![]() |
#1 |
Участник
|
a33ik: Adjust tax value using X++ code
Источник: http://daxonline.org/1641-adjust-tax...ng-x-code.html
============== Adjust tax value of purchase invoice. commonLine could be either MarkupTrans or VendInvoiceInfoLine. static void VKTaxRegulation(Args _args){ PurchTotals purchTotals; TaxPurch taxPurch; VendInvoiceInfoTable vendInvoiceInfoTable; MarkupTrans commonLine; //VendInvoiceInfoLine commonLine; TaxRegulation taxRegulation; select firstOnly vendInvoiceInfoTable where vendInvoiceInfoTable.Num == "VKTest10"; purchTotals = PurchTotals::newParmTable( vendInvoiceInfoTable, PurchUpdate::All, AccountOrder::None, vendInvoiceInfoTable.ParmId, '', vendInvoiceInfoTable.Ordering); purchTotals.calc(); taxPurch = purchTotals.tax(); select commonLine where commonLine.RecId == 5637172328; taxRegulation = TaxRegulation::newTaxRegulation( taxPurch, null, commonLine.TableId, commonLine.RecId ); taxRegulation.allocateAmount(22); taxRegulation.saveTaxRegulation(); info('done');} ![]() Adjust tax value for purchase order:static void VKTaxRegulationPO(Args _args){ PurchTable purchTable; PurchLine purchLine; TaxRegulation taxRegulation; purchTable = PurchTable::find('VK-001113'); purchLine = PurchLine::find('VK-001113'); taxRegulation = TaxRegulation::newTaxRegulation( PurchTotals::getTax(purchTable), null, tableNum(PurchLine), purchLine.RecId ); if(taxRegulation) { taxRegulation.allocateAmount(12); taxRegulation.saveTaxRegulation(); }} In order to process VAT adjustments at line level, the country region should be added to the list of Consolidation Countries. \Classes\SysCountryRegionCode\isLegalEntityInConsolidatedCountryRegion Источник: http://daxonline.org/1641-adjust-tax...ng-x-code.html |
|
|
|