Programmer:Goods Received Note Transfer from Purchase Order v2

From AutoCount Resource Center
Jump to navigation Jump to search

Full Document Transfer

public void GRNFullTransferFromPO(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand cmd =
        AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand.Create(userSession, userSession.DBSetting);
    AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNote doc = cmd.AddNew();

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

    //Purchase Order numbers to be transferred into Goods Received Note
    string[] poDocNos = { "PO-00001", "PO-00002" };

    doc.FullTransfer(poDocNos, AutoCount.Invoicing.Purchase.TransferFrom.PurchaseOrder, AutoCount.Invoicing.FullTransferOption.FullDetails);

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

Partial Transfer

public void GRNPartialTransferFromPO(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand cmd =
        AutoCount.Invoicing.Purchase.GoodsReceivedNote.GoodsReceivedNoteCommand.Create(userSession, userSession.DBSetting);
    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(AutoCount.Invoicing.Purchase.TransferFrom.PurchaseOrder,
        poDocNo, itemCode, uom, qtyToTransfer, focQtyToTrasnfer);

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

Go to menu

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