Ax 4.0 成本笔记

AX 物料成本价这块我一直觉得蛮复杂的,没有仔细研究过他的逻辑

Table\InventSum\method\CostPrice

display CostPrice costPricePcs(boolean _onHandOnly = false)
{
    InventModelGroup    inventModelGroup;
    CostAmount          value;
    InventQty           qty;
    ;

    inventModelGroup = InventModelGroup::find(InventTable::find(this.ItemId).ModelGroupId);
    value            = (this.PostedValue) + (inventModelGroup.InclPhysicalValueInCost ? (this.PhysicalValue           ) : 0);
    qty              = (this.PostedQty  ) + (inventModelGroup.InclPhysicalValueInCost ? (this.Received - this.Deducted) : 0);

    if (_onHandOnly)
    {
        if (qty <= 0 || value <= 0)
        {
            return 0;
        }
    }
    else
    {
        if (qty <= 0 || value <= 0 || inventModelGroup.StandardCost)
        {
            return InventTable::findCostPcsPrice(this.ItemId, this.InventDimId);
        }
    }

    return value / qty;
}

参考inventSum.costPrice方法,可知成本价要根据物料的 “库存库存模型组”的参数“包括实际成本”,来计算。

如果基于库存来计算成本价,那应该是 过账金额/数量,如果将实际成本打钩则是 (过账金额+物理金额)/(过账数量+已收到-已扣减);

 

 

posted @ 2014-07-04 10:39  szlailai  阅读(364)  评论(0)    收藏  举报