Search This Blog

Sunday, 12 January 2014

Creating New PurchaseOrder Line after clicking a Button(AddLine)


Hi dude,

The Below code is used to create a Purchase order line & the created lines will be ready for posting .

This is one of my customization ...........

 
void clicked()
{
    Dialog      dialog;
    DialogField field;
    InventTable invTab
    InventSum   invSum;
    InventDim   invDim;
    PurchTable  purTab;
    PurchLine   purLine;
    int addPhyBal;
    ;
    dialog = new Dialog("Enter IteamGroup");
    field = dialog.addField(typeid(ItemGroupId));
    dialog.run();
    if (dialog.closedOk())
    {
     while select invTab join invSum
          where invTab.ItemGroupId==field.value() && invSum.ItemId==invTab.ItemId
          {
            addPhyBal+=invSum.AvailPhysical;
           
            if(addPhyBal<=1000)
             {
                select invDim where invDim.inventDimId == invSum.InventDimId;
                purLine.clear();
                purLine.PurchId=PurchTable.PurchId;
                purLine.ItemId= invSum.ItemId;
                purLine.InventDimId=invSum.InventDimId;
                invDim.inventBatchId = invDim.inventBatchId;
                invDim.InventColorId = invDim.InventColorId;
                invDim.InventLocationId = invDim.InventLocationId;
                invDim.inventSerialId = invDim.inventSerialId;
                invDim.InventSiteId = invDim.InventSiteId;
                invDim.InventSizeId = invDim.InventSizeId;
                invDim.configId = invDim.configId;
                purLine.PurchQty = 5000;
                purLine.createLine(true,true,true,true,true,true);// Create new PO lines
              }
            }
        PurchLine_ds.executeQuery();
     }
     super();
}

 

1 comment: