Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleApAging.bjs
1 {
2     "name" : "Pman.Tab.XtupleApAging",
3     "parent" : "Pman.Tab.XtupleAccountsTab",
4     "title" : "",
5     "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleApAging.bjs",
6     "permname" : "",
7     "modOrder" : "500",
8     "items" : [
9         {
10             "fitToFrame" : true,
11             "background" : true,
12             "region" : "center",
13             "title" : "Accounts Payable",
14             "xtype" : "NestedLayoutPanel",
15             "fitContainer" : true,
16             "$ xns" : "Roo",
17             "items" : [
18                 {
19                     "xtype" : "BorderLayout",
20                     "$ xns" : "Roo",
21                     "* prop" : "layout",
22                     "items" : [
23                         {
24                             "xtype" : "LayoutRegion",
25                             "$ xns" : "Roo",
26                             "* prop" : "center"
27                         },
28                         {
29                             "listeners" : {
30                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
31                             },
32                             "fitToframe" : true,
33                             "background" : true,
34                             "region" : "center",
35                             "title" : "ApAging",
36                             "xtype" : "GridPanel",
37                             "fitContainer" : true,
38                             "$ xns" : "Roo",
39                             "tableName" : "apopen",
40                             "items" : [
41                                 {
42                                     "listeners" : {
43                                         "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
44                                     },
45                                     "autoExpandColumn" : "araging_cust_name",
46                                     "xtype" : "Grid",
47                                     "loadMask" : true,
48                                     "$ xns" : "Roo.grid",
49                                     "* prop" : "grid",
50                                     "items" : [
51                                         {
52                                             "xtype" : "RowSelectionModel",
53                                             "singleSelect" : true,
54                                             "$ xns" : "Roo.grid",
55                                             "* prop" : "sm"
56                                         },
57                                         {
58                                             "listeners" : {
59                                                 "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n\n    \n    var dt = _this.relDate.getValue();\n    \n    var params = {\n        _group : 'apAging',\n        _name : 'bydate',\n        'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'useDocDate:text' : false\n    };\n    \n    var vend = _this.vendSel.getValue();\n    if (vend*1) {\n        params['vend_id:number'] = vend;\n    \n    }\n    \n    \n    Roo.apply(o.params,params);\n}"
60                                             },
61                                             "xtype" : "Store",
62                                             "remoteSort" : true,
63                                             "$ xns" : "Roo.data",
64                                             "* prop" : "dataSource",
65                                             "items" : [
66                                                 {
67                                                     "$ url" : "baseURL + '/Roo/Metasql.php'",
68                                                     "method" : "GET",
69                                                     "xtype" : "HttpProxy",
70                                                     "timeout" : 600000,
71                                                     "$ xns" : "Roo.data",
72                                                     "* prop" : "proxy"
73                                                 },
74                                                 {
75                                                     "id" : "id",
76                                                     "root" : "data",
77                                                     "xtype" : "JsonReader",
78                                                     "$ fields" : "[\n    {\n        'name': 'apaging_doctype',\n        'type': 'string'\n    }\n]",
79                                                     "$ xns" : "Roo.data",
80                                                     "* prop" : "reader",
81                                                     "totalProperty" : "total"
82                                                 }
83                                             ]
84                                         },
85                                         {
86                                             "xtype" : "Toolbar",
87                                             "$ xns" : "Roo",
88                                             "* prop" : "toolbar",
89                                             "items" : [
90                                                 {
91                                                     "listeners" : {
92                                                         "render" : "function (_self)\n{\n    _this.vendSel = _self;\n}",
93                                                         "select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
94                                                     },
95                                                     "listWidth" : 400,
96                                                     "triggerAction" : "all",
97                                                     "fieldLabel" : "cust_name",
98                                                     "forceSelection" : true,
99                                                     "selectOnFocus" : true,
100                                                     "pageSize" : 20,
101                                                     "displayField" : "vend_name",
102                                                     "emptyText" : "Select Vendor",
103                                                     "hiddenName" : "vend_id",
104                                                     "minChars" : 2,
105                                                     "valueField" : "vend_id",
106                                                     "xtype" : "ComboBox",
107                                                     "allowBlank" : true,
108                                                     "typeAhead" : true,
109                                                     "editable" : true,
110                                                     "width" : 300,
111                                                     "$ xns" : "Roo.form",
112                                                     "name" : "vend_name",
113                                                     "qtip" : "Select Vendor",
114                                                     "queryParam" : "vend_name:text",
115                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
116                                                     "loadingText" : "Searching...",
117                                                     "items" : [
118                                                         {
119                                                             "listeners" : {
120                                                                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    if (!_this.relDate) {\n        return false;\n    }\n    var dt = _this.relDate.getValue();    \n    // set more here\n    o.params['_group'] = 'apAging';\n    o.params['_name'] = 'vendors';\n    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    o.params['useDocDate:text'] = false    \n}\n"
121                                                             },
122                                                             "xtype" : "Store",
123                                                             "remoteSort" : true,
124                                                             "$ sortInfo" : "{ direction : 'ASC', field: 'cust_name' }",
125                                                             "$ xns" : "Roo.data",
126                                                             "* prop" : "store",
127                                                             "items" : [
128                                                                 {
129                                                                     "$ url" : "baseURL + '/Roo/metasql.php'",
130                                                                     "xtype" : "HttpProxy",
131                                                                     "method" : "GET",
132                                                                     "$ xns" : "Roo.data",
133                                                                     "* prop" : "proxy"
134                                                                 },
135                                                                 {
136                                                                     "id" : "cust_id",
137                                                                     "root" : "data",
138                                                                     "xtype" : "JsonReader",
139                                                                     "$ fields" : "[{\"name\":\"vend_id\",\"type\":\"int\"},\"vend_name\"]",
140                                                                     "$ xns" : "Roo.data",
141                                                                     "* prop" : "reader",
142                                                                     "totalProperty" : "total"
143                                                                 }
144                                                             ]
145                                                         }
146                                                     ]
147                                                 },
148                                                 {
149                                                     "text" : "as Of:",
150                                                     "xtype" : "TextItem",
151                                                     "$ xns" : "Roo.Toolbar"
152                                                 },
153                                                 {
154                                                     "listeners" : {
155                                                         "render" : "function (_self)\r\n{\r\n    _this.relDate = _self;\r\n   _self.setValue(  new Date() );\r\n}",
156                                                         "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
157                                                     },
158                                                     "format" : "Y-m-d",
159                                                     "xtype" : "DateField",
160                                                     "allowBlank" : false,
161                                                     "width" : 100,
162                                                     "$ xns" : "Roo.form"
163                                                 },
164                                                 {
165                                                     "xtype" : "Fill",
166                                                     "$ xns" : "Roo.Toolbar"
167                                                 },
168                                                 {
169                                                     "listeners" : {
170                                                         "|click" : "function ()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s || s.data.apopen_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n    }\n    \n    if(s.data.apaging_doctype != 'V'){\n        Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Voiding',\n                url : baseURL + '/Roo/Apopen',\n                method : 'POST',\n                params :  {\n                    apopen_id : s.data.apopen_id,\n                    _void : 1\n                },\n                success : function() {\n                    _this.grid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
171                                                     },
172                                                     "text" : "Void",
173                                                     "xtype" : "Button",
174                                                     "cls" : "x-btn-text-icon",
175                                                     "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
176                                                     "$ xns" : "Roo.Toolbar"
177                                                 }
178                                             ]
179                                         },
180                                         {
181                                             "pageSize" : 25,
182                                             "xtype" : "PagingToolbar",
183                                             "emptyMsg" : "Nothing found",
184                                             "$ xns" : "Roo",
185                                             "displayMsg" : "Displaying araging{0} - {1} of {2}",
186                                             "displayInfo" : true,
187                                             "* prop" : "footer"
188                                         },
189                                         {
190                                             "xtype" : "ColumnModel",
191                                             "header" : "Date",
192                                             "width" : 100,
193                                             "$ renderer" : "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n\n    return String.format('{0}', d.format('d/M/Y')); \n}",
194                                             "$ xns" : "Roo.grid",
195                                             "* prop" : "colModel[]",
196                                             "dataIndex" : "apaging_docdate"
197                                         },
198                                         {
199                                             "xtype" : "ColumnModel",
200                                             "header" : "Vendor",
201                                             "width" : 200,
202                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
203                                             "$ xns" : "Roo.grid",
204                                             "* prop" : "colModel[]",
205                                             "dataIndex" : "apaging_vend_name"
206                                         },
207                                         {
208                                             "xtype" : "ColumnModel",
209                                             "header" : "Doc Type",
210                                             "width" : 120,
211                                             "$ renderer" : "function(v) {\n    switch(v) {\n        case 'I':\n            return \"Invoice\";\n        case 'C':\n            return \"Credit Memo\";        \n        case 'D':\n            return \"Debit Memo\";                    \n        case 'R':\n            return \"Cash Receipt\";        \n        case 'V':\n            return \"Voucher\";        \n        default:\n             return String.format('{0}', v); \n     }\n }",
212                                             "$ xns" : "Roo.grid",
213                                             "* prop" : "colModel[]",
214                                             "dataIndex" : "apaging_doctype"
215                                         },
216                                         {
217                                             "xtype" : "ColumnModel",
218                                             "header" : "Docnumber",
219                                             "width" : 120,
220                                             "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
221                                             "$ xns" : "Roo.grid",
222                                             "* prop" : "colModel[]",
223                                             "dataIndex" : "apaging_docnumber"
224                                         },
225                                         {
226                                             "xtype" : "ColumnModel",
227                                             "header" : "Currency",
228                                             "width" : 120,
229                                             "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
230                                             "$ xns" : "Roo.grid",
231                                             "* prop" : "colModel[]",
232                                             "dataIndex" : "apaging_curr_symbol"
233                                         },
234                                         {
235                                             "align" : "right",
236                                             "xtype" : "ColumnModel",
237                                             "header" : "Value",
238                                             "width" : 100,
239                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
240                                             "$ xns" : "Roo.grid",
241                                             "* prop" : "colModel[]",
242                                             "dataIndex" : "apaging_apopen_amount"
243                                         },
244                                         {
245                                             "align" : "right",
246                                             "xtype" : "ColumnModel",
247                                             "header" : "30 Days",
248                                             "width" : 100,
249                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
250                                             "$ xns" : "Roo.grid",
251                                             "* prop" : "colModel[]",
252                                             "dataIndex" : "apaging_cur_val"
253                                         },
254                                         {
255                                             "align" : "right",
256                                             "xtype" : "ColumnModel",
257                                             "header" : "60 Days",
258                                             "width" : 100,
259                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
260                                             "$ xns" : "Roo.grid",
261                                             "* prop" : "colModel[]",
262                                             "dataIndex" : "apaging_sixty_val"
263                                         },
264                                         {
265                                             "align" : "right",
266                                             "xtype" : "ColumnModel",
267                                             "header" : "90 Days",
268                                             "width" : 100,
269                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
270                                             "$ xns" : "Roo.grid",
271                                             "* prop" : "colModel[]",
272                                             "dataIndex" : "apaging_ninety_val"
273                                         },
274                                         {
275                                             "align" : "right",
276                                             "xtype" : "ColumnModel",
277                                             "header" : "Over 90 days",
278                                             "width" : 150,
279                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
280                                             "$ xns" : "Roo.grid",
281                                             "* prop" : "colModel[]",
282                                             "dataIndex" : "apaging_plus_val"
283                                         },
284                                         {
285                                             "align" : "right",
286                                             "xtype" : "ColumnModel",
287                                             "header" : "Total",
288                                             "width" : 150,
289                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
290                                             "$ xns" : "Roo.grid",
291                                             "* prop" : "colModel[]",
292                                             "dataIndex" : "apaging_total_val"
293                                         },
294                                         {
295                                             "align" : "right",
296                                             "xtype" : "ColumnModel",
297                                             "header" : "Total (BASE)",
298                                             "width" : 150,
299                                             "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
300                                             "$ xns" : "Roo.grid",
301                                             "* prop" : "colModel[]",
302                                             "dataIndex" : "apaging_base_total"
303                                         }
304                                     ]
305                                 }
306                             ]
307                         }
308                     ]
309                 }
310             ]
311         }
312     ]
313 }