Use below code to mark customers open transaction from X++.
       
    }
}
thanks
p.
static void MarkOpenTransaction() 
{
    custInvoiceJour
custInvoiceJour;
   
SalesTable  salesTable;
   
specTrans   specTrans;
   
custTrans   custTrans;
   
custTransOpen   custTransOpen;
   
TaxWithholdTrans    taxWithHoldTrans;
   
TaxWithhold_CustPaym taxWithhold;
   
CustVendOpenTransManager manager;
   
ExchangeRateHelper  exch;
   
AmountCur   totalSettleAmount;
   
;
   
select firstOnly
custInvoiceJour where
custInvoiceJour.InvoiceId == '004452';// && _custInvoiceJour.SalesId ==
xml_SalesID.text();
   
if(custInvoiceJour)
   
{
       
ttsBegin;
       
salesTable = salesTable::find('000330');
       
specTrans.SpecRecId = salesTable.RecId;
       
select * from
custTrans where custTrans.AccountNum
== '000001' &&
custTrans.Invoice == custInvoiceJour.InvoiceId;
       
select RecId, dataAreaId from custTransOpen where custTransOpen.RefRecId == custTrans.RecId;
       
specTrans.RefRecId = custTransOpen.RecId;
       
specTrans.RefTableId = tablename2id('CustTransOpen');
       
specTrans.SpecTableId = salesTable.TableId;
       
specTrans.Balance01 = str2num('-300');//amount
       
specTrans.LineNum = 2;
       
specTrans.Code = salesTable.CurrencyCode;
       
specTrans.SpecCompany = salesTable.dataAreaId;
       
specTrans.RefCompany = custTransOpen.dataAreaId;
       
specTrans.insert();
       
ttsCommit;
}
thanks
p.
Comments
Post a Comment