xtype: 'RowSelectionModel',
xns: Roo.grid,
listeners : {
- selectionchange : function (_self)
+ afterselectionchange : function (_self)
{
_this.igrid.footer.onClick('first');
}
if (_this.ipanel.active) {
//this.footer.onClick('first');
}
- },
- cellclick : function (_self, row, col, e)
- {
- var di = _this.grid.colModel.getDataIndex(col);
-
- var rec = _this.grid.ds.getAt(row);
-
- if(di == 'item_image_filename'){
- if(!rec.data.item_image_id){
- return;
- }
- var u = baseURL;
- if(rec.data.item_image_from_hk){
- u = u.split('/');
- u.pop();
- u = u.join('/') + '/hk.php';
- }
- Pman.download( {
- url: u + '/Images/Download/' + rec.data.item_image_id + '/' + rec.data.item_image_filename
- });
- return;
- }
-
- if (di == 'item_active') {
-
- var nv = rec.data.item_active ? 0 : 1;
- new Pman.Request({
- mask : 'Saving',
- url : baseURL + '/Roo/Item',
- params : {
- item_id : rec.data.item_id,
- item_active : nv
- },
- success : function() {
- rec.set('item_active', nv);
- }
- });
- return;
-
-
- }
-
- if(di == 'itemsrc_active'){
- if(!rec.data.itemsrc_active){
- Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');
- return;
- }
- if(rec.data.itemsrc_active){
- Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
- function (res) {
- if(res!='yes') {
- return;
- }
- rec.commit();
- });
- }
- }
-
- _this.locgrid.footer.onClick('first');
-
-
-
-
},
afteredit : function (e)
{
+ if(e.value == e.originalValue){
+ return false;
+ }
+ var p = _this.grid.getSelectionModel().getSelected();
+
+ if(!p || p.data.ipshead_id * 1 < 1){
+ Roo.MessageBox.alert('Error','Please select a price list');
+ return false;
+ }
- Roo.log(e);
new Pman.Request({
- url : baseURL +'/Roo/Charass',
+ url : baseURL +'/Roo/Item',
+ method : 'POST',
+ marks : 'Posting',
params : {
- charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
- charass_value : e.value,
- charass_target_type : 'I',
- charass_default : 1,
- charass_target_id : e.record.data.item_id
+ update_ipshead : 1,
+ ipshead_id : p.data.ipshead_id,
+ item_id : e.record.data.item_id,
+ _price : e.value,
},
- method : 'POST'
+ success : function() {
+ _this.igrid.footer.onClick('refresh');
+ }
+
});
-
- e.record.commit();
-
-
-
},
- rowdblclick : function (_self, rowIndex, e)
+ beforeedit : function (e)
{
- if (!_this.dialog) return;
- _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
- _this.grid.footer.onClick('first');
- });
+ if(e.field != 'ipshead_price'){
+ return false;
+ }
+
}
},
- autoExpandColumn : 'item_descrip1',
+ autoExpandColumn : 'item_number',
clicksToEdit : 1,
loadMask : true,
dataSource : {
var p = _this.grid.getSelectionModel().getSelected();
- if(!p || p.ipshead_id * 1 < 1){
+ if(!p || p.data.ipshead_id * 1 < 1){
this.removeAll();
return false;
}
- o.params.item_active = 1;
+ //o.params.item_active = 1;
+ o.params._ipshead_price = 1;
+ o.params._ipshead_id = p.data.ipshead_id;
- },
- update : function (_self, record, operation)
- {
- if(operation != 'commit'){
- return;
- }
-
- var nv = record.data.itemsrc_active ? 0 : 1;
- new Pman.Request({
- mask : 'Saving',
- url : baseURL + '/Roo/Itemsrc',
- params : {
- _update_by_item : 1,
- item_id : record.data.item_id,
- itemsrc_active : nv
- },
- success : function(res) {
- record.set('itemsrc_active', nv);
- }
- });
}
},
remoteSort : true,
reader : {
xtype: 'JsonReader',
xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
id : 'id',
+ root : 'data',
+ totalProperty : 'total',
fields : [
{
'name': 'item_id',
{
'name': 'item_number',
'type': 'string'
- },
- {
- 'name': 'item_descrip1',
- 'type': 'string'
- },
- {
- 'name': 'item_descrip2',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id',
- 'type': 'int'
- },
- {
- 'name': 'item_picklist',
- 'type': 'int'
- },
- {
- 'name': 'item_comments',
- 'type': 'string'
- },
- {
- 'name': 'item_sold',
- 'type': 'int'
- },
- {
- 'name': 'item_fractional',
- 'type': 'int'
- },
- {
- 'name': 'item_active',
- 'type': 'int'
- },
- {
- 'name': 'item_type',
- 'type': 'string'
- },
- {
- 'name': 'item_prodweight',
- 'type': 'float'
- },
- {
- 'name': 'item_packweight',
- 'type': 'float'
- },
- {
- 'name': 'item_prodcat_id',
- 'type': 'int'
- },
- {
- 'name': 'item_exclusive',
- 'type': 'int'
- },
- {
- 'name': 'item_listprice',
- 'type': 'float'
- },
- {
- 'name': 'item_config',
- 'type': 'int'
- },
- {
- 'name': 'item_extdescrip',
- 'type': 'string'
- },
- {
- 'name': 'item_upccode',
- 'type': 'string'
- },
- {
- 'name': 'item_maxcost',
- 'type': 'float'
- },
- {
- 'name': 'item_inv_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_warrdays',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id',
- 'type': 'int'
- },
- {
- 'name': 'item_tax_recoverable',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_price_uom_id_uom_name',
- 'type': 'string'
- },
- {
- 'name': 'item_price_uom_id_uom_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_price_uom_id_uom_item_weight',
- 'type': 'int'
- },
- {
- 'name': 'item_inv_uom_id_uom_id',
- 'type': 'int'
- },
- {
- 'name': 'item_inv_uom_id_uom_name',
- 'type': 'string'
- },
- {
- 'name': 'item_inv_uom_id_uom_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_inv_uom_id_uom_item_weight',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id_freightclass_id',
- 'type': 'int'
- },
- {
- 'name': 'item_freightclass_id_freightclass_code',
- 'type': 'string'
- },
- {
- 'name': 'item_freightclass_id_freightclass_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_id',
- 'type': 'int'
- },
- {
- 'name': 'item_classcode_id_classcode_code',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_descrip',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_mfg',
- 'type': 'int'
- },
- {
- 'name': 'item_classcode_id_classcode_creator',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_created',
- 'type': 'date'
- },
- {
- 'name': 'item_classcode_id_classcode_modifier',
- 'type': 'string'
- },
- {
- 'name': 'item_classcode_id_classcode_modified',
- 'type': 'date'
- },
- {
- 'name': 'item_classcode_id_classcode_type',
- 'type': 'string'
}
]
}
xns: Roo.grid,
dataIndex : 'item_number',
header : 'Number',
- width : 100,
+ width : 150,
renderer : function(v) { return String.format('{0}', v); }
},
{
align : 'right',
dataIndex : 'ipshead_price',
header : 'Price',
- width : 75,
- renderer : function(v,x,r) {
-
- return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ;
-
- }
+ width : 100,
+ renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
+ editor : {
+ xtype: 'GridEditor',
+ xns: Roo.grid,
+ field : {
+ xtype: 'NumberField',
+ xns: Roo.form,
+ decimalPrecision : 2,
+ minValue : 1,
+ style : 'text-align:right'
+ }
+ }
}
]
}
xtype: 'LayoutRegion',
xns: Roo,
split : true,
- width : 500
+ width : 350
}
}
};