Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleCustomer.js
index 61f7447..e94ceb2 100644 (file)
@@ -2,8 +2,10 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleCustomer = new Roo.XComponent({
-    part     :  ["Xtuple","Customer"],
+    part     :  ["Xtuple", "Customer" ],
     order    : '700-Pman.Tab.XtupleCustomer',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleSales',
@@ -15,93 +17,20 @@ Pman.Tab.XtupleCustomer = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'GridPanel',
-            xns: Roo,
-            listeners : {
-                activate : function() {
-                    _this.panel = this;
-                    if (_this.grid) {
-                        _this.grid.footer.onClick('first');
-                    }
-                }
-            },
-            background : true,
-            fitContainer : true,
-            fitToframe : true,
-            region : 'center',
-            tableName : 'custinfo',
-            title : "Customers",
             grid : {
-                xtype: 'Grid',
-                xns: Roo.grid,
-                listeners : {
-                    render : function() 
-                    {
-                        _this.grid = this; 
-                        _this.dialog = Pman.Dialog.XtupleCustomer;
-                        if (_this.panel.active) {
-                           this.footer.onClick('first');
-                        }
-                    },
-                    rowdblclick : function (_self, rowIndex, e)
-                    {
-                        if (!_this.dialog) return;
-                        _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
-                            _this.grid.footer.onClick('refresh');
-                        }); 
-                    }
-                },
-                autoExpandColumn : 'cust_name',
-                loadMask : true,
                 dataSource : {
-                    xtype: 'Store',
-                    xns: Roo.data,
-                    listeners : {
-                        beforeload : function (_self, o)
-                        {
-                            if (!_this.officeCombo) {
-                                return false;
-                            }
-                            
-                            o.params = o.params || {};
-                            o.params['search[cust_name]'] = _this.searchBox.getValue();
-                            if (!_this.activeBtn.pressed) {
-                                o.params.cust_active = 1;
-                            } 
-                            var dt = _this.dateSearch.getValue(); 
-                            if (dt) {
-                                o.params['search[orders_since]'] = dt.format('Y-m-d');
-                            }
-                            dt = _this.dateSearchNo.getValue(); 
-                            if (dt) {
-                                o.params['search[no_orders_since]'] = dt.format('Y-m-d');
-                            }
-                            
-                            o.params['search[with_orders_since]'] = 1; //
-                            o.params['search[with_balance]'] = 1;
-                            o.params['search[with_address]'] = 1;
-                            o.params['_with_char'] = 1;    
-                            o.params['_with_group_data'] = 1;
-                            o.params['search[_country]'] = _this.country.getValue();
-                            o.params._get = 1; // for download
-                            
-                            o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();
-                        }
-                    },
-                    remoteSort : true,
-                    sortInfo : { field : 'cust_name', direction: 'ASC' },
                     proxy : {
-                        xtype: 'HttpProxy',
-                        xns: Roo.data,
+                        '|xns' : 'Roo.data',
+                        url : baseURL + '/Roo/custinfo.php',
+                        xtype : 'HttpProxy',
                         method : 'GET',
-                        url : baseURL + '/Roo/custinfo.php'
+                        xns : Roo.data
                     },
                     reader : {
-                        xtype: 'JsonReader',
-                        xns: Roo.data,
-                        totalProperty : 'total',
-                        root : 'data',
+                        '|xns' : 'Roo.data',
                         id : 'id',
+                        root : 'data',
+                        xtype : 'JsonReader',
                         fields : [
                             {
                                 'name': 'cust_active',
@@ -119,281 +48,321 @@ Pman.Tab.XtupleCustomer = new Roo.XComponent({
                                 'name': 'cust_name',
                                 'type': 'string'
                             }
-                        ]
-                    }
+                        ],
+                        xns : Roo.data,
+                        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\"}',
+                        totalProperty : 'total'
+                    },
+                    '|xns' : 'Roo.data',
+                    xtype : 'Store',
+                    remoteSort : true,
+                    sortInfo : { field : 'cust_name', direction: 'ASC' },
+                    xns : Roo.data,
+                    listeners : {
+                       beforeload : function (_self, o)
+                          {
+                              if (!_this.officeCombo) {
+                                  return false;
+                              }
+                              
+                              o.params = o.params || {};
+                              o.params['search[_mix]'] = _this.searchBox.getValue();
+                              if (!_this.activeBtn.pressed) {
+                                  o.params.cust_active = 1;
+                                  o.params.cust_aropen_active = 1;
+                              } 
+                              var dt = _this.dateSearch.getValue(); 
+                              if (dt) {
+                                  o.params['search[orders_since]'] = dt.format('Y-m-d');
+                              }
+                              dt = _this.dateSearchNo.getValue(); 
+                              if (dt) {
+                                  o.params['search[no_orders_since]'] = dt.format('Y-m-d');
+                              }
+                              
+                              o.params['search[with_orders_since]'] = 1; //
+                              o.params['search[with_balance]'] = 1;
+                              o.params['search[with_address]'] = 1;
+                              o.params['_with_char'] = 1;    
+                              o.params['_with_group_data'] = 1;
+                              o.params['search[_country]'] = _this.country.getValue();
+                              o.params._get = 1; // for download
+                              
+                              o.params['cust_char_internalcompany'] = _this.officeCombo.getValue();
+                          }
+                    },
+                    items : [
+
+                    ]
+
                 },
                 footer : {
-                    xtype: 'PagingToolbar',
-                    xns: Roo,
+                    '|xns' : 'Roo',
                     pageSize : 25,
+                    xtype : 'PagingToolbar',
+                    emptyMsg : "No custinfo found",
+                    xns : Roo,
                     displayInfo : true,
                     displayMsg : "Displaying custinfo{0} - {1} of {2}",
-                    emptyMsg : "No custinfo found",
                     items : [
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            text : "Upload/Download",
+                       {
                             menu : {
-                                xtype: 'Menu',
-                                xns: Roo.menu,
+                                '|xns' : 'Roo.menu',
+                                xtype : 'Menu',
+                                xns : Roo.menu,
                                 items : [
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Download Mailing list subscribers",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                               
-                                                var params = {
-                                                    '_group' : 'customer',
-                                                    '_name' : 'subscribers',
-                                                    'limit' : 99999,
-                                                    'csvTitles' : '*',
-                                                    'csvCols' : '*'
-                                                };
-                                                
-                                                
-                                                new Pman.Download({
-                                                  url : baseURL + '/Roo/Metasql',
-                                                  params :   params,
-                                                  method : 'GET'
-                                                });
-                                                
-                                                Roo.MessageBox.alert("Notice", "Report will download shortly");
-                                                
-                                            }
-                                        },
-                                        text : "Download Mailing list subscribers"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                     
+                                                      var params = {
+                                                          '_group' : 'customer',
+                                                          '_name' : 'subscribers',
+                                                          'limit' : 99999,
+                                                          'csvTitles' : '*',
+                                                          'csvCols' : '*'
+                                                      };
+                                                      
+                                                      
+                                                      new Pman.Download({
+                                                        url : baseURL + '/Roo/Metasql',
+                                                        params :   params,
+                                                        method : 'GET'
+                                                      });
+                                                      
+                                                      Roo.MessageBox.alert("Notice", "Report will download shortly");
+                                                      
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Download Customers",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                                _this.grid.ds.proxy.conn.method = 'POST';
-                                                new Pman.Download({
-                                                    grid : _this.grid
-                                                });
-                                                
-                                            }
-                                        },
-                                        text : "Download Customers"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Xtuple.CustomerDownload','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                      _this.grid.ds.proxy.conn.method = 'POST';
+                                                      new Pman.Download({
+                                                          grid : _this.grid
+                                                      });
+                                                      
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Download Customers As Json",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                                
-                                                var c = _this.country.getValue();
-                                                if(!c.length){
-                                                    Roo.MessageBox.alert("Error", "Please select a country");
-                                                    return;
-                                                }
-                                                
-                                                new Pman.Download({
-                                                    url : baseURL + '/Roo/custinfo',
-                                                    method : 'GET',
-                                                    params : {
-                                                        _my_json : 1,
-                                                        limit : 9999,
-                                                        'search[_country]' : c,
-                                                        'search[with_address]' : 1
-                                                    }
-                                                    
-                                                });
-                                            }
-                                        },
-                                        text : "Download Customers As Json"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                      
+                                                      var c = _this.country.getValue();
+                                                      if(!c.length){
+                                                          Roo.MessageBox.alert("Error", "Please select a country");
+                                                          return;
+                                                      }
+                                                      
+                                                      new Pman.Download({
+                                                          url : baseURL + '/Roo/custinfo',
+                                                          method : 'GET',
+                                                          params : {
+                                                              _my_json : 1,
+                                                              limit : 9999,
+                                                              'search[_country]' : c,
+                                                              'search[with_address]' : 1
+                                                          }
+                                                          
+                                                      });
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Upload Customers",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                               
-                                               Pman.Dialog.Image.show(
-                                                   {
-                                                        _url : baseURL+'/Xtuple/Import/Customers' 
-                                                    
-                                                   },
-                                                   function (data) {
-                                                        _this.grid.footer.onClick('first');
-                                                        Roo.MessageBox.alert("Notice", "DONE");
-                                            //            Roo.MessageBox.alert("Notice", msg.join("\n"));
-                                            
-                                                   }
-                                               );
-                                                
-                                            }
-                                        },
-                                        text : "Upload Customers"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                     
+                                                     Pman.Dialog.Image.show(
+                                                         {
+                                                              _url : baseURL+'/Xtuple/Import/Customers' 
+                                                          
+                                                         },
+                                                         function (data) {
+                                                              _this.grid.footer.onClick('first');
+                                                              Roo.MessageBox.alert("Notice", "DONE");
+                                                  //            Roo.MessageBox.alert("Notice", msg.join("\n"));
+                                                  
+                                                         }
+                                                     );
+                                                      
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Upload Customers Json File",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                               
-                                               Pman.Dialog.Image.show(
-                                                   {
-                                                        _url : baseURL+'/Xtuple/Import/MyCustomers' 
-                                                    
-                                                   },
-                                                   function (data) {
-                                                        _this.grid.footer.onClick('first');
-                                                        Roo.MessageBox.alert("Notice", "DONE");
-                                            //            Roo.MessageBox.alert("Notice", msg.join("\n"));
-                                            
-                                                   }
-                                               );
-                                                
-                                            }
-                                        },
-                                        text : "Upload Customers Json File"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                     
+                                                     Pman.Dialog.Image.show(
+                                                         {
+                                                              _url : baseURL+'/Xtuple/Import/MyCustomers' 
+                                                          
+                                                         },
+                                                         function (data) {
+                                                              _this.grid.footer.onClick('first');
+                                                              Roo.MessageBox.alert("Notice", "DONE");
+                                                  //            Roo.MessageBox.alert("Notice", msg.join("\n"));
+                                                  
+                                                         }
+                                                     );
+                                                      
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Item',
-                                        xns: Roo.menu,
+                                       {
+                                        '|xns' : 'Roo.menu',
+                                        text : "Upload AU Post Accounts",
+                                        xtype : 'Item',
+                                        xns : Roo.menu,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                
-                                                if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
-                                                    Roo.MessageBox.alert("Error", "Permission Denied");
-                                                    return;
-                                                }
-                                               
-                                               Pman.Dialog.Image.show(
-                                                   {
-                                                        _url : baseURL+'/Xtuple/Import/AUPostAccounts' 
-                                                    
-                                                   },
-                                                   function (data) {
-                                                        _this.grid.footer.onClick('first');
-                                                        Roo.MessageBox.alert("Notice", data);
-                                            
-                                                   }
-                                               );
-                                                
-                                            }
-                                        },
-                                        text : "Upload AU Post Accounts"
+                                               click : function (_self, e)
+                                                  {
+                                                      
+                                                      if (!Pman.hasPerm('Admin.Admin_Tab','S')) {
+                                                          Roo.MessageBox.alert("Error", "Permission Denied");
+                                                          return;
+                                                      }
+                                                     
+                                                     Pman.Dialog.Image.show(
+                                                         {
+                                                              _url : baseURL+'/Xtuple/Import/AUPostAccounts' 
+                                                          
+                                                         },
+                                                         function (data) {
+                                                              _this.grid.footer.onClick('first');
+                                                              Roo.MessageBox.alert("Notice", data);
+                                                  
+                                                         }
+                                                     );
+                                                      
+                                                  }
+                                        }
                                     }
                                 ]
