{ "id": "roo-file-360", "name": "Pman.Tab.XtupleAdjustment", "parent": "Pman.Tab.XtupleAdjustmentTab", "title": "Pman.Tab.XtupleAdjustment", "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleAdjustment.bjs", "items": [ { "listeners": { "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, "background": true, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "invadj", "title": "Inventory Adjustments", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|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}", "afteredit": "function (e)\n{\n if (e.record.data.invadj_posted) {\n return;\n }\n var req = [ 'invadj_transdate', 'invadj_location_id', 'invadj_itemsite_id', \n 'invadj_qty_by', 'invadj_comments' ];\n var valid = true;\n Roo.each(req, function(c) {\n var val = '' + e.record.get(c);\n if (!val.length) {\n valid = false;\n }\n });\n if (!valid) {\n return;\n }\n e.record.commit();\n \n \n \n}", "validateedit": "function (e)\n{\n switch(e.field) {\n case 'invadj_transdate':\n // e.record.setValue('invadj_transdate', Date.parseDate(e.value, 'Y-m-d'));\n e.value = Date.parseDate(e.value, 'Y-m-d');\n break;\n }\n}", "beforeedit": "function (e)\n{\n Roo.log(e.record);\n if (e.record.data.invadj_posted) {\n \n e.cancel = true;\n return false;\n }\n}", "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n var c = _this.grid.colModel.config[columnIndex];\n var di = c.dataIndex;\n if (di != 'invadj_posted') {\n return;\n }\n \n var r = _this.grid.ds.getAt(rowIndex);\n if (r.data.invadj_posted || !r.data.invadj_id) {\n return;\n }\n // attempting to post..\n // validation - done at other end..\n new Pman.Request({\n url : baseURL + '/Roo/Invadj',\n method : 'POST',\n mask : 'Posting',\n params : {\n invadj_id : r.data.invadj_id,\n _post : 1\n },\n success : function(res) {\n r.set('invadj_posted', true);\n if (r.data.invadj_voids_id > 0) {\n _this.grid.ds.each(function(rr) {\n if (rr.data.invadj_id == r.data.invadj_voids_id) {\n rr.set('invadj_voided_by_id', r.data.invadj_id);\n rr.set('invadj_comments', rr.data.invadj_comments);\n }\n });\n \n \n }\n \n \n \n },\n failure : function (res) {\n Roo.log(res);\n Roo.MessageBox.alert(\"Error\",res.errorMsg);\n if (res.errors.trandate) {\n r.set('invadj_transdate', Date.parseDate(res.errors.trandate,'Y-m-d'));\n r.commit();\n }\n \n }\n });\n \n \n \n \n}" }, "*prop": "grid", "autoExpandColumn": "invadj_comments", "clicksToEdit": 1, "loadMask": true, "xtype": "EditorGrid", "|xns": "Roo.grid", "items": [ { "listeners": { "tabend": "function (eventdata)\n{\n _this.addBtn.fireEvent('click', this); \n\n}" }, "*prop": "sm", "xtype": "CellSelectionModel", "|xns": "Roo.grid" }, { "listeners": { "beforeload": "function (_self, options)\n{\n options.params.invadj_location_id = _this.locationCombo.getValue();\n options.params.invadj_itemsite_id = _this.itemCombo.getValue(); \n switch(_this.status.getValue()) {\n case 'ALL':\n \n break;\n case 'ALL-WITHVOID':\n options.params._show_void = 2; \n break; \n \n case 'VOID':\n options.params._show_void = 1;\n \n break;\n \n case 'POSTED':\n\n options.params.invadj_posted = 1;\n break;\n \n case 'UNPOSTED':\n options.params.invadj_posted = 0;\n options.params._show_void = 2; \n break; \n\n case 'ALL-NOGROUP':\n options.params._hide_group = 1; \n break;\n\n case 'ALL-NOGROUP-WITHVOID':\n options.params._show_void = 2; \n options.params._hide_group = 1; \n break; \n \n case 'VOID-NOGROUP':\n options.params._show_void = 1; \n options.params._hide_group = 1; \n break;\n \n case 'POSTED-NOGROUP':\n options.params.invadj_posted = 1;\n options.params._hide_group = 1; \n break;\n \n case 'UNPOSTED-NOGROUP':\n options.params._hide_group = 1; \n options.params.invadj_posted = 0;\n options.params._show_void = 2; \n break; \n \n \n }\n options.params['query[comment]'] = _this.search.getValue();\n}", "update": "function (_self, record, operation)\n{\n \n Roo.log(operation);\n if (operation != 'commit' || _this.incom) {\n return;\n }\n\n \n var p = Roo.apply({}, record.data);\n \n if (p.invadj_posted) {\n return;\n }\n p.invadj_transdate = record.data.invadj_transdate.format('Y-m-d');\n p.invadj_posted = 0; \n\n _this.incom = true; \n new Pman.Request( {\n url : baseURL + '/Roo/Invadj',\n mask : 'Saving',\n method : 'POST',\n params : p,\n success : function(res) {\n record.set('invadj_id', res.data.invadj_id);\n _this.incom = false;\n },\n failure : function()\n {\n Roo.MessageBox.alert(\"Error\", \"Saving failed\");\n _this.incom = false; \n }\n \n });\n \n \n \n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'invadj_id', direction: 'DESC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|url": "baseURL + '/Roo/invadj.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", "*prop": "reader", "id": "id", "|fields": "[\n {\n 'name': 'invadj_id',\n 'type': 'int'\n },\n {\n 'name': 'invadj_transdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invadj_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invadj_itemsite_id',\n 'type': 'int'\n },\n {\n 'name': 'invadj_qty_by',\n 'type': 'int'\n },\n {\n 'name': 'invadj_posted',\n 'type': 'int'\n }\n]" } ] }, { "*prop": "footer", "xtype": "PagingToolbar", "pageSize": 25, "displayInfo": true, "displayMsg": "Displaying invadj{0} - {1} of {2}", "emptyMsg": "No invadj found", "|xns": "Roo" }, { "*prop": "toolbar", "xtype": "Toolbar", "|xns": "Roo", "items": [ { "listeners": { "render": "function (_self)\n{\n _this.locationCombo = _self;\n}", "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": true, "displayField": "location_name", "editable": true, "emptyText": "Select location", "fieldLabel": "location", "forceSelection": true, "hiddenName": "invadj_location_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "invadj_location_id_location_name", "pageSize": 100, "qtip": "Select location", "queryParam": "query[location_name]", "selectOnFocus": true, "tpl": "