Commit 28a353e0f29aaf037395c34ed5b2c34925550b66
1 parent
74a74006ef
Exists in
master
and in
1 other branch
refactor valor compra por valor venta
Showing
1 changed file
with
11 additions
and
14 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -2,9 +2,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 2 | 2 | [ |
| 3 | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
| 4 | 4 | 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', |
| 5 | + '$rootScope', | |
| 5 | 6 | function( |
| 6 | 7 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
| 7 | - focaSeguimientoService, notaPedidoBusinessService | |
| 8 | + focaSeguimientoService, notaPedidoBusinessService, $rootScope | |
| 8 | 9 | ) { |
| 9 | 10 | $scope.botonera = [ |
| 10 | 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| ... | ... | @@ -47,7 +48,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 47 | 48 | addCabecera('Moneda:', monedaPorDefecto.detalle); |
| 48 | 49 | addCabecera('Fecha cotizacion:', |
| 49 | 50 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
| 50 | - addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | |
| 51 | + addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR); | |
| 51 | 52 | $scope.notaPedido.moneda = monedaPorDefecto; |
| 52 | 53 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
| 53 | 54 | }); |
| ... | ... | @@ -162,7 +163,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 162 | 163 | idProveedor: $scope.notaPedido.proveedor.codigo, |
| 163 | 164 | idDomicilio: $scope.notaPedido.domicilio.id, |
| 164 | 165 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
| 165 | - cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | |
| 166 | + cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | |
| 166 | 167 | flete: $scope.notaPedido.flete, |
| 167 | 168 | fob: $scope.notaPedido.fob, |
| 168 | 169 | bomba: $scope.notaPedido.bomba, |
| ... | ... | @@ -173,7 +174,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 173 | 174 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 174 | 175 | function(data) { |
| 175 | 176 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
| 176 | - data.data.id, $scope.notaPedido.cotizacion.COTIZACION); | |
| 177 | + data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | |
| 177 | 178 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); |
| 178 | 179 | var plazos = $scope.plazosPagos; |
| 179 | 180 | |
| ... | ... | @@ -194,7 +195,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 194 | 195 | 'Fecha cotizacion:', |
| 195 | 196 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
| 196 | 197 | ); |
| 197 | - addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); | |
| 198 | + addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); | |
| 198 | 199 | $scope.notaPedido.vendedor = {}; |
| 199 | 200 | $scope.notaPedido.cliente = {}; |
| 200 | 201 | $scope.notaPedido.proveedor = {}; |
| ... | ... | @@ -226,7 +227,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 226 | 227 | resolve: { |
| 227 | 228 | parametroProducto: { |
| 228 | 229 | idLista: $scope.idLista, |
| 229 | - cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | |
| 230 | + cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | |
| 230 | 231 | simbolo: $scope.notaPedido.moneda.simbolo |
| 231 | 232 | } |
| 232 | 233 | }, |
| ... | ... | @@ -480,9 +481,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 480 | 481 | var articulosTablaTemp = $scope.articulosTabla; |
| 481 | 482 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 482 | 483 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 483 | - $scope.notaPedido.cotizacion.COTIZACION; | |
| 484 | + $scope.notaPedido.cotizacion.VENDEDOR; | |
| 484 | 485 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 485 | - cotizacion.COTIZACION; | |
| 486 | + cotizacion.VENDEDOR; | |
| 486 | 487 | } |
| 487 | 488 | $scope.articulosTabla = articulosTablaTemp; |
| 488 | 489 | $scope.notaPedido.moneda = { |
| ... | ... | @@ -490,17 +491,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 490 | 491 | detalle: moneda.DETALLE, |
| 491 | 492 | simbolo: moneda.SIMBOLO |
| 492 | 493 | }; |
| 493 | - $scope.notaPedido.cotizacion = { | |
| 494 | - ID: cotizacion.ID, | |
| 495 | - COTIZACION: cotizacion.COTIZACION, | |
| 496 | - FECHA: cotizacion.FECHA | |
| 497 | - }; | |
| 494 | + $scope.notaPedido.cotizacion = cotizacion; | |
| 498 | 495 | addCabecera('Moneda:', moneda.DETALLE); |
| 499 | 496 | addCabecera( |
| 500 | 497 | 'Fecha cotizacion:', |
| 501 | 498 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 502 | 499 | ); |
| 503 | - addCabecera('Cotizacion:', cotizacion.COTIZACION); | |
| 500 | + addCabecera('Cotizacion:', cotizacion.VENDEDOR); | |
| 504 | 501 | }, function() { |
| 505 | 502 | |
| 506 | 503 | } |