Commit 73f912e7d45ff7875582ce79e586334964b55fb4

Authored by Helder
1 parent 576578fa
Exists in master

Atualização contendo as telas de relatório

wscacicneo/static/relatorio.js
  1 +/*TABELA DE RELATÓRIOS*/
  2 +
1 Ext.define('User',{ 3 Ext.define('User',{
2 extend: 'Ext.data.Model', 4 extend: 'Ext.data.Model',
3 - fields: [ 'codigo', 'orgao', 'date' ] 5 + fields: [ 'marca', 'modelo', 'fabricacao', 'quantidade' ],
4 }); 6 });
5 7
6 var userStore = Ext.create('Ext.data.Store', { 8 var userStore = Ext.create('Ext.data.Store', {
7 model: 'User', 9 model: 'User',
8 data: [ 10 data: [
9 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
10 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
11 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
12 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
13 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
14 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
15 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
16 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
17 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
18 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
19 - { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },  
20 - ] 11 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  12 + { marca: 'AMD', modelo: 'AMD 3.2GHZ', fabricacao: '08/22/2008', quantidade: '26' },
  13 +
  14 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  15 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  16 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  17 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  18 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  19 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  20 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  21 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  22 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  23 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  24 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  25 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  26 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  27 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  28 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  29 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  30 + { marca: 'INTEL', modelo: 'CORE I7 3.2GHZ', fabricacao: '12/12/2014', quantidade: '32' },
  31 + { marca: 'AMD', modelo: 'AMD 3.2GHZ', fabricacao: '08/22/2008', quantidade: '26' },
  32 + ],
  33 + autoLoad: false,
  34 +
  35 + id:'simpsonsStore',
21 }); 36 });
22 37
23 table = Ext.create('Ext.grid.Panel', { 38 table = Ext.create('Ext.grid.Panel', {
24 store: userStore, 39 store: userStore,
25 width: 400, 40 width: 400,
26 - height: 200, 41 + height: 300,
27 // title: 'Application Users', 42 // title: 'Application Users',
28 columns: [ 43 columns: [
29 { 44 {
30 - text: 'Codigo', 45 + text: 'MARCA',
31 width: 75, 46 width: 75,
32 sortable: true, 47 sortable: true,
33 hideable: false, 48 hideable: false,
34 - dataIndex: 'codigo' 49 + dataIndex: 'marca'
35 }, 50 },
36 { 51 {
37 - text: 'Orgao', 52 + text: 'MODELO',
38 width: 300, 53 width: 300,
39 - dataIndex: 'orgao', 54 + dataIndex: 'modelo',
40 hidden: false, 55 hidden: false,
41 }, 56 },
42 { 57 {
43 - text: 'Data', 58 + text: 'FABRICAÇÃO',
44 sortable: false, 59 sortable: false,
45 width:80, 60 width:80,
46 - renderer: Ext.util.Format.dateRenderer('m/d/Y'), 61 + renderer: Ext.util.Format.dateRenderer('d/m/Y'),
47 flex: 1, 62 flex: 1,
48 - dataIndex: 'date' 63 + dataIndex: 'fabricacao'
49 }, 64 },
50 -  
51 - ] 65 + {
  66 + text: 'QUANTIDADE',
  67 + sortable: false,
  68 + width:80,
  69 + dataIndex: 'quantidade'
  70 + },
  71 + ],
  72 + tbar:[
  73 +
  74 +
  75 + 'Exportar PDF',
  76 + { xtype: 'tbfill'},
  77 + 'Imprimir',
  78 + { xtype: 'tbfill'},
  79 + 'Favorito',
  80 + { xtype: 'tbfill'},
  81 + 'Voltar',
  82 + { xtype: 'tbfill'},
  83 +
  84 + ]
  85 +});
  86 +
  87 +/*COMEÇANDO PAGINAÇÃO - LEMBRANDO QUE TODA A PAGINAÇÃO NÃO ESTÁ COMPLETAMENTE FUNCIONANDO.
  88 +APENAS PARA QUESTÃO DE DOCUMENTAÇÃO.*/
  89 +
  90 +
  91 +var itemsPerPage = 2; // set the number of items you want per page
  92 +
  93 +var store = Ext.create('Ext.data.Store', {
  94 + id:'simpsonsStore',
  95 + autoLoad: false,
  96 + fields:['name', 'email', 'phone'],
  97 + pageSize: itemsPerPage, // items per page
  98 + proxy: {
  99 + type: 'ajax',
  100 + url: 'pagingstore.js', // url that will load data with respect to start and limit params
  101 + reader: {
  102 + type: 'json',
  103 + root: 'items',
  104 + totalProperty: 'total'
  105 + }
  106 + }
  107 +});
  108 +
  109 +
  110 +
  111 +
  112 +// specify segment of data you want to load using params
  113 +store.load({
  114 + params:{
  115 + start:0,
  116 + limit: itemsPerPage
  117 + }
52 }); 118 });
53 119
54 tabela = Ext.create('Ext.panel.Panel', { 120 tabela = Ext.create('Ext.panel.Panel', {
55 layout: 'fit', 121 layout: 'fit',
56 - title: 'Relatorios de Coletas', 122 + title: 'Relatorio de coletas por PROCESSADOR',
57 width: '75%', 123 width: '75%',
58 frame: true, 124 frame: true,
59 draggable: true, 125 draggable: true,
@@ -64,11 +130,17 @@ tabela = Ext.create('Ext.panel.Panel', { @@ -64,11 +130,17 @@ tabela = Ext.create('Ext.panel.Panel', {
64 margin: '0px auto 15px auto' 130 margin: '0px auto 15px auto'
65 }, 131 },
66 items: table, 132 items: table,
67 -});  
68 133
69 -Ext.onReady(function(){ 134 + dockedItems: [{
  135 + xtype: 'pagingtoolbar',
  136 + store: userStore, // same store GridPanel is using
  137 + dock: 'bottom',
  138 + displayInfo: true
  139 + }],
70 140
  141 +});
71 142
  143 +Ext.onReady(function(){
72 Ext.create('Ext.Container', { 144 Ext.create('Ext.Container', {
73 padding: '15px', 145 padding: '15px',
74 items: [tabela], 146 items: [tabela],
@@ -77,16 +149,15 @@ Ext.onReady(function(){ @@ -77,16 +149,15 @@ Ext.onReady(function(){
77 149
78 }); 150 });
79 151
80 -// **** GRAFICO DE PIZZA **** 152 +
  153 +//CRIANDO GRAFICO
  154 +
81 155
82 var store = Ext.create('Ext.data.JsonStore', { 156 var store = Ext.create('Ext.data.JsonStore', {
83 fields: ['name', 'data'], 157 fields: ['name', 'data'],
84 data: [ 158 data: [
85 - { 'name': 'dado1', 'data': 2 },  
86 - { 'name': 'dado2', 'data': 2 },  
87 - { 'name': 'dado3', 'data': 4 },  
88 - { 'name': 'dado4', 'data': 10 },  
89 - { 'name': 'dado5', 'data': 20 } 159 + { 'name': 'INTEL', 'data': 32 },
  160 + { 'name': 'AMD', 'data': 26 }
90 ]}); 161 ]});
91 162
92 var chart = Ext.create('Ext.chart.Chart', { 163 var chart = Ext.create('Ext.chart.Chart', {
@@ -133,7 +204,7 @@ var chart = Ext.create('Ext.chart.Chart', { @@ -133,7 +204,7 @@ var chart = Ext.create('Ext.chart.Chart', {
133 204
134 widget = Ext.create('Ext.panel.Panel', { 205 widget = Ext.create('Ext.panel.Panel', {
135 layout: 'fit', 206 layout: 'fit',
136 - title: 'Relatório', 207 + title: 'Grafico de relatório por PROCESSADORES',
137 width: '75%', 208 width: '75%',
138 frame: true, 209 frame: true,
139 draggable: true, 210 draggable: true,
@@ -143,7 +214,15 @@ widget = Ext.create('Ext.panel.Panel', { @@ -143,7 +214,15 @@ widget = Ext.create('Ext.panel.Panel', {
143 "text-align": 'center', 214 "text-align": 'center',
144 margin: '-35px auto 15px auto' 215 margin: '-35px auto 15px auto'
145 }, 216 },
146 - items: chart 217 + items: chart,
  218 +
  219 + tbar:[
  220 + 'Exportar PDF',
  221 + { xtype: 'tbfill'},
  222 + 'Imprimir',
  223 + { xtype: 'tbfill'},
  224 + ]
  225 +
147 }); 226 });
148 227
149 Ext.onReady(function(){ 228 Ext.onReady(function(){
@@ -158,3 +237,4 @@ Ext.onReady(function(){ @@ -158,3 +237,4 @@ Ext.onReady(function(){
158 }); 237 });
159 238
160 239
  240 +
wscacicneo/static/reports.js
1 -fakeHtml = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat placerat convallis. Nullam diam nunc, auctor mollis adipiscing id, tristique in velit. Proin eu sodales ipsum. Nunc vel erat orci. Maecenas quis tortor sit amet elit interdum vehicula. Mauris vitae urna neque, in tincidunt mi. Praesent sapien neque, imperdiet in lobortis in, tempus ut dolor. Aliquam pretium eleifend diam sit amet mattis. In tincidunt fringilla nunc, in feugiat tellus dignissim in. Nam faucibus nisi vel metus pulvinar nec commodo sapien condimentum. Nullam rutrum, lacus a aliquam tincidunt, elit lectus dapibus felis, nec mattis mauris sapien sed ante. Suspendisse suscipit lorem et orci egestas sodales. Phasellus scelerisque fermentum est id lobortis.<br>Morbi eu mauris nibh, id faucibus tellus. '; 1 +/*GRAFICO DE ORGÃOS*/
2 2
3 -report1 = Ext.create('Ext.panel.Panel', { 3 +
  4 +
  5 +Ext.define('User',{
  6 + extend: 'Ext.data.Model',
  7 + fields: [ 'codigo', 'orgao', 'date' ]
  8 +});
  9 +
  10 +var userStore = Ext.create('Ext.data.Store', {
  11 + model: 'User',
  12 + data: [
  13 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  14 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  15 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  16 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  17 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  18 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  19 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  20 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  21 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  22 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  23 + { codigo: '27236', orgao: 'Minist&eacuterio da Fazenda', date: '12/12/2014' },
  24 + ]
  25 +});
  26 +
  27 +table = Ext.create('Ext.grid.Panel', {
  28 + store: userStore,
  29 + width: 400,
  30 + height: 200,
  31 + // title: 'Application Users',
  32 + columns: [
  33 + {
  34 + xtype: 'checkcolumn',
  35 + allowBlank: false,
  36 + dataIndex: 'active',
  37 + width: 60,
  38 + editor:{
  39 + xtype: 'checkbox',
  40 + cls: 'item'
  41 + },
  42 + },
  43 + {
  44 + text: 'Codigo',
  45 + width: 75,
  46 + sortable: true,
  47 + hideable: false,
  48 + dataIndex: 'codigo'
  49 + },
  50 + {
  51 + text: 'Orgao',
  52 + width: 300,
  53 + dataIndex: 'orgao',
  54 + hidden: false,
  55 + },
  56 + {
  57 + text: 'Data',
  58 + sortable: false,
  59 + width:80,
  60 + renderer: Ext.util.Format.dateRenderer('m/d/Y'),
  61 + flex: 1,
  62 + dataIndex: 'date'
  63 + },
  64 +
  65 + ]
  66 +});
  67 +
  68 +tabela = Ext.create('Ext.panel.Panel', {
4 layout: 'fit', 69 layout: 'fit',
5 - title: 'Relatório1',  
6 - width: '75%',  
7 - frame: true,  
8 - html: fakeHtml,  
9 - draggable: true,  
10 - collapsible: true,  
11 - style: {  
12 - margin: '0px auto 15px auto'  
13 - },  
14 - tools: [{  
15 - type: 'print',  
16 - handler: function(){  
17 - }  
18 - }]  
19 -});  
20 -  
21 -report2 = Ext.create('Ext.panel.Panel', {  
22 - layout: 'fit',  
23 - title: 'Relatório2',  
24 - width: '75%',  
25 - frame: true,  
26 - html: fakeHtml + fakeHtml,  
27 - draggable: true,  
28 - collapsible: true,  
29 - border : true,  
30 - style: {  
31 - margin: '0px auto 15px auto'  
32 - },  
33 - tools: [{  
34 - type: 'print',  
35 - handler: function(){  
36 - }  
37 - }] 70 + title: 'Relatorios de Coletas',
  71 + width: '75%',
  72 + frame: true,
  73 + draggable: true,
  74 + collapsible: true,
  75 + border : true,
  76 + style: {
  77 + "text-align": 'center',
  78 + margin: '0px auto 15px auto'
  79 + },
  80 + items: table,
38 }); 81 });
39 82
40 Ext.onReady(function(){ 83 Ext.onReady(function(){
41 84
42 - Ext.create('Ext.Container', {  
43 - padding: '15px',  
44 - items: [report1, report2],  
45 - renderTo: 'widgets'  
46 - });  
47 85
  86 + Ext.create('Ext.Container', {
  87 + padding: '15px',
  88 + items: [tabela],
  89 + renderTo: 'widgets'
  90 + });
  91 +
  92 +});
  93 +
  94 +
  95 +
  96 +
  97 +
  98 +// **** FILTRO DE ITENS ****
  99 +
  100 +Ext.define('User1',{
  101 + extend: 'Ext.data.Model',
  102 + fields: ['chbox', 'item' ]
48 }); 103 });
  104 +
  105 +var userStore1 = Ext.create('Ext.data.Store', {
  106 + model: 'User1',
  107 + data: [
  108 + { item: 'Computador'},
  109 + { item: 'Processador'},
  110 + { item: 'Memórias'},
  111 + { item: 'Hard Disk (HD)'},
  112 + { item: 'Sistemas Operacionais'},
  113 + { item: 'Suítes de Escritórios'},
  114 + { item: 'Ativos de Redes'},
  115 + { item: 'Softwares Básicos'},
  116 + ]
  117 +});
  118 +
  119 +table1 = Ext.create('Ext.grid.Panel', {
  120 + store: userStore1,
  121 + width: 400,
  122 + height: 200,
  123 + // title: 'Application Users',
  124 + columns: [
  125 + {
  126 + text: 'Item',
  127 + width: 500,
  128 + sortable: true,
  129 + hideable: false,
  130 + dataIndex: 'item'
  131 + },
  132 + ]
  133 +});
  134 +
  135 +tabela1 = Ext.create('Ext.panel.Panel', {
  136 + layout: 'fit',
  137 + title: 'Gerar Relatório',
  138 + width: '75%',
  139 + frame: true,
  140 + draggable: true,
  141 + collapsible: true,
  142 + border : true,
  143 + style: {
  144 + "text-align": 'center',
  145 + margin: '0px auto 15px auto'
  146 + },
  147 + items: table1,
  148 +});
  149 +
  150 +Ext.onReady(function(){
  151 +
  152 +
  153 + Ext.create('Ext.Container', {
  154 + padding:'15px',
  155 + items: [tabela1],
  156 + renderTo: 'widgets'
  157 + });
  158 +
  159 +});
  160 +
  161 +
wscacicneo/templates/relatorios.pt
1 <metal:main use-macro="load: master.pt"> 1 <metal:main use-macro="load: master.pt">
2 <!-- Insere JavaScript --> 2 <!-- Insere JavaScript -->
3 <!-- <script metal:fill-slot="javascript" type="text/javascript" src="static/teste-tabelag.js"></script> --> 3 <!-- <script metal:fill-slot="javascript" type="text/javascript" src="static/teste-tabelag.js"></script> -->
4 - <script metal:fill-slot="javascript" type="text/javascript" src="static/teste-helder.js"></script> 4 + <script metal:fill-slot="javascript" type="text/javascript" src="static/relatorio.js"></script>
5 5
6 <!--<script metal:fill-slot="javascript" type="text/javascript" src="static/WMI.js"></script>--> 6 <!--<script metal:fill-slot="javascript" type="text/javascript" src="static/WMI.js"></script>-->
7 7
wscacicneo/templates/reports.pt
1 <metal:main use-macro="load: master.pt"> 1 <metal:main use-macro="load: master.pt">
2 <!-- Insere JavaScript --> 2 <!-- Insere JavaScript -->
3 <!-- <script metal:fill-slot="javascript" type="text/javascript" src="static/reports.js"></script>--> 3 <!-- <script metal:fill-slot="javascript" type="text/javascript" src="static/reports.js"></script>-->
4 -<script metal:fill-slot="javascript" type="text/javascript" src="static/teste-helder.js"></script> 4 +<script metal:fill-slot="javascript" type="text/javascript" src="static/reports.js"></script>
5 5
6 <div metal:fill-slot="conteudo" id="widgets"></div> 6 <div metal:fill-slot="conteudo" id="widgets"></div>
7 </metal:main> 7 </metal:main>