我正在尝试从 NetSuite 的发票中提取剩余金额数据。
问题是数据非常不一致。
首先,他们不提供发票货币的剩余金额。看起来他们只提供美元。所以我尝试用汇率转换成目标货币,它在 75% 的时间里都能正常工作。
换算:外币到期金额=API响应金额/汇率
示例响应 1:
{
Invoices: [
{
amountRemaining: 6096.9,
currency: 2, <-- (GBP)
exchangeRate: 1.354865,
fxAmount: 4500,
status: open,
customFieldList: { },
xmlns:platform_common: urn:common_2017_2.platform.webservices.netsuite.com,
custom_segments: { },
custom_fields: { }
}
],
}
在样本 2 中,汇率必须在 1.3 左右,但被错误地设置为 0.76。但是,好在剩余金额是根据汇率计算的,因此使用上述公式进行转换仍然会给我正确的应付金额。
示例响应 2:
{
Invoices: [
{
amountRemaining: 58538.49,
currency: 2, <-- (GBP)
exchangeRate: 0.76009212,
fxAmount: 77015,
status: open,
customFieldList: { },
xmlns:platform_common: urn:common_2017_2.platform.webservices.netsuite.com,
custom_segments: { },
custom_fields: { }
}
],
}
但是,在样本 3 中,汇率被错误地设置为 1。应付的金额应该是 21523.32。但是,大约是 30000。不知道如何计算此信息。
示例响应 3:
{
Invoices: [
{
amountRemaining: 30132.648,
currency: 2, <-- (GBP)
exchangeRate: 1,
fxAmount: 21523.32,
status: open,
customFieldList: { },
xmlns:platform_common: urn:common_2017_2.platform.webservices.netsuite.com,
custom_segments: { },
custom_fields: { }
}
],
}
应付金额如何计算?我是否查看了错误的转换字段?
提前致谢!