Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleArAging.js
index cbcf65c..022f7d7 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleArAging = new Roo.XComponent({
-    part     :  ["Xtuple","ArAging"],
-    order    : '300-Pman.Tab.XtupleArAging',
+    part     :  ["Xtuple", "ArAging" ],
+    order    : '400-Pman.Tab.XtupleArAging',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "unnamed module",
@@ -15,293 +17,440 @@ Pman.Tab.XtupleArAging = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "ArAging",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        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 : 'aropen',
-                        title : "ArAging",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                }
-                            },
-                            autoExpandColumn : 'publication',
-                            loadMask : true,
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
-                                    {
-                                        o.params = o.params || {};
-                                        
-                                        var dt = _this.relDate.getValue();
-                                        
-                                        var params = {
-                                            _group : 'arAging',
-                                            _name : 'bydate',
-                                            'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                            'useDocDate:text' : false
-                                        };
-                                        
-                                        Roo.apply(o.params,params);
-                                    }
-                                },
-                                remoteSort : true,
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Metasql.php',
                                     method : 'GET',
+                                    xtype : 'HttpProxy',
                                     timeout : 600000,
-                                    url : baseURL + '/Roo/Metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'type',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_office_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_name',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_phone',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_fax',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_email',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_company_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_role',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_active',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_remarks',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_passwd',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_owner_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_lang',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_no_reset_sent',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_action_type',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_project_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_deleted_by',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_deleted_dt',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'leader_firstname',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_lastname',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_name_facebook',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_url_blog',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_url_twitter',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_url_linkedin',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'leader_crm_lead_percentage',
+                                            'name': 'araging_apopen_id',
                                             'type': 'int'
                                         },
                                         {
-                                            'name': 'leader_crm_industry_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_crm_updated_action_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_crm_created_action_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'leader_crm_type_id',
+                                            'name': 'araging_cust_id',
                                             'type': 'int'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o)
+                                          {
+                                              o.params = o.params || {};
+                                              
+                                          
+                                              
+                                              var dt = _this.relDate.getValue();
+                                              
+                                              var params = {
+                                                  _group : 'arAging',
+                                                  _name : 'bydate',
+                                                  'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                  'useDocDate:text' : false
+                                              };
+                                              
+                                              var cs = _this.customerSel.getValue();
+                                              if (cs*1) {
+                                                  params['cust_id:number'] = cs;
+                                              
+                                              }
+                                              
+                                              
+                                              Roo.apply(o.params,params);
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'DateField',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)\r
-                                            {\r
-                                                _this.relDate = _self;\r
-                                               _self.setValue(  new Date() );\r
+                                       {
+                                        store : {
+                                            proxy : {
+                                                '|xns' : 'Roo.data',
+                                                url : baseURL + '/Roo/metasql.php',
+                                                xtype : 'HttpProxy',
+                                                method : 'GET',
+                                                xns : Roo.data
                                             },
-                                            select : function (combo, date)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                            reader : {
+                                                '|xns' : 'Roo.data',
+                                                id : 'cust_id',
+                                                root : 'data',
+                                                xtype : 'JsonReader',
+                                                xns : Roo.data,
+                                                fields : [{"name":"cust_id","type":"int"},"cust_name"],
+                                                totalProperty : 'total'
+                                            },
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'Store',
+                                            remoteSort : true,
+                                            sortInfo : { direction : 'ASC', field: 'cust_name' },
+                                            xns : Roo.data,
+                                            listeners : {
+                                               beforeload : function (_self, o){
+                                                      o.params = o.params || {};
+                                                  
+                                                      if (!_this.relDate) {
+                                                          return false;
+                                                      }
+                                                      var dt = _this.relDate.getValue();    
+                                                      // set more here
+                                                      o.params['_group'] = 'arAging';
+                                                      o.params['_name'] = 'customers';
+                                                      o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
+                                                      o.params['useDocDate:text'] = false    
+                                                  }
+                                            },
+                                            items : [
+
+                                            ]
+
                                         },
-                                        allowBlank : false,
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 400,
+                                        triggerAction : 'all',
+                                        fieldLabel : 'cust_name',
+                                        forceSelection : true,
+                                        selectOnFocus : true,
+                                        pageSize : 20,
+                                        displayField : 'cust_name',
+                                        emptyText : "Select customer",
+                                        hiddenName : 'cust_id',
+                                        minChars : 2,
+                                        valueField : 'cust_id',
+                                        xtype : 'ComboBox',
+                                        allowBlank : true,
+                                        typeAhead : true,
+                                        editable : true,
+                                        width : 300,
+                                        xns : Roo.form,
+                                        name : 'cust_name',
+                                        qtip : "Select Customer",
+                                        queryParam : 'cust_name:text',
+                                        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
+                                        loadingText : "Searching...",
+                                        listeners : {
+                                               render : function (_self)
+                                                  {
+                                                      _this.customerSel = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        },
+                                        items : [
+
+                                        ]
+
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "as Of:",
+                                        xtype : 'TextItem',
+                                        xns : Roo.Toolbar
+                                    },
+                                       {
+                                        '|xns' : 'Roo.form',
                                         format : 'Y-m-d',
-                                        width : 100
+                                        xtype : 'DateField',
+                                        allowBlank : false,
+                                        width : 100,
+                                        xns : Roo.form,
+                                        listeners : {
+                                               render : function (_self)\r
+                                                  {\r
+                                                      _this.relDate = _self;\r
+                                                     _self.setValue(  new Date() );\r
+                                                  },
+                                               select : function (combo, date)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "Nothing found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                displayInfo : true
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'araging_cust_name',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'Date',
-                                    header : 'araging_docdate',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'Type',
-                                    header : 'araging_doctype',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'Docnumber',
-                                    header : 'araging_docnumber',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'Total',
-                                    header : 'araging_total_val',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                           var d = Date.parseDate(v, 'Y-m-d');
+                                       
+                                           return String.format('{0}', d.format('d/M/Y')); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_docdate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Customer',
+                                       width : 200,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_cust_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Doc Type',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           switch(v) {
+                                               case 'I':
+                                                   return "Invoice";
+                                               case 'C':
+                                                   return "Credit Memo";        
+                                               case 'D':
+                                                   return "Debit Memo";                    
+                                               case 'R':
+                                                   return "Cash Receipt";        
+                                               case 'V':
+                                                   return "Voucher";     
+                                               default:
+                                                    return String.format('{0}', v); 
+                                            }
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_doctype'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Docnumber',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_docnumber'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Order',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_ponumber_pretty'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Currency',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_curr_symbol'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Value',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_aropen_amount'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '30 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_cur_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '60 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_sixty_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '90 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_ninety_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Over 90 days',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_plus_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_total_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total (BASE)',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_base_total'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : true,
+                        region : 'center',
+                        title : "ArAging",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'aropen',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            fitToFrame : true,
+            background : true,
+            region : 'center',
+            title : "Accounts Recievable",
+            xtype : 'NestedLayoutPanel',
+            fitContainer : true,
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });