Commit 8aee8c1f53aced39de8fd825580a920a81ca2586

Authored by Luigi
1 parent 351c88d9d1
Exists in master and in 1 other branch develop

Cotizacion pesos argentinos (modal)

Showing 1 changed file with 34 additions and 19 deletions   Show diff stats
src/js/controller.js
... ... @@ -9,6 +9,8 @@ angular.module('focaCrearRemito') .controller('remitoController',
9 9 {
10 10 config();
11 11  
  12 + var cotizacionPArgentino = {};
  13 +
12 14 function config() {
13 15 $scope.tmpCantidad = Number;
14 16 $scope.tmpPrecio = Number;
... ... @@ -813,7 +815,16 @@ angular.module('focaCrearRemito') .controller('remitoController',
813 815 };
814 816 focaModalService.modal(parametrosModal).then(
815 817 function(moneda) {
816   - $scope.abrirModalCotizacion(moneda);
  818 + if (moneda.ID !== 1) {
  819 + $scope.abrirModalCotizacion(moneda);
  820 + }
  821 + crearRemitoService.getCotizacionByIdMoneda(1)
  822 + .then(function (res){
  823 + cotizacionPArgentino = res.data[0];
  824 + $scope.remito.cotizacion = cotizacionPArgentino;
  825 + $scope.remito.cotizacion.moneda = moneda;
  826 + actualizarCabeceraMoneda(cotizacionPArgentino);
  827 + });
817 828 }, function() {
818 829  
819 830 }
... ... @@ -856,30 +867,34 @@ angular.module('focaCrearRemito') .controller('remitoController',
856 867 $scope.remito.articulosRemito = articulosTablaTemp;
857 868 $scope.remito.cotizacion = cotizacion;
858 869 $scope.remito.cotizacion.moneda = moneda;
859   - if (moneda.DETALLE === 'PESOS ARGENTINOS') {
860   - $scope.$broadcast('removeCabecera', 'Moneda:');
861   - $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
862   - $scope.$broadcast('removeCabecera', 'Cotizacion:');
863   - } else {
864   - $scope.$broadcast('addCabecera',{
865   - label: 'Moneda:',
866   - valor: moneda.DETALLE
867   - });
868   - $scope.$broadcast('addCabecera',{
869   - label: 'Fecha cotizacion:',
870   - valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
871   - });
872   - $scope.$broadcast('addCabecera',{
873   - label: 'Cotizacion:',
874   - valor: $filter('number')(cotizacion.VENDEDOR, '2')
875   - });
876   - }
  870 + actualizarCabeceraMoneda(cotizacion);
877 871 }, function() {
878 872  
879 873 }
880 874 );
881 875 };
882 876  
  877 + function actualizarCabeceraMoneda (cotizacion) {
  878 + if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') {
  879 + $scope.$broadcast('removeCabecera', 'Moneda:');
  880 + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
  881 + $scope.$broadcast('removeCabecera', 'Cotizacion:');
  882 + } else {
  883 + $scope.$broadcast('addCabecera', {
  884 + label: 'Moneda:',
  885 + valor: cotizacion.moneda.DETALLE
  886 + });
  887 + $scope.$broadcast('addCabecera', {
  888 + label: 'Fecha cotizacion:',
  889 + valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
  890 + });
  891 + $scope.$broadcast('addCabecera', {
  892 + label: 'Cotizacion:',
  893 + valor: $filter('number')(cotizacion.VENDEDOR, '2')
  894 + });
  895 + }
  896 + }
  897 +
883 898 $scope.agregarATabla = function(key) {
884 899 if (key === 13) {
885 900 if ($scope.articuloACargar.cantidad === undefined ||