Commit 6723c0403e22b1ba98fe9ccda4c06985c0830c85

Authored by Jose Pinto
1 parent ddce87f264
Exists in master

agrego foca-botonera-facturador

1 { 1 {
2 "name": "foca-crear-hoja-ruta", 2 "name": "foca-crear-hoja-ruta",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "foca-crear-hoja-ruta", 4 "description": "foca-crear-hoja-ruta",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 10 "postinstall": "npm run compile && gulp clean-post-install",
11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git" 11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-botonera-facturador.git git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-remito.git"
12 }, 12 },
13 "pre-commit": [ 13 "pre-commit": [
14 "gulp-pre-commit" 14 "gulp-pre-commit"
15 ], 15 ],
16 "repository": { 16 "repository": {
17 "type": "git", 17 "type": "git",
18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git" 18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git"
19 }, 19 },
20 "author": "Foca Software", 20 "author": "Foca Software",
21 "license": "ISC", 21 "license": "ISC",
22 "devDependencies": { 22 "devDependencies": {
23 "angular": "^1.7.5", 23 "angular": "^1.7.5",
24 "angular-ladda": "^0.4.3", 24 "angular-ladda": "^0.4.3",
25 "angular-route": "^1.7.5", 25 "angular-route": "^1.7.5",
26 "bootstrap": "^4.1.3", 26 "bootstrap": "^4.1.3",
27 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", 27 "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git",
28 "foca-modal-remito": "git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git", 28 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
29 "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git",
29 "font-awesome": "^4.7.0", 30 "font-awesome": "^4.7.0",
30 "gulp": "^3.9.1", 31 "gulp": "^3.9.1",
31 "gulp-angular-templatecache": "^2.2.5", 32 "gulp-angular-templatecache": "^2.2.5",
32 "gulp-clean": "^0.4.0", 33 "gulp-clean": "^0.4.0",
33 "gulp-concat": "^2.6.1", 34 "gulp-concat": "^2.6.1",
34 "gulp-connect": "^5.6.1", 35 "gulp-connect": "^5.6.1",
35 "gulp-htmlmin": "^5.0.1", 36 "gulp-htmlmin": "^5.0.1",
36 "gulp-jshint": "^2.1.0", 37 "gulp-jshint": "^2.1.0",
37 "gulp-rename": "^1.4.0", 38 "gulp-rename": "^1.4.0",
38 "gulp-replace": "^1.0.0", 39 "gulp-replace": "^1.0.0",
39 "gulp-sequence": "^1.0.0", 40 "gulp-sequence": "^1.0.0",
40 "gulp-uglify": "^3.0.1", 41 "gulp-uglify": "^3.0.1",
41 "jasmine-core": "^3.3.0", 42 "jasmine-core": "^3.3.0",
42 "jquery": "^3.3.1", 43 "jquery": "^3.3.1",
43 "jshint": "^2.9.6", 44 "jshint": "^2.9.6",
44 "ladda": "1.0.6", 45 "ladda": "1.0.6",
45 "pre-commit": "^1.2.2", 46 "pre-commit": "^1.2.2",
46 "pump": "^3.0.0", 47 "pump": "^3.0.0",
47 "ui-bootstrap4": "^3.0.5" 48 "ui-bootstrap4": "^3.0.5"
48 } 49 }
49 } 50 }
50 51
src/js/controller.js
1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', 1 angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService',
4 function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { 4 function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) {
5 $scope.botonera = [ 5
6 {texto: 'Transportista', imagen: '../img/abmPrecios.png', 6 $scope.botonera = crearHojaRutaService.getBotonera();
7 accion: function() {$scope.seleccionarProveedor();}},
8 {texto: 'Chofer', imagen: '../img/abmPrecios.png',
9 accion: function() {$scope.seleccionarChofer();}},
10 {texto: 'Vehículo', imagen: '../img/abmPrecios.png',
11 accion: function() {$scope.seleccionarVehiculo();}},
12 {texto: 'Tarifario', imagen: '../img/abmPrecios.png',
13 accion: function() {$scope.seleccionarTarifario();}},
14 {texto: 'Remitos', imagen: '../img/abmPrecios.png',
15 accion: function() {$scope.seleccionarRemito();}},
16 {texto: '', accion: function() {}}
17 ];
18 $scope.datepickerAbierto = false; 7 $scope.datepickerAbierto = false;
19 8
20 $scope.show = false; 9 $scope.show = false;
21 $scope.cargando = true; 10 $scope.cargando = true;
22 $scope.dateOptions = { 11 $scope.dateOptions = {
23 maxDate: new Date(), 12 maxDate: new Date(),
24 minDate: new Date(2010, 0, 1) 13 minDate: new Date(2010, 0, 1)
25 }; 14 };
26 15
27 $scope.hojaRuta = { 16 $scope.hojaRuta = {
28 fecha: new Date(), 17 fecha: new Date(),
29 litros: 0, 18 litros: 0,
30 chofer: {}, 19 chofer: {},
31 vehiculo: { 20 vehiculo: {
32 capacidad: 0 21 capacidad: 0
33 }, 22 },
34 transportista: {}, 23 transportista: {},
35 tarifario: { 24 tarifario: {
36 costo: null 25 costo: null
37 } 26 }
38 }; 27 };
39 28
40 $scope.cabecera = []; 29 $scope.cabecera = [];
41 $scope.showCabecera = true; 30 $scope.showCabecera = true;
42 31
43 $scope.now = new Date(); 32 $scope.now = new Date();
44 $scope.puntoVenta = '0000'; 33 $scope.puntoVenta = '0000';
45 $scope.comprobante = '00000000'; 34 $scope.comprobante = '00000000';
46 $scope.remitosTabla = []; 35 $scope.remitosTabla = [];
47 $scope.idLista = undefined; 36 $scope.idLista = undefined;
48 //La pantalla solo se usa para cargar pedidos 37 //La pantalla solo se usa para cargar pedidos
49 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); 38 //var hojaRutaTemp = crearHojaRutaService.getHojaRuta();
50 39
51 crearHojaRutaService.getNumeroHojaRuta().then( 40 crearHojaRutaService.getNumeroHojaRuta().then(
52 function(res) { 41 function(res) {
53 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); 42 $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4);
54 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); 43 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
55 }, 44 },
56 function(err) { 45 function(err) {
57 focaModalService.alert('La terminal no esta configurada correctamente'); 46 focaModalService.alert('La terminal no esta configurada correctamente');
58 console.info(err); 47 console.info(err);
59 } 48 }
60 ); 49 );
61 //La pantalla solo se usa para cargar pedidos 50 //La pantalla solo se usa para cargar pedidos
62 // if (hojaRutaTemp !== undefined) { 51 // if (hojaRutaTemp !== undefined) {
63 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); 52 // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga);
64 // $scope.hojaRuta = hojaRutaTemp; 53 // $scope.hojaRuta = hojaRutaTemp;
65 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); 54 // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString();
66 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); 55 // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString();
67 // $scope.idLista = $scope.hojaRuta.precioCondicion; 56 // $scope.idLista = $scope.hojaRuta.precioCondicion;
68 // crearHojaRutaService 57 // crearHojaRutaService
69 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( 58 // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then(
70 // function(res) { 59 // function(res) {
71 // $scope.remitosTabla = res.data; 60 // $scope.remitosTabla = res.data;
72 // } 61 // }
73 // ); 62 // );
74 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 63 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
75 //(NO REQUERIDO EN ESTA VERSION) 64 //(NO REQUERIDO EN ESTA VERSION)
76 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( 65 // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then(
77 // function(res) { 66 // function(res) {
78 // $scope.hojaRuta.domicilio = res.data; 67 // $scope.hojaRuta.domicilio = res.data;
79 // } 68 // }
80 // ); 69 // );
81 // } else { 70 // } else {
82 // $scope.hojaRuta.fechaCarga = new Date(); 71 // $scope.hojaRuta.fechaCarga = new Date();
83 // $scope.hojaRuta.bomba = '0'; 72 // $scope.hojaRuta.bomba = '0';
84 // $scope.hojaRuta.flete = '0'; 73 // $scope.hojaRuta.flete = '0';
85 // $scope.idLista = undefined; 74 // $scope.idLista = undefined;
86 // } 75 // }
87 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 76 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
88 // $scope.addNewDom = function() { 77 // $scope.addNewDom = function() {
89 // $scope.hojaRuta.domicilio.push({ 'id': 0 }); 78 // $scope.hojaRuta.domicilio.push({ 'id': 0 });
90 // }; 79 // };
91 // $scope.removeNewChoice = function(choice) { 80 // $scope.removeNewChoice = function(choice) {
92 // if ($scope.hojaRuta.domicilio.length > 1) { 81 // if ($scope.hojaRuta.domicilio.length > 1) {
93 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( 82 // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex(
94 // function(c) { 83 // function(c) {
95 // return c.$$hashKey === choice.$$hashKey; 84 // return c.$$hashKey === choice.$$hashKey;
96 // } 85 // }
97 // ), 1); 86 // ), 1);
98 // } 87 // }
99 // }; 88 // };
100 89
101 $scope.crearHojaRuta = function() { 90 $scope.crearHojaRuta = function() {
102 if($scope.hojaRuta.litros <= 0) { 91 if($scope.hojaRuta.litros <= 0) {
103 focaModalService.alert('Ingrese Remitos'); 92 focaModalService.alert('Ingrese Remitos');
104 return; 93 return;
105 } 94 }
106 95
107 if(!$scope.hojaRuta.chofer.id) { 96 if(!$scope.hojaRuta.chofer.id) {
108 focaModalService.alert('Ingrese Chofer'); 97 focaModalService.alert('Ingrese Chofer');
109 return; 98 return;
110 } 99 }
111 100
112 if(!$scope.hojaRuta.vehiculo.id) { 101 if(!$scope.hojaRuta.vehiculo.id) {
113 focaModalService.alert('Ingrese Vehiculo'); 102 focaModalService.alert('Ingrese Vehiculo');
114 return; 103 return;
115 } 104 }
116 105
117 if(!$scope.hojaRuta.transportista.codigo) { 106 if(!$scope.hojaRuta.transportista.codigo) {
118 focaModalService.alert('Ingrese Transportista'); 107 focaModalService.alert('Ingrese Transportista');
119 return; 108 return;
120 } 109 }
121 110
122 if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { 111 if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) {
123 focaModalService.alert( 112 focaModalService.alert(
124 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' 113 'La capacidad del Vehiculo es menor a lo ingresado en Remitos'
125 ); 114 );
126 return; 115 return;
127 } 116 }
128 117
129 if(!$scope.hojaRuta.tarifario.costo) { 118 if(!$scope.hojaRuta.tarifario.costo) {
130 focaModalService.alert('Ingrese Tarifario'); 119 focaModalService.alert('Ingrese Tarifario');
131 return; 120 return;
132 } 121 }
133 122
134 var date = new Date(); 123 var date = new Date();
135 var save = { 124 var save = {
136 hojaRuta: { 125 hojaRuta: {
137 id: 0, 126 id: 0,
138 fechaCreacion: 127 fechaCreacion:
139 new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 128 new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
140 .toISOString().slice(0, 19) .replace('T', ' '), 129 .toISOString().slice(0, 19) .replace('T', ' '),
141 idTransportista: $scope.hojaRuta.transportista.codigo, 130 idTransportista: $scope.hojaRuta.transportista.codigo,
142 idChofer: $scope.hojaRuta.chofer.id, 131 idChofer: $scope.hojaRuta.chofer.id,
143 idVehiculo: $scope.hojaRuta.vehiculo.id, 132 idVehiculo: $scope.hojaRuta.vehiculo.id,
144 tarifaFlete: $scope.hojaRuta.tarifario.costo 133 tarifaFlete: $scope.hojaRuta.tarifario.costo
145 }, 134 },
146 remitos: $scope.remitosTabla 135 remitos: $scope.remitosTabla
147 }; 136 };
148 137
149 crearHojaRutaService.crearHojaRuta(save).then( 138 crearHojaRutaService.crearHojaRuta(save).then(
150 function(data) { 139 function(data) {
151 focaModalService.alert( 140 focaModalService.alert(
152 'Hoja ruta creada Nº: ' + 141 'Hoja ruta creada Nº: ' +
153 $scope.rellenar(data.data.sucursal, 4) + 142 $scope.rellenar(data.data.sucursal, 4) +
154 '-' + 143 '-' +
155 $scope.rellenar(data.data.numeroHojaRuta, 8) 144 $scope.rellenar(data.data.numeroHojaRuta, 8)
156 ); 145 );
157 $scope.hojaRuta = { 146 $scope.hojaRuta = {
158 fecha: new Date(), 147 fecha: new Date(),
159 litros: 0, 148 litros: 0,
160 chofer: {}, 149 chofer: {},
161 vehiculo: { 150 vehiculo: {
162 capacidad: 0 151 capacidad: 0
163 }, 152 },
164 transportista: {}, 153 transportista: {},
165 tarifario: { 154 tarifario: {
166 costo: null 155 costo: null
167 } 156 }
168 }; 157 };
169 158
170 $scope.remitosTabla = []; 159 $scope.remitosTabla = [];
171 $scope.cabecera = []; 160 $scope.cabecera = [];
172 161
173 crearHojaRutaService.getNumeroHojaRuta().then(function(res) { 162 crearHojaRutaService.getNumeroHojaRuta().then(function(res) {
174 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); 163 $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8);
175 }); 164 });
176 }, 165 },
177 function(error) { 166 function(error) {
178 focaModalService.alert('Hubo un error al crear la nota de pedido'); 167 focaModalService.alert('Hubo un error al crear la nota de pedido');
179 console.info(error); 168 console.info(error);
180 } 169 }
181 ); 170 );
182 }; 171 };
183 172
184 $scope.seleccionarProveedor = function() { 173 $scope.seleccionarTransportista = function() {
185 var modalInstance = $uibModal.open( 174 var modalInstance = $uibModal.open(
186 { 175 {
187 ariaLabelledBy: 'Busqueda de Transportista', 176 ariaLabelledBy: 'Busqueda de Transportista',
188 templateUrl: 'modal-proveedor.html', 177 templateUrl: 'modal-proveedor.html',
189 controller: 'focaModalProveedorCtrl', 178 controller: 'focaModalProveedorCtrl',
190 size: 'lg', 179 size: 'lg',
191 resolve: { 180 resolve: {
192 transportista: function() { 181 transportista: function() {
193 return true; 182 return true;
194 } 183 }
195 } 184 }
196 } 185 }
197 ); 186 );
198 modalInstance.result.then( 187 modalInstance.result.then(
199 function(proveedor) { 188 function(proveedor) {
200 console.info($scope.hojaRuta); 189 console.info($scope.hojaRuta);
201 $scope.hojaRuta.transportista.codigo = proveedor.COD; 190 $scope.hojaRuta.transportista.codigo = proveedor.COD;
202 addCabecera('Transportista:', proveedor.NOM); 191 addCabecera('Transportista:', proveedor.NOM);
203 }, function() { 192 }, function() {
204 193
205 } 194 }
206 ); 195 );
207 }; 196 };
208 197
209 $scope.seleccionarChofer = function() { 198 $scope.seleccionarChofer = function() {
210 var modalInstance = $uibModal.open( 199 var modalInstance = $uibModal.open(
211 { 200 {
212 ariaLabelledBy: 'Busqueda de Chofer', 201 ariaLabelledBy: 'Busqueda de Chofer',
213 templateUrl: 'modal-chofer.html', 202 templateUrl: 'modal-chofer.html',
214 controller: 'focaModalChoferController', 203 controller: 'focaModalChoferController',
215 size: 'lg' 204 size: 'lg'
216 } 205 }
217 ); 206 );
218 207
219 modalInstance.result.then( 208 modalInstance.result.then(
220 function(chofer) { 209 function(chofer) {
221 $scope.hojaRuta.chofer = chofer; 210 $scope.hojaRuta.chofer = chofer;
222 addCabecera('Chofer: ', chofer.nombre); 211 addCabecera('Chofer: ', chofer.nombre);
223 }, function() { 212 }, function() {
224 // funcion ejecutada cuando se cancela el modal 213 // funcion ejecutada cuando se cancela el modal
225 } 214 }
226 ); 215 );
227 }; 216 };
228 217
229 $scope.seleccionarVehiculo = function() { 218 $scope.seleccionarVehiculo = function() {
230 var modalInstance = $uibModal.open( 219 var modalInstance = $uibModal.open(
231 { 220 {
232 ariaLabelledBy: 'Busqueda de Vehiculo', 221 ariaLabelledBy: 'Busqueda de Vehiculo',
233 templateUrl: 'modal-vehiculo.html', 222 templateUrl: 'modal-vehiculo.html',
234 controller: 'focaModalVehiculoController', 223 controller: 'focaModalVehiculoController',
235 size: 'lg' 224 size: 'lg'
236 } 225 }
237 ); 226 );
238 227
239 modalInstance.result.then( 228 modalInstance.result.then(
240 function(vehiculo) { 229 function(vehiculo) {
241 $scope.hojaRuta.vehiculo = vehiculo; 230 $scope.hojaRuta.vehiculo = vehiculo;
242 addCabecera('Tractor: ', vehiculo.tractor); 231 addCabecera('Tractor: ', vehiculo.tractor);
243 addCabecera('Semi: ', vehiculo.semi); 232 addCabecera('Semi: ', vehiculo.semi);
244 addCabecera('Capacidad: ', vehiculo.capacidad); 233 addCabecera('Capacidad: ', vehiculo.capacidad);
245 }, function() { 234 }, function() {
246 // funcion ejecutada cuando se cancela el modal 235 // funcion ejecutada cuando se cancela el modal
247 } 236 }
248 ); 237 );
249 }; 238 };
250 239
251 $scope.seleccionarTarifario = function() { 240 $scope.seleccionarTarifario = function() {
252 var modalInstance = $uibModal.open( 241 var modalInstance = $uibModal.open(
253 { 242 {
254 ariaLabelledBy: 'Busqueda de Tarifario', 243 ariaLabelledBy: 'Busqueda de Tarifario',
255 templateUrl: 'modal-tarifa-flete.html', 244 templateUrl: 'modal-tarifa-flete.html',
256 controller: 'focaModalTarifaFleteController', 245 controller: 'focaModalTarifaFleteController',
257 size: 'lg', 246 size: 'lg',
258 resolve: { 247 resolve: {
259 parametrosTarifaFlete: function() { 248 parametrosTarifaFlete: function() {
260 return $scope.hojaRuta.tarifario.costo; 249 return $scope.hojaRuta.tarifario.costo;
261 } 250 }
262 } 251 }
263 } 252 }
264 ); 253 );
265 254
266 modalInstance.result.then( 255 modalInstance.result.then(
267 function(tarifario) { 256 function(tarifario) {
268 $scope.hojaRuta.tarifario = tarifario; 257 $scope.hojaRuta.tarifario = tarifario;
269 addCabecera('Tarifario: ', tarifario.costo); 258 addCabecera('Tarifario: ', tarifario.costo);
270 }, function() { 259 }, function() {
271 // funcion ejecutada cuando se cancela el modal 260 // funcion ejecutada cuando se cancela el modal
272 } 261 }
273 ); 262 );
274 }; 263 };
275 264
276 $scope.seleccionarRemito = function() { 265 $scope.seleccionarRemitos = function() {
277 var modalInstance = $uibModal.open( 266 var modalInstance = $uibModal.open(
278 { 267 {
279 ariaLabelledBy: 'Busqueda de Remito', 268 ariaLabelledBy: 'Busqueda de Remito',
280 templateUrl: 'foca-modal-remito.html', 269 templateUrl: 'foca-modal-remito.html',
281 controller: 'focaModalRemitoController', 270 controller: 'focaModalRemitoController',
282 size: 'lg', 271 size: 'lg',
283 resolve: {usadoPor: function() {return 'hojaRuta';}} 272 resolve: {usadoPor: function() {return 'hojaRuta';}}
284 } 273 }
285 ); 274 );
286 modalInstance.result.then( 275 modalInstance.result.then(
287 function(remito) { 276 function(remito) {
288 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 277 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
289 if ($scope.remitosTabla[i].id === remito.id) { 278 if ($scope.remitosTabla[i].id === remito.id) {
290 focaModalService.alert('Remito ya incluido'); 279 focaModalService.alert('Remito ya incluido');
291 return; 280 return;
292 } 281 }
293 } 282 }
294 283
295 var litros = 0; 284 var litros = 0;
296 for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { 285 for (var j = remito.articulosRemito.length - 1; j >= 0; j--) {
297 litros = litros + parseFloat(remito.articulosRemito[j].cantidad); 286 litros = litros + parseFloat(remito.articulosRemito[j].cantidad);
298 } 287 }
299 288
300 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { 289 if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) {
301 focaModalService.alert( 290 focaModalService.alert(
302 'Debe ingresar toda la información para el transporte' 291 'Debe ingresar toda la información para el transporte'
303 ); 292 );
304 return; 293 return;
305 } 294 }
306 295
307 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) 296 if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad)
308 { 297 {
309 var litrostotales = litros; 298 var litrostotales = litros;
310 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; 299 litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros;
311 focaModalService.alert( 300 focaModalService.alert(
312 'La carga excede la capacidad disponible del vehiculo. ' + 301 'La carga excede la capacidad disponible del vehiculo. ' +
313 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' 302 'Excedente no cargado: ' + (litrostotales - litros) + ' litros'
314 ); 303 );
315 } 304 }
316 305
317 remito.litros = litros; 306 remito.litros = litros;
318 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; 307 $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros;
319 $scope.remitosTabla.push(remito); 308 $scope.remitosTabla.push(remito);
320 }, function() { 309 }, function() {
321 // funcion ejecutada cuando se cancela el modal 310 // funcion ejecutada cuando se cancela el modal
322 } 311 }
323 ); 312 );
324 }; 313 };
325 314
326 $scope.getTotal = function() { 315 $scope.getTotal = function() {
327 var total = 0; 316 var total = 0;
328 var arrayTempArticulos = $scope.remitosTabla; 317 var arrayTempArticulos = $scope.remitosTabla;
329 for (var i = 0; i < arrayTempArticulos.length; i++) { 318 for (var i = 0; i < arrayTempArticulos.length; i++) {
330 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 319 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
331 } 320 }
332 return parseFloat(total.toFixed(2)); 321 return parseFloat(total.toFixed(2));
333 }; 322 };
334 323
335 $scope.getSubTotal = function() { 324 $scope.getSubTotal = function() {
336 if($scope.articuloACargar) { 325 if($scope.articuloACargar) {
337 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 326 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
338 } 327 }
339 }; 328 };
340 329
341 $scope.limpiarPantalla = function() { 330 $scope.limpiarPantalla = function() {
342 $scope.limpiarFlete(); 331 $scope.limpiarFlete();
343 $scope.hojaRuta.flete = '0'; 332 $scope.hojaRuta.flete = '0';
344 $scope.hojaRuta.bomba = '0'; 333 $scope.hojaRuta.bomba = '0';
345 $scope.hojaRuta.precioCondicion = ''; 334 $scope.hojaRuta.precioCondicion = '';
346 $scope.remitosTabla = []; 335 $scope.remitosTabla = [];
347 $scope.hojaRuta.vendedor.nombre = ''; 336 $scope.hojaRuta.vendedor.nombre = '';
348 $scope.hojaRuta.cliente = {nombre: ''}; 337 $scope.hojaRuta.cliente = {nombre: ''};
349 $scope.hojaRuta.domicilio = {dom: ''}; 338 $scope.hojaRuta.domicilio = {dom: ''};
350 $scope.hojaRuta.litros = 0; 339 $scope.hojaRuta.litros = 0;
351 $scope.domiciliosCliente = []; 340 $scope.domiciliosCliente = [];
352 }; 341 };
353 //Recibe aviso si el teclado está en uso 342 //Recibe aviso si el teclado está en uso
354 // $rootScope.$on('usarTeclado', function(event, data) { 343 // $rootScope.$on('usarTeclado', function(event, data) {
355 // if(data) { 344 // if(data) {
356 // $scope.mostrarTeclado = true; 345 // $scope.mostrarTeclado = true;
357 // return; 346 // return;
358 // } 347 // }
359 // $scope.mostrarTeclado = false; 348 // $scope.mostrarTeclado = false;
360 // }) 349 // })
361 $scope.selectFocus = function($event) { 350 $scope.selectFocus = function($event) {
362 //Si el teclado esta en uso no selecciona el valor 351 //Si el teclado esta en uso no selecciona el valor
363 // if($scope.mostrarTeclado) { 352 // if($scope.mostrarTeclado) {
364 // return; 353 // return;
365 // } 354 // }
366 $event.target.select(); 355 $event.target.select();
367 }; 356 };
368 357
369 $scope.salir = function() { 358 $scope.salir = function() {
370 $location.path('/'); 359 $location.path('/');
371 }; 360 };
372 361
373 $scope.parsearATexto = function(articulo) { 362 $scope.parsearATexto = function(articulo) {
374 articulo.cantidad = parseFloat(articulo.cantidad); 363 articulo.cantidad = parseFloat(articulo.cantidad);
375 articulo.precio = parseFloat(articulo.precio); 364 articulo.precio = parseFloat(articulo.precio);
376 }; 365 };
377 366
378 $scope.rellenar = function(relleno, longitud) { 367 $scope.rellenar = function(relleno, longitud) {
379 relleno = '' + relleno; 368 relleno = '' + relleno;
380 while (relleno.length < longitud) { 369 while (relleno.length < longitud) {
381 relleno = '0' + relleno; 370 relleno = '0' + relleno;
382 } 371 }
383 372
384 return relleno; 373 return relleno;
385 }; 374 };
386 375
387 $scope.quitarArticulo = function(key) { 376 $scope.quitarArticulo = function(key) {
388 $scope.remitosTabla.splice(key, 1); 377 $scope.remitosTabla.splice(key, 1);
389 var litros = 0; 378 var litros = 0;
390 379
391 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { 380 for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) {
392 litros += parseFloat($scope.remitosTabla[i].litros); 381 litros += parseFloat($scope.remitosTabla[i].litros);
393 } 382 }
394 383
395 $scope.hojaRuta.litros = litros; 384 $scope.hojaRuta.litros = litros;
396 385
397 }; 386 };
398 387
399 function addCabecera(label, valor) { 388 function addCabecera(label, valor) {
400 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 389 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
401 if(propiedad.length === 1) { 390 if(propiedad.length === 1) {
402 propiedad[0].valor = valor; 391 propiedad[0].valor = valor;
403 } else { 392 } else {
404 $scope.cabecera.push({label: label, valor: valor}); 393 $scope.cabecera.push({label: label, valor: valor});
405 } 394 }
406 } 395 }
407 396
408 /*function removeCabecera(label) { 397 /*function removeCabecera(label) {
409 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 398 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
410 if(propiedad.length === 1){ 399 if(propiedad.length === 1){
411 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 400 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
412 } 401 }
413 }*/ 402 }*/
414 } 403 }
415 ] 404 ]
416 ) 405 )
417 .controller('hojaRutaListaCtrl', [ 406 .controller('hojaRutaListaCtrl', [
418 '$scope', 407 '$scope',
419 'crearHojaRutaService', 408 'crearHojaRutaService',
420 '$location', 409 '$location',
421 function($scope, crearHojaRutaService, $location) { 410 function($scope, crearHojaRutaService, $location) {
422 crearHojaRutaService.obtenerHojaRuta().then(function(datos) { 411 crearHojaRutaService.obtenerHojaRuta().then(function(datos) {
423 $scope.hojaRutas = datos.data; 412 $scope.hojaRutas = datos.data;
424 }); 413 });
425 $scope.editar = function(hojaRuta) { 414 $scope.editar = function(hojaRuta) {
426 crearHojaRutaService.setHojaRuta(hojaRuta); 415 crearHojaRutaService.setHojaRuta(hojaRuta);
427 $location.path('/venta-nota-pedido/abm/'); 416 $location.path('/venta-nota-pedido/abm/');
428 }; 417 };
429 $scope.crearPedido = function() { 418 $scope.crearPedido = function() {
430 crearHojaRutaService.clearHojaRuta(); 419 crearHojaRutaService.clearHojaRuta();
431 $location.path('/venta-nota-pedido/abm/'); 420 $location.path('/venta-nota-pedido/abm/');
432 }; 421 };
433 } 422 }
434 ]) 423 ])
435 .controller('focaCrearHojaRutaFichaClienteController', [ 424 .controller('focaCrearHojaRutaFichaClienteController', [
436 '$scope', 425 '$scope',
437 'crearHojaRutaService', 426 'crearHojaRutaService',
438 '$location', 427 '$location',
439 function($scope, crearHojaRutaService, $location) { 428 function($scope, crearHojaRutaService, $location) {
440 crearHojaRutaService.obtenerHojaRuta().then(function(datos) { 429 crearHojaRutaService.obtenerHojaRuta().then(function(datos) {
441 $scope.hojaRutas = datos.data; 430 $scope.hojaRutas = datos.data;
442 }); 431 });
443 $scope.editar = function(hojaRuta) { 432 $scope.editar = function(hojaRuta) {
444 crearHojaRutaService.setHojaRuta(hojaRuta); 433 crearHojaRutaService.setHojaRuta(hojaRuta);
445 $location.path('/venta-nota-pedido/abm/'); 434 $location.path('/venta-nota-pedido/abm/');
446 }; 435 };
447 $scope.crearPedido = function() { 436 $scope.crearPedido = function() {
448 crearHojaRutaService.clearHojaRuta(); 437 crearHojaRutaService.clearHojaRuta();
449 $location.path('/venta-nota-pedido/abm/'); 438 $location.path('/venta-nota-pedido/abm/');
450 }; 439 };
451 } 440 }
452 ]); 441 ]);
453 442
1 angular.module('focaCrearHojaRuta') 1 angular.module('focaCrearHojaRuta')
2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearHojaRuta: function(hojaRuta) { 5 crearHojaRuta: function(hojaRuta) {
6 return $http.post(route + '/hoja-ruta', hojaRuta); 6 return $http.post(route + '/hoja-ruta', hojaRuta);
7 }, 7 },
8 obtenerHojaRuta: function() { 8 obtenerHojaRuta: function() {
9 return $http.get(route +'/hoja-ruta'); 9 return $http.get(route +'/hoja-ruta');
10 }, 10 },
11 setHojaRuta: function(hojaRuta) { 11 setHojaRuta: function(hojaRuta) {
12 this.hojaRuta = hojaRuta; 12 this.hojaRuta = hojaRuta;
13 }, 13 },
14 clearHojaRuta: function() { 14 clearHojaRuta: function() {
15 this.hojaRuta = undefined; 15 this.hojaRuta = undefined;
16 }, 16 },
17 getHojaRuta: function() { 17 getHojaRuta: function() {
18 return this.hojaRuta; 18 return this.hojaRuta;
19 }, 19 },
20 getArticulosByIdHojaRuta: function(id) { 20 getArticulosByIdHojaRuta: function(id) {
21 return $http.get(route+'/articulos/hoja-ruta/'+id); 21 return $http.get(route+'/articulos/hoja-ruta/'+id);
22 }, 22 },
23 crearArticulosParaHojaRuta: function(articuloHojaRuta) { 23 crearArticulosParaHojaRuta: function(articuloHojaRuta) {
24 return $http.post(route + '/articulos/hoja-ruta', 24 return $http.post(route + '/articulos/hoja-ruta',
25 {articuloHojaRuta: articuloHojaRuta}); 25 {articuloHojaRuta: articuloHojaRuta});
26 }, 26 },
27 getDomiciliosByIdHojaRuta: function(id) { 27 getDomiciliosByIdHojaRuta: function(id) {
28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); 28 return $http.get(route +'/hoja-ruta/' + id + '/domicilios');
29 }, 29 },
30 getDomiciliosByIdCliente: function(id) { 30 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 33 },
34 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
36 }, 36 },
37 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
39 }, 39 },
40 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/' + id); 41 return $http.get(route + '/plazo-pago/precio-condicion/' + id);
42 }, 42 },
43 crearFlete: function(flete) { 43 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
45 }, 45 },
46 crearPlazosParaHojaRuta: function(plazos) { 46 crearPlazosParaHojaRuta: function(plazos) {
47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos); 47 return $http.post(route + '/plazo-pago/hoja-ruta', plazos);
48 }, 48 },
49 getCotizacionByIdMoneda: function(id) { 49 getCotizacionByIdMoneda: function(id) {
50 return $http.get(route + '/moneda/' + id); 50 return $http.get(route + '/moneda/' + id);
51 }, 51 },
52 crearEstadoParaHojaRuta: function(estado) { 52 crearEstadoParaHojaRuta: function(estado) {
53 return $http.post(route + '/estado', {estado: estado}); 53 return $http.post(route + '/estado', {estado: estado});
54 }, 54 },
55 getNumeroHojaRuta: function() { 55 getNumeroHojaRuta: function() {
56 return $http.get(route + '/hoja-ruta/numero-siguiente'); 56 return $http.get(route + '/hoja-ruta/numero-siguiente');
57 },
58 getBotonera: function() {
59 return ['Transportista', 'Chofer', 'Vehiculo', 'Tarifario', 'Remitos'];
57 } 60 }
58 }; 61 };
59 }]); 62 }]);
60 63
src/views/hoja-ruta.html
1 <div class="crear-hoja-ruta foca-crear one-row row"> 1 <div class="crear-hoja-ruta foca-crear one-row row">
2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> 2 <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12">
3 <div class="row"> 3 <div class="row">
4 <div class="col-md-10 col-lg-12"> 4 <div class="col-md-10 col-lg-12">
5 <div class="row panel-informativo"> 5 <div class="row panel-informativo">
6 <div class="col-12"> 6 <div class="col-12">
7 <div class="row titulares"> 7 <div class="row titulares">
8 <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> 8 <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle">
9 <h5 class="mb-0">HOJA DE RUTA</h5> 9 <h5 class="mb-0">HOJA DE RUTA</h5>
10 </div> 10 </div>
11 <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle" 11 <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle"
12 >Nº {{puntoVenta}}-{{comprobante}} 12 >Nº {{puntoVenta}}-{{comprobante}}
13 </div> 13 </div>
14 <div class="col-7 col-sm-3 border border-white align-middle"> 14 <div class="col-7 col-sm-3 border border-white align-middle">
15 Fecha: 15 Fecha:
16 <span 16 <span
17 ng-show="!datepickerAbierto" 17 ng-show="!datepickerAbierto"
18 ng-bind="now | date:'dd/MM/yyyy'" 18 ng-bind="now | date:'dd/MM/yyyy'"
19 ng-click="datepickerAbierto = true" 19 ng-click="datepickerAbierto = true"
20 > 20 >
21 </span> 21 </span>
22 <input 22 <input
23 ng-show="datepickerAbierto" 23 ng-show="datepickerAbierto"
24 type="date" 24 type="date"
25 ng-model="now" 25 ng-model="now"
26 ng-change="datepickerAbierto = false" 26 ng-change="datepickerAbierto = false"
27 ng-blur="datepickerAbierto = false" 27 ng-blur="datepickerAbierto = false"
28 class="form-control form-control-sm col-8 float-right" 28 class="form-control form-control-sm col-8 float-right"
29 foca-focus="datepickerAbierto" 29 foca-focus="datepickerAbierto"
30 hasta-hoy 30 hasta-hoy
31 /> 31 />
32 </div> 32 </div>
33 <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> 33 <div class="col-5 col-sm-3 border border-white border-right-0 align-middle">
34 Hora: 34 Hora:
35 <span 35 <span
36 ng-show="!datepickerAbierto" 36 ng-show="!datepickerAbierto"
37 ng-bind="now | date:'HH:mm'" 37 ng-bind="now | date:'HH:mm'"
38 ng-click="datepickerAbierto = true" 38 ng-click="datepickerAbierto = true"
39 > 39 >
40 </span> 40 </span>
41 </div> 41 </div>
42 </div> 42 </div>
43 <div class="row py-2"> 43 <div class="row py-2">
44 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 44 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
45 <span class="label" ng-bind="cab.label"></span> 45 <span class="label" ng-bind="cab.label"></span>
46 <span class="valor" ng-bind="cab.valor"></span> 46 <span class="valor" ng-bind="cab.valor"></span>
47 </div> 47 </div>
48 <a 48 <a
49 class="btn col-12 btn-secondary d-sm-none" 49 class="btn col-12 btn-secondary d-sm-none"
50 ng-show="cabecera.length > 0" 50 ng-show="cabecera.length > 0"
51 ng-click="showCabecera = !showCabecera" 51 ng-click="showCabecera = !showCabecera"
52 > 52 >
53 <i 53 <i
54 class="fa fa-chevron-down" 54 class="fa fa-chevron-down"
55 ng-hide="showCabecera" 55 ng-hide="showCabecera"
56 aria-hidden="true" 56 aria-hidden="true"
57 > 57 >
58 </i> 58 </i>
59 <i 59 <i
60 class="fa fa-chevron-up" 60 class="fa fa-chevron-up"
61 ng-show="showCabecera" 61 ng-show="showCabecera"
62 aria-hidden="true"> 62 aria-hidden="true">
63 </i> 63 </i>
64 </a> 64 </a>
65 </div> 65 </div>
66 </div> 66 </div>
67 </div> 67 </div>
68 68
69 </div> 69 </div>
70 </div> 70 </div>
71 </form> 71 </form>
72 <div class="col-lg-12"> 72 <div class="col-lg-12">
73 <div class="row mt-4"> 73 <div class="row mt-4">
74 <div class="col-12 col-md-10 border border-light rounded"> 74 <div class="col-12 col-md-10 border border-light rounded">
75 <div class="row px-5 py-2 botonera-secundaria"> 75 <div class="row px-5 py-2 botonera-secundaria">
76 <div class="col-12"> 76 <div class="col-12">
77 <div class="row"> 77 <foca-botonera-facturador botones="botonera" extra="1" class="row"></foca-botonera-facturador>
78 <div
79 class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0"
80 ng-repeat="boton in botonera"
81 ng-class="{'d-none d-md-grid': boton.texto == ''}">
82 <button
83 type="button"
84 class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light"
85 ng-click="boton.accion()"
86 ng-class="{'d-sm-block h-100': boton.texto == ''}"
87 >
88 <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen">
89 <span>{{boton.texto}}</span>
90 </button>
91 </div>
92 </div>
93 </div> 78 </div>
94 </div> 79 </div>
95 <!-- PC --> 80 <!-- PC -->
96 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 81 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
97 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 82 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
98 <thead> 83 <thead>
99 <tr class="d-flex"> 84 <tr class="d-flex">
100 <th class="col-auto">#</th> 85 <th class="col-auto">#</th>
101 <th class="col-2">Remito</th> 86 <th class="col-2">Remito</th>
102 <th class="col">Cliente</th> 87 <th class="col">Cliente</th>
103 <th class="col">Dirección</th> 88 <th class="col">Dirección</th>
104 <th class="text-right" style="width: 80px">Cantidad</th> 89 <th class="text-right" style="width: 80px">Cantidad</th>
105 <th class="col-auto"> 90 <th class="col-auto">
106 <button 91 <button
107 class="btn btn-outline-secondary selectable" 92 class="btn btn-outline-secondary selectable"
108 ng-click="show = !show; masMenos()" 93 ng-click="show = !show; masMenos()"
109 > 94 >
110 <i 95 <i
111 class="fa fa-chevron-down" 96 class="fa fa-chevron-down"
112 ng-show="show" 97 ng-show="show"
113 aria-hidden="true" 98 aria-hidden="true"
114 > 99 >
115 </i> 100 </i>
116 <i 101 <i
117 class="fa fa-chevron-up" 102 class="fa fa-chevron-up"
118 ng-hide="show" 103 ng-hide="show"
119 aria-hidden="true"> 104 aria-hidden="true">
120 </i> 105 </i>
121 </button> 106 </button>
122 </th> 107 </th>
123 </th> 108 </th>
124 </tr> 109 </tr>
125 </thead> 110 </thead>
126 <tbody class="tabla-articulo-body"> 111 <tbody class="tabla-articulo-body">
127 <tr 112 <tr
128 ng-repeat="(key, remito) in remitosTabla" 113 ng-repeat="(key, remito) in remitosTabla"
129 class="d-flex" 114 class="d-flex"
130 ng-show="show || key == remitosTabla.length - 1" 115 ng-show="show || key == remitosTabla.length - 1"
131 > 116 >
132 <td ng-bind="key + 1" class="col-auto"></td> 117 <td ng-bind="key + 1" class="col-auto"></td>
133 <td 118 <td
134 class="col-2" 119 class="col-2"
135 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" 120 ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)"
136 ></td> 121 ></td>
137 <th class="col" ng-bind="remito.cliente[0].NOM"></th> 122 <th class="col" ng-bind="remito.cliente[0].NOM"></th>
138 <th class="col" ng-bind="remito.domicilioStamp"></th> 123 <th class="col" ng-bind="remito.domicilioStamp"></th>
139 <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> 124 <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th>
140 <td class="text-center col-auto"> 125 <td class="text-center col-auto">
141 <button 126 <button
142 class="btn btn-outline-secondary" 127 class="btn btn-outline-secondary"
143 ng-click="quitarArticulo(key)" 128 ng-click="quitarArticulo(key)"
144 > 129 >
145 <i class="fa fa-trash"></i> 130 <i class="fa fa-trash"></i>
146 </button> 131 </button>
147 </td> 132 </td>
148 </tr> 133 </tr>
149 </tbody> 134 </tbody>
150 <tfoot> 135 <tfoot>
151 <tr class="d-flex"> 136 <tr class="d-flex">
152 <td class="col-auto px-1"> 137 <td class="col-auto px-1">
153 <strong>Remitos:</strong> 138 <strong>Remitos:</strong>
154 <a ng-bind="remitosTabla.length"></a> 139 <a ng-bind="remitosTabla.length"></a>
155 </td> 140 </td>
156 <td class="col"></td> 141 <td class="col"></td>
157 <td class="col-auto px-1"> 142 <td class="col-auto px-1">
158 <strong>Cantidad:</strong> 143 <strong>Cantidad:</strong>
159 <a ng-bind="hojaRuta.litros"></a> 144 <a ng-bind="hojaRuta.litros"></a>
160 </td> 145 </td>
161 </tr> 146 </tr>
162 </tfoot> 147 </tfoot>
163 </table> 148 </table>
164 </div> 149 </div>
165 150
166 <!-- MOBILE --> 151 <!-- MOBILE -->
167 <div class="row d-sm-none"> 152 <div class="row d-sm-none">
168 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 153 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
169 <thead> 154 <thead>
170 <tr class="d-flex"> 155 <tr class="d-flex">
171 <th class="">#</th> 156 <th class="">#</th>
172 <th class="col px-0"> 157 <th class="col px-0">
173 <div class="d-flex"> 158 <div class="d-flex">
174 <div class="col-4 px-1">Código</div> 159 <div class="col-4 px-1">Código</div>
175 <div class="col-8 px-1">Descripción</div> 160 <div class="col-8 px-1">Descripción</div>
176 </div> 161 </div>
177 <div class="d-flex"> 162 <div class="d-flex">
178 <div class="col-3 px-1">Cantidad</div> 163 <div class="col-3 px-1">Cantidad</div>
179 <div class="col px-1 text-right">P. Uni.</div> 164 <div class="col px-1 text-right">P. Uni.</div>
180 <div class="col px-1 text-right">Subtotal</div> 165 <div class="col px-1 text-right">Subtotal</div>
181 </div> 166 </div>
182 </th> 167 </th>
183 <th class="text-center tamaño-boton"> 168 <th class="text-center tamaño-boton">
184 &nbsp; 169 &nbsp;
185 </th> 170 </th>
186 </tr> 171 </tr>
187 </thead> 172 </thead>
188 <tbody> 173 <tbody>
189 <tr 174 <tr
190 ng-repeat="(key, articulo) in remitosTabla" 175 ng-repeat="(key, articulo) in remitosTabla"
191 ng-show="show || key == remitosTabla.length - 1" 176 ng-show="show || key == remitosTabla.length - 1"
192 > 177 >
193 <td class="w-100 align-middle d-flex p-0"> 178 <td class="w-100 align-middle d-flex p-0">
194 <div class="align-middle p-1"> 179 <div class="align-middle p-1">
195 <span ng-bind="key+1" class="align-middle"></span> 180 <span ng-bind="key+1" class="align-middle"></span>
196 </div> 181 </div>
197 <div class="col px-0"> 182 <div class="col px-0">
198 <div class="d-flex"> 183 <div class="d-flex">
199 <div class="col-4 px-1"> 184 <div class="col-4 px-1">
200 <span 185 <span
201 ng-bind="articulo.sector + '-' + articulo.codigo" 186 ng-bind="articulo.sector + '-' + articulo.codigo"
202 ></span> 187 ></span>
203 </div> 188 </div>
204 <div class="col-8 px-1"> 189 <div class="col-8 px-1">
205 <span ng-bind="articulo.descripcion"></span> 190 <span ng-bind="articulo.descripcion"></span>
206 </div> 191 </div>
207 </div> 192 </div>
208 <div class="d-flex"> 193 <div class="d-flex">
209 <div class="col-3 px-1"> 194 <div class="col-3 px-1">
210 <span ng-bind="'x' + articulo.cantidad"></span> 195 <span ng-bind="'x' + articulo.cantidad"></span>
211 </div> 196 </div>
212 <div class="col-3 px-1 text-right"> 197 <div class="col-3 px-1 text-right">
213 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> 198 <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
214 </div> 199 </div>
215 <div class="col px-1 text-right"> 200 <div class="col px-1 text-right">
216 <span 201 <span
217 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" 202 ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo"
218 > 203 >
219 </span> 204 </span>
220 </div> 205 </div>
221 </div> 206 </div>
222 </div> 207 </div>
223 <div class="align-middle p-1"> 208 <div class="align-middle p-1">
224 <button 209 <button
225 class="btn btn-outline-secondary" 210 class="btn btn-outline-secondary"
226 ng-click="quitarArticulo(key)" 211 ng-click="quitarArticulo(key)"
227 > 212 >
228 <i class="fa fa-trash"></i> 213 <i class="fa fa-trash"></i>
229 </button> 214 </button>
230 </div> 215 </div>
231 </td> 216 </td>
232 </tr> 217 </tr>
233 </tbody> 218 </tbody>
234 <tfoot> 219 <tfoot>
235 <!-- CARGANDO ITEM --> 220 <!-- CARGANDO ITEM -->
236 <tr ng-show="!cargando" class="d-flex"> 221 <tr ng-show="!cargando" class="d-flex">
237 <td 222 <td
238 class="align-middle p-1" 223 class="align-middle p-1"
239 ng-bind="remitosTabla.length + 1" 224 ng-bind="remitosTabla.length + 1"
240 ></td> 225 ></td>
241 <td class="col p-0"> 226 <td class="col p-0">
242 <div class="d-flex"> 227 <div class="d-flex">
243 <div class="col-4 px-1"> 228 <div class="col-4 px-1">
244 <span 229 <span
245 ng-bind="articuloACargar.sectorCodigo" 230 ng-bind="articuloACargar.sectorCodigo"
246 ></span> 231 ></span>
247 </div> 232 </div>
248 <div class="col-8 px-1"> 233 <div class="col-8 px-1">
249 <span ng-bind="articuloACargar.descripcion"></span> 234 <span ng-bind="articuloACargar.descripcion"></span>
250 </div> 235 </div>
251 </div> 236 </div>
252 <div class="d-flex"> 237 <div class="d-flex">
253 <div class="col-3 px-1 m-1"> 238 <div class="col-3 px-1 m-1">
254 <input 239 <input
255 class="form-control p-1" 240 class="form-control p-1"
256 type="number" 241 type="number"
257 min="1" 242 min="1"
258 ng-model="articuloACargar.cantidad" 243 ng-model="articuloACargar.cantidad"
259 foca-focus="!cargando" 244 foca-focus="!cargando"
260 ng-keypress="agregarATabla($event.keyCode)" 245 ng-keypress="agregarATabla($event.keyCode)"
261 style="height: auto; line-height: 1.1em" 246 style="height: auto; line-height: 1.1em"
262 > 247 >
263 </div> 248 </div>
264 <div class="col-3 px-1 text-right"> 249 <div class="col-3 px-1 text-right">
265 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> 250 <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span>
266 </div> 251 </div>
267 <div class="col px-1 text-right"> 252 <div class="col px-1 text-right">
268 <span 253 <span
269 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" 254 ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo"
270 > 255 >
271 </span> 256 </span>
272 </div> 257 </div>
273 </div> 258 </div>
274 </td> 259 </td>
275 <td class="text-center align-middle"> 260 <td class="text-center align-middle">
276 <button 261 <button
277 class="btn btn-outline-secondary" 262 class="btn btn-outline-secondary"
278 ng-click="agregarATabla(13)" 263 ng-click="agregarATabla(13)"
279 > 264 >
280 <i class="fa fa-save"></i> 265 <i class="fa fa-save"></i>
281 </button> 266 </button>
282 </td> 267 </td>
283 </tr> 268 </tr>
284 <!-- SELECCIONAR PRODUCTO --> 269 <!-- SELECCIONAR PRODUCTO -->
285 <tr ng-show="cargando" class="d-flex"> 270 <tr ng-show="cargando" class="d-flex">
286 <td class="col-12"> 271 <td class="col-12">
287 <input 272 <input
288 placeholder="Seleccione Articulo" 273 placeholder="Seleccione Articulo"
289 class="form-control form-control-sm" 274 class="form-control form-control-sm"
290 readonly 275 readonly
291 ng-click="seleccionarArticulo()" 276 ng-click="seleccionarArticulo()"
292 /> 277 />
293 </td> 278 </td>
294 </tr> 279 </tr>
295 <!-- TOOGLE EXPANDIR --> 280 <!-- TOOGLE EXPANDIR -->
296 <tr> 281 <tr>
297 <td class="col"> 282 <td class="col">
298 <button 283 <button
299 class="btn btn-outline-secondary selectable w-100" 284 class="btn btn-outline-secondary selectable w-100"
300 ng-click="show = !show; masMenos()" 285 ng-click="show = !show; masMenos()"
301 ng-show="remitosTabla.length > 0" 286 ng-show="remitosTabla.length > 0"
302 > 287 >
303 <i 288 <i
304 class="fa fa-chevron-down" 289 class="fa fa-chevron-down"
305 ng-hide="show" 290 ng-hide="show"
306 aria-hidden="true" 291 aria-hidden="true"
307 > 292 >
308 </i> 293 </i>
309 <i 294 <i
310 class="fa fa-chevron-up" 295 class="fa fa-chevron-up"
311 ng-show="show" 296 ng-show="show"
312 aria-hidden="true"> 297 aria-hidden="true">
313 </i> 298 </i>
314 </button> 299 </button>
315 </td> 300 </td>
316 </tr> 301 </tr>
317 <!-- FOOTER --> 302 <!-- FOOTER -->
318 <tr class="d-flex"> 303 <tr class="d-flex">
319 <td class="align-middle no-border-top" colspan="2"> 304 <td class="align-middle no-border-top" colspan="2">
320 <strong>Cantidad Items:</strong> 305 <strong>Cantidad Items:</strong>
321 <a ng-bind="remitosTabla.length"></a> 306 <a ng-bind="remitosTabla.length"></a>
322 </td> 307 </td>
323 <td class="text-right ml-auto table-celda-total no-border-top"> 308 <td class="text-right ml-auto table-celda-total no-border-top">
324 <h3>Total:</h3> 309 <h3>Total:</h3>
325 </td> 310 </td>
326 <td class="table-celda-total text-right no-border-top"> 311 <td class="table-celda-total text-right no-border-top">
327 <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> 312 <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3>
328 </td> 313 </td>
329 </tr> 314 </tr>
330 </tfoot> 315 </tfoot>
331 </table> 316 </table>
332 </div> 317 </div>
333 </div> 318 </div>
334 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> 319 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none">
335 <div class="col-12 mt-auto"> 320 <div class="col-12 mt-auto">
336 <button 321 <button
337 ng-click="crearHojaRuta()" 322 ng-click="crearHojaRuta()"
338 type="submit" 323 type="submit"
339 title="Crear nota pedido" 324 title="Crear nota pedido"
340 class="btn btn-default btn-block mb-2 border border-dark"> 325 class="btn btn-default btn-block mb-2 border border-dark">
341 <strong>GUARDAR</strong> 326 <strong>GUARDAR</strong>
342 </button> 327 </button>
343 <button 328 <button
344 type="submit" 329 type="submit"
345 title="Crear nota pedido" 330 title="Crear nota pedido"
346 class="btn btn-default btn-block mb-2 border border-dark"> 331 class="btn btn-default btn-block mb-2 border border-dark">
347 <strong>PAUSAR</strong> 332 <strong>PAUSAR</strong>
348 </button> 333 </button>
349 <button 334 <button
350 ng-click="salir()" 335 ng-click="salir()"
351 type="button" 336 type="button"
352 title="Salir" 337 title="Salir"
353 class="btn btn-default btn-block border border-dark"> 338 class="btn btn-default btn-block border border-dark">
354 <strong>SALIR</strong> 339 <strong>SALIR</strong>
355 </button> 340 </button>
356 </div> 341 </div>
357 </div> 342 </div>
358 </div> 343 </div>
359 </div> 344 </div>
360 <div class="row d-md-none fixed-bottom"> 345 <div class="row d-md-none fixed-bottom">
361 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 346 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
362 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 347 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
363 <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> 348 <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span>
364 </div> 349 </div>
365 </div> 350 </div>
366 </div> 351 </div>
367 352