{ "id": "roo-file-29", "name": "Pman.Dialog.XtupleSalesOrderNew", "parent": "", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleSalesOrderNew.bjs", "items": [ { "listeners": { "show": "function (_self)\n{\n _this.form.findField('cohead_cust_id').focus();\n}" }, "closable": false, "height": 180, "modal": true, "resizable": false, "title": "Create new Sales Order", "width": 500, "xtype": "LayoutDialog", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "region": "center", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "listeners": { "rendered": "function (form)\n{\n _this.form = form;\n}" }, "xtype": "Form", "|xns": "Roo.form", "items": [ { "listeners": { "add": "function (combo)\n{\n \n Pman.Dialog.XtupleCustomer.show( { id : 0 } , function(res) {\n Roo.log(res);\n // fill in customer\n _this.form.setValues({\n cohead_cust_id: res.cust_id,\n cohead_cust_id_cust_name : res.cust_name,\n cohead_curr_id : res.cust_curr_id,\n cohead_curr_id_curr_name : res.cust_curr_id_curr_name\n });\n \n \n })\n \n}\n\n", "select": "function (combo, record, index)\n{\n \n Roo.log(record);\n _this.form.setValues({\n cohead_curr_id : record.data.cust_curr_id,\n cohead_curr_id_curr_name : record.data.cust_curr_id_curr_name\n \n });\n}" }, "allowBlank": false, "displayField": "cust_name", "editable": true, "fieldLabel": "Select Customer", "forceSelection": true, "hiddenName": "cohead_cust_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "cohead_cust_id_cust_name", "pageSize": 20, "qtip": "Select custinfo", "queryParam": "query[cust_name_begin]", "selectOnFocus": true, "tpl": "
{cust_name} ({cust_number})
", "triggerAction": "all", "typeAhead": true, "valueField": "cust_id", "width": 300, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n\n // o.params['search[with_location]'] = 1;\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|xns": "Roo.data", "|url": "baseURL + '/Roo/custinfo.php'" }, { "*prop": "reader", "xtype": "JsonReader", "|xns": "Roo.data", "id": "cust_id", "root": "data", "totalProperty": "total", "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]" } ] } ] }, { "allowBlank": false, "displayField": "curr_name", "editable": false, "emptyText": "Select Currency", "fieldLabel": "Currency", "forceSelection": true, "hiddenName": "cohead_curr_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "cohead_curr_id_curr_name", "pageSize": 20, "qtip": "Select Currency", "queryParam": "query[curr_name]", "selectOnFocus": true, "tpl": "
{curr_name}
", "triggerAction": "all", "typeAhead": true, "valueField": "curr_id", "width": 285, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n \n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'curr_symbol' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|xns": "Roo.data", "|url": "baseURL + '/Roo/curr_symbol.php'" }, { "*prop": "reader", "xtype": "JsonReader", "|xns": "Roo.data", "id": "curr_id", "root": "data", "totalProperty": "total", "|fields": "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]" } ] } ] } ] } ] }, { "listeners": { "click": "function (_self, e)\n{\n _this.dialog.hide();\n \n }" }, "*prop": "buttons[]", "text": "Cancel", "xtype": "Button", "|xns": "Roo" }, { "listeners": { "click": "function (_self, e)\n{\n //_this.findField('cuinfo_\n \n // check if customer is filled in.\n if (_this.form.findField('cohead_cust_id').getValue() < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a customer\");\n return;\n }\n \n var data = _this.form.getFieldValues();\n var c = _this.form.findField('cohead_cust_id').lastData;\n\n var cur = _this.form.findField('cohead_curr_id').lastData; \n \n data.cohead_curr_id = cur.curr_id;\n// data.cohead_curr_id_curr_name = cur.cust_curr_id_curr_name;\n data.cohead_curr_id_curr_name = cur.curr_name;\n \n data.cohead_terms_id = c.cust_terms_id;\n data.cohead_terms_id_terms_descrip = c.cust_terms_id_terms_descrip;\n \n // fill in staff in/c..\n \n data.cohead_salesrep_id = Pman.Login.authUser.salesrep.salesrep_id;\n data.cohead_salesrep_id_salesrep_name = Pman.Login.authUser.salesrep.salesrep_name;\n \n data.cohead_display_salesrep_id = c.cust_salesrep_id;\n data.cohead_display_salesrep_id_salesrep_name = c.cust_salesrep_id_salesrep_name;\n \n data.cohead_orderdate = new Date();\n \n \n data.cohead_location_src = c.default_location_id;\n data.cohead_location_src_location_name = c.default_location_name;\n \n data.cohead_taxzone_id = c.cust_taxzone_id_taxzone_id;\n data.cohead_taxzone_id_taxzone_descrip = c.cust_taxzone_id_taxzone_descrip;\n \n // if customer is online .. .then do not fill this stuff in..\n \n if (c.cust_custtype_id_custtype_code == 'ONLINE') {\n Pman.Dialog.XtupleSalesOrder.show(data, function() {\n _this.dialog.hide();\n _this.callback()\n }); \n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/cntct.php',\n method : 'GET',\n params : {\n '_id' : c.cust_cntct_id\n },\n success : function (res){\n if(res.data){\n for(var i in res.data) {\n data['cohead_billto_cntct_id_' + i] = res.data[i];\n }\n }\n Pman.Dialog.XtupleSalesOrder.show(data, function() {\n _this.dialog.hide();\n _this.callback()\n }); \n }\n });\n \n \n \n}" }, "*prop": "buttons[]", "text": "OK", "xtype": "Button", "|xns": "Roo" } ] } ], "permname": "", "modOrder": "001" }