最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

用于取消支付和发票的X++代码 / X++ Code to Unsettle Payment and Invoice

网络文摘 William 191浏览 0评论

Hi Dax guys,

This is small utility code if we need to unsettle payments and invoice

 select firstonly * from findCustTrans  
 where findCustTrans.Voucher == voucher;  
 if (findCustTrans.RecId) {  
     balanceAmount = findCustTrans.remainAmountCur();  
     if (balanceAmount == 0) {  
         custTable = custTable::find(findCustTrans.AccountNum);  
         select firstonly custSettlement  
         where custSettlement.TransCompany == findCustTrans.dataAreaId && custSettlement.TransRecId == findCustTrans.RecId && custSettlement.AccountNum == findCustTrans.AccountNum;  
         specTransManager = SpecTransManager::newRefTableId(custTable, tablenum(custSettlement), true);  
         specTransManager.insert(custSettlement.DataAreaId, custSettlement.TableId, custSettlement.RecId, custSettlement.SettleAmountCur, findCustTrans.CurrencyCode);  
         custSettlement.CustVendSettlement::markOffsets(specTransManager, findCustTrans.CurrencyCode, true);  
         if (CustTrans::reverseTransact(custTable, null, settleDatePrinc::DateOfPayment, custSettlement.TransDate)) {  
             specTransManager.deleteAll();  
         }  
     }  
 }  

 

Thanks
Amir

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址