Commit b9b1895caaafa9994687c8c8419a26896449b219
1 parent
56c85044dc
Exists in
master
and in
1 other branch
guardar idremito en numero pedido
Showing
2 changed files
with
58 additions
and
47 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -36,6 +36,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 36 | 36 | moneda: {}, |
| 37 | 37 | cotizacion: {} |
| 38 | 38 | }; |
| 39 | + | |
| 40 | + $scope.notaPedido = { | |
| 41 | + id: 0 | |
| 42 | + }; | |
| 39 | 43 | var monedaPorDefecto; |
| 40 | 44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 41 | 45 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
| ... | ... | @@ -94,6 +98,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 94 | 98 | modalInstance.result.then( |
| 95 | 99 | function(notaPedido) { |
| 96 | 100 | //añado cabeceras |
| 101 | + $scope.notaPedido.id = notaPedido.id; | |
| 97 | 102 | removeCabecera('Moneda:'); |
| 98 | 103 | removeCabecera('Fecha cotizacion:'); |
| 99 | 104 | removeCabecera('Cotizacion:'); |
| ... | ... | @@ -337,7 +342,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 337 | 342 | } else if(!$scope.remito.proveedor) { |
| 338 | 343 | focaModalService.alert('Ingrese Proveedor'); |
| 339 | 344 | return; |
| 340 | - } else if(!$scope.remito.moneda.ID) { | |
| 345 | + } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { | |
| 341 | 346 | focaModalService.alert('Ingrese Moneda'); |
| 342 | 347 | return; |
| 343 | 348 | } else if(!$scope.remito.cotizacion.ID) { |
| ... | ... | @@ -353,51 +358,53 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 353 | 358 | return; |
| 354 | 359 | } |
| 355 | 360 | var date = new Date(); |
| 356 | - var remito = { | |
| 357 | - id: $scope.remito.id, | |
| 358 | - fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
| 359 | - .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | |
| 360 | - idCliente: $scope.remito.cliente.COD, | |
| 361 | - nombreCliente: $scope.remito.cliente.NOM, | |
| 362 | - cuitCliente: $scope.remito.cliente.CUIT, | |
| 363 | - responsabilidadIvaCliente: 0,//TODO, | |
| 364 | - descuento: 0,//TODO, | |
| 365 | - importeNeto: 0,//TODO | |
| 366 | - importeExento: 0,//TODO | |
| 367 | - importeIva: 0,//TODO | |
| 368 | - importeIvaServicios: 0,//TODO | |
| 369 | - importeImpuestoInterno: 0,//TODO | |
| 370 | - importeImpuestoInterno1: 0,//TODO | |
| 371 | - importeImpuestoInterno2: 0,//TODO | |
| 372 | - percepcion: 0,//TODO | |
| 373 | - percepcionIva: 0,//TODO | |
| 374 | - redondeo: 0,//TODO | |
| 375 | - total: $scope.getTotal(), | |
| 376 | - numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
| 377 | - anulado: false, | |
| 378 | - planilla: 0,//TODO | |
| 379 | - lugar: 0,//TODO | |
| 380 | - cuentaMadre: 0,// | |
| 381 | - cuentaContable: 0,//TODO | |
| 382 | - asiento: 0,//TODO | |
| 383 | - e_hd: '',//TODO | |
| 384 | - c_hd: '', | |
| 385 | - numeroLiquidoProducto: 0,//TODO | |
| 386 | - idVendedor: $scope.remito.idVendedor, | |
| 387 | - idProveedor: $scope.remito.idProveedor, | |
| 388 | - idDomicilio: 0,//TODO | |
| 389 | - domicilioStamp: $scope.remito.domicilioStamp, | |
| 390 | - idCotizacion: $scope.remito.cotizacion.ID, | |
| 391 | - idPrecioCondicion: $scope.remito.idPrecioCondicion, | |
| 392 | - flete: $scope.remito.flete, | |
| 393 | - fob: $scope.remito.fob, | |
| 394 | - bomba: $scope.remito.bomba, | |
| 395 | - kilometros: $scope.remito.kilometros, | |
| 396 | - estado: 0,//TODO | |
| 397 | - destinoVenta: 0,//TODO | |
| 398 | - operacionTipo: 0//TODO | |
| 361 | + var save = { | |
| 362 | + remito: { | |
| 363 | + id: 0, | |
| 364 | + fechaRemito: | |
| 365 | + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
| 366 | + .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | |
| 367 | + idCliente: $scope.remito.idCliente, | |
| 368 | + nombreCliente: $scope.remito.nombreCliente, | |
| 369 | + cuitCliente: $scope.remito.cuitCliente, | |
| 370 | + responsabilidadIvaCliente: 0,//TODO, | |
| 371 | + descuento: 0,//TODO, | |
| 372 | + importeNeto: 0,//TODO | |
| 373 | + importeExento: 0,//TODO | |
| 374 | + importeIva: 0,//TODO | |
| 375 | + importeIvaServicios: 0,//TODO | |
| 376 | + importeImpuestoInterno: 0,//TODO | |
| 377 | + importeImpuestoInterno1: 0,//TODO | |
| 378 | + importeImpuestoInterno2: 0,//TODO | |
| 379 | + percepcion: 0,//TODO | |
| 380 | + percepcionIva: 0,//TODO | |
| 381 | + redondeo: 0,//TODO | |
| 382 | + total: $scope.getTotal(), | |
| 383 | + numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
| 384 | + anulado: false, | |
| 385 | + planilla: 0,//TODO | |
| 386 | + lugar: 0,//TODO | |
| 387 | + cuentaMadre: 0,// | |
| 388 | + cuentaContable: 0,//TODO | |
| 389 | + asiento: 0,//TODO | |
| 390 | + e_hd: '',//TODO | |
| 391 | + c_hd: '', | |
| 392 | + numeroLiquidoProducto: 0,//TODO | |
| 393 | + idVendedor: $scope.remito.idVendedor, | |
| 394 | + idProveedor: $scope.remito.idProveedor, | |
| 395 | + idDomicilio: 0,//TODO | |
| 396 | + idCotizacion: $scope.remito.idCotizacion, | |
| 397 | + flete: $scope.remito.flete, | |
| 398 | + fob: $scope.remito.fob, | |
| 399 | + bomba: $scope.remito.bomba, | |
| 400 | + kilometros: $scope.remito.kilometros, | |
| 401 | + estado: 0,//TODO | |
| 402 | + destinoVenta: 0,//TODO | |
| 403 | + operacionTipo: 0//TODO | |
| 404 | + }, | |
| 405 | + notaPedido: $scope.notaPedido | |
| 399 | 406 | }; |
| 400 | - crearRemitoService.crearRemito(remito).then( | |
| 407 | + crearRemitoService.crearRemito(save).then( | |
| 401 | 408 | function(data) { |
| 402 | 409 | remitoBusinessService.addArticulos($scope.articulosTabla, |
| 403 | 410 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
| ... | ... | @@ -430,6 +437,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 430 | 437 | console.info(err); |
| 431 | 438 | } |
| 432 | 439 | ); |
| 440 | + | |
| 441 | + $scope.notaPedido = { | |
| 442 | + id: 0 | |
| 443 | + }; | |
| 433 | 444 | } |
| 434 | 445 | ); |
| 435 | 446 | }; |
| ... | ... | @@ -547,8 +558,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 547 | 558 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 548 | 559 | templateUrl: 'modal-domicilio.html', |
| 549 | 560 | controller: 'focaModalDomicilioController', |
| 550 | - resolve: { idCliente: function() { return cliente.cod; }}, | |
| 551 | 561 | size: 'lg', |
| 562 | + resolve: { idCliente: function() { return cliente.cod; }} | |
| 552 | 563 | } |
| 553 | 564 | ); |
| 554 | 565 | modalInstanceDomicilio.result.then( |
src/js/service.js
| ... | ... | @@ -4,7 +4,7 @@ angular.module('focaCrearRemito') |
| 4 | 4 | return { |
| 5 | 5 | crearRemito: function(remito) { |
| 6 | 6 | // TODO: Cambiar para usar el servicio /remito |
| 7 | - return $http.post(route + '/remito', {remito: remito}); | |
| 7 | + return $http.post(route + '/remito', remito); | |
| 8 | 8 | }, |
| 9 | 9 | obtenerRemito: function() { |
| 10 | 10 | return $http.get(route +'/nota-pedido'); |