From 28a353e0f29aaf037395c34ed5b2c34925550b66 Mon Sep 17 00:00:00 2001 From: efernandez Date: Thu, 8 Nov 2018 16:44:47 -0300 Subject: [PATCH] refactor valor compra por valor venta --- src/js/controller.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index b9403be..d6c027a 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -2,9 +2,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', [ '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', + '$rootScope', function( $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, - focaSeguimientoService, notaPedidoBusinessService + focaSeguimientoService, notaPedidoBusinessService, $rootScope ) { $scope.botonera = [ {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, @@ -47,7 +48,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', addCabecera('Moneda:', monedaPorDefecto.detalle); addCabecera('Fecha cotizacion:', new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); - addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); + addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR); $scope.notaPedido.moneda = monedaPorDefecto; $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; }); @@ -162,7 +163,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', idProveedor: $scope.notaPedido.proveedor.codigo, idDomicilio: $scope.notaPedido.domicilio.id, idCotizacion: $scope.notaPedido.cotizacion.ID, - cotizacion: $scope.notaPedido.cotizacion.COTIZACION, + cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, flete: $scope.notaPedido.flete, fob: $scope.notaPedido.fob, bomba: $scope.notaPedido.bomba, @@ -173,7 +174,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', crearNotaPedidoService.crearNotaPedido(notaPedido).then( function(data) { notaPedidoBusinessService.addArticulos($scope.articulosTabla, - data.data.id, $scope.notaPedido.cotizacion.COTIZACION); + data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); focaSeguimientoService.guardarPosicion('crear nota pedido', ''); var plazos = $scope.plazosPagos; @@ -194,7 +195,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 'Fecha cotizacion:', $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') ); - addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); + addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); $scope.notaPedido.vendedor = {}; $scope.notaPedido.cliente = {}; $scope.notaPedido.proveedor = {}; @@ -226,7 +227,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', resolve: { parametroProducto: { idLista: $scope.idLista, - cotizacion: $scope.notaPedido.cotizacion.COTIZACION, + cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, simbolo: $scope.notaPedido.moneda.simbolo } }, @@ -480,9 +481,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', var articulosTablaTemp = $scope.articulosTabla; for(var i = 0; i < articulosTablaTemp.length; i++) { articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * - $scope.notaPedido.cotizacion.COTIZACION; + $scope.notaPedido.cotizacion.VENDEDOR; articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / - cotizacion.COTIZACION; + cotizacion.VENDEDOR; } $scope.articulosTabla = articulosTablaTemp; $scope.notaPedido.moneda = { @@ -490,17 +491,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', detalle: moneda.DETALLE, simbolo: moneda.SIMBOLO }; - $scope.notaPedido.cotizacion = { - ID: cotizacion.ID, - COTIZACION: cotizacion.COTIZACION, - FECHA: cotizacion.FECHA - }; + $scope.notaPedido.cotizacion = cotizacion; addCabecera('Moneda:', moneda.DETALLE); addCabecera( 'Fecha cotizacion:', $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') ); - addCabecera('Cotizacion:', cotizacion.COTIZACION); + addCabecera('Cotizacion:', cotizacion.VENDEDOR); }, function() { } -- 1.9.1