-                            }
+
+                            },
+                            '|xns' : 'Roo.Toolbar',
+                            text : "Upload/Download",
+                            xtype : 'Button',
+                            xns : Roo.Toolbar,
+                            items : [
+
+                            ]
+
                         }
                     ]
+
                 },
                 toolbar : {
-                    xtype: 'Toolbar',
-                    xns: Roo,
+                    '|xns' : 'Roo',
+                    xtype : 'Toolbar',
+                    xns : Roo,
                     items : [
-                        {
-                            xtype: 'TextItem',
-                            xns: Roo.Toolbar,
-                            text : "Search : "
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "Search : ",
+                            xtype : 'TextItem',
+                            xns : Roo.Toolbar
                         },
-                        {
-                            xtype: 'TextField',
-                            xns: Roo.form,
+                       {
+                            '|xns' : 'Roo.form',
+                            xtype : 'TextField',
+                            xns : Roo.form,
                             listeners : {
-                                render : function (_self)
-                                {
-                                    _this.searchBox = _self;
-                                },
-                                specialkey : function (_self, e)
-                                {
-                                    _this.grid.footer.onClick('first');
-                                }
+                               specialkey : function (_self, e)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  },
+                               render : function (_self)
+                                  {
+                                      _this.searchBox = _self;
+                                  }
                             }
                         },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function (_self, e)
-                                {
-                                _this.grid.footer.onClick('first');
-                                }
-                            },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Button',
                             cls : 'x-btn-icon',
-                            icon : rootURL + '/Pman/templates/images/search.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
+                            icon : rootURL + '/Pman/templates/images/search.gif',
+                            xns : Roo.Toolbar,
                             listeners : {
-                                click : function (_self, e)
-                                {
-                                    _this.searchBox.setValue('');
-                                    
-                                    
-                                    _this.grid.footer.onClick('first');
-                                }
-                            },
-                            cls : 'x-btn-icon',
-                            icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                               click : function (_self, e)
+                                  {
+                                  _this.grid.footer.onClick('first');
+                                  }
+                            }
                         },
