I current have an AXA class that receives the qty they enter for the PO. It uses the code below and works well. The issue is if we have several parts on a PO and they scan/enter them one by one it creates a new journal for every single part even though they have the same packingslip. Do I have to create the journal and essential hold on to that while I do this? I have a feeling this would get lost.
public D2MFWEventHandleResult onFormSubmit(D2MFWControlInstanceID _submitTargetID) { AXAWMSIMain axaWMSIMain = this.getMain(); AXAParameters axaParameters = AXAParameters::find(); D2MFWEventHandleResult ret; AXAReceipt axaReceipt = new AXAReceipt(this.getUserID(), this.getHostName()); AXACommon axaCommon= AXACommon::constructFromForm(this); AXAWMSIPOReceipt axawmsiPOReceipt; InventQty smcQuantity; InventQty smcCurQuantity; int LoopCount; PurchFormLetter purchFormLetter; PurchFormletterParmData purchFormLetterParmData; PurchParmUpdate purchParmUpdate; PurchParmTable purchParmTable; PurchParmLine purchParmLine; PurchTable purchTable; PurchLine purchLine; PurchId purchId; Num packingSlipId; LoopCount = 0; smcCurQuantity = 0; smcQuantity = 0; axaWMSIMain.varLblMessage(""); smcQuantity = str2int(this.getrealvalue(AXAWMSIMain.varsmcQty(), 'Q')); AXAWMSIMain.varQty(str2num(this.getrealvalue(AXAWMSIMain.varsmcQty(), 'Q'))); AXAWMSIMain.varPurchId(this.getrealvalue(AXAWMSIMain.varsmcPurchId(), 'K')); AXAWMSIMain.varPartNumber(this.getrealvalue(AXAWMSIMain.varsmcPartNum(), 'P')); //smcPackingSlipid = AXAWMSIMain.varPackingSlipId(str2num(this.getrealvalue(AXAWMSIMain.varsmcQty(), 'Q'))); this.showHideControls(); // Clear pressed if(this.getBtnClear().isSubmitTarget(_submitTargetId)) { this.clearTxtBoxes(); /* 2011.11.30 DAW/JH AXA_DAW_000000257 generic and retail additions > start */ this.showHideControls(); /* 2011.11.30 DAW/JH AXA_DAW_000000257 generic and retail additions < end */ //--> begin: DAW/rbongu | AXA_DAW_AA00000771_ProductDimensionPV AXAProdVar::constructFromForm(this).clearSolutionPVvars(); this.setVariantVisibility(); //<-- end : DAW/rbongu | AXA_DAW_AA00000771_ProductDimensionPV } // OK pressed else if(this.getBtnOk().isSubmitTarget(_submitTargetId)) { //(AXAWMSIMain.varQty(),'Q') > 0 && AXAWMSIMain.varPurchId() != "" && AXAWMSIMain.varPartNumber() != "" && AXAWMSIMain.varPackingSlipId() != "" && AXAWMSIMain.varClockNbr() != "") if(AXAWMSIMain.varQty() > 0 ) { if(AXAWMSIMain.varPurchId() != "" && AXAWMSIMain.varPartNumber() != "" && AXAWMSIMain.varPackingSlipId() != "" && AXAWMSIMain.varClockNbr() != "") { this.showHideControls(); axaWMSIMain.varLblMessage(""); purchTable = PurchTable::find(AXAWMSIMain.varPurchId()); ttsBegin; // Create PurchParamUpdate table purchFormLetterParmData = PurchFormletterParmData::newData( DocumentStatus::PackingSlip, VersioningUpdateType::Initial); purchFormLetterParmData.parmOnlyCreateParmUpdate(true); purchFormLetterParmData.createData(false); purchParmUpdate = purchFormLetterParmData.parmParmUpdate(); // Set PurchParmTable table purchParmTable.clear(); purchParmTable.TransDate = SystemDateGet(); purchParmTable.Ordering = DocumentStatus::PackingSlip; purchParmTable.ParmJobStatus = ParmJobStatus::Waiting; purchParmTable.Num = AXAWMSIMain.varPackingSlipId(); purchParmTable.PurchId = purchTable.PurchId; purchParmTable.PurchName = purchTable.PurchName; purchParmTable.DeliveryName = purchTable.DeliveryName; purchParmTable.DeliveryPostalAddress = purchTable.DeliveryPostalAddress; purchParmTable.OrderAccount = purchTable.OrderAccount; purchParmTable.CurrencyCode = purchTable.CurrencyCode; purchParmTable.InvoiceAccount = purchTable.InvoiceAccount; purchParmTable.ParmId = purchParmUpdate.ParmId; purchParmTable.insert(); // Set PurchParmLine table while select purchLine where purchLine.PurchId == AXAWMSIMain.varPurchId() && purchLine.PurchStatus == PurchStatus::Backorder && purchLine.ItemId == AXAWMSIMain.varPartNumber() { //smcQuantityTotal = smcQuantityTotal purchLine.RemainPurchPhysical; if(smcQuantity >= purchLine.RemainPurchPhysical) { smcCurQuantity = purchLine.RemainPurchPhysical; smcQuantity = smcQuantity - purchLine.RemainPurchPhysical; } else{ smcCurQuantity = smcQuantity; smcQuantity = smcQuantity - smcQuantity; } if(smcCurQuantity > 0) { purchParmLine.InitFromPurchLine(purchLine); purchParmLine.ReceiveNow = smcCurQuantity; purchParmLine.ParmId = purchParmTable.ParmId; purchParmLine.TableRefId = purchParmTable.TableRefId; purchParmLine.setQty(DocumentStatus::PackingSlip, false, true); purchParmLine.setLineAmount(); purchParmLine.insert(); } LoopCount = LoopCount 1; } purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip); //ProjectPackingSlip purchFormLetter.transDate(systemDateGet()); purchFormLetter.proforma(false); purchFormLetter.specQty(PurchUpdate::ReceiveNow); purchFormLetter.purchTable(purchTable); // This is the ID we hard code as the product receipt ID, if we do the posting via UI // user would have the option to manually enter this value purchFormLetter.parmParmTableNum(AXAWMSIMain.varPurchId()); purchFormLetter.parmId(AXAWMSIMain.varPurchId()); purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate()); purchFormLetter.run(); ttsCommit; this.clearTxtBoxes(); if(LoopCount > 0) { axaWMSIMain.varLblMessage("PO Receipt recieved!"); } else { axaWMSIMain.varLblMessage("Nothing recieved! Please check the information and submit again!"); } //this.getLblMessage().text("TEST"); } else { axaWMSIMain.varLblMessage("Please fill in all fields."); } } else{ this.showHideControls(); axaWMSIMain.varLblMessage("Please enter a valid Quantity."); } } //else if(this.getBtnBack().isSubmitTarget(_submitTargetId)) //{ // if(axaWMSIMain.varGRItemsReceived() == NoYes::Yes) // Ask if we want to quit, otherwise // return axaWMSIMain.getGRCancelReceipt().showForm(); //} //AXAWMSIPOReceipt.getLblMessage(); return super(_submitTargetID); }