Programmer:Goods Received Note Transfer from Purchase Order

From AutoCount Resource Center
Jump to navigation Jump to search

Full Document Transfer

public void NewGRN(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand cmd =
        BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNote doc = cmd.AddNew();

    doc.CreditorCode = "400-X001";
    doc.DocDate = DateTime.Today.Date;

    string[] poDocNos = { "PO-00001" };
    doc.FullTransfer(poDocNos, BCE.AutoCount.Invoicing.Purchase.TransferFrom.PurchaseOrder, BCE.AutoCount.Invoicing.FullTransferOption.FullDetails);

    try
    {
        doc.Save();
        //log save successful
    }
    catch (BCE.Application.AppException ex)
    {
        //log exception
    }
}

Partial Transfer

public void NewGRN(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand cmd =
        BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNote doc = cmd.AddNew();

    doc.CreditorCode = "400-X001";
    doc.DocDate = DateTime.Today.Date;

    //Transfer one line of item from PO, if more than one line, write a loop
    string poDocNo = "PO-00001";
    string itemCode = "ItemA";
    string uom = "UNIT";
    decimal qtyToTransfer = 5;
    decimal focQtyToTrasnfer = 0;
    //Using Partial Transfer
    doc.PartialTransfer(BCE.AutoCount.Invoicing.Purchase.TransferFrom.PurchaseOrder,
        poDocNo, itemCode, uom, qtyToTransfer, focQtyToTrasnfer);

    try
    {
        doc.Save();
        //log save successful
    }
    catch (BCE.Application.AppException ex)
    {
        //log exception
    }
}

Go to menu

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