Selecting items from different form and display in salesline form
To add new button in salestable form-> Linesview -> to show all related items based on salestable itemtype. And selecting items in other form and need to display in salesline:
1. Create new form(INC_InventItemsdetails) by taking InventTable datasource and adding Display menuitem (Inventitemdetailsdisplay).
2. Add menuitembutton in salesline, provide display menuitem(Inventitemdetailsdisplay).
3. In Form = INC_InventTabledetails -> Form ->Init()
public void init()
{
SalesTable salesTable;
super();
salesTable = element.args().record();
I InventTable_ds.query().dataSourceTable(Tablenum(InventTable)).addRange(fieldNum(InventTable,I NC_ItemType)).value(SysQuery::value(salesTable.INC_ItemType));
}
4. Taking command button in INC_InventTabledetails form -> Clicked()
void clicked()
{
SalesLine salesLine;
SalesTable salesTable;
int recordsCount;
InventTable inventTableloc;
AxSalesLine axSalesLine;
Object _fds;
super();
salesTable = element.args().record();
_fds = element.args().record().dataSource();
recordsCount = InventTable_ds.recordsMarked().lastIndex(); // Total number of marked records.
inventTableloc = InventTable_ds.getFirst(1);
while (inventTableloc)
{
salesLine.clear();
salesLine.initFromSalesTable(salesTable);
axSalesLine = AxSalesLine::newSalesLine(salesLine);
axSalesLine.parmSalesId(salesTable.SalesId);
axSalesLine.parmItemId(inventTableloc.ItemId);
axSalesLine.parmSalesQty(1);
axSalesLine.save();
inventTableloc = InventTable_ds.getNext();
}
_fds.reReadLines();
}
1. Create new form(INC_InventItemsdetails) by taking InventTable datasource and adding Display menuitem (Inventitemdetailsdisplay).
2. Add menuitembutton in salesline, provide display menuitem(Inventitemdetailsdisplay).
3. In Form = INC_InventTabledetails -> Form ->Init()
public void init()
{
SalesTable salesTable;
super();
salesTable = element.args().record();
I InventTable_ds.query().dataSourceTable(Tablenum(InventTable)).addRange(fieldNum(InventTable,I NC_ItemType)).value(SysQuery::value(salesTable.INC_ItemType));
}
4. Taking command button in INC_InventTabledetails form -> Clicked()
void clicked()
{
SalesLine salesLine;
SalesTable salesTable;
int recordsCount;
InventTable inventTableloc;
AxSalesLine axSalesLine;
Object _fds;
super();
salesTable = element.args().record();
_fds = element.args().record().dataSource();
recordsCount = InventTable_ds.recordsMarked().lastIndex(); // Total number of marked records.
inventTableloc = InventTable_ds.getFirst(1);
while (inventTableloc)
{
salesLine.clear();
salesLine.initFromSalesTable(salesTable);
axSalesLine = AxSalesLine::newSalesLine(salesLine);
axSalesLine.parmSalesId(salesTable.SalesId);
axSalesLine.parmItemId(inventTableloc.ItemId);
axSalesLine.parmSalesQty(1);
axSalesLine.save();
inventTableloc = InventTable_ds.getNext();
}
_fds.reReadLines();
}
Comments
Post a Comment