1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtupleCustomer = new Roo.XComponent({
6 part : ["Xtuple","Customer"],
7 order : '700-Pman.Tab.XtupleCustomer',
9 parent : 'Pman.Tab.XtupleSales',
10 name : "unnamed module",
21 activate : function() {
24 _this.grid.footer.onClick('first');
32 tableName : 'custinfo',
41 _this.dialog = Pman.Dialog.XtupleCustomer;
42 if (_this.panel.active) {
43 this.footer.onClick('first');
46 rowdblclick : function (_self, rowIndex, e)
48 if (!_this.dialog) return;
49 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
50 _this.grid.footer.onClick('refresh');
54 autoExpandColumn : 'cust_name',
60 beforeload : function (_self, o)
62 if (!_this.officeCombo) {
66 o.params = o.params || {};
67 o.params['search[cust_name]'] = _this.searchBox.getValue();
68 if (!_this.activeBtn.pressed) {
69 o.params.cust_active = 1;
71 var dt = _this.dateSearch.getValue();
73 o.params['search[orders_since]'] = dt.format('Y-m-d');
75 dt = _this.dateSearchNo.getValue();
77 o.params['search[no_orders_since]'] = dt.format('Y-m-d');
80 o.params['search[with_orders_since]'] = 1; //
81 o.params['search[with_balance]'] = 1;
82 o.params['search[with_address]'] = 1;
83 o.params['_with_char'] = 1;
84 o.params['_with_group_data'] = 1;
85 o.params['search[_country]'] = _this.country.getValue();
86 o.params._get = 1; // for download
88 o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();
92 sortInfo : { field : 'cust_name', direction: 'ASC' },
97 url : baseURL + '/Roo/custinfo.php'
102 totalProperty : 'total',
107 'name': 'cust_active',
111 'name': 'cust_custtype_id_custtype_descrip',
115 'name': 'cust_salesrep_id_salesrep_name',
126 xtype: 'PagingToolbar',
130 displayMsg : "Displaying custinfo{0} - {1} of {2}",
131 emptyMsg : "No custinfo found",
136 text : "Upload/Download",
145 click : function (_self, e)
148 if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
149 Roo.MessageBox.alert("Error", "Permission Denied");
152 _this.grid.ds.proxy.conn.method = 'POST';
159 text : "Download Customers"
165 click : function (_self, e)
168 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
169 Roo.MessageBox.alert("Error", "Permission Denied");
173 var c = _this.country.getValue();
175 Roo.MessageBox.alert("Error", "Please select a country");
180 url : baseURL + '/Roo/custinfo',
185 'search[_country]' : c,
186 'search[with_address]' : 1
192 text : "Download Customers As Json"
198 click : function (_self, e)
201 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
202 Roo.MessageBox.alert("Error", "Permission Denied");
206 Pman.Dialog.Image.show(
208 _url : baseURL+'/Xtuple/Import/Customers'
212 _this.grid.footer.onClick('first');
213 Roo.MessageBox.alert("Notice", "DONE");
214 // Roo.MessageBox.alert("Notice", msg.join("\n"));
221 text : "Upload Customers"
227 click : function (_self, e)
230 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
231 Roo.MessageBox.alert("Error", "Permission Denied");
235 Pman.Dialog.Image.show(
237 _url : baseURL+'/Xtuple/Import/MyCustomers'
241 _this.grid.footer.onClick('first');
242 Roo.MessageBox.alert("Notice", "DONE");
243 // Roo.MessageBox.alert("Notice", msg.join("\n"));
250 text : "Upload Customers Json File"
256 click : function (_self, e)
259 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
260 Roo.MessageBox.alert("Error", "Permission Denied");
264 Pman.Dialog.Image.show(
266 _url : baseURL+'/Xtuple/Import/AUPostAccounts'
270 _this.grid.footer.onClick('first');
271 Roo.MessageBox.alert("Notice", data);
278 text : "Upload AU Post Accounts"
298 render : function (_self)
300 _this.searchBox = _self;
302 specialkey : function (_self, e)
304 _this.grid.footer.onClick('first');
312 click : function (_self, e)
314 _this.grid.footer.onClick('first');
318 icon : rootURL + '/Pman/templates/images/search.gif'
324 click : function (_self, e)
326 _this.searchBox.setValue('');
329 _this.grid.footer.onClick('first');
333 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
339 render : function (_self)
341 _this.officeCombo = _self;
343 select : function (combo, record, index)
346 _this.grid.footer.onClick('first');
350 displayField : 'office',
352 fieldLabel : 'Office',
353 hiddenName : 'office',
357 tpl : '<div class="x-grid-cell-text x-btn button"><b>{office}</b> </div>',
358 triggerAction : 'all',
359 valueField : 'office',
362 xtype: 'SimpleStore',
379 render : function (_self)
381 _this.country = _self;
383 select : function (combo, record, index)
385 _this.grid.footer.onClick('first');
390 displayField : 'addr_country',
392 emptyText : "Select Country",
393 fieldLabel : 'Country',
394 forceSelection : true,
395 hiddenName : 'addr_country',
397 loadingText : "Searching...",
399 name : 'addr_country',
401 qtip : "Select Country",
402 queryParam : 'query[addr_country]',
403 selectOnFocus : true,
404 tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_country}</b> </div>',
405 triggerAction : 'all',
407 valueField : 'addr_country',
413 beforeload : function (_self, o){
414 o.params = o.params || {};
415 o.params._distinct = 'addr_country';
416 o.params._columns ='addr_country';
420 sortInfo : { direction : 'ASC', field: 'addr_country' },
425 url : baseURL + '/Roo/Addr.php'
432 totalProperty : 'total',
433 fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}]
441 toggle : function (_self, pressed)
443 _this.grid.footer.onClick('first');
445 render : function (_self)
447 _this.activeBtn = _self;
452 text : "Show / Hide Inactive"
457 text : "Has orders since"
463 render : function (_self)
465 _this.dateSearch = _self
467 select : function (combo, date)
469 _this.grid.footer.onClick('first');
471 specialkey : function (_self, e)
473 _this.grid.footer.onClick('first');
481 text : "No orders since"
487 render : function (_self)
489 _this.dateSearchNo = _self
491 select : function (combo, date)
493 _this.grid.footer.onClick('first');
495 specialkey : function (_self, e)
497 _this.grid.footer.onClick('first');
512 if (!_this.dialog) return;
513 _this.dialog.show( { id : 0 } , function() {
514 _this.grid.footer.onClick('first');
518 cls : 'x-btn-text-icon',
520 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
528 var s = _this.grid.getSelectionModel().getSelections();
529 if (!s.length || (s.length > 1)) {
530 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
533 if (!_this.dialog) return;
534 _this.dialog.show(s[0].data, function() {
535 _this.grid.footer.onClick('first');
540 cls : 'x-btn-text-icon',
542 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
548 xtype: 'ColumnModel',
550 dataIndex : 'cust_active',
553 renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); }
556 xtype: 'ColumnModel',
558 dataIndex : 'last_order',
559 header : 'Last Order',
561 renderer : function(v) {
565 var vv = Date.parseDate(v, 'Y-m-d');
566 return String.format('{0}', vv.format('d/M/Y') );
570 xtype: 'ColumnModel',
572 dataIndex : 'cust_taxzone_id_taxzone_descrip',
573 header : 'Tax Status',
576 renderer : function(v) { return String.format('{0}', v); }
579 xtype: 'ColumnModel',
581 dataIndex : 'cust_terms_id_terms_descrip',
585 renderer : function(v) { return String.format('{0}', v); }
588 xtype: 'ColumnModel',
590 dataIndex : 'cust_salesrep_id_salesrep_name',
591 header : 'Sales Rep',
594 renderer : function(v) { return String.format('{0}', v); }
597 xtype: 'ColumnModel',
599 dataIndex : 'ipshead_id_name',
600 header : 'Curr/Price List',
603 renderer : function(v,x,r) {
605 return String.format('{0}<br/><span style="color:red">No price list</span>',
606 r.data.cust_curr_id_curr_name );
609 return String.format('{0}<br/>{1}',
610 r.data.cust_curr_id_curr_name,
615 xtype: 'ColumnModel',
617 dataIndex : 'cust_number',
621 renderer : function(v) { return String.format('{0}', v); }
624 xtype: 'ColumnModel',
626 dataIndex : 'cust_name',
630 renderer : function(v,x,r) {
631 if (!r.data.cust_char_internalcompany.length) {
632 return String.format('{0}', v);
634 return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
635 r.data.cust_char_internalcompany, v);
639 xtype: 'ColumnModel',
641 dataIndex : 'cust_bill_info',
642 header : 'Billing Address',
645 renderer : function(v,x,r)
649 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
\r
650 if (!r.data['cntct_addr_' + k].length) {
\r
653 add.push(String.format("{0}", r.data['cntct_addr_' + k]));
\r
656 return add.join('<BR/>');
659 var v = v.split("\r\n").join("<br/>");
664 xtype: 'ColumnModel',
666 dataIndex : 'cust_ship_info',
667 header : 'Shipping Address',
670 renderer : function(v,x,r)
674 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
\r
675 if (!r.data['cntct_addr_' + k].length) {
\r
678 add.push(String.format("{0}", r.data['cntct_addr_' + k]));
\r
681 return add.join('<BR/>');
684 var v = v.split("\r\n").join("<br/>");
689 xtype: 'ColumnModel',
691 dataIndex : 'cust_cntct_id_cntct_first_name',
695 renderer : function(v,x,r)
697 return String.format(
700 'Email: <a href="mailto:{2}">{2}</a>',
702 r.data.cust_cntct_id_cntct_first_name,
703 r.data.cust_cntct_id_cntct_phone,
704 r.data.cust_cntct_id_cntct_email
709 xtype: 'ColumnModel',
711 dataIndex : 'cust_char_au_post_accno',
716 renderer : function(v,x,r)
718 return String.format('{0}', v);
722 xtype: 'ColumnModel',
724 dataIndex : 'cust_cntct_id_cntct_phone',
725 header : 'Contact Number',
729 renderer : function(v,x,r)
731 return String.format('{0}',v);
735 xtype: 'ColumnModel',
737 dataIndex : 'cust_cntct_id_cntct_email',
742 renderer : function(v,x,r)
744 return String.format('<a href="mailto:{0}">{0}</a>', v);
748 xtype: 'ColumnModel',
751 dataIndex : 'cntct_addr_city',
756 renderer : function(v) { return String.format('{0}', v ? v : ''); }
759 xtype: 'ColumnModel',
762 dataIndex : 'cntct_addr_state',
767 renderer : function(v) { return String.format('{0}', v ? v : ''); }
770 xtype: 'ColumnModel',
773 dataIndex : 'cntct_addr_country',
777 renderer : function(v) { return String.format('{0}', v ? v : ''); }
780 xtype: 'ColumnModel',
782 dataIndex : 'cust_curr_id_curr_name',
786 renderer : function(v) { return String.format('{0}', v); }
789 xtype: 'ColumnModel',
792 dataIndex : 'balance',
795 renderer : function(v,x,r) {
798 return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2));