Commit 65f66401b14f8d8c5991d06acab31e1cf39ce62d

Authored by Luigi
1 parent 80ecc23929
Exists in master

Cotizacion Pesos Argentinos

Showing 1 changed file with 51 additions and 20 deletions   Show diff stats
src/js/controller.js
... ... @@ -21,6 +21,27 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
21 21 {
22 22 config();
23 23  
  24 + var cotizacionPArgentino = {
  25 + COTIZACION: 1,
  26 + C_HD: '',
  27 + E_HD: '',
  28 + FECHA: new Date(),
  29 + ID: 20,
  30 + ID_MONEDA: 1,
  31 + VENDEDOR: 1,
  32 + moneda: {
  33 + ALIAS_CC: 1091,
  34 + CODIGO_AFIP: 'PES',
  35 + COTIZACION: 0,
  36 + C_HD: '',
  37 + DETALLE: 'PESOS ARGENTINOS',
  38 + E_HD: '',
  39 + FECHA_ULT_COT: new Date(),
  40 + ID: 1,
  41 + SIMBOLO: '$'
  42 + }
  43 + };
  44 +
24 45 function config() {
25 46 // PARAMETROS INICIALES PARA FUNCIONAMIENTO DEL PROGRAMA
26 47 $scope.tmpCantidad = Number;
... ... @@ -37,7 +58,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
37 58 maxDate: new Date(),
38 59 minDate: new Date(2010, 0, 1)
39 60 };
40   -
  61 +
41 62 //SETEO BOTONERA LATERAL
42 63 $timeout(function() {
43 64 focaBotoneraLateralService.showSalir(false);
... ... @@ -672,7 +693,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
672 693 };
673 694 focaModalService.modal(parametrosModal).then(
674 695 function(moneda) {
675   - $scope.abrirModalCotizacion(moneda);
  696 + if (moneda.ID !== 1) {
  697 + $scope.abrirModalCotizacion(moneda);
  698 + }
  699 + moneda = cotizacionPArgentino;
  700 + $scope.notaPedido.cotizacion = cotizacionPArgentino;
  701 + $scope.notaPedido.cotizacion.moneda = cotizacionPArgentino.moneda;
  702 + actualizarCabeceraMoneda(cotizacionPArgentino);
676 703 }, function() {
677 704  
678 705 }
... ... @@ -721,30 +748,34 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
721 748 $scope.notaPedido.articulosNotaPedido = articulosTablaTemp;
722 749 $scope.notaPedido.cotizacion = cotizacion;
723 750 $scope.notaPedido.cotizacion.moneda = moneda;
724   - if (moneda.DETALLE === 'PESOS ARGENTINOS') {
725   - $scope.$broadcast('removeCabecera', 'Moneda:');
726   - $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
727   - $scope.$broadcast('removeCabecera', 'Cotizacion:');
728   - } else {
729   - $scope.$broadcast('addCabecera', {
730   - label: 'Moneda:',
731   - valor: moneda.DETALLE
732   - });
733   - $scope.$broadcast('addCabecera', {
734   - label: 'Fecha cotizacion:',
735   - valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
736   - });
737   - $scope.$broadcast('addCabecera', {
738   - label: 'Cotizacion:',
739   - valor: $filter('number')(cotizacion.VENDEDOR, '2')
740   - });
741   - }
  751 + actualizarCabeceraMoneda(cotizacion);
742 752 }, function() {
743 753  
744 754 }
745 755 );
746 756 };
747 757  
  758 + function actualizarCabeceraMoneda (cotizacion) {
  759 + if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') {
  760 + $scope.$broadcast('removeCabecera', 'Moneda:');
  761 + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
  762 + $scope.$broadcast('removeCabecera', 'Cotizacion:');
  763 + } else {
  764 + $scope.$broadcast('addCabecera', {
  765 + label: 'Moneda:',
  766 + valor: cotizacion.moneda.DETALLE
  767 + });
  768 + $scope.$broadcast('addCabecera', {
  769 + label: 'Fecha cotizacion:',
  770 + valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
  771 + });
  772 + $scope.$broadcast('addCabecera', {
  773 + label: 'Cotizacion:',
  774 + valor: $filter('number')(cotizacion.VENDEDOR, '2')
  775 + });
  776 + }
  777 + }
  778 +
748 779 $scope.agregarATabla = function(key) {
749 780 if (key === 13) {
750 781 if ($scope.articuloACargar.cantidad === undefined ||