 var windowReportPhotoSpy = null;
 
 /*var storeReportPhotoSpy = new Ext.data.Store({     
        pageSize: 30,
		fields: ['fileName', 'shop', 'SKU_name', 'price', 'code', {name: 'indoor', type: 'bool'}],
		data: [
		{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298039553.jpg</a>',shop:"dixi",SKU_name:"НЕКТАР ДОБРЫЙ АПЕЛЬСИН",price:"103.9",code:"4607042438776"},
			{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298053620.jpg</a>',shop:"dixi",SKU_name:"ОГУРЦЫ Д КОРНИШОНЫ МАРИНОВАННЫЕ С/Б 720 МЛ",price:"75,9",code:"4607081908728"},
				{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298084975.jpg</a>',shop:"dixi",SKU_name:"ОГУРЦЫ ДОВГАНЬ 720 МЛ",price:"99,9",code:""},
					{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298101618.jpg</a>',shop:"dixi",SKU_name:"ОЛАДУШКИ С ПЫЛУ С ЖАРУ ДОМАШНИЕ 280Г",price:"55",code:"4607018272878"},
						{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298133889.jpg</a>',shop:"dixi",SKU_name:"КОТЛЕТЫ ИЗ ГОВЯДИНЫ ОХЛ 400Г ?ТОРГ",price:"170",code:"2705356000015"},
							{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474298166185.jpg</a>',shop:"dixi",SKU_name:"ПИВО ЖАТЕЦКИЙ ГУСЬ СВЕТЛОЕ АЛК.4.6.МЛ СБ О.5Л",price:"57",code:"4600682483502"},
								{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474295553226.jpg</a>',shop:"magnit",SKU_name:"СТАРОПРАМЕН пиво 0,5л с б (САН ИнБев):20",price:"71",code:"8593868000302"},
									{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474295584274.jpg</a>',shop:"magnit",SKU_name:"БАЛТИКА пиво N7 с/ б 0,5л 20",price:"55",code:"4600682931102"},
										{fileName:'<a href="app/SFA/photo/1474298039553.jpg" target="_blank" >1474295619289.jpg</a>',shop:"magnit",SKU_name:"ЛИПЕЦКИЙ БЮВЕТ мин. вода газ. 1,5л",price:"26",code:"4601201008794"}
		] 
});*/

Ext.define('modelReportPhotoSpy', {
    extend: 'Ext.data.Model',
    fileds: ['fileName','shop','SKU_name','price','code',{name:'indoor',type:'bool'}],
});

var storeReportPhotoSpy =  new Ext.data.Store({		        
			    pageSize: 30,
		        model: 'modelReportPhotoSpy',
		        proxy: 
		        {
		          type: 'ajax',
		          url: 'app/SFALite_ReportPhotoSpy.php?load=1',
		          reader: 
		          {
		            type: 'json',
		            root: 'rows',
					totalProperty: 'total'
		          }
		        }
		});

   
//-----------------window-----------------------------------------------------   
function show_SFALite_ReportPhotoSpy_Window()
{
	
	storeReportPhotoSpy.load();
	
	var pagingToolbarReportPhotoSpy = Ext.create('Ext.PagingToolbar', {
        border: false,
        frame: false,
        store: storeReportPhotoSpy,
        displayInfo: true
    });
	
	
	var gridReportPhotoSpy = new Ext.create('Ext.grid.Panel',{
		    selType: 'rowmodel',
		    columnLines: true,
		    store: storeReportPhotoSpy,
		    loadMask: true,
		    border: false,
		    autoScroll: true,
			bbar:[pagingToolbarReportPhotoSpy],
			tbar:[
				{
							tooltip: 'Обновить данные',
							iconCls: 'refresh',
	    		    		handler: function(){
								
							}
				},'-',{
                            xtype: 'datefield',
                            format: 'Y-m-d',
                            altFormats: 'Y-m-d',
                            startDay: 1,
                            fieldLabel: 'Период с',
                            labelAlign: 'left',
                            labelWidth: 60,
                            style:' margin-left:3px;',
                            //id: 'proceeds_startdt',
                            width: 165,
                            value: new Date(),
                            maxValue: new Date(),
                            listeners:{
                                change: function(newValue, oldValue, eOpts){

                                }
                            }
                },
                {
                             xtype: 'datefield',
                             format: 'Y-m-d',
                             altFormats: 'Y-m-d',
                             startDay: 1,
                             fieldLabel: 'Период по',
                             labelAlign: 'left',
                             labelWidth: 60,
                             //id: 'proceeds_enddt',
                             style:'margin-left:3px;',
                             width: 165,
                             value: new Date()
                },
                {
                            text: "Фильтровать",
                            //iconCls: 'left-right',
                            //id:'filter_data',
                            handler:function(){
                               
                            }
                }
			],
			columns:[
			{
				xtype: 'checkcolumn', 
				width: 30, 
				dataIndex: 'indoor', 
				hideable: false, 
				sortable: false,
				listeners:
                {
                    checkchange:function(CheckColumn, rowIndex, checked, eOpts )
                    {
						
					}
				}
			},
			{
	        	xtype: 'rownumberer',
				width: 30
	        },
			{
	        	text: 'Изображение',
	            dataIndex: 'fileName',            
	            flex: 1,
	            sortable: true
	        },
			{        	
	        	text: 'Магазин',
	            dataIndex: 'shop',
	            width: 80,
				sortable: true
	        },
			{
	        	text: 'SKU',
	            dataIndex: 'SKU_name',
	            width: 300,
				sortable: true
	        },
			{
	        	text: 'Цена',
	            dataIndex: 'price',
	            width: 80,
				sortable: true
	        },
			{
	        	text: 'Код',
	            dataIndex: 'code',
	            width: 120,
				sortable: true
	        }
			],
			listeners: {
				beforeedit: function(editor, ctx, e, eOpts, record)
				{
           
				},
				edit: function(editor, ctx, e, eOpts, record) {
           
				},
				itemdblclick: function(cmp, records) {    		
    		
				}
			}
	});

	
	if(!windowReportPhotoSpy){
        windowReportPhotoSpy = new Ext.Window({
                        width: 800,
                        height: 400,
                        title: SFALite.ReportPhotoSpy,
                        closeAction : 'destroy',
                        layout: 'fit',
                        resizable:true,
                        modal:true,
						constrainHeader: true,
                        //bodyStyle:{'background-color': '#FFFFFF'},
                 items:[
					gridReportPhotoSpy
				 ]
                     

        });    
         
    }
    windowReportPhotoSpy.show();
	
}