Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleCustomer.js
index e1e80d9..465fbfd 100644 (file)
@@ -1919,6 +1919,19 @@ Pman.Dialog.XtupleCustomer = {
                                     {
                                         'name': 'id',
                                         'type': 'int'
+                                    },
+                                    {
+                                        'name': 'filename',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'imgtype',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'created',
+                                        'type': 'date',
+                                        'dateFormat': 'Y-m-d H:i:s'
                                     }
                                 ],
                                 totalProperty : 'total'
@@ -1942,43 +1955,6 @@ Pman.Dialog.XtupleCustomer = {
                                   
                                       o.params.ontable = 'custinfo';
                                       o.params.onid = cust_id;
-                                  },
-                               load : function (_self, records, options)
-                                  {
-                                      function setText(str) {
-                                      
-                                          _this.hgrid.footer.el.select('.sales-footer-text', 
-                                                  true).first().dom.innerHTML = str;
-                                      }
-                                      
-                                      
-                                      if (!records.length) {
-                                          //_this.footertext.setText('');
-                                          Roo.log("no records");
-                                          setText('');
-                                          return;
-                                      }
-                                      new Pman.Request({
-                                          method : 'GET',
-                                          url : baseURL + '/Roo/cohist',
-                                          params : {
-                                              _sums : 1,
-                                              
-                                              cust_id : _this.form.findField('cust_id').getValue(),
-                                              startDate : _this.dateFrom.getValue(),
-                                              endDate :  _this.dateTo.getValue()
-                                          },
-                                          success : function(res) 
-                                          {
-                                              setText("Total Orders : " + parseInt(res.data[0].total_orders) + 
-                                                      "  Total Shipped : " + parseInt(res.data[0].total_shipped) +                  
-                                                     "   Total Value: " + res.data[0].total_basecurr + " " +
-                                                      Roo.util.Format.number(res.data[0].total_value,2)
-                                              );
-                                          }
-                                      });
-                                      
-                                          
                                   }
                             },
                             items : [
@@ -1996,16 +1972,16 @@ Pman.Dialog.XtupleCustomer = {
                             displayInfo : true
                         },
                         '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'id',
+                        autoExpandColumn : 'imgtype',
                         xtype : 'Grid',
                         loadMask : true,
                         xns : Roo.grid,
-                        colModel : [
+                        cm : [
                                 {
                                        '|xns' : 'Roo.grid',
                                        xtype : 'ColumnModel',
-                                       width : 100,
                                        header : 'Image',
+                                       width : 100,
                                        renderer : function(v,x,r) {
                                            return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="50">', baseURL, v, r.data.filename);
                                        },
@@ -2015,116 +1991,45 @@ Pman.Dialog.XtupleCustomer = {
 {
                                        '|xns' : 'Roo.grid',
                                        xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'File Name',
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'filename'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Invoice Month',
-                                       renderer : function(v) { 
-                                           
-                                           return String.format('{0}',v);
-                                        },
-                                       xns : Roo.grid,
-                                       dataIndex : 'invmonth'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Invoice date',
-                                       renderer : function(v) { 
-                                           var d = Date.parseDate(v, 'Y-m-d');
-                                           return String.format('{0}', d ? d.format('d/M/Y') : '');
-                                        },
-                                       xns : Roo.grid,
-                                       dataIndex : 'cohead_orderdate'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Invoice date',
+                                       width : 150,
+                                       header : 'Date',
                                        renderer : function(v) { 
-                                           var d = Date.parseDate(v, 'Y-m-d');
-                                           return String.format('{0}', d ? d.format('d/M/Y') : '');
+                                           return String.format('{0}', v ? v.format('d/M/Y') : '');
                                         },
                                        xns : Roo.grid,
-                                       dataIndex : 'cohist_invcdate'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Invoice#',
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'cohist_invcnumber'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Item No.',
-                                       renderer : function(v) { return String.format('{0}', v ? v   : ''); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'item_number'
+                                       dataIndex : 'created'
                                    },
 {
                                        '|xns' : 'Roo.grid',
                                        xtype : 'ColumnModel',
+                                       header : 'File Name',
                                        width : 200,
-                                       header : 'Description',
                                        renderer : function(v) { return String.format('{0}', v); },
                                        xns : Roo.grid,
-                                       dataIndex : 'item_descrip1'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       align : 'right',
-                                       xtype : 'ColumnModel',
-                                       header : 'Qty',
-                                       width : 70,
-                                       renderer : function(v) { return parseInt(v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'cohist_qtyshipped'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 75,
-                                       header : 'Currency',
-                                       renderer : function(v) { return String.format('{0}', v.split(/\s+/)[0]); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'currabbr'
-                                   },
-{
-                                       '|xns' : 'Roo.grid',
-                                       align : 'right',
-                                       xtype : 'ColumnModel',
-                                       header : 'Unit Price',
-                                       width : 75,
-                                       renderer : function(v) { return Roo.util.Format.number( v, 2); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'cohist_unitprice'
+                                       dataIndex : 'filename'
                                    },
 {
                                        '|xns' : 'Roo.grid',
-                                       align : 'right',
                                        xtype : 'ColumnModel',
-                                       header : 'Ext Cost',
-                                       width : 75,
-                                       renderer : function(v) { return Roo.util.Format.number( v, 2); },
+                                       header : 'Type',
+                                       width : 200,
+                                       renderer : function(v) { 
+                                           return String.format('{0}',v);
+                                        },
                                        xns : Roo.grid,
-                                       dataIndex : 'extprice'
+                                       dataIndex : 'imgtype'
                                    }
                         ],
                         listeners : {
+                               rowdblclick : function (_self, rowIndex, e)
+                                  {
+                                     var s =  _self.getDataSource().getAt(rowIndex);
+                                     
+                                     new Pman.Download({
+                                          url : baseURL + '/Images/Download/' + s.data.id
+                                      });
+                                     
+                                  },
                                render : function() 
                                   {
                                       _this.igrid = this;