-                        {
-                            xtype: 'ComboBox',
-                            xns: Roo.form,
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Button',
+                            cls : 'x-btn-icon',
+                            icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+                            xns : Roo.Toolbar,
                             listeners : {
-                                render : function (_self)
-                                {
-                                  _this.officeCombo  = _self;
-                                },
-                                select : function (combo, record, index)
-                                {
-                                
-                                    _this.grid.footer.onClick('first');
-                                }
-                            },
-                            allowBlank : true,
-                            displayField : 'office',
-                            editable : false,
-                            fieldLabel : 'Office',
-                            hiddenName : 'office',
-                            listWidth : 200,
-                            mode : 'local',
-                            name : 'office',
-                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{office}</b> </div>',
-                            triggerAction : 'all',
-                            valueField : 'office',
-                            width : 75,
+                               click : function (_self, e)
+                                  {
+                                      _this.searchBox.setValue('');
+                                      
+                                      
+                                      _this.grid.footer.onClick('first');
+                                  }
+                            }
+                        },
+                       {
                             store : {
-                                xtype: 'SimpleStore',
-                                xns: Roo.data,
+                                '|xns' : 'Roo.data',
+                                xtype : 'SimpleStore',
                                 data : [ 
                                     [ ''] ,
                                     [ 'hk' ],
@@ -402,437 +371,561 @@ Pman.Tab.XtupleCustomer = new Roo.XComponent({
                                     [ 'cn' ],
                                     [ 'au' ]
                                 ],
-                                fields : ['office']
-                            }
-                        },
-                        {
-                            xtype: 'ComboBox',
-                            xns: Roo.form,
+                                fields : ['office'],
+                                xns : Roo.data
+                            },
+                            '|xns' : 'Roo.form',
+                            listWidth : 200,
+                            triggerAction : 'all',
+                            fieldLabel : 'Office',
+                            displayField : 'office',
+                            xtype : 'ComboBox',
+                            hiddenName : 'office',
+                            valueField : 'office',
+                            allowBlank : true,
+                            editable : false,
+                            width : 75,
+                            xns : Roo.form,
+                            mode : 'local',
+                            name : 'office',
+                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>',
                             listeners : {
-                                render : function (_self)
-                                {
-                                    _this.country = _self;
+                               render : function (_self)
+                                  {
+                                    _this.officeCombo  = _self;
+                                  },
+                               select : function (combo, record, index)
+                                  {
+                                  
+                                      _this.grid.footer.onClick('first');
+                                  }
+                            },
+                            items : [
+
+                            ]
+
+                        },
+                       {
+                            store : {
+                                proxy : {
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Addr.php',
+                                    xtype : 'HttpProxy',
+                                    method : 'GET',
+                                    xns : Roo.data
+                                },
+                                reader : {
+                                    '|xns' : 'Roo.data',
+                                    id : 'addr_id',
+                                    root : 'data',
+                                    xtype : 'JsonReader',
+                                    fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { direction : 'ASC', field: 'addr_country' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o){
+                                              o.params = o.params || {};
+                                              o.params._distinct = 'addr_country';
+                                              o.params._columns ='addr_country';
+                                          }
                                 },
-                                select : function (combo, record, index)
-                                {
-                                    _this.grid.footer.onClick('first');
-                                }
+                                items : [
+
+                                ]
+
                             },
-                            allowBlank : true,
+                            '|xns' : 'Roo.form',
                             alwaysQuery : true,
-                            displayField : 'addr_country',
-                            editable : true,
-                            emptyText : "Select Country",
+                            listWidth : 300,
+                            triggerAction : 'all',
                             fieldLabel : 'Country',
                             forceSelection : true,
+                            selectOnFocus : true,
+                            pageSize : 20,
+                            displayField : 'addr_country',
+                            emptyText : "Select Country",
                             hiddenName : 'addr_country',
-                            listWidth : 300,
-                            loadingText : "Searching...",
                             minChars : 2,
+                            valueField : 'addr_country',
+                            xtype : 'ComboBox',
+                            allowBlank : true,
+                            typeAhead : true,
+                            editable : true,
+                            width : 150,
+                            xns : Roo.form,
                             name : 'addr_country',
-                            pageSize : 20,
                             qtip : "Select Country",
                             queryParam : 'query[addr_country]',
-                            selectOnFocus : true,
-                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_country}</b> </div>',
-                            triggerAction : 'all',
-                            typeAhead : true,
-                            valueField : 'addr_country',
-                            width : 150,
-                            store : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o){
-                                        o.params = o.params || {};
-                                        o.params._distinct = 'addr_country';
-                                        o.params._columns ='addr_country';
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { direction : 'ASC', field: 'addr_country' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Roo/Addr.php'
-                                },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    id : 'addr_id',
-                                    root : 'data',
-                                    totalProperty : 'total',
-                                    fields : [{"name":"addr_id","type":"int"},{"name":"addr_country","type":"string"}]
-                                }
-                            }
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
+                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{addr_country}</b> </div>',
+                            loadingText : "Searching...",
                             listeners : {
-                                toggle : function (_self, pressed)
-                                {
-                                    _this.grid.footer.onClick('first');
-                                },
-                                render : function (_self)
-                                {
-                                    _this.activeBtn = _self;
-                                }
+                               render : function (_self)
+                                  {
+                                      _this.country = _self;
+                                  },
+                               select : function (combo, record, index)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  }
                             },
