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