Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleSalesOrder.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.XtupleSalesOrder = new Roo.XComponent({
8
9  _strings : {
10   'fdb35c1a9883acaa94378144a114dfe6' :"Cust. PO#",
11   'a8929eb5c1553d3f70497f862d25d0ce' :"Select Action",
12   '3bd9a9f36601eeb35d5afce4dcfbfce5' :"No cohead found",
13   '6f1bf85c9ebb3c7fa26251e1e335e032' :"Terms",
14   'd2fd3c49554ebcce7e57b85dfa682160' :"Displaying cohead{0} - {1} of {2}",
15   '72d6d7a1885885bb55a565fd1070581a' :"Import",
16   '36dc4ac22a9c9aa45d359e55937499da' :"as PDF",
17   '051f291b80c3336fc75368454ca2a8d2' :"Import HSBC csv file",
18   'f313afd5710eeea203821d3201cc27d8' :"Email to warehouse",
19   'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
20   'd1228f5476d15142b1358ae4b5fa2454' :"Order #",
21   'bf2234cf486127ba73efe4b2986eed78' :"Customer Statement",
22   'bcc3c81377e8aef6878f3048ad3e1845' :"cohead",
23   'be99bd9be2f6204e18d9be098b1cec84' :"AR Aging",
24   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
25   'ce26601dac0dea138b7295f02b7620a7' :"Customer",
26   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
27   '3f7488c396d3d4e015d8886452db4110' :"Staff IC.",
28   '4351cfebe4b61d8aa5efa1d020710005' :"View",
29   'f38ab62162b94b4978679aeca58a270c' :"Select Order",
30   '8f3e1295a3a1d30b6ee5d8de6e0b8c0a' :"as Excel",
31   '13348442cc6a27032d2b4aa28b75a5d3' :"Search",
32   '26e09a1ee1517389c7b07f42df65561a' :"Ordered",
33   '8db91c5e3376bc85414ebca9c53fb53f' :"MYOPEN",
34   '904062c33353866aa5234f35ed29e114' :"Download Results",
35   '959462c653dede23e7152b97b45a8aa5' :"Clear Unpaid Orders",
36   '3e208ad5d41ca414bb432adbb7d39c33' :"View type",
37   '4d02be4779719ea23232946e4a34aa82' :"Magento Upload",
38   '74002cb040b036511b8d031da591364a' :"Ship to",
39   '5da618e8e4b89c66fe86e32cdafde142' :"From",
40   'ebe043e4c90950fe50c8a95d96af10f5' :"Quick Stock Check",
41   '54ca6e7fdb43298ae82cd9cb04e77f9b' :"#order",
42   'c91c7b93c28cd18741b71f727ee81ee3' :"Reports",
43   '96b0141273eabab320119c467cdcaf17' :"Total",
44   '99360e60ce244a99256c131555f20d4e' :"Sales Orders",
45   '1c5b744a085a30924e4436c89a79027e' :"Complete and Close",
46   'a2fdeac60e3c5b6c51a92e027fb9d533' :"Target Delivery",
47   '5fb63579fc981698f97d55bfecb213ea' :"Copy",
48   'b155bf2beaeeb2018389eded7c74b56f' :"Customer History",
49   'b0ca9fe87723f63f290ec66b891ec9ee' :"Import Waybill Delivery",
50   '2d899459cc25ea99ea2573d592860ec8' :"Customer#",
51   'fce6d3795b41b54dc0dab82df50517c1' :"Select custinfo",
52   'e12167aa0a7698e6ebc92b4ce3909b53' :"To",
53   'd720bb04db44a8269a09bea3b90352f4' :"Summary Excel",
54   'f4c6f851b00d5518bf888815de279aba' :"Notes"
55  },
56
57   part     :  ["Xtuple", "SalesOrder" ],
58   order    : '001-Pman.Tab.XtupleSalesOrder',
59   region   : 'center',
60   parent   : 'Pman.Tab.XtupleSales',
61   name     : "unnamed module",
62   disabled : false, 
63   permname : '', 
64   _tree : function()
65   {
66    var _this = this;
67    var MODULE = this;
68    return {
69    region : 'center',
70    title : _this._strings['99360e60ce244a99256c131555f20d4e'] /* Sales Orders */,
71    xns : Roo,
72    '|xns' : 'Roo',
73    xtype : 'NestedLayoutPanel',
74    listeners : {
75     activate : function (_self)
76      {
77          this.setTitle('Sales Orders (' + Pman.Login.authUser.dbname +')');
78      }
79    },
80    layout : {
81     xns : Roo,
82     '|xns' : 'Roo',
83     xtype : 'BorderLayout',
84     center : {
85      xns : Roo,
86      '|xns' : 'Roo',
87      xtype : 'LayoutRegion'
88     },
89     west : {
90      split : true,
91      title : _this._strings['13348442cc6a27032d2b4aa28b75a5d3'] /* Search */,
92      width : 200,
93      xns : Roo,
94      '|xns' : 'Roo',
95      xtype : 'LayoutRegion'
96     },
97     items  : [
98      {
99       background : true,
100       builderCfg : '{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
101       fitContainer : true,
102       fitToframe : true,
103       region : 'center',
104       tableName : 'cohead',
105       title : _this._strings['bcc3c81377e8aef6878f3048ad3e1845'] /* cohead */,
106       xns : Roo,
107       '|xns' : 'Roo',
108       xtype : 'GridPanel',
109       listeners : {
110        activate : function() {
111             _this.panel = this;
112             if (_this.grid) {
113                 _this.grid.footer.onClick('first');
114             }
115         }
116       },
117       grid : {
118        autoExpandColumn : 'cohead_cust_id_cust_name',
119        loadMask : true,
120        xns : Roo.grid,
121        '|xns' : 'Roo.grid',
122        xtype : 'Grid',
123        listeners : {
124         render : function() 
125          {
126              _this.grid = this; 
127              try { 
128                  _this.dialog = Pman.Dialog.XtupleSalesOrder;
129              } catch(e) {}
130              if (_this.panel.active) {
131                 this.footer.onClick('first');
132              }
133          },
134         rowdblclick : function (_self, rowIndex, e)
135          {
136              if (!_this.dialog) return;
137              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
138                  _this.grid.footer.onClick('refresh');
139                  Pman.Tab.XtupleSales.grid.footer.onClick('first');
140              }); 
141          }
142        },
143        footer : {
144         displayInfo : true,
145         displayMsg : _this._strings['d2fd3c49554ebcce7e57b85dfa682160'] /* Displaying cohead{0} - {1} of {2} */,
146         emptyMsg : _this._strings['3bd9a9f36601eeb35d5afce4dcfbfce5'] /* No cohead found */,
147         pageSize : 25,
148         xns : Roo,
149         '|xns' : 'Roo',
150         xtype : 'PagingToolbar',
151         items  : [
152          {
153           cls : 'x-btn-text-icon',
154           icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
155           text : _this._strings['904062c33353866aa5234f35ed29e114'] /* Download Results */,
156           xns : Roo.Toolbar,
157           '|xns' : 'Roo.Toolbar',
158           xtype : 'Button',
159           listeners : {
160            click : function ()
161             {
162                 new Pman.Download({
163                     grid : _this.grid,
164                     newWindow : true,
165                     timeout : 6000000,
166                     method : 'POST'
167                 });     
168                
169             }
170           }
171          }
172         ]
173        },
174        toolbar : {
175         xns : Roo,
176         '|xns' : 'Roo',
177         xtype : 'Toolbar',
178         items  : [
179          {
180           text : _this._strings['ebe043e4c90950fe50c8a95d96af10f5'] /* Quick Stock Check */,
181           xns : Roo.Toolbar,
182           '|xns' : 'Roo.Toolbar',
183           xtype : 'Button',
184           listeners : {
185            click : function (_self, e)
186             {
187              Pman.Dialog.XtupleInvHistory.show({
188              
189              
190                 });
191             }
192           }
193          },
194          {
195           text : _this._strings['72d6d7a1885885bb55a565fd1070581a'] /* Import */,
196           xns : Roo.Toolbar,
197           '|xns' : 'Roo.Toolbar',
198           xtype : 'Button',
199           menu : {
200            xns : Roo.menu,
201            '|xns' : 'Roo.menu',
202            xtype : 'Menu',
203            items  : [
204             {
205              text : _this._strings['4d02be4779719ea23232946e4a34aa82'] /* Magento Upload */,
206              xns : Roo.menu,
207              '|xns' : 'Roo.menu',
208              xtype : 'Item',
209              listeners : {
210               click : function (_self, e)
211                {
212                   Pman.Dialog.Image.show(
213                       {
214                            _url : baseURL+'/Xtuple/Import/Magento',
215                            timeout : 90000
216                        
217                       },
218                       function (data) {
219                            Roo.MessageBox.alert("Notice", data); 
220                            _this.grid.footer.onClick('first');
221                
222                       }
223                   );
224                }
225              }
226             },
227             {
228              text : _this._strings['051f291b80c3336fc75368454ca2a8d2'] /* Import HSBC csv file */,
229              xns : Roo.menu,
230              '|xns' : 'Roo.menu',
231              xtype : 'Item',
232              listeners : {
233               click : function (_self, e)
234                {
235                    Pman.Dialog.XtupleUploadHSBC.show( {} , function(res) {
236                        Pman.Dialog.Image.show({
237                            timeout : 900000,
238                            _url : baseURL + '/Xtuple/Import/HSBC?' + Roo.urlEncode(res)
239                        }, function(data) {
240                            Roo.MessageBox.alert('Success', data);
241                            _this.grid.footer.onClick('first');
242                        });
243                    }); 
244                }
245              }
246             },
247             {
248              text : _this._strings['b0ca9fe87723f63f290ec66b891ec9ee'] /* Import Waybill Delivery */,
249              xns : Roo.menu,
250              '|xns' : 'Roo.menu',
251              xtype : 'Item',
252              listeners : {
253               click : function (_self, e)
254                {
255                   Pman.Dialog.Image.show(
256                       {
257                            _url : baseURL+'/Xtuple/Import/WayBill',
258                            timeout : 900000
259                        
260                       },
261                       function (data) {
262                            Roo.MessageBox.alert("Notice", data); 
263                            _this.grid.footer.onClick('first');
264                       }
265                   );
266                }
267              }
268             }
269            ]
270           }
271          },
272          {
273           cls : 'x-btn-text-icon',
274           icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
275           text : _this._strings['c91c7b93c28cd18741b71f727ee81ee3'] /* Reports */,
276           xns : Roo.Toolbar,
277           '|xns' : 'Roo.Toolbar',
278           xtype : 'Button',
279           menu : {
280            xns : Roo.menu,
281            '|xns' : 'Roo.menu',
282            xtype : 'Menu',
283            items  : [
284             {
285              text : _this._strings['be99bd9be2f6204e18d9be098b1cec84'] /* AR Aging */,
286              xns : Roo.menu,
287              '|xns' : 'Roo.menu',
288              xtype : 'Item',
289              menu : {
290               xns : Roo.menu,
291               '|xns' : 'Roo.menu',
292               xtype : 'Menu',
293               items  : [
294                {
295                 text : _this._strings['36dc4ac22a9c9aa45d359e55937499da'] /* as PDF */,
296                 xns : Roo.menu,
297                 '|xns' : 'Roo.menu',
298                 xtype : 'Item',
299                 listeners : {
300                  click : function (_self, e)
301                   {
302                       var from = _this.form.findField('_fromdate').getValue();
303                       var to = _this.form.findField('_todate').getValue();
304                       
305                       if(!from || !to){
306                           Roo.Msg.alert('Error', 'Please select a date range for the report');
307                           return;
308                       }
309                       
310                       var params  =   {
311                           template: 'ARAging',
312                           filename : 'ARAging-' + to.format('Y-m-d'),
313                           'param[0]':   "startDate:string='" + from.format('Y-m-d') + "'",
314                           'param[1]':   "relDate:string='" + to.format('Y-m-d') + "'",
315                           'param[2]':   "useDocDate:number=1"
316                       };
317                       var cust_id =     _this.form.findField('cohead_cust_id').getValue();
318                       if (cust_id * 1 > 0) {
319                           params['param[3]'] = 'cust_id:number=' + cust_id;
320                       }
321                    
322                       new Pman.Download({
323                         url : baseURL + '/Xtuple/Print',
324                         params :   params,
325                         method : 'GET'
326                       });
327                       Roo.MessageBox.alert("Notice", "Report will download shortly");
328                   }
329                 }
330                },
331                {
332                 text : _this._strings['8f3e1295a3a1d30b6ee5d8de6e0b8c0a'] /* as Excel */,
333                 xns : Roo.menu,
334                 '|xns' : 'Roo.menu',
335                 xtype : 'Item',
336                 listeners : {
337                  click : function (_self, e)
338                   {
339                       var from = _this.form.findField('_fromdate').getValue();
340                       var to = _this.form.findField('_todate').getValue();
341                       
342                      
343                       
344                       var params = {
345                           '_group' : 'arAging',
346                           '_name' : 'bydate',
347                           'limit' : 99999,
348                           
349                             'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,
350                           'relDate:text' : to ? to.format('Y-m-d') : '2100-01-01',
351                        
352                           
353                           
354                           'useDocDate:text' : 'TRUE',
355                           'csvTitles' : '*',
356                           'csvCols' : '*'
357                       };
358                       
359                       
360                       var cust_id =     _this.form.findField('cohead_cust_id').getValue();
361                       if (cust_id * 1 > 0) {
362                           params['cust_id:number'] = cust_id;
363                       }
364                       
365                       new Pman.Download({\r
366                         url : baseURL + '/Roo/Metasql',\r
367                         params :   params,\r
368                         method : 'GET'\r
369                       });\r
370                       Roo.MessageBox.alert("Notice", "Report will download shortly");\r
371                       \r
372                   }
373                 }
374                },
375                {
376                 text : _this._strings['d720bb04db44a8269a09bea3b90352f4'] /* Summary Excel */,
377                 xns : Roo.menu,
378                 '|xns' : 'Roo.menu',
379                 xtype : 'Item',
380                 listeners : {
381                  click : function (_self, e)
382                   {
383                       var from = _this.form.findField('_fromdate').getValue();
384                       var to = _this.form.findField('_todate').getValue();
385                       
386                      
387                       
388                       var params = {
389                           '_group' : 'arAging',
390                           '_name' : 'summary',
391                           'limit' : 99999,
392                           
393                           
394                         
395                           'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,
396                           'relDate:text' : to ? to.format('Y-m-d') : '2100-01-01',
397                        
398                           
399                           'useDocDate:text' : 'TRUE',
400                           'csvTitles' : '*',
401                           'csvCols' : '*'
402                       };
403                       
404                       var cust_id =     _this.form.findField('cohead_cust_id').getValue();
405                       if (cust_id * 1 > 0) {
406                           params['cust_id:number'] = cust_id;
407                       }
408                       
409                       new Pman.Download({\r
410                         url : baseURL + '/Roo/Metasql',\r
411                         params :   params,\r
412                         method : 'GET'\r
413                       });\r
414                       Roo.MessageBox.alert("Notice", "Report will download shortly");\r
415                       \r
416                   }
417                 }
418                }
419               ]
420              }
421             },
422             {
423              text : _this._strings['b155bf2beaeeb2018389eded7c74b56f'] /* Customer History */,
424              xns : Roo.menu,
425              '|xns' : 'Roo.menu',
426              xtype : 'Item',
427              menu : {
428               xns : Roo.menu,
429               '|xns' : 'Roo.menu',
430               xtype : 'Menu',
431               items  : [
432                {
433                 text : _this._strings['36dc4ac22a9c9aa45d359e55937499da'] /* as PDF */,
434                 xns : Roo.menu,
435                 '|xns' : 'Roo.menu',
436                 xtype : 'Item',
437                 listeners : {
438                  click : function (_self, e)
439                   {
440                       var cust_id = _this.form.findField('cohead_cust_id').getValue();
441                       if (cust_id * 1 < 1) {
442                           Roo.Msg.alert('Error', 'Please select a customer');
443                           return;
444                       }
445                       
446                       var from = _this.form.findField('_fromdate').getValue();
447                       var to = _this.form.findField('_todate').getValue();
448                       
449                       if(!from || !to){
450                           Roo.Msg.alert('Error', 'Please select a date range for the report');
451                           return;
452                       }
453                       
454                       var params  =   {
455                           template: 'customer_ar_history',
456                           filename : 'customer_ar_history-' + to.format('Y-m-d'),
457                           'param[0]':   "startDate:string='" + from.format('Y-m-d') + "'",
458                           'param[1]':   "endDate:string='" + to.format('Y-m-d') + "'",
459                           'param[2]':   "cust_id:number=" + cust_id
460                       };
461                            
462                       new Pman.Download({
463                           url : baseURL + '/Xtuple/Print',
464                           params :   params,
465                           method : 'GET'
466                       });
467                       Roo.MessageBox.alert("Notice", "Report will download shortly");
468                   }
469                 }
470                },
471                {
472                 text : _this._strings['8f3e1295a3a1d30b6ee5d8de6e0b8c0a'] /* as Excel */,
473                 xns : Roo.menu,
474                 '|xns' : 'Roo.menu',
475                 xtype : 'Item',
476                 listeners : {
477                  click : function (_self, e)
478                   {
479                       var cust_id = _this.form.findField('cohead_cust_id').getValue();
480                       if (cust_id * 1 < 1) {
481                           Roo.Msg.alert('Error', 'Please select a customer');
482                           return;
483                       }
484                       
485                       var from = _this.form.findField('_fromdate').getValue();
486                       var to = _this.form.findField('_todate').getValue();
487                       
488                     
489                       
490                       var params = {
491                           '_group' : 'customerHistory',
492                           '_name' : 'detail',
493                           'limit' : 99999,
494                           
495                           'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,
496                           'endDate:text' : to ? to.format('Y-m-d') : '2100-01-01',
497                          
498                           'cust_id:number' : cust_id,
499                           'csvTitles' : '*',
500                           'csvCols' : '*'
501                       };
502                       
503                       
504                       new Pman.Download({\r
505                         url : baseURL + '/Roo/Metasql',\r
506                         params :   params,\r
507                         method : 'GET'\r
508                       });\r
509                       Roo.MessageBox.alert("Notice", "Report will download shortly");
510                   }
511                 }
512                }
513               ]
514              }
515             },
516             {
517              text : _this._strings['bf2234cf486127ba73efe4b2986eed78'] /* Customer Statement */,
518              xns : Roo.menu,
519              '|xns' : 'Roo.menu',
520              xtype : 'Item',
521              menu : {
522               xns : Roo.menu,
523               '|xns' : 'Roo.menu',
524               xtype : 'Menu',
525               items  : [
526                {
527                 text : _this._strings['36dc4ac22a9c9aa45d359e55937499da'] /* as PDF */,
528                 xns : Roo.menu,
529                 '|xns' : 'Roo.menu',
530                 xtype : 'Item',
531                 listeners : {
532                  click : function (_self, e)
533                   {
534                       var cust_id = _this.form.findField('cohead_cust_id').getValue();
535                       if (cust_id * 1 < 1) {
536                           Roo.Msg.alert('Error', 'Please select a customer');
537                           return;
538                       }
539                       
540                       var from = _this.form.findField('_fromdate').getValue();
541                       var to = _this.form.findField('_todate').getValue();
542                       
543                    
544                        
545                       var params  =   {
546                           template: 'customer_ar_statement',
547                           filename : 'customer_ar_statement-' +(to ? to.format('Y-m-d') : '2100-01-01'),
548                           'param[0]':   "startDate:string='" + (from ? from.format('Y-m-d') : '2000-01-01') + "'",
549                           'param[1]':   "asofdate:string='" + (to ? to.format('Y-m-d') : '2100-01-01')+ "'",
550                           'param[2]':   "cust_id:number=" + cust_id
551                       };
552                       
553                       new Pman.Download({
554                           url : baseURL + '/Xtuple/Print',
555                           params :   params,
556                           method : 'GET'
557                       });
558                       Roo.MessageBox.alert("Notice", "Report will download shortly");
559                   }
560                 }
561                },
562                {
563                 text : _this._strings['8f3e1295a3a1d30b6ee5d8de6e0b8c0a'] /* as Excel */,
564                 xns : Roo.menu,
565                 '|xns' : 'Roo.menu',
566                 xtype : 'Item',
567                 listeners : {
568                  click : function (_self, e)
569                   {
570                       var cust_id = _this.form.findField('cohead_cust_id').getValue();
571                       if (cust_id * 1 < 1) {
572                           Roo.Msg.alert('Error', 'Please select a customer');
573                           return;
574                       }
575                       
576                      var from = _this.form.findField('_fromdate').getValue();
577                      var to = _this.form.findField('_todate').getValue();
578                   
579                       //if(!from || !to){
580                       //    Roo.Msg.alert('Error', 'Please select a date range for the report');
581                       //    return;
582                       //}
583                       
584                       var params = {
585                           '_group' : 'customerStatement',
586                           '_name' : 'detail',
587                           'limit' : 99999,
588                           'startDate:text' : from ? from.format('Y-m-d') : '2000-01-01' ,
589                           'asofdate:text' : to ? to.format('Y-m-d') : '2100-01-01',
590                           'cust_id:number' : cust_id,
591                           'csvTitles' : '*',
592                           'csvCols' : '*'
593                       };
594                   
595                       
596                       new Pman.Download({\r
597                         url : baseURL + '/Roo/Metasql',\r
598                         params :   params,\r
599                         method : 'GET'\r
600                       });\r
601                       Roo.MessageBox.alert("Notice", "Report will download shortly");
602                   }
603                 }
604                }
605               ]
606              }
607             }
608            ]
609           }
610          },
611          {
612           cls : 'x-btn-text-icon',
613           icon : Roo.rootURL + 'images/default/dd/email.gif',
614           text : _this._strings['f313afd5710eeea203821d3201cc27d8'] /* Email to warehouse */,
615           xns : Roo.Toolbar,
616           '|xns' : 'Roo.Toolbar',
617           xtype : 'Button',
618           listeners : {
619            click : function (_self, e)
620             {
621                 var sels = _this.grid.getSelectionModel().getSelections();
622                 
623                 if (!sels.length) {
624                     Roo.MessageBox.alert("Error", "Select an order");
625                     return;
626                 }
627                 var ids = [];
628                 for (var i =0; i < sels.length; i++) {
629                     var s = sels[i];    
630                     
631                     if(s.data.cohead_qtyuninvoiced * 1 > 0){
632                         Roo.MessageBox.alert("Error", "Order has not been invoiced! - " + s.data.cohead_number);
633                         return;
634                     }
635                     
636                     if(s.data.aropen_unpaid * 1 > 0){
637                         Roo.MessageBox.alert("Error", "Order has not been paid! - "  + s.data.cohead_number);
638                         return;
639                     }
640                     ids.push(s.data.cohead_id);
641                 }
642                 
643                 new Pman.Download({\r
644                   url : baseURL + '/Xtuple/Reports/SalesOrderBookingDetail',\r
645                   params :   {
646                         cohead_id : ids.join(',')
647                   },\r
648                   method : 'GET'\r
649                 });\r
650                 
651                 Roo.MessageBox.alert("Notice", "Report will download shortly");
652             }
653           }
654          },
655          {
656           cls : 'x-btn-text-icon',
657           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
658           text : _this._strings['1c5b744a085a30924e4436c89a79027e'] /* Complete and Close */,
659           xns : Roo.Toolbar,
660           '|xns' : 'Roo.Toolbar',
661           xtype : 'Button',
662           listeners : {
663            click : function()
664             {
665                 var s = _this.grid.getSelectionModel().getSelected();
666                 if (!s) {
667                     Roo.MessageBox.alert("Error", "Select an order to close");
668                     return;
669                 }
670                 
671                 if(s.data.cohead_status == 'C'){
672                     Roo.MessageBox.alert("Error", "This order has been closed");
673                     return;
674                 }
675                 
676                 Roo.MessageBox.confirm("Confirm", "Are you sure?",
677                     function(v) {
678                         if (v != 'yes') {
679                             return;
680                         }
681                         new Pman.Request({
682                             url: baseURL + '/Roo/cohead',
683                             method : 'POST',
684                             params :  {
685                                 cohead_id : s.data.cohead_id,
686                                 _close : 1
687                             },
688                             mask : 'Sending',
689                             success : function()
690                             {
691                                 Roo.MessageBox.alert("Notice", "DONE");
692                                 _this.grid.footer.onClick('first');
693                             }
694                        });
695                     }
696                 );
697                 
698                 
699             }
700           }
701          },
702          {
703           cls : 'x-btn-text-icon',
704           icon : Roo.rootURL + 'images/default/tree/leaf.gif',
705           text : _this._strings['959462c653dede23e7152b97b45a8aa5'] /* Clear Unpaid Orders */,
706           xns : Roo.Toolbar,
707           '|xns' : 'Roo.Toolbar',
708           xtype : 'Button',
709           listeners : {
710            click : function()
711             {
712                 
713                 new Pman.Request({
714                     url: baseURL + '/Roo/cohead',
715                     method : 'POST',
716                     params :  {
717                         _clearUnpaid : 1
718                     },
719                     mask : 'Clearing',
720                     success : function()
721                     {
722                         Roo.MessageBox.alert("Notice", "DONE");
723                         _this.grid.footer.onClick('first');
724                     }
725                });
726                 
727             }
728           }
729          },
730          {
731           xns : Roo.Toolbar,
732           '|xns' : 'Roo.Toolbar',
733           xtype : 'Fill'
734          },
735          {
736           cls : 'x-btn-text-icon',
737           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
738           text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
739           xns : Roo.Toolbar,
740           '|xns' : 'Roo.Toolbar',
741           xtype : 'Button',
742           listeners : {
743            click : function()
744             {
745                // check if the login in user have more than 25 open orders..
746                // if yes, warning...
747                new Pman.Request({
748                     url : baseURL + '/Roo/cohead.php',
749                     method :'GET',
750                     params : {
751                         viewtype : 'MYOPEN',
752                         _count_order : 1 // make the search faster!
753                     },
754                     success : function(res) {
755                         if(res.data[0].order_totals * 1 > 25){
756                             Roo.MessageBox.alert("Warning", "Can you please close old orders before creating new ones");
757                         }
758                     }
759                 });
760                
761                Pman.Dialog.XtupleSalesOrderNew.show( { id : 0 } , function() {
762                     _this.grid.footer.onClick('first');
763                }); 
764             }
765           }
766          },
767          {
768           cls : 'x-btn-text-icon',
769           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
770           text : _this._strings['5fb63579fc981698f97d55bfecb213ea'] /* Copy */,
771           xns : Roo.Toolbar,
772           '|xns' : 'Roo.Toolbar',
773           xtype : 'Button',
774           listeners : {
775            click : function()
776             {
777                var s = _this.grid.getSelectionModel().getSelected();
778                if (!s) {
779                     Roo.MessageBox.alert("Error", "Select an order to copy");
780                     return;
781                }
782                
783                
784                Pman.Dialog.XtupleSalesOrderCopy.show( { _copy_cohead_id : s.data.cohead_id } , function(data) {
785                
786                     // get the id from the data, then 
787                
788                     _this.grid.footer.onClick('first');
789                     Pman.Tab.XtupleSales.grid.footer.onClick('first');
790                     // get the id from the data, then start editing it..
791                     Roo.log(data);
792                         _this.dialog.show(data,  function() {
793                         _this.grid.footer.onClick('refresh');
794                         Pman.Tab.XtupleSales.grid.footer.onClick('first');
795                     }); 
796                     
797                }); 
798             }
799           }
800          }
801         ]
802        },
803        dataSource : {
804         builderCfg : '{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
805         remoteSort : true,
806         sortInfo : { field : 'cohead_orderdate', direction: 'DESC' },
807         xns : Roo.data,
808         '|xns' : 'Roo.data',
809         xtype : 'Store',
810         listeners : {
811          beforeload : function (_self, options)
812           {
813               var vl;
814               try { 
815                    vl = _this.form.getFieldValues();
816                } catch (e) {
817                   vl = {};
818                }
819           
820                
821                
822               for(var x in vl) {
823                   if (!(new String(vl[x])).length) {
824                       continue;
825                   }
826                   options.params[x] = vl[x];
827                   
828               }
829               try {
830                   if (options.params['query[cohead_number]'].length) {
831                       options.params.viewtype = 'REALALL';
832                   }
833               } catch (e) {}
834           }
835         },
836         proxy : {
837          method : 'GET',
838          timeout : 60000,
839          url : baseURL + '/Roo/cohead.php',
840          xns : Roo.data,
841          '|xns' : 'Roo.data',
842          xtype : 'HttpProxy'
843         },
844         reader : {
845          builderCfg : '{\"cols\":[{\"table\":\"cohead\",\"column\":\"cohead_number\",\"columnshort\":\"cohead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#order\"},{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"},{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"},{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"},{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"},{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"},{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"},{\"table\":\"curr_symbol\",\"column\":\"cohead_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\"}],\"cols_ex\":[\"cohead_cust_id_cust_name\"],\"table\":\"cohead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
846          fields : [
847              {
848                  'name': 'cohead_number',
849                  'type': 'string'
850              },
851              {
852                  'name': 'cohead_cust_id_cust_name',
853                  'type': 'string'
854              },
855              {
856                  'name': 'cohead_custponumber',
857                  'type': 'string'
858              },
859              {
860                  'name': 'cohead_type'
861              },
862              {
863                  'name': 'cohead_orderdate',
864                  'type': 'date'
865              },
866              {
867                  'name': 'cohead_shipto_id_shipto_name',
868                  'type': 'string'
869              },
870              {
871                  'name': 'cohead_terms_id_terms_descrip',
872                  'type': 'string'
873              },
874              {
875                  'name': 'cohead_curr_id_curr_name',
876                  'type': 'string'
877              }
878          ],
879          id : 'id',
880          root : 'data',
881          totalProperty : 'total',
882          xns : Roo.data,
883          '|xns' : 'Roo.data',
884          xtype : 'JsonReader'
885         }
886        },
887        colModel : [
888         {
889          builderCfg : '{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}',
890          dataIndex : 'cohead_orderdate',
891          header : _this._strings['26e09a1ee1517389c7b07f42df65561a'] /* Ordered */,
892          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
893          sortable : true,
894          width : 75,
895          xns : Roo.grid,
896          '|xns' : 'Roo.grid',
897          xtype : 'ColumnModel'
898         },
899         {
900          dataIndex : 'cohead_targetdate',
901          header : _this._strings['a2fdeac60e3c5b6c51a92e027fb9d533'] /* Target Delivery */,
902          hidden : true,
903          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
904          sortable : true,
905          width : 75,
906          xns : Roo.grid,
907          '|xns' : 'Roo.grid',
908          xtype : 'ColumnModel'
909         },
910         {
911          builderCfg : '{\"table\":\"cohead\",\"column\":\"cohead_orderdate\",\"columnshort\":\"cohead_orderdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ordered\"}',
912          dataIndex : 'cohead_salesrep_id_salesrep_name',
913          header : _this._strings['3f7488c396d3d4e015d8886452db4110'] /* Staff IC. */,
914          renderer : function(v,x,r) { 
915          
916              if (r.data.cohead_display_salesrep_id) {
917                  return String.format('{0} ({1})', v, r.data.cohead_display_salesrep_id_salesrep_name);
918              }
919              return String.format('{0}', v );
920              
921              
922           },
923          sortable : true,
924          width : 100,
925          xns : Roo.grid,
926          '|xns' : 'Roo.grid',
927          xtype : 'ColumnModel'
928         },
929         {
930          dataIndex : 'cohead_number',
931          header : _this._strings['54ca6e7fdb43298ae82cd9cb04e77f9b'] /* #order */,
932          renderer : function(v,x,r) {
933          
934                
935                // we want to show more detail about status..
936                // like payment status / delivery etc...
937                
938                // I = invoiced
939                // R = Reserved
940                // S = shipped (or partial shipped)
941                // P = paid (or partial paid)
942                // online payment failed? >> on terms?
943                // 
944                var tags = {
945                  invoiced : '<span class="dragon-so-complete" qtip="Invoiced">I</span>',
946                  invoiced_not : '<span class="dragon-so-complete-not"  qtip="Not Invoiced">I</span>',
947                  stock_not : '<span class="dragon-so-complete-not" qtip="Stock not reserved or shipped">S</span>',        
948                  stock_reserved : '<span class="dragon-so-complete-part" qtip="Stock Reserved / Not shipped">R</span>',
949                  stock_shipped : '<span class="dragon-so-complete" qtip="Shipped">S</span>',
950                  paid : '<span class="dragon-so-complete" qtip="Paid">P</span>',
951                  paid_not : '<span class="dragon-so-complete-not" qtip="Not Paid">P</span>'
952              };        
953               
954               // invoiced
955               var tg = '';
956               
957                 // stock status...
958               if (r.data.cohead_qtyunshipped > 0) {
959                    
960                    tg +=  (r.data.shipitem_qty*1 > 0)  ? tags.stock_reserved :tags.stock_not;
961               }     else {
962               
963                   tg +=  tags.stock_shipped;
964              }
965               
966               tg += (r.data.cohead_qtyuninvoiced > 0) ? tags.invoiced_not : tags.invoiced;
967               // ?? partially invoiced??
968               
969               
970               if (r.data.cohead_qtyuninvoiced*1 < 1) {
971                    tg += (r.data.aropen_unpaid*1 > 0) ? tags.paid_not : tags.paid;
972                }
973               
974               
975               
976              // payment status??
977          
978                if (r.data.cohead_status == 'C') {
979                    return tg + ' ' + String.format('<i qtip="closed">{0}</i>', v); 
980                }
981                if (r.data.cohead_status == 'X') {
982                    return tg + ' ' +  String.format('<s qtip="void">{0}</s>', v)  ; 
983                }
984                return tg + ' ' + String.format('{0}', v); 
985           },
986          sortable : true,
987          width : 100,
988          xns : Roo.grid,
989          '|xns' : 'Roo.grid',
990          xtype : 'ColumnModel'
991         },
992         {
993          builderCfg : '{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}',
994          dataIndex : 'cohead_cust_id_cust_number',
995          header : _this._strings['2d899459cc25ea99ea2573d592860ec8'] /* Customer# */,
996          renderer : function(v) { return String.format('{0}', v); },
997          sortable : true,
998          width : 100,
999          xns : Roo.grid,
1000          '|xns' : 'Roo.grid',
1001          xtype : 'ColumnModel'
1002         },
1003         {
1004          builderCfg : '{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}',
1005          dataIndex : 'cohead_cust_id_cust_name',
1006          header : _this._strings['ce26601dac0dea138b7295f02b7620a7'] /* Customer */,
1007          renderer : function(v) { return String.format('{0}', v); },
1008          sortable : true,
1009          width : 200,
1010          xns : Roo.grid,
1011          '|xns' : 'Roo.grid',
1012          xtype : 'ColumnModel'
1013         },
1014         {
1015          builderCfg : '{\"table\":\"cohead\",\"column\":\"cohead_custponumber\",\"columnshort\":\"cohead_custponumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust. PO#\"}',
1016          dataIndex : 'cohead_custponumber',
1017          header : _this._strings['fdb35c1a9883acaa94378144a114dfe6'] /* Cust. PO# */,
1018          renderer : function(v) { return String.format('{0}', v); },
1019          width : 50,
1020          xns : Roo.grid,
1021          '|xns' : 'Roo.grid',
1022          xtype : 'ColumnModel'
1023         },
1024         {
1025          builderCfg : '{\"table\":\"cohead\",\"column\":\"cohead_type\",\"columnshort\":\"cohead_type\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Type\"}',
1026          dataIndex : 'cohead_type',
1027          header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'] /* Type */,
1028          renderer : function(v) { return String.format('{0}', v); },
1029          width : 50,
1030          xns : Roo.grid,
1031          '|xns' : 'Roo.grid',
1032          xtype : 'ColumnModel'
1033         },
1034         {
1035          dataIndex : 'cohead_src_locations',
1036          header : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
1037          renderer : function(v) { return String.format('{0}', v); },
1038          width : 100,
1039          xns : Roo.grid,
1040          '|xns' : 'Roo.grid',
1041          xtype : 'ColumnModel'
1042         },
1043         {
1044          builderCfg : '{\"table\":\"shiptoinfo\",\"column\":\"cohead_shipto_id_shipto_name\",\"columnshort\":\"shipto_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship to\"}',
1045          dataIndex : 'cohead_shiptoaddress1',
1046          header : _this._strings['74002cb040b036511b8d031da591364a'] /* Ship to */,
1047          renderer : function(v) { return String.format('{0}', v); },
1048          width : 200,
1049          xns : Roo.grid,
1050          '|xns' : 'Roo.grid',
1051          xtype : 'ColumnModel'
1052         },
1053         {
1054          builderCfg : '{\"table\":\"terms\",\"column\":\"cohead_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\"}',
1055          dataIndex : 'cohead_terms_id_terms_descrip',
1056          header : _this._strings['6f1bf85c9ebb3c7fa26251e1e335e032'] /* Terms */,
1057          renderer : function(v) { return String.format('{0}', v); },
1058          width : 100,
1059          xns : Roo.grid,
1060          '|xns' : 'Roo.grid',
1061          xtype : 'ColumnModel'
1062         },
1063         {
1064          dataIndex : 'cohead_ordercomments',
1065          header : _this._strings['f4c6f851b00d5518bf888815de279aba'] /* Notes */,
1066          hidden : true,
1067          renderer : function(v) { return String.format('{0}', v); },
1068          width : 100,
1069          xns : Roo.grid,
1070          '|xns' : 'Roo.grid',
1071          xtype : 'ColumnModel'
1072         },
1073         {
1074          align : 'right',
1075          dataIndex : 'cohead_total',
1076          header : _this._strings['96b0141273eabab320119c467cdcaf17'] /* Total */,
1077          renderer : function(v,x,r) { 
1078              var ret =  String.format('{0} {1}',
1079                   r.data.cohead_curr_id_curr_name, v ?   parseFloat(v).toFixed(3) : '---'
1080               ); 
1081               
1082               if (parseInt(r.data.cohead_qtyordered)  != 0 && 
1083                  parseInt(r.data.cohead_unshipped) == 0 && 
1084                   parseInt(r.data.cohead_qtyunshipped) == 0 &&
1085                   parseInt(r.data.cohead_qtyuninvoiced) == 0 &&         
1086                    parseInt(r.data.cohead_unshipped) == 0 &&
1087                   parseInt(r.data.cohead_uninvoiced) == 0 
1088               ) {
1089                  return ret;
1090              }
1091               
1092               return String.format('<b style="color:red" ' + 
1093                      'qtip="Products: {3} ({4}) &lt;BR/&gt;Unshipped: {1} ({5})&lt;BR&gt;Uninvoiced: {2} ({6})">{0}</b>',
1094                   ret, 
1095                      r.data.cohead_unshipped, r.data.cohead_uninvoiced, r.data.cohead_subtotal,
1096                      r.data.cohead_qtyordered, r.data.cohead_qtyunshipped, r.data.cohead_qtyuninvoiced
1097                   );
1098               
1099           },
1100          width : 100,
1101          xns : Roo.grid,
1102          '|xns' : 'Roo.grid',
1103          xtype : 'ColumnModel'
1104         }
1105        ]
1106       }
1107      },
1108      {
1109       background : false,
1110       region : 'west',
1111       xns : Roo,
1112       '|xns' : 'Roo',
1113       xtype : 'ContentPanel',
1114       toolbar : {
1115        xns : Roo,
1116        '|xns' : 'Roo',
1117        xtype : 'Toolbar',
1118        items  : [
1119         {
1120          xns : Roo.Toolbar,
1121          '|xns' : 'Roo.Toolbar',
1122          xtype : 'Fill'
1123         },
1124         {
1125          cls : 'x-btn-icon',
1126          icon : rootURL + '/Pman/templates/images/search.gif',
1127          xns : Roo.Toolbar,
1128          '|xns' : 'Roo.Toolbar',
1129          xtype : 'Button',
1130          listeners : {
1131           click : function (_self, e)
1132            {
1133            _this.grid.footer.onClick('first');
1134            }
1135          }
1136         },
1137         {
1138          cls : 'x-btn-icon',
1139          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
1140          xns : Roo.Toolbar,
1141          '|xns' : 'Roo.Toolbar',
1142          xtype : 'Button',
1143          listeners : {
1144           click : function (_self, e)
1145            {
1146                _this.form.reset('');
1147            
1148                
1149                _this.grid.footer.onClick('first');
1150            }
1151          }
1152         }
1153        ]
1154       },
1155       items  : [
1156        {
1157         labelAlign : 'top',
1158         method : 'POST',
1159         style : 'margin:5px;',
1160         xns : Roo.form,
1161         '|xns' : 'Roo.form',
1162         xtype : 'Form',
1163         listeners : {
1164          rendered : function (form)
1165           {
1166               _this.form= form;
1167           }
1168         },
1169         items  : [
1170          {
1171           allowBlank : false,
1172           displayField : 'value',
1173           editable : false,
1174           emptyText : _this._strings['3e208ad5d41ca414bb432adbb7d39c33'] /* View type */,
1175           fieldLabel : _this._strings['4351cfebe4b61d8aa5efa1d020710005'] /* View */,
1176           forceSelection : true,
1177           listWidth : 200,
1178           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1179           minChars : 2,
1180           name : 'viewtype',
1181           pageSize : 20,
1182           qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */,
1183           queryParam : 'query[action]',
1184           selectOnFocus : true,
1185           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>',
1186           triggerAction : 'all',
1187           typeAhead : true,
1188           value : _this._strings['8db91c5e3376bc85414ebca9c53fb53f'] /* MYOPEN */,
1189           valueField : 'key',
1190           width : 150,
1191           xns : Roo.form,
1192           '|xns' : 'Roo.form',
1193           xtype : 'ComboBox',
1194           listeners : {
1195            render : function (_self)
1196             {
1197               _this.viewtypeSel = _self;
1198             },
1199            select : function (combo, record, index)
1200             {
1201               _this.grid.footer.onClick('first');
1202             }
1203           },
1204           store : {
1205            data : [
1206              [ 'MYOPEN', 'My Open orders' ],
1207              [ 'MYCLOSED', 'My Closed orders' ],
1208              [ 'MYALL', 'My orders (all)' ],    
1209              [ 'MYVOID', 'My Voided orders' ],      
1210              [ 'OPEN', 'All Open orders' ],
1211              [ 'NOTSHIPPED', 'All Un-shipped orders' ],
1212              [ 'NOTPAID', 'All Un-paid orders' ],
1213              [ 'PAIDNOTSHIPPED', 'All paid / not shipped orders' ],  
1214              [ 'CLOSED', 'All Closed orders' ],
1215              
1216              [ 'ALL', 'All orders' ],
1217              [ 'VOID', 'Voided orders' ],
1218              [ 'INCOMPLETE', 'Incomplete orders' ],  
1219              [ 'DRAFTSHIP', 'Have Un-confirmed Shipments' ],
1220            //  [ 'SHIPPOSTBUG', 'Bugs with Posted transactions' ],  
1221            //  [ 'SHIPQTYBUG', 'Bugs with Shipment Qty' ] ,
1222              [ 'FIFOBUG', 'Problems with FIFO' ] 
1223                
1224            ],
1225            fields : [ 'key', 'value' ],
1226            id : 0,
1227            xns : Roo.data,
1228            '|xns' : 'Roo.data',
1229            xtype : 'SimpleStore'
1230           }
1231          },
1232          {
1233           allowBlank : true,
1234           displayField : 'cohead_number',
1235           editable : true,
1236           emptyText : _this._strings['f38ab62162b94b4978679aeca58a270c'] /* Select Order */,
1237           fieldLabel : _this._strings['d1228f5476d15142b1358ae4b5fa2454'] /* Order # */,
1238           forceSelection : false,
1239           listWidth : 400,
1240           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1241           minChars : 2,
1242           name : 'query[cohead_number]',
1243           pageSize : 20,
1244           qtip : _this._strings['f38ab62162b94b4978679aeca58a270c'] /* Select Order */,
1245           queryParam : 'query[cohead_number]',
1246           selectOnFocus : true,
1247           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cohead_number}</b> </div>',
1248           triggerAction : 'all',
1249           typeAhead : false,
1250           valueField : 'cohead_number',
1251           width : 180,
1252           xns : Roo.form,
1253           '|xns' : 'Roo.form',
1254           xtype : 'ComboBox',
1255           listeners : {
1256            beforequery : function (combo, query, forceAll, cancel, e)
1257             {
1258              
1259                if( _this.rsearch) {
1260                     _this.rsearch =false;
1261                     return false;
1262                 }
1263              
1264             },
1265            select : function (combo, record, index)
1266             {
1267                 (function() { _this.grid.footer.onClick('first'); }).defer(100);
1268             },
1269            specialkey : function (_self, e)
1270             {
1271                 //Roo.log(e.getKey());
1272                 if (e.getKey() == 13) {
1273                     (function() { _this.grid.footer.onClick('first'); }).defer(100);
1274                     e.stopEvent();
1275                     _this.rsearch = true;
1276                 }
1277                 
1278             }
1279           },
1280           store : {
1281            remoteSort : true,
1282            sortInfo : { direction : 'ASC', field: 'cohead_number' },
1283            xns : Roo.data,
1284            '|xns' : 'Roo.data',
1285            xtype : 'Store',
1286            listeners : {
1287             beforeload : function (_self, o){
1288                  o.params = o.params || {};
1289                  o.params['_columns'] = 'cohead_number';
1290                  // set more here
1291              }
1292            },
1293            proxy : {
1294             method : 'GET',
1295             url : baseURL + '/Roo/cohead.php',
1296             xns : Roo.data,
1297             '|xns' : 'Roo.data',
1298             xtype : 'HttpProxy'
1299            },
1300            reader : {
1301             fields : ["cohead_number"],
1302             id : 'cohead_number',
1303             root : 'data',
1304             totalProperty : 'total',
1305             xns : Roo.data,
1306             '|xns' : 'Roo.data',
1307             xtype : 'JsonReader'
1308            }
1309           }
1310          },
1311          {
1312           allowBlank : true,
1313           displayField : 'cust_name',
1314           editable : true,
1315           emptyText : _this._strings['fce6d3795b41b54dc0dab82df50517c1'] /* Select custinfo */,
1316           fieldLabel : _this._strings['ce26601dac0dea138b7295f02b7620a7'] /* Customer */,
1317           forceSelection : true,
1318           hiddenName : 'cohead_cust_id',
1319           listWidth : 400,
1320           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
1321           minChars : 2,
1322           name : 'cohead_cust_id_cust_name',
1323           pageSize : 20,
1324           qtip : _this._strings['fce6d3795b41b54dc0dab82df50517c1'] /* Select custinfo */,
1325           queryParam : 'query[cust_name]',
1326           selectOnFocus : true,
1327           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b>  ({cust_number})</div>',
1328           triggerAction : 'all',
1329           typeAhead : false,
1330           valueField : 'cust_id',
1331           width : 180,
1332           xns : Roo.form,
1333           '|xns' : 'Roo.form',
1334           xtype : 'ComboBox',
1335           listeners : {
1336            select : function (combo, record, index)
1337             {
1338                    (function() { _this.grid.footer.onClick('first'); }).defer(100);
1339             }
1340           },
1341           store : {
1342            remoteSort : true,
1343            sortInfo : { direction : 'ASC', field: 'cust_name' },
1344            xns : Roo.data,
1345            '|xns' : 'Roo.data',
1346            xtype : 'Store',
1347            listeners : {
1348             beforeload : function (_self, o){
1349                  o.params = o.params || {};
1350                  // set more here
1351              }
1352            },
1353            proxy : {
1354             method : 'GET',
1355             url : baseURL + '/Roo/custinfo.php',
1356             xns : Roo.data,
1357             '|xns' : 'Roo.data',
1358             xtype : 'HttpProxy'
1359            },
1360            reader : {
1361             fields : [{"name":"cust_id","type":"int"},"cust_name"],
1362             id : 'cust_id',
1363             root : 'data',
1364             totalProperty : 'total',
1365             xns : Roo.data,
1366             '|xns' : 'Roo.data',
1367             xtype : 'JsonReader'
1368            }
1369           }
1370          },
1371          {
1372           fieldLabel : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
1373           format : 'Y-m-d',
1374           name : '_fromdate',
1375           width : 100,
1376           xns : Roo.form,
1377           '|xns' : 'Roo.form',
1378           xtype : 'DateField',
1379           listeners : {
1380            select : function (combo, date)
1381             {
1382                 _this.grid.footer.onClick('first');
1383             }
1384           }
1385          },
1386          {
1387           fieldLabel : _this._strings['e12167aa0a7698e6ebc92b4ce3909b53'] /* To */,
1388           format : 'Y-m-d',
1389           name : '_todate',
1390           width : 100,
1391           xns : Roo.form,
1392           '|xns' : 'Roo.form',
1393           xtype : 'DateField',
1394           listeners : {
1395            select : function (combo, date)
1396             {
1397                 _this.grid.footer.onClick('first');
1398             }
1399           }
1400          }
1401         ]
1402        }
1403       ]
1404      }
1405     ]
1406    }
1407   };  }
1408 });