Showing posts with label Validation in PO confirm. Show all posts
Showing posts with label Validation in PO confirm. Show all posts

Monday, June 26, 2023

Supplementary Item Quantity Validation in PO confirm.

My requirement is throwing validation based on the Quantity of supplementary items when a purchase order is for confirmation. 

 [ExtensionOf(classStr(PurchFormLetter_PurchOrder))]

public final class  DAX_PurchFormLetter_Extension

{

   public boolean validate(Object _calledFrom)

   {

       boolean         retExt = next validate(_calledFrom);

       boolean         ret1 = true,ret2;

       PurchLine       purchLineExt,purchline;

       SuppItemTable   suppItemTable;

       str             id;

       id = this.purchTable().PurchId;

       if (retExt)

       {

          while select * from purchline

             where purchline.purchid == id

           {

               ret1 = true;

              while select * from suppItemTable

                   where suppItemTable.ItemRelation == purchline.ItemId

               {

                   if(suppItemTable)

                   {

                       select * from purchLineExt

                           where purchLineExt.ItemId == suppItemTable.SuppItemId

                           && purchLineExt.PurchId == purchline.PurchId;

 

                            if (!purchLineExt)

                            {

                               ret1 = false;

                            }

                     }

 

               }

           

               if(ret1 == false )

               {

                   ret1 =  checkFailed(strFmt("please select the supplimentory items for %1  ",purchline.ItemId));

                   return  ret1;

               }

               

               if(purchline.PurchQty != suppItemTable.SuppItemQty )          

                     {

               ret2 =  checkFailed(" Please enter the supplimentory quantity  and purchline quantity should be equal");

                   return ret2;

             }

            }

       }


RESULT:-










Purchase Orders

 Before confirming a Purchase Order, the system should display a confirmation popup if the purchase order is associated with an active inter...