Commit cf96528377cd7604141b6e4b35c250cdb5ff52ef
1 parent
846f410cbf
Exists in
master
and in
1 other branch
proveedor por defecto
Showing
1 changed file
with
51 additions
and
36 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -26,28 +26,39 @@ angular.module('focaCrearRemito') .controller('remitoController', |
26 | 26 | }; |
27 | 27 | |
28 | 28 | var monedaPorDefecto; |
29 | + var proveedorPorDefecto; | |
29 | 30 | var promiseMoneda = crearRemitoService.getCotizacionByIdMoneda(1); |
30 | - var promiseProveedor = crearRemitoService.getProveedorById(1); | |
31 | + var promiseProveedor = crearRemitoService.getProveedorById(98); | |
31 | 32 | |
32 | 33 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
33 | 34 | //Trabajo con el proveedo YPF, por eso uso siempre la primera |
34 | 35 | |
35 | 36 | Promise.all([promiseMoneda, promiseProveedor]).then(function(res) { |
36 | - var monedaPorDefecto = res[0].data[0]; | |
37 | + | |
38 | + monedaPorDefecto = res[0].data[0]; | |
39 | + proveedorPorDefecto = res[1].data[0]; | |
40 | + | |
37 | 41 | $scope.remito.cotizacion = Object.assign( |
38 | 42 | {moneda: monedaPorDefecto}, |
39 | 43 | monedaPorDefecto.cotizaciones[0] |
40 | 44 | ); |
41 | 45 | $scope.inicial.cotizacion = $scope.remito.cotizacion; |
42 | - var proveedorPorDefecto = res[1].data[0]; | |
46 | + | |
47 | + | |
43 | 48 | $scope.remito.proveedor = Object.assign( |
44 | 49 | {proveedor: proveedorPorDefecto} |
45 | 50 | ); |
46 | 51 | $scope.inicial.proveedor = $scope.remito.proveedor; |
52 | + | |
47 | 53 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); |
48 | 54 | $scope.proveedor = angular.copy($scope.remito.proveedor); |
55 | + | |
56 | + $scope.remito.flete = false; | |
57 | + $scope.remito.fob = false; | |
58 | + $scope.remito.bomba = false; | |
59 | + | |
49 | 60 | $timeout(function() {getLSRemito();}); |
50 | - }); | |
61 | + }); | |
51 | 62 | //SETEO BOTONERA LATERAL |
52 | 63 | $timeout(function() { |
53 | 64 | focaBotoneraLateralService.showSalir(false); |
... | ... | @@ -124,7 +135,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
124 | 135 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
125 | 136 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
126 | 137 | var puntosDescarga = []; |
127 | - notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedido, idx, arr) { | |
138 | + notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedido) { | |
128 | 139 | puntosDescarga.push(notaPedido.puntoDescarga); |
129 | 140 | }); |
130 | 141 | var cabeceras = [ |
... | ... | @@ -176,7 +187,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
176 | 187 | }, |
177 | 188 | { |
178 | 189 | label: 'Puntos de descarga: ', |
179 | - valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga)) | |
190 | + valor: $filter('rellenarDigitos')( | |
191 | + getCabeceraPuntoDescarga(puntosDescarga)) | |
180 | 192 | } |
181 | 193 | ]; |
182 | 194 | |
... | ... | @@ -282,29 +294,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
282 | 294 | idCliente: $scope.remito.cliente.COD, |
283 | 295 | nombreCliente: $scope.remito.cliente.NOM, |
284 | 296 | cuitCliente: $scope.remito.cliente.CUIT, |
285 | - responsabilidadIvaCliente: 0,//TODO, | |
286 | - descuento: 0,//TODO, | |
287 | - importeNeto: 0,//TODO | |
288 | - importeExento: 0,//TODO | |
289 | - importeIva: 0,//TODO | |
290 | - importeIvaServicios: 0,//TODO | |
291 | - importeImpuestoInterno: 0,//TODO | |
292 | - importeImpuestoInterno1: 0,//TODO | |
293 | - importeImpuestoInterno2: 0,//TODO | |
294 | - percepcion: 0,//TODO | |
295 | - percepcionIva: 0,//TODO | |
296 | - redondeo: 0,//TODO | |
297 | 297 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
298 | 298 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
299 | - anulado: false, | |
300 | - planilla: 0,//TODO | |
301 | - lugar: 0,//TODO | |
302 | - cuentaMadre: 0,// | |
303 | - cuentaContable: 0,//TODO | |
304 | - asiento: 0,//TODO | |
305 | - e_hd: '',//TODO | |
306 | - c_hd: '', | |
307 | - numeroLiquidoProducto: 0,//TODO | |
308 | 299 | idVendedor: $scope.remito.idVendedor, |
309 | 300 | idProveedor: $scope.remito.idProveedor, |
310 | 301 | idDomicilio: $scope.remito.idDomicilio, |
... | ... | @@ -315,12 +306,33 @@ angular.module('focaCrearRemito') .controller('remitoController', |
315 | 306 | bomba: $scope.remito.bomba, |
316 | 307 | kilometros: $scope.remito.kilometros, |
317 | 308 | domicilioStamp: $scope.remito.domicilioStamp, |
309 | + observaciones: $scope.remito.observaciones, | |
310 | + numeroRemito: parseInt($scope.comprobante), | |
311 | + sucursal: parseInt($scope.puntoVenta), | |
312 | + responsabilidadIvaCliente: 0,//TODO CAMPO IVA CLIENTES | |
313 | + descuento: 0,//TODO, | |
314 | + importeNeto: 0,//TODO SUMATORIA NETO * CANTIDAD ARTICULOS | |
315 | + importeExento: 0,//TODO SUMATORIA EXENTO * CANTIDAD ARTICULOS | |
316 | + importeIva: 0,//TODO SUMATORIA IVA * CANTIDAD ARTICULOS | |
317 | + importeIvaServicios: 0,//TODO | |
318 | + importeImpuestoInterno: 0,//SUMA importeImpuestoInterno * CANT ARTICULO | |
319 | + importeImpuestoInterno1: 0,//SUMA importeImpuestoInterno1 * CANT ARTICULO | |
320 | + importeImpuestoInterno2: 0,//SUMA importeImpuestoInterno2 * CANT ARTICULO | |
321 | + percepcion: 0,//TODO | |
322 | + percepcionIva: 0,//TODO | |
323 | + redondeo: 0,//TODO | |
324 | + anulado: false, | |
325 | + planilla: 0,//TODO DDMMYYYY | |
326 | + lugar: 0,//SUCURSAL | |
327 | + cuentaMadre: 0,//TODO | |
328 | + cuentaContable: 0,//TODO | |
329 | + asiento: 0,//TODO | |
330 | + e_hd: '',//TODO | |
331 | + c_hd: '', | |
332 | + numeroLiquidoProducto: 0,//TODO | |
318 | 333 | estado: 0,//TODO |
319 | 334 | destinoVenta: 0,//TODO |
320 | 335 | operacionTipo: 0, //TODO |
321 | - observaciones: $scope.remito.observaciones, | |
322 | - numeroRemito: parseInt($scope.comprobante), | |
323 | - sucursal: parseInt($scope.puntoVenta) | |
324 | 336 | }, |
325 | 337 | notaPedido: $scope.notaPedido |
326 | 338 | }; |
... | ... | @@ -457,7 +469,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
457 | 469 | |
458 | 470 | $scope.$broadcast('addCabecera', { |
459 | 471 | label: 'Puntos de descarga:', |
460 | - valor: getCabeceraPuntoDescarga($scope.remito.domicilio.puntosDescarga) | |
472 | + valor: getCabeceraPuntoDescarga( | |
473 | + $scope.remito.domicilio.puntosDescarga ) | |
461 | 474 | }); |
462 | 475 | }, function() { |
463 | 476 | $scope.abrirModalDomicilios($scope.cliente); |
... | ... | @@ -588,6 +601,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
588 | 601 | modalInstanceDomicilio.result.then( |
589 | 602 | function(domicilio) { |
590 | 603 | $scope.remito.domicilio = domicilio; |
604 | + console.log(cliente); | |
591 | 605 | $scope.remito.cliente = { |
592 | 606 | COD: cliente.cod, |
593 | 607 | CUIT: cliente.cuit, |
... | ... | @@ -648,11 +662,12 @@ angular.module('focaCrearRemito') .controller('remitoController', |
648 | 662 | } |
649 | 663 | |
650 | 664 | if ($scope.remito.articulosRemito.length !== 0) { |
651 | - focaModalService.confirm('Se perderan los productos ingresados').then(function(data) { | |
652 | - if (data && varlidarRemitoFacturado()) { | |
653 | - abrirModal(); | |
654 | - } | |
655 | - }); | |
665 | + focaModalService.confirm('Se perderan los productos ingresados') | |
666 | + .then(function(data) { | |
667 | + if (data && varlidarRemitoFacturado()) { | |
668 | + abrirModal(); | |
669 | + } | |
670 | + }); | |
656 | 671 | } else { |
657 | 672 | abrirModal(); |
658 | 673 | } |