1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.XtupleItem = {
12 show : function(data, cb)
20 this.dialog.show(this.data._el);
23 this.form.setValues(data);
24 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
32 this.dialog = Roo.factory({
35 alwaysShowTabs : true,
36 xtype : 'LayoutRegion',
43 title : "Edit / Create item",
44 xtype : 'LayoutDialog',
57 click : function (_self, e)
69 render : function (_self)
73 click : function (_self, e)
78 // _this.dialog.el.mask("Saving");
79 _this.form.doAction("submit");
86 show : function (_self)
88 _this.dialog.layout.getRegion('center').showPanel(0);
96 xtype : 'ContentPanel',
101 url : baseURL + '/Roo/item.php',
103 style : 'margin:10px;',
108 actioncomplete : function(_self,action)
110 if (action.type == 'setdata') {
111 _this.form.findField('item_number').el.dom.readOnly = true;
112 _this.form.findField('item_type').disabled = true;
114 if(_this.data.item_id * 1 > 0){
119 '_id' : _this.data.item_id,
120 '_with_itemsite' : 1,
121 '_with_itemcost' : 1,
122 '_with_prodcat' : 1 ,
123 '_with_salesaccnt' : 1
129 _this.form.findField('item_number').el.dom.readOnly = false;
130 _this.form.findField('item_type').disabled = false;
131 _this.form.findField('item_salesaccnt').setValue('');
135 if (action.type == 'load') {
136 _this.form.findField('item_type').showHide();
139 if (action.type =='submit') {
141 var id = _this.form.findField('item_id').getValue() * 1;
147 '_id' : action.result.data.item_id,
148 '_with_itemsite' : 1,
149 '_with_itemcost' : 1,
150 '_with_prodcat' : 1 ,
151 '_with_salesaccnt' : 1
158 if (_this.callback) {
159 _this.callback.call(_this, _this.form.getValues());
165 rendered : function (form)
182 fieldLabel : 'Description',
186 name : 'item_descrip1'
190 fieldLabel : 'Description (2)',
194 name : 'item_descrip2'
205 xtype : 'SimpleStore',
207 [ 'P', "Purchased (eg. a standard product)"],
208 [ 'R' , "Reference (Non-Product)"],
209 [ 'K', "Kit (made up of products)"]
211 fields : [ 'ftype', 'fname'],
216 triggerAction : 'all',
218 displayField : 'fname',
219 emptyText : "Select Type",
220 hiddenName : 'item_type',
221 valueField : 'ftype',
224 showHide : function() {
226 var it = this.getValue();
229 'item_itemcost_id_itemcost_curr_id',
230 'item_itemcost_id_itemcost_actcost',
231 'item_itemsite_id_itemsite_reorderlevel',
232 'item_itemsite_id_itemsite_leadtime',
233 'item_itemsite_id_itemsite_location_id',
234 'item_itemsite_id_itemsite_loccntrl',
235 'item_itemsite_id_itemsite_stocked',
236 'item_itemsite_id_itemsite_perishable',
238 'item_itemsite_id_itemsite_safetystock',
239 'item_itemsite_id_itemsite_controlmethod',
240 'item_itemsite_id_itemsite_plancode_id',
241 'item_itemsite_id_itemsite_costcat_id',
242 'item_itemsite_id_itemsite_active',
243 'item_itemsite_id_itemsite_sold'
253 _this.standardCostFieldSet.show();
254 _this.itemsiteFieldSet.show();
255 _this.form.findField('_update_related').setValue(1);
261 _this.form.findField('item_listprice').allowBlank = false;
262 _this.form.findField('item_listprice').actionMode = 'fieldEl';
263 _this.form.findField('item_listprice').hideMode = 'display';
264 _this.form.findField('item_listprice').show();
268 case 'R': // refrence
269 options = options.concat(r_req);
271 _this.standardCostFieldSet.hide();
274 case 'P': // purchased..
275 options = options.concat(r_req);
280 Roo.each(options, function(n) {
281 var ff = _this.form.findField(n);
282 ff.allowBlank = !state;
283 ff.actionMode = 'fieldEl';
284 ff.hideMode = 'display';
285 state ? ff.show() : ff.hide();
291 _this.standardCostFieldSet.hide();
292 _this.itemsiteFieldSet.hide();
293 _this.form.findField('_update_related').setValue(0);
303 name : 'item_type_name',
304 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
306 beforeselect : function (combo, record, index)
308 (function() { combo.showHide(); }).defer(100);
320 url : baseURL + '/Roo/classcode.php',
329 xtype : 'JsonReader',
331 fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
332 totalProperty : 'total'
337 sortInfo : { direction : 'ASC', field: 'id' },
340 beforeload : function (_self, o){
341 o.params = o.params || {};
352 triggerAction : 'all',
353 fieldLabel : 'Class',
354 forceSelection : true,
355 selectOnFocus : true,
357 displayField : 'classcode_code',
358 emptyText : "Select classcode",
359 hiddenName : 'item_classcode_id',
361 valueField : 'classcode_id',
368 name : 'item_classcode_id_classcode_code',
369 qtip : "Select classcode",
371 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
372 loadingText : "Searching...",
382 url : baseURL + '/Roo/classcode.php',
391 xtype : 'JsonReader',
393 fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
394 totalProperty : 'total'
399 sortInfo : { direction : 'ASC', field: 'id' },
402 beforeload : function (_self, o){
403 o.params = o.params || {};
414 triggerAction : 'all',
415 fieldLabel : 'Class',
416 forceSelection : true,
417 selectOnFocus : true,
419 displayField : 'uom_name',
420 emptyText : "Select classcode",
421 hiddenName : 'item_classcode_id',
423 valueField : 'classcode_id',
430 name : 'item_classcode_id_classcode_code',
431 qtip : "Select classcode",
433 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
434 loadingText : "Searching...",
442 fieldLabel : 'Weight',
443 xtype : 'NumberField',
445 allowDecimals : true,
446 decimalPrecision : 2,
449 name : 'item_prodweight'
453 fieldLabel : 'Item comments',
457 name : 'item_comments',
462 fieldLabel : 'Item sold',
472 fieldLabel : 'Item active',
484 url : baseURL + '/Roo/prodcat.php',
493 xtype : 'JsonReader',
495 fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
496 totalProperty : 'total'
502 sortInfo : { direction : 'ASC', field: 'id' },
504 beforeload : function (_self, o){
505 o.params = o.params || {};
517 triggerAction : 'all',
518 fieldLabel : 'Product Category',
519 forceSelection : true,
520 selectOnFocus : true,
522 displayField : 'prodcat_code',
523 emptyText : "Select Category",
524 hiddenName : 'item_prodcat_id',
526 valueField : 'prodcat_id',
533 name : 'item_prodcat_id_prodcat_code',
534 qtip : "Select prodcat",
536 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
537 loadingText : "Searching...",
539 add : function (combo)
541 Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
543 edit : function (combo, record)
545 var s = _this.form.findField('item_prodcat_id').getValue() * 1;
547 Roo.MessageBox.alert('Error','Please select a account assignment');
550 Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
560 fieldLabel : 'Sales Account',
561 xtype : 'DisplayField',
563 name : 'item_salesaccnt'
567 fieldLabel : 'Item listprice',
568 xtype : 'NumberField',
571 name : 'item_listprice'
575 style : 'width:320px',
577 legend : "Standard Cost",
580 render : function (_self)
582 _this.standardCostFieldSet = _self;
590 url : baseURL + '/Roo/curr_symbol.php',
599 xtype : 'JsonReader',
601 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
602 totalProperty : 'total'
607 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
610 beforeload : function (_self, o){
611 o.params = o.params || {};
623 triggerAction : 'all',
624 fieldLabel : 'Currency',
625 forceSelection : true,
626 selectOnFocus : true,
628 displayField : 'curr_name',
629 emptyText : "Select Currency",
630 hiddenName : 'item_itemcost_id_itemcost_curr_id',
632 valueField : 'curr_id',
640 qtip : "Select Currency",
641 queryParam : 'query[curr_name]',
642 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
643 loadingText : "Searching...",
651 fieldLabel : 'Value',
652 xtype : 'NumberField',
656 name : 'item_itemcost_id_itemcost_actcost'
672 legend : "Itemsite Settings",
674 style : 'width:335px;',
677 render : function (_self)
679 _this.itemsiteFieldSet = _self;
685 fieldLabel : 'Reorder Level',
686 xtype : 'NumberField',
690 name : 'item_itemsite_id_itemsite_reorderlevel'
694 fieldLabel : 'Stock Safety Level',
695 xtype : 'NumberField',
699 name : 'item_itemsite_id_itemsite_safetystock'
703 fieldLabel : 'Lead time (Days)',
704 xtype : 'NumberField',
708 name : 'item_itemsite_id_itemsite_leadtime'
713 xtype : 'SimpleStore',
718 fields : [ 'ftype', 'fname'],
723 triggerAction : 'all',
724 fieldLabel : 'Control Method',
725 displayField : 'fname',
726 hiddenName : 'item_itemsite_id_itemsite_controlmethod',
727 valueField : 'ftype',
734 name : 'item_itemsite_id_itemsite_controlmethod_name',
735 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
745 url : baseURL + '/Roo/plancode.php',
754 xtype : 'JsonReader',
756 fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
757 totalProperty : 'total'
763 sortInfo : { direction : 'ASC', field: 'id' },
765 beforeload : function (_self, o){
766 o.params = o.params || {};
777 triggerAction : 'all',
778 fieldLabel : 'Planner Code',
779 forceSelection : true,
780 selectOnFocus : true,
782 displayField : 'plancode_name',
783 emptyText : "Select plancode",
784 hiddenName : 'item_itemsite_id_itemsite_plancode_id',
786 valueField : 'plancode_id',
793 name : 'plancode_name',
794 qtip : "Select plancode",
796 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
797 loadingText : "Searching...",
807 url : baseURL + '/Roo/costcat.php',
816 xtype : 'JsonReader',
818 fields : [{"name":"id","type":"int"},{"name":"costcat_code","type":"string"}],
819 totalProperty : 'total'
825 sortInfo : { direction : 'ASC', field: 'id' },
827 beforeload : function (_self, o){
828 o.params = o.params || {};
839 triggerAction : 'all',
840 fieldLabel : 'Costcat',
841 forceSelection : true,
842 selectOnFocus : true,
844 displayField : 'costcat_code',
845 emptyText : "Select costcat",
846 hiddenName : 'item_itemsite_id_itemsite_costcat_id',
848 valueField : 'costcat_id',
855 name : 'costcat_code',
856 qtip : "Select costcat",
858 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
859 loadingText : "Searching...",
867 fieldLabel : 'Active',
873 name : 'item_itemsite_id_itemsite_active'
883 name : 'item_itemsite_id_itemsite_sold'
887 fieldLabel : 'Stocked',
893 name : 'item_itemsite_id_itemsite_stocked'
897 fieldLabel : 'Perishable',
903 name : 'item_itemsite_id_itemsite_perishable'
907 fieldLabel : 'Multi Location',
913 name : 'item_itemsite_id_itemsite_loccntrl'
919 url : baseURL + '/Roo/location.php',
928 xtype : 'JsonReader',
929 fields : [{"name":"location_id","type":"int"},"location_name"],
931 totalProperty : 'total'
936 sortInfo : { direction : 'ASC', field: 'location_name' },
939 beforeload : function (_self, o){
940 o.params = o.params || {};
942 o.params.location_netable = 1;
943 o.params._notinternalcompany = 1;
944 o.params.location_restrict = 0;
954 triggerAction : 'all',
955 fieldLabel : 'Default Location',
956 forceSelection : true,
957 selectOnFocus : true,
959 displayField : 'location_name',
960 emptyText : "Default Location",
961 hiddenName : 'item_itemsite_id_itemsite_location_id',
963 valueField : 'location_id',
970 name : 'location_name',
971 qtip : "Select terms",
972 queryParam : 'query[location_name]',
973 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
974 loadingText : "Searching...",
999 name : '_update_related'
1017 '|xns' : 'Roo.data',
1018 url : baseURL + '/Roo/item.php',
1020 xtype : 'HttpProxy',
1024 '|xns' : 'Roo.data',
1027 xtype : 'JsonReader',
1029 {"name":"id","type":"int"},
1030 {"name":"item_number","type":"string"}
1033 totalProperty : 'total'
1035 '|xns' : 'Roo.data',
1038 sortInfo : { direction : 'ASC', field: 'item_number' },
1041 beforeload : function (_self, o){
1042 o.params = o.params || {};
1044 o.params.item_active = 1;
1045 o.params['!item_type'] = 'K';
1053 '|xns' : 'Roo.bootstrap',
1055 triggerAction : 'all',
1056 fieldLabel : 'Item',
1057 forceSelection : true,
1058 selectOnFocus : true,
1060 displayField : 'item_number',
1061 emptyText : "Select item",
1069 xns : Roo.bootstrap,
1070 qtip : "Select item",
1071 queryParam : 'query[number_or_name]',
1072 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1073 loadingText : "Searching...",
1075 render : function (_self)
1077 _this.partsBox = _self;
1079 select : function (combo, record, index)
1081 var item_id = _this.form.findField('item_id').getValue() * 1;
1083 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
1089 _this.partsgrid.ds.each(function(d){
1090 if(record.data.item_id == d.data.bomitem_item_id){
1096 Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
1097 _this.partsBox.reset();
1102 url : baseURL + '/Roo/bomitem.php',
1105 bomitem_parent_item_id : item_id,
1106 bomitem_item_id : record.data.item_id
1108 success : function(res) {
1109 _this.partsBox.reset();
1110 _this.partsgrid.footer.onClick('first');
1121 '|xns' : 'Roo.Toolbar',
1129 cls : 'x-btn-text-icon',
1130 icon : rootURL + '/Pman/templates/images/trash.gif',
1135 var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
1137 if(!sel || !sel.length){
1138 Roo.MessageBox.alert("Error", "Please select a item from below list");
1142 var d = _this.partsgrid.ds.getAt(sel[0]);
1144 if(d.data.bomitem_id * 1 < 1){
1145 Roo.MessageBox.alert("Error", "Invaild selection");
1150 url : baseURL + '/Roo/bomitem.php',
1153 _delete : d.data.bomitem_id
1155 success : function(res) {
1156 _this.partsgrid.footer.onClick('first');
1168 '|xns' : 'Roo.data',
1169 url : baseURL + '/Roo/bomitem.php',
1170 xtype : 'HttpProxy',
1175 '|xns' : 'Roo.data',
1178 xtype : 'JsonReader',
1181 'name': 'bomitem_id',
1186 totalProperty : 'total'
1188 '|xns' : 'Roo.data',
1191 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1194 beforeload : function (_self, o)
1196 o.params = o.params || {};
1198 var id = _this.form.findField('item_id').getValue() * 1;
1203 o.params.bom_parent_item_id = id;
1214 xtype : 'PagingToolbar',
1215 emptyMsg : "Nothing found",
1217 displayMsg : "Displaying parts {0} - {1} of {2}",
1220 '|xns' : 'Roo.grid',
1221 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1222 xtype : 'EditorGrid',
1228 '|xns' : 'Roo.grid',
1229 xtype : 'ColumnModel',
1232 renderer : function(v) { return String.format('{0}', v); },
1234 dataIndex : 'bomitem_item_id_item_number'
1237 '|xns' : 'Roo.grid',
1238 xtype : 'ColumnModel',
1239 header : 'Description',
1241 renderer : function(v) { return String.format('{0}', v); },
1243 dataIndex : 'bomitem_item_id_item_descrip1'
1248 '|xns' : 'Roo.form',
1250 cls : 'align-right',
1251 xtype : 'NumberField',
1252 decimalPrecision : 0,
1256 '|xns' : 'Roo.grid',
1257 xtype : 'GridEditor',
1264 '|xns' : 'Roo.grid',
1265 xtype : 'ColumnModel',
1269 renderer : function(v) { return String.format('{0}', v); },
1271 dataIndex : 'bomitem_qtyper',
1279 beforeedit : function (e)
1281 if(e.field != 'bomitem_qtyper'){
1288 _this.partsgrid = this;
1289 //_this.dialog = Pman.Dialog.FILL_IN
1290 if (_this.partspanel.active) {
1291 this.footer.onClick('first');
1294 afteredit : function (e)
1296 if(e.originalValue == e.value){
1303 url : baseURL + '/Roo/bomitem.php',
1306 bomitem_id : e.record.data.bomitem_id,
1307 bomitem_qtyper : e.value
1309 success : function() {
1310 e.record.set('bomitem_qtyper', e.value);
1329 title : "Item Parts",
1330 xtype : 'GridPanel',
1331 fitContainer : true,
1333 tableName : 'bomitem',
1335 activate : function() {
1336 _this.partspanel = this;
1338 try { if (MODULE.isBuilder) {
1342 var id = _this.form.findField('item_id').getValue() * 1;
1344 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1345 _this.dialog.layout.getRegion('center').showPanel(0);
1349 var type = _this.form.findField('item_type').getValue();
1351 if(!type.length || type != 'K'){
1352 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1353 _this.dialog.layout.getRegion('center').showPanel(0);
1357 if (_this.partsgrid) {
1358 _this.partsgrid.footer.onClick('first');
1372 '|xns' : 'Roo.data',
1375 xtype : 'JsonReader',
1410 'name': 'displayorder',
1418 'name': 'parent_image_id',
1424 'dateFormat' : 'Y-m-d H:i:s'
1444 totalProperty : 'total'
1447 '|xns' : 'Roo.data',
1448 url : baseURL + '/Roo/Images.php',
1449 xtype : 'HttpProxy',
1453 '|xns' : 'Roo.data',
1456 sortInfo : { field: 'created' , direction: 'DESC' },
1459 beforeload : function (_self, o)
1461 o.params = o.params || {};
1463 var id = _this.form.findField('item_id').getValue();
1470 o.params.ontable = 'item';
1482 xtype : 'PagingToolbar',
1483 emptyMsg : "No Images found",
1486 displayMsg : "Displaying Images {0} - {1} of {2}"
1494 '|xns' : 'Roo.Toolbar',
1497 cls : 'x-btn-text-icon',
1498 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1503 Pman.Dialog.Image.show({
1506 onid: _this.form.findField('item_id').getValue() * 1,
1509 if (!data) { return; }
1510 _this.grid.footer.onClick('first');
1517 '|xns' : 'Roo.Toolbar',
1520 cls : 'x-btn-text-icon',
1521 icon : rootURL + '/Pman/templates/images/trash.gif',
1526 Pman.genericDelete(_this, 'Images');
1533 '|xns' : 'Roo.grid',
1534 autoExpandColumn : 'id',
1540 '|xns' : 'Roo.grid',
1541 xtype : 'ColumnModel',
1545 renderer : function(v,x,r) {
1546 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1547 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1548 r.data.width, r.data.height
1552 dataIndex : 'created'
1555 '|xns' : 'Roo.grid',
1556 xtype : 'ColumnModel',
1559 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1565 rowdblclick : function (_self, rowIndex, e)
1568 var s = _self.getDataSource().getAt(rowIndex);
1570 url : baseURL + '/Images/Download/' + s.data.id
1574 render : function() {
1577 if (_this.panel.active) {
1578 this.footer.onClick('first');
1591 title : "Reference Files",
1592 xtype : 'GridPanel',
1593 fitContainer : true,
1595 tableName : 'Images',
1597 activate : function() {
1600 try { if (MODULE.isBuilder) {
1604 var id = _this.form.findField('item_id').getValue() * 1;
1606 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1607 _this.dialog.layout.getRegion('center').showPanel(0);
1612 _this.grid.footer.onClick('first');
1626 '|xns' : 'Roo.data',
1627 url : baseURL + '/Roo/ipshead.php',
1629 xtype : 'HttpProxy',
1633 '|xns' : 'Roo.data',
1636 xtype : 'JsonReader',
1639 'name': 'ipshead_id',
1643 'name': 'ipshead_name',
1648 totalProperty : 'total'
1650 '|xns' : 'Roo.data',
1653 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1656 beforeload : function (_self, o)
1658 o.params = o.params || {};
1660 var id = _this.form.findField('item_id').getValue() * 1;
1665 o.params._with_item = id;
1676 xtype : 'PagingToolbar',
1677 emptyMsg : "Nothing found",
1679 displayMsg : "Displaying records {0} - {1} of {2}",
1682 '|xns' : 'Roo.grid',
1683 autoExpandColumn : 'ipshead_descrip',
1684 xtype : 'EditorGrid',
1690 '|xns' : 'Roo.grid',
1691 xtype : 'ColumnModel',
1694 renderer : function(v) { return String.format('{0}', v); },
1696 dataIndex : 'ipshead_name'
1699 '|xns' : 'Roo.grid',
1700 xtype : 'ColumnModel',
1702 header : 'Description',
1703 renderer : function(v) { return String.format('{0}', v); },
1705 dataIndex : 'ipshead_descrip'
1708 '|xns' : 'Roo.grid',
1709 xtype : 'ColumnModel',
1711 header : 'Currency',
1712 renderer : function(v) { return String.format('{0}', v); },
1714 dataIndex : 'ipshead_curr_id_curr_name'
1719 '|xns' : 'Roo.form',
1720 xtype : 'NumberField',
1721 cls : 'align-right',
1722 decimalPrecision : 2,
1725 '|xns' : 'Roo.grid',
1726 xtype : 'GridEditor',
1733 '|xns' : 'Roo.grid',
1735 xtype : 'ColumnModel',
1738 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1740 dataIndex : 'ipshead_ipsitem_price',
1748 beforeedit : function (e)
1750 if(e.field != 'ipshead_ipsitem_price'){
1758 //_this.dialog = Pman.Dialog.FILL_IN
1759 if (_this.lpanel.active) {
1760 this.footer.onClick('first');
1763 afteredit : function (e)
1765 if(e.originalValue == e.value){
1769 var id = _this.form.findField('item_id').getValue() * 1;
1776 url : baseURL + '/Roo/ipsiteminfo',
1779 ipsitem_ipshead_id : e.record.data.ipshead_id,
1780 ipsitem_item_id : id,
1781 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1782 ipsitem_id : e.record.data.ipshead_ipsitem_id
1801 title : "Price List",
1802 xtype : 'GridPanel',
1803 fitContainer : true,
1805 tableName : 'ipshead',
1807 activate : function() {
1808 _this.lpanel = this;
1810 try { if (MODULE.isBuilder) {
1814 var id = _this.form.findField('item_id').getValue() * 1;
1816 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1817 _this.dialog.layout.getRegion('center').showPanel(0);
1822 _this.lgrid.footer.onClick('first');
1836 '|xns' : 'Roo.data',
1837 url : baseURL + '/Roo/itemsrc.php',
1838 xtype : 'HttpProxy',
1843 '|xns' : 'Roo.data',
1846 xtype : 'JsonReader',
1850 'name': 'itemsrc_id',
1854 'name': 'itemsrc_item_id',
1858 'name': 'itemsrc_item_id',
1862 'name': 'itemsrc_vend_id',
1866 'name': 'itemsrc_vend_id',
1870 'name': 'itemsrc_vend_item_number',
1874 'name': 'itemsrc_vend_item_descrip',
1878 'name': 'itemsrc_comments',
1882 'name': 'itemsrc_vend_uom',
1886 'name': 'itemsrc_invvendoruomratio',
1890 'name': 'itemsrc_minordqty',
1894 'name': 'itemsrc_multordqty',
1898 'name': 'itemsrc_leadtime',
1902 'name': 'itemsrc_ranking',
1906 'name': 'itemsrc_active',
1910 'name': 'itemsrc_manuf_name',
1914 'name': 'itemsrc_manuf_item_number',
1918 'name': 'itemsrc_manuf_item_descrip',
1922 'name': 'itemsrc_default',
1926 'name': 'itemsrc_upccode',
1930 totalProperty : 'total'
1932 '|xns' : 'Roo.data',
1935 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
1938 update : function (_self, record, operation)
1943 if (operation != 'commit') {
1946 if (record.data.itemsrc_vend_id * 1 < 1) {
1947 return; // do not save.
1949 if (record.data.itemsrc_id * 1 < 0) {
1950 return; // do not save. -- updating at present...
1953 var p = Roo.apply({}, record.data);
1954 record.set('itemsrc_id', -1);
1957 url : baseURL + '/Roo/Itemsrc',
1960 success: function(res) {
1961 if (record.data.itemsrc_id *1 < 1) {
1962 record.set('itemsrc_id', res.data.itemsrc_id);
1969 beforeload : function (_self, o)
1972 var id = 1 * _this.form.findField('item_id').getValue();
1977 o.params.itemsrc_item_id = id;
1988 xtype : 'PagingToolbar',
1989 emptyMsg : "No itemsrc found",
1992 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
2000 '|xns' : 'Roo.Toolbar',
2003 cls : 'x-btn-text-icon',
2004 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2010 Roo.log("add presed");
2013 var grid = _this.itemsrcgrid;
2015 // uses form defaults or last row value.
2016 var nr = grid.ds.reader.newRow({
2018 itemsrc_item_id : _this.form.findField('item_id').getValue(),
2020 itemsrc_vend_id : 0,
2021 itemsrc_vend_item_number : '',
2022 itemsrc_vend_item_descrip : '',
2023 itemsrc_comments : '',
2024 itemsrc_vend_uom : 'EA',
2025 itemsrc_invvendoruomratio : 1.0,
2026 itemsrc_minordqty : 0,
2027 itemsrc_multordqty : 0,
2028 itemsrc_leadtime : 30,
2029 itemsrc_ranking : 0,
2030 itemsrc_active : true,
2031 itemsrc_manuf_name : '',
2032 itemsrc_manuf_item_number : '',
2033 itemsrc_manuf_item_descrip: '',
2034 itemsrc_default : true,
2035 itemsrc_upccode : ''
2039 grid.ds.insert(0, nr);
2040 grid.startEditing(0, 0); // type..
2048 '|xns' : 'Roo.grid',
2049 autoExpandColumn : 'itemsrc_comments',
2050 xtype : 'EditorGrid',
2060 '|xns' : 'Roo.data',
2061 url : baseURL + '/Roo/vendinfo.php',
2062 xtype : 'HttpProxy',
2067 '|xns' : 'Roo.data',
2070 xtype : 'JsonReader',
2072 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2073 totalProperty : 'total'
2075 '|xns' : 'Roo.data',
2079 sortInfo : { direction : 'ASC', field: 'id' },
2081 beforeload : function (_self, o){
2082 o.params = o.params || {};
2091 '|xns' : 'Roo.form',
2093 triggerAction : 'all',
2094 forceSelection : true,
2095 selectOnFocus : true,
2097 displayField : 'vend_name',
2098 emptyText : "Select Vendor",
2099 hiddenName : 'itemsrc_vend_id',
2101 valueField : 'vend_id',
2108 name : 'itemsrc_vend_id_vend_name',
2109 qtip : "Select vendinfo",
2110 queryParam : 'q[search]',
2111 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2112 loadingText : "Searching...",
2118 '|xns' : 'Roo.grid',
2119 xtype : 'GridEditor',
2126 '|xns' : 'Roo.grid',
2127 xtype : 'ColumnModel',
2130 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2132 dataIndex : 'itemsrc_vend_id',
2141 '|xns' : 'Roo.form',
2142 xtype : 'TextField',
2145 '|xns' : 'Roo.grid',
2146 xtype : 'GridEditor',
2153 '|xns' : 'Roo.grid',
2154 xtype : 'ColumnModel',
2156 header : 'Vendor Ref#',
2157 renderer : function(v) { return String.format('{0}', v); },
2159 dataIndex : 'itemsrc_vend_item_number',
2168 '|xns' : 'Roo.form',
2169 xtype : 'TextField',
2172 '|xns' : 'Roo.grid',
2173 xtype : 'GridEditor',
2180 '|xns' : 'Roo.grid',
2181 xtype : 'ColumnModel',
2183 header : 'Comments',
2184 renderer : function(v) { return String.format('{0}', v); },
2186 dataIndex : 'itemsrc_comments',
2193 '|xns' : 'Roo.grid',
2194 xtype : 'ColumnModel',
2197 renderer : function(v) { return String.format('{0}', v); },
2199 dataIndex : 'itemsrc_vend_uom'
2204 '|xns' : 'Roo.form',
2206 xtype : 'NumberField',
2207 decimalPrecision : 0,
2210 '|xns' : 'Roo.grid',
2211 xtype : 'GridEditor',
2218 '|xns' : 'Roo.grid',
2220 xtype : 'ColumnModel',
2223 renderer : function(v) { return String.format('{0}', v); },
2225 dataIndex : 'itemsrc_minordqty',
2234 '|xns' : 'Roo.form',
2236 xtype : 'NumberField',
2237 decimalPrecision : 0,
2240 '|xns' : 'Roo.grid',
2241 xtype : 'GridEditor',
2248 '|xns' : 'Roo.grid',
2250 xtype : 'ColumnModel',
2251 header : 'Lead time',
2253 renderer : function(v) { return String.format('{0}', v); },
2255 dataIndex : 'itemsrc_leadtime',
2262 '|xns' : 'Roo.grid',
2263 xtype : 'ColumnModel',
2266 renderer : function(v) { return String.format('{0}', v); },
2268 dataIndex : 'itemsrc_active'
2272 rowdblclick : function (_self, rowIndex, e)
2274 if (!_this.dialog) return;
2275 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2276 _this.grid.footer.onClick('first');
2281 _this.itemsrcgrid = this;
2282 //_this.dialog = Pman.Dialog.FILL_IN
2285 afteredit : function (e)
2299 title : "Suppliers",
2300 xtype : 'GridPanel',
2301 fitContainer : true,
2303 tableName : 'itemsrc',
2305 activate : function() {
2306 _this.itemsrcpanel = this;
2307 if (_this.itemsrcgrid) {
2308 _this.itemsrcgrid.footer.onClick('first');
2321 '|xns' : 'Roo.data',
2322 url : baseURL + '/Roo/events.php',
2324 xtype : 'HttpProxy',
2328 '|xns' : 'Roo.data',
2331 xtype : 'JsonReader',
2334 'name': 'event_when',
2346 'name': 'person_id_name',
2355 totalProperty : 'total'
2357 '|xns' : 'Roo.data',
2360 sortInfo : { field : 'event_when', direction: 'DESC' },
2363 beforeload : function (_self, options)
2365 options.params = options.params || {};
2367 options.params.on_table = 'item';
2368 options.params.on_id = _this.form.findField('item_id').getValue();
2379 xtype : 'PagingToolbar',
2380 emptyMsg : "No Events found",
2382 displayMsg : "Displaying events{0} - {1} of {2}",
2385 '|xns' : 'Roo.grid',
2386 autoExpandColumn : 'remarks',
2392 '|xns' : 'Roo.grid',
2393 xtype : 'ColumnModel',
2396 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2398 dataIndex : 'event_when'
2401 '|xns' : 'Roo.grid',
2402 xtype : 'ColumnModel',
2405 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2407 dataIndex : 'action'
2410 '|xns' : 'Roo.grid',
2411 xtype : 'ColumnModel',
2413 header : 'IP Address',
2414 renderer : function(v) { return String.format('{0}', v); },
2416 dataIndex : 'ipaddr'
2419 '|xns' : 'Roo.grid',
2420 xtype : 'ColumnModel',
2423 renderer : function(v) { return String.format('{0}', v); },
2425 dataIndex : 'person_id_name'
2428 '|xns' : 'Roo.grid',
2429 xtype : 'ColumnModel',
2432 renderer : function(v) { return String.format('{0}', v); },
2434 dataIndex : 'remarks'
2441 if (_this.hpanel.active) {
2442 this.footer.onClick('first');
2456 xtype : 'GridPanel',
2457 fitContainer : true,
2459 tableName : 'events',
2461 activate : function() {
2462 _this.hpanel = this;
2464 _this.hgrid.footer.onClick('first');