3 "name": "Pman.Tab.XtupleTransfer",
4 "parent": "Pman.Tab.XtupleSales",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleTransfer.bjs",
10 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
16 "tableName": "invhist_transfer",
23 "|render": "function() \n{\n _this.grid = this; \n _this.dialog =Pman.Dialog.XtupleTransfer;\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
24 "|rowdblclick": "function (_self, rowIndex, e)\n{\n var sel = _this.postedCombo.getValue();\n \n var tdb = baseURL.split('/').pop().split('.').shift();\n \n \n if (sel.match(/^office-/)) {\n tdb = sel.split('-').pop();\n \n }\n \n \n if (!_this.dialog) return;\n \n var data = this.getDataSource().getAt(rowIndex).data;\n \n \n _this.dialog.show( {\n invhist_transfer_id : data.invhist_transfer_id,\n _roo_office : tdb\n }, function() {\n _this.grid.footer.onClick('first');\n }); \n}\n",
25 "rowclass": "function (gridview, rowcfg)\n{\n if(rowcfg.record.data.invhist_transfer_void){\n rowcfg.rowClass = 'strikethrough';\n }\n}"
28 "autoExpandColumn": "invhist_transfer_descrip",
35 "beforeload": "function (_self, o)\n{\n var tdb = baseURL.split('/').pop().split('.').shift(); \n o.params._roo_office = tdb;\n o.params['query[location_id]'] = _this.locCombo.getValue();\n o.params['query[invhist_transfer_number]'] = _this.searchBox.getValue();\n var sel = _this.postedCombo.getValue();\n switch (sel) {\n case 'VOIDED': \n o.params.invhist_transfer_void = 1; \n break;\n case 'POSTED': \n o.params.invhist_transfer_posted = 1; \n break;\n case 'UNPOSTED': \n o.params.invhist_transfer_posted = 0; \n o.params.invhist_transfer_void = 0; \n break; \n case 'ALL': \n break;\n default: \n if (!sel.match(/^office-/)) {\n break;\n }\n delete o.params['query[location_id]'];\n \n o.params._roo_office= sel.replace(/^office-/,'');\n o.params.cust_to_internalcompany = tdb;\n break;\n }\n var dt = _this.dateSel.getValue();\n \n o.params['query[dateSel]'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n \n\n \n \n}"
37 "*prop": "dataSource",
40 "|sortInfo": "{ field : 'invhist_transfer_transdate', direction: 'DESC' }",
47 "|url": "baseURL + '/Xtuple/Roo/invhist_transfer.php'",
52 "xtype": "JsonReader",
53 "totalProperty": "total",
57 "|fields": "[\n {\n 'name': 'invhist_transfer_id',\n 'type': 'int'\n },\n {\n 'name': 'invhist_transfer_transdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invhist_transfer_number',\n 'type': 'string'\n },\n {\n 'name': 'invhist_transfer_from',\n 'type': 'int'\n },\n {\n 'name': 'invhist_transfer_to',\n 'type': 'int'\n },\n {\n 'name': 'invhist_transfer_descrip',\n 'type': 'string'\n }\n]"
63 "xtype": "PagingToolbar",
66 "displayMsg": "Displaying invhist_transfer{0} - {1} of {2}",
67 "emptyMsg": "No invhist_transfer found",
72 "click": "function (_self, e)\n{\n new Pman.Download({\n grid : _this.grid\n });\n Roo.MessageBox.alert(\"Downloading\", \"Report is downloading\");\n}"
87 "render": "function (_self)\n{\n _this.searchBox = _self;\n}",
88 "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}"
95 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}",
96 "render": "function (_self)\n{\n _this.locCombo = _self;\n}"
99 "displayField": "location_name",
101 "emptyText": "Select location",
102 "fieldLabel": "location",
103 "forceSelection": true,
104 "hiddenName": "location_id",
106 "loadingText": "Searching...",
108 "name": "location_id",
110 "qtip": "Select location",
111 "queryParam": "query[location_name]",
112 "selectOnFocus": true,
113 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> - <b style=\"color:red\">{location_cust_id_char_internalcompany} </b> {location_descrip} </div>",
114 "triggerAction": "all",
116 "valueField": "location_id",
123 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params.location_restrict = 0;\n \n}\n"
128 "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
134 "xtype": "HttpProxy",
135 "|url": "baseURL + '/Roo/location.php'",
140 "xtype": "JsonReader",
144 "totalProperty": "total",
145 "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"location_name\",\"type\":\"string\"}]"
153 "|select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}",
154 "|render": "function (_self)\n{\n _this.postedCombo = _self;\n}"
157 "displayField": "title",
159 "emptyText": "Select Action",
160 "forceSelection": true,
162 "loadingText": "Searching...",
166 "qtip": "Select Action",
167 "selectOnFocus": true,
168 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
169 "triggerAction": "all",
172 "valueField": "code",
180 "xtype": "SimpleStore",
181 "|data": "(function() { \n var ret = [\n [ 'ALL', 'All Transactions' ],\n [ 'UNPOSTED', 'Unposted' ],\n [ 'POSTED', 'Posted' ],\n [ 'VOIDED', 'Voided' ],\n [ '--', '-----------------' ] \n ];\n var c = baseURL.split('/').pop().split('.').shift(); \n Roo.each(uiConfig.xtuple_offices, function(o) {\n if (o == c) {\n return;\n }\n ret.push( [ 'office-' + o, \"Transfers from \" + Pman.Xtuple.offices[o] ] );\n\n });\n \n return ret;\n \n \n})()",
182 "|fields": "[ 'code', 'title' ]",
189 "render": "function (_self)\n{\n _this.dateSel = _self;\n}",
190 "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}"
193 "fieldLabel": "Date",
196 "xtype": "DateField",
201 "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
205 "|icon": "rootURL + '/Pman/templates/images/search.gif'",
206 "|xns": "Roo.Toolbar"
210 "|click": "function (_self, e)\n{\n _this.searchBox.setValue('');\n \n _this.locCombo.setValue(''); \n\n \n _this.grid.footer.onClick('first');\n}"
214 "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
215 "|xns": "Roo.Toolbar"
218 "|xns": "Roo.Toolbar",
223 "|click": "function()\n{\n \n var sel = _this.postedCombo.getValue();\n if (sel.match(/^office-/)) {\n Roo.Msg.alert('Error', \"You can create transfers for another office\");\n return;\n }\n \n var s = _this.grid.selModel.getSelected();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a row to copy\");\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/invhist_transfer',\n method : 'POST',\n mask: 'Processing',\n timeout : 1200000, //20 minutes...! - big xfer should be 10mins.\n params : {\n invhist_transfer_id : s.data.invhist_transfer_id,\n _copy : 1\n },\n success : function () \n {\n _this.grid.footer.onClick('refresh');\n }\n });\n \n}\n"
225 "cls": "x-btn-text-icon",
226 "text": "Copy Transfer",
228 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
229 "|xns": "Roo.Toolbar"
232 "|xns": "Roo.Toolbar",
237 "|click": "function()\n{\n \n var sel = _this.postedCombo.getValue();\n if (sel.match(/^office-/)) {\n Roo.Msg.alert('Error', \"You can create transfers for another office\");\n return;\n }\n \n if (!_this.dialog) return;\n _this.dialog.show( { id : 0, _roo_office : baseURL.split('/').pop().split('.').shift() } , function() {\n _this.grid.footer.onClick('first');\n }); \n}\n"
239 "cls": "x-btn-text-icon",
242 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
243 "|xns": "Roo.Toolbar"
246 "|xns": "Roo.Toolbar",
251 "|click": "function()\n{\n \n var sel = _this.postedCombo.getValue();\n if (sel.match(/^office-/)) {\n Roo.Msg.alert('Error', 'You can not create reversals of transfer from another office');\n return;\n }\n \n \n var s = _this.grid.getSelectionModel().getSelected();\n if(!s){\n Roo.Msg.alert('Error', 'Please select a row!');\n return;\n }\n Roo.log(s);\n if(s.data.cust_to_internalcompany.length > 0){\n Roo.Msg.confirm(\"Comfirm\", \"Are you sure? <br/>\" + \n \"This will create a transfer in the other company dragon, you will need to log to that company and post for it to happen.<br/>\" +\n \"Otherwise, it just creates a transfer, and then opens the dialog to edit it.\", \n function(r) {\n if (r != 'yes') {\n return;\n }\n \n Roo.Msg.alert('Warnning', 'Sorry, it is comming soon !!');\n }\n );\n \n return;\n }\n \n \n Roo.Msg.confirm(\"Comfirm\", \"Are you sure? <br/>\" + \n \"You can void a transfer, however if you need to reverse a transfer at a different date press 'yes', and a new transfer will be created.\", \n function(r) {\n if (r != 'yes') {\n return;\n }\n var data = {\n invhist_transfer_transdate : new Date(),\n invhist_transfer_arrivaldate : new Date(),\n invhist_transfer_to : s.data.invhist_transfer_from_location_id,\n invhist_transfer_to_location_descrip : s.data.invhist_transfer_from_location_descrip,\n invhist_transfer_from : s.data.invhist_transfer_to_location_id,\n invhist_transfer_from_location_descrip : s.data.invhist_transfer_to_location_descrip,\n invhist_transfer_price : s.data.invhist_transfer_price,\n invhist_transfer_descrip : s.data.invhist_transfer_descrip,\n _createReverse : s.data.invhist_transfer_id\n \n };\n _this.dialog.show( data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n }\n );\n return;\n \n}\n"
253 "cls": "x-btn-text-icon",
254 "text": "Create Reverse Transfer",
256 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
257 "|xns": "Roo.Toolbar"
260 "|xns": "Roo.Toolbar",
265 "|click": "function()\n{\n var sel = _this.postedCombo.getValue();\n if (sel.match(/^office-/)) {\n Roo.Msg.alert('Error', \"You can not Post transfer from another office\");\n return;\n }\n var s = _this.grid.selModel.getSelected();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a row to post\");\n return;\n }\n \n if(s.data.invhist_transfer_void){\n Roo.MessageBox.alert(\"Error\", \"You can not post a voided transfer\");\n return;\n }\n \n var msg = \"Posting\";\n \n if (s.data.cust_from_internalcompany.length || s.data.cust_to_internalcompany.length) {\n msg += \" Cross company transfer - large orders may take some time, so do not cancel or reload\";\n }\n \n \n new Pman.Request({\n url : baseURL + '/Roo/invhist_transfer',\n method : 'POST',\n mask: msg,\n timeout : 1200000, //20 minutes...! - big xfer should be 10mins.\n params : {\n invhist_transfer_id : s.data.invhist_transfer_id,\n _post : 1\n },\n success : function () \n {\n _this.grid.footer.onClick('refresh');\n }\n });\n \n}\n "
267 "cls": "x-btn-text-icon",
270 "|icon": "rootURL + '/Pman/templates/images/mail-close.gif'",
271 "|xns": "Roo.Toolbar"
274 "|xns": "Roo.Toolbar",
279 "|click": "function()\n{\n var sel = _this.postedCombo.getValue();\n if (sel.match(/^office-/)) {\n Roo.Msg.alert('Error', \"You can not Post transfer from coid office\");\n return;\n }\n \n var s = _this.grid.selModel.getSelected();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a row to void\");\n return;\n }\n \n var voidposted = function(){\n new Pman.Request({\n url : baseURL + '/Roo/invhist_transfer',\n method : 'POST',\n mask : \"Voiding\",\n timeout : 90000,\n params : {\n invhist_transfer_id : s.data.invhist_transfer_id,\n _void : 1\n },\n success : function () \n {\n _this.grid.footer.onClick('refresh');\n }\n });\n }\n \n var voidunposted = function(){\n new Pman.Request({\n url : baseURL + '/Roo/invhist_transfer',\n method : 'POST',\n mask : \"Voiding\",\n params : {\n invhist_transfer_id : s.data.invhist_transfer_id,\n invhist_transfer_void : 1\n },\n success : function () \n {\n _this.grid.footer.onClick('refresh');\n }\n });\n }\n \n \n var posted = s.data.invhist_transfer_posted;\n \n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to void that\", \n function(r) {\n if (r != 'yes') {\n return;\n }\n if(posted){\n voidposted();\n return;\n } \n voidunposted();\n }\n )\n \n}\n "
281 "cls": "x-btn-text-icon",
284 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
285 "|xns": "Roo.Toolbar"
290 "*prop": "colModel[]",
291 "dataIndex": "invhist_transfer_posted",
294 "xtype": "ColumnModel",
295 "|renderer": "function(v) { \n var state = v * 1 > 0 ? '-checked' : '';\n\n return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n \n }",
299 "*prop": "colModel[]",
300 "dataIndex": "invhist_transfer_transdate",
304 "xtype": "ColumnModel",
305 "|renderer": "function(v) { \n\n return String.format('{0}', v ? Date.parseDate(v.split(' ').shift(),'Y-m-d').format('d/M/Y') : '');\n }",
309 "*prop": "colModel[]",
310 "dataIndex": "invhist_transfer_arrivaldate",
314 "xtype": "ColumnModel",
315 "|renderer": "function(v) { \n\n return String.format('{0}', v ? Date.parseDate(v.split(' ').shift(),'Y-m-d').format('d/M/Y') : '');\n }",
319 "*prop": "colModel[]",
320 "dataIndex": "invhist_transfer_number",
321 "header": "reference#",
324 "xtype": "ColumnModel",
325 "|renderer": "function(v,x,r) { \n\n var sel = _this.postedCombo.getValue();\n var p = baseURL.split('/').pop().split('.').shift().toUpperCase();;\n if (sel.match(/^office-/)) {\n p = sel.split('-').pop().toUpperCase();\n }\n \n return String.format(r.data.invhist_transfer_void ? '<s>{0}</s>' : '{0}', p+':'+v); \n \n}",
329 "*prop": "colModel[]",
330 "dataIndex": "invhist_transfer_from_location_name",
334 "xtype": "ColumnModel",
335 "|renderer": "function(v,x,r) { \n\n var lv = _this.locCombo.getValue();\n var fmt = lv == r.data.invhist_transfer_from ? '<B>{0}</B>' : '{0}';\n if (r.data.cust_from_internalcompany.length) {\n fmt = '<span style=\"color:red\">[Intercompany {1}] ' + fmt + '</span>';\n }\n \n return String.format(fmt, v,r.data.cust_from_internalcompany ); \n}",
339 "*prop": "colModel[]",
340 "dataIndex": "invhist_transfer_to_location_name",
344 "xtype": "ColumnModel",
345 "|renderer": "function(v,x,r) { \n\n var lv = _this.locCombo.getValue();\n var fmt = lv == r.data.invhist_transfer_to ? '<B>{0}</B>' : '{0}';\n if (r.data.cust_to_internalcompany.length) {\n fmt = '<span style=\"color:red\">[Intercompany {1}] ' + fmt + '</span>';\n }\n \n return String.format(fmt, v, r.data.cust_to_internalcompany); \n}",
349 "*prop": "colModel[]",
351 "header": "Quantity Moved",
353 "xtype": "ColumnModel",
354 "|renderer": "function(v,x,r) \n{\n if(\n r.data.cust_to_internalcompany.length \n || \n (r.data.invhist_transfer_void && r.data.moved_qty == 0)\n ||\n (!r.data.invhist_transfer_void && !r.data.invhist_transfer_posted)\n ){\n return String.format('{0}', v); \n }\n \n var diff = v * 1 - r.data.moved_qty * 1;\n var flag = ''\n \n if(diff != 0){\n flag = '<span style=\"color:red\"> ({1}) </span>'\n }\n\n return String.format('{0}' + flag, v, r.data.moved_qty); \n\n \n}",
358 "*prop": "colModel[]",
359 "dataIndex": "invhist_transfer_salesrep_id_salesrep_name",
360 "header": "Sales Rep",
362 "xtype": "ColumnModel",
363 "|renderer": "function(v) { return String.format('{0}', v); }",
367 "*prop": "colModel[]",
368 "dataIndex": "invhist_transfer_descrip",
371 "xtype": "ColumnModel",
372 "|renderer": "function(v) { return String.format('{0}', v); }",