20.12.2013, 10:11 | #1 |
Участник
|
Pawan's Ax blog: How to update sales price for already created sales orders by applying latest trade agreements using x++ code
Источник: http://pawansaxblog.blogspot.com/201...r-already.html
============== In one of implementation project. I got a requirement in this Client wants to update sales orders that were created in past.Requirement was to update sales price by applying new trade agreements that were created later in system after the sales order creation. I used the following code to update the sales price. private void updateSalesPrice() { SalesLine salesLine; PriceDiscPolicyCheckPolicy checkPolicy; str text; SysOperationProgress operationProgress; boolean salesLineFound; #AviFiles // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price --> Dialog dialog; DialogField dfStartDate; DialogText dialogText; TransDate startDate; // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price ; operationProgress = new SysOperationProgress(); operationProgress.setCaption("@DTD849"); operationProgress.setAnimation(#AviUpdate); // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price --> dialog = new Dialog("@DTD847"); dfStartDate = dialog.addField(extendedTypeStr(TransDate), "@DTD1042"); dfStartDate.value(dateNull()); text = "@DTD845" + '\n\n' +"@DTD846" ; dialogText = dialog.addText(text); dialogText.displayHeight(4); dialogText.displayLengthValue(50); if (dialog.run()) { startDate = dfStartDate.value(); // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price ttsBegin; while select forUpdate salesLine where salesLine.SalesType == SalesType::Sales && salesLine.SalesStatus = startDate || startDate == dateNull()) // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price { salesLine.ManualEntryChangepolicy = 0; //optimisation dkos 2013-09-25 // 2013-02-18 #20169 csek: Job to update SOprice --> salesLine.SystemEntryChangePolicy = 0; //optimisation dkos 2013-09-25 // 2013-02-18 #20169 csek: Job to update SOprice checkPolicy = PriceDiscPolicyCheckPolicy::newFromParm(salesLine.PriceDiscResultFields::parmPriceDiscResultFields()); salesLine.salesPurchLine::resetPriceAgreement(); salesLine.setPriceAgreement(salesLine.inventDim(), null ,false,true);// 2013-02-07 #20169 csek: Job to update SOprice salesLine.LineAmount = salesLine.calcLineAmountForced(salesLine.SalesQty, checkPolicy); operationProgress.setText(strFmt("@DTD850",salesLine.SalesId)); salesLine.update(); salesLineFound = true; } ttsCommit; } if (salesLineFound) { info("@DTD1041"); // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price } } Источник: http://pawansaxblog.blogspot.com/201...r-already.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|