Commit b598c80ad3bd013ba1fbb755e2311836efea190f
Exists in
master
and in
2 other branches
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !55
Showing
3 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 | const header = require('gulp-header'); | 12 | const header = require('gulp-header'); | 
| 13 | const footer = require('gulp-footer'); | 13 | const footer = require('gulp-footer'); | 
| 14 | const gulpSequence = require('gulp-sequence'); | 14 | const gulpSequence = require('gulp-sequence'); | 
| 15 | 15 | ||
| 16 | var paths = { | 16 | var paths = { | 
| 17 | srcJS: 'src/js/*.js', | 17 | srcJS: 'src/js/*.js', | 
| 18 | srcViews: 'src/views/*.html', | 18 | srcViews: 'src/views/*.html', | 
| 19 | specs: 'spec/*.js', | 19 | specs: 'spec/*.js', | 
| 20 | tmp: 'tmp', | 20 | tmp: 'tmp', | 
| 21 | dist: 'dist/' | 21 | dist: 'dist/' | 
| 22 | }; | 22 | }; | 
| 23 | 23 | ||
| 24 | gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')); | 24 | gulp.task('uglify', function(callback) { | 
| 25 | gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')(callback); | ||
| 26 | }); | ||
| 25 | 27 | ||
| 26 | gulp.task('templates', ['clean'], function() { | 28 | gulp.task('templates', function() { | 
| 27 | return pump( | 29 | return pump( | 
| 28 | [ | 30 | [ | 
| 29 | gulp.src(paths.srcViews), | 31 | gulp.src(paths.srcViews), | 
| 30 | htmlmin(), | 32 | htmlmin(), | 
| 31 | templateCache('views.js', { | 33 | templateCache('views.js', { | 
| 32 | module: 'focaCrearRemito', | 34 | module: 'focaCrearRemito', | 
| 33 | root: '' | 35 | root: '' | 
| 34 | }), | 36 | }), | 
| 35 | gulp.dest(paths.tmp) | 37 | gulp.dest(paths.tmp) | 
| 36 | ] | 38 | ] | 
| 37 | ); | 39 | ); | 
| 38 | }); | 40 | }); | 
| 39 | 41 | ||
| 40 | gulp.task('uglify-app', function() { | 42 | gulp.task('uglify-app', function() { | 
| 41 | return pump( | 43 | return pump( | 
| 42 | [ | 44 | [ | 
| 43 | gulp.src([ | 45 | gulp.src([ | 
| 44 | paths.srcJS, | 46 | paths.srcJS, | 
| 45 | 'tmp/views.js' | 47 | 'tmp/views.js' | 
| 46 | ]), | 48 | ]), | 
| 47 | concat('foca-crear-remito.js'), | 49 | concat('foca-crear-remito.js'), | 
| 48 | replace('src/views/', ''), | 50 | replace('src/views/', ''), | 
| 49 | gulp.dest(paths.tmp), | 51 | gulp.dest(paths.tmp), | 
| 50 | rename('foca-crear-remito.min.js'), | 52 | rename('foca-crear-remito.min.js'), | 
| 51 | uglify(), | 53 | uglify(), | 
| 52 | gulp.dest(paths.dist) | 54 | gulp.dest(paths.dist) | 
| 53 | ] | 55 | ] | 
| 54 | ); | 56 | ); | 
| 55 | }); | 57 | }); | 
| 56 | 58 | ||
| 57 | gulp.task('uglify-spec', function() { | 59 | gulp.task('uglify-spec', function() { | 
| 58 | return pump( | 60 | return pump( | 
| 59 | [ | 61 | [ | 
| 60 | gulp.src(paths.specs), | 62 | gulp.src(paths.specs), | 
| 61 | concat('foca-crear-remito.spec.js'), | 63 | concat('foca-crear-remito.spec.js'), | 
| 62 | replace('src/views/', ''), | 64 | replace('src/views/', ''), | 
| 63 | header("describe('Módulo foca-crear-remito', function() { \n"), | 65 | header("describe('Módulo foca-crear-remito', function() { \n"), | 
| 64 | footer("});"), | 66 | footer("});"), | 
| 65 | gulp.dest(paths.dist) | 67 | gulp.dest(paths.dist) | 
| 66 | ] | 68 | ] | 
| 67 | ); | 69 | ); | 
| 68 | }); | 70 | }); | 
| 69 | 71 | ||
| 70 | gulp.task('clean', function() { | 72 | gulp.task('clean', function() { | 
| 71 | return gulp.src(['tmp', 'dist'], {read: false}) | 73 | return gulp.src(['tmp', 'dist'], {read: false}).pipe(clean()); | 
| 72 | .pipe(clean()); | ||
| 73 | }); | 74 | }); | 
| 74 | 75 | ||
| 75 | gulp.task('pre-commit', function() { | 76 | gulp.task('pre-commit', function() { | 
| 76 | return pump( | 77 | return pump( | 
| 77 | [ | 78 | [ | 
| 78 | gulp.src([paths.srcJS, paths.specs]), | 79 | gulp.src([paths.srcJS, paths.specs]), | 
| 79 | jshint('.jshintrc'), | 80 | jshint('.jshintrc'), | 
| 80 | jshint.reporter('default'), | 81 | jshint.reporter('default'), | 
| 81 | jshint.reporter('fail') | 82 | jshint.reporter('fail') | 
| 82 | ] | 83 | ] | 
| 83 | ); | 84 | ); | 
| 84 | 85 | ||
| 85 | gulp.start('uglify'); | 86 | gulp.start('uglify'); | 
| 86 | }); | 87 | }); | 
| 87 | 88 | ||
| 88 | gulp.task('webserver', function() { | 89 | gulp.task('webserver', function() { | 
| 89 | pump [ | 90 | pump [ | 
| 90 | connect.server({port: 3300, host: '0.0.0.0'}) | 91 | connect.server({port: 3300, host: '0.0.0.0'}) | 
| 91 | ] | 92 | ] | 
| 92 | }); | 93 | }); | 
| 93 | 94 | ||
| 94 | gulp.task('clean-post-install', function() { | 95 | gulp.task('clean-post-install', function() { | 
| 95 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 96 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 
| 96 | 'index.html'], {read: false}) | 97 | 'index.html'], {read: false}) | 
| 97 | .pipe(clean()); | 98 | .pipe(clean()); | 
| 98 | }); | 99 | }); | 
| 99 | 100 | ||
| 100 | gulp.task('default', ['webserver']); | 101 | gulp.task('default', ['webserver']); | 
| 101 | 102 | ||
| 102 | gulp.task('watch', function() { | 103 | gulp.task('watch', function() { | 
| 103 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 104 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 
| 104 | }); | 105 | }); | 
| 105 | 106 | ||
| 106 | gulp.task('copy', ['uglify'], function() { | 107 | gulp.task('copy', ['uglify'], function() { | 
| 107 | return gulp.src('dist/*.js') | 108 | return gulp.src('dist/*.js') | 
| 108 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); | 109 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); | 
| 109 | }); | 110 | }); | 
| 110 | 111 | ||
| 111 | gulp.task('watchAndCopy', function() { | 112 | gulp.task('watchAndCopy', function() { | 
| 112 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | 113 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | 
| 113 | }); | 114 | }); | 
src/js/controller.js
| 1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', | 
| 2 | [ | 2 | [ | 
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 
| 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 
| 5 | '$localStorage', | 5 | '$localStorage', | 
| 6 | function( | 6 | function( | 
| 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 
| 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) | 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) | 
| 9 | { | 9 | { | 
| 10 | config(); | 10 | config(); | 
| 11 | 11 | ||
| 12 | function config() { | 12 | function config() { | 
| 13 | $scope.botonera = crearRemitoService.getBotonera(); | 13 | $scope.botonera = crearRemitoService.getBotonera(); | 
| 14 | $scope.isNumber = angular.isNumber; | 14 | $scope.isNumber = angular.isNumber; | 
| 15 | $scope.datepickerAbierto = false; | 15 | $scope.datepickerAbierto = false; | 
| 16 | $scope.show = false; | 16 | $scope.show = false; | 
| 17 | $scope.cargando = true; | 17 | $scope.cargando = true; | 
| 18 | $scope.now = new Date(); | 18 | $scope.now = new Date(); | 
| 19 | $scope.puntoVenta = rellenar(0, 4); | 19 | $scope.puntoVenta = rellenar(0, 4); | 
| 20 | $scope.comprobante = rellenar(0, 8); | 20 | $scope.comprobante = rellenar(0, 8); | 
| 21 | $scope.dateOptions = { | 21 | $scope.dateOptions = { | 
| 22 | maxDate: new Date(), | 22 | maxDate: new Date(), | 
| 23 | minDate: new Date(2010, 0, 1) | 23 | minDate: new Date(2010, 0, 1) | 
| 24 | }; | 24 | }; | 
| 25 | 25 | ||
| 26 | var monedaPorDefecto; | 26 | var monedaPorDefecto; | 
| 27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 
| 28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 
| 29 | monedaPorDefecto = res.data[0]; | 29 | monedaPorDefecto = res.data[0]; | 
| 30 | 30 | ||
| 31 | $scope.remito.cotizacion = Object.assign( | 31 | $scope.remito.cotizacion = Object.assign( | 
| 32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] | 32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] | 
| 33 | ); | 33 | ); | 
| 34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; | 34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; | 
| 35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); | 35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); | 
| 36 | }); | 36 | }); | 
| 37 | 37 | ||
| 38 | //SETEO BOTONERA LATERAL | 38 | //SETEO BOTONERA LATERAL | 
| 39 | $timeout(function() { | 39 | $timeout(function() { | 
| 40 | focaBotoneraLateralService.showSalir(false); | 40 | focaBotoneraLateralService.showSalir(false); | 
| 41 | focaBotoneraLateralService.showPausar(true); | 41 | focaBotoneraLateralService.showPausar(true); | 
| 42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 
| 43 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 43 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 
| 44 | }); | 44 | }); | 
| 45 | 45 | ||
| 46 | init(); | 46 | init(); | 
| 47 | $timeout(function() {getLSRemito();}); | 47 | $timeout(function() {getLSRemito();}); | 
| 48 | } | 48 | } | 
| 49 | 49 | ||
| 50 | function init() { | 50 | function init() { | 
| 51 | $scope.$broadcast('cleanCabecera'); | 51 | $scope.$broadcast('cleanCabecera'); | 
| 52 | 52 | ||
| 53 | $scope.remito = { | 53 | $scope.remito = { | 
| 54 | id: 0, | 54 | id: 0, | 
| 55 | estado: 0, | 55 | estado: 0, | 
| 56 | vendedor: {}, | 56 | vendedor: {}, | 
| 57 | cliente: {}, | 57 | cliente: {}, | 
| 58 | proveedor: {}, | 58 | proveedor: {}, | 
| 59 | domicilio: {dom: ''}, | 59 | domicilio: {dom: ''}, | 
| 60 | moneda: {}, | 60 | moneda: {}, | 
| 61 | cotizacion: $scope.cotizacionPorDefecto || {}, | 61 | cotizacion: $scope.cotizacionPorDefecto || {}, | 
| 62 | articulosRemito: [] | 62 | articulosRemito: [] | 
| 63 | }; | 63 | }; | 
| 64 | 64 | ||
| 65 | $scope.notaPedido = { | 65 | $scope.notaPedido = { | 
| 66 | id: 0 | 66 | id: 0 | 
| 67 | }; | 67 | }; | 
| 68 | 68 | ||
| 69 | $scope.remito.articulosRemito = []; | 69 | $scope.remito.articulosRemito = []; | 
| 70 | $scope.idLista = undefined; | 70 | $scope.idLista = undefined; | 
| 71 | 71 | ||
| 72 | crearRemitoService.getNumeroRemito().then( | 72 | crearRemitoService.getNumeroRemito().then( | 
| 73 | function(res) { | 73 | function(res) { | 
| 74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 
| 75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 
| 76 | }, | 76 | }, | 
| 77 | function(err) { | 77 | function(err) { | 
| 78 | focaModalService.alert('La terminal no esta configurada correctamente'); | 78 | focaModalService.alert('La terminal no esta configurada correctamente'); | 
| 79 | console.info(err); | 79 | console.info(err); | 
| 80 | } | 80 | } | 
| 81 | ); | 81 | ); | 
| 82 | 82 | ||
| 83 | $scope.inicial = angular.copy($scope.remito); | 83 | $scope.inicial = angular.copy($scope.remito); | 
| 84 | } | 84 | } | 
| 85 | 85 | ||
| 86 | $scope.$watch('remito', function(newValue) { | 86 | $scope.$watch('remito', function(newValue) { | 
| 87 | focaBotoneraLateralService.setPausarData({ | 87 | focaBotoneraLateralService.setPausarData({ | 
| 88 | label: 'remito', | 88 | label: 'remito', | 
| 89 | val: newValue | 89 | val: newValue | 
| 90 | }); | 90 | }); | 
| 91 | }, true); | 91 | }, true); | 
| 92 | 92 | ||
| 93 | $scope.seleccionarNotaPedido = function() { | 93 | $scope.seleccionarNotaPedido = function() { | 
| 94 | if (varlidarRemitoFacturado()) { | 94 | if (varlidarRemitoFacturado()) { | 
| 95 | var modalInstance = $uibModal.open( | 95 | var modalInstance = $uibModal.open( | 
| 96 | { | 96 | { | 
| 97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 
| 98 | templateUrl: 'foca-modal-nota-pedido.html', | 98 | templateUrl: 'foca-modal-nota-pedido.html', | 
| 99 | controller: 'focaModalNotaPedidoController', | 99 | controller: 'focaModalNotaPedidoController', | 
| 100 | size: 'lg', | 100 | size: 'lg', | 
| 101 | resolve: { | 101 | resolve: { | 
| 102 | usadoPor: function() { return 'remito'; }, | 102 | usadoPor: function() { return 'remito'; }, | 
| 103 | idVendedor: function() { return null; } | 103 | idVendedor: function() { return null; } | 
| 104 | } | 104 | } | 
| 105 | } | 105 | } | 
| 106 | ); | 106 | ); | 
| 107 | modalInstance.result.then( | 107 | modalInstance.result.then( | 
| 108 | function(notaPedido) { | 108 | function(notaPedido) { | 
| 109 | //añado cabeceras | 109 | //añado cabeceras | 
| 110 | $scope.notaPedido.id = notaPedido.id; | 110 | $scope.notaPedido.id = notaPedido.id; | 
| 111 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 111 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 
| 112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 
| 113 | var cabeceras = [ | 113 | var cabeceras = [ | 
| 114 | { | 114 | { | 
| 115 | label: 'Moneda:', | 115 | label: 'Moneda:', | 
| 116 | valor: notaPedido.cotizacion.moneda.DETALLE | 116 | valor: notaPedido.cotizacion.moneda.DETALLE | 
| 117 | }, | 117 | }, | 
| 118 | { | 118 | { | 
| 119 | label: 'Fecha cotizacion:', | 119 | label: 'Fecha cotizacion:', | 
| 120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 
| 121 | 'dd/MM/yyyy') | 121 | 'dd/MM/yyyy') | 
| 122 | }, | 122 | }, | 
| 123 | { | 123 | { | 
| 124 | label: 'Cotizacion:', | 124 | label: 'Cotizacion:', | 
| 125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 
| 126 | '2') | 126 | '2') | 
| 127 | }, | 127 | }, | 
| 128 | { | 128 | { | 
| 129 | label: 'Cliente:', | 129 | label: 'Cliente:', | 
| 130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 
| 131 | ' - ' + notaPedido.cliente.NOM | 131 | ' - ' + notaPedido.cliente.NOM | 
| 132 | }, | 132 | }, | 
| 133 | { | 133 | { | 
| 134 | label: 'Domicilio:', | 134 | label: 'Domicilio:', | 
| 135 | valor: notaPedido.domicilioStamp | 135 | valor: notaPedido.domicilioStamp | 
| 136 | }, | 136 | }, | 
| 137 | { | 137 | { | 
| 138 | label: 'Vendedor:', | 138 | label: 'Vendedor:', | 
| 139 | valor: $filter('rellenarDigitos')( | 139 | valor: $filter('rellenarDigitos')( | 
| 140 | notaPedido.vendedor.NUM, 3 | 140 | notaPedido.vendedor.NUM, 3 | 
| 141 | ) + ' - ' + notaPedido.vendedor.NOM | 141 | ) + ' - ' + notaPedido.vendedor.NOM | 
| 142 | }, | 142 | }, | 
| 143 | { | 143 | { | 
| 144 | label: 'Proveedor:', | 144 | label: 'Proveedor:', | 
| 145 | valor: $filter('rellenarDigitos') | 145 | valor: $filter('rellenarDigitos') | 
| 146 | (notaPedido.proveedor.COD, 5) + ' - ' + | 146 | (notaPedido.proveedor.COD, 5) + ' - ' + | 
| 147 | notaPedido.proveedor.NOM | 147 | notaPedido.proveedor.NOM | 
| 148 | }, | 148 | }, | 
| 149 | { | 149 | { | 
| 150 | label: 'Precio condicion:', | 150 | label: 'Precio condicion:', | 
| 151 | valor: valorPrecioCondicion() + ' ' + | 151 | valor: valorPrecioCondicion() + ' ' + | 
| 152 | remitoBusinessService | 152 | remitoBusinessService | 
| 153 | .plazoToString(notaPedido.notaPedidoPlazo) | 153 | .plazoToString(notaPedido.notaPedidoPlazo) | 
| 154 | }, | 154 | }, | 
| 155 | { | 155 | { | 
| 156 | label: 'Flete:', | 156 | label: 'Flete:', | 
| 157 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 157 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 
| 158 | notaPedido.flete === 1 ? 'Si' : 'No') | 158 | notaPedido.flete === 1 ? 'Si' : 'No') | 
| 159 | } | 159 | } | 
| 160 | ]; | 160 | ]; | 
| 161 | 161 | ||
| 162 | if (notaPedido.observaciones) { | 162 | if (notaPedido.observaciones) { | 
| 163 | cabeceras.push({ | 163 | cabeceras.push({ | 
| 164 | label: 'Observaciones:', | 164 | label: 'Observaciones:', | 
| 165 | valor: notaPedido.observaciones | 165 | valor: notaPedido.observaciones | 
| 166 | }); | 166 | }); | 
| 167 | } | 167 | } | 
| 168 | 168 | ||
| 169 | function valorPrecioCondicion() { | 169 | function valorPrecioCondicion() { | 
| 170 | if (notaPedido.idPrecioCondicion > 0) { | 170 | if (notaPedido.idPrecioCondicion > 0) { | 
| 171 | return notaPedido.precioCondicion.nombre; | 171 | return notaPedido.precioCondicion.nombre; | 
| 172 | } else { | 172 | } else { | 
| 173 | return 'Ingreso Manual'; | 173 | return 'Ingreso Manual'; | 
| 174 | } | 174 | } | 
| 175 | } | 175 | } | 
| 176 | 176 | ||
| 177 | if (notaPedido.flete === 1) { | 177 | if (notaPedido.flete === 1) { | 
| 178 | var cabeceraBomba = { | 178 | var cabeceraBomba = { | 
| 179 | label: 'Bomba:', | 179 | label: 'Bomba:', | 
| 180 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 180 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 
| 181 | }; | 181 | }; | 
| 182 | if (notaPedido.kilometros) { | 182 | if (notaPedido.kilometros) { | 
| 183 | var cabeceraKilometros = { | 183 | var cabeceraKilometros = { | 
| 184 | label: 'Kilometros:', | 184 | label: 'Kilometros:', | 
| 185 | valor: notaPedido.kilometros | 185 | valor: notaPedido.kilometros | 
| 186 | }; | 186 | }; | 
| 187 | cabeceras.push(cabeceraKilometros); | 187 | cabeceras.push(cabeceraKilometros); | 
| 188 | } | 188 | } | 
| 189 | cabeceras.push(cabeceraBomba); | 189 | cabeceras.push(cabeceraBomba); | 
| 190 | } | 190 | } | 
| 191 | 191 | ||
| 192 | delete notaPedido.id; | 192 | delete notaPedido.id; | 
| 193 | $scope.remito = notaPedido; | 193 | $scope.remito = notaPedido; | 
| 194 | $scope.remito.id = 0; | 194 | $scope.remito.id = 0; | 
| 195 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 195 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 
| 196 | 196 | ||
| 197 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 197 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 
| 198 | notaPedido.articulosNotaPedido[i].id = 0; | 198 | notaPedido.articulosNotaPedido[i].id = 0; | 
| 199 | } | 199 | } | 
| 200 | 200 | ||
| 201 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 201 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 
| 202 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 202 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 
| 203 | notaPedido.cotizacion.VENDEDOR); | 203 | notaPedido.cotizacion.VENDEDOR); | 
| 204 | 204 | ||
| 205 | if (notaPedido.idPrecioCondicion > 0) { | 205 | if (notaPedido.idPrecioCondicion > 0) { | 
| 206 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 206 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 
| 207 | }else { | 207 | }else { | 
| 208 | $scope.idLista = -1; | 208 | $scope.idLista = -1; | 
| 209 | } | 209 | } | 
| 210 | 210 | ||
| 211 | enableObservaciones(notaPedido.observaciones ? true : false); | 211 | enableObservaciones(notaPedido.observaciones ? true : false); | 
| 212 | addArrayCabecera(cabeceras); | 212 | addArrayCabecera(cabeceras); | 
| 213 | 213 | ||
| 214 | }, function() { | 214 | }, function() { | 
| 215 | // funcion ejecutada cuando se cancela el modal | 215 | // funcion ejecutada cuando se cancela el modal | 
| 216 | } | 216 | } | 
| 217 | ); | 217 | ); | 
| 218 | } | 218 | } | 
| 219 | }; | 219 | }; | 
| 220 | 220 | ||
| 221 | $scope.seleccionarRemito = function() { | 221 | $scope.seleccionarRemito = function() { | 
| 222 | var modalInstance = $uibModal.open( | 222 | var modalInstance = $uibModal.open( | 
| 223 | { | 223 | { | 
| 224 | ariaLabelledBy: 'Busqueda de Remito', | 224 | ariaLabelledBy: 'Busqueda de Remito', | 
| 225 | templateUrl: 'foca-modal-remito.html', | 225 | templateUrl: 'foca-modal-remito.html', | 
| 226 | controller: 'focaModalRemitoController', | 226 | controller: 'focaModalRemitoController', | 
| 227 | size: 'lg', | 227 | size: 'lg', | 
| 228 | resolve: {usadoPor: function() {return 'remito';}} | 228 | resolve: {usadoPor: function() {return 'remito';}} | 
| 229 | } | 229 | } | 
| 230 | ); | 230 | ); | 
| 231 | modalInstance.result.then( | 231 | modalInstance.result.then( | 
| 232 | setearRemito, function() { | 232 | setearRemito, function() { | 
| 233 | // funcion ejecutada cuando se cancela el modal | 233 | // funcion ejecutada cuando se cancela el modal | 
| 234 | } | 234 | } | 
| 235 | ); | 235 | ); | 
| 236 | }; | 236 | }; | 
| 237 | 237 | ||
| 238 | //validacion por domicilio y por plazo pago | 238 | //validacion por domicilio y por plazo pago | 
| 239 | $scope.crearRemito = function() { | 239 | $scope.crearRemito = function() { | 
| 240 | if (!$scope.remito.vendedor.NUM) { | 240 | if (!$scope.remito.vendedor.NUM) { | 
| 241 | focaModalService.alert('Ingrese Vendedor'); | 241 | focaModalService.alert('Ingrese Vendedor'); | 
| 242 | return; | 242 | return; | 
| 243 | } else if (!$scope.remito.cliente.COD) { | 243 | } else if (!$scope.remito.cliente.COD) { | 
| 244 | focaModalService.alert('Ingrese Cliente'); | 244 | focaModalService.alert('Ingrese Cliente'); | 
| 245 | return; | 245 | return; | 
| 246 | } else if (!$scope.remito.proveedor) { | 246 | } else if (!$scope.remito.proveedor) { | 
| 247 | focaModalService.alert('Ingrese Proveedor'); | 247 | focaModalService.alert('Ingrese Proveedor'); | 
| 248 | return; | 248 | return; | 
| 249 | } else if (!$scope.remito.cotizacion.moneda.id && | 249 | } else if (!$scope.remito.cotizacion.moneda.id && | 
| 250 | !$scope.remito.cotizacion.moneda.ID) | 250 | !$scope.remito.cotizacion.moneda.ID) | 
| 251 | { | 251 | { | 
| 252 | focaModalService.alert('Ingrese Moneda'); | 252 | focaModalService.alert('Ingrese Moneda'); | 
| 253 | return; | 253 | return; | 
| 254 | } else if (!$scope.remito.cotizacion.ID) { | 254 | } else if (!$scope.remito.cotizacion.ID) { | 
| 255 | focaModalService.alert('Ingrese Cotización'); | 255 | focaModalService.alert('Ingrese Cotización'); | 
| 256 | return; | 256 | return; | 
| 257 | } else if ( | 257 | } else if ( | 
| 258 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 258 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 
| 259 | { | 259 | { | 
| 260 | focaModalService.alert('Ingrese Flete'); | 260 | focaModalService.alert('Ingrese Flete'); | 
| 261 | return; | 261 | return; | 
| 262 | } else if ($scope.remito.articulosRemito.length === 0) { | 262 | } else if ($scope.remito.articulosRemito.length === 0) { | 
| 263 | focaModalService.alert('Debe cargar al menos un articulo'); | 263 | focaModalService.alert('Debe cargar al menos un articulo'); | 
| 264 | return; | 264 | return; | 
| 265 | } | 265 | } | 
| 266 | focaBotoneraLateralService.startGuardar(); | 266 | focaBotoneraLateralService.startGuardar(); | 
| 267 | $scope.saveLoading = true; | 267 | $scope.saveLoading = true; | 
| 268 | var save = { | 268 | var save = { | 
| 269 | remito: { | 269 | remito: { | 
| 270 | id: $scope.remito.id, | 270 | id: $scope.remito.id, | 
| 271 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 271 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 
| 272 | idCliente: $scope.remito.cliente.COD, | 272 | idCliente: $scope.remito.cliente.COD, | 
| 273 | nombreCliente: $scope.remito.cliente.NOM, | 273 | nombreCliente: $scope.remito.cliente.NOM, | 
| 274 | cuitCliente: $scope.remito.cliente.CUIT, | 274 | cuitCliente: $scope.remito.cliente.CUIT, | 
| 275 | responsabilidadIvaCliente: 0,//TODO, | 275 | responsabilidadIvaCliente: 0,//TODO, | 
| 276 | descuento: 0,//TODO, | 276 | descuento: 0,//TODO, | 
| 277 | importeNeto: 0,//TODO | 277 | importeNeto: 0,//TODO | 
| 278 | importeExento: 0,//TODO | 278 | importeExento: 0,//TODO | 
| 279 | importeIva: 0,//TODO | 279 | importeIva: 0,//TODO | 
| 280 | importeIvaServicios: 0,//TODO | 280 | importeIvaServicios: 0,//TODO | 
| 281 | importeImpuestoInterno: 0,//TODO | 281 | importeImpuestoInterno: 0,//TODO | 
| 282 | importeImpuestoInterno1: 0,//TODO | 282 | importeImpuestoInterno1: 0,//TODO | 
| 283 | importeImpuestoInterno2: 0,//TODO | 283 | importeImpuestoInterno2: 0,//TODO | 
| 284 | percepcion: 0,//TODO | 284 | percepcion: 0,//TODO | 
| 285 | percepcionIva: 0,//TODO | 285 | percepcionIva: 0,//TODO | 
| 286 | redondeo: 0,//TODO | 286 | redondeo: 0,//TODO | 
| 287 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 287 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 
| 288 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 288 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 
| 289 | anulado: false, | 289 | anulado: false, | 
| 290 | planilla: 0,//TODO | 290 | planilla: 0,//TODO | 
| 291 | lugar: 0,//TODO | 291 | lugar: 0,//TODO | 
| 292 | cuentaMadre: 0,// | 292 | cuentaMadre: 0,// | 
| 293 | cuentaContable: 0,//TODO | 293 | cuentaContable: 0,//TODO | 
| 294 | asiento: 0,//TODO | 294 | asiento: 0,//TODO | 
| 295 | e_hd: '',//TODO | 295 | e_hd: '',//TODO | 
| 296 | c_hd: '', | 296 | c_hd: '', | 
| 297 | numeroLiquidoProducto: 0,//TODO | 297 | numeroLiquidoProducto: 0,//TODO | 
| 298 | idVendedor: $scope.remito.idVendedor, | 298 | idVendedor: $scope.remito.idVendedor, | 
| 299 | idProveedor: $scope.remito.idProveedor, | 299 | idProveedor: $scope.remito.idProveedor, | 
| 300 | idDomicilio: $scope.remito.idDomicilio, | 300 | idDomicilio: $scope.remito.idDomicilio, | 
| 301 | idCotizacion: $scope.remito.cotizacion.ID, | 301 | idCotizacion: $scope.remito.cotizacion.ID, | 
| 302 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 302 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 
| 303 | flete: $scope.remito.flete, | 303 | flete: $scope.remito.flete, | 
| 304 | fob: $scope.remito.fob, | 304 | fob: $scope.remito.fob, | 
| 305 | bomba: $scope.remito.bomba, | 305 | bomba: $scope.remito.bomba, | 
| 306 | kilometros: $scope.remito.kilometros, | 306 | kilometros: $scope.remito.kilometros, | 
| 307 | domicilioStamp: $scope.remito.domicilioStamp, | 307 | domicilioStamp: $scope.remito.domicilioStamp, | 
| 308 | estado: 0,//TODO | 308 | estado: 0,//TODO | 
| 309 | destinoVenta: 0,//TODO | 309 | destinoVenta: 0,//TODO | 
| 310 | operacionTipo: 0//TODO | 310 | operacionTipo: 0//TODO | 
| 311 | }, | 311 | }, | 
| 312 | notaPedido: $scope.notaPedido | 312 | notaPedido: $scope.notaPedido | 
| 313 | }; | 313 | }; | 
| 314 | 314 | ||
| 315 | crearRemitoService.crearRemito(save).then( | 315 | crearRemitoService.crearRemito(save).then( | 
| 316 | function(data) { | 316 | function(data) { | 
| 317 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | ||
| 318 | data.data.id, $scope.remito.cotizacion.COTIZACION); | ||
| 319 | 317 | ||
| 320 | focaBotoneraLateralService.endGuardar(true); | 318 | focaBotoneraLateralService.endGuardar(true); | 
| 321 | $scope.saveLoading = false; | 319 | $scope.saveLoading = false; | 
| 322 | 320 | ||
| 323 | //TODO: updatear plazos | 321 | // TODO: updatear plazos | 
| 324 | if ($scope.remito.id === 0) { | 322 | if ($scope.remito.id === 0) { | 
| 323 | |||
| 324 | $scope.remito.id = data.data.id; | ||
| 325 | $scope.remito.numeroRemito = data.data.numero; | ||
| 326 | |||
| 327 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | ||
| 328 | $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); | ||
| 329 | |||
| 325 | var plazos = $scope.remito.remitoPlazo; | 330 | var plazos = $scope.remito.remitoPlazo; | 
| 326 | 331 | ||
| 327 | for(var j = 0; j < plazos.length; j++) { | 332 | for(var j = 0; j < plazos.length; j++) { | 
| 328 | var json = { | 333 | var json = { | 
| 329 | idRemito: $scope.remito.id, | 334 | idRemito: $scope.remito.id, | 
| 330 | dias: plazos[j].dias | 335 | dias: plazos[j].dias | 
| 331 | }; | 336 | }; | 
| 332 | crearRemitoService.crearPlazosParaRemito(json); | 337 | crearRemitoService.crearPlazosParaRemito(json); | 
| 333 | } | 338 | } | 
| 334 | } | 339 | } | 
| 335 | abrirModalMail(data.data.id, $scope.remito.cliente, $filter('comprobante')([ | 340 | |
| 336 | data.data.sucursal, | 341 | abrirModalMail($scope.remito.id, | 
| 337 | data.data.numero | 342 | $scope.remito.cliente, | 
| 338 | ])); | 343 | $filter('comprobante')([ | 
| 344 | $scope.puntoVenta, | ||
| 345 | $scope.remito.numeroRemito | ||
| 346 | ]) | ||
| 347 | ); | ||
| 339 | 348 | ||
| 340 | init(); | 349 | init(); | 
| 341 | 350 | ||
| 342 | }, function(error) { | 351 | }, function(error) { | 
| 343 | focaModalService.alert('Hubo un error al crear el remito'); | 352 | focaModalService.alert('Hubo un error al crear el remito'); | 
| 344 | focaBotoneraLateralService.endGuardar(); | 353 | focaBotoneraLateralService.endGuardar(); | 
| 345 | $scope.saveLoading = false; | 354 | $scope.saveLoading = false; | 
| 346 | console.info(error); | 355 | console.info(error); | 
| 347 | } | 356 | } | 
| 348 | ); | 357 | ); | 
| 349 | }; | 358 | }; | 
| 350 | 359 | ||
| 351 | $scope.seleccionarProductos = function() { | 360 | $scope.seleccionarProductos = function() { | 
| 352 | if ($scope.idLista === undefined) { | 361 | if ($scope.idLista === undefined) { | 
| 353 | focaModalService.alert( | 362 | focaModalService.alert( | 
| 354 | 'Primero seleccione una lista de precio y condicion'); | 363 | 'Primero seleccione una lista de precio y condicion'); | 
| 355 | return; | 364 | return; | 
| 356 | } | 365 | } | 
| 357 | var modalInstance = $uibModal.open( | 366 | var modalInstance = $uibModal.open( | 
| 358 | { | 367 | { | 
| 359 | ariaLabelledBy: 'Busqueda de Productos', | 368 | ariaLabelledBy: 'Busqueda de Productos', | 
| 360 | templateUrl: 'modal-busqueda-productos.html', | 369 | templateUrl: 'modal-busqueda-productos.html', | 
| 361 | controller: 'modalBusquedaProductosCtrl', | 370 | controller: 'modalBusquedaProductosCtrl', | 
| 362 | resolve: { | 371 | resolve: { | 
| 363 | parametroProducto: { | 372 | parametroProducto: { | 
| 364 | idLista: $scope.idLista, | 373 | idLista: $scope.idLista, | 
| 365 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 374 | cotizacion: $scope.remito.cotizacion.VENDEDOR, | 
| 366 | simbolo: $scope.remito.cotizacion.moneda.simbolo | 375 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO | 
| 367 | } | 376 | } | 
| 368 | }, | 377 | }, | 
| 369 | size: 'lg' | 378 | size: 'lg' | 
| 370 | } | 379 | } | 
| 371 | ); | 380 | ); | 
| 372 | modalInstance.result.then( | 381 | modalInstance.result.then( | 
| 373 | function(producto) { | 382 | function(producto) { | 
| 374 | var newArt = | 383 | var newArt = | 
| 375 | { | 384 | { | 
| 376 | id: 0, | 385 | id: 0, | 
| 377 | codigo: producto.codigo, | 386 | codigo: producto.codigo, | 
| 378 | sector: producto.sector, | 387 | sector: producto.sector, | 
| 379 | sectorCodigo: producto.sector + '-' + producto.codigo, | 388 | sectorCodigo: producto.sector + '-' + producto.codigo, | 
| 380 | descripcion: producto.descripcion, | 389 | descripcion: producto.descripcion, | 
| 381 | item: $scope.remito.articulosRemito.length + 1, | 390 | item: $scope.remito.articulosRemito.length + 1, | 
| 382 | nombre: producto.descripcion, | 391 | nombre: producto.descripcion, | 
| 383 | precio: parseFloat(producto.precio.toFixed(4)), | 392 | precio: parseFloat(producto.precio.toFixed(4)), | 
| 384 | costoUnitario: producto.costo, | 393 | costoUnitario: producto.costo, | 
| 385 | editCantidad: false, | 394 | editCantidad: false, | 
| 386 | editPrecio: false, | 395 | editPrecio: false, | 
| 387 | rubro: producto.CodRub, | 396 | rubro: producto.CodRub, | 
| 388 | exentoUnitario: producto.precio, | 397 | exentoUnitario: producto.precio, | 
| 389 | ivaUnitario: producto.IMPIVA, | 398 | ivaUnitario: producto.IMPIVA, | 
| 390 | impuestoInternoUnitario: producto.ImpInt, | 399 | impuestoInternoUnitario: producto.ImpInt, | 
| 391 | impuestoInterno1Unitario: producto.ImpInt2, | 400 | impuestoInterno1Unitario: producto.ImpInt2, | 
| 392 | impuestoInterno2Unitario: producto.ImpInt3, | 401 | impuestoInterno2Unitario: producto.ImpInt3, | 
| 393 | precioLista: producto.precio, | 402 | precioLista: producto.precio, | 
| 394 | combustible: 1, | 403 | combustible: 1, | 
| 395 | facturado: 0 | 404 | facturado: 0 | 
| 396 | }; | 405 | }; | 
| 397 | $scope.articuloACargar = newArt; | 406 | $scope.articuloACargar = newArt; | 
| 398 | $scope.cargando = false; | 407 | $scope.cargando = false; | 
| 399 | }, function() { | 408 | }, function() { | 
| 400 | // funcion ejecutada cuando se cancela el modal | 409 | // funcion ejecutada cuando se cancela el modal | 
| 401 | } | 410 | } | 
| 402 | ); | 411 | ); | 
| 403 | }; | 412 | }; | 
| 404 | 413 | ||
| 405 | $scope.seleccionarPuntosDeDescarga = function() { | 414 | $scope.seleccionarPuntosDeDescarga = function() { | 
| 406 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 415 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 
| 407 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 416 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 
| 408 | return; | 417 | return; | 
| 409 | }else { | 418 | }else { | 
| 410 | var modalInstance = $uibModal.open( | 419 | var modalInstance = $uibModal.open( | 
| 411 | { | 420 | { | 
| 412 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 421 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 
| 413 | templateUrl: 'modal-punto-descarga.html', | 422 | templateUrl: 'modal-punto-descarga.html', | 
| 414 | controller: 'focaModalPuntoDescargaController', | 423 | controller: 'focaModalPuntoDescargaController', | 
| 415 | size: 'lg', | 424 | size: 'lg', | 
| 416 | resolve: { | 425 | resolve: { | 
| 417 | filters: { | 426 | filters: { | 
| 418 | idDomicilio: $scope.remito.domicilio.id, | 427 | idDomicilio: $scope.remito.domicilio.id, | 
| 419 | idCliente: $scope.remito.cliente.COD, | 428 | idCliente: $scope.remito.cliente.COD, | 
| 420 | articulos: $scope.remito.articulosRemito, | 429 | articulos: $scope.remito.articulosRemito, | 
| 421 | puntosDescarga: $scope.remito.domicilio.puntosDescarga | 430 | puntosDescarga: $scope.remito.domicilio.puntosDescarga | 
| 422 | } | 431 | } | 
| 423 | } | 432 | } | 
| 424 | } | 433 | } | 
| 425 | ); | 434 | ); | 
| 426 | modalInstance.result.then( | 435 | modalInstance.result.then( | 
| 427 | function(puntosDescarga) { | 436 | function(puntosDescarga) { | 
| 428 | $scope.remito.puntosDescarga = puntosDescarga; | 437 | $scope.remito.puntosDescarga = puntosDescarga; | 
| 429 | 438 | ||
| 430 | //AGREGO PUNTOS DE DESCARGA A CABECERA | 439 | //AGREGO PUNTOS DE DESCARGA A CABECERA | 
| 431 | var puntosStamp = ''; | 440 | var puntosStamp = ''; | 
| 432 | puntosDescarga.forEach(function(punto, idx, arr) { | 441 | puntosDescarga.forEach(function(punto, idx, arr) { | 
| 433 | puntosStamp += punto.descripcion; | 442 | puntosStamp += punto.descripcion; | 
| 434 | if ((idx + 1) !== arr.length) puntosStamp += ', '; | 443 | if ((idx + 1) !== arr.length) puntosStamp += ', '; | 
| 435 | }); | 444 | }); | 
| 436 | 445 | ||
| 437 | $scope.$broadcast('addCabecera', { | 446 | $scope.$broadcast('addCabecera', { | 
| 438 | label: 'Puntos de descarga:', | 447 | label: 'Puntos de descarga:', | 
| 439 | valor: puntosStamp | 448 | valor: puntosStamp | 
| 440 | }); | 449 | }); | 
| 441 | }, function() { | 450 | }, function() { | 
| 442 | $scope.abrirModalDomicilios($scope.cliente); | 451 | $scope.abrirModalDomicilios($scope.cliente); | 
| 443 | } | 452 | } | 
| 444 | ); | 453 | ); | 
| 445 | } | 454 | } | 
| 446 | }; | 455 | }; | 
| 447 | 456 | ||
| 448 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { | 457 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { | 
| 449 | if (ocultarVendedor) { | 458 | if (ocultarVendedor) { | 
| 450 | callback(); | 459 | callback(); | 
| 451 | return; | 460 | return; | 
| 452 | } | 461 | } | 
| 453 | 462 | ||
| 454 | if (varlidarRemitoFacturado()) { | 463 | if (varlidarRemitoFacturado()) { | 
| 455 | var parametrosModal = { | 464 | var parametrosModal = { | 
| 456 | titulo: 'Búsqueda vendedores', | 465 | titulo: 'Búsqueda vendedores', | 
| 457 | query: '/vendedor', | 466 | query: '/vendedor', | 
| 458 | columnas: [ | 467 | columnas: [ | 
| 459 | { | 468 | { | 
| 460 | propiedad: 'NUM', | 469 | propiedad: 'NUM', | 
| 461 | nombre: 'Código', | 470 | nombre: 'Código', | 
| 462 | filtro: { | 471 | filtro: { | 
| 463 | nombre: 'rellenarDigitos', | 472 | nombre: 'rellenarDigitos', | 
| 464 | parametro: 3 | 473 | parametro: 3 | 
| 465 | } | 474 | } | 
| 466 | }, | 475 | }, | 
| 467 | { | 476 | { | 
| 468 | propiedad: 'NOM', | 477 | propiedad: 'NOM', | 
| 469 | nombre: 'Nombre' | 478 | nombre: 'Nombre' | 
| 470 | } | 479 | } | 
| 471 | ], | 480 | ], | 
| 472 | size: 'md' | 481 | size: 'md' | 
| 473 | }; | 482 | }; | 
| 474 | focaModalService.modal(parametrosModal).then( | 483 | focaModalService.modal(parametrosModal).then( | 
| 475 | function(vendedor) { | 484 | function(vendedor) { | 
| 476 | $scope.$broadcast('addCabecera',{ | 485 | $scope.$broadcast('addCabecera',{ | 
| 477 | label: 'Vendedor:', | 486 | label: 'Vendedor:', | 
| 478 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 487 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 
| 479 | vendedor.NOM | 488 | vendedor.NOM | 
| 480 | }); | 489 | }); | 
| 481 | $scope.remito.idVendedor = vendedor.id; | 490 | $scope.remito.idVendedor = vendedor.id; | 
| 482 | $scope.remito.vendedor = vendedor; | 491 | $scope.remito.vendedor = vendedor; | 
| 483 | deleteCliente(); | 492 | deleteCliente(); | 
| 484 | callback(); | 493 | callback(); | 
| 485 | }, function() { | 494 | }, function() { | 
| 486 | 495 | ||
| 487 | } | 496 | } | 
| 488 | ); | 497 | ); | 
| 489 | } | 498 | } | 
| 490 | }; | 499 | }; | 
| 491 | 500 | ||
| 492 | $scope.seleccionarCliente = function(ocultarVendedor) { | 501 | $scope.seleccionarCliente = function(ocultarVendedor) { | 
| 493 | 502 | ||
| 494 | $scope.seleccionarVendedor(function() { | 503 | $scope.seleccionarVendedor(function() { | 
| 495 | if (varlidarRemitoFacturado()) { | 504 | if (varlidarRemitoFacturado()) { | 
| 496 | var modalInstance = $uibModal.open( | 505 | var modalInstance = $uibModal.open( | 
| 497 | { | 506 | { | 
| 498 | ariaLabelledBy: 'Busqueda de Cliente', | 507 | ariaLabelledBy: 'Busqueda de Cliente', | 
| 499 | templateUrl: 'foca-busqueda-cliente-modal.html', | 508 | templateUrl: 'foca-busqueda-cliente-modal.html', | 
| 500 | controller: 'focaBusquedaClienteModalController', | 509 | controller: 'focaBusquedaClienteModalController', | 
| 501 | resolve: { | 510 | resolve: { | 
| 502 | vendedor: function() { return $scope.remito.vendedor; }, | 511 | vendedor: function() { return $scope.remito.vendedor; }, | 
| 503 | cobrador: function() { return null; } | 512 | cobrador: function() { return null; } | 
| 504 | }, | 513 | }, | 
| 505 | size: 'lg' | 514 | size: 'lg' | 
| 506 | } | 515 | } | 
| 507 | ); | 516 | ); | 
| 508 | modalInstance.result.then( | 517 | modalInstance.result.then( | 
| 509 | function(cliente) { | 518 | function(cliente) { | 
| 510 | $scope.abrirModalDomicilios(cliente); | 519 | $scope.abrirModalDomicilios(cliente); | 
| 511 | $scope.cliente = cliente; | 520 | $scope.cliente = cliente; | 
| 512 | }, function() { | 521 | }, function() { | 
| 513 | $scope.seleccionarCliente(); | 522 | $scope.seleccionarCliente(); | 
| 514 | } | 523 | } | 
| 515 | ); | 524 | ); | 
| 516 | } | 525 | } | 
| 517 | }, ocultarVendedor); | 526 | }, ocultarVendedor); | 
| 518 | }; | 527 | }; | 
| 519 | 528 | ||
| 520 | $scope.seleccionarProveedor = function(callback) { | 529 | $scope.seleccionarProveedor = function(callback) { | 
| 521 | if (varlidarRemitoFacturado()) { | 530 | if (varlidarRemitoFacturado()) { | 
| 522 | var parametrosModal = { | 531 | var parametrosModal = { | 
| 523 | titulo: 'Búsqueda de Proveedor', | 532 | titulo: 'Búsqueda de Proveedor', | 
| 524 | query: '/proveedor', | 533 | query: '/proveedor', | 
| 525 | columnas: [ | 534 | columnas: [ | 
| 526 | { | 535 | { | 
| 527 | nombre: 'Código', | 536 | nombre: 'Código', | 
| 528 | propiedad: 'COD', | 537 | propiedad: 'COD', | 
| 529 | filtro: { | 538 | filtro: { | 
| 530 | nombre: 'rellenarDigitos', | 539 | nombre: 'rellenarDigitos', | 
| 531 | parametro: 5 | 540 | parametro: 5 | 
| 532 | } | 541 | } | 
| 533 | }, | 542 | }, | 
| 534 | { | 543 | { | 
| 535 | nombre: 'Nombre', | 544 | nombre: 'Nombre', | 
| 536 | propiedad: 'NOM' | 545 | propiedad: 'NOM' | 
| 537 | }, | 546 | }, | 
| 538 | { | 547 | { | 
| 539 | nombre: 'CUIT', | 548 | nombre: 'CUIT', | 
| 540 | propiedad: 'CUIT' | 549 | propiedad: 'CUIT' | 
| 541 | } | 550 | } | 
| 542 | ], | 551 | ], | 
| 543 | tipo: 'POST', | 552 | tipo: 'POST', | 
| 544 | json: {razonCuitCod: ''} | 553 | json: {razonCuitCod: ''} | 
| 545 | }; | 554 | }; | 
| 546 | focaModalService.modal(parametrosModal).then( | 555 | focaModalService.modal(parametrosModal).then( | 
| 547 | function(proveedor) { | 556 | function(proveedor) { | 
| 548 | $scope.remito.proveedor = proveedor; | 557 | $scope.remito.proveedor = proveedor; | 
| 549 | $scope.remito.idProveedor = proveedor.COD; | 558 | $scope.remito.idProveedor = proveedor.COD; | 
| 550 | 559 | ||
| 551 | $scope.$broadcast('addCabecera',{ | 560 | $scope.$broadcast('addCabecera',{ | 
| 552 | label: 'Proveedor:', | 561 | label: 'Proveedor:', | 
| 553 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 562 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 
| 554 | proveedor.NOM | 563 | proveedor.NOM | 
| 555 | }); | 564 | }); | 
| 556 | callback(); | 565 | callback(); | 
| 557 | }, function() { } | 566 | }, function() { } | 
| 558 | ); | 567 | ); | 
| 559 | } | 568 | } | 
| 560 | }; | 569 | }; | 
| 561 | 570 | ||
| 562 | $scope.abrirModalDomicilios = function(cliente) { | 571 | $scope.abrirModalDomicilios = function(cliente) { | 
| 563 | var modalInstanceDomicilio = $uibModal.open( | 572 | var modalInstanceDomicilio = $uibModal.open( | 
| 564 | { | 573 | { | 
| 565 | ariaLabelledBy: 'Busqueda de Domicilios', | 574 | ariaLabelledBy: 'Busqueda de Domicilios', | 
| 566 | templateUrl: 'modal-domicilio.html', | 575 | templateUrl: 'modal-domicilio.html', | 
| 567 | controller: 'focaModalDomicilioController', | 576 | controller: 'focaModalDomicilioController', | 
| 568 | size: 'lg', | 577 | size: 'lg', | 
| 569 | resolve: { | 578 | resolve: { | 
| 570 | idCliente: function() { return cliente.cod; }, | 579 | idCliente: function() { return cliente.cod; }, | 
| 571 | esNuevo: function() { return cliente.esNuevo; } | 580 | esNuevo: function() { return cliente.esNuevo; } | 
| 572 | } | 581 | } | 
| 573 | } | 582 | } | 
| 574 | ); | 583 | ); | 
| 575 | modalInstanceDomicilio.result.then( | 584 | modalInstanceDomicilio.result.then( | 
| 576 | function(domicilio) { | 585 | function(domicilio) { | 
| 577 | $scope.remito.domicilio = domicilio; | 586 | $scope.remito.domicilio = domicilio; | 
| 578 | $scope.remito.cliente = { | 587 | $scope.remito.cliente = { | 
| 579 | COD: cliente.cod, | 588 | COD: cliente.cod, | 
| 580 | CUIT: cliente.cuit, | 589 | CUIT: cliente.cuit, | 
| 581 | NOM: cliente.nom, | 590 | NOM: cliente.nom, | 
| 582 | MAIL: cliente.mail, | 591 | MAIL: cliente.mail, | 
| 583 | MOD: cliente.mod | 592 | MOD: cliente.mod | 
| 584 | }; | 593 | }; | 
| 585 | 594 | ||
| 586 | 595 | ||
| 587 | var domicilioStamp = | 596 | var domicilioStamp = | 
| 588 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 597 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 
| 589 | domicilio.Localidad + ', ' + domicilio.Provincia; | 598 | domicilio.Localidad + ', ' + domicilio.Provincia; | 
| 590 | $scope.remito.domicilioStamp = domicilioStamp; | 599 | $scope.remito.domicilioStamp = domicilioStamp; | 
| 591 | 600 | ||
| 592 | $scope.$broadcast('addCabecera',{ | 601 | $scope.$broadcast('addCabecera',{ | 
| 593 | label: 'Cliente:', | 602 | label: 'Cliente:', | 
| 594 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 603 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 
| 595 | }); | 604 | }); | 
| 596 | $scope.$broadcast('addCabecera',{ | 605 | $scope.$broadcast('addCabecera',{ | 
| 597 | label: 'Domicilio:', | 606 | label: 'Domicilio:', | 
| 598 | valor: domicilioStamp | 607 | valor: domicilioStamp | 
| 599 | }); | 608 | }); | 
| 600 | 609 | ||
| 601 | if (domicilio.verPuntos) { | 610 | if (domicilio.verPuntos) { | 
| 602 | delete $scope.remito.domicilio.verPuntos; | 611 | delete $scope.remito.domicilio.verPuntos; | 
| 603 | $scope.seleccionarPuntosDeDescarga(); | 612 | $scope.seleccionarPuntosDeDescarga(); | 
| 604 | }else { | 613 | }else { | 
| 605 | crearRemitoService | 614 | crearRemitoService | 
| 606 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 615 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 
| 607 | .then(function(res) { | 616 | .then(function(res) { | 
| 608 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | 617 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | 
| 609 | }); | 618 | }); | 
| 610 | } | 619 | } | 
| 611 | }, function() { | 620 | }, function() { | 
| 612 | $scope.seleccionarCliente(true); | 621 | $scope.seleccionarCliente(true); | 
| 613 | return; | 622 | return; | 
| 614 | } | 623 | } | 
| 615 | ); | 624 | ); | 
| 616 | }; | 625 | }; | 
| 617 | 626 | ||
| 618 | $scope.getTotal = function() { | 627 | $scope.getTotal = function() { | 
| 619 | var total = 0; | 628 | var total = 0; | 
| 620 | var arrayTempArticulos = $scope.remito.articulosRemito; | 629 | var arrayTempArticulos = $scope.remito.articulosRemito; | 
| 621 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 630 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 
| 622 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 631 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 
| 623 | } | 632 | } | 
| 624 | return parseFloat(total.toFixed(2)); | 633 | return parseFloat(total.toFixed(2)); | 
| 625 | }; | 634 | }; | 
| 626 | 635 | ||
| 627 | $scope.getSubTotal = function() { | 636 | $scope.getSubTotal = function() { | 
| 628 | if ($scope.articuloACargar) { | 637 | if ($scope.articuloACargar) { | 
| 629 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 638 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 
| 630 | } | 639 | } | 
| 631 | }; | 640 | }; | 
| 632 | 641 | ||
| 633 | $scope.seleccionarPreciosYCondiciones = function() { | 642 | $scope.seleccionarPreciosYCondiciones = function() { | 
| 634 | if (!$scope.remito.cliente.COD) { | 643 | if (!$scope.remito.cliente.COD) { | 
| 635 | focaModalService.alert('Primero seleccione un cliente'); | 644 | focaModalService.alert('Primero seleccione un cliente'); | 
| 636 | return; | 645 | return; | 
| 637 | } | 646 | } | 
| 638 | if (varlidarRemitoFacturado()) { | 647 | if (varlidarRemitoFacturado()) { | 
| 639 | var modalInstance = $uibModal.open( | 648 | var modalInstance = $uibModal.open( | 
| 640 | { | 649 | { | 
| 641 | ariaLabelledBy: 'Busqueda de Precio Condición', | 650 | ariaLabelledBy: 'Busqueda de Precio Condición', | 
| 642 | templateUrl: 'modal-precio-condicion.html', | 651 | templateUrl: 'modal-precio-condicion.html', | 
| 643 | controller: 'focaModalPrecioCondicionController', | 652 | controller: 'focaModalPrecioCondicionController', | 
| 644 | size: 'lg', | 653 | size: 'lg', | 
| 645 | resolve: { | 654 | resolve: { | 
| 646 | idListaPrecio: function() { | 655 | idListaPrecio: function() { | 
| 647 | return $scope.remito.cliente.MOD || null; | 656 | return $scope.remito.cliente.MOD || null; | 
| 648 | } | 657 | } | 
| 649 | } | 658 | } | 
| 650 | } | 659 | } | 
| 651 | ); | 660 | ); | 
| 652 | modalInstance.result.then( | 661 | modalInstance.result.then( | 
| 653 | function(precioCondicion) { | 662 | function(precioCondicion) { | 
| 654 | var cabecera = ''; | 663 | var cabecera = ''; | 
| 655 | var plazosConcat = ''; | 664 | var plazosConcat = ''; | 
| 656 | if (!Array.isArray(precioCondicion)) { | 665 | if (!Array.isArray(precioCondicion)) { | 
| 657 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 666 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 
| 658 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 667 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 
| 659 | $scope.idLista = precioCondicion.idListaPrecio; | 668 | $scope.idLista = precioCondicion.idListaPrecio; | 
| 660 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 669 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 
| 661 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 670 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 
| 662 | } | 671 | } | 
| 663 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 672 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 
| 664 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 673 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 
| 665 | }else { //Cuando se ingresan los plazos manualmente | 674 | }else { //Cuando se ingresan los plazos manualmente | 
| 666 | $scope.remito.idPrecioCondicion = 0; | 675 | $scope.remito.idPrecioCondicion = 0; | 
| 667 | //-1, el modal productos busca todos los productos | 676 | //-1, el modal productos busca todos los productos | 
| 668 | $scope.idLista = -1; | 677 | $scope.idLista = -1; | 
| 669 | $scope.remito.remitoPlazo = precioCondicion; | 678 | $scope.remito.remitoPlazo = precioCondicion; | 
| 670 | for(var j = 0; j < precioCondicion.length; j++) { | 679 | for(var j = 0; j < precioCondicion.length; j++) { | 
| 671 | plazosConcat += precioCondicion[j].dias + ' '; | 680 | plazosConcat += precioCondicion[j].dias + ' '; | 
| 672 | } | 681 | } | 
| 673 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 682 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 
| 674 | } | 683 | } | 
| 675 | $scope.remito.articulosRemito = []; | 684 | $scope.remito.articulosRemito = []; | 
| 676 | $scope.$broadcast('addCabecera',{ | 685 | $scope.$broadcast('addCabecera',{ | 
| 677 | label: 'Precios y condiciones:', | 686 | label: 'Precios y condiciones:', | 
| 678 | valor: cabecera | 687 | valor: cabecera | 
| 679 | }); | 688 | }); | 
| 680 | 689 | ||
| 681 | $scope.remito.precioCondicion = precioCondicion; | 690 | $scope.remito.precioCondicion = precioCondicion; | 
| 682 | }, function() { | 691 | }, function() { | 
| 683 | 692 | ||
| 684 | } | 693 | } | 
| 685 | ); | 694 | ); | 
| 686 | } | 695 | } | 
| 687 | }; | 696 | }; | 
| 688 | 697 | ||
| 689 | $scope.seleccionarTransportista = function() { | 698 | $scope.seleccionarTransportista = function() { | 
| 690 | $scope.seleccionarProveedor(function() { | 699 | $scope.seleccionarProveedor(function() { | 
| 691 | if (varlidarRemitoFacturado()) { | 700 | if (varlidarRemitoFacturado()) { | 
| 692 | var modalInstance = $uibModal.open( | 701 | var modalInstance = $uibModal.open( | 
| 693 | { | 702 | { | 
| 694 | ariaLabelledBy: 'Busqueda de Flete', | 703 | ariaLabelledBy: 'Busqueda de Flete', | 
| 695 | templateUrl: 'modal-flete.html', | 704 | templateUrl: 'modal-flete.html', | 
| 696 | controller: 'focaModalFleteController', | 705 | controller: 'focaModalFleteController', | 
| 697 | size: 'lg', | 706 | size: 'lg', | 
| 698 | resolve: { | 707 | resolve: { | 
| 699 | parametrosFlete: | 708 | parametrosFlete: | 
| 700 | function() { | 709 | function() { | 
| 701 | return { | 710 | return { | 
| 702 | flete: $scope.remito.flete ? '1' : | 711 | flete: $scope.remito.flete ? '1' : | 
| 703 | ($scope.remito.fob ? 'FOB' : | 712 | ($scope.remito.fob ? 'FOB' : | 
| 704 | ($scope.remito.flete === undefined ? | 713 | ($scope.remito.flete === undefined ? | 
| 705 | null : '0')), | 714 | null : '0')), | 
| 706 | bomba: $scope.remito.bomba ? '1' : | 715 | bomba: $scope.remito.bomba ? '1' : | 
| 707 | ($scope.remito.bomba === undefined ? | 716 | ($scope.remito.bomba === undefined ? | 
| 708 | null : '0'), | 717 | null : '0'), | 
| 709 | kilometros: $scope.remito.kilometros | 718 | kilometros: $scope.remito.kilometros | 
| 710 | }; | 719 | }; | 
| 711 | } | 720 | } | 
| 712 | } | 721 | } | 
| 713 | } | 722 | } | 
| 714 | ); | 723 | ); | 
| 715 | modalInstance.result.then( | 724 | modalInstance.result.then( | 
| 716 | function(datos) { | 725 | function(datos) { | 
| 717 | $scope.remito.flete = datos.flete; | 726 | $scope.remito.flete = datos.flete; | 
| 718 | $scope.remito.fob = datos.FOB; | 727 | $scope.remito.fob = datos.FOB; | 
| 719 | $scope.remito.bomba = datos.bomba; | 728 | $scope.remito.bomba = datos.bomba; | 
| 720 | $scope.remito.kilometros = datos.kilometros; | 729 | $scope.remito.kilometros = datos.kilometros; | 
| 721 | 730 | ||
| 722 | $scope.$broadcast('addCabecera',{ | 731 | $scope.$broadcast('addCabecera',{ | 
| 723 | label: 'Flete:', | 732 | label: 'Flete:', | 
| 724 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 733 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 
| 725 | }); | 734 | }); | 
| 726 | if (datos.flete) { | 735 | if (datos.flete) { | 
| 727 | $scope.$broadcast('addCabecera',{ | 736 | $scope.$broadcast('addCabecera',{ | 
| 728 | label: 'Bomba:', | 737 | label: 'Bomba:', | 
| 729 | valor: datos.bomba ? 'Si' : 'No' | 738 | valor: datos.bomba ? 'Si' : 'No' | 
| 730 | }); | 739 | }); | 
| 731 | $scope.$broadcast('addCabecera',{ | 740 | $scope.$broadcast('addCabecera',{ | 
| 732 | label: 'Kilometros:', | 741 | label: 'Kilometros:', | 
| 733 | valor: datos.kilometros | 742 | valor: datos.kilometros | 
| 734 | }); | 743 | }); | 
| 735 | } else { | 744 | } else { | 
| 736 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 745 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 
| 737 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 746 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 
| 738 | $scope.remito.fob = false; | 747 | $scope.remito.fob = false; | 
| 739 | $scope.remito.bomba = false; | 748 | $scope.remito.bomba = false; | 
| 740 | $scope.remito.kilometros = null; | 749 | $scope.remito.kilometros = null; | 
| 741 | } | 750 | } | 
| 742 | }, function() { | 751 | }, function() { | 
| 743 | $scope.seleccionarTransportista(); | 752 | $scope.seleccionarTransportista(); | 
| 744 | } | 753 | } | 
| 745 | ); | 754 | ); | 
| 746 | } | 755 | } | 
| 747 | }); | 756 | }); | 
| 748 | }; | 757 | }; | 
| 749 | 758 | ||
| 750 | $scope.seleccionarMoneda = function() { | 759 | $scope.seleccionarMoneda = function() { | 
| 751 | if (varlidarRemitoFacturado()) { | 760 | if (varlidarRemitoFacturado()) { | 
| 752 | var parametrosModal = { | 761 | var parametrosModal = { | 
| 753 | titulo: 'Búsqueda de monedas', | 762 | titulo: 'Búsqueda de monedas', | 
| 754 | query: '/moneda', | 763 | query: '/moneda', | 
| 755 | columnas: [ | 764 | columnas: [ | 
| 756 | { | 765 | { | 
| 757 | propiedad: 'DETALLE', | 766 | propiedad: 'DETALLE', | 
| 758 | nombre: 'Nombre' | 767 | nombre: 'Nombre' | 
| 759 | }, | 768 | }, | 
| 760 | { | 769 | { | 
| 761 | propiedad: 'SIMBOLO', | 770 | propiedad: 'SIMBOLO', | 
| 762 | nombre: 'Símbolo' | 771 | nombre: 'Símbolo' | 
| 763 | } | 772 | } | 
| 764 | ], | 773 | ], | 
| 765 | size: 'md' | 774 | size: 'md' | 
| 766 | }; | 775 | }; | 
| 767 | focaModalService.modal(parametrosModal).then( | 776 | focaModalService.modal(parametrosModal).then( | 
| 768 | function(moneda) { | 777 | function(moneda) { | 
| 769 | $scope.abrirModalCotizacion(moneda); | 778 | $scope.abrirModalCotizacion(moneda); | 
| 770 | }, function() { | 779 | }, function() { | 
| 771 | 780 | ||
| 772 | } | 781 | } | 
| 773 | ); | 782 | ); | 
| 774 | } | 783 | } | 
| 775 | }; | 784 | }; | 
| 776 | 785 | ||
| 777 | $scope.seleccionarObservaciones = function() { | 786 | $scope.seleccionarObservaciones = function() { | 
| 778 | focaModalService | 787 | focaModalService | 
| 779 | .prompt({ | 788 | .prompt({ | 
| 780 | titulo: 'Observaciones', | 789 | titulo: 'Observaciones', | 
| 781 | value: $scope.remito.observaciones, | 790 | value: $scope.remito.observaciones, | 
| 782 | textarea: true, | 791 | textarea: true, | 
| 783 | readonly: true | 792 | readonly: true | 
| 784 | }) | 793 | }) | 
| 785 | .then(function(observaciones) { | 794 | .then(function(observaciones) { | 
| 786 | $scope.remito.observaciones = observaciones; | 795 | $scope.remito.observaciones = observaciones; | 
| 787 | }); | 796 | }); | 
| 788 | }; | 797 | }; | 
| 789 | 798 | ||
| 790 | $scope.abrirModalCotizacion = function(moneda) { | 799 | $scope.abrirModalCotizacion = function(moneda) { | 
| 791 | var modalInstance = $uibModal.open( | 800 | var modalInstance = $uibModal.open( | 
| 792 | { | 801 | { | 
| 793 | ariaLabelledBy: 'Busqueda de Cotización', | 802 | ariaLabelledBy: 'Busqueda de Cotización', | 
| 794 | templateUrl: 'modal-cotizacion.html', | 803 | templateUrl: 'modal-cotizacion.html', | 
| 795 | controller: 'focaModalCotizacionController', | 804 | controller: 'focaModalCotizacionController', | 
| 796 | size: 'lg', | 805 | size: 'lg', | 
| 797 | resolve: {idMoneda: function() {return moneda.ID;}} | 806 | resolve: {idMoneda: function() {return moneda.ID;}} | 
| 798 | } | 807 | } | 
| 799 | ); | 808 | ); | 
| 800 | modalInstance.result.then( | 809 | modalInstance.result.then( | 
| 801 | function(cotizacion) { | 810 | function(cotizacion) { | 
| 802 | var articulosTablaTemp = $scope.remito.articulosRemito; | 811 | var articulosTablaTemp = $scope.remito.articulosRemito; | 
| 803 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 812 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 
| 804 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 813 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 
| 805 | $scope.remito.cotizacion.COTIZACION; | 814 | $scope.remito.cotizacion.VENDEDOR; | 
| 806 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 815 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 
| 807 | cotizacion.COTIZACION; | 816 | cotizacion.VENDEDOR; | 
| 808 | } | 817 | } | 
| 809 | $scope.remito.articulosRemito = articulosTablaTemp; | 818 | $scope.remito.articulosRemito = articulosTablaTemp; | 
| 810 | $scope.remito.cotizacion.moneda = moneda; | ||
| 811 | $scope.remito.cotizacion = cotizacion; | 819 | $scope.remito.cotizacion = cotizacion; | 
| 820 | $scope.remito.cotizacion.moneda = moneda; | ||
| 812 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { | 821 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { | 
| 813 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 822 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 
| 814 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 823 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 
| 815 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 824 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 
| 816 | }else { | 825 | }else { | 
| 817 | $scope.$broadcast('addCabecera',{ | 826 | $scope.$broadcast('addCabecera',{ | 
| 818 | label: 'Moneda:', | 827 | label: 'Moneda:', | 
| 819 | valor: moneda.DETALLE | 828 | valor: moneda.DETALLE | 
| 820 | }); | 829 | }); | 
| 821 | $scope.$broadcast('addCabecera',{ | 830 | $scope.$broadcast('addCabecera',{ | 
| 822 | label: 'Fecha cotizacion:', | 831 | label: 'Fecha cotizacion:', | 
| 823 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 832 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 
| 824 | }); | 833 | }); | 
| 825 | $scope.$broadcast('addCabecera',{ | 834 | $scope.$broadcast('addCabecera',{ | 
| 826 | label: 'Cotizacion:', | 835 | label: 'Cotizacion:', | 
| 827 | valor: $filter('number')(cotizacion.COTIZACION, '2') | 836 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 
| 828 | }); | 837 | }); | 
| 829 | } | 838 | } | 
| 830 | }, function() { | 839 | }, function() { | 
| 831 | 840 | ||
| 832 | } | 841 | } | 
| 833 | ); | 842 | ); | 
| 834 | }; | 843 | }; | 
| 835 | 844 | ||
| 836 | $scope.agregarATabla = function(key) { | 845 | $scope.agregarATabla = function(key) { | 
| 837 | if (key === 13) { | 846 | if (key === 13) { | 
| 838 | if ($scope.articuloACargar.cantidad === undefined || | 847 | if ($scope.articuloACargar.cantidad === undefined || | 
| 839 | $scope.articuloACargar.cantidad === 0 || | 848 | $scope.articuloACargar.cantidad === 0 || | 
| 840 | $scope.articuloACargar.cantidad === null ) { | 849 | $scope.articuloACargar.cantidad === null ) { | 
| 841 | focaModalService.alert('El valor debe ser al menos 1'); | 850 | focaModalService.alert('El valor debe ser al menos 1'); | 
| 842 | return; | 851 | return; | 
| 843 | } | 852 | } | 
| 844 | delete $scope.articuloACargar.sectorCodigo; | 853 | delete $scope.articuloACargar.sectorCodigo; | 
| 845 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 854 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 
| 846 | $scope.cargando = true; | 855 | $scope.cargando = true; | 
| 847 | } | 856 | } | 
| 848 | }; | 857 | }; | 
| 849 | 858 | ||
| 850 | $scope.quitarArticulo = function(key) { | 859 | $scope.quitarArticulo = function(key) { | 
| 851 | $scope.remito.articulosRemito.splice(key, 1); | 860 | $scope.remito.articulosRemito.splice(key, 1); | 
| 852 | }; | 861 | }; | 
| 853 | 862 | ||
| 854 | $scope.editarArticulo = function(key, articulo) { | 863 | $scope.editarArticulo = function(key, articulo) { | 
| 855 | if (key === 13) { | 864 | if (key === 13) { | 
| 856 | if (!articulo.cantidad || !articulo.precio) { | 865 | if (!articulo.cantidad || !articulo.precio) { | 
| 857 | focaModalService.alert('Los valores deben ser al menos 1'); | 866 | focaModalService.alert('Los valores deben ser al menos 1'); | 
| 858 | return; | 867 | return; | 
| 859 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | 868 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | 
| 860 | focaModalService.alert('Los valores no pueden ser negativos'); | 869 | focaModalService.alert('Los valores no pueden ser negativos'); | 
| 861 | return; | 870 | return; | 
| 862 | } | 871 | } | 
| 863 | articulo.editCantidad = articulo.editPrecio = false; | 872 | articulo.editCantidad = articulo.editPrecio = false; | 
| 864 | } | 873 | } | 
| 865 | }; | 874 | }; | 
| 866 | 875 | ||
| 867 | $scope.cambioEdit = function(articulo, propiedad) { | 876 | $scope.cambioEdit = function(articulo, propiedad) { | 
| 868 | if (propiedad === 'cantidad') { | 877 | if (propiedad === 'cantidad') { | 
| 869 | articulo.editCantidad = true; | 878 | articulo.editCantidad = true; | 
| 870 | } else if (propiedad === 'precio') { | 879 | } else if (propiedad === 'precio') { | 
| 871 | articulo.editPrecio = true; | 880 | articulo.editPrecio = true; | 
| 872 | } | 881 | } | 
| 873 | }; | 882 | }; | 
| 874 | 883 | ||
| 875 | $scope.resetFilter = function() { | 884 | $scope.resetFilter = function() { | 
| 876 | $scope.articuloACargar = {}; | 885 | $scope.articuloACargar = {}; | 
| 877 | $scope.cargando = true; | 886 | $scope.cargando = true; | 
| 878 | }; | 887 | }; | 
| 879 | //Recibe aviso si el teclado está en uso | 888 | //Recibe aviso si el teclado está en uso | 
| 880 | $rootScope.$on('usarTeclado', function(event, data) { | 889 | $rootScope.$on('usarTeclado', function(event, data) { | 
| 881 | if (data) { | 890 | if (data) { | 
| 882 | $scope.mostrarTeclado = true; | 891 | $scope.mostrarTeclado = true; | 
| 883 | return; | 892 | return; | 
| 884 | } | 893 | } | 
| 885 | $scope.mostrarTeclado = false; | 894 | $scope.mostrarTeclado = false; | 
| 886 | }); | 895 | }); | 
| 887 | 896 | ||
| 888 | $scope.selectFocus = function($event) { | 897 | $scope.selectFocus = function($event) { | 
| 889 | // Si el teclado esta en uso no selecciona el valor | 898 | // Si el teclado esta en uso no selecciona el valor | 
| 890 | if ($scope.mostrarTeclado) { | 899 | if ($scope.mostrarTeclado) { | 
| 891 | return; | 900 | return; | 
| 892 | } | 901 | } | 
| 893 | $event.target.select(); | 902 | $event.target.select(); | 
| 894 | }; | 903 | }; | 
| 895 | 904 | ||
| 896 | function addArrayCabecera(array) { | 905 | function addArrayCabecera(array) { | 
| 897 | for (var i = 0; i < array.length; i++) { | 906 | for (var i = 0; i < array.length; i++) { | 
| 898 | $scope.$broadcast('addCabecera',{ | 907 | $scope.$broadcast('addCabecera',{ | 
| 899 | label: array[i].label, | 908 | label: array[i].label, | 
| 900 | valor: array[i].valor | 909 | valor: array[i].valor | 
| 901 | }); | 910 | }); | 
| 902 | } | 911 | } | 
| 903 | } | 912 | } | 
| 904 | 913 | ||
| 905 | function rellenar(relleno, longitud) { | 914 | function rellenar(relleno, longitud) { | 
| 906 | relleno = '' + relleno; | 915 | relleno = '' + relleno; | 
| 907 | while (relleno.length < longitud) { | 916 | while (relleno.length < longitud) { | 
| 908 | relleno = '0' + relleno; | 917 | relleno = '0' + relleno; | 
| 909 | } | 918 | } | 
| 910 | 919 | ||
| 911 | return relleno; | 920 | return relleno; | 
| 912 | } | 921 | } | 
| 913 | 922 | ||
| 914 | function varlidarRemitoFacturado() { | 923 | function varlidarRemitoFacturado() { | 
| 915 | if ($scope.remito.estado !== 5) { | 924 | if ($scope.remito.estado !== 5) { | 
| 916 | return true; | 925 | return true; | 
| 917 | } else { | 926 | } else { | 
| 918 | focaModalService.alert('No se puede editar un remito facturado'); | 927 | focaModalService.alert('No se puede editar un remito facturado'); | 
| 919 | return false(); | 928 | return false(); | 
| 920 | } | 929 | } | 
| 921 | } | 930 | } | 
| 922 | 931 | ||
| 923 | function salir() { | 932 | function salir() { | 
| 924 | var confirmacion = false; | 933 | var confirmacion = false; | 
| 925 | 934 | ||
| 926 | if (!angular.equals($scope.remito, $scope.inicial)) { | 935 | if (!angular.equals($scope.remito, $scope.inicial)) { | 
| 927 | confirmacion = true; | 936 | confirmacion = true; | 
| 928 | } | 937 | } | 
| 929 | 938 | ||
| 930 | if (confirmacion) { | 939 | if (confirmacion) { | 
| 931 | focaModalService.confirm( | 940 | focaModalService.confirm( | 
| 932 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 941 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 
| 933 | ).then(function(data) { | 942 | ).then(function(data) { | 
| 934 | if (data) { | 943 | if (data) { | 
| 935 | $location.path('/'); | 944 | $location.path('/'); | 
| 936 | } | 945 | } | 
| 937 | }); | 946 | }); | 
| 938 | } else { | 947 | } else { | 
| 939 | $location.path('/'); | 948 | $location.path('/'); | 
| 940 | } | 949 | } | 
| 941 | } | 950 | } | 
| 942 | 951 | ||
| 943 | function enableObservaciones(val) { | 952 | function enableObservaciones(val) { | 
| 944 | var boton = $scope.botonera.filter(function(botonObs) { | 953 | var boton = $scope.botonera.filter(function(botonObs) { | 
| 945 | return botonObs.label === 'Observaciones'; | 954 | return botonObs.label === 'Observaciones'; | 
| 946 | }); | 955 | }); | 
| 947 | 956 | ||
| 948 | boton[0].disable = !val; | 957 | boton[0].disable = !val; | 
| 949 | } | 958 | } | 
| 950 | 959 | ||
| 951 | function setearRemito(remito) { | 960 | function setearRemito(remito) { | 
| 952 | //añado cabeceras | 961 | //añado cabeceras | 
| 953 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 962 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 
| 954 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 963 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 
| 955 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 964 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 
| 956 | 965 | ||
| 957 | var cabeceras = []; | 966 | var cabeceras = []; | 
| 958 | 967 | ||
| 959 | if (remito.cotizacion.ID) { | 968 | if (remito.cotizacion.ID) { | 
| 960 | cabeceras.push({ | 969 | cabeceras.push({ | 
| 961 | label: 'Moneda:', | 970 | label: 'Moneda:', | 
| 962 | valor: remito.cotizacion.moneda.DETALLE | 971 | valor: remito.cotizacion.moneda.DETALLE | 
| 963 | }); | 972 | }); | 
| 964 | cabeceras.push({ | 973 | cabeceras.push({ | 
| 965 | label: 'Fecha cotizacion:', | 974 | label: 'Fecha cotizacion:', | 
| 966 | valor: $filter('date')(remito.cotizacion.FECHA, | 975 | valor: $filter('date')(remito.cotizacion.FECHA, | 
| 967 | 'dd/MM/yyyy') | 976 | 'dd/MM/yyyy') | 
| 968 | }); | 977 | }); | 
| 969 | cabeceras.push({ | 978 | cabeceras.push({ | 
| 970 | label: 'Cotizacion:', | 979 | label: 'Cotizacion:', | 
| 971 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 980 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 
| 972 | '2') | 981 | '2') | 
| 973 | }); | 982 | }); | 
| 974 | } | 983 | } | 
| 975 | if (remito.cliente.COD) { | 984 | if (remito.cliente.COD) { | 
| 976 | cabeceras.push({ | 985 | cabeceras.push({ | 
| 977 | label: 'Cliente:', | 986 | label: 'Cliente:', | 
| 978 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 987 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 
| 979 | remito.cliente.NOM | 988 | remito.cliente.NOM | 
| 980 | }); | 989 | }); | 
| 981 | cabeceras.push({ | 990 | cabeceras.push({ | 
| 982 | label: 'Domicilio:', | 991 | label: 'Domicilio:', | 
| 983 | valor: remito.domicilioStamp | 992 | valor: remito.domicilioStamp | 
| 984 | }); | 993 | }); | 
| 985 | } | 994 | } | 
| 986 | if (remito.vendedor.NUM) { | 995 | if (remito.vendedor.NUM) { | 
| 987 | cabeceras.push({ | 996 | cabeceras.push({ | 
| 988 | label: 'Vendedor:', | 997 | label: 'Vendedor:', | 
| 989 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 998 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 
| 990 | ' - ' + remito.vendedor.NOM | 999 | ' - ' + remito.vendedor.NOM | 
| 991 | }); | 1000 | }); | 
| 992 | } | 1001 | } | 
| 993 | if (remito.proveedor.COD) { | 1002 | if (remito.proveedor.COD) { | 
| 994 | cabeceras.push({ | 1003 | cabeceras.push({ | 
| 995 | label: 'Proveedor:', | 1004 | label: 'Proveedor:', | 
| 996 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + | 1005 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + | 
| 997 | ' - ' + remito.proveedor.NOM | 1006 | ' - ' + remito.proveedor.NOM | 
| 998 | }); | 1007 | }); | 
| 999 | } | 1008 | } | 
| 1000 | if (remito.flete !== undefined) { | 1009 | if (remito.flete !== undefined) { | 
| 1001 | cabeceras.push({ | 1010 | cabeceras.push({ | 
| 1002 | label: 'Flete:', | 1011 | label: 'Flete:', | 
| 1003 | valor: remito.fob === 1 ? 'FOB' : ( | 1012 | valor: remito.fob === 1 ? 'FOB' : ( | 
| 1004 | remito.flete === 1 ? 'Si' : 'No') | 1013 | remito.flete === 1 ? 'Si' : 'No') | 
| 1005 | }); | 1014 | }); | 
| 1006 | } | 1015 | } | 
| 1007 | if (remito.remitoPlazo) { | 1016 | if (remito.remitoPlazo) { | 
| 1008 | cabeceras.push({ | 1017 | cabeceras.push({ | 
| 1009 | label: 'Precio condicion:', | 1018 | label: 'Precio condicion:', | 
| 1010 | valor: valorPrecioCondicion() + ' ' + | 1019 | valor: valorPrecioCondicion() + ' ' + | 
| 1011 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 1020 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 
| 1012 | }); | 1021 | }); | 
| 1013 | } | 1022 | } | 
| 1014 | 1023 | ||
| 1015 | function valorPrecioCondicion() { | 1024 | function valorPrecioCondicion() { | 
| 1016 | if (remito.idPrecioCondicion > 0) { | 1025 | if (remito.idPrecioCondicion > 0) { | 
| 1017 | return remito.precioCondicion.nombre; | 1026 | return remito.precioCondicion.nombre; | 
| 1018 | } else { | 1027 | } else { | 
| 1019 | return 'Ingreso Manual'; | 1028 | return 'Ingreso Manual'; | 
| 1020 | } | 1029 | } | 
| 1021 | } | 1030 | } | 
| 1022 | 1031 | ||
| 1023 | if (remito.flete === 1) { | 1032 | if (remito.flete === 1) { | 
| 1024 | var cabeceraBomba = { | 1033 | var cabeceraBomba = { | 
| 1025 | label: 'Bomba', | 1034 | label: 'Bomba', | 
| 1026 | valor: remito.bomba === 1 ? 'Si' : 'No' | 1035 | valor: remito.bomba === 1 ? 'Si' : 'No' | 
| 1027 | }; | 1036 | }; | 
| 1028 | if (remito.kilometros) { | 1037 | if (remito.kilometros) { | 
| 1029 | var cabeceraKilometros = { | 1038 | var cabeceraKilometros = { | 
| 1030 | label: 'Kilometros', | 1039 | label: 'Kilometros', | 
| 1031 | valor: remito.kilometros | 1040 | valor: remito.kilometros | 
| 1032 | }; | 1041 | }; | 
| 1033 | cabeceras.push(cabeceraKilometros); | 1042 | cabeceras.push(cabeceraKilometros); | 
| 1034 | } | 1043 | } | 
| 1035 | cabeceras.push(cabeceraBomba); | 1044 | cabeceras.push(cabeceraBomba); | 
| 1036 | } | 1045 | } | 
| 1037 | $scope.remito.articulosRemito = remito.articulosRemito; | 1046 | $scope.remito.articulosRemito = remito.articulosRemito; | 
| 1038 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 1047 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 
| 1039 | remito.cotizacion.VENDEDOR); | 1048 | remito.cotizacion.VENDEDOR); | 
| 1040 | if (remito.idPrecioCondicion > 0) { | 1049 | if (remito.idPrecioCondicion > 0) { | 
| 1041 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 1050 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 
| 1042 | } else { | 1051 | } else { | 
| 1043 | $scope.idLista = -1; | 1052 | $scope.idLista = -1; | 
| 1044 | } | 1053 | } | 
| 1045 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 1054 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 
| 1046 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 1055 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 
| 1047 | $scope.remito = remito; | 1056 | $scope.remito = remito; | 
| 1048 | addArrayCabecera(cabeceras); | 1057 | addArrayCabecera(cabeceras); | 
| 1049 | } | 1058 | } | 
| 1050 | 1059 | ||
| 1051 | function getLSRemito() { | 1060 | function getLSRemito() { | 
| 1052 | var remito = JSON.parse($localStorage.remito || null); | 1061 | var remito = JSON.parse($localStorage.remito || null); | 
| 1053 | if (remito) { | 1062 | if (remito) { | 
| 1054 | setearRemito(remito); | 1063 | setearRemito(remito); | 
| 1055 | delete $localStorage.remito; | 1064 | delete $localStorage.remito; | 
| 1056 | } | 1065 | } | 
| 1057 | } | 1066 | } | 
| 1058 | 1067 | ||
| 1059 | function deleteCliente() { | 1068 | function deleteCliente() { | 
| 1060 | delete $scope.remito.domicilioStamp; | 1069 | delete $scope.remito.domicilioStamp; | 
| 1061 | delete $scope.remito.puntosDescarga; | 1070 | delete $scope.remito.puntosDescarga; | 
| 1062 | $scope.remito.domicilio = {dom: ''}; | 1071 | $scope.remito.domicilio = {dom: ''}; | 
| 1063 | $scope.remito.cliente = {}; | 1072 | $scope.remito.cliente = {}; | 
| 1064 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 1073 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 
| 1065 | $scope.$broadcast('removeCabecera', 'Domicilio:'); | 1074 | $scope.$broadcast('removeCabecera', 'Domicilio:'); | 
| 1066 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | 1075 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | 
| 1067 | } | 1076 | } | 
| 1068 | 1077 | ||
| 1069 | function abrirModalMail(id, cliente, numeroRemito) { | 1078 | function abrirModalMail(id, cliente, numeroRemito) { | 
| 1070 | focaModalService.mail( | 1079 | focaModalService.mail( | 
| 1071 | { | 1080 | { | 
| 1072 | titulo: 'Comprobante de remito Nº ' + numeroRemito, | 1081 | titulo: 'Comprobante de remito Nº ' + numeroRemito, | 
| 1073 | descarga: { | 1082 | descarga: { | 
| 1074 | nombre: numeroRemito + '.pdf', | 1083 | nombre: numeroRemito + '.pdf', | 
| 1075 | url: '/remito/comprobante', | 1084 | url: '/remito/comprobante', | 
| 1076 | }, | 1085 | }, | 
| 1077 | envio: { | 1086 | envio: { | 
| 1078 | mailCliente: cliente.MAIL, | 1087 | mailCliente: cliente.MAIL, | 
| 1079 | url: '/remito/mail', | 1088 | url: '/remito/mail', | 
| 1080 | }, | 1089 | }, | 
| 1081 | options: { | 1090 | options: { | 
| 1082 | idRemito: id | 1091 | idRemito: id | 
| 1083 | } | 1092 | } | 
| 1084 | } | 1093 | } | 
| 1085 | ) | 1094 | ) | 
| 1086 | .then(function(res) { | 1095 | .then(function(res) { | 
| 1087 | if (res === false) { | 1096 | if (res === false) { | 
| 1088 | abrirModalMail(id); | 1097 | abrirModalMail(id); | 
| 1089 | focaModalService.alert('Descarga o envíe su remito ' + | 1098 | focaModalService.alert('Descarga o envíe su remito ' + | 
| 1090 | 'antes de cerrar esta ventana'); | 1099 | 'antes de cerrar esta ventana'); | 
| 1091 | } | 1100 | } | 
| 1092 | }); | 1101 | }); | 
| 1093 | } | 1102 | } | 
src/views/remito.html
| 1 | <div class="crear-nota-remito foca-crear row"> | 1 | <div class="crear-nota-remito foca-crear row"> | 
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador | 
| 3 | titulo="'Remito'" | 3 | titulo="'Remito'" | 
| 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="seleccionarRemito" | 7 | busqueda="seleccionarRemito" | 
| 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 p-1 botonera-secundaria px-5 py-2"> | 12 | <div class="row p-1 botonera-secundaria px-5 py-2"> | 
| 13 | <div class="col-12"> | 13 | <div class="col-12"> | 
| 14 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="4" 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 class="">#</th> | 22 | <th class="">#</th> | 
| 23 | <th class="col">Código</th> | 23 | <th class="col">Código</th> | 
| 24 | <th class="col-4">Descripción</th> | 24 | <th class="col-4">Descripción</th> | 
| 25 | <th class="col text-right">Cantidad</th> | 25 | <th class="col text-right">Cantidad</th> | 
| 26 | <th class="col text-right">Precio Unitario</th> | 26 | <th class="col text-right">Precio Unitario</th> | 
| 27 | <th class="col text-right">SubTotal</th> | 27 | <th class="col text-right">SubTotal</th> | 
| 28 | <th class="text-right"> | 28 | <th 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 remito.articulosRemito" | 50 | ng-repeat="(key, articulo) in remito.articulosRemito" | 
| 51 | ng-show="show || key == (remito.articulosRemito.length - 1)" | 51 | ng-show="show || key == (remito.articulosRemito.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 | foca-focus="articulo.editCantidad" | 70 | foca-focus="articulo.editCantidad" | 
| 71 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 71 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 
| 72 | ng-focus="selectFocus($event)" | 72 | ng-focus="selectFocus($event)" | 
| 73 | teclado-virtual | 73 | teclado-virtual | 
| 74 | > | 74 | > | 
| 75 | <i | 75 | <i | 
| 76 | class="selectable" | 76 | class="selectable" | 
| 77 | ng-click="cambioEdit(articulo, 'cantidad')" | 77 | ng-click="cambioEdit(articulo, 'cantidad')" | 
| 78 | ng-hide="articulo.editCantidad" | 78 | ng-hide="articulo.editCantidad" | 
| 79 | ng-bind="articulo.cantidad"> | 79 | ng-bind="articulo.cantidad"> | 
| 80 | </i> | 80 | </i> | 
| 81 | </td> | 81 | </td> | 
| 82 | <td class="col text-right"> | 82 | <td class="col text-right"> | 
| 83 | <input | 83 | <input | 
| 84 | ng-show="articulo.editPrecio" | 84 | ng-show="articulo.editPrecio" | 
| 85 | ng-model="articulo.precio" | 85 | ng-model="articulo.precio" | 
| 86 | class="form-control" | 86 | class="form-control" | 
| 87 | foca-tipo-input | 87 | foca-tipo-input | 
| 88 | min="1" | 88 | min="1" | 
| 89 | step="0.0001" | 89 | step="0.0001" | 
| 90 | foca-focus="articulo.editPrecio" | 90 | foca-focus="articulo.editPrecio" | 
| 91 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 91 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 
| 92 | ng-focus="selectFocus($event)" | 92 | ng-focus="selectFocus($event)" | 
| 93 | teclado-virtual | 93 | teclado-virtual | 
| 94 | > | 94 | > | 
| 95 | <i | 95 | <i | 
| 96 | class="selectable" | 96 | class="selectable" | 
| 97 | ng-click="cambioEdit(articulo, 'precio')" | 97 | ng-click="cambioEdit(articulo, 'precio')" | 
| 98 | ng-hide="articulo.editPrecio" | 98 | ng-hide="articulo.editPrecio" | 
| 99 | ng-bind="articulo.precio | number: 4"> | 99 | ng-bind="articulo.precio | number: 4"> | 
| 100 | </i> | 100 | </i> | 
| 101 | </td> | 101 | </td> | 
| 102 | <td | 102 | <td | 
| 103 | class="col text-right" | 103 | class="col text-right" | 
| 104 | ng-bind="(articulo.precio * articulo.cantidad) | number: 2"> | 104 | ng-bind="(articulo.precio * articulo.cantidad) | number: 2"> | 
| 105 | </td> | 105 | </td> | 
| 106 | <td class="text-center"> | 106 | <td class="text-center"> | 
| 107 | <button | 107 | <button | 
| 108 | class="btn btn-outline-light" | 108 | class="btn btn-outline-light" | 
| 109 | ng-click="quitarArticulo(key)" | 109 | ng-click="quitarArticulo(key)" | 
| 110 | > | 110 | > | 
| 111 | <i class="fa fa-trash"></i> | 111 | <i class="fa fa-trash"></i> | 
| 112 | </button> | 112 | </button> | 
| 113 | <button | 113 | <button | 
| 114 | class="btn btn-outline-light" | 114 | class="btn btn-outline-light" | 
| 115 | ng-click="editarArticulo(13, articulo)" | 115 | ng-click="editarArticulo(13, articulo)" | 
| 116 | ng-show="articulo.editCantidad || articulo.editPrecio" | 116 | ng-show="articulo.editCantidad || articulo.editPrecio" | 
| 117 | > | 117 | > | 
| 118 | <i class="fa fa-save"></i> | 118 | <i class="fa fa-save"></i> | 
| 119 | </button> | 119 | </button> | 
| 120 | </td> | 120 | </td> | 
| 121 | </tr> | 121 | </tr> | 
| 122 | </tbody> | 122 | </tbody> | 
| 123 | <tfoot> | 123 | <tfoot> | 
| 124 | <tr ng-show="!cargando" class="d-flex"> | 124 | <tr ng-show="!cargando" class="d-flex"> | 
| 125 | <td | 125 | <td | 
| 126 | class="align-middle" | 126 | class="align-middle" | 
| 127 | ng-bind="remito.articulosRemito.length + 1" | 127 | ng-bind="remito.articulosRemito.length + 1" | 
| 128 | ></td> | 128 | ></td> | 
| 129 | <td class="col"> | 129 | <td class="col"> | 
| 130 | <input | 130 | <input | 
| 131 | class="form-control" | 131 | class="form-control" | 
| 132 | ng-model="articuloACargar.sectorCodigo" | 132 | ng-model="articuloACargar.sectorCodigo" | 
| 133 | readonly | 133 | readonly | 
| 134 | > | 134 | > | 
| 135 | </td> | 135 | </td> | 
| 136 | <td class="col-4 tabla-articulo-descripcion"> | 136 | <td class="col-4 tabla-articulo-descripcion"> | 
| 137 | <input | 137 | <input | 
| 138 | class="form-control" | 138 | class="form-control" | 
| 139 | ng-model="articuloACargar.descripcion" | 139 | ng-model="articuloACargar.descripcion" | 
| 140 | readonly | 140 | readonly | 
| 141 | > | 141 | > | 
| 142 | </td> | 142 | </td> | 
| 143 | <td class="col text-right"> | 143 | <td class="col text-right"> | 
| 144 | <input | 144 | <input | 
| 145 | class="form-control" | 145 | class="form-control" | 
| 146 | foca-tipo-input | 146 | foca-tipo-input | 
| 147 | min="1" | 147 | min="1" | 
| 148 | ng-model="articuloACargar.cantidad" | 148 | ng-model="articuloACargar.cantidad" | 
| 149 | foca-focus="!cargando" | 149 | foca-focus="!cargando" | 
| 150 | esc-key="resetFilter()" | 150 | esc-key="resetFilter()" | 
| 151 | ng-keypress="agregarATabla($event.keyCode)" | 151 | ng-keypress="agregarATabla($event.keyCode)" | 
| 152 | teclado-virtual | 152 | teclado-virtual | 
| 153 | > | 153 | > | 
| 154 | </td> | 154 | </td> | 
| 155 | <td class="col text-right"> | 155 | <td class="col text-right"> | 
| 156 | <input | 156 | <input | 
| 157 | class="form-control" | 157 | class="form-control" | 
| 158 | ng-model="articuloACargar.precio" | 158 | ng-model="articuloACargar.precio" | 
| 159 | ng-show="idLista != -1" | 159 | ng-show="idLista != -1" | 
| 160 | ng-keypress="agregarATabla($event.keyCode)" | 160 | ng-keypress="agregarATabla($event.keyCode)" | 
| 161 | > | 161 | > | 
| 162 | <input | 162 | <input | 
| 163 | class="form-control" | 163 | class="form-control" | 
| 164 | foca-tipo-input | 164 | foca-tipo-input | 
| 165 | step="0.0001" | 165 | step="0.0001" | 
| 166 | ng-model="articuloACargar.precio" | 166 | ng-model="articuloACargar.precio" | 
| 167 | esc-key="resetFilter()" | 167 | esc-key="resetFilter()" | 
| 168 | ng-keypress="agregarATabla($event.keyCode)" | 168 | ng-keypress="agregarATabla($event.keyCode)" | 
| 169 | ng-show="idLista == -1" | 169 | ng-show="idLista == -1" | 
| 170 | teclado-virtual | 170 | teclado-virtual | 
| 171 | > | 171 | > | 
| 172 | </td> | 172 | </td> | 
| 173 | <td class="col text-right"> | 173 | <td class="col text-right"> | 
| 174 | <input | 174 | <input | 
| 175 | class="form-control" | 175 | class="form-control" | 
| 176 | ng-value="getSubTotal() | number: 2" | 176 | ng-value="getSubTotal() | number: 2" | 
| 177 | readonly | 177 | readonly | 
| 178 | ></td> | 178 | ></td> | 
| 179 | <td class="text-center align-middle"> | 179 | <td class="text-center align-middle"> | 
| 180 | <button | 180 | <button | 
| 181 | class="btn btn-outline-light" | 181 | class="btn btn-outline-light" | 
| 182 | ng-click="agregarATabla(13)" | 182 | ng-click="agregarATabla(13)" | 
| 183 | > | 183 | > | 
| 184 | <i class="fa fa-save"></i> | 184 | <i class="fa fa-save"></i> | 
| 185 | </button> | 185 | </button> | 
| 186 | </td> | 186 | </td> | 
| 187 | </tr> | 187 | </tr> | 
| 188 | 188 | ||
| 189 | <tr class="d-flex"> | 189 | <tr class="d-flex"> | 
| 190 | <td colspan="4" class="no-border-top"> | 190 | <td colspan="4" class="no-border-top"> | 
| 191 | <strong>Items:</strong> | 191 | <strong>Items:</strong> | 
| 192 | <a ng-bind="remito.articulosRemito.length"></a> | 192 | <a ng-bind="remito.articulosRemito.length"></a> | 
| 193 | </td> | 193 | </td> | 
| 194 | <td class="text-right ml-auto table-celda-total no-border-top"> | 194 | <td class="text-right ml-auto table-celda-total no-border-top"> | 
| 195 | <h3>Total:</h3> | 195 | <h3>Total:</h3> | 
| 196 | </td> | 196 | </td> | 
| 197 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 197 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 
| 198 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | 198 | <h3>{{getTotal() | currency: remito.cotizacion.moneda.SIMBOLO}}</h3> | 
| 199 | </td> | 199 | </td> | 
| 200 | <td class="text-right no-border-top"> | 200 | <td class="text-right no-border-top"> | 
| 201 | <button | 201 | <button | 
| 202 | type="button" | 202 | type="button" | 
| 203 | class="btn btn-default btn-sm" | 203 | class="btn btn-default btn-sm" | 
| 204 | > | 204 | > | 
| 205 | Totales | 205 | Totales | 
| 206 | </button> | 206 | </button> | 
| 207 | </td> | 207 | </td> | 
| 208 | </tr> | 208 | </tr> | 
| 209 | </tfoot> | 209 | </tfoot> | 
| 210 | </table> | 210 | </table> | 
| 211 | </div> | 211 | </div> | 
| 212 | |||
| 213 | <!-- MOBILE --> | ||
| 214 | <div class="row d-sm-none"> | ||
| 215 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | ||
| 216 | <thead> | ||
| 217 | <tr class="d-flex"> | ||
| 218 | <th class="">#</th> | ||
| 219 | <th class="col px-0"> | ||
| 220 | <div class="d-flex"> | ||
| 221 | <div class="col-4 px-1">Código</div> | ||
| 222 | <div class="col-8 px-1">Descripción</div> | ||
| 223 | </div> | ||
| 224 | <div class="d-flex"> | ||
| 225 | <div class="col-3 px-1">Cantidad</div> | ||
| 226 | <div class="col px-1 text-right">P. Uni.</div> | ||
| 227 | <div class="col px-1 text-right">Subtotal</div> | ||
| 228 | </div> | ||
| 229 | </th> | ||
| 230 | <th class="text-center tamaño-boton"> | ||
| 231 |   | ||
| 232 | </th> | ||
| 233 | </tr> | ||
| 234 | </thead> | ||
| 235 | <tbody> | ||
| 236 | <tr | ||
| 237 | ng-repeat="(key, articulo) in remito.articulosRemito" | ||
| 238 | ng-show="show || key == remito.articulosRemito.length - 1" | ||
| 239 | > | ||
| 240 | <td class="w-100 align-middle d-flex p-0"> | ||
| 241 | <div class="align-middle p-1"> | ||
| 242 | <span ng-bind="key+1" class="align-middle"></span> | ||
| 243 | </div> | ||
| 244 | <div class="col px-0"> | ||
| 245 | <div class="d-flex"> | ||
| 246 | <div class="col-4 px-1"> | ||
| 247 | <span | ||
| 248 | ng-bind="articulo.sector + '-' + articulo.codigo" | ||
| 249 | ></span> | ||
| 250 | </div> | ||
| 251 | <div class="col-8 px-1"> | ||
| 252 | <span | ||
| 253 | ng-bind="'x' + articulo.cantidad" | ||
| 254 | ng-hide="articulo.editCantidad" | ||
| 255 | ></span> | ||
| 256 | <i | ||
| 257 | class="fa fa-pencil text-white-50" | ||
| 258 | aria-hidden="true" | ||
| 259 | ng-hide="articulo.editCantidad" | ||
| 260 | ng-click="articulo.editCantidad = true" | ||
| 261 | ></i> | ||
| 262 | <input | ||
| 263 | ng-show="articulo.editCantidad" | ||
| 264 | ng-model="articulo.cantidad" | ||
| 265 | class="form-control" | ||
| 266 | foca-tipo-input | ||
| 267 | min="1" | ||
| 268 | step="0.001" | ||
| 269 | foca-focus="articulo.editCantidad" | ||
| 270 | ng-keypress="editarArticulo($event.keyCode, articulo)" | ||
| 271 | ng-focus="selectFocus($event)" | ||
| 272 | > | ||
| 273 | </div> | ||
| 274 | </div> | ||
| 275 | <div class="d-flex"> | ||
| 276 | <div class="col-3 px-1"> | ||
| 277 | <span ng-bind="'x' + articulo.cantidad"></span> | ||
| 278 | </div> | ||
| 279 | <div class="col px-1 text-right"> | ||
| 280 | <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> | ||
| 281 | </div> | ||
| 282 | <div class="col px-1 text-right"> | ||
| 283 | <span | ||
| 284 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" | ||
| 285 | > | ||
| 286 | </span> | ||
| 287 | </div> | ||
| 288 | </div> | ||
| 289 | </div> | ||
| 290 | <div class="align-middle p-1"> | ||
| 291 | <button | ||
| 292 | class="btn btn-outline-light" | ||
| 293 | ng-click="quitarArticulo(key)" | ||
| 294 | > | ||
| 295 | <i class="fa fa-trash"></i> | ||
| 296 | </button> | ||
| 297 | </div> | ||
| 298 | </td> | ||
| 299 | </tr> | ||
| 300 | </tbody> | ||
| 301 | <tfoot> | ||
| 302 | <!-- CARGANDO ITEM --> | ||
| 303 | <tr ng-show="!cargando" class="d-flex"> | ||
| 304 | <td | ||
| 305 | class="align-middle p-1" | ||
| 306 | ng-bind="remito.articulosRemito.length + 1" | ||
| 307 | ></td> | ||
| 308 | <td class="col p-0"> | ||
| 309 | <div class="d-flex"> | ||
| 310 | <div class="col-4 px-1"> | ||
| 311 | <span | ||
| 312 | ng-bind="articuloACargar.sectorCodigo" | ||
| 313 | ></span> | ||
| 314 | </div> | ||
| 315 | <div class="col-8 px-1"> | ||
| 316 | <span ng-bind="articuloACargar.descripcion"></span> | ||
| 317 | </div> | ||
| 318 | </div> | ||
| 319 | <div class="d-flex"> | ||
| 320 | <div class="col-3 px-1 m-1"> | ||
| 321 | <input | ||
| 322 | class="form-control p-1" | ||
| 323 | foca-tipo-input | ||
| 324 | min="1" | ||
| 325 | ng-model="articuloACargar.cantidad" | ||
| 326 | foca-focus="!cargando" | ||
| 327 | ng-keypress="agregarATabla($event.keyCode)" | ||
| 328 | style="height: auto; line-height: 1.1em" | ||
| 329 | > | ||
| 330 | </div> | ||
| 331 | <div class="col px-1 text-right"> | ||
| 332 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> | ||
| 333 | </div> | ||
| 334 | <div class="col px-1 text-right"> | ||
| 335 | <span | ||
| 336 | ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" | ||
| 337 | > | ||
| 338 | </span> | ||
| 339 | </div> | ||
| 340 | </div> | ||
| 341 | </td> | ||
| 342 | <td class="text-center align-middle"> | ||
| 343 | <button | ||
| 344 | class="btn btn-outline-light" | ||
| 345 | ng-click="agregarATabla(13)" | ||
| 346 | > | ||
| 347 | <i class="fa fa-save"></i> | ||
| 348 | </button> | ||
| 349 | </td> | ||
| 350 | </tr> | ||
| 351 | <!-- TOOGLE EXPANDIR --> | ||
| 352 | <tr> | ||
| 353 | <td class="col"> | ||
| 354 | <button | ||
| 355 | class="btn btn-outline-light selectable w-100" | ||
| 356 | ng-click="show = !show; masMenos()" | ||
| 357 | ng-show="remito.articulosRemito.length > 0" | ||
| 358 | > | ||
| 359 | <i | ||
| 360 | class="fa fa-chevron-down" | ||
| 361 | ng-hide="show" | ||
| 362 | aria-hidden="true" | ||
| 363 | > | ||
| 364 | </i> | ||
| 365 | <i | ||
| 366 | class="fa fa-chevron-up" | ||
| 367 | ng-show="show" | ||
| 368 | aria-hidden="true"> | ||
| 369 | </i> | ||
| 370 | </button> | ||
| 371 | </td> | ||
| 372 | </tr> | ||
| 373 | <!-- FOOTER --> | ||
| 374 | <tr class="d-flex"> | ||
| 375 | <td class="align-middle no-border-top" colspan="2"> | ||
| 376 | <strong>Cantidad Items:</strong> | ||
| 377 | <a ng-bind="remito.articulosRemito.length"></a> | ||
| 378 | </td> | ||
| 379 | <td class="text-right ml-auto table-celda-total no-border-top"> | ||
| 380 | <h3>Total:</h3> | ||
| 381 | </td> | ||
| 382 | <td class="table-celda-total text-right no-border-top"> | ||
| 383 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | ||
| 384 | </td> | ||
| 385 | </tr> | ||
| 386 | </tfoot> | ||
| 387 | </table> | ||
| 388 | </div> | ||
| 389 | </div> | 212 | </div> | 
| 390 | </div> | 213 | </div> | 
| 391 | </div> | 214 | </div> | 
| 392 | <div class="row d-md-none fixed-bottom"> | 215 | <div class="row d-md-none fixed-bottom"> | 
| 393 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 216 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 
| 394 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 217 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 
| 395 | <span | 218 | <span | 
| 396 | class="mr-3 ml-auto" | 219 | class="mr-3 ml-auto" | 
| 397 | ng-class="saveLoading ? 'text-muted' : ''" | 220 | ng-class="saveLoading ? 'text-muted' : ''" | 
| 398 | ng-click="crearRemito()" | 221 | ng-click="crearRemito()" | 
| 399 | ladda="saveLoading" | 222 | ladda="saveLoading" | 
| 400 | data-style="expand-left" | 223 | data-style="expand-left" | 
| 401 | >Guardar</span> | 224 | >Guardar</span> | 
| 402 | </div> | 225 | </div> | 
| 403 | </div> | 226 | </div> | 
| 404 | </div> | 227 | </div> | 
| 405 | 228 |