+                            items : [
+
+                            ]
+
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "Show / Hide Inactive",
                             enableToggle : true,
                             pressed : false,
-                            text : "Show / Hide Inactive"
+                            xtype : 'Button',
+                            xns : Roo.Toolbar,
+                            listeners : {
+                               toggle : function (_self, pressed)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  },
+                               render : function (_self)
+                                  {
+                                      _this.activeBtn = _self;
+                                  }
+                            }
                         },
-                        {
-                            xtype: 'TextItem',
-                            xns: Roo.Toolbar,
-                            text : "Has orders since"
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "Has orders since",
+                            xtype : 'TextItem',
+                            xns : Roo.Toolbar
                         },
-                        {
-                            xtype: 'DateField',
-                            xns: Roo.form,
+                       {
+                            '|xns' : 'Roo.form',
+                            format : 'Y-m-d',
+                            xtype : 'DateField',
+                            xns : Roo.form,
                             listeners : {
-                                render : function (_self)
-                                {
-                                    _this.dateSearch = _self
-                                },
-                                select : function (combo, date)
-                                {
-                                    _this.grid.footer.onClick('first');
-                                },
-                                specialkey : function (_self, e)
-                                {
-                                   _this.grid.footer.onClick('first');
-                                }
-                            },
-                            format : 'Y-m-d'
+                               specialkey : function (_self, e)
+                                  {
+                                     _this.grid.footer.onClick('first');
+                                  },
+                               render : function (_self)
+                                  {
+                                      _this.dateSearch = _self
+                                  },
+                               select : function (combo, date)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  }
+                            }
                         },
