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