1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.XtupleSalesOrderNew = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 show : function (_self)
36 _this.form.findField('cohead_cust_id').focus();
43 title : "Create new Sales Order",
47 xtype: 'ContentPanel',
55 rendered : function (form)
65 add : function (combo)
68 Pman.Dialog.XtupleCustomer.show( { id : 0 } , function(res) {
71 _this.form.setValues({
72 cohead_cust_id: res.cust_id,
73 cohead_cust_id_cust_name : res.cust_name,
74 cohead_curr_id : res.cust_curr_id,
75 cohead_curr_id_curr_name : res.cust_curr_id_curr_name
82 select : function (combo, record, index)
86 _this.form.setValues({
87 cohead_curr_id : record.data.cust_curr_id,
88 cohead_curr_id_curr_name : record.data.cust_curr_id_curr_name
94 displayField : 'cust_name',
96 fieldLabel : 'Select Customer',
97 forceSelection : true,
98 hiddenName : 'cohead_cust_id',
100 loadingText : "Searching...",
102 name : 'cohead_cust_id_cust_name',
104 qtip : "Select custinfo",
105 queryParam : 'query[cust_name_begin]',
106 selectOnFocus : true,
107 tpl : '<div class="x-grid-cell-text x-btn button"><b>{cust_name}</b> ({cust_number})</div>',
108 triggerAction : 'all',
110 valueField : 'cust_id',
116 beforeload : function (_self, o){
117 o.params = o.params || {};
119 // o.params['search[with_location]'] = 1;
123 sortInfo : { direction : 'ASC', field: 'cust_name' },
128 url : baseURL + '/Roo/custinfo.php'
135 totalProperty : 'total',
136 fields : [{"name":"cust_id","type":"int"},"cust_name"]
144 displayField : 'curr_name',
146 emptyText : "Select Currency",
147 fieldLabel : 'Currency',
148 forceSelection : true,
149 hiddenName : 'cohead_curr_id',
151 loadingText : "Searching...",
153 name : 'cohead_curr_id_curr_name',
155 qtip : "Select Currency",
156 queryParam : 'query[curr_name]',
157 selectOnFocus : true,
158 tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_name}</b> </div>',
159 triggerAction : 'all',
161 valueField : 'curr_id',
167 beforeload : function (_self, o){
168 o.params = o.params || {};
173 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
178 url : baseURL + '/Roo/curr_symbol.php'
185 totalProperty : 'total',
186 fields : [{"name":"curr_id","type":"int"},"curr_symbol"]
196 xtype: 'LayoutRegion',
204 click : function (_self, e)
216 click : function (_self, e)
218 //_this.findField('cuinfo_
220 // check if customer is filled in.
221 if (_this.form.findField('cohead_cust_id').getValue() < 1) {
222 Roo.MessageBox.alert("Error", "Select a customer");
226 var data = _this.form.getFieldValues();
227 var c = _this.form.findField('cohead_cust_id').lastData;
229 var cur = _this.form.findField('cohead_curr_id').lastData;
231 data.cohead_curr_id = cur.curr_id;
232 // data.cohead_curr_id_curr_name = cur.cust_curr_id_curr_name;
233 data.cohead_curr_id_curr_name = cur.curr_name;
235 data.cohead_terms_id = c.cust_terms_id;
236 data.cohead_terms_id_terms_descrip = c.cust_terms_id_terms_descrip;
238 // fill in staff in/c..
240 data.cohead_salesrep_id = Pman.Login.authUser.salesrep.salesrep_id;
241 data.cohead_salesrep_id_salesrep_name = Pman.Login.authUser.salesrep.salesrep_name;
243 data.cohead_display_salesrep_id = c.cust_salesrep_id;
244 data.cohead_display_salesrep_id_salesrep_name = c.cust_salesrep_id_salesrep_name;
246 data.cohead_orderdate = new Date();
249 data.cohead_location_src = c.default_location_id;
250 data.cohead_location_src_location_name = c.default_location_name;
252 data.cohead_taxzone_id = c.cust_taxzone_id_taxzone_id;
253 data.cohead_taxzone_id_taxzone_descrip = c.cust_taxzone_id_taxzone_descrip;
255 // if customer is online .. .then do not fill this stuff in..
257 if (c.cust_custtype_id_custtype_code == 'ONLINE') {
258 Pman.Dialog.XtupleSalesOrder.show(data, function() {
266 url : baseURL + '/Roo/cntct.php',
269 '_id' : c.cust_cntct_id
271 success : function (res){
273 for(var i in res.data) {
274 data['cohead_billto_cntct_id_' + i] = res.data[i];
277 Pman.Dialog.XtupleSalesOrder.show(data, function() {