clewis 6/18/2010 10:31:28 AM

Error Number 799: Tax Table detail does not equal the tax amount

I hope someone can help with this but I can't seem to save an Invoice in Sales Order.  I am using GP v10.  We also have AvaTax installed.

The code I have is to create the XML string is below.  What am I missing?

Thanks

Christel 

private string eConnectOrderXml(short isUpdate)

{

int orderItemCount = this.Items.Count;

short docType = this.DocType;

string docID = (docType == 3) ? "STDINV" : "STDRTN";

// Create a datetime format object

DateTimeFormatInfo dateFormat = new CultureInfo("en-US").DateTimeFormat;

// Create an array that can hold two taSopLineIvcInsert_ItemsTaSopLineIvcInsert objects

taSopLineIvcInsert_ItemsTaSopLineIvcInsert[] LineItems = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[orderItemCount];

 

for (int i = 0; i < orderItemCount; i++)

{

// Create a taSopLineIvcInsert_ItemsTaSopLineIvcInsert object and populate its fields

taSopLineIvcInsert_ItemsTaSopLineIvcInsert salesLine = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();OrderItem item = this.Items[i];

salesLine.ADDRESS1 = ReadProperty(Address1Property);

salesLine.ADDRESS2 = ReadProperty(Address2Property);

salesLine.ADDRESS3 = ReadProperty(Address3Property);

salesLine.CITY = ReadProperty(CityProperty);

salesLine.STATE = ReadProperty(StateProperty);

salesLine.ZIPCODE = ReadProperty(ZipProperty);

salesLine.COUNTRY = ReadProperty(CountryProperty);

salesLine.CNTCPRSN = ReadProperty(ShipToContactProperty);

salesLine.ShipToName = ReadProperty(ShipToNameProperty);

salesLine.CUSTNMBR = ReadProperty(CustomerIdProperty).ToString();

salesLine.SOPNUMBE = ReadProperty(OrderIdProperty).ToString();

salesLine.CITY = ReadProperty(CityProperty);

salesLine.SOPTYPE = docType;

salesLine.DOCID = docID;

salesLine.QUANTITY = item.Quantity;

if (docType == 4)

salesLine.QTYRTRND = item.Quantity;

salesLine.ITEMNMBR = item.Code;

salesLine.ITEMDESC = item.Description;

salesLine.UNITPRCE = item.UnitPrice;

salesLine.XTNDPRCE = item.ExtendedPrice;

salesLine.LOCNCODE = ReadProperty(LocationProperty);

salesLine.DOCDATE = ReadProperty(InvoiceDateProperty).ToString();

salesLine.ReqShipDate = ReadProperty(DueDateProperty).ToShortDateString();

salesLine.ACTLSHIP = ReadProperty(DueDateProperty).ToShortDateString();

salesLine.FUFILDAT = ReadProperty(DueDateProperty).ToShortDateString();

salesLine.TAXSCHID = ReadProperty(TaxScheduleProperty);

salesLine.LNITMSEQ = i;

salesLine.UpdateIfExists = isUpdate;

// Add the SOP line item object to the array

LineItems[i] = salesLine;

}

//Tax

taSopLineIvcTaxInsert_ItemsTaSopLineIvcTaxInsert[] LineTaxes = new taSopLineIvcTaxInsert_ItemsTaSopLineIvcTaxInsert[1];taSopLineIvcTaxInsert_ItemsTaSopLineIvcTaxInsert LineTax = new taSopLineIvcTaxInsert_ItemsTaSopLineIvcTaxInsert();

LineTax.SOPTYPE = docType;

LineTax.SOPNUMBE = ReadProperty(OrderIdProperty).ToString();

LineTax.CUSTNMBR = ReadProperty(CustomerIdProperty).ToString();

LineTax.LNITMSEQ = 0;

LineTax.TXDTOTTX = ReadProperty(TaxProperty);

LineTax.TDTTXSLS = ReadProperty(TaxProperty);

LineTax.TDTTXSLSSpecified =
true;LineTax.TXDTOTTXSpecified = true;

LineTax.TAXDTLID = ReadProperty(TaxScheduleProperty);

LineTaxes[0] = LineTax;

 

// Create a taSopHdrIvcInsert object and populate its fields

taSopHdrIvcInsert salesHdr = new taSopHdrIvcInsert();

salesHdr.SOPNUMBE = ReadProperty(OrderIdProperty);

salesHdr.SOPTYPE = docType;

salesHdr.DOCID = docID;

salesHdr.BACHNUMB = ReadProperty(BatchIDProperty);

salesHdr.LOCNCODE = ReadProperty(LocationProperty);

salesHdr.DOCDATE = ReadProperty(InvoiceDateProperty).ToShortDateString();

if (docType == 3)

{ salesHdr.ORDRDATE = ReadProperty(OrderDateProperty).ToShortDateString(); }

salesHdr.CUSTNMBR = ReadProperty(CustomerIdProperty).ToString();

salesHdr.PRSTADCD = "PRIMARY"; // ReadProperty(ShipToAddressCodeProperty);

salesHdr.ShipToName = ReadProperty(ShipToNameProperty);

salesHdr.ADDRESS1 = ReadProperty(Address1Property);

salesHdr.ADDRESS2 = ReadProperty(Address2Property);

salesHdr.ADDRESS3 = ReadProperty(Address3Property);

salesHdr.CNTCPRSN = ReadProperty(ShipToContactProperty);

salesHdr.CITY = ReadProperty(CityProperty);

salesHdr.STATE = ReadProperty(StateProperty);

salesHdr.ZIPCODE = ReadProperty(ZipProperty);

salesHdr.COUNTRY = ReadProperty(CountryProperty);

salesHdr.SUBTOTAL = ReadProperty(SubTotalProperty);

salesHdr.DOCAMNT = ReadProperty(TotalProperty);

salesHdr.TAXAMNT = ReadProperty(TaxProperty);

salesHdr.FRTTXAMT = 0;

salesHdr.MSCTXAMT = 0;

salesHdr.TRDISAMT = ReadProperty(DiscountProperty);

salesHdr.COMMENT_1 = ReadProperty(NotesProperty);

salesHdr.USER2ENT = Csla.
ApplicationContext.User.Identity.Name;

salesHdr.ReqShipDate = ReadProperty(DueDateProperty).ToShortDateString();

salesHdr.TAXSCHID = ReadProperty(TaxScheduleProperty);

salesHdr.USINGHEADERLEVELTAXES = 1;

salesHdr.CREATETAXES = 0;

//salesHdr.CREATEDIST = 1;

salesHdr.UpdateExisting = isUpdate;

 

taSopUpdateCreateProcessHold ProcessHold = new taSopUpdateCreateProcessHold();

//credit orders shouldn't be put on hold

if (!ReadProperty(isNewCreditOrderProperty))

{

if (isUpdate == 0) //inserting a record

{

ProcessHold.SOPTYPE = docType;

ProcessHold.SOPNUMBE = ReadProperty(OrderIdProperty);

ProcessHold.PRCHLDID = "Hold"; //the id for the process hold

ProcessHold.POSTPHOL = 1;

ProcessHold.DELETE1 = 0; //add the hold

ProcessHold.UpdateIfExistsMaster = 0;

ProcessHold.UpdateSopIfExists = 1;

}

}

 

taSopUserDefined UserDef = new taSopUserDefined();

UserDef.SOPNUMBE = ReadProperty(OrderIdProperty);

UserDef.SOPTYPE = docType;

UserDef.USERDEF2 = ReadProperty(ReferenceProperty);

UserDef.USRDEF03 = ReadProperty(OrderTypeProperty).ToString();

 

// Create a eConnect SOPTransactionType schema object

SOPTransactionType salesOrder = new SOPTransactionType();

 

// Populate the schema object with the SOP header and SOP line item objects

salesOrder.taSopLineIvcInsert_Items = LineItems;

salesOrder.taSopLineIvcTaxInsert_Items = LineTaxes;

salesOrder.taSopUserDefined = UserDef;

salesOrder.taSopHdrIvcInsert = salesHdr;

salesOrder.taSopHdrIvcInsert.UpdateExisting = isUpdate;

if (isUpdate == 0 && !ReadProperty(isNewCreditOrderProperty)) //inserting a record that isn't a Credit Order

salesOrder.taSopUpdateCreateProcessHold = ProcessHold;

 

 

 

// Create an array that holds SOPTransactionType objects

// Populate the array with the SOPTransactionType schema object

SOPTransactionType[] MySopTransactionType = { salesOrder };

// Create an eConnect XML document object and populate it

// with the SOPTransactionType schema object

eConnectType eConnect = new eConnectType();

eConnect.SOPTransactionType = MySopTransactionType;

return Utility.SerializeToString(eConnect);

}

Version: Unknown or N/A
Section: eConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3