简体   繁体   English

使用Dynamics GP中的数组的GLTransaction的eConnect XML文件详细信息

[英]eConnect XML file detail for GLTransaction using arrays in Dynamics GP

I am looking to enter a single gltransaction in Dynamics GP using econnect. 我希望使用econnect在Dynamics GP中输入一个gltransaction。

My code below does generate an XML file. 我的下面代码确实生成了一个XML文件。 However, it places three identical GL line items for $25 dollars each in the XML file leaving an unbalanced entry. 但是,它在XML文件中放置了三个相同的GL订单项,每个价格为25美元,从而导致条目不平衡。

What I would like it to do instead is place a $75 debit, a $50 credit and a $25 credit per the code below. 我希望它做的是按照下面的代码放置75美元的借方,50美元的贷方和25美元的贷方。 Can you help me troubleshoot what I have done wrong specifically so that I do not have three $25 items coming into the file? 您能帮我解决我做错的具体事情,以便使我没有3个25美元的物品进入文件吗?

Thanks in advance. 提前致谢。

string DTime = DateTime.Today.ToString();
string CurrentDatabase = "OCITE";
string NextJEno = GetNextJournal.GetNextJournalEntry(CurrentDatabase);

eConnectType eConnect = new eConnectType();

GLTransactionType myGLTrxType = new GLTransactionType();
taGLTransactionHeaderInsert myGLHeader = new taGLTransactionHeaderInsert();
taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert [] myGLDetail = new taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert[3];
taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert myGLDetailLine = new taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert();

myGLDetailLine.BACHNUMB = CurrentDatabase;
myGLDetailLine.JRNENTRY = Int32.Parse(NextJEno);
myGLDetailLine.CRDTAMNT = (decimal)0;
myGLDetailLine.DEBITAMT = (decimal)75.00;
myGLDetailLine.ACTNUMST = "1000-0000-C";

myGLDetail[0] = myGLDetailLine;

myGLDetailLine.BACHNUMB = CurrentDatabase;
myGLDetailLine.JRNENTRY = Int32.Parse(NextJEno);
myGLDetailLine.CRDTAMNT = (decimal)50;
myGLDetailLine.DEBITAMT = (decimal)0;
myGLDetailLine.ACTNUMST = "6560-0000-C";

myGLDetail[1] = myGLDetailLine;

myGLDetailLine.BACHNUMB = CurrentDatabase;
myGLDetailLine.JRNENTRY = Int32.Parse(NextJEno);
myGLDetailLine.CRDTAMNT = (decimal)25;
myGLDetailLine.DEBITAMT = (decimal)0;
myGLDetailLine.ACTNUMST = "5120-0000-C";

myGLDetail[2] = myGLDetailLine;

myGLHeader.BACHNUMB = CurrentDatabase; 
myGLHeader.JRNENTRY = Int32.Parse(NextJEno);
myGLHeader.REFRENCE = "REFRENCE";
myGLHeader.TRXDATE = DTime;
myGLHeader.TRXTYPE = 0;

myGLTrxType.taGLTransactionLineInsert_Items = myGLDetail;
myGLTrxType.taGLTransactionHeaderInsert = myGLHeader;
GLTransactionType[] myGLType = { myGLTrxType };
eConnect.GLTransactionType = myGLType;

FileStream streamFile = new FileStream(filename, FileMode.Create);
XmlTextWriter Xmlwriter = new XmlTextWriter(streamFile, new UTF8Encoding());

XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
serializer.Serialize(Xmlwriter, eConnect);
Xmlwriter.Close();

XML file XML文件

<eConnect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GLTransactionType>
<eConnectProcessInfo xsi:nil="true" />
<taRequesterTrxDisabler_Items xsi:nil="true" />
<taGLTransactionLineInsert_Items>
<taGLTransactionLineInsert>
<BACHNUMB>OCITE</BACHNUMB>
<JRNENTRY>1750</JRNENTRY>
<CRDTAMNT>25</CRDTAMNT>
<DEBITAMT>0</DEBITAMT>
<ACTNUMST>5120-0000-C</ACTNUMST>
</taGLTransactionLineInsert>
<taGLTransactionLineInsert>
<BACHNUMB>OCITE</BACHNUMB>
<JRNENTRY>1750</JRNENTRY>
<CRDTAMNT>25</CRDTAMNT>
<DEBITAMT>0</DEBITAMT>
<ACTNUMST>5120-0000-C</ACTNUMST>
</taGLTransactionLineInsert>
<taGLTransactionLineInsert>
<BACHNUMB>OCITE</BACHNUMB>
<JRNENTRY>1750</JRNENTRY>
<CRDTAMNT>25</CRDTAMNT>
<DEBITAMT>0</DEBITAMT>
<ACTNUMST>5120-0000-C</ACTNUMST>
</taGLTransactionLineInsert>
</taGLTransactionLineInsert_Items>
<taAnalyticsDistribution_Items xsi:nil="true" />
<taGLTransactionHeaderInsert>
<BACHNUMB>OCITE</BACHNUMB>
<JRNENTRY>1750</JRNENTRY>
<REFRENCE>REFRENCE</REFRENCE>
<TRXDATE>3/21/2013 12:00:00 AM</TRXDATE>
<TRXTYPE>0</TRXTYPE>
</taGLTransactionHeaderInsert>
<taMdaUpdate_Items xsi:nil="true" />
</GLTransactionType>
</eConnect>

I came up with a solution to my own question. 我想出了一个解决自己问题的方法。

Namely, creating a new instance of the myGLDetailLine object for 'every' single line will resolve this problem. 即,为“每”一行创建myGLDetailLine对象的新实例将解决此问题。

taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert myGLDetailLine = new taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert();

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

相关问题 是否有用于Microsoft Dynamics GP 8的eConnect - Is there an eConnect for Microsoft Dynamics GP 8 无法加载文件或程序集Microsoft.Dynamics.GP.eConnect.Serialization - Could not load file or assembly Microsoft.Dynamics.GP.eConnect.Serialization Dynamics GP eConnect:获取数据(而不是创建/更新)? - Dynamics GP eConnect: get data (as opposed to create/update)? 为了对Dynamics GP 2010使用eConnect 11.0,是否必须在客户端计算机上安装eConnect Windows服务? - In order to use eConnect 11.0 for Dynamics GP 2010, does the eConnect windows service have to be installed on the client computer? eConnect类在引用的dll Microsoft \\ Microsoft.Dynamics.GP.eConnect.Serialization.dll中不可见 - eConnect Classes not visible in referenced dll Microsoft\Microsoft.Dynamics.GP.eConnect.Serialization.dll 在 Dynamics GP 中使用 LibreOffice 而不是 MS Office - Using LibreOffice instead of MS Office in Dynamics GP 动态GP eConnect-创建新的PMClassMaster - Dynamic GP eConnect - Creating a new PMClassMaster CRM许可证过期后,Microsoft CRM Dynamics GP使用数据库 - Microsoft CRM Dynamics GP Using database after CRM License Expires Dynamics GP中的新检查签名文件 - New Check Signature File in Dynamics GP Microsoft Dynamics eConnect-允许降价出售吗? - Microsoft Dynamics eConnect— allowed to have a negative markdown?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM