Commit 4b63e4145a64bf34fc9bacf4c094fa51bccc94a5
1 parent
c85b6a3401
Exists in
master
trabajo realizado
Showing
5 changed files
with
93 additions
and
215 deletions
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
12 | 12 | ||
13 | var paths = { | 13 | var paths = { |
14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
17 | dist: 'dist/' | 17 | dist: 'dist/' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | gulp.task('templates', ['clean'], function() { | 20 | gulp.task('templates', ['clean'], function() { |
21 | return pump( | 21 | return pump( |
22 | [ | 22 | [ |
23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
24 | htmlmin(), | 24 | htmlmin(), |
25 | templateCache('views.js', { | 25 | templateCache('views.js', { |
26 | module: 'focaCrearHojaRuta', | 26 | module: 'focaCrearHojaRuta', |
27 | root: '' | 27 | root: '' |
28 | }), | 28 | }), |
29 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
30 | ] | 30 | ] |
31 | ); | 31 | ); |
32 | }); | 32 | }); |
33 | 33 | ||
34 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 35 | return pump( |
36 | [ | 36 | [ |
37 | gulp.src([ | 37 | gulp.src([ |
38 | paths.srcJS, | 38 | paths.srcJS, |
39 | 'tmp/views.js' | 39 | 'tmp/views.js' |
40 | ]), | 40 | ]), |
41 | concat('foca-crear-hoja-ruta.js'), | 41 | concat('foca-crear-hoja-ruta.js'), |
42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
43 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
44 | rename('foca-crear-hoja-ruta.min.js'), | 44 | rename('foca-crear-hoja-ruta.min.js'), |
45 | uglify(), | 45 | uglify(), |
46 | /*replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | 46 | /*replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ | 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ |
49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | 49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ |
50 | '"cordovaGeolocationModule"', ''),*/ | 50 | '"cordovaGeolocationModule"', ''),*/ |
51 | gulp.dest(paths.dist) | 51 | gulp.dest(paths.dist) |
52 | ] | 52 | ] |
53 | ); | 53 | ); |
54 | }); | 54 | }); |
55 | 55 | ||
56 | gulp.task('clean', function(){ | 56 | gulp.task('clean', function() { |
57 | return gulp.src(['tmp', 'dist'], {read: false}) | 57 | return gulp.src(['tmp', 'dist'], {read: false}) |
58 | .pipe(clean()); | 58 | .pipe(clean()); |
59 | }); | 59 | }); |
60 | 60 | ||
61 | gulp.task('pre-commit', function() { | 61 | gulp.task('pre-commit', function() { |
62 | return pump( | 62 | return pump( |
63 | [ | 63 | [ |
64 | gulp.src(paths.srcJS), | 64 | gulp.src(paths.srcJS), |
65 | jshint('.jshintrc'), | 65 | jshint('.jshintrc'), |
66 | jshint.reporter('default'), | 66 | jshint.reporter('default'), |
67 | jshint.reporter('fail') | 67 | jshint.reporter('fail') |
68 | ] | 68 | ] |
69 | ); | 69 | ); |
70 | 70 | ||
71 | gulp.start('uglify'); | 71 | gulp.start('uglify'); |
72 | }); | 72 | }); |
73 | 73 | ||
74 | gulp.task('webserver', function() { | 74 | gulp.task('webserver', function() { |
75 | pump [ | 75 | pump [ |
76 | connect.server({port: 3300, host: '0.0.0.0'}) | 76 | connect.server({port: 3300, host: '0.0.0.0'}) |
77 | ] | 77 | ] |
78 | }); | 78 | }); |
79 | 79 | ||
80 | gulp.task('clean-post-install', function() { | 80 | gulp.task('clean-post-install', function() { |
81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
82 | 'index.html'], {read: false}) | 82 | 'index.html'], {read: false}) |
83 | .pipe(clean()); | 83 | .pipe(clean()); |
84 | }); | 84 | }); |
85 | 85 | ||
86 | gulp.task('default', ['webserver']); | 86 | gulp.task('default', ['webserver']); |
87 | 87 | ||
88 | gulp.task('watch', function() { | 88 | gulp.task('watch', function() { |
89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
90 | }); | 90 | }); |
91 | 91 |
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-hoja-ruta", | 2 | "name": "foca-crear-hoja-ruta", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "foca-crear-hoja-ruta", | 4 | "description": "foca-crear-hoja-ruta", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1" | 7 | "test": "echo \"Error: no test specified\" && exit 1" |
8 | }, | 8 | }, |
9 | "repository": { | 9 | "repository": { |
10 | "type": "git", | 10 | "type": "git", |
11 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git" | 11 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-hoja-ruta.git" |
12 | }, | 12 | }, |
13 | "author": "Foca Software", | 13 | "author": "Foca Software", |
14 | "license": "ISC", | 14 | "license": "ISC", |
15 | "devDependencies": { | 15 | "devDependencies": { |
16 | "angular": "^1.7.5", | 16 | "angular": "^1.7.5", |
17 | "angular-ladda": "^0.4.3", | 17 | "angular-ladda": "^0.4.3", |
18 | "angular-route": "^1.7.5", | 18 | "angular-route": "^1.7.5", |
19 | "bootstrap": "^4.1.3", | 19 | "bootstrap": "^4.1.3", |
20 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 20 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
21 | "foca-modal-remito": "git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git", | ||
21 | "font-awesome": "^4.7.0", | 22 | "font-awesome": "^4.7.0", |
22 | "gulp": "^3.9.1", | 23 | "gulp": "^3.9.1", |
23 | "gulp-angular-templatecache": "^2.2.5", | 24 | "gulp-angular-templatecache": "^2.2.5", |
24 | "gulp-clean": "^0.4.0", | 25 | "gulp-clean": "^0.4.0", |
25 | "gulp-concat": "^2.6.1", | 26 | "gulp-concat": "^2.6.1", |
26 | "gulp-connect": "^5.6.1", | 27 | "gulp-connect": "^5.6.1", |
27 | "gulp-htmlmin": "^5.0.1", | 28 | "gulp-htmlmin": "^5.0.1", |
28 | "gulp-jshint": "^2.1.0", | 29 | "gulp-jshint": "^2.1.0", |
29 | "gulp-rename": "^1.4.0", | 30 | "gulp-rename": "^1.4.0", |
30 | "gulp-replace": "^1.0.0", | 31 | "gulp-replace": "^1.0.0", |
31 | "gulp-sequence": "^1.0.0", | 32 | "gulp-sequence": "^1.0.0", |
32 | "gulp-uglify": "^3.0.1", | 33 | "gulp-uglify": "^3.0.1", |
33 | "jasmine-core": "^3.3.0", | 34 | "jasmine-core": "^3.3.0", |
34 | "jquery": "^3.3.1", | 35 | "jquery": "^3.3.1", |
35 | "jshint": "^2.9.6", | 36 | "jshint": "^2.9.6", |
36 | "ladda": "1.0.6", | 37 | "ladda": "1.0.6", |
37 | "pre-commit": "^1.2.2", | 38 | "pre-commit": "^1.2.2", |
38 | "pump": "^3.0.0", | 39 | "pump": "^3.0.0", |
39 | "ui-bootstrap4": "^3.0.5" | 40 | "ui-bootstrap4": "^3.0.5" |
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 |
src/js/app.js
1 | angular.module('focaCrearHojaRuta', [ | 1 | angular.module('focaCrearHojaRuta', [ |
2 | 'ngRoute', | 2 | 'ngRoute', |
3 | 'focaModalRemito', | ||
3 | 'ui.bootstrap'/*, | 4 | 'ui.bootstrap'/*, |
4 | 'focaModalVendedores', | ||
5 | 'focaBusquedaProductos', | 5 | 'focaBusquedaProductos', |
6 | 'focaModalProveedor', | 6 | 'focaModalProveedor', |
7 | 'focaBusquedaCliente', | 7 | 'focaBusquedaCliente', |
8 | 'focaModalPrecioCondicion', | 8 | 'focaModalPrecioCondicion', |
9 | 'focaModalFlete', | 9 | 'focaModalFlete', |
10 | 'focaDirectivas', | 10 | 'focaDirectivas', |
11 | 'focaModal', | 11 | 'focaModal', |
12 | 'focaModalDomicilio', | 12 | 'focaModalDomicilio', |
13 | 'focaModalMoneda', | 13 | 'focaModalMoneda', |
14 | 'focaModalCotizacion', | 14 | 'focaModalCotizacion', |
15 | 'focaSeguimiento', | 15 | 'focaSeguimiento', |
16 | 'angular-ladda', | 16 | 'angular-ladda', |
17 | 'cordovaGeolocationModule'*/ | 17 | 'cordovaGeolocationModule'*/ |
18 | ]); | 18 | ]); |
src/js/controller.js
1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', |
4 | 'focaModalService', 'focaSeguimientoService', 'hojaRutaBusinessService', | 4 | 'focaModalService', 'focaSeguimientoService', 'hojaRutaBusinessService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService, |
7 | focaSeguimientoService, hojaRutaBusinessService | 7 | focaSeguimientoService, hojaRutaBusinessService |
8 | ) { | 8 | ) { |
9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
10 | {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}}, | 10 | {texto: 'Transportista', accion: function() {$scope.seleccionarProveedor();}}, |
11 | {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}}, | 11 | {texto: 'Chofer', accion: function() {$scope.seleccionarChofer();}}, |
12 | {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}}, | 12 | {texto: 'Vehiculo', accion: function() {$scope.seleccionarVehiculo();}}, |
13 | {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}}, | 13 | {texto: 'Tarifario', accion: function() {$scope.seleccionarTarifario();}}, |
14 | {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}}, | 14 | {texto: 'Remitos', accion: function() {$scope.seleccionarRemito();}}, |
15 | {texto: '', accion: function() {}}, | 15 | {texto: '', accion: function() {}}, |
16 | {texto: '', accion: function() {}}, | 16 | {texto: '', accion: function() {}}, |
17 | {texto: '', accion: function() {}} | 17 | {texto: '', accion: function() {}} |
18 | ]; | 18 | ]; |
19 | $scope.datepickerAbierto = false; | 19 | $scope.datepickerAbierto = false; |
20 | 20 | ||
21 | $scope.show = false; | 21 | $scope.show = false; |
22 | $scope.cargando = true; | 22 | $scope.cargando = true; |
23 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
24 | maxDate: new Date(), | 24 | maxDate: new Date(), |
25 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
26 | }; | 26 | }; |
27 | 27 | ||
28 | $scope.hojaRuta = { | 28 | $scope.hojaRuta = { |
29 | fecha: new Date(), | ||
29 | vendedor: {}, | 30 | vendedor: {}, |
30 | cliente: {}, | 31 | cliente: {}, |
31 | proveedor: {}, | 32 | transportista: {}, |
32 | domicilio: {dom: ''}, | 33 | domicilio: {dom: ''}, |
33 | moneda: {}, | 34 | moneda: {}, |
34 | cotizacion: {} | 35 | cotizacion: {} |
35 | }; | 36 | }; |
36 | var monedaPorDefecto; | ||
37 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | ||
38 | crearHojaRutaService.getCotizacionByIdMoneda(1).then(function(res) { | ||
39 | monedaPorDefecto = { | ||
40 | id: res.data[0].ID, | ||
41 | detalle: res.data[0].DETALLE, | ||
42 | simbolo: res.data[0].SIMBOLO, | ||
43 | cotizaciones: res.data[0].cotizaciones | ||
44 | }; | ||
45 | addCabecera('Moneda:', monedaPorDefecto.detalle); | ||
46 | addCabecera('Fecha cotizacion:', | ||
47 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | ||
48 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | ||
49 | $scope.hojaRuta.moneda = monedaPorDefecto; | ||
50 | $scope.hojaRuta.cotizacion = monedaPorDefecto.cotizaciones[0]; | ||
51 | }); | ||
52 | 37 | ||
53 | $scope.cabecera = []; | 38 | $scope.cabecera = []; |
54 | $scope.showCabecera = true; | 39 | $scope.showCabecera = true; |
55 | 40 | ||
56 | $scope.now = new Date(); | 41 | $scope.now = new Date(); |
57 | $scope.puntoVenta = '0000'; | 42 | $scope.puntoVenta = '0000'; |
58 | $scope.comprobante = '00000000'; | 43 | $scope.comprobante = '00000000'; |
59 | $scope.articulosTabla = []; | 44 | $scope.remitosTabla = []; |
60 | $scope.idLista = undefined; | 45 | $scope.idLista = undefined; |
46 | $ | ||
61 | //La pantalla solo se usa para cargar pedidos | 47 | //La pantalla solo se usa para cargar pedidos |
62 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); | 48 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); |
63 | 49 | ||
64 | crearHojaRutaService.getPrecioCondicion().then( | ||
65 | function(res) { | ||
66 | $scope.precioCondiciones = res.data; | ||
67 | } | ||
68 | ); | ||
69 | |||
70 | crearHojaRutaService.getNumeroHojaRuta().then( | 50 | crearHojaRutaService.getNumeroHojaRuta().then( |
71 | function(res) { | 51 | function(res) { |
72 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 52 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
73 | $scope.comprobante = rellenar(res.data.numeroHojaRuta, 8); | 53 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
74 | }, | 54 | }, |
75 | function(err) { | 55 | function(err) { |
76 | focaModalService.alert('La terminal no esta configurada correctamente'); | 56 | focaModalService.alert('La terminal no esta configurada correctamente'); |
77 | console.info(err); | 57 | console.info(err); |
78 | } | 58 | } |
79 | ); | 59 | ); |
80 | //La pantalla solo se usa para cargar pedidos | 60 | //La pantalla solo se usa para cargar pedidos |
81 | // if (hojaRutaTemp !== undefined) { | 61 | // if (hojaRutaTemp !== undefined) { |
82 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); | 62 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); |
83 | // $scope.hojaRuta = hojaRutaTemp; | 63 | // $scope.hojaRuta = hojaRutaTemp; |
84 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); | 64 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); |
85 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); | 65 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); |
86 | // $scope.idLista = $scope.hojaRuta.precioCondicion; | 66 | // $scope.idLista = $scope.hojaRuta.precioCondicion; |
87 | // crearHojaRutaService | 67 | // crearHojaRutaService |
88 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( | 68 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( |
89 | // function(res) { | 69 | // function(res) { |
90 | // $scope.articulosTabla = res.data; | 70 | // $scope.remitosTabla = res.data; |
91 | // } | 71 | // } |
92 | // ); | 72 | // ); |
93 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 73 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
94 | //(NO REQUERIDO EN ESTA VERSION) | 74 | //(NO REQUERIDO EN ESTA VERSION) |
95 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( | 75 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( |
96 | // function(res) { | 76 | // function(res) { |
97 | // $scope.hojaRuta.domicilio = res.data; | 77 | // $scope.hojaRuta.domicilio = res.data; |
98 | // } | 78 | // } |
99 | // ); | 79 | // ); |
100 | // } else { | 80 | // } else { |
101 | // $scope.hojaRuta.fechaCarga = new Date(); | 81 | // $scope.hojaRuta.fechaCarga = new Date(); |
102 | // $scope.hojaRuta.bomba = '0'; | 82 | // $scope.hojaRuta.bomba = '0'; |
103 | // $scope.hojaRuta.flete = '0'; | 83 | // $scope.hojaRuta.flete = '0'; |
104 | // $scope.idLista = undefined; | 84 | // $scope.idLista = undefined; |
105 | // } | 85 | // } |
106 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 86 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
107 | // $scope.addNewDom = function() { | 87 | // $scope.addNewDom = function() { |
108 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); | 88 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); |
109 | // }; | 89 | // }; |
110 | // $scope.removeNewChoice = function(choice) { | 90 | // $scope.removeNewChoice = function(choice) { |
111 | // if ($scope.hojaRuta.domicilio.length > 1) { | 91 | // if ($scope.hojaRuta.domicilio.length > 1) { |
112 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( | 92 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( |
113 | // function(c) { | 93 | // function(c) { |
114 | // return c.$$hashKey === choice.$$hashKey; | 94 | // return c.$$hashKey === choice.$$hashKey; |
115 | // } | 95 | // } |
116 | // ), 1); | 96 | // ), 1); |
117 | // } | 97 | // } |
118 | // }; | 98 | // }; |
119 | 99 | ||
120 | $scope.crearHojaRuta = function() { | 100 | $scope.crearHojaRuta = function() { |
121 | if(!$scope.hojaRuta.vendedor.codigo) { | 101 | if(!$scope.hojaRuta.vendedor.codigo) { |
122 | focaModalService.alert('Ingrese Vendedor'); | 102 | focaModalService.alert('Ingrese Vendedor'); |
123 | return; | 103 | return; |
124 | } else if(!$scope.hojaRuta.cliente.cod) { | 104 | } else if(!$scope.hojaRuta.cliente.cod) { |
125 | focaModalService.alert('Ingrese Cliente'); | 105 | focaModalService.alert('Ingrese Cliente'); |
126 | return; | 106 | return; |
127 | } else if(!$scope.hojaRuta.proveedor.codigo) { | 107 | } else if(!$scope.hojaRuta.transportista.codigo) { |
128 | focaModalService.alert('Ingrese Proveedor'); | 108 | focaModalService.alert('Ingrese Transportista'); |
129 | return; | 109 | return; |
130 | } else if(!$scope.hojaRuta.moneda.id) { | 110 | } else if(!$scope.hojaRuta.moneda.id) { |
131 | focaModalService.alert('Ingrese Moneda'); | 111 | focaModalService.alert('Ingrese Moneda'); |
132 | return; | 112 | return; |
133 | } else if(!$scope.hojaRuta.cotizacion.ID) { | 113 | } else if(!$scope.hojaRuta.cotizacion.ID) { |
134 | focaModalService.alert('Ingrese Cotización'); | 114 | focaModalService.alert('Ingrese Cotización'); |
135 | return; | 115 | return; |
136 | } else if(!$scope.plazosPagos) { | 116 | } else if(!$scope.plazosPagos) { |
137 | focaModalService.alert('Ingrese Precios y Condiciones'); | 117 | focaModalService.alert('Ingrese Precios y Condiciones'); |
138 | return; | 118 | return; |
139 | } else if( | 119 | } else if( |
140 | $scope.hojaRuta.flete === undefined || $scope.hojaRuta.flete === null) | 120 | $scope.hojaRuta.flete === undefined || $scope.hojaRuta.flete === null) |
141 | { | 121 | { |
142 | focaModalService.alert('Ingrese Flete'); | 122 | focaModalService.alert('Ingrese Flete'); |
143 | return; | 123 | return; |
144 | } else if(!$scope.hojaRuta.domicilio.id) { | 124 | } else if(!$scope.hojaRuta.domicilio.id) { |
145 | focaModalService.alert('Ingrese Domicilio'); | 125 | focaModalService.alert('Ingrese Domicilio'); |
146 | return; | 126 | return; |
147 | } else if($scope.articulosTabla.length === 0) { | 127 | } else if($scope.remitosTabla.length === 0) { |
148 | focaModalService.alert('Debe cargar al menos un articulo'); | 128 | focaModalService.alert('Debe cargar al menos un articulo'); |
149 | return; | 129 | return; |
150 | } | 130 | } |
151 | var date = new Date(); | 131 | var date = new Date(); |
152 | var hojaRuta = { | 132 | var hojaRuta = { |
153 | id: 0, | 133 | id: 0, |
154 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 134 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
155 | .toISOString().slice(0, 19).replace('T', ' '), | 135 | .toISOString().slice(0, 19).replace('T', ' '), |
156 | idVendedor: $scope.hojaRuta.vendedor.codigo, | 136 | idVendedor: $scope.hojaRuta.vendedor.codigo, |
157 | idCliente: $scope.hojaRuta.cliente.cod, | 137 | idCliente: $scope.hojaRuta.cliente.cod, |
158 | nombreCliente: $scope.hojaRuta.cliente.nom, | 138 | nombreCliente: $scope.hojaRuta.cliente.nom, |
159 | cuitCliente: $scope.hojaRuta.cliente.cuit, | 139 | cuitCliente: $scope.hojaRuta.cliente.cuit, |
160 | idProveedor: $scope.hojaRuta.proveedor.codigo, | ||
161 | idDomicilio: $scope.hojaRuta.domicilio.id, | 140 | idDomicilio: $scope.hojaRuta.domicilio.id, |
141 | idProveedor: $scope.hojaRuta.transportista.codigo, | ||
162 | idCotizacion: $scope.hojaRuta.cotizacion.ID, | 142 | idCotizacion: $scope.hojaRuta.cotizacion.ID, |
163 | cotizacion: $scope.hojaRuta.cotizacion.COTIZACION, | 143 | cotizacion: $scope.hojaRuta.cotizacion.COTIZACION, |
164 | flete: $scope.hojaRuta.flete, | 144 | flete: $scope.hojaRuta.flete, |
165 | fob: $scope.hojaRuta.fob, | 145 | fob: $scope.hojaRuta.fob, |
166 | bomba: $scope.hojaRuta.bomba, | 146 | bomba: $scope.hojaRuta.bomba, |
167 | kilometros: $scope.hojaRuta.kilometros, | 147 | kilometros: $scope.hojaRuta.kilometros, |
168 | estado: 0, | 148 | estado: 0, |
169 | total: $scope.getTotal() | 149 | total: $scope.getTotal() |
170 | }; | 150 | }; |
171 | crearHojaRutaService.crearHojaRuta(hojaRuta).then( | 151 | crearHojaRutaService.crearHojaRuta(hojaRuta).then( |
172 | function(data) { | 152 | function(data) { |
173 | hojaRutaBusinessService.addArticulos($scope.articulosTabla, | 153 | hojaRutaBusinessService.addArticulos($scope.remitosTabla, |
174 | data.data.id, $scope.hojaRuta.cotizacion.COTIZACION); | 154 | data.data.id, $scope.hojaRuta.cotizacion.COTIZACION); |
175 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); | 155 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); |
176 | var plazos = $scope.plazosPagos; | 156 | var plazos = $scope.plazosPagos; |
177 | 157 | ||
178 | for(var j = 0; j < plazos.length; j++) { | 158 | for(var j = 0; j < plazos.length; j++) { |
179 | var json = { | 159 | var json = { |
180 | idPedido: data.data.id, | 160 | idPedido: data.data.id, |
181 | dias: plazos[j].dias | 161 | dias: plazos[j].dias |
182 | }; | 162 | }; |
183 | crearHojaRutaService.crearPlazosParaHojaRuta(json); | 163 | crearHojaRutaService.crearPlazosParaHojaRuta(json); |
184 | } | 164 | } |
185 | hojaRutaBusinessService.addEstado(data.data.id, | 165 | hojaRutaBusinessService.addEstado(data.data.id, |
186 | $scope.hojaRuta.vendedor.codigo); | 166 | $scope.hojaRuta.vendedor.codigo); |
187 | 167 | ||
188 | focaModalService.alert('Nota pedido creada'); | 168 | focaModalService.alert('Nota pedido creada'); |
189 | $scope.cabecera = []; | 169 | $scope.cabecera = []; |
190 | addCabecera('Moneda:', $scope.hojaRuta.moneda.detalle); | 170 | addCabecera('Moneda:', $scope.hojaRuta.moneda.detalle); |
191 | addCabecera( | 171 | addCabecera( |
192 | 'Fecha cotizacion:', | 172 | 'Fecha cotizacion:', |
193 | $filter('date')($scope.hojaRuta.cotizacion.FECHA, 'dd/MM/yyyy') | 173 | $filter('date')($scope.hojaRuta.cotizacion.FECHA, 'dd/MM/yyyy') |
194 | ); | 174 | ); |
195 | addCabecera('Cotizacion:', $scope.hojaRuta.cotizacion.COTIZACION); | 175 | addCabecera('Cotizacion:', $scope.hojaRuta.cotizacion.COTIZACION); |
196 | $scope.hojaRuta.vendedor = {}; | 176 | $scope.hojaRuta.vendedor = {}; |
197 | $scope.hojaRuta.cliente = {}; | 177 | $scope.hojaRuta.cliente = {}; |
198 | $scope.hojaRuta.proveedor = {}; | ||
199 | $scope.hojaRuta.domicilio = {}; | 178 | $scope.hojaRuta.domicilio = {}; |
179 | $scope.hojaRuta.transportista = {}; | ||
200 | $scope.hojaRuta.flete = null; | 180 | $scope.hojaRuta.flete = null; |
201 | $scope.hojaRuta.fob = null; | 181 | $scope.hojaRuta.fob = null; |
202 | $scope.hojaRuta.bomba = null; | 182 | $scope.hojaRuta.bomba = null; |
203 | $scope.hojaRuta.kilometros = null; | 183 | $scope.hojaRuta.kilometros = null; |
204 | $scope.articulosTabla = []; | 184 | $scope.remitosTabla = []; |
205 | }, | 185 | }, |
206 | function(error) { | 186 | function(error) { |
207 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 187 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
208 | console.info(error); | 188 | console.info(error); |
209 | } | 189 | } |
210 | ); | 190 | ); |
211 | }; | 191 | }; |
212 | 192 | ||
213 | $scope.seleccionarArticulo = function() { | 193 | $scope.seleccionarArticulo = function() { |
214 | if ($scope.idLista === undefined) { | 194 | if ($scope.idLista === undefined) { |
215 | focaModalService.alert( | 195 | focaModalService.alert( |
216 | 'Primero seleccione una lista de precio y condicion'); | 196 | 'Primero seleccione una lista de precio y condicion'); |
217 | return; | 197 | return; |
218 | } | 198 | } |
219 | var modalInstance = $uibModal.open( | 199 | var modalInstance = $uibModal.open( |
220 | { | 200 | { |
221 | ariaLabelledBy: 'Busqueda de Productos', | 201 | ariaLabelledBy: 'Busqueda de Productos', |
222 | templateUrl: 'modal-busqueda-productos.html', | 202 | templateUrl: 'modal-busqueda-productos.html', |
223 | controller: 'modalBusquedaProductosCtrl', | 203 | controller: 'modalBusquedaProductosCtrl', |
224 | resolve: { | 204 | resolve: { |
225 | parametroProducto: { | 205 | parametroProducto: { |
226 | idLista: $scope.idLista, | 206 | idLista: $scope.idLista, |
227 | cotizacion: $scope.hojaRuta.cotizacion.COTIZACION, | 207 | cotizacion: $scope.hojaRuta.cotizacion.COTIZACION, |
228 | simbolo: $scope.hojaRuta.moneda.simbolo | 208 | simbolo: $scope.hojaRuta.moneda.simbolo |
229 | } | 209 | } |
230 | }, | 210 | }, |
231 | size: 'lg' | 211 | size: 'lg' |
232 | } | 212 | } |
233 | ); | 213 | ); |
234 | modalInstance.result.then( | 214 | modalInstance.result.then( |
235 | function(producto) { | 215 | function(producto) { |
236 | var newArt = | 216 | var newArt = |
237 | { | 217 | { |
238 | id: 0, | 218 | id: 0, |
239 | codigo: producto.codigo, | 219 | codigo: producto.codigo, |
240 | sector: producto.sector, | 220 | sector: producto.sector, |
241 | sectorCodigo: producto.sector + '-' + producto.codigo, | 221 | sectorCodigo: producto.sector + '-' + producto.codigo, |
242 | descripcion: producto.descripcion, | 222 | descripcion: producto.descripcion, |
243 | item: $scope.articulosTabla.length + 1, | 223 | item: $scope.remitosTabla.length + 1, |
244 | nombre: producto.descripcion, | 224 | nombre: producto.descripcion, |
245 | precio: parseFloat(producto.precio.toFixed(4)), | 225 | precio: parseFloat(producto.precio.toFixed(4)), |
246 | costoUnitario: producto.costo, | 226 | costoUnitario: producto.costo, |
247 | editCantidad: false, | 227 | editCantidad: false, |
248 | editPrecio: false | 228 | editPrecio: false |
249 | }; | 229 | }; |
250 | $scope.articuloACargar = newArt; | 230 | $scope.articuloACargar = newArt; |
251 | $scope.cargando = false; | 231 | $scope.cargando = false; |
252 | }, function() { | 232 | }, function() { |
253 | // funcion ejecutada cuando se cancela el modal | 233 | // funcion ejecutada cuando se cancela el modal |
254 | } | 234 | } |
255 | ); | 235 | ); |
256 | }; | 236 | }; |
257 | 237 | ||
258 | $scope.seleccionarVendedor = function() { | 238 | $scope.seleccionarVendedor = function() { |
259 | var modalInstance = $uibModal.open( | 239 | var modalInstance = $uibModal.open( |
260 | { | 240 | { |
261 | ariaLabelledBy: 'Busqueda de Vendedores', | 241 | ariaLabelledBy: 'Busqueda de Vendedores', |
262 | templateUrl: 'modal-vendedores.html', | 242 | templateUrl: 'modal-vendedores.html', |
263 | controller: 'modalVendedoresCtrl', | 243 | controller: 'modalVendedoresCtrl', |
264 | size: 'lg' | 244 | size: 'lg' |
265 | } | 245 | } |
266 | ); | 246 | ); |
267 | modalInstance.result.then( | 247 | modalInstance.result.then( |
268 | function(vendedor) { | 248 | function(vendedor) { |
269 | addCabecera('Vendedor:', vendedor.NomVen); | 249 | addCabecera('Vendedor:', vendedor.NomVen); |
270 | $scope.hojaRuta.vendedor.codigo = vendedor.CodVen; | 250 | $scope.hojaRuta.vendedor.codigo = vendedor.CodVen; |
271 | }, function() { | 251 | }, function() { |
272 | 252 | ||
273 | } | 253 | } |
274 | ); | 254 | ); |
275 | }; | 255 | }; |
276 | 256 | ||
277 | $scope.seleccionarProveedor = function() { | 257 | $scope.seleccionarProveedor = function() { |
278 | var modalInstance = $uibModal.open( | 258 | var modalInstance = $uibModal.open( |
279 | { | 259 | { |
280 | ariaLabelledBy: 'Busqueda de Proveedor', | 260 | ariaLabelledBy: 'Busqueda de Transportista', |
281 | templateUrl: 'modal-proveedor.html', | 261 | templateUrl: 'modal-proveedor.html', |
282 | controller: 'focaModalProveedorCtrl', | 262 | controller: 'focaModalProveedorCtrl', |
283 | size: 'lg', | 263 | size: 'lg', |
284 | resolve: { | 264 | resolve: { |
285 | transportista: function() { | 265 | transportista: function() { |
286 | return true; | 266 | return true; |
287 | } | 267 | } |
288 | } | 268 | } |
289 | } | 269 | } |
290 | ); | 270 | ); |
291 | modalInstance.result.then( | 271 | modalInstance.result.then( |
292 | function(proveedor) { | 272 | function(proveedor) { |
293 | $scope.hojaRuta.proveedor.codigo = proveedor.COD; | 273 | console.info($scope.hojaRuta); |
294 | addCabecera('Proveedor:', proveedor.NOM); | 274 | $scope.hojaRuta.transportista.codigo = proveedor.COD; |
275 | addCabecera('Transportista:', proveedor.NOM); | ||
295 | }, function() { | 276 | }, function() { |
296 | 277 | ||
297 | } | 278 | } |
298 | ); | 279 | ); |
299 | }; | 280 | }; |
300 | 281 | ||
301 | $scope.seleccionarCliente = function() { | 282 | $scope.seleccionarCliente = function() { |
302 | 283 | ||
303 | var modalInstance = $uibModal.open( | 284 | var modalInstance = $uibModal.open( |
304 | { | 285 | { |
305 | ariaLabelledBy: 'Busqueda de Cliente', | 286 | ariaLabelledBy: 'Busqueda de Cliente', |
306 | templateUrl: 'foca-busqueda-cliente-modal.html', | 287 | templateUrl: 'foca-busqueda-cliente-modal.html', |
307 | controller: 'focaBusquedaClienteModalController', | 288 | controller: 'focaBusquedaClienteModalController', |
308 | size: 'lg' | 289 | size: 'lg' |
309 | } | 290 | } |
310 | ); | 291 | ); |
311 | modalInstance.result.then( | 292 | modalInstance.result.then( |
312 | function(cliente) { | 293 | function(cliente) { |
313 | $scope.abrirModalDomicilios(cliente); | 294 | $scope.abrirModalDomicilios(cliente); |
314 | }, function() { | 295 | }, function() { |
315 | 296 | ||
316 | } | 297 | } |
317 | ); | 298 | ); |
318 | }; | 299 | }; |
319 | 300 | ||
301 | $scope.seleccionarRemito = function() { | ||
302 | var modalInstance = $uibModal.open( | ||
303 | { | ||
304 | ariaLabelledBy: 'Busqueda de Remito', | ||
305 | templateUrl: 'foca-modal-remito.html', | ||
306 | controller: 'focaModalRemitoController', | ||
307 | size: 'lg' | ||
308 | } | ||
309 | ); | ||
310 | modalInstance.result.then( | ||
311 | function(remito) { | ||
312 | var litros = 0; | ||
313 | for (var i = remito.articulosRemito.length - 1; i >= 0; i--) { | ||
314 | litros =+ remito.articulosRemito[i].cantidad; | ||
315 | } | ||
316 | |||
317 | remito.litros = litros; | ||
318 | $scope.remitosTabla.push(remito); | ||
319 | console.info($scope.remitosTabla); | ||
320 | |||
321 | |||
322 | // TODO: Implementar carga remito | ||
323 | }, function() { | ||
324 | // funcion ejecutada cuando se cancela el modal | ||
325 | } | ||
326 | ); | ||
327 | }; | ||
328 | |||
320 | $scope.abrirModalDomicilios = function(cliente) { | 329 | $scope.abrirModalDomicilios = function(cliente) { |
321 | var modalInstanceDomicilio = $uibModal.open( | 330 | var modalInstanceDomicilio = $uibModal.open( |
322 | { | 331 | { |
323 | ariaLabelledBy: 'Busqueda de Domicilios', | 332 | ariaLabelledBy: 'Busqueda de Domicilios', |
324 | templateUrl: 'modal-domicilio.html', | 333 | templateUrl: 'modal-domicilio.html', |
325 | controller: 'focaModalDomicilioController', | 334 | controller: 'focaModalDomicilioController', |
326 | resolve: { idCliente: function() { return cliente.cod; }}, | 335 | resolve: { idCliente: function() { return cliente.cod; }}, |
327 | size: 'lg', | 336 | size: 'lg', |
328 | } | 337 | } |
329 | ); | 338 | ); |
330 | modalInstanceDomicilio.result.then( | 339 | modalInstanceDomicilio.result.then( |
331 | function(domicilio) { | 340 | function(domicilio) { |
332 | $scope.hojaRuta.domicilio.id = domicilio.nivel2; | 341 | $scope.hojaRuta.domicilio.id = domicilio.nivel2; |
333 | $scope.hojaRuta.cliente = cliente; | 342 | $scope.hojaRuta.cliente = cliente; |
334 | 343 | ||
335 | addCabecera('Cliente:', cliente.nom); | 344 | addCabecera('Cliente:', cliente.nom); |
336 | addCabecera('Domicilio:', domicilio.Calle + ' ' + domicilio.Numero); | 345 | addCabecera('Domicilio:', domicilio.Calle + ' ' + domicilio.Numero); |
337 | }, function() { | 346 | }, function() { |
338 | $scope.seleccionarCliente(); | 347 | $scope.seleccionarCliente(); |
339 | return; | 348 | return; |
340 | } | 349 | } |
341 | ); | 350 | ); |
342 | }; | 351 | }; |
343 | 352 | ||
344 | $scope.mostrarFichaCliente = function() { | 353 | $scope.mostrarFichaCliente = function() { |
345 | $uibModal.open( | 354 | $uibModal.open( |
346 | { | 355 | { |
347 | ariaLabelledBy: 'Datos del Cliente', | 356 | ariaLabelledBy: 'Datos del Cliente', |
348 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 357 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
349 | controller: 'focaCrearHojaRutaFichaClienteController', | 358 | controller: 'focaCrearHojaRutaFichaClienteController', |
350 | size: 'lg' | 359 | size: 'lg' |
351 | } | 360 | } |
352 | ); | 361 | ); |
353 | }; | 362 | }; |
354 | 363 | ||
355 | $scope.getTotal = function() { | 364 | $scope.getTotal = function() { |
356 | var total = 0; | 365 | var total = 0; |
357 | var arrayTempArticulos = $scope.articulosTabla; | 366 | var arrayTempArticulos = $scope.remitosTabla; |
358 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 367 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
359 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 368 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
360 | } | 369 | } |
361 | return parseFloat(total.toFixed(2)); | 370 | return parseFloat(total.toFixed(2)); |
362 | }; | 371 | }; |
363 | 372 | ||
364 | $scope.getSubTotal = function() { | 373 | $scope.getSubTotal = function() { |
365 | if($scope.articuloACargar) { | 374 | if($scope.articuloACargar) { |
366 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 375 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
367 | } | 376 | } |
368 | }; | 377 | }; |
369 | 378 | ||
370 | $scope.abrirModalListaPrecio = function() { | 379 | $scope.abrirModalListaPrecio = function() { |
371 | var modalInstance = $uibModal.open( | 380 | var modalInstance = $uibModal.open( |
372 | { | 381 | { |
373 | ariaLabelledBy: 'Busqueda de Precio Condición', | 382 | ariaLabelledBy: 'Busqueda de Precio Condición', |
374 | templateUrl: 'modal-precio-condicion.html', | 383 | templateUrl: 'modal-precio-condicion.html', |
375 | controller: 'focaModalPrecioCondicionController', | 384 | controller: 'focaModalPrecioCondicionController', |
376 | size: 'lg' | 385 | size: 'lg' |
377 | } | 386 | } |
378 | ); | 387 | ); |
379 | modalInstance.result.then( | 388 | modalInstance.result.then( |
380 | function(precioCondicion) { | 389 | function(precioCondicion) { |
381 | var cabecera = ''; | 390 | var cabecera = ''; |
382 | var plazosConcat = ''; | 391 | var plazosConcat = ''; |
383 | if(!Array.isArray(precioCondicion)) { | 392 | if(!Array.isArray(precioCondicion)) { |
384 | $scope.plazosPagos = precioCondicion.plazoPago; | 393 | $scope.plazosPagos = precioCondicion.plazoPago; |
385 | $scope.idLista = precioCondicion.idListaPrecio; | 394 | $scope.idLista = precioCondicion.idListaPrecio; |
386 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 395 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
387 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 396 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
388 | } | 397 | } |
389 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 398 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
390 | } else { //Cuando se ingresan los plazos manualmente | 399 | } else { //Cuando se ingresan los plazos manualmente |
391 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 400 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
392 | $scope.plazosPagos = precioCondicion; | 401 | $scope.plazosPagos = precioCondicion; |
393 | for(var j = 0; j < precioCondicion.length; j++) { | 402 | for(var j = 0; j < precioCondicion.length; j++) { |
394 | plazosConcat += precioCondicion[j].dias + ' '; | 403 | plazosConcat += precioCondicion[j].dias + ' '; |
395 | } | 404 | } |
396 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 405 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
397 | } | 406 | } |
398 | $scope.articulosTabla = []; | 407 | $scope.remitosTabla = []; |
399 | addCabecera('Precios y condiciones:', cabecera); | 408 | addCabecera('Precios y condiciones:', cabecera); |
400 | }, function() { | 409 | }, function() { |
401 | 410 | ||
402 | } | 411 | } |
403 | ); | 412 | ); |
404 | }; | 413 | }; |
405 | 414 | ||
406 | $scope.abrirModalFlete = function() { | 415 | $scope.abrirModalFlete = function() { |
407 | var modalInstance = $uibModal.open( | 416 | var modalInstance = $uibModal.open( |
408 | { | 417 | { |
409 | ariaLabelledBy: 'Busqueda de Flete', | 418 | ariaLabelledBy: 'Busqueda de Flete', |
410 | templateUrl: 'modal-flete.html', | 419 | templateUrl: 'modal-flete.html', |
411 | controller: 'focaModalFleteController', | 420 | controller: 'focaModalFleteController', |
412 | size: 'lg', | 421 | size: 'lg', |
413 | resolve: { | 422 | resolve: { |
414 | parametrosFlete: | 423 | parametrosFlete: |
415 | function() { | 424 | function() { |
416 | return { | 425 | return { |
417 | flete: $scope.hojaRuta.flete ? '1' : | 426 | flete: $scope.hojaRuta.flete ? '1' : |
418 | ($scope.hojaRuta.fob ? 'FOB' : | 427 | ($scope.hojaRuta.fob ? 'FOB' : |
419 | ($scope.hojaRuta.flete === undefined ? null : '0')), | 428 | ($scope.hojaRuta.flete === undefined ? null : '0')), |
420 | bomba: $scope.hojaRuta.bomba ? '1' : | 429 | bomba: $scope.hojaRuta.bomba ? '1' : |
421 | ($scope.hojaRuta.bomba === undefined ? null : '0'), | 430 | ($scope.hojaRuta.bomba === undefined ? null : '0'), |
422 | kilometros: $scope.hojaRuta.kilometros | 431 | kilometros: $scope.hojaRuta.kilometros |
423 | }; | 432 | }; |
424 | } | 433 | } |
425 | } | 434 | } |
426 | } | 435 | } |
427 | ); | 436 | ); |
428 | modalInstance.result.then( | 437 | modalInstance.result.then( |
429 | function(datos) { | 438 | function(datos) { |
430 | $scope.hojaRuta.flete = datos.flete; | 439 | $scope.hojaRuta.flete = datos.flete; |
431 | $scope.hojaRuta.fob = datos.FOB; | 440 | $scope.hojaRuta.fob = datos.FOB; |
432 | $scope.hojaRuta.bomba = datos.bomba; | 441 | $scope.hojaRuta.bomba = datos.bomba; |
433 | $scope.hojaRuta.kilometros = datos.kilometros; | 442 | $scope.hojaRuta.kilometros = datos.kilometros; |
434 | 443 | ||
435 | addCabecera('Flete:', datos.flete ? 'Si' : | 444 | addCabecera('Flete:', datos.flete ? 'Si' : |
436 | ($scope.hojaRuta.fob ? 'FOB' : 'No')); | 445 | ($scope.hojaRuta.fob ? 'FOB' : 'No')); |
437 | if(datos.flete) { | 446 | if(datos.flete) { |
438 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 447 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
439 | addCabecera('Kilometros:', datos.kilometros); | 448 | addCabecera('Kilometros:', datos.kilometros); |
440 | } else { | 449 | } else { |
441 | removeCabecera('Bomba:'); | 450 | removeCabecera('Bomba:'); |
442 | removeCabecera('Kilometros:'); | 451 | removeCabecera('Kilometros:'); |
443 | $scope.hojaRuta.fob = false; | 452 | $scope.hojaRuta.fob = false; |
444 | $scope.hojaRuta.bomba = false; | 453 | $scope.hojaRuta.bomba = false; |
445 | $scope.hojaRuta.kilometros = null; | 454 | $scope.hojaRuta.kilometros = null; |
446 | } | 455 | } |
447 | }, function() { | 456 | }, function() { |
448 | 457 | ||
449 | } | 458 | } |
450 | ); | 459 | ); |
451 | }; | 460 | }; |
452 | 461 | ||
453 | $scope.abrirModalMoneda = function() { | 462 | $scope.abrirModalMoneda = function() { |
454 | var modalInstance = $uibModal.open( | 463 | var modalInstance = $uibModal.open( |
455 | { | 464 | { |
456 | ariaLabelledBy: 'Busqueda de Moneda', | 465 | ariaLabelledBy: 'Busqueda de Moneda', |
457 | templateUrl: 'modal-moneda.html', | 466 | templateUrl: 'modal-moneda.html', |
458 | controller: 'focaModalMonedaController', | 467 | controller: 'focaModalMonedaController', |
459 | size: 'lg' | 468 | size: 'lg' |
460 | } | 469 | } |
461 | ); | 470 | ); |
462 | modalInstance.result.then( | 471 | modalInstance.result.then( |
463 | function(moneda) { | 472 | function(moneda) { |
464 | $scope.abrirModalCotizacion(moneda); | 473 | $scope.abrirModalCotizacion(moneda); |
465 | }, function() { | 474 | }, function() { |
466 | 475 | ||
467 | } | 476 | } |
468 | ); | 477 | ); |
469 | }; | 478 | }; |
470 | 479 | ||
471 | $scope.abrirModalCotizacion = function(moneda) { | 480 | $scope.abrirModalCotizacion = function(moneda) { |
472 | var modalInstance = $uibModal.open( | 481 | var modalInstance = $uibModal.open( |
473 | { | 482 | { |
474 | ariaLabelledBy: 'Busqueda de Cotización', | 483 | ariaLabelledBy: 'Busqueda de Cotización', |
475 | templateUrl: 'modal-cotizacion.html', | 484 | templateUrl: 'modal-cotizacion.html', |
476 | controller: 'focaModalCotizacionController', | 485 | controller: 'focaModalCotizacionController', |
477 | size: 'lg', | 486 | size: 'lg', |
478 | resolve: {idMoneda: function() {return moneda.ID;}} | 487 | resolve: {idMoneda: function() {return moneda.ID;}} |
479 | } | 488 | } |
480 | ); | 489 | ); |
481 | modalInstance.result.then( | 490 | modalInstance.result.then( |
482 | function(cotizacion) { | 491 | function(cotizacion) { |
483 | var articulosTablaTemp = $scope.articulosTabla; | 492 | var remitosTablaTemp = $scope.remitosTabla; |
484 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 493 | for(var i = 0; i < remitosTablaTemp.length; i++) { |
485 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 494 | remitosTablaTemp[i].precio = remitosTablaTemp[i].precio * |
486 | $scope.hojaRuta.cotizacion.COTIZACION; | 495 | $scope.hojaRuta.cotizacion.COTIZACION; |
487 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 496 | remitosTablaTemp[i].precio = remitosTablaTemp[i].precio / |
488 | cotizacion.COTIZACION; | 497 | cotizacion.COTIZACION; |
489 | } | 498 | } |
490 | $scope.articulosTabla = articulosTablaTemp; | 499 | $scope.remitosTabla = remitosTablaTemp; |
491 | $scope.hojaRuta.moneda = { | 500 | $scope.hojaRuta.moneda = { |
492 | id: moneda.ID, | 501 | id: moneda.ID, |
493 | detalle: moneda.DETALLE, | 502 | detalle: moneda.DETALLE, |
494 | simbolo: moneda.SIMBOLO | 503 | simbolo: moneda.SIMBOLO |
495 | }; | 504 | }; |
496 | $scope.hojaRuta.cotizacion = { | 505 | $scope.hojaRuta.cotizacion = { |
497 | ID: cotizacion.ID, | 506 | ID: cotizacion.ID, |
498 | COTIZACION: cotizacion.COTIZACION, | 507 | COTIZACION: cotizacion.COTIZACION, |
499 | FECHA: cotizacion.FECHA | 508 | FECHA: cotizacion.FECHA |
500 | }; | 509 | }; |
501 | addCabecera('Moneda:', moneda.DETALLE); | 510 | addCabecera('Moneda:', moneda.DETALLE); |
502 | addCabecera( | 511 | addCabecera( |
503 | 'Fecha cotizacion:', | 512 | 'Fecha cotizacion:', |
504 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 513 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
505 | ); | 514 | ); |
506 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 515 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
507 | }, function() { | 516 | }, function() { |
508 | 517 | ||
509 | } | 518 | } |
510 | ); | 519 | ); |
511 | }; | 520 | }; |
512 | 521 | ||
513 | $scope.agregarATabla = function(key) { | 522 | $scope.agregarATabla = function(key) { |
514 | if(key === 13) { | 523 | if(key === 13) { |
515 | if($scope.articuloACargar.cantidad === undefined || | 524 | if($scope.articuloACargar.cantidad === undefined || |
516 | $scope.articuloACargar.cantidad === 0 || | 525 | $scope.articuloACargar.cantidad === 0 || |
517 | $scope.articuloACargar.cantidad === null ){ | 526 | $scope.articuloACargar.cantidad === null ){ |
518 | focaModalService.alert('El valor debe ser al menos 1'); | 527 | focaModalService.alert('El valor debe ser al menos 1'); |
519 | return; | 528 | return; |
520 | } | 529 | } |
521 | delete $scope.articuloACargar.sectorCodigo; | 530 | delete $scope.articuloACargar.sectorCodigo; |
522 | console.info($scope.articuloACargar); | 531 | console.info($scope.articuloACargar); |
523 | $scope.articulosTabla.push($scope.articuloACargar); | 532 | $scope.remitosTabla.push($scope.articuloACargar); |
524 | $scope.cargando = true; | 533 | $scope.cargando = true; |
525 | } | 534 | } |
526 | }; | 535 | }; |
527 | 536 | ||
528 | $scope.quitarArticulo = function(key) { | 537 | $scope.quitarArticulo = function(key) { |
529 | $scope.articulosTabla.splice(key, 1); | 538 | $scope.remitosTabla.splice(key, 1); |
530 | }; | 539 | }; |
531 | 540 | ||
532 | $scope.editarArticulo = function(key, articulo) { | 541 | $scope.editarArticulo = function(key, articulo) { |
533 | if(key === 13) { | 542 | if(key === 13) { |
534 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 543 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
535 | articulo.cantidad === undefined){ | 544 | articulo.cantidad === undefined){ |
536 | focaModalService.alert('El valor debe ser al menos 1'); | 545 | focaModalService.alert('El valor debe ser al menos 1'); |
537 | return; | 546 | return; |
538 | } | 547 | } |
539 | articulo.editCantidad = false; | 548 | articulo.editCantidad = false; |
540 | articulo.editPrecio = false; | 549 | articulo.editPrecio = false; |
541 | } | 550 | } |
542 | }; | 551 | }; |
543 | 552 | ||
544 | $scope.cambioEdit = function(articulo, propiedad) { | 553 | $scope.cambioEdit = function(articulo, propiedad) { |
545 | if(propiedad === 'cantidad') { | 554 | if(propiedad === 'cantidad') { |
546 | articulo.editCantidad = true; | 555 | articulo.editCantidad = true; |
547 | } else if(propiedad === 'precio') { | 556 | } else if(propiedad === 'precio') { |
548 | articulo.editPrecio = true; | 557 | articulo.editPrecio = true; |
549 | } | 558 | } |
550 | }; | 559 | }; |
551 | 560 | ||
552 | $scope.limpiarFlete = function() { | 561 | $scope.limpiarFlete = function() { |
553 | $scope.hojaRuta.fleteNombre = ''; | 562 | $scope.hojaRuta.fleteNombre = ''; |
554 | $scope.hojaRuta.chofer = ''; | 563 | $scope.hojaRuta.chofer = ''; |
555 | $scope.hojaRuta.vehiculo = ''; | 564 | $scope.hojaRuta.vehiculo = ''; |
556 | $scope.hojaRuta.kilometros = ''; | 565 | $scope.hojaRuta.kilometros = ''; |
557 | $scope.hojaRuta.costoUnitarioKmFlete = ''; | 566 | $scope.hojaRuta.costoUnitarioKmFlete = ''; |
558 | $scope.choferes = ''; | 567 | $scope.choferes = ''; |
559 | $scope.vehiculos = ''; | 568 | $scope.vehiculos = ''; |
560 | }; | 569 | }; |
561 | 570 | ||
562 | $scope.limpiarPantalla = function() { | 571 | $scope.limpiarPantalla = function() { |
563 | $scope.limpiarFlete(); | 572 | $scope.limpiarFlete(); |
564 | $scope.hojaRuta.flete = '0'; | 573 | $scope.hojaRuta.flete = '0'; |
565 | $scope.hojaRuta.bomba = '0'; | 574 | $scope.hojaRuta.bomba = '0'; |
566 | $scope.hojaRuta.precioCondicion = ''; | 575 | $scope.hojaRuta.precioCondicion = ''; |
567 | $scope.articulosTabla = []; | 576 | $scope.remitosTabla = []; |
568 | $scope.hojaRuta.vendedor.nombre = ''; | 577 | $scope.hojaRuta.vendedor.nombre = ''; |
569 | $scope.hojaRuta.cliente = {nombre: ''}; | 578 | $scope.hojaRuta.cliente = {nombre: ''}; |
570 | $scope.hojaRuta.domicilio = {dom: ''}; | 579 | $scope.hojaRuta.domicilio = {dom: ''}; |
571 | $scope.domiciliosCliente = []; | 580 | $scope.domiciliosCliente = []; |
572 | }; | 581 | }; |
573 | 582 | ||
574 | $scope.resetFilter = function() { | 583 | $scope.resetFilter = function() { |
575 | $scope.articuloACargar = {}; | 584 | $scope.articuloACargar = {}; |
576 | $scope.cargando = true; | 585 | $scope.cargando = true; |
577 | }; | 586 | }; |
578 | //Recibe aviso si el teclado está en uso | 587 | //Recibe aviso si el teclado está en uso |
579 | // $rootScope.$on('usarTeclado', function(event, data) { | 588 | // $rootScope.$on('usarTeclado', function(event, data) { |
580 | // if(data) { | 589 | // if(data) { |
581 | // $scope.mostrarTeclado = true; | 590 | // $scope.mostrarTeclado = true; |
582 | // return; | 591 | // return; |
583 | // } | 592 | // } |
584 | // $scope.mostrarTeclado = false; | 593 | // $scope.mostrarTeclado = false; |
585 | // }) | 594 | // }) |
586 | $scope.selectFocus = function($event) { | 595 | $scope.selectFocus = function($event) { |
587 | //Si el teclado esta en uso no selecciona el valor | 596 | //Si el teclado esta en uso no selecciona el valor |
588 | // if($scope.mostrarTeclado) { | 597 | // if($scope.mostrarTeclado) { |
589 | // return; | 598 | // return; |
590 | // } | 599 | // } |
591 | $event.target.select(); | 600 | $event.target.select(); |
592 | }; | 601 | }; |
593 | 602 | ||
594 | $scope.salir = function() { | 603 | $scope.salir = function() { |
595 | $location.path('/'); | 604 | $location.path('/'); |
596 | }; | 605 | }; |
597 | 606 | ||
598 | $scope.parsearATexto = function(articulo) { | 607 | $scope.parsearATexto = function(articulo) { |
599 | articulo.cantidad = parseFloat(articulo.cantidad); | 608 | articulo.cantidad = parseFloat(articulo.cantidad); |
600 | articulo.precio = parseFloat(articulo.precio); | 609 | articulo.precio = parseFloat(articulo.precio); |
601 | }; | 610 | }; |
602 | 611 | ||
612 | $scope.rellenar = function(relleno, longitud) { | ||
613 | relleno = '' + relleno; | ||
614 | while (relleno.length < longitud) { | ||
615 | relleno = '0' + relleno; | ||
616 | } | ||
617 | |||
618 | return relleno; | ||
619 | } | ||
620 | |||
603 | function addCabecera(label, valor) { | 621 | function addCabecera(label, valor) { |
604 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 622 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
605 | if(propiedad.length === 1) { | 623 | if(propiedad.length === 1) { |
606 | propiedad[0].valor = valor; | 624 | propiedad[0].valor = valor; |
607 | } else { | 625 | } else { |
608 | $scope.cabecera.push({label: label, valor: valor}); | 626 | $scope.cabecera.push({label: label, valor: valor}); |
609 | } | 627 | } |
610 | } | 628 | } |
611 | 629 | ||
612 | function removeCabecera(label) { | 630 | function removeCabecera(label) { |
613 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 631 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
614 | if(propiedad.length === 1){ | 632 | if(propiedad.length === 1){ |
615 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 633 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
616 | } | 634 | } |
617 | } | 635 | } |
618 | 636 | ||
619 | function rellenar(relleno, longitud) { | 637 | |
620 | relleno = '' + relleno; | ||
621 | while (relleno.length < longitud) { | ||
622 | relleno = '0' + relleno; | ||
623 | } | ||
624 | |||
625 | return relleno; | ||
626 | } | ||
627 | } | 638 | } |
628 | ] | 639 | ] |
629 | ) | 640 | ) |
630 | .controller('hojaRutaListaCtrl', [ | 641 | .controller('hojaRutaListaCtrl', [ |
631 | '$scope', | 642 | '$scope', |
632 | 'crearHojaRutaService', | 643 | 'crearHojaRutaService', |
633 | '$location', | 644 | '$location', |
634 | function($scope, crearHojaRutaService, $location) { | 645 | function($scope, crearHojaRutaService, $location) { |
635 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { | 646 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { |
src/views/hoja-ruta.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row"> | 7 | <div class="row"> |
8 | <div class="col-12 col-sm-4 nota-pedido"> | 8 | <div class="col-12 col-sm-4 nota-pedido"> |
9 | <h5>HOJA RUTA</h5> | 9 | <h5>HOJA RUTA</h5> |
10 | </div> | 10 | </div> |
11 | <div class="col-5 col-sm-4 numero-pedido" | 11 | <div class="col-5 col-sm-4 numero-pedido" |
12 | >Nº {{puntoVenta}}-{{comprobante}} | 12 | >Nº {{puntoVenta}}-{{comprobante}} |
13 | </div> | 13 | </div> |
14 | <div class="col-7 col-sm-4 text-right"> | 14 | <div class="col-7 col-sm-4 text-right"> |
15 | Fecha: | 15 | Fecha: |
16 | <span | 16 | <span |
17 | ng-show="!datepickerAbierto" | 17 | ng-show="!datepickerAbierto" |
18 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 18 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" |
19 | ng-click="datepickerAbierto = true" | 19 | ng-click="datepickerAbierto = true" |
20 | > | 20 | > |
21 | </span> | 21 | </span> |
22 | <input | 22 | <input |
23 | ng-show="datepickerAbierto" | 23 | ng-show="datepickerAbierto" |
24 | type="date" | 24 | type="date" |
25 | ng-model="now" | 25 | ng-model="now" |
26 | ng-change="datepickerAbierto = false" | 26 | ng-change="datepickerAbierto = false" |
27 | ng-blur="datepickerAbierto = false" | 27 | ng-blur="datepickerAbierto = false" |
28 | class="form-control form-control-sm col-8 float-right" | 28 | class="form-control form-control-sm col-8 float-right" |
29 | foca-focus="datepickerAbierto" | 29 | foca-focus="datepickerAbierto" |
30 | hasta-hoy | 30 | hasta-hoy |
31 | /> | 31 | /> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | <div class="row"> | 34 | <div class="row"> |
35 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 35 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
36 | <span class="label" ng-bind="cab.label"></span> | 36 | <span class="label" ng-bind="cab.label"></span> |
37 | <span class="valor" ng-bind="cab.valor"></span> | 37 | <span class="valor" ng-bind="cab.valor"></span> |
38 | </div> | 38 | </div> |
39 | <a | 39 | <a |
40 | class="btn col-12 btn-secondary d-sm-none" | 40 | class="btn col-12 btn-secondary d-sm-none" |
41 | ng-show="cabecera.length > 0" | 41 | ng-show="cabecera.length > 0" |
42 | ng-click="showCabecera = !showCabecera" | 42 | ng-click="showCabecera = !showCabecera" |
43 | > | 43 | > |
44 | <i | 44 | <i |
45 | class="fa fa-chevron-down" | 45 | class="fa fa-chevron-down" |
46 | ng-hide="showCabecera" | 46 | ng-hide="showCabecera" |
47 | aria-hidden="true" | 47 | aria-hidden="true" |
48 | > | 48 | > |
49 | </i> | 49 | </i> |
50 | <i | 50 | <i |
51 | class="fa fa-chevron-up" | 51 | class="fa fa-chevron-up" |
52 | ng-show="showCabecera" | 52 | ng-show="showCabecera" |
53 | aria-hidden="true"> | 53 | aria-hidden="true"> |
54 | </i> | 54 | </i> |
55 | </a> | 55 | </a> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | <div class="row p-1 botonera-secundaria"> | 59 | <div class="row p-1 botonera-secundaria"> |
60 | <div class="col-12"> | 60 | <div class="col-12"> |
61 | <div class="row"> | 61 | <div class="row"> |
62 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 62 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
63 | <button | 63 | <button |
64 | type="button" | 64 | type="button" |
65 | class="btn btn-default btn-block btn-xs text-left py-2" | 65 | class="btn btn-default btn-block btn-xs text-left py-2" |
66 | ng-click="boton.accion()" | 66 | ng-click="boton.accion()" |
67 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 67 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
68 | > | 68 | > |
69 | <i | 69 | <i |
70 | class="fa fa-arrow-circle-right" | 70 | class="fa fa-arrow-circle-right" |
71 | ng-show="boton.texto != ''" | 71 | ng-show="boton.texto != ''" |
72 | ></i> | 72 | ></i> |
73 | | 73 | |
74 | {{boton.texto}} | 74 | {{boton.texto}} |
75 | </button> | 75 | </button> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | </form> | 82 | </form> |
83 | <div class="row"> | 83 | <div class="row"> |
84 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 84 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
85 | <!-- PC --> | 85 | <!-- PC --> |
86 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 86 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
87 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 87 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
88 | <thead> | 88 | <thead> |
89 | <tr class="d-flex"> | 89 | <tr class="d-flex"> |
90 | <th class="">#</th> | 90 | <th class="col-auto">#</th> |
91 | <th class="col">Código</th> | 91 | <th class="col-2">Remito</th> |
92 | <th class="col-4">Descripción</th> | 92 | <th class="col">Cliente</th> |
93 | <th class="col text-right">Cantidad</th> | 93 | <th class="col">Dirección</th> |
94 | <th class="col text-right">Precio Unitario</th> | 94 | <th class="col-1">Litros</th> |
95 | <th class="col text-right">SubTotal</th> | 95 | <th class="col-auto"> |
96 | <th class="text-right"> | ||
97 | <button | 96 | <button |
98 | class="btn btn-outline-secondary selectable" | 97 | class="btn btn-outline-secondary selectable" |
99 | ng-click="show = !show; masMenos()" | 98 | ng-click="show = !show; masMenos()" |
100 | > | 99 | > |
101 | <i | 100 | <i |
102 | class="fa fa-chevron-down" | 101 | class="fa fa-chevron-down" |
103 | ng-show="show" | 102 | ng-show="show" |
104 | aria-hidden="true" | 103 | aria-hidden="true" |
105 | > | 104 | > |
106 | </i> | 105 | </i> |
107 | <i | 106 | <i |
108 | class="fa fa-chevron-up" | 107 | class="fa fa-chevron-up" |
109 | ng-hide="show" | 108 | ng-hide="show" |
110 | aria-hidden="true"> | 109 | aria-hidden="true"> |
111 | </i> | 110 | </i> |
112 | </button> | 111 | </button> |
113 | </th> | 112 | </th> |
113 | </th> | ||
114 | </tr> | 114 | </tr> |
115 | </thead> | 115 | </thead> |
116 | <tbody class="tabla-articulo-body"> | 116 | <tbody class="tabla-articulo-body"> |
117 | <tr | 117 | <tr |
118 | ng-repeat="(key, articulo) in articulosTabla" | 118 | ng-repeat="(key, remito) in remitosTabla" |
119 | ng-show="show || key == (articulosTabla.length - 1)" | ||
120 | class="d-flex" | 119 | class="d-flex" |
120 | ng-show="show || key == 0" | ||
121 | > | 121 | > |
122 | <td ng-bind="key + 1"></td> | 122 | <td ng-bind="key + 1" class="col-auto"></td> |
123 | <td | 123 | <td |
124 | class="col" | 124 | class="col-2" |
125 | ng-bind="articulo.sector + '-' + articulo.codigo" | 125 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" |
126 | ></td> | 126 | ></td> |
127 | <td | 127 | <th class="col" ng-bind="remito.cliente[0].NOM"></th> |
128 | class="col-4" | 128 | <th class="col" ng-bind="remito.direccionStamp"></th> |
129 | ng-bind="articulo.descripcion" | 129 | <th class="col-1" ng-bind="remito.litros"></th> |
130 | ></td> | 130 | <td class="text-center col-auto"> |
131 | <td class="col text-right"> | ||
132 | <input | ||
133 | ng-show="articulo.editCantidad" | ||
134 | ng-model="articulo.cantidad" | ||
135 | class="form-control" | ||
136 | type="number" | ||
137 | min="1" | ||
138 | foca-focus="articulo.editCantidad" | ||
139 | ng-keypress="editarArticulo($event.keyCode, articulo)" | ||
140 | ng-focus="selectFocus($event)" | ||
141 | teclado-virtual | ||
142 | > | ||
143 | <i | ||
144 | class="selectable" | ||
145 | ng-click="cambioEdit(articulo, 'cantidad')" | ||
146 | ng-hide="articulo.editCantidad" | ||
147 | ng-bind="articulo.cantidad"> | ||
148 | </i> | ||
149 | </td> | ||
150 | <td class="col text-right"> | ||
151 | <input | ||
152 | ng-show="articulo.editPrecio" | ||
153 | ng-model="articulo.precio" | ||
154 | class="form-control" | ||
155 | type="number" | ||
156 | min="0" | ||
157 | step="0.0001" | ||
158 | foca-focus="articulo.editPrecio" | ||
159 | ng-keypress="editarArticulo($event.keyCode, articulo)" | ||
160 | ng-focus="selectFocus($event)" | ||
161 | teclado-virtual | ||
162 | > | ||
163 | <i | ||
164 | class="selectable" | ||
165 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | ||
166 | ng-hide="articulo.editPrecio" | ||
167 | ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"> | ||
168 | </i> | ||
169 | </td> | ||
170 | <td | ||
171 | class="col text-right" | ||
172 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo"> | ||
173 | </td> | ||
174 | <td class="text-center"> | ||
175 | <button | 131 | <button |
176 | class="btn btn-outline-secondary" | 132 | class="btn btn-outline-secondary" |
177 | ng-click="quitarArticulo(key)" | 133 | ng-click="quitarArticulo(key)" |
178 | > | 134 | > |
179 | <i class="fa fa-trash"></i> | 135 | <i class="fa fa-trash"></i> |
180 | </button> | 136 | </button> |
181 | </td> | 137 | </td> |
182 | </tr> | 138 | </tr> |
183 | </tbody> | 139 | </tbody> |
184 | <tfoot> | 140 | <tfoot> |
185 | <tr ng-show="!cargando" class="d-flex"> | ||
186 | <td | ||
187 | class="align-middle" | ||
188 | ng-bind="articulosTabla.length + 1" | ||
189 | ></td> | ||
190 | <td class="col"> | ||
191 | <input | ||
192 | class="form-control" | ||
193 | ng-model="articuloACargar.sectorCodigo" | ||
194 | readonly | ||
195 | > | ||
196 | </td> | ||
197 | <td class="col-4 tabla-articulo-descripcion"> | ||
198 | <input | ||
199 | class="form-control" | ||
200 | ng-model="articuloACargar.descripcion" | ||
201 | readonly | ||
202 | > | ||
203 | </td> | ||
204 | <td class="col text-right"> | ||
205 | <input | ||
206 | class="form-control" | ||
207 | type="number" | ||
208 | min="1" | ||
209 | ng-model="articuloACargar.cantidad" | ||
210 | foca-focus="!cargando" | ||
211 | esc-key="resetFilter()" | ||
212 | ng-keypress="agregarATabla($event.keyCode)" | ||
213 | ng-blur="parsearATexto(articuloACargar)" | ||
214 | teclado-virtual | ||
215 | > | ||
216 | </td> | ||
217 | <td class="col text-right"> | ||
218 | <input | ||
219 | class="form-control" | ||
220 | ng-value="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4" | ||
221 | ng-show="idLista != -1" | ||
222 | readonly | ||
223 | > | ||
224 | <input | ||
225 | class="form-control" | ||
226 | type="number" | ||
227 | min="0" | ||
228 | step="0.0001" | ||
229 | ng-model="articuloACargar.precio" | ||
230 | esc-key="resetFilter()" | ||
231 | ng-keypress="agregarATabla($event.keyCode)" | ||
232 | ng-show="idLista == -1" | ||
233 | teclado-virtual | ||
234 | > | ||
235 | </td> | ||
236 | <td class="col text-right"> | ||
237 | <input | ||
238 | class="form-control" | ||
239 | ng-value="getSubTotal() | currency: hojaRuta.moneda.simbolo" | ||
240 | readonly | ||
241 | ></td> | ||
242 | <td class="text-center align-middle"> | ||
243 | <button | ||
244 | class="btn btn-outline-secondary" | ||
245 | ng-click="agregarATabla(13)" | ||
246 | > | ||
247 | <i class="fa fa-save"></i> | ||
248 | </button> | ||
249 | </td> | ||
250 | </tr> | ||
251 | <tr ng-show="cargando" class="d-flex"> | ||
252 | <td colspan="7" class="col-12"> | ||
253 | <input | ||
254 | placeholder="Seleccione Articulo" | ||
255 | class="form-control form-control-sm" | ||
256 | readonly | ||
257 | ng-click="seleccionarArticulo()" | ||
258 | /> | ||
259 | </td> | ||
260 | </tr> | ||
261 | <tr class="d-flex"> | 141 | <tr class="d-flex"> |
262 | <td colspan="4" class="no-border-top"> | 142 | <td colspan="4" class="no-border-top"> |
263 | <strong>Items:</strong> | 143 | <strong>Remitos:</strong> |
264 | <a ng-bind="articulosTabla.length"></a> | 144 | <a ng-bind="remitosTabla.length"></a> |
265 | </td> | ||
266 | <td class="text-right ml-auto table-celda-total no-border-top"> | ||
267 | <h3>Total:</h3> | ||
268 | </td> | ||
269 | <td class="table-celda-total text-right no-border-top" colspan="1"> | ||
270 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> | ||
271 | </td> | ||
272 | <td class="text-right no-border-top"> | ||
273 | <button | ||
274 | type="button" | ||
275 | class="btn btn-default btn-sm" | ||
276 | > | ||
277 | Totales | ||
278 | </button> | ||
279 | </td> | 145 | </td> |
280 | </tr> | 146 | </tr> |
281 | </tfoot> | 147 | </tfoot> |
282 | </table> | 148 | </table> |
283 | </div> | 149 | </div> |
284 | 150 | ||
285 | <!-- MOBILE --> | 151 | <!-- MOBILE --> |
286 | <div class="row d-sm-none"> | 152 | <div class="row d-sm-none"> |
287 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | 153 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> |
288 | <thead> | 154 | <thead> |
289 | <tr class="d-flex"> | 155 | <tr class="d-flex"> |
290 | <th class="">#</th> | 156 | <th class="">#</th> |
291 | <th class="col px-0"> | 157 | <th class="col px-0"> |
292 | <div class="d-flex"> | 158 | <div class="d-flex"> |
293 | <div class="col-4 px-1">Código</div> | 159 | <div class="col-4 px-1">Código</div> |
294 | <div class="col-8 px-1">Descripción</div> | 160 | <div class="col-8 px-1">Descripción</div> |
295 | </div> | 161 | </div> |
296 | <div class="d-flex"> | 162 | <div class="d-flex"> |
297 | <div class="col-3 px-1">Cantidad</div> | 163 | <div class="col-3 px-1">Cantidad</div> |
298 | <div class="col px-1 text-right">P. Uni.</div> | 164 | <div class="col px-1 text-right">P. Uni.</div> |
299 | <div class="col px-1 text-right">Subtotal</div> | 165 | <div class="col px-1 text-right">Subtotal</div> |
300 | </div> | 166 | </div> |
301 | </th> | 167 | </th> |
302 | <th class="text-center tamaño-boton"> | 168 | <th class="text-center tamaño-boton"> |
303 | | 169 | |
304 | </th> | 170 | </th> |
305 | </tr> | 171 | </tr> |
306 | </thead> | 172 | </thead> |
307 | <tbody> | 173 | <tbody> |
308 | <tr | 174 | <tr |
309 | ng-repeat="(key, articulo) in articulosTabla" | 175 | ng-repeat="(key, articulo) in remitosTabla" |
310 | ng-show="show || key == articulosTabla.length - 1" | 176 | ng-show="show || key == remitosTabla.length - 1" |
311 | > | 177 | > |
312 | <td class="w-100 align-middle d-flex p-0"> | 178 | <td class="w-100 align-middle d-flex p-0"> |
313 | <div class="align-middle p-1"> | 179 | <div class="align-middle p-1"> |
314 | <span ng-bind="key+1" class="align-middle"></span> | 180 | <span ng-bind="key+1" class="align-middle"></span> |
315 | </div> | 181 | </div> |
316 | <div class="col px-0"> | 182 | <div class="col px-0"> |
317 | <div class="d-flex"> | 183 | <div class="d-flex"> |
318 | <div class="col-4 px-1"> | 184 | <div class="col-4 px-1"> |
319 | <span | 185 | <span |
320 | ng-bind="articulo.sector + '-' + articulo.codigo" | 186 | ng-bind="articulo.sector + '-' + articulo.codigo" |
321 | ></span> | 187 | ></span> |
322 | </div> | 188 | </div> |
323 | <div class="col-8 px-1"> | 189 | <div class="col-8 px-1"> |
324 | <span ng-bind="articulo.descripcion"></span> | 190 | <span ng-bind="articulo.descripcion"></span> |
325 | </div> | 191 | </div> |
326 | </div> | 192 | </div> |
327 | <div class="d-flex"> | 193 | <div class="d-flex"> |
328 | <div class="col-3 px-1"> | 194 | <div class="col-3 px-1"> |
329 | <span ng-bind="'x' + articulo.cantidad"></span> | 195 | <span ng-bind="'x' + articulo.cantidad"></span> |
330 | </div> | 196 | </div> |
331 | <div class="col-3 px-1 text-right"> | 197 | <div class="col-3 px-1 text-right"> |
332 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | 198 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> |
333 | </div> | 199 | </div> |
334 | <div class="col px-1 text-right"> | 200 | <div class="col px-1 text-right"> |
335 | <span | 201 | <span |
336 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" | 202 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" |
337 | > | 203 | > |
338 | </span> | 204 | </span> |
339 | </div> | 205 | </div> |
340 | </div> | 206 | </div> |
341 | </div> | 207 | </div> |
342 | <div class="align-middle p-1"> | 208 | <div class="align-middle p-1"> |
343 | <button | 209 | <button |
344 | class="btn btn-outline-secondary" | 210 | class="btn btn-outline-secondary" |
345 | ng-click="quitarArticulo(key)" | 211 | ng-click="quitarArticulo(key)" |
346 | > | 212 | > |
347 | <i class="fa fa-trash"></i> | 213 | <i class="fa fa-trash"></i> |
348 | </button> | 214 | </button> |
349 | </div> | 215 | </div> |
350 | </td> | 216 | </td> |
351 | </tr> | 217 | </tr> |
352 | </tbody> | 218 | </tbody> |
353 | <tfoot> | 219 | <tfoot> |
354 | <!-- CARGANDO ITEM --> | 220 | <!-- CARGANDO ITEM --> |
355 | <tr ng-show="!cargando" class="d-flex"> | 221 | <tr ng-show="!cargando" class="d-flex"> |
356 | <td | 222 | <td |
357 | class="align-middle p-1" | 223 | class="align-middle p-1" |
358 | ng-bind="articulosTabla.length + 1" | 224 | ng-bind="remitosTabla.length + 1" |
359 | ></td> | 225 | ></td> |
360 | <td class="col p-0"> | 226 | <td class="col p-0"> |
361 | <div class="d-flex"> | 227 | <div class="d-flex"> |
362 | <div class="col-4 px-1"> | 228 | <div class="col-4 px-1"> |
363 | <span | 229 | <span |
364 | ng-bind="articuloACargar.sectorCodigo" | 230 | ng-bind="articuloACargar.sectorCodigo" |
365 | ></span> | 231 | ></span> |
366 | </div> | 232 | </div> |
367 | <div class="col-8 px-1"> | 233 | <div class="col-8 px-1"> |
368 | <span ng-bind="articuloACargar.descripcion"></span> | 234 | <span ng-bind="articuloACargar.descripcion"></span> |
369 | </div> | 235 | </div> |
370 | </div> | 236 | </div> |
371 | <div class="d-flex"> | 237 | <div class="d-flex"> |
372 | <div class="col-3 px-1 m-1"> | 238 | <div class="col-3 px-1 m-1"> |
373 | <input | 239 | <input |
374 | class="form-control p-1" | 240 | class="form-control p-1" |
375 | type="number" | 241 | type="number" |
376 | min="1" | 242 | min="1" |
377 | ng-model="articuloACargar.cantidad" | 243 | ng-model="articuloACargar.cantidad" |
378 | foca-focus="!cargando" | 244 | foca-focus="!cargando" |
379 | ng-keypress="agregarATabla($event.keyCode)" | 245 | ng-keypress="agregarATabla($event.keyCode)" |
380 | style="height: auto; line-height: 1.1em" | 246 | style="height: auto; line-height: 1.1em" |
381 | > | 247 | > |
382 | </div> | 248 | </div> |
383 | <div class="col-3 px-1 text-right"> | 249 | <div class="col-3 px-1 text-right"> |
384 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | 250 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> |
385 | </div> | 251 | </div> |
386 | <div class="col px-1 text-right"> | 252 | <div class="col px-1 text-right"> |
387 | <span | 253 | <span |
388 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" | 254 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" |
389 | > | 255 | > |
390 | </span> | 256 | </span> |
391 | </div> | 257 | </div> |
392 | </div> | 258 | </div> |
393 | </td> | 259 | </td> |
394 | <td class="text-center align-middle"> | 260 | <td class="text-center align-middle"> |
395 | <button | 261 | <button |
396 | class="btn btn-outline-secondary" | 262 | class="btn btn-outline-secondary" |
397 | ng-click="agregarATabla(13)" | 263 | ng-click="agregarATabla(13)" |
398 | > | 264 | > |
399 | <i class="fa fa-save"></i> | 265 | <i class="fa fa-save"></i> |
400 | </button> | 266 | </button> |
401 | </td> | 267 | </td> |
402 | </tr> | 268 | </tr> |
403 | <!-- SELECCIONAR PRODUCTO --> | 269 | <!-- SELECCIONAR PRODUCTO --> |
404 | <tr ng-show="cargando" class="d-flex"> | 270 | <tr ng-show="cargando" class="d-flex"> |
405 | <td class="col-12"> | 271 | <td class="col-12"> |
406 | <input | 272 | <input |
407 | placeholder="Seleccione Articulo" | 273 | placeholder="Seleccione Articulo" |
408 | class="form-control form-control-sm" | 274 | class="form-control form-control-sm" |
409 | readonly | 275 | readonly |
410 | ng-click="seleccionarArticulo()" | 276 | ng-click="seleccionarArticulo()" |
411 | /> | 277 | /> |
412 | </td> | 278 | </td> |
413 | </tr> | 279 | </tr> |
414 | <!-- TOOGLE EXPANDIR --> | 280 | <!-- TOOGLE EXPANDIR --> |
415 | <tr> | 281 | <tr> |
416 | <td class="col"> | 282 | <td class="col"> |
417 | <button | 283 | <button |
418 | class="btn btn-outline-secondary selectable w-100" | 284 | class="btn btn-outline-secondary selectable w-100" |
419 | ng-click="show = !show; masMenos()" | 285 | ng-click="show = !show; masMenos()" |
420 | ng-show="articulosTabla.length > 0" | 286 | ng-show="remitosTabla.length > 0" |
421 | > | 287 | > |
422 | <i | 288 | <i |
423 | class="fa fa-chevron-down" | 289 | class="fa fa-chevron-down" |
424 | ng-hide="show" | 290 | ng-hide="show" |
425 | aria-hidden="true" | 291 | aria-hidden="true" |
426 | > | 292 | > |
427 | </i> | 293 | </i> |
428 | <i | 294 | <i |
429 | class="fa fa-chevron-up" | 295 | class="fa fa-chevron-up" |
430 | ng-show="show" | 296 | ng-show="show" |
431 | aria-hidden="true"> | 297 | aria-hidden="true"> |
432 | </i> | 298 | </i> |
433 | </button> | 299 | </button> |
434 | </td> | 300 | </td> |
435 | </tr> | 301 | </tr> |
436 | <!-- FOOTER --> | 302 | <!-- FOOTER --> |
437 | <tr class="d-flex"> | 303 | <tr class="d-flex"> |
438 | <td class="align-middle no-border-top" colspan="2"> | 304 | <td class="align-middle no-border-top" colspan="2"> |
439 | <strong>Cantidad Items:</strong> | 305 | <strong>Cantidad Items:</strong> |
440 | <a ng-bind="articulosTabla.length"></a> | 306 | <a ng-bind="remitosTabla.length"></a> |
441 | </td> | 307 | </td> |
442 | <td class="text-right ml-auto table-celda-total no-border-top"> | 308 | <td class="text-right ml-auto table-celda-total no-border-top"> |
443 | <h3>Total:</h3> | 309 | <h3>Total:</h3> |
444 | </td> | 310 | </td> |
445 | <td class="table-celda-total text-right no-border-top"> | 311 | <td class="table-celda-total text-right no-border-top"> |
446 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> | 312 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> |
447 | </td> | 313 | </td> |
448 | </tr> | 314 | </tr> |
449 | </tfoot> | 315 | </tfoot> |
450 | </table> | 316 | </table> |
451 | </div> | 317 | </div> |
452 | </div> | 318 | </div> |
453 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | 319 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> |
454 | <div class="row align-items-end"> | 320 | <div class="row align-items-end"> |
455 | <div class="col-12"> | 321 | <div class="col-12"> |
456 | <button | 322 | <button |
457 | ng-click="crearNotaPedido()" | 323 | ng-click="crearNotaPedido()" |
458 | type="submit" | 324 | type="submit" |
459 | title="Crear nota pedido" | 325 | title="Crear nota pedido" |
460 | class="btn btn-default btn-block mb-2"> | 326 | class="btn btn-default btn-block mb-2"> |
461 | Guardar | 327 | Guardar |
462 | </button> | 328 | </button> |
463 | <button | 329 | <button |
464 | ng-click="salir()" | 330 | ng-click="salir()" |
465 | type="button" | 331 | type="button" |
466 | title="Salir" | 332 | title="Salir" |
467 | class="btn btn-default btn-block"> | 333 | class="btn btn-default btn-block"> |
468 | Salir | 334 | Salir |
469 | </button> | 335 | </button> |
470 | </div> | 336 | </div> |
471 | </div> | 337 | </div> |
472 | </div> | 338 | </div> |
473 | </div> | 339 | </div> |
474 | <div class="row d-md-none fixed-bottom"> | 340 | <div class="row d-md-none fixed-bottom"> |
475 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 341 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
476 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 342 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
477 | <span class="mr-3 ml-auto" ng-click="crearNotaPedido()">Guardar</span> | 343 | <span class="mr-3 ml-auto" ng-click="crearNotaPedido()">Guardar</span> |
478 | </div> | 344 | </div> |
479 | </div> | 345 | </div> |