Programmer:Stock Transfer

From AutoCount Resource Center
Jump to navigation Jump to search

References of AutoCount Accounting version 1.8, 1.9

BCE.AutoCount.dll
BCE.AutoCount.CommonAccounting.dll
BCE.AutoCount.MainEntry.dll
BCE.Utils.dll
BCE.Utils.UI.dll
BCE.AutoCount.Stock.dll
BCE.AutoCount.Manufacturing.dll

Simple Create New Stock Adjustment

public void SimpleCreateNewStockTransfer(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.StockTransfer.StockTransferCommand cmd =
        BCE.AutoCount.Stock.StockTransfer.StockTransferCommand.Create(dbSetting);
    BCE.AutoCount.Stock.StockTransfer.StockTransfer doc = cmd.AddNew();
    BCE.AutoCount.Stock.StockTransfer.StockTransferDetail dtl = null;

    //doc.DocNo = "<<New>>";
    doc.DocDate = DateTime.Today.Date;
    doc.Description = "Test Generated.";
    doc.FromLocation = "HQ";
    doc.ToLocation = "PJ";

    //Set to auto populate the item information from Item Maintenance
    //such as Item Description
    doc.EnableAutoLoadItemDetail = true;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00001";
    dtl.UOM = "KG";
    dtl.Qty = 1;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00002";
    dtl.UOM = "PCS";
    dtl.Qty = 2;

    try
    {
        doc.Save();
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
    }
}

Edit Stock Adjustment

public void EditStockTransfer(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.StockTransfer.StockTransferCommand cmd =
        BCE.AutoCount.Stock.StockTransfer.StockTransferCommand.Create(dbSetting);
    BCE.AutoCount.Stock.StockTransfer.StockTransfer doc = cmd.Edit("XFER-00001");
    BCE.AutoCount.Stock.StockTransfer.StockTransferDetail dtl = null;

    if (doc == null)
    {
        //Log document not found.
        return;
    }

    doc.DocDate = DateTime.Today.Date;
    doc.Description = "Test Generated.";
    doc.FromLocation = "HQ";
    doc.ToLocation = "PJ";

    doc.ClearDetails();

    //Set to auto populate the item information from Item Maintenance
    doc.EnableAutoLoadItemDetail = true;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00001";
    dtl.UOM = "KG";
    dtl.Qty = 1;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00002";
    dtl.UOM = "PCS";
    dtl.Qty = 2;

    try
    {
        doc.Save();
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
    }
}


Cancel Stock Adjustment

public void Cancel(BCE.Data.DBSetting dbSetting)
{
    string docNo = "XFER-00001";
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.Stock.StockTransfer.StockTransferCommand cmd =
        BCE.AutoCount.Stock.StockTransfer.StockTransferCommand.Create(dbSetting);

    try
    {
        cmd.CancelDocument(docNo, userId);
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
    }
}


Uncancel Stock Adjustment

public void UnCancel(BCE.Data.DBSetting dbSetting)
{
    string docNo = "XFER-00001";
    string userId = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
    BCE.AutoCount.Stock.StockTransfer.StockTransferCommand cmd =
        BCE.AutoCount.Stock.StockTransfer.StockTransferCommand.Create(dbSetting);

    try
    {
        cmd.UncancelDocument(docNo, userId);
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
    }
}

Delete Stock Adjustment

public void Delete(BCE.Data.DBSetting dbSetting)
{
    string docNo = "XFER-00001";
    BCE.AutoCount.Stock.StockTransfer.StockTransferCommand cmd =
        BCE.AutoCount.Stock.StockTransfer.StockTransferCommand.Create(dbSetting);

    try
    {
        cmd.Delete(docNo);
        //log success
    }
    catch (BCE.Application.AppException ex)
    {
        //log error
    }
}

See Also

Go to menu

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