Commit 1ebdd5d8f5cce675329af704a33c09354d554091
1 parent
e2c80cacc7
Exists in
master
refactor crear remito
Showing
2 changed files
with
12 additions
and
15 deletions
Show diff stats
src/js/businessService.js
| ... | ... | @@ -3,15 +3,16 @@ angular.module('focaCrearHojaRuta') |
| 3 | 3 | 'focaCrearHojaRutaService', |
| 4 | 4 | function(crearHojaRutaService) { |
| 5 | 5 | return { |
| 6 | - addArticulos: function(articulosHojaRuta, idRemito, cotizacion) { | |
| 6 | + addArticulos: function(articulosHojaRuta, cotizacion) { | |
| 7 | + | |
| 7 | 8 | for(var i = 0; i < articulosHojaRuta.length; i++) { |
| 8 | 9 | delete articulosHojaRuta[i].editCantidad; |
| 9 | 10 | delete articulosHojaRuta[i].editPrecio; |
| 10 | 11 | delete articulosHojaRuta[i].sectorCodigo; |
| 11 | - articulosHojaRuta[i].idRemito = idRemito; | |
| 12 | 12 | articulosHojaRuta[i].precio = articulosHojaRuta[i].precio * cotizacion; |
| 13 | - crearHojaRutaService.crearArticulosParaHojaRuta(articulosHojaRuta[i]); | |
| 14 | 13 | } |
| 14 | + | |
| 15 | + return articulosHojaRuta; | |
| 15 | 16 | }, |
| 16 | 17 | addEstado: function(idHojaRuta, idVendedor) { |
| 17 | 18 | var date = new Date(); |
src/js/controller.js
| ... | ... | @@ -297,14 +297,14 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
| 297 | 297 | idCliente: $scope.hojaRuta.cliente.COD, |
| 298 | 298 | nombreCliente: $scope.hojaRuta.cliente.NOM, |
| 299 | 299 | cuitCliente: $scope.hojaRuta.cliente.CUIT, |
| 300 | - idVendedor: $cookies.get('vendedorCobrador'), | |
| 301 | - idProveedor: $scope.hojaRuta.proveedor.COD, | |
| 300 | + idVendedor: $scope.hojaRuta.cliente.VEN, | |
| 301 | + idProveedor: parseInt($scope.hojaRuta.proveedor.COD), | |
| 302 | 302 | idDomicilio: $scope.hojaRuta.idDomicilio || |
| 303 | 303 | $scope.hojaRuta.domicilio.id, |
| 304 | 304 | idCotizacion: $scope.hojaRuta.cotizacion.ID, |
| 305 | 305 | domicilioStamp: $scope.hojaRuta.domicilioStamp, |
| 306 | 306 | observaciones: $scope.hojaRuta.observaciones, |
| 307 | - idListaPrecio: $scope.hojaRuta.cliente.MOD.trim(), | |
| 307 | + idListaPrecio: parseInt($scope.hojaRuta.cliente.MOD.trim()), | |
| 308 | 308 | total: getImporte('total') || 0, |
| 309 | 309 | descuento: 0,//TODO, |
| 310 | 310 | importeNeto: getImporte('netoUnitario') || 0, //TODO: arreglar, |
| ... | ... | @@ -335,7 +335,11 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
| 335 | 335 | }, |
| 336 | 336 | notaPedido: { |
| 337 | 337 | id: 0 |
| 338 | - } | |
| 338 | + }, | |
| 339 | + articulos: hojaRutaBusinessService.addArticulos($scope.articulosRecibidos, | |
| 340 | + $scope.hojaRuta.cotizacion.VENDEDOR), | |
| 341 | + puntosDescarga: [], | |
| 342 | + plazos: [] | |
| 339 | 343 | }; |
| 340 | 344 | focaCrearHojaRutaService.crearRemito(save).then( |
| 341 | 345 | function (data) { |
| ... | ... | @@ -352,14 +356,6 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
| 352 | 356 | }, data.data.id); |
| 353 | 357 | $scope.remito.numeroRemito = data.data.numero; |
| 354 | 358 | |
| 355 | - // if ($scope.remito.remitoPuntoDescarga.length > 0) { | |
| 356 | - // remitoBusinessService.addPuntosDescarga(data.data.id, | |
| 357 | - // $scope.remito.remitoPuntoDescarga); | |
| 358 | - // } | |
| 359 | - | |
| 360 | - hojaRutaBusinessService.addArticulos($scope.articulosRecibidos, | |
| 361 | - data.data.id, $scope.hojaRuta.cotizacion.VENDEDOR); | |
| 362 | - | |
| 363 | 359 | guardarHojaRuta(data.data.id); |
| 364 | 360 | |
| 365 | 361 | }, function (error) { |