Programmer:Get Stock Cost

From AutoCount Resource Center
Revision as of 04:35, 9 August 2018 by DanielY (talk | contribs)
Jump to navigation Jump to search

Standard Cost

Get Standard Cost with ItemRecord

public decimal GetItemStandardCostWithItemRecord(BCE.Data.DBSetting dbSetting, string itemCode, string uom)
{
    BCE.AutoCount.Data.ItemRecord itemRec = BCE.AutoCount.Data.CommonRecordUtils.GetItem(dbSetting, itemCode, uom);
    return itemRec == null ? 0 : itemRec.Cost;
}

Get Standard Cost with StockHelper

public decimal GetItemStandardCostWithStockHelper(BCE.Data.DBSetting dbSetting, string itemCode, string uom)
{
    BCE.AutoCount.Stock.StockHelper stkHelper = BCE.AutoCount.Stock.StockHelper.Create(dbSetting);
    return stkHelper.GetFixedCost(itemCode, uom);
}

Most Recent Cost

public decimal GetRecentStockCost(BCE.Data.DBSetting dbSetting, string itemCode, string uom, string loc)
{
    BCE.AutoCount.Stock.UTDCostHelper costHelper =
        BCE.AutoCount.Stock.UTDCostHelper.Create(dbSetting, itemCode, uom, loc, null, DateTime.Today.Date);
    return costHelper.GetMostRecentlyCost().Cost;
}


Up-to-date Cost

public decimal GetUpToDateUnitCost(BCE.Data.DBSetting dbSetting, string itemCode, string uom, decimal qty, DateTime date)
{
    BCE.AutoCount.Stock.StockHelper stkHelper = BCE.AutoCount.Stock.StockHelper.Create(dbSetting);
    return stkHelper.GetUpToDateUnitCost(itemCode, uom, qty, date);
}


Items' Stock Balance, Quantity and Costing Table

public System.Data.DataTable GetStockBalanceCostTable(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.StockBalance.StockBalanceHelper sbHelper = new BCE.AutoCount.Stock.StockBalance.StockBalanceHelper(dbSetting);
    sbHelper.Inquire(DateTime.Today.Date);

    //sbHelper.ResultDataSet returns 2 tables
    //1. Master (Item Balance)
    //2. ItemSerialNo (Serial Number)
    //System.Data.DataSet dsBalanceWithSerial = sbHelper.ResultDataSet;

    return sbHelper.ResultTable;
}


Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers