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);
95 xtype : 'ContentPanel',
101 url : baseURL + '/Roo/item.php',
102 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();
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();
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',
1081 '|xns' : 'Roo.data',
1082 url : baseURL + '/Roo/item.php',
1083 xtype : 'HttpProxy',
1088 '|xns' : 'Roo.data',
1091 xtype : 'JsonReader',
1093 {"name":"id","type":"int"},
1094 {"name":"item_number","type":"string"}
1097 totalProperty : 'total'
1099 '|xns' : 'Roo.data',
1102 sortInfo : { direction : 'ASC', field: 'item_number' },
1105 beforeload : function (_self, o){
1106 o.params = o.params || {};
1108 o.params.item_active = 1;
1109 o.params['!item_type'] = 'K';
1117 '|xns' : 'Roo.bootstrap',
1119 triggerAction : 'all',
1120 fieldLabel : 'Item',
1121 forceSelection : true,
1122 selectOnFocus : true,
1124 displayField : 'item_number',
1125 emptyText : "Select item",
1133 xns : Roo.bootstrap,
1134 qtip : "Select item",
1135 queryParam : 'query[number_or_name]',
1136 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1137 loadingText : "Searching...",
1139 render : function (_self)
1141 _this.partsBox = _self;
1143 select : function (combo, record, index)
1145 var item_id = _this.form.findField('item_id').getValue() * 1;
1147 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
1153 _this.partsgrid.ds.each(function(d){
1154 if(record.data.item_id == d.data.bomitem_item_id){
1160 Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
1161 _this.partsBox.reset();
1166 url : baseURL + '/Roo/bomitem.php',
1169 bomitem_parent_item_id : item_id,
1170 bomitem_item_id : record.data.item_id,
1173 success : function(res) {
1174 _this.partsBox.reset();
1175 _this.partsgrid.footer.onClick('first');
1186 '|xns' : 'Roo.Toolbar',
1194 cls : 'x-btn-text-icon',
1195 icon : rootURL + '/Pman/templates/images/trash.gif',
1200 var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
1202 if(!sel || !sel.length){
1203 Roo.MessageBox.alert("Error", "Please select a item from below list");
1207 var d = _this.partsgrid.ds.getAt(sel[0]);
1209 if(d.data.bomitem_id * 1 < 1){
1210 Roo.MessageBox.alert("Error", "Invaild selection");
1215 url : baseURL + '/Roo/bomitem.php',
1218 _delete : d.data.bomitem_id
1220 success : function(res) {
1221 _this.partsgrid.footer.onClick('first');
1233 '|xns' : 'Roo.data',
1234 url : baseURL + '/Roo/bomitem.php',
1236 xtype : 'HttpProxy',
1240 '|xns' : 'Roo.data',
1243 xtype : 'JsonReader',
1246 'name': 'bomitem_id',
1251 totalProperty : 'total'
1253 '|xns' : 'Roo.data',
1256 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1259 beforeload : function (_self, o)
1261 o.params = o.params || {};
1263 var id = _this.form.findField('item_id').getValue() * 1;
1268 o.params.bom_parent_item_id = id;
1279 xtype : 'PagingToolbar',
1280 emptyMsg : "Nothing found",
1282 displayMsg : "Displaying parts {0} - {1} of {2}",
1285 '|xns' : 'Roo.grid',
1286 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1287 xtype : 'EditorGrid',
1293 '|xns' : 'Roo.grid',
1294 xtype : 'ColumnModel',
1297 renderer : function(v) { return String.format('{0}', v); },
1299 dataIndex : 'bomitem_item_id_item_number'
1302 '|xns' : 'Roo.grid',
1303 xtype : 'ColumnModel',
1305 header : 'Description',
1306 renderer : function(v) { return String.format('{0}', v); },
1308 dataIndex : 'bomitem_item_id_item_descrip1'
1313 '|xns' : 'Roo.form',
1315 cls : 'align-right',
1316 xtype : 'NumberField',
1317 decimalPrecision : 0,
1321 '|xns' : 'Roo.grid',
1322 xtype : 'GridEditor',
1329 '|xns' : 'Roo.grid',
1330 xtype : 'ColumnModel',
1334 renderer : function(v) { return String.format('{0}', v); },
1336 dataIndex : 'bomitem_qtyper',
1344 beforeedit : function (e)
1346 if(e.field != 'bomitem_qtyper'){
1353 _this.partsgrid = this;
1354 //_this.dialog = Pman.Dialog.FILL_IN
1355 if (_this.partspanel.active) {
1356 this.footer.onClick('first');
1359 afteredit : function (e)
1361 if(e.originalValue == e.value){
1368 url : baseURL + '/Roo/bomitem.php',
1371 bomitem_id : e.record.data.bomitem_id,
1372 bomitem_qtyper : e.value
1374 success : function() {
1375 e.record.set('bomitem_qtyper', e.value);
1394 title : "Item Parts",
1395 xtype : 'GridPanel',
1396 fitContainer : true,
1398 tableName : 'bomitem',
1400 activate : function() {
1401 _this.partspanel = this;
1403 try { if (MODULE.isBuilder) {
1407 var id = _this.form.findField('item_id').getValue() * 1;
1409 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1410 _this.dialog.layout.getRegion('center').showPanel(0);
1414 var type = _this.form.findField('item_type').getValue();
1416 if(!type.length || type != 'K'){
1417 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1418 _this.dialog.layout.getRegion('center').showPanel(0);
1422 if (_this.partsgrid) {
1423 _this.partsgrid.footer.onClick('first');
1437 '|xns' : 'Roo.data',
1440 xtype : 'JsonReader',
1475 'name': 'displayorder',
1483 'name': 'parent_image_id',
1489 'dateFormat' : 'Y-m-d H:i:s'
1509 totalProperty : 'total'
1512 '|xns' : 'Roo.data',
1513 url : baseURL + '/Roo/Images.php',
1515 xtype : 'HttpProxy',
1518 '|xns' : 'Roo.data',
1521 sortInfo : { field: 'created' , direction: 'DESC' },
1524 beforeload : function (_self, o)
1526 o.params = o.params || {};
1528 var id = _this.form.findField('item_id').getValue();
1535 o.params.ontable = 'item';
1547 xtype : 'PagingToolbar',
1548 emptyMsg : "No Images found",
1551 displayMsg : "Displaying Images {0} - {1} of {2}"
1559 '|xns' : 'Roo.Toolbar',
1562 cls : 'x-btn-text-icon',
1563 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1568 Pman.Dialog.Image.show({
1571 onid: _this.form.findField('item_id').getValue() * 1,
1574 if (!data) { return; }
1575 _this.grid.footer.onClick('first');
1582 '|xns' : 'Roo.Toolbar',
1585 cls : 'x-btn-text-icon',
1586 icon : rootURL + '/Pman/templates/images/trash.gif',
1591 Pman.genericDelete(_this, 'Images');
1598 '|xns' : 'Roo.grid',
1599 autoExpandColumn : 'id',
1605 '|xns' : 'Roo.grid',
1606 xtype : 'ColumnModel',
1610 renderer : function(v,x,r) {
1611 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1612 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1613 r.data.width, r.data.height
1617 dataIndex : 'created'
1620 '|xns' : 'Roo.grid',
1621 xtype : 'ColumnModel',
1624 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1630 rowdblclick : function (_self, rowIndex, e)
1633 var s = _self.getDataSource().getAt(rowIndex);
1635 url : baseURL + '/Images/Download/' + s.data.id
1639 render : function() {
1642 if (_this.panel.active) {
1643 this.footer.onClick('first');
1656 title : "Reference Files",
1657 xtype : 'GridPanel',
1658 fitContainer : true,
1660 tableName : 'Images',
1662 activate : function() {
1665 try { if (MODULE.isBuilder) {
1669 var id = _this.form.findField('item_id').getValue() * 1;
1671 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1672 _this.dialog.layout.getRegion('center').showPanel(0);
1677 _this.grid.footer.onClick('first');
1691 '|xns' : 'Roo.data',
1692 url : baseURL + '/Roo/ipshead.php',
1693 xtype : 'HttpProxy',
1698 '|xns' : 'Roo.data',
1701 xtype : 'JsonReader',
1704 'name': 'ipshead_id',
1708 'name': 'ipshead_name',
1713 totalProperty : 'total'
1715 '|xns' : 'Roo.data',
1718 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1721 beforeload : function (_self, o)
1723 o.params = o.params || {};
1725 var id = _this.form.findField('item_id').getValue() * 1;
1730 o.params._with_item = id;
1741 xtype : 'PagingToolbar',
1742 emptyMsg : "Nothing found",
1744 displayMsg : "Displaying records {0} - {1} of {2}",
1747 '|xns' : 'Roo.grid',
1748 autoExpandColumn : 'ipshead_descrip',
1749 xtype : 'EditorGrid',
1755 '|xns' : 'Roo.grid',
1756 xtype : 'ColumnModel',
1759 renderer : function(v) { return String.format('{0}', v); },
1761 dataIndex : 'ipshead_name'
1764 '|xns' : 'Roo.grid',
1765 xtype : 'ColumnModel',
1766 header : 'Description',
1768 renderer : function(v) { return String.format('{0}', v); },
1770 dataIndex : 'ipshead_descrip'
1773 '|xns' : 'Roo.grid',
1774 xtype : 'ColumnModel',
1775 header : 'Currency',
1777 renderer : function(v) { return String.format('{0}', v); },
1779 dataIndex : 'ipshead_curr_id_curr_name'
1784 '|xns' : 'Roo.form',
1785 xtype : 'NumberField',
1786 cls : 'align-right',
1787 decimalPrecision : 2,
1790 '|xns' : 'Roo.grid',
1791 xtype : 'GridEditor',
1798 '|xns' : 'Roo.grid',
1800 xtype : 'ColumnModel',
1803 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1805 dataIndex : 'ipshead_ipsitem_price',
1813 beforeedit : function (e)
1815 if(e.field != 'ipshead_ipsitem_price'){
1823 //_this.dialog = Pman.Dialog.FILL_IN
1824 if (_this.lpanel.active) {
1825 this.footer.onClick('first');
1828 afteredit : function (e)
1830 if(e.originalValue == e.value){
1834 var id = _this.form.findField('item_id').getValue() * 1;
1841 url : baseURL + '/Roo/ipsiteminfo',
1844 ipsitem_ipshead_id : e.record.data.ipshead_id,
1845 ipsitem_item_id : id,
1846 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1847 ipsitem_id : e.record.data.ipshead_ipsitem_id
1866 title : "Price List",
1867 xtype : 'GridPanel',
1868 fitContainer : true,
1870 tableName : 'ipshead',
1872 activate : function() {
1873 _this.lpanel = this;
1875 try { if (MODULE.isBuilder) {
1879 var id = _this.form.findField('item_id').getValue() * 1;
1881 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1882 _this.dialog.layout.getRegion('center').showPanel(0);
1887 _this.lgrid.footer.onClick('first');
1901 '|xns' : 'Roo.data',
1902 url : baseURL + '/Roo/itemsrc.php',
1904 xtype : 'HttpProxy',
1908 '|xns' : 'Roo.data',
1911 xtype : 'JsonReader',
1915 'name': 'itemsrc_id',
1919 'name': 'itemsrc_item_id',
1923 'name': 'itemsrc_item_id',
1927 'name': 'itemsrc_vend_id',
1931 'name': 'itemsrc_vend_id',
1935 'name': 'itemsrc_vend_item_number',
1939 'name': 'itemsrc_vend_item_descrip',
1943 'name': 'itemsrc_comments',
1947 'name': 'itemsrc_vend_uom',
1951 'name': 'itemsrc_invvendoruomratio',
1955 'name': 'itemsrc_minordqty',
1959 'name': 'itemsrc_multordqty',
1963 'name': 'itemsrc_leadtime',
1967 'name': 'itemsrc_ranking',
1971 'name': 'itemsrc_active',
1975 'name': 'itemsrc_manuf_name',
1979 'name': 'itemsrc_manuf_item_number',
1983 'name': 'itemsrc_manuf_item_descrip',
1987 'name': 'itemsrc_default',
1991 'name': 'itemsrc_upccode',
1995 totalProperty : 'total'
1997 '|xns' : 'Roo.data',
2000 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
2003 update : function (_self, record, operation)
2008 if (operation != 'commit') {
2011 if (record.data.itemsrc_vend_id * 1 < 1) {
2012 return; // do not save.
2014 if (record.data.itemsrc_id * 1 < 0) {
2015 return; // do not save. -- updating at present...
2018 var p = Roo.apply({}, record.data);
2019 record.set('itemsrc_id', -1);
2022 url : baseURL + '/Roo/Itemsrc',
2025 success: function(res) {
2026 if (record.data.itemsrc_id *1 < 1) {
2027 record.set('itemsrc_id', res.data.itemsrc_id);
2034 beforeload : function (_self, o)
2037 var id = 1 * _this.form.findField('item_id').getValue();
2042 o.params.itemsrc_item_id = id;
2053 xtype : 'PagingToolbar',
2054 emptyMsg : "No itemsrc found",
2057 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
2065 '|xns' : 'Roo.Toolbar',
2068 cls : 'x-btn-text-icon',
2069 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
2075 Roo.log("add presed");
2078 var grid = _this.itemsrcgrid;
2080 // uses form defaults or last row value.
2081 var nr = grid.ds.reader.newRow({
2083 itemsrc_item_id : _this.form.findField('item_id').getValue(),
2084 itemsrc_vend_id : 0,
2085 itemsrc_vend_id_vend_name : '',
2086 itemsrc_vend_item_number : '',
2087 itemsrc_vend_item_descrip : '',
2088 itemsrc_comments : '',
2089 itemsrc_vend_uom : 'EA',
2090 itemsrc_invvendoruomratio : 1.0,
2091 itemsrc_minordqty : 0,
2092 itemsrc_multordqty : 0,
2093 itemsrc_leadtime : 30,
2094 itemsrc_ranking : 0,
2095 itemsrc_active : true,
2096 itemsrc_manuf_name : '',
2097 itemsrc_manuf_item_number : '',
2098 itemsrc_manuf_item_descrip: '',
2099 itemsrc_default : true,
2100 itemsrc_upccode : ''
2104 grid.ds.insert(0, nr);
2105 grid.startEditing(0, 0); // type..
2113 '|xns' : 'Roo.grid',
2114 autoExpandColumn : 'itemsrc_comments',
2115 xtype : 'EditorGrid',
2125 '|xns' : 'Roo.data',
2126 url : baseURL + '/Roo/vendinfo.php',
2128 xtype : 'HttpProxy',
2132 '|xns' : 'Roo.data',
2135 xtype : 'JsonReader',
2137 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2138 totalProperty : 'total'
2140 '|xns' : 'Roo.data',
2144 sortInfo : { direction : 'ASC', field: 'id' },
2146 beforeload : function (_self, o){
2147 o.params = o.params || {};
2156 '|xns' : 'Roo.form',
2158 triggerAction : 'all',
2159 forceSelection : true,
2160 selectOnFocus : true,
2162 displayField : 'vend_name',
2163 emptyText : "Select Vendor",
2164 hiddenName : 'itemsrc_vend_id',
2166 valueField : 'vend_id',
2173 name : 'itemsrc_vend_id_vend_name',
2174 qtip : "Select vendinfo",
2175 queryParam : 'q[search]',
2176 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2177 loadingText : "Searching...",
2183 '|xns' : 'Roo.grid',
2184 xtype : 'GridEditor',
2191 '|xns' : 'Roo.grid',
2192 xtype : 'ColumnModel',
2195 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2197 dataIndex : 'itemsrc_vend_id',
2206 '|xns' : 'Roo.form',
2207 xtype : 'TextField',
2210 '|xns' : 'Roo.grid',
2211 xtype : 'GridEditor',
2218 '|xns' : 'Roo.grid',
2219 xtype : 'ColumnModel',
2220 header : 'Vendor Ref#',
2222 renderer : function(v) { return String.format('{0}', v); },
2224 dataIndex : 'itemsrc_vend_item_number',
2233 '|xns' : 'Roo.form',
2234 xtype : 'TextField',
2237 '|xns' : 'Roo.grid',
2238 xtype : 'GridEditor',
2245 '|xns' : 'Roo.grid',
2246 xtype : 'ColumnModel',
2247 header : 'Comments',
2249 renderer : function(v) { return String.format('{0}', v); },
2251 dataIndex : 'itemsrc_comments',
2258 '|xns' : 'Roo.grid',
2259 xtype : 'ColumnModel',
2262 renderer : function(v) { return String.format('{0}', v); },
2264 dataIndex : 'itemsrc_vend_uom'
2269 '|xns' : 'Roo.form',
2271 xtype : 'NumberField',
2272 decimalPrecision : 0,
2275 '|xns' : 'Roo.grid',
2276 xtype : 'GridEditor',
2283 '|xns' : 'Roo.grid',
2285 xtype : 'ColumnModel',
2288 renderer : function(v) { return String.format('{0}', v); },
2290 dataIndex : 'itemsrc_minordqty',
2299 '|xns' : 'Roo.form',
2301 xtype : 'NumberField',
2302 decimalPrecision : 0,
2305 '|xns' : 'Roo.grid',
2306 xtype : 'GridEditor',
2313 '|xns' : 'Roo.grid',
2315 xtype : 'ColumnModel',
2316 header : 'Lead time',
2318 renderer : function(v) { return String.format('{0}', v); },
2320 dataIndex : 'itemsrc_leadtime',
2327 '|xns' : 'Roo.grid',
2328 xtype : 'ColumnModel',
2331 renderer : function(v) { return String.format('{0}', v); },
2333 dataIndex : 'itemsrc_active'
2337 rowdblclick : function (_self, rowIndex, e)
2339 if (!_this.dialog) return;
2340 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2341 _this.grid.footer.onClick('first');
2346 _this.itemsrcgrid = this;
2348 if (_this.itemsrcpanel.active) {
2349 this.footer.onClick('first');
2352 afteredit : function (e)
2366 title : "Suppliers",
2367 xtype : 'GridPanel',
2368 fitContainer : true,
2370 tableName : 'itemsrc',
2372 activate : function() {
2373 _this.itemsrcpanel = this;
2375 try { if (MODULE.isBuilder) {
2379 var id = _this.form.findField('item_id').getValue() * 1;
2381 Roo.MessageBox.alert("Save First", "Save the item first, before adding suppliers");
2382 _this.dialog.layout.getRegion('center').showPanel(0);
2386 var type = _this.form.findField('item_type').getValue();
2389 Roo.MessageBox.alert("Error", "Can't add suppliers to kit item");
2390 _this.dialog.layout.getRegion('center').showPanel(0);
2394 if (_this.itemsrcgrid) {
2395 _this.itemsrcgrid.footer.onClick('first');
2408 '|xns' : 'Roo.data',
2409 url : baseURL + '/Roo/events.php',
2410 xtype : 'HttpProxy',
2415 '|xns' : 'Roo.data',
2418 xtype : 'JsonReader',
2421 'name': 'event_when',
2433 'name': 'person_id_name',
2442 totalProperty : 'total'
2444 '|xns' : 'Roo.data',
2447 sortInfo : { field : 'event_when', direction: 'DESC' },
2450 beforeload : function (_self, options)
2452 options.params = options.params || {};
2454 options.params.on_table = 'item';
2455 options.params.on_id = _this.form.findField('item_id').getValue();
2466 xtype : 'PagingToolbar',
2467 emptyMsg : "No Events found",
2469 displayMsg : "Displaying events{0} - {1} of {2}",
2472 '|xns' : 'Roo.grid',
2473 autoExpandColumn : 'remarks',
2479 '|xns' : 'Roo.grid',
2480 xtype : 'ColumnModel',
2483 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2485 dataIndex : 'event_when'
2488 '|xns' : 'Roo.grid',
2489 xtype : 'ColumnModel',
2492 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2494 dataIndex : 'action'
2497 '|xns' : 'Roo.grid',
2498 xtype : 'ColumnModel',
2499 header : 'IP Address',
2501 renderer : function(v) { return String.format('{0}', v); },
2503 dataIndex : 'ipaddr'
2506 '|xns' : 'Roo.grid',
2507 xtype : 'ColumnModel',
2510 renderer : function(v) { return String.format('{0}', v); },
2512 dataIndex : 'person_id_name'
2515 '|xns' : 'Roo.grid',
2516 xtype : 'ColumnModel',
2519 renderer : function(v) { return String.format('{0}', v); },
2521 dataIndex : 'remarks'
2528 if (_this.hpanel.active) {
2529 this.footer.onClick('first');
2543 xtype : 'GridPanel',
2544 fitContainer : true,
2546 tableName : 'events',
2548 activate : function() {
2549 _this.hpanel = this;
2551 _this.hgrid.footer.onClick('first');