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...",
380 fieldLabel : 'Weight',
381 xtype : 'NumberField',
383 allowDecimals : true,
384 decimalPrecision : 2,
387 name : 'item_prodweight'
391 fieldLabel : 'Item comments',
395 name : 'item_comments',
400 fieldLabel : 'Item sold',
410 fieldLabel : 'Item active',
422 url : baseURL + '/Roo/prodcat.php',
431 xtype : 'JsonReader',
433 fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
434 totalProperty : 'total'
440 sortInfo : { direction : 'ASC', field: 'id' },
442 beforeload : function (_self, o){
443 o.params = o.params || {};
455 triggerAction : 'all',
456 fieldLabel : 'Product Category',
457 forceSelection : true,
458 selectOnFocus : true,
460 displayField : 'prodcat_code',
461 emptyText : "Select Category",
462 hiddenName : 'item_prodcat_id',
464 valueField : 'prodcat_id',
471 name : 'item_prodcat_id_prodcat_code',
472 qtip : "Select prodcat",
474 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
475 loadingText : "Searching...",
477 add : function (combo)
479 Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
481 edit : function (combo, record)
483 var s = _this.form.findField('item_prodcat_id').getValue() * 1;
485 Roo.MessageBox.alert('Error','Please select a account assignment');
488 Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
498 fieldLabel : 'Sales Account',
499 xtype : 'DisplayField',
501 name : 'item_salesaccnt'
505 fieldLabel : 'Item listprice',
506 xtype : 'NumberField',
509 name : 'item_listprice'
513 style : 'width:320px',
515 legend : "Standard Cost",
518 render : function (_self)
520 _this.standardCostFieldSet = _self;
528 url : baseURL + '/Roo/curr_symbol.php',
537 xtype : 'JsonReader',
539 fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
540 totalProperty : 'total'
545 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
548 beforeload : function (_self, o){
549 o.params = o.params || {};
561 triggerAction : 'all',
562 fieldLabel : 'Currency',
563 forceSelection : true,
564 selectOnFocus : true,
566 displayField : 'curr_name',
567 emptyText : "Select Currency",
568 hiddenName : 'item_itemcost_id_itemcost_curr_id',
570 valueField : 'curr_id',
578 qtip : "Select Currency",
579 queryParam : 'query[curr_name]',
580 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
581 loadingText : "Searching...",
589 fieldLabel : 'Value',
590 xtype : 'NumberField',
594 name : 'item_itemcost_id_itemcost_actcost'
610 legend : "Itemsite Settings",
612 style : 'width:335px;',
615 render : function (_self)
617 _this.itemsiteFieldSet = _self;
623 fieldLabel : 'Reorder Level',
624 xtype : 'NumberField',
628 name : 'item_itemsite_id_itemsite_reorderlevel'
632 fieldLabel : 'Stock Safety Level',
633 xtype : 'NumberField',
637 name : 'item_itemsite_id_itemsite_safetystock'
641 fieldLabel : 'Lead time (Days)',
642 xtype : 'NumberField',
646 name : 'item_itemsite_id_itemsite_leadtime'
651 xtype : 'SimpleStore',
656 fields : [ 'ftype', 'fname'],
661 triggerAction : 'all',
662 fieldLabel : 'Control Method',
663 displayField : 'fname',
664 hiddenName : 'item_itemsite_id_itemsite_controlmethod',
665 valueField : 'ftype',
672 name : 'item_itemsite_id_itemsite_controlmethod_name',
673 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
683 url : baseURL + '/Roo/plancode.php',
692 xtype : 'JsonReader',
694 fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
695 totalProperty : 'total'
701 sortInfo : { direction : 'ASC', field: 'id' },
703 beforeload : function (_self, o){
704 o.params = o.params || {};
715 triggerAction : 'all',
716 fieldLabel : 'Planner Code',
717 forceSelection : true,
718 selectOnFocus : true,
720 displayField : 'plancode_name',
721 emptyText : "Select plancode",
722 hiddenName : 'item_itemsite_id_itemsite_plancode_id',
724 valueField : 'plancode_id',
731 name : 'plancode_name',
732 qtip : "Select plancode",
734 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
735 loadingText : "Searching...",
745 url : baseURL + '/Roo/costcat.php',
754 xtype : 'JsonReader',
756 fields : [{"name":"id","type":"int"},{"name":"costcat_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 : 'Costcat',
779 forceSelection : true,
780 selectOnFocus : true,
782 displayField : 'costcat_code',
783 emptyText : "Select costcat",
784 hiddenName : 'item_itemsite_id_itemsite_costcat_id',
786 valueField : 'costcat_id',
793 name : 'costcat_code',
794 qtip : "Select costcat",
796 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
797 loadingText : "Searching...",
805 fieldLabel : 'Active',
811 name : 'item_itemsite_id_itemsite_active'
821 name : 'item_itemsite_id_itemsite_sold'
825 fieldLabel : 'Stocked',
831 name : 'item_itemsite_id_itemsite_stocked'
835 fieldLabel : 'Perishable',
841 name : 'item_itemsite_id_itemsite_perishable'
845 fieldLabel : 'Multi Location',
851 name : 'item_itemsite_id_itemsite_loccntrl'
857 url : baseURL + '/Roo/location.php',
866 xtype : 'JsonReader',
867 fields : [{"name":"location_id","type":"int"},"location_name"],
869 totalProperty : 'total'
874 sortInfo : { direction : 'ASC', field: 'location_name' },
877 beforeload : function (_self, o){
878 o.params = o.params || {};
880 o.params.location_netable = 1;
881 o.params._notinternalcompany = 1;
882 o.params.location_restrict = 0;
892 triggerAction : 'all',
893 fieldLabel : 'Default Location',
894 forceSelection : true,
895 selectOnFocus : true,
897 displayField : 'location_name',
898 emptyText : "Default Location",
899 hiddenName : 'item_itemsite_id_itemsite_location_id',
901 valueField : 'location_id',
908 name : 'location_name',
909 qtip : "Select terms",
910 queryParam : 'query[location_name]',
911 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
912 loadingText : "Searching...",
937 name : '_update_related'
956 url : baseURL + '/Roo/item.php',
965 xtype : 'JsonReader',
967 {"name":"id","type":"int"},
968 {"name":"item_number","type":"string"}
971 totalProperty : 'total'
976 sortInfo : { direction : 'ASC', field: 'item_number' },
979 beforeload : function (_self, o){
980 o.params = o.params || {};
982 o.params.item_active = 1;
983 o.params['!item_type'] = 'K';
991 '|xns' : 'Roo.bootstrap',
993 triggerAction : 'all',
995 forceSelection : true,
996 selectOnFocus : true,
998 displayField : 'item_number',
999 emptyText : "Select item",
1007 xns : Roo.bootstrap,
1008 qtip : "Select item",
1009 queryParam : 'query[number_or_name]',
1010 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1011 loadingText : "Searching...",
1013 render : function (_self)
1015 _this.partsBox = _self;
1017 select : function (combo, record, index)
1019 var item_id = _this.form.findField('item_id').getValue() * 1;
1021 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
1027 _this.partsgrid.ds.each(function(d){
1028 if(record.data.item_id == d.data.bomitem_item_id){
1034 Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
1035 _this.partsBox.reset();
1040 url : baseURL + '/Roo/bomitem.php',
1043 bomitem_parent_item_id : item_id,
1044 bomitem_item_id : record.data.item_id
1046 success : function(res) {
1047 _this.partsBox.reset();
1048 _this.partsgrid.footer.onClick('first');
1059 '|xns' : 'Roo.Toolbar',
1067 cls : 'x-btn-text-icon',
1068 icon : rootURL + '/Pman/templates/images/trash.gif',
1073 var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
1075 if(!sel || !sel.length){
1076 Roo.MessageBox.alert("Error", "Please select a item from below list");
1080 var d = _this.partsgrid.ds.getAt(sel[0]);
1082 if(d.data.bomitem_id * 1 < 1){
1083 Roo.MessageBox.alert("Error", "Invaild selection");
1088 url : baseURL + '/Roo/bomitem.php',
1091 _delete : d.data.bomitem_id
1093 success : function(res) {
1094 _this.partsgrid.footer.onClick('first');
1106 '|xns' : 'Roo.data',
1107 url : baseURL + '/Roo/bomitem.php',
1108 xtype : 'HttpProxy',
1113 '|xns' : 'Roo.data',
1116 xtype : 'JsonReader',
1119 'name': 'bomitem_id',
1124 totalProperty : 'total'
1126 '|xns' : 'Roo.data',
1129 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1132 beforeload : function (_self, o)
1134 o.params = o.params || {};
1136 var id = _this.form.findField('item_id').getValue() * 1;
1141 o.params.bom_parent_item_id = id;
1152 xtype : 'PagingToolbar',
1153 emptyMsg : "Nothing found",
1155 displayMsg : "Displaying parts {0} - {1} of {2}",
1158 '|xns' : 'Roo.grid',
1159 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1160 xtype : 'EditorGrid',
1166 '|xns' : 'Roo.grid',
1167 xtype : 'ColumnModel',
1170 renderer : function(v) { return String.format('{0}', v); },
1172 dataIndex : 'bomitem_item_id_item_number'
1175 '|xns' : 'Roo.grid',
1176 xtype : 'ColumnModel',
1177 header : 'Description',
1179 renderer : function(v) { return String.format('{0}', v); },
1181 dataIndex : 'bomitem_item_id_item_descrip1'
1186 '|xns' : 'Roo.form',
1188 cls : 'align-right',
1189 xtype : 'NumberField',
1190 decimalPrecision : 0,
1194 '|xns' : 'Roo.grid',
1195 xtype : 'GridEditor',
1202 '|xns' : 'Roo.grid',
1203 xtype : 'ColumnModel',
1207 renderer : function(v) { return String.format('{0}', v); },
1209 dataIndex : 'bomitem_qtyper',
1217 beforeedit : function (e)
1219 if(e.field != 'bomitem_qtyper'){
1226 _this.partsgrid = this;
1227 //_this.dialog = Pman.Dialog.FILL_IN
1228 if (_this.partspanel.active) {
1229 this.footer.onClick('first');
1232 afteredit : function (e)
1236 if(e.originalValue == e.value){
1242 var id = _this.form.findField('item_id').getValue() * 1;
1249 url : baseURL + '/Roo/ipsiteminfo',
1252 ipsitem_ipshead_id : e.record.data.ipshead_id,
1253 ipsitem_item_id : id,
1254 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1255 ipsitem_id : e.record.data.ipshead_ipsitem_id
1274 title : "Item Parts",
1275 xtype : 'GridPanel',
1276 fitContainer : true,
1278 tableName : 'bomitem',
1280 activate : function() {
1281 _this.partspanel = this;
1283 try { if (MODULE.isBuilder) {
1287 var id = _this.form.findField('item_id').getValue() * 1;
1289 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1290 _this.dialog.layout.getRegion('center').showPanel(0);
1294 var type = _this.form.findField('item_type').getValue();
1296 if(!type.length || type != 'K'){
1297 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1298 _this.dialog.layout.getRegion('center').showPanel(0);
1302 if (_this.partsgrid) {
1303 _this.partsgrid.footer.onClick('first');
1317 '|xns' : 'Roo.data',
1320 xtype : 'JsonReader',
1355 'name': 'displayorder',
1363 'name': 'parent_image_id',
1369 'dateFormat' : 'Y-m-d H:i:s'
1389 totalProperty : 'total'
1392 '|xns' : 'Roo.data',
1393 url : baseURL + '/Roo/Images.php',
1394 xtype : 'HttpProxy',
1398 '|xns' : 'Roo.data',
1401 sortInfo : { field: 'created' , direction: 'DESC' },
1404 beforeload : function (_self, o)
1406 o.params = o.params || {};
1408 var id = _this.form.findField('item_id').getValue();
1415 o.params.ontable = 'item';
1427 xtype : 'PagingToolbar',
1428 emptyMsg : "No Images found",
1431 displayMsg : "Displaying Images {0} - {1} of {2}"
1439 '|xns' : 'Roo.Toolbar',
1442 cls : 'x-btn-text-icon',
1443 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1448 Pman.Dialog.Image.show({
1451 onid: _this.form.findField('item_id').getValue() * 1,
1454 if (!data) { return; }
1455 _this.grid.footer.onClick('first');
1462 '|xns' : 'Roo.Toolbar',
1465 cls : 'x-btn-text-icon',
1466 icon : rootURL + '/Pman/templates/images/trash.gif',
1471 Pman.genericDelete(_this, 'Images');
1478 '|xns' : 'Roo.grid',
1479 autoExpandColumn : 'id',
1485 '|xns' : 'Roo.grid',
1486 xtype : 'ColumnModel',
1490 renderer : function(v,x,r) {
1491 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1492 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1493 r.data.width, r.data.height
1497 dataIndex : 'created'
1500 '|xns' : 'Roo.grid',
1501 xtype : 'ColumnModel',
1504 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1510 rowdblclick : function (_self, rowIndex, e)
1513 var s = _self.getDataSource().getAt(rowIndex);
1515 url : baseURL + '/Images/Download/' + s.data.id
1519 render : function() {
1522 if (_this.panel.active) {
1523 this.footer.onClick('first');
1536 title : "Reference Files",
1537 xtype : 'GridPanel',
1538 fitContainer : true,
1540 tableName : 'Images',
1542 activate : function() {
1545 try { if (MODULE.isBuilder) {
1549 var id = _this.form.findField('item_id').getValue() * 1;
1551 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1552 _this.dialog.layout.getRegion('center').showPanel(0);
1557 _this.grid.footer.onClick('first');
1571 '|xns' : 'Roo.data',
1572 url : baseURL + '/Roo/ipshead.php',
1574 xtype : 'HttpProxy',
1578 '|xns' : 'Roo.data',
1581 xtype : 'JsonReader',
1584 'name': 'ipshead_id',
1588 'name': 'ipshead_name',
1593 totalProperty : 'total'
1595 '|xns' : 'Roo.data',
1598 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1601 beforeload : function (_self, o)
1603 o.params = o.params || {};
1605 var id = _this.form.findField('item_id').getValue() * 1;
1610 o.params._with_item = id;
1621 xtype : 'PagingToolbar',
1622 emptyMsg : "Nothing found",
1624 displayMsg : "Displaying records {0} - {1} of {2}",
1627 '|xns' : 'Roo.grid',
1628 autoExpandColumn : 'ipshead_descrip',
1629 xtype : 'EditorGrid',
1635 '|xns' : 'Roo.grid',
1636 xtype : 'ColumnModel',
1639 renderer : function(v) { return String.format('{0}', v); },
1641 dataIndex : 'ipshead_name'
1644 '|xns' : 'Roo.grid',
1645 xtype : 'ColumnModel',
1647 header : 'Description',
1648 renderer : function(v) { return String.format('{0}', v); },
1650 dataIndex : 'ipshead_descrip'
1653 '|xns' : 'Roo.grid',
1654 xtype : 'ColumnModel',
1656 header : 'Currency',
1657 renderer : function(v) { return String.format('{0}', v); },
1659 dataIndex : 'ipshead_curr_id_curr_name'
1664 '|xns' : 'Roo.form',
1665 xtype : 'NumberField',
1666 cls : 'align-right',
1667 decimalPrecision : 2,
1670 '|xns' : 'Roo.grid',
1671 xtype : 'GridEditor',
1678 '|xns' : 'Roo.grid',
1680 xtype : 'ColumnModel',
1683 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1685 dataIndex : 'ipshead_ipsitem_price',
1693 beforeedit : function (e)
1695 if(e.field != 'ipshead_ipsitem_price'){
1703 //_this.dialog = Pman.Dialog.FILL_IN
1704 if (_this.lpanel.active) {
1705 this.footer.onClick('first');
1708 afteredit : function (e)
1710 if(e.originalValue == e.value){
1714 var id = _this.form.findField('item_id').getValue() * 1;
1721 url : baseURL + '/Roo/ipsiteminfo',
1724 ipsitem_ipshead_id : e.record.data.ipshead_id,
1725 ipsitem_item_id : id,
1726 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1727 ipsitem_id : e.record.data.ipshead_ipsitem_id
1746 title : "Price List",
1747 xtype : 'GridPanel',
1748 fitContainer : true,
1750 tableName : 'ipshead',
1752 activate : function() {
1753 _this.lpanel = this;
1755 try { if (MODULE.isBuilder) {
1759 var id = _this.form.findField('item_id').getValue() * 1;
1761 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1762 _this.dialog.layout.getRegion('center').showPanel(0);
1767 _this.lgrid.footer.onClick('first');
1781 '|xns' : 'Roo.data',
1782 url : baseURL + '/Roo/itemsrc.php',
1783 xtype : 'HttpProxy',
1788 '|xns' : 'Roo.data',
1791 xtype : 'JsonReader',
1795 'name': 'itemsrc_id',
1799 'name': 'itemsrc_item_id',
1803 'name': 'itemsrc_item_id',
1807 'name': 'itemsrc_vend_id',
1811 'name': 'itemsrc_vend_id',
1815 'name': 'itemsrc_vend_item_number',
1819 'name': 'itemsrc_vend_item_descrip',
1823 'name': 'itemsrc_comments',
1827 'name': 'itemsrc_vend_uom',
1831 'name': 'itemsrc_invvendoruomratio',
1835 'name': 'itemsrc_minordqty',
1839 'name': 'itemsrc_multordqty',
1843 'name': 'itemsrc_leadtime',
1847 'name': 'itemsrc_ranking',
1851 'name': 'itemsrc_active',
1855 'name': 'itemsrc_manuf_name',
1859 'name': 'itemsrc_manuf_item_number',
1863 'name': 'itemsrc_manuf_item_descrip',
1867 'name': 'itemsrc_default',
1871 'name': 'itemsrc_upccode',
1875 totalProperty : 'total'
1877 '|xns' : 'Roo.data',
1880 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
1883 update : function (_self, record, operation)
1888 if (operation != 'commit') {
1891 if (record.data.itemsrc_vend_id * 1 < 1) {
1892 return; // do not save.
1894 if (record.data.itemsrc_id * 1 < 0) {
1895 return; // do not save. -- updating at present...
1898 var p = Roo.apply({}, record.data);
1899 record.set('itemsrc_id', -1);
1902 url : baseURL + '/Roo/Itemsrc',
1905 success: function(res) {
1906 if (record.data.itemsrc_id *1 < 1) {
1907 record.set('itemsrc_id', res.data.itemsrc_id);
1914 beforeload : function (_self, o)
1917 var id = 1 * _this.form.findField('item_id').getValue();
1922 o.params.itemsrc_item_id = id;
1933 xtype : 'PagingToolbar',
1934 emptyMsg : "No itemsrc found",
1937 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
1945 '|xns' : 'Roo.Toolbar',
1948 cls : 'x-btn-text-icon',
1949 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1955 Roo.log("add presed");
1958 var grid = _this.itemsrcgrid;
1960 // uses form defaults or last row value.
1961 var nr = grid.ds.reader.newRow({
1963 itemsrc_item_id : _this.form.findField('item_id').getValue(),
1965 itemsrc_vend_id : 0,
1966 itemsrc_vend_item_number : '',
1967 itemsrc_vend_item_descrip : '',
1968 itemsrc_comments : '',
1969 itemsrc_vend_uom : 'EA',
1970 itemsrc_invvendoruomratio : 1.0,
1971 itemsrc_minordqty : 0,
1972 itemsrc_multordqty : 0,
1973 itemsrc_leadtime : 30,
1974 itemsrc_ranking : 0,
1975 itemsrc_active : true,
1976 itemsrc_manuf_name : '',
1977 itemsrc_manuf_item_number : '',
1978 itemsrc_manuf_item_descrip: '',
1979 itemsrc_default : true,
1980 itemsrc_upccode : ''
1984 grid.ds.insert(0, nr);
1985 grid.startEditing(0, 0); // type..
1993 '|xns' : 'Roo.grid',
1994 autoExpandColumn : 'itemsrc_comments',
1995 xtype : 'EditorGrid',
2005 '|xns' : 'Roo.data',
2006 url : baseURL + '/Roo/vendinfo.php',
2007 xtype : 'HttpProxy',
2012 '|xns' : 'Roo.data',
2015 xtype : 'JsonReader',
2017 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2018 totalProperty : 'total'
2020 '|xns' : 'Roo.data',
2024 sortInfo : { direction : 'ASC', field: 'id' },
2026 beforeload : function (_self, o){
2027 o.params = o.params || {};
2036 '|xns' : 'Roo.form',
2038 triggerAction : 'all',
2039 forceSelection : true,
2040 selectOnFocus : true,
2042 displayField : 'vend_name',
2043 emptyText : "Select Vendor",
2044 hiddenName : 'itemsrc_vend_id',
2046 valueField : 'vend_id',
2053 name : 'itemsrc_vend_id_vend_name',
2054 qtip : "Select vendinfo",
2055 queryParam : 'q[search]',
2056 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2057 loadingText : "Searching...",
2063 '|xns' : 'Roo.grid',
2064 xtype : 'GridEditor',
2071 '|xns' : 'Roo.grid',
2072 xtype : 'ColumnModel',
2075 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2077 dataIndex : 'itemsrc_vend_id',
2086 '|xns' : 'Roo.form',
2087 xtype : 'TextField',
2090 '|xns' : 'Roo.grid',
2091 xtype : 'GridEditor',
2098 '|xns' : 'Roo.grid',
2099 xtype : 'ColumnModel',
2101 header : 'Vendor Ref#',
2102 renderer : function(v) { return String.format('{0}', v); },
2104 dataIndex : 'itemsrc_vend_item_number',
2113 '|xns' : 'Roo.form',
2114 xtype : 'TextField',
2117 '|xns' : 'Roo.grid',
2118 xtype : 'GridEditor',
2125 '|xns' : 'Roo.grid',
2126 xtype : 'ColumnModel',
2128 header : 'Comments',
2129 renderer : function(v) { return String.format('{0}', v); },
2131 dataIndex : 'itemsrc_comments',
2138 '|xns' : 'Roo.grid',
2139 xtype : 'ColumnModel',
2142 renderer : function(v) { return String.format('{0}', v); },
2144 dataIndex : 'itemsrc_vend_uom'
2149 '|xns' : 'Roo.form',
2151 xtype : 'NumberField',
2152 decimalPrecision : 0,
2155 '|xns' : 'Roo.grid',
2156 xtype : 'GridEditor',
2163 '|xns' : 'Roo.grid',
2165 xtype : 'ColumnModel',
2168 renderer : function(v) { return String.format('{0}', v); },
2170 dataIndex : 'itemsrc_minordqty',
2179 '|xns' : 'Roo.form',
2181 xtype : 'NumberField',
2182 decimalPrecision : 0,
2185 '|xns' : 'Roo.grid',
2186 xtype : 'GridEditor',
2193 '|xns' : 'Roo.grid',
2195 xtype : 'ColumnModel',
2196 header : 'Lead time',
2198 renderer : function(v) { return String.format('{0}', v); },
2200 dataIndex : 'itemsrc_leadtime',
2207 '|xns' : 'Roo.grid',
2208 xtype : 'ColumnModel',
2211 renderer : function(v) { return String.format('{0}', v); },
2213 dataIndex : 'itemsrc_active'
2217 rowdblclick : function (_self, rowIndex, e)
2219 if (!_this.dialog) return;
2220 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2221 _this.grid.footer.onClick('first');
2226 _this.itemsrcgrid = this;
2227 //_this.dialog = Pman.Dialog.FILL_IN
2230 afteredit : function (e)
2244 title : "Suppliers",
2245 xtype : 'GridPanel',
2246 fitContainer : true,
2248 tableName : 'itemsrc',
2250 activate : function() {
2251 _this.itemsrcpanel = this;
2252 if (_this.itemsrcgrid) {
2253 _this.itemsrcgrid.footer.onClick('first');
2266 '|xns' : 'Roo.data',
2267 url : baseURL + '/Roo/events.php',
2269 xtype : 'HttpProxy',
2273 '|xns' : 'Roo.data',
2276 xtype : 'JsonReader',
2279 'name': 'event_when',
2291 'name': 'person_id_name',
2300 totalProperty : 'total'
2302 '|xns' : 'Roo.data',
2305 sortInfo : { field : 'event_when', direction: 'DESC' },
2308 beforeload : function (_self, options)
2310 options.params = options.params || {};
2312 options.params.on_table = 'item';
2313 options.params.on_id = _this.form.findField('item_id').getValue();
2324 xtype : 'PagingToolbar',
2325 emptyMsg : "No Events found",
2327 displayMsg : "Displaying events{0} - {1} of {2}",
2330 '|xns' : 'Roo.grid',
2331 autoExpandColumn : 'remarks',
2337 '|xns' : 'Roo.grid',
2338 xtype : 'ColumnModel',
2341 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2343 dataIndex : 'event_when'
2346 '|xns' : 'Roo.grid',
2347 xtype : 'ColumnModel',
2350 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2352 dataIndex : 'action'
2355 '|xns' : 'Roo.grid',
2356 xtype : 'ColumnModel',
2358 header : 'IP Address',
2359 renderer : function(v) { return String.format('{0}', v); },
2361 dataIndex : 'ipaddr'
2364 '|xns' : 'Roo.grid',
2365 xtype : 'ColumnModel',
2368 renderer : function(v) { return String.format('{0}', v); },
2370 dataIndex : 'person_id_name'
2373 '|xns' : 'Roo.grid',
2374 xtype : 'ColumnModel',
2377 renderer : function(v) { return String.format('{0}', v); },
2379 dataIndex : 'remarks'
2386 if (_this.hpanel.active) {
2387 this.footer.onClick('first');
2401 xtype : 'GridPanel',
2402 fitContainer : true,
2404 tableName : 'events',
2406 activate : function() {
2407 _this.hpanel = this;
2409 _this.hgrid.footer.onClick('first');