粉彩合作伙伴SDK创建发票问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了粉彩合作伙伴SDK创建发票问题相关的知识,希望对你有一定的参考价值。
我正在尝试使用来自C#应用程序的SDK在Pastel Partner中生成发票。我已经按照文档进行了发球,但我仍然获得了17的返回代码(无效的客户账户代码)。我已经确认客户存在。
public string GenerateInvoiceDocument(Order order)
{
var result = _sdk.SetDataPath($"{_directory}{_company}");
if (result == "0") _sdk.OpenDocumentFiles();
var customer = GetCustomer(order.CustomerNumber);
if (result == "0") {
var header = "|||OIL004|05/03/2017||N|0|Message no.1|Message no.2|Message no.3|Delivery no.1|Delivery no.2|Delivery no.3|Delivery no.4|Delivery no.5||00||05/03/1999|011-7402156|Johnny|011-7402157|1";
result =_sdk.DefineDocumentHeader(header);
}
for (var x = 0; x < order.InventoryCode.Count; x++)
{
if (result == "0")
{
var customerPrice = GetCustomerPrice(customer.Number, order.InventoryCode[x]);
result = _sdk.DefineDocumentLine(
GenerateDocumentLine(
0,
Convert.ToDouble(order.Quantity[x]),
customerPrice.Price[x],
customerPrice.IncPrice[x],
"",
customer.TaxCode.ToString().PastelZeroPad(2),
"",
"",
customerPrice.ItemCode,
order.InventoryCode[x],
"4",
"002",
""));
}
}
result = _sdk.ImportDocument(3);
_sdk.CloseDocumentFiles();
return result;
}
答案
看起来像Pastel的一些错误行为,解决方案是通过事先做它们从Pastel流中删除任何计算。
public string GenerateInvoiceDocument(Order order)
{
var customer = GetCustomer(order.CustomerNumber);
var header = GenerateCustomerDocumentHeader(customer, DateTime.Now.AddYears(-1), order.Number, "", "", "", "", "", "", "", "", "", "", DateTime.Now.AddYears(-1), "", "", "", 1);
var lines = new List<string>();
for (var x = 0; x < order.InventoryCode.Count; x++)
{
var customerPrice = GetCustomerPrice(order.CustomerNumber, order.InventoryCode[x]);
var newLine = GenerateDocumentLine(customerPrice.Price[x], (double)order.Quantity[x], customerPrice.Price[x], customerPrice.IncPrice[x], "0", customer.TaxCode.ToString(), "", "0", order.InventoryCode[x], order.InventoryDescription[x], "4", "001", "");
lines.Add(newLine);
}
var result = _sdk.SetDataPath($"{_directory}{_company}");
_sdk.OpenDocumentFiles();
result = _sdk.DefineDocumentHeader(header, true);
foreach (var line in lines)
{
result = _sdk.DefineDocumentLine(line);
}
result = _sdk.ImportDocument(3, 0);
_sdk.CloseDocumentFiles();
return result;
}
以上是关于粉彩合作伙伴SDK创建发票问题的主要内容,如果未能解决你的问题,请参考以下文章
create_with_paypal 节点 sdk PayPal 中的发票编号
使用 QuickBooks Online (QBO) Intuit 合作伙伴平台 (IPP) DevKit 查询所有未结余额发票