Commit d4245c484ba3e4443a6af0fd9255e195ff24718c
Exists in
master
Merge branch 'master' into 'master'
agrego foca-botonera-lateral See merge request !12
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 | data.data.id, | 139 | data.data.id, |
| 123 | 'Nota de pedido', | 140 | 'Nota de pedido', |
| 124 | 'Nº: ' + $filter('comprobante')([ | 141 | 'Nº: ' + $filter('comprobante')([ |
| 125 | $scope.puntoVenta, | 142 | $scope.puntoVenta, |
| 126 | $scope.comprobante | 143 | $scope.comprobante |
| 127 | ]) + '<br/>' + | 144 | ]) + '<br/>' + |
| 128 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + | 145 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + |
| 129 | 'Total: ' + $filter('currency')($scope.getTotal()) | 146 | 'Total: ' + $filter('currency')($scope.getTotal()) |
| 130 | ); | 147 | ); |
| 131 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 148 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
| 132 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 149 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
| 133 | var plazos = $scope.plazosPagos; | 150 | var plazos = $scope.plazosPagos; |
| 134 | 151 | ||
| 135 | for(var j = 0; j < plazos.length; j++) { | 152 | for(var j = 0; j < plazos.length; j++) { |
| 136 | var json = { | 153 | var json = { |
| 137 | idPedido: data.data.id, | 154 | idPedido: data.data.id, |
| 138 | dias: plazos[j].dias | 155 | dias: plazos[j].dias |
| 139 | }; | 156 | }; |
| 140 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); | 157 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
| 141 | } | 158 | } |
| 142 | notaPedidoBusinessService.addEstado(data.data.id, | 159 | notaPedidoBusinessService.addEstado(data.data.id, |
| 143 | $scope.notaPedido.vendedor.CodVen); | 160 | $scope.notaPedido.vendedor.CodVen); |
| 144 | 161 | ||
| 145 | focaModalService.alert('Nota pedido creada'); | 162 | focaModalService.alert('Nota pedido creada'); |
| 146 | $scope.saveLoading = false; | 163 | $scope.saveLoading = false; |
| 147 | $scope.$broadcast('cleanCabecera'); | 164 | $scope.$broadcast('cleanCabecera'); |
| 148 | $scope.$broadcast('addCabecera', { | 165 | $scope.$broadcast('addCabecera', { |
| 149 | label: 'Moneda:', | 166 | label: 'Moneda:', |
| 150 | valor: $scope.notaPedido.moneda.DETALLE | 167 | valor: $scope.notaPedido.moneda.DETALLE |
| 151 | }); | 168 | }); |
| 152 | $scope.$broadcast('addCabecera', { | 169 | $scope.$broadcast('addCabecera', { |
| 153 | label: 'Fecha cotizacion:', | 170 | label: 'Fecha cotizacion:', |
| 154 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 171 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
| 155 | }); | 172 | }); |
| 156 | $scope.$broadcast('addCabecera', { | 173 | $scope.$broadcast('addCabecera', { |
| 157 | label: 'Moneda:', | 174 | label: 'Moneda:', |
| 158 | valor: $scope.notaPedido.moneda.DETALLE | 175 | valor: $scope.notaPedido.moneda.DETALLE |
| 159 | }); | 176 | }); |
| 160 | $scope.$broadcast('addCabecera', { | 177 | $scope.$broadcast('addCabecera', { |
| 161 | label: 'Cotizacion:', | 178 | label: 'Cotizacion:', |
| 162 | valor: $scope.notaPedido.cotizacion.VENDEDOR | 179 | valor: $scope.notaPedido.cotizacion.VENDEDOR |
| 163 | }); | 180 | }); |
| 164 | crearNotaPedidoService.getNumeroNotaPedido().then( | 181 | crearNotaPedidoService.getNumeroNotaPedido().then( |
| 165 | function(res) { | 182 | function(res) { |
| 166 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 183 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 167 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 184 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
| 168 | }, | 185 | }, |
| 169 | function(err) { | 186 | function(err) { |
| 170 | focaModalService.alert( | 187 | focaModalService.alert( |
| 171 | 'La terminal no esta configurada correctamente'); | 188 | 'La terminal no esta configurada correctamente'); |
| 172 | console.info(err); | 189 | console.info(err); |
| 173 | } | 190 | } |
| 174 | ); | 191 | ); |
| 175 | $scope.notaPedido.vendedor = {}; | 192 | $scope.notaPedido.vendedor = {}; |
| 176 | $scope.notaPedido.cliente = {}; | 193 | $scope.notaPedido.cliente = {}; |
| 177 | $scope.notaPedido.proveedor = {}; | 194 | $scope.notaPedido.proveedor = {}; |
| 178 | $scope.notaPedido.domicilio = {}; | 195 | $scope.notaPedido.domicilio = {}; |
| 179 | $scope.notaPedido.flete = null; | 196 | $scope.notaPedido.flete = null; |
| 180 | $scope.notaPedido.fob = null; | 197 | $scope.notaPedido.fob = null; |
| 181 | $scope.notaPedido.bomba = null; | 198 | $scope.notaPedido.bomba = null; |
| 182 | $scope.notaPedido.kilometros = null; | 199 | $scope.notaPedido.kilometros = null; |
| 183 | $scope.articulosTabla = []; | 200 | $scope.articulosTabla = []; |
| 184 | }, | 201 | }, |
| 185 | function(error) { | 202 | function(error) { |
| 186 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 203 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
| 187 | $scope.saveLoading = false; | 204 | $scope.saveLoading = false; |
| 188 | console.info(error); | 205 | console.info(error); |
| 189 | } | 206 | } |
| 190 | ); | 207 | ); |
| 191 | }; | 208 | }; |
| 192 | 209 | ||
| 193 | $scope.seleccionarNotaPedido = function() { | 210 | $scope.seleccionarNotaPedido = function() { |
| 194 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
| 195 | { | 212 | { |
| 196 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 213 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| 197 | templateUrl: 'foca-modal-nota-pedido.html', | 214 | templateUrl: 'foca-modal-nota-pedido.html', |
| 198 | controller: 'focaModalNotaPedidoController', | 215 | controller: 'focaModalNotaPedidoController', |
| 199 | size: 'lg', | 216 | size: 'lg', |
| 200 | resolve: {usadoPor: function() {return 'notaPedido';}} | 217 | resolve: {usadoPor: function() {return 'notaPedido';}} |
| 201 | } | 218 | } |
| 202 | ); | 219 | ); |
| 203 | modalInstance.result.then( | 220 | modalInstance.result.then( |
| 204 | function(notaPedido) { | 221 | function(notaPedido) { |
| 205 | $scope.now = new Date(notaPedido.fechaCarga); | 222 | $scope.now = new Date(notaPedido.fechaCarga); |
| 206 | //añado cabeceras | 223 | //añado cabeceras |
| 207 | $scope.notaPedido.id = notaPedido.id; | 224 | $scope.notaPedido.id = notaPedido.id; |
| 208 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 225 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 209 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 226 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 210 | var cabeceras = [ | 227 | var cabeceras = [ |
| 211 | { | 228 | { |
| 212 | label: 'Moneda:', | 229 | label: 'Moneda:', |
| 213 | valor: notaPedido.cotizacion.moneda.DETALLE | 230 | valor: notaPedido.cotizacion.moneda.DETALLE |
| 214 | }, | 231 | }, |
| 215 | { | 232 | { |
| 216 | label: 'Fecha cotizacion:', | 233 | label: 'Fecha cotizacion:', |
| 217 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 234 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
| 218 | 'dd/MM/yyyy') | 235 | 'dd/MM/yyyy') |
| 219 | }, | 236 | }, |
| 220 | { | 237 | { |
| 221 | label: 'Cotizacion:', | 238 | label: 'Cotizacion:', |
| 222 | valor: notaPedido.cotizacion.VENDEDOR | 239 | valor: notaPedido.cotizacion.VENDEDOR |
| 223 | }, | 240 | }, |
| 224 | { | 241 | { |
| 225 | label: 'Cliente:', | 242 | label: 'Cliente:', |
| 226 | valor: notaPedido.cliente.NOM | 243 | valor: notaPedido.cliente.NOM |
| 227 | }, | 244 | }, |
| 228 | { | 245 | { |
| 229 | label: 'Domicilio:', | 246 | label: 'Domicilio:', |
| 230 | valor: notaPedido.domicilioStamp | 247 | valor: notaPedido.domicilioStamp |
| 231 | }, | 248 | }, |
| 232 | { | 249 | { |
| 233 | label: 'Vendedor:', | 250 | label: 'Vendedor:', |
| 234 | valor: notaPedido.vendedor.NomVen | 251 | valor: notaPedido.vendedor.NomVen |
| 235 | }, | 252 | }, |
| 236 | { | 253 | { |
| 237 | label: 'Proveedor:', | 254 | label: 'Proveedor:', |
| 238 | valor: notaPedido.proveedor.NOM | 255 | valor: notaPedido.proveedor.NOM |
| 239 | }, | 256 | }, |
| 240 | { | 257 | { |
| 241 | label: 'Precio condicion:', | 258 | label: 'Precio condicion:', |
| 242 | valor: valorPrecioCondicion() + ' ' + | 259 | valor: valorPrecioCondicion() + ' ' + |
| 243 | notaPedidoBusinessService | 260 | notaPedidoBusinessService |
| 244 | .plazoToString(notaPedido.notaPedidoPlazo) | 261 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 245 | }, | 262 | }, |
| 246 | { | 263 | { |
| 247 | label: 'Flete:', | 264 | label: 'Flete:', |
| 248 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 265 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| 249 | notaPedido.flete === 1 ? 'Si' : 'No') | 266 | notaPedido.flete === 1 ? 'Si' : 'No') |
| 250 | } | 267 | } |
| 251 | ]; | 268 | ]; |
| 252 | 269 | ||
| 253 | function valorPrecioCondicion() { | 270 | function valorPrecioCondicion() { |
| 254 | if(notaPedido.idPrecioCondicion > 0) { | 271 | if(notaPedido.idPrecioCondicion > 0) { |
| 255 | return notaPedido.precioCondicion.nombre; | 272 | return notaPedido.precioCondicion.nombre; |
| 256 | } else { | 273 | } else { |
| 257 | return 'Ingreso Manual'; | 274 | return 'Ingreso Manual'; |
| 258 | } | 275 | } |
| 259 | } | 276 | } |
| 260 | 277 | ||
| 261 | if(notaPedido.flete === 1) { | 278 | if(notaPedido.flete === 1) { |
| 262 | var cabeceraBomba = { | 279 | var cabeceraBomba = { |
| 263 | label: 'Bomba:', | 280 | label: 'Bomba:', |
| 264 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 281 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
| 265 | }; | 282 | }; |
| 266 | if(notaPedido.kilometros) { | 283 | if(notaPedido.kilometros) { |
| 267 | var cabeceraKilometros = { | 284 | var cabeceraKilometros = { |
| 268 | label: 'Kilometros:', | 285 | label: 'Kilometros:', |
| 269 | valor: notaPedido.kilometros | 286 | valor: notaPedido.kilometros |
| 270 | }; | 287 | }; |
| 271 | cabeceras.push(cabeceraKilometros); | 288 | cabeceras.push(cabeceraKilometros); |
| 272 | } | 289 | } |
| 273 | cabeceras.push(cabeceraBomba); | 290 | cabeceras.push(cabeceraBomba); |
| 274 | } | 291 | } |
| 275 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 292 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
| 276 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 293 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
| 277 | notaPedido.cotizacion.VENDEDOR); | 294 | notaPedido.cotizacion.VENDEDOR); |
| 278 | if(notaPedido.idPrecioCondicion > 0) { | 295 | if(notaPedido.idPrecioCondicion > 0) { |
| 279 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 296 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 280 | } else { | 297 | } else { |
| 281 | $scope.idLista = -1; | 298 | $scope.idLista = -1; |
| 282 | } | 299 | } |
| 283 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | 300 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); |
| 284 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | 301 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); |
| 285 | $scope.notaPedido = notaPedido; | 302 | $scope.notaPedido = notaPedido; |
| 286 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 303 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
| 287 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 304 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
| 288 | addArrayCabecera(cabeceras); | 305 | addArrayCabecera(cabeceras); |
| 289 | 306 | ||
| 290 | }, function() { | 307 | }, function() { |
| 291 | // funcion ejecutada cuando se cancela el modal | 308 | // funcion ejecutada cuando se cancela el modal |
| 292 | } | 309 | } |
| 293 | ); | 310 | ); |
| 294 | }; | 311 | }; |
| 295 | 312 | ||
| 296 | $scope.seleccionarProductos = function() { | 313 | $scope.seleccionarProductos = function() { |
| 297 | if ($scope.idLista === undefined) { | 314 | if ($scope.idLista === undefined) { |
| 298 | focaModalService.alert( | 315 | focaModalService.alert( |
| 299 | 'Primero seleccione una lista de precio y condicion'); | 316 | 'Primero seleccione una lista de precio y condicion'); |
| 300 | return; | 317 | return; |
| 301 | } | 318 | } |
| 302 | var modalInstance = $uibModal.open( | 319 | var modalInstance = $uibModal.open( |
| 303 | { | 320 | { |
| 304 | ariaLabelledBy: 'Busqueda de Productos', | 321 | ariaLabelledBy: 'Busqueda de Productos', |
| 305 | templateUrl: 'modal-busqueda-productos.html', | 322 | templateUrl: 'modal-busqueda-productos.html', |
| 306 | controller: 'modalBusquedaProductosCtrl', | 323 | controller: 'modalBusquedaProductosCtrl', |
| 307 | resolve: { | 324 | resolve: { |
| 308 | parametroProducto: { | 325 | parametroProducto: { |
| 309 | idLista: $scope.idLista, | 326 | idLista: $scope.idLista, |
| 310 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 327 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
| 311 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 328 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
| 312 | } | 329 | } |
| 313 | }, | 330 | }, |
| 314 | size: 'lg' | 331 | size: 'lg' |
| 315 | } | 332 | } |
| 316 | ); | 333 | ); |
| 317 | modalInstance.result.then( | 334 | modalInstance.result.then( |
| 318 | function(producto) { | 335 | function(producto) { |
| 319 | var newArt = | 336 | var newArt = |
| 320 | { | 337 | { |
| 321 | id: 0, | 338 | id: 0, |
| 322 | codigo: producto.codigo, | 339 | codigo: producto.codigo, |
| 323 | sector: producto.sector, | 340 | sector: producto.sector, |
| 324 | sectorCodigo: producto.sector + '-' + producto.codigo, | 341 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 325 | descripcion: producto.descripcion, | 342 | descripcion: producto.descripcion, |
| 326 | item: $scope.articulosTabla.length + 1, | 343 | item: $scope.articulosTabla.length + 1, |
| 327 | nombre: producto.descripcion, | 344 | nombre: producto.descripcion, |
| 328 | precio: parseFloat(producto.precio.toFixed(4)), | 345 | precio: parseFloat(producto.precio.toFixed(4)), |
| 329 | costoUnitario: producto.costo, | 346 | costoUnitario: producto.costo, |
| 330 | editCantidad: false, | 347 | editCantidad: false, |
| 331 | editPrecio: false, | 348 | editPrecio: false, |
| 332 | rubro: producto.CodRub, | 349 | rubro: producto.CodRub, |
| 333 | exentoUnitario: producto.precio, | 350 | exentoUnitario: producto.precio, |
| 334 | ivaUnitario: producto.IMPIVA, | 351 | ivaUnitario: producto.IMPIVA, |
| 335 | impuestoInternoUnitario: producto.ImpInt, | 352 | impuestoInternoUnitario: producto.ImpInt, |
| 336 | impuestoInterno1Unitario: producto.ImpInt2, | 353 | impuestoInterno1Unitario: producto.ImpInt2, |
| 337 | impuestoInterno2Unitario: producto.ImpInt3, | 354 | impuestoInterno2Unitario: producto.ImpInt3, |
| 338 | precioLista: producto.precio, | 355 | precioLista: producto.precio, |
| 339 | combustible: 1, | 356 | combustible: 1, |
| 340 | facturado: 0 | 357 | facturado: 0 |
| 341 | }; | 358 | }; |
| 342 | $scope.articuloACargar = newArt; | 359 | $scope.articuloACargar = newArt; |
| 343 | $scope.cargando = false; | 360 | $scope.cargando = false; |
| 344 | }, function() { | 361 | }, function() { |
| 345 | // funcion ejecutada cuando se cancela el modal | 362 | // funcion ejecutada cuando se cancela el modal |
| 346 | } | 363 | } |
| 347 | ); | 364 | ); |
| 348 | }; | 365 | }; |
| 349 | 366 | ||
| 350 | $scope.seleccionarVendedor = function() { | 367 | $scope.seleccionarVendedor = function() { |
| 351 | if(validarNotaRemitada()) { | 368 | if(validarNotaRemitada()) { |
| 352 | var modalInstance = $uibModal.open( | 369 | var modalInstance = $uibModal.open( |
| 353 | { | 370 | { |
| 354 | ariaLabelledBy: 'Busqueda de Vendedores', | 371 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 355 | templateUrl: 'modal-vendedores.html', | 372 | templateUrl: 'modal-vendedores.html', |
| 356 | controller: 'modalVendedoresCtrl', | 373 | controller: 'modalVendedoresCtrl', |
| 357 | size: 'lg' | 374 | size: 'lg' |
| 358 | } | 375 | } |
| 359 | ); | 376 | ); |
| 360 | modalInstance.result.then( | 377 | modalInstance.result.then( |
| 361 | function(vendedor) { | 378 | function(vendedor) { |
| 362 | $scope.$broadcast('addCabecera', { | 379 | $scope.$broadcast('addCabecera', { |
| 363 | label: 'Vendedor:', | 380 | label: 'Vendedor:', |
| 364 | valor: vendedor.NomVen | 381 | valor: vendedor.NomVen |
| 365 | }); | 382 | }); |
| 366 | $scope.notaPedido.vendedor = vendedor; | 383 | $scope.notaPedido.vendedor = vendedor; |
| 367 | }, function() { | 384 | }, function() { |
| 368 | 385 | ||
| 369 | } | 386 | } |
| 370 | ); | 387 | ); |
| 371 | } | 388 | } |
| 372 | }; | 389 | }; |
| 373 | 390 | ||
| 374 | $scope.seleccionarProveedor = function() { | 391 | $scope.seleccionarProveedor = function() { |
| 375 | if(validarNotaRemitada()) { | 392 | if(validarNotaRemitada()) { |
| 376 | var modalInstance = $uibModal.open( | 393 | var modalInstance = $uibModal.open( |
| 377 | { | 394 | { |
| 378 | ariaLabelledBy: 'Busqueda de Proveedor', | 395 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 379 | templateUrl: 'modal-proveedor.html', | 396 | templateUrl: 'modal-proveedor.html', |
| 380 | controller: 'focaModalProveedorCtrl', | 397 | controller: 'focaModalProveedorCtrl', |
| 381 | size: 'lg', | 398 | size: 'lg', |
| 382 | resolve: { | 399 | resolve: { |
| 383 | transportista: function() { | 400 | transportista: function() { |
| 384 | return false; | 401 | return false; |
| 385 | } | 402 | } |
| 386 | } | 403 | } |
| 387 | } | 404 | } |
| 388 | ); | 405 | ); |
| 389 | modalInstance.result.then( | 406 | modalInstance.result.then( |
| 390 | function(proveedor) { | 407 | function(proveedor) { |
| 391 | $scope.notaPedido.proveedor = proveedor; | 408 | $scope.notaPedido.proveedor = proveedor; |
| 392 | $scope.$broadcast('addCabecera', { | 409 | $scope.$broadcast('addCabecera', { |
| 393 | label: 'Proveedor:', | 410 | label: 'Proveedor:', |
| 394 | valor: proveedor.NOM | 411 | valor: proveedor.NOM |
| 395 | }); | 412 | }); |
| 396 | }, function() { | 413 | }, function() { |
| 397 | 414 | ||
| 398 | } | 415 | } |
| 399 | ); | 416 | ); |
| 400 | } | 417 | } |
| 401 | }; | 418 | }; |
| 402 | 419 | ||
| 403 | $scope.seleccionarCliente = function() { | 420 | $scope.seleccionarCliente = function() { |
| 404 | if(validarNotaRemitada()) { | 421 | if(validarNotaRemitada()) { |
| 405 | var modalInstance = $uibModal.open( | 422 | var modalInstance = $uibModal.open( |
| 406 | { | 423 | { |
| 407 | ariaLabelledBy: 'Busqueda de Cliente', | 424 | ariaLabelledBy: 'Busqueda de Cliente', |
| 408 | templateUrl: 'foca-busqueda-cliente-modal.html', | 425 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 409 | controller: 'focaBusquedaClienteModalController', | 426 | controller: 'focaBusquedaClienteModalController', |
| 410 | size: 'lg' | 427 | size: 'lg' |
| 411 | } | 428 | } |
| 412 | ); | 429 | ); |
| 413 | modalInstance.result.then( | 430 | modalInstance.result.then( |
| 414 | function(cliente) { | 431 | function(cliente) { |
| 415 | $scope.abrirModalDomicilios(cliente); | 432 | $scope.abrirModalDomicilios(cliente); |
| 416 | }, function() { | 433 | }, function() { |
| 417 | 434 | ||
| 418 | } | 435 | } |
| 419 | ); | 436 | ); |
| 420 | } | 437 | } |
| 421 | }; | 438 | }; |
| 422 | 439 | ||
| 423 | $scope.abrirModalDomicilios = function(cliente) { | 440 | $scope.abrirModalDomicilios = function(cliente) { |
| 424 | var modalInstanceDomicilio = $uibModal.open( | 441 | var modalInstanceDomicilio = $uibModal.open( |
| 425 | { | 442 | { |
| 426 | ariaLabelledBy: 'Busqueda de Domicilios', | 443 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 427 | templateUrl: 'modal-domicilio.html', | 444 | templateUrl: 'modal-domicilio.html', |
| 428 | controller: 'focaModalDomicilioController', | 445 | controller: 'focaModalDomicilioController', |
| 429 | resolve: { idCliente: function() { return cliente.cod; }}, | 446 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 430 | size: 'lg', | 447 | size: 'lg', |
| 431 | } | 448 | } |
| 432 | ); | 449 | ); |
| 433 | modalInstanceDomicilio.result.then( | 450 | modalInstanceDomicilio.result.then( |
| 434 | function(domicilio) { | 451 | function(domicilio) { |
| 435 | $scope.notaPedido.domicilio = domicilio; | 452 | $scope.notaPedido.domicilio = domicilio; |
| 436 | $scope.notaPedido.cliente = { | 453 | $scope.notaPedido.cliente = { |
| 437 | COD: cliente.cod, | 454 | COD: cliente.cod, |
| 438 | CUIT: cliente.cuit, | 455 | CUIT: cliente.cuit, |
| 439 | NOM: cliente.nom | 456 | NOM: cliente.nom |
| 440 | }; | 457 | }; |
| 441 | var domicilioStamp = | 458 | var domicilioStamp = |
| 442 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 459 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
| 443 | domicilio.Localidad + ', ' + domicilio.Provincia; | 460 | domicilio.Localidad + ', ' + domicilio.Provincia; |
| 444 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 461 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
| 445 | 462 | ||
| 446 | $scope.$broadcast('addCabecera', { | 463 | $scope.$broadcast('addCabecera', { |
| 447 | label: 'Cliente:', | 464 | label: 'Cliente:', |
| 448 | valor: cliente.nom | 465 | valor: cliente.nom |
| 449 | }); | 466 | }); |
| 450 | $scope.$broadcast('addCabecera', { | 467 | $scope.$broadcast('addCabecera', { |
| 451 | label: 'Domicilio:', | 468 | label: 'Domicilio:', |
| 452 | valor: domicilioStamp | 469 | valor: domicilioStamp |
| 453 | }); | 470 | }); |
| 454 | }, function() { | 471 | }, function() { |
| 455 | $scope.seleccionarCliente(); | 472 | $scope.seleccionarCliente(); |
| 456 | return; | 473 | return; |
| 457 | } | 474 | } |
| 458 | ); | 475 | ); |
| 459 | }; | 476 | }; |
| 460 | 477 | ||
| 461 | $scope.getTotal = function() { | 478 | $scope.getTotal = function() { |
| 462 | var total = 0; | 479 | var total = 0; |
| 463 | var arrayTempArticulos = $scope.articulosTabla; | 480 | var arrayTempArticulos = $scope.articulosTabla; |
| 464 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 481 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 465 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 482 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 466 | } | 483 | } |
| 467 | return parseFloat(total.toFixed(2)); | 484 | return parseFloat(total.toFixed(2)); |
| 468 | }; | 485 | }; |
| 469 | 486 | ||
| 470 | $scope.getSubTotal = function() { | 487 | $scope.getSubTotal = function() { |
| 471 | if($scope.articuloACargar) { | 488 | if($scope.articuloACargar) { |
| 472 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 489 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 473 | } | 490 | } |
| 474 | }; | 491 | }; |
| 475 | 492 | ||
| 476 | $scope.seleccionarPreciosYCondiciones = function() { | 493 | $scope.seleccionarPreciosYCondiciones = function() { |
| 477 | if(validarNotaRemitada()) { | 494 | if(validarNotaRemitada()) { |
| 478 | var modalInstance = $uibModal.open( | 495 | var modalInstance = $uibModal.open( |
| 479 | { | 496 | { |
| 480 | ariaLabelledBy: 'Busqueda de Precio Condición', | 497 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 481 | templateUrl: 'modal-precio-condicion.html', | 498 | templateUrl: 'modal-precio-condicion.html', |
| 482 | controller: 'focaModalPrecioCondicionController', | 499 | controller: 'focaModalPrecioCondicionController', |
| 483 | size: 'lg' | 500 | size: 'lg' |
| 484 | } | 501 | } |
| 485 | ); | 502 | ); |
| 486 | modalInstance.result.then( | 503 | modalInstance.result.then( |
| 487 | function(precioCondicion) { | 504 | function(precioCondicion) { |
| 488 | var cabecera = ''; | 505 | var cabecera = ''; |
| 489 | var plazosConcat = ''; | 506 | var plazosConcat = ''; |
| 490 | if(!Array.isArray(precioCondicion)) { | 507 | if(!Array.isArray(precioCondicion)) { |
| 491 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 508 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
| 492 | $scope.plazosPagos = precioCondicion.plazoPago; | 509 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 493 | $scope.idLista = precioCondicion.idListaPrecio; | 510 | $scope.idLista = precioCondicion.idListaPrecio; |
| 494 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 511 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 495 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 512 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 496 | } | 513 | } |
| 497 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 514 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 498 | } else { //Cuando se ingresan los plazos manualmente | 515 | } else { //Cuando se ingresan los plazos manualmente |
| 499 | $scope.notaPedido.idPrecioCondicion = 0; | 516 | $scope.notaPedido.idPrecioCondicion = 0; |
| 500 | //-1, el modal productos busca todos los productos | 517 | //-1, el modal productos busca todos los productos |
| 501 | $scope.idLista = -1; | 518 | $scope.idLista = -1; |
| 502 | $scope.plazosPagos = precioCondicion; | 519 | $scope.plazosPagos = precioCondicion; |
| 503 | for(var j = 0; j < precioCondicion.length; j++) { | 520 | for(var j = 0; j < precioCondicion.length; j++) { |
| 504 | plazosConcat += precioCondicion[j].dias + ' '; | 521 | plazosConcat += precioCondicion[j].dias + ' '; |
| 505 | } | 522 | } |
| 506 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 523 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 507 | } | 524 | } |
| 508 | $scope.articulosTabla = []; | 525 | $scope.articulosTabla = []; |
| 509 | $scope.$broadcast('addCabecera', { | 526 | $scope.$broadcast('addCabecera', { |
| 510 | label: 'Precios y condiciones:', | 527 | label: 'Precios y condiciones:', |
| 511 | valor: cabecera | 528 | valor: cabecera |
| 512 | }); | 529 | }); |
| 513 | }, function() { | 530 | }, function() { |
| 514 | 531 | ||
| 515 | } | 532 | } |
| 516 | ); | 533 | ); |
| 517 | } | 534 | } |
| 518 | }; | 535 | }; |
| 519 | 536 | ||
| 520 | $scope.seleccionarFlete = function() { | 537 | $scope.seleccionarFlete = function() { |
| 521 | if(validarNotaRemitada()) { | 538 | if(validarNotaRemitada()) { |
| 522 | var modalInstance = $uibModal.open( | 539 | var modalInstance = $uibModal.open( |
| 523 | { | 540 | { |
| 524 | ariaLabelledBy: 'Busqueda de Flete', | 541 | ariaLabelledBy: 'Busqueda de Flete', |
| 525 | templateUrl: 'modal-flete.html', | 542 | templateUrl: 'modal-flete.html', |
| 526 | controller: 'focaModalFleteController', | 543 | controller: 'focaModalFleteController', |
| 527 | size: 'lg', | 544 | size: 'lg', |
| 528 | resolve: { | 545 | resolve: { |
| 529 | parametrosFlete: | 546 | parametrosFlete: |
| 530 | function() { | 547 | function() { |
| 531 | return { | 548 | return { |
| 532 | flete: $scope.notaPedido.fob ? 'FOB' : | 549 | flete: $scope.notaPedido.fob ? 'FOB' : |
| 533 | ( $scope.notaPedido.flete ? '1' : | 550 | ( $scope.notaPedido.flete ? '1' : |
| 534 | ($scope.notaPedido.flete === undefined ? | 551 | ($scope.notaPedido.flete === undefined ? |
| 535 | null : '0')), | 552 | null : '0')), |
| 536 | bomba: $scope.notaPedido.bomba ? '1' : | 553 | bomba: $scope.notaPedido.bomba ? '1' : |
| 537 | ($scope.notaPedido.bomba === undefined ? | 554 | ($scope.notaPedido.bomba === undefined ? |
| 538 | null : '0'), | 555 | null : '0'), |
| 539 | kilometros: $scope.notaPedido.kilometros | 556 | kilometros: $scope.notaPedido.kilometros |
| 540 | }; | 557 | }; |
| 541 | } | 558 | } |
| 542 | } | 559 | } |
| 543 | } | 560 | } |
| 544 | ); | 561 | ); |
| 545 | modalInstance.result.then( | 562 | modalInstance.result.then( |
| 546 | function(datos) { | 563 | function(datos) { |
| 547 | $scope.notaPedido.flete = datos.flete; | 564 | $scope.notaPedido.flete = datos.flete; |
| 548 | $scope.notaPedido.fob = datos.FOB; | 565 | $scope.notaPedido.fob = datos.FOB; |
| 549 | $scope.notaPedido.bomba = datos.bomba; | 566 | $scope.notaPedido.bomba = datos.bomba; |
| 550 | $scope.notaPedido.kilometros = datos.kilometros; | 567 | $scope.notaPedido.kilometros = datos.kilometros; |
| 551 | $scope.$broadcast('addCabecera', { | 568 | $scope.$broadcast('addCabecera', { |
| 552 | label: 'Flete:', | 569 | label: 'Flete:', |
| 553 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') | 570 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') |
| 554 | }); | 571 | }); |
| 555 | if(datos.flete) { | 572 | if(datos.flete) { |
| 556 | $scope.$broadcast('addCabecera', { | 573 | $scope.$broadcast('addCabecera', { |
| 557 | label: 'Bomba:', | 574 | label: 'Bomba:', |
| 558 | valor: datos.bomba ? 'Si' : 'No' | 575 | valor: datos.bomba ? 'Si' : 'No' |
| 559 | }); | 576 | }); |
| 560 | $scope.$broadcast('addCabecera', { | 577 | $scope.$broadcast('addCabecera', { |
| 561 | label: 'Kilometros:', | 578 | label: 'Kilometros:', |
| 562 | valor: datos.kilometros | 579 | valor: datos.kilometros |
| 563 | }); | 580 | }); |
| 564 | } else { | 581 | } else { |
| 565 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 582 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 566 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 583 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 567 | $scope.notaPedido.bomba = false; | 584 | $scope.notaPedido.bomba = false; |
| 568 | $scope.notaPedido.kilometros = null; | 585 | $scope.notaPedido.kilometros = null; |
| 569 | } | 586 | } |
| 570 | }, function() { | 587 | }, function() { |
| 571 | 588 | ||
| 572 | } | 589 | } |
| 573 | ); | 590 | ); |
| 574 | } | 591 | } |
| 575 | }; | 592 | }; |
| 576 | 593 | ||
| 577 | $scope.seleccionarMoneda = function() { | 594 | $scope.seleccionarMoneda = function() { |
| 578 | if(validarNotaRemitada()) { | 595 | if(validarNotaRemitada()) { |
| 579 | var modalInstance = $uibModal.open( | 596 | var modalInstance = $uibModal.open( |
| 580 | { | 597 | { |
| 581 | ariaLabelledBy: 'Busqueda de Moneda', | 598 | ariaLabelledBy: 'Busqueda de Moneda', |
| 582 | templateUrl: 'modal-moneda.html', | 599 | templateUrl: 'modal-moneda.html', |
| 583 | controller: 'focaModalMonedaController', | 600 | controller: 'focaModalMonedaController', |
| 584 | size: 'lg' | 601 | size: 'lg' |
| 585 | } | 602 | } |
| 586 | ); | 603 | ); |
| 587 | modalInstance.result.then( | 604 | modalInstance.result.then( |
| 588 | function(moneda) { | 605 | function(moneda) { |
| 589 | $scope.abrirModalCotizacion(moneda); | 606 | $scope.abrirModalCotizacion(moneda); |
| 590 | }, function() { | 607 | }, function() { |
| 591 | 608 | ||
| 592 | } | 609 | } |
| 593 | ); | 610 | ); |
| 594 | } | 611 | } |
| 595 | }; | 612 | }; |
| 596 | 613 | ||
| 597 | $scope.abrirModalCotizacion = function(moneda) { | 614 | $scope.abrirModalCotizacion = function(moneda) { |
| 598 | var modalInstance = $uibModal.open( | 615 | var modalInstance = $uibModal.open( |
| 599 | { | 616 | { |
| 600 | ariaLabelledBy: 'Busqueda de Cotización', | 617 | ariaLabelledBy: 'Busqueda de Cotización', |
| 601 | templateUrl: 'modal-cotizacion.html', | 618 | templateUrl: 'modal-cotizacion.html', |
| 602 | controller: 'focaModalCotizacionController', | 619 | controller: 'focaModalCotizacionController', |
| 603 | size: 'lg', | 620 | size: 'lg', |
| 604 | resolve: {idMoneda: function() {return moneda.ID;}} | 621 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 605 | } | 622 | } |
| 606 | ); | 623 | ); |
| 607 | modalInstance.result.then( | 624 | modalInstance.result.then( |
| 608 | function(cotizacion) { | 625 | function(cotizacion) { |
| 609 | var articulosTablaTemp = $scope.articulosTabla; | 626 | var articulosTablaTemp = $scope.articulosTabla; |
| 610 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 627 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 611 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 628 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 612 | $scope.notaPedido.cotizacion.VENDEDOR; | 629 | $scope.notaPedido.cotizacion.VENDEDOR; |
| 613 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 630 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 614 | cotizacion.VENDEDOR; | 631 | cotizacion.VENDEDOR; |
| 615 | } | 632 | } |
| 616 | $scope.articulosTabla = articulosTablaTemp; | 633 | $scope.articulosTabla = articulosTablaTemp; |
| 617 | $scope.notaPedido.moneda = moneda; | 634 | $scope.notaPedido.moneda = moneda; |
| 618 | $scope.notaPedido.cotizacion = cotizacion; | 635 | $scope.notaPedido.cotizacion = cotizacion; |
| 619 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 636 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
| 620 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 637 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
| 621 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 638 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
| 622 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 639 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 623 | }else { | 640 | }else { |
| 624 | $scope.$broadcast('addCabecera', { | 641 | $scope.$broadcast('addCabecera', { |
| 625 | label: 'Moneda:', | 642 | label: 'Moneda:', |
| 626 | valor: moneda.DETALLE | 643 | valor: moneda.DETALLE |
| 627 | }); | 644 | }); |
| 628 | $scope.$broadcast('addCabecera', { | 645 | $scope.$broadcast('addCabecera', { |
| 629 | label: 'Fecha cotizacion:', | 646 | label: 'Fecha cotizacion:', |
| 630 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 647 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 631 | }); | 648 | }); |
| 632 | $scope.$broadcast('addCabecera', { | 649 | $scope.$broadcast('addCabecera', { |
| 633 | label: 'Cotizacion:', | 650 | label: 'Cotizacion:', |
| 634 | valor: cotizacion.VENDEDOR | 651 | valor: cotizacion.VENDEDOR |
| 635 | }); | 652 | }); |
| 636 | } | 653 | } |
| 637 | }, function() { | 654 | }, function() { |
| 638 | 655 | ||
| 639 | } | 656 | } |
| 640 | ); | 657 | ); |
| 641 | }; | 658 | }; |
| 642 | 659 | ||
| 643 | $scope.agregarATabla = function(key) { | 660 | $scope.agregarATabla = function(key) { |
| 644 | if(key === 13) { | 661 | if(key === 13) { |
| 645 | if($scope.articuloACargar.cantidad === undefined || | 662 | if($scope.articuloACargar.cantidad === undefined || |
| 646 | $scope.articuloACargar.cantidad === 0 || | 663 | $scope.articuloACargar.cantidad === 0 || |
| 647 | $scope.articuloACargar.cantidad === null ) { | 664 | $scope.articuloACargar.cantidad === null ) { |
| 648 | focaModalService.alert('El valor debe ser al menos 1'); | 665 | focaModalService.alert('El valor debe ser al menos 1'); |
| 649 | return; | 666 | return; |
| 650 | } | 667 | } |
| 651 | delete $scope.articuloACargar.sectorCodigo; | 668 | delete $scope.articuloACargar.sectorCodigo; |
| 652 | $scope.articulosTabla.push($scope.articuloACargar); | 669 | $scope.articulosTabla.push($scope.articuloACargar); |
| 653 | $scope.cargando = true; | 670 | $scope.cargando = true; |
| 654 | } | 671 | } |
| 655 | }; | 672 | }; |
| 656 | 673 | ||
| 657 | $scope.quitarArticulo = function(key) { | 674 | $scope.quitarArticulo = function(key) { |
| 658 | $scope.articulosTabla.splice(key, 1); | 675 | $scope.articulosTabla.splice(key, 1); |
| 659 | }; | 676 | }; |
| 660 | 677 | ||
| 661 | $scope.editarArticulo = function(key, articulo) { | 678 | $scope.editarArticulo = function(key, articulo) { |
| 662 | if(key === 13) { | 679 | if(key === 13) { |
| 663 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 680 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 664 | articulo.cantidad === undefined) { | 681 | articulo.cantidad === undefined) { |
| 665 | focaModalService.alert('El valor debe ser al menos 1'); | 682 | focaModalService.alert('El valor debe ser al menos 1'); |
| 666 | return; | 683 | return; |
| 667 | } | 684 | } |
| 668 | articulo.editCantidad = false; | 685 | articulo.editCantidad = false; |
| 669 | articulo.editPrecio = false; | 686 | articulo.editPrecio = false; |
| 670 | } | 687 | } |
| 671 | }; | 688 | }; |
| 672 | 689 | ||
| 673 | $scope.cambioEdit = function(articulo, propiedad) { | 690 | $scope.cambioEdit = function(articulo, propiedad) { |
| 674 | if(propiedad === 'cantidad') { | 691 | if(propiedad === 'cantidad') { |
| 675 | articulo.editCantidad = true; | 692 | articulo.editCantidad = true; |
| 676 | } else if(propiedad === 'precio') { | 693 | } else if(propiedad === 'precio') { |
| 677 | articulo.editPrecio = true; | 694 | articulo.editPrecio = true; |
| 678 | } | 695 | } |
| 679 | }; | 696 | }; |
| 680 | 697 | ||
| 681 | $scope.resetFilter = function() { | 698 | $scope.resetFilter = function() { |
| 682 | $scope.articuloACargar = {}; | 699 | $scope.articuloACargar = {}; |
| 683 | $scope.cargando = true; | 700 | $scope.cargando = true; |
| 684 | }; | 701 | }; |
| 685 | //Recibe aviso si el teclado está en uso | 702 | //Recibe aviso si el teclado está en uso |
| 686 | $rootScope.$on('usarTeclado', function(event, data) { | 703 | $rootScope.$on('usarTeclado', function(event, data) { |
| 687 | if(data) { | 704 | if(data) { |
| 688 | $scope.mostrarTeclado = true; | 705 | $scope.mostrarTeclado = true; |
| 689 | return; | 706 | return; |
| 690 | } | 707 | } |
| 691 | $scope.mostrarTeclado = false; | 708 | $scope.mostrarTeclado = false; |
| 692 | }); | 709 | }); |
| 693 | 710 | ||
| 694 | $scope.selectFocus = function($event) { | 711 | $scope.selectFocus = function($event) { |
| 695 | // Si el teclado esta en uso no selecciona el valor | 712 | // Si el teclado esta en uso no selecciona el valor |
| 696 | if($scope.mostrarTeclado) { | 713 | if($scope.mostrarTeclado) { |
| 697 | return; | 714 | return; |
| 698 | } | 715 | } |
| 699 | $event.target.select(); | 716 | $event.target.select(); |
| 700 | }; | 717 | }; |
| 701 | 718 | ||
| 702 | $scope.salir = function() { | 719 | $scope.salir = function() { |
| 703 | $location.path('/'); | 720 | $location.path('/'); |
| 704 | }; | 721 | }; |
| 705 | 722 | ||
| 706 | $scope.parsearATexto = function(articulo) { | 723 | $scope.parsearATexto = function(articulo) { |
| 707 | articulo.cantidad = parseFloat(articulo.cantidad); | 724 | articulo.cantidad = parseFloat(articulo.cantidad); |
| 708 | articulo.precio = parseFloat(articulo.precio); | 725 | articulo.precio = parseFloat(articulo.precio); |
| 709 | }; | 726 | }; |
| 710 | 727 | ||
| 711 | function addArrayCabecera(array) { | 728 | function addArrayCabecera(array) { |
| 712 | for(var i = 0; i < array.length; i++) { | 729 | for(var i = 0; i < array.length; i++) { |
| 713 | $scope.$broadcast('addCabecera', { | 730 | $scope.$broadcast('addCabecera', { |
| 714 | label: array[i].label, | 731 | label: array[i].label, |
| 715 | valor: array[i].valor | 732 | valor: array[i].valor |
| 716 | }); | 733 | }); |
| 717 | } | 734 | } |
| 718 | } | 735 | } |
| 719 | 736 | ||
| 720 | function rellenar(relleno, longitud) { | 737 | function rellenar(relleno, longitud) { |
| 721 | relleno = '' + relleno; | 738 | relleno = '' + relleno; |
| 722 | while (relleno.length < longitud) { | 739 | while (relleno.length < longitud) { |
| 723 | relleno = '0' + relleno; | 740 | relleno = '0' + relleno; |
| 724 | } | 741 | } |
| 725 | 742 | ||
| 726 | return relleno; | 743 | return relleno; |
| 727 | } | 744 | } |
| 728 | 745 | ||
| 729 | function validarNotaRemitada() { | 746 | function validarNotaRemitada() { |
| 730 | if(!$scope.notaPedido.idRemito) { | 747 | if(!$scope.notaPedido.idRemito) { |
| 731 | return true; | 748 | return true; |
| 732 | }else{ | 749 | }else{ |
| 733 | focaModalService.alert('No se puede editar una nota de pedido remitada'); | 750 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
| 734 | return false; | 751 | return false; |
| 735 | } | 752 | } |
| 736 | } | 753 | } |
| 737 | } | 754 | } |
| 738 | ]); | 755 | ]); |
| 739 | 756 |
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 |