Commit e20e4c6bd6f527a26559b29640c1fcf5bf2eab6e

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master

See merge request !75
... ... @@ -60,7 +60,7 @@
60 60 "gulp-uglify-es": "^1.0.4",
61 61 "jasmine-core": "^3.3.0",
62 62 "jquery": "^3.3.1",
63   - "jshint": "^2.9.6",
  63 + "jshint": "^2.10.2",
64 64 "ladda": "1.0.6",
65 65 "pre-commit": "^1.2.2",
66 66 "pump": "^3.0.0",
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 ||