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 = o.params || {}
431 var p = _this.grid.getSelectionModel().getSelected();
433 if(!p || p.ipshead_id * 1 < 1){
438 o.params.item_active = 1;
441 update : function (_self, record, operation)
443 if(operation != 'commit'){
447 var nv = record.data.itemsrc_active ? 0 : 1;
450 url : baseURL + '/Roo/Itemsrc',
453 item_id : record.data.item_id,
456 success : function(res) {
457 record.set('itemsrc_active', nv);
463 sortInfo : { field : 'item_number', direction: 'ASC' },
468 url : baseURL + '/Roo/item.php'
473 totalProperty : 'total',
482 'name': 'item_number',
486 'name': 'item_descrip1',
490 'name': 'item_descrip2',
494 'name': 'item_classcode_id',
498 'name': 'item_picklist',
502 'name': 'item_comments',
510 'name': 'item_fractional',
514 'name': 'item_active',
522 'name': 'item_prodweight',
526 'name': 'item_packweight',
530 'name': 'item_prodcat_id',
534 'name': 'item_exclusive',
538 'name': 'item_listprice',
542 'name': 'item_config',
546 'name': 'item_extdescrip',
550 'name': 'item_upccode',
554 'name': 'item_maxcost',
558 'name': 'item_inv_uom_id',
562 'name': 'item_price_uom_id',
566 'name': 'item_warrdays',
570 'name': 'item_freightclass_id',
574 'name': 'item_tax_recoverable',
578 'name': 'item_price_uom_id_uom_id',
582 'name': 'item_price_uom_id_uom_name',
586 'name': 'item_price_uom_id_uom_descrip',
590 'name': 'item_price_uom_id_uom_item_weight',
594 'name': 'item_inv_uom_id_uom_id',
598 'name': 'item_inv_uom_id_uom_name',
602 'name': 'item_inv_uom_id_uom_descrip',
606 'name': 'item_inv_uom_id_uom_item_weight',
610 'name': 'item_freightclass_id_freightclass_id',
614 'name': 'item_freightclass_id_freightclass_code',
618 'name': 'item_freightclass_id_freightclass_descrip',
622 'name': 'item_classcode_id_classcode_id',
626 'name': 'item_classcode_id_classcode_code',
630 'name': 'item_classcode_id_classcode_descrip',
634 'name': 'item_classcode_id_classcode_mfg',
638 'name': 'item_classcode_id_classcode_creator',
642 'name': 'item_classcode_id_classcode_created',
646 'name': 'item_classcode_id_classcode_modifier',
650 'name': 'item_classcode_id_classcode_modified',
654 'name': 'item_classcode_id_classcode_type',
661 xtype: 'PagingToolbar',
664 displayMsg : "Displaying item{0} - {1} of {2}",
665 emptyMsg : "No item found",
672 click : function (_self, e)
676 url : baseURL + '/Roo/item',
683 text : "Download Standard costs"
689 click : function (_self, e)
691 Pman.Dialog.Image.show(
693 _url : baseURL+'/Xtuple/Import/Products'
700 msg.push("Updated " + data.updated + " Products(s)");
703 msg.push("Added " + data.inserted + " Products(s)");
706 msg.push("Skipped " + data.skipped);
710 msg.push("No data changed");
712 Roo.MessageBox.alert("Notice", msg.join("\n"));
718 text : "Upload new products and costs"
724 click : function (_self, e)
727 var sel = _this.grid.selModel.getSelectedCell();
729 Roo.MessageBox.alert("Error", "Select a row");
733 var rec = _this.grid.ds.getAt(sel[0]);
734 if(rec.data.item_id * 1 < 1){
738 Pman.Dialog.Image.show({
739 id : rec.data.item_image_id ? rec.data.item_image_id : 0,
740 onid : rec.data.item_id,
744 _this.grid.footer.onClick('first');
751 text : "Upload an image"
757 click : function (_self, e)
759 Roo.MessageBox.progress ("Syncing Stock", "Sending");
766 url : baseURL+'/Roo/Item',
772 success : function(res) {
774 if (!res.data.total) {
775 Roo.MessageBox.hide();
778 offset += res.data.limit;
779 Roo.MessageBox.updateProgress ( offset / res.data.total, "Done " + offset + '/' + res.data.total);
789 text : "Sync Product Data from HK",
790 hidden : (function() {
792 return baseURL.match(/hk\.php$/) ? true : false;
799 xtype: 'ColumnModel',
801 dataIndex : 'item_number',
804 renderer : function(v) { return String.format('{0}', v); }
807 xtype: 'ColumnModel',
810 dataIndex : 'item_actcost',
813 renderer : function(v,x,r) {
815 return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
820 xtype: 'ColumnModel',
823 dataIndex : 'item_base_cost',
824 header : 'Cost (base)',
826 renderer : function(v,x,r) {
828 return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ;
837 xtype: 'LayoutRegion',
841 xtype: 'LayoutRegion',