Commit 14d7ad88947803858dfee0d4997fea08a3bf169a
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !65
Showing
7 changed files
Show diff stats
gulpfile.js
| ... | ... | @@ -21,9 +21,11 @@ var paths = { |
| 21 | 21 | dist: 'dist/' |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | -gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')); | |
| 24 | +gulp.task('uglify', function(callback) { | |
| 25 | + gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')(callback); | |
| 26 | +}); | |
| 25 | 27 | |
| 26 | -gulp.task('templates', ['clean'], function() { | |
| 28 | +gulp.task('templates', function() { | |
| 27 | 29 | return pump( |
| 28 | 30 | [ |
| 29 | 31 | gulp.src(paths.srcViews), |
| ... | ... | @@ -68,8 +70,7 @@ gulp.task('uglify-spec', function() { |
| 68 | 70 | }); |
| 69 | 71 | |
| 70 | 72 | gulp.task('clean', function() { |
| 71 | - return gulp.src(['tmp', 'dist'], {read: false}) | |
| 72 | - .pipe(clean()); | |
| 73 | + return gulp.src(['tmp', 'dist'], {read: false}).pipe(clean()); | |
| 73 | 74 | }); |
| 74 | 75 | |
| 75 | 76 | gulp.task('pre-commit', function() { |
| ... | ... | @@ -84,7 +85,7 @@ gulp.task('pre-commit', function() { |
| 84 | 85 | |
| 85 | 86 | gulp.start('uglify'); |
| 86 | 87 | }); |
| 87 | - | |
| 88 | + | |
| 88 | 89 | gulp.task('webserver', function() { |
| 89 | 90 | pump [ |
| 90 | 91 | connect.server({port: 3300, host: '0.0.0.0'}) |
src/js/businessService.js
| ... | ... | @@ -7,7 +7,8 @@ angular.module('focaCrearRemito') |
| 7 | 7 | for(var i = 0; i < articulosRemito.length; i++) { |
| 8 | 8 | delete articulosRemito[i].editCantidad; |
| 9 | 9 | delete articulosRemito[i].editPrecio; |
| 10 | - articulosRemito[i].idRemito = idRemito; | |
| 10 | + articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ? | |
| 11 | + idRemito : articulosRemito[i].idRemito; | |
| 11 | 12 | articulosRemito[i].precio = articulosRemito[i].precio * cotizacion; |
| 12 | 13 | delete articulosRemito[i].idNotaPedido; |
| 13 | 14 | crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); |
src/js/controller.js
| ... | ... | @@ -10,6 +10,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 10 | 10 | config(); |
| 11 | 11 | |
| 12 | 12 | function config() { |
| 13 | + $scope.tmpCantidad = Number; | |
| 14 | + $scope.tmpPrecio = Number; | |
| 13 | 15 | $scope.botonera = crearRemitoService.getBotonera(); |
| 14 | 16 | $scope.isNumber = angular.isNumber; |
| 15 | 17 | $scope.datepickerAbierto = false; |
| ... | ... | @@ -33,6 +35,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 33 | 35 | ); |
| 34 | 36 | $scope.inicial.cotizacion = $scope.remito.cotizacion; |
| 35 | 37 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); |
| 38 | + | |
| 39 | + $timeout(function() { getLSRemito(); }); | |
| 36 | 40 | }); |
| 37 | 41 | |
| 38 | 42 | //SETEO BOTONERA LATERAL |
| ... | ... | @@ -44,7 +48,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 44 | 48 | }); |
| 45 | 49 | |
| 46 | 50 | init(); |
| 47 | - $timeout(function() {getLSRemito();}); | |
| 48 | 51 | } |
| 49 | 52 | |
| 50 | 53 | function init() { |
| ... | ... | @@ -91,7 +94,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 91 | 94 | }, true); |
| 92 | 95 | |
| 93 | 96 | $scope.seleccionarNotaPedido = function() { |
| 94 | - if(varlidarRemitoFacturado()) { | |
| 97 | + if (varlidarRemitoFacturado()) { | |
| 95 | 98 | var modalInstance = $uibModal.open( |
| 96 | 99 | { |
| 97 | 100 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| ... | ... | @@ -159,13 +162,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 159 | 162 | } |
| 160 | 163 | ]; |
| 161 | 164 | |
| 162 | - if (notaPedido.observaciones) { | |
| 163 | - cabeceras.push({ | |
| 164 | - label: 'Observaciones:', | |
| 165 | - valor: notaPedido.observaciones | |
| 166 | - }); | |
| 167 | - } | |
| 168 | - | |
| 169 | 165 | function valorPrecioCondicion() { |
| 170 | 166 | if (notaPedido.idPrecioCondicion > 0) { |
| 171 | 167 | return notaPedido.precioCondicion.nombre; |
| ... | ... | @@ -196,15 +192,14 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 196 | 192 | |
| 197 | 193 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
| 198 | 194 | notaPedido.articulosNotaPedido[i].id = 0; |
| 195 | + notaPedido.articulosNotaPedido[i].idRemito = 0; | |
| 199 | 196 | } |
| 200 | 197 | |
| 201 | 198 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; |
| 202 | - remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | |
| 203 | - notaPedido.cotizacion.VENDEDOR); | |
| 204 | 199 | |
| 205 | - if(notaPedido.idPrecioCondicion > 0) { | |
| 200 | + if (notaPedido.idPrecioCondicion > 0) { | |
| 206 | 201 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 207 | - }else { | |
| 202 | + } else { | |
| 208 | 203 | $scope.idLista = -1; |
| 209 | 204 | } |
| 210 | 205 | |
| ... | ... | @@ -247,19 +242,16 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 247 | 242 | focaModalService.alert('Ingrese Proveedor'); |
| 248 | 243 | return; |
| 249 | 244 | } else if (!$scope.remito.cotizacion.moneda.id && |
| 250 | - !$scope.remito.cotizacion.moneda.ID) | |
| 251 | - { | |
| 245 | + !$scope.remito.cotizacion.moneda.ID){ | |
| 252 | 246 | focaModalService.alert('Ingrese Moneda'); |
| 253 | 247 | return; |
| 254 | 248 | } else if (!$scope.remito.cotizacion.ID) { |
| 255 | 249 | focaModalService.alert('Ingrese Cotizaciรณn'); |
| 256 | 250 | return; |
| 257 | - } else if ( | |
| 258 | - $scope.remito.flete === undefined || $scope.remito.flete === null) | |
| 259 | - { | |
| 251 | + } else if ($scope.remito.flete === undefined || $scope.remito.flete === null){ | |
| 260 | 252 | focaModalService.alert('Ingrese Flete'); |
| 261 | 253 | return; |
| 262 | - } else if ($scope.remito.articulosRemito.length === 0) { | |
| 254 | + } else if ($scope.articulosFiltro().length === 0) { | |
| 263 | 255 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 264 | 256 | return; |
| 265 | 257 | } |
| ... | ... | @@ -307,21 +299,33 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 307 | 299 | domicilioStamp: $scope.remito.domicilioStamp, |
| 308 | 300 | estado: 0,//TODO |
| 309 | 301 | destinoVenta: 0,//TODO |
| 310 | - operacionTipo: 0//TODO | |
| 302 | + operacionTipo: 0, //TODO | |
| 303 | + observaciones: $scope.remito.observaciones, | |
| 304 | + numeroRemito: parseInt($scope.comprobante), | |
| 305 | + sucursal: parseInt($scope.puntoVenta) | |
| 311 | 306 | }, |
| 312 | 307 | notaPedido: $scope.notaPedido |
| 313 | 308 | }; |
| 314 | 309 | |
| 315 | 310 | crearRemitoService.crearRemito(save).then( |
| 316 | 311 | function(data) { |
| 317 | - remitoBusinessService.addArticulos($scope.remito.articulosRemito, | |
| 318 | - data.data.id, $scope.remito.cotizacion.COTIZACION); | |
| 319 | 312 | |
| 320 | 313 | focaBotoneraLateralService.endGuardar(true); |
| 321 | 314 | $scope.saveLoading = false; |
| 322 | 315 | |
| 323 | - //TODO: updatear plazos | |
| 324 | - if($scope.remito.id === 0) { | |
| 316 | + $scope.remito.id = data.data.id; | |
| 317 | + $scope.remito.numeroRemito = data.data.numero; | |
| 318 | + | |
| 319 | + remitoBusinessService.addArticulos($scope.remito.articulosRemito, | |
| 320 | + $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); | |
| 321 | + | |
| 322 | + if(data.status === 500) { | |
| 323 | + focaModalService.alert(data.data); | |
| 324 | + return; | |
| 325 | + } | |
| 326 | + | |
| 327 | + // TODO: updatear plazos | |
| 328 | + if ($scope.remito.id === 0) { | |
| 325 | 329 | var plazos = $scope.remito.remitoPlazo; |
| 326 | 330 | |
| 327 | 331 | for(var j = 0; j < plazos.length; j++) { |
| ... | ... | @@ -333,20 +337,18 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 333 | 337 | } |
| 334 | 338 | } |
| 335 | 339 | |
| 336 | - $uibModal.open({ | |
| 337 | - templateUrl: 'remito-comprobante.html', | |
| 338 | - controller: 'focaRemitoComprobanteController', | |
| 339 | - resolve: { | |
| 340 | - parametros: { | |
| 341 | - idRemito: data.data.id | |
| 342 | - } | |
| 343 | - } | |
| 344 | - }); | |
| 340 | + abrirModalMail($scope.remito.id, | |
| 341 | + $scope.remito.cliente, | |
| 342 | + $filter('comprobante')([ | |
| 343 | + $scope.puntoVenta, | |
| 344 | + $scope.remito.numeroRemito | |
| 345 | + ]) | |
| 346 | + ); | |
| 345 | 347 | |
| 346 | 348 | init(); |
| 347 | 349 | |
| 348 | 350 | }, function(error) { |
| 349 | - focaModalService.alert('Hubo un error al crear el remito'); | |
| 351 | + focaModalService.alert(error.data || 'Hubo un error al crear el remito'); | |
| 350 | 352 | focaBotoneraLateralService.endGuardar(); |
| 351 | 353 | $scope.saveLoading = false; |
| 352 | 354 | console.info(error); |
| ... | ... | @@ -355,7 +357,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 355 | 357 | }; |
| 356 | 358 | |
| 357 | 359 | $scope.seleccionarProductos = function() { |
| 358 | - if($scope.idLista === undefined) { | |
| 360 | + if ($scope.idLista === undefined) { | |
| 359 | 361 | focaModalService.alert( |
| 360 | 362 | 'Primero seleccione una lista de precio y condicion'); |
| 361 | 363 | return; |
| ... | ... | @@ -368,8 +370,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 368 | 370 | resolve: { |
| 369 | 371 | parametroProducto: { |
| 370 | 372 | idLista: $scope.idLista, |
| 371 | - cotizacion: $scope.remito.cotizacion.COTIZACION, | |
| 372 | - simbolo: $scope.remito.cotizacion.moneda.simbolo | |
| 373 | + cotizacion: $scope.remito.cotizacion.VENDEDOR, | |
| 374 | + simbolo: $scope.remito.cotizacion.moneda.SIMBOLO | |
| 373 | 375 | } |
| 374 | 376 | }, |
| 375 | 377 | size: 'lg' |
| ... | ... | @@ -380,6 +382,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 380 | 382 | var newArt = |
| 381 | 383 | { |
| 382 | 384 | id: 0, |
| 385 | + idRemito: 0, | |
| 383 | 386 | codigo: producto.codigo, |
| 384 | 387 | sector: producto.sector, |
| 385 | 388 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| ... | ... | @@ -409,10 +412,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 409 | 412 | }; |
| 410 | 413 | |
| 411 | 414 | $scope.seleccionarPuntosDeDescarga = function() { |
| 412 | - if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | |
| 415 | + if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | |
| 413 | 416 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
| 414 | 417 | return; |
| 415 | - }else { | |
| 418 | + } else { | |
| 416 | 419 | var modalInstance = $uibModal.open( |
| 417 | 420 | { |
| 418 | 421 | ariaLabelledBy: 'Bรบsqueda de Puntos de descarga', |
| ... | ... | @@ -424,25 +427,19 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 424 | 427 | idDomicilio: $scope.remito.domicilio.id, |
| 425 | 428 | idCliente: $scope.remito.cliente.COD, |
| 426 | 429 | articulos: $scope.remito.articulosRemito, |
| 427 | - puntosDescarga: $scope.remito.domicilio.puntosDescarga | |
| 430 | + puntosDescarga: $scope.remito.domicilio.puntosDescarga, | |
| 431 | + domicilio: $scope.remito.domicilio | |
| 428 | 432 | } |
| 429 | 433 | } |
| 430 | 434 | } |
| 431 | 435 | ); |
| 432 | 436 | modalInstance.result.then( |
| 433 | 437 | function(puntosDescarga) { |
| 434 | - $scope.remito.puntosDescarga = puntosDescarga; | |
| 435 | - | |
| 436 | - //AGREGO PUNTOS DE DESCARGA A CABECERA | |
| 437 | - var puntosStamp = ''; | |
| 438 | - puntosDescarga.forEach(function(punto, idx, arr) { | |
| 439 | - puntosStamp += punto.descripcion; | |
| 440 | - if((idx + 1) !== arr.length) puntosStamp += ', '; | |
| 441 | - }); | |
| 438 | + $scope.remito.domicilio.puntosDescarga = puntosDescarga; | |
| 442 | 439 | |
| 443 | 440 | $scope.$broadcast('addCabecera', { |
| 444 | 441 | label: 'Puntos de descarga:', |
| 445 | - valor: puntosStamp | |
| 442 | + valor: getCabeceraPuntoDescarga($scope.remito.domicilio.puntosDescarga) | |
| 446 | 443 | }); |
| 447 | 444 | }, function() { |
| 448 | 445 | $scope.abrirModalDomicilios($scope.cliente); |
| ... | ... | @@ -457,7 +454,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 457 | 454 | return; |
| 458 | 455 | } |
| 459 | 456 | |
| 460 | - if(varlidarRemitoFacturado()) { | |
| 457 | + if (varlidarRemitoFacturado()) { | |
| 461 | 458 | var parametrosModal = { |
| 462 | 459 | titulo: 'Bรบsqueda vendedores', |
| 463 | 460 | query: '/vendedor', |
| ... | ... | @@ -523,8 +520,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 523 | 520 | }, ocultarVendedor); |
| 524 | 521 | }; |
| 525 | 522 | |
| 526 | - $scope.seleccionarProveedor = function(callback) { | |
| 527 | - if(varlidarRemitoFacturado()) { | |
| 523 | + $scope.seleccionarProveedor = function() { | |
| 524 | + if (varlidarRemitoFacturado()) { | |
| 528 | 525 | var parametrosModal = { |
| 529 | 526 | titulo: 'Bรบsqueda de Proveedor', |
| 530 | 527 | query: '/proveedor', |
| ... | ... | @@ -551,15 +548,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 551 | 548 | }; |
| 552 | 549 | focaModalService.modal(parametrosModal).then( |
| 553 | 550 | function(proveedor) { |
| 554 | - $scope.remito.proveedor = proveedor; | |
| 555 | - $scope.remito.idProveedor = proveedor.COD; | |
| 556 | - | |
| 557 | - $scope.$broadcast('addCabecera',{ | |
| 558 | - label: 'Proveedor:', | |
| 559 | - valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | |
| 560 | - proveedor.NOM | |
| 561 | - }); | |
| 562 | - callback(); | |
| 551 | + $scope.seleccionarFlete(proveedor); | |
| 563 | 552 | }, function() { } |
| 564 | 553 | ); |
| 565 | 554 | } |
| ... | ... | @@ -589,12 +578,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 589 | 578 | MOD: cliente.mod |
| 590 | 579 | }; |
| 591 | 580 | |
| 592 | - | |
| 593 | 581 | var domicilioStamp = |
| 594 | 582 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
| 595 | 583 | domicilio.Localidad + ', ' + domicilio.Provincia; |
| 596 | 584 | $scope.remito.domicilioStamp = domicilioStamp; |
| 597 | - | |
| 598 | 585 | $scope.$broadcast('addCabecera',{ |
| 599 | 586 | label: 'Cliente:', |
| 600 | 587 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
| ... | ... | @@ -604,14 +591,14 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 604 | 591 | valor: domicilioStamp |
| 605 | 592 | }); |
| 606 | 593 | |
| 607 | - if(domicilio.verPuntos) { | |
| 594 | + if (domicilio.verPuntos) { | |
| 608 | 595 | delete $scope.remito.domicilio.verPuntos; |
| 609 | 596 | $scope.seleccionarPuntosDeDescarga(); |
| 610 | - }else { | |
| 597 | + } else { | |
| 611 | 598 | crearRemitoService |
| 612 | 599 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
| 613 | 600 | .then(function(res) { |
| 614 | - if(res.data.length) $scope.seleccionarPuntosDeDescarga(); | |
| 601 | + if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | |
| 615 | 602 | }); |
| 616 | 603 | } |
| 617 | 604 | }, function() { |
| ... | ... | @@ -623,7 +610,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 623 | 610 | |
| 624 | 611 | $scope.getTotal = function() { |
| 625 | 612 | var total = 0; |
| 626 | - var arrayTempArticulos = $scope.remito.articulosRemito; | |
| 613 | + var arrayTempArticulos = $scope.articulosFiltro(); | |
| 627 | 614 | for(var i = 0; i < arrayTempArticulos.length; i++) { |
| 628 | 615 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 629 | 616 | } |
| ... | ... | @@ -631,7 +618,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 631 | 618 | }; |
| 632 | 619 | |
| 633 | 620 | $scope.getSubTotal = function() { |
| 634 | - if($scope.articuloACargar) { | |
| 621 | + if ($scope.articuloACargar) { | |
| 635 | 622 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 636 | 623 | } |
| 637 | 624 | }; |
| ... | ... | @@ -641,7 +628,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 641 | 628 | focaModalService.alert('Primero seleccione un cliente'); |
| 642 | 629 | return; |
| 643 | 630 | } |
| 644 | - if(varlidarRemitoFacturado()) { | |
| 631 | + if (varlidarRemitoFacturado()) { | |
| 645 | 632 | var modalInstance = $uibModal.open( |
| 646 | 633 | { |
| 647 | 634 | ariaLabelledBy: 'Busqueda de Precio Condiciรณn', |
| ... | ... | @@ -659,7 +646,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 659 | 646 | function(precioCondicion) { |
| 660 | 647 | var cabecera = ''; |
| 661 | 648 | var plazosConcat = ''; |
| 662 | - if(!Array.isArray(precioCondicion)) { | |
| 649 | + if (!Array.isArray(precioCondicion)) { | |
| 663 | 650 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
| 664 | 651 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
| 665 | 652 | $scope.idLista = precioCondicion.idListaPrecio; |
| ... | ... | @@ -668,10 +655,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 668 | 655 | } |
| 669 | 656 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
| 670 | 657 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 671 | - }else { //Cuando se ingresan los plazos manualmente | |
| 658 | + } else { //Cuando se ingresan los plazos manualmente | |
| 672 | 659 | $scope.remito.idPrecioCondicion = 0; |
| 673 | 660 | //-1, el modal productos busca todos los productos |
| 674 | - $scope.idLista = -1; | |
| 661 | + $scope.idLista = -1; | |
| 675 | 662 | $scope.remito.remitoPlazo = precioCondicion; |
| 676 | 663 | for(var j = 0; j < precioCondicion.length; j++) { |
| 677 | 664 | plazosConcat += precioCondicion[j].dias + ' '; |
| ... | ... | @@ -683,7 +670,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 683 | 670 | label: 'Precios y condiciones:', |
| 684 | 671 | valor: cabecera |
| 685 | 672 | }); |
| 686 | - | |
| 687 | 673 | $scope.remito.precioCondicion = precioCondicion; |
| 688 | 674 | }, function() { |
| 689 | 675 | |
| ... | ... | @@ -692,69 +678,75 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 692 | 678 | } |
| 693 | 679 | }; |
| 694 | 680 | |
| 695 | - $scope.seleccionarTransportista = function() { | |
| 696 | - $scope.seleccionarProveedor(function() { | |
| 697 | - if (varlidarRemitoFacturado()) { | |
| 698 | - var modalInstance = $uibModal.open( | |
| 699 | - { | |
| 700 | - ariaLabelledBy: 'Busqueda de Flete', | |
| 701 | - templateUrl: 'modal-flete.html', | |
| 702 | - controller: 'focaModalFleteController', | |
| 703 | - size: 'lg', | |
| 704 | - resolve: { | |
| 705 | - parametrosFlete: | |
| 706 | - function() { | |
| 707 | - return { | |
| 708 | - flete: $scope.remito.flete ? '1' : | |
| 709 | - ($scope.remito.fob ? 'FOB' : | |
| 710 | - ($scope.remito.flete === undefined ? | |
| 711 | - null : '0')), | |
| 712 | - bomba: $scope.remito.bomba ? '1' : | |
| 713 | - ($scope.remito.bomba === undefined ? | |
| 714 | - null : '0'), | |
| 715 | - kilometros: $scope.remito.kilometros | |
| 716 | - }; | |
| 717 | - } | |
| 718 | - } | |
| 681 | + $scope.seleccionarFlete = function(proveedor) { | |
| 682 | + if (varlidarRemitoFacturado()) { | |
| 683 | + var modalInstance = $uibModal.open( | |
| 684 | + { | |
| 685 | + ariaLabelledBy: 'Busqueda de Flete', | |
| 686 | + templateUrl: 'modal-flete.html', | |
| 687 | + controller: 'focaModalFleteController', | |
| 688 | + size: 'lg', | |
| 689 | + resolve: { | |
| 690 | + parametrosFlete: | |
| 691 | + function() { | |
| 692 | + return { | |
| 693 | + flete: $scope.remito.flete ? '1' : | |
| 694 | + ($scope.remito.fob ? 'FOB' : | |
| 695 | + ($scope.remito.flete === undefined ? | |
| 696 | + null : '0')), | |
| 697 | + bomba: $scope.remito.bomba ? '1' : | |
| 698 | + ($scope.remito.bomba === undefined ? | |
| 699 | + null : '0'), | |
| 700 | + kilometros: $scope.remito.kilometros | |
| 701 | + }; | |
| 702 | + } | |
| 719 | 703 | } |
| 720 | - ); | |
| 721 | - modalInstance.result.then( | |
| 722 | - function(datos) { | |
| 723 | - $scope.remito.flete = datos.flete; | |
| 724 | - $scope.remito.fob = datos.FOB; | |
| 725 | - $scope.remito.bomba = datos.bomba; | |
| 726 | - $scope.remito.kilometros = datos.kilometros; | |
| 727 | - | |
| 704 | + } | |
| 705 | + ); | |
| 706 | + modalInstance.result.then( | |
| 707 | + function(datos) { | |
| 708 | + | |
| 709 | + $scope.remito.proveedor = proveedor; | |
| 710 | + $scope.remito.idProveedor = proveedor.COD; | |
| 711 | + $scope.$broadcast('addCabecera',{ | |
| 712 | + label: 'Proveedor:', | |
| 713 | + valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | |
| 714 | + proveedor.NOM | |
| 715 | + }); | |
| 716 | + | |
| 717 | + $scope.remito.flete = datos.flete; | |
| 718 | + $scope.remito.fob = datos.FOB; | |
| 719 | + $scope.remito.bomba = datos.bomba; | |
| 720 | + $scope.remito.kilometros = datos.kilometros; | |
| 721 | + | |
| 722 | + $scope.$broadcast('addCabecera',{ | |
| 723 | + label: 'Flete:', | |
| 724 | + valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | |
| 725 | + }); | |
| 726 | + if (datos.flete) { | |
| 728 | 727 | $scope.$broadcast('addCabecera',{ |
| 729 | - label: 'Flete:', | |
| 730 | - valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | |
| 728 | + label: 'Bomba:', | |
| 729 | + valor: datos.bomba ? 'Si' : 'No' | |
| 731 | 730 | }); |
| 732 | - if (datos.flete) { | |
| 733 | - $scope.$broadcast('addCabecera',{ | |
| 734 | - label: 'Bomba:', | |
| 735 | - valor: datos.bomba ? 'Si' : 'No' | |
| 736 | - }); | |
| 737 | - $scope.$broadcast('addCabecera',{ | |
| 738 | - label: 'Kilometros:', | |
| 739 | - valor: datos.kilometros | |
| 740 | - }); | |
| 741 | - } else { | |
| 742 | - $scope.$broadcast('removeCabecera', 'Bomba:'); | |
| 743 | - $scope.$broadcast('removeCabecera', 'Kilometros:'); | |
| 744 | - $scope.remito.fob = false; | |
| 745 | - $scope.remito.bomba = false; | |
| 746 | - $scope.remito.kilometros = null; | |
| 747 | - } | |
| 748 | - }, function() { | |
| 749 | - $scope.seleccionarTransportista(); | |
| 731 | + $scope.$broadcast('addCabecera',{ | |
| 732 | + label: 'Kilometros:', | |
| 733 | + valor: datos.kilometros | |
| 734 | + }); | |
| 735 | + } else { | |
| 736 | + $scope.$broadcast('removeCabecera', 'Bomba:'); | |
| 737 | + $scope.$broadcast('removeCabecera', 'Kilometros:'); | |
| 738 | + $scope.remito.bomba = false; | |
| 739 | + $scope.remito.kilometros = null; | |
| 750 | 740 | } |
| 751 | - ); | |
| 752 | - } | |
| 753 | - }); | |
| 741 | + }, function() { | |
| 742 | + $scope.seleccionarTransportista(); | |
| 743 | + } | |
| 744 | + ); | |
| 745 | + } | |
| 754 | 746 | }; |
| 755 | 747 | |
| 756 | 748 | $scope.seleccionarMoneda = function() { |
| 757 | - if(varlidarRemitoFacturado()) { | |
| 749 | + if (varlidarRemitoFacturado()) { | |
| 758 | 750 | var parametrosModal = { |
| 759 | 751 | titulo: 'Bรบsqueda de monedas', |
| 760 | 752 | query: '/moneda', |
| ... | ... | @@ -808,18 +800,18 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 808 | 800 | var articulosTablaTemp = $scope.remito.articulosRemito; |
| 809 | 801 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 810 | 802 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 811 | - $scope.remito.cotizacion.COTIZACION; | |
| 803 | + $scope.remito.cotizacion.VENDEDOR; | |
| 812 | 804 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 813 | - cotizacion.COTIZACION; | |
| 805 | + cotizacion.VENDEDOR; | |
| 814 | 806 | } |
| 815 | 807 | $scope.remito.articulosRemito = articulosTablaTemp; |
| 816 | - $scope.remito.cotizacion.moneda = moneda; | |
| 817 | 808 | $scope.remito.cotizacion = cotizacion; |
| 818 | - if(moneda.DETALLE === 'PESOS ARGENTINOS') { | |
| 809 | + $scope.remito.cotizacion.moneda = moneda; | |
| 810 | + if (moneda.DETALLE === 'PESOS ARGENTINOS') { | |
| 819 | 811 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
| 820 | 812 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
| 821 | 813 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 822 | - }else { | |
| 814 | + } else { | |
| 823 | 815 | $scope.$broadcast('addCabecera',{ |
| 824 | 816 | label: 'Moneda:', |
| 825 | 817 | valor: moneda.DETALLE |
| ... | ... | @@ -830,7 +822,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 830 | 822 | }); |
| 831 | 823 | $scope.$broadcast('addCabecera',{ |
| 832 | 824 | label: 'Cotizacion:', |
| 833 | - valor: $filter('number')(cotizacion.COTIZACION, '2') | |
| 825 | + valor: $filter('number')(cotizacion.VENDEDOR, '2') | |
| 834 | 826 | }); |
| 835 | 827 | } |
| 836 | 828 | }, function() { |
| ... | ... | @@ -840,8 +832,8 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 840 | 832 | }; |
| 841 | 833 | |
| 842 | 834 | $scope.agregarATabla = function(key) { |
| 843 | - if(key === 13) { | |
| 844 | - if($scope.articuloACargar.cantidad === undefined || | |
| 835 | + if (key === 13) { | |
| 836 | + if ($scope.articuloACargar.cantidad === undefined || | |
| 845 | 837 | $scope.articuloACargar.cantidad === 0 || |
| 846 | 838 | $scope.articuloACargar.cantidad === null ) { |
| 847 | 839 | focaModalService.alert('El valor debe ser al menos 1'); |
| ... | ... | @@ -853,11 +845,19 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 853 | 845 | } |
| 854 | 846 | }; |
| 855 | 847 | |
| 856 | - $scope.quitarArticulo = function(key) { | |
| 857 | - $scope.remito.articulosRemito.splice(key, 1); | |
| 848 | + $scope.quitarArticulo = function(articulo) { | |
| 849 | + articulo.idRemito = -1; | |
| 858 | 850 | }; |
| 859 | 851 | |
| 860 | - $scope.editarArticulo = function(key, articulo) { | |
| 852 | + $scope.articulosFiltro = function() { | |
| 853 | + | |
| 854 | + var result = $scope.remito.articulosRemito.filter(function(articulo) { | |
| 855 | + return articulo.idRemito >= 0; | |
| 856 | + }); | |
| 857 | + return result; | |
| 858 | + }; | |
| 859 | + | |
| 860 | + $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) { | |
| 861 | 861 | if (key === 13) { |
| 862 | 862 | if (!articulo.cantidad || !articulo.precio) { |
| 863 | 863 | focaModalService.alert('Los valores deben ser al menos 1'); |
| ... | ... | @@ -866,14 +866,23 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 866 | 866 | focaModalService.alert('Los valores no pueden ser negativos'); |
| 867 | 867 | return; |
| 868 | 868 | } |
| 869 | + articulo.cantidad = tmpCantidad; | |
| 870 | + articulo.precio = tmpPrecio; | |
| 871 | + $scope.getTotal(); | |
| 869 | 872 | articulo.editCantidad = articulo.editPrecio = false; |
| 870 | 873 | } |
| 871 | 874 | }; |
| 872 | 875 | |
| 876 | + $scope.cancelarEditar = function(articulo) { | |
| 877 | + $scope.tmpCantidad = articulo.cantidad; | |
| 878 | + $scope.tmpPrecio = articulo.precio; | |
| 879 | + articulo.editCantidad = articulo.editPrecio = false; | |
| 880 | + }; | |
| 881 | + | |
| 873 | 882 | $scope.cambioEdit = function(articulo, propiedad) { |
| 874 | - if(propiedad === 'cantidad') { | |
| 883 | + if (propiedad === 'cantidad') { | |
| 875 | 884 | articulo.editCantidad = true; |
| 876 | - }else if(propiedad === 'precio') { | |
| 885 | + } else if (propiedad === 'precio') { | |
| 877 | 886 | articulo.editPrecio = true; |
| 878 | 887 | } |
| 879 | 888 | }; |
| ... | ... | @@ -884,7 +893,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 884 | 893 | }; |
| 885 | 894 | //Recibe aviso si el teclado estรก en uso |
| 886 | 895 | $rootScope.$on('usarTeclado', function(event, data) { |
| 887 | - if(data) { | |
| 896 | + if (data) { | |
| 888 | 897 | $scope.mostrarTeclado = true; |
| 889 | 898 | return; |
| 890 | 899 | } |
| ... | ... | @@ -893,14 +902,14 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 893 | 902 | |
| 894 | 903 | $scope.selectFocus = function($event) { |
| 895 | 904 | // Si el teclado esta en uso no selecciona el valor |
| 896 | - if($scope.mostrarTeclado) { | |
| 905 | + if ($scope.mostrarTeclado) { | |
| 897 | 906 | return; |
| 898 | 907 | } |
| 899 | 908 | $event.target.select(); |
| 900 | 909 | }; |
| 901 | 910 | |
| 902 | 911 | function addArrayCabecera(array) { |
| 903 | - for(var i = 0; i < array.length; i++) { | |
| 912 | + for (var i = 0; i < array.length; i++) { | |
| 904 | 913 | $scope.$broadcast('addCabecera',{ |
| 905 | 914 | label: array[i].label, |
| 906 | 915 | valor: array[i].valor |
| ... | ... | @@ -913,14 +922,13 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 913 | 922 | while (relleno.length < longitud) { |
| 914 | 923 | relleno = '0' + relleno; |
| 915 | 924 | } |
| 916 | - | |
| 917 | 925 | return relleno; |
| 918 | 926 | } |
| 919 | 927 | |
| 920 | 928 | function varlidarRemitoFacturado() { |
| 921 | - if($scope.remito.estado !== 5) { | |
| 929 | + if ($scope.remito.estado !== 5) { | |
| 922 | 930 | return true; |
| 923 | - }else { | |
| 931 | + } else { | |
| 924 | 932 | focaModalService.alert('No se puede editar un remito facturado'); |
| 925 | 933 | return false(); |
| 926 | 934 | } |
| ... | ... | @@ -950,7 +958,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 950 | 958 | var boton = $scope.botonera.filter(function(botonObs) { |
| 951 | 959 | return botonObs.label === 'Observaciones'; |
| 952 | 960 | }); |
| 953 | - | |
| 954 | 961 | boton[0].disable = !val; |
| 955 | 962 | } |
| 956 | 963 | |
| ... | ... | @@ -962,7 +969,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 962 | 969 | |
| 963 | 970 | var cabeceras = []; |
| 964 | 971 | |
| 965 | - if (remito.cotizacion.ID) { | |
| 972 | + if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | |
| 966 | 973 | cabeceras.push({ |
| 967 | 974 | label: 'Moneda:', |
| 968 | 975 | valor: remito.cotizacion.moneda.DETALLE |
| ... | ... | @@ -1003,11 +1010,11 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1003 | 1010 | ' - ' + remito.proveedor.NOM |
| 1004 | 1011 | }); |
| 1005 | 1012 | } |
| 1006 | - if (remito.flete !== undefined) { | |
| 1013 | + if (remito.flete !== undefined && remito.fob !== undefined) { | |
| 1007 | 1014 | cabeceras.push({ |
| 1008 | 1015 | label: 'Flete:', |
| 1009 | - valor: remito.fob === 1 ? 'FOB' : ( | |
| 1010 | - remito.flete === 1 ? 'Si' : 'No') | |
| 1016 | + valor: remito.fob ? 'FOB' : ( | |
| 1017 | + remito.flete ? 'Si' : 'No') | |
| 1011 | 1018 | }); |
| 1012 | 1019 | } |
| 1013 | 1020 | if (remito.remitoPlazo) { |
| ... | ... | @@ -1017,7 +1024,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1017 | 1024 | remitoBusinessService.plazoToString(remito.remitoPlazo) |
| 1018 | 1025 | }); |
| 1019 | 1026 | } |
| 1020 | - | |
| 1021 | 1027 | function valorPrecioCondicion() { |
| 1022 | 1028 | if (remito.idPrecioCondicion > 0) { |
| 1023 | 1029 | return remito.precioCondicion.nombre; |
| ... | ... | @@ -1025,7 +1031,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1025 | 1031 | return 'Ingreso Manual'; |
| 1026 | 1032 | } |
| 1027 | 1033 | } |
| 1028 | - | |
| 1029 | 1034 | if (remito.flete === 1) { |
| 1030 | 1035 | var cabeceraBomba = { |
| 1031 | 1036 | label: 'Bomba', |
| ... | ... | @@ -1040,9 +1045,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1040 | 1045 | } |
| 1041 | 1046 | cabeceras.push(cabeceraBomba); |
| 1042 | 1047 | } |
| 1043 | - $scope.remito.articulosRemito = remito.articulosRemito; | |
| 1044 | - remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | |
| 1045 | - remito.cotizacion.VENDEDOR); | |
| 1048 | + | |
| 1046 | 1049 | if (remito.idPrecioCondicion > 0) { |
| 1047 | 1050 | $scope.idLista = remito.precioCondicion.idListaPrecio; |
| 1048 | 1051 | } else { |
| ... | ... | @@ -1051,6 +1054,13 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1051 | 1054 | $scope.puntoVenta = rellenar(remito.sucursal, 4); |
| 1052 | 1055 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
| 1053 | 1056 | $scope.remito = remito; |
| 1057 | + if ($scope.remito.puntosDescarga) { | |
| 1058 | + var puntosDescarga = $scope.remito.puntosDescarga; | |
| 1059 | + cabeceras.push({ | |
| 1060 | + label: 'Puntos de descarga: ', | |
| 1061 | + valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga)) | |
| 1062 | + }); | |
| 1063 | + } | |
| 1054 | 1064 | addArrayCabecera(cabeceras); |
| 1055 | 1065 | } |
| 1056 | 1066 | |
| ... | ... | @@ -1071,5 +1081,40 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 1071 | 1081 | $scope.$broadcast('removeCabecera', 'Domicilio:'); |
| 1072 | 1082 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); |
| 1073 | 1083 | } |
| 1084 | + | |
| 1085 | + function getCabeceraPuntoDescarga(puntosDescarga) { | |
| 1086 | + var puntosStamp = ''; | |
| 1087 | + puntosDescarga.forEach(function(punto, idx, arr) { | |
| 1088 | + puntosStamp += punto.descripcion; | |
| 1089 | + if ((idx + 1) !== arr.length) puntosStamp += ', '; | |
| 1090 | + }); | |
| 1091 | + return puntosStamp; | |
| 1092 | + } | |
| 1093 | + | |
| 1094 | + function abrirModalMail(id, cliente, numeroRemito) { | |
| 1095 | + focaModalService.mail( | |
| 1096 | + { | |
| 1097 | + titulo: 'Comprobante de remito Nยบ ' + numeroRemito, | |
| 1098 | + descarga: { | |
| 1099 | + nombre: numeroRemito + '.pdf', | |
| 1100 | + url: '/remito/comprobante', | |
| 1101 | + }, | |
| 1102 | + envio: { | |
| 1103 | + mailCliente: cliente.MAIL, | |
| 1104 | + url: '/remito/mail', | |
| 1105 | + }, | |
| 1106 | + options: { | |
| 1107 | + idRemito: id | |
| 1108 | + } | |
| 1109 | + } | |
| 1110 | + ) | |
| 1111 | + .then(function(res) { | |
| 1112 | + if (res === false) { | |
| 1113 | + abrirModalMail(id); | |
| 1114 | + focaModalService.alert('Descarga o envรญe su remito ' + | |
| 1115 | + 'antes de cerrar esta ventana'); | |
| 1116 | + } | |
| 1117 | + }); | |
| 1118 | + } | |
| 1074 | 1119 | } |
| 1075 | 1120 | ]); |
src/js/controllerComprobante.js
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | -angular.module('focaCrearRemito') | |
| 2 | - .controller('focaRemitoComprobanteController', [ | |
| 3 | - '$scope', | |
| 4 | - '$uibModalInstance', | |
| 5 | - 'crearRemitoService', | |
| 6 | - '$filter', | |
| 7 | - 'parametros', | |
| 8 | - 'FileSaver', | |
| 9 | - 'Blob', | |
| 10 | - function( | |
| 11 | - $scope, $uibModalInstance, crearRemitoService, $filter, | |
| 12 | - parametros, FileSaver, Blob | |
| 13 | - ) { | |
| 14 | - crearRemitoService.getRemitoById(parametros.idRemito).then(function(res) { | |
| 15 | - | |
| 16 | - $scope.remito = res.data; | |
| 17 | - }); | |
| 18 | - $scope.correoEnviado = false; | |
| 19 | - $scope.correoNoEnviado = false; | |
| 20 | - $scope.esperando = false; | |
| 21 | - | |
| 22 | - $scope.aceptar = function() { | |
| 23 | - $uibModalInstance.close(); | |
| 24 | - }; | |
| 25 | - | |
| 26 | - $scope.imprimir = function () { | |
| 27 | - $scope.esperando = true; | |
| 28 | - crearRemitoService.imprimirRemitoByIdRemito($scope.remito.id).then( | |
| 29 | - function(res) { | |
| 30 | - var data = new Blob([res.data], {type: 'application/pdf'}); | |
| 31 | - | |
| 32 | - FileSaver.saveAs( | |
| 33 | - data, | |
| 34 | - 'RE-R-' + $filter('comprobante')([ | |
| 35 | - $scope.remito.sucursal, | |
| 36 | - $scope.remito.numeroRemito | |
| 37 | - ]) + '.pdf' | |
| 38 | - ); | |
| 39 | - $scope.esperando = false; | |
| 40 | - } | |
| 41 | - ); | |
| 42 | - }; | |
| 43 | - | |
| 44 | - $scope.enviarCorreo = function(key) { | |
| 45 | - if(key !== 13) return; | |
| 46 | - $scope.esperando = true; | |
| 47 | - var options = { | |
| 48 | - para: $scope.remito.cliente.MAIL, | |
| 49 | - remito: $scope.remito.id | |
| 50 | - }; | |
| 51 | - | |
| 52 | - crearRemitoService.enviarCorreo(options).then(function() { | |
| 53 | - $scope.correoEnviado = true; | |
| 54 | - $scope.esperando = false; | |
| 55 | - }, function() { | |
| 56 | - $scope.esperando = false; | |
| 57 | - $scope.correoNoEnviado = true; | |
| 58 | - }); | |
| 59 | - }; | |
| 60 | - } | |
| 61 | - ]); |
src/js/service.js
| ... | ... | @@ -60,9 +60,8 @@ angular.module('focaCrearRemito') |
| 60 | 60 | getNumeroRemito: function() { |
| 61 | 61 | return $http.get(route + '/remito/numero-siguiente'); |
| 62 | 62 | }, |
| 63 | - imprimirRemitoByIdRemito: function(idRemito, original) { | |
| 64 | - var tipo = original ? '/original' : ''; | |
| 65 | - return $http.get(route + '/remito/comprobante/' + idRemito + tipo, { | |
| 63 | + imprimirRemitoByIdRemito: function(idRemito) { | |
| 64 | + return $http.get(route + '/remito/comprobante/' + idRemito , { | |
| 66 | 65 | responseType: 'arraybuffer' |
| 67 | 66 | }); |
| 68 | 67 | }, |
| ... | ... | @@ -84,7 +83,7 @@ angular.module('focaCrearRemito') |
| 84 | 83 | image: 'cliente.png' |
| 85 | 84 | }, |
| 86 | 85 | { |
| 87 | - label: 'Transportista', | |
| 86 | + label: 'Proveedor', | |
| 88 | 87 | image: 'proveedor.png' |
| 89 | 88 | }, |
| 90 | 89 | { |
src/views/remito-comprobante.html
| ... | ... | @@ -1,42 +0,0 @@ |
| 1 | -<div class="modal-header"> | |
| 2 | - <h5>Comprobante de remito Nยบ | |
| 3 | - <span | |
| 4 | - ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"> | |
| 5 | - </span> | |
| 6 | - </h5> | |
| 7 | -</div> | |
| 8 | -<div class="modal-body"> | |
| 9 | - <div class="col-12"> | |
| 10 | - <label | |
| 11 | - class="col-12 bg-success text-white" | |
| 12 | - ng-show="correoEnviado">Correo enviado con รฉxito</label> | |
| 13 | - <label | |
| 14 | - class="col-12 bg-danger text-white" | |
| 15 | - ng-show="correoNoEnviado">Hubo un error al enviar el correo</label> | |
| 16 | - <label>Enviar correo a </label> | |
| 17 | - <input | |
| 18 | - class="form-control" | |
| 19 | - ng-model="remito.cliente.MAIL" | |
| 20 | - ng-click="enviarCorreo($event.keyCode)"/> | |
| 21 | - </div> | |
| 22 | -</div> | |
| 23 | -<div class="modal-footer"> | |
| 24 | - <button | |
| 25 | - type="button" | |
| 26 | - class="btn btn-info" | |
| 27 | - ng-click="imprimir()" | |
| 28 | - ladda="esperando" | |
| 29 | - >Imprimir</button> | |
| 30 | - <button | |
| 31 | - type="button" | |
| 32 | - class="btn btn-primary" | |
| 33 | - ng-click="aceptar()" | |
| 34 | - ladda="esperando" | |
| 35 | - >Aceptar</button> | |
| 36 | - <button | |
| 37 | - type="button" | |
| 38 | - class="btn btn-primary" | |
| 39 | - ng-click="enviarCorreo(13)" | |
| 40 | - ladda="esperando" | |
| 41 | - >Enviar</button> | |
| 42 | -</div> |
src/views/remito.html
| ... | ... | @@ -6,6 +6,12 @@ |
| 6 | 6 | class="mb-0 col-lg-12" |
| 7 | 7 | busqueda="seleccionarRemito" |
| 8 | 8 | ></foca-cabecera-facturador> |
| 9 | + <marquee | |
| 10 | + bgcolor="#FF9900" | |
| 11 | + behavior="scroll" | |
| 12 | + direction="left" | |
| 13 | + ng-bind="remito.observaciones" | |
| 14 | + ></marquee> | |
| 9 | 15 | <div class="col-lg-12"> |
| 10 | 16 | <div class="row mt-4"> |
| 11 | 17 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
| ... | ... | @@ -47,8 +53,8 @@ |
| 47 | 53 | </thead> |
| 48 | 54 | <tbody class="tabla-articulo-body"> |
| 49 | 55 | <tr |
| 50 | - ng-repeat="(key, articulo) in remito.articulosRemito" | |
| 51 | - ng-show="show || key == (remito.articulosRemito.length - 1)" | |
| 56 | + ng-repeat="(key, articulo) in articulosFiltro()" | |
| 57 | + ng-show="show || key == (articulosFiltro().length - 1)" | |
| 52 | 58 | class="d-flex" |
| 53 | 59 | > |
| 54 | 60 | <td ng-bind="key + 1"></td> |
| ... | ... | @@ -63,13 +69,16 @@ |
| 63 | 69 | <td class="col text-right"> |
| 64 | 70 | <input |
| 65 | 71 | ng-show="articulo.editCantidad" |
| 66 | - ng-model="articulo.cantidad" | |
| 72 | + ng-model="tmpCantidad" | |
| 67 | 73 | class="form-control" |
| 68 | 74 | foca-tipo-input |
| 69 | 75 | min="1" |
| 70 | 76 | foca-focus="articulo.editCantidad" |
| 71 | - ng-keypress="editarArticulo($event.keyCode, articulo)" | |
| 72 | - ng-focus="selectFocus($event)" | |
| 77 | + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);" | |
| 78 | + esc-key="cancelarEditar(articulo)" | |
| 79 | + ng-focus="selectFocus($event); | |
| 80 | + tmpCantidad = articulo.cantidad; | |
| 81 | + tmpPrecio = articulo.precio" | |
| 73 | 82 | teclado-virtual |
| 74 | 83 | > |
| 75 | 84 | <i |
| ... | ... | @@ -82,14 +91,17 @@ |
| 82 | 91 | <td class="col text-right"> |
| 83 | 92 | <input |
| 84 | 93 | ng-show="articulo.editPrecio" |
| 85 | - ng-model="articulo.precio" | |
| 94 | + ng-model="tmpPrecio" | |
| 86 | 95 | class="form-control" |
| 87 | 96 | foca-tipo-input |
| 88 | 97 | min="1" |
| 89 | 98 | step="0.0001" |
| 90 | 99 | foca-focus="articulo.editPrecio" |
| 91 | - ng-keypress="editarArticulo($event.keyCode, articulo)" | |
| 92 | - ng-focus="selectFocus($event)" | |
| 100 | + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);" | |
| 101 | + esc-key="cancelarEditar(articulo)" | |
| 102 | + ng-focus="selectFocus($event); | |
| 103 | + tmpCantidad = articulo.cantidad; | |
| 104 | + tmpPrecio = articulo.precio" | |
| 93 | 105 | teclado-virtual |
| 94 | 106 | > |
| 95 | 107 | <i |
| ... | ... | @@ -106,7 +118,7 @@ |
| 106 | 118 | <td class="text-center"> |
| 107 | 119 | <button |
| 108 | 120 | class="btn btn-outline-light" |
| 109 | - ng-click="quitarArticulo(key)" | |
| 121 | + ng-click="quitarArticulo(articulo)" | |
| 110 | 122 | > |
| 111 | 123 | <i class="fa fa-trash"></i> |
| 112 | 124 | </button> |
| ... | ... | @@ -124,7 +136,7 @@ |
| 124 | 136 | <tr ng-show="!cargando" class="d-flex"> |
| 125 | 137 | <td |
| 126 | 138 | class="align-middle" |
| 127 | - ng-bind="remito.articulosRemito.length + 1" | |
| 139 | + ng-bind="articulosFiltro().length + 1" | |
| 128 | 140 | ></td> |
| 129 | 141 | <td class="col"> |
| 130 | 142 | <input |
| ... | ... | @@ -189,13 +201,13 @@ |
| 189 | 201 | <tr class="d-flex"> |
| 190 | 202 | <td colspan="4" class="no-border-top"> |
| 191 | 203 | <strong>Items:</strong> |
| 192 | - <a ng-bind="remito.articulosRemito.length"></a> | |
| 204 | + <a ng-bind="articulosFiltro().length"></a> | |
| 193 | 205 | </td> |
| 194 | 206 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 195 | 207 | <h3>Total:</h3> |
| 196 | 208 | </td> |
| 197 | 209 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 198 | - <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | |
| 210 | + <h3>{{getTotal() | currency: remito.cotizacion.moneda.SIMBOLO}}</h3> | |
| 199 | 211 | </td> |
| 200 | 212 | <td class="text-right no-border-top"> |
| 201 | 213 | <button |
| ... | ... | @@ -209,183 +221,6 @@ |
| 209 | 221 | </tfoot> |
| 210 | 222 | </table> |
| 211 | 223 | </div> |
| 212 | - | |
| 213 | - <!-- MOBILE --> | |
| 214 | - <div class="row d-sm-none"> | |
| 215 | - <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | |
| 216 | - <thead> | |
| 217 | - <tr class="d-flex"> | |
| 218 | - <th class="">#</th> | |
| 219 | - <th class="col px-0"> | |
| 220 | - <div class="d-flex"> | |
| 221 | - <div class="col-4 px-1">Cรณdigo</div> | |
| 222 | - <div class="col-8 px-1">Descripciรณn</div> | |
| 223 | - </div> | |
| 224 | - <div class="d-flex"> | |
| 225 | - <div class="col-3 px-1">Cantidad</div> | |
| 226 | - <div class="col px-1 text-right">P. Uni.</div> | |
| 227 | - <div class="col px-1 text-right">Subtotal</div> | |
| 228 | - </div> | |
| 229 | - </th> | |
| 230 | - <th class="text-center tamaรฑo-boton"> | |
| 231 | - | |
| 232 | - </th> | |
| 233 | - </tr> | |
| 234 | - </thead> | |
| 235 | - <tbody> | |
| 236 | - <tr | |
| 237 | - ng-repeat="(key, articulo) in remito.articulosRemito" | |
| 238 | - ng-show="show || key == remito.articulosRemito.length - 1" | |
| 239 | - > | |
| 240 | - <td class="w-100 align-middle d-flex p-0"> | |
| 241 | - <div class="align-middle p-1"> | |
| 242 | - <span ng-bind="key+1" class="align-middle"></span> | |
| 243 | - </div> | |
| 244 | - <div class="col px-0"> | |
| 245 | - <div class="d-flex"> | |
| 246 | - <div class="col-4 px-1"> | |
| 247 | - <span | |
| 248 | - ng-bind="articulo.sector + '-' + articulo.codigo" | |
| 249 | - ></span> | |
| 250 | - </div> | |
| 251 | - <div class="col-8 px-1"> | |
| 252 | - <span | |
| 253 | - ng-bind="'x' + articulo.cantidad" | |
| 254 | - ng-hide="articulo.editCantidad" | |
| 255 | - ></span> | |
| 256 | - <i | |
| 257 | - class="fa fa-pencil text-white-50" | |
| 258 | - aria-hidden="true" | |
| 259 | - ng-hide="articulo.editCantidad" | |
| 260 | - ng-click="articulo.editCantidad = true" | |
| 261 | - ></i> | |
| 262 | - <input | |
| 263 | - ng-show="articulo.editCantidad" | |
| 264 | - ng-model="articulo.cantidad" | |
| 265 | - class="form-control" | |
| 266 | - foca-tipo-input | |
| 267 | - min="1" | |
| 268 | - step="0.001" | |
| 269 | - foca-focus="articulo.editCantidad" | |
| 270 | - ng-keypress="editarArticulo($event.keyCode, articulo)" | |
| 271 | - ng-focus="selectFocus($event)" | |
| 272 | - > | |
| 273 | - </div> | |
| 274 | - </div> | |
| 275 | - <div class="d-flex"> | |
| 276 | - <div class="col-3 px-1"> | |
| 277 | - <span ng-bind="'x' + articulo.cantidad"></span> | |
| 278 | - </div> | |
| 279 | - <div class="col px-1 text-right"> | |
| 280 | - <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> | |
| 281 | - </div> | |
| 282 | - <div class="col px-1 text-right"> | |
| 283 | - <span | |
| 284 | - ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" | |
| 285 | - > | |
| 286 | - </span> | |
| 287 | - </div> | |
| 288 | - </div> | |
| 289 | - </div> | |
| 290 | - <div class="align-middle p-1"> | |
| 291 | - <button | |
| 292 | - class="btn btn-outline-light" | |
| 293 | - ng-click="quitarArticulo(key)" | |
| 294 | - > | |
| 295 | - <i class="fa fa-trash"></i> | |
| 296 | - </button> | |
| 297 | - </div> | |
| 298 | - </td> | |
| 299 | - </tr> | |
| 300 | - </tbody> | |
| 301 | - <tfoot> | |
| 302 | - <!-- CARGANDO ITEM --> | |
| 303 | - <tr ng-show="!cargando" class="d-flex"> | |
| 304 | - <td | |
| 305 | - class="align-middle p-1" | |
| 306 | - ng-bind="remito.articulosRemito.length + 1" | |
| 307 | - ></td> | |
| 308 | - <td class="col p-0"> | |
| 309 | - <div class="d-flex"> | |
| 310 | - <div class="col-4 px-1"> | |
| 311 | - <span | |
| 312 | - ng-bind="articuloACargar.sectorCodigo" | |
| 313 | - ></span> | |
| 314 | - </div> | |
| 315 | - <div class="col-8 px-1"> | |
| 316 | - <span ng-bind="articuloACargar.descripcion"></span> | |
| 317 | - </div> | |
| 318 | - </div> | |
| 319 | - <div class="d-flex"> | |
| 320 | - <div class="col-3 px-1 m-1"> | |
| 321 | - <input | |
| 322 | - class="form-control p-1" | |
| 323 | - foca-tipo-input | |
| 324 | - min="1" | |
| 325 | - ng-model="articuloACargar.cantidad" | |
| 326 | - foca-focus="!cargando" | |
| 327 | - ng-keypress="agregarATabla($event.keyCode)" | |
| 328 | - style="height: auto; line-height: 1.1em" | |
| 329 | - > | |
| 330 | - </div> | |
| 331 | - <div class="col px-1 text-right"> | |
| 332 | - <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> | |
| 333 | - </div> | |
| 334 | - <div class="col px-1 text-right"> | |
| 335 | - <span | |
| 336 | - ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" | |
| 337 | - > | |
| 338 | - </span> | |
| 339 | - </div> | |
| 340 | - </div> | |
| 341 | - </td> | |
| 342 | - <td class="text-center align-middle"> | |
| 343 | - <button | |
| 344 | - class="btn btn-outline-light" | |
| 345 | - ng-click="agregarATabla(13)" | |
| 346 | - > | |
| 347 | - <i class="fa fa-save"></i> | |
| 348 | - </button> | |
| 349 | - </td> | |
| 350 | - </tr> | |
| 351 | - <!-- TOOGLE EXPANDIR --> | |
| 352 | - <tr> | |
| 353 | - <td class="col"> | |
| 354 | - <button | |
| 355 | - class="btn btn-outline-light selectable w-100" | |
| 356 | - ng-click="show = !show; masMenos()" | |
| 357 | - ng-show="remito.articulosRemito.length > 0" | |
| 358 | - > | |
| 359 | - <i | |
| 360 | - class="fa fa-chevron-down" | |
| 361 | - ng-hide="show" | |
| 362 | - aria-hidden="true" | |
| 363 | - > | |
| 364 | - </i> | |
| 365 | - <i | |
| 366 | - class="fa fa-chevron-up" | |
| 367 | - ng-show="show" | |
| 368 | - aria-hidden="true"> | |
| 369 | - </i> | |
| 370 | - </button> | |
| 371 | - </td> | |
| 372 | - </tr> | |
| 373 | - <!-- FOOTER --> | |
| 374 | - <tr class="d-flex"> | |
| 375 | - <td class="align-middle no-border-top" colspan="2"> | |
| 376 | - <strong>Cantidad Items:</strong> | |
| 377 | - <a ng-bind="remito.articulosRemito.length"></a> | |
| 378 | - </td> | |
| 379 | - <td class="text-right ml-auto table-celda-total no-border-top"> | |
| 380 | - <h3>Total:</h3> | |
| 381 | - </td> | |
| 382 | - <td class="table-celda-total text-right no-border-top"> | |
| 383 | - <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | |
| 384 | - </td> | |
| 385 | - </tr> | |
| 386 | - </tfoot> | |
| 387 | - </table> | |
| 388 | - </div> | |
| 389 | 224 | </div> |
| 390 | 225 | </div> |
| 391 | 226 | </div> |