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;
990 '|xns' : 'Roo.bootstrap',
992 triggerAction : 'all',
994 forceSelection : true,
995 selectOnFocus : true,
997 displayField : 'item_number',
998 emptyText : "Select item",
1006 xns : Roo.bootstrap,
1007 qtip : "Select item",
1008 queryParam : 'query[search]',
1009 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
1010 loadingText : "Searching...",
1012 render : function (_self)
1014 _this.partsBox = _self;
1016 select : function (combo, record, index)
1020 /* var event_id = _this.form.findField('id').getValue() * 1;
1022 if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || event_id < 1){
1028 _this.fgrid.ds.each(function(d){
1029 if(record.data.id == d.data.interest_id){
1035 Roo.MessageBox.alert('Error', record.data.display_name + ' already exists!');
1036 _this.focusBox.reset();
1041 url : baseURL + '/Roo/cal_event_focus.php',
1044 cal_event_id : event_id,
1045 interest_id : record.data.id
1047 success : function(res) {
1048 _this.focusBox.reset();
1049 _this.fgrid.footer.onClick('first');
1060 '|xns' : 'Roo.Toolbar',
1061 xtype : 'Separator',
1068 cls : 'x-btn-text-icon',
1069 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1074 Pman.Dialog.CoreEnum.show( {id : 0, etype : 'crm_interest'}, function(res){
1075 _this.focusBox.setFromData(res);
1080 _this.focusBox.fireEvent('select', _this.focusBox, record);
1087 '|xns' : 'Roo.Toolbar',
1095 cls : 'x-btn-text-icon',
1096 icon : rootURL + '/Pman/templates/images/trash.gif',
1101 var sel = _this.fgrid.getSelectionModel().getSelections();
1103 if(!sel || !sel.length){
1104 Roo.MessageBox.alert("Error", "Please select interests from below list");
1112 Roo.each(sel, function(s){
1113 if(s.data.id * 1 < 1){ // bad data?
1121 url : baseURL + '/Roo/cal_event_focus.php',
1124 _delete : id.join(',')
1126 success : function(res) {
1127 _this.fgrid.footer.onClick('first');
1139 '|xns' : 'Roo.data',
1140 url : baseURL + '/Roo/bomitem.php',
1141 xtype : 'HttpProxy',
1146 '|xns' : 'Roo.data',
1149 xtype : 'JsonReader',
1152 'name': 'bomitem_id',
1157 totalProperty : 'total'
1159 '|xns' : 'Roo.data',
1162 sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
1165 beforeload : function (_self, o)
1167 o.params = o.params || {};
1169 var id = _this.form.findField('item_id').getValue() * 1;
1174 o.params.bom_parent_item_id = id;
1185 xtype : 'PagingToolbar',
1186 emptyMsg : "Nothing found",
1188 displayMsg : "Displaying parts {0} - {1} of {2}",
1191 '|xns' : 'Roo.grid',
1192 autoExpandColumn : 'bomitem_item_id_item_descrip1',
1193 xtype : 'EditorGrid',
1199 '|xns' : 'Roo.grid',
1200 xtype : 'ColumnModel',
1203 renderer : function(v) { return String.format('{0}', v); },
1205 dataIndex : 'bomitem_item_id_item_name'
1208 '|xns' : 'Roo.grid',
1209 xtype : 'ColumnModel',
1210 header : 'Description',
1212 renderer : function(v) { return String.format('{0}', v); },
1214 dataIndex : 'bomitem_item_id_item_descrip1'
1217 '|xns' : 'Roo.grid',
1218 xtype : 'ColumnModel',
1221 renderer : function(v) { return String.format('{0}', v); },
1223 dataIndex : 'bomitem_qtyper'
1227 beforeedit : function (e)
1229 if(e.field != 'ipshead_ipsitem_price'){
1236 _this.partsgrid = this;
1237 //_this.dialog = Pman.Dialog.FILL_IN
1238 if (_this.partspanel.active) {
1239 this.footer.onClick('first');
1242 afteredit : function (e)
1244 if(e.originalValue == e.value){
1250 var id = _this.form.findField('item_id').getValue() * 1;
1257 url : baseURL + '/Roo/ipsiteminfo',
1260 ipsitem_ipshead_id : e.record.data.ipshead_id,
1261 ipsitem_item_id : id,
1262 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1263 ipsitem_id : e.record.data.ipshead_ipsitem_id
1282 title : "Item Parts",
1283 xtype : 'GridPanel',
1284 fitContainer : true,
1286 tableName : 'bomitem',
1288 activate : function() {
1289 _this.partspanel = this;
1291 try { if (MODULE.isBuilder) {
1295 var id = _this.form.findField('item_id').getValue() * 1;
1297 Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
1298 _this.dialog.layout.getRegion('center').showPanel(0);
1302 var type = _this.form.findField('item_type').getValue();
1304 if(!type.length || type != 'K'){
1305 Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
1306 _this.dialog.layout.getRegion('center').showPanel(0);
1310 if (_this.partsgrid) {
1311 _this.partsgrid.footer.onClick('first');
1325 '|xns' : 'Roo.data',
1328 xtype : 'JsonReader',
1363 'name': 'displayorder',
1371 'name': 'parent_image_id',
1377 'dateFormat' : 'Y-m-d H:i:s'
1397 totalProperty : 'total'
1400 '|xns' : 'Roo.data',
1401 url : baseURL + '/Roo/Images.php',
1402 xtype : 'HttpProxy',
1406 '|xns' : 'Roo.data',
1409 sortInfo : { field: 'created' , direction: 'DESC' },
1412 beforeload : function (_self, o)
1414 o.params = o.params || {};
1416 var id = _this.form.findField('item_id').getValue();
1423 o.params.ontable = 'item';
1435 xtype : 'PagingToolbar',
1436 emptyMsg : "No Images found",
1439 displayMsg : "Displaying Images {0} - {1} of {2}"
1447 '|xns' : 'Roo.Toolbar',
1450 cls : 'x-btn-text-icon',
1451 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1456 Pman.Dialog.Image.show({
1459 onid: _this.form.findField('item_id').getValue() * 1,
1462 if (!data) { return; }
1463 _this.grid.footer.onClick('first');
1470 '|xns' : 'Roo.Toolbar',
1473 cls : 'x-btn-text-icon',
1474 icon : rootURL + '/Pman/templates/images/trash.gif',
1479 Pman.genericDelete(_this, 'Images');
1486 '|xns' : 'Roo.grid',
1487 autoExpandColumn : 'id',
1493 '|xns' : 'Roo.grid',
1494 xtype : 'ColumnModel',
1498 renderer : function(v,x,r) {
1499 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
1500 v.format('d/M/Y'), r.data.mimetype, r.data.filename,
1501 r.data.width, r.data.height
1505 dataIndex : 'created'
1508 '|xns' : 'Roo.grid',
1509 xtype : 'ColumnModel',
1512 renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
1518 rowdblclick : function (_self, rowIndex, e)
1521 var s = _self.getDataSource().getAt(rowIndex);
1523 url : baseURL + '/Images/Download/' + s.data.id
1527 render : function() {
1530 if (_this.panel.active) {
1531 this.footer.onClick('first');
1544 title : "Reference Files",
1545 xtype : 'GridPanel',
1546 fitContainer : true,
1548 tableName : 'Images',
1550 activate : function() {
1553 try { if (MODULE.isBuilder) {
1557 var id = _this.form.findField('item_id').getValue() * 1;
1559 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1560 _this.dialog.layout.getRegion('center').showPanel(0);
1565 _this.grid.footer.onClick('first');
1579 '|xns' : 'Roo.data',
1580 url : baseURL + '/Roo/ipshead.php',
1582 xtype : 'HttpProxy',
1586 '|xns' : 'Roo.data',
1589 xtype : 'JsonReader',
1592 'name': 'ipshead_id',
1596 'name': 'ipshead_name',
1601 totalProperty : 'total'
1603 '|xns' : 'Roo.data',
1606 sortInfo : { field : 'ipshead_id', direction: 'ASC' },
1609 beforeload : function (_self, o)
1611 o.params = o.params || {};
1613 var id = _this.form.findField('item_id').getValue() * 1;
1618 o.params._with_item = id;
1629 xtype : 'PagingToolbar',
1630 emptyMsg : "Nothing found",
1632 displayMsg : "Displaying records {0} - {1} of {2}",
1635 '|xns' : 'Roo.grid',
1636 autoExpandColumn : 'ipshead_descrip',
1637 xtype : 'EditorGrid',
1643 '|xns' : 'Roo.grid',
1644 xtype : 'ColumnModel',
1647 renderer : function(v) { return String.format('{0}', v); },
1649 dataIndex : 'ipshead_name'
1652 '|xns' : 'Roo.grid',
1653 xtype : 'ColumnModel',
1655 header : 'Description',
1656 renderer : function(v) { return String.format('{0}', v); },
1658 dataIndex : 'ipshead_descrip'
1661 '|xns' : 'Roo.grid',
1662 xtype : 'ColumnModel',
1664 header : 'Currency',
1665 renderer : function(v) { return String.format('{0}', v); },
1667 dataIndex : 'ipshead_curr_id_curr_name'
1672 '|xns' : 'Roo.form',
1673 xtype : 'NumberField',
1674 cls : 'align-right',
1675 decimalPrecision : 2,
1678 '|xns' : 'Roo.grid',
1679 xtype : 'GridEditor',
1686 '|xns' : 'Roo.grid',
1688 xtype : 'ColumnModel',
1691 renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
1693 dataIndex : 'ipshead_ipsitem_price',
1701 beforeedit : function (e)
1703 if(e.field != 'ipshead_ipsitem_price'){
1711 //_this.dialog = Pman.Dialog.FILL_IN
1712 if (_this.lpanel.active) {
1713 this.footer.onClick('first');
1716 afteredit : function (e)
1718 if(e.originalValue == e.value){
1722 var id = _this.form.findField('item_id').getValue() * 1;
1729 url : baseURL + '/Roo/ipsiteminfo',
1732 ipsitem_ipshead_id : e.record.data.ipshead_id,
1733 ipsitem_item_id : id,
1734 ipsitem_price : e.record.data.ipshead_ipsitem_price,
1735 ipsitem_id : e.record.data.ipshead_ipsitem_id
1754 title : "Price List",
1755 xtype : 'GridPanel',
1756 fitContainer : true,
1758 tableName : 'ipshead',
1760 activate : function() {
1761 _this.lpanel = this;
1763 try { if (MODULE.isBuilder) {
1767 var id = _this.form.findField('item_id').getValue() * 1;
1769 Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
1770 _this.dialog.layout.getRegion('center').showPanel(0);
1775 _this.lgrid.footer.onClick('first');
1789 '|xns' : 'Roo.data',
1790 url : baseURL + '/Roo/itemsrc.php',
1791 xtype : 'HttpProxy',
1796 '|xns' : 'Roo.data',
1799 xtype : 'JsonReader',
1803 'name': 'itemsrc_id',
1807 'name': 'itemsrc_item_id',
1811 'name': 'itemsrc_item_id',
1815 'name': 'itemsrc_vend_id',
1819 'name': 'itemsrc_vend_id',
1823 'name': 'itemsrc_vend_item_number',
1827 'name': 'itemsrc_vend_item_descrip',
1831 'name': 'itemsrc_comments',
1835 'name': 'itemsrc_vend_uom',
1839 'name': 'itemsrc_invvendoruomratio',
1843 'name': 'itemsrc_minordqty',
1847 'name': 'itemsrc_multordqty',
1851 'name': 'itemsrc_leadtime',
1855 'name': 'itemsrc_ranking',
1859 'name': 'itemsrc_active',
1863 'name': 'itemsrc_manuf_name',
1867 'name': 'itemsrc_manuf_item_number',
1871 'name': 'itemsrc_manuf_item_descrip',
1875 'name': 'itemsrc_default',
1879 'name': 'itemsrc_upccode',
1883 totalProperty : 'total'
1885 '|xns' : 'Roo.data',
1888 sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
1891 update : function (_self, record, operation)
1896 if (operation != 'commit') {
1899 if (record.data.itemsrc_vend_id * 1 < 1) {
1900 return; // do not save.
1902 if (record.data.itemsrc_id * 1 < 0) {
1903 return; // do not save. -- updating at present...
1906 var p = Roo.apply({}, record.data);
1907 record.set('itemsrc_id', -1);
1910 url : baseURL + '/Roo/Itemsrc',
1913 success: function(res) {
1914 if (record.data.itemsrc_id *1 < 1) {
1915 record.set('itemsrc_id', res.data.itemsrc_id);
1922 beforeload : function (_self, o)
1925 var id = 1 * _this.form.findField('item_id').getValue();
1930 o.params.itemsrc_item_id = id;
1941 xtype : 'PagingToolbar',
1942 emptyMsg : "No itemsrc found",
1945 displayMsg : "Displaying itemsrc{0} - {1} of {2}"
1953 '|xns' : 'Roo.Toolbar',
1956 cls : 'x-btn-text-icon',
1957 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
1963 Roo.log("add presed");
1966 var grid = _this.itemsrcgrid;
1968 // uses form defaults or last row value.
1969 var nr = grid.ds.reader.newRow({
1971 itemsrc_item_id : _this.form.findField('item_id').getValue(),
1973 itemsrc_vend_id : 0,
1974 itemsrc_vend_item_number : '',
1975 itemsrc_vend_item_descrip : '',
1976 itemsrc_comments : '',
1977 itemsrc_vend_uom : 'EA',
1978 itemsrc_invvendoruomratio : 1.0,
1979 itemsrc_minordqty : 0,
1980 itemsrc_multordqty : 0,
1981 itemsrc_leadtime : 30,
1982 itemsrc_ranking : 0,
1983 itemsrc_active : true,
1984 itemsrc_manuf_name : '',
1985 itemsrc_manuf_item_number : '',
1986 itemsrc_manuf_item_descrip: '',
1987 itemsrc_default : true,
1988 itemsrc_upccode : ''
1992 grid.ds.insert(0, nr);
1993 grid.startEditing(0, 0); // type..
2001 '|xns' : 'Roo.grid',
2002 autoExpandColumn : 'itemsrc_comments',
2003 xtype : 'EditorGrid',
2013 '|xns' : 'Roo.data',
2014 url : baseURL + '/Roo/vendinfo.php',
2015 xtype : 'HttpProxy',
2020 '|xns' : 'Roo.data',
2023 xtype : 'JsonReader',
2025 fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
2026 totalProperty : 'total'
2028 '|xns' : 'Roo.data',
2032 sortInfo : { direction : 'ASC', field: 'id' },
2034 beforeload : function (_self, o){
2035 o.params = o.params || {};
2044 '|xns' : 'Roo.form',
2046 triggerAction : 'all',
2047 forceSelection : true,
2048 selectOnFocus : true,
2050 displayField : 'vend_name',
2051 emptyText : "Select Vendor",
2052 hiddenName : 'itemsrc_vend_id',
2054 valueField : 'vend_id',
2061 name : 'itemsrc_vend_id_vend_name',
2062 qtip : "Select vendinfo",
2063 queryParam : 'q[search]',
2064 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
2065 loadingText : "Searching...",
2071 '|xns' : 'Roo.grid',
2072 xtype : 'GridEditor',
2079 '|xns' : 'Roo.grid',
2080 xtype : 'ColumnModel',
2083 renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
2085 dataIndex : 'itemsrc_vend_id',
2094 '|xns' : 'Roo.form',
2095 xtype : 'TextField',
2098 '|xns' : 'Roo.grid',
2099 xtype : 'GridEditor',
2106 '|xns' : 'Roo.grid',
2107 xtype : 'ColumnModel',
2109 header : 'Vendor Ref#',
2110 renderer : function(v) { return String.format('{0}', v); },
2112 dataIndex : 'itemsrc_vend_item_number',
2121 '|xns' : 'Roo.form',
2122 xtype : 'TextField',
2125 '|xns' : 'Roo.grid',
2126 xtype : 'GridEditor',
2133 '|xns' : 'Roo.grid',
2134 xtype : 'ColumnModel',
2136 header : 'Comments',
2137 renderer : function(v) { return String.format('{0}', v); },
2139 dataIndex : 'itemsrc_comments',
2146 '|xns' : 'Roo.grid',
2147 xtype : 'ColumnModel',
2150 renderer : function(v) { return String.format('{0}', v); },
2152 dataIndex : 'itemsrc_vend_uom'
2157 '|xns' : 'Roo.form',
2159 xtype : 'NumberField',
2160 decimalPrecision : 0,
2163 '|xns' : 'Roo.grid',
2164 xtype : 'GridEditor',
2171 '|xns' : 'Roo.grid',
2173 xtype : 'ColumnModel',
2176 renderer : function(v) { return String.format('{0}', v); },
2178 dataIndex : 'itemsrc_minordqty',
2187 '|xns' : 'Roo.form',
2189 xtype : 'NumberField',
2190 decimalPrecision : 0,
2193 '|xns' : 'Roo.grid',
2194 xtype : 'GridEditor',
2201 '|xns' : 'Roo.grid',
2203 xtype : 'ColumnModel',
2204 header : 'Lead time',
2206 renderer : function(v) { return String.format('{0}', v); },
2208 dataIndex : 'itemsrc_leadtime',
2215 '|xns' : 'Roo.grid',
2216 xtype : 'ColumnModel',
2219 renderer : function(v) { return String.format('{0}', v); },
2221 dataIndex : 'itemsrc_active'
2225 rowdblclick : function (_self, rowIndex, e)
2227 if (!_this.dialog) return;
2228 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
2229 _this.grid.footer.onClick('first');
2234 _this.itemsrcgrid = this;
2235 //_this.dialog = Pman.Dialog.FILL_IN
2238 afteredit : function (e)
2252 title : "Suppliers",
2253 xtype : 'GridPanel',
2254 fitContainer : true,
2256 tableName : 'itemsrc',
2258 activate : function() {
2259 _this.itemsrcpanel = this;
2260 if (_this.itemsrcgrid) {
2261 _this.itemsrcgrid.footer.onClick('first');
2274 '|xns' : 'Roo.data',
2275 url : baseURL + '/Roo/events.php',
2277 xtype : 'HttpProxy',
2281 '|xns' : 'Roo.data',
2284 xtype : 'JsonReader',
2287 'name': 'event_when',
2299 'name': 'person_id_name',
2308 totalProperty : 'total'
2310 '|xns' : 'Roo.data',
2313 sortInfo : { field : 'event_when', direction: 'DESC' },
2316 beforeload : function (_self, options)
2318 options.params = options.params || {};
2320 options.params.on_table = 'item';
2321 options.params.on_id = _this.form.findField('item_id').getValue();
2332 xtype : 'PagingToolbar',
2333 emptyMsg : "No Events found",
2335 displayMsg : "Displaying events{0} - {1} of {2}",
2338 '|xns' : 'Roo.grid',
2339 autoExpandColumn : 'remarks',
2345 '|xns' : 'Roo.grid',
2346 xtype : 'ColumnModel',
2349 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
2351 dataIndex : 'event_when'
2354 '|xns' : 'Roo.grid',
2355 xtype : 'ColumnModel',
2358 renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
2360 dataIndex : 'action'
2363 '|xns' : 'Roo.grid',
2364 xtype : 'ColumnModel',
2366 header : 'IP Address',
2367 renderer : function(v) { return String.format('{0}', v); },
2369 dataIndex : 'ipaddr'
2372 '|xns' : 'Roo.grid',
2373 xtype : 'ColumnModel',
2376 renderer : function(v) { return String.format('{0}', v); },
2378 dataIndex : 'person_id_name'
2381 '|xns' : 'Roo.grid',
2382 xtype : 'ColumnModel',
2385 renderer : function(v) { return String.format('{0}', v); },
2387 dataIndex : 'remarks'
2394 if (_this.hpanel.active) {
2395 this.footer.onClick('first');
2409 xtype : 'GridPanel',
2410 fitContainer : true,
2412 tableName : 'events',
2414 activate : function() {
2415 _this.hpanel = this;
2417 _this.hgrid.footer.onClick('first');