-                        {
-                            xtype: 'TextItem',
-                            xns: Roo.Toolbar,
-                            text : "No orders since"
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "No orders since",
+                            xtype : 'TextItem',
+                            xns : Roo.Toolbar
                         },
-                        {
-                            xtype: 'DateField',
-                            xns: Roo.form,
+                       {
+                            '|xns' : 'Roo.form',
+                            format : 'Y-m-d',
+                            xtype : 'DateField',
+                            xns : Roo.form,
                             listeners : {
-                                render : function (_self)
-                                {
-                                    _this.dateSearchNo = _self
-                                },
-                                select : function (combo, date)
-                                {
-                                   _this.grid.footer.onClick('first');
-                                },
-                                specialkey : function (_self, e)
-                                {
-                                   _this.grid.footer.onClick('first');
-                                }
-                            },
-                            format : 'Y-m-d'
+                               specialkey : function (_self, e)
+                                  {
+                                     _this.grid.footer.onClick('first');
+                                  },
+                               render : function (_self)
+                                  {
+                                      _this.dateSearchNo = _self
+                                  },
+                               select : function (combo, date)
+                                  {
+                                     _this.grid.footer.onClick('first');
+                                  }
+                            }
                         },
-                        {
-                            xtype: 'Fill',
-                            xns: Roo.Toolbar
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Fill',
+                            xns : Roo.Toolbar
                         },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                    if (!_this.dialog) return;
