fitContainer : true,
fitToFrame : true,
region : 'center',
- title : "Accounts Recievable",
+ title : "Price List",
layout : {
xtype: 'BorderLayout',
xns: Roo,
},
autoExpandColumn : 'ipshead_descrip',
loadMask : true,
+ sm : {
+ xtype: 'RowSelectionModel',
+ xns: Roo.grid,
+ listeners : {
+ afterselectionchange : function (_self)
+ {
+ _this.igrid.footer.onClick('first');
+ }
+ },
+ singleSelect : true
+ },
dataSource : {
xtype: 'Store',
xns: Roo.data,
}
]
}
+ },
+ {
+ xtype: 'GridPanel',
+ xns: Roo,
+ listeners : {
+ activate : function() {
+ _this.ipanel = this;
+ if (_this.igrid) {
+ // _this.igrid.footer.onClick('first');
+ }
+ }
+ },
+ background : true,
+ fitContainer : true,
+ fitToframe : true,
+ region : 'east',
+ tableName : 'item',
+ title : "Products",
+ grid : {
+ xtype: 'EditorGrid',
+ xns: Roo.grid,
+ listeners : {
+ render : function()
+ {
+ _this.igrid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+ if (_this.ipanel.active) {
+ //this.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;
+ }
+
+ new Pman.Request({
+ url : baseURL +'/Roo/Item',
+ method : 'POST',
+ marks : 'Posting',
+ params : {
+ update_ipshead : 1,
+ ipshead_id : p.data.ipshead_id,
+ item_id : e.record.data.item_id,
+ _price : e.value,
+ },
+ success : function() {
+ _this.igrid.footer.onClick('refresh');
+ }
+
+ });
+
+ },
+ beforeedit : function (e)
+ {
+ if(e.field != 'ipshead_price'){
+ return false;
+ }
+
+ }
+ },
+ autoExpandColumn : 'item_number',
+ clicksToEdit : 1,
+ loadMask : true,
+ dataSource : {
+ xtype: 'Store',
+ xns: Roo.data,
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params = o.params || {}
+
+ var p = _this.grid.getSelectionModel().getSelected();
+
+ if(!p || p.data.ipshead_id * 1 < 1){
+ this.removeAll();
+ return false;
+ }
+
+ //o.params.item_active = 1;
+ o.params._ipshead_price = 1;
+ o.params._ipshead_id = p.data.ipshead_id;
+
+ }
+ },
+ remoteSort : true,
+ sortInfo : { field : 'item_number', direction: 'ASC' },
+ proxy : {
+ xtype: 'HttpProxy',
+ xns: Roo.data,
+ method : 'GET',
+ url : baseURL + '/Roo/item.php'
+ },
+ reader : {
+ xtype: 'JsonReader',
+ xns: Roo.data,
+ id : 'id',
+ root : 'data',
+ totalProperty : 'total',
+ fields : [
+ {
+ 'name': 'item_id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'item_number',
+ 'type': 'string'
+ }
+ ]
+ }
+ },
+ footer : {
+ xtype: 'PagingToolbar',
+ xns: Roo,
+ displayInfo : true,
+ displayMsg : "",
+ emptyMsg : "",
+ pageSize : 25
+ },
+ colModel : [
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ dataIndex : 'item_number',
+ header : 'Number',
+ width : 150,
+ renderer : function(v) { return String.format('{0}', v); }
+ },
+ {
+ xtype: 'ColumnModel',
+ xns: Roo.grid,
+ align : 'right',
+ dataIndex : 'ipshead_price',
+ header : 'Price',
+ 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'
+ }
+ }
+ }
+ ]
+ }
}
],
center : {
xtype: 'LayoutRegion',
xns: Roo
+ },
+ east : {
+ xtype: 'LayoutRegion',
+ xns: Roo,
+ split : true,
+ width : 350
}
}
};