Commit f7a60a682355c1dced6049b94bd6e54025cf9386
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'upstream/master'
Showing
4 changed files
Show diff stats
gulpfile.js
| 1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
| 2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
| 3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
| 4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
| 5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
| 6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
| 7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
| 8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
| 9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
| 10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
| 11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
| 12 | 12 | ||
| 13 | var paths = { | 13 | var paths = { |
| 14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
| 15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
| 16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
| 17 | dist: 'dist/' | 17 | dist: 'dist/' |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | gulp.task('templates', ['clean'], function() { | 20 | gulp.task('templates', ['clean'], function() { |
| 21 | return pump( | 21 | return pump( |
| 22 | [ | 22 | [ |
| 23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
| 24 | htmlmin(), | 24 | htmlmin(), |
| 25 | templateCache('views.js', { | 25 | templateCache('views.js', { |
| 26 | module: 'focaCrearNotaPedido', | 26 | module: 'focaCrearNotaPedido', |
| 27 | root: '' | 27 | root: '' |
| 28 | }), | 28 | }), |
| 29 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
| 30 | ] | 30 | ] |
| 31 | ); | 31 | ); |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
| 35 | return pump( | 35 | return pump( |
| 36 | [ | 36 | [ |
| 37 | gulp.src([ | 37 | gulp.src([ |
| 38 | paths.srcJS, | 38 | paths.srcJS, |
| 39 | 'tmp/views.js' | 39 | 'tmp/views.js' |
| 40 | ]), | 40 | ]), |
| 41 | concat('foca-crear-nota-pedido.js'), | 41 | concat('foca-crear-nota-pedido.js'), |
| 42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
| 43 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
| 44 | rename('foca-crear-nota-pedido.min.js'), | 44 | rename('foca-crear-nota-pedido.min.js'), |
| 45 | uglify(), | 45 | uglify(), |
| 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
| 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ | 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
| 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ |
| 49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | 49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento"'+ |
| 50 | '"cordovaGeolocationModule"', ''), | 50 | ',"focaBotoneraLateral","angular-ladda","cordovaGeolocationModule"', ''), |
| 51 | gulp.dest(paths.dist) | 51 | gulp.dest(paths.dist) |
| 52 | ] | 52 | ] |
| 53 | ); | 53 | ); |
| 54 | }); | 54 | }); |
| 55 | 55 | ||
| 56 | gulp.task('clean', function() { | 56 | gulp.task('clean', function() { |
| 57 | return gulp.src(['tmp', 'dist'], {read: false}) | 57 | return gulp.src(['tmp', 'dist'], {read: false}) |
| 58 | .pipe(clean()); | 58 | .pipe(clean()); |
| 59 | }); | 59 | }); |
| 60 | 60 | ||
| 61 | gulp.task('pre-commit', function() { | 61 | gulp.task('pre-commit', function() { |
| 62 | return pump( | 62 | return pump( |
| 63 | [ | 63 | [ |
| 64 | gulp.src(paths.srcJS), | 64 | gulp.src(paths.srcJS), |
| 65 | jshint('.jshintrc'), | 65 | jshint('.jshintrc'), |
| 66 | jshint.reporter('default'), | 66 | jshint.reporter('default'), |
| 67 | jshint.reporter('fail') | 67 | jshint.reporter('fail') |
| 68 | ] | 68 | ] |
| 69 | ); | 69 | ); |
| 70 | 70 | ||
| 71 | gulp.start('uglify'); | 71 | gulp.start('uglify'); |
| 72 | }); | 72 | }); |
| 73 | 73 | ||
| 74 | gulp.task('webserver', function() { | 74 | gulp.task('webserver', function() { |
| 75 | pump [ | 75 | pump [ |
| 76 | connect.server({port: 3300, host: '0.0.0.0'}) | 76 | connect.server({port: 3300, host: '0.0.0.0'}) |
| 77 | ] | 77 | ] |
| 78 | }); | 78 | }); |
| 79 | 79 | ||
| 80 | gulp.task('clean-post-install', function() { | 80 | gulp.task('clean-post-install', function() { |
| 81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
| 82 | 'index.html'], {read: false}) | 82 | 'index.html'], {read: false}) |
| 83 | .pipe(clean()); | 83 | .pipe(clean()); |
| 84 | }); | 84 | }); |
| 85 | 85 | ||
| 86 | gulp.task('default', ['webserver']); | 86 | gulp.task('default', ['webserver']); |
| 87 | 87 | ||
| 88 | gulp.task('watch', function() { | 88 | gulp.task('watch', function() { |
| 89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
| 90 | }); | 90 | }); |
| 91 | 91 | ||
| 92 | gulp.task('copy', ['uglify'], function() { | 92 | gulp.task('copy', ['uglify'], function() { |
| 93 | return gulp.src('dist/*.js') | 93 | return gulp.src('dist/*.js') |
| 94 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/')); | 94 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/')); |
| 95 | }); | 95 | }); |
| 96 | 96 | ||
| 97 | gulp.task('watchAndCopy', function() { | 97 | gulp.task('watchAndCopy', function() { |
| 98 | return gulp.watch([paths.srcJS], ['copy']); | 98 | return gulp.watch([paths.srcJS], ['copy']); |
| 99 | }); | 99 | }); |
| 100 | 100 |
src/js/app.js
| 1 | angular.module('focaCrearNotaPedido', [ | 1 | angular.module('focaCrearNotaPedido', [ |
| 2 | 'ngRoute', | 2 | 'ngRoute', |
| 3 | 'ui.bootstrap', | 3 | 'ui.bootstrap', |
| 4 | 'focaModalVendedores', | 4 | 'focaModalVendedores', |
| 5 | 'focaBusquedaProductos', | 5 | 'focaBusquedaProductos', |
| 6 | 'focaModalProveedor', | 6 | 'focaModalProveedor', |
| 7 | 'focaBusquedaCliente', | 7 | 'focaBusquedaCliente', |
| 8 | 'focaModalPrecioCondicion', | 8 | 'focaModalPrecioCondicion', |
| 9 | 'focaModalFlete', | 9 | 'focaModalFlete', |
| 10 | 'focaDirectivas', | 10 | 'focaDirectivas', |
| 11 | 'focaModal', | 11 | 'focaModal', |
| 12 | 'focaModalDomicilio', | 12 | 'focaModalDomicilio', |
| 13 | 'focaModalMoneda', | 13 | 'focaModalMoneda', |
| 14 | 'focaModalCotizacion', | 14 | 'focaModalCotizacion', |
| 15 | 'focaSeguimiento', | 15 | 'focaSeguimiento', |
| 16 | 'focaBotoneraLateral', | ||
| 16 | 'angular-ladda', | 17 | 'angular-ladda', |
| 17 | 'cordovaGeolocationModule' | 18 | 'cordovaGeolocationModule' |
| 18 | ]); | 19 | ]); |
| 19 | 20 |
src/js/controller.js
| 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', |
| 4 | 'focaModalService', 'notaPedidoBusinessService', '$rootScope', 'focaSeguimientoService', | 4 | '$uibModal', |
| 5 | '$location', | ||
| 6 | '$filter', | ||
| 7 | '$timeout', | ||
| 8 | 'crearNotaPedidoService', | ||
| 9 | 'focaBotoneraLateralService', | ||
| 10 | 'focaModalService', | ||
| 11 | 'notaPedidoBusinessService', | ||
| 12 | '$rootScope', | ||
| 13 | 'focaSeguimientoService', | ||
| 5 | function( | 14 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, | 15 | $scope, $uibModal, $location, $filter, $timeout, |
| 7 | notaPedidoBusinessService, $rootScope, focaSeguimientoService) | 16 | crearNotaPedidoService, focaBotoneraLateralService, |
| 17 | focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) | ||
| 8 | { | 18 | { |
| 9 | 19 | ||
| 10 | $scope.botonera = crearNotaPedidoService.getBotonera(); | 20 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
| 11 | 21 | ||
| 12 | $scope.isNumber = angular.isNumber; | 22 | $scope.isNumber = angular.isNumber; |
| 13 | $scope.datepickerAbierto = false; | 23 | $scope.datepickerAbierto = false; |
| 14 | $scope.show = false; | 24 | $scope.show = false; |
| 15 | $scope.cargando = true; | 25 | $scope.cargando = true; |
| 16 | $scope.dateOptions = { | 26 | $scope.dateOptions = { |
| 17 | maxDate: new Date(), | 27 | maxDate: new Date(), |
| 18 | minDate: new Date(2010, 0, 1) | 28 | minDate: new Date(2010, 0, 1) |
| 19 | }; | 29 | }; |
| 20 | 30 | ||
| 21 | $scope.notaPedido = { | 31 | $scope.notaPedido = { |
| 22 | id: 0, | 32 | id: 0, |
| 23 | vendedor: {}, | 33 | vendedor: {}, |
| 24 | cliente: {}, | 34 | cliente: {}, |
| 25 | proveedor: {}, | 35 | proveedor: {}, |
| 26 | domicilio: {dom: ''}, | 36 | domicilio: {dom: ''}, |
| 27 | moneda: {}, | 37 | moneda: {}, |
| 28 | cotizacion: {} | 38 | cotizacion: {} |
| 29 | }; | 39 | }; |
| 30 | var monedaPorDefecto; | 40 | var monedaPorDefecto; |
| 31 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 41 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 32 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 42 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
| 33 | monedaPorDefecto = res.data[0]; | 43 | monedaPorDefecto = res.data[0]; |
| 34 | $scope.notaPedido.moneda = monedaPorDefecto; | 44 | $scope.notaPedido.moneda = monedaPorDefecto; |
| 35 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
| 36 | }); | 46 | }); |
| 37 | 47 | ||
| 38 | $scope.cabecera = []; | 48 | $scope.cabecera = []; |
| 39 | $scope.showCabecera = true; | 49 | $scope.showCabecera = true; |
| 40 | 50 | ||
| 41 | $scope.now = new Date(); | 51 | $scope.now = new Date(); |
| 42 | $scope.puntoVenta = '0000'; | 52 | $scope.puntoVenta = '0000'; |
| 43 | $scope.comprobante = '00000000'; | 53 | $scope.comprobante = '00000000'; |
| 44 | $scope.articulosTabla = []; | 54 | $scope.articulosTabla = []; |
| 45 | $scope.idLista = undefined; | 55 | $scope.idLista = undefined; |
| 46 | 56 | ||
| 57 | //SETEO BOTONERA LATERAL | ||
| 58 | $timeout(function() { | ||
| 59 | focaBotoneraLateralService.showSalir(true); | ||
| 60 | focaBotoneraLateralService.showPausar(true); | ||
| 61 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | ||
| 62 | }); | ||
| 63 | |||
| 47 | crearNotaPedidoService.getPrecioCondicion().then( | 64 | crearNotaPedidoService.getPrecioCondicion().then( |
| 48 | function(res) { | 65 | function(res) { |
| 49 | $scope.precioCondiciones = res.data; | 66 | $scope.precioCondiciones = res.data; |
| 50 | } | 67 | } |
| 51 | ); | 68 | ); |
| 52 | 69 | ||
| 53 | crearNotaPedidoService.getNumeroNotaPedido().then( | 70 | crearNotaPedidoService.getNumeroNotaPedido().then( |
| 54 | function(res) { | 71 | function(res) { |
| 55 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 72 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 56 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 73 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
| 57 | }, | 74 | }, |
| 58 | function(err) { | 75 | function(err) { |
| 59 | focaModalService.alert('La terminal no esta configurada correctamente'); | 76 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 60 | console.info(err); | 77 | console.info(err); |
| 61 | } | 78 | } |
| 62 | ); | 79 | ); |
| 63 | 80 | ||
| 64 | $scope.crearNotaPedido = function() { | 81 | $scope.crearNotaPedido = function() { |
| 65 | if(!$scope.notaPedido.vendedor.CodVen) { | 82 | if(!$scope.notaPedido.vendedor.CodVen) { |
| 66 | focaModalService.alert('Ingrese Vendedor'); | 83 | focaModalService.alert('Ingrese Vendedor'); |
| 67 | return; | 84 | return; |
| 68 | } else if(!$scope.notaPedido.cliente.COD) { | 85 | } else if(!$scope.notaPedido.cliente.COD) { |
| 69 | focaModalService.alert('Ingrese Cliente'); | 86 | focaModalService.alert('Ingrese Cliente'); |
| 70 | return; | 87 | return; |
| 71 | } else if(!$scope.notaPedido.proveedor.COD) { | 88 | } else if(!$scope.notaPedido.proveedor.COD) { |
| 72 | focaModalService.alert('Ingrese Proveedor'); | 89 | focaModalService.alert('Ingrese Proveedor'); |
| 73 | return; | 90 | return; |
| 74 | } else if(!$scope.notaPedido.moneda.ID) { | 91 | } else if(!$scope.notaPedido.moneda.ID) { |
| 75 | focaModalService.alert('Ingrese Moneda'); | 92 | focaModalService.alert('Ingrese Moneda'); |
| 76 | return; | 93 | return; |
| 77 | } else if(!$scope.notaPedido.cotizacion.ID) { | 94 | } else if(!$scope.notaPedido.cotizacion.ID) { |
| 78 | focaModalService.alert('Ingrese Cotización'); | 95 | focaModalService.alert('Ingrese Cotización'); |
| 79 | return; | 96 | return; |
| 80 | } else if(!$scope.plazosPagos) { | 97 | } else if(!$scope.plazosPagos) { |
| 81 | focaModalService.alert('Ingrese Precios y Condiciones'); | 98 | focaModalService.alert('Ingrese Precios y Condiciones'); |
| 82 | return; | 99 | return; |
| 83 | } else if( | 100 | } else if( |
| 84 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | 101 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) |
| 85 | { | 102 | { |
| 86 | focaModalService.alert('Ingrese Flete'); | 103 | focaModalService.alert('Ingrese Flete'); |
| 87 | return; | 104 | return; |
| 88 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto | 105 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto |
| 89 | focaModalService.alert('Ingrese Domicilio'); | 106 | focaModalService.alert('Ingrese Domicilio'); |
| 90 | return; | 107 | return; |
| 91 | } else if($scope.articulosTabla.length === 0) { | 108 | } else if($scope.articulosTabla.length === 0) { |
| 92 | focaModalService.alert('Debe cargar al menos un articulo'); | 109 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 93 | return; | 110 | return; |
| 94 | } | 111 | } |
| 95 | $scope.saveLoading = true; | 112 | $scope.saveLoading = true; |
| 96 | var notaPedido = { | 113 | var notaPedido = { |
| 97 | id: $scope.notaPedido.id, | 114 | id: $scope.notaPedido.id, |
| 98 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 115 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
| 99 | idVendedor: $scope.notaPedido.vendedor.CodVen, | 116 | idVendedor: $scope.notaPedido.vendedor.CodVen, |
| 100 | idCliente: $scope.notaPedido.cliente.COD, | 117 | idCliente: $scope.notaPedido.cliente.COD, |
| 101 | nombreCliente: $scope.notaPedido.cliente.NOM, | 118 | nombreCliente: $scope.notaPedido.cliente.NOM, |
| 102 | cuitCliente: $scope.notaPedido.cliente.CUIT, | 119 | cuitCliente: $scope.notaPedido.cliente.CUIT, |
| 103 | idProveedor: $scope.notaPedido.proveedor.COD, | 120 | idProveedor: $scope.notaPedido.proveedor.COD, |
| 104 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID | 121 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID |
| 105 | idCotizacion: $scope.notaPedido.cotizacion.ID, | 122 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
| 106 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | 123 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, |
| 107 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 124 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
| 108 | flete: $scope.notaPedido.flete, | 125 | flete: $scope.notaPedido.flete, |
| 109 | fob: $scope.notaPedido.fob, | 126 | fob: $scope.notaPedido.fob, |
| 110 | bomba: $scope.notaPedido.bomba, | 127 | bomba: $scope.notaPedido.bomba, |
| 111 | kilometros: $scope.notaPedido.kilometros, | 128 | kilometros: $scope.notaPedido.kilometros, |
| 112 | domicilioStamp: $scope.notaPedido.domicilioStamp, | 129 | domicilioStamp: $scope.notaPedido.domicilioStamp, |
| 113 | estado: 0, | 130 | estado: 0, |
| 114 | total: $scope.getTotal() | 131 | total: $scope.getTotal() |
| 115 | }; | 132 | }; |
| 116 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 133 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 117 | function(data) { | 134 | function(data) { |
| 118 | // Al guardar los datos de la nota de pedido logueamos la | 135 | // Al guardar los datos de la nota de pedido logueamos la |
| 119 | // actividad para su seguimiento. | 136 | // actividad para su seguimiento. |
| 120 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? | 137 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? |
| 121 | focaSeguimientoService.guardarPosicion( | 138 | focaSeguimientoService.guardarPosicion( |
| 122 | 'Nota de pedido', | 139 | 'Nota de pedido', |
| 123 | data.data.id, | 140 | data.data.id, |
| 124 | '' | 141 | '' |
| 125 | ); | 142 | ); |
| 126 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 143 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
| 127 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 144 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
| 128 | var plazos = $scope.plazosPagos; | 145 | var plazos = $scope.plazosPagos; |
| 129 | 146 | ||
| 130 | for(var j = 0; j < plazos.length; j++) { | 147 | for(var j = 0; j < plazos.length; j++) { |
| 131 | var json = { | 148 | var json = { |
| 132 | idPedido: data.data.id, | 149 | idPedido: data.data.id, |
| 133 | dias: plazos[j].dias | 150 | dias: plazos[j].dias |
| 134 | }; | 151 | }; |
| 135 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); | 152 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
| 136 | } | 153 | } |
| 137 | notaPedidoBusinessService.addEstado(data.data.id, | 154 | notaPedidoBusinessService.addEstado(data.data.id, |
| 138 | $scope.notaPedido.vendedor.CodVen); | 155 | $scope.notaPedido.vendedor.CodVen); |
| 139 | 156 | ||
| 140 | focaModalService.alert('Nota pedido creada'); | 157 | focaModalService.alert('Nota pedido creada'); |
| 141 | $scope.saveLoading = false; | 158 | $scope.saveLoading = false; |
| 142 | $scope.$broadcast('cleanCabecera'); | 159 | $scope.$broadcast('cleanCabecera'); |
| 143 | $scope.$broadcast('addCabecera', { | 160 | $scope.$broadcast('addCabecera', { |
| 144 | label: 'Moneda:', | 161 | label: 'Moneda:', |
| 145 | valor: $scope.notaPedido.moneda.DETALLE | 162 | valor: $scope.notaPedido.moneda.DETALLE |
| 146 | }); | 163 | }); |
| 147 | $scope.$broadcast('addCabecera', { | 164 | $scope.$broadcast('addCabecera', { |
| 148 | label: 'Fecha cotizacion:', | 165 | label: 'Fecha cotizacion:', |
| 149 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 166 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
| 150 | }); | 167 | }); |
| 151 | $scope.$broadcast('addCabecera', { | 168 | $scope.$broadcast('addCabecera', { |
| 152 | label: 'Moneda:', | 169 | label: 'Moneda:', |
| 153 | valor: $scope.notaPedido.moneda.DETALLE | 170 | valor: $scope.notaPedido.moneda.DETALLE |
| 154 | }); | 171 | }); |
| 155 | $scope.$broadcast('addCabecera', { | 172 | $scope.$broadcast('addCabecera', { |
| 156 | label: 'Cotizacion:', | 173 | label: 'Cotizacion:', |
| 157 | valor: $scope.notaPedido.cotizacion.VENDEDOR | 174 | valor: $scope.notaPedido.cotizacion.VENDEDOR |
| 158 | }); | 175 | }); |
| 159 | crearNotaPedidoService.getNumeroNotaPedido().then( | 176 | crearNotaPedidoService.getNumeroNotaPedido().then( |
| 160 | function(res) { | 177 | function(res) { |
| 161 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 178 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 162 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 179 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
| 163 | }, | 180 | }, |
| 164 | function(err) { | 181 | function(err) { |
| 165 | focaModalService.alert( | 182 | focaModalService.alert( |
| 166 | 'La terminal no esta configurada correctamente'); | 183 | 'La terminal no esta configurada correctamente'); |
| 167 | console.info(err); | 184 | console.info(err); |
| 168 | } | 185 | } |
| 169 | ); | 186 | ); |
| 170 | $scope.notaPedido.vendedor = {}; | 187 | $scope.notaPedido.vendedor = {}; |
| 171 | $scope.notaPedido.cliente = {}; | 188 | $scope.notaPedido.cliente = {}; |
| 172 | $scope.notaPedido.proveedor = {}; | 189 | $scope.notaPedido.proveedor = {}; |
| 173 | $scope.notaPedido.domicilio = {}; | 190 | $scope.notaPedido.domicilio = {}; |
| 174 | $scope.notaPedido.flete = null; | 191 | $scope.notaPedido.flete = null; |
| 175 | $scope.notaPedido.fob = null; | 192 | $scope.notaPedido.fob = null; |
| 176 | $scope.notaPedido.bomba = null; | 193 | $scope.notaPedido.bomba = null; |
| 177 | $scope.notaPedido.kilometros = null; | 194 | $scope.notaPedido.kilometros = null; |
| 178 | $scope.articulosTabla = []; | 195 | $scope.articulosTabla = []; |
| 179 | }, | 196 | }, |
| 180 | function(error) { | 197 | function(error) { |
| 181 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 198 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
| 182 | $scope.saveLoading = false; | 199 | $scope.saveLoading = false; |
| 183 | console.info(error); | 200 | console.info(error); |
| 184 | } | 201 | } |
| 185 | ); | 202 | ); |
| 186 | }; | 203 | }; |
| 187 | 204 | ||
| 188 | $scope.seleccionarNotaPedido = function() { | 205 | $scope.seleccionarNotaPedido = function() { |
| 189 | var modalInstance = $uibModal.open( | 206 | var modalInstance = $uibModal.open( |
| 190 | { | 207 | { |
| 191 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 208 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| 192 | templateUrl: 'foca-modal-nota-pedido.html', | 209 | templateUrl: 'foca-modal-nota-pedido.html', |
| 193 | controller: 'focaModalNotaPedidoController', | 210 | controller: 'focaModalNotaPedidoController', |
| 194 | size: 'lg', | 211 | size: 'lg', |
| 195 | resolve: {usadoPor: function() {return 'notaPedido';}} | 212 | resolve: {usadoPor: function() {return 'notaPedido';}} |
| 196 | } | 213 | } |
| 197 | ); | 214 | ); |
| 198 | modalInstance.result.then( | 215 | modalInstance.result.then( |
| 199 | function(notaPedido) { | 216 | function(notaPedido) { |
| 200 | $scope.now = new Date(notaPedido.fechaCarga); | 217 | $scope.now = new Date(notaPedido.fechaCarga); |
| 201 | //añado cabeceras | 218 | //añado cabeceras |
| 202 | $scope.notaPedido.id = notaPedido.id; | 219 | $scope.notaPedido.id = notaPedido.id; |
| 203 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 220 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 204 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 221 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 205 | var cabeceras = [ | 222 | var cabeceras = [ |
| 206 | { | 223 | { |
| 207 | label: 'Moneda:', | 224 | label: 'Moneda:', |
| 208 | valor: notaPedido.cotizacion.moneda.DETALLE | 225 | valor: notaPedido.cotizacion.moneda.DETALLE |
| 209 | }, | 226 | }, |
| 210 | { | 227 | { |
| 211 | label: 'Fecha cotizacion:', | 228 | label: 'Fecha cotizacion:', |
| 212 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 229 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
| 213 | 'dd/MM/yyyy') | 230 | 'dd/MM/yyyy') |
| 214 | }, | 231 | }, |
| 215 | { | 232 | { |
| 216 | label: 'Cotizacion:', | 233 | label: 'Cotizacion:', |
| 217 | valor: notaPedido.cotizacion.VENDEDOR | 234 | valor: notaPedido.cotizacion.VENDEDOR |
| 218 | }, | 235 | }, |
| 219 | { | 236 | { |
| 220 | label: 'Cliente:', | 237 | label: 'Cliente:', |
| 221 | valor: notaPedido.cliente.NOM | 238 | valor: notaPedido.cliente.NOM |
| 222 | }, | 239 | }, |
| 223 | { | 240 | { |
| 224 | label: 'Domicilio:', | 241 | label: 'Domicilio:', |
| 225 | valor: notaPedido.domicilioStamp | 242 | valor: notaPedido.domicilioStamp |
| 226 | }, | 243 | }, |
| 227 | { | 244 | { |
| 228 | label: 'Vendedor:', | 245 | label: 'Vendedor:', |
| 229 | valor: notaPedido.vendedor.NomVen | 246 | valor: notaPedido.vendedor.NomVen |
| 230 | }, | 247 | }, |
| 231 | { | 248 | { |
| 232 | label: 'Proveedor:', | 249 | label: 'Proveedor:', |
| 233 | valor: notaPedido.proveedor.NOM | 250 | valor: notaPedido.proveedor.NOM |
| 234 | }, | 251 | }, |
| 235 | { | 252 | { |
| 236 | label: 'Precio condicion:', | 253 | label: 'Precio condicion:', |
| 237 | valor: valorPrecioCondicion() + ' ' + | 254 | valor: valorPrecioCondicion() + ' ' + |
| 238 | notaPedidoBusinessService | 255 | notaPedidoBusinessService |
| 239 | .plazoToString(notaPedido.notaPedidoPlazo) | 256 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 240 | }, | 257 | }, |
| 241 | { | 258 | { |
| 242 | label: 'Flete:', | 259 | label: 'Flete:', |
| 243 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 260 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| 244 | notaPedido.flete === 1 ? 'Si' : 'No') | 261 | notaPedido.flete === 1 ? 'Si' : 'No') |
| 245 | } | 262 | } |
| 246 | ]; | 263 | ]; |
| 247 | 264 | ||
| 248 | function valorPrecioCondicion() { | 265 | function valorPrecioCondicion() { |
| 249 | if(notaPedido.idPrecioCondicion > 0) { | 266 | if(notaPedido.idPrecioCondicion > 0) { |
| 250 | return notaPedido.precioCondicion.nombre; | 267 | return notaPedido.precioCondicion.nombre; |
| 251 | } else { | 268 | } else { |
| 252 | return 'Ingreso Manual'; | 269 | return 'Ingreso Manual'; |
| 253 | } | 270 | } |
| 254 | } | 271 | } |
| 255 | 272 | ||
| 256 | if(notaPedido.flete === 1) { | 273 | if(notaPedido.flete === 1) { |
| 257 | var cabeceraBomba = { | 274 | var cabeceraBomba = { |
| 258 | label: 'Bomba:', | 275 | label: 'Bomba:', |
| 259 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 276 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
| 260 | }; | 277 | }; |
| 261 | if(notaPedido.kilometros) { | 278 | if(notaPedido.kilometros) { |
| 262 | var cabeceraKilometros = { | 279 | var cabeceraKilometros = { |
| 263 | label: 'Kilometros:', | 280 | label: 'Kilometros:', |
| 264 | valor: notaPedido.kilometros | 281 | valor: notaPedido.kilometros |
| 265 | }; | 282 | }; |
| 266 | cabeceras.push(cabeceraKilometros); | 283 | cabeceras.push(cabeceraKilometros); |
| 267 | } | 284 | } |
| 268 | cabeceras.push(cabeceraBomba); | 285 | cabeceras.push(cabeceraBomba); |
| 269 | } | 286 | } |
| 270 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 287 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
| 271 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 288 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
| 272 | notaPedido.cotizacion.VENDEDOR); | 289 | notaPedido.cotizacion.VENDEDOR); |
| 273 | if(notaPedido.idPrecioCondicion > 0) { | 290 | if(notaPedido.idPrecioCondicion > 0) { |
| 274 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 291 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 275 | } else { | 292 | } else { |
| 276 | $scope.idLista = -1; | 293 | $scope.idLista = -1; |
| 277 | } | 294 | } |
| 278 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | 295 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); |
| 279 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | 296 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); |
| 280 | $scope.notaPedido = notaPedido; | 297 | $scope.notaPedido = notaPedido; |
| 281 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 298 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
| 282 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 299 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
| 283 | addArrayCabecera(cabeceras); | 300 | addArrayCabecera(cabeceras); |
| 284 | 301 | ||
| 285 | }, function() { | 302 | }, function() { |
| 286 | // funcion ejecutada cuando se cancela el modal | 303 | // funcion ejecutada cuando se cancela el modal |
| 287 | } | 304 | } |
| 288 | ); | 305 | ); |
| 289 | }; | 306 | }; |
| 290 | 307 | ||
| 291 | $scope.seleccionarProductos = function() { | 308 | $scope.seleccionarProductos = function() { |
| 292 | if ($scope.idLista === undefined) { | 309 | if ($scope.idLista === undefined) { |
| 293 | focaModalService.alert( | 310 | focaModalService.alert( |
| 294 | 'Primero seleccione una lista de precio y condicion'); | 311 | 'Primero seleccione una lista de precio y condicion'); |
| 295 | return; | 312 | return; |
| 296 | } | 313 | } |
| 297 | var modalInstance = $uibModal.open( | 314 | var modalInstance = $uibModal.open( |
| 298 | { | 315 | { |
| 299 | ariaLabelledBy: 'Busqueda de Productos', | 316 | ariaLabelledBy: 'Busqueda de Productos', |
| 300 | templateUrl: 'modal-busqueda-productos.html', | 317 | templateUrl: 'modal-busqueda-productos.html', |
| 301 | controller: 'modalBusquedaProductosCtrl', | 318 | controller: 'modalBusquedaProductosCtrl', |
| 302 | resolve: { | 319 | resolve: { |
| 303 | parametroProducto: { | 320 | parametroProducto: { |
| 304 | idLista: $scope.idLista, | 321 | idLista: $scope.idLista, |
| 305 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 322 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
| 306 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 323 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
| 307 | } | 324 | } |
| 308 | }, | 325 | }, |
| 309 | size: 'lg' | 326 | size: 'lg' |
| 310 | } | 327 | } |
| 311 | ); | 328 | ); |
| 312 | modalInstance.result.then( | 329 | modalInstance.result.then( |
| 313 | function(producto) { | 330 | function(producto) { |
| 314 | var newArt = | 331 | var newArt = |
| 315 | { | 332 | { |
| 316 | id: 0, | 333 | id: 0, |
| 317 | codigo: producto.codigo, | 334 | codigo: producto.codigo, |
| 318 | sector: producto.sector, | 335 | sector: producto.sector, |
| 319 | sectorCodigo: producto.sector + '-' + producto.codigo, | 336 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 320 | descripcion: producto.descripcion, | 337 | descripcion: producto.descripcion, |
| 321 | item: $scope.articulosTabla.length + 1, | 338 | item: $scope.articulosTabla.length + 1, |
| 322 | nombre: producto.descripcion, | 339 | nombre: producto.descripcion, |
| 323 | precio: parseFloat(producto.precio.toFixed(4)), | 340 | precio: parseFloat(producto.precio.toFixed(4)), |
| 324 | costoUnitario: producto.costo, | 341 | costoUnitario: producto.costo, |
| 325 | editCantidad: false, | 342 | editCantidad: false, |
| 326 | editPrecio: false, | 343 | editPrecio: false, |
| 327 | rubro: producto.CodRub, | 344 | rubro: producto.CodRub, |
| 328 | exentoUnitario: producto.precio, | 345 | exentoUnitario: producto.precio, |
| 329 | ivaUnitario: producto.IMPIVA, | 346 | ivaUnitario: producto.IMPIVA, |
| 330 | impuestoInternoUnitario: producto.ImpInt, | 347 | impuestoInternoUnitario: producto.ImpInt, |
| 331 | impuestoInterno1Unitario: producto.ImpInt2, | 348 | impuestoInterno1Unitario: producto.ImpInt2, |
| 332 | impuestoInterno2Unitario: producto.ImpInt3, | 349 | impuestoInterno2Unitario: producto.ImpInt3, |
| 333 | precioLista: producto.precio, | 350 | precioLista: producto.precio, |
| 334 | combustible: 1, | 351 | combustible: 1, |
| 335 | facturado: 0 | 352 | facturado: 0 |
| 336 | }; | 353 | }; |
| 337 | $scope.articuloACargar = newArt; | 354 | $scope.articuloACargar = newArt; |
| 338 | $scope.cargando = false; | 355 | $scope.cargando = false; |
| 339 | }, function() { | 356 | }, function() { |
| 340 | // funcion ejecutada cuando se cancela el modal | 357 | // funcion ejecutada cuando se cancela el modal |
| 341 | } | 358 | } |
| 342 | ); | 359 | ); |
| 343 | }; | 360 | }; |
| 344 | 361 | ||
| 345 | $scope.seleccionarVendedor = function() { | 362 | $scope.seleccionarVendedor = function() { |
| 346 | if(validarNotaRemitada()) { | 363 | if(validarNotaRemitada()) { |
| 347 | var modalInstance = $uibModal.open( | 364 | var modalInstance = $uibModal.open( |
| 348 | { | 365 | { |
| 349 | ariaLabelledBy: 'Busqueda de Vendedores', | 366 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 350 | templateUrl: 'modal-vendedores.html', | 367 | templateUrl: 'modal-vendedores.html', |
| 351 | controller: 'modalVendedoresCtrl', | 368 | controller: 'modalVendedoresCtrl', |
| 352 | size: 'lg' | 369 | size: 'lg' |
| 353 | } | 370 | } |
| 354 | ); | 371 | ); |
| 355 | modalInstance.result.then( | 372 | modalInstance.result.then( |
| 356 | function(vendedor) { | 373 | function(vendedor) { |
| 357 | $scope.$broadcast('addCabecera', { | 374 | $scope.$broadcast('addCabecera', { |
| 358 | label: 'Vendedor:', | 375 | label: 'Vendedor:', |
| 359 | valor: vendedor.NomVen | 376 | valor: vendedor.NomVen |
| 360 | }); | 377 | }); |
| 361 | $scope.notaPedido.vendedor = vendedor; | 378 | $scope.notaPedido.vendedor = vendedor; |
| 362 | }, function() { | 379 | }, function() { |
| 363 | 380 | ||
| 364 | } | 381 | } |
| 365 | ); | 382 | ); |
| 366 | } | 383 | } |
| 367 | }; | 384 | }; |
| 368 | 385 | ||
| 369 | $scope.seleccionarProveedor = function() { | 386 | $scope.seleccionarProveedor = function() { |
| 370 | if(validarNotaRemitada()) { | 387 | if(validarNotaRemitada()) { |
| 371 | var modalInstance = $uibModal.open( | 388 | var modalInstance = $uibModal.open( |
| 372 | { | 389 | { |
| 373 | ariaLabelledBy: 'Busqueda de Proveedor', | 390 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 374 | templateUrl: 'modal-proveedor.html', | 391 | templateUrl: 'modal-proveedor.html', |
| 375 | controller: 'focaModalProveedorCtrl', | 392 | controller: 'focaModalProveedorCtrl', |
| 376 | size: 'lg', | 393 | size: 'lg', |
| 377 | resolve: { | 394 | resolve: { |
| 378 | transportista: function() { | 395 | transportista: function() { |
| 379 | return false; | 396 | return false; |
| 380 | } | 397 | } |
| 381 | } | 398 | } |
| 382 | } | 399 | } |
| 383 | ); | 400 | ); |
| 384 | modalInstance.result.then( | 401 | modalInstance.result.then( |
| 385 | function(proveedor) { | 402 | function(proveedor) { |
| 386 | $scope.notaPedido.proveedor = proveedor; | 403 | $scope.notaPedido.proveedor = proveedor; |
| 387 | $scope.$broadcast('addCabecera', { | 404 | $scope.$broadcast('addCabecera', { |
| 388 | label: 'Proveedor:', | 405 | label: 'Proveedor:', |
| 389 | valor: proveedor.NOM | 406 | valor: proveedor.NOM |
| 390 | }); | 407 | }); |
| 391 | }, function() { | 408 | }, function() { |
| 392 | 409 | ||
| 393 | } | 410 | } |
| 394 | ); | 411 | ); |
| 395 | } | 412 | } |
| 396 | }; | 413 | }; |
| 397 | 414 | ||
| 398 | $scope.seleccionarCliente = function() { | 415 | $scope.seleccionarCliente = function() { |
| 399 | if(validarNotaRemitada()) { | 416 | if(validarNotaRemitada()) { |
| 400 | var modalInstance = $uibModal.open( | 417 | var modalInstance = $uibModal.open( |
| 401 | { | 418 | { |
| 402 | ariaLabelledBy: 'Busqueda de Cliente', | 419 | ariaLabelledBy: 'Busqueda de Cliente', |
| 403 | templateUrl: 'foca-busqueda-cliente-modal.html', | 420 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 404 | controller: 'focaBusquedaClienteModalController', | 421 | controller: 'focaBusquedaClienteModalController', |
| 405 | size: 'lg' | 422 | size: 'lg' |
| 406 | } | 423 | } |
| 407 | ); | 424 | ); |
| 408 | modalInstance.result.then( | 425 | modalInstance.result.then( |
| 409 | function(cliente) { | 426 | function(cliente) { |
| 410 | $scope.abrirModalDomicilios(cliente); | 427 | $scope.abrirModalDomicilios(cliente); |
| 411 | }, function() { | 428 | }, function() { |
| 412 | 429 | ||
| 413 | } | 430 | } |
| 414 | ); | 431 | ); |
| 415 | } | 432 | } |
| 416 | }; | 433 | }; |
| 417 | 434 | ||
| 418 | $scope.abrirModalDomicilios = function(cliente) { | 435 | $scope.abrirModalDomicilios = function(cliente) { |
| 419 | var modalInstanceDomicilio = $uibModal.open( | 436 | var modalInstanceDomicilio = $uibModal.open( |
| 420 | { | 437 | { |
| 421 | ariaLabelledBy: 'Busqueda de Domicilios', | 438 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 422 | templateUrl: 'modal-domicilio.html', | 439 | templateUrl: 'modal-domicilio.html', |
| 423 | controller: 'focaModalDomicilioController', | 440 | controller: 'focaModalDomicilioController', |
| 424 | resolve: { idCliente: function() { return cliente.cod; }}, | 441 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 425 | size: 'lg', | 442 | size: 'lg', |
| 426 | } | 443 | } |
| 427 | ); | 444 | ); |
| 428 | modalInstanceDomicilio.result.then( | 445 | modalInstanceDomicilio.result.then( |
| 429 | function(domicilio) { | 446 | function(domicilio) { |
| 430 | $scope.notaPedido.domicilio = domicilio; | 447 | $scope.notaPedido.domicilio = domicilio; |
| 431 | $scope.notaPedido.cliente = { | 448 | $scope.notaPedido.cliente = { |
| 432 | COD: cliente.cod, | 449 | COD: cliente.cod, |
| 433 | CUIT: cliente.cuit, | 450 | CUIT: cliente.cuit, |
| 434 | NOM: cliente.nom | 451 | NOM: cliente.nom |
| 435 | }; | 452 | }; |
| 436 | var domicilioStamp = | 453 | var domicilioStamp = |
| 437 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 454 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
| 438 | domicilio.Localidad + ', ' + domicilio.Provincia; | 455 | domicilio.Localidad + ', ' + domicilio.Provincia; |
| 439 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 456 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
| 440 | 457 | ||
| 441 | $scope.$broadcast('addCabecera', { | 458 | $scope.$broadcast('addCabecera', { |
| 442 | label: 'Cliente:', | 459 | label: 'Cliente:', |
| 443 | valor: cliente.nom | 460 | valor: cliente.nom |
| 444 | }); | 461 | }); |
| 445 | $scope.$broadcast('addCabecera', { | 462 | $scope.$broadcast('addCabecera', { |
| 446 | label: 'Domicilio:', | 463 | label: 'Domicilio:', |
| 447 | valor: domicilioStamp | 464 | valor: domicilioStamp |
| 448 | }); | 465 | }); |
| 449 | }, function() { | 466 | }, function() { |
| 450 | $scope.seleccionarCliente(); | 467 | $scope.seleccionarCliente(); |
| 451 | return; | 468 | return; |
| 452 | } | 469 | } |
| 453 | ); | 470 | ); |
| 454 | }; | 471 | }; |
| 455 | 472 | ||
| 456 | $scope.getTotal = function() { | 473 | $scope.getTotal = function() { |
| 457 | var total = 0; | 474 | var total = 0; |
| 458 | var arrayTempArticulos = $scope.articulosTabla; | 475 | var arrayTempArticulos = $scope.articulosTabla; |
| 459 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 476 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 460 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 477 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 461 | } | 478 | } |
| 462 | return parseFloat(total.toFixed(2)); | 479 | return parseFloat(total.toFixed(2)); |
| 463 | }; | 480 | }; |
| 464 | 481 | ||
| 465 | $scope.getSubTotal = function() { | 482 | $scope.getSubTotal = function() { |
| 466 | if($scope.articuloACargar) { | 483 | if($scope.articuloACargar) { |
| 467 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 484 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 468 | } | 485 | } |
| 469 | }; | 486 | }; |
| 470 | 487 | ||
| 471 | $scope.seleccionarPreciosYCondiciones = function() { | 488 | $scope.seleccionarPreciosYCondiciones = function() { |
| 472 | if(validarNotaRemitada()) { | 489 | if(validarNotaRemitada()) { |
| 473 | var modalInstance = $uibModal.open( | 490 | var modalInstance = $uibModal.open( |
| 474 | { | 491 | { |
| 475 | ariaLabelledBy: 'Busqueda de Precio Condición', | 492 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 476 | templateUrl: 'modal-precio-condicion.html', | 493 | templateUrl: 'modal-precio-condicion.html', |
| 477 | controller: 'focaModalPrecioCondicionController', | 494 | controller: 'focaModalPrecioCondicionController', |
| 478 | size: 'lg' | 495 | size: 'lg' |
| 479 | } | 496 | } |
| 480 | ); | 497 | ); |
| 481 | modalInstance.result.then( | 498 | modalInstance.result.then( |
| 482 | function(precioCondicion) { | 499 | function(precioCondicion) { |
| 483 | var cabecera = ''; | 500 | var cabecera = ''; |
| 484 | var plazosConcat = ''; | 501 | var plazosConcat = ''; |
| 485 | if(!Array.isArray(precioCondicion)) { | 502 | if(!Array.isArray(precioCondicion)) { |
| 486 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 503 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
| 487 | $scope.plazosPagos = precioCondicion.plazoPago; | 504 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 488 | $scope.idLista = precioCondicion.idListaPrecio; | 505 | $scope.idLista = precioCondicion.idListaPrecio; |
| 489 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 506 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 490 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 507 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 491 | } | 508 | } |
| 492 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 509 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 493 | } else { //Cuando se ingresan los plazos manualmente | 510 | } else { //Cuando se ingresan los plazos manualmente |
| 494 | $scope.notaPedido.idPrecioCondicion = 0; | 511 | $scope.notaPedido.idPrecioCondicion = 0; |
| 495 | //-1, el modal productos busca todos los productos | 512 | //-1, el modal productos busca todos los productos |
| 496 | $scope.idLista = -1; | 513 | $scope.idLista = -1; |
| 497 | $scope.plazosPagos = precioCondicion; | 514 | $scope.plazosPagos = precioCondicion; |
| 498 | for(var j = 0; j < precioCondicion.length; j++) { | 515 | for(var j = 0; j < precioCondicion.length; j++) { |
| 499 | plazosConcat += precioCondicion[j].dias + ' '; | 516 | plazosConcat += precioCondicion[j].dias + ' '; |
| 500 | } | 517 | } |
| 501 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 518 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 502 | } | 519 | } |
| 503 | $scope.articulosTabla = []; | 520 | $scope.articulosTabla = []; |
| 504 | $scope.$broadcast('addCabecera', { | 521 | $scope.$broadcast('addCabecera', { |
| 505 | label: 'Precios y condiciones:', | 522 | label: 'Precios y condiciones:', |
| 506 | valor: cabecera | 523 | valor: cabecera |
| 507 | }); | 524 | }); |
| 508 | }, function() { | 525 | }, function() { |
| 509 | 526 | ||
| 510 | } | 527 | } |
| 511 | ); | 528 | ); |
| 512 | } | 529 | } |
| 513 | }; | 530 | }; |
| 514 | 531 | ||
| 515 | $scope.seleccionarFlete = function() { | 532 | $scope.seleccionarFlete = function() { |
| 516 | if(validarNotaRemitada()) { | 533 | if(validarNotaRemitada()) { |
| 517 | var modalInstance = $uibModal.open( | 534 | var modalInstance = $uibModal.open( |
| 518 | { | 535 | { |
| 519 | ariaLabelledBy: 'Busqueda de Flete', | 536 | ariaLabelledBy: 'Busqueda de Flete', |
| 520 | templateUrl: 'modal-flete.html', | 537 | templateUrl: 'modal-flete.html', |
| 521 | controller: 'focaModalFleteController', | 538 | controller: 'focaModalFleteController', |
| 522 | size: 'lg', | 539 | size: 'lg', |
| 523 | resolve: { | 540 | resolve: { |
| 524 | parametrosFlete: | 541 | parametrosFlete: |
| 525 | function() { | 542 | function() { |
| 526 | return { | 543 | return { |
| 527 | flete: $scope.notaPedido.fob ? 'FOB' : | 544 | flete: $scope.notaPedido.fob ? 'FOB' : |
| 528 | ( $scope.notaPedido.flete ? '1' : | 545 | ( $scope.notaPedido.flete ? '1' : |
| 529 | ($scope.notaPedido.flete === undefined ? | 546 | ($scope.notaPedido.flete === undefined ? |
| 530 | null : '0')), | 547 | null : '0')), |
| 531 | bomba: $scope.notaPedido.bomba ? '1' : | 548 | bomba: $scope.notaPedido.bomba ? '1' : |
| 532 | ($scope.notaPedido.bomba === undefined ? | 549 | ($scope.notaPedido.bomba === undefined ? |
| 533 | null : '0'), | 550 | null : '0'), |
| 534 | kilometros: $scope.notaPedido.kilometros | 551 | kilometros: $scope.notaPedido.kilometros |
| 535 | }; | 552 | }; |
| 536 | } | 553 | } |
| 537 | } | 554 | } |
| 538 | } | 555 | } |
| 539 | ); | 556 | ); |
| 540 | modalInstance.result.then( | 557 | modalInstance.result.then( |
| 541 | function(datos) { | 558 | function(datos) { |
| 542 | $scope.notaPedido.flete = datos.flete; | 559 | $scope.notaPedido.flete = datos.flete; |
| 543 | $scope.notaPedido.fob = datos.FOB; | 560 | $scope.notaPedido.fob = datos.FOB; |
| 544 | $scope.notaPedido.bomba = datos.bomba; | 561 | $scope.notaPedido.bomba = datos.bomba; |
| 545 | $scope.notaPedido.kilometros = datos.kilometros; | 562 | $scope.notaPedido.kilometros = datos.kilometros; |
| 546 | $scope.$broadcast('addCabecera', { | 563 | $scope.$broadcast('addCabecera', { |
| 547 | label: 'Flete:', | 564 | label: 'Flete:', |
| 548 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') | 565 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') |
| 549 | }); | 566 | }); |
| 550 | if(datos.flete) { | 567 | if(datos.flete) { |
| 551 | $scope.$broadcast('addCabecera', { | 568 | $scope.$broadcast('addCabecera', { |
| 552 | label: 'Bomba:', | 569 | label: 'Bomba:', |
| 553 | valor: datos.bomba ? 'Si' : 'No' | 570 | valor: datos.bomba ? 'Si' : 'No' |
| 554 | }); | 571 | }); |
| 555 | $scope.$broadcast('addCabecera', { | 572 | $scope.$broadcast('addCabecera', { |
| 556 | label: 'Kilometros:', | 573 | label: 'Kilometros:', |
| 557 | valor: datos.kilometros | 574 | valor: datos.kilometros |
| 558 | }); | 575 | }); |
| 559 | } else { | 576 | } else { |
| 560 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 577 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 561 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 578 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 562 | $scope.notaPedido.bomba = false; | 579 | $scope.notaPedido.bomba = false; |
| 563 | $scope.notaPedido.kilometros = null; | 580 | $scope.notaPedido.kilometros = null; |
| 564 | } | 581 | } |
| 565 | }, function() { | 582 | }, function() { |
| 566 | 583 | ||
| 567 | } | 584 | } |
| 568 | ); | 585 | ); |
| 569 | } | 586 | } |
| 570 | }; | 587 | }; |
| 571 | 588 | ||
| 572 | $scope.seleccionarMoneda = function() { | 589 | $scope.seleccionarMoneda = function() { |
| 573 | if(validarNotaRemitada()) { | 590 | if(validarNotaRemitada()) { |
| 574 | var modalInstance = $uibModal.open( | 591 | var modalInstance = $uibModal.open( |
| 575 | { | 592 | { |
| 576 | ariaLabelledBy: 'Busqueda de Moneda', | 593 | ariaLabelledBy: 'Busqueda de Moneda', |
| 577 | templateUrl: 'modal-moneda.html', | 594 | templateUrl: 'modal-moneda.html', |
| 578 | controller: 'focaModalMonedaController', | 595 | controller: 'focaModalMonedaController', |
| 579 | size: 'lg' | 596 | size: 'lg' |
| 580 | } | 597 | } |
| 581 | ); | 598 | ); |
| 582 | modalInstance.result.then( | 599 | modalInstance.result.then( |
| 583 | function(moneda) { | 600 | function(moneda) { |
| 584 | $scope.abrirModalCotizacion(moneda); | 601 | $scope.abrirModalCotizacion(moneda); |
| 585 | }, function() { | 602 | }, function() { |
| 586 | 603 | ||
| 587 | } | 604 | } |
| 588 | ); | 605 | ); |
| 589 | } | 606 | } |
| 590 | }; | 607 | }; |
| 591 | 608 | ||
| 592 | $scope.abrirModalCotizacion = function(moneda) { | 609 | $scope.abrirModalCotizacion = function(moneda) { |
| 593 | var modalInstance = $uibModal.open( | 610 | var modalInstance = $uibModal.open( |
| 594 | { | 611 | { |
| 595 | ariaLabelledBy: 'Busqueda de Cotización', | 612 | ariaLabelledBy: 'Busqueda de Cotización', |
| 596 | templateUrl: 'modal-cotizacion.html', | 613 | templateUrl: 'modal-cotizacion.html', |
| 597 | controller: 'focaModalCotizacionController', | 614 | controller: 'focaModalCotizacionController', |
| 598 | size: 'lg', | 615 | size: 'lg', |
| 599 | resolve: {idMoneda: function() {return moneda.ID;}} | 616 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 600 | } | 617 | } |
| 601 | ); | 618 | ); |
| 602 | modalInstance.result.then( | 619 | modalInstance.result.then( |
| 603 | function(cotizacion) { | 620 | function(cotizacion) { |
| 604 | var articulosTablaTemp = $scope.articulosTabla; | 621 | var articulosTablaTemp = $scope.articulosTabla; |
| 605 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 622 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 606 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 623 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 607 | $scope.notaPedido.cotizacion.VENDEDOR; | 624 | $scope.notaPedido.cotizacion.VENDEDOR; |
| 608 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 625 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 609 | cotizacion.VENDEDOR; | 626 | cotizacion.VENDEDOR; |
| 610 | } | 627 | } |
| 611 | $scope.articulosTabla = articulosTablaTemp; | 628 | $scope.articulosTabla = articulosTablaTemp; |
| 612 | $scope.notaPedido.moneda = moneda; | 629 | $scope.notaPedido.moneda = moneda; |
| 613 | $scope.notaPedido.cotizacion = cotizacion; | 630 | $scope.notaPedido.cotizacion = cotizacion; |
| 614 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 631 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
| 615 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 632 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
| 616 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 633 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
| 617 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 634 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 618 | }else { | 635 | }else { |
| 619 | $scope.$broadcast('addCabecera', { | 636 | $scope.$broadcast('addCabecera', { |
| 620 | label: 'Moneda:', | 637 | label: 'Moneda:', |
| 621 | valor: moneda.DETALLE | 638 | valor: moneda.DETALLE |
| 622 | }); | 639 | }); |
| 623 | $scope.$broadcast('addCabecera', { | 640 | $scope.$broadcast('addCabecera', { |
| 624 | label: 'Fecha cotizacion:', | 641 | label: 'Fecha cotizacion:', |
| 625 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 642 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 626 | }); | 643 | }); |
| 627 | $scope.$broadcast('addCabecera', { | 644 | $scope.$broadcast('addCabecera', { |
| 628 | label: 'Cotizacion:', | 645 | label: 'Cotizacion:', |
| 629 | valor: cotizacion.VENDEDOR | 646 | valor: cotizacion.VENDEDOR |
| 630 | }); | 647 | }); |
| 631 | } | 648 | } |
| 632 | }, function() { | 649 | }, function() { |
| 633 | 650 | ||
| 634 | } | 651 | } |
| 635 | ); | 652 | ); |
| 636 | }; | 653 | }; |
| 637 | 654 | ||
| 638 | $scope.agregarATabla = function(key) { | 655 | $scope.agregarATabla = function(key) { |
| 639 | if(key === 13) { | 656 | if(key === 13) { |
| 640 | if($scope.articuloACargar.cantidad === undefined || | 657 | if($scope.articuloACargar.cantidad === undefined || |
| 641 | $scope.articuloACargar.cantidad === 0 || | 658 | $scope.articuloACargar.cantidad === 0 || |
| 642 | $scope.articuloACargar.cantidad === null ) { | 659 | $scope.articuloACargar.cantidad === null ) { |
| 643 | focaModalService.alert('El valor debe ser al menos 1'); | 660 | focaModalService.alert('El valor debe ser al menos 1'); |
| 644 | return; | 661 | return; |
| 645 | } | 662 | } |
| 646 | delete $scope.articuloACargar.sectorCodigo; | 663 | delete $scope.articuloACargar.sectorCodigo; |
| 647 | $scope.articulosTabla.push($scope.articuloACargar); | 664 | $scope.articulosTabla.push($scope.articuloACargar); |
| 648 | $scope.cargando = true; | 665 | $scope.cargando = true; |
| 649 | } | 666 | } |
| 650 | }; | 667 | }; |
| 651 | 668 | ||
| 652 | $scope.quitarArticulo = function(key) { | 669 | $scope.quitarArticulo = function(key) { |
| 653 | $scope.articulosTabla.splice(key, 1); | 670 | $scope.articulosTabla.splice(key, 1); |
| 654 | }; | 671 | }; |
| 655 | 672 | ||
| 656 | $scope.editarArticulo = function(key, articulo) { | 673 | $scope.editarArticulo = function(key, articulo) { |
| 657 | if(key === 13) { | 674 | if(key === 13) { |
| 658 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 675 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 659 | articulo.cantidad === undefined) { | 676 | articulo.cantidad === undefined) { |
| 660 | focaModalService.alert('El valor debe ser al menos 1'); | 677 | focaModalService.alert('El valor debe ser al menos 1'); |
| 661 | return; | 678 | return; |
| 662 | } | 679 | } |
| 663 | articulo.editCantidad = false; | 680 | articulo.editCantidad = false; |
| 664 | articulo.editPrecio = false; | 681 | articulo.editPrecio = false; |
| 665 | } | 682 | } |
| 666 | }; | 683 | }; |
| 667 | 684 | ||
| 668 | $scope.cambioEdit = function(articulo, propiedad) { | 685 | $scope.cambioEdit = function(articulo, propiedad) { |
| 669 | if(propiedad === 'cantidad') { | 686 | if(propiedad === 'cantidad') { |
| 670 | articulo.editCantidad = true; | 687 | articulo.editCantidad = true; |
| 671 | } else if(propiedad === 'precio') { | 688 | } else if(propiedad === 'precio') { |
| 672 | articulo.editPrecio = true; | 689 | articulo.editPrecio = true; |
| 673 | } | 690 | } |
| 674 | }; | 691 | }; |
| 675 | 692 | ||
| 676 | $scope.resetFilter = function() { | 693 | $scope.resetFilter = function() { |
| 677 | $scope.articuloACargar = {}; | 694 | $scope.articuloACargar = {}; |
| 678 | $scope.cargando = true; | 695 | $scope.cargando = true; |
| 679 | }; | 696 | }; |
| 680 | //Recibe aviso si el teclado está en uso | 697 | //Recibe aviso si el teclado está en uso |
| 681 | $rootScope.$on('usarTeclado', function(event, data) { | 698 | $rootScope.$on('usarTeclado', function(event, data) { |
| 682 | if(data) { | 699 | if(data) { |
| 683 | $scope.mostrarTeclado = true; | 700 | $scope.mostrarTeclado = true; |
| 684 | return; | 701 | return; |
| 685 | } | 702 | } |
| 686 | $scope.mostrarTeclado = false; | 703 | $scope.mostrarTeclado = false; |
| 687 | }); | 704 | }); |
| 688 | 705 | ||
| 689 | $scope.selectFocus = function($event) { | 706 | $scope.selectFocus = function($event) { |
| 690 | // Si el teclado esta en uso no selecciona el valor | 707 | // Si el teclado esta en uso no selecciona el valor |
| 691 | if($scope.mostrarTeclado) { | 708 | if($scope.mostrarTeclado) { |
| 692 | return; | 709 | return; |
| 693 | } | 710 | } |
| 694 | $event.target.select(); | 711 | $event.target.select(); |
| 695 | }; | 712 | }; |
| 696 | 713 | ||
| 697 | $scope.salir = function() { | 714 | $scope.salir = function() { |
| 698 | $location.path('/'); | 715 | $location.path('/'); |
| 699 | }; | 716 | }; |
| 700 | 717 | ||
| 701 | $scope.parsearATexto = function(articulo) { | 718 | $scope.parsearATexto = function(articulo) { |
| 702 | articulo.cantidad = parseFloat(articulo.cantidad); | 719 | articulo.cantidad = parseFloat(articulo.cantidad); |
| 703 | articulo.precio = parseFloat(articulo.precio); | 720 | articulo.precio = parseFloat(articulo.precio); |
| 704 | }; | 721 | }; |
| 705 | 722 | ||
| 706 | function addArrayCabecera(array) { | 723 | function addArrayCabecera(array) { |
| 707 | for(var i = 0; i < array.length; i++) { | 724 | for(var i = 0; i < array.length; i++) { |
| 708 | $scope.$broadcast('addCabecera', { | 725 | $scope.$broadcast('addCabecera', { |
| 709 | label: array[i].label, | 726 | label: array[i].label, |
| 710 | valor: array[i].valor | 727 | valor: array[i].valor |
| 711 | }); | 728 | }); |
| 712 | } | 729 | } |
| 713 | } | 730 | } |
| 714 | 731 | ||
| 715 | function rellenar(relleno, longitud) { | 732 | function rellenar(relleno, longitud) { |
| 716 | relleno = '' + relleno; | 733 | relleno = '' + relleno; |
| 717 | while (relleno.length < longitud) { | 734 | while (relleno.length < longitud) { |
| 718 | relleno = '0' + relleno; | 735 | relleno = '0' + relleno; |
| 719 | } | 736 | } |
| 720 | 737 | ||
| 721 | return relleno; | 738 | return relleno; |
| 722 | } | 739 | } |
| 723 | 740 | ||
| 724 | function validarNotaRemitada() { | 741 | function validarNotaRemitada() { |
| 725 | if(!$scope.notaPedido.idRemito) { | 742 | if(!$scope.notaPedido.idRemito) { |
| 726 | return true; | 743 | return true; |
| 727 | }else{ | 744 | }else{ |
| 728 | focaModalService.alert('No se puede editar una nota de pedido remitada'); | 745 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
| 729 | return false; | 746 | return false; |
| 730 | } | 747 | } |
| 731 | } | 748 | } |
| 732 | } | 749 | } |
| 733 | ]); | 750 | ]); |
| 734 | 751 |
src/views/nota-pedido.html
| 1 | <div class="crear-nota-pedido foca-crear row"> | 1 | <div class="crear-nota-pedido foca-crear row"> |
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
| 3 | titulo="'NOTA DE PEDIDO'" | 3 | titulo="'Nota de pedido'" |
| 4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
| 5 | fecha="now" | 5 | fecha="now" |
| 6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
| 7 | busqueda="seleccionarNotaPedido" | 7 | busqueda="seleccionarNotaPedido" |
| 8 | ></foca-cabecera-facturador> | 8 | ></foca-cabecera-facturador> |
| 9 | <div class="col-lg-12"> | 9 | <div class="col-lg-12"> |
| 10 | <div class="row mt-4"> | 10 | <div class="row mt-4"> |
| 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> | 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
| 12 | <div class="row px-5 py-2 botonera-secundaria"> | 12 | <div class="row px-5 py-2 botonera-secundaria"> |
| 13 | <div class="col-12"> | 13 | <div class="col-12"> |
| 14 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> |
| 15 | </div> | 15 | </div> |
| 16 | </div> | 16 | </div> |
| 17 | <!-- PC --> | 17 | <!-- PC --> |
| 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
| 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
| 20 | <thead> | 20 | <thead> |
| 21 | <tr class="d-flex"> | 21 | <tr class="d-flex"> |
| 22 | <th valign="middle" class="">#</th> | 22 | <th valign="middle" class="">#</th> |
| 23 | <th valign="middle" class="col">Código</th> | 23 | <th valign="middle" class="col">Código</th> |
| 24 | <th valign="middle" class="col-4">Descripción</th> | 24 | <th valign="middle" class="col-4">Descripción</th> |
| 25 | <th valign="middle" class="col text-right">Cantidad</th> | 25 | <th valign="middle" class="col text-right">Cantidad</th> |
| 26 | <th valign="middle" class="col text-right">Precio Unitario</th> | 26 | <th valign="middle" class="col text-right">Precio Unitario</th> |
| 27 | <th valign="middle" class="col text-right">SubTotal</th> | 27 | <th valign="middle" class="col text-right">SubTotal</th> |
| 28 | <th valign="middle" class="text-right"> | 28 | <th valign="middle" class="text-right"> |
| 29 | <button | 29 | <button |
| 30 | class="btn btn-outline-light selectable" | 30 | class="btn btn-outline-light selectable" |
| 31 | ng-click="show = !show; masMenos()" | 31 | ng-click="show = !show; masMenos()" |
| 32 | > | 32 | > |
| 33 | <i | 33 | <i |
| 34 | class="fa fa-chevron-down" | 34 | class="fa fa-chevron-down" |
| 35 | ng-show="show" | 35 | ng-show="show" |
| 36 | aria-hidden="true" | 36 | aria-hidden="true" |
| 37 | > | 37 | > |
| 38 | </i> | 38 | </i> |
| 39 | <i | 39 | <i |
| 40 | class="fa fa-chevron-up" | 40 | class="fa fa-chevron-up" |
| 41 | ng-hide="show" | 41 | ng-hide="show" |
| 42 | aria-hidden="true"> | 42 | aria-hidden="true"> |
| 43 | </i> | 43 | </i> |
| 44 | </button> | 44 | </button> |
| 45 | </th> | 45 | </th> |
| 46 | </tr> | 46 | </tr> |
| 47 | </thead> | 47 | </thead> |
| 48 | <tbody class="tabla-articulo-body"> | 48 | <tbody class="tabla-articulo-body"> |
| 49 | <tr | 49 | <tr |
| 50 | ng-repeat="(key, articulo) in articulosTabla" | 50 | ng-repeat="(key, articulo) in articulosTabla" |
| 51 | ng-show="show || key == (articulosTabla.length - 1)" | 51 | ng-show="show || key == (articulosTabla.length - 1)" |
| 52 | class="d-flex" | 52 | class="d-flex" |
| 53 | > | 53 | > |
| 54 | <td ng-bind="key + 1"></td> | 54 | <td ng-bind="key + 1"></td> |
| 55 | <td | 55 | <td |
| 56 | class="col" | 56 | class="col" |
| 57 | ng-bind="articulo.sector + '-' + articulo.codigo" | 57 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 58 | ></td> | 58 | ></td> |
| 59 | <td | 59 | <td |
| 60 | class="col-4" | 60 | class="col-4" |
| 61 | ng-bind="articulo.descripcion" | 61 | ng-bind="articulo.descripcion" |
| 62 | ></td> | 62 | ></td> |
| 63 | <td class="col text-right"> | 63 | <td class="col text-right"> |
| 64 | <input | 64 | <input |
| 65 | ng-show="articulo.editCantidad" | 65 | ng-show="articulo.editCantidad" |
| 66 | ng-model="articulo.cantidad" | 66 | ng-model="articulo.cantidad" |
| 67 | class="form-control" | 67 | class="form-control" |
| 68 | foca-tipo-input | 68 | foca-tipo-input |
| 69 | min="1" | 69 | min="1" |
| 70 | step="0.001" | 70 | step="0.001" |
| 71 | foca-focus="articulo.editCantidad" | 71 | foca-focus="articulo.editCantidad" |
| 72 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 72 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 73 | ng-focus="selectFocus($event)" | 73 | ng-focus="selectFocus($event)" |
| 74 | teclado-virtual | 74 | teclado-virtual |
| 75 | > | 75 | > |
| 76 | <i | 76 | <i |
| 77 | class="selectable" | 77 | class="selectable" |
| 78 | ng-click="cambioEdit(articulo, 'cantidad')" | 78 | ng-click="cambioEdit(articulo, 'cantidad')" |
| 79 | ng-hide="articulo.editCantidad" | 79 | ng-hide="articulo.editCantidad" |
| 80 | ng-bind="articulo.cantidad"> | 80 | ng-bind="articulo.cantidad"> |
| 81 | </i> | 81 | </i> |
| 82 | </td> | 82 | </td> |
| 83 | <td class="col text-right"> | 83 | <td class="col text-right"> |
| 84 | <input | 84 | <input |
| 85 | ng-show="articulo.editPrecio" | 85 | ng-show="articulo.editPrecio" |
| 86 | ng-model="articulo.precio" | 86 | ng-model="articulo.precio" |
| 87 | class="form-control" | 87 | class="form-control" |
| 88 | foca-tipo-input | 88 | foca-tipo-input |
| 89 | min="0" | 89 | min="0" |
| 90 | step="0.0001" | 90 | step="0.0001" |
| 91 | foca-focus="articulo.editPrecio" | 91 | foca-focus="articulo.editPrecio" |
| 92 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 92 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 93 | ng-focus="selectFocus($event)" | 93 | ng-focus="selectFocus($event)" |
| 94 | teclado-virtual | 94 | teclado-virtual |
| 95 | > | 95 | > |
| 96 | <i | 96 | <i |
| 97 | class="selectable" | 97 | class="selectable" |
| 98 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 98 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
| 99 | ng-hide="articulo.editPrecio" | 99 | ng-hide="articulo.editPrecio" |
| 100 | ng-bind="articulo.precio | | 100 | ng-bind="articulo.precio | |
| 101 | currency: notaPedido.moneda.SIMBOLO : 4"> | 101 | currency: notaPedido.moneda.SIMBOLO : 4"> |
| 102 | </i> | 102 | </i> |
| 103 | </td> | 103 | </td> |
| 104 | <td | 104 | <td |
| 105 | class="col text-right" | 105 | class="col text-right" |
| 106 | ng-bind="(articulo.precio * articulo.cantidad) | | 106 | ng-bind="(articulo.precio * articulo.cantidad) | |
| 107 | currency: notaPedido.moneda.SIMBOLO"> | 107 | currency: notaPedido.moneda.SIMBOLO"> |
| 108 | </td> | 108 | </td> |
| 109 | <td class="text-center"> | 109 | <td class="text-center"> |
| 110 | <button | 110 | <button |
| 111 | ng-show="articulo.editCantidad || articulo.editPrecio" | 111 | ng-show="articulo.editCantidad || articulo.editPrecio" |
| 112 | class="btn btn-outline-light" | 112 | class="btn btn-outline-light" |
| 113 | ng-click="editarArticulo(13, articulo)" | 113 | ng-click="editarArticulo(13, articulo)" |
| 114 | > | 114 | > |
| 115 | <i class="fa fa-save"></i> | 115 | <i class="fa fa-save"></i> |
| 116 | </button> | 116 | </button> |
| 117 | <button | 117 | <button |
| 118 | class="btn btn-outline-light" | 118 | class="btn btn-outline-light" |
| 119 | ng-click="quitarArticulo(key)" | 119 | ng-click="quitarArticulo(key)" |
| 120 | > | 120 | > |
| 121 | <i class="fa fa-trash"></i> | 121 | <i class="fa fa-trash"></i> |
| 122 | </button> | 122 | </button> |
| 123 | </td> | 123 | </td> |
| 124 | </tr> | 124 | </tr> |
| 125 | </tbody> | 125 | </tbody> |
| 126 | <tfoot> | 126 | <tfoot> |
| 127 | <tr ng-show="!cargando" class="d-flex"> | 127 | <tr ng-show="!cargando" class="d-flex"> |
| 128 | <td | 128 | <td |
| 129 | class="align-middle" | 129 | class="align-middle" |
| 130 | ng-bind="articulosTabla.length + 1" | 130 | ng-bind="articulosTabla.length + 1" |
| 131 | ></td> | 131 | ></td> |
| 132 | <td class="col"> | 132 | <td class="col"> |
| 133 | <input | 133 | <input |
| 134 | class="form-control" | 134 | class="form-control" |
| 135 | ng-model="articuloACargar.sectorCodigo" | 135 | ng-model="articuloACargar.sectorCodigo" |
| 136 | readonly | 136 | readonly |
| 137 | > | 137 | > |
| 138 | </td> | 138 | </td> |
| 139 | <td class="col-4 tabla-articulo-descripcion"> | 139 | <td class="col-4 tabla-articulo-descripcion"> |
| 140 | <input | 140 | <input |
| 141 | class="form-control" | 141 | class="form-control" |
| 142 | ng-model="articuloACargar.descripcion" | 142 | ng-model="articuloACargar.descripcion" |
| 143 | readonly | 143 | readonly |
| 144 | > | 144 | > |
| 145 | </td> | 145 | </td> |
| 146 | <td class="col text-right"> | 146 | <td class="col text-right"> |
| 147 | <input | 147 | <input |
| 148 | class="form-control" | 148 | class="form-control" |
| 149 | foca-tipo-input | 149 | foca-tipo-input |
| 150 | min="1" | 150 | min="1" |
| 151 | step="0.001" | 151 | step="0.001" |
| 152 | ng-model="articuloACargar.cantidad" | 152 | ng-model="articuloACargar.cantidad" |
| 153 | foca-focus="!cargando" | 153 | foca-focus="!cargando" |
| 154 | esc-key="resetFilter()" | 154 | esc-key="resetFilter()" |
| 155 | ng-keypress="agregarATabla($event.keyCode)" | 155 | ng-keypress="agregarATabla($event.keyCode)" |
| 156 | teclado-virtual | 156 | teclado-virtual |
| 157 | > | 157 | > |
| 158 | </td> | 158 | </td> |
| 159 | <td class="col text-right"> | 159 | <td class="col text-right"> |
| 160 | <input | 160 | <input |
| 161 | class="form-control" | 161 | class="form-control" |
| 162 | ng-value="articuloACargar.precio | | 162 | ng-value="articuloACargar.precio | |
| 163 | currency: notaPedido.moneda.SIMBOLO : 4" | 163 | currency: notaPedido.moneda.SIMBOLO : 4" |
| 164 | ng-show="idLista != -1" | 164 | ng-show="idLista != -1" |
| 165 | readonly | 165 | readonly |
| 166 | > | 166 | > |
| 167 | <input | 167 | <input |
| 168 | class="form-control" | 168 | class="form-control" |
| 169 | foca-tipo-input | 169 | foca-tipo-input |
| 170 | min="0" | 170 | min="0" |
| 171 | step="0.0001" | 171 | step="0.0001" |
| 172 | ng-model="articuloACargar.precio" | 172 | ng-model="articuloACargar.precio" |
| 173 | esc-key="resetFilter()" | 173 | esc-key="resetFilter()" |
| 174 | ng-keypress="agregarATabla($event.keyCode)" | 174 | ng-keypress="agregarATabla($event.keyCode)" |
| 175 | ng-show="idLista == -1" | 175 | ng-show="idLista == -1" |
| 176 | teclado-virtual | 176 | teclado-virtual |
| 177 | > | 177 | > |
| 178 | </td> | 178 | </td> |
| 179 | <td class="col text-right"> | 179 | <td class="col text-right"> |
| 180 | <input | 180 | <input |
| 181 | class="form-control" | 181 | class="form-control" |
| 182 | ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO" | 182 | ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO" |
| 183 | readonly | 183 | readonly |
| 184 | ></td> | 184 | ></td> |
| 185 | <td class="text-center align-middle"> | 185 | <td class="text-center align-middle"> |
| 186 | <button | 186 | <button |
| 187 | class="btn btn-outline-light" | 187 | class="btn btn-outline-light" |
| 188 | ng-click="agregarATabla(13)" | 188 | ng-click="agregarATabla(13)" |
| 189 | > | 189 | > |
| 190 | <i class="fa fa-save"></i> | 190 | <i class="fa fa-save"></i> |
| 191 | </button> | 191 | </button> |
| 192 | </td> | 192 | </td> |
| 193 | </tr> | 193 | </tr> |
| 194 | <tr class="d-flex"> | 194 | <tr class="d-flex"> |
| 195 | <td colspan="4" class="no-border-top"> | 195 | <td colspan="4" class="no-border-top"> |
| 196 | <strong>Items:</strong> | 196 | <strong>Items:</strong> |
| 197 | <a ng-bind="articulosTabla.length"></a> | 197 | <a ng-bind="articulosTabla.length"></a> |
| 198 | </td> | 198 | </td> |
| 199 | <td class="text-right ml-auto table-celda-total no-border-top"> | 199 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 200 | <h3>Total:</h3> | 200 | <h3>Total:</h3> |
| 201 | </td> | 201 | </td> |
| 202 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 202 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 203 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 203 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
| 204 | </td> | 204 | </td> |
| 205 | <td class="text-right no-border-top"> | 205 | <td class="text-right no-border-top"> |
| 206 | <button | 206 | <button |
| 207 | type="button" | 207 | type="button" |
| 208 | class="btn btn-default btn-sm" | 208 | class="btn btn-default btn-sm" |
| 209 | > | 209 | > |
| 210 | Totales | 210 | Totales |
| 211 | </button> | 211 | </button> |
| 212 | </td> | 212 | </td> |
| 213 | </tr> | 213 | </tr> |
| 214 | </tfoot> | 214 | </tfoot> |
| 215 | </table> | 215 | </table> |
| 216 | </div> | 216 | </div> |
| 217 | <!-- MOBILE --> | 217 | <!-- MOBILE --> |
| 218 | <div class="row d-sm-none"> | 218 | <div class="row d-sm-none"> |
| 219 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | 219 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> |
| 220 | <thead> | 220 | <thead> |
| 221 | <tr class="d-flex"> | 221 | <tr class="d-flex"> |
| 222 | <th class="">#</th> | 222 | <th class="">#</th> |
| 223 | <th class="col px-0"> | 223 | <th class="col px-0"> |
| 224 | <div class="d-flex"> | 224 | <div class="d-flex"> |
| 225 | <div class="col-4 px-1">Código</div> | 225 | <div class="col-4 px-1">Código</div> |
| 226 | <div class="col-8 px-1">Descripción</div> | 226 | <div class="col-8 px-1">Descripción</div> |
| 227 | </div> | 227 | </div> |
| 228 | <div class="d-flex"> | 228 | <div class="d-flex"> |
| 229 | <div class="col-3 px-1">Cantidad</div> | 229 | <div class="col-3 px-1">Cantidad</div> |
| 230 | <div class="col px-1 text-right">P. Uni.</div> | 230 | <div class="col px-1 text-right">P. Uni.</div> |
| 231 | <div class="col px-1 text-right">Subtotal</div> | 231 | <div class="col px-1 text-right">Subtotal</div> |
| 232 | </div> | 232 | </div> |
| 233 | </th> | 233 | </th> |
| 234 | <th class="text-center tamaño-boton"> | 234 | <th class="text-center tamaño-boton"> |
| 235 | | 235 | |
| 236 | </th> | 236 | </th> |
| 237 | </tr> | 237 | </tr> |
| 238 | </thead> | 238 | </thead> |
| 239 | <tbody> | 239 | <tbody> |
| 240 | <tr | 240 | <tr |
| 241 | ng-repeat="(key, articulo) in articulosTabla" | 241 | ng-repeat="(key, articulo) in articulosTabla" |
| 242 | ng-show="show || key == articulosTabla.length - 1" | 242 | ng-show="show || key == articulosTabla.length - 1" |
| 243 | > | 243 | > |
| 244 | <td class="w-100 align-middle d-flex p-0"> | 244 | <td class="w-100 align-middle d-flex p-0"> |
| 245 | <div class="align-middle p-1"> | 245 | <div class="align-middle p-1"> |
| 246 | <span ng-bind="key+1" class="align-middle"></span> | 246 | <span ng-bind="key+1" class="align-middle"></span> |
| 247 | </div> | 247 | </div> |
| 248 | <div class="col px-0"> | 248 | <div class="col px-0"> |
| 249 | <div class="d-flex"> | 249 | <div class="d-flex"> |
| 250 | <div class="col-4 px-1"> | 250 | <div class="col-4 px-1"> |
| 251 | <span | 251 | <span |
| 252 | ng-bind="articulo.sector + '-' + articulo.codigo" | 252 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 253 | ></span> | 253 | ></span> |
| 254 | </div> | 254 | </div> |
| 255 | <div class="col-8 px-1"> | 255 | <div class="col-8 px-1"> |
| 256 | <span ng-bind="articulo.descripcion"></span> | 256 | <span ng-bind="articulo.descripcion"></span> |
| 257 | </div> | 257 | </div> |
| 258 | </div> | 258 | </div> |
| 259 | <div class="d-flex"> | 259 | <div class="d-flex"> |
| 260 | <div class="col-3 px-1"> | 260 | <div class="col-3 px-1"> |
| 261 | <span | 261 | <span |
| 262 | ng-bind="'x' + articulo.cantidad" | 262 | ng-bind="'x' + articulo.cantidad" |
| 263 | ng-hide="articulo.editCantidad" | 263 | ng-hide="articulo.editCantidad" |
| 264 | ></span> | 264 | ></span> |
| 265 | <i | 265 | <i |
| 266 | class="fa fa-pencil text-white-50" | 266 | class="fa fa-pencil text-white-50" |
| 267 | aria-hidden="true" | 267 | aria-hidden="true" |
| 268 | ng-hide="articulo.editCantidad" | 268 | ng-hide="articulo.editCantidad" |
| 269 | ng-click="articulo.editCantidad = true" | 269 | ng-click="articulo.editCantidad = true" |
| 270 | ></i> | 270 | ></i> |
| 271 | <input | 271 | <input |
| 272 | ng-show="articulo.editCantidad" | 272 | ng-show="articulo.editCantidad" |
| 273 | ng-model="articulo.cantidad" | 273 | ng-model="articulo.cantidad" |
| 274 | class="form-control" | 274 | class="form-control" |
| 275 | foca-tipo-input | 275 | foca-tipo-input |
| 276 | min="1" | 276 | min="1" |
| 277 | step="0.001" | 277 | step="0.001" |
| 278 | foca-focus="articulo.editCantidad" | 278 | foca-focus="articulo.editCantidad" |
| 279 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 279 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 280 | ng-focus="selectFocus($event)" | 280 | ng-focus="selectFocus($event)" |
| 281 | > | 281 | > |
| 282 | </div> | 282 | </div> |
| 283 | <div class="col px-1 text-right"> | 283 | <div class="col px-1 text-right"> |
| 284 | <span ng-bind="articulo.precio | | 284 | <span ng-bind="articulo.precio | |
| 285 | currency: notaPedido.moneda.SIMBOLO : 4"></span> | 285 | currency: notaPedido.moneda.SIMBOLO : 4"></span> |
| 286 | ></span> | 286 | ></span> |
| 287 | </div> | 287 | </div> |
| 288 | <div class="col px-1 text-right"> | 288 | <div class="col px-1 text-right"> |
| 289 | <span | 289 | <span |
| 290 | ng-bind="(articulo.precio * articulo.cantidad) | | 290 | ng-bind="(articulo.precio * articulo.cantidad) | |
| 291 | currency: notaPedido.moneda.SIMBOLO" | 291 | currency: notaPedido.moneda.SIMBOLO" |
| 292 | > | 292 | > |
| 293 | </span> | 293 | </span> |
| 294 | </div> | 294 | </div> |
| 295 | </div> | 295 | </div> |
| 296 | </div> | 296 | </div> |
| 297 | <div class="align-middle p-1"> | 297 | <div class="align-middle p-1"> |
| 298 | <button | 298 | <button |
| 299 | class="btn btn-outline-light" | 299 | class="btn btn-outline-light" |
| 300 | ng-click="quitarArticulo(key)" | 300 | ng-click="quitarArticulo(key)" |
| 301 | > | 301 | > |
| 302 | <i class="fa fa-trash"></i> | 302 | <i class="fa fa-trash"></i> |
| 303 | </button> | 303 | </button> |
| 304 | </div> | 304 | </div> |
| 305 | </td> | 305 | </td> |
| 306 | </tr> | 306 | </tr> |
| 307 | </tbody> | 307 | </tbody> |
| 308 | <tfoot> | 308 | <tfoot> |
| 309 | <!-- CARGANDO ITEM --> | 309 | <!-- CARGANDO ITEM --> |
| 310 | <tr ng-show="!cargando" class="d-flex"> | 310 | <tr ng-show="!cargando" class="d-flex"> |
| 311 | <td | 311 | <td |
| 312 | class="align-middle p-1" | 312 | class="align-middle p-1" |
| 313 | ng-bind="articulosTabla.length + 1" | 313 | ng-bind="articulosTabla.length + 1" |
| 314 | ></td> | 314 | ></td> |
| 315 | <td class="col p-0"> | 315 | <td class="col p-0"> |
| 316 | <div class="d-flex"> | 316 | <div class="d-flex"> |
| 317 | <div class="col-4 px-1"> | 317 | <div class="col-4 px-1"> |
| 318 | <span | 318 | <span |
| 319 | ng-bind="articuloACargar.sectorCodigo" | 319 | ng-bind="articuloACargar.sectorCodigo" |
| 320 | ></span> | 320 | ></span> |
| 321 | </div> | 321 | </div> |
| 322 | <div class="col-8 px-1"> | 322 | <div class="col-8 px-1"> |
| 323 | <span ng-bind="articuloACargar.descripcion"></span> | 323 | <span ng-bind="articuloACargar.descripcion"></span> |
| 324 | </div> | 324 | </div> |
| 325 | </div> | 325 | </div> |
| 326 | <div class="d-flex"> | 326 | <div class="d-flex"> |
| 327 | <div class="col-3 px-1 m-1"> | 327 | <div class="col-3 px-1 m-1"> |
| 328 | <input | 328 | <input |
| 329 | class="form-control p-1" | 329 | class="form-control p-1" |
| 330 | foca-tipo-input | 330 | foca-tipo-input |
| 331 | min="1" | 331 | min="1" |
| 332 | ng-model="articuloACargar.cantidad" | 332 | ng-model="articuloACargar.cantidad" |
| 333 | foca-focus="!cargando" | 333 | foca-focus="!cargando" |
| 334 | ng-keypress="agregarATabla($event.keyCode)" | 334 | ng-keypress="agregarATabla($event.keyCode)" |
| 335 | style="height: auto; line-height: 1.1em" | 335 | style="height: auto; line-height: 1.1em" |
| 336 | > | 336 | > |
| 337 | </div> | 337 | </div> |
| 338 | <div class="col px-1 text-right"> | 338 | <div class="col px-1 text-right"> |
| 339 | <span ng-bind="articuloACargar.precio | | 339 | <span ng-bind="articuloACargar.precio | |
| 340 | currency: notaPedido.moneda.SIMBOLO : 4" | 340 | currency: notaPedido.moneda.SIMBOLO : 4" |
| 341 | ></span> | 341 | ></span> |
| 342 | </div> | 342 | </div> |
| 343 | <div class="col px-1 text-right"> | 343 | <div class="col px-1 text-right"> |
| 344 | <span | 344 | <span |
| 345 | ng-bind="getSubTotal() | | 345 | ng-bind="getSubTotal() | |
| 346 | currency: notaPedido.moneda.SIMBOLO" | 346 | currency: notaPedido.moneda.SIMBOLO" |
| 347 | > | 347 | > |
| 348 | </span> | 348 | </span> |
| 349 | </div> | 349 | </div> |
| 350 | </div> | 350 | </div> |
| 351 | </td> | 351 | </td> |
| 352 | <td class="text-center align-middle"> | 352 | <td class="text-center align-middle"> |
| 353 | <button | 353 | <button |
| 354 | class="btn btn-outline-light" | 354 | class="btn btn-outline-light" |
| 355 | ng-click="agregarATabla(13)" | 355 | ng-click="agregarATabla(13)" |
| 356 | > | 356 | > |
| 357 | <i class="fa fa-save"></i> | 357 | <i class="fa fa-save"></i> |
| 358 | </button> | 358 | </button> |
| 359 | </td> | 359 | </td> |
| 360 | </tr> | 360 | </tr> |
| 361 | <!-- SELECCIONAR PRODUCTO --> | 361 | <!-- SELECCIONAR PRODUCTO --> |
| 362 | <tr ng-show="cargando" class="d-flex"> | 362 | <tr ng-show="cargando" class="d-flex"> |
| 363 | <td class="col-12"> | 363 | <td class="col-12"> |
| 364 | <input | 364 | <input |
| 365 | placeholder="Seleccione Articulo" | 365 | placeholder="Seleccione Articulo" |
| 366 | class="form-control form-control-sm" | 366 | class="form-control form-control-sm" |
| 367 | readonly | 367 | readonly |
| 368 | ng-click="seleccionarArticulo()" | 368 | ng-click="seleccionarArticulo()" |
| 369 | /> | 369 | /> |
| 370 | </td> | 370 | </td> |
| 371 | </tr> | 371 | </tr> |
| 372 | <!-- TOOGLE EXPANDIR --> | 372 | <!-- TOOGLE EXPANDIR --> |
| 373 | <tr> | 373 | <tr> |
| 374 | <td class="col"> | 374 | <td class="col"> |
| 375 | <button | 375 | <button |
| 376 | class="btn btn-outline-light selectable w-100" | 376 | class="btn btn-outline-light selectable w-100" |
| 377 | ng-click="show = !show; masMenos()" | 377 | ng-click="show = !show; masMenos()" |
| 378 | ng-show="articulosTabla.length > 0" | 378 | ng-show="articulosTabla.length > 0" |
| 379 | > | 379 | > |
| 380 | <i | 380 | <i |
| 381 | class="fa fa-chevron-down" | 381 | class="fa fa-chevron-down" |
| 382 | ng-hide="show" | 382 | ng-hide="show" |
| 383 | aria-hidden="true" | 383 | aria-hidden="true" |
| 384 | > | 384 | > |
| 385 | </i> | 385 | </i> |
| 386 | <i | 386 | <i |
| 387 | class="fa fa-chevron-up" | 387 | class="fa fa-chevron-up" |
| 388 | ng-show="show" | 388 | ng-show="show" |
| 389 | aria-hidden="true"> | 389 | aria-hidden="true"> |
| 390 | </i> | 390 | </i> |
| 391 | </button> | 391 | </button> |
| 392 | </td> | 392 | </td> |
| 393 | </tr> | 393 | </tr> |
| 394 | <!-- FOOTER --> | 394 | <!-- FOOTER --> |
| 395 | <tr class="d-flex"> | 395 | <tr class="d-flex"> |
| 396 | <td class="align-middle no-border-top" colspan="2"> | 396 | <td class="align-middle no-border-top" colspan="2"> |
| 397 | <strong>Cantidad Items:</strong> | 397 | <strong>Cantidad Items:</strong> |
| 398 | <a ng-bind="articulosTabla.length"></a> | 398 | <a ng-bind="articulosTabla.length"></a> |
| 399 | </td> | 399 | </td> |
| 400 | <td class="text-right ml-auto table-celda-total no-border-top"> | 400 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 401 | <h3>Total:</h3> | 401 | <h3>Total:</h3> |
| 402 | </td> | 402 | </td> |
| 403 | <td class="table-celda-total text-right no-border-top"> | 403 | <td class="table-celda-total text-right no-border-top"> |
| 404 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 404 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
| 405 | </td> | 405 | </td> |
| 406 | </tr> | 406 | </tr> |
| 407 | </tfoot> | 407 | </tfoot> |
| 408 | </table> | 408 | </table> |
| 409 | </div> | 409 | </div> |
| 410 | </div> | 410 | </div> |
| 411 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> | ||
| 412 | <div class="col-12 mt-auto"> | ||
| 413 | <button | ||
| 414 | ng-click="crearNotaPedido()" | ||
| 415 | type="submit" | ||
| 416 | title="Crear nota pedido" | ||
| 417 | class="btn btn-default btn-block mb-2 border border-dark" | ||
| 418 | ng-disabled="notaPedido.idRemito || saveLoading" | ||
| 419 | > | ||
| 420 | <strong>GUARDAR</strong> | ||
| 421 | </button> | ||
| 422 | <!-- AGREGAR FUNCIONALIDAD PAUSAR --> | ||
| 423 | <button | ||
| 424 | type="submit" | ||
| 425 | title="Crear nota pedido" | ||
| 426 | class="btn btn-default btn-block mb-2 border border-dark" | ||
| 427 | > | ||
| 428 | <strong>PAUSAR</strong> | ||
| 429 | </button> | ||
| 430 | <button | ||
| 431 | ng-click="salir()" | ||
| 432 | type="button" | ||
| 433 | title="Salir" | ||
| 434 | class="btn btn-default btn-block border border-dark"> | ||
| 435 | <strong>SALIR</strong> | ||
| 436 | </button> | ||
| 437 | </div> | ||
| 438 | </div> | ||
| 439 | </div> | 411 | </div> |
| 440 | </div> | 412 | </div> |
| 441 | <div class="row d-md-none fixed-bottom"> | 413 | <div class="row d-md-none fixed-bottom"> |
| 442 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 414 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 443 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 415 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 444 | <span | 416 | <span |
| 445 | class="mr-3 ml-auto" | 417 | class="mr-3 ml-auto" |
| 446 | ng-class="saveLoading ? 'text-muted' : ''" | 418 | ng-class="saveLoading ? 'text-muted' : ''" |
| 447 | ng-click="crearNotaPedido()" | 419 | ng-click="crearNotaPedido()" |
| 448 | ladda="saveLoading" | 420 | ladda="saveLoading" |
| 449 | data-style="expand-left" | 421 | data-style="expand-left" |
| 450 | >Guardar</span> | 422 | >Guardar</span> |
| 451 | </div> | 423 | </div> |
| 452 | </div> | 424 | </div> |
| 453 | </div> | 425 | </div> |
| 454 | 426 |