Thursday, 14 April 2016

Creation of Inquiry Form Using Display Methods


Scenario:
  Here the  scenario is to show the item details in grid based on selection of item in the  form.
  The item details  include Orderedsum,PhysicalInventory and PhysicalReserved.
  But we have to get these three fields through display methods in table.



     

 With the help of above screen shot you can easily understand what my scenario is.


  • First of all I have created a table (table6),in that I  have taken  itemid(edt) as a field, but this table should be temporary table(TempDB).
  • Now I have written a method(getorderedsum) in order to get orderedsum field in my form.
      

Display Qty getorderedsum()
{
    Inventsum inventsum;
    InventDim inventdim;
    ;
   inventdim.InventSiteId = this.InventSiteId;
    inventDim.InventLocationId = this.InventLocationId;
    inventDim = InventDim::findOrCreate(inventDim);
    select inventsum where
    inventsum.itemid ==  this.ItemId;


    return inventsum.orderedSum();
}

  • Now I have written another method(getphysicalinventory)  to get physical inventory field.

Display  Qty getphysicalinventory()
{
    InventSum inventsum;
    InventDim   inventDim;
    ;
    inventdim.InventSiteId = this.InventSiteId;
    inventDim.InventLocationId = this.InventLocationId;
    inventDim = InventDim::findOrCreate(inventDim);

    select inventsum where
    inventsum.itemid ==  this.ItemId
    && inventsum.InventDimId == inventDim.inventDimId;



    return inventsum.availPhysicalCalculated();
}
  • Now I have written another method(getphysicalreserved)  to get physical reserved field.
  •   
display qty getphysicalreserved()
{
   Inventsum inventsum;
    InventDim inventdim;
    ;
   inventdim.InventSiteId = this.InventSiteId;
    inventDim.InventLocationId = this.InventLocationId;
    inventDim = InventDim::findOrCreate(inventDim);


    select inventsum where
    inventsum.ItemId == this.ItemId
     && inventsum.InventDimId == inventDim.inventDimId;
    return InventSum.availReservation();

}

  • Now create a form using the above created table as data source.
  • Now override the init method with this code.
public void init()
{
    super();

    delete_from  Table6;

}
  • Now in grid create three real edits and name those as Orderedsum,PhysicalInventory and PhysicalReserved respectively.
  • Now in realedit properties give the datasource as table6(tablename) and data method as respective method name.
  
  • now do the same for the next two real edits.
  • Inorder to get the grid empty set the datasource property insertifempty to NO.
  • Then the final output will be as shown below.





No comments:

Post a Comment