{ "id": "roo-file-6", "name": "Pman.Dialog.XtupleExpenses", "parent": "", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleExpenses.bjs", "items": [ { "closable": false, "collapsible": false, "height": 640, "modal": true, "resizable": false, "title": "Edit / Create expense Report", "width": 900, "xtype": "LayoutDialog", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "*prop": "north", "height": 250, "xtype": "LayoutRegion", "|xns": "Roo" }, { "region": "north", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "listeners": { "|actioncomplete": "function(_self,action)\n{\n \n var btns = ['postToManagement', 'postToAccounts','postToGL', 'postToStaff', 'saveBtn'];\n var showhide = function()\n {\n Roo.each(btns, function(b) {\n _this[b].hide();\n });\n switch(_this.form.findField('expense_status').getValue()) {\n case '':\n _this['saveBtn'].show();\n return; // do not show any button...\n case 'Draft': \n _this['saveBtn'].show();\n _this['postToManagement'].show();\n break;\n \n \n case 'Pending Management Approval':\n case 'Pending Supervisor Approval': // old system..\n // check if they are managmenet..\n // eg. have to be in TIER2\n if (!Pman.Login.inGroup('TIER2') && !Pman.Login.inGroup('TIER1') && \n !Pman.Login.inGroup('Administrators')) {\n return;\n }\n _this['postToAccounts'].show();\n _this['postToStaff'].show(); \n _this['saveBtn'].show();\n break;\n case 'Pending Accounting Approval':\n if (!Pman.Login.inGroup('Administrators')) {\n return;\n }\n \n // check if they are managmenet..\n _this['postToGL'].show();\n _this['postToStaff'].show(); \n _this['saveBtn'].show(); \n break;\n \n \n }\n }\n \n if (action.type == 'setdata') {\n //_this.dialog.el.mask(\"Loading\");\n if (_this.data.expense_id) {\n this.load({ method: 'GET', params: { '_id' : _this.data.expense_id }});\n \n return;\n }\n showhide();\n _this.grid.ds.load({});\n return;\n }\n if (action.type == 'load') {\n \n \n showhide();\n \n \n \n _this.grid.ds.load({});\n return;\n }\n if (action.type =='submit') {\n \n \n if (! (1 * _this.form.findField('expense_id').getValue()) ) {\n Roo.log(\"fire event\");\n _this.data = action.result.data;\n this.fireEvent('actioncomplete', this, { type: 'setdata', data: action.result.data });\n return;\n }\n \n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(_this, _this.form.getValues());\n }\n _this.form.reset();\n return;\n }\n}\n", "|rendered": "function (form)\n{\n _this.form= form;\n}\n" }, "method": "POST", "style": "margin:10px;", "xtype": "Form", "|url": "baseURL + '/Roo/expense.php'", "|xns": "Roo.form", "items": [ { "width": 400, "xtype": "Column", "|xns": "Roo.form", "items": [ { "legend": "Summary", "style": "width:380px", "xtype": "FieldSet", "|xns": "Roo.form", "items": [ { "fieldLabel": "Ref#", "name": "expense_number", "readOnly": true, "width": 200, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Due Date", "format": "Y-m-d", "name": "expense_trandate", "width": 100, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Summary", "name": "expense_memo", "width": 200, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Status", "name": "expense_status", "readOnly": true, "width": 200, "xtype": "TextField", "|xns": "Roo.form" } ] }, { "labelAlign": "top", "style": "clear:both;float:left;", "xtype": "Row", "|xns": "Roo.form", "items": [ { "fieldLabel": "Comments / For Review etc.", "name": "expense_comments", "width": 400, "xtype": "TextArea", "|xns": "Roo.form" } ] } ] }, { "width": 400, "xtype": "Column", "|xns": "Roo.form", "items": [ { "labelWidth": 50, "legend": "Employee", "style": "width:250px;margin-left:10px", "xtype": "FieldSet", "|xns": "Roo.form", "items": [ { "fieldLabel": "Name", "name": "expense_emp_id_emp_name", "readOnly": true, "xtype": "TextField", "|xns": "Roo.form" } ] }, { "legend": "Financial Details", "style": "width:250px;margin-left:10px", "xtype": "FieldSet", "|xns": "Roo.form", "items": [ { "fieldLabel": "Advance Paid", "name": "expense_advance", "width": 75, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Amount", "name": "expense_amount_ro", "readOnly": true, "width": 75, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Tax", "name": "expense_tax_ro", "readOnly": true, "width": 75, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Total", "name": "expense_total_ro", "readOnly": true, "width": 75, "xtype": "TextField", "|xns": "Roo.form" }, { "labelAlign": "top", "xtype": "Row", "|xns": "Roo.form", "items": [ { "allowBlank": true, "displayField": "accnt_descrip", "editable": false, "emptyText": "Select accnt", "fieldLabel": "Paid from Bank Account (accounting only)", "forceSelection": true, "hiddenName": "expense_accnt_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "expense_accnt_id_accnt_descrip", "pageSize": 20, "qtip": "Select accnt", "queryParam": "", "selectOnFocus": true, "tpl": "