1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.XtupleCustomer = new Roo.XComponent({
8 part : ["Xtuple", "Customer" ],
9 order : '700-Pman.Tab.XtupleCustomer',
11 parent : 'Pman.Tab.XtupleSales',
12 name : "unnamed module",
24 url : baseURL + '/Roo/custinfo.php',
36 'name': 'cust_active',
40 'name': 'cust_custtype_id_custtype_descrip',
44 'name': 'cust_salesrep_id_salesrep_name',
53 builderCfg : '{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
54 totalProperty : 'total'
59 sortInfo : { field : 'cust_name', direction: 'ASC' },
62 beforeload : function (_self, o)
64 if (!_this.officeCombo) {
68 o.params = o.params || {};
69 o.params['search[_mix]'] = _this.searchBox.getValue();
70 if (!_this.activeBtn.pressed) {
71 o.params.cust_active = 1;
72 o.params.cust_aropen_active = 1;
74 var dt = _this.dateSearch.getValue();
76 o.params['search[orders_since]'] = dt.format('Y-m-d');
78 dt = _this.dateSearchNo.getValue();
80 o.params['search[no_orders_since]'] = dt.format('Y-m-d');
83 o.params['search[with_orders_since]'] = 1; //
84 o.params['search[with_balance]'] = 1;
85 o.params['search[with_address]'] = 1;
86 o.params['_with_char'] = 1;
87 o.params['_with_group_data'] = 1;
88 o.params['search[_country]'] = _this.country.getValue();
89 o.params._get = 1; // for download
91 o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();
102 xtype : 'PagingToolbar',
103 emptyMsg : "No custinfo found",
106 displayMsg : "Displaying custinfo{0} - {1} of {2}",
116 text : "Download Mailing list subscribers",
120 click : function (_self, e)
123 if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
124 Roo.MessageBox.alert("Error", "Permission Denied");
129 '_group' : 'customer',
130 '_name' : 'subscribers',
138 url : baseURL + '/Roo/Metasql',
143 Roo.MessageBox.alert("Notice", "Report will download shortly");
150 text : "Download Customers",
154 click : function (_self, e)
157 if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
158 Roo.MessageBox.alert("Error", "Permission Denied");
161 _this.grid.ds.proxy.conn.method = 'POST';
171 text : "Download Customers As Json",
175 click : function (_self, e)
178 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
179 Roo.MessageBox.alert("Error", "Permission Denied");
183 var c = _this.country.getValue();
185 Roo.MessageBox.alert("Error", "Please select a country");
190 url : baseURL + '/Roo/custinfo',
195 'search[_country]' : c,
196 'search[with_address]' : 1
205 text : "Upload Customers",
209 click : function (_self, e)
212 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
213 Roo.MessageBox.alert("Error", "Permission Denied");
217 Pman.Dialog.Image.show(
219 _url : baseURL+'/Xtuple/Import/Customers'
223 _this.grid.footer.onClick('first');
224 Roo.MessageBox.alert("Notice", "DONE");
225 // Roo.MessageBox.alert("Notice", msg.join("\n"));
235 text : "Upload Customers Json File",
239 click : function (_self, e)
242 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
243 Roo.MessageBox.alert("Error", "Permission Denied");
247 Pman.Dialog.Image.show(
249 _url : baseURL+'/Xtuple/Import/MyCustomers'
253 _this.grid.footer.onClick('first');
254 Roo.MessageBox.alert("Notice", "DONE");
255 // Roo.MessageBox.alert("Notice", msg.join("\n"));
265 text : "Upload AU Post Accounts",
269 click : function (_self, e)
272 if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
273 Roo.MessageBox.alert("Error", "Permission Denied");
277 Pman.Dialog.Image.show(
279 _url : baseURL+'/Xtuple/Import/AUPostAccounts'
283 _this.grid.footer.onClick('first');
284 Roo.MessageBox.alert("Notice", data);
295 '|xns' : 'Roo.Toolbar',
296 text : "Upload/Download",
313 '|xns' : 'Roo.Toolbar',
323 specialkey : function (_self, e)
325 _this.grid.footer.onClick('first');
327 render : function (_self)
329 _this.searchBox = _self;
334 '|xns' : 'Roo.Toolbar',
337 icon : rootURL + '/Pman/templates/images/search.gif',
340 click : function (_self, e)
342 _this.grid.footer.onClick('first');
347 '|xns' : 'Roo.Toolbar',
350 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
353 click : function (_self, e)
355 _this.searchBox.setValue('');
358 _this.grid.footer.onClick('first');
365 xtype : 'SimpleStore',
379 triggerAction : 'all',
380 fieldLabel : 'Office',
381 displayField : 'office',
383 hiddenName : 'office',
384 valueField : 'office',
391 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>',
393 render : function (_self)
395 _this.officeCombo = _self;
397 select : function (combo, record, index)
400 _this.grid.footer.onClick('first');
412 url : baseURL + '/Roo/Addr.php',
421 xtype : 'JsonReader',
422 fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}],
424 totalProperty : 'total'
429 sortInfo : { direction : 'ASC', field: 'addr_country' },
432 beforeload : function (_self, o){
433 o.params = o.params || {};
434 o.params._distinct = 'addr_country';
435 o.params._columns ='addr_country';
446 triggerAction : 'all',
447 fieldLabel : 'Country',
448 forceSelection : true,
449 selectOnFocus : true,
451 displayField : 'addr_country',
452 emptyText : "Select Country",
453 hiddenName : 'addr_country',
455 valueField : 'addr_country',
462 name : 'addr_country',
463 qtip : "Select Country",
464 queryParam : 'query[addr_country]',
465 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{addr_country}</b> </div>',
466 loadingText : "Searching...",
468 render : function (_self)
470 _this.country = _self;
472 select : function (combo, record, index)
474 _this.grid.footer.onClick('first');
483 '|xns' : 'Roo.Toolbar',
484 text : "Show / Hide Inactive",
490 toggle : function (_self, pressed)
492 _this.grid.footer.onClick('first');
494 render : function (_self)
496 _this.activeBtn = _self;
501 '|xns' : 'Roo.Toolbar',
502 text : "Has orders since",
512 specialkey : function (_self, e)
514 _this.grid.footer.onClick('first');
516 render : function (_self)
518 _this.dateSearch = _self
520 select : function (combo, date)
522 _this.grid.footer.onClick('first');
527 '|xns' : 'Roo.Toolbar',
528 text : "No orders since",
538 specialkey : function (_self, e)
540 _this.grid.footer.onClick('first');
542 render : function (_self)
544 _this.dateSearchNo = _self
546 select : function (combo, date)
548 _this.grid.footer.onClick('first');
553 '|xns' : 'Roo.Toolbar',
558 '|xns' : 'Roo.Toolbar',
561 cls : 'x-btn-text-icon',
562 icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
567 if (!_this.dialog) return;
568 _this.dialog.show( { id : 0 } , function() {
569 _this.grid.footer.onClick('first');
575 '|xns' : 'Roo.Toolbar',
578 cls : 'x-btn-text-icon',
579 icon : Roo.rootURL + 'images/default/tree/leaf.gif',
584 var s = _this.grid.getSelectionModel().getSelections();
585 if (!s.length || (s.length > 1)) {
586 Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
589 if (!_this.dialog) return;
590 _this.dialog.show(s[0].data, function() {
591 _this.grid.footer.onClick('first');
601 autoExpandColumn : 'cust_name',
605 builderCfg : '{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
609 xtype : 'ColumnModel',
612 renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); },
614 dataIndex : 'cust_active',
615 builderCfg : '{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"}'
619 xtype : 'ColumnModel',
620 header : 'Last Order',
622 renderer : function(v) {
626 var vv = Date.parseDate(v, 'Y-m-d');
627 return String.format('{0}', vv.format('d/M/Y') );
630 dataIndex : 'last_order'
634 xtype : 'ColumnModel',
636 header : 'Tax Status',
638 renderer : function(v) { return String.format('{0}', v); },
640 dataIndex : 'cust_taxzone_id_taxzone_descrip',
641 builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
645 xtype : 'ColumnModel',
649 renderer : function(v) { return String.format('{0}', v); },
651 dataIndex : 'cust_terms_id_terms_descrip',
652 builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
656 xtype : 'ColumnModel',
658 header : 'Sales Rep',
660 renderer : function(v) { return String.format('{0}', v); },
662 dataIndex : 'cust_salesrep_id_salesrep_name',
663 builderCfg : '{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"}'
667 xtype : 'ColumnModel',
669 header : 'Curr/Price List',
671 renderer : function(v,x,r) {
673 return String.format('{0}<br/><span style="color:red">No price list</span>',
674 r.data.cust_curr_id_curr_name );
677 return String.format('{0}<br/>{1}',
678 r.data.cust_curr_id_curr_name,
682 dataIndex : 'ipshead_id_name'
686 xtype : 'ColumnModel',
690 renderer : function(v) { return String.format('{0}', v); },
692 dataIndex : 'cust_number'
696 xtype : 'ColumnModel',
700 renderer : function(v,x,r) {
701 if (!r.data.cust_char_internalcompany.length) {
702 return String.format('{0}', v);
704 return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
705 r.data.cust_char_internalcompany, v);
708 dataIndex : 'cust_name'
712 xtype : 'ColumnModel',
714 header : 'Billing Address',
716 renderer : function(v,x,r)
720 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
\r
721 if (!r.data['cntct_addr_' + k].length) {
\r
724 add.push(String.format("{0}", r.data['cntct_addr_' + k]));
\r
727 return add.join('<BR/>');
730 var v = v.split("\r\n").join("<br/>");
734 dataIndex : 'cust_bill_info'
738 xtype : 'ColumnModel',
740 header : 'Shipping Address',
742 renderer : function(v,x,r)
746 Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
\r
747 if (!r.data['cntct_addr_' + k].length) {
\r
750 add.push(String.format("{0}", r.data['cntct_addr_' + k]));
\r
753 return add.join('<BR/>');
756 var v = v.split("\r\n").join("<br/>");
760 dataIndex : 'cust_ship_info'
764 xtype : 'ColumnModel',
768 renderer : function(v,x,r)
770 return String.format(
773 'Email: <a href="mailto:{2}">{2}</a>',
775 r.data.cust_cntct_id_cntct_first_name,
776 r.data.cust_cntct_id_cntct_phone,
777 r.data.cust_cntct_id_cntct_email
781 dataIndex : 'cust_cntct_id_cntct_first_name'
786 xtype : 'ColumnModel',
790 renderer : function(v,x,r)
792 return String.format('{0}', v);
795 dataIndex : 'cust_char_au_post_accno'
800 xtype : 'ColumnModel',
802 header : 'Contact Number',
804 renderer : function(v,x,r)
806 return String.format('{0}',v);
809 dataIndex : 'cust_cntct_id_cntct_phone'
814 xtype : 'ColumnModel',
818 renderer : function(v,x,r)
820 return String.format('<a href="mailto:{0}">{0}</a>', v);
823 dataIndex : 'cust_cntct_id_cntct_email'
829 xtype : 'ColumnModel',
833 renderer : function(v) { return String.format('{0}', v ? v : ''); },
835 dataIndex : 'cntct_addr_city'
841 xtype : 'ColumnModel',
845 renderer : function(v) { return String.format('{0}', v ? v : ''); },
847 dataIndex : 'cntct_addr_state'
852 xtype : 'ColumnModel',
856 renderer : function(v) { return String.format('{0}', v ? v : ''); },
858 dataIndex : 'cntct_addr_country'
862 xtype : 'ColumnModel',
866 renderer : function(v) { return String.format('{0}', v); },
868 dataIndex : 'cust_curr_id_curr_name',
869 builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
874 xtype : 'ColumnModel',
877 renderer : function(v,x,r) {
880 return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2));
883 dataIndex : 'balance'
887 rowdblclick : function (_self, rowIndex, e)
889 if (!_this.dialog) return;
890 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
891 _this.grid.footer.onClick('refresh');
897 _this.dialog = Pman.Dialog.XtupleCustomer;
898 if (_this.panel.active) {
899 this.footer.onClick('first');
916 builderCfg : '{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Name\"}],\"cols_ex\":[\"cust_name\"],\"table\":\"custinfo\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
917 tableName : 'custinfo',
919 activate : function() {
922 _this.grid.footer.onClick('first');