Commit b709c99d68137afc358fe72207c8643d710b2267
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !95
Showing
1 changed file
Show diff stats
src/js/controller.js
| ... | ... | @@ -167,7 +167,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 167 | 167 | notaPedido.proveedor.NOM |
| 168 | 168 | }, |
| 169 | 169 | { |
| 170 | - label: 'Precio condicion:', | |
| 170 | + label: 'Precios y condiciones:', | |
| 171 | 171 | valor: valorPrecioCondicion() + ' ' + |
| 172 | 172 | remitoBusinessService |
| 173 | 173 | .plazoToString(notaPedido.notaPedidoPlazo) |
| ... | ... | @@ -317,11 +317,11 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 317 | 317 | cuitCliente: $scope.remito.cliente.CUIT, |
| 318 | 318 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
| 319 | 319 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
| 320 | - idVendedor: $scope.remito.idVendedor, | |
| 320 | + idVendedor: $scope.remito.vendedor.NUM, | |
| 321 | 321 | idProveedor: $scope.remito.proveedor.COD, |
| 322 | 322 | idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, |
| 323 | 323 | idCotizacion: $scope.remito.cotizacion.ID, |
| 324 | - idListaPrecio: $scope.remito.idListaPrecio, | |
| 324 | + idListaPrecio: $scope.idLista, | |
| 325 | 325 | flete: $scope.remito.flete, |
| 326 | 326 | fob: $scope.remito.fob, |
| 327 | 327 | bomba: $scope.remito.bomba, |
| ... | ... | @@ -357,14 +357,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 357 | 357 | }, |
| 358 | 358 | notaPedido: $scope.notaPedido |
| 359 | 359 | }; |
| 360 | - | |
| 361 | 360 | crearRemitoService.crearRemito(save).then( |
| 362 | 361 | function (data) { |
| 363 | 362 | |
| 364 | 363 | focaBotoneraLateralService.endGuardar(true); |
| 365 | 364 | $scope.saveLoading = false; |
| 366 | 365 | |
| 367 | - $scope.remito.id = data.data.id; | |
| 368 | 366 | $scope.remito.numeroRemito = data.data.numero; |
| 369 | 367 | |
| 370 | 368 | if ($scope.remito.remitoPuntoDescarga.length > 0) { |
| ... | ... | @@ -372,28 +370,29 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 372 | 370 | $scope.remito.remitoPuntoDescarga); |
| 373 | 371 | } |
| 374 | 372 | |
| 375 | - remitoBusinessService.addArticulos($scope.remito.articulosRemito, | |
| 376 | - $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); | |
| 377 | - | |
| 378 | 373 | if (data.status === 500) { |
| 379 | 374 | focaModalService.alert(data.data); |
| 380 | 375 | return; |
| 381 | 376 | } |
| 382 | 377 | |
| 383 | 378 | // TODO: updatear plazos |
| 384 | - if ($scope.remito.id === 0) { | |
| 379 | + if ($scope.remito.id == 0) { | |
| 380 | + | |
| 381 | + remitoBusinessService.addArticulos($scope.remito.articulosRemito, | |
| 382 | + data.data.id, $scope.remito.cotizacion.VENDEDOR); | |
| 383 | + | |
| 385 | 384 | var plazos = $scope.remito.remitoPlazo; |
| 386 | 385 | |
| 387 | 386 | for (var j = 0; j < plazos.length; j++) { |
| 388 | 387 | var json = { |
| 389 | - idRemito: $scope.remito.id, | |
| 388 | + idRemito: data.data.id, | |
| 390 | 389 | dias: plazos[j].dias |
| 391 | 390 | }; |
| 392 | 391 | crearRemitoService.crearPlazosParaRemito(json); |
| 393 | 392 | } |
| 394 | 393 | } |
| 395 | 394 | |
| 396 | - abrirModalMail($scope.remito.id, | |
| 395 | + abrirModalMail(data.data.id, | |
| 397 | 396 | $scope.remito.cliente, |
| 398 | 397 | $filter('comprobante')([ |
| 399 | 398 | $scope.puntoVenta, |
| ... | ... | @@ -633,8 +632,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 633 | 632 | }); |
| 634 | 633 | } |
| 635 | 634 | |
| 636 | - $scope.remitoIsDirty = true; | |
| 637 | - | |
| 638 | 635 | $filter('filter')($scope.botonera, |
| 639 | 636 | { label: 'Cliente' })[0].checked = true; |
| 640 | 637 | }) |
| ... | ... | @@ -698,7 +695,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
| 698 | 695 | if (!Array.isArray(precioCondicion)) { |
| 699 | 696 | $scope.remito.idPrecioCondicion = precioCondicion.listaPrecio.ID; |
| 700 | 697 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
| 701 | - $scope.idLista = precioCondicion.listaPrecio.ID; | |
| 698 | + $scope.idLista = parseInt(precioCondicion.listaPrecio.ID) ? | |
| 699 | + parseInt(precioCondicion.listaPrecio.ID) : -1; | |
| 702 | 700 | for (var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 703 | 701 | plazosConcat += precioCondicion.plazoPago[i].dias + ', '; |
| 704 | 702 | } |