Search the GP Tables
Search by TABLE NAME
Search by FIELD NAME
These are our SOP scripts. All of our scripts for Dynamics GP can be found here
DynDeveloper.com

DynDeveloper.com

Sign Up Now!Log In
kv 2/18/2016 5:20:55 AM

Gross Amount missing from eConnect submission

Me again!  I have an issue where my eConnect code is not updating the receivings Tax Summary correctly.  I have attached some images of what the client is expecting, and what my submission is creating

 

|And here is the XML that I submitted.  I am almost there, I am just overlooking something!

 

images.zip

Within this images.zip file, image013.jpg is what they are expecting.  The problem I am getting is that  the TAX Id window has not populated the Gross figure and the distribution has produced an unbalanced document.  Image007 & 008 are what my code are currently producing

 

So I need to figure out what to add to my code in order to get these populated.

 

<?xml version="1.0" encoding="utf-8"?>
  <POPReceivingsType>
    <eConnectProcessInfo xsi:nil="true" />
    <taRequesterTrxDisabler_Items xsi:nil="true" />
    <taUpdateCreateItemRcd xsi:nil="true" />
    <taUpdateCreateVendorRcd xsi:nil="true" />
    <taCreateVendorAddress_Items xsi:nil="true" />
    <taPopRcptLotInsert_Items xsi:nil="true" />
    <taPopRcptSerialInsert_Items xsi:nil="true" />
    <taPopRcptLineInsert_Items>
      <taPopRcptLineInsert>
        <POPTYPE>3</POPTYPE>
        <POPRCTNM>R000065</POPRCTNM>
        <ITEMNMBR>Laynards x 30</ITEMNMBR>
        <ITEMDESC>Laynards x 30</ITEMDESC>
        <VENDORID>ARJ001</VENDORID>
        <RCPTLNNM>1</RCPTLNNM>
        <InventoryAccount>9998-00</InventoryAccount>
        <UOFM>Each</UOFM>
        <UNITCOST>43.20</UNITCOST>
        <EXTDCOST>43.20</EXTDCOST>
        <NONINVEN>1</NONINVEN>
        <QTYSHPPD>1</QTYSHPPD>
        <QTYINVCD>1</QTYINVCD>
        <Purchase_IV_Item_Taxable>3</Purchase_IV_Item_Taxable>
        <Purchase_Site_Tax_Schedu>PSTD</Purchase_Site_Tax_Schedu>
        <LOCNCODE>NO PROJECT</LOCNCODE>
        <receiptdate>01/02/2016</receiptdate>
        <CURNCYID>GBP</CURNCYID>
        <ProjNum>DEVLIV1SC</ProjNum>
        <CostCatID>SC04</CostCatID>
      </taPopRcptLineInsert>
    </taPopRcptLineInsert_Items>
    <taPopRcptMultiBin_Items xsi:nil="true" />
    <taPopRcptLineTaxInsert_Items>
      <taPopRcptLineTaxInsert>
        <VENDORID>ARJ001</VENDORID>
        <POPRCTNM>R000065</POPRCTNM>
        <TAXDTLID>PSTD</TAXDTLID>
        <TAXTYPE>0</TAXTYPE>
        <ACTNUMST>1226-00</ACTNUMST>
        <TAXAMNT>8.64</TAXAMNT>
        <RCPTLNNM>1</RCPTLNNM>
      </taPopRcptLineTaxInsert>
    </taPopRcptLineTaxInsert_Items>
    <taPopRctUserDefined xsi:nil="true" />
    <taPopDistribution_Items xsi:nil="true" />
    <taAnalyticsDistribution_Items xsi:nil="true" />
    <taPopRcptHdrInsert>
      <POPRCTNM>R000065</POPRCTNM>
      <POPTYPE>3</POPTYPE>
      <VNDDOCNM>27300</VNDDOCNM>
      <receiptdate>01/02/2016</receiptdate>
      <BACHNUMB>16022016025926</BACHNUMB>
      <VENDORID>ARJ001</VENDORID>
      <TAXAMNT>8.64</TAXAMNT>
      <AUTOCOST>1</AUTOCOST>
      <TAXSCHID>PSTD</TAXSCHID>
      <USINGHEADERLEVELTAXES>2</USINGHEADERLEVELTAXES>
      <CURNCYID>GBP</CURNCYID>
    </taPopRcptHdrInsert>
    <taMdaUpdate_Items xsi:nil="true" />
  </POPReceivingsType>
