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',
77 sortInfo : { field : 'ipshead_name', direction: 'ASC' },
82 url : baseURL + '/Roo/ipshead.php'
87 totalProperty : 'total',
96 'name': 'ipshead_name',
100 'name': 'ipshead_descrip',
104 'name': 'ipshead_effective',
106 'dateFormat': 'Y-m-d'
109 'name': 'ipshead_expires',
111 'dateFormat': 'Y-m-d'
114 'name': 'ipshead_curr_id',
118 'name': 'ipshead_updated',
120 'dateFormat': 'Y-m-d'
123 'name': 'ipshead_curr_id_curr_id',
127 'name': 'ipshead_curr_id_curr_base',
131 'name': 'ipshead_curr_id_curr_name',
135 'name': 'ipshead_curr_id_curr_symbol',
139 'name': 'ipshead_curr_id_curr_abbr',
146 xtype: 'PagingToolbar',
149 displayMsg : "Displaying ipshead{0} - {1} of {2}",
150 emptyMsg : "No ipshead found",
161 click : function (_self, e)
165 url : baseURL + '/Roo/Ipsiteminfo',
172 text : "Download Price Matrix"
178 click : function (_self, e)
180 Pman.Dialog.Image.show(
182 _url : baseURL+'/Xtuple/Pricing'
188 msg.push("Deleted " + data.deleted + " Price(s)");
191 msg.push("Updated " + data.updated + " Price(s)");
194 msg.push("Added " + data.inserted + " Price(s)");
197 msg.push("No data changed");
199 Roo.MessageBox.alert("Notice", msg.join("\n"));
205 text : "Upload Price Matrix"
215 cls : 'x-btn-text-icon',
216 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
220 if (!_this.dialog) return;
221 _this.dialog.show( { id : 0 } , function() {
222 _this.grid.footer.onClick('first');
231 cls : 'x-btn-text-icon',
232 icon : rootURL + '/Pman/templates/images/trash.gif',
236 Pman.genericDelete(_this, 'ipshead');
244 xtype: 'ColumnModel',
246 dataIndex : 'ipshead_curr_id_curr_name',
247 header : 'Ipshead curr',
250 renderer : function(v) { return String.format('{0}', v); }
253 xtype: 'ColumnModel',
255 dataIndex : 'ipshead_name',
256 header : 'Ipshead name',
259 renderer : function(v) { return String.format('{0}', v); }
262 xtype: 'ColumnModel',
264 header : 'Ipshead descrip',
266 dataIndex : 'ipshead_descrip',
267 renderer : function(v) { return String.format('{0}', v); }
270 xtype: 'ColumnModel',
272 header : 'Ipshead effective',
274 dataIndex : 'ipshead_effective',
275 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
278 xtype: 'ColumnModel',
280 dataIndex : 'ipshead_expires',
281 header : 'Ipshead expires',
283 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
286 xtype: 'ColumnModel',
288 header : 'Ipshead updated',
290 dataIndex : 'ipshead_updated',
291 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
300 activate : function() {
303 // _this.igrid.footer.onClick('first');
320 //_this.dialog = Pman.Dialog.FILL_IN
321 if (_this.ipanel.active) {
322 //this.footer.onClick('first');
325 cellclick : function (_self, row, col, e)
327 var di = _this.grid.colModel.getDataIndex(col);
329 var rec = _this.grid.ds.getAt(row);
331 if(di == 'item_image_filename'){
332 if(!rec.data.item_image_id){
336 if(rec.data.item_image_from_hk){
339 u = u.join('/') + '/hk.php';
342 url: u + '/Images/Download/' + rec.data.item_image_id + '/' + rec.data.item_image_filename
347 if (di == 'item_active') {
349 var nv = rec.data.item_active ? 0 : 1;
352 url : baseURL + '/Roo/Item',
354 item_id : rec.data.item_id,
357 success : function() {
358 rec.set('item_active', nv);
366 if(di == 'itemsrc_active'){
367 if(!rec.data.itemsrc_active){
368 Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');
371 if(rec.data.itemsrc_active){
372 Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
382 _this.locgrid.footer.onClick('first');
388 afteredit : function (e)
394 url : baseURL +'/Roo/Charass',
396 charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
397 charass_value : e.value,
398 charass_target_type : 'I',
400 charass_target_id : e.record.data.item_id
411 rowdblclick : function (_self, rowIndex, e)
413 if (!_this.dialog) return;
414 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
415 _this.grid.footer.onClick('first');
419 autoExpandColumn : 'item_descrip1',
426 beforeload : function (_self, o)
428 o.params._with_prodcat = 1;
429 o.params._with_char = 1;
430 o.params._with_itemsrc_active = 1;
431 o.params._with_last_purchase_price = 1;
432 o.params._with_image = 1;
433 var s = _this.search.getValue();
435 o.params['query[number_or_name]'] = s;
437 if (!_this.active.pressed) {
438 o.params.item_active = 1;
440 if (_this.brandSel.getValue().length) {
441 o.params._with_brand = _this.brandSel.getValue()
444 update : function (_self, record, operation)
446 if(operation != 'commit'){
450 var nv = record.data.itemsrc_active ? 0 : 1;
453 url : baseURL + '/Roo/Itemsrc',
456 item_id : record.data.item_id,
459 success : function(res) {
460 record.set('itemsrc_active', nv);
466 sortInfo : { field : 'item_number', direction: 'ASC' },
471 url : baseURL + '/Roo/item.php'
476 totalProperty : 'total',
485 'name': 'item_number',
489 'name': 'item_descrip1',
493 'name': 'item_descrip2',
497 'name': 'item_classcode_id',
501 'name': 'item_picklist',
505 'name': 'item_comments',
513 'name': 'item_fractional',
517 'name': 'item_active',
525 'name': 'item_prodweight',
529 'name': 'item_packweight',
533 'name': 'item_prodcat_id',
537 'name': 'item_exclusive',
541 'name': 'item_listprice',
545 'name': 'item_config',
549 'name': 'item_extdescrip',
553 'name': 'item_upccode',
557 'name': 'item_maxcost',
561 'name': 'item_inv_uom_id',
565 'name': 'item_price_uom_id',
569 'name': 'item_warrdays',
573 'name': 'item_freightclass_id',
577 'name': 'item_tax_recoverable',
581 'name': 'item_price_uom_id_uom_id',
585 'name': 'item_price_uom_id_uom_name',
589 'name': 'item_price_uom_id_uom_descrip',
593 'name': 'item_price_uom_id_uom_item_weight',
597 'name': 'item_inv_uom_id_uom_id',
601 'name': 'item_inv_uom_id_uom_name',
605 'name': 'item_inv_uom_id_uom_descrip',
609 'name': 'item_inv_uom_id_uom_item_weight',
613 'name': 'item_freightclass_id_freightclass_id',
617 'name': 'item_freightclass_id_freightclass_code',
621 'name': 'item_freightclass_id_freightclass_descrip',
625 'name': 'item_classcode_id_classcode_id',
629 'name': 'item_classcode_id_classcode_code',
633 'name': 'item_classcode_id_classcode_descrip',
637 'name': 'item_classcode_id_classcode_mfg',
641 'name': 'item_classcode_id_classcode_creator',
645 'name': 'item_classcode_id_classcode_created',
649 'name': 'item_classcode_id_classcode_modifier',
653 'name': 'item_classcode_id_classcode_modified',
657 'name': 'item_classcode_id_classcode_type',
671 render : function (_self)
673 _this.brandSel = _self;
675 select : function (combo, record, index)
677 _this.grid.footer.onClick('first');
682 displayField : 'charass_value',
684 forceSelection : true,
686 loadingText : "Searching...",
689 qtip : "Select Brand",
690 queryParam : 'query[charass_value]',
691 selectOnFocus : true,
692 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
693 triggerAction : 'all',
699 beforeload : function (_self, o)
701 o.params = o.params || {};
702 // staff can see all logs, other companies can only see their own.
703 // look for all of the charass 's with the same type= eg. brand.
705 o.params.charass_char_id_char_name = 'BRAND';
706 o.params.charass_target_type ='I';
707 o.params._distinct = 'charass_value';
708 o.params._columns = 'charass_value';
713 sortInfo : { field : 'charass_value' , direction : 'ASC' },
718 url : baseURL + '/Roo/Charass.php'
723 totalProperty : 'total',
732 'name': 'person_name',
736 'name': 'event_when',
738 'dateFormat': 'Y-m-d'
765 'name': 'person_id_id',
769 'name': 'person_id_office_id',
773 'name': 'person_id_name',
777 'name': 'person_id_phone',
781 'name': 'person_id_fax',
785 'name': 'person_id_email',
789 'name': 'person_id_company_id',
793 'name': 'person_id_role',
797 'name': 'person_id_active',
801 'name': 'person_id_remarks',
805 'name': 'person_id_passwd',
809 'name': 'person_id_owner_id',
813 'name': 'person_id_lang',
817 'name': 'person_id_no_reset_sent',
821 'name': 'person_id_action_type',
825 'name': 'person_id_project_id',
829 'name': 'person_id_deleted_by',
833 'name': 'person_id_deleted_dt',
844 render : function (_self)
846 _this.search = _self;
848 specialkey : function (_self, e)
850 _this.grid.footer.onClick('first');
858 click : function (_self, e)
860 _this.grid.footer.onClick('first');
864 icon : rootURL + '/Pman/templates/images/search.gif'
870 click : function (_self, e)
872 _this.search.setValue('');
876 _this.grid.footer.onClick('first');
880 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
890 toggle : function (_self, pressed)
893 this.setText(pressed ? "Hide Inactive" : "Show Inactive");
894 (function() { _this.grid.footer.onClick('first'); }).defer(100);
896 render : function (_self)
898 _this.active = _self;
902 text : "Show Inactive"
911 text : "Report start :"
917 render : function (_self)
919 _this.dateFrom = _self;
924 value : (function() { return (new Date()).format('Y') + '-01-01'; })()
930 render : function (_self)
932 _this.datespan = _self;
936 displayField : 'fname',
938 fieldLabel : 'Status',
939 hiddenName : 'cm_status',
942 name : 'cm_status_name',
943 triggerAction : 'all',
945 valueField : 'ftype',
948 xtype: 'SimpleStore',
951 [ '1', "Single Month Sales"],
952 [ '3', "Quarter Sales"],
953 [ '6', "Half year Sales"] ,
954 [ '12', "Full Year Sales"]
956 fields : [ 'ftype', 'fname']
963 click : function (_self, e)
965 if (!_this.brandSel.getValue().length) {
966 Roo.MessageBox.alert("Error", "Select a brand to download");
971 url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
973 date_from : _this.dateFrom.getValue(),
974 brand : _this.brandSel.getValue(),
975 span : _this.datespan.getValue()
982 text : "Download Sales Report"
987 xtype: 'PagingToolbar',
991 displayMsg : "Displaying item{0} - {1} of {2}",
992 emptyMsg : "No item found",
998 click : function (_self, e)
1002 url : baseURL + '/Roo/item',
1009 text : "Download Standard costs"
1015 click : function (_self, e)
1017 Pman.Dialog.Image.show(
1019 _url : baseURL+'/Xtuple/Import/Products'
1026 msg.push("Updated " + data.updated + " Products(s)");
1028 if (data.inserted) {
1029 msg.push("Added " + data.inserted + " Products(s)");
1032 msg.push("Skipped " + data.skipped);
1036 msg.push("No data changed");
1038 Roo.MessageBox.alert("Notice", msg.join("\n"));
1044 text : "Upload new products and costs"
1050 click : function (_self, e)
1053 var sel = _this.grid.selModel.getSelectedCell();
1055 Roo.MessageBox.alert("Error", "Select a row");
1059 var rec = _this.grid.ds.getAt(sel[0]);
1060 if(rec.data.item_id * 1 < 1){
1064 Pman.Dialog.Image.show({
1065 id : rec.data.item_image_id ? rec.data.item_image_id : 0,
1066 onid : rec.data.item_id,
1070 _this.grid.footer.onClick('first');
1077 text : "Upload an image"
1083 click : function (_self, e)
1085 Roo.MessageBox.progress ("Syncing Stock", "Sending");
1089 function runSync() {
1092 url : baseURL+'/Roo/Item',
1098 success : function(res) {
1100 if (!res.data.total) {
1101 Roo.MessageBox.hide();
1104 offset += res.data.limit;
1105 Roo.MessageBox.updateProgress ( offset / res.data.total, "Done " + offset + '/' + res.data.total);
1115 text : "Sync Product Data from HK",
1116 hidden : (function() {
1118 return baseURL.match(/hk\.php$/) ? true : false;
1125 xtype: 'ColumnModel',
1127 dataIndex : 'item_image_filename',
1128 header : 'Image ( Click to download )',
1130 renderer : function(v,x,r)
\r
1135 if(r.data.item_image_from_hk){
1136 var url = baseURL.split('/');
1138 url = url.join('/');
1139 return '<img src="' + url + '/hk.php/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="150" />';
1141 return '<img src="' + baseURL + '/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="150" />';
\r
1145 xtype: 'ColumnModel',
1147 dataIndex : 'item_char_brand',
1151 renderer : function(v) { return String.format('{0}', v); },
1153 xtype: 'GridEditor',
1160 displayField : 'charass_value',
1162 forceSelection : false,
1164 loadingText : "Searching...",
1167 qtip : "Select Brand",
1168 queryParam : 'query[charass_value]',
1169 selectOnFocus : true,
1170 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
1171 triggerAction : 'all',
1177 beforeload : function (_self, o)
1179 o.params = o.params || {};
1180 // staff can see all logs, other companies can only see their own.
1181 // look for all of the charass 's with the same type= eg. brand.
1183 o.params.charass_char_id_char_name = 'BRAND';
1184 o.params.charass_target_type ='I';
1185 o.params._distinct = 'charass_value';
1186 o.params._columns = 'charass_value';
1191 sortInfo : { field : 'charass_value' , direction : 'ASC' },
1196 url : baseURL + '/Roo/Charass.php'
1199 xtype: 'JsonReader',
1201 totalProperty : 'total',
1210 'name': 'person_name',
1214 'name': 'event_when',
1216 'dateFormat': 'Y-m-d'
1235 'name': 'person_id',
1243 'name': 'person_id_id',
1247 'name': 'person_id_office_id',
1251 'name': 'person_id_name',
1255 'name': 'person_id_phone',
1259 'name': 'person_id_fax',
1263 'name': 'person_id_email',
1267 'name': 'person_id_company_id',
1271 'name': 'person_id_role',
1275 'name': 'person_id_active',
1279 'name': 'person_id_remarks',
1283 'name': 'person_id_passwd',
1287 'name': 'person_id_owner_id',
1291 'name': 'person_id_lang',
1295 'name': 'person_id_no_reset_sent',
1299 'name': 'person_id_action_type',
1303 'name': 'person_id_project_id',
1307 'name': 'person_id_deleted_by',
1311 'name': 'person_id_deleted_dt',
1321 xtype: 'ColumnModel',
1323 dataIndex : 'item_char_productgroup',
1324 header : 'Product Group',
1326 renderer : function(v) { return String.format('{0}', v); },
1328 xtype: 'GridEditor',
1335 displayField : 'charass_value',
1337 forceSelection : false,
1339 loadingText : "Searching...",
1342 qtip : "Select Brand",
1343 queryParam : 'query[charass_value]',
1344 selectOnFocus : true,
1345 tpl : '<div class="x-grid-cell-text x-btn button"><b>{charass_value}</b> </div>',
1346 triggerAction : 'all',
1352 beforeload : function (_self, o)
1354 o.params = o.params || {};
1355 // staff can see all logs, other companies can only see their own.
1356 // look for all of the charass 's with the same type= eg. brand.
1358 o.params.charass_char_id_char_name = 'PRODUCTGROUP';
1359 o.params.charass_target_type ='I';
1360 o.params._distinct = 'charass_value';
1361 o.params._columns = 'charass_value';
1365 sortInfo : { field : 'charass_value' , direction : 'ASC' },
1370 url : baseURL + '/Roo/Charass.php'
1373 xtype: 'JsonReader',
1375 totalProperty : 'total',
1384 'name': 'person_name',
1388 'name': 'event_when',
1390 'dateFormat': 'Y-m-d'
1409 'name': 'person_id',
1417 'name': 'person_id_id',
1421 'name': 'person_id_office_id',
1425 'name': 'person_id_name',
1429 'name': 'person_id_phone',
1433 'name': 'person_id_fax',
1437 'name': 'person_id_email',
1441 'name': 'person_id_company_id',
1445 'name': 'person_id_role',
1449 'name': 'person_id_active',
1453 'name': 'person_id_remarks',
1457 'name': 'person_id_passwd',
1461 'name': 'person_id_owner_id',
1465 'name': 'person_id_lang',
1469 'name': 'person_id_no_reset_sent',
1473 'name': 'person_id_action_type',
1477 'name': 'person_id_project_id',
1481 'name': 'person_id_deleted_by',
1485 'name': 'person_id_deleted_dt',
1495 xtype: 'ColumnModel',
1497 dataIndex : 'item_number',
1500 renderer : function(v) { return String.format('{0}', v); }
1503 xtype: 'ColumnModel',
1505 dataIndex : 'item_descrip1',
1506 header : 'Description',
1508 renderer : function(v) { return String.format('{0}', v); }
1511 xtype: 'ColumnModel',
1513 dataIndex : 'itemsrc_active',
1514 header : 'Purchased',
1516 renderer : function(v) {
1517 var state = v * 1 > 0 ? '-checked' : '';
1519 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1524 xtype: 'ColumnModel',
1526 dataIndex : 'item_sold',
1527 header : 'is Sold?',
1529 renderer : function(v) {
1530 var state = v * 1 > 0 ? '-checked' : '';
1532 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1537 xtype: 'ColumnModel',
1539 dataIndex : 'item_active',
1540 header : 'is Active?',
1542 renderer : function(v) {
1543 var state = v * 1 > 0 ? '-checked' : '';
1545 return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
1550 xtype: 'ColumnModel',
1552 dataIndex : 'last_purchase_price',
1553 header : 'Last purchase price',
1555 renderer : function(v,x,r) {
1557 return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ;
1562 xtype: 'ColumnModel',
1564 dataIndex : 'item_type',
1565 header : 'Item type',
1567 renderer : function(v) { return String.format('{0}', v); }
1570 xtype: 'ColumnModel',
1572 dataIndex : 'item_prodcat_id_prodcat_code',
1573 header : 'Item prodcat',
1575 renderer : function(v) { return String.format('{0}', v); }
1578 xtype: 'ColumnModel',
1581 dataIndex : 'item_actcost',
1584 renderer : function(v,x,r) {
1586 return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
1591 xtype: 'ColumnModel',
1594 dataIndex : 'item_base_cost',
1595 header : 'Cost (base)',
1597 renderer : function(v,x,r) {
1599 return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ;
1608 xtype: 'LayoutRegion',
1612 xtype: 'LayoutRegion',