Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleExpenses.bjs
1 {
2     "id": "roo-file-6",
3     "name": "Pman.Dialog.XtupleExpenses",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleExpenses.bjs",
7     "items": [
8         {
9             "closable": false,
10             "collapsible": false,
11             "height": 640,
12             "modal": true,
13             "resizable": false,
14             "title": "Edit / Create expense Report",
15             "width": 900,
16             "xtype": "LayoutDialog",
17             "|xns": "Roo",
18             "items": [
19                 {
20                     "|xns": "Roo",
21                     "xtype": "LayoutRegion",
22                     "*prop": "center"
23                 },
24                 {
25                     "*prop": "north",
26                     "height": 250,
27                     "xtype": "LayoutRegion",
28                     "|xns": "Roo"
29                 },
30                 {
31                     "region": "north",
32                     "xtype": "ContentPanel",
33                     "|xns": "Roo",
34                     "items": [
35                         {
36                             "listeners": {
37                                 "|actioncomplete": "function(_self,action)\n{\n    \n    var btns = ['postToManagement', 'postToAccounts','postToGL', 'postToStaff', 'saveBtn'];\n    var  showhide = function()\n    {\n        Roo.each(btns, function(b) {\n            _this[b].hide();\n        });\n        switch(_this.form.findField('expense_status').getValue()) {\n            case '':\n                _this['saveBtn'].show();\n                return; // do not show any button...\n            case 'Draft':            \n                _this['saveBtn'].show();\n                _this['postToManagement'].show();\n                break;\n                \n                \n            case 'Pending Management Approval':\n            case 'Pending Supervisor Approval': // old system..\n                // check if they are managmenet..\n                // eg. have to be in TIER2\n                if (!Pman.Login.inGroup('TIER2') && !Pman.Login.inGroup('TIER1') && \n                         !Pman.Login.inGroup('Administrators')) {\n                    return;\n                }\n                _this['postToAccounts'].show();\n                _this['postToStaff'].show(); \n                _this['saveBtn'].show();\n                break;\n            case 'Pending Accounting Approval':\n                if (!Pman.Login.inGroup('Administrators')) {\n                    return;\n                }\n            \n                // check if they are managmenet..\n                _this['postToGL'].show();\n                _this['postToStaff'].show();                \n                _this['saveBtn'].show();                \n                break;\n            \n        \n        }\n    }\n    \n    if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       if (_this.data.expense_id) {\n           this.load({ method: 'GET', params: { '_id' : _this.data.expense_id }});\n             \n           return;\n       }\n       showhide();\n       _this.grid.ds.load({});\n       return;\n    }\n    if (action.type == 'load') {\n    \n    \n        showhide();\n    \n    \n    \n       _this.grid.ds.load({});\n        return;\n    }\n    if (action.type =='submit') {\n        \n        \n        if (! (1 * _this.form.findField('expense_id').getValue()) ) {\n            Roo.log(\"fire event\");\n            _this.data = action.result.data;\n            this.fireEvent('actioncomplete', this,  { type: 'setdata', data: action.result.data });\n            return;\n        }\n        \n \n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
38                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
39                             },
40                             "method": "POST",
41                             "style": "margin:10px;",
42                             "xtype": "Form",
43                             "|url": "baseURL + '/Roo/expense.php'",
44                             "|xns": "Roo.form",
45                             "items": [
46                                 {
47                                     "width": 400,
48                                     "xtype": "Column",
49                                     "|xns": "Roo.form",
50                                     "items": [
51                                         {
52                                             "legend": "Summary",
53                                             "style": "width:380px",
54                                             "xtype": "FieldSet",
55                                             "|xns": "Roo.form",
56                                             "items": [
57                                                 {
58                                                     "fieldLabel": "Ref#",
59                                                     "name": "expense_number",
60                                                     "readOnly": true,
61                                                     "width": 200,
62                                                     "xtype": "TextField",
63                                                     "|xns": "Roo.form"
64                                                 },
65                                                 {
66                                                     "fieldLabel": "Due Date",
67                                                     "format": "Y-m-d",
68                                                     "name": "expense_trandate",
69                                                     "width": 100,
70                                                     "xtype": "DateField",
71                                                     "|xns": "Roo.form"
72                                                 },
73                                                 {
74                                                     "fieldLabel": "Summary",
75                                                     "name": "expense_memo",
76                                                     "width": 200,
77                                                     "xtype": "TextField",
78                                                     "|xns": "Roo.form"
79                                                 },
80                                                 {
81                                                     "fieldLabel": "Status",
82                                                     "name": "expense_status",
83                                                     "readOnly": true,
84                                                     "width": 200,
85                                                     "xtype": "TextField",
86                                                     "|xns": "Roo.form"
87                                                 }
88                                             ]
89                                         },
90                                         {
91                                             "labelAlign": "top",
92                                             "style": "clear:both;float:left;",
93                                             "xtype": "Row",
94                                             "|xns": "Roo.form",
95                                             "items": [
96                                                 {
97                                                     "fieldLabel": "Comments / For Review etc.",
98                                                     "name": "expense_comments",
99                                                     "width": 400,
100                                                     "xtype": "TextArea",
101                                                     "|xns": "Roo.form"
102                                                 }
103                                             ]
104                                         }
105                                     ]
106                                 },
107                                 {
108                                     "width": 400,
109                                     "xtype": "Column",
110                                     "|xns": "Roo.form",
111                                     "items": [
112                                         {
113                                             "labelWidth": 50,
114                                             "legend": "Employee",
115                                             "style": "width:250px;margin-left:10px",
116                                             "xtype": "FieldSet",
117                                             "|xns": "Roo.form",
118                                             "items": [
119                                                 {
120                                                     "fieldLabel": "Name",
121                                                     "name": "expense_emp_id_emp_name",
122                                                     "readOnly": true,
123                                                     "xtype": "TextField",
124                                                     "|xns": "Roo.form"
125                                                 }
126                                             ]
127                                         },
128                                         {
129                                             "legend": "Financial Details",
130                                             "style": "width:250px;margin-left:10px",
131                                             "xtype": "FieldSet",
132                                             "|xns": "Roo.form",
133                                             "items": [
134                                                 {
135                                                     "fieldLabel": "Advance Paid",
136                                                     "name": "expense_advance",
137                                                     "width": 75,
138                                                     "xtype": "TextField",
139                                                     "|xns": "Roo.form"
140                                                 },
141                                                 {
142                                                     "fieldLabel": "Amount",
143                                                     "name": "expense_amount_ro",
144                                                     "readOnly": true,
145                                                     "width": 75,
146                                                     "xtype": "TextField",
147                                                     "|xns": "Roo.form"
148                                                 },
149                                                 {
150                                                     "fieldLabel": "Tax",
151                                                     "name": "expense_tax_ro",
152                                                     "readOnly": true,
153                                                     "width": 75,
154                                                     "xtype": "TextField",
155                                                     "|xns": "Roo.form"
156                                                 },
157                                                 {
158                                                     "fieldLabel": "Total",
159                                                     "name": "expense_total_ro",
160                                                     "readOnly": true,
161                                                     "width": 75,
162                                                     "xtype": "TextField",
163                                                     "|xns": "Roo.form"
164                                                 },
165                                                 {
166                                                     "labelAlign": "top",
167                                                     "xtype": "Row",
168                                                     "|xns": "Roo.form",
169                                                     "items": [
170                                                         {
171                                                             "allowBlank": true,
172                                                             "displayField": "accnt_descrip",
173                                                             "editable": false,
174                                                             "emptyText": "Select accnt",
175                                                             "fieldLabel": "Paid from Bank Account (accounting only)",
176                                                             "forceSelection": true,
177                                                             "hiddenName": "expense_accnt_id",
178                                                             "listWidth": 400,
179                                                             "loadingText": "Searching...",
180                                                             "minChars": 2,
181                                                             "name": "expense_accnt_id_accnt_descrip",
182                                                             "pageSize": 20,
183                                                             "qtip": "Select accnt",
184                                                             "queryParam": "",
185                                                             "selectOnFocus": true,
186                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{accnt_descrip}</b> </div>",
187                                                             "triggerAction": "all",
188                                                             "valueField": "accnt_id",
189                                                             "width": 250,
190                                                             "xtype": "ComboBox",
191                                                             "|xns": "Roo.form",
192                                                             "items": [
193                                                                 {
194                                                                     "listeners": {
195                                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    o.params.accnt_subaccnttype_code =  'CA';\n}\n"
196                                                                     },
197                                                                     "*prop": "store",
198                                                                     "remoteSort": true,
199                                                                     "xtype": "Store",
200                                                                     "|sortInfo": "{ direction : 'ASC', field: 'accnt_descrip' }",
201                                                                     "|xns": "Roo.data",
202                                                                     "items": [
203                                                                         {
204                                                                             "*prop": "proxy",
205                                                                             "xtype": "HttpProxy",
206                                                                             "method": "GET",
207                                                                             "|xns": "Roo.data",
208                                                                             "|url": "baseURL + '/Roo/accnt.php'"
209                                                                         },
210                                                                         {
211                                                                             "*prop": "reader",
212                                                                             "xtype": "JsonReader",
213                                                                             "|xns": "Roo.data",
214                                                                             "id": "id",
215                                                                             "root": "data",
216                                                                             "totalProperty": "total",
217                                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"accnt_number\",\"type\":\"string\"}]"
218                                                                         }
219                                                                     ]
220                                                                 }
221                                                             ]
222                                                         }
223                                                     ]
224                                                 }
225                                             ]
226                                         }
227                                     ]
228                                 },
229                                 {
230                                     "name": "base_curr_id",
231                                     "xtype": "Hidden",
232                                     "|xns": "Roo.form"
233                                 },
234                                 {
235                                     "name": "base_curr_name",
236                                     "xtype": "Hidden",
237                                     "|xns": "Roo.form"
238                                 },
239                                 {
240                                     "name": "def_expcat_id",
241                                     "xtype": "Hidden",
242                                     "|xns": "Roo.form"
243                                 },
244                                 {
245                                     "name": "def_expcat_descrip",
246                                     "xtype": "Hidden",
247                                     "|xns": "Roo.form"
248                                 },
249                                 {
250                                     "name": "expense_emp_id",
251                                     "xtype": "Hidden",
252                                     "|xns": "Roo.form"
253                                 },
254                                 {
255                                     "name": "expense_id",
256                                     "xtype": "Hidden",
257                                     "|xns": "Roo.form"
258                                 },
259                                 {
260                                     "name": "_post",
261                                     "xtype": "Hidden",
262                                     "|xns": "Roo.form"
263                                 }
264                             ]
265                         }
266                     ]
267                 },
268                 {
269                     "listeners": {
270                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n      //  _this.grid.footer.onClick('first');\n    }\n}"
271                     },
272                     "background": false,
273                     "fitContainer": true,
274                     "fitToframe": true,
275                     "region": "center",
276                     "tableName": "expitem",
277                     "title": "expitem",
278                     "xtype": "GridPanel",
279                     "|xns": "Roo",
280                     "items": [
281                         {
282                             "listeners": {
283                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       //this.gi.onClick('first');\n    }\n}",
284                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
285                                 "afteredit": "function (e)\n{\n    \n    if (e.field == 'expitem_date') {\n        e.record.set('expitem_date', Date.parseDate(e.value, 'Y-m-d'));\n    \n    } \n    \n    e.record.commit();\n}"
286                             },
287                             "*prop": "grid",
288                             "autoExpandColumn": "expitem_memo",
289                             "clicksToEdit": 1,
290                             "loadMask": true,
291                             "xtype": "EditorGrid",
292                             "|xns": "Roo.grid",
293                             "items": [
294                                 {
295                                     "listeners": {
296                                         "beforeload": "function (_self, options)\n{\n    \n    options.params = options.param || {};\n    options.params.limit = 999;\n    _this.grid.view.el.unmask();\n    options.params.expitem_expense_id = _this.form.findField('expense_id').getValue() *1 ;\n   if (!    options.params.expitem_expense_id) {\n         Roo.log(\"no expense id yet\");\n        this.removeAll();\n        _this.grid.view.el.mask(\"Save First\");\n        return false;\n    }\n    \n}",
297                                         "update": "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    var send = Roo.apply({}, record.data);\n    // fix date...\n    send.expitem_date = typeof(send.expitem_date) == 'object' ? send.expitem_date.format('Y-m-d') : send.expitem_date;\n    \n    \n    function updateTotals(){\n        var t = { expense_total_ro : 0 , expense_amount_ro : 0, expense_tax_ro : 0 }\n        _this.grid.ds.each(function(r) {\n            var fc_total = (r.data.expitem_tax * 1) + (r.data.expitem_amount_fc * 1);\n            if (!fc_total) {\n                return;\n            }\n            var base_total = r.data.expitem_total * 1;\n            var rate = base_total / fc_total;\n            t.expense_total_ro += base_total;\n            t.expense_amount_ro += (r.data.expitem_amount_fc * rate);\n            t.expense_tax_ro += (r.data.expitem_tax  * rate);\n        \n        });\n        t.expense_total_ro =         t.expense_total_ro.toFixed(2);\n        t.expense_amount_ro =        t.expense_amount_ro.toFixed(2);\n        t.expense_tax_ro = t.expense_tax_ro.toFixed(2);\n    \n        \n        _this.form.setValues(t);\n    }\n    \n    \n    new Pman.Request( {\n        method : 'POST' ,\n        url : baseURL + '/Roo/expitem',\n        params :send,\n        success : function(res) {\n           if (!record.data.expitem_id) {\n                record.set('expitem_id', res.data.expitem_id);\n           }\n           record.set('expitem_total', res.data.expitem_total);\n           updateTotals();\n        }\n    });\n    \n    \n    \n}"
298                                     },
299                                     "*prop": "dataSource",
300                                     "remoteSort": true,
301                                     "xtype": "Store",
302                                     "|sortInfo": "{ field : 'expitem_row', direction: 'ASC' }",
303                                     "|xns": "Roo.data",
304                                     "items": [
305                                         {
306                                             "*prop": "proxy",
307                                             "xtype": "HttpProxy",
308                                             "method": "GET",
309                                             "|url": "baseURL + '/Roo/expitem.php'",
310                                             "|xns": "Roo.data"
311                                         },
312                                         {
313                                             "|xns": "Roo.data",
314                                             "xtype": "JsonReader",
315                                             "totalProperty": "total",
316                                             "root": "data",
317                                             "*prop": "reader",
318                                             "id": "id",
319                                             "|fields": "[\n    {\n        'name': 'expitem_id',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_expense_id',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_expcat_id',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_row',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_amount',\n        'type': 'float'\n    },\n    {\n        'name': 'expitem_amount_fc',\n        'type': 'float'\n    },\n    {\n        'name': 'expitem_tax',\n        'type': 'float'\n    },\n    {\n        'name': 'expitem_total',\n        'type': 'float'\n    },\n    {\n        'name': 'expitem_date',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'expitem_is_billable',\n        'type': 'int'\n    },\n    {\n        'name': 'expitem_memo',\n        'type': 'string'\n    }\n]"
320                                         }
321                                     ]
322                                 },
323                                 {
324                                     "*prop": "toolbar",
325                                     "xtype": "Toolbar",
326                                     "|xns": "Roo",
327                                     "items": [
328                                         {
329                                             "listeners": {
330                                                 "|click": "function()\n{\n   \n   \n \n   var grid = _this.grid;\n   var r = grid.getDataSource().reader.newRow({\n        expitem_id : 0,\n        expitem_expense_id : _this.form.findField('expense_id').getValue(),\n        expitem_row : grid.ds.getCount() + 1,\n        expitem_date : new Date(),\n        expitem_curr_id :           _this.form.findField('base_curr_id').getValue(),\n        expitem_curr_id_curr_name : _this.form.findField('base_curr_name').getValue(),\n        expitem_expcat_id :         _this.form.findField('def_expcat_id').getValue(),\n        expitem_expcat_id_expcat_descrip  : _this.form.findField('def_expcat_descrip').getValue(),\n        expitem_amount_tax : 0.0\n   \n   });\n       \n    grid.stopEditing();\n    var lr =   grid.ds.getCount()\n    grid.getDataSource().insert(lr, r); \n    grid.startEditing(lr, 1); \n}"
331                                             },
332                                             "cls": "x-btn-text-icon",
333                                             "text": "Add",
334                                             "xtype": "Button",
335                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
336                                             "|xns": "Roo.Toolbar"
337                                         },
338                                         {
339                                             "|xns": "Roo.Toolbar",
340                                             "xtype": "Fill"
341                                         },
342                                         {
343                                             "listeners": {
344                                                 "|click": "function()\n{\n    var ce =  _this.grid.selModel.getSelectedCell();\n    if (!ce) {\n        Roo.MessageBox.alert(\"Error\", \"Select a line to delete\");\n        return;\n    }\n    var rec = _this.grid.ds.getAt(ce[0]);\n    if (!rec.data.expitem_id) {\n        _this.grid.ds.remove(rec);\n        return;\n    }\n    \n    \n    new Pman.Request({\n        mask : 'Deleting',\n        url : baseURL + '/Roo/expitem',\n        method : 'POST',\n        params : {\n            _delete : rec.data.expitem_id\n        },\n        success : function()\n        {\n            _this.grid.ds.remove(rec);            \n        }\n    });\n   \n   \n}\n        "
345                                             },
346                                             "cls": "x-btn-text-icon",
347                                             "text": "Delete",
348                                             "xtype": "Button",
349                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
350                                             "|xns": "Roo.Toolbar"
351                                         }
352                                     ]
353                                 },
354                                 {
355                                     "*prop": "colModel[]",
356                                     "dataIndex": "expitem_row",
357                                     "header": "Line#",
358                                     "width": 50,
359                                     "xtype": "ColumnModel",
360                                     "|renderer": "function(v) { return String.format('{0}', v); }",
361                                     "|xns": "Roo.grid"
362                                 },
363                                 {
364                                     "*prop": "colModel[]",
365                                     "dataIndex": "expitem_date",
366                                     "header": "Date",
367                                     "width": 75,
368                                     "xtype": "ColumnModel",
369                                     "|renderer": "function(v) {\n    if (!v) {\n        return '<span style=\"color:red\">' + \"NO DATE\" + '</span>';\n    }\n\n     return String.format('{0}', typeof(v) == 'object' ? v.format('d/M/Y') : v); \n }",
370                                     "|xns": "Roo.grid",
371                                     "items": [
372                                         {
373                                             "|xns": "Roo.grid",
374                                             "xtype": "GridEditor",
375                                             "*prop": "editor",
376                                             "items": [
377                                                 {
378                                                     "*prop": "field",
379                                                     "format": "d/M/Y",
380                                                     "useIso": true,
381                                                     "xtype": "DateField",
382                                                     "|xns": "Roo.form"
383                                                 }
384                                             ]
385                                         }
386                                     ]
387                                 },
388                                 {
389                                     "*prop": "colModel[]",
390                                     "dataIndex": "expitem_expcat_id",
391                                     "header": "Category",
392                                     "width": 140,
393                                     "xtype": "ColumnModel",
394                                     "|renderer": "function(v,x,r) { return String.format('{0}', r.data.expitem_expcat_id_expcat_descrip); }",
395                                     "|xns": "Roo.grid",
396                                     "items": [
397                                         {
398                                             "|xns": "Roo.grid",
399                                             "xtype": "GridEditor",
400                                             "*prop": "editor",
401                                             "items": [
402                                                 {
403                                                     "*prop": "field",
404                                                     "allowBlank": false,
405                                                     "displayField": "expcat_descrip",
406                                                     "editable": false,
407                                                     "emptyText": "Select expcat",
408                                                     "fieldLabel": "expcat",
409                                                     "forceSelection": true,
410                                                     "hiddenName": "expitem_expcat_id",
411                                                     "listWidth": 400,
412                                                     "loadingText": "Searching...",
413                                                     "minChars": 2,
414                                                     "name": "expitem_expcat_id_expcat_descrip",
415                                                     "pageSize": 20,
416                                                     "qtip": "Select expcat",
417                                                     "queryParam": "",
418                                                     "selectOnFocus": true,
419                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{expcat_descrip}</b> </div>",
420                                                     "triggerAction": "all",
421                                                     "typeAhead": true,
422                                                     "valueField": "expcat_id",
423                                                     "width": 300,
424                                                     "xtype": "ComboBox",
425                                                     "|xns": "Roo.form",
426                                                     "items": [
427                                                         {
428                                                             "listeners": {
429                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
430                                                             },
431                                                             "*prop": "store",
432                                                             "remoteSort": true,
433                                                             "xtype": "Store",
434                                                             "|sortInfo": "{ direction : 'ASC', field: 'expcat_descrip' }",
435                                                             "|xns": "Roo.data",
436                                                             "items": [
437                                                                 {
438                                                                     "*prop": "proxy",
439                                                                     "xtype": "HttpProxy",
440                                                                     "method": "GET",
441                                                                     "|xns": "Roo.data",
442                                                                     "|url": "baseURL + '/Roo/expcat.php'"
443                                                                 },
444                                                                 {
445                                                                     "*prop": "reader",
446                                                                     "xtype": "JsonReader",
447                                                                     "|xns": "Roo.data",
448                                                                     "id": "id",
449                                                                     "root": "data",
450                                                                     "totalProperty": "total",
451                                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"expcat_code\",\"type\":\"string\"}]"
452                                                                 }
453                                                             ]
454                                                         }
455                                                     ]
456                                                 }
457                                             ]
458                                         }
459                                     ]
460                                 },
461                                 {
462                                     "*prop": "colModel[]",
463                                     "dataIndex": "expitem_memo",
464                                     "header": "Description",
465                                     "width": 200,
466                                     "xtype": "ColumnModel",
467                                     "|renderer": "function(v) { return String.format('{0}', v); }",
468                                     "|xns": "Roo.grid",
469                                     "items": [
470                                         {
471                                             "|xns": "Roo.grid",
472                                             "xtype": "GridEditor",
473                                             "*prop": "editor",
474                                             "items": [
475                                                 {
476                                                     "|xns": "Roo.form",
477                                                     "xtype": "TextField",
478                                                     "*prop": "field"
479                                                 }
480                                             ]
481                                         }
482                                     ]
483                                 },
484                                 {
485                                     "*prop": "colModel[]",
486                                     "dataIndex": "expitem_curr_id",
487                                     "header": "Currency",
488                                     "width": 75,
489                                     "xtype": "ColumnModel",
490                                     "|renderer": "function(v,x,r) { return String.format('{0}', r.data.expitem_curr_id_curr_name); }",
491                                     "|xns": "Roo.grid",
492                                     "items": [
493                                         {
494                                             "|xns": "Roo.grid",
495                                             "xtype": "GridEditor",
496                                             "*prop": "editor",
497                                             "items": [
498                                                 {
499                                                     "*prop": "field",
500                                                     "allowBlank": false,
501                                                     "displayField": "curr_name",
502                                                     "editable": false,
503                                                     "emptyText": "Select curr_symbol",
504                                                     "fieldLabel": "curr_symbol",
505                                                     "forceSelection": true,
506                                                     "hiddenName": "expitem_curr_id",
507                                                     "listWidth": 400,
508                                                     "loadingText": "Searching...",
509                                                     "minChars": 2,
510                                                     "name": "expitem_curr_id_curr_name",
511                                                     "pageSize": 20,
512                                                     "qtip": "Select curr_symbol",
513                                                     "queryParam": "",
514                                                     "selectOnFocus": true,
515                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
516                                                     "triggerAction": "all",
517                                                     "typeAhead": true,
518                                                     "valueField": "curr_id",
519                                                     "width": 300,
520                                                     "xtype": "ComboBox",
521                                                     "|xns": "Roo.form",
522                                                     "items": [
523                                                         {
524                                                             "*prop": "store",
525                                                             "xtype": "Store",
526                                                             "|xns": "Roo.data",
527                                                             "remoteSort": true,
528                                                             "|sortInfo": "{ direction : 'ASC', field: 'id' }",
529                                                             "listeners": {
530                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
531                                                             },
532                                                             "items": [
533                                                                 {
534                                                                     "*prop": "proxy",
535                                                                     "xtype": "HttpProxy",
536                                                                     "method": "GET",
537                                                                     "|xns": "Roo.data",
538                                                                     "|url": "baseURL + '/Roo/curr_symbol.php'"
539                                                                 },
540                                                                 {
541                                                                     "*prop": "reader",
542                                                                     "xtype": "JsonReader",
543                                                                     "|xns": "Roo.data",
544                                                                     "id": "id",
545                                                                     "root": "data",
546                                                                     "totalProperty": "total",
547                                                                     "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"curr_name\",\"type\":\"string\"}]"
548                                                                 }
549                                                             ]
550                                                         }
551                                                     ]
552                                                 }
553                                             ]
554                                         }
555                                     ]
556                                 },
557                                 {
558                                     "*prop": "colModel[]",
559                                     "align": "right",
560                                     "dataIndex": "expitem_amount_fc",
561                                     "header": "Amount",
562                                     "width": 75,
563                                     "xtype": "ColumnModel",
564                                     "|renderer": "function(v) { return String.format('{0}', (1*v).toFixed(2)); }",
565                                     "|xns": "Roo.grid",
566                                     "items": [
567                                         {
568                                             "|xns": "Roo.grid",
569                                             "xtype": "GridEditor",
570                                             "*prop": "editor",
571                                             "items": [
572                                                 {
573                                                     "|xns": "Roo.form",
574                                                     "xtype": "NumberField",
575                                                     "*prop": "field"
576                                                 }
577                                             ]
578                                         }
579                                     ]
580                                 },
581                                 {
582                                     "*prop": "colModel[]",
583                                     "align": "right",
584                                     "dataIndex": "expitem_tax",
585                                     "header": "Tax",
586                                     "width": 75,
587                                     "xtype": "ColumnModel",
588                                     "|renderer": "function(v) { return String.format('{0}', (1*v).toFixed(2)); }",
589                                     "|xns": "Roo.grid",
590                                     "items": [
591                                         {
592                                             "|xns": "Roo.grid",
593                                             "xtype": "GridEditor",
594                                             "*prop": "editor",
595                                             "items": [
596                                                 {
597                                                     "|xns": "Roo.form",
598                                                     "xtype": "NumberField",
599                                                     "*prop": "field"
600                                                 }
601                                             ]
602                                         }
603                                     ]
604                                 },
605                                 {
606                                     "*prop": "colModel[]",
607                                     "align": "right",
608                                     "dataIndex": "expitem_total",
609                                     "header": "Base Total",
610                                     "width": 75,
611                                     "xtype": "ColumnModel",
612                                     "|renderer": "function(v) { return String.format('{0}', (1*v).toFixed(2)); }",
613                                     "|xns": "Roo.grid"
614                                 }
615                             ]
616                         }
617                     ]
618                 },
619                 {
620                     "listeners": {
621                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
622                     },
623                     "*prop": "buttons[]",
624                     "text": "Cancel",
625                     "xtype": "Button",
626                     "|xns": "Roo"
627                 },
628                 {
629                     "listeners": {
630                         "click": "function (_self, e)\n{\n    if (!_this.form.findField('expense_id').getValue()) {\n        Roo.MessageBox.alert(\"Error\",\"You must save your expense report before printing/downloading\");\n        return;        \n    }\n    new Pman.Download({\n        url : baseURL + '/Roo/expense',\n        method : 'GET',\n        params : {\n            expense_id : _this.form.findField('expense_id').getValue(),\n            _asExcel : 1\n        }\n    });\n    Roo.MessageBox.alert(\"Notice\",\"Your report should be downloading now\");\n    \n}"
631                     },
632                     "*prop": "buttons[]",
633                     "text": "Download/Print",
634                     "xtype": "Button",
635                     "|xns": "Roo"
636                 },
637                 {
638                     "listeners": {
639                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n    _this.form.findField('expense_status').setValue('Pending Management Approval');\n    _this.form.doAction(\"submit\");\n\n}",
640                         "render": "function (_self)\n{\n    _this.postToManagement = _self;\n}"
641                     },
642                     "*prop": "buttons[]",
643                     "text": "Post to Management",
644                     "xtype": "Button",
645                     "|xns": "Roo"
646                 },
647                 {
648                     "listeners": {
649                         "click": "function (_self, e)\n{\n    // do some checks?\n      _this.form.findField('expense_status').setValue('Pending Accounting Approval');\n \n    _this.form.doAction(\"submit\");\n\n}",
650                         "render": "function (_self)\n{\n    _this.postToAccounts = _self;\n}"
651                     },
652                     "*prop": "buttons[]",
653                     "text": "Post to Accounts",
654                     "xtype": "Button",
655                     "|xns": "Roo"
656                 },
657                 {
658                     "listeners": {
659                         "click": "function (_self, e)\n{\n \n    \n    \n    \n    Roo.MessageBox.confirm(\"Confirm\", \"Post to General Ledger - this is very difficult to reverse so make sure it is correct\",\n        function(b) {\n            if (b!='yes') { \n                return;\n            }\n            _this.form.findField('_post').setValue(1);\n            _this.form.submit();\n        \n        }\n    );\n    \n    // do some checks?\n\n \n   // _this.form.doAction(\"submit\");\n\n}",
660                         "render": "function (_self)\n{\n    _this.postToGL = _self;\n}"
661                     },
662                     "*prop": "buttons[]",
663                     "text": "Post to General Ledger",
664                     "xtype": "Button",
665                     "|xns": "Roo"
666                 },
667                 {
668                     "listeners": {
669                         "click": "function (_self, e)\n{\n    // do some checks?\n\n    if (!    _this.form.findField('expense_comments').getValue().length ) {\n        Roo.MessageBox.alert(\"Error\", \"Fill in a comment why it is getting rejected\");\n        return;\n    }\n     \n    _this.form.findField('expense_status').setValue('Draft');\n    _this.form.doAction(\"submit\");\n\n}",
670                         "render": "function (_self)\n{\n    _this.postToStaff = _self;\n    \n}"
671                     },
672                     "*prop": "buttons[]",
673                     "text": "Reject / Require Clarification",
674                     "xtype": "Button",
675                     "|xns": "Roo"
676                 },
677                 {
678                     "listeners": {
679                         "click": "function (_self, e)\n{\n    // do some checks?\n     \n \n    _this.form.doAction(\"submit\");\n\n}",
680                         "render": "function (_self)\n{\n    _this.saveBtn = _self;\n}"
681                     },
682                     "*prop": "buttons[]",
683                     "text": "Save",
684                     "xtype": "Button",
685                     "|xns": "Roo"
686                 }
687             ]
688         }
689     ],
690     "permname": "",
691     "modOrder": "001"
692 }