Saturday, February 15, 2014

Calculation of Explosive Qty

// Calculation of Explosive Qty

private void CalculationOfExplosiveQty()
{
    ExplosiveQty    netExplosiveQty;
    InventTable     _InventTable;
    InventSum       _InventSum;
    InventLocation  _InventLocation;
    PurchParmLine   _PurchParmLine,_PurchParmLine1;
    InventDim       _InventDim,_InventDim1;
    real            totalQty,PhysicalQty;
    PurchId         _PurchId;
    ;

    while select _InventDim1 group by InventLocationId join _PurchParmLine1 where _PurchParmLine1.ParmId == PurchParmTable.ParmId
                                                                                && _InventDim1.inventDimId == _PurchParmLine1.InventDimId
    {
        totalQty =0;
        info(strFmt("%1",_InventDim1.InventLocationId));

        while select _PurchParmLine join _InventDim group by InventLocationId where _PurchParmLine.ParmId == PurchParmTable.ParmId
                                                                            && _InventDim.inventDimId == _PurchParmLine.InventDimid
                                                                            && _InventDim.inventlocationid == _InventDim1.inventlocationid

        {
            _PurchId = PurchParmLine.OrigPurchId;
            select _InventTable where _InventTable.ItemId == _PurchParmLine.ItemId;
            netExplosiveQty = _InventTable.ExplosiveQty;
            select _InventLocation where _InventLocation.InventLocationId == _InventDim.InventLocationId;
            totalQty += PurchParmLine.ReceiveNow * netExplosiveQty;
        }
            PhysicalQty = 0;
            while select _InventSum join _InventDim join _InventTable where _InventSum.InventDimId == _InventDim.inventDimId
                                                                        && _InventDim.InventLocationId == _InventDim1.InventLocationId
                                                                        && _InventTable.ItemId == _InventSum.ItemId
            {
                PhysicalQty += _InventSum.PhysicalInvent * ((_InventTable.ExplosiveQty == 0)? 1 : _InventTable.ExplosiveQty) ;
                // info(strFmt("%1 :  %2",_InventSum.PhysicalInvent,_InventDim.InventLocationId));
            }
                // info(strFmt("%1 : %2",PhysicalQty,totalQty));
                if(_InventLocation.ExplosiveLimit < totalQty + PhysicalQty)
                {
                    info(strFmt("Limit Exceed in  wearhouse %1",_InventDim1.InventLocationId));
                }
                else
                {
                    info("Purchase Order Posted");
                }
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...