var _itemsite = mywindow.findChild("_itemsite");
var _site = mywindow.findChild("_site");
var _view = mywindow.findChild("_view");
var _viewis = mywindow.findChild("_viewItemSite");
_itemsite.addColumn(qsTr("Item Number"), -1, Qt.AlignLeft, true, "item_number");
_itemsite.addColumn(qsTr("Loc. Controlled"), -1, Qt.AlignRight,true, "itemsite_loccntrl");
_itemsite.addColumn(qsTr("Control Method"), -1, Qt.AlignRight,true, "itemsite_controlmethod");
function sFillList()
{
var params = new Object;
params.site = _site.id();
var qry = toolbox.executeQuery('SELECT item_id, itemsite_id, item_number, '
+ ' itemsite_loccntrl, itemsite_controlmethod '
+ 'FROM itemsite '
+ ' JOIN item ON (itemsite_item_id=item_id) '
+ 'WHERE itemsite_warehous_id=<? value("site") ?> '
+ 'ORDER BY item_number;',
params);
_itemsite.populate(qry, true);
}
function sViewItem()
{
var params = new Object();
params.item_id = _itemsite.id();
params.mode = "view";
var newdlg = toolbox.openWindow("item", 0, 0, 0);
newdlg.set(params);
}
function sViewItemSite()
{
var params = new Object();
params.itemsite_id= _itemsite.altId();
params.mode = "view";
var newdlg = toolbox.openWindow("itemSite", mywindow, Qt.WindowModal, Qt.Sheet);
newdlg.set(params);
var result = newdlg.exec();
print("Item Site window returned " + result);
}
_site["newID(int)"].connect(sFillList);
_view.clicked.connect(sViewItem);
_viewis.clicked.connect(sViewItemSite);
sFillList();