Tuesday, January 8, 2019

Brand Stock Value Purchased Summary

static void BrandStockValue_Purchased(Args _args)
{
    ASAPG_BrandWiseValues                  globalTable ;
    ASAPG_BrandNameMaster                  brandMasterTable;
    Date                                   _today,_lastMonth;
    VendInvoiceJour                        vendInvoiceJour;
    VendInvoiceTrans                       vendInvoiceTrans;
    InventTable                            inventTable;

    TransDate                              startOfMth1,LastOfMth1;
    TransDate                              asonDate = mkDate(11,04,2017);  //today();

    _today          = asOnDate ;
    _lastMonth      = prevMth(_today );


    startOfMth1     = dateStartMth(_lastMonth );
    LastOfMth1      = endmth(_lastMonth);

    while select brandMasterTable  where brandMasterTable.Brand == 'RBI'
    {

     select  sum(LineAmount) from vendInvoiceTrans
                where vendInvoiceTrans.InvoiceDate >= startOfMth1 && vendInvoiceTrans.InvoiceDate <= LastOfMth1
    join vendInvoiceJour
        where vendInvoiceTrans.PurchID == vendInvoiceJour.PurchId  && vendInvoiceTrans.InvoiceId == vendInvoiceJour.InvoiceId
            && vendInvoiceTrans.InvoiceDate == vendInvoiceJour.InvoiceDate  && vendInvoiceTrans.numberSequenceGroup == vendInvoiceJour.numberSequenceGroup
            && vendInvoiceJour.VendGroup != 'GROUP'
    join inventTable
        where vendInvoiceTrans.ItemId == inventTable.ItemId
            && inventTable.OGSBrand == brandMasterTable.Brand;

        globalTable.SalesAmount_1 = vendInvoiceTrans.LineAmount;

        info(strFmt("Brand %1 - Amount %2", brandMasterTable.Brand, vendInvoiceTrans.LineAmount));
    }
}

No comments:

Post a Comment