Wednesday, March 8, 2023

how to throw error for a invent journal line if selected item is not a supplementary item for main item of previous line

 [ExtensionOf(formDataSourceStr(InventJournalMovement,InventJournalTrans))]

public final class DaxInventJournalItemId_Extension

{    

/// <summary>    

///    /// </summary>    

/// <param name="sender"></param>    

/// <param name="e"></param>    

public boolean validateWrite()        

{

        InventJournalTable     inventJournalTable;

        InventJournalTrans     inventJournalTrans,inventJournalTrans1;

        SuppItemTable          suppItemTable;

        container              con;

        int                    i;

        boolean                ret;

           ret = next validateWrite();

          inventJournalTrans1 = this.cursor();

          select inventJournalTrans

            where inventJournalTrans.JournalId == inventJournalTrans1.JournalId;

        select * from suppItemTable

             where suppItemTable.ItemRelation == inventJournalTrans.ItemId

            && suppItemTable.SuppItemId == inventJournalTrans1.ItemId;

        if(!suppItemTable)

        {

            ret = Error("The selected Item is not Supply item");

        }              

return ret;

    }

  }


No comments:

Post a Comment