-                                    _this.dialog.show( { id : 0 } , function() {
-                                        _this.grid.footer.onClick('first');
-                                   }); 
-                                }
-                            },
-                            cls : 'x-btn-text-icon',
+                       {
+                            '|xns' : 'Roo.Toolbar',
                             text : "Add",
-                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
-                        },
-                        {
-                            xtype: 'Button',
-                            xns: Roo.Toolbar,
-                            listeners : {
-                                click : function()
-                                {
-                                    var s = _this.grid.getSelectionModel().getSelections();
-                                    if (!s.length || (s.length > 1))  {
-                                        Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
-                                        return;
-                                    }
-                                    if (!_this.dialog) return;
-                                    _this.dialog.show(s[0].data, function() {
-                                        _this.grid.footer.onClick('first');
-                                    }); 
-                                    
-                                }
-                            },
+                            xtype : 'Button',
                             cls : 'x-btn-text-icon',
+                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                            xns : Roo.Toolbar,
+                            listeners : {
+                               click : function()
+                                  {
+                                      if (!_this.dialog) return;
+                                      _this.dialog.show( { id : 0 } , function() {
+                                          _this.grid.footer.onClick('first');
+                                     }); 
+                                  }
+                            }
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
                             text : "Edit",
-                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                            xtype : 'Button',
+                            cls : 'x-btn-text-icon',
+                            icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                            xns : Roo.Toolbar,
+                            listeners : {
+                               click : function()
+                                  {
+                                      var s = _this.grid.getSelectionModel().getSelections();
+                                      if (!s.length || (s.length > 1))  {
+                                          Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                                          return;
+                                      }
+                                      if (!_this.dialog) return;
+                                      _this.dialog.show(s[0].data, function() {
+                                          _this.grid.footer.onClick('first');
+                                      }); 
+                                      
+                                  }
+                            }
                         }
                     ]
+
                 },
