Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

create a purchase order receipt on the same journal

Posted on by 10

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);

}

  • cykosis3 Profile Picture
    cykosis3 10 on at
    RE: create a purchase order receipt on the same journal

    I have not found that. I know that AXA has a production receipt. It only takes the prodId and then ask for the quantity. You have to understand we receive items with different quantities all the time. So they may not have everything in that PO to finish. So we need to accept a partial post, but keep it on the same journal. 

    -Keith

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,912 Super User 2024 Season 2 on at
    RE: create a purchase order receipt on the same journal

    Hi,

    Also in AX2012, there is support for the arrival journal in Dynamics Anywhere to first store all receipt and using the Finish option it will then post it. Can you see if you can find this option for your scenario?

  • cykosis3 Profile Picture
    cykosis3 10 on at
    RE: create a purchase order receipt on the same journal

    I tried adding in some logic to find the journal thinking it would post to that particular journal. No go.

    select * from vendPackingSlipJour

                       where vendPackingSlipJour.PurchId == purchId

                           && vendPackingSlipJour.PackingSlipId == packingSlipId;

    Then added the line in the purchParmTable logic:

    purchParmTable.VendPackingSlipJour      = vendPackingSlipJour.RecId;

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,912 Super User 2024 Season 2 on at
    RE: create a purchase order receipt on the same journal

    Hi Cykosis3,

    I'm working at To-Increase and also managing the latest versions of the Dynamics Anywhere solution. I haven't looked deeply at the AX2012 version as I try to focus on new epics.

    Let me try to help you here as volunteer...

    It looks like this method is called every time you scanned an item.

    On line 89 there is an insert command. There is no logic to find an exiting; not posted purchParmTable for the same order.

    Lines 120 until 132 will actually post the receipt list.

    For Dynamics 365, we do support a receipt journal which hold multiple arrivals. I will check if the same is applicable for AX2012. I not, you would need a change here.

  • cykosis3 Profile Picture
    cykosis3 10 on at
    RE: create a purchase order receipt on the same journal

    Yes, AXA. This is a custom form that uses uses a little of both.  

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,912 Super User 2024 Season 2 on at
    RE: create a purchase order receipt on the same journal

    Hi cykosis3,

    Do you have a mobility solution called "Dynamics Anywhere"? If so, can you tell if this part is a customization, customized or standard coding?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,912 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,355 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans