Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleCreditMemos.bjs
1 {
2     "id": "roo-file-48",
3     "name": "Pman.Tab.XtupleCreditMemos",
4     "parent": "Pman.Tab.XtupleSales",
5     "title": "Pman.Tab.XtupleCreditMemos",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCreditMemos.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToframe": true,
15             "region": "center",
16             "tableName": "cmhead",
17             "title": "Credit Memos",
18             "xtype": "GridPanel",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "listeners": {
23                         "|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}",
24                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    var s = this.dataSource.getAt(rowIndex);\n    Pman.Dialog.XtupleCreditMemo.show({\n        cmhead_id : s.data.cmhead_id\n    },function() {\n        _this.grid.footer.onClick('first');\n    \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"
25                     },
26                     "*prop": "grid",
27                     "autoExpandColumn": "cmhead_cust_id_cust_name",
28                     "loadMask": true,
29                     "xtype": "Grid",
30                     "|xns": "Roo.grid",
31                     "items": [
32                         {
33                             "listeners": {
34                                 "beforeload": "function (_self, o)\n{\n    if ( _this.customer &&  _this.customer.getValue() ) {\n       o.params.cmhead_cust_id = _this.customer.getValue();\n    }\n    if (_this.cmnumber && _this.cmnumber.getValue() ) {\n       o.params.cmhead_id =  _this.cmnumber.getValue();\n    }\n    if (_this.status) { \n        o.params['query[status]'] = _this.status.getValue();\n    }\n    \n    o.params._with_aropen = 1;\n}"
35                             },
36                             "*prop": "dataSource",
37                             "remoteSort": true,
38                             "xtype": "Store",
39                             "|sortInfo": "{ field : 'cmhead_id', direction: 'DESC' }",
40                             "|xns": "Roo.data",
41                             "items": [
42                                 {
43                                     "*prop": "proxy",
44                                     "xtype": "HttpProxy",
45                                     "method": "GET",
46                                     "|url": "baseURL + '/Roo/cmhead.php'",
47                                     "|xns": "Roo.data"
48                                 },
49                                 {
50                                     "|xns": "Roo.data",
51                                     "xtype": "JsonReader",
52                                     "totalProperty": "total",
53                                     "root": "data",
54                                     "*prop": "reader",
55                                     "id": "id",
56                                     "|fields": "[\n    {\n        'name': 'cmhead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_number',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_posted',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_invcnumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_custponumber',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_cust_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_docdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cmhead_shipto_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_shipto_name',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_address1',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_address2',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_address3',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_city',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_state',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_zipcode',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_salesrep_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_freight',\n        'type': 'float'\n    },\n    {\n        'name': 'cmhead_misc',\n        'type': 'float'\n    },\n    {\n        'name': 'cmhead_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_printed',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_billtoname',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtoaddress1',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtoaddress2',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtoaddress3',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtocity',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtostate',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_billtozip',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_hold',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_commission',\n        'type': 'float'\n    },\n    {\n        'name': 'cmhead_misc_accnt_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_misc_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_rsncode_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_freighttaxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_gldistdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'cmhead_billtocountry',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_shipto_country',\n        'type': 'string'\n    },\n    {\n        'name': 'cmhead_rahead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_taxzone_id',\n        'type': 'int'\n    },\n    {\n        'name': 'cmhead_prj_id',\n        'type': 'int'\n    }\n]"
57                                 }
58                             ]
59                         },
60                         {
61                             "*prop": "footer",
62                             "xtype": "PagingToolbar",
63                             "pageSize": 25,
64                             "displayInfo": true,
65                             "displayMsg": "Displaying cmhead{0} - {1} of {2}",
66                             "emptyMsg": "No cmhead found",
67                             "|xns": "Roo",
68                             "items": [
69                                 {
70                                     "listeners": {
71                                         "click": "function (_self, e)\n{\n new Pman.Download({\n        grid : _this.grid\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report is downloading\");\n}"
72                                     },
73                                     "text": "Download",
74                                     "xtype": "Button",
75                                     "|xns": "Roo.Toolbar"
76                                 }
77                             ]
78                         },
79                         {
80                             "*prop": "toolbar",
81                             "xtype": "Toolbar",
82                             "|xns": "Roo",
83                             "items": [
84                                 {
85                                     "listeners": {
86                                         "render": "function (_self)\n{\n    _this.cmnumber = _self;\n}",
87                                         "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
88                                     },
89                                     "allowBlank": true,
90                                     "displayField": "cmhead_number",
91                                     "editable": true,
92                                     "emptyText": "Order",
93                                     "fieldLabel": "ordernumber",
94                                     "forceSelection": true,
95                                     "hiddenName": "cmhead_id",
96                                     "listWidth": 400,
97                                     "loadingText": "Searching...",
98                                     "minChars": 2,
99                                     "name": "cmhead_number",
100                                     "pageSize": 20,
101                                     "qtip": "Select invchead",
102                                     "queryParam": "query[cmhead_number]",
103                                     "selectOnFocus": true,
104                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
105                                     "triggerAction": "all",
106                                     "typeAhead": false,
107                                     "valueField": "cmhead_id",
108                                     "width": 150,
109                                     "xtype": "ComboBox",
110                                     "|xns": "Roo.form",
111                                     "items": [
112                                         {
113                                             "listeners": {
114                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
115                                             },
116                                             "*prop": "store",
117                                             "remoteSort": true,
118                                             "xtype": "Store",
119                                             "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
120                                             "|xns": "Roo.data",
121                                             "items": [
122                                                 {
123                                                     "*prop": "proxy",
124                                                     "method": "GET",
125                                                     "xtype": "HttpProxy",
126                                                     "|url": "baseURL + '/Roo/cmhead.php'",
127                                                     "|xns": "Roo.data"
128                                                 },
129                                                 {
130                                                     "*prop": "reader",
131                                                     "id": "cmhead_id",
132                                                     "root": "data",
133                                                     "totalProperty": "total",
134                                                     "xtype": "JsonReader",
135                                                     "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
136                                                     "|xns": "Roo.data"
137                                                 }
138                                             ]
139                                         }
140                                     ]
141                                 },
142                                 {
143                                     "listeners": {
144                                         "render": "function (_self)\n{\n    _this.customer = _self;\n}",
145                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
146                                     },
147                                     "allowBlank": true,
148                                     "displayField": "cust_name",
149                                     "editable": true,
150                                     "emptyText": "Select Customer",
151                                     "fieldLabel": "cust_name",
152                                     "forceSelection": true,
153                                     "hiddenName": "cust_id",
154                                     "listWidth": 400,
155                                     "loadingText": "Searching...",
156                                     "minChars": 2,
157                                     "name": "cust_name",
158                                     "pageSize": 20,
159                                     "qtip": "Select custinfo",
160                                     "queryParam": "query[cust_name]",
161                                     "selectOnFocus": true,
162                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
163                                     "triggerAction": "all",
164                                     "typeAhead": false,
165                                     "valueField": "cust_id",
166                                     "width": 200,
167                                     "xtype": "ComboBox",
168                                     "|xns": "Roo.form",
169                                     "items": [
170                                         {
171                                             "*prop": "store",
172                                             "|xns": "Roo.data",
173                                             "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
174                                             "xtype": "Store",
175                                             "remoteSort": true,
176                                             "listeners": {
177                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
178                                             },
179                                             "items": [
180                                                 {
181                                                     "*prop": "proxy",
182                                                     "xtype": "HttpProxy",
183                                                     "method": "GET",
184                                                     "|xns": "Roo.data",
185                                                     "|url": "baseURL + '/Roo/custinfo.php'"
186                                                 },
187                                                 {
188                                                     "*prop": "reader",
189                                                     "xtype": "JsonReader",
190                                                     "|xns": "Roo.data",
191                                                     "id": "cust_id",
192                                                     "root": "data",
193                                                     "totalProperty": "total",
194                                                     "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
195                                                 }
196                                             ]
197                                         }
198                                     ]
199                                 },
200                                 {
201                                     "listeners": {
202                                         "render": "function (_self)\n{\n  _this.status = _self;\n}",
203                                         "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
204                                     },
205                                     "allowBlank": false,
206                                     "displayField": "fname",
207                                     "editable": false,
208                                     "fieldLabel": "Status",
209                                     "hiddenName": "cm_status",
210                                     "listWidth": 200,
211                                     "mode": "local",
212                                     "name": "cm_status_name",
213                                     "triggerAction": "all",
214                                     "value": "NOTCLOSED",
215                                     "valueField": "ftype",
216                                     "width": 150,
217                                     "xtype": "ComboBox",
218                                     "|xns": "Roo.form",
219                                     "items": [
220                                         {
221                                             "*prop": "store",
222                                             "xtype": "SimpleStore",
223                                             "|data": "[ \n    [ 'NOTCLOSED', \"Not Closed\"],\n    [ 'CLOSED' , \"Closed\"],\n    [ 'UNPOSTED', \"Unposted only\"] ,\n    [ 'UNUSED', \"Posted and not used\"] ,\n    [ 'VOIDED', \"Voided\"],\n    [ 'NOTVOIDED', \"Not Voided\"],\n    [ 'ALL', \"Show All\"],\n]\n",
224                                             "|fields": "[  'ftype', 'fname']",
225                                             "|xns": "Roo.data"
226                                         }
227                                     ]
228                                 },
229                                 {
230                                     "|xns": "Roo.Toolbar",
231                                     "xtype": "Fill"
232                                 },
233                                 {
234                                     "cls": "x-btn-text-icon",
235                                     "text": "Add",
236                                     "xtype": "Button",
237                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
238                                     "|xns": "Roo.Toolbar",
239                                     "items": [
240                                         {
241                                             "|xns": "Roo.menu",
242                                             "xtype": "Menu",
243                                             "*prop": "menu",
244                                             "items": [
245                                                 {
246                                                     "listeners": {
247                                                         "click": "function (_self, e)\n{\n   Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n        _this.grid.footer.onClick('first');\n   }); \n\n}"
248                                                     },
249                                                     "cls": "x-btn-text-icon",
250                                                     "text": "New Credit Memo",
251                                                     "xtype": "Item",
252                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
253                                                     "|xns": "Roo.menu"
254                                                 },
255                                                 {
256                                                     "|xns": "Roo.menu",
257                                                     "xtype": "Separator"
258                                                 },
259                                                 {
260                                                     "listeners": {
261                                                         "click": "function (_self, e)\n{\n   var s = _this.grid.getSelectionModel().getSelections();\n\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }    \n    if(s[0].data.checkhead_total == 0){\n        Roo.MessageBox.alert(\"Error\", \"you cannot create the miscellaneous check for the credit memo coz the total amount remaining is 0! \");\n        return;\n    }\n    if(!s[0].data.cmhead_posted){\n        Roo.MessageBox.alert(\"Error\", \"This credit memo  has not been posted!\");\n        return;\n    }\n    var data = {\n        'checkhead_recip_id' : s[0].data.cmhead_cust_id,\n        'checkhead_recip_type' : 'C',\n        'checkhead_checkdate' : new Date(),\n        'checkhead_amount' : s[0].data.checkhead_total,\n        'remaining_total' : s[0].data.checkhead_total,\n        'checkhead_curr_id' : s[0].data.cmhead_curr_id,\n        'checkhead_curr_id_curr_name' : s[0].data.cmhead_curr_id_curr_name,\n        'checkhead_misc' : true,\n        'aropen_id' : s[0].data.cmhead_aropen_id_aropen_id,\n    \t'cmhead_number' : s[0].data.cmhead_number,\n\t'cust_name' : s[0].data.cmhead_cust_id_cust_name,\n\t'_create_and_post' : 1\n\n    };\n    \n    \n    Pman.Dialog.XtupleMiscellaneousCheck.show( data , function() {\n        _this.grid.footer.onClick('first');\n   }); \n\n}"
262                                                     },
263                                                     "cls": "x-btn-text-icon",
264                                                     "text": "New Miscellaneous Check",
265                                                     "xtype": "Item",
266                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
267                                                     "|xns": "Roo.menu"
268                                                 }
269                                             ]
270                                         }
271                                     ]
272                                 },
273                                 {
274                                     "|xns": "Roo.Toolbar",
275                                     "xtype": "Separator"
276                                 },
277                                 {
278                                     "listeners": {
279                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n\n    var postit = function()\n    {\n        new Pman.Request(\n        {\n            url : baseURL + '/Roo/Cmhead',\n            mask: 'Voiding',\n            method : 'POST',\n            params : {\n                cmhead_id : s[0].data.cmhead_id,\n                _void : 1\n            },\n            success : function()\n            {\n                _this.grid.footer.onClick('refresh');\n            } \n        });\n    \n    };\n\n\n    Roo.MessageBox.confirm(\n        \"Confirm\",\n        \"Are you sure to void this credit memo?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            postit();\n        }\n    );\n    \n}\n"
280                                     },
281                                     "cls": "x-btn-text-icon",
282                                     "text": "Void Credit Memo",
283                                     "xtype": "Button",
284                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
285                                     "|xns": "Roo.Toolbar"
286                                 },
287                                 {
288                                     "|xns": "Roo.Toolbar",
289                                     "xtype": "Separator"
290                                 },
291                                 {
292                                     "listeners": {
293                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (s[0].data.cmhead_posted ) { \n        Roo.MessageBox.alert(\"Error\", \n            \"You can not delete posted credit memo's - you have to create an invoice to reverse them\");\n        return;\n    }\n    \n    \n\n    var postit = function()\n    {\n        new Pman.Request(\n        {\n            url : baseURL + '/Roo/Cmhead',\n            mask: 'Deleting',\n            method : 'POST',\n            params : {\n                _delete  : s[0].data.cmhead_id \n            },\n            success : function()\n            {\n                _this.grid.footer.onClick('refresh');\n            } \n        });\n    \n    };\n\n\n    Roo.MessageBox.confirm(\n        \"Confirm Deletion\",\n        \"You will have to make sure this credit memo has no line items associated before deleting it. \",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            postit();\n        }\n    );\n    \n}\n"
294                                     },
295                                     "cls": "x-btn-text-icon",
296                                     "text": "Delete Credit Memo",
297                                     "xtype": "Button",
298                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
299                                     "|xns": "Roo.Toolbar"
300                                 },
301                                 {
302                                     "|xns": "Roo.Toolbar",
303                                     "xtype": "Separator"
304                                 },
305                                 {
306                                     "listeners": {
307                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n\n    var postit = function()\n    {\n        new Pman.Request(\n        {\n            url : baseURL + '/Roo/Cmhead',\n            mask: 'Posting',\n            method : 'POST',\n            params : {\n                cmhead_id : s[0].data.cmhead_id,\n                _post : 1\n            },\n            success : function()\n            {\n                _this.grid.footer.onClick('refresh');\n            } \n        });\n    \n    };\n\n\n    Roo.MessageBox.confirm(\n        \"Confirm Posting\",\n        \"Are you sure that is complete, <B>Voiding a Credit memo invoices creating a sales order and invoice</B>, so make sure this is correct before posting\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            postit();\n        }\n    ); \n    \n}\n"
308                                     },
309                                     "cls": "x-btn-text-icon",
310                                     "text": "POST",
311                                     "xtype": "Button",
312                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
313                                     "|xns": "Roo.Toolbar"
314                                 },
315                                 {
316                                     "|xns": "Roo.Toolbar",
317                                     "xtype": "Separator"
318                                 },
319                                 {
320                                     "listeners": {
321                                         "click": "function ()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n      if (!s || !s.data.cmhead_id) {\n        Roo.MessageBox.alert(\"Error\", \"Select a credit memo\");\n        return\n      }\n      \n      var ext = baseURL.split('/').pop().replace(/\\.php/, '');\n      new Pman.Download({\n        url : baseURL + '/Xtuple/Print',\n        params :  {\n            template: 'creditmemo-' + ext,\n            filename : 'creditmemo-' + s.data.cmhead_id,\n            'param[0]':   \"cmhead_id:string='\" + s.data.cmhead_id + \"'\"\n           \n        },\n        method : 'GET'\n     });\n     Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n            \n            \n   \n}"
322                                     },
323                                     "cls": "x-btn-text-icon",
324                                     "text": "Print",
325                                     "xtype": "Button",
326                                     "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
327                                     "|xns": "Roo.Toolbar"
328                                 },
329                                 {
330                                     "|xns": "Roo.Toolbar",
331                                     "xtype": "Separator"
332                                 },
333                                 {
334                                     "cls": "x-btn-text-icon",
335                                     "text": "Tools",
336                                     "xtype": "Button",
337                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
338                                     "|xns": "Roo.Toolbar",
339                                     "items": [
340                                         {
341                                             "|xns": "Roo.menu",
342                                             "xtype": "Menu",
343                                             "*prop": "menu",
344                                             "items": [
345                                                 {
346                                                     "|xns": "Roo.menu",
347                                                     "xtype": "Separator"
348                                                 },
349                                                 {
350                                                     "listeners": {
351                                                         "click": "function (_self, e)\n{\n   Roo.MessageBox.confirm(\n        \"Confirm\",\n        \"It is going to fill in all the blank return stock. Are you sure?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request(\n            {\n                url : baseURL + '/Roo/Cmhead',\n                mask: 'Processing',\n                method : 'POST',\n                params : {\n                    _fix_stock : 1\n                },\n                success : function()\n                {\n                    Roo.MessageBox.alert('Notice','Fixed');\n                    _this.grid.footer.onClick('refresh');\n                } \n            });\n        }\n    ); \n}"
352                                                     },
353                                                     "cls": "x-btn-text-icon",
354                                                     "text": "Fix Blank Return Stock",
355                                                     "xtype": "Item",
356                                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
357                                                     "|xns": "Roo.menu"
358                                                 }
359                                             ]
360                                         }
361                                     ]
362                                 }
363                             ]
364                         },
365                         {
366                             "*prop": "colModel[]",
367                             "dataIndex": "cmhead_number",
368                             "header": "Ref #",
369                             "sortable": true,
370                             "width": 150,
371                             "xtype": "ColumnModel",
372                             "|renderer": "function(v) { return String.format('{0}', v); }",
373                             "|xns": "Roo.grid"
374                         },
375                         {
376                             "*prop": "colModel[]",
377                             "dataIndex": "cmhead_docdate",
378                             "header": "Date",
379                             "sortable": true,
380                             "width": 100,
381                             "xtype": "ColumnModel",
382                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
383                             "|xns": "Roo.grid"
384                         },
385                         {
386                             "*prop": "colModel[]",
387                             "dataIndex": "cmhead_salesrep_id_salesrep_name",
388                             "header": "Sales Rep",
389                             "sortable": true,
390                             "width": 80,
391                             "xtype": "ColumnModel",
392                             "|renderer": "function(v) { return String.format('{0}', v  ); }",
393                             "|xns": "Roo.grid"
394                         },
395                         {
396                             "*prop": "colModel[]",
397                             "dataIndex": "cust_salesrep_salesrep_name",
398                             "header": "Cust. Sales Rep",
399                             "sortable": true,
400                             "width": 80,
401                             "xtype": "ColumnModel",
402                             "|renderer": "function(v) { return String.format('{0}', v  ); }",
403                             "|xns": "Roo.grid"
404                         },
405                         {
406                             "*prop": "colModel[]",
407                             ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
408                             "dataIndex": "cmhead_cust_id_cust_name",
409                             "header": "Customer",
410                             "width": 200,
411                             "xtype": "ColumnModel",
412                             "|renderer": "function(v) { return String.format('{0}', v); }",
413                             "|xns": "Roo.grid"
414                         },
415                         {
416                             "*prop": "colModel[]",
417                             "align": "right",
418                             "dataIndex": "cmhead_curr_id_curr_symbol",
419                             "header": "Currency",
420                             "width": 70,
421                             "xtype": "ColumnModel",
422                             "|renderer": "function(v)\n{\n    return String.format('{0}', v ? v : '??');\n}",
423                             "|xns": "Roo.grid"
424                         },
425                         {
426                             "*prop": "colModel[]",
427                             "align": "right",
428                             "dataIndex": "cmhead_value",
429                             "header": "Value",
430                             "width": 100,
431                             "xtype": "ColumnModel",
432                             "|renderer": "function(v)\n{\n    return Roo.util.Format.usMoney(v);\n}",
433                             "|xns": "Roo.grid"
434                         },
435                         {
436                             "*prop": "colModel[]",
437                             "align": "right",
438                             "dataIndex": "cmhead_unpaid",
439                             "header": "Open Value",
440                             "width": 100,
441                             "xtype": "ColumnModel",
442                             "|renderer": "function(v,x,r)\n{\n    if (!r.data.cmhead_posted) {\n        return '';\n    }\n    return Roo.util.Format.usMoney(v);\n}",
443                             "|xns": "Roo.grid"
444                         },
445                         {
446                             "*prop": "colModel[]",
447                             "dataIndex": "cmhead_posted",
448                             "header": "Posted",
449                             "width": 75,
450                             "xtype": "ColumnModel",
451                             "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",
452                             "|xns": "Roo.grid"
453                         }
454                     ]
455                 }
456             ]
457         }
458     ],
459     "permname": "",
460     "modOrder": "200"
461 }