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('');
133 _this.form.findField('item_type').showHide();
137 if (action.type == 'load') {
138 _this.form.findField('item_type').showHide();
141 if (action.type =='submit') {
143 var id = _this.form.findField('item_id').getValue() * 1;
149 '_id' : action.result.data.item_id,
150 '_with_itemsite' : 1,
151 '_with_itemcost' : 1,
152 '_with_prodcat' : 1 ,
153 '_with_salesaccnt' : 1
160 if (_this.callback) {
161 _this.callback.call(_this, _this.form.getValues());
167 rendered : function (form)
184 fieldLabel : 'Description',
188 name : 'item_descrip1'
192 fieldLabel : 'Description (2)',
196 name : 'item_descrip2'
207 xtype : 'SimpleStore',
209 [ 'P', "Purchased (eg. a standard product)"],
210 [ 'R' , "Reference (Non-Product)"],
211 [ 'K', "Kit (made up of products)"]
213 fields : [ 'ftype', 'fname'],
218 triggerAction : 'all',
220 displayField : 'fname',
221 emptyText : "Select Type",
222 hiddenName : 'item_type',
223 valueField : 'ftype',
226 showHide : function() {
228 var it = this.getValue();
231 'item_itemcost_id_itemcost_curr_id',
232 'item_itemcost_id_itemcost_actcost',
233 'item_itemsite_id_itemsite_reorderlevel',
234 'item_itemsite_id_itemsite_leadtime',
235 'item_itemsite_id_itemsite_location_id',
236 'item_itemsite_id_itemsite_loccntrl',
237 'item_itemsite_id_itemsite_stocked',
238 'item_itemsite_id_itemsite_perishable',
240 'item_itemsite_id_itemsite_safetystock',
241 'item_itemsite_id_itemsite_controlmethod',
242 'item_itemsite_id_itemsite_plancode_id',
243 'item_itemsite_id_itemsite_costcat_id',
244 'item_itemsite_id_itemsite_active',
245 'item_itemsite_id_itemsite_sold'
255 _this.standardCostFieldSet.show();
256 _this.itemsiteFieldSet.show();
257 _this.form.findField('_update_related').setValue(1);
263 _this.form.findField('item_listprice').allowBlank = false;
264 _this.form.findField('item_listprice').actionMode = 'fieldEl';
265 _this.form.findField('item_listprice').hideMode = 'display';
266 _this.form.findField('item_listprice').show();
270 case 'R': // refrence
271 options = options.concat(r_req);
273 _this.standardCostFieldSet.hide();
276 case 'P': // purchased..
277 options = options.concat(r_req);
282 Roo.each(options, function(n) {
283 var ff = _this.form.findField(n);
284 ff.allowBlank = !state;
285 ff.actionMode = 'fieldEl';
286 ff.hideMode = 'display';
287 state ? ff.show() : ff.hide();
293 _this.standardCostFieldSet.hide();
294 _this.itemsiteFieldSet.hide();
295 _this.form.findField('_update_related').setValue(0);
305 name : 'item_type_name',
306 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
308 beforeselect : function (combo, record, index)
310 (function() { combo.showHide(); }).defer(100);
322 url : baseURL + '/Roo/classcode.php',
331 xtype : 'JsonReader',
333 fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
334 totalProperty : 'total'
339 sortInfo : { direction : 'ASC', field: 'id' },
342 beforeload : function (_self, o){
343 o.params = o.params || {};
354 triggerAction : 'all',
355 fieldLabel : 'Class',
356 forceSelection : true,
357 selectOnFocus : true,
359 displayField : 'classcode_code',
360 emptyText : "Select classcode",
361 hiddenName : 'item_classcode_id',
363 valueField : 'classcode_id',
370 name : 'item_classcode_id_classcode_code',
371 qtip : "Select classcode",
373 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
374 loadingText : "Searching...",
384 url : baseURL + '/Roo/uom.php',
393 xtype : 'JsonReader',
396 {"name":"id","type":"int"},
397 {"name":"uom_name","type":"string"},
398 {"name":"uom_descrip","type":"string"},
400 totalProperty : 'total'
405 sortInfo : { direction : 'ASC', field: 'uom_name' },
408 beforeload : function (_self, o){
409 o.params = o.params || {};
420 triggerAction : 'all',
421 fieldLabel : 'Invoice UOM',
422 forceSelection : true,
423 selectOnFocus : true,
425 displayField : 'uom_descrip',
426 emptyText : "Select uom",
427 hiddenName : 'item_inv_uom_id',
429 valueField : 'uom_id',
436 name : 'item_inv_uom_id_uom_descrip',
437 qtip : "Select classcode",
439 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
440 loadingText : "Searching...",
450 url : baseURL + '/Roo/uom.php',
459 xtype : 'JsonReader',
462 {"name":"id","type":"int"},
463 {"name":"uom_name","type":"string"},
464 {"name":"uom_descrip","type":"string"},
466 totalProperty : 'total'
471 sortInfo : { direction : 'ASC', field: 'uom_name' },
474 beforeload : function (_self, o){
475 o.params = o.params || {};
486 triggerAction : 'all',
487 fieldLabel : 'Price UOM',
488 forceSelection : true,
489 selectOnFocus : true,
491 displayField : 'uom_descrip',
492 emptyText : "Select uom",
493 hiddenName : 'item_price_uom_id',
495 valueField : 'uom_id',
502 name : 'item_price_uom_id_uom_descrip',
503 qtip : "Select classcode",
505 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
506 loadingText : "Searching...",
514 fieldLabel : 'Weight',
515 xtype : 'NumberField',
517 allowDecimals : true,
518 decimalPrecision : 2,
521 name : 'item_prodweight'
525 fieldLabel : 'Item comments',
529 name : 'item_comments',
534 fieldLabel : 'Item sold',
544 fieldLabel : 'Item active',
556 url : baseURL + '/Roo/prodcat.php',
565 xtype : 'JsonReader',
567 fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
568 totalProperty : 'total'
574 sortInfo : { direction : 'ASC', field: 'id' },
576 beforeload : function (_self, o){
577 o.params = o.params || {};
589 triggerAction : 'all',
590 fieldLabel : 'Product Category',
591 forceSelection : true,
592 selectOnFocus : true,
594 displayField : 'prodcat_code',
595 emptyText : "Select Category",
596 hiddenName : 'item_prodcat_id',
598 valueField : 'prodcat_id',
605 name : 'item_prodcat_id_prodcat_code',
606 qtip : "Select prodcat",
608 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
609 loadingText : "Searching...",
611 add : function (combo)
613 Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
615 edit : function (combo, record)
617 var s = _this.form.findField('item_prodcat_id').getValue() * 1;
619 Roo.MessageBox.alert('Error','Please select a account assignment');
622 Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
632 fieldLabel : 'Sales Account',
633 xtype : 'DisplayField',
635 name : 'item_salesaccnt'
639 fieldLabel : 'Item listprice',
640 xtype : 'NumberField',
643 name : 'item_listprice'
648 legend : "Standard Cost",
649 style : 'width:320px',
652 render : function (_self)
654 _this.standardCostFieldSet = _self;
662 url : baseURL + '/Roo/curr_symbol.php',
671 xtype : 'JsonReader',
673 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
674 totalProperty : 'total'
679 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
682 beforeload : function (_self, o){
683 o.params = o.params || {};
695 triggerAction : 'all',
696 fieldLabel : 'Currency',
697 forceSelection : true,
698 selectOnFocus : true,
700 displayField : 'curr_name',
701 emptyText : "Select Currency",
702 hiddenName : 'item_itemcost_id_itemcost_curr_id',
704 valueField : 'curr_id',
712 qtip : "Select Currency",
713 queryParam : 'query[curr_name]',
714 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
715 loadingText : "Searching...",
723 fieldLabel : 'Value',
724 xtype : 'NumberField',
728 name : 'item_itemcost_id_itemcost_actcost'
744 legend : "Itemsite Settings",
746 style : 'width:335px;',
749 render : function (_self)
751 _this.itemsiteFieldSet = _self;
757 fieldLabel : 'Reorder Level',
758 xtype : 'NumberField',
762 name : 'item_itemsite_id_itemsite_reorderlevel'
766 fieldLabel : 'Stock Safety Level',
767 xtype : 'NumberField',
771 name : 'item_itemsite_id_itemsite_safetystock'
775 fieldLabel : 'Lead time (Days)',
776 xtype : 'NumberField',
780 name : 'item_itemsite_id_itemsite_leadtime'
785 xtype : 'SimpleStore',
790 fields : [ 'ftype', 'fname'],
795 triggerAction : 'all',
796 fieldLabel : 'Control Method',
797 displayField : 'fname',
798 hiddenName : 'item_itemsite_id_itemsite_controlmethod',
799 valueField : 'ftype',
806 name : 'item_itemsite_id_itemsite_controlmethod_name',
807 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
817 url : baseURL + '/Roo/plancode.php',
826 xtype : 'JsonReader',
828 fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
829 totalProperty : 'total'
835 sortInfo : { direction : 'ASC', field: 'id' },
837 beforeload : function (_self, o){
838 o.params = o.params || {};
849 triggerAction : 'all',
850 fieldLabel : 'Planner Code',
851 forceSelection : true,
852 selectOnFocus : true,
854 displayField : 'plancode_name',
855 emptyText : "Select plancode",
856 hiddenName : 'item_itemsite_id_itemsite_plancode_id',
858 valueField : 'plancode_id',
865 name : 'plancode_name',
866 qtip : "Select plancode",
868 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
869 loadingText : "Searching...",
879 url : baseURL + '/Roo/costcat.php',
888 xtype : 'JsonReader',
890 fields : [{"name":"id","type":"int"},{"name":"costcat_code","type":"string"}],
891 totalProperty : 'total'
897 sortInfo : { direction : 'ASC', field: 'id' },
899 beforeload : function (_self, o){
900 o.params = o.params || {};
911 triggerAction : 'all',
912 fieldLabel : 'Costcat',
913 forceSelection : true,
914 selectOnFocus : true,
916 displayField : 'costcat_code',
917 emptyText : "Select costcat",
918 hiddenName : 'item_itemsite_id_itemsite_costcat_id',
920 valueField : 'costcat_id',
927 name : 'costcat_code',
928 qtip : "Select costcat",
930 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
931 loadingText : "Searching...",
939 fieldLabel : 'Active',
945 name : 'item_itemsite_id_itemsite_active'
955 name : 'item_itemsite_id_itemsite_sold'
959 fieldLabel : 'Stocked',
965 name : 'item_itemsite_id_itemsite_stocked'
969 fieldLabel : 'Perishable',
975 name : 'item_itemsite_id_itemsite_perishable'
979 fieldLabel : 'Multi Location',
985 name : 'item_itemsite_id_itemsite_loccntrl'
991 url : baseURL + '/Roo/location.php',
1000 xtype : 'JsonReader',
1001 fields : [{"name":"location_id","type":"int"},"location_name"],
1003 totalProperty : 'total'
1005 '|xns' : 'Roo.data',
1008 sortInfo : { direction : 'ASC', field: 'location_name' },
1011 beforeload : function (_self, o){
1012 o.params = o.params || {};
1014 o.params.location_netable = 1;
1015 o.params._notinternalcompany = 1;
1016 o.params.location_restrict = 0;
1024 '|xns' : 'Roo.form',
1026 triggerAction : 'all',
1027 fieldLabel : 'Default Location',
1028 forceSelection : true,
1029 selectOnFocus : true,
1031 displayField : 'location_name',
1032 emptyText : "Default Location",
1033 hiddenName : 'item_itemsite_id_itemsite_location_id',
1035 valueField : 'location_id',
1042 name : 'location_name',
1043 qtip : "Select terms",
1044 queryParam : 'query[location_name]',
1045 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
1046 loadingText : "Searching...",
1059 '|xns' : 'Roo.form',
1066 '|xns' : 'Roo.form',
1071 name : '_update_related'
1089 '|xns' : 'Roo.data',
1090 url : baseURL + '/Roo/item.php',
1092 xtype : 'HttpProxy',
1096 '|xns' : 'Roo.data',
1099 xtype : 'JsonReader',
1101 {"name":"id","type":"int"},
1102 {"name":"item_number","type":"string"}
1105 totalProperty : 'total'
1107 '|xns' : 'Roo.data',
1110 sortInfo : { direction : 'ASC', field: 'item_number' },
1113 beforeload : function (_self, o){
1114 o.params = o.params || {};
1116 o.params.item_active = 1;
1117 o.params['!item_type'] = 'K';
1125 '|xns' : 'Roo.bootstrap',
1127 triggerAction : 'all',
1128 fieldLabel : 'Item',
1129 forceSelection : true,
1130 selectOnFocus : true,
1132 displayField : 'item_number',
1133 emptyText : "Select item",
1141 xns : Roo.bootstrap,
1142 qtip : "Select item",
1143 queryParam : 'query[number_or_name]',
1144 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1145 loadingText : "Searching...",
1147 render : function (_self)
1149 _this.partsBox = _self;
1151 select : function (combo, record, index)
1153 var item_id = _this.form.findField('item_id').getValue() * 1;
1155 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
1161 _this.partsgrid.ds.each(function(d){
1162 if(record.data.item_id == d.data.bomitem_item_id){
1168 Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
1169 _this.partsBox.reset();
1174 url : baseURL + '/Roo/bomitem.php',
1177 bomitem_parent_item_id : item_id,
1178 bomitem_item_id : record.data.item_id
1180 success : function(res) {
1181 _this.partsBox.reset();
1182 _this.partsgrid.footer.onClick('first');
1193 '|xns' : 'Roo.Toolbar',
1201 cls : 'x-btn-text-icon',
1202 icon : rootURL + '/Pman/templates/images/trash.gif',
1207 var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
1209 if(!sel || !sel.length){
1210 Roo.MessageBox.alert("Error", "Please select a item from below list");
1214 var d = _this.partsgrid.ds.getAt(sel[0]);
1216 if(d.data.bomitem_id * 1 < 1){
1217 Roo.MessageBox.alert("Error", "Invaild selection");
1222 url : baseURL + '/Roo/bomitem.php',
1225 _delete : d.data.bomitem_id
1227 success : function(res) {
1228 _this.partsgrid.footer.onClick('first');
1240 '|xns' : 'Roo.data',
1241 url : baseURL + '/Roo/bomitem.php',
1242 xtype : 'HttpProxy',
1247 '|xns' : 'Roo.data',
1250 xtype : 'JsonReader',
1253 'name': 'bomitem_id',
1258 totalProperty : 'total'
1260 '|xns' : 'Roo.data',
1263 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1266 beforeload : function (_self, o)
1268 o.params = o.params || {};
1270 var id = _this.form.findField('item_id').getValue() * 1;
1275 o.params.bom_parent_item_id = id;
1286 xtype : 'PagingToolbar',
1287 emptyMsg : "Nothing found",
1289 displayMsg : "Displaying parts {0} - {1} of {2}",
1292 '|xns' : 'Roo.grid',
1293 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1294 xtype : 'EditorGrid',
1300 '|xns' : 'Roo.grid',
1301 xtype : 'ColumnModel',
1304 renderer : function(v) { return String.format('{0}', v); },
1306 dataIndex : 'bomitem_item_id_item_number'
1309 '|xns' : 'Roo.grid',
1310 xtype : 'ColumnModel',
1311 header : 'Description',
1313 renderer : function(v) { return String.format('{0}', v); },
1315 dataIndex : 'bomitem_item_id_item_descrip1'
1320 '|xns' : 'Roo.form',
1322 cls : 'align-right',
1323 xtype : 'NumberField',
1324 decimalPrecision : 0,
1328 '|xns' : 'Roo.grid',
1329 xtype : 'GridEditor',
1336 '|xns' : 'Roo.grid',
1337 xtype : 'ColumnModel',
1341 renderer : function(v) { return String.format('{0}', v); },
1343 dataIndex : 'bomitem_qtyper',
1351 beforeedit : function (e)
1353 if(e.field != 'bomitem_qtyper'){
1360 _this.partsgrid = this;
1361 //_this.dialog = Pman.Dialog.FILL_IN
1362 if (_this.partspanel.active) {
1363 this.footer.onClick('first');
1366 afteredit : function (e)
1368 if(e.originalValue == e.value){
1375 url : baseURL + '/Roo/bomitem.php',
1378 bomitem_id : e.record.data.bomitem_id,
1379 bomitem_qtyper : e.value
1381 success : function() {
1382 e.record.set('bomitem_qtyper', e.value);
1401 title : "Item Parts",
1402 xtype : 'GridPanel',
1403 fitContainer : true,
1405 tableName : 'bomitem',
1407 activate : function() {
1408 _this.partspanel = this;
1410 try { if (MODULE.isBuilder) {
1414 var id = _this.form.findField('item_id').getValue() * 1;
1416 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1417 _this.dialog.layout.getRegion('center').showPanel(0);
1421 var type = _this.form.findField('item_type').getValue();
1423 if(!type.length || type != 'K'){
1424 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1425 _this.dialog.layout.getRegion('center').showPanel(0);
1429 if (_this.partsgrid) {
1430 _this.partsgrid.footer.onClick('first');
1444 '|xns' : 'Roo.data',
1447 xtype : 'JsonReader',
1482 'name': 'displayorder',
1490 'name': 'parent_image_id',
1496 'dateFormat' : 'Y-m-d H:i:s'
1516 totalProperty : 'total'
1519 '|xns' : 'Roo.data',
1520 url : baseURL + '/Roo/Images.php',
1521 xtype : 'HttpProxy',
1525 '|xns' : 'Roo.data',
1528 sortInfo : { field: 'created' , direction: 'DESC' },
1531 beforeload : function (_self, o)
1533 o.params = o.params || {};
1535 var id = _this.form.findField('item_id').getValue();
1542 o.params.ontable = 'item';
1554 xtype : 'PagingToolbar',
1555 emptyMsg : "No Images found",
1558 displayMsg : "Displaying Images {0} - {1} of {2}"
1566 '|xns' : 'Roo.Toolbar',
1569 cls : 'x-btn-text-icon',
1570 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1575 Pman.Dialog.Image.show({
1578 onid: _this.form.findField('item_id').getValue() * 1,
1581 if (!data) { return; }
1582 _this.grid.footer.onClick('first');
1589 '|xns' : 'Roo.Toolbar',
1592 cls : 'x-btn-text-icon',
1593 icon : rootURL + '/Pman/templates/images/trash.gif',
1598 Pman.genericDelete(_this, 'Images');
1605 '|xns' : 'Roo.grid',
1606 autoExpandColumn : 'id',
1612 '|xns' : 'Roo.grid',
1613 xtype : 'ColumnModel',
1617 renderer : function(v,x,r) {
1618 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1619 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1620 r.data.width, r.data.height
1624 dataIndex : 'created'
1627 '|xns' : 'Roo.grid',
1628 xtype : 'ColumnModel',
1631 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1637 rowdblclick : function (_self, rowIndex, e)
1640 var s = _self.getDataSource().getAt(rowIndex);
1642 url : baseURL + '/Images/Download/' + s.data.id
1646 render : function() {
1649 if (_this.panel.active) {
1650 this.footer.onClick('first');
1663 title : "Reference Files",
1664 xtype : 'GridPanel',
1665 fitContainer : true,
1667 tableName : 'Images',
1669 activate : function() {
1672 try { if (MODULE.isBuilder) {
1676 var id = _this.form.findField('item_id').getValue() * 1;
1678 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1679 _this.dialog.layout.getRegion('center').showPanel(0);
1684 _this.grid.footer.onClick('first');
1698 '|xns' : 'Roo.data',
1699 url : baseURL + '/Roo/ipshead.php',
1701 xtype : 'HttpProxy',
1705 '|xns' : 'Roo.data',
1708 xtype : 'JsonReader',
1711 'name': 'ipshead_id',
1715 'name': 'ipshead_name',
1720 totalProperty : 'total'
1722 '|xns' : 'Roo.data',
1725 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1728 beforeload : function (_self, o)
1730 o.params = o.params || {};
1732 var id = _this.form.findField('item_id').getValue() * 1;
1737 o.params._with_item = id;
1748 xtype : 'PagingToolbar',
1749 emptyMsg : "Nothing found",
1751 displayMsg : "Displaying records {0} - {1} of {2}",
1754 '|xns' : 'Roo.grid',
1755 autoExpandColumn : 'ipshead_descrip',
1756 xtype : 'EditorGrid',
1762 '|xns' : 'Roo.grid',
1763 xtype : 'ColumnModel',
1766 renderer : function(v) { return String.format('{0}', v); },
1768 dataIndex : 'ipshead_name'
1771 '|xns' : 'Roo.grid',
1772 xtype : 'ColumnModel',
1774 header : 'Description',
1775 renderer : function(v) { return String.format('{0}', v); },
1777 dataIndex : 'ipshead_descrip'
1780 '|xns' : 'Roo.grid',
1781 xtype : 'ColumnModel',
1783 header : 'Currency',
1784 renderer : function(v) { return String.format('{0}', v); },
1786 dataIndex : 'ipshead_curr_id_curr_name'
1791 '|xns' : 'Roo.form',
1792 xtype : 'NumberField',
1793 cls : 'align-right',
1794 decimalPrecision : 2,
1797 '|xns' : 'Roo.grid',
1798 xtype : 'GridEditor',
1805 '|xns' : 'Roo.grid',
1807 xtype : 'ColumnModel',
1810 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1812 dataIndex : 'ipshead_ipsitem_price',
1820 beforeedit : function (e)
1822 if(e.field != 'ipshead_ipsitem_price'){
1830 //_this.dialog = Pman.Dialog.FILL_IN
1831 if (_this.lpanel.active) {
1832 this.footer.onClick('first');
1835 afteredit : function (e)
1837 if(e.originalValue == e.value){
1841 var id = _this.form.findField('item_id').getValue() * 1;
1848 url : baseURL + '/Roo/ipsiteminfo',
1851 ipsitem_ipshead_id : e.record.data.ipshead_id,
1852 ipsitem_item_id : id,
1853 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1854 ipsitem_id : e.record.data.ipshead_ipsitem_id
1873 title : "Price List",
1874 xtype : 'GridPanel',
1875 fitContainer : true,
1877 tableName : 'ipshead',
1879 activate : function() {
1880 _this.lpanel = this;
1882 try { if (MODULE.isBuilder) {
1886 var id = _this.form.findField('item_id').getValue() * 1;
1888 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1889 _this.dialog.layout.getRegion('center').showPanel(0);
1894 _this.lgrid.footer.onClick('first');
1908 '|xns' : 'Roo.data',
1909 url : baseURL + '/Roo/itemsrc.php',
1910 xtype : 'HttpProxy',
1915 '|xns' : 'Roo.data',
1918 xtype : 'JsonReader',
1922 'name': 'itemsrc_id',
1926 'name': 'itemsrc_item_id',
1930 'name': 'itemsrc_item_id',
1934 'name': 'itemsrc_vend_id',
1938 'name': 'itemsrc_vend_id',
1942 'name': 'itemsrc_vend_item_number',
1946 'name': 'itemsrc_vend_item_descrip',
1950 'name': 'itemsrc_comments',
1954 'name': 'itemsrc_vend_uom',
1958 'name': 'itemsrc_invvendoruomratio',
1962 'name': 'itemsrc_minordqty',
1966 'name': 'itemsrc_multordqty',
1970 'name': 'itemsrc_leadtime',
1974 'name': 'itemsrc_ranking',
1978 'name': 'itemsrc_active',
1982 'name': 'itemsrc_manuf_name',
1986 'name': 'itemsrc_manuf_item_number',
1990 'name': 'itemsrc_manuf_item_descrip',
1994 'name': 'itemsrc_default',
1998 'name': 'itemsrc_upccode',
2002 totalProperty : 'total'
2004 '|xns' : 'Roo.data',
2007 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
2010 update : function (_self, record, operation)
2015 if (operation != 'commit') {
2018 if (record.data.itemsrc_vend_id * 1 < 1) {
2019 return; // do not save.
2021 if (record.data.itemsrc_id * 1 < 0) {
2022 return; // do not save. -- updating at present...
2025 var p = Roo.apply({}, record.data);
2026 record.set('itemsrc_id', -1);
2029 url : baseURL + '/Roo/Itemsrc',
2032 success: function(res) {
2033 if (record.data.itemsrc_id *1 < 1) {
2034 record.set('itemsrc_id', res.data.itemsrc_id);
2041 beforeload : function (_self, o)
2044 var id = 1 * _this.form.findField('item_id').getValue();
2049 o.params.itemsrc_item_id = id;
2060 xtype : 'PagingToolbar',
2061 emptyMsg : "No itemsrc found",
2064 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
2072 '|xns' : 'Roo.Toolbar',
2075 cls : 'x-btn-text-icon',
2076 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2082 Roo.log("add presed");
2085 var grid = _this.itemsrcgrid;
2087 // uses form defaults or last row value.
2088 var nr = grid.ds.reader.newRow({
2090 itemsrc_item_id : _this.form.findField('item_id').getValue(),
2091 itemsrc_vend_id : 0,
2092 itemsrc_vend_id_vend_name : '',
2093 itemsrc_vend_item_number : '',
2094 itemsrc_vend_item_descrip : '',
2095 itemsrc_comments : '',
2096 itemsrc_vend_uom : 'EA',
2097 itemsrc_invvendoruomratio : 1.0,
2098 itemsrc_minordqty : 0,
2099 itemsrc_multordqty : 0,
2100 itemsrc_leadtime : 30,
2101 itemsrc_ranking : 0,
2102 itemsrc_active : true,
2103 itemsrc_manuf_name : '',
2104 itemsrc_manuf_item_number : '',
2105 itemsrc_manuf_item_descrip: '',
2106 itemsrc_default : true,
2107 itemsrc_upccode : ''
2111 grid.ds.insert(0, nr);
2112 grid.startEditing(0, 0); // type..
2120 '|xns' : 'Roo.grid',
2121 autoExpandColumn : 'itemsrc_comments',
2122 xtype : 'EditorGrid',
2132 '|xns' : 'Roo.data',
2133 url : baseURL + '/Roo/vendinfo.php',
2134 xtype : 'HttpProxy',
2139 '|xns' : 'Roo.data',
2142 xtype : 'JsonReader',
2144 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2145 totalProperty : 'total'
2147 '|xns' : 'Roo.data',
2151 sortInfo : { direction : 'ASC', field: 'id' },
2153 beforeload : function (_self, o){
2154 o.params = o.params || {};
2163 '|xns' : 'Roo.form',
2165 triggerAction : 'all',
2166 forceSelection : true,
2167 selectOnFocus : true,
2169 displayField : 'vend_name',
2170 emptyText : "Select Vendor",
2171 hiddenName : 'itemsrc_vend_id',
2173 valueField : 'vend_id',
2180 name : 'itemsrc_vend_id_vend_name',
2181 qtip : "Select vendinfo",
2182 queryParam : 'q[search]',
2183 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2184 loadingText : "Searching...",
2190 '|xns' : 'Roo.grid',
2191 xtype : 'GridEditor',
2198 '|xns' : 'Roo.grid',
2199 xtype : 'ColumnModel',
2202 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2204 dataIndex : 'itemsrc_vend_id',
2213 '|xns' : 'Roo.form',
2214 xtype : 'TextField',
2217 '|xns' : 'Roo.grid',
2218 xtype : 'GridEditor',
2225 '|xns' : 'Roo.grid',
2226 xtype : 'ColumnModel',
2228 header : 'Vendor Ref#',
2229 renderer : function(v) { return String.format('{0}', v); },
2231 dataIndex : 'itemsrc_vend_item_number',
2240 '|xns' : 'Roo.form',
2241 xtype : 'TextField',
2244 '|xns' : 'Roo.grid',
2245 xtype : 'GridEditor',
2252 '|xns' : 'Roo.grid',
2253 xtype : 'ColumnModel',
2255 header : 'Comments',
2256 renderer : function(v) { return String.format('{0}', v); },
2258 dataIndex : 'itemsrc_comments',
2265 '|xns' : 'Roo.grid',
2266 xtype : 'ColumnModel',
2269 renderer : function(v) { return String.format('{0}', v); },
2271 dataIndex : 'itemsrc_vend_uom'
2276 '|xns' : 'Roo.form',
2278 xtype : 'NumberField',
2279 decimalPrecision : 0,
2282 '|xns' : 'Roo.grid',
2283 xtype : 'GridEditor',
2290 '|xns' : 'Roo.grid',
2292 xtype : 'ColumnModel',
2295 renderer : function(v) { return String.format('{0}', v); },
2297 dataIndex : 'itemsrc_minordqty',
2306 '|xns' : 'Roo.form',
2308 xtype : 'NumberField',
2309 decimalPrecision : 0,
2312 '|xns' : 'Roo.grid',
2313 xtype : 'GridEditor',
2320 '|xns' : 'Roo.grid',
2322 xtype : 'ColumnModel',
2323 header : 'Lead time',
2325 renderer : function(v) { return String.format('{0}', v); },
2327 dataIndex : 'itemsrc_leadtime',
2334 '|xns' : 'Roo.grid',
2335 xtype : 'ColumnModel',
2338 renderer : function(v) { return String.format('{0}', v); },
2340 dataIndex : 'itemsrc_active'
2344 rowdblclick : function (_self, rowIndex, e)
2346 if (!_this.dialog) return;
2347 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2348 _this.grid.footer.onClick('first');
2353 _this.itemsrcgrid = this;
2355 if (_this.itemsrcpanel.active) {
2356 this.footer.onClick('first');
2359 afteredit : function (e)
2373 title : "Suppliers",
2374 xtype : 'GridPanel',
2375 fitContainer : true,
2377 tableName : 'itemsrc',
2379 activate : function() {
2380 _this.itemsrcpanel = this;
2382 try { if (MODULE.isBuilder) {
2386 var id = _this.form.findField('item_id').getValue() * 1;
2388 Roo.MessageBox.alert("Save First", "Save the item first, before adding suppliers");
2389 _this.dialog.layout.getRegion('center').showPanel(0);
2393 var type = _this.form.findField('item_type').getValue();
2396 Roo.MessageBox.alert("Error", "Can't add suppliers to kit item");
2397 _this.dialog.layout.getRegion('center').showPanel(0);
2401 if (_this.itemsrcgrid) {
2402 _this.itemsrcgrid.footer.onClick('first');
2415 '|xns' : 'Roo.data',
2416 url : baseURL + '/Roo/events.php',
2418 xtype : 'HttpProxy',
2422 '|xns' : 'Roo.data',
2425 xtype : 'JsonReader',
2428 'name': 'event_when',
2440 'name': 'person_id_name',
2449 totalProperty : 'total'
2451 '|xns' : 'Roo.data',
2454 sortInfo : { field : 'event_when', direction: 'DESC' },
2457 beforeload : function (_self, options)
2459 options.params = options.params || {};
2461 options.params.on_table = 'item';
2462 options.params.on_id = _this.form.findField('item_id').getValue();
2473 xtype : 'PagingToolbar',
2474 emptyMsg : "No Events found",
2476 displayMsg : "Displaying events{0} - {1} of {2}",
2479 '|xns' : 'Roo.grid',
2480 autoExpandColumn : 'remarks',
2486 '|xns' : 'Roo.grid',
2487 xtype : 'ColumnModel',
2490 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2492 dataIndex : 'event_when'
2495 '|xns' : 'Roo.grid',
2496 xtype : 'ColumnModel',
2499 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2501 dataIndex : 'action'
2504 '|xns' : 'Roo.grid',
2505 xtype : 'ColumnModel',
2507 header : 'IP Address',
2508 renderer : function(v) { return String.format('{0}', v); },
2510 dataIndex : 'ipaddr'
2513 '|xns' : 'Roo.grid',
2514 xtype : 'ColumnModel',
2517 renderer : function(v) { return String.format('{0}', v); },
2519 dataIndex : 'person_id_name'
2522 '|xns' : 'Roo.grid',
2523 xtype : 'ColumnModel',
2526 renderer : function(v) { return String.format('{0}', v); },
2528 dataIndex : 'remarks'
2535 if (_this.hpanel.active) {
2536 this.footer.onClick('first');
2550 xtype : 'GridPanel',
2551 fitContainer : true,
2553 tableName : 'events',
2555 activate : function() {
2556 _this.hpanel = this;
2558 _this.hgrid.footer.onClick('first');