{
'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'
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 : [
'|xns' : 'Roo',
pageSize : 25,
xtype : 'PagingToolbar',
- emptyMsg : "No cohist found",
+ emptyMsg : "No Images found",
xns : Roo,
- displayMsg : "Displaying Sales {0} - {1} of {2}",
+ displayMsg : "Displaying Images {0} - {1} of {2}",
displayInfo : true
},
- toolbar : {
- '|xns' : 'Roo',
- xtype : 'Toolbar',
- xns : Roo,
- items : [
- {
- '|xns' : 'Roo.Toolbar',
- text : "From",
- xtype : 'TextItem',
- xns : Roo.Toolbar
- },
- {
- '|xns' : 'Roo.form',
- format : 'd/M/Y',
- useIso : true,
- xtype : 'DateField',
- value : (function() {return (new Date()).add(Date.MONTH, -3); })(),
- xns : Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.dateFrom = _self;
- }
- }
- },
- {
- '|xns' : 'Roo.Toolbar',
- text : "To",
- xtype : 'TextItem',
- xns : Roo.Toolbar
- },
- {
- '|xns' : 'Roo.form',
- format : 'd/M/Y',
- useIso : true,
- xtype : 'DateField',
- value : (function() {return (new Date()) })(),
- xns : Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.dateTo = _self;
- }
- }
- },
- {
- '|xns' : 'Roo.Toolbar',
- text : "Refresh",
- xtype : 'Button',
- xns : Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- _this.hgrid.footer.onClick('first');
- }
- }
- },
- {
- '|xns' : 'Roo.Toolbar',
- xtype : 'Fill',
- xns : Roo.Toolbar
- },
- {
- '|xns' : 'Roo.Toolbar',
- text : "Download",
- xtype : 'Button',
- xns : Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- new Pman.Download({
- grid : _this.hgrid
- });
- }
- }
- }
- ]
-
- },
'|xns' : 'Roo.grid',
- autoExpandColumn : '',
+ autoExpandColumn : 'imgtype',
xtype : 'Grid',
loadMask : true,
xns : Roo.grid,
- colModel : [
+ cm : [
{
'|xns' : 'Roo.grid',
xtype : 'ColumnModel',
- width : 75,
- header : 'Customer',
- renderer : function(v) { return String.format('{0}', v); },
- xns : Roo.grid,
- dataIndex : 'cust_name'
- },
-{
- '|xns' : 'Roo.grid',
- xtype : 'ColumnModel',
- width : 75,
- header : 'Order',
- renderer : function(v) { return String.format('{0}', v); },
- xns : Roo.grid,
- dataIndex : 'cohist_ordernumber'
- },
-{
- '|xns' : 'Roo.grid',
- xtype : 'ColumnModel',
- width : 75,
- header : 'Invoice Month',
- renderer : function(v) {
-
- return String.format('{0}',v);
- },
+ 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);
+ },
xns : Roo.grid,
- dataIndex : 'invmonth'
+ dataIndex : 'id'
},
{
'|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 : 'cohead_orderdate'
- },
-{
- '|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 : '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'
+ dataIndex : 'filename'
},
{
'|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'
- },
-{
- '|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;