Commit 68a8009d6329e45e1bae95e3f8e0f274985da14a

Authored by Nicolás Guarnieri
Exists in master

Merge remote-tracking branch 'upstream/master'

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: 'focaCrearRemito', 26 module: 'focaCrearRemito',
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-remito.js'), 41 concat('foca-crear-remito.js'),
42 replace('src/views/', ''), 42 replace('src/views/', ''),
43 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
44 rename('foca-crear-remito.min.js'), 44 rename('foca-crear-remito.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], ['copy']); 89 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
90 }); 90 });
91 91
92 gulp.task('copy', ['uglify'], function(){ 92 gulp.task('copy', ['uglify'], function() {
93 return gulp.src('dist/*.js') 93 return gulp.src('dist/*.js')
94 .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist')); 94 .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/'));
95 });
96
97 gulp.task('watchAndCopy', function() {
98 return gulp.watch([paths.srcJS, paths.srcViews], ['copy']);
95 }); 99 });
96 100
src/js/controller.js
1 angular.module('focaCrearRemito') .controller('remitoController', 1 angular.module('focaCrearRemito') .controller('remitoController',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService',
4 'focaModalService', 'remitoBusinessService', 4 'focaModalService', 'remitoBusinessService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, 6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService,
7 remitoBusinessService 7 remitoBusinessService
8 ) { 8 ) {
9 $scope.botonera = [ 9 $scope.botonera = [
10 {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}},
10 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, 11 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
11 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, 12 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
12 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, 13 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}},
13 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, 14 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
14 { 15 {
15 texto: 'Precios y condiciones', 16 texto: 'Precios y condiciones',
16 accion: function() {$scope.abrirModalListaPrecio();}}, 17 accion: function() {$scope.abrirModalListaPrecio();}},
17 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, 18 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
18 {texto: '', accion: function() {}},
19 {texto: '', accion: function() {}} 19 {texto: '', accion: function() {}}
20 ]; 20 ];
21 $scope.datepickerAbierto = false; 21 $scope.datepickerAbierto = false;
22 22
23 $scope.show = false; 23 $scope.show = false;
24 $scope.cargando = true; 24 $scope.cargando = true;
25 $scope.dateOptions = { 25 $scope.dateOptions = {
26 maxDate: new Date(), 26 maxDate: new Date(),
27 minDate: new Date(2010, 0, 1) 27 minDate: new Date(2010, 0, 1)
28 }; 28 };
29 29
30 $scope.remito = { 30 $scope.remito = {
31 vendedor: {}, 31 vendedor: {},
32 cliente: {}, 32 cliente: {},
33 proveedor: {}, 33 proveedor: {},
34 domicilio: {dom: ''}, 34 domicilio: {dom: ''},
35 moneda: {}, 35 moneda: {},
36 cotizacion: {} 36 cotizacion: {}
37 }; 37 };
38 var monedaPorDefecto; 38 var monedaPorDefecto;
39 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 39 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
40 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { 40 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) {
41 monedaPorDefecto = { 41 monedaPorDefecto = {
42 id: res.data[0].ID, 42 id: res.data[0].ID,
43 detalle: res.data[0].DETALLE, 43 detalle: res.data[0].DETALLE,
44 simbolo: res.data[0].SIMBOLO, 44 simbolo: res.data[0].SIMBOLO,
45 cotizaciones: res.data[0].cotizaciones 45 cotizaciones: res.data[0].cotizaciones
46 }; 46 };
47 addCabecera('Moneda:', monedaPorDefecto.detalle); 47 addCabecera('Moneda:', monedaPorDefecto.detalle);
48 addCabecera('Fecha cotizacion:', 48 addCabecera('Fecha cotizacion:',
49 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); 49 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString());
50 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); 50 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION);
51 $scope.remito.moneda = monedaPorDefecto; 51 $scope.remito.moneda = monedaPorDefecto;
52 $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; 52 $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0];
53 }); 53 });
54 54
55 $scope.cabecera = []; 55 $scope.cabecera = [];
56 $scope.showCabecera = true; 56 $scope.showCabecera = true;
57 57
58 $scope.now = new Date(); 58 $scope.now = new Date();
59 $scope.puntoVenta = Math.round(Math.random() * 10000); 59 $scope.puntoVenta = Math.round(Math.random() * 10000);
60 $scope.comprobante = Math.round(Math.random() * 1000000); 60 $scope.comprobante = Math.round(Math.random() * 1000000);
61 61
62 $scope.articulosTabla = []; 62 $scope.articulosTabla = [];
63 $scope.idLista = undefined; 63 $scope.idLista = undefined;
64 //La pantalla solo se usa para cargar remitos 64 //La pantalla solo se usa para cargar remitos
65 //var remitoTemp = crearRemitoService.getRemito(); 65 //var remitoTemp = crearRemitoService.getRemito();
66 66
67 crearRemitoService.getPrecioCondicion().then( 67 crearRemitoService.getPrecioCondicion().then(
68 function(res) { 68 function(res) {
69 $scope.precioCondiciones = res.data; 69 $scope.precioCondiciones = res.data;
70 } 70 }
71 ); 71 );
72
73 crearRemitoService.getNumeroRemito().then(
74 function(res) {
75 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8);
77 },
78 function(err) {
79 focaModalService.alert('La terminal no esta configurada correctamente');
80 console.info(err);
81 }
82 );
83
84 $scope.seleccionarNotaPedido = function() {
85 var modalInstance = $uibModal.open(
86 {
87 ariaLabelledBy: 'Busqueda de Nota de Pedido',
88 templateUrl: 'foca-modal-nota-pedido.html',
89 controller: 'focaModalNotaPedidoController',
90 resolve: {
91 parametroNotaPedido: {
92 idLista: $scope.idLista,
93 cotizacion: $scope.remito.cotizacion.COTIZACION,
94 simbolo: $scope.remito.moneda.simbolo
95 }
96 },
97 size: 'lg'
98 }
99 );
100 modalInstance.result.then(
101 function(producto) {
102 var newArt =
103 {
104 id: 0,
105 codigo: producto.codigo,
106 sector: producto.sector,
107 sectorCodigo: producto.sector + '-' + producto.codigo,
108 descripcion: producto.descripcion,
109 item: $scope.articulosTabla.length + 1,
110 nombre: producto.descripcion,
111 precio: parseFloat(producto.precio.toFixed(4)),
112 costoUnitario: producto.costo,
113 editCantidad: false,
114 editPrecio: false
115 };
116 $scope.articuloACargar = newArt;
117 $scope.cargando = false;
118 }, function() {
119 // funcion ejecutada cuando se cancela el modal
120 }
121 );
122 }
123 $scope.seleccionarRemito = function() {
124 var modalInstance = $uibModal.open(
125 {
126 ariaLabelledBy: 'Busqueda de Remito',
127 templateUrl: 'foca-modal-remito.html',
128 controller: 'focaModalRemitoController',
129 resolve: {
130 parametroRemito: {
131 idLista: $scope.idLista,
132 cotizacion: $scope.remito.cotizacion.COTIZACION,
133 simbolo: $scope.remito.moneda.simbolo
134 }
135 },
136 size: 'lg'
137 }
138 );
139 modalInstance.result.then(
140 function(producto) {
141 var newArt =
142 {
143 id: 0,
144 codigo: producto.codigo,
145 sector: producto.sector,
146 sectorCodigo: producto.sector + '-' + producto.codigo,
147 descripcion: producto.descripcion,
148 item: $scope.articulosTabla.length + 1,
149 nombre: producto.descripcion,
72 150 precio: parseFloat(producto.precio.toFixed(4)),
73 crearRemitoService.getNumeroRemito().then( 151 costoUnitario: producto.costo,
74 function(res) { 152 editCantidad: false,
75 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 153 editPrecio: false
76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); 154 };
77 }, 155 $scope.articuloACargar = newArt;
78 function(err) { 156 $scope.cargando = false;
79 focaModalService.alert('La terminal no esta configurada correctamente'); 157 }, function() {
80 console.info(err); 158 // funcion ejecutada cuando se cancela el modal
81 } 159 }
82 ); 160 );
83 //La pantalla solo se usa para cargar remitos 161 }
84 // if (remitoTemp !== undefined) { 162
85 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); 163 //La pantalla solo se usa para cargar remitos
86 // $scope.remito = remitoTemp; 164 // if (remitoTemp !== undefined) {
87 // $scope.remito.flete = ($scope.remito.flete).toString(); 165 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga);
88 // $scope.remito.bomba = ($scope.remito.bomba).toString(); 166 // $scope.remito = remitoTemp;
89 // $scope.idLista = $scope.remito.precioCondicion; 167 // $scope.remito.flete = ($scope.remito.flete).toString();
90 // crearRemitoService 168 // $scope.remito.bomba = ($scope.remito.bomba).toString();
91 // .getArticulosByIdRemito($scope.remito.id).then( 169 // $scope.idLista = $scope.remito.precioCondicion;
92 // function(res) { 170 // crearRemitoService
93 // $scope.articulosTabla = res.data; 171 // .getArticulosByIdRemito($scope.remito.id).then(
94 // } 172 // function(res) {
95 // ); 173 // $scope.articulosTabla = res.data;
96 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO 174 // }
97 //(NO REQUERIDO EN ESTA VERSION) 175 // );
98 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( 176 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO
99 // function(res) { 177 //(NO REQUERIDO EN ESTA VERSION)
100 // $scope.remito.domicilio = res.data; 178 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then(
101 // } 179 // function(res) {
102 // ); 180 // $scope.remito.domicilio = res.data;
103 // } else { 181 // }
104 // $scope.remito.fechaCarga = new Date(); 182 // );
105 // $scope.remito.bomba = '0'; 183 // } else {
106 // $scope.remito.flete = '0'; 184 // $scope.remito.fechaCarga = new Date();
107 // $scope.idLista = undefined; 185 // $scope.remito.bomba = '0';
108 // } 186 // $scope.remito.flete = '0';
109 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 187 // $scope.idLista = undefined;
110 // $scope.addNewDom = function() { 188 // }
111 // $scope.remito.domicilio.push({ 'id': 0 }); 189 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
112 // }; 190 // $scope.addNewDom = function() {
113 // $scope.removeNewChoice = function(choice) { 191 // $scope.remito.domicilio.push({ 'id': 0 });
114 // if ($scope.remito.domicilio.length > 1) { 192 // };
115 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( 193 // $scope.removeNewChoice = function(choice) {
116 // function(c) { 194 // if ($scope.remito.domicilio.length > 1) {
117 // return c.$$hashKey === choice.$$hashKey; 195 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex(
118 // } 196 // function(c) {
119 // ), 1); 197 // return c.$$hashKey === choice.$$hashKey;
120 // } 198 // }
121 // }; 199 // ), 1);
122 200 // }
123 $scope.crearRemito = function() { 201 // };
124 if(!$scope.remito.vendedor.codigo) { 202
125 focaModalService.alert('Ingrese Vendedor'); 203 $scope.crearRemito = function() {
126 return; 204 if(!$scope.remito.vendedor.codigo) {
127 } else if(!$scope.remito.cliente.cod) { 205 focaModalService.alert('Ingrese Vendedor');
128 focaModalService.alert('Ingrese Cliente'); 206 return;
129 return; 207 } else if(!$scope.remito.cliente.cod) {
130 } else if(!$scope.remito.proveedor.codigo) { 208 focaModalService.alert('Ingrese Cliente');
131 focaModalService.alert('Ingrese Proveedor'); 209 return;
132 return; 210 } else if(!$scope.remito.proveedor.codigo) {
133 } else if(!$scope.remito.moneda.id) { 211 focaModalService.alert('Ingrese Proveedor');
134 focaModalService.alert('Ingrese Moneda'); 212 return;
135 return; 213 } else if(!$scope.remito.moneda.id) {
136 } else if(!$scope.remito.cotizacion.ID) { 214 focaModalService.alert('Ingrese Moneda');
137 focaModalService.alert('Ingrese Cotización'); 215 return;
138 return; 216 } else if(!$scope.remito.cotizacion.ID) {
139 } else if(!$scope.plazosPagos) { 217 focaModalService.alert('Ingrese Cotización');
140 focaModalService.alert('Ingrese Precios y Condiciones'); 218 return;
141 return; 219 } else if(!$scope.plazosPagos) {
142 } else if( 220 focaModalService.alert('Ingrese Precios y Condiciones');
143 $scope.remito.flete === undefined || $scope.remito.flete === null) 221 return;
144 { 222 } else if(
145 focaModalService.alert('Ingrese Flete'); 223 $scope.remito.flete === undefined || $scope.remito.flete === null)
146 return; 224 {
147 } else if(!$scope.remito.domicilio.id) { 225 focaModalService.alert('Ingrese Flete');
148 focaModalService.alert('Ingrese Domicilio'); 226 return;
149 return; 227 } else if(!$scope.remito.domicilio.id) {
150 } else if($scope.articulosTabla.length === 0) { 228 focaModalService.alert('Ingrese Domicilio');
151 focaModalService.alert('Debe cargar al menos un articulo'); 229 return;
152 return; 230 } else if($scope.articulosTabla.length === 0) {
153 } 231 focaModalService.alert('Debe cargar al menos un articulo');
154 var date = new Date(); 232 return;
155 var remito = { 233 }
156 id: 0, 234 var date = new Date();
157 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 235 var remito = {
158 .toISOString().slice(0, 19).replace('T', ' '), 236 id: 0,
159 idVendedor: $scope.remito.vendedor.codigo, 237 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
160 idCliente: $scope.remito.cliente.cod, 238 .toISOString().slice(0, 19).replace('T', ' '),
161 nombreCliente: $scope.remito.cliente.nom, 239 idVendedor: $scope.remito.vendedor.codigo,
162 cuitCliente: $scope.remito.cliente.cuit, 240 idCliente: $scope.remito.cliente.cod,
163 idProveedor: $scope.remito.proveedor.codigo, 241 nombreCliente: $scope.remito.cliente.nom,
164 idDomicilio: $scope.remito.domicilio.id, 242 cuitCliente: $scope.remito.cliente.cuit,
165 idCotizacion: $scope.remito.cotizacion.ID, 243 idProveedor: $scope.remito.proveedor.codigo,
166 cotizacion: $scope.remito.cotizacion.COTIZACION, 244 idDomicilio: $scope.remito.domicilio.id,
167 flete: $scope.remito.flete, 245 idCotizacion: $scope.remito.cotizacion.ID,
168 fob: $scope.remito.fob, 246 cotizacion: $scope.remito.cotizacion.COTIZACION,
169 bomba: $scope.remito.bomba, 247 flete: $scope.remito.flete,
170 kilometros: $scope.remito.kilometros, 248 fob: $scope.remito.fob,
171 estado: 0, 249 bomba: $scope.remito.bomba,
172 total: $scope.getTotal() 250 kilometros: $scope.remito.kilometros,
173 }; 251 estado: 0,
174 crearRemitoService.crearRemito(remito).then( 252 total: $scope.getTotal()
175 function(data) { 253 };
176 remitoBusinessService.addArticulos($scope.articulosTabla, 254 crearRemitoService.crearRemito(remito).then(
177 data.data.id, $scope.remito.cotizacion.COTIZACION); 255 function(data) {
178 var plazos = $scope.plazosPagos; 256 remitoBusinessService.addArticulos($scope.articulosTabla,
179 for(var j = 0; j < plazos.length; j++) { 257 data.data.id, $scope.remito.cotizacion.COTIZACION);
180 var json = { 258 var plazos = $scope.plazosPagos;
181 idRemito: data.data.id, 259 for(var j = 0; j < plazos.length; j++) {
182 dias: plazos[j].dias 260 var json = {
183 }; 261 idRemito: data.data.id,
184 crearRemitoService.crearPlazosParaRemito(json); 262 dias: plazos[j].dias
185 } 263 };
186 remitoBusinessService.addEstado(data.data.id, 264 crearRemitoService.crearPlazosParaRemito(json);
187 $scope.remito.vendedor.codigo); 265 }
188 266 remitoBusinessService.addEstado(data.data.id,
189 focaModalService.alert('Nota remito creada'); 267 $scope.remito.vendedor.codigo);
190 $scope.cabecera = []; 268
191 addCabecera('Moneda:', $scope.remito.moneda.detalle); 269 focaModalService.alert('Nota remito creada');
192 addCabecera( 270 $scope.cabecera = [];
193 'Fecha cotizacion:', 271 addCabecera('Moneda:', $scope.remito.moneda.detalle);
194 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') 272 addCabecera(
195 ); 273 'Fecha cotizacion:',
196 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); 274 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
197 $scope.remito.vendedor = {}; 275 );
198 $scope.remito.cliente = {}; 276 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION);
199 $scope.remito.proveedor = {}; 277 $scope.remito.vendedor = {};
200 $scope.remito.domicilio = {}; 278 $scope.remito.cliente = {};
201 $scope.remito.flete = null; 279 $scope.remito.proveedor = {};
202 $scope.remito.fob = null; 280 $scope.remito.domicilio = {};
203 $scope.remito.bomba = null; 281 $scope.remito.flete = null;
204 $scope.remito.kilometros = null; 282 $scope.remito.fob = null;
205 $scope.articulosTabla = []; 283 $scope.remito.bomba = null;
206 } 284 $scope.remito.kilometros = null;
207 ); 285 $scope.articulosTabla = [];
208 }; 286 }
209 287 );
210 $scope.seleccionarArticulo = function() { 288 };
211 if ($scope.idLista === undefined) { 289
212 focaModalService.alert( 290 $scope.seleccionarArticulo = function() {
213 'Primero seleccione una lista de precio y condicion'); 291 if ($scope.idLista === undefined) {
214 return; 292 focaModalService.alert(
215 } 293 'Primero seleccione una lista de precio y condicion');
216 var modalInstance = $uibModal.open( 294 return;
217 { 295 }
218 ariaLabelledBy: 'Busqueda de Productos', 296 var modalInstance = $uibModal.open(
219 templateUrl: 'modal-busqueda-productos.html', 297 {
220 controller: 'modalBusquedaProductosCtrl', 298 ariaLabelledBy: 'Busqueda de Productos',
221 resolve: { 299 templateUrl: 'modal-busqueda-productos.html',
222 parametroProducto: { 300 controller: 'modalBusquedaProductosCtrl',
223 idLista: $scope.idLista, 301 resolve: {
224 cotizacion: $scope.remito.cotizacion.COTIZACION, 302 parametroProducto: {
225 simbolo: $scope.remito.moneda.simbolo 303 idLista: $scope.idLista,
226 } 304 cotizacion: $scope.remito.cotizacion.COTIZACION,
227 }, 305 simbolo: $scope.remito.moneda.simbolo
228 size: 'lg' 306 }
229 } 307 },
230 ); 308 size: 'lg'
231 modalInstance.result.then( 309 }
232 function(producto) { 310 );
233 var newArt = 311 modalInstance.result.then(
234 { 312 function(producto) {
235 id: 0, 313 var newArt =
236 codigo: producto.codigo, 314 {
237 sector: producto.sector, 315 id: 0,
238 sectorCodigo: producto.sector + '-' + producto.codigo, 316 codigo: producto.codigo,
239 descripcion: producto.descripcion, 317 sector: producto.sector,
240 item: $scope.articulosTabla.length + 1, 318 sectorCodigo: producto.sector + '-' + producto.codigo,
241 nombre: producto.descripcion, 319 descripcion: producto.descripcion,
242 precio: parseFloat(producto.precio.toFixed(4)), 320 item: $scope.articulosTabla.length + 1,
243 costoUnitario: producto.costo, 321 nombre: producto.descripcion,
244 editCantidad: false, 322 precio: parseFloat(producto.precio.toFixed(4)),
245 editPrecio: false 323 costoUnitario: producto.costo,
246 }; 324 editCantidad: false,
247 $scope.articuloACargar = newArt; 325 editPrecio: false
248 $scope.cargando = false; 326 };
249 }, function() { 327 $scope.articuloACargar = newArt;
250 // funcion ejecutada cuando se cancela el modal 328 $scope.cargando = false;
251 } 329 }, function() {
252 ); 330 // funcion ejecutada cuando se cancela el modal
253 }; 331 }
254 332 );
255 $scope.seleccionarVendedor = function() { 333 };
256 var modalInstance = $uibModal.open( 334
257 { 335 $scope.seleccionarVendedor = function() {
258 ariaLabelledBy: 'Busqueda de Vendedores', 336 var modalInstance = $uibModal.open(
259 templateUrl: 'modal-vendedores.html', 337 {
260 controller: 'modalVendedoresCtrl', 338 ariaLabelledBy: 'Busqueda de Vendedores',
261 size: 'lg' 339 templateUrl: 'modal-vendedores.html',
262 } 340 controller: 'modalVendedoresCtrl',
263 ); 341 size: 'lg'
264 modalInstance.result.then( 342 }
265 function(vendedor) { 343 );
266 addCabecera('Vendedor:', vendedor.NomVen); 344 modalInstance.result.then(
267 $scope.remito.vendedor.codigo = vendedor.CodVen; 345 function(vendedor) {
268 }, function() { 346 addCabecera('Vendedor:', vendedor.NomVen);
269 347 $scope.remito.vendedor.codigo = vendedor.CodVen;
270 } 348 }, function() {
271 ); 349
272 }; 350 }
273 351 );
274 $scope.seleccionarProveedor = function() { 352 };
275 var modalInstance = $uibModal.open( 353
276 { 354 $scope.seleccionarProveedor = function() {
277 ariaLabelledBy: 'Busqueda de Proveedor', 355 var modalInstance = $uibModal.open(
278 templateUrl: 'modal-proveedor.html', 356 {
279 controller: 'focaModalProveedorCtrl', 357 ariaLabelledBy: 'Busqueda de Proveedor',
280 size: 'lg' 358 templateUrl: 'modal-proveedor.html',
281 } 359 controller: 'focaModalProveedorCtrl',
282 ); 360 size: 'lg'
283 modalInstance.result.then( 361 }
284 function(proveedor) { 362 );
285 $scope.remito.proveedor.codigo = proveedor.COD; 363 modalInstance.result.then(
286 addCabecera('Proveedor:', proveedor.NOM); 364 function(proveedor) {
287 }, function() { 365 $scope.remito.proveedor.codigo = proveedor.COD;
288 366 addCabecera('Proveedor:', proveedor.NOM);
289 } 367 }, function() {
290 ); 368
291 }; 369 }
292 370 );
293 $scope.seleccionarCliente = function() { 371 };
294 372
295 var modalInstance = $uibModal.open( 373 $scope.seleccionarCliente = function() {
296 { 374
297 ariaLabelledBy: 'Busqueda de Cliente', 375 var modalInstance = $uibModal.open(
298 templateUrl: 'foca-busqueda-cliente-modal.html', 376 {
299 controller: 'focaBusquedaClienteModalController', 377 ariaLabelledBy: 'Busqueda de Cliente',
300 size: 'lg' 378 templateUrl: 'foca-busqueda-cliente-modal.html',
301 } 379 controller: 'focaBusquedaClienteModalController',
302 ); 380 size: 'lg'
303 modalInstance.result.then( 381 }
304 function(cliente) { 382 );
305 $scope.abrirModalDomicilios(cliente); 383 modalInstance.result.then(
306 }, function() { 384 function(cliente) {
307 385 $scope.abrirModalDomicilios(cliente);
308 } 386 }, function() {
309 ); 387
310 }; 388 }
311 389 );
312 $scope.abrirModalDomicilios = function(cliente) { 390 };
313 var modalInstanceDomicilio = $uibModal.open( 391
314 { 392 $scope.abrirModalDomicilios = function(cliente) {
315 ariaLabelledBy: 'Busqueda de Domicilios', 393 var modalInstanceDomicilio = $uibModal.open(
316 templateUrl: 'modal-domicilio.html', 394 {
317 controller: 'focaModalDomicilioController', 395 ariaLabelledBy: 'Busqueda de Domicilios',
318 resolve: { idCliente: function() { return cliente.cod; }}, 396 templateUrl: 'modal-domicilio.html',
319 size: 'lg', 397 controller: 'focaModalDomicilioController',
320 } 398 resolve: { idCliente: function() { return cliente.cod; }},
321 ); 399 size: 'lg',
322 modalInstanceDomicilio.result.then( 400 }
323 function(domicilio) { 401 );
324 $scope.remito.domicilio.id = domicilio.nivel2; 402 modalInstanceDomicilio.result.then(
325 $scope.remito.cliente = cliente; 403 function(domicilio) {
326 404 $scope.remito.domicilio.id = domicilio.nivel2;
327 addCabecera('Cliente:', cliente.nom); 405 $scope.remito.cliente = cliente;
328 addCabecera('Domicilio:', domicilio.dom); 406
329 }, function() { 407 addCabecera('Cliente:', cliente.nom);
330 $scope.seleccionarCliente(); 408 addCabecera('Domicilio:', domicilio.dom);
331 return; 409 }, function() {
332 } 410 $scope.seleccionarCliente();
333 ); 411 return;
334 }; 412 }
335 413 );
336 $scope.mostrarFichaCliente = function() { 414 };
337 $uibModal.open( 415
338 { 416 $scope.mostrarFichaCliente = function() {
339 ariaLabelledBy: 'Datos del Cliente', 417 $uibModal.open(
340 templateUrl: 'foca-crear-remito-ficha-cliente.html', 418 {
341 controller: 'focaCrearRemitoFichaClienteController', 419 ariaLabelledBy: 'Datos del Cliente',
342 size: 'lg' 420 templateUrl: 'foca-crear-remito-ficha-cliente.html',
343 } 421 controller: 'focaCrearRemitoFichaClienteController',
344 ); 422 size: 'lg'
345 }; 423 }
346 424 );
347 $scope.getTotal = function() { 425 };
348 var total = 0; 426
349 var arrayTempArticulos = $scope.articulosTabla; 427 $scope.getTotal = function() {
350 for (var i = 0; i < arrayTempArticulos.length; i++) { 428 var total = 0;
351 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 429 var arrayTempArticulos = $scope.articulosTabla;
352 } 430 for (var i = 0; i < arrayTempArticulos.length; i++) {
353 return parseFloat(total.toFixed(2)); 431 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
354 }; 432 }
355 433 return parseFloat(total.toFixed(2));
356 $scope.getSubTotal = function() { 434 };
357 if($scope.articuloACargar) { 435
358 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 436 $scope.getSubTotal = function() {
359 } 437 if($scope.articuloACargar) {
360 }; 438 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
361 439 }
362 $scope.abrirModalListaPrecio = function() { 440 };
363 var modalInstance = $uibModal.open( 441
364 { 442 $scope.abrirModalListaPrecio = function() {
365 ariaLabelledBy: 'Busqueda de Precio Condición', 443 var modalInstance = $uibModal.open(
366 templateUrl: 'modal-precio-condicion.html', 444 {
367 controller: 'focaModalPrecioCondicionController', 445 ariaLabelledBy: 'Busqueda de Precio Condición',
368 size: 'lg' 446 templateUrl: 'modal-precio-condicion.html',
369 } 447 controller: 'focaModalPrecioCondicionController',
370 ); 448 size: 'lg'
371 modalInstance.result.then( 449 }
372 function(precioCondicion) { 450 );
373 var cabecera = ''; 451 modalInstance.result.then(
374 var plazosConcat = ''; 452 function(precioCondicion) {
375 if(!Array.isArray(precioCondicion)) { 453 var cabecera = '';
376 $scope.plazosPagos = precioCondicion.plazoPago; 454 var plazosConcat = '';
377 $scope.idLista = precioCondicion.idListaPrecio; 455 if(!Array.isArray(precioCondicion)) {
378 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 456 $scope.plazosPagos = precioCondicion.plazoPago;
379 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 457 $scope.idLista = precioCondicion.idListaPrecio;
380 } 458 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
381 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 459 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
382 } else { //Cuando se ingresan los plazos manualmente 460 }
383 $scope.idLista = -1; //-1, el modal productos busca todos los productos 461 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
384 $scope.plazosPagos = precioCondicion; 462 } else { //Cuando se ingresan los plazos manualmente
385 for(var j = 0; j < precioCondicion.length; j++) { 463 $scope.idLista = -1; //-1, el modal productos busca todos los productos
386 plazosConcat += precioCondicion[j].dias + ' '; 464 $scope.plazosPagos = precioCondicion;
387 } 465 for(var j = 0; j < precioCondicion.length; j++) {
388 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 466 plazosConcat += precioCondicion[j].dias + ' ';
389 } 467 }
390 $scope.articulosTabla = []; 468 cabecera = 'Ingreso manual ' + plazosConcat.trim();
391 addCabecera('Precios y condiciones:', cabecera); 469 }
392 }, function() { 470 $scope.articulosTabla = [];
393 471 addCabecera('Precios y condiciones:', cabecera);
394 } 472 }, function() {
395 ); 473
396 }; 474 }
397 475 );
398 $scope.abrirModalFlete = function() { 476 };
399 var modalInstance = $uibModal.open( 477
400 { 478 $scope.abrirModalFlete = function() {
401 ariaLabelledBy: 'Busqueda de Flete', 479 var modalInstance = $uibModal.open(
402 templateUrl: 'modal-flete.html', 480 {
403 controller: 'focaModalFleteController', 481 ariaLabelledBy: 'Busqueda de Flete',
404 size: 'lg', 482 templateUrl: 'modal-flete.html',
405 resolve: { 483 controller: 'focaModalFleteController',
406 parametrosFlete: 484 size: 'lg',
407 function() { 485 resolve: {
408 return { 486 parametrosFlete:
409 flete: $scope.remito.flete ? '1' : 487 function() {
410 ($scope.remito.fob ? 'FOB' : 488 return {
411 ($scope.remito.flete === undefined ? null : '0')), 489 flete: $scope.remito.flete ? '1' :
412 bomba: $scope.remito.bomba ? '1' : 490 ($scope.remito.fob ? 'FOB' :
413 ($scope.remito.bomba === undefined ? null : '0'), 491 ($scope.remito.flete === undefined ? null : '0')),
414 kilometros: $scope.remito.kilometros 492 bomba: $scope.remito.bomba ? '1' :
415 }; 493 ($scope.remito.bomba === undefined ? null : '0'),
416 } 494 kilometros: $scope.remito.kilometros
417 } 495 };
418 } 496 }
419 ); 497 }
420 modalInstance.result.then( 498 }
421 function(datos) { 499 );
422 $scope.remito.flete = datos.flete; 500 modalInstance.result.then(
423 $scope.remito.fob = datos.FOB; 501 function(datos) {
424 $scope.remito.bomba = datos.bomba; 502 $scope.remito.flete = datos.flete;
425 $scope.remito.kilometros = datos.kilometros; 503 $scope.remito.fob = datos.FOB;
426 504 $scope.remito.bomba = datos.bomba;
427 addCabecera('Flete:', datos.flete ? 'Si' : 505 $scope.remito.kilometros = datos.kilometros;
428 ($scope.remito.fob ? 'FOB' : 'No')); 506
429 if(datos.flete) { 507 addCabecera('Flete:', datos.flete ? 'Si' :
430 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 508 ($scope.remito.fob ? 'FOB' : 'No'));
431 addCabecera('Kilometros:', datos.kilometros); 509 if(datos.flete) {
432 } else { 510 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
433 removeCabecera('Bomba:'); 511 addCabecera('Kilometros:', datos.kilometros);
434 removeCabecera('Kilometros:'); 512 } else {
435 $scope.remito.fob = false; 513 removeCabecera('Bomba:');
436 $scope.remito.bomba = false; 514 removeCabecera('Kilometros:');
437 $scope.remito.kilometros = null; 515 $scope.remito.fob = false;
438 } 516 $scope.remito.bomba = false;
439 }, function() { 517 $scope.remito.kilometros = null;
440 518 }
441 } 519 }, function() {
442 ); 520
443 }; 521 }
444 522 );
445 $scope.abrirModalMoneda = function() { 523 };
446 var modalInstance = $uibModal.open( 524
447 { 525 $scope.abrirModalMoneda = function() {
448 ariaLabelledBy: 'Busqueda de Moneda', 526 var modalInstance = $uibModal.open(
449 templateUrl: 'modal-moneda.html', 527 {
450 controller: 'focaModalMonedaController', 528 ariaLabelledBy: 'Busqueda de Moneda',
451 size: 'lg' 529 templateUrl: 'modal-moneda.html',
452 } 530 controller: 'focaModalMonedaController',
453 ); 531 size: 'lg'
454 modalInstance.result.then( 532 }
455 function(moneda) { 533 );
456 $scope.abrirModalCotizacion(moneda); 534 modalInstance.result.then(
457 }, function() { 535 function(moneda) {
458 536 $scope.abrirModalCotizacion(moneda);
459 } 537 }, function() {
460 ); 538
461 }; 539 }
462 540 );
463 $scope.abrirModalCotizacion = function(moneda) { 541 };
464 var modalInstance = $uibModal.open( 542
465 { 543 $scope.abrirModalCotizacion = function(moneda) {
466 ariaLabelledBy: 'Busqueda de Cotización', 544 var modalInstance = $uibModal.open(
467 templateUrl: 'modal-cotizacion.html', 545 {
468 controller: 'focaModalCotizacionController', 546 ariaLabelledBy: 'Busqueda de Cotización',
469 size: 'lg', 547 templateUrl: 'modal-cotizacion.html',
470 resolve: {idMoneda: function() {return moneda.ID;}} 548 controller: 'focaModalCotizacionController',
471 } 549 size: 'lg',
472 ); 550 resolve: {idMoneda: function() {return moneda.ID;}}
473 modalInstance.result.then( 551 }
474 function(cotizacion) { 552 );
475 var articulosTablaTemp = $scope.articulosTabla; 553 modalInstance.result.then(
476 for(var i = 0; i < articulosTablaTemp.length; i++) { 554 function(cotizacion) {
477 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 555 var articulosTablaTemp = $scope.articulosTabla;
478 $scope.remito.cotizacion.COTIZACION; 556 for(var i = 0; i < articulosTablaTemp.length; i++) {
479 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 557 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
480 cotizacion.COTIZACION; 558 $scope.remito.cotizacion.COTIZACION;
481 } 559 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
482 $scope.articulosTabla = articulosTablaTemp; 560 cotizacion.COTIZACION;
483 $scope.remito.moneda = { 561 }
484 id: moneda.ID, 562 $scope.articulosTabla = articulosTablaTemp;
485 detalle: moneda.DETALLE, 563 $scope.remito.moneda = {
486 simbolo: moneda.SIMBOLO 564 id: moneda.ID,
487 }; 565 detalle: moneda.DETALLE,
488 $scope.remito.cotizacion = { 566 simbolo: moneda.SIMBOLO
489 ID: cotizacion.ID, 567 };
490 COTIZACION: cotizacion.COTIZACION, 568 $scope.remito.cotizacion = {
491 FECHA: cotizacion.FECHA 569 ID: cotizacion.ID,
492 }; 570 COTIZACION: cotizacion.COTIZACION,
493 addCabecera('Moneda:', moneda.DETALLE); 571 FECHA: cotizacion.FECHA
494 addCabecera( 572 };
495 'Fecha cotizacion:', 573 addCabecera('Moneda:', moneda.DETALLE);
496 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 574 addCabecera(
497 ); 575 'Fecha cotizacion:',
498 addCabecera('Cotizacion:', cotizacion.COTIZACION); 576 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
499 }, function() { 577 );
500 578 addCabecera('Cotizacion:', cotizacion.COTIZACION);
501 } 579 }, function() {
502 ); 580
503 }; 581 }
504 582 );
505 $scope.agregarATabla = function(key) { 583 };
506 if(key === 13) { 584
507 if($scope.articuloACargar.cantidad === undefined || 585 $scope.agregarATabla = function(key) {
508 $scope.articuloACargar.cantidad === 0 || 586 if(key === 13) {
509 $scope.articuloACargar.cantidad === null ){ 587 if($scope.articuloACargar.cantidad === undefined ||
510 focaModalService.alert('El valor debe ser al menos 1'); 588 $scope.articuloACargar.cantidad === 0 ||
511 return; 589 $scope.articuloACargar.cantidad === null ){
512 } 590 focaModalService.alert('El valor debe ser al menos 1');
513 delete $scope.articuloACargar.sectorCodigo; 591 return;
514 $scope.articulosTabla.push($scope.articuloACargar); 592 }
515 $scope.cargando = true; 593 delete $scope.articuloACargar.sectorCodigo;
516 } 594 $scope.articulosTabla.push($scope.articuloACargar);
517 }; 595 $scope.cargando = true;
518 596 }
519 $scope.quitarArticulo = function(key) { 597 };
520 $scope.articulosTabla.splice(key, 1); 598
521 }; 599 $scope.quitarArticulo = function(key) {
522 600 $scope.articulosTabla.splice(key, 1);
523 $scope.editarArticulo = function(key, articulo) { 601 };
524 if(key === 13) { 602
525 if(articulo.cantidad === null || articulo.cantidad === 0 || 603 $scope.editarArticulo = function(key, articulo) {
526 articulo.cantidad === undefined){ 604 if(key === 13) {
527 focaModalService.alert('El valor debe ser al menos 1'); 605 if(articulo.cantidad === null || articulo.cantidad === 0 ||
528 return; 606 articulo.cantidad === undefined){
529 } 607 focaModalService.alert('El valor debe ser al menos 1');
530 articulo.editCantidad = false; 608 return;
531 articulo.editPrecio = false; 609 }
532 } 610 articulo.editCantidad = false;
533 }; 611 articulo.editPrecio = false;
534 612 }
535 $scope.cambioEdit = function(articulo, propiedad) { 613 };
536 if(propiedad === 'cantidad') { 614
537 articulo.editCantidad = true; 615 $scope.cambioEdit = function(articulo, propiedad) {
538 } else if(propiedad === 'precio') { 616 if(propiedad === 'cantidad') {
539 articulo.editPrecio = true; 617 articulo.editCantidad = true;
540 } 618 } else if(propiedad === 'precio') {
541 }; 619 articulo.editPrecio = true;
542 620 }
543 $scope.limpiarFlete = function() { 621 };
544 $scope.remito.fleteNombre = ''; 622
545 $scope.remito.chofer = ''; 623 $scope.limpiarFlete = function() {
546 $scope.remito.vehiculo = ''; 624 $scope.remito.fleteNombre = '';
547 $scope.remito.kilometros = ''; 625 $scope.remito.chofer = '';
548 $scope.remito.costoUnitarioKmFlete = ''; 626 $scope.remito.vehiculo = '';
549 $scope.choferes = ''; 627 $scope.remito.kilometros = '';
550 $scope.vehiculos = ''; 628 $scope.remito.costoUnitarioKmFlete = '';
551 }; 629 $scope.choferes = '';
552 630 $scope.vehiculos = '';
553 $scope.limpiarPantalla = function() { 631 };
554 $scope.limpiarFlete(); 632
555 $scope.remito.flete = '0'; 633 $scope.limpiarPantalla = function() {
556 $scope.remito.bomba = '0'; 634 $scope.limpiarFlete();
557 $scope.remito.precioCondicion = ''; 635 $scope.remito.flete = '0';
558 $scope.articulosTabla = []; 636 $scope.remito.bomba = '0';
559 $scope.remito.vendedor.nombre = ''; 637 $scope.remito.precioCondicion = '';
560 $scope.remito.cliente = {nombre: ''}; 638 $scope.articulosTabla = [];
561 $scope.remito.domicilio = {dom: ''}; 639 $scope.remito.vendedor.nombre = '';
562 $scope.domiciliosCliente = []; 640 $scope.remito.cliente = {nombre: ''};
563 }; 641 $scope.remito.domicilio = {dom: ''};
564 642 $scope.domiciliosCliente = [];
565 $scope.resetFilter = function() { 643 };
566 $scope.articuloACargar = {}; 644
567 $scope.cargando = true; 645 $scope.resetFilter = function() {
568 }; 646 $scope.articuloACargar = {};
569 647 $scope.cargando = true;
570 $scope.selectFocus = function($event) { 648 };
571 $event.target.select(); 649
572 }; 650 $scope.selectFocus = function($event) {
573 651 $event.target.select();
574 $scope.salir = function() { 652 };
575 $location.path('/'); 653
576 }; 654 $scope.salir = function() {
577 655 $location.path('/');
578 function addCabecera(label, valor) { 656 };
579 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 657
580 if(propiedad.length === 1) { 658 function addCabecera(label, valor) {
581 propiedad[0].valor = valor; 659 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
582 } else { 660 if(propiedad.length === 1) {
583 $scope.cabecera.push({label: label, valor: valor}); 661 propiedad[0].valor = valor;
584 } 662 } else {
585 } 663 $scope.cabecera.push({label: label, valor: valor});
586 664 }
587 function removeCabecera(label) { 665 }
588 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 666
589 if(propiedad.length === 1){ 667 function removeCabecera(label) {
590 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 668 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
591 } 669 if(propiedad.length === 1){
592 } 670 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
593 671 }
594 function rellenar(relleno, longitud) { 672 }
595 relleno = '' + relleno; 673
596 while (relleno.length < longitud) { 674 function rellenar(relleno, longitud) {
597 relleno = '0' + relleno; 675 relleno = '' + relleno;
598 } 676 while (relleno.length < longitud) {
599 677 relleno = '0' + relleno;
600 return relleno; 678 }
601 } 679
602 } 680 return relleno;
603 ] 681 }
604 ) 682 }
605 .controller('remitoListaCtrl', [ 683 ]
606 '$scope', 684 )
607 'crearRemitoService', 685 .controller('remitoListaCtrl', [
608 '$location', 686 '$scope',
609 function($scope, crearRemitoService, $location) { 687 'crearRemitoService',
610 crearRemitoService.obtenerRemito().then(function(datos) { 688 '$location',
611 $scope.remitos = datos.data; 689 function($scope, crearRemitoService, $location) {
612 }); 690 crearRemitoService.obtenerRemito().then(function(datos) {
613 $scope.editar = function(remito) { 691 $scope.remitos = datos.data;
614 crearRemitoService.setRemito(remito); 692 });
615 $location.path('/venta-nota-remito/abm/'); 693 $scope.editar = function(remito) {
616 }; 694 crearRemitoService.setRemito(remito);
617 $scope.crearRemito = function() { 695 $location.path('/venta-nota-remito/abm/');
618 crearRemitoService.clearRemito(); 696 };
619 $location.path('/venta-nota-remito/abm/'); 697 $scope.crearRemito = function() {
620 }; 698 crearRemitoService.clearRemito();
621 } 699 $location.path('/venta-nota-remito/abm/');
622 ]) 700 };
623 .controller('focaCrearRemitoFichaClienteController', [ 701 }
624 '$scope', 702 ])
625 'crearRemitoService', 703 .controller('focaCrearRemitoFichaClienteController', [
626 '$location', 704 '$scope',
627 function($scope, crearRemitoService, $location) { 705 'crearRemitoService',
628 crearRemitoService.obtenerRemito().then(function(datos) { 706 '$location',
629 $scope.remitos = datos.data; 707 function($scope, crearRemitoService, $location) {
630 }); 708 crearRemitoService.obtenerRemito().then(function(datos) {
631 $scope.editar = function(remito) { 709 $scope.remitos = datos.data;
632 crearRemitoService.setRemito(remito); 710 });
633 $location.path('/venta-nota-remito/abm/'); 711 $scope.editar = function(remito) {
634 }; 712 crearRemitoService.setRemito(remito);
635 $scope.crearRemito = function() { 713 $location.path('/venta-nota-remito/abm/');
636 crearRemitoService.clearRemito(); 714 };
637 $location.path('/venta-nota-remito/abm/'); 715 $scope.crearRemito = function() {
638 }; 716 crearRemitoService.clearRemito();
639 } 717 $location.path('/venta-nota-remito/abm/');
640 ]); 718 };
641 719 }
720 ]);
src/views/remito.html
1 <div class="crear-nota-remito"> 1 <div class="crear-nota-remito">
2 <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0"> 2 <form name="formCrearNota" ng-submit="crearRemito()" 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-remito"> 8 <div class="col-12 col-sm-4 nota-remito">
9 <h5>REMITO</h5> 9 <h5>REMITO</h5>
10 </div> 10 </div>
11 <div class="col-5 col-sm-4 numero-remito" 11 <div class="col-5 col-sm-4 numero-remito"
12 > 12 >
13 Nº {{puntoVenta}}-{{comprobante}} 13 Nº {{puntoVenta}}-{{comprobante}}
14 <button 14 <button
15 class="btn btn-xs" 15 class="btn btn-xs"
16 type="button" 16 type="button"
17 ng-click="buscarNotaPedido()" 17 ng-click="seleccionarRemito()"
18 > 18 >
19 <i class="fa fa-search"></i> 19 <i class="fa fa-search"></i>
20 </button> 20 </button>
21 </div> 21 </div>
22 <div class="col-7 col-sm-4 text-right"> 22 <div class="col-7 col-sm-4 text-right">
23 Fecha: 23 Fecha:
24 <span 24 <span
25 ng-show="!datepickerAbierto" 25 ng-show="!datepickerAbierto"
26 ng-bind="now | date:'dd/MM/yyyy HH:mm'" 26 ng-bind="now | date:'dd/MM/yyyy HH:mm'"
27 ng-click="datepickerAbierto = true" 27 ng-click="datepickerAbierto = true"
28 > 28 >
29 </span> 29 </span>
30 <input 30 <input
31 ng-show="datepickerAbierto" 31 ng-show="datepickerAbierto"
32 type="date" 32 type="date"
33 ng-model="now" 33 ng-model="now"
34 ng-change="datepickerAbierto = false" 34 ng-change="datepickerAbierto = false"
35 ng-blur="datepickerAbierto = false" 35 ng-blur="datepickerAbierto = false"
36 class="form-control form-control-sm col-8 float-right" 36 class="form-control form-control-sm col-8 float-right"
37 foca-focus="datepickerAbierto" 37 foca-focus="datepickerAbierto"
38 hasta-hoy 38 hasta-hoy
39 /> 39 />
40 </div> 40 </div>
41 </div> 41 </div>
42 <div class="row"> 42 <div class="row">
43 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 43 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
44 <span class="label" ng-bind="cab.label"></span> 44 <span class="label" ng-bind="cab.label"></span>
45 <span class="valor" ng-bind="cab.valor"></span> 45 <span class="valor" ng-bind="cab.valor"></span>
46 </div> 46 </div>
47 <a 47 <a
48 class="btn col-12 btn-secondary d-sm-none" 48 class="btn col-12 btn-secondary d-sm-none"
49 ng-show="cabecera.length > 0" 49 ng-show="cabecera.length > 0"
50 ng-click="showCabecera = !showCabecera" 50 ng-click="showCabecera = !showCabecera"
51 > 51 >
52 <i 52 <i
53 class="fa fa-chevron-down" 53 class="fa fa-chevron-down"
54 ng-hide="showCabecera" 54 ng-hide="showCabecera"
55 aria-hidden="true" 55 aria-hidden="true"
56 > 56 >
57 </i> 57 </i>
58 <i 58 <i
59 class="fa fa-chevron-up" 59 class="fa fa-chevron-up"
60 ng-show="showCabecera" 60 ng-show="showCabecera"
61 aria-hidden="true"> 61 aria-hidden="true">
62 </i> 62 </i>
63 </a> 63 </a>
64 </div> 64 </div>
65 </div> 65 </div>
66 </div> 66 </div>
67 <div class="row p-1 botonera-secundaria"> 67 <div class="row p-1 botonera-secundaria">
68 <div class="col-12"> 68 <div class="col-12">
69 <div class="row"> 69 <div class="row">
70 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 70 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
71 <button 71 <button
72 type="button" 72 type="button"
73 class="btn btn-default btn-block btn-xs text-left py-2" 73 class="btn btn-default btn-block btn-xs text-left py-2"
74 ng-click="boton.accion()" 74 ng-click="boton.accion()"
75 ng-class="{'d-none d-sm-block': boton.texto == ''}" 75 ng-class="{'d-none d-sm-block': boton.texto == ''}"
76 > 76 >
77 <i 77 <i
78 class="fa fa-arrow-circle-right" 78 class="fa fa-arrow-circle-right"
79 ng-show="boton.texto != ''" 79 ng-show="boton.texto != ''"
80 ></i> 80 ></i>
81 &nbsp; 81 &nbsp;
82 {{boton.texto}} 82 {{boton.texto}}
83 </button> 83 </button>
84 </div> 84 </div>
85 </div> 85 </div>
86 </div> 86 </div>
87 </div> 87 </div>
88 </div> 88 </div>
89 </div> 89 </div>
90 </form> 90 </form>
91 <div class="row"> 91 <div class="row">
92 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 92 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
93 <!-- PC --> 93 <!-- PC -->
94 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 94 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
95 <table class="table tabla-articulo table-striped table-sm table-dark"> 95 <table class="table tabla-articulo table-striped table-sm table-dark">
96 <thead> 96 <thead>
97 <tr class="d-flex"> 97 <tr class="d-flex">
98 <th class="">#</th> 98 <th class="">#</th>
99 <th class="col">Código</th> 99 <th class="col">Código</th>
100 <th class="col-4">Descripción</th> 100 <th class="col-4">Descripción</th>
101 <th class="col text-right">Cantidad</th> 101 <th class="col text-right">Cantidad</th>
102 <th class="col text-right">Precio Unitario</th> 102 <th class="col text-right">Precio Unitario</th>
103 <th class="col text-right">SubTotal</th> 103 <th class="col text-right">SubTotal</th>
104 <th class="text-right"> 104 <th class="text-right">
105 <button 105 <button
106 class="btn btn-outline-secondary selectable" 106 class="btn btn-outline-secondary selectable"
107 ng-click="show = !show; masMenos()" 107 ng-click="show = !show; masMenos()"
108 > 108 >
109 <i 109 <i
110 class="fa fa-chevron-down" 110 class="fa fa-chevron-down"
111 ng-show="show" 111 ng-show="show"
112 aria-hidden="true" 112 aria-hidden="true"
113 > 113 >
114 </i> 114 </i>
115 <i 115 <i
116 class="fa fa-chevron-up" 116 class="fa fa-chevron-up"
117 ng-hide="show" 117 ng-hide="show"
118 aria-hidden="true"> 118 aria-hidden="true">
119 </i> 119 </i>
120 </button> 120 </button>
121 </th> 121 </th>
122 </tr> 122 </tr>
123 </thead> 123 </thead>
124 <tbody class="tabla-articulo-body"> 124 <tbody class="tabla-articulo-body">
125 <tr 125 <tr
126 ng-repeat="(key, articulo) in articulosTabla" 126 ng-repeat="(key, articulo) in articulosTabla"
127 ng-show="show || key == (articulosTabla.length - 1)" 127 ng-show="show || key == (articulosTabla.length - 1)"
128 class="d-flex" 128 class="d-flex"
129 > 129 >
130 <td ng-bind="key + 1"></td> 130 <td ng-bind="key + 1"></td>
131 <td 131 <td
132 class="col" 132 class="col"
133 ng-bind="articulo.sector + '-' + articulo.codigo" 133 ng-bind="articulo.sector + '-' + articulo.codigo"
134 ></td> 134 ></td>
135 <td 135 <td
136 class="col-4" 136 class="col-4"
137 ng-bind="articulo.descripcion" 137 ng-bind="articulo.descripcion"
138 ></td> 138 ></td>
139 <td class="col text-right"> 139 <td class="col text-right">
140 <input 140 <input
141 ng-show="articulo.editCantidad" 141 ng-show="articulo.editCantidad"
142 ng-model="articulo.cantidad" 142 ng-model="articulo.cantidad"
143 class="form-control" 143 class="form-control"
144 type="number" 144 type="number"
145 min="1" 145 min="1"
146 foca-focus="articulo.editCantidad" 146 foca-focus="articulo.editCantidad"
147 ng-keypress="editarArticulo($event.keyCode, articulo)" 147 ng-keypress="editarArticulo($event.keyCode, articulo)"
148 ng-focus="selectFocus($event)" 148 ng-focus="selectFocus($event)"
149 > 149 >
150 <i 150 <i
151 class="selectable" 151 class="selectable"
152 ng-click="cambioEdit(articulo, 'cantidad')" 152 ng-click="cambioEdit(articulo, 'cantidad')"
153 ng-hide="articulo.editCantidad" 153 ng-hide="articulo.editCantidad"
154 ng-bind="articulo.cantidad"> 154 ng-bind="articulo.cantidad">
155 </i> 155 </i>
156 </td> 156 </td>
157 <td class="col text-right"> 157 <td class="col text-right">
158 <input 158 <input
159 ng-show="articulo.editPrecio" 159 ng-show="articulo.editPrecio"
160 ng-model="articulo.precio" 160 ng-model="articulo.precio"
161 class="form-control" 161 class="form-control"
162 type="number" 162 type="number"
163 min="1" 163 min="1"
164 step="0.0001" 164 step="0.0001"
165 foca-focus="articulo.editPrecio" 165 foca-focus="articulo.editPrecio"
166 ng-keypress="editarArticulo($event.keyCode, articulo)" 166 ng-keypress="editarArticulo($event.keyCode, articulo)"
167 ng-focus="selectFocus($event)" 167 ng-focus="selectFocus($event)"
168 > 168 >
169 <i 169 <i
170 class="selectable" 170 class="selectable"
171 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" 171 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
172 ng-hide="articulo.editPrecio" 172 ng-hide="articulo.editPrecio"
173 ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> 173 ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4">
174 </i> 174 </i>
175 </td> 175 </td>
176 <td 176 <td
177 class="col text-right" 177 class="col text-right"
178 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> 178 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo">
179 </td> 179 </td>
180 <td class="text-center"> 180 <td class="text-center">
181 <button 181 <button
182 class="btn btn-outline-secondary" 182 class="btn btn-outline-secondary"
183 ng-click="quitarArticulo(key)" 183 ng-click="quitarArticulo(key)"
184 > 184 >
185 <i class="fa fa-trash"></i> 185 <i class="fa fa-trash"></i>
186 </button> 186 </button>
187 </td> 187 </td>
188 </tr> 188 </tr>
189 </tbody> 189 </tbody>
190 <tfoot> 190 <tfoot>
191 <tr ng-show="!cargando" class="d-flex"> 191 <tr ng-show="!cargando" class="d-flex">
192 <td 192 <td
193 class="align-middle" 193 class="align-middle"
194 ng-bind="articulosTabla.length + 1" 194 ng-bind="articulosTabla.length + 1"
195 ></td> 195 ></td>
196 <td class="col"> 196 <td class="col">
197 <input 197 <input
198 class="form-control" 198 class="form-control"
199 ng-model="articuloACargar.sectorCodigo" 199 ng-model="articuloACargar.sectorCodigo"
200 readonly 200 readonly
201 > 201 >
202 </td> 202 </td>
203 <td class="col-4 tabla-articulo-descripcion"> 203 <td class="col-4 tabla-articulo-descripcion">
204 <input 204 <input
205 class="form-control" 205 class="form-control"
206 ng-model="articuloACargar.descripcion" 206 ng-model="articuloACargar.descripcion"
207 readonly 207 readonly
208 > 208 >
209 </td> 209 </td>
210 <td class="col text-right"> 210 <td class="col text-right">
211 <input 211 <input
212 class="form-control" 212 class="form-control"
213 type="number" 213 type="number"
214 min="1" 214 min="1"
215 ng-model="articuloACargar.cantidad" 215 ng-model="articuloACargar.cantidad"
216 foca-focus="!cargando" 216 foca-focus="!cargando"
217 esc-key="resetFilter()" 217 esc-key="resetFilter()"
218 ng-keypress="agregarATabla($event.keyCode)" 218 ng-keypress="agregarATabla($event.keyCode)"
219 > 219 >
220 </td> 220 </td>
221 <td class="col text-right"> 221 <td class="col text-right">
222 <input 222 <input
223 class="form-control" 223 class="form-control"
224 ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" 224 ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4"
225 ng-show="idLista != -1" 225 ng-show="idLista != -1"
226 readonly 226 readonly
227 > 227 >
228 <input 228 <input
229 class="form-control" 229 class="form-control"
230 type="number" 230 type="number"
231 step="0.0001" 231 step="0.0001"
232 ng-model="articuloACargar.precio" 232 ng-model="articuloACargar.precio"
233 esc-key="resetFilter()" 233 esc-key="resetFilter()"
234 ng-keypress="agregarATabla($event.keyCode)" 234 ng-keypress="agregarATabla($event.keyCode)"
235 ng-show="idLista == -1" 235 ng-show="idLista == -1"
236 > 236 >
237 </td> 237 </td>
238 <td class="col text-right"> 238 <td class="col text-right">
239 <input 239 <input
240 class="form-control" 240 class="form-control"
241 ng-value="getSubTotal() | currency: remito.moneda.simbolo" 241 ng-value="getSubTotal() | currency: remito.moneda.simbolo"
242 readonly 242 readonly
243 ></td> 243 ></td>
244 <td class="text-center align-middle"> 244 <td class="text-center align-middle">
245 <button 245 <button
246 class="btn btn-outline-secondary" 246 class="btn btn-outline-secondary"
247 ng-click="agregarATabla(13)" 247 ng-click="agregarATabla(13)"
248 > 248 >
249 <i class="fa fa-save"></i> 249 <i class="fa fa-save"></i>
250 </button> 250 </button>
251 </td> 251 </td>
252 </tr> 252 </tr>
253 <tr ng-show="cargando" class="d-flex"> 253 <tr ng-show="cargando" class="d-flex">
254 <td colspan="7" class="col-12"> 254 <td colspan="7" class="col-12">
255 <input 255 <input
256 placeholder="Seleccione Articulo" 256 placeholder="Seleccione Articulo"
257 class="form-control form-control-sm" 257 class="form-control form-control-sm"
258 readonly 258 readonly
259 ng-click="seleccionarArticulo()" 259 ng-click="seleccionarArticulo()"
260 /> 260 />
261 </td> 261 </td>
262 </tr> 262 </tr>
263 <tr class="d-flex"> 263 <tr class="d-flex">
264 <td colspan="4" class="no-border-top"> 264 <td colspan="4" class="no-border-top">
265 <strong>Items:</strong> 265 <strong>Items:</strong>
266 <a ng-bind="articulosTabla.length"></a> 266 <a ng-bind="articulosTabla.length"></a>
267 </td> 267 </td>
268 <td class="text-right ml-auto table-celda-total no-border-top"> 268 <td class="text-right ml-auto table-celda-total no-border-top">
269 <h3>Total:</h3> 269 <h3>Total:</h3>
270 </td> 270 </td>
271 <td class="table-celda-total text-right no-border-top" colspan="1"> 271 <td class="table-celda-total text-right no-border-top" colspan="1">
272 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> 272 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3>
273 </td> 273 </td>
274 <td class="text-right no-border-top"> 274 <td class="text-right no-border-top">
275 <button 275 <button
276 type="button" 276 type="button"
277 class="btn btn-default btn-sm" 277 class="btn btn-default btn-sm"
278 > 278 >
279 Totales 279 Totales
280 </button> 280 </button>
281 </td> 281 </td>
282 </tr> 282 </tr>
283 </tfoot> 283 </tfoot>
284 </table> 284 </table>
285 </div> 285 </div>
286 286
287 <!-- MOBILE --> 287 <!-- MOBILE -->
288 <div class="row d-sm-none"> 288 <div class="row d-sm-none">
289 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 289 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
290 <thead> 290 <thead>
291 <tr class="d-flex"> 291 <tr class="d-flex">
292 <th class="">#</th> 292 <th class="">#</th>
293 <th class="col px-0"> 293 <th class="col px-0">
294 <div class="d-flex"> 294 <div class="d-flex">
295 <div class="col-4 px-1">Código</div> 295 <div class="col-4 px-1">Código</div>
296 <div class="col-8 px-1">Descripción</div> 296 <div class="col-8 px-1">Descripción</div>
297 </div> 297 </div>
298 <div class="d-flex"> 298 <div class="d-flex">
299 <div class="col-3 px-1">Cantidad</div> 299 <div class="col-3 px-1">Cantidad</div>
300 <div class="col px-1 text-right">P. Uni.</div> 300 <div class="col px-1 text-right">P. Uni.</div>
301 <div class="col px-1 text-right">Subtotal</div> 301 <div class="col px-1 text-right">Subtotal</div>
302 </div> 302 </div>
303 </th> 303 </th>
304 <th class="text-center tamaño-boton"> 304 <th class="text-center tamaño-boton">
305 &nbsp; 305 &nbsp;
306 </th> 306 </th>
307 </tr> 307 </tr>
308 </thead> 308 </thead>
309 <tbody> 309 <tbody>
310 <tr 310 <tr
311 ng-repeat="(key, articulo) in articulosTabla" 311 ng-repeat="(key, articulo) in articulosTabla"
312 ng-show="show || key == articulosTabla.length - 1" 312 ng-show="show || key == articulosTabla.length - 1"
313 > 313 >
314 <td class="w-100 align-middle d-flex p-0"> 314 <td class="w-100 align-middle d-flex p-0">
315 <div class="align-middle p-1"> 315 <div class="align-middle p-1">
316 <span ng-bind="key+1" class="align-middle"></span> 316 <span ng-bind="key+1" class="align-middle"></span>
317 </div> 317 </div>
318 <div class="col px-0"> 318 <div class="col px-0">
319 <div class="d-flex"> 319 <div class="d-flex">
320 <div class="col-4 px-1"> 320 <div class="col-4 px-1">
321 <span 321 <span
322 ng-bind="articulo.sector + '-' + articulo.codigo" 322 ng-bind="articulo.sector + '-' + articulo.codigo"
323 ></span> 323 ></span>
324 </div> 324 </div>
325 <div class="col-8 px-1"> 325 <div class="col-8 px-1">
326 <span ng-bind="articulo.descripcion"></span> 326 <span ng-bind="articulo.descripcion"></span>
327 </div> 327 </div>
328 </div> 328 </div>
329 <div class="d-flex"> 329 <div class="d-flex">
330 <div class="col-3 px-1"> 330 <div class="col-3 px-1">
331 <span ng-bind="'x' + articulo.cantidad"></span> 331 <span ng-bind="'x' + articulo.cantidad"></span>
332 </div> 332 </div>
333 <div class="col-3 px-1 text-right"> 333 <div class="col-3 px-1 text-right">
334 <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> 334 <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span>
335 </div> 335 </div>
336 <div class="col px-1 text-right"> 336 <div class="col px-1 text-right">
337 <span 337 <span
338 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" 338 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"
339 > 339 >
340 </span> 340 </span>
341 </div> 341 </div>
342 </div> 342 </div>
343 </div> 343 </div>
344 <div class="align-middle p-1"> 344 <div class="align-middle p-1">
345 <button 345 <button
346 class="btn btn-outline-secondary" 346 class="btn btn-outline-secondary"
347 ng-click="quitarArticulo(key)" 347 ng-click="quitarArticulo(key)"
348 > 348 >
349 <i class="fa fa-trash"></i> 349 <i class="fa fa-trash"></i>
350 </button> 350 </button>
351 </div> 351 </div>
352 </td> 352 </td>
353 </tr> 353 </tr>
354 </tbody> 354 </tbody>
355 <tfoot> 355 <tfoot>
356 <!-- CARGANDO ITEM --> 356 <!-- CARGANDO ITEM -->
357 <tr ng-show="!cargando" class="d-flex"> 357 <tr ng-show="!cargando" class="d-flex">
358 <td 358 <td
359 class="align-middle p-1" 359 class="align-middle p-1"
360 ng-bind="articulosTabla.length + 1" 360 ng-bind="articulosTabla.length + 1"
361 ></td> 361 ></td>
362 <td class="col p-0"> 362 <td class="col p-0">
363 <div class="d-flex"> 363 <div class="d-flex">
364 <div class="col-4 px-1"> 364 <div class="col-4 px-1">
365 <span 365 <span
366 ng-bind="articuloACargar.sectorCodigo" 366 ng-bind="articuloACargar.sectorCodigo"
367 ></span> 367 ></span>
368 </div> 368 </div>
369 <div class="col-8 px-1"> 369 <div class="col-8 px-1">
370 <span ng-bind="articuloACargar.descripcion"></span> 370 <span ng-bind="articuloACargar.descripcion"></span>
371 </div> 371 </div>
372 </div> 372 </div>
373 <div class="d-flex"> 373 <div class="d-flex">
374 <div class="col-3 px-1 m-1"> 374 <div class="col-3 px-1 m-1">
375 <input 375 <input
376 class="form-control p-1" 376 class="form-control p-1"
377 type="number" 377 type="number"
378 min="1" 378 min="1"
379 ng-model="articuloACargar.cantidad" 379 ng-model="articuloACargar.cantidad"
380 foca-focus="!cargando" 380 foca-focus="!cargando"
381 ng-keypress="agregarATabla($event.keyCode)" 381 ng-keypress="agregarATabla($event.keyCode)"
382 style="height: auto; line-height: 1.1em" 382 style="height: auto; line-height: 1.1em"
383 > 383 >
384 </div> 384 </div>
385 <div class="col-3 px-1 text-right"> 385 <div class="col-3 px-1 text-right">
386 <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> 386 <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span>
387 </div> 387 </div>
388 <div class="col px-1 text-right"> 388 <div class="col px-1 text-right">
389 <span 389 <span
390 ng-bind="getSubTotal() | currency: remito.moneda.simbolo" 390 ng-bind="getSubTotal() | currency: remito.moneda.simbolo"
391 > 391 >
392 </span> 392 </span>
393 </div> 393 </div>
394 </div> 394 </div>
395 </td> 395 </td>
396 <td class="text-center align-middle"> 396 <td class="text-center align-middle">
397 <button 397 <button
398 class="btn btn-outline-secondary" 398 class="btn btn-outline-secondary"
399 ng-click="agregarATabla(13)" 399 ng-click="agregarATabla(13)"
400 > 400 >
401 <i class="fa fa-save"></i> 401 <i class="fa fa-save"></i>
402 </button> 402 </button>
403 </td> 403 </td>
404 </tr> 404 </tr>
405 <!-- SELECCIONAR PRODUCTO --> 405 <!-- SELECCIONAR PRODUCTO -->
406 <tr ng-show="cargando" class="d-flex"> 406 <tr ng-show="cargando" class="d-flex">
407 <td class="col-12"> 407 <td class="col-12">
408 <input 408 <input
409 placeholder="Seleccione Articulo" 409 placeholder="Seleccione Articulo"
410 class="form-control form-control-sm" 410 class="form-control form-control-sm"
411 readonly 411 readonly
412 ng-click="seleccionarArticulo()" 412 ng-click="seleccionarArticulo()"
413 /> 413 />
414 </td> 414 </td>
415 </tr> 415 </tr>
416 <!-- TOOGLE EXPANDIR --> 416 <!-- TOOGLE EXPANDIR -->
417 <tr> 417 <tr>
418 <td class="col"> 418 <td class="col">
419 <button 419 <button
420 class="btn btn-outline-secondary selectable w-100" 420 class="btn btn-outline-secondary selectable w-100"
421 ng-click="show = !show; masMenos()" 421 ng-click="show = !show; masMenos()"
422 ng-show="articulosTabla.length > 0" 422 ng-show="articulosTabla.length > 0"
423 > 423 >
424 <i 424 <i
425 class="fa fa-chevron-down" 425 class="fa fa-chevron-down"
426 ng-hide="show" 426 ng-hide="show"
427 aria-hidden="true" 427 aria-hidden="true"
428 > 428 >
429 </i> 429 </i>
430 <i 430 <i
431 class="fa fa-chevron-up" 431 class="fa fa-chevron-up"
432 ng-show="show" 432 ng-show="show"
433 aria-hidden="true"> 433 aria-hidden="true">
434 </i> 434 </i>
435 </button> 435 </button>
436 </td> 436 </td>
437 </tr> 437 </tr>
438 <!-- FOOTER --> 438 <!-- FOOTER -->
439 <tr class="d-flex"> 439 <tr class="d-flex">
440 <td class="align-middle no-border-top" colspan="2"> 440 <td class="align-middle no-border-top" colspan="2">
441 <strong>Cantidad Items:</strong> 441 <strong>Cantidad Items:</strong>
442 <a ng-bind="articulosTabla.length"></a> 442 <a ng-bind="articulosTabla.length"></a>
443 </td> 443 </td>
444 <td class="text-right ml-auto table-celda-total no-border-top"> 444 <td class="text-right ml-auto table-celda-total no-border-top">
445 <h3>Total:</h3> 445 <h3>Total:</h3>
446 </td> 446 </td>
447 <td class="table-celda-total text-right no-border-top"> 447 <td class="table-celda-total text-right no-border-top">
448 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> 448 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3>
449 </td> 449 </td>
450 </tr> 450 </tr>
451 </tfoot> 451 </tfoot>
452 </table> 452 </table>
453 </div> 453 </div>
454 </div> 454 </div>
455 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> 455 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block">
456 <div class="row align-items-end"> 456 <div class="row align-items-end">
457 <div class="col-12"> 457 <div class="col-12">
458 <button 458 <button
459 ng-click="crearRemito()" 459 ng-click="crearRemito()"
460 type="submit" 460 type="submit"
461 title="Crear nota remito" 461 title="Crear nota remito"
462 class="btn btn-default btn-block mb-2"> 462 class="btn btn-default btn-block mb-2">
463 Guardar 463 Guardar
464 </button> 464 </button>
465 <button 465 <button
466 ng-click="salir()" 466 ng-click="salir()"
467 type="button" 467 type="button"
468 title="Salir" 468 title="Salir"
469 class="btn btn-default btn-block"> 469 class="btn btn-default btn-block">
470 Salir 470 Salir
471 </button> 471 </button>
472 </div> 472 </div>
473 </div> 473 </div>
474 </div> 474 </div>
475 </div> 475 </div>
476 <div class="row d-md-none fixed-bottom"> 476 <div class="row d-md-none fixed-bottom">
477 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 477 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
478 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 478 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
479 <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> 479 <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span>
480 </div> 480 </div>
481 </div> 481 </div>
482 </div> 482 </div>
483 483