Cost JOC In X++

 internal final class FabricCost

{

    /// <summary>

    /// Class entry point. The system will call this method when a designated menu 

    /// is selected or when execution starts and this class is set as the startup class.

    /// </summary>

    /// <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)

    {

        real      Cost;

        PRODTABLE PRODTABLE;

        SALESTABLE SALESTABLE;

        bfpProdMasterTable bfpProdMasterTable;

        ProdJournalTable ProdJournalTable;

        ProdTableJour ProdTableJour;

        ProdJournalBOM ProdJournalBOM;

        INVENTTRANSORIGIN INVENTTRANSORIGIN;

        INVENTTRANS INVENTTRANS;

        INVENTTABLE INVENTTABLE;



        select sum(COSTAMOUNTPHYSICAL)

        from INVENTTRANS

        where ( INVENTTRANS.ItemId like 'GD*' ||  INVENTTRANS.ItemId like 'FO*')


        exists JOIN INVENTTRANSORIGIN

        where INVENTTRANSORIGIN.RECID == INVENTTRANS.INVENTTRANSORIGIN


        exists join PRODTABLE

        where INVENTTRANSORIGIN.ReferenceId == PRODTABLE.PRODID


        exists JOIN SALESTABLE

        where SALESTABLE.SALESID == PRODTABLE.SLD_SALESORDER

        && SALESTABLE.SALESID == 'SO-003575'


        exists JOIN bfpProdMasterTable

        where PRODTABLE.BFPPRODMASTERID == bfpProdMasterTable.PRODMASTERID

        && bfpProdMasterTable.PRODMASTERID != ''

        && bfpProdMasterTable.HighestStatus == 7

        ;



        Cost = InventTrans.CostAmountPhysical;


        info(strFmt('%1 - %2',Cost, PRODTABLE.QtySched));


    }


}

Comments

Popular posts from this blog

D365FO – AX – X++ –Refresh, Reread, Research, and ExecuteQuery

Create Inventory Journal through Code in D365FO X++

SalesLine Reservation in D365fo x++