Commit 3290df65b938b085f6f9be7c42543135553b4c33
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !1
Showing
15 changed files
Show diff stats
.gitignore
File was created | 1 | /node_modules | |
2 | /dist | ||
3 | /tmp | ||
4 | package-lock\.json | ||
5 | |||
6 | src/etc/develop\.js | ||
7 |
.jshintrc
File was created | 1 | { | |
2 | /* | ||
3 | * ENVIRONMENTS | ||
4 | * ================= | ||
5 | */ | ||
6 | |||
7 | // Define globals exposed by modern browsers. | ||
8 | "browser": true, | ||
9 | |||
10 | // Define globals exposed by jQuery. | ||
11 | "jquery": true, | ||
12 | |||
13 | // Define globals exposed by Node.js. | ||
14 | "node": true, | ||
15 | |||
16 | // Allow ES6. | ||
17 | "esversion": 6, | ||
18 | |||
19 | /* | ||
20 | * ENFORCING OPTIONS | ||
21 | * ================= | ||
22 | */ | ||
23 | |||
24 | // Force all variable names to use either camelCase style or UPPER_CASE | ||
25 | // with underscores. | ||
26 | "camelcase": true, | ||
27 | |||
28 | // Prohibit use of == and != in favor of === and !==. | ||
29 | "eqeqeq": true, | ||
30 | |||
31 | // Enforce tab width of 2 spaces. | ||
32 | "indent": 4, | ||
33 | |||
34 | // Prohibit use of a variable before it is defined. | ||
35 | "latedef": false, | ||
36 | |||
37 | // Enforce line length to 100 characters | ||
38 | "maxlen": 100, | ||
39 | |||
40 | // Require capitalized names for constructor functions. | ||
41 | "newcap": true, | ||
42 | |||
43 | // Enforce use of single quotation marks for strings. | ||
44 | "quotmark": "single", | ||
45 | |||
46 | // Enforce placing 'use strict' at the top function scope | ||
47 | "strict": false, | ||
48 | |||
49 | // Prohibit use of explicitly undeclared variables. | ||
50 | "undef": true, | ||
51 | |||
52 | // Warn when variables are defined but never used. | ||
53 | "unused": true, | ||
54 | |||
55 | // Para que funcione en angular | ||
56 | "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | ||
57 | /* | ||
58 | * RELAXING OPTIONS | ||
59 | * ================= | ||
60 | */ | ||
61 | |||
62 | // Suppress warnings about == null comparisons. | ||
63 | "eqnull": true | ||
64 | } | ||
65 |
gulpfile.js
File was created | 1 | const templateCache = require('gulp-angular-templatecache'); | |
2 | const concat = require('gulp-concat'); | ||
3 | const htmlmin = require('gulp-htmlmin'); | ||
4 | const rename = require('gulp-rename'); | ||
5 | const uglify = require('gulp-uglify'); | ||
6 | const gulp = require('gulp'); | ||
7 | const pump = require('pump'); | ||
8 | const jshint = require('gulp-jshint'); | ||
9 | const replace = require('gulp-replace'); | ||
10 | const connect = require('gulp-connect'); | ||
11 | const clean = require('gulp-clean'); | ||
12 | |||
13 | var paths = { | ||
14 | srcJS: 'src/js/*.js', | ||
15 | srcViews: 'src/views/*.html', | ||
16 | tmp: 'tmp', | ||
17 | dist: 'dist/' | ||
18 | }; | ||
19 | |||
20 | gulp.task('clean', function() { | ||
21 | return gulp.src(['tmp', 'dist'], {read: false}) | ||
22 | .pipe(clean()); | ||
23 | }); | ||
24 | |||
25 | gulp.task('templates', ['clean'], function() { | ||
26 | return pump( | ||
27 | [ | ||
28 | gulp.src(paths.srcViews), | ||
29 | htmlmin(), | ||
30 | templateCache('views.js', { | ||
31 | module: 'focaModalInforme', | ||
32 | root: '' | ||
33 | }), | ||
34 | gulp.dest(paths.tmp) | ||
35 | ] | ||
36 | ); | ||
37 | }); | ||
38 | |||
39 | gulp.task('uglify', ['templates'], function() { | ||
40 | return pump( | ||
41 | [ | ||
42 | gulp.src([ | ||
43 | paths.srcJS, | ||
44 | 'tmp/views.js' | ||
45 | ]), | ||
46 | concat('foca-modal-informe.js'), | ||
47 | replace('src/views/', ''), | ||
48 | gulp.dest(paths.tmp), | ||
49 | rename('foca-modal-informe.min.js'), | ||
50 | uglify(), | ||
51 | gulp.dest(paths.dist) | ||
52 | ] | ||
53 | ); | ||
54 | }); | ||
55 | |||
56 | gulp.task('pre-commit', function() { | ||
57 | return pump( | ||
58 | [ | ||
59 | gulp.src(paths.srcJS), | ||
60 | jshint('.jshintrc'), | ||
61 | jshint.reporter('default'), | ||
62 | jshint.reporter('fail') | ||
63 | ] | ||
64 | ); | ||
65 | |||
66 | gulp.start('uglify'); | ||
67 | }); | ||
68 | |||
69 | gulp.task('webserver', function() { | ||
70 | pump [ | ||
71 | connect.server({port: 3000}) | ||
72 | ] | ||
73 | }); | ||
74 | |||
75 | gulp.task('clean-post-install', function() { | ||
76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | ||
77 | 'index.html'], {read: false}) | ||
78 | .pipe(clean()); | ||
79 | }); | ||
80 | |||
81 | gulp.task('default', ['webserver']); | ||
82 | |||
83 | gulp.task('watch', function() { | ||
84 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | ||
85 | }); | ||
86 | |||
87 | gulp.task('copy', ['uglify'], function() { | ||
88 | gulp.src('dist/*.js') | ||
89 | .pipe(gulp.dest('../wrapper-demo/node_modules/foca-informe-hoja-ruta/dist')); | ||
90 | }); | ||
91 | |||
92 | gulp.task('watchAndCopy', function() { | ||
93 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | ||
94 | }); | ||
95 |
package.json
File was created | 1 | { | |
2 | "name": "foca-modal-informe", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Modales generadoras de informes", | ||
5 | "scripts": { | ||
6 | "test": "echo \"Error: no test specified\" && exit 1", | ||
7 | "gulp-pre-commit": "gulp pre-commit", | ||
8 | "compile": "gulp uglify", | ||
9 | "postinstall": "npm run compile && gulp clean-post-install", | ||
10 | "install-dev": "npm install -D angular angular-ladda ladda@1.0.6 bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4 && npm i -D git+http://git.focasoftware.com/npm/foca-directivas.git" | ||
11 | }, | ||
12 | "pre-commit": [ | ||
13 | "gulp-pre-commit" | ||
14 | ], | ||
15 | "repository": { | ||
16 | "type": "git", | ||
17 | "url": "http://git.focasoftware.com/npm/foca-modal-informe" | ||
18 | }, | ||
19 | "author": "Foca software", | ||
20 | "license": "ISC", | ||
21 | "peerDependencies": { | ||
22 | "angular": "^1.7.4", | ||
23 | "bootstrap": "^4.1.3", | ||
24 | "font-awesome": "^4.7.0", | ||
25 | "ui-bootstrap4": "^3.0.4", | ||
26 | "gulp": "^3.9.1", | ||
27 | "gulp-angular-templatecache": "^2.2.1", | ||
28 | "gulp-concat": "^2.6.1", | ||
29 | "gulp-connect": "^5.6.1", | ||
30 | "gulp-htmlmin": "^5.0.1", | ||
31 | "gulp-rename": "^1.4.0", | ||
32 | "gulp-replace": "^1.0.0", | ||
33 | "gulp-uglify": "^3.0.1", | ||
34 | "jquery": "^3.3.1", | ||
35 | "pump": "^3.0.0", | ||
36 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git" | ||
37 | }, | ||
38 | "devDependencies": { | ||
39 | "angular": "^1.7.5", | ||
40 | "angular-ladda": "^0.4.3", | ||
41 | "bootstrap": "^4.1.3", | ||
42 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | ||
43 | "font-awesome": "^4.7.0", | ||
44 | "gulp": "^3.9.1", | ||
45 | "gulp-angular-templatecache": "^2.2.3", | ||
46 | "gulp-clean": "^0.4.0", | ||
47 | "gulp-concat": "^2.6.1", | ||
48 | "gulp-connect": "^5.6.1", | ||
49 | "gulp-htmlmin": "^5.0.1", | ||
50 | "gulp-jshint": "^2.1.0", | ||
51 | "gulp-rename": "^1.4.0", | ||
52 | "gulp-replace": "^1.0.0", | ||
53 | "gulp-uglify": "^3.0.1", | ||
54 | "jasmine-core": "^3.3.0", | ||
55 | "jquery": "^3.3.1", | ||
56 | "jshint": "^2.9.6", | ||
57 | "ladda": "1.0.6", | ||
58 | "pre-commit": "^1.2.2", | ||
59 | "pump": "^3.0.0", | ||
60 | "ui-bootstrap4": "^3.0.5" | ||
61 | } | ||
62 | } | ||
63 |
src/etc/develop.js.ejemplo
File was created | 1 | angular.module('focaModalInforme') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/app.js
File was created | 1 | angular.module('focaModalInforme', []); | |
2 |
src/js/controller-chofer.js
File was created | 1 | angular.module('focaModalInforme') | |
2 | .controller('focaModalInformeChoferController', | ||
3 | [ | ||
4 | '$filter', | ||
5 | '$scope', | ||
6 | '$uibModalInstance', | ||
7 | 'focaModalInformeChoferService', | ||
8 | 'i18nService', | ||
9 | function($filter, $scope, $uibModalInstance, | ||
10 | focaModalInformeChoferService, i18nService | ||
11 | ) { | ||
12 | var fecha = new Date(); | ||
13 | $scope.generando = false; | ||
14 | $scope.fechaHasta = new Date(); | ||
15 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | ||
16 | $scope.buscar = true; | ||
17 | $scope.informe = {}; | ||
18 | i18nService.setCurrentLang('es'); | ||
19 | $scope.gridOptions = { | ||
20 | enableGridMenu: true, | ||
21 | exporterMenuCsv: false, | ||
22 | exporterPdfPageSize: 'A4', | ||
23 | exporterPdfFooter: function(currentPage, pageCount) { | ||
24 | return { | ||
25 | columns: [ | ||
26 | {text: $filter('date')(new Date(), 'dd/MM/yyyy'), | ||
27 | margin: [40, 0]}, | ||
28 | {text: currentPage + ' de ' + pageCount, | ||
29 | margin: [28, 0], alignment: 'right'} | ||
30 | ] | ||
31 | }; | ||
32 | } | ||
33 | }; | ||
34 | $scope.generarInforme = function() { | ||
35 | $scope.generando = true; | ||
36 | focaModalInformeChoferService | ||
37 | .getDescargas( | ||
38 | $scope.fechaDesde.toISOString().split('.')[0], | ||
39 | $scope.fechaHasta.toISOString().split('.')[0] | ||
40 | ) | ||
41 | .then(function(res) { | ||
42 | var promesas = []; | ||
43 | $scope.gridOptions.data = orderData(res.data); | ||
44 | |||
45 | res.data.forEach(function(descargas) { | ||
46 | var idsRemito = descargas.map(function(descarga) { | ||
47 | return descarga.remito.id; | ||
48 | }); | ||
49 | idsRemito = eliminarDuplicados(idsRemito); | ||
50 | promesas.push( | ||
51 | focaModalInformeChoferService | ||
52 | .getDistanciaPorIdRemito(idsRemito)); | ||
53 | }); | ||
54 | return Promise.all(promesas); | ||
55 | }) | ||
56 | .then(function(res) { | ||
57 | res.forEach(function(movimiento, idx) { | ||
58 | //Calculo lts/km y los agrego a la grilla | ||
59 | var ltsPorKm = 0; | ||
60 | if (movimiento.data.totalKms) { | ||
61 | ltsPorKm = | ||
62 | $scope.gridOptions.data[idx].litros / | ||
63 | movimiento.data.totalKms; | ||
64 | } else { | ||
65 | ltsPorKm = $scope.gridOptions.data[idx].litros; | ||
66 | } | ||
67 | $scope.gridOptions.data[idx].kmRecorridos = | ||
68 | $filter('number')(movimiento.data.totalKms); | ||
69 | $scope.gridOptions.data[idx].ltsPorKm = | ||
70 | $filter('number')(ltsPorKm, 7); | ||
71 | }); | ||
72 | //TODO: sacar id empresa hardcodeado | ||
73 | return focaModalInformeChoferService.getEmpresa(1); | ||
74 | }) | ||
75 | .then(function(res) { | ||
76 | //Seteo filename para PDF y Excel, y cabecera de PDF | ||
77 | var filenameStamp = 'Informe choferes - ' + | ||
78 | $filter('date')(new Date(), 'dd/MM/yyyy'); | ||
79 | $scope.informe.nombreEmpresa = res.data.NOM.trim(); | ||
80 | $scope.informe.direccionEmpresa = res.data.DIR.trim(); | ||
81 | $scope.gridOptions.exporterPdfFilename = filenameStamp + '.pdf'; | ||
82 | $scope.gridOptions.exporterExcelFilename = filenameStamp + '.xlsx'; | ||
83 | $scope.gridOptions.exporterPdfHeader = { | ||
84 | columns: [ | ||
85 | { | ||
86 | text: $scope.informe.nombreEmpresa, | ||
87 | margin: [40, 0], | ||
88 | fontSize: 9 | ||
89 | }, | ||
90 | { | ||
91 | text: '\nInforme de choferes', | ||
92 | margin: [-170, -4, 0, 0], | ||
93 | fontSize: 12 | ||
94 | }, | ||
95 | { | ||
96 | text: [ | ||
97 | '\n\nFiltros: ', | ||
98 | 'Fecha desde: ', | ||
99 | $filter('date')($scope.fechaDesde, 'dd/MM/yyyy'), | ||
100 | ' Fecha hasta: ', | ||
101 | $filter('date')($scope.fechaHasta, 'dd/MM/yyyy') | ||
102 | ], | ||
103 | margin: [-380, 2, 0, 0], | ||
104 | fontSize: 9 | ||
105 | }, | ||
106 | { | ||
107 | text: $scope.informe.direccionEmpresa, | ||
108 | margin: [28, 0], | ||
109 | alignment: 'right', | ||
110 | fontSize: 9 | ||
111 | } | ||
112 | ] | ||
113 | }; | ||
114 | $scope.buscar = false; | ||
115 | $scope.generando = false; | ||
116 | }); | ||
117 | }; | ||
118 | $scope.volver = function() { | ||
119 | $scope.buscar = true; | ||
120 | }; | ||
121 | $scope.cancel = function() { | ||
122 | $uibModalInstance.dismiss('Cancelar'); | ||
123 | }; | ||
124 | |||
125 | function orderData(data) { | ||
126 | var result = []; | ||
127 | data.forEach(function(descargas) { | ||
128 | var row = { | ||
129 | chofer: descargas[0].remito.hojaRuta.chofer.nombre, | ||
130 | litros: 0 | ||
131 | }; | ||
132 | descargas.forEach(function(descarga) { | ||
133 | row.litros += descarga.cantidad; | ||
134 | }); | ||
135 | result.push(row); | ||
136 | }); | ||
137 | return result; | ||
138 | } | ||
139 | |||
140 | function eliminarDuplicados(datos) { | ||
141 | var result = []; | ||
142 | datos.forEach(function(dato) { | ||
143 | if (result.indexOf(dato) === -1) { | ||
144 | result.push(dato); | ||
145 | } | ||
146 | }); | ||
147 | return result; | ||
148 | } | ||
149 | } | ||
150 | ] | ||
151 | ); | ||
152 |
src/js/controller-general-unidad.js
File was created | 1 | angular.module('focaModalInforme') | |
2 | .controller('focaModalInformeGeneralUnidadController', | ||
3 | [ | ||
4 | '$filter', | ||
5 | '$scope', | ||
6 | '$uibModalInstance', | ||
7 | 'focaModalInformeGeneralUnidadService', | ||
8 | 'i18nService', | ||
9 | 'focaModalService', | ||
10 | function($filter, $scope, $uibModalInstance, | ||
11 | focaModalInformeGeneralUnidadService, i18nService, focaModalService | ||
12 | ) { | ||
13 | i18nService.setCurrentLang('es'); | ||
14 | var fecha = new Date(); | ||
15 | $scope.generando = false; | ||
16 | $scope.buscar = true; | ||
17 | $scope.informe = {}; | ||
18 | $scope.params = { | ||
19 | fechaHasta: new Date(), | ||
20 | fechaDesde: new Date(fecha.setMonth(fecha.getMonth() - 1)), | ||
21 | sector: undefined, | ||
22 | diferenciarProductos: false, | ||
23 | diferenciarMeses: false | ||
24 | }; | ||
25 | $scope.gridOptions = { | ||
26 | enableGridMenu: true, | ||
27 | exporterMenuCsv: false, | ||
28 | exporterPdfPageSize: 'A4', | ||
29 | exporterPdfFooter: function (currentPage, pageCount) { | ||
30 | return { | ||
31 | columns: [ | ||
32 | {text: $filter('date')(new Date(), 'dd/MM/yyyy'), | ||
33 | margin: [40, 0]}, | ||
34 | {text: currentPage + ' de ' + pageCount, | ||
35 | margin: [28, 0], alignment: 'right'} | ||
36 | ] | ||
37 | }; | ||
38 | }, | ||
39 | columnDefs: [ | ||
40 | { | ||
41 | field: 'vehiculo', | ||
42 | enableSorting: false, | ||
43 | cellClass: function(grid, row, col) { | ||
44 | if (grid.getCellValue(row,col).indexOf('Sector:') !== -1) | ||
45 | return 'yellow w-100'; | ||
46 | if (grid.getCellValue(row,col).indexOf('Producto:') !== -1) | ||
47 | return 'red w-100'; | ||
48 | if (grid.getCellValue(row,col).indexOf('Fecha:') !== -1) | ||
49 | return 'green w-100'; | ||
50 | } | ||
51 | }, | ||
52 | { | ||
53 | field: 'kmRecorridos', | ||
54 | enableSorting: false, | ||
55 | cellClass: function(grid, row, col) { | ||
56 | if (!grid.getCellValue(row,col)) | ||
57 | return 'd-none'; | ||
58 | } | ||
59 | }, | ||
60 | { | ||
61 | field: 'litrosRepartidos', | ||
62 | enableSorting: false, | ||
63 | cellClass: function(grid, row, col) { | ||
64 | if (!grid.getCellValue(row,col)) | ||
65 | return 'd-none'; | ||
66 | } | ||
67 | }, | ||
68 | { | ||
69 | field: 'viajes', | ||
70 | enableSorting: false, | ||
71 | cellClass: function(grid, row, col) { | ||
72 | if (!grid.getCellValue(row,col)) | ||
73 | return 'd-none'; | ||
74 | } | ||
75 | } | ||
76 | ] | ||
77 | }; | ||
78 | $scope.generarInforme = function() { | ||
79 | $scope.generando = true; | ||
80 | focaModalInformeGeneralUnidadService | ||
81 | .getInformeData($scope.params) | ||
82 | .then(function(res) { | ||
83 | var result = []; | ||
84 | |||
85 | res.data.forEach(function(sector) { | ||
86 | if (!$scope.params.sector || | ||
87 | $scope.params.sector.ID === sector.idSector) { | ||
88 | //AGREGO SECTORES | ||
89 | result.push({ | ||
90 | vehiculo: 'Sector: ' + | ||
91 | $filter('rellenarDigitos')(sector.idSector, 2, '0') + | ||
92 | ' - ' + sector.sector.trim() | ||
93 | }); | ||
94 | if (!$scope.params.diferenciarProductos) | ||
95 | sector.productos = unirProductos(sector.productos); | ||
96 | |||
97 | sector.productos.forEach(function(producto) { | ||
98 | //AGREGO PRODUCTOS | ||
99 | if ($scope.params.diferenciarProductos){ | ||
100 | result.push({ | ||
101 | vehiculo: 'Producto: ' + | ||
102 | producto.idProducto + | ||
103 | ' - ' + producto.producto | ||
104 | }); | ||
105 | } | ||
106 | if (!$scope.params.diferenciarMeses) { | ||
107 | producto.fechas = unirFechas(producto.fechas); | ||
108 | } | ||
109 | producto.fechas.forEach(function(fecha) { | ||
110 | //AGREGO FECHAS | ||
111 | if ($scope.params.diferenciarMeses) { | ||
112 | result.push({ | ||
113 | vehiculo: | ||
114 | 'Fecha: ' + fecha.month + ' - ' + fecha.year | ||
115 | }); | ||
116 | } else { | ||
117 | result.push({ | ||
118 | vehiculo: | ||
119 | 'Fecha: ' + fecha.year | ||
120 | }); | ||
121 | } | ||
122 | fecha.vehiculos.forEach(function(vehiculo) { | ||
123 | //AGREGO VEHICULOS | ||
124 | result.push({ | ||
125 | vehiculo: vehiculo.vehiculo, | ||
126 | kmRecorridos: | ||
127 | $filter('number')(vehiculo.data.kms, 2), | ||
128 | litrosRepartidos: | ||
129 | $filter('number')(vehiculo.data.lts, 2), | ||
130 | viajes: | ||
131 | $filter('number')(vehiculo.data.viajes, 0) | ||
132 | }); | ||
133 | }); | ||
134 | }); | ||
135 | }); | ||
136 | } | ||
137 | }); | ||
138 | |||
139 | $scope.gridOptions.data = result; | ||
140 | $scope.generando = false; | ||
141 | $scope.buscar = false; | ||
142 | }); | ||
143 | }; | ||
144 | |||
145 | $scope.seleccionarSector = function(key) { | ||
146 | if (key === 13) { | ||
147 | var parametrosModal = { | ||
148 | titulo: 'Búsqueda de Sector', | ||
149 | query: '/sector', | ||
150 | columnas: [ | ||
151 | { | ||
152 | nombre: 'Código', | ||
153 | propiedad: 'ID' | ||
154 | }, | ||
155 | { | ||
156 | nombre: 'Nombre', | ||
157 | propiedad: 'NOMBRE' | ||
158 | } | ||
159 | ], | ||
160 | size: 'md' | ||
161 | }; | ||
162 | focaModalService.modal(parametrosModal).then( | ||
163 | function(sector) { | ||
164 | $scope.params.sector = sector; | ||
165 | }, function() {} | ||
166 | ); | ||
167 | } | ||
168 | }; | ||
169 | $scope.volver = function() { | ||
170 | $scope.buscar = true; | ||
171 | }; | ||
172 | $scope.cancel = function() { | ||
173 | $uibModalInstance.dismiss('Cancelar'); | ||
174 | }; | ||
175 | |||
176 | function unirProductos(productos) { | ||
177 | var result = [{fechas: []}]; | ||
178 | productos.forEach(function(producto) { | ||
179 | producto.fechas.forEach(function(fecha) { | ||
180 | var existe = result[0].fechas.filter(function(result) { | ||
181 | return result.fecha === fecha.fecha; | ||
182 | }); | ||
183 | if (existe.length) { | ||
184 | existe[0].vehiculos = existe[0].vehiculos.concat(fecha.vehiculos); | ||
185 | } else { | ||
186 | result[0].fechas.push(fecha); | ||
187 | } | ||
188 | |||
189 | }); | ||
190 | }); | ||
191 | result[0].fechas.forEach(function(fecha) { | ||
192 | fecha.vehiculos = unirVehiculos(fecha.vehiculos); | ||
193 | }); | ||
194 | return result; | ||
195 | } | ||
196 | |||
197 | function unirFechas(fechas) { | ||
198 | var results = []; | ||
199 | fechas.forEach(function(fecha) { | ||
200 | var existe = results.filter(function(result) { | ||
201 | return result.year === fecha.year; | ||
202 | }); | ||
203 | |||
204 | if (existe.length) { | ||
205 | existe[0].vehiculos = existe[0].vehiculos.concat(fecha.vehiculos); | ||
206 | } else { | ||
207 | results.push({ | ||
208 | year: fecha.year, | ||
209 | vehiculos: fecha.vehiculos | ||
210 | }); | ||
211 | } | ||
212 | }); | ||
213 | |||
214 | results.forEach(function(result) { | ||
215 | result.vehiculos = unirVehiculos(result.vehiculos); | ||
216 | }); | ||
217 | return results; | ||
218 | } | ||
219 | |||
220 | function unirVehiculos(vehiculos) { | ||
221 | var results = []; | ||
222 | vehiculos.forEach(function(vehiculo) { | ||
223 | var existe = results.filter(function(result) { | ||
224 | return result.vehiculo === vehiculo.vehiculo; | ||
225 | }); | ||
226 | |||
227 | if (existe.length) { | ||
228 | existe[0].data.kms += vehiculo.data.kms; | ||
229 | existe[0].data.lts += vehiculo.data.lts; | ||
230 | existe[0].data.viajes += vehiculo.data.viajes; | ||
231 | } else { | ||
232 | results.push(vehiculo); | ||
233 | } | ||
234 | }); | ||
235 | return results; | ||
236 | } | ||
237 | |||
238 | |||
239 | } | ||
240 | ] | ||
241 | ); | ||
242 |
src/js/controller-hoja-ruta.js
File was created | 1 | angular.module('focaModalInforme') | |
2 | .controller('focaModalInformeHojaRutaController', | ||
3 | [ | ||
4 | '$filter', | ||
5 | '$scope', | ||
6 | '$uibModalInstance', | ||
7 | 'focaModalInformeHojaRutaService', | ||
8 | 'i18nService', | ||
9 | 'uiGridConstants', | ||
10 | function($filter, $scope, $uibModalInstance, | ||
11 | focaModalInformeHojaRutaService, i18nService, uiGridConstants | ||
12 | ) { | ||
13 | var fecha = new Date(); | ||
14 | $scope.fechaHasta = new Date(); | ||
15 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | ||
16 | $scope.buscar = true; | ||
17 | $scope.informe = {}; | ||
18 | i18nService.setCurrentLang('es'); | ||
19 | $scope.gridOptions = { | ||
20 | enableHorizontalScrollbar: uiGridConstants.scrollbars.ALWAYS, | ||
21 | enableVerticalScrollbar: uiGridConstants.scrollbars.WHEN_NEEDED, | ||
22 | enableGridMenu: true, | ||
23 | exporterMenuCsv: false, | ||
24 | exporterPdfPageSize: 'A4', | ||
25 | exporterPdfFooter: function (currentPage, pageCount) { | ||
26 | return { | ||
27 | columns: [ | ||
28 | {text: $filter('date')(new Date(), 'dd/MM/yyyy'), | ||
29 | margin: [40, 0]}, | ||
30 | {text: currentPage + ' de ' + pageCount, | ||
31 | margin: [28, 0], alignment: 'right'} | ||
32 | ] | ||
33 | }; | ||
34 | }, | ||
35 | |||
36 | }; | ||
37 | $scope.generarInforme = function() { | ||
38 | focaModalInformeHojaRutaService | ||
39 | .getHojasRuta( | ||
40 | $scope.fechaDesde.toISOString().split('.')[0], | ||
41 | $scope.fechaHasta.toISOString().split('.')[0] | ||
42 | ) | ||
43 | .then(function(res) { | ||
44 | $scope.gridOptions.data = res.data.map(function(hojaRuta) { | ||
45 | return { | ||
46 | sucursal: hojaRuta.sucursal, | ||
47 | numero: hojaRuta.numeroHojaRuta, | ||
48 | transportista: hojaRuta.transportista.NOM, | ||
49 | unidad: hojaRuta.vehiculo.codigo, | ||
50 | chofer: hojaRuta.chofer.nombre, | ||
51 | fechaDeReparto: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy') | ||
52 | }; | ||
53 | }); | ||
54 | |||
55 | //TODO: sacar id empresa hardcodeado | ||
56 | return focaModalInformeHojaRutaService.getEmpresa(1); | ||
57 | }) | ||
58 | .then(function(res) { | ||
59 | var filenameStamp = 'Informe de correlatividad de hojas de ruta - ' + | ||
60 | $filter('date')(new Date(), 'dd/MM/yyyy'); | ||
61 | $scope.informe.nombreEmpresa = res.data.NOM.trim(); | ||
62 | $scope.informe.direccionEmpresa = res.data.DIR.trim(); | ||
63 | $scope.gridOptions.exporterPdfFilename = filenameStamp + '.pdf'; | ||
64 | $scope.gridOptions.exporterExcelFilename = filenameStamp + '.xlsx'; | ||
65 | $scope.gridOptions.exporterPdfHeader = { | ||
66 | columns: [ | ||
67 | { | ||
68 | text: $scope.informe.nombreEmpresa, | ||
69 | margin: [40, 0], | ||
70 | fontSize: 9 | ||
71 | }, | ||
72 | { | ||
73 | text: '\nInforme de correlatividad de hojas de ruta', | ||
74 | margin: [-170, -4, 0, 0], | ||
75 | fontSize: 12 | ||
76 | }, | ||
77 | { | ||
78 | text: [ | ||
79 | '\n\nFiltros: ', | ||
80 | 'Fecha desde: ', | ||
81 | $filter('date')($scope.fechaDesde, 'dd/MM/yyyy'), | ||
82 | ' Fecha hasta: ', | ||
83 | $filter('date')($scope.fechaHasta, 'dd/MM/yyyy') | ||
84 | ], | ||
85 | margin: [-380, 2, 0, 0], | ||
86 | fontSize: 9 | ||
87 | }, | ||
88 | { | ||
89 | text: $scope.informe.direccionEmpresa, | ||
90 | margin: [28, 0], | ||
91 | alignment: 'right', | ||
92 | fontSize: 9 | ||
93 | } | ||
94 | ] | ||
95 | }; | ||
96 | $scope.buscar = false; | ||
97 | }); | ||
98 | }; | ||
99 | $scope.volver = function() { | ||
100 | $scope.buscar = true; | ||
101 | }; | ||
102 | $scope.cancel = function() { | ||
103 | $uibModalInstance.dismiss('Cancelar'); | ||
104 | }; | ||
105 | } | ||
106 | ] | ||
107 | ); | ||
108 |
src/js/controller-litros-km-unidad.js
File was created | 1 | angular.module('focaModalInforme') | |
2 | .controller('focaModalInformeLitrosKmUnidadController', | ||
3 | [ | ||
4 | '$filter', | ||
5 | '$scope', | ||
6 | '$uibModalInstance', | ||
7 | 'focaModalInformeLitrosKmUnidadService', | ||
8 | 'i18nService', | ||
9 | 'focaModalService', | ||
10 | '$uibModal', | ||
11 | function($filter, $scope, $uibModalInstance, focaModalInformeLitrosKmUnidadService, | ||
12 | i18nService, focaModalService, $uibModal | ||
13 | ) { | ||
14 | var meses = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', | ||
15 | 'jul', 'ago', 'sep', 'oct', 'nov', 'dic']; | ||
16 | var fecha = new Date(); | ||
17 | $scope.generando = false; | ||
18 | $scope.fechaHasta = new Date(); | ||
19 | $scope.fechaDesde = new Date(fecha.setMonth(fecha.getMonth() - 1)); | ||
20 | $scope.buscar = true; | ||
21 | $scope.informe = {}; | ||
22 | i18nService.setCurrentLang('es'); | ||
23 | $scope.gridOptions = { | ||
24 | enableGridMenu: true, | ||
25 | exporterMenuCsv: false, | ||
26 | exporterPdfPageSize: 'A4', | ||
27 | exporterPdfFooter: function (currentPage, pageCount) { | ||
28 | return { | ||
29 | columns: [ | ||
30 | {text: $filter('date')(new Date(), 'dd/MM/yyyy'), | ||
31 | margin: [40, 0]}, | ||
32 | {text: currentPage + ' de ' + pageCount, | ||
33 | margin: [28, 0], alignment: 'right'} | ||
34 | ] | ||
35 | }; | ||
36 | }, | ||
37 | columnDefs: [ | ||
38 | { | ||
39 | field: 'fecha', | ||
40 | enableSorting: false, | ||
41 | cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | ||
42 | if (grid.getCellValue(row,col).indexOf('Sector:') !== -1) | ||
43 | return 'yellow w-100'; | ||
44 | if (grid.getCellValue(row,col).indexOf('Producto:') !== -1) | ||
45 | return 'red w-100'; | ||
46 | } | ||
47 | }, | ||
48 | { | ||
49 | field: 'litrosRepartidos', | ||
50 | enableSorting: false, | ||
51 | cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | ||
52 | if (!grid.getCellValue(row,col)) | ||
53 | return 'd-none'; | ||
54 | } | ||
55 | }, | ||
56 | { | ||
57 | field: 'kmRecorridos', | ||
58 | enableSorting: false, | ||
59 | cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | ||
60 | if (!grid.getCellValue(row,col)) | ||
61 | return 'd-none'; | ||
62 | } | ||
63 | }, | ||
64 | { | ||
65 | field: 'lts/Km', | ||
66 | enableSorting: false, | ||
67 | cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | ||
68 | if (!grid.getCellValue(row,col)) | ||
69 | return 'd-none'; | ||
70 | } | ||
71 | } | ||
72 | ] | ||
73 | |||
74 | }; | ||
75 | $scope.generarInforme = function() { | ||
76 | if(!$scope.unidad){ | ||
77 | focaModalService.alert('Primero seleccione una unidad'); | ||
78 | return; | ||
79 | } | ||
80 | $scope.generando = true; | ||
81 | focaModalInformeLitrosKmUnidadService | ||
82 | .getDescargas( | ||
83 | $scope.unidad.id, | ||
84 | $scope.fechaDesde.toISOString().split('.')[0], | ||
85 | $scope.fechaHasta.toISOString().split('.')[0] | ||
86 | ) | ||
87 | .then(function(res) { | ||
88 | var result = []; | ||
89 | res.data.forEach(function(sector) { | ||
90 | result.push({ | ||
91 | fecha: 'Sector: ' + | ||
92 | $filter('rellenarDigitos')(sector[0].articulo.CodSec, 2, '0') + | ||
93 | ' - ' + sector[0].articulo.sector.NOMBRE.trim() | ||
94 | }); | ||
95 | sector.forEach(function(cisternaCarga) { | ||
96 | result.push({ | ||
97 | fecha: 'Producto: ' + | ||
98 | cisternaCarga.articulo.CodArt + | ||
99 | ' - ' + cisternaCarga.articulo.DetArt | ||
100 | }); | ||
101 | cisternaCarga.cisternaMovimientos.forEach(function(cisternaMovimiento) { | ||
102 | var lts = cisternaMovimiento.lts; | ||
103 | var kms = cisternaMovimiento.kms; | ||
104 | |||
105 | result.push({ | ||
106 | fecha: meses[cisternaMovimiento.month] + ' - ' + cisternaMovimiento.year, | ||
107 | litrosRepartidos: $filter('number')(lts, 2), | ||
108 | kmRecorridos: $filter('number')(kms, 2), | ||
109 | 'lts/Km': (kms) ? $filter('number')(lts / kms, 2) : lts | ||
110 | }); | ||
111 | }); | ||
112 | }); | ||
113 | }); | ||
114 | $scope.gridOptions.data = result; | ||
115 | $scope.generando = false; | ||
116 | $scope.buscar = false; | ||
117 | }); | ||
118 | }; | ||
119 | $scope.seleccionarTransportista = function() { | ||
120 | var parametrosModal = { | ||
121 | titulo: 'Búsqueda de Transportista', | ||
122 | query: '/transportista', | ||
123 | columnas: [ | ||
124 | { | ||
125 | propiedad: 'COD', | ||
126 | nombre: 'Código', | ||
127 | filtro: { | ||
128 | nombre: 'rellenarDigitos', | ||
129 | parametro: 5 | ||
130 | } | ||
131 | }, | ||
132 | { | ||
133 | propiedad: 'NOM', | ||
134 | nombre: 'Nombre' | ||
135 | }, | ||
136 | { | ||
137 | propiedad: 'CUIT', | ||
138 | nombre: 'CUIT' | ||
139 | } | ||
140 | ], | ||
141 | size: 'md' | ||
142 | }; | ||
143 | return focaModalService.modal(parametrosModal) | ||
144 | }; | ||
145 | |||
146 | $scope.seleccionarUnidad = function() { | ||
147 | $scope.seleccionarTransportista().then( | ||
148 | function(transportista) { | ||
149 | var parametrosModal = { | ||
150 | titulo: 'Búsqueda de vehículos', | ||
151 | query: '/vehiculo/transportista/' + transportista.COD, | ||
152 | columnas: [ | ||
153 | { | ||
154 | propiedad: 'codigo', | ||
155 | nombre: 'Código' | ||
156 | }, | ||
157 | { | ||
158 | propiedad: 'tractor', | ||
159 | nombre: 'Tractor' | ||
160 | }, | ||
161 | { | ||
162 | propiedad: 'semi', | ||
163 | nombre: 'Semi' | ||
164 | }, | ||
165 | { | ||
166 | propiedad: 'tractor', | ||
167 | nombre: 'Tractor' | ||
168 | } | ||
169 | ], | ||
170 | size: 'md' | ||
171 | }; | ||
172 | focaModalService.modal(parametrosModal).then( | ||
173 | function(unidad) { | ||
174 | $scope.unidad = unidad; | ||
175 | }, function() { | ||
176 | $scope.seleccionarUnidad(); | ||
177 | }); | ||
178 | }); | ||
179 | }; | ||
180 | $scope.volver = function() { | ||
181 | $scope.buscar = true; | ||
182 | }; | ||
183 | $scope.cancel = function() { | ||
184 | $uibModalInstance.dismiss('Cancelar'); | ||
185 | }; | ||
186 | } | ||
187 | ] | ||
188 | ); | ||
189 |
src/js/service.js
File was created | 1 | angular.module('focaModalInforme') | |
2 | .factory('focaModalInformeChoferService', [ | ||
3 | '$http', | ||
4 | 'API_ENDPOINT', | ||
5 | function($http, API_ENDPOINT) { | ||
6 | return { | ||
7 | getDescargas: function(fechaDesde, fechaHasta) { | ||
8 | return $http.post(API_ENDPOINT.URL + '/informe/chofer', | ||
9 | {fechaDesde: fechaDesde, fechaHasta: fechaHasta}); | ||
10 | }, | ||
11 | getEmpresa: function(id) { | ||
12 | return $http.get(API_ENDPOINT.URL + '/empresa/' + id); | ||
13 | }, | ||
14 | getDistanciaPorIdRemito: function(ids) { | ||
15 | return $http.post(API_ENDPOINT.URL + '/remito/distancia', {ids: ids}); | ||
16 | } | ||
17 | }; | ||
18 | } | ||
19 | ]) | ||
20 | .factory('focaModalInformeGeneralUnidadService', [ | ||
21 | '$http', | ||
22 | 'API_ENDPOINT', | ||
23 | function($http, API_ENDPOINT) { | ||
24 | return { | ||
25 | getEmpresa: function(id) { | ||
26 | return $http.get(API_ENDPOINT.URL + '/empresa/' + id); | ||
27 | }, | ||
28 | getInformeData: function(params) { | ||
29 | return $http.post(API_ENDPOINT.URL + '/informe/general-unidad-reparto', {params: params}); | ||
30 | } | ||
31 | }; | ||
32 | } | ||
33 | ]) | ||
34 | .factory('focaModalInformeLitrosKmUnidadService', [ | ||
35 | '$http', | ||
36 | 'API_ENDPOINT', | ||
37 | function($http, API_ENDPOINT) { | ||
38 | return { | ||
39 | getDescargas: function(idVehiculo, fechaDesde, fechaHasta) { | ||
40 | return $http.post(API_ENDPOINT.URL + '/informe/litros-por-km', | ||
41 | {idVehiculo: idVehiculo, fechaDesde: fechaDesde, fechaHasta: fechaHasta}); | ||
42 | }, | ||
43 | getEmpresa: function(id) { | ||
44 | return $http.get(API_ENDPOINT.URL + '/empresa/' + id); | ||
45 | }, | ||
46 | getDistanciaPorIdRemito: function(ids) { | ||
47 | return $http.post(API_ENDPOINT.URL + '/remito/distancia', {ids: ids}); | ||
48 | } | ||
49 | }; | ||
50 | } | ||
51 | ]) | ||
52 | .factory('focaModalInformeHojaRutaService', [ | ||
53 | '$http', | ||
54 | 'API_ENDPOINT', | ||
55 | function($http, API_ENDPOINT) { | ||
56 | return { | ||
57 | getHojasRuta: function(fechaDesde, fechaHasta) { | ||
58 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/listar/' + | ||
59 | fechaDesde + '/' + fechaHasta); | ||
60 | }, | ||
61 | getEmpresa: function(id) { | ||
62 | return $http.get(API_ENDPOINT.URL + '/empresa/' + id); | ||
63 | } | ||
64 | }; | ||
65 | } | ||
66 | ]); |
src/views/informe-chofer.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-6" ng-bind="informe.nombreEmpresa" ng-hide="buscar"></div> | ||
4 | <div class="col-6 text-right" ng-bind="informe.direccionEmpresa" ng-hide="buscar"></div> | ||
5 | <div class="col-12"><h5 class="modal-title">Informe de choferes</h5></div> | ||
6 | <div class="col-12" ng-hide="buscar">Filtros: Fecha desde: {{fechaDesde | date: 'dd/MM/yyyy'}} Fecha hasta: {{fechaHasta | date: 'dd/MM/yyyy'}}</div> | ||
7 | </div> | ||
8 | </div> | ||
9 | <div class="modal-body" id="modal-body"> | ||
10 | <div class="input-group row" | ||
11 | ng-show="buscar"> | ||
12 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> | ||
13 | <div class="col-md-4 col-8 input-group mb-2"> | ||
14 | <div class="input-group-prepend"> | ||
15 | <div class="input-group-text form-control-sm"> | ||
16 | <i class="fa fa-calendar"></i> | ||
17 | </div> | ||
18 | </div> | ||
19 | <input | ||
20 | class="form-control form-control-sm" | ||
21 | id="inlineFormInputGroup" | ||
22 | type="text" | ||
23 | ng-model="fechaDesde" | ||
24 | ng-required="true" | ||
25 | uib-datepicker-popup="dd/MM/yyyy" | ||
26 | show-button-bar="false" | ||
27 | is-open="datepickerOpen" | ||
28 | on-open-focus="false" | ||
29 | ng-focus="datepickerOpen = true" | ||
30 | datepicker-options="dateOptions" | ||
31 | /> | ||
32 | </div> | ||
33 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> | ||
34 | <div class="col-md-4 col-8 input-group mb-2"> | ||
35 | <div class="input-group-prepend"> | ||
36 | <div class="input-group-text form-control-sm"> | ||
37 | <i class="fa fa-calendar"></i> | ||
38 | </div> | ||
39 | </div> | ||
40 | <input | ||
41 | class="form-control form-control-sm" | ||
42 | id="inlineFormInputGroup" | ||
43 | type="text" | ||
44 | ng-model="fechaHasta" | ||
45 | ng-required="true" | ||
46 | uib-datepicker-popup="dd/MM/yyyy" | ||
47 | show-button-bar="false" | ||
48 | is-open="datepicker2Open" | ||
49 | on-open-focus="false" | ||
50 | ng-focus="datepicker2Open = true" | ||
51 | /> | ||
52 | </div> | ||
53 | </div> | ||
54 | <div | ||
55 | ng-if="!buscar" | ||
56 | class="row"> | ||
57 | <div class="col-12"> | ||
58 | <div | ||
59 | class="gridInforme" | ||
60 | ui-grid="gridOptions" | ||
61 | ui-grid-exporter | ||
62 | ui-grid-resize-columns | ||
63 | ></div> | ||
64 | </div> | ||
65 | </div> | ||
66 | </div> | ||
67 | <div class="modal-footer py-1"> | ||
68 | <button | ||
69 | class="btn btn-sm btn-secondary" | ||
70 | type="button" | ||
71 | ng-click="cancel()" | ||
72 | ng-show="buscar">Cancelar</button> | ||
73 | <button | ||
74 | ladda="generando" | ||
75 | class="btn btn-sm btn-secondary" | ||
76 | type="button" | ||
77 | ng-click="generarInforme()" | ||
78 | ng-show="buscar">Generar</button> | ||
79 | <button | ||
80 | class="btn btn-sm btn-secondary" | ||
81 | type="button" | ||
82 | ng-click="volver()" | ||
83 | ng-hide="buscar">Volver</button> | ||
84 | </div> | ||
85 |
src/views/informe-general-unidad.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-6" ng-bind="informe.nombreEmpresa" ng-hide="buscar"></div> | ||
4 | <div class="col-6 text-right" ng-bind="informe.direccionEmpresa" ng-hide="buscar"></div> | ||
5 | <div class="col-12"><h5 class="modal-title">Informe general por unidad de reparto</h5></div> | ||
6 | <div class="col-12" ng-hide="buscar">Filtros: Fecha desde: {{params.fechaDesde | date: 'dd/MM/yyyy'}} Fecha hasta: {{params.fechaHasta | date: 'dd/MM/yyyy'}}</div> | ||
7 | </div> | ||
8 | </div> | ||
9 | <div class="modal-body" id="modal-body"> | ||
10 | |||
11 | <div class="input-group row" | ||
12 | ng-show="buscar"> | ||
13 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> | ||
14 | <div class="col-md-4 col-8 input-group mb-2"> | ||
15 | <div class="input-group-prepend"> | ||
16 | <div class="input-group-text form-control-sm"> | ||
17 | <i class="fa fa-calendar"></i> | ||
18 | </div> | ||
19 | </div> | ||
20 | <input | ||
21 | class="form-control form-control-sm" | ||
22 | id="inlineFormInputGroup" | ||
23 | type="text" | ||
24 | ng-model="params.fechaDesde" | ||
25 | ng-required="true" | ||
26 | uib-datepicker-popup="dd/MM/yyyy" | ||
27 | show-button-bar="false" | ||
28 | is-open="datepickerOpen" | ||
29 | on-open-focus="false" | ||
30 | ng-focus="datepickerOpen = true" | ||
31 | datepicker-options="dateOptions" | ||
32 | /> | ||
33 | </div> | ||
34 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> | ||
35 | <div class="col-md-4 col-8 input-group mb-2"> | ||
36 | <div class="input-group-prepend"> | ||
37 | <div class="input-group-text form-control-sm"> | ||
38 | <i class="fa fa-calendar"></i> | ||
39 | </div> | ||
40 | </div> | ||
41 | <input | ||
42 | class="form-control form-control-sm" | ||
43 | id="inlineFormInputGroup" | ||
44 | type="text" | ||
45 | ng-model="params.fechaHasta" | ||
46 | ng-required="true" | ||
47 | uib-datepicker-popup="dd/MM/yyyy" | ||
48 | show-button-bar="false" | ||
49 | is-open="datepicker2Open" | ||
50 | on-open-focus="false" | ||
51 | ng-focus="datepicker2Open = true" | ||
52 | /> | ||
53 | </div> | ||
54 | <small class="col-md-2 col-4 text-left my-1">Sector</small> | ||
55 | <div class="col-md-4 col-8 input-group mb-2"> | ||
56 | <input | ||
57 | class="form-control form-control-sm" | ||
58 | id="inlineFormInputGroup" | ||
59 | type="text" | ||
60 | ng-model="params.sector.NOMBRE" | ||
61 | ng-required="true" | ||
62 | ng-keypress="seleccionarSector($event.keyCode)" | ||
63 | /> | ||
64 | <div class="input-group-append"> | ||
65 | <div class="input-group-append" ng-hide="ingreso"> | ||
66 | <button | ||
67 | ladda="searchLoading" | ||
68 | data-spinner-color="#FF0000" | ||
69 | class="btn btn-outline-secondary" | ||
70 | type="button" | ||
71 | ng-click="seleccionarSector(13)"> | ||
72 | <i class="fa fa-search" aria-hidden="true"></i> | ||
73 | </button> | ||
74 | </div> | ||
75 | </div> | ||
76 | </div> | ||
77 | <small class="col-md-4 col-8 text-left my-1">Diferenciar productos</small> | ||
78 | <div class="col-md-2 col-4 input-group mb-2"> | ||
79 | <div class="custom-control custom-checkbox ml-auto"> | ||
80 | <input | ||
81 | type="checkbox" | ||
82 | class="custom-control-input" | ||
83 | ng-model="params.diferenciarProductos" | ||
84 | id="customCheck1"> | ||
85 | <label class="custom-control-label" for="customCheck1"></label> | ||
86 | </div> | ||
87 | </div> | ||
88 | <small class="col-md-4 col-8 text-left my-1">Detallar por mes</small> | ||
89 | <div class="col-md-2 col-4 input-group mb-2"> | ||
90 | <div class="custom-control custom-checkbox ml-auto"> | ||
91 | <input | ||
92 | type="checkbox" | ||
93 | class="custom-control-input" | ||
94 | ng-model="params.diferenciarMeses" | ||
95 | id="customCheck2"> | ||
96 | <label class="custom-control-label" for="customCheck2"></label> | ||
97 | </div> | ||
98 | </div> | ||
99 | </div> | ||
100 | <div | ||
101 | ng-if="!buscar" | ||
102 | class="row"> | ||
103 | <div class="col-12"> | ||
104 | <div | ||
105 | class="gridInforme" | ||
106 | ui-grid="gridOptions" | ||
107 | ui-grid-exporter | ||
108 | ui-grid-resize-columns | ||
109 | ></div> | ||
110 | </div> | ||
111 | </div> | ||
112 | </div> | ||
113 | <div class="modal-footer py-1"> | ||
114 | <button | ||
115 | class="btn btn-sm btn-secondary" | ||
116 | type="button" | ||
117 | ng-click="cancel()" | ||
118 | ng-show="buscar">Cancelar</button> | ||
119 | <button | ||
120 | ladda="generando" | ||
121 | class="btn btn-sm btn-secondary" | ||
122 | type="button" | ||
123 | ng-click="generarInforme()" | ||
124 | ng-show="buscar">Generar</button> | ||
125 | <button | ||
126 | class="btn btn-sm btn-secondary" | ||
127 | type="button" | ||
128 | ng-click="volver()" | ||
129 | ng-hide="buscar">Volver</button> | ||
130 | </div> | ||
131 |
src/views/informe-hoja-ruta.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-6" ng-bind="informe.nombreEmpresa" ng-hide="buscar"></div> | ||
4 | <div class="col-6 text-right" ng-bind="informe.direccionEmpresa" ng-hide="buscar"></div> | ||
5 | <div class="col-12"><h5 class="modal-title">Informe de correlatividad de hojas de ruta</h5></div> | ||
6 | <div class="col-12" ng-hide="buscar">Filtros: Fecha desde: {{fechaDesde | date: 'dd/MM/yyyy'}} Fecha hasta: {{fechaHasta | date: 'dd/MM/yyyy'}}</div> | ||
7 | </div> | ||
8 | </div> | ||
9 | <div class="modal-body" id="modal-body"> | ||
10 | |||
11 | <div class="input-group row" | ||
12 | ng-show="buscar"> | ||
13 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> | ||
14 | <div class="col-md-4 col-8 input-group mb-2"> | ||
15 | <div class="input-group-prepend"> | ||
16 | <div class="input-group-text form-control-sm"> | ||
17 | <i class="fa fa-calendar"></i> | ||
18 | </div> | ||
19 | </div> | ||
20 | <input | ||
21 | class="form-control form-control-sm" | ||
22 | id="inlineFormInputGroup" | ||
23 | ladda="searchLoading" | ||
24 | type="text" | ||
25 | ng-model="fechaDesde" | ||
26 | ng-required="true" | ||
27 | uib-datepicker-popup="dd/MM/yyyy" | ||
28 | show-button-bar="false" | ||
29 | is-open="datepickerOpen" | ||
30 | on-open-focus="false" | ||
31 | ng-focus="datepickerOpen = true" | ||
32 | datepicker-options="dateOptions" | ||
33 | /> | ||
34 | </div> | ||
35 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> | ||
36 | <div class="col-md-4 col-8 input-group mb-2"> | ||
37 | <div class="input-group-prepend"> | ||
38 | <div class="input-group-text form-control-sm"> | ||
39 | <i class="fa fa-calendar"></i> | ||
40 | </div> | ||
41 | </div> | ||
42 | <input | ||
43 | class="form-control form-control-sm" | ||
44 | id="inlineFormInputGroup" | ||
45 | ladda="searchLoading" | ||
46 | type="text" | ||
47 | ng-model="fechaHasta" | ||
48 | ng-required="true" | ||
49 | uib-datepicker-popup="dd/MM/yyyy" | ||
50 | show-button-bar="false" | ||
51 | is-open="datepicker2Open" | ||
52 | on-open-focus="false" | ||
53 | ng-focus="datepicker2Open = true" | ||
54 | /> | ||
55 | </div> | ||
56 | </div> | ||
57 | <div | ||
58 | ng-if="!buscar" | ||
59 | class="row"> | ||
60 | <div class="col-12"> | ||
61 | <div | ||
62 | class="gridInforme" | ||
63 | ui-grid="gridOptions" | ||
64 | ui-grid-exporter | ||
65 | ui-grid-resize-columns | ||
66 | ></div> | ||
67 | </div> | ||
68 | </div> | ||
69 | </div> | ||
70 | <div class="modal-footer py-1"> | ||
71 | <button | ||
72 | class="btn btn-sm btn-secondary" | ||
73 | type="button" | ||
74 | ng-click="cancel()" | ||
75 | ng-show="buscar">Cancelar</button> | ||
76 | <button | ||
77 | class="btn btn-sm btn-secondary" | ||
78 | type="button" | ||
79 | ng-click="generarInforme()" | ||
80 | ng-show="buscar">Generar</button> | ||
81 | <button | ||
82 | class="btn btn-sm btn-secondary" | ||
83 | type="button" | ||
84 | ng-click="volver()" | ||
85 | ng-hide="buscar">Volver</button> | ||
86 | </div> | ||
87 |
src/views/informe-litros-km-unidad.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-6" ng-bind="informe.nombreEmpresa" ng-hide="buscar"></div> | ||
4 | <div class="col-6 text-right" ng-bind="informe.direccionEmpresa" ng-hide="buscar"></div> | ||
5 | <div class="col-12"><h5 class="modal-title">Informe de litros por km recorrido por unidad de reparto</h5></div> | ||
6 | <div class="col-12" ng-hide="buscar">Filtros: Fecha desde: {{fechaDesde | date: 'dd/MM/yyyy'}} Fecha hasta: {{fechaHasta | date: 'dd/MM/yyyy'}}</div> | ||
7 | </div> | ||
8 | </div> | ||
9 | <div class="modal-body" id="modal-body"> | ||
10 | <div class="input-group row" | ||
11 | ng-show="buscar"> | ||
12 | <small class="col-md-2 col-4 text-left my-1">Fecha Desde</small> | ||
13 | <div class="col-md-4 col-8 input-group mb-2"> | ||
14 | <div class="input-group-prepend"> | ||
15 | <div class="input-group-text form-control-sm"> | ||
16 | <i class="fa fa-calendar"></i> | ||
17 | </div> | ||
18 | </div> | ||
19 | <input | ||
20 | class="form-control form-control-sm" | ||
21 | id="inlineFormInputGroup" | ||
22 | type="text" | ||
23 | ng-model="fechaDesde" | ||
24 | ng-required="true" | ||
25 | uib-datepicker-popup="dd/MM/yyyy" | ||
26 | show-button-bar="false" | ||
27 | is-open="datepickerOpen" | ||
28 | on-open-focus="false" | ||
29 | ng-focus="datepickerOpen = true" | ||
30 | datepicker-options="dateOptions" | ||
31 | /> | ||
32 | </div> | ||
33 | <small class="col-md-2 col-4 text-left my-1">Fecha Hasta</small> | ||
34 | <div class="col-md-4 col-8 input-group mb-2"> | ||
35 | <div class="input-group-prepend"> | ||
36 | <div class="input-group-text form-control-sm"> | ||
37 | <i class="fa fa-calendar"></i> | ||
38 | </div> | ||
39 | </div> | ||
40 | <input | ||
41 | class="form-control form-control-sm" | ||
42 | id="inlineFormInputGroup" | ||
43 | type="text" | ||
44 | ng-model="fechaHasta" | ||
45 | ng-required="true" | ||
46 | uib-datepicker-popup="dd/MM/yyyy" | ||
47 | show-button-bar="false" | ||
48 | is-open="datepicker2Open" | ||
49 | on-open-focus="false" | ||
50 | ng-focus="datepicker2Open = true" | ||
51 | /> | ||
52 | </div> | ||
53 | <small class="col-md-2 col-4 text-left my-1">Unidad</small> | ||
54 | <div class="col-md-4 col-8 input-group mb-2"> | ||
55 | <input | ||
56 | class="form-control form-control-sm" | ||
57 | id="inlineFormInputGroup" | ||
58 | type="text" | ||
59 | ng-model="unidad.codigo" | ||
60 | ng-required="true" | ||
61 | ng-keypress="seleccionarUnidad($event.keyCode)" | ||
62 | /> | ||
63 | <div class="input-group-append"> | ||
64 | <div class="input-group-append" ng-hide="ingreso"> | ||
65 | <button | ||
66 | ladda="searchLoading" | ||
67 | data-spinner-color="#FF0000" | ||
68 | class="btn btn-outline-secondary" | ||
69 | type="button" | ||
70 | ng-click="seleccionarUnidad(13)"> | ||
71 | <i class="fa fa-search" aria-hidden="true"></i> | ||
72 | </button> | ||
73 | </div> | ||
74 | </div> | ||
75 | </div> | ||
76 | </div> | ||
77 | <div | ||
78 | ng-if="!buscar" | ||
79 | class="row"> | ||
80 | <div class="col-12"> | ||
81 | <div | ||
82 | class="gridInforme" | ||
83 | ui-grid="gridOptions" | ||
84 | ui-grid-exporter | ||
85 | ui-grid-resize-columns | ||
86 | ></div> | ||
87 | </div> | ||
88 | </div> | ||
89 | </div> | ||
90 | <div class="modal-footer py-1"> | ||
91 | <button | ||
92 | class="btn btn-sm btn-secondary" | ||
93 | type="button" | ||
94 | ng-click="cancel()" | ||
95 | ng-show="buscar">Cancelar</button> | ||
96 | <button | ||
97 | ladda="generando" | ||
98 | class="btn btn-sm btn-secondary" | ||
99 | type="button" | ||
100 | ng-click="generarInforme()" | ||
101 | ng-show="buscar">Generar</button> | ||
102 | <button | ||
103 | class="btn btn-sm btn-secondary" | ||
104 | type="button" | ||
105 | ng-click="volver()" | ||
106 | ng-hide="buscar">Volver</button> | ||
107 | </div> | ||
108 |