Commit f595f490e4e3e2df2dbfd27c9c8fdfbd62da9053
1 parent
6168be6786
Exists in
master
fix properties art
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearRemito').controller('remitoController', | 1 | angular.module('focaCrearRemito').controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', |
4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', |
5 | '$localStorage', | 5 | '$localStorage', |
6 | function ( | 6 | function ( |
7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, |
8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) { | 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) { |
9 | config(); | 9 | config(); |
10 | 10 | ||
11 | var cotizacionPArgentino = {}; | 11 | var cotizacionPArgentino = {}; |
12 | 12 | ||
13 | function config() { | 13 | function config() { |
14 | $scope.tmpCantidad = Number; | 14 | $scope.tmpCantidad = Number; |
15 | $scope.tmpPrecio = Number; | 15 | $scope.tmpPrecio = Number; |
16 | $scope.botonera = crearRemitoService.getBotonera(); | 16 | $scope.botonera = crearRemitoService.getBotonera(); |
17 | $scope.isNumber = angular.isNumber; | 17 | $scope.isNumber = angular.isNumber; |
18 | $scope.datepickerAbierto = false; | 18 | $scope.datepickerAbierto = false; |
19 | $scope.show = false; | 19 | $scope.show = false; |
20 | $scope.cargando = true; | 20 | $scope.cargando = true; |
21 | $scope.now = new Date(); | 21 | $scope.now = new Date(); |
22 | $scope.puntoVenta = rellenar(0, 4); | 22 | $scope.puntoVenta = rellenar(0, 4); |
23 | $scope.comprobante = rellenar(0, 8); | 23 | $scope.comprobante = rellenar(0, 8); |
24 | $scope.dateOptions = { | 24 | $scope.dateOptions = { |
25 | maxDate: new Date(), | 25 | maxDate: new Date(), |
26 | minDate: new Date(2010, 0, 1) | 26 | minDate: new Date(2010, 0, 1) |
27 | }; | 27 | }; |
28 | 28 | ||
29 | 29 | ||
30 | crearRemitoService.getParametros().then(function (res) { | 30 | crearRemitoService.getParametros().then(function (res) { |
31 | var parametros = JSON.parse(res.data[0].jsonText); | 31 | var parametros = JSON.parse(res.data[0].jsonText); |
32 | if ($localStorage.remito) { | 32 | if ($localStorage.remito) { |
33 | $timeout(function () { getLSRemito(); }); | 33 | $timeout(function () { getLSRemito(); }); |
34 | } else { | 34 | } else { |
35 | for (var property in parametros) { | 35 | for (var property in parametros) { |
36 | $scope.remito[property] = parametros[property]; | 36 | $scope.remito[property] = parametros[property]; |
37 | $scope.inicial[property] = parametros[property]; | 37 | $scope.inicial[property] = parametros[property]; |
38 | } | 38 | } |
39 | setearRemito($scope.remito); | 39 | setearRemito($scope.remito); |
40 | } | 40 | } |
41 | }); | 41 | }); |
42 | 42 | ||
43 | //SETEO BOTONERA LATERAL | 43 | //SETEO BOTONERA LATERAL |
44 | $timeout(function () { | 44 | $timeout(function () { |
45 | focaBotoneraLateralService.showSalir(false); | 45 | focaBotoneraLateralService.showSalir(false); |
46 | focaBotoneraLateralService.showPausar(true); | 46 | focaBotoneraLateralService.showPausar(true); |
47 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 47 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); |
48 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 48 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
49 | }); | 49 | }); |
50 | 50 | ||
51 | init(); | 51 | init(); |
52 | 52 | ||
53 | } | 53 | } |
54 | 54 | ||
55 | function init() { | 55 | function init() { |
56 | $scope.$broadcast('cleanCabecera'); | 56 | $scope.$broadcast('cleanCabecera'); |
57 | $scope.remitoIsDirty = false; | 57 | $scope.remitoIsDirty = false; |
58 | $scope.remito = { | 58 | $scope.remito = { |
59 | id: 0, | 59 | id: 0, |
60 | estado: 0, | 60 | estado: 0, |
61 | vendedor: {}, | 61 | vendedor: {}, |
62 | cliente: {}, | 62 | cliente: {}, |
63 | proveedor: {}, | 63 | proveedor: {}, |
64 | domicilio: { dom: '' }, | 64 | domicilio: { dom: '' }, |
65 | moneda: {}, | 65 | moneda: {}, |
66 | cotizacion: $scope.cotizacionPorDefecto || {}, | 66 | cotizacion: $scope.cotizacionPorDefecto || {}, |
67 | articulosRemito: [], | 67 | articulosRemito: [], |
68 | remitoPuntoDescarga: [] | 68 | remitoPuntoDescarga: [] |
69 | }; | 69 | }; |
70 | 70 | ||
71 | $scope.notaPedido = { | 71 | $scope.notaPedido = { |
72 | id: 0 | 72 | id: 0 |
73 | }; | 73 | }; |
74 | 74 | ||
75 | $scope.remito.articulosRemito = []; | 75 | $scope.remito.articulosRemito = []; |
76 | $scope.idLista = undefined; | 76 | $scope.idLista = undefined; |
77 | 77 | ||
78 | crearRemitoService.getNumeroRemito().then( | 78 | crearRemitoService.getNumeroRemito().then( |
79 | function (res) { | 79 | function (res) { |
80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
82 | }, | 82 | }, |
83 | function (err) { | 83 | function (err) { |
84 | focaModalService.alert('La terminal no esta configurada correctamente'); | 84 | focaModalService.alert('La terminal no esta configurada correctamente'); |
85 | console.info(err); | 85 | console.info(err); |
86 | } | 86 | } |
87 | ); | 87 | ); |
88 | 88 | ||
89 | $scope.inicial = angular.copy($scope.remito); | 89 | $scope.inicial = angular.copy($scope.remito); |
90 | } | 90 | } |
91 | 91 | ||
92 | $scope.$watch('remito', function (newValue) { | 92 | $scope.$watch('remito', function (newValue) { |
93 | focaBotoneraLateralService.setPausarData({ | 93 | focaBotoneraLateralService.setPausarData({ |
94 | label: 'remito', | 94 | label: 'remito', |
95 | val: newValue | 95 | val: newValue |
96 | }); | 96 | }); |
97 | }, true); | 97 | }, true); |
98 | 98 | ||
99 | $scope.seleccionarNotaPedido = function () { | 99 | $scope.seleccionarNotaPedido = function () { |
100 | if (varlidarRemitoFacturado()) { | 100 | if (varlidarRemitoFacturado()) { |
101 | var modalInstance = $uibModal.open( | 101 | var modalInstance = $uibModal.open( |
102 | { | 102 | { |
103 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 103 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
104 | templateUrl: 'foca-modal-nota-pedido.html', | 104 | templateUrl: 'foca-modal-nota-pedido.html', |
105 | controller: 'focaModalNotaPedidoController', | 105 | controller: 'focaModalNotaPedidoController', |
106 | size: 'lg', | 106 | size: 'lg', |
107 | resolve: { | 107 | resolve: { |
108 | usadoPor: function () { return 'remito'; }, | 108 | usadoPor: function () { return 'remito'; }, |
109 | idVendedor: function () { return null; } | 109 | idVendedor: function () { return null; } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | ); | 112 | ); |
113 | modalInstance.result.then( | 113 | modalInstance.result.then( |
114 | function (notaPedido) { | 114 | function (notaPedido) { |
115 | //añado cabeceras | 115 | //añado cabeceras |
116 | $scope.remitoIsDirty = true; | 116 | $scope.remitoIsDirty = true; |
117 | $scope.notaPedido.id = notaPedido.id; | 117 | $scope.notaPedido.id = notaPedido.id; |
118 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 118 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
119 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 119 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
120 | var puntosDescarga = []; | 120 | var puntosDescarga = []; |
121 | notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedido) { | 121 | notaPedido.notaPedidoPuntoDescarga.forEach(function (notaPedido) { |
122 | puntosDescarga.push(notaPedido.puntoDescarga); | 122 | puntosDescarga.push(notaPedido.puntoDescarga); |
123 | }); | 123 | }); |
124 | var cabeceras = [ | 124 | var cabeceras = [ |
125 | { | 125 | { |
126 | label: 'Moneda:', | 126 | label: 'Moneda:', |
127 | valor: notaPedido.cotizacion.moneda.DETALLE | 127 | valor: notaPedido.cotizacion.moneda.DETALLE |
128 | }, | 128 | }, |
129 | { | 129 | { |
130 | label: 'Fecha cotizacion:', | 130 | label: 'Fecha cotizacion:', |
131 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 131 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
132 | 'dd/MM/yyyy') | 132 | 'dd/MM/yyyy') |
133 | }, | 133 | }, |
134 | { | 134 | { |
135 | label: 'Cotizacion:', | 135 | label: 'Cotizacion:', |
136 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 136 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
137 | '2') | 137 | '2') |
138 | }, | 138 | }, |
139 | { | 139 | { |
140 | label: 'Cliente:', | 140 | label: 'Cliente:', |
141 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 141 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + |
142 | ' - ' + notaPedido.cliente.NOM | 142 | ' - ' + notaPedido.cliente.NOM |
143 | }, | 143 | }, |
144 | { | 144 | { |
145 | label: 'Domicilio:', | 145 | label: 'Domicilio:', |
146 | valor: notaPedido.domicilioStamp | 146 | valor: notaPedido.domicilioStamp |
147 | }, | 147 | }, |
148 | { | 148 | { |
149 | label: 'Vendedor:', | 149 | label: 'Vendedor:', |
150 | valor: $filter('rellenarDigitos')( | 150 | valor: $filter('rellenarDigitos')( |
151 | notaPedido.vendedor.NUM, 3 | 151 | notaPedido.vendedor.NUM, 3 |
152 | ) + ' - ' + notaPedido.vendedor.NOM | 152 | ) + ' - ' + notaPedido.vendedor.NOM |
153 | }, | 153 | }, |
154 | { | 154 | { |
155 | label: 'Proveedor:', | 155 | label: 'Proveedor:', |
156 | valor: $filter('rellenarDigitos') | 156 | valor: $filter('rellenarDigitos') |
157 | (notaPedido.proveedor.COD, 5) + ' - ' + | 157 | (notaPedido.proveedor.COD, 5) + ' - ' + |
158 | notaPedido.proveedor.NOM | 158 | notaPedido.proveedor.NOM |
159 | }, | 159 | }, |
160 | { | 160 | { |
161 | label: 'Precio condicion:', | 161 | label: 'Precio condicion:', |
162 | valor: valorPrecioCondicion() + ' ' + | 162 | valor: valorPrecioCondicion() + ' ' + |
163 | remitoBusinessService | 163 | remitoBusinessService |
164 | .plazoToString(notaPedido.notaPedidoPlazo) | 164 | .plazoToString(notaPedido.notaPedidoPlazo) |
165 | }, | 165 | }, |
166 | { | 166 | { |
167 | label: 'Flete:', | 167 | label: 'Flete:', |
168 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 168 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
169 | notaPedido.flete === 1 ? 'Si' : 'No') | 169 | notaPedido.flete === 1 ? 'Si' : 'No') |
170 | }, | 170 | }, |
171 | { | 171 | { |
172 | label: 'Puntos de descarga: ', | 172 | label: 'Puntos de descarga: ', |
173 | valor: $filter('rellenarDigitos')( | 173 | valor: $filter('rellenarDigitos')( |
174 | getCabeceraPuntoDescarga(puntosDescarga)) | 174 | getCabeceraPuntoDescarga(puntosDescarga)) |
175 | } | 175 | } |
176 | ]; | 176 | ]; |
177 | 177 | ||
178 | // Seteo checked en cabeceras | 178 | // Seteo checked en cabeceras |
179 | $filter('filter')($scope.botonera, | 179 | $filter('filter')($scope.botonera, |
180 | { label: 'Cliente' })[0].checked = true; | 180 | { label: 'Cliente' })[0].checked = true; |
181 | $filter('filter')($scope.botonera, | 181 | $filter('filter')($scope.botonera, |
182 | { label: 'Proveedor' })[0].checked = true; | 182 | { label: 'Proveedor' })[0].checked = true; |
183 | $filter('filter')($scope.botonera, | 183 | $filter('filter')($scope.botonera, |
184 | { label: 'Moneda' })[0].checked = true; | 184 | { label: 'Moneda' })[0].checked = true; |
185 | $filter('filter')($scope.botonera, | 185 | $filter('filter')($scope.botonera, |
186 | { label: 'Nota pedido' })[0].checked = true; | 186 | { label: 'Nota pedido' })[0].checked = true; |
187 | $filter('filter')($scope.botonera, | 187 | $filter('filter')($scope.botonera, |
188 | { label: 'Precios y condiciones' })[0].checked = true; | 188 | { label: 'Precios y condiciones' })[0].checked = true; |
189 | 189 | ||
190 | if (notaPedido.observaciones) { | 190 | if (notaPedido.observaciones) { |
191 | $filter('filter')($scope.botonera, | 191 | $filter('filter')($scope.botonera, |
192 | { label: 'Observaciones' })[0].checked = true; | 192 | { label: 'Observaciones' })[0].checked = true; |
193 | } | 193 | } |
194 | 194 | ||
195 | function valorPrecioCondicion() { | 195 | function valorPrecioCondicion() { |
196 | if (notaPedido.idPrecioCondicion > 0) { | 196 | if (notaPedido.idPrecioCondicion > 0) { |
197 | return notaPedido.precioCondicion.nombre; | 197 | return notaPedido.precioCondicion.nombre; |
198 | } else { | 198 | } else { |
199 | return 'Ingreso Manual'; | 199 | return 'Ingreso Manual'; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | if (notaPedido.flete === 1) { | 203 | if (notaPedido.flete === 1) { |
204 | var cabeceraBomba = { | 204 | var cabeceraBomba = { |
205 | label: 'Bomba:', | 205 | label: 'Bomba:', |
206 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 206 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
207 | }; | 207 | }; |
208 | if (notaPedido.kilometros) { | 208 | if (notaPedido.kilometros) { |
209 | var cabeceraKilometros = { | 209 | var cabeceraKilometros = { |
210 | label: 'Kilometros:', | 210 | label: 'Kilometros:', |
211 | valor: notaPedido.kilometros | 211 | valor: notaPedido.kilometros |
212 | }; | 212 | }; |
213 | cabeceras.push(cabeceraKilometros); | 213 | cabeceras.push(cabeceraKilometros); |
214 | } | 214 | } |
215 | cabeceras.push(cabeceraBomba); | 215 | cabeceras.push(cabeceraBomba); |
216 | } | 216 | } |
217 | 217 | ||
218 | delete notaPedido.id; | 218 | delete notaPedido.id; |
219 | $scope.remito = notaPedido; | 219 | $scope.remito = notaPedido; |
220 | $scope.remito.id = 0; | 220 | $scope.remito.id = 0; |
221 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 221 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; |
222 | $scope.remito.remitoPuntoDescarga = notaPedido.notaPedidoPuntoDescarga; | 222 | $scope.remito.remitoPuntoDescarga = notaPedido.notaPedidoPuntoDescarga; |
223 | 223 | ||
224 | notaPedido.articulosNotaPedido.forEach(function (articulo) { | 224 | notaPedido.articulosNotaPedido.forEach(function (articulo) { |
225 | articulo.id = 0; | 225 | articulo.id = 0; |
226 | articulo.idRemito = 0; | 226 | articulo.idRemito = 0; |
227 | articulo.precio = | 227 | articulo.precio = |
228 | (articulo.precio / notaPedido.cotizacion.VENDEDOR).toFixed(4); | 228 | (articulo.precio / notaPedido.cotizacion.VENDEDOR).toFixed(4); |
229 | }); | 229 | }); |
230 | 230 | ||
231 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 231 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; |
232 | 232 | ||
233 | if (notaPedido.idPrecioCondicion > 0) { | 233 | if (notaPedido.idPrecioCondicion > 0) { |
234 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 234 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
235 | } else { | 235 | } else { |
236 | $scope.idLista = -1; | 236 | $scope.idLista = -1; |
237 | } | 237 | } |
238 | 238 | ||
239 | enableObservaciones(notaPedido.observaciones ? true : false); | 239 | enableObservaciones(notaPedido.observaciones ? true : false); |
240 | addArrayCabecera(cabeceras); | 240 | addArrayCabecera(cabeceras); |
241 | 241 | ||
242 | }, function () { | 242 | }, function () { |
243 | // funcion ejecutada cuando se cancela el modal | 243 | // funcion ejecutada cuando se cancela el modal |
244 | } | 244 | } |
245 | ); | 245 | ); |
246 | } | 246 | } |
247 | }; | 247 | }; |
248 | 248 | ||
249 | $scope.seleccionarRemito = function () { | 249 | $scope.seleccionarRemito = function () { |
250 | if ($scope.remitoIsDirty) { | 250 | if ($scope.remitoIsDirty) { |
251 | focaModalService.confirm('¿Desea continuar? Se perderan los cambios') | 251 | focaModalService.confirm('¿Desea continuar? Se perderan los cambios') |
252 | .then(function () { | 252 | .then(function () { |
253 | $scope.getRemitoModal(); | 253 | $scope.getRemitoModal(); |
254 | }); | 254 | }); |
255 | } else { | 255 | } else { |
256 | $scope.getRemitoModal(); | 256 | $scope.getRemitoModal(); |
257 | } | 257 | } |
258 | }; | 258 | }; |
259 | $scope.getRemitoModal = function () { | 259 | $scope.getRemitoModal = function () { |
260 | var modalInstance = $uibModal.open( | 260 | var modalInstance = $uibModal.open( |
261 | { | 261 | { |
262 | ariaLabelledBy: 'Busqueda de Remito', | 262 | ariaLabelledBy: 'Busqueda de Remito', |
263 | templateUrl: 'foca-modal-remito.html', | 263 | templateUrl: 'foca-modal-remito.html', |
264 | controller: 'focaModalRemitoController', | 264 | controller: 'focaModalRemitoController', |
265 | size: 'lg', | 265 | size: 'lg', |
266 | resolve: { usadoPor: function () { return 'remito'; } } | 266 | resolve: { usadoPor: function () { return 'remito'; } } |
267 | } | 267 | } |
268 | ); | 268 | ); |
269 | modalInstance.result.then( | 269 | modalInstance.result.then( |
270 | setearRemito, function () { | 270 | setearRemito, function () { |
271 | // funcion ejecutada cuando se cancela el modal | 271 | // funcion ejecutada cuando se cancela el modal |
272 | } | 272 | } |
273 | ); | 273 | ); |
274 | }; | 274 | }; |
275 | //validacion por domicilio y por plazo pago | 275 | //validacion por domicilio y por plazo pago |
276 | $scope.crearRemito = function () { | 276 | $scope.crearRemito = function () { |
277 | if (!$scope.remito.vendedor.NUM) { | 277 | if (!$scope.remito.vendedor.NUM) { |
278 | focaModalService.alert('Ingrese Vendedor'); | 278 | focaModalService.alert('Ingrese Vendedor'); |
279 | return; | 279 | return; |
280 | } else if (!$scope.remito.cliente.COD) { | 280 | } else if (!$scope.remito.cliente.COD) { |
281 | focaModalService.alert('Ingrese Cliente'); | 281 | focaModalService.alert('Ingrese Cliente'); |
282 | return; | 282 | return; |
283 | } else if (!$scope.remito.proveedor.COD) { | 283 | } else if (!$scope.remito.proveedor.COD) { |
284 | focaModalService.alert('Ingrese Proveedor'); | 284 | focaModalService.alert('Ingrese Proveedor'); |
285 | return; | 285 | return; |
286 | } else if (!$scope.remito.cotizacion.moneda.id && | 286 | } else if (!$scope.remito.cotizacion.moneda.id && |
287 | !$scope.remito.cotizacion.moneda.ID) { | 287 | !$scope.remito.cotizacion.moneda.ID) { |
288 | focaModalService.alert('Ingrese Moneda'); | 288 | focaModalService.alert('Ingrese Moneda'); |
289 | return; | 289 | return; |
290 | } else if (!$scope.remito.cotizacion.ID) { | 290 | } else if (!$scope.remito.cotizacion.ID) { |
291 | focaModalService.alert('Ingrese Cotización'); | 291 | focaModalService.alert('Ingrese Cotización'); |
292 | return; | 292 | return; |
293 | } else if ($scope.remito.flete === undefined || $scope.remito.flete === null) { | 293 | } else if ($scope.remito.flete === undefined || $scope.remito.flete === null) { |
294 | focaModalService.alert('Ingrese Flete'); | 294 | focaModalService.alert('Ingrese Flete'); |
295 | return; | 295 | return; |
296 | } else if ($scope.articulosFiltro().length === 0) { | 296 | } else if ($scope.articulosFiltro().length === 0) { |
297 | focaModalService.alert('Debe cargar al menos un articulo'); | 297 | focaModalService.alert('Debe cargar al menos un articulo'); |
298 | return; | 298 | return; |
299 | } | 299 | } |
300 | focaBotoneraLateralService.startGuardar(); | 300 | focaBotoneraLateralService.startGuardar(); |
301 | $scope.saveLoading = true; | 301 | $scope.saveLoading = true; |
302 | var save = { | 302 | var save = { |
303 | remito: { | 303 | remito: { |
304 | id: $scope.remito.id, | 304 | id: $scope.remito.id, |
305 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 305 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
306 | idCliente: $scope.remito.cliente.COD, | 306 | idCliente: $scope.remito.cliente.COD, |
307 | nombreCliente: $scope.remito.cliente.NOM, | 307 | nombreCliente: $scope.remito.cliente.NOM, |
308 | cuitCliente: $scope.remito.cliente.CUIT, | 308 | cuitCliente: $scope.remito.cliente.CUIT, |
309 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 309 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
310 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 310 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
311 | idVendedor: $scope.remito.idVendedor, | 311 | idVendedor: $scope.remito.idVendedor, |
312 | idProveedor: $scope.remito.proveedor.COD, | 312 | idProveedor: $scope.remito.proveedor.COD, |
313 | idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, | 313 | idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, |
314 | idCotizacion: $scope.remito.cotizacion.ID, | 314 | idCotizacion: $scope.remito.cotizacion.ID, |
315 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 315 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
316 | flete: $scope.remito.flete, | 316 | flete: $scope.remito.flete, |
317 | fob: $scope.remito.fob, | 317 | fob: $scope.remito.fob, |
318 | bomba: $scope.remito.bomba, | 318 | bomba: $scope.remito.bomba, |
319 | kilometros: $scope.remito.kilometros, | 319 | kilometros: $scope.remito.kilometros, |
320 | domicilioStamp: $scope.remito.domicilioStamp, | 320 | domicilioStamp: $scope.remito.domicilioStamp, |
321 | observaciones: $scope.remito.observaciones, | 321 | observaciones: $scope.remito.observaciones, |
322 | numeroRemito: parseInt($scope.comprobante), | 322 | numeroRemito: parseInt($scope.comprobante), |
323 | sucursal: parseInt($scope.puntoVenta), | 323 | sucursal: parseInt($scope.puntoVenta), |
324 | responsabilidadIvaCliente: $scope.remito.cliente.IVA, | 324 | responsabilidadIvaCliente: $scope.remito.cliente.IVA, |
325 | descuento: 0,//TODO, | 325 | descuento: 0,//TODO, |
326 | importeNeto: getImporte('netoUnitario'), | 326 | importeNeto: getImporte('netoUnitario'), |
327 | importeExento: getImporte('exentoUnitario'), | 327 | importeExento: getImporte('exentoUnitario'), |
328 | importeIva: getImporte('ivaUnitario'), | 328 | importeIva: getImporte('ivaUnitario'), |
329 | importeIvaServicios: 0,//TODO | 329 | importeIvaServicios: 0,//TODO |
330 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | 330 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), |
331 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | 331 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), |
332 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | 332 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), |
333 | percepcion: 0,//TODO | 333 | percepcion: 0,//TODO |
334 | percepcionIva: 0,//TODO | 334 | percepcionIva: 0,//TODO |
335 | redondeo: 0,//TODO | 335 | redondeo: 0,//TODO |
336 | anulado: false, | 336 | anulado: false, |
337 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), | 337 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), |
338 | lugar: parseInt($scope.puntoVenta), | 338 | lugar: parseInt($scope.puntoVenta), |
339 | cuentaMadre: 0,//TODO | 339 | cuentaMadre: 0,//TODO |
340 | cuentaContable: 0,//TODO | 340 | cuentaContable: 0,//TODO |
341 | asiento: 0,//TODO | 341 | asiento: 0,//TODO |
342 | e_hd: '',//TODO | 342 | e_hd: '',//TODO |
343 | c_hd: '', | 343 | c_hd: '', |
344 | numeroLiquidoProducto: 0,//TODO | 344 | numeroLiquidoProducto: 0,//TODO |
345 | estado: 0, | 345 | estado: 0, |
346 | destinoVenta: 0,//TODO | 346 | destinoVenta: 0,//TODO |
347 | operacionTipo: 0, //TODO | 347 | operacionTipo: 0, //TODO |
348 | }, | 348 | }, |
349 | notaPedido: $scope.notaPedido | 349 | notaPedido: $scope.notaPedido |
350 | }; | 350 | }; |
351 | 351 | ||
352 | crearRemitoService.crearRemito(save).then( | 352 | crearRemitoService.crearRemito(save).then( |
353 | function (data) { | 353 | function (data) { |
354 | 354 | ||
355 | focaBotoneraLateralService.endGuardar(true); | 355 | focaBotoneraLateralService.endGuardar(true); |
356 | $scope.saveLoading = false; | 356 | $scope.saveLoading = false; |
357 | 357 | ||
358 | $scope.remito.id = data.data.id; | 358 | $scope.remito.id = data.data.id; |
359 | $scope.remito.numeroRemito = data.data.numero; | 359 | $scope.remito.numeroRemito = data.data.numero; |
360 | 360 | ||
361 | if ($scope.remito.remitoPuntoDescarga.length) { | 361 | if ($scope.remito.remitoPuntoDescarga.length) { |
362 | remitoBusinessService.addPuntosDescarga(data.data.id, | 362 | remitoBusinessService.addPuntosDescarga(data.data.id, |
363 | $scope.remito.remitoPuntoDescarga); | 363 | $scope.remito.remitoPuntoDescarga); |
364 | } | 364 | } |
365 | 365 | ||
366 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | 366 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
367 | $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); | 367 | $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); |
368 | 368 | ||
369 | if (data.status === 500) { | 369 | if (data.status === 500) { |
370 | focaModalService.alert(data.data); | 370 | focaModalService.alert(data.data); |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | 373 | ||
374 | // TODO: updatear plazos | 374 | // TODO: updatear plazos |
375 | if ($scope.remito.id === 0) { | 375 | if ($scope.remito.id === 0) { |
376 | var plazos = $scope.remito.remitoPlazo; | 376 | var plazos = $scope.remito.remitoPlazo; |
377 | 377 | ||
378 | for (var j = 0; j < plazos.length; j++) { | 378 | for (var j = 0; j < plazos.length; j++) { |
379 | var json = { | 379 | var json = { |
380 | idRemito: $scope.remito.id, | 380 | idRemito: $scope.remito.id, |
381 | dias: plazos[j].dias | 381 | dias: plazos[j].dias |
382 | }; | 382 | }; |
383 | crearRemitoService.crearPlazosParaRemito(json); | 383 | crearRemitoService.crearPlazosParaRemito(json); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | abrirModalMail($scope.remito.id, | 387 | abrirModalMail($scope.remito.id, |
388 | $scope.remito.cliente, | 388 | $scope.remito.cliente, |
389 | $filter('comprobante')([ | 389 | $filter('comprobante')([ |
390 | $scope.puntoVenta, | 390 | $scope.puntoVenta, |
391 | $scope.remito.numeroRemito | 391 | $scope.remito.numeroRemito |
392 | ]) | 392 | ]) |
393 | ); | 393 | ); |
394 | 394 | ||
395 | config(); | 395 | config(); |
396 | 396 | ||
397 | }, function (error) { | 397 | }, function (error) { |
398 | focaModalService.alert(error.data || 'Hubo un error al crear el remito'); | 398 | focaModalService.alert(error.data || 'Hubo un error al crear el remito'); |
399 | focaBotoneraLateralService.endGuardar(); | 399 | focaBotoneraLateralService.endGuardar(); |
400 | $scope.saveLoading = false; | 400 | $scope.saveLoading = false; |
401 | console.info(error); | 401 | console.info(error); |
402 | } | 402 | } |
403 | ); | 403 | ); |
404 | }; | 404 | }; |
405 | 405 | ||
406 | $scope.seleccionarProductos = function () { | 406 | $scope.seleccionarProductos = function () { |
407 | if ($scope.idLista === undefined) { | 407 | if ($scope.idLista === undefined) { |
408 | focaModalService.alert( | 408 | focaModalService.alert( |
409 | 'Primero seleccione una lista de precio y condicion'); | 409 | 'Primero seleccione una lista de precio y condicion'); |
410 | return; | 410 | return; |
411 | } | 411 | } |
412 | var modalInstance = $uibModal.open( | 412 | var modalInstance = $uibModal.open( |
413 | { | 413 | { |
414 | ariaLabelledBy: 'Busqueda de Productos', | 414 | ariaLabelledBy: 'Busqueda de Productos', |
415 | templateUrl: 'modal-busqueda-productos.html', | 415 | templateUrl: 'modal-busqueda-productos.html', |
416 | controller: 'modalBusquedaProductosCtrl', | 416 | controller: 'modalBusquedaProductosCtrl', |
417 | resolve: { | 417 | resolve: { |
418 | parametroProducto: { | 418 | parametroProducto: { |
419 | idLista: $scope.idLista, | 419 | idLista: $scope.idLista, |
420 | cotizacion: $scope.remito.cotizacion.VENDEDOR, | 420 | cotizacion: $scope.remito.cotizacion.VENDEDOR, |
421 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO | 421 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO |
422 | } | 422 | } |
423 | }, | 423 | }, |
424 | size: 'lg' | 424 | size: 'lg' |
425 | } | 425 | } |
426 | ); | 426 | ); |
427 | modalInstance.result.then( | 427 | modalInstance.result.then( |
428 | function (producto) { | 428 | function (producto) { |
429 | var newArt = | 429 | var newArt = |
430 | { | 430 | { |
431 | id: 0, | 431 | id: 0, |
432 | idRemito: 0, | 432 | idRemito: 0, |
433 | codigo: producto.codigo, | 433 | codigo: producto.codigo, |
434 | sector: producto.sector, | 434 | sector: producto.sector, |
435 | sectorCodigo: producto.sector + '-' + producto.codigo, | 435 | sectorCodigo: producto.sector + '-' + producto.codigo, |
436 | descripcion: producto.descripcion, | 436 | descripcion: producto.descripcion, |
437 | item: $scope.remito.articulosRemito.length + 1, | 437 | item: $scope.remito.articulosRemito.length + 1, |
438 | nombre: producto.descripcion, | 438 | nombre: producto.descripcion, |
439 | precio: parseFloat(producto.precio.toFixed(4)), | 439 | precio: parseFloat(producto.precio.toFixed(4)), |
440 | costoUnitario: producto.costo, | 440 | costoUnitario: producto.costo, |
441 | editCantidad: false, | 441 | editCantidad: false, |
442 | editPrecio: false, | 442 | editPrecio: false, |
443 | rubro: producto.CodRub, | 443 | rubro: producto.CodRub, |
444 | exentoUnitario: producto.precio, | ||
445 | ivaUnitario: producto.IMPIVA, | 444 | ivaUnitario: producto.IMPIVA, |
446 | impuestoInternoUnitario: producto.ImpInt, | 445 | impuestoInternoUnitario: producto.ImpInt, |
447 | impuestoInterno1Unitario: producto.ImpInt2, | 446 | impuestoInterno1Unitario: producto.ImpInt2, |
448 | impuestoInterno2Unitario: producto.ImpInt3, | 447 | impuestoInterno2Unitario: producto.ImpInt3, |
449 | precioLista: producto.precio, | 448 | precioLista: producto.precio, |
450 | combustible: 1, | 449 | combustible: 1, |
451 | facturado: 0 | 450 | facturado: 0, |
451 | idArticulo: producto.id, | ||
452 | tasaIva: producto.tasaIVA | ||
452 | }; | 453 | }; |
454 | |||
455 | newArt.exentoUnitario = newArt.ivaUnitario ? 0 : producto.neto; | ||
456 | newArt.netoUnitario = newArt.ivaUnitario ? producto.neto : 0; | ||
457 | |||
453 | $scope.articuloACargar = newArt; | 458 | $scope.articuloACargar = newArt; |
454 | $scope.cargando = false; | 459 | $scope.cargando = false; |
455 | }, function () { | 460 | }, function () { |
456 | // funcion ejecutada cuando se cancela el modal | 461 | // funcion ejecutada cuando se cancela el modal |
457 | } | 462 | } |
458 | ); | 463 | ); |
459 | }; | 464 | }; |
460 | 465 | ||
461 | $scope.seleccionarPuntosDeDescarga = function () { | 466 | $scope.seleccionarPuntosDeDescarga = function () { |
462 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 467 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { |
463 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 468 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
464 | return; | 469 | return; |
465 | } else { | 470 | } else { |
466 | var modalInstance = $uibModal.open( | 471 | var modalInstance = $uibModal.open( |
467 | { | 472 | { |
468 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 473 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
469 | templateUrl: 'modal-punto-descarga.html', | 474 | templateUrl: 'modal-punto-descarga.html', |
470 | controller: 'focaModalPuntoDescargaController', | 475 | controller: 'focaModalPuntoDescargaController', |
471 | size: 'lg', | 476 | size: 'lg', |
472 | resolve: { | 477 | resolve: { |
473 | filters: { | 478 | filters: { |
474 | idDomicilio: $scope.remito.domicilio.id, | 479 | idDomicilio: $scope.remito.domicilio.id, |
475 | idCliente: $scope.remito.cliente.COD, | 480 | idCliente: $scope.remito.cliente.COD, |
476 | articulos: $scope.remito.articulosRemito, | 481 | articulos: $scope.remito.articulosRemito, |
477 | puntosDescarga: $scope.remito.remitoPuntoDescarga, | 482 | puntosDescarga: $scope.remito.remitoPuntoDescarga, |
478 | domicilio: $scope.remito.domicilio | 483 | domicilio: $scope.remito.domicilio |
479 | } | 484 | } |
480 | } | 485 | } |
481 | } | 486 | } |
482 | ); | 487 | ); |
483 | modalInstance.result.then( | 488 | modalInstance.result.then( |
484 | function(puntosDescarga) { | 489 | function(puntosDescarga) { |
485 | 490 | ||
486 | puntosDescarga.forEach(function(punto) { | 491 | puntosDescarga.forEach(function(punto) { |
487 | $scope.remito.remitoPuntoDescarga.push( | 492 | $scope.remito.remitoPuntoDescarga.push( |
488 | { | 493 | { |
489 | puntoDescarga: punto | 494 | puntoDescarga: punto |
490 | } | 495 | } |
491 | ); | 496 | ); |
492 | }); | 497 | }); |
493 | 498 | ||
494 | $scope.$broadcast('addCabecera', { | 499 | $scope.$broadcast('addCabecera', { |
495 | label: 'Puntos de descarga:', | 500 | label: 'Puntos de descarga:', |
496 | valor: getCabeceraPuntoDescarga(puntosDescarga) | 501 | valor: getCabeceraPuntoDescarga(puntosDescarga) |
497 | }); | 502 | }); |
498 | }, function () { | 503 | }, function () { |
499 | $scope.abrirModalDomicilios($scope.cliente); | 504 | $scope.abrirModalDomicilios($scope.cliente); |
500 | } | 505 | } |
501 | ); | 506 | ); |
502 | } | 507 | } |
503 | }; | 508 | }; |
504 | 509 | ||
505 | $scope.seleccionarVendedor = function (callback, ocultarVendedor) { | 510 | $scope.seleccionarVendedor = function (callback, ocultarVendedor) { |
506 | if (ocultarVendedor) { | 511 | if (ocultarVendedor) { |
507 | callback(); | 512 | callback(); |
508 | return; | 513 | return; |
509 | } | 514 | } |
510 | 515 | ||
511 | if (varlidarRemitoFacturado()) { | 516 | if (varlidarRemitoFacturado()) { |
512 | var parametrosModal = { | 517 | var parametrosModal = { |
513 | titulo: 'Búsqueda vendedores', | 518 | titulo: 'Búsqueda vendedores', |
514 | query: '/vendedor', | 519 | query: '/vendedor', |
515 | columnas: [ | 520 | columnas: [ |
516 | { | 521 | { |
517 | propiedad: 'NUM', | 522 | propiedad: 'NUM', |
518 | nombre: 'Código', | 523 | nombre: 'Código', |
519 | filtro: { | 524 | filtro: { |
520 | nombre: 'rellenarDigitos', | 525 | nombre: 'rellenarDigitos', |
521 | parametro: 3 | 526 | parametro: 3 |
522 | } | 527 | } |
523 | }, | 528 | }, |
524 | { | 529 | { |
525 | propiedad: 'NOM', | 530 | propiedad: 'NOM', |
526 | nombre: 'Nombre' | 531 | nombre: 'Nombre' |
527 | } | 532 | } |
528 | ], | 533 | ], |
529 | size: 'md' | 534 | size: 'md' |
530 | }; | 535 | }; |
531 | focaModalService.modal(parametrosModal).then( | 536 | focaModalService.modal(parametrosModal).then( |
532 | function (vendedor) { | 537 | function (vendedor) { |
533 | $scope.remitoIsDirty = true; | 538 | $scope.remitoIsDirty = true; |
534 | $scope.$broadcast('addCabecera', { | 539 | $scope.$broadcast('addCabecera', { |
535 | label: 'Vendedor:', | 540 | label: 'Vendedor:', |
536 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 541 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
537 | vendedor.NOM | 542 | vendedor.NOM |
538 | }); | 543 | }); |
539 | $scope.remito.idVendedor = vendedor.id; | 544 | $scope.remito.idVendedor = vendedor.id; |
540 | $scope.remito.vendedor = vendedor; | 545 | $scope.remito.vendedor = vendedor; |
541 | deleteCliente(); | 546 | deleteCliente(); |
542 | callback(); | 547 | callback(); |
543 | }, function () { | 548 | }, function () { |
544 | 549 | ||
545 | } | 550 | } |
546 | ); | 551 | ); |
547 | } | 552 | } |
548 | }; | 553 | }; |
549 | 554 | ||
550 | $scope.seleccionarCliente = function (ocultarVendedor) { | 555 | $scope.seleccionarCliente = function (ocultarVendedor) { |
551 | 556 | ||
552 | $scope.seleccionarVendedor(function () { | 557 | $scope.seleccionarVendedor(function () { |
553 | if (varlidarRemitoFacturado()) { | 558 | if (varlidarRemitoFacturado()) { |
554 | var modalInstance = $uibModal.open( | 559 | var modalInstance = $uibModal.open( |
555 | { | 560 | { |
556 | ariaLabelledBy: 'Busqueda de Cliente', | 561 | ariaLabelledBy: 'Busqueda de Cliente', |
557 | templateUrl: 'foca-busqueda-cliente-modal.html', | 562 | templateUrl: 'foca-busqueda-cliente-modal.html', |
558 | controller: 'focaBusquedaClienteModalController', | 563 | controller: 'focaBusquedaClienteModalController', |
559 | resolve: { | 564 | resolve: { |
560 | vendedor: function () { return $scope.remito.vendedor; }, | 565 | vendedor: function () { return $scope.remito.vendedor; }, |
561 | cobrador: function () { return null; } | 566 | cobrador: function () { return null; } |
562 | }, | 567 | }, |
563 | size: 'lg' | 568 | size: 'lg' |
564 | } | 569 | } |
565 | ); | 570 | ); |
566 | modalInstance.result.then( | 571 | modalInstance.result.then( |
567 | function (cliente) { | 572 | function (cliente) { |
568 | $scope.abrirModalDomicilios(cliente); | 573 | $scope.abrirModalDomicilios(cliente); |
569 | $scope.cliente = cliente; | 574 | $scope.cliente = cliente; |
570 | }, function () { | 575 | }, function () { |
571 | $scope.seleccionarCliente(); | 576 | $scope.seleccionarCliente(); |
572 | } | 577 | } |
573 | ); | 578 | ); |
574 | } | 579 | } |
575 | }, ocultarVendedor); | 580 | }, ocultarVendedor); |
576 | }; | 581 | }; |
577 | 582 | ||
578 | $scope.seleccionarProveedor = function () { | 583 | $scope.seleccionarProveedor = function () { |
579 | if (varlidarRemitoFacturado()) { | 584 | if (varlidarRemitoFacturado()) { |
580 | var parametrosModal = { | 585 | var parametrosModal = { |
581 | titulo: 'Búsqueda de Proveedor', | 586 | titulo: 'Búsqueda de Proveedor', |
582 | query: '/proveedor', | 587 | query: '/proveedor', |
583 | columnas: [ | 588 | columnas: [ |
584 | { | 589 | { |
585 | nombre: 'Código', | 590 | nombre: 'Código', |
586 | propiedad: 'COD', | 591 | propiedad: 'COD', |
587 | filtro: { | 592 | filtro: { |
588 | nombre: 'rellenarDigitos', | 593 | nombre: 'rellenarDigitos', |
589 | parametro: 5 | 594 | parametro: 5 |
590 | } | 595 | } |
591 | }, | 596 | }, |
592 | { | 597 | { |
593 | nombre: 'Nombre', | 598 | nombre: 'Nombre', |
594 | propiedad: 'NOM' | 599 | propiedad: 'NOM' |
595 | }, | 600 | }, |
596 | { | 601 | { |
597 | nombre: 'CUIT', | 602 | nombre: 'CUIT', |
598 | propiedad: 'CUIT' | 603 | propiedad: 'CUIT' |
599 | } | 604 | } |
600 | ], | 605 | ], |
601 | tipo: 'POST', | 606 | tipo: 'POST', |
602 | json: { razonCuitCod: '' } | 607 | json: { razonCuitCod: '' } |
603 | }; | 608 | }; |
604 | focaModalService.modal(parametrosModal).then( | 609 | focaModalService.modal(parametrosModal).then( |
605 | function (proveedor) { | 610 | function (proveedor) { |
606 | $scope.seleccionarFlete(proveedor); | 611 | $scope.seleccionarFlete(proveedor); |
607 | }, function () { } | 612 | }, function () { } |
608 | ); | 613 | ); |
609 | } | 614 | } |
610 | }; | 615 | }; |
611 | 616 | ||
612 | $scope.abrirModalDomicilios = function (cliente) { | 617 | $scope.abrirModalDomicilios = function (cliente) { |
613 | var modalInstanceDomicilio = $uibModal.open( | 618 | var modalInstanceDomicilio = $uibModal.open( |
614 | { | 619 | { |
615 | ariaLabelledBy: 'Busqueda de Domicilios', | 620 | ariaLabelledBy: 'Busqueda de Domicilios', |
616 | templateUrl: 'modal-domicilio.html', | 621 | templateUrl: 'modal-domicilio.html', |
617 | controller: 'focaModalDomicilioController', | 622 | controller: 'focaModalDomicilioController', |
618 | size: 'lg', | 623 | size: 'lg', |
619 | resolve: { | 624 | resolve: { |
620 | idCliente: function () { return cliente.cod; }, | 625 | idCliente: function () { return cliente.cod; }, |
621 | esNuevo: function () { return cliente.esNuevo; } | 626 | esNuevo: function () { return cliente.esNuevo; } |
622 | } | 627 | } |
623 | } | 628 | } |
624 | ); | 629 | ); |
625 | modalInstanceDomicilio.result.then( | 630 | modalInstanceDomicilio.result.then( |
626 | function (domicilio) { | 631 | function (domicilio) { |
627 | $scope.remito.domicilio = domicilio; | 632 | $scope.remito.domicilio = domicilio; |
628 | console.log(cliente); | 633 | console.log(cliente); |
629 | $scope.remito.cliente = { | 634 | $scope.remito.cliente = { |
630 | COD: cliente.cod, | 635 | COD: cliente.cod, |
631 | CUIT: cliente.cuit, | 636 | CUIT: cliente.cuit, |
632 | NOM: cliente.nom, | 637 | NOM: cliente.nom, |
633 | MAIL: cliente.mail, | 638 | MAIL: cliente.mail, |
634 | MOD: cliente.mod, | 639 | MOD: cliente.mod, |
635 | IVA: cliente.iva | 640 | IVA: cliente.iva |
636 | }; | 641 | }; |
637 | 642 | ||
638 | var domicilioStamp = | 643 | var domicilioStamp = |
639 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 644 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
640 | domicilio.Localidad + ', ' + domicilio.Provincia; | 645 | domicilio.Localidad + ', ' + domicilio.Provincia; |
641 | $scope.remito.domicilioStamp = domicilioStamp; | 646 | $scope.remito.domicilioStamp = domicilioStamp; |
642 | $scope.$broadcast('addCabecera', { | 647 | $scope.$broadcast('addCabecera', { |
643 | label: 'Cliente:', | 648 | label: 'Cliente:', |
644 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 649 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
645 | }); | 650 | }); |
646 | $scope.$broadcast('addCabecera', { | 651 | $scope.$broadcast('addCabecera', { |
647 | label: 'Domicilio:', | 652 | label: 'Domicilio:', |
648 | valor: domicilioStamp | 653 | valor: domicilioStamp |
649 | }); | 654 | }); |
650 | 655 | ||
651 | if (domicilio.verPuntos) { | 656 | if (domicilio.verPuntos) { |
652 | delete $scope.remito.domicilio.verPuntos; | 657 | delete $scope.remito.domicilio.verPuntos; |
653 | $scope.seleccionarPuntosDeDescarga(); | 658 | $scope.seleccionarPuntosDeDescarga(); |
654 | } | 659 | } |
655 | 660 | ||
656 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 661 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
657 | }, function () { | 662 | }, function () { |
658 | $scope.seleccionarCliente(true); | 663 | $scope.seleccionarCliente(true); |
659 | return; | 664 | return; |
660 | } | 665 | } |
661 | ); | 666 | ); |
662 | }; | 667 | }; |
663 | 668 | ||
664 | $scope.getTotal = function () { | 669 | $scope.getTotal = function () { |
665 | var total = 0; | 670 | var total = 0; |
666 | var arrayTempArticulos = $scope.articulosFiltro(); | 671 | var arrayTempArticulos = $scope.articulosFiltro(); |
667 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 672 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
668 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 673 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
669 | } | 674 | } |
670 | return parseFloat(total.toFixed(2)); | 675 | return parseFloat(total.toFixed(2)); |
671 | }; | 676 | }; |
672 | 677 | ||
673 | $scope.getSubTotal = function () { | 678 | $scope.getSubTotal = function () { |
674 | if ($scope.articuloACargar) { | 679 | if ($scope.articuloACargar) { |
675 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 680 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
676 | } | 681 | } |
677 | }; | 682 | }; |
678 | 683 | ||
679 | $scope.seleccionarPreciosYCondiciones = function () { | 684 | $scope.seleccionarPreciosYCondiciones = function () { |
680 | if (!$scope.remito.cliente.COD) { | 685 | if (!$scope.remito.cliente.COD) { |
681 | focaModalService.alert('Primero seleccione un cliente'); | 686 | focaModalService.alert('Primero seleccione un cliente'); |
682 | return; | 687 | return; |
683 | } | 688 | } |
684 | 689 | ||
685 | if ($scope.remito.articulosRemito.length !== 0) { | 690 | if ($scope.remito.articulosRemito.length !== 0) { |
686 | focaModalService.confirm('Se perderan los productos ingresados') | 691 | focaModalService.confirm('Se perderan los productos ingresados') |
687 | .then(function (data) { | 692 | .then(function (data) { |
688 | if (data && varlidarRemitoFacturado()) { | 693 | if (data && varlidarRemitoFacturado()) { |
689 | abrirModal(); | 694 | abrirModal(); |
690 | } | 695 | } |
691 | }); | 696 | }); |
692 | } else { | 697 | } else { |
693 | abrirModal(); | 698 | abrirModal(); |
694 | } | 699 | } |
695 | 700 | ||
696 | function abrirModal() { | 701 | function abrirModal() { |
697 | var modalInstance = $uibModal.open( | 702 | var modalInstance = $uibModal.open( |
698 | { | 703 | { |
699 | ariaLabelledBy: 'Busqueda de Precio Condición', | 704 | ariaLabelledBy: 'Busqueda de Precio Condición', |
700 | templateUrl: 'modal-precio-condicion.html', | 705 | templateUrl: 'modal-precio-condicion.html', |
701 | controller: 'focaModalPrecioCondicionController', | 706 | controller: 'focaModalPrecioCondicionController', |
702 | size: 'lg', | 707 | size: 'lg', |
703 | resolve: { | 708 | resolve: { |
704 | idListaPrecio: function () { | 709 | idListaPrecio: function () { |
705 | return $scope.remito.cliente.MOD || null; | 710 | return $scope.remito.cliente.MOD || null; |
706 | } | 711 | } |
707 | } | 712 | } |
708 | } | 713 | } |
709 | ); | 714 | ); |
710 | modalInstance.result.then( | 715 | modalInstance.result.then( |
711 | function (precioCondicion) { | 716 | function (precioCondicion) { |
712 | var cabecera = ''; | 717 | var cabecera = ''; |
713 | var plazosConcat = ''; | 718 | var plazosConcat = ''; |
714 | if (!Array.isArray(precioCondicion)) { | 719 | if (!Array.isArray(precioCondicion)) { |
715 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 720 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
716 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 721 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
717 | $scope.idLista = precioCondicion.idListaPrecio; | 722 | $scope.idLista = precioCondicion.idListaPrecio; |
718 | for (var i = 0; i < precioCondicion.plazoPago.length; i++) { | 723 | for (var i = 0; i < precioCondicion.plazoPago.length; i++) { |
719 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 724 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
720 | } | 725 | } |
721 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 726 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
722 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 727 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
723 | } else { //Cuando se ingresan los plazos manualmente | 728 | } else { //Cuando se ingresan los plazos manualmente |
724 | $scope.remito.idPrecioCondicion = 0; | 729 | $scope.remito.idPrecioCondicion = 0; |
725 | //-1, el modal productos busca todos los productos | 730 | //-1, el modal productos busca todos los productos |
726 | $scope.idLista = -1; | 731 | $scope.idLista = -1; |
727 | $scope.remito.remitoPlazo = precioCondicion; | 732 | $scope.remito.remitoPlazo = precioCondicion; |
728 | for (var j = 0; j < precioCondicion.length; j++) { | 733 | for (var j = 0; j < precioCondicion.length; j++) { |
729 | plazosConcat += precioCondicion[j].dias + ' '; | 734 | plazosConcat += precioCondicion[j].dias + ' '; |
730 | } | 735 | } |
731 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 736 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
732 | } | 737 | } |
733 | $scope.remito.articulosRemito = []; | 738 | $scope.remito.articulosRemito = []; |
734 | $scope.$broadcast('addCabecera', { | 739 | $scope.$broadcast('addCabecera', { |
735 | label: 'Precios y condiciones:', | 740 | label: 'Precios y condiciones:', |
736 | valor: cabecera | 741 | valor: cabecera |
737 | }); | 742 | }); |
738 | $scope.remito.precioCondicion = precioCondicion; | 743 | $scope.remito.precioCondicion = precioCondicion; |
739 | 744 | ||
740 | $filter('filter')($scope.botonera, | 745 | $filter('filter')($scope.botonera, |
741 | { label: 'Precios y Condiciones' })[0].checked = true; | 746 | { label: 'Precios y Condiciones' })[0].checked = true; |
742 | }, function () { | 747 | }, function () { |
743 | 748 | ||
744 | } | 749 | } |
745 | ); | 750 | ); |
746 | } | 751 | } |
747 | }; | 752 | }; |
748 | 753 | ||
749 | $scope.seleccionarFlete = function (proveedor) { | 754 | $scope.seleccionarFlete = function (proveedor) { |
750 | if (varlidarRemitoFacturado()) { | 755 | if (varlidarRemitoFacturado()) { |
751 | var modalInstance = $uibModal.open( | 756 | var modalInstance = $uibModal.open( |
752 | { | 757 | { |
753 | ariaLabelledBy: 'Busqueda de Flete', | 758 | ariaLabelledBy: 'Busqueda de Flete', |
754 | templateUrl: 'modal-flete.html', | 759 | templateUrl: 'modal-flete.html', |
755 | controller: 'focaModalFleteController', | 760 | controller: 'focaModalFleteController', |
756 | size: 'lg', | 761 | size: 'lg', |
757 | resolve: { | 762 | resolve: { |
758 | parametrosFlete: | 763 | parametrosFlete: |
759 | function () { | 764 | function () { |
760 | return { | 765 | return { |
761 | flete: $scope.remito.flete ? '1' : | 766 | flete: $scope.remito.flete ? '1' : |
762 | ($scope.remito.fob ? 'FOB' : | 767 | ($scope.remito.fob ? 'FOB' : |
763 | ($scope.remito.flete === undefined ? | 768 | ($scope.remito.flete === undefined ? |
764 | null : '0')), | 769 | null : '0')), |
765 | bomba: $scope.remito.bomba ? '1' : | 770 | bomba: $scope.remito.bomba ? '1' : |
766 | ($scope.remito.bomba === undefined ? | 771 | ($scope.remito.bomba === undefined ? |
767 | null : '0'), | 772 | null : '0'), |
768 | kilometros: $scope.remito.kilometros | 773 | kilometros: $scope.remito.kilometros |
769 | }; | 774 | }; |
770 | } | 775 | } |
771 | } | 776 | } |
772 | } | 777 | } |
773 | ); | 778 | ); |
774 | modalInstance.result.then( | 779 | modalInstance.result.then( |
775 | function (datos) { | 780 | function (datos) { |
776 | $scope.remitoIsDirty = true; | 781 | $scope.remitoIsDirty = true; |
777 | $scope.remito.proveedor = proveedor; | 782 | $scope.remito.proveedor = proveedor; |
778 | $scope.remito.idProveedor = proveedor.COD; | 783 | $scope.remito.idProveedor = proveedor.COD; |
779 | $scope.$broadcast('addCabecera', { | 784 | $scope.$broadcast('addCabecera', { |
780 | label: 'Proveedor:', | 785 | label: 'Proveedor:', |
781 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 786 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
782 | proveedor.NOM | 787 | proveedor.NOM |
783 | }); | 788 | }); |
784 | 789 | ||
785 | $scope.remito.flete = datos.flete; | 790 | $scope.remito.flete = datos.flete; |
786 | $scope.remito.fob = datos.FOB; | 791 | $scope.remito.fob = datos.FOB; |
787 | $scope.remito.bomba = datos.bomba; | 792 | $scope.remito.bomba = datos.bomba; |
788 | $scope.remito.kilometros = datos.kilometros; | 793 | $scope.remito.kilometros = datos.kilometros; |
789 | 794 | ||
790 | $scope.$broadcast('addCabecera', { | 795 | $scope.$broadcast('addCabecera', { |
791 | label: 'Flete:', | 796 | label: 'Flete:', |
792 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 797 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') |
793 | }); | 798 | }); |
794 | if (datos.flete) { | 799 | if (datos.flete) { |
795 | $scope.$broadcast('addCabecera', { | 800 | $scope.$broadcast('addCabecera', { |
796 | label: 'Bomba:', | 801 | label: 'Bomba:', |
797 | valor: datos.bomba ? 'Si' : 'No' | 802 | valor: datos.bomba ? 'Si' : 'No' |
798 | }); | 803 | }); |
799 | $scope.$broadcast('addCabecera', { | 804 | $scope.$broadcast('addCabecera', { |
800 | label: 'Kilometros:', | 805 | label: 'Kilometros:', |
801 | valor: datos.kilometros | 806 | valor: datos.kilometros |
802 | }); | 807 | }); |
803 | } else { | 808 | } else { |
804 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 809 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
805 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 810 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
806 | $scope.remito.bomba = false; | 811 | $scope.remito.bomba = false; |
807 | $scope.remito.kilometros = null; | 812 | $scope.remito.kilometros = null; |
808 | } | 813 | } |
809 | 814 | ||
810 | $filter('filter')($scope.botonera, | 815 | $filter('filter')($scope.botonera, |
811 | { label: 'Proveedor' })[0].checked = true; | 816 | { label: 'Proveedor' })[0].checked = true; |
812 | }, function () { | 817 | }, function () { |
813 | $scope.seleccionarTransportista(); | 818 | $scope.seleccionarTransportista(); |
814 | } | 819 | } |
815 | ); | 820 | ); |
816 | } | 821 | } |
817 | }; | 822 | }; |
818 | 823 | ||
819 | $scope.seleccionarMoneda = function () { | 824 | $scope.seleccionarMoneda = function () { |
820 | if (varlidarRemitoFacturado()) { | 825 | if (varlidarRemitoFacturado()) { |
821 | var parametrosModal = { | 826 | var parametrosModal = { |
822 | titulo: 'Búsqueda de monedas', | 827 | titulo: 'Búsqueda de monedas', |
823 | query: '/moneda', | 828 | query: '/moneda', |
824 | columnas: [ | 829 | columnas: [ |
825 | { | 830 | { |
826 | propiedad: 'DETALLE', | 831 | propiedad: 'DETALLE', |
827 | nombre: 'Nombre' | 832 | nombre: 'Nombre' |
828 | }, | 833 | }, |
829 | { | 834 | { |
830 | propiedad: 'SIMBOLO', | 835 | propiedad: 'SIMBOLO', |
831 | nombre: 'Símbolo' | 836 | nombre: 'Símbolo' |
832 | } | 837 | } |
833 | ], | 838 | ], |
834 | size: 'md' | 839 | size: 'md' |
835 | }; | 840 | }; |
836 | focaModalService.modal(parametrosModal).then( | 841 | focaModalService.modal(parametrosModal).then( |
837 | function (moneda) { | 842 | function (moneda) { |
838 | 843 | ||
839 | if (moneda.ID !== 1) { | 844 | if (moneda.ID !== 1) { |
840 | $scope.abrirModalCotizacion(moneda); | 845 | $scope.abrirModalCotizacion(moneda); |
841 | return; | 846 | return; |
842 | } | 847 | } |
843 | 848 | ||
844 | crearRemitoService.getCotizacionByIdMoneda(1) | 849 | crearRemitoService.getCotizacionByIdMoneda(1) |
845 | .then(function (res) { | 850 | .then(function (res) { |
846 | 851 | ||
847 | cotizacionPArgentino = res.data[0].cotizaciones[0]; | 852 | cotizacionPArgentino = res.data[0].cotizaciones[0]; |
848 | cotizacionPArgentino.moneda = moneda; | 853 | cotizacionPArgentino.moneda = moneda; |
849 | 854 | ||
850 | actualizarCabeceraMoneda(cotizacionPArgentino); | 855 | actualizarCabeceraMoneda(cotizacionPArgentino); |
851 | 856 | ||
852 | $scope.remito.cotizacion = cotizacionPArgentino; | 857 | $scope.remito.cotizacion = cotizacionPArgentino; |
853 | }); | 858 | }); |
854 | }, function () { | 859 | }, function () { |
855 | 860 | ||
856 | } | 861 | } |
857 | ); | 862 | ); |
858 | } | 863 | } |
859 | }; | 864 | }; |
860 | 865 | ||
861 | $scope.seleccionarObservaciones = function () { | 866 | $scope.seleccionarObservaciones = function () { |
862 | focaModalService | 867 | focaModalService |
863 | .prompt({ | 868 | .prompt({ |
864 | titulo: 'Observaciones', | 869 | titulo: 'Observaciones', |
865 | value: $scope.remito.observaciones, | 870 | value: $scope.remito.observaciones, |
866 | textarea: true, | 871 | textarea: true, |
867 | readonly: true | 872 | readonly: true |
868 | }) | 873 | }) |
869 | .then(function (observaciones) { | 874 | .then(function (observaciones) { |
870 | $scope.remito.observaciones = observaciones; | 875 | $scope.remito.observaciones = observaciones; |
871 | }); | 876 | }); |
872 | }; | 877 | }; |
873 | 878 | ||
874 | $scope.abrirModalCotizacion = function (moneda) { | 879 | $scope.abrirModalCotizacion = function (moneda) { |
875 | var modalInstance = $uibModal.open( | 880 | var modalInstance = $uibModal.open( |
876 | { | 881 | { |
877 | ariaLabelledBy: 'Busqueda de Cotización', | 882 | ariaLabelledBy: 'Busqueda de Cotización', |
878 | templateUrl: 'modal-cotizacion.html', | 883 | templateUrl: 'modal-cotizacion.html', |
879 | controller: 'focaModalCotizacionController', | 884 | controller: 'focaModalCotizacionController', |
880 | size: 'lg', | 885 | size: 'lg', |
881 | resolve: { idMoneda: function () { return moneda.ID; } } | 886 | resolve: { idMoneda: function () { return moneda.ID; } } |
882 | } | 887 | } |
883 | ); | 888 | ); |
884 | modalInstance.result.then( | 889 | modalInstance.result.then( |
885 | function (cotizacion) { | 890 | function (cotizacion) { |
886 | cotizacion.moneda = moneda; | 891 | cotizacion.moneda = moneda; |
887 | $scope.remitoIsDirty = true; | 892 | $scope.remitoIsDirty = true; |
888 | actualizarCabeceraMoneda(cotizacion); | 893 | actualizarCabeceraMoneda(cotizacion); |
889 | $scope.remito.cotizacion = cotizacion; | 894 | $scope.remito.cotizacion = cotizacion; |
890 | }, function () { | 895 | }, function () { |
891 | 896 | ||
892 | } | 897 | } |
893 | ); | 898 | ); |
894 | }; | 899 | }; |
895 | 900 | ||
896 | function actualizarCabeceraMoneda(cotizacion) { | 901 | function actualizarCabeceraMoneda(cotizacion) { |
897 | 902 | ||
898 | $scope.remito.articulosRemito.forEach(function (art) { | 903 | $scope.remito.articulosRemito.forEach(function (art) { |
899 | art.precio = (art.precio * $scope.remito.cotizacion.VENDEDOR).toFixed(4); | 904 | art.precio = (art.precio * $scope.remito.cotizacion.VENDEDOR).toFixed(4); |
900 | art.precio = (art.precio / cotizacion.VENDEDOR).toFixed(4); | 905 | art.precio = (art.precio / cotizacion.VENDEDOR).toFixed(4); |
901 | }); | 906 | }); |
902 | 907 | ||
903 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { | 908 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { |
904 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 909 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
905 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 910 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
906 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 911 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
907 | } else { | 912 | } else { |
908 | $scope.$broadcast('addCabecera', { | 913 | $scope.$broadcast('addCabecera', { |
909 | label: 'Moneda:', | 914 | label: 'Moneda:', |
910 | valor: cotizacion.moneda.DETALLE | 915 | valor: cotizacion.moneda.DETALLE |
911 | }); | 916 | }); |
912 | $scope.$broadcast('addCabecera', { | 917 | $scope.$broadcast('addCabecera', { |
913 | label: 'Fecha cotizacion:', | 918 | label: 'Fecha cotizacion:', |
914 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 919 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
915 | }); | 920 | }); |
916 | $scope.$broadcast('addCabecera', { | 921 | $scope.$broadcast('addCabecera', { |
917 | label: 'Cotizacion:', | 922 | label: 'Cotizacion:', |
918 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 923 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
919 | }); | 924 | }); |
920 | } | 925 | } |
921 | } | 926 | } |
922 | 927 | ||
923 | $scope.agregarATabla = function (key) { | 928 | $scope.agregarATabla = function (key) { |
924 | if (key === 13) { | 929 | if (key === 13) { |
925 | if ($scope.articuloACargar.cantidad === undefined || | 930 | if ($scope.articuloACargar.cantidad === undefined || |
926 | $scope.articuloACargar.cantidad === 0 || | 931 | $scope.articuloACargar.cantidad === 0 || |
927 | $scope.articuloACargar.cantidad === null) { | 932 | $scope.articuloACargar.cantidad === null) { |
928 | focaModalService.alert('El valor debe ser al menos 1'); | 933 | focaModalService.alert('El valor debe ser al menos 1'); |
929 | return; | 934 | return; |
930 | } | 935 | } |
931 | delete $scope.articuloACargar.sectorCodigo; | 936 | delete $scope.articuloACargar.sectorCodigo; |
932 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 937 | $scope.remito.articulosRemito.push($scope.articuloACargar); |
933 | $scope.cargando = true; | 938 | $scope.cargando = true; |
934 | } | 939 | } |
935 | }; | 940 | }; |
936 | 941 | ||
937 | $scope.quitarArticulo = function (articulo) { | 942 | $scope.quitarArticulo = function (articulo) { |
938 | articulo.idRemito = -1; | 943 | articulo.idRemito = -1; |
939 | }; | 944 | }; |
940 | 945 | ||
941 | $scope.articulosFiltro = function () { | 946 | $scope.articulosFiltro = function () { |
942 | 947 | ||
943 | var result = $scope.remito.articulosRemito.filter(function (articulo) { | 948 | var result = $scope.remito.articulosRemito.filter(function (articulo) { |
944 | return articulo.idRemito >= 0; | 949 | return articulo.idRemito >= 0; |
945 | }); | 950 | }); |
946 | 951 | ||
947 | // Agrego checked en cabecera si hay datos | 952 | // Agrego checked en cabecera si hay datos |
948 | if (result.length) { | 953 | if (result.length) { |
949 | $filter('filter')($scope.botonera, { label: 'Productos' })[0].checked = true; | 954 | $filter('filter')($scope.botonera, { label: 'Productos' })[0].checked = true; |
950 | } else { | 955 | } else { |
951 | $filter('filter')($scope.botonera, { label: 'Productos' })[0].checked = false; | 956 | $filter('filter')($scope.botonera, { label: 'Productos' })[0].checked = false; |
952 | } | 957 | } |
953 | return result; | 958 | return result; |
954 | }; | 959 | }; |
955 | 960 | ||
956 | $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { | 961 | $scope.editarArticulo = function (key, articulo, tmpCantidad, tmpPrecio) { |
957 | if (key === 13) { | 962 | if (key === 13) { |
958 | if (!articulo.cantidad || !articulo.precio) { | 963 | if (!articulo.cantidad || !articulo.precio) { |
959 | focaModalService.alert('Los valores deben ser al menos 1'); | 964 | focaModalService.alert('Los valores deben ser al menos 1'); |
960 | return; | 965 | return; |
961 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | 966 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
962 | focaModalService.alert('Los valores no pueden ser negativos'); | 967 | focaModalService.alert('Los valores no pueden ser negativos'); |
963 | return; | 968 | return; |
964 | } | 969 | } |
965 | articulo.cantidad = tmpCantidad; | 970 | articulo.cantidad = tmpCantidad; |
966 | articulo.precio = tmpPrecio; | 971 | articulo.precio = tmpPrecio; |
967 | $scope.getTotal(); | 972 | $scope.getTotal(); |
968 | articulo.editCantidad = articulo.editPrecio = false; | 973 | articulo.editCantidad = articulo.editPrecio = false; |
969 | } | 974 | } |
970 | }; | 975 | }; |
971 | 976 | ||
972 | $scope.cancelarEditar = function (articulo) { | 977 | $scope.cancelarEditar = function (articulo) { |
973 | $scope.tmpCantidad = articulo.cantidad; | 978 | $scope.tmpCantidad = articulo.cantidad; |
974 | $scope.tmpPrecio = articulo.precio; | 979 | $scope.tmpPrecio = articulo.precio; |
975 | articulo.editCantidad = articulo.editPrecio = false; | 980 | articulo.editCantidad = articulo.editPrecio = false; |
976 | }; | 981 | }; |
977 | 982 | ||
978 | $scope.cambioEdit = function (articulo, propiedad) { | 983 | $scope.cambioEdit = function (articulo, propiedad) { |
979 | if (propiedad === 'cantidad') { | 984 | if (propiedad === 'cantidad') { |
980 | articulo.editCantidad = true; | 985 | articulo.editCantidad = true; |
981 | } else if (propiedad === 'precio') { | 986 | } else if (propiedad === 'precio') { |
982 | articulo.editPrecio = true; | 987 | articulo.editPrecio = true; |
983 | } | 988 | } |
984 | }; | 989 | }; |
985 | 990 | ||
986 | $scope.resetFilter = function () { | 991 | $scope.resetFilter = function () { |
987 | $scope.articuloACargar = {}; | 992 | $scope.articuloACargar = {}; |
988 | $scope.cargando = true; | 993 | $scope.cargando = true; |
989 | }; | 994 | }; |
990 | //Recibe aviso si el teclado está en uso | 995 | //Recibe aviso si el teclado está en uso |
991 | $rootScope.$on('usarTeclado', function (event, data) { | 996 | $rootScope.$on('usarTeclado', function (event, data) { |
992 | if (data) { | 997 | if (data) { |
993 | $scope.mostrarTeclado = true; | 998 | $scope.mostrarTeclado = true; |
994 | return; | 999 | return; |
995 | } | 1000 | } |
996 | $scope.mostrarTeclado = false; | 1001 | $scope.mostrarTeclado = false; |
997 | }); | 1002 | }); |
998 | 1003 | ||
999 | $scope.selectFocus = function ($event) { | 1004 | $scope.selectFocus = function ($event) { |
1000 | // Si el teclado esta en uso no selecciona el valor | 1005 | // Si el teclado esta en uso no selecciona el valor |
1001 | if ($scope.mostrarTeclado) { | 1006 | if ($scope.mostrarTeclado) { |
1002 | return; | 1007 | return; |
1003 | } | 1008 | } |
1004 | $event.target.select(); | 1009 | $event.target.select(); |
1005 | }; | 1010 | }; |
1006 | 1011 | ||
1007 | function addArrayCabecera(array) { | 1012 | function addArrayCabecera(array) { |
1008 | for (var i = 0; i < array.length; i++) { | 1013 | for (var i = 0; i < array.length; i++) { |
1009 | $scope.$broadcast('addCabecera', { | 1014 | $scope.$broadcast('addCabecera', { |
1010 | label: array[i].label, | 1015 | label: array[i].label, |
1011 | valor: array[i].valor | 1016 | valor: array[i].valor |
1012 | }); | 1017 | }); |
1013 | } | 1018 | } |
1014 | } | 1019 | } |
1015 | 1020 | ||
1016 | function rellenar(relleno, longitud) { | 1021 | function rellenar(relleno, longitud) { |
1017 | relleno = '' + relleno; | 1022 | relleno = '' + relleno; |
1018 | while (relleno.length < longitud) { | 1023 | while (relleno.length < longitud) { |
1019 | relleno = '0' + relleno; | 1024 | relleno = '0' + relleno; |
1020 | } | 1025 | } |
1021 | return relleno; | 1026 | return relleno; |
1022 | } | 1027 | } |
1023 | 1028 | ||
1024 | function varlidarRemitoFacturado() { | 1029 | function varlidarRemitoFacturado() { |
1025 | if ($scope.remito.estado !== 5) { | 1030 | if ($scope.remito.estado !== 5) { |
1026 | return true; | 1031 | return true; |
1027 | } else { | 1032 | } else { |
1028 | focaModalService.alert('No se puede editar un remito facturado'); | 1033 | focaModalService.alert('No se puede editar un remito facturado'); |
1029 | return false(); | 1034 | return false(); |
1030 | } | 1035 | } |
1031 | } | 1036 | } |
1032 | 1037 | ||
1033 | function salir() { | 1038 | function salir() { |
1034 | var confirmacion = false; | 1039 | var confirmacion = false; |
1035 | 1040 | ||
1036 | if (!angular.equals($scope.remito, $scope.inicial)) { | 1041 | if (!angular.equals($scope.remito, $scope.inicial)) { |
1037 | confirmacion = true; | 1042 | confirmacion = true; |
1038 | } | 1043 | } |
1039 | 1044 | ||
1040 | if (confirmacion) { | 1045 | if (confirmacion) { |
1041 | focaModalService.confirm( | 1046 | focaModalService.confirm( |
1042 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 1047 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
1043 | ).then(function (data) { | 1048 | ).then(function (data) { |
1044 | if (data) { | 1049 | if (data) { |
1045 | $location.path('/'); | 1050 | $location.path('/'); |
1046 | } | 1051 | } |
1047 | }); | 1052 | }); |
1048 | } else { | 1053 | } else { |
1049 | $location.path('/'); | 1054 | $location.path('/'); |
1050 | } | 1055 | } |
1051 | } | 1056 | } |
1052 | 1057 | ||
1053 | function enableObservaciones(val) { | 1058 | function enableObservaciones(val) { |
1054 | var boton = $scope.botonera.filter(function (botonObs) { | 1059 | var boton = $scope.botonera.filter(function (botonObs) { |
1055 | return botonObs.label === 'Observaciones'; | 1060 | return botonObs.label === 'Observaciones'; |
1056 | }); | 1061 | }); |
1057 | boton[0].disable = !val; | 1062 | boton[0].disable = !val; |
1058 | } | 1063 | } |
1059 | 1064 | ||
1060 | function setearRemito(remito) { | 1065 | function setearRemito(remito) { |
1061 | //añado cabeceras | 1066 | //añado cabeceras |
1062 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 1067 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
1063 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 1068 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
1064 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 1069 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
1065 | 1070 | ||
1066 | var cabeceras = []; | 1071 | var cabeceras = []; |
1067 | 1072 | ||
1068 | if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | 1073 | if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
1069 | cabeceras.push({ | 1074 | cabeceras.push({ |
1070 | label: 'Moneda:', | 1075 | label: 'Moneda:', |
1071 | valor: remito.cotizacion.moneda.DETALLE | 1076 | valor: remito.cotizacion.moneda.DETALLE |
1072 | }); | 1077 | }); |
1073 | cabeceras.push({ | 1078 | cabeceras.push({ |
1074 | label: 'Fecha cotizacion:', | 1079 | label: 'Fecha cotizacion:', |
1075 | valor: $filter('date')(remito.cotizacion.FECHA, | 1080 | valor: $filter('date')(remito.cotizacion.FECHA, |
1076 | 'dd/MM/yyyy') | 1081 | 'dd/MM/yyyy') |
1077 | }); | 1082 | }); |
1078 | cabeceras.push({ | 1083 | cabeceras.push({ |
1079 | label: 'Cotizacion:', | 1084 | label: 'Cotizacion:', |
1080 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 1085 | valor: $filter('number')(remito.cotizacion.VENDEDOR, |
1081 | '2') | 1086 | '2') |
1082 | }); | 1087 | }); |
1083 | } | 1088 | } |
1084 | 1089 | ||
1085 | if (remito.cotizacion.moneda) { | 1090 | if (remito.cotizacion.moneda) { |
1086 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; | 1091 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
1087 | } | 1092 | } |
1088 | 1093 | ||
1089 | if (remito.cliente.COD) { | 1094 | if (remito.cliente.COD) { |
1090 | cabeceras.push({ | 1095 | cabeceras.push({ |
1091 | label: 'Cliente:', | 1096 | label: 'Cliente:', |
1092 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 1097 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
1093 | remito.cliente.NOM | 1098 | remito.cliente.NOM |
1094 | }); | 1099 | }); |
1095 | cabeceras.push({ | 1100 | cabeceras.push({ |
1096 | label: 'Domicilio:', | 1101 | label: 'Domicilio:', |
1097 | valor: remito.domicilioStamp | 1102 | valor: remito.domicilioStamp |
1098 | }); | 1103 | }); |
1099 | 1104 | ||
1100 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 1105 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
1101 | } | 1106 | } |
1102 | if (remito.vendedor.NUM) { | 1107 | if (remito.vendedor.NUM) { |
1103 | cabeceras.push({ | 1108 | cabeceras.push({ |
1104 | label: 'Vendedor:', | 1109 | label: 'Vendedor:', |
1105 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 1110 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
1106 | ' - ' + remito.vendedor.NOM | 1111 | ' - ' + remito.vendedor.NOM |
1107 | }); | 1112 | }); |
1108 | } | 1113 | } |
1109 | if (remito.proveedor.COD) { | 1114 | if (remito.proveedor.COD) { |
1110 | cabeceras.push({ | 1115 | cabeceras.push({ |
1111 | label: 'Proveedor:', | 1116 | label: 'Proveedor:', |
1112 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + | 1117 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + |
1113 | ' - ' + remito.proveedor.NOM | 1118 | ' - ' + remito.proveedor.NOM |
1114 | }); | 1119 | }); |
1115 | 1120 | ||
1116 | $filter('filter')($scope.botonera, { label: 'Proveedor' })[0].checked = true; | 1121 | $filter('filter')($scope.botonera, { label: 'Proveedor' })[0].checked = true; |
1117 | } | 1122 | } |
1118 | if (remito.flete !== undefined && remito.fob !== undefined) { | 1123 | if (remito.flete !== undefined && remito.fob !== undefined) { |
1119 | cabeceras.push({ | 1124 | cabeceras.push({ |
1120 | label: 'Flete:', | 1125 | label: 'Flete:', |
1121 | valor: remito.fob ? 'FOB' : ( | 1126 | valor: remito.fob ? 'FOB' : ( |
1122 | remito.flete ? 'Si' : 'No') | 1127 | remito.flete ? 'Si' : 'No') |
1123 | }); | 1128 | }); |
1124 | } | 1129 | } |
1125 | if (remito.remitoPlazo) { | 1130 | if (remito.remitoPlazo) { |
1126 | cabeceras.push({ | 1131 | cabeceras.push({ |
1127 | label: 'Precio condicion:', | 1132 | label: 'Precio condicion:', |
1128 | valor: valorPrecioCondicion() + ' ' + | 1133 | valor: valorPrecioCondicion() + ' ' + |
1129 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 1134 | remitoBusinessService.plazoToString(remito.remitoPlazo) |
1130 | }); | 1135 | }); |
1131 | 1136 | ||
1132 | $filter('filter')($scope.botonera, | 1137 | $filter('filter')($scope.botonera, |
1133 | { label: 'Precios y condiciones' })[0].checked = true; | 1138 | { label: 'Precios y condiciones' })[0].checked = true; |
1134 | } | 1139 | } |
1135 | function valorPrecioCondicion() { | 1140 | function valorPrecioCondicion() { |
1136 | if (remito.idPrecioCondicion > 0) { | 1141 | if (remito.idPrecioCondicion > 0) { |
1137 | return remito.precioCondicion.nombre; | 1142 | return remito.precioCondicion.nombre; |
1138 | } else { | 1143 | } else { |
1139 | return 'Ingreso Manual'; | 1144 | return 'Ingreso Manual'; |
1140 | } | 1145 | } |
1141 | } | 1146 | } |
1142 | if (remito.flete === 1) { | 1147 | if (remito.flete === 1) { |
1143 | var cabeceraBomba = { | 1148 | var cabeceraBomba = { |
1144 | label: 'Bomba', | 1149 | label: 'Bomba', |
1145 | valor: remito.bomba === 1 ? 'Si' : 'No' | 1150 | valor: remito.bomba === 1 ? 'Si' : 'No' |
1146 | }; | 1151 | }; |
1147 | if (remito.kilometros) { | 1152 | if (remito.kilometros) { |
1148 | var cabeceraKilometros = { | 1153 | var cabeceraKilometros = { |
1149 | label: 'Kilometros', | 1154 | label: 'Kilometros', |
1150 | valor: remito.kilometros | 1155 | valor: remito.kilometros |
1151 | }; | 1156 | }; |
1152 | cabeceras.push(cabeceraKilometros); | 1157 | cabeceras.push(cabeceraKilometros); |
1153 | } | 1158 | } |
1154 | cabeceras.push(cabeceraBomba); | 1159 | cabeceras.push(cabeceraBomba); |
1155 | } | 1160 | } |
1156 | 1161 | ||
1157 | if (remito.idPrecioCondicion > 0) { | 1162 | if (remito.idPrecioCondicion > 0) { |
1158 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 1163 | $scope.idLista = remito.precioCondicion.idListaPrecio; |
1159 | } else { | 1164 | } else { |
1160 | $scope.idLista = -1; | 1165 | $scope.idLista = -1; |
1161 | } | 1166 | } |
1162 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 1167 | $scope.puntoVenta = rellenar(remito.sucursal, 4); |
1163 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 1168 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
1164 | $scope.remito = remito; | 1169 | $scope.remito = remito; |
1165 | if ($scope.remito.remitoPuntoDescarga.length) { | 1170 | if ($scope.remito.remitoPuntoDescarga.length) { |
1166 | var puntoDescarga = []; | 1171 | var puntoDescarga = []; |
1167 | 1172 | ||
1168 | $scope.remito.remitoPuntoDescarga.forEach(function(remitoPuntoDescarga) { | 1173 | $scope.remito.remitoPuntoDescarga.forEach(function(remitoPuntoDescarga) { |
1169 | puntoDescarga.push(remitoPuntoDescarga.puntoDescarga); | 1174 | puntoDescarga.push(remitoPuntoDescarga.puntoDescarga); |
1170 | }); | 1175 | }); |
1171 | 1176 | ||
1172 | cabeceras.push({ | 1177 | cabeceras.push({ |
1173 | label: 'Puntos de descarga: ', | 1178 | label: 'Puntos de descarga: ', |
1174 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntoDescarga)) | 1179 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntoDescarga)) |
1175 | }); | 1180 | }); |
1176 | } | 1181 | } |
1177 | $scope.remitoIsDirty = false; | 1182 | $scope.remitoIsDirty = false; |
1178 | 1183 | ||
1179 | if ($scope.remito.articulosRemito.length) { | 1184 | if ($scope.remito.articulosRemito.length) { |
1180 | $scope.remito.articulosRemito.forEach(function (articulo) { | 1185 | $scope.remito.articulosRemito.forEach(function (articulo) { |
1181 | articulo.precio = | 1186 | articulo.precio = |
1182 | (articulo.precio / $scope.remito.cotizacion.VENDEDOR).toFixed(4); | 1187 | (articulo.precio / $scope.remito.cotizacion.VENDEDOR).toFixed(4); |
1183 | }); | 1188 | }); |
1184 | } | 1189 | } |
1185 | 1190 | ||
1186 | addArrayCabecera(cabeceras); | 1191 | addArrayCabecera(cabeceras); |
1187 | } | 1192 | } |
1188 | 1193 | ||
1189 | function getLSRemito() { | 1194 | function getLSRemito() { |
1190 | var remito = JSON.parse($localStorage.remito || null); | 1195 | var remito = JSON.parse($localStorage.remito || null); |
1191 | if (remito) { | 1196 | if (remito) { |
1192 | setearRemito(remito); | 1197 | setearRemito(remito); |
1193 | delete $localStorage.remito; | 1198 | delete $localStorage.remito; |
1194 | } | 1199 | } |
1195 | } | 1200 | } |
1196 | 1201 | ||
1197 | function deleteCliente() { | 1202 | function deleteCliente() { |
1198 | $scope.remito.domicilioStamp = ''; | 1203 | $scope.remito.domicilioStamp = ''; |
1199 | $scope.remito.remitoPuntoDescarga = []; | 1204 | $scope.remito.remitoPuntoDescarga = []; |
1200 | $scope.remito.domicilio = { dom: '' }; | 1205 | $scope.remito.domicilio = { dom: '' }; |
1201 | $scope.remito.cliente = {}; | 1206 | $scope.remito.cliente = {}; |
1202 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 1207 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
1203 | $scope.$broadcast('removeCabecera', 'Domicilio:'); | 1208 | $scope.$broadcast('removeCabecera', 'Domicilio:'); |
1204 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | 1209 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); |
1205 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false; | 1210 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = false; |
1206 | } | 1211 | } |
1207 | 1212 | ||
1208 | function getCabeceraPuntoDescarga(puntosDescarga) { | 1213 | function getCabeceraPuntoDescarga(puntosDescarga) { |
1209 | var puntosStamp = ''; | 1214 | var puntosStamp = ''; |
1210 | puntosDescarga.forEach(function (punto, idx, arr) { | 1215 | puntosDescarga.forEach(function (punto, idx, arr) { |
1211 | puntosStamp += punto.descripcion; | 1216 | puntosStamp += punto.descripcion; |
1212 | if ((idx + 1) !== arr.length) puntosStamp += ', '; | 1217 | if ((idx + 1) !== arr.length) puntosStamp += ', '; |
1213 | }); | 1218 | }); |
1214 | return puntosStamp; | 1219 | return puntosStamp; |
1215 | } | 1220 | } |
1216 | 1221 | ||
1217 | function abrirModalMail(id, cliente, numeroRemito) { | 1222 | function abrirModalMail(id, cliente, numeroRemito) { |
1218 | focaModalService.mail( | 1223 | focaModalService.mail( |
1219 | { | 1224 | { |
1220 | titulo: 'Comprobante de remito Nº ' + numeroRemito, | 1225 | titulo: 'Comprobante de remito Nº ' + numeroRemito, |
1221 | descarga: { | 1226 | descarga: { |
1222 | nombre: numeroRemito + '.pdf', | 1227 | nombre: numeroRemito + '.pdf', |
1223 | url: '/remito/comprobante', | 1228 | url: '/remito/comprobante', |
1224 | }, | 1229 | }, |
1225 | envio: { | 1230 | envio: { |
1226 | mailCliente: cliente.MAIL, | 1231 | mailCliente: cliente.MAIL, |
1227 | url: '/remito/mail', | 1232 | url: '/remito/mail', |
1228 | }, | 1233 | }, |
1229 | options: { | 1234 | options: { |
1230 | idRemito: id | 1235 | idRemito: id |
1231 | } | 1236 | } |
1232 | } | 1237 | } |
1233 | ) | 1238 | ) |
1234 | .then(function (res) { | 1239 | .then(function (res) { |
1235 | if (res === false) { | 1240 | if (res === false) { |
1236 | abrirModalMail(id); | 1241 | abrirModalMail(id); |
1237 | focaModalService.alert('Descarga o envíe su remito ' + | 1242 | focaModalService.alert('Descarga o envíe su remito ' + |
1238 | 'antes de cerrar esta ventana'); | 1243 | 'antes de cerrar esta ventana'); |
1239 | } | 1244 | } |
1240 | }); | 1245 | }); |
1241 | } | 1246 | } |
1242 | //recibo la propiedad por la cual quiero obtener el valor | 1247 | //recibo la propiedad por la cual quiero obtener el valor |
1243 | function getImporte(propiedad) { | 1248 | function getImporte(propiedad) { |
1244 | var importe = 0; | 1249 | var importe = 0; |
1245 | 1250 | ||
1246 | $scope.articulosFiltro().forEach(function (articulo) { | 1251 | $scope.articulosFiltro().forEach(function (articulo) { |
1247 | 1252 | ||
1248 | if (articulo[propiedad]) { | 1253 | if (articulo[propiedad]) { |
1249 | importe += articulo[propiedad] * articulo.cantidad; | 1254 | importe += articulo[propiedad] * articulo.cantidad; |
1250 | } | 1255 | } |
1251 | return; | 1256 | return; |
1252 | 1257 | ||
1253 | }); | 1258 | }); |
1254 | 1259 | ||
1255 | return importe; | 1260 | return importe; |
1256 | } | 1261 | } |
1257 | } | 1262 | } |
1258 | ]); | 1263 | ]); |