Pman.Tab.XtupleCreditMemos.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCreditMemos.bjs
1 {
2     "id": "roo-file-364",
3     "name": "Pman.Tab.XtupleCreditMemos",
4     "parent": "Pman.Tab.XtupleSales",
5     "title": "Pman.Tab.XtupleCreditMemos",
6     "path": "/home/alan/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                                     "|xns": "Roo.Toolbar",
71                                     "xtype": "Button"
72                                 }
73                             ]
74                         },
75                         {
76                             "*prop": "toolbar",
77                             "xtype": "Toolbar",
78                             "|xns": "Roo",
79                             "items": [
80                                 {
81                                     "listeners": {
82                                         "render": "function (_self)\n{\n    _this.cmnumber = _self;\n}",
83                                         "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
84                                     },
85                                     "allowBlank": true,
86                                     "displayField": "cmhead_number",
87                                     "editable": true,
88                                     "emptyText": "Order",
89                                     "fieldLabel": "ordernumber",
90                                     "forceSelection": true,
91                                     "hiddenName": "cmhead_id",
92                                     "listWidth": 400,
93                                     "loadingText": "Searching...",
94                                     "minChars": 2,
95                                     "name": "cmhead_number",
96                                     "pageSize": 20,
97                                     "qtip": "Select invchead",
98                                     "queryParam": "query[cmhead_number]",
99                                     "selectOnFocus": true,
100                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
101                                     "triggerAction": "all",
102                                     "typeAhead": false,
103                                     "valueField": "cmhead_id",
104                                     "width": 150,
105                                     "xtype": "ComboBox",
106                                     "|xns": "Roo.form",
107                                     "items": [
108                                         {
109                                             "listeners": {
110                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
111                                             },
112                                             "*prop": "store",
113                                             "remoteSort": true,
114                                             "xtype": "Store",
115                                             "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
116                                             "|xns": "Roo.data",
117                                             "items": [
118                                                 {
119                                                     "*prop": "proxy",
120                                                     "method": "GET",
121                                                     "xtype": "HttpProxy",
122                                                     "|url": "baseURL + '/Roo/cmhead.php'",
123                                                     "|xns": "Roo.data"
124                                                 },
125                                                 {
126                                                     "*prop": "reader",
127                                                     "id": "cmhead_id",
128                                                     "root": "data",
129                                                     "totalProperty": "total",
130                                                     "xtype": "JsonReader",
131                                                     "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
132                                                     "|xns": "Roo.data"
133                                                 }
134                                             ]
135                                         }
136                                     ]
137                                 },
138                                 {
139                                     "listeners": {
140                                         "render": "function (_self)\n{\n    _this.customer = _self;\n}",
141                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
142                                     },
143                                     "allowBlank": true,
144                                     "displayField": "cust_name",
145                                     "editable": true,
146                                     "emptyText": "Select Customer",
147                                     "fieldLabel": "cust_name",
148                                     "forceSelection": true,
149                                     "hiddenName": "cust_id",
150                                     "listWidth": 400,
151                                     "loadingText": "Searching...",
152                                     "minChars": 2,
153                                     "name": "cust_name",
154                                     "pageSize": 20,
155                                     "qtip": "Select custinfo",
156                                     "queryParam": "query[cust_name]",
157                                     "selectOnFocus": true,
158                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
159                                     "triggerAction": "all",
160                                     "typeAhead": false,
161                                     "valueField": "cust_id",
162                                     "width": 200,
163                                     "xtype": "ComboBox",
164                                     "|xns": "Roo.form",
165                                     "items": [
166                                         {
167                                             "*prop": "store",
168                                             "|xns": "Roo.data",
169                                             "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
170                                             "xtype": "Store",
171                                             "remoteSort": true,
172                                             "listeners": {
173                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
174                                             },
175                                             "items": [
176                                                 {
177                                                     "*prop": "proxy",
178                                                     "xtype": "HttpProxy",
179                                                     "method": "GET",
180                                                     "|xns": "Roo.data",
181                                                     "|url": "baseURL + '/Roo/custinfo.php'"
182                                                 },
183                                                 {
184                                                     "*prop": "reader",
185                                                     "xtype": "JsonReader",
186                                                     "|xns": "Roo.data",
187                                                     "id": "cust_id",
188                                                     "root": "data",
189                                                     "totalProperty": "total",
190                                                     "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
191                                                 }
192                                             ]
193                                         }
194                                     ]
195                                 },
196                                 {
197                                     "listeners": {
198                                         "render": "function (_self)\n{\n  _this.status = _self;\n}",
199                                         "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
200                                     },
201                                     "allowBlank": false,
202                                     "displayField": "fname",
203                                     "editable": false,
204                                     "fieldLabel": "Status",
205                                     "hiddenName": "cm_status",
206                                     "listWidth": 200,
207                                     "mode": "local",
208                                     "name": "cm_status_name",
209                                     "triggerAction": "all",
210                                     "value": "NOTCLOSED",
211                                     "valueField": "ftype",
212                                     "width": 150,
213                                     "xtype": "ComboBox",
214                                     "|xns": "Roo.form",
215                                     "items": [
216                                         {
217                                             "*prop": "store",
218                                             "xtype": "SimpleStore",
219                                             "|data": "[ \n    [ 'NOTCLOSED', \"Not Closed\"],\n    [ 'CLOSED' , \"Closed\"],\n    [ 'UNPOSTED', \"Unposted only\"] ,\n    [ 'UNUSED', \"Posted and not used\"] ,\n    [ 'VOIDED', \"Voided\"] \n]\n",
220                                             "|fields": "[  'ftype', 'fname']",
221                                             "|xns": "Roo.data"
222                                         }
223                                     ]
224                                 },
225                                 {
226                                     "|xns": "Roo.Toolbar",
227                                     "xtype": "Fill"
228                                 },
229                                 {
230                                     "cls": "x-btn-text-icon",
231                                     "text": "Add",
232                                     "xtype": "Button",
233                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
234                                     "|xns": "Roo.Toolbar",
235                                     "items": [
236                                         {
237                                             "|xns": "Roo.menu",
238                                             "xtype": "Menu",
239                                             "*prop": "menu",
240                                             "items": [
241                                                 {
242                                                     "listeners": {
243                                                         "click": "function (_self, e)\n{\n   Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n        _this.grid.footer.onClick('first');\n   }); \n\n}"
244                                                     },
245                                                     "cls": "x-btn-text-icon",
246                                                     "text": "New Credit Memo",
247                                                     "xtype": "Item",
248                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
249                                                     "|xns": "Roo.menu"
250                                                 },
251                                                 {
252                                                     "|xns": "Roo.menu",
253                                                     "xtype": "Separator"
254                                                 },
255                                                 {
256                                                     "listeners": {
257                                                         "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}"
258                                                     },
259                                                     "cls": "x-btn-text-icon",
260                                                     "text": "New Miscellaneous Check",
261                                                     "xtype": "Item",
262                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
263                                                     "|xns": "Roo.menu"
264                                                 }
265                                             ]
266                                         }
267                                     ]
268                                 },
269                                 {
270                                     "|xns": "Roo.Toolbar",
271                                     "xtype": "Separator"
272                                 },
273                                 {
274                                     "listeners": {
275                                         "|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"
276                                     },
277                                     "cls": "x-btn-text-icon",
278                                     "text": "Void Credit Memo",
279                                     "xtype": "Button",
280                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
281                                     "|xns": "Roo.Toolbar"
282                                 },
283                                 {
284                                     "|xns": "Roo.Toolbar",
285                                     "xtype": "Separator"
286                                 },
287                                 {
288                                     "listeners": {
289                                         "|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"
290                                     },
291                                     "cls": "x-btn-text-icon",
292                                     "text": "Delete Credit Memo",
293                                     "xtype": "Button",
294                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
295                                     "|xns": "Roo.Toolbar"
296                                 },
297                                 {
298                                     "|xns": "Roo.Toolbar",
299                                     "xtype": "Separator"
300                                 },
301                                 {
302                                     "listeners": {
303                                         "|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"
304                                     },
305                                     "cls": "x-btn-text-icon",
306                                     "text": "POST",
307                                     "xtype": "Button",
308                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
309                                     "|xns": "Roo.Toolbar"
310                                 },
311                                 {
312                                     "|xns": "Roo.Toolbar",
313                                     "xtype": "Separator"
314                                 },
315                                 {
316                                     "listeners": {
317                                         "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}"
318                                     },
319                                     "cls": "x-btn-text-icon",
320                                     "text": "Print",
321                                     "xtype": "Button",
322                                     "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
323                                     "|xns": "Roo.Toolbar"
324                                 },
325                                 {
326                                     "|xns": "Roo.Toolbar",
327                                     "xtype": "Separator"
328                                 },
329                                 {
330                                     "cls": "x-btn-text-icon",
331                                     "text": "Tools",
332                                     "xtype": "Button",
333                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
334                                     "|xns": "Roo.Toolbar",
335                                     "items": [
336                                         {
337                                             "|xns": "Roo.menu",
338                                             "xtype": "Menu",
339                                             "*prop": "menu",
340                                             "items": [
341                                                 {
342                                                     "|xns": "Roo.menu",
343                                                     "xtype": "Separator"
344                                                 },
345                                                 {
346                                                     "listeners": {
347                                                         "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}"
348                                                     },
349                                                     "cls": "x-btn-text-icon",
350                                                     "text": "Fix Blank Return Stock",
351                                                     "xtype": "Item",
352                                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
353                                                     "|xns": "Roo.menu"
354                                                 }
355                                             ]
356                                         }
357                                     ]
358                                 }
359                             ]
360                         },
361                         {
362                             "*prop": "colModel[]",
363                             "dataIndex": "cmhead_number",
364                             "header": "Ref #",
365                             "sortable": true,
366                             "width": 150,
367                             "xtype": "ColumnModel",
368                             "|renderer": "function(v) { return String.format('{0}', v); }",
369                             "|xns": "Roo.grid"
370                         },
371                         {
372                             "*prop": "colModel[]",
373                             "dataIndex": "cmhead_docdate",
374                             "header": "Date",
375                             "sortable": true,
376                             "width": 100,
377                             "xtype": "ColumnModel",
378                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
379                             "|xns": "Roo.grid"
380                         },
381                         {
382                             "*prop": "colModel[]",
383                             "dataIndex": "cmhead_salesrep_id_salesrep_name",
384                             "header": "Sales Rep",
385                             "sortable": true,
386                             "width": 100,
387                             "xtype": "ColumnModel",
388                             "|renderer": "function(v) { return String.format('{0}', v  ); }",
389                             "|xns": "Roo.grid"
390                         },
391                         {
392                             "*prop": "colModel[]",
393                             ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
394                             "dataIndex": "cmhead_cust_id_cust_name",
395                             "header": "Customer",
396                             "width": 200,
397                             "xtype": "ColumnModel",
398                             "|renderer": "function(v) { return String.format('{0}', v); }",
399                             "|xns": "Roo.grid"
400                         },
401                         {
402                             "*prop": "colModel[]",
403                             "align": "right",
404                             "dataIndex": "cmhead_curr_id_curr_symbol",
405                             "header": "Currency",
406                             "width": 70,
407                             "xtype": "ColumnModel",
408                             "|renderer": "function(v)\n{\n    return String.format('{0}', v ? v : '??');\n}",
409                             "|xns": "Roo.grid"
410                         },
411                         {
412                             "*prop": "colModel[]",
413                             "align": "right",
414                             "dataIndex": "cmhead_value",
415                             "header": "Value",
416                             "width": 100,
417                             "xtype": "ColumnModel",
418                             "|renderer": "function(v)\n{\n    return Roo.util.Format.usMoney(v);\n}",
419                             "|xns": "Roo.grid"
420                         },
421                         {
422                             "*prop": "colModel[]",
423                             "align": "right",
424                             "dataIndex": "cmhead_unpaid",
425                             "header": "Open Value",
426                             "width": 100,
427                             "xtype": "ColumnModel",
428                             "|renderer": "function(v,x,r)\n{\n    if (!r.data.cmhead_posted) {\n        return '';\n    }\n    return Roo.util.Format.usMoney(v);\n}",
429                             "|xns": "Roo.grid"
430                         },
431                         {
432                             "*prop": "colModel[]",
433                             "dataIndex": "cmhead_posted",
434                             "header": "Posted",
435                             "width": 75,
436                             "xtype": "ColumnModel",
437                             "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",
438                             "|xns": "Roo.grid"
439                         }
440                     ]
441                 }
442             ]
443         }
444     ],
445     "permname": "",
446     "modOrder": "200"
447 }