+                '|xns' : 'Roo.grid',
+                autoExpandColumn : 'cust_name',
+                xtype : 'Grid',
+                loadMask : true,
+                xns : Roo.grid,
+                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\"}',
                 colModel : [
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_active',
-                        header : 'Active',
-                        width : 50,
-                        renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'last_order',
-                        header : 'Last Order',
-                        width : 80,
-                        renderer : function(v) { 
-                            if (!v) { 
-                                return '-none-';
-                            }
-                            var vv = Date.parseDate(v, 'Y-m-d');
-                            return String.format('{0}',  vv.format('d/M/Y') ); 
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_taxzone_id_taxzone_descrip',
-                        header : 'Tax Status',
-                        sortable : true,
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_terms_id_terms_descrip',
-                        header : 'Terms',
-                        sortable : true,
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_salesrep_id_salesrep_name',
-                        header : 'Sales Rep',
-                        sortable : true,
-                        width : 100,
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'ipshead_id_name',
-                        header : 'Curr/Price List',
-                        sortable : true,
-                        width : 80,
-                        renderer : function(v,x,r) { 
-                            if (!v.length) {
-                                 return String.format('{0}<br/><span style="color:red">No price list</span>', 
-                                r.data.cust_curr_id_curr_name  );
-                             }    
-                        
-                            return  String.format('{0}<br/>{1}', 
-                                r.data.cust_curr_id_curr_name,
-                               v ); 
-                           }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_number',
-                        header : 'Ref No.',
-                        sortable : true,
-                        width : 80,
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_name',
-                        header : 'Name',
-                        sortable : true,
-                        width : 200,
-                        renderer : function(v,x,r) {
-                            if (!r.data.cust_char_internalcompany.length) {
-                                 return String.format('{0}', v); 
-                             }
-                            return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
-                                r.data.cust_char_internalcompany,  v); 
-                         }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_bill_info',
-                        header : 'Billing Address',
-                        sortable : true,
-                        width : 200,
-                        renderer : function(v,x,r) 
-                        { 
-                            if(!v.length){
-                                var add = [];\r
-                                Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
-                                    if (!r.data['cntct_addr_' + k].length) {\r
-                                        return;\r
-                                    }\r
-                                    add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
-                                \r
-                                });
-                                return add.join('<BR/>');
-                            }
-                            
-                            var v = v.split("\r\n").join("<br/>");
-                            return v; 
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_ship_info',
-                        header : 'Shipping Address',
-                        sortable : true,
-                        width : 200,
-                        renderer : function(v,x,r) 
-                        { 
-                            if(!v.length){
-                                var add = [];\r
-                                Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
-                                    if (!r.data['cntct_addr_' + k].length) {\r
-                                        return;\r
-                                    }\r
-                                    add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
-                                \r
-                                });
-                                return add.join('<BR/>');
-                            }
-                            
-                            var v = v.split("\r\n").join("<br/>");
-                            return v; 
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_cntct_id_cntct_first_name',
-                        header : 'Contact',
-                        sortable : true,
-                        width : 150,
-                        renderer : function(v,x,r) 
-                        { 
-                            return String.format(
-                                'Name: {0}<br/>' + 
-                                'Phone: {1}<br/>' + 
-                                'Email: <a href="mailto:{2}">{2}</a>',
-                            
-                                r.data.cust_cntct_id_cntct_first_name,
-                                r.data.cust_cntct_id_cntct_phone,
-                                r.data.cust_cntct_id_cntct_email
-                            );
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_char_au_post_accno',
-                        header : 'AU Post#',
-                        hidden : true,
-                        sortable : true,
-                        width : 150,
-                        renderer : function(v,x,r) 
-                        { 
-                            return String.format('{0}', v);
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_cntct_id_cntct_phone',
-                        header : 'Contact Number',
-                        hidden : true,
-                        sortable : true,
-                        width : 150,
-                        renderer : function(v,x,r) 
-                        { 
-                            return String.format('{0}',v);
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_cntct_id_cntct_email',
-                        header : 'Email',
-                        hidden : true,
-                        sortable : true,
-                        width : 150,
-                        renderer : function(v,x,r) 
-                        { 
-                            return String.format('<a href="mailto:{0}">{0}</a>', v);
-                        }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        align : 'right',
-                        dataIndex : 'cntct_addr_city',
-                        header : 'City',
-                        hidden : true,
-                        sortable : true,
-                        width : 75,
-                        renderer : function(v) { return String.format('{0}', v ? v : ''); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        align : 'right',
-                        dataIndex : 'cntct_addr_state',
-                        header : 'State',
-                        hidden : true,
-                        sortable : true,
-                        width : 75,
-                        renderer : function(v) { return String.format('{0}', v ? v : ''); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        align : 'right',
-                        dataIndex : 'cntct_addr_country',
-                        header : 'Country',
-                        sortable : true,
-                        width : 75,
-                        renderer : function(v) { return String.format('{0}', v ? v : ''); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        dataIndex : 'cust_curr_id_curr_name',
-                        header : 'Currency',
-                        sortable : true,
-                        width : 50,
-                        renderer : function(v) { return String.format('{0}', v); }
-                    },
-                    {
-                        xtype: 'ColumnModel',
-                        xns: Roo.grid,
-                        align : 'right',
-                        dataIndex : 'balance',
-                        header : 'Balance',
-                        width : 75,
-                        renderer : function(v,x,r) { 
-                        
-                             
-                            return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2)); 
-                        }
-                    }
+                        {
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               header : 'Active',
+                               width : 50,
+                               renderer : function(v) { return String.format('{0}', v? 'Y' : 'N'); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_active',
+                               builderCfg : '{\"table\":\"custinfo\",\"column\":\"cust_active\",\"columnshort\":\"cust_active\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Active\"}'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               header : 'Last Order',
+                               width : 80,
+                               renderer : function(v) { 
+                                   if (!v) { 
+                                       return '-none-';
+                                   }
+                                   var vv = Date.parseDate(v, 'Y-m-d');
+                                   return String.format('{0}',  vv.format('d/M/Y') ); 
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'last_order'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Tax Status',
+                               width : 100,
+                               renderer : function(v) { return String.format('{0}', v); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_taxzone_id_taxzone_descrip',
+                               builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Terms',
+                               width : 100,
+                               renderer : function(v) { return String.format('{0}', v); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_terms_id_terms_descrip',
+                               builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Sales Rep',
+                               width : 100,
+                               renderer : function(v) { return String.format('{0}', v); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_salesrep_id_salesrep_name',
+                               builderCfg : '{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Sales Rep\"}'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Curr/Price List',
+                               width : 80,
+                               renderer : function(v,x,r) { 
+                                   if (!v.length) {
+                                        return String.format('{0}<br/><span style="color:red">No price list</span>', 
+                                       r.data.cust_curr_id_curr_name  );
+                                    }    
+                               
+                                   return  String.format('{0}<br/>{1}', 
+                                       r.data.cust_curr_id_curr_name,
+                                      v ); 
+                                  },
+                               xns : Roo.grid,
+                               dataIndex : 'ipshead_id_name'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Ref No.',
+                               width : 80,
+                               renderer : function(v) { return String.format('{0}', v); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_number'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Name',
+                               width : 200,
+                               renderer : function(v,x,r) {
+                                   if (!r.data.cust_char_internalcompany.length) {
+                                        return String.format('{0}', v); 
+                                    }
+                                   return String.format('<span style="color:red">[Internal company : {0}] {1}</span>',
+                                       r.data.cust_char_internalcompany,  v); 
+                                },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_name'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Billing Address',
+                               width : 200,
+                               renderer : function(v,x,r) 
+                               { 
+                                   if(!v.length){
+                                       var add = [];\r
+                                       Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
+                                           if (!r.data['cntct_addr_' + k].length) {\r
+                                               return;\r
+                                           }\r
+                                           add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
+                                       \r
+                                       });
+                                       return add.join('<BR/>');
+                                   }
+                                   
+                                   var v = v.split("\r\n").join("<br/>");
+                                   return v; 
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_bill_info'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Shipping Address',
+                               width : 200,
+                               renderer : function(v,x,r) 
+                               { 
+                                   if(!v.length){
+                                       var add = [];\r
+                                       Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {\r
+                                           if (!r.data['cntct_addr_' + k].length) {\r
+                                               return;\r
+                                           }\r
+                                           add.push(String.format("{0}", r.data['cntct_addr_' + k]));\r
+                                       \r
+                                       });
+                                       return add.join('<BR/>');
+                                   }
+                                   
+                                   var v = v.split("\r\n").join("<br/>");
+                                   return v; 
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_ship_info'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Contact',
+                               width : 150,
+                               renderer : function(v,x,r) 
+                               { 
+                                   return String.format(
+                                       'Name: {0}<br/>' + 
+                                       'Phone: {1}<br/>' + 
+                                       'Email: <a href="mailto:{2}">{2}</a>',
+                                   
+                                       r.data.cust_cntct_id_cntct_first_name,
+                                       r.data.cust_cntct_id_cntct_phone,
+                                       r.data.cust_cntct_id_cntct_email
+                                   );
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_cntct_id_cntct_first_name'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               hidden : true,
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'AU Post#',
+                               width : 150,
+                               renderer : function(v,x,r) 
+                               { 
+                                   return String.format('{0}', v);
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_char_au_post_accno'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               hidden : true,
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Contact Number',
+                               width : 150,
+                               renderer : function(v,x,r) 
+                               { 
+                                   return String.format('{0}',v);
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_cntct_id_cntct_phone'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               hidden : true,
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Email',
+                               width : 150,
+                               renderer : function(v,x,r) 
+                               { 
+                                   return String.format('<a href="mailto:{0}">{0}</a>', v);
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_cntct_id_cntct_email'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               align : 'right',
+                               hidden : true,
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'City',
+                               width : 75,
+                               renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                               xns : Roo.grid,
+                               dataIndex : 'cntct_addr_city'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               align : 'right',
+                               hidden : true,
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'State',
+                               width : 75,
+                               renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                               xns : Roo.grid,
+                               dataIndex : 'cntct_addr_state'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               align : 'right',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Country',
+                               width : 75,
+                               renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                               xns : Roo.grid,
+                               dataIndex : 'cntct_addr_country'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               xtype : 'ColumnModel',
+                               sortable : true,
+                               header : 'Currency',
+                               width : 50,
+                               renderer : function(v) { return String.format('{0}', v); },
+                               xns : Roo.grid,
+                               dataIndex : 'cust_curr_id_curr_name',
+                               builderCfg : '{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer type\"}'
+                           },
+{
+                               '|xns' : 'Roo.grid',
+                               align : 'right',
+                               xtype : 'ColumnModel',
+                               header : 'Balance',
+                               width : 75,
+                               renderer : function(v,x,r) { 
+                               
+                                    
+                                   return String.format('{0}{1}', r.data.cust_curr_id_curr_symbol, Roo.util.Format.number(v,2)); 
+                               },
+                               xns : Roo.grid,
+                               dataIndex : 'balance'
+                           }
+                ],
+                listeners : {
+                       rowdblclick : function (_self, rowIndex, e)
+                          {
+                              if (!_this.dialog) return;
+                              _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
+                                  _this.grid.footer.onClick('refresh');
+                              }); 
+                          },
+                       render : function() 
+                          {
+                              _this.grid = this; 
+                              _this.dialog = Pman.Dialog.XtupleCustomer;
+                              if (_this.panel.active) {
+                                 this.footer.onClick('first');
+                              }
+                          }
+                },
+                items : [
+
                 ]
-            }
-        };
-    }
+
+            },
+            '|xns' : 'Roo',
+            fitToframe : true,
+            region : 'center',
+            background : true,
+            title : "Customers",
+            xtype : 'GridPanel',
+            fitContainer : true,
+            xns : Roo,
+            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\"}',
+            tableName : 'custinfo',
+            listeners : {
+               activate : function() {
+                      _this.panel = this;
+                      if (_this.grid) {
+                          _this.grid.footer.onClick('first');
+                      }
+                  }
+            },
+            items : [
+
+            ]
+
+        };    }
 });