Monday, 10 November 2014

Based on Barcode Populating Item Details Including Dimensions in TransferLine

Based on Barcode populate Item Details including Dimensions in TransferLine

Note:

The bar code for each item is available in the "InventItembarcode" table and refer this table to understand about "bar code".

Steps:

1.create a new field "barcode" in InventTransferTable table and drag and drop the field into table grid in the InvenTransferOrders form.




2.Craete the same field in InventTransferLine table also ,and drag and drop the field into table grid in the InvenTransferOrders form.

3.When we select a new barcode in the header table, All item details will be populated and the same will be inserted as new line in the transfer screen including all the dimensions like color, size and serial numbers.

It is possible to add multiple lines for the same transfer order [same item can also be inserted with different bar code]




4.If the selected bar code is already used by the same or any other transfer orders,
  then it should prompt an error with that existing transfer order number [Eg:"The bar code is already    exist in the Transfer order 000008"]



5.The bar code field in the header should be empty each time after the selection of bar code .

6.So write the code in the Modified() method of the barcode field in Datasourse "InventTransferTable"


public void modified()
{
    InventTransferTable _inventTransferTable;
    InventTransferLine line,line1;
    InventItemBarcode _InventItemBarcode;
    InventDim inventDim1;

    super();


         if(InventTransferTable.itemBarCode)

          {
                 if(InventTransferTable.validateWrite())

                   {
                     select _InventItemBarcode where                      _InventItemBarcode.itemBarCode==InventTransferTable.itemBarCode;

                           if(_InventItemBarcode)

                            {

                             line.initValue();

                             line.initFromInventTableModule(InventTableModule::find(line.ItemId,ModuleInventPurchSales::Invent));

                             line.initFromInventTransferTable(InventTransferTable,true);

                             line.itemBarCode=_InventItemBarcode.itemBarCode;

                             line.ItemId=_InventItemBarcode.itemId;

                             line.LineNum=InventTransferLine::lastLineNum(InventTransferLine.TransferId)+1.0;

                             select InventDim where InventDim.inventDimId==_InventItemBarcode.inventDimId;

                             line.InventDimId=InventDim.inventDimId;

                                               if(line.validateWrite())

                                                 {
                                                   select ItemBarCode from line1 where line1.itemBarCode==line.itemBarCode ;

                                                      if(!line1)
                                                        {
                                                            line.insert();
                                                        }
                                                      else
                                                        {
                                                           InventTransferTable.itemBarCode = " ";
                                                           select TransferId from line1 where line1.itemBarCode ==           line.itemBarCode;
                                                           throw error("Barcode Already Exist in Transfer Order"+"   "+ line1.TransferId);
                                                        }

                                                  }

                               }


                      }

              InventTransferTable.itemBarCode = " ";

              InventTransferLine_ds.executeQuery();


       }


}


Now you can run the form and get the output.....................................