items : [
{
grid : {
+ sm : {
+ '|xns' : 'Roo.grid',
+ singleSelect : true,
+ xtype : 'RowSelectionModel',
+ xns : Roo.grid
+ },
toolbar : {
'|xns' : 'Roo',
xtype : 'Toolbar',
_this.grid.footer.onClick('first');\r
}
}
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Fill',
+ xns : Roo.Toolbar
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "Add",
+ xtype : 'Button',
+ cls : 'x-btn-text-icon',
+ icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+ xns : Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+
+ Pman.Dialog.XtupleTerms.show( { id : 0 } , function() {
+ _this.grid.footer.onClick('first');
+ });
+ }
+ }
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Separator',
+ xns : Roo.Toolbar
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "Delete",
+ xtype : 'Button',
+ cls : 'x-btn-text-icon',
+ icon : rootURL + '/Pman/templates/images/trash.gif',
+ xns : Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+ var sel = _this.grid.getSelectionModel().getSelected();
+
+ if(!sel || sel.data.terms_id * 1 < 1){
+ Roo.MessageBox.alert("Error", "Please select a terms");
+ return;
+ }
+
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete the terms?",
+ function(r) {
+ if (r != 'yes') {
+ return;
+ }
+ new Pman.Request({
+ url : baseURL + '/Roo/terms.php',
+ method : 'POST',
+ params : {
+ _delete : sel.data.terms_id * 1
+ },
+ success : function(res) {
+ _this.grid.footer.onClick('first');
+ }
+ });
+
+ return;
+ }
+ );
+
+ }
+ }
}
]
proxy : {
'|xns' : 'Roo.data',
url : baseURL + '/Roo/terms.php',
- xtype : 'HttpProxy',
method : 'GET',
+ xtype : 'HttpProxy',
xns : Roo.data
},
reader : {
'|xns' : 'Roo.data',
xtype : 'Store',
remoteSort : true,
- sortInfo : { field : 'crdate', direction: 'ASC' },
+ sortInfo : { field : 'terms_id', direction: 'ASC' },
xns : Roo.data,
listeners : {
beforeload : function (_self, o)
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
+ width : 75,
header : 'ID#',
- width : 200,
renderer : function(v) { return String.format('{0}', v ? v : ''); },
xns : Roo.grid,
sortable : true,
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- width : 150,
header : 'Code',
+ width : 150,
renderer : function(v) { return String.format('{0}', v ? v : ''); },
xns : Roo.grid,
sortable : true,
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- header : 'Description',
width : 150,
+ header : 'Description',
renderer : function(v) { return String.format('{0}', v ? v : ''); },
xns : Roo.grid,
sortable : true,
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- width : 150,
header : 'Type',
+ width : 75,
renderer : function(v) {
var t = (v == 'D') ? 'Days' : 'Proximo';
},
xns : Roo.grid,
sortable : true,
- dataIndex : 'term_type'
+ dataIndex : 'terms_type'
},
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- width : 150,
header : 'Due Days',
- renderer : function(v) { return String.format('{0}', v ? v : ''); },
+ width : 100,
+ renderer : function(v) {
+ return String.format('{0}', v);
+
+ },
xns : Roo.grid,
sortable : true,
dataIndex : 'terms_duedays'
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- width : 150,
header : 'Discount Days',
- renderer : function(v) { return String.format('{0}', v ? v : ''); },
+ width : 100,
+ renderer : function(v) {
+ return String.format('{0}', v);
+
+ },
xns : Roo.grid,
sortable : true,
dataIndex : 'terms_discdays'
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- header : 'Discount Days',
- width : 150,
- renderer : function(v) { return String.format('{0}', v ? v : ''); },
+ header : 'Cut Off Days',
+ width : 100,
+ renderer : function(v) {
+ return String.format('{0}', v);
+
+ },
xns : Roo.grid,
sortable : true,
dataIndex : 'terms_cutoffday'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Used in Payables',
+ width : 150,
+ renderer : function(v) {
+ var state = v ? '-checked' : '';
+
+ return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+ },
+ xns : Roo.grid,
+ sortable : true,
+ dataIndex : 'terms_ap'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ width : 150,
+ header : 'Used in Receivables',
+ renderer : function(v) {
+ var state = v ? '-checked' : '';
+
+ return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+ },
+ xns : Roo.grid,
+ sortable : true,
+ dataIndex : 'terms_ar'
}
],
listeners : {
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ var id = this.getDataSource().getAt(rowIndex).data.terms_id * 1;
+
+ if(id < 1){
+ Roo.MessageBox.alert('Error', 'Please select a row');
+ return;
+ }
+
+ Pman.Dialog.XtupleTerms.show( {id : id}, function() {
+ _this.grid.footer.onClick('refresh');
+ });
+ },
render : function()
{
_this.grid = this;
},
'|xns' : 'Roo',
+ region : 'center',
fitToframe : true,
background : false,
- region : 'center',
title : "Terms",
xtype : 'GridPanel',
fitContainer : true,