简体   繁体   English

使用 Sage50 Canada 2019 的示例 sdk 代码创建销售发票时出现异常错误

[英]Getting exception error while creating sale invoice using sample sdk code of Sage50 Canada 2019

Getting the error: SimplySDK.SimplyErrorMessageException: 'Your chequing account is overdrawn. See the Advice topic "Managing Your Cash Flow" for suggestions.'收到错误: SimplySDK.SimplyErrorMessageException: 'Your chequing account is overdrawn. See the Advice topic "Managing Your Cash Flow" for suggestions.' SimplySDK.SimplyErrorMessageException: 'Your chequing account is overdrawn. See the Advice topic "Managing Your Cash Flow" for suggestions.' I am using the following SDK sample code for invoice create:我正在使用以下 SDK 示例代码来创建发票:

// Sales Invoice Example
SalesJournal salJourn = SDKInstanceManager.Instance.OpenSalesJournal();

// Cash
salJourn.SelectTransType(0);  // invoice
salJourn.InvoiceNumber = orderNumber;
salJourn.SelectAPARLedger("harish");
salJourn.SelectPaidByType("Cash");
salJourn.SelectPaidDepositAccount(MakeAccountNumber(1060).ToString());
salJourn.SetItemNumber("CR-10", 1);
salJourn.SetQuantity(1, 1);
salJourn.SetUnit("Hour", 1);
salJourn.SetDescription("Computer Repair - No Warranty", 1);
salJourn.SetPrice(90.00, 1);
salJourn.SetLineAmount(90.00, 1);
salJourn.SetLineAccount(MakeAccountNumber(SDK_ACCTINVREV).ToString(), 1);

salJourn.SetDescription("Item #2", 2);
salJourn.SetQuantity(2, 2);
salJourn.SetUnit("Each", 2);
salJourn.SetPrice(0.99, 2);

salJourn.SetLineAccount(MakeAccountNumber(SDK_ACCTINVREV).ToString(), 2);
// allocate projects
ProjectAllocation projAlloc = salJourn.AllocateLine(2);
projAlloc.SetProject("Sage Project", 1);
try
{
   projAlloc.SetPercent(50.0, 1);
}
catch (SimplyNoAccessException)
{
   // can't allocate by percent, allocation by amount
   projAlloc.SetAmount(0.99, 1);
}
projAlloc.Save();
salJourn.SetComment("Paid by cash");
var salecreateRes = salJourn.Post();
if (salecreateRes)
{
    Console.WriteLine("Sales invoice 'SJ 1' posting succeeded");
}
else
{
     Console.WriteLine("Sales invoice 'SJ 1' posting failed");
}

Don't understand why its throwing chequing account error on creating a simple invoice.不明白为什么在创建简单发票时会抛出支票账户错误。 I am using this SDK with a trial software with single account is that could be the reason for this?我正在使用此 SDK 和单个帐户的试用软件,这可能是这个原因吗?

well i have replaced the account in this line salJourn.SelectPaidDepositAccount(MakeAccountNumber(1060).ToString())好吧,我已经替换了这一行中的帐户salJourn.SelectPaidDepositAccount(MakeAccountNumber(1060).ToString())

changed 1060 to 1020 which is an cash account ("Cash to be deposited") after that i am getting success message.将 1060 更改为 1020,这是一个现金账户(“要存入的现金”),之后我收到了成功消息。 and removed the following code, i don't need that并删除了以下代码,我不需要

// allocate projects
ProjectAllocation projAlloc = salJourn.AllocateLine(2);
projAlloc.SetProject("Sage Project", 1);
try
{
   projAlloc.SetPercent(50.0, 1);
}
catch (SimplyNoAccessException)
{
   // can't allocate by percent, allocation by amount
   projAlloc.SetAmount(0.99, 1);
}
projAlloc.Save();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 504 - 连接 sage50 云帐户时出现超时错误 - 504 - Time out error while connect sage50 cloud accounts Sage 50 UK V26.2.136.0 - 如何使用 sdk 代码更新发票的分类帐,以便发票可以出现在客户的列表活动中 - Sage 50 UK V26.2.136.0 - How to update ledger of an invoice with sdk code so that invoice could appear on the customer's list activity Sage 50 Accounting SDK创建包含许多项目的销售报价 - Sage 50 Accounting SDK Creating Sales Quotes with many Items 在 VS 2019 中创建 Api 控制器时出现代码生成错误 - Code Generation error while creating Api Controller in VS 2019 创建付款发票时,Sage One API返回500内部服务错误 - Sage One API returning 500 Internal Service Error when creating Payment Invoice 获取异常“非零金额必须四舍五入为整数”Sage 50 C# WPF? - Getting exception 'Non-zero amount must be rounded to whole currency' Sage 50 C# WPF? 使用 Microsoft Graph v1.0 SDK 创建 OnlineMeeting 时出现 Forbidden 403 错误 - Getting Forbidden 403 error while creating OnlineMeeting using Microsoft Graph v1.0 SDK 应用程序通过ODBC访问Sage Line 50数据时出错 - Error with app accessing Sage Line 50 data via ODBC SDK中的样本错误 - Sample error in sdk 使用 linq 查询创建列表时出现 IGrouping 错误 - Getting IGrouping error while creating a list using linq query
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM