Neerman 9/11/2008 2:13:29 PM

Auto-generate Voucher Number and taPMTransactionInsert

HI, I have used the taPMTransactionInsert schema eConnect9.0 to insert new Invoice PM to Dynamic GP9.0 using ASP.NET 2.0 successfully. It's working fine. I could able to see the newly inserted invoice in PM10000 and PM00400 tables. I have used the next voucher number value from NTVCHNUM field in PM40100 table to add in the header.VCHNUMWK so that I do not have to auto-generate the voucher number everytime I add new invoice from the webform into the GP.

My problem arise when multiple user try to add new invoice. Since all the concurrent users use the same Next Voucher Number in thier webform on Page load, it throws an error when submitting as only one user could able to enter the invoice and rest user acknowledge this as 'voucher already exist". So, is there any way that the same model works in the multiple user. What happens if I do not provide hearder.VCHNUMWK and does the GP automatically append the next voucher number from the PM00100 and update in the PM10000 table. Please help me. Thanks

 

PMTransactionType pmTrxType = new PMTransactionType();

taPMTransactionInsert header = new taPMTransactionInsert();

taPMDistribution_ItemsTaPMDistribution[] dists = new taPMDistribution_ItemsTaPMDistribution[2];

 

                header.VCHNUMWK = "VCH000111222";

                header.DOCTYPE = 1;

                header.TRXDSCRN = "My trx comment";

                header.BACHNUMB = "ECONNECT";

                header.DOCDATE = "04/12/2017";

                header.VENDORID = "ADVANCED0001";

                header.DOCNUMBR = "12345";

                header.PRCHAMNT = 50.00M;

                header.CHRGAMNT = 50.00M;

                header.DOCAMNT = 50.00M;

                header.CREATEDIST = 0;

 

taPMDistribution_ItemsTaPMDistribution payablesDist = new taPMDistribution_ItemsTaPMDistribution();

                payablesDist.VCHRNMBR = "VCH000111222";

                payablesDist.DOCTYPE = 1;

                payablesDist.VENDORID = "ADVANCED0001";

                payablesDist.ACTNUMST = "000-2100-00";

                payablesDist.DISTTYPE = 2;

                payablesDist.CRDTAMNT = 50.00M;

 

                dists[0] = payablesDist;

 

taPMDistribution_ItemsTaPMDistribution purchDist = new taPMDistribution_ItemsTaPMDistribution();

                purchDist.VCHRNMBR = "VCH000111222";

                purchDist.DOCTYPE = 1;

                purchDist.VENDORID = "ADVANCED0001";

                purchDist.ACTNUMST = "500-6150-00";

                purchDist.DISTTYPE = 6;

                purchDist.DEBITAMT = 50.00M;

 

                dists[1] = purchDist;

 

                pmTrxType.taPMTransactionInsert = header;

                pmTrxType.taPMDistribution_Items = dists;

 

                eConnectType eConnect = new eConnectType();

                PMTransactionType[] myTrans = { pmTrxType };

                eConnect.PMTransactionType = myTrans;

 

                // serialize to a memory stream.

                XmlSerializer serializer = new XmlSerializer(eConnect.GetType());

                MemoryStream memStream = new MemoryStream();

                serializer.Serialize(memStream, eConnect);

                memStream.Position = 0;

 

                // read from the memory stream to a string variable to pass to the eConnect API.

                string xml = "";

                XmlTextReader xmlreader = new XmlTextReader(memStream);

                while (xmlreader.Read())

                    xml = xml + xmlreader.ReadOuterXml();

                memStream.Close();

 

                eConnectMethods eConCall = new eConnectMethods();

                string cnString = @"data source=.\GP10;integrated security=SSPI;initial catalog=TWO";

                bool result;

 

                result = eConCall.eConnect_EntryPoint(cnString, EnumTypes.ConnectionStringType.SqlClient, xml, EnumTypes.SchemaValidationType.None, "");

                MessageBox.Show("Done");

 

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