1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtuplePriceLists = new Roo.XComponent({
6 part : ["Xtuple","PriceLists"],
7 order : '001-Pman.Tab.XtuplePriceLists',
9 parent : 'Pman.Tab.XtupleManage',
10 name : "Pman.Tab.XtuplePriceLists",
18 xtype: 'NestedLayoutPanel',
26 xtype: 'BorderLayout',
33 activate : function() {
36 _this.grid.footer.onClick('first');
44 tableName : 'ipshead',
45 title : "Price Lists",
53 _this.dialog = Pman.Dialog.XtuplePriceList
54 if (_this.panel.active) {
55 this.footer.onClick('first');
58 rowdblclick : function (_self, rowIndex, e)
60 if (!_this.dialog) return;
61 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
62 _this.grid.footer.onClick('first');
67 autoExpandColumn : 'ipshead_descrip',
70 xtype: 'RowSelectionModel',
78 sortInfo : { field : 'ipshead_name', direction: 'ASC' },
83 url : baseURL + '/Roo/ipshead.php'
88 totalProperty : 'total',
97 'name': 'ipshead_name',
101 'name': 'ipshead_descrip',
105 'name': 'ipshead_effective',
107 'dateFormat': 'Y-m-d'
110 'name': 'ipshead_expires',
112 'dateFormat': 'Y-m-d'
115 'name': 'ipshead_curr_id',
119 'name': 'ipshead_updated',
121 'dateFormat': 'Y-m-d'
124 'name': 'ipshead_curr_id_curr_id',
128 'name': 'ipshead_curr_id_curr_base',
132 'name': 'ipshead_curr_id_curr_name',
136 'name': 'ipshead_curr_id_curr_symbol',
140 'name': 'ipshead_curr_id_curr_abbr',
147 xtype: 'PagingToolbar',
150 displayMsg : "Displaying ipshead{0} - {1} of {2}",
151 emptyMsg : "No ipshead found",
162 click : function (_self, e)
166 url : baseURL + '/Roo/Ipsiteminfo',
173 text : "Download Price Matrix"
179 click : function (_self, e)
181 Pman.Dialog.Image.show(
183 _url : baseURL+'/Xtuple/Pricing'
189 msg.push("Deleted " + data.deleted + " Price(s)");
192 msg.push("Updated " + data.updated + " Price(s)");
195 msg.push("Added " + data.inserted + " Price(s)");
198 msg.push("No data changed");
200 Roo.MessageBox.alert("Notice", msg.join("\n"));
206 text : "Upload Price Matrix"
216 cls : 'x-btn-text-icon',
217 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
221 if (!_this.dialog) return;
222 _this.dialog.show( { id : 0 } , function() {
223 _this.grid.footer.onClick('first');
232 cls : 'x-btn-text-icon',
233 icon : rootURL + '/Pman/templates/images/trash.gif',
237 Pman.genericDelete(_this, 'ipshead');
245 xtype: 'ColumnModel',
247 dataIndex : 'ipshead_curr_id_curr_name',
248 header : 'Ipshead curr',
251 renderer : function(v) { return String.format('{0}', v); }
254 xtype: 'ColumnModel',
256 dataIndex : 'ipshead_name',
257 header : 'Ipshead name',
260 renderer : function(v) { return String.format('{0}', v); }
263 xtype: 'ColumnModel',
265 header : 'Ipshead descrip',
267 dataIndex : 'ipshead_descrip',
268 renderer : function(v) { return String.format('{0}', v); }
271 xtype: 'ColumnModel',
273 header : 'Ipshead effective',
275 dataIndex : 'ipshead_effective',
276 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
279 xtype: 'ColumnModel',
281 dataIndex : 'ipshead_expires',
282 header : 'Ipshead expires',
284 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
287 xtype: 'ColumnModel',
289 header : 'Ipshead updated',
291 dataIndex : 'ipshead_updated',
292 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
301 activate : function() {
304 // _this.igrid.footer.onClick('first');
321 //_this.dialog = Pman.Dialog.FILL_IN
322 if (_this.ipanel.active) {
323 //this.footer.onClick('first');
326 cellclick : function (_self, row, col, e)
328 var di = _this.grid.colModel.getDataIndex(col);
330 var rec = _this.grid.ds.getAt(row);
332 if(di == 'item_image_filename'){
333 if(!rec.data.item_image_id){
337 if(rec.data.item_image_from_hk){
340 u = u.join('/') + '/hk.php';
343 url: u + '/Images/Download/' + rec.data.item_image_id + '/' + rec.data.item_image_filename
348 if (di == 'item_active') {
350 var nv = rec.data.item_active ? 0 : 1;
353 url : baseURL + '/Roo/Item',
355 item_id : rec.data.item_id,
358 success : function() {
359 rec.set('item_active', nv);
367 if(di == 'itemsrc_active'){
368 if(!rec.data.itemsrc_active){
369 Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');
372 if(rec.data.itemsrc_active){
373 Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
383 _this.locgrid.footer.onClick('first');
389 afteredit : function (e)
395 url : baseURL +'/Roo/Charass',
397 charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
398 charass_value : e.value,
399 charass_target_type : 'I',
401 charass_target_id : e.record.data.item_id
412 rowdblclick : function (_self, rowIndex, e)
414 if (!_this.dialog) return;
415 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
416 _this.grid.footer.onClick('first');
420 autoExpandColumn : 'item_descrip1',
427 beforeload : function (_self, o)
429 o.params._with_prodcat = 1;
430 o.params._with_char = 1;
431 o.params._with_itemsrc_active = 1;
432 o.params._with_last_purchase_price = 1;
433 o.params._with_image = 1;
434 var s = _this.search.getValue();
436 o.params['query[number_or_name]'] = s;
438 if (!_this.active.pressed) {
439 o.params.item_active = 1;
441 if (_this.brandSel.getValue().length) {
442 o.params._with_brand = _this.brandSel.getValue()
445 update : function (_self, record, operation)
447 if(operation != 'commit'){
451 var nv = record.data.itemsrc_active ? 0 : 1;
454 url : baseURL + '/Roo/Itemsrc',
457 item_id : record.data.item_id,
460 success : function(res) {
461 record.set('itemsrc_active', nv);
467 sortInfo : { field : 'item_number', direction: 'ASC' },
472 url : baseURL + '/Roo/item.php'
477 totalProperty : 'total',
486 'name': 'item_number',
490 'name': 'item_descrip1',
494 'name': 'item_descrip2',
498 'name': 'item_classcode_id',
502 'name': 'item_picklist',
506 'name': 'item_comments',
514 'name': 'item_fractional',
518 'name': 'item_active',
526 'name': 'item_prodweight',
530 'name': 'item_packweight',
534 'name': 'item_prodcat_id',
538 'name': 'item_exclusive',
542 'name': 'item_listprice',
546 'name': 'item_config',
550 'name': 'item_extdescrip',
554 'name': 'item_upccode',
558 'name': 'item_maxcost',
562 'name': 'item_inv_uom_id',
566 'name': 'item_price_uom_id',
570 'name': 'item_warrdays',
574 'name': 'item_freightclass_id',
578 'name': 'item_tax_recoverable',
582 'name': 'item_price_uom_id_uom_id',
586 'name': 'item_price_uom_id_uom_name',
590 'name': 'item_price_uom_id_uom_descrip',
594 'name': 'item_price_uom_id_uom_item_weight',
598 'name': 'item_inv_uom_id_uom_id',
602 'name': 'item_inv_uom_id_uom_name',
606 'name': 'item_inv_uom_id_uom_descrip',
610 'name': 'item_inv_uom_id_uom_item_weight',
614 'name': 'item_freightclass_id_freightclass_id',
618 'name': 'item_freightclass_id_freightclass_code',
622 'name': 'item_freightclass_id_freightclass_descrip',
626 'name': 'item_classcode_id_classcode_id',
630 'name': 'item_classcode_id_classcode_code',
634 'name': 'item_classcode_id_classcode_descrip',
638 'name': 'item_classcode_id_classcode_mfg',
642 'name': 'item_classcode_id_classcode_creator',
646 'name': 'item_classcode_id_classcode_created',
650 'name': 'item_classcode_id_classcode_modifier',
654 'name': 'item_classcode_id_classcode_modified',
658 'name': 'item_classcode_id_classcode_type',
672 render : function (_self)
674 _this.brandSel = _self;
676 select : function (combo, record, index)
678 _this.grid.footer.onClick('first');
683 displayField : 'charass_value',
685 forceSelection : true,
687 loadingText : "Searching...",
690 qtip : "Select Brand",
691 queryParam : 'query[charass_value]',
692 selectOnFocus : true,
693 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
694 triggerAction : 'all',
700 beforeload : function (_self, o)
702 o.params = o.params || {};
703 // staff can see all logs, other companies can only see their own.
704 // look for all of the charass 's with the same type= eg. brand.
706 o.params.charass_char_id_char_name = 'BRAND';
707 o.params.charass_target_type ='I';
708 o.params._distinct = 'charass_value';
709 o.params._columns = 'charass_value';
714 sortInfo : { field : 'charass_value' , direction : 'ASC' },
719 url : baseURL + '/Roo/Charass.php'
724 totalProperty : 'total',
733 'name': 'person_name',
737 'name': 'event_when',
739 'dateFormat': 'Y-m-d'
766 'name': 'person_id_id',
770 'name': 'person_id_office_id',
774 'name': 'person_id_name',
778 'name': 'person_id_phone',
782 'name': 'person_id_fax',
786 'name': 'person_id_email',
790 'name': 'person_id_company_id',
794 'name': 'person_id_role',
798 'name': 'person_id_active',
802 'name': 'person_id_remarks',
806 'name': 'person_id_passwd',
810 'name': 'person_id_owner_id',
814 'name': 'person_id_lang',
818 'name': 'person_id_no_reset_sent',
822 'name': 'person_id_action_type',
826 'name': 'person_id_project_id',
830 'name': 'person_id_deleted_by',
834 'name': 'person_id_deleted_dt',
845 render : function (_self)
847 _this.search = _self;
849 specialkey : function (_self, e)
851 _this.grid.footer.onClick('first');
859 click : function (_self, e)
861 _this.grid.footer.onClick('first');
865 icon : rootURL + '/Pman/templates/images/search.gif'
871 click : function (_self, e)
873 _this.search.setValue('');
877 _this.grid.footer.onClick('first');
881 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
891 toggle : function (_self, pressed)
894 this.setText(pressed ? "Hide Inactive" : "Show Inactive");
895 (function() { _this.grid.footer.onClick('first'); }).defer(100);
897 render : function (_self)
899 _this.active = _self;
903 text : "Show Inactive"
912 text : "Report start :"
918 render : function (_self)
920 _this.dateFrom = _self;
925 value : (function() { return (new Date()).format('Y') + '-01-01'; })()
931 render : function (_self)
933 _this.datespan = _self;
937 displayField : 'fname',
939 fieldLabel : 'Status',
940 hiddenName : 'cm_status',
943 name : 'cm_status_name',
944 triggerAction : 'all',
946 valueField : 'ftype',
949 xtype: 'SimpleStore',
952 [ '1', "Single Month Sales"],
953 [ '3', "Quarter Sales"],
954 [ '6', "Half year Sales"] ,
955 [ '12', "Full Year Sales"]
957 fields : [ 'ftype', 'fname']
964 click : function (_self, e)
966 if (!_this.brandSel.getValue().length) {
967 Roo.MessageBox.alert("Error", "Select a brand to download");
972 url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
974 date_from : _this.dateFrom.getValue(),
975 brand : _this.brandSel.getValue(),
976 span : _this.datespan.getValue()
983 text : "Download Sales Report"
988 xtype: 'PagingToolbar',
992 displayMsg : "Displaying item{0} - {1} of {2}",
993 emptyMsg : "No item found",
999 click : function (_self, e)
1003 url : baseURL + '/Roo/item',
1010 text : "Download Standard costs"
1016 click : function (_self, e)
1018 Pman.Dialog.Image.show(
1020 _url : baseURL+'/Xtuple/Import/Products'
1027 msg.push("Updated " + data.updated + " Products(s)");
1029 if (data.inserted) {
1030 msg.push("Added " + data.inserted + " Products(s)");
1033 msg.push("Skipped " + data.skipped);
1037 msg.push("No data changed");
1039 Roo.MessageBox.alert("Notice", msg.join("\n"));
1045 text : "Upload new products and costs"
1051 click : function (_self, e)
1054 var sel = _this.grid.selModel.getSelectedCell();
1056 Roo.MessageBox.alert("Error", "Select a row");
1060 var rec = _this.grid.ds.getAt(sel[0]);
1061 if(rec.data.item_id * 1 < 1){
1065 Pman.Dialog.Image.show({
1066 id : rec.data.item_image_id ? rec.data.item_image_id : 0,
1067 onid : rec.data.item_id,
1071 _this.grid.footer.onClick('first');
1078 text : "Upload an image"
1084 click : function (_self, e)
1086 Roo.MessageBox.progress ("Syncing Stock", "Sending");
1090 function runSync() {
1093 url : baseURL+'/Roo/Item',
1099 success : function(res) {
1101 if (!res.data.total) {
1102 Roo.MessageBox.hide();
1105 offset += res.data.limit;
1106 Roo.MessageBox.updateProgress ( offset / res.data.total, "Done " + offset + '/' + res.data.total);
1116 text : "Sync Product Data from HK",
1117 hidden : (function() {
1119 return baseURL.match(/hk\.php$/) ? true : false;
1126 xtype: 'ColumnModel',
1128 dataIndex : 'item_image_filename',
1129 header : 'Image ( Click to download )',
1131 renderer : function(v,x,r)
\r
1136 if(r.data.item_image_from_hk){
1137 var url = baseURL.split('/');
1139 url = url.join('/');
1140 return '<img src="' + url + '/hk.php/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="150" />';
1142 return '<img src="' + baseURL + '/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="150" />';
\r
1146 xtype: 'ColumnModel',
1148 dataIndex : 'item_char_brand',
1152 renderer : function(v) { return String.format('{0}', v); },
1154 xtype: 'GridEditor',
1161 displayField : 'charass_value',
1163 forceSelection : false,
1165 loadingText : "Searching...",
1168 qtip : "Select Brand",
1169 queryParam : 'query[charass_value]',
1170 selectOnFocus : true,
1171 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
1172 triggerAction : 'all',
1178 beforeload : function (_self, o)
1180 o.params = o.params || {};
1181 // staff can see all logs, other companies can only see their own.
1182 // look for all of the charass 's with the same type= eg. brand.
1184 o.params.charass_char_id_char_name = 'BRAND';
1185 o.params.charass_target_type ='I';
1186 o.params._distinct = 'charass_value';
1187 o.params._columns = 'charass_value';
1192 sortInfo : { field : 'charass_value' , direction : 'ASC' },
1197 url : baseURL + '/Roo/Charass.php'
1200 xtype: 'JsonReader',
1202 totalProperty : 'total',
1211 'name': 'person_name',
1215 'name': 'event_when',
1217 'dateFormat': 'Y-m-d'
1236 'name': 'person_id',
1244 'name': 'person_id_id',
1248 'name': 'person_id_office_id',
1252 'name': 'person_id_name',
1256 'name': 'person_id_phone',
1260 'name': 'person_id_fax',
1264 'name': 'person_id_email',
1268 'name': 'person_id_company_id',
1272 'name': 'person_id_role',
1276 'name': 'person_id_active',
1280 'name': 'person_id_remarks',
1284 'name': 'person_id_passwd',
1288 'name': 'person_id_owner_id',
1292 'name': 'person_id_lang',
1296 'name': 'person_id_no_reset_sent',
1300 'name': 'person_id_action_type',
1304 'name': 'person_id_project_id',
1308 'name': 'person_id_deleted_by',
1312 'name': 'person_id_deleted_dt',
1322 xtype: 'ColumnModel',
1324 dataIndex : 'item_char_productgroup',
1325 header : 'Product Group',
1327 renderer : function(v) { return String.format('{0}', v); },
1329 xtype: 'GridEditor',
1336 displayField : 'charass_value',
1338 forceSelection : false,
1340 loadingText : "Searching...",
1343 qtip : "Select Brand",
1344 queryParam : 'query[charass_value]',
1345 selectOnFocus : true,
1346 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
1347 triggerAction : 'all',
1353 beforeload : function (_self, o)
1355 o.params = o.params || {};
1356 // staff can see all logs, other companies can only see their own.
1357 // look for all of the charass 's with the same type= eg. brand.
1359 o.params.charass_char_id_char_name = 'PRODUCTGROUP';
1360 o.params.charass_target_type ='I';
1361 o.params._distinct = 'charass_value';
1362 o.params._columns = 'charass_value';
1366 sortInfo : { field : 'charass_value' , direction : 'ASC' },
1371 url : baseURL + '/Roo/Charass.php'
1374 xtype: 'JsonReader',
1376 totalProperty : 'total',
1385 'name': 'person_name',
1389 'name': 'event_when',
1391 'dateFormat': 'Y-m-d'
1410 'name': 'person_id',
1418 'name': 'person_id_id',
1422 'name': 'person_id_office_id',
1426 'name': 'person_id_name',
1430 'name': 'person_id_phone',
1434 'name': 'person_id_fax',
1438 'name': 'person_id_email',
1442 'name': 'person_id_company_id',
1446 'name': 'person_id_role',
1450 'name': 'person_id_active',
1454 'name': 'person_id_remarks',
1458 'name': 'person_id_passwd',
1462 'name': 'person_id_owner_id',
1466 'name': 'person_id_lang',
1470 'name': 'person_id_no_reset_sent',
1474 'name': 'person_id_action_type',
1478 'name': 'person_id_project_id',
1482 'name': 'person_id_deleted_by',
1486 'name': 'person_id_deleted_dt',
1496 xtype: 'ColumnModel',
1498 dataIndex : 'item_number',
1501 renderer : function(v) { return String.format('{0}', v); }
1504 xtype: 'ColumnModel',
1506 dataIndex : 'item_descrip1',
1507 header : 'Description',
1509 renderer : function(v) { return String.format('{0}', v); }
1512 xtype: 'ColumnModel',
1514 dataIndex : 'itemsrc_active',
1515 header : 'Purchased',
1517 renderer : function(v) {
1518 var state = v * 1 > 0 ? '-checked' : '';
1520 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1525 xtype: 'ColumnModel',
1527 dataIndex : 'item_sold',
1528 header : 'is Sold?',
1530 renderer : function(v) {
1531 var state = v * 1 > 0 ? '-checked' : '';
1533 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1538 xtype: 'ColumnModel',
1540 dataIndex : 'item_active',
1541 header : 'is Active?',
1543 renderer : function(v) {
1544 var state = v * 1 > 0 ? '-checked' : '';
1546 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1551 xtype: 'ColumnModel',
1553 dataIndex : 'last_purchase_price',
1554 header : 'Last purchase price',
1556 renderer : function(v,x,r) {
1558 return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ;
1563 xtype: 'ColumnModel',
1565 dataIndex : 'item_type',
1566 header : 'Item type',
1568 renderer : function(v) { return String.format('{0}', v); }
1571 xtype: 'ColumnModel',
1573 dataIndex : 'item_prodcat_id_prodcat_code',
1574 header : 'Item prodcat',
1576 renderer : function(v) { return String.format('{0}', v); }
1579 xtype: 'ColumnModel',
1582 dataIndex : 'item_actcost',
1585 renderer : function(v,x,r) {
1587 return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
1592 xtype: 'ColumnModel',
1595 dataIndex : 'item_base_cost',
1596 header : 'Cost (base)',
1598 renderer : function(v,x,r) {
1600 return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ;
1609 xtype: 'LayoutRegion',
1613 xtype: 'LayoutRegion',