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/Core_enum.php',
965 xtype : 'JsonReader',
967 {"name":"id","type":"int"},
968 {"name":"name","type":"string"},
969 {"name":"display_name","type":"string"}
972 totalProperty : 'total'
977 sortInfo : { direction : 'ASC', field: 'name' },
980 beforeload : function (_self, o){
981 o.params = o.params || {};
983 o.params.etype = 'crm_interest';
992 '|xns' : 'Roo.bootstrap',
995 triggerAction : 'all',
996 fieldLabel : 'Interests',
997 forceSelection : true,
998 selectOnFocus : true,
1000 displayField : 'display_name',
1001 emptyText : "Select interests",
1010 xns : Roo.bootstrap,
1012 qtip : "Select Interests",
1013 queryParam : 'query[search]',
1014 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
1015 loadingText : "Searching...",
1017 render : function (_self)
1019 _this.partsBox = _self;
1021 select : function (combo, record, index)
1025 /* var event_id = _this.form.findField('id').getValue() * 1;
1027 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || event_id < 1){
1033 _this.fgrid.ds.each(function(d){
1034 if(record.data.id == d.data.interest_id){
1040 Roo.MessageBox.alert('Error', record.data.display_name + ' already exists!');
1041 _this.focusBox.reset();
1046 url : baseURL + '/Roo/cal_event_focus.php',
1049 cal_event_id : event_id,
1050 interest_id : record.data.id
1052 success : function(res) {
1053 _this.focusBox.reset();
1054 _this.fgrid.footer.onClick('first');
1065 '|xns' : 'Roo.Toolbar',
1066 xtype : 'Separator',
1073 cls : 'x-btn-text-icon',
1074 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1079 Pman.Dialog.CoreEnum.show( {id : 0, etype : 'crm_interest'}, function(res){
1080 _this.focusBox.setFromData(res);
1085 _this.focusBox.fireEvent('select', _this.focusBox, record);
1092 '|xns' : 'Roo.Toolbar',
1100 cls : 'x-btn-text-icon',
1101 icon : rootURL + '/Pman/templates/images/trash.gif',
1106 var sel = _this.fgrid.getSelectionModel().getSelections();
1108 if(!sel || !sel.length){
1109 Roo.MessageBox.alert("Error", "Please select interests from below list");
1117 Roo.each(sel, function(s){
1118 if(s.data.id * 1 < 1){ // bad data?
1126 url : baseURL + '/Roo/cal_event_focus.php',
1129 _delete : id.join(',')
1131 success : function(res) {
1132 _this.fgrid.footer.onClick('first');
1144 '|xns' : 'Roo.data',
1145 url : baseURL + '/Roo/bomitem.php',
1146 xtype : 'HttpProxy',
1151 '|xns' : 'Roo.data',
1154 xtype : 'JsonReader',
1157 'name': 'bomitem_id',
1162 totalProperty : 'total'
1164 '|xns' : 'Roo.data',
1167 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1170 beforeload : function (_self, o)
1172 o.params = o.params || {};
1174 var id = _this.form.findField('item_id').getValue() * 1;
1179 o.params.bom_parent_item_id = id;
1190 xtype : 'PagingToolbar',
1191 emptyMsg : "Nothing found",
1193 displayMsg : "Displaying parts {0} - {1} of {2}",
1196 '|xns' : 'Roo.grid',
1197 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1198 xtype : 'EditorGrid',
1204 '|xns' : 'Roo.grid',
1205 xtype : 'ColumnModel',
1208 renderer : function(v) { return String.format('{0}', v); },
1210 dataIndex : 'bomitem_item_id_item_name'
1213 '|xns' : 'Roo.grid',
1214 xtype : 'ColumnModel',
1215 header : 'Description',
1217 renderer : function(v) { return String.format('{0}', v); },
1219 dataIndex : 'bomitem_item_id_item_descrip1'
1222 '|xns' : 'Roo.grid',
1223 xtype : 'ColumnModel',
1226 renderer : function(v) { return String.format('{0}', v); },
1228 dataIndex : 'bomitem_qtyper'
1232 beforeedit : function (e)
1234 if(e.field != 'ipshead_ipsitem_price'){
1241 _this.partsgrid = this;
1242 //_this.dialog = Pman.Dialog.FILL_IN
1243 if (_this.partspanel.active) {
1244 this.footer.onClick('first');
1247 afteredit : function (e)
1249 if(e.originalValue == e.value){
1255 var id = _this.form.findField('item_id').getValue() * 1;
1262 url : baseURL + '/Roo/ipsiteminfo',
1265 ipsitem_ipshead_id : e.record.data.ipshead_id,
1266 ipsitem_item_id : id,
1267 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1268 ipsitem_id : e.record.data.ipshead_ipsitem_id
1287 title : "Item Parts",
1288 xtype : 'GridPanel',
1289 fitContainer : true,
1291 tableName : 'bomitem',
1293 activate : function() {
1294 _this.lpanel = this;
1296 try { if (MODULE.isBuilder) {
1300 var id = _this.form.findField('item_id').getValue() * 1;
1302 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1303 _this.dialog.layout.getRegion('center').showPanel(0);
1307 var type = _this.form.findField('item_type').getValue();
1309 if(!type.length || type != 'K'){
1310 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1311 _this.dialog.layout.getRegion('center').showPanel(0);
1315 if (_this.partsgrid) {
1316 _this.partsgrid.footer.onClick('first');
1330 '|xns' : 'Roo.data',
1333 xtype : 'JsonReader',
1368 'name': 'displayorder',
1376 'name': 'parent_image_id',
1382 'dateFormat' : 'Y-m-d H:i:s'
1402 totalProperty : 'total'
1405 '|xns' : 'Roo.data',
1406 url : baseURL + '/Roo/Images.php',
1407 xtype : 'HttpProxy',
1411 '|xns' : 'Roo.data',
1414 sortInfo : { field: 'created' , direction: 'DESC' },
1417 beforeload : function (_self, o)
1419 o.params = o.params || {};
1421 var id = _this.form.findField('item_id').getValue();
1428 o.params.ontable = 'item';
1440 xtype : 'PagingToolbar',
1441 emptyMsg : "No Images found",
1444 displayMsg : "Displaying Images {0} - {1} of {2}"
1452 '|xns' : 'Roo.Toolbar',
1455 cls : 'x-btn-text-icon',
1456 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1461 Pman.Dialog.Image.show({
1464 onid: _this.form.findField('item_id').getValue() * 1,
1467 if (!data) { return; }
1468 _this.grid.footer.onClick('first');
1475 '|xns' : 'Roo.Toolbar',
1478 cls : 'x-btn-text-icon',
1479 icon : rootURL + '/Pman/templates/images/trash.gif',
1484 Pman.genericDelete(_this, 'Images');
1491 '|xns' : 'Roo.grid',
1492 autoExpandColumn : 'id',
1498 '|xns' : 'Roo.grid',
1499 xtype : 'ColumnModel',
1503 renderer : function(v,x,r) {
1504 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1505 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1506 r.data.width, r.data.height
1510 dataIndex : 'created'
1513 '|xns' : 'Roo.grid',
1514 xtype : 'ColumnModel',
1517 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1523 rowdblclick : function (_self, rowIndex, e)
1526 var s = _self.getDataSource().getAt(rowIndex);
1528 url : baseURL + '/Images/Download/' + s.data.id
1532 render : function() {
1535 if (_this.panel.active) {
1536 this.footer.onClick('first');
1549 title : "Reference Files",
1550 xtype : 'GridPanel',
1551 fitContainer : true,
1553 tableName : 'Images',
1555 activate : function() {
1558 try { if (MODULE.isBuilder) {
1562 var id = _this.form.findField('item_id').getValue() * 1;
1564 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1565 _this.dialog.layout.getRegion('center').showPanel(0);
1570 _this.grid.footer.onClick('first');
1584 '|xns' : 'Roo.data',
1585 url : baseURL + '/Roo/ipshead.php',
1587 xtype : 'HttpProxy',
1591 '|xns' : 'Roo.data',
1594 xtype : 'JsonReader',
1597 'name': 'ipshead_id',
1601 'name': 'ipshead_name',
1606 totalProperty : 'total'
1608 '|xns' : 'Roo.data',
1611 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1614 beforeload : function (_self, o)
1616 o.params = o.params || {};
1618 var id = _this.form.findField('item_id').getValue() * 1;
1623 o.params._with_item = id;
1634 xtype : 'PagingToolbar',
1635 emptyMsg : "Nothing found",
1637 displayMsg : "Displaying records {0} - {1} of {2}",
1640 '|xns' : 'Roo.grid',
1641 autoExpandColumn : 'ipshead_descrip',
1642 xtype : 'EditorGrid',
1648 '|xns' : 'Roo.grid',
1649 xtype : 'ColumnModel',
1652 renderer : function(v) { return String.format('{0}', v); },
1654 dataIndex : 'ipshead_name'
1657 '|xns' : 'Roo.grid',
1658 xtype : 'ColumnModel',
1660 header : 'Description',
1661 renderer : function(v) { return String.format('{0}', v); },
1663 dataIndex : 'ipshead_descrip'
1666 '|xns' : 'Roo.grid',
1667 xtype : 'ColumnModel',
1669 header : 'Currency',
1670 renderer : function(v) { return String.format('{0}', v); },
1672 dataIndex : 'ipshead_curr_id_curr_name'
1677 '|xns' : 'Roo.form',
1678 xtype : 'NumberField',
1679 cls : 'align-right',
1680 decimalPrecision : 2,
1683 '|xns' : 'Roo.grid',
1684 xtype : 'GridEditor',
1691 '|xns' : 'Roo.grid',
1693 xtype : 'ColumnModel',
1696 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1698 dataIndex : 'ipshead_ipsitem_price',
1706 beforeedit : function (e)
1708 if(e.field != 'ipshead_ipsitem_price'){
1716 //_this.dialog = Pman.Dialog.FILL_IN
1717 if (_this.lpanel.active) {
1718 this.footer.onClick('first');
1721 afteredit : function (e)
1723 if(e.originalValue == e.value){
1727 var id = _this.form.findField('item_id').getValue() * 1;
1734 url : baseURL + '/Roo/ipsiteminfo',
1737 ipsitem_ipshead_id : e.record.data.ipshead_id,
1738 ipsitem_item_id : id,
1739 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1740 ipsitem_id : e.record.data.ipshead_ipsitem_id
1759 title : "Price List",
1760 xtype : 'GridPanel',
1761 fitContainer : true,
1763 tableName : 'ipshead',
1765 activate : function() {
1766 _this.lpanel = this;
1768 try { if (MODULE.isBuilder) {
1772 var id = _this.form.findField('item_id').getValue() * 1;
1774 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1775 _this.dialog.layout.getRegion('center').showPanel(0);
1780 _this.lgrid.footer.onClick('first');
1794 '|xns' : 'Roo.data',
1795 url : baseURL + '/Roo/itemsrc.php',
1796 xtype : 'HttpProxy',
1801 '|xns' : 'Roo.data',
1804 xtype : 'JsonReader',
1808 'name': 'itemsrc_id',
1812 'name': 'itemsrc_item_id',
1816 'name': 'itemsrc_item_id',
1820 'name': 'itemsrc_vend_id',
1824 'name': 'itemsrc_vend_id',
1828 'name': 'itemsrc_vend_item_number',
1832 'name': 'itemsrc_vend_item_descrip',
1836 'name': 'itemsrc_comments',
1840 'name': 'itemsrc_vend_uom',
1844 'name': 'itemsrc_invvendoruomratio',
1848 'name': 'itemsrc_minordqty',
1852 'name': 'itemsrc_multordqty',
1856 'name': 'itemsrc_leadtime',
1860 'name': 'itemsrc_ranking',
1864 'name': 'itemsrc_active',
1868 'name': 'itemsrc_manuf_name',
1872 'name': 'itemsrc_manuf_item_number',
1876 'name': 'itemsrc_manuf_item_descrip',
1880 'name': 'itemsrc_default',
1884 'name': 'itemsrc_upccode',
1888 totalProperty : 'total'
1890 '|xns' : 'Roo.data',
1893 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
1896 update : function (_self, record, operation)
1901 if (operation != 'commit') {
1904 if (record.data.itemsrc_vend_id * 1 < 1) {
1905 return; // do not save.
1907 if (record.data.itemsrc_id * 1 < 0) {
1908 return; // do not save. -- updating at present...
1911 var p = Roo.apply({}, record.data);
1912 record.set('itemsrc_id', -1);
1915 url : baseURL + '/Roo/Itemsrc',
1918 success: function(res) {
1919 if (record.data.itemsrc_id *1 < 1) {
1920 record.set('itemsrc_id', res.data.itemsrc_id);
1927 beforeload : function (_self, o)
1930 var id = 1 * _this.form.findField('item_id').getValue();
1935 o.params.itemsrc_item_id = id;
1946 xtype : 'PagingToolbar',
1947 emptyMsg : "No itemsrc found",
1950 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
1958 '|xns' : 'Roo.Toolbar',
1961 cls : 'x-btn-text-icon',
1962 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1968 Roo.log("add presed");
1971 var grid = _this.itemsrcgrid;
1973 // uses form defaults or last row value.
1974 var nr = grid.ds.reader.newRow({
1976 itemsrc_item_id : _this.form.findField('item_id').getValue(),
1978 itemsrc_vend_id : 0,
1979 itemsrc_vend_item_number : '',
1980 itemsrc_vend_item_descrip : '',
1981 itemsrc_comments : '',
1982 itemsrc_vend_uom : 'EA',
1983 itemsrc_invvendoruomratio : 1.0,
1984 itemsrc_minordqty : 0,
1985 itemsrc_multordqty : 0,
1986 itemsrc_leadtime : 30,
1987 itemsrc_ranking : 0,
1988 itemsrc_active : true,
1989 itemsrc_manuf_name : '',
1990 itemsrc_manuf_item_number : '',
1991 itemsrc_manuf_item_descrip: '',
1992 itemsrc_default : true,
1993 itemsrc_upccode : ''
1997 grid.ds.insert(0, nr);
1998 grid.startEditing(0, 0); // type..
2006 '|xns' : 'Roo.grid',
2007 autoExpandColumn : 'itemsrc_comments',
2008 xtype : 'EditorGrid',
2018 '|xns' : 'Roo.data',
2019 url : baseURL + '/Roo/vendinfo.php',
2020 xtype : 'HttpProxy',
2025 '|xns' : 'Roo.data',
2028 xtype : 'JsonReader',
2030 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2031 totalProperty : 'total'
2033 '|xns' : 'Roo.data',
2037 sortInfo : { direction : 'ASC', field: 'id' },
2039 beforeload : function (_self, o){
2040 o.params = o.params || {};
2049 '|xns' : 'Roo.form',
2051 triggerAction : 'all',
2052 forceSelection : true,
2053 selectOnFocus : true,
2055 displayField : 'vend_name',
2056 emptyText : "Select Vendor",
2057 hiddenName : 'itemsrc_vend_id',
2059 valueField : 'vend_id',
2066 name : 'itemsrc_vend_id_vend_name',
2067 qtip : "Select vendinfo",
2068 queryParam : 'q[search]',
2069 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2070 loadingText : "Searching...",
2076 '|xns' : 'Roo.grid',
2077 xtype : 'GridEditor',
2084 '|xns' : 'Roo.grid',
2085 xtype : 'ColumnModel',
2088 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2090 dataIndex : 'itemsrc_vend_id',
2099 '|xns' : 'Roo.form',
2100 xtype : 'TextField',
2103 '|xns' : 'Roo.grid',
2104 xtype : 'GridEditor',
2111 '|xns' : 'Roo.grid',
2112 xtype : 'ColumnModel',
2114 header : 'Vendor Ref#',
2115 renderer : function(v) { return String.format('{0}', v); },
2117 dataIndex : 'itemsrc_vend_item_number',
2126 '|xns' : 'Roo.form',
2127 xtype : 'TextField',
2130 '|xns' : 'Roo.grid',
2131 xtype : 'GridEditor',
2138 '|xns' : 'Roo.grid',
2139 xtype : 'ColumnModel',
2141 header : 'Comments',
2142 renderer : function(v) { return String.format('{0}', v); },
2144 dataIndex : 'itemsrc_comments',
2151 '|xns' : 'Roo.grid',
2152 xtype : 'ColumnModel',
2155 renderer : function(v) { return String.format('{0}', v); },
2157 dataIndex : 'itemsrc_vend_uom'
2162 '|xns' : 'Roo.form',
2164 xtype : 'NumberField',
2165 decimalPrecision : 0,
2168 '|xns' : 'Roo.grid',
2169 xtype : 'GridEditor',
2176 '|xns' : 'Roo.grid',
2178 xtype : 'ColumnModel',
2181 renderer : function(v) { return String.format('{0}', v); },
2183 dataIndex : 'itemsrc_minordqty',
2192 '|xns' : 'Roo.form',
2194 xtype : 'NumberField',
2195 decimalPrecision : 0,
2198 '|xns' : 'Roo.grid',
2199 xtype : 'GridEditor',
2206 '|xns' : 'Roo.grid',
2208 xtype : 'ColumnModel',
2209 header : 'Lead time',
2211 renderer : function(v) { return String.format('{0}', v); },
2213 dataIndex : 'itemsrc_leadtime',
2220 '|xns' : 'Roo.grid',
2221 xtype : 'ColumnModel',
2224 renderer : function(v) { return String.format('{0}', v); },
2226 dataIndex : 'itemsrc_active'
2230 rowdblclick : function (_self, rowIndex, e)
2232 if (!_this.dialog) return;
2233 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2234 _this.grid.footer.onClick('first');
2239 _this.itemsrcgrid = this;
2240 //_this.dialog = Pman.Dialog.FILL_IN
2243 afteredit : function (e)
2257 title : "Suppliers",
2258 xtype : 'GridPanel',
2259 fitContainer : true,
2261 tableName : 'itemsrc',
2263 activate : function() {
2264 _this.itemsrcpanel = this;
2265 if (_this.itemsrcgrid) {
2266 _this.itemsrcgrid.footer.onClick('first');
2279 '|xns' : 'Roo.data',
2280 url : baseURL + '/Roo/events.php',
2282 xtype : 'HttpProxy',
2286 '|xns' : 'Roo.data',
2289 xtype : 'JsonReader',
2292 'name': 'event_when',
2304 'name': 'person_id_name',
2313 totalProperty : 'total'
2315 '|xns' : 'Roo.data',
2318 sortInfo : { field : 'event_when', direction: 'DESC' },
2321 beforeload : function (_self, options)
2323 options.params = options.params || {};
2325 options.params.on_table = 'item';
2326 options.params.on_id = _this.form.findField('item_id').getValue();
2337 xtype : 'PagingToolbar',
2338 emptyMsg : "No Events found",
2340 displayMsg : "Displaying events{0} - {1} of {2}",
2343 '|xns' : 'Roo.grid',
2344 autoExpandColumn : 'remarks',
2350 '|xns' : 'Roo.grid',
2351 xtype : 'ColumnModel',
2354 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2356 dataIndex : 'event_when'
2359 '|xns' : 'Roo.grid',
2360 xtype : 'ColumnModel',
2363 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2365 dataIndex : 'action'
2368 '|xns' : 'Roo.grid',
2369 xtype : 'ColumnModel',
2371 header : 'IP Address',
2372 renderer : function(v) { return String.format('{0}', v); },
2374 dataIndex : 'ipaddr'
2377 '|xns' : 'Roo.grid',
2378 xtype : 'ColumnModel',
2381 renderer : function(v) { return String.format('{0}', v); },
2383 dataIndex : 'person_id_name'
2386 '|xns' : 'Roo.grid',
2387 xtype : 'ColumnModel',
2390 renderer : function(v) { return String.format('{0}', v); },
2392 dataIndex : 'remarks'
2399 if (_this.hpanel.active) {
2400 this.footer.onClick('first');
2414 xtype : 'GridPanel',
2415 fitContainer : true,
2417 tableName : 'events',
2419 activate : function() {
2420 _this.hpanel = this;
2422 _this.hgrid.footer.onClick('first');