this is the code i have
- Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon(JiwaSqlServer, JiwaDatabaseName, JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, JiwaAdmin, JiwaPassword);
var salesOrder = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder>(null);
salesOrder.CreateNew(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes.e_NewSalesOrder, (debtorseed ?? quote.billing_account_id), debtorseed != null);
salesOrder.Reference = quote.id;
salesOrder.OrderNo = quote.description;
salesOrder.Save();
var iID = salesOrder.InvoiceID;
salesOrder = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder>(null);
salesOrder .Read(iID);
var trc = new TaxRateCollection(TaxRates.TaxRateTypes.GSTAdjustmentsout);
var sol = new SalesOrderLine(trc)
{
HistoryID = soh.RecID,
InventoryID = GetJiwaInvetoryID(product.name, jiwaConnection),
PartNo = product.name,
Description = product.description,
InvoicePrice = Convert.ToDecimal(product.total_amount),
QuantityOrdered = Convert.ToDecimal(product.quantity)
};
salesOrder.SalesOrderLines.Add(sol);
salesOrder.Save(); //<--- Here i get Error
The error that I recieve is :
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in JiwaSales.dll
Additional information: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_SO_Lines_TaxID". The conflict occurred in database "GeneticsAus_Jiwa1", table "dbo.TX_Main", column 'TaxID'.
I assume I am doing something not right with the new TaxRateCollection.
Any help will be appreciated.
Drew