</eConnect>

 

POPReceivingsType oPOPReceivingsType = new POPReceivingsType();
                taPopRcptHdrInsert invoiceHeader = new taPopRcptHdrInsert();
                List<taPopRcptLineInsert_ItemsTaPopRcptLineInsert> ecInvoiceLines = new List<taPopRcptLineInsert_ItemsTaPopRcptLineInsert>();
                GetNextDocNumbers transNumber = new GetNextDocNumbers();
 
                 
                Int16 lineNumber = 1, lineIndex = 0;
                String xmlFilename = "XML\\posted" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".xml";
                Decimal totalTax = 0;
 
                //Get Business Unit/Supplier Details
                c2sBUnit.BU_ID = Convert.ToInt32(invoice.BU_ID);
                c2sSupplier.Supplier_ID = invoice.Supplier_ID;
 
                c2sBUnit.Fetch();
                c2sSupplier.Fetch();
 
 
 
                //build connection string to dynamics database
                dynamicsConnStr = ConfigurationManager.ConnectionStrings["eConnectDB"].ConnectionString.Replace("{DBNAME}", c2sBUnit.BU_DBName);
                Console.WriteLine(dynamicsConnStr);
 
                invoice.InvoiceNumber = transNumber.GetNextPOPReceiptNumber(IncrementDecrement.Increment, dynamicsConnStr);
                String batchNumberPlaceHolder = DateTime.Now.ToString("ddMMyyyyhhmmss");
                String vendorReference = c2sSupplier.Supplier_Acct.Substring(c2sSupplier.Supplier_Acct.IndexOf('-') + 1);
 
 
                Console.WriteLine(invoice.SupplierDocumentNumber);
 
 
                //Invoice Header Details
                invoiceHeader.POPRCTNM = invoice.InvoiceNumber;    //receipt number placeholder
                invoiceHeader.POPTYPE = 3;                                  //Shipping/invoice
                invoiceHeader.VNDDOCNM = invoice.SupplierDocumentNumber;             //invoice number
                invoiceHeader.CURNCYID = "GBP";                             //currency defaults to GBP
                invoiceHeader.TAXSCHID = invoice.TaxSchedule;               //Tax Code
                invoiceHeader.receiptdate = invoice.InvoiceDate.ToString("dd/MM/yyyy"); // invoice.InvoiceDate.ToString("dd/MM/yyyy");
                invoiceHeader.USINGHEADERLEVELTAXES = 2;
                invoiceHeader.AUTOCOST = 1;
                invoiceHeader.BACHNUMB = batchNumberPlaceHolder;
                invoiceHeader.VENDORID = vendorReference;
                //Invoice lines
                taPopRcptLineTaxInsert_ItemsTaPopRcptLineTaxInsert[] invoiceLineTax = new taPopRcptLineTaxInsert_ItemsTaPopRcptLineTaxInsert[invoice.InvoiceLines.Count];
 
                oPOPReceivingsType.taPopRcptLineInsert_Items = new taPopRcptLineInsert_ItemsTaPopRcptLineInsert[invoice.InvoiceLines.Count];
                Decimal totalInvoiceTax = 0;
 
                foreach (OutgoingInvoiceLine line in invoice.InvoiceLines)
                {
                    taPopRcptLineTaxInsert_ItemsTaPopRcptLineTaxInsert invoiceTax = new taPopRcptLineTaxInsert_ItemsTaPopRcptLineTaxInsert();
                    taPopRcptLineInsert_ItemsTaPopRcptLineInsert ecLine = new taPopRcptLineInsert_ItemsTaPopRcptLineInsert();
                    NominalIDs c2sNominal = new NominalIDs(ConfigurationManager.ConnectionStrings["DestinationDB"].ConnectionString);
 
                    ecLine.POPRCTNM = invoice.SupplierDocumentNumber;
                    ecLine.VENDORID = vendorReference;
                    ecLine.CURNCYID = "GBP";
                    ecLine.ITEMNMBR = line.ItemDescription;
                    ecLine.ITEMDESC = line.ItemDescription;
                    ecLine.UOFM = "Each";
                    ecLine.QTYINVCD = line.Quantity;
                    ecLine.QTYSHPPD = line.Quantity;
                    ecLine.UNITCOST = Decimal.Parse(line.UnitCost.ToString());
                    ecLine.EXTDCOST = Decimal.Parse(Convert.ToString(line.UnitCost * line.Quantity));
                    ecLine.Purchase_IV_Item_Taxable = 3;
                    ecLine.EXTDCOSTSpecified = true;
                    ecLine.UNITCOSTSpecified = true;
                    ecLine.NONINVEN = 1;
                    ecLine.receiptdate = "01/02/2016";
                     
                    ecLine.RCPTLNNM = lineNumber;
                    ecLine.POPTYPE = 3;
                    //ecLine.INVINDX = 315;
                    ecLine.InventoryAccount = "9998-00"; //line.NominalCode;
                    ecLine.ProjNum = line.ProjectNumber;
                    ecLine.CostCatID = line.CostCategory;
                    ecLine.LOCNCODE = "NO PROJECT"//default Location Code
                     
 
                    ecLine.Purchase_Site_Tax_Schedu = line.TaxCode;
                     
 
                    oPOPReceivingsType.taPopRcptLineInsert_Items[lineIndex] = ecLine;
 
                    totalTax = line.TaxCost;
 
                    //Invoice Tax
                    c2sNominal.Nominal_BUID = c2sBUnit.BU_ID;
                    c2sNominal.Nominal_Code = line.NominalCode;
                    c2sNominal.Fetch();
 
 
                    invoiceTax.TAXTYPE = 0;
                    invoiceTax.POPRCTNM = invoice.SupplierDocumentNumber;
                    invoiceTax.VENDORID = vendorReference;
                    invoiceTax.TAXDTLID = invoice.TaxDetail;
                    invoiceTax.TAXAMNT = totalTax;
                    invoiceTax.MSCTXAMT = Decimal.Parse("0.00");
                    invoiceTax.FRTTXAMT = Decimal.Parse("0.00");
                     
                    //invoiceTax.ACTINDX = c2sNominal.ACCTINDX;
                    invoiceTax.ACTNUMST = "1226-00";//line.NominalCode;
                    invoiceTax.RCPTLNNM = lineNumber;
                     
                    invoiceLineTax[lineIndex] = invoiceTax;
                    totalInvoiceTax += totalTax;
 
                    lineIndex++;
                    lineNumber++;
                }
 
                invoiceHeader.TAXAMNT = totalInvoiceTax;
                oPOPReceivingsType.taPopRcptHdrInsert = invoiceHeader;
 
                oPOPReceivingsType.taPopRcptLineTaxInsert_Items = invoiceLineTax;
 
                // Create an eConnect XML document object and populate it
                // with the POPReceivingsType schema object
                eConnectType eConnect = new eConnectType();
 
                eConnect.POPReceivingsType = new POPReceivingsType[1];
                eConnect.POPReceivingsType[0] = oPOPReceivingsType;
                // Create a file to hold the serialized eConnect XML document
                FileStream fs = new FileStream(xmlFilename, FileMode.Create);
                XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding());
 
                // Serialize the eConnect document object to the file using the XmlTextWriter.
                XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
                serializer.Serialize(writer, eConnect);
                writer.Close();
 
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(xmlFilename);
 
                //// Create an XML string from the document object
                invoice.GeneratedXML = xmldoc.OuterXml;

Version: GP 2010
Section: Dynamics GP, 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