Commit 39a9112fe4e9882debc8f958d7643a75e77e5400

Authored by Pablo Marco del Pont
1 parent 275df735ff
Exists in master

- Tareas gulp.

- Agregué botones lupa y nota pedido.
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', 'focaSeguimientoService', 'remitoBusinessService', 4 'focaModalService', 'focaSeguimientoService', 'remitoBusinessService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, 6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService,
7 focaSeguimientoService, remitoBusinessService 7 focaSeguimientoService, 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 $scope.seleccionarNotaPedido = function() {
73 var modalInstance = $uibModal.open(
74 {
75 ariaLabelledBy: 'Busqueda de Nota de Pedido',
76 templateUrl: 'foca-modal-nota-pedido.html',
77 controller: 'focaModalNotaPedidoController',
78 resolve: {
79 parametroNotaPedido: {
80 idLista: $scope.idLista,
81 cotizacion: $scope.remito.cotizacion.COTIZACION,
82 simbolo: $scope.remito.moneda.simbolo
83 }
84 },
85 size: 'lg'
86 }
87 );
88 modalInstance.result.then(
89 function(producto) {
90 var newArt =
91 {
92 id: 0,
93 codigo: producto.codigo,
94 sector: producto.sector,
95 sectorCodigo: producto.sector + '-' + producto.codigo,
96 descripcion: producto.descripcion,
97 item: $scope.articulosTabla.length + 1,
98 nombre: producto.descripcion,
99 precio: parseFloat(producto.precio.toFixed(4)),
100 costoUnitario: producto.costo,
101 editCantidad: false,
102 editPrecio: false
103 };
104 $scope.articuloACargar = newArt;
105 $scope.cargando = false;
106 }, function() {
107 // funcion ejecutada cuando se cancela el modal
108 }
109 );
110 }
111 $scope.seleccionarRemito = function() {
112 var modalInstance = $uibModal.open(
113 {
114 ariaLabelledBy: 'Busqueda de Remito',
115 templateUrl: 'foca-modal-remito.html',
116 controller: 'focaModalRemitoController',
117 resolve: {
118 parametroRemito: {
119 idLista: $scope.idLista,
120 cotizacion: $scope.remito.cotizacion.COTIZACION,
121 simbolo: $scope.remito.moneda.simbolo
122 }
123 },
124 size: 'lg'
125 }
126 );
127 modalInstance.result.then(
128 function(producto) {
129 var newArt =
130 {
131 id: 0,
132 codigo: producto.codigo,
133 sector: producto.sector,
134 sectorCodigo: producto.sector + '-' + producto.codigo,
135 descripcion: producto.descripcion,
136 item: $scope.articulosTabla.length + 1,
137 nombre: producto.descripcion,
138 precio: parseFloat(producto.precio.toFixed(4)),
139 costoUnitario: producto.costo,
140 editCantidad: false,
141 editPrecio: false
142 };
143 $scope.articuloACargar = newArt;
144 $scope.cargando = false;
145 }, function() {
146 // funcion ejecutada cuando se cancela el modal
147 }
148 );
149 }
72 //La pantalla solo se usa para cargar remitos 150 //La pantalla solo se usa para cargar remitos
73 // if (remitoTemp !== undefined) { 151 // if (remitoTemp !== undefined) {
74 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); 152 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga);
75 // $scope.remito = remitoTemp; 153 // $scope.remito = remitoTemp;
76 // $scope.remito.flete = ($scope.remito.flete).toString(); 154 // $scope.remito.flete = ($scope.remito.flete).toString();
77 // $scope.remito.bomba = ($scope.remito.bomba).toString(); 155 // $scope.remito.bomba = ($scope.remito.bomba).toString();
78 // $scope.idLista = $scope.remito.precioCondicion; 156 // $scope.idLista = $scope.remito.precioCondicion;
79 // crearRemitoService 157 // crearRemitoService
80 // .getArticulosByIdRemito($scope.remito.id).then( 158 // .getArticulosByIdRemito($scope.remito.id).then(
81 // function(res) { 159 // function(res) {
82 // $scope.articulosTabla = res.data; 160 // $scope.articulosTabla = res.data;
83 // } 161 // }
84 // ); 162 // );
85 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO 163 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO
86 //(NO REQUERIDO EN ESTA VERSION) 164 //(NO REQUERIDO EN ESTA VERSION)
87 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( 165 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then(
88 // function(res) { 166 // function(res) {
89 // $scope.remito.domicilio = res.data; 167 // $scope.remito.domicilio = res.data;
90 // } 168 // }
91 // ); 169 // );
92 // } else { 170 // } else {
93 // $scope.remito.fechaCarga = new Date(); 171 // $scope.remito.fechaCarga = new Date();
94 // $scope.remito.bomba = '0'; 172 // $scope.remito.bomba = '0';
95 // $scope.remito.flete = '0'; 173 // $scope.remito.flete = '0';
96 // $scope.idLista = undefined; 174 // $scope.idLista = undefined;
97 // } 175 // }
98 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 176 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
99 // $scope.addNewDom = function() { 177 // $scope.addNewDom = function() {
100 // $scope.remito.domicilio.push({ 'id': 0 }); 178 // $scope.remito.domicilio.push({ 'id': 0 });
101 // }; 179 // };
102 // $scope.removeNewChoice = function(choice) { 180 // $scope.removeNewChoice = function(choice) {
103 // if ($scope.remito.domicilio.length > 1) { 181 // if ($scope.remito.domicilio.length > 1) {
104 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( 182 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex(
105 // function(c) { 183 // function(c) {
106 // return c.$$hashKey === choice.$$hashKey; 184 // return c.$$hashKey === choice.$$hashKey;
107 // } 185 // }
108 // ), 1); 186 // ), 1);
109 // } 187 // }
110 // }; 188 // };
111 189
112 $scope.crearRemito = function() { 190 $scope.crearRemito = function() {
113 if(!$scope.remito.vendedor.codigo) { 191 if(!$scope.remito.vendedor.codigo) {
114 focaModalService.alert('Ingrese Vendedor'); 192 focaModalService.alert('Ingrese Vendedor');
115 return; 193 return;
116 } else if(!$scope.remito.cliente.cod) { 194 } else if(!$scope.remito.cliente.cod) {
117 focaModalService.alert('Ingrese Cliente'); 195 focaModalService.alert('Ingrese Cliente');
118 return; 196 return;
119 } else if(!$scope.remito.proveedor.codigo) { 197 } else if(!$scope.remito.proveedor.codigo) {
120 focaModalService.alert('Ingrese Proveedor'); 198 focaModalService.alert('Ingrese Proveedor');
121 return; 199 return;
122 } else if(!$scope.remito.moneda.id) { 200 } else if(!$scope.remito.moneda.id) {
123 focaModalService.alert('Ingrese Moneda'); 201 focaModalService.alert('Ingrese Moneda');
124 return; 202 return;
125 } else if(!$scope.remito.cotizacion.ID) { 203 } else if(!$scope.remito.cotizacion.ID) {
126 focaModalService.alert('Ingrese Cotización'); 204 focaModalService.alert('Ingrese Cotización');
127 return; 205 return;
128 } else if(!$scope.plazosPagos) { 206 } else if(!$scope.plazosPagos) {
129 focaModalService.alert('Ingrese Precios y Condiciones'); 207 focaModalService.alert('Ingrese Precios y Condiciones');
130 return; 208 return;
131 } else if( 209 } else if(
132 $scope.remito.flete === undefined || $scope.remito.flete === null) 210 $scope.remito.flete === undefined || $scope.remito.flete === null)
133 { 211 {
134 focaModalService.alert('Ingrese Flete'); 212 focaModalService.alert('Ingrese Flete');
135 return; 213 return;
136 } else if(!$scope.remito.domicilio.id) { 214 } else if(!$scope.remito.domicilio.id) {
137 focaModalService.alert('Ingrese Domicilio'); 215 focaModalService.alert('Ingrese Domicilio');
138 return; 216 return;
139 } else if($scope.articulosTabla.length === 0) { 217 } else if($scope.articulosTabla.length === 0) {
140 focaModalService.alert('Debe cargar al menos un articulo'); 218 focaModalService.alert('Debe cargar al menos un articulo');
141 return; 219 return;
142 } 220 }
143 var date = new Date(); 221 var date = new Date();
144 var remito = { 222 var remito = {
145 id: 0, 223 id: 0,
146 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 224 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
147 .toISOString().slice(0, 19).replace('T', ' '), 225 .toISOString().slice(0, 19).replace('T', ' '),
148 idVendedor: $scope.remito.vendedor.codigo, 226 idVendedor: $scope.remito.vendedor.codigo,
149 idCliente: $scope.remito.cliente.cod, 227 idCliente: $scope.remito.cliente.cod,
150 nombreCliente: $scope.remito.cliente.nom, 228 nombreCliente: $scope.remito.cliente.nom,
151 cuitCliente: $scope.remito.cliente.cuit, 229 cuitCliente: $scope.remito.cliente.cuit,
152 idProveedor: $scope.remito.proveedor.codigo, 230 idProveedor: $scope.remito.proveedor.codigo,
153 idDomicilio: $scope.remito.domicilio.id, 231 idDomicilio: $scope.remito.domicilio.id,
154 idCotizacion: $scope.remito.cotizacion.ID, 232 idCotizacion: $scope.remito.cotizacion.ID,
155 cotizacion: $scope.remito.cotizacion.COTIZACION, 233 cotizacion: $scope.remito.cotizacion.COTIZACION,
156 flete: $scope.remito.flete, 234 flete: $scope.remito.flete,
157 fob: $scope.remito.fob, 235 fob: $scope.remito.fob,
158 bomba: $scope.remito.bomba, 236 bomba: $scope.remito.bomba,
159 kilometros: $scope.remito.kilometros, 237 kilometros: $scope.remito.kilometros,
160 estado: 0, 238 estado: 0,
161 total: $scope.getTotal() 239 total: $scope.getTotal()
162 }; 240 };
163 crearRemitoService.crearRemito(remito).then( 241 crearRemitoService.crearRemito(remito).then(
164 function(data) { 242 function(data) {
165 remitoBusinessService.addArticulos($scope.articulosTabla, 243 remitoBusinessService.addArticulos($scope.articulosTabla,
166 data.data.id, $scope.remito.cotizacion.COTIZACION); 244 data.data.id, $scope.remito.cotizacion.COTIZACION);
167 focaSeguimientoService.guardarPosicion('crear nota remito', ''); 245 focaSeguimientoService.guardarPosicion('crear nota remito', '');
168 var plazos = $scope.plazosPagos; 246 var plazos = $scope.plazosPagos;
169 for(var j = 0; j < plazos.length; j++) { 247 for(var j = 0; j < plazos.length; j++) {
170 var json = { 248 var json = {
171 idRemito: data.data.id, 249 idRemito: data.data.id,
172 dias: plazos[j].dias 250 dias: plazos[j].dias
173 }; 251 };
174 crearRemitoService.crearPlazosParaRemito(json); 252 crearRemitoService.crearPlazosParaRemito(json);
175 } 253 }
176 remitoBusinessService.addEstado(data.data.id, 254 remitoBusinessService.addEstado(data.data.id,
177 $scope.remito.vendedor.codigo); 255 $scope.remito.vendedor.codigo);
178 256
179 focaModalService.alert('Nota remito creada'); 257 focaModalService.alert('Nota remito creada');
180 $scope.cabecera = []; 258 $scope.cabecera = [];
181 addCabecera('Moneda:', $scope.remito.moneda.detalle); 259 addCabecera('Moneda:', $scope.remito.moneda.detalle);
182 addCabecera( 260 addCabecera(
183 'Fecha cotizacion:', 261 'Fecha cotizacion:',
184 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') 262 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
185 ); 263 );
186 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); 264 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION);
187 $scope.remito.vendedor = {}; 265 $scope.remito.vendedor = {};
188 $scope.remito.cliente = {}; 266 $scope.remito.cliente = {};
189 $scope.remito.proveedor = {}; 267 $scope.remito.proveedor = {};
190 $scope.remito.domicilio = {}; 268 $scope.remito.domicilio = {};
191 $scope.remito.flete = null; 269 $scope.remito.flete = null;
192 $scope.remito.fob = null; 270 $scope.remito.fob = null;
193 $scope.remito.bomba = null; 271 $scope.remito.bomba = null;
194 $scope.remito.kilometros = null; 272 $scope.remito.kilometros = null;
195 $scope.articulosTabla = []; 273 $scope.articulosTabla = [];
196 } 274 }
197 ); 275 );
198 }; 276 };
199 277
200 $scope.seleccionarArticulo = function() { 278 $scope.seleccionarArticulo = function() {
201 if ($scope.idLista === undefined) { 279 if ($scope.idLista === undefined) {
202 focaModalService.alert( 280 focaModalService.alert(
203 'Primero seleccione una lista de precio y condicion'); 281 'Primero seleccione una lista de precio y condicion');
204 return; 282 return;
205 } 283 }
206 var modalInstance = $uibModal.open( 284 var modalInstance = $uibModal.open(
207 { 285 {
208 ariaLabelledBy: 'Busqueda de Productos', 286 ariaLabelledBy: 'Busqueda de Productos',
209 templateUrl: 'modal-busqueda-productos.html', 287 templateUrl: 'modal-busqueda-productos.html',
210 controller: 'modalBusquedaProductosCtrl', 288 controller: 'modalBusquedaProductosCtrl',
211 resolve: { 289 resolve: {
212 parametroProducto: { 290 parametroProducto: {
213 idLista: $scope.idLista, 291 idLista: $scope.idLista,
214 cotizacion: $scope.remito.cotizacion.COTIZACION, 292 cotizacion: $scope.remito.cotizacion.COTIZACION,
215 simbolo: $scope.remito.moneda.simbolo 293 simbolo: $scope.remito.moneda.simbolo
216 } 294 }
217 }, 295 },
218 size: 'lg' 296 size: 'lg'
219 } 297 }
220 ); 298 );
221 modalInstance.result.then( 299 modalInstance.result.then(
222 function(producto) { 300 function(producto) {
223 var newArt = 301 var newArt =
224 { 302 {
225 id: 0, 303 id: 0,
226 codigo: producto.codigo, 304 codigo: producto.codigo,
227 sector: producto.sector, 305 sector: producto.sector,
228 sectorCodigo: producto.sector + '-' + producto.codigo, 306 sectorCodigo: producto.sector + '-' + producto.codigo,
229 descripcion: producto.descripcion, 307 descripcion: producto.descripcion,
230 item: $scope.articulosTabla.length + 1, 308 item: $scope.articulosTabla.length + 1,
231 nombre: producto.descripcion, 309 nombre: producto.descripcion,
232 precio: parseFloat(producto.precio.toFixed(4)), 310 precio: parseFloat(producto.precio.toFixed(4)),
233 costoUnitario: producto.costo, 311 costoUnitario: producto.costo,
234 editCantidad: false, 312 editCantidad: false,
235 editPrecio: false 313 editPrecio: false
236 }; 314 };
237 $scope.articuloACargar = newArt; 315 $scope.articuloACargar = newArt;
238 $scope.cargando = false; 316 $scope.cargando = false;
239 }, function() { 317 }, function() {
240 // funcion ejecutada cuando se cancela el modal 318 // funcion ejecutada cuando se cancela el modal
241 } 319 }
242 ); 320 );
243 }; 321 };
244 322
245 $scope.seleccionarVendedor = function() { 323 $scope.seleccionarVendedor = function() {
246 var modalInstance = $uibModal.open( 324 var modalInstance = $uibModal.open(
247 { 325 {
248 ariaLabelledBy: 'Busqueda de Vendedores', 326 ariaLabelledBy: 'Busqueda de Vendedores',
249 templateUrl: 'modal-vendedores.html', 327 templateUrl: 'modal-vendedores.html',
250 controller: 'modalVendedoresCtrl', 328 controller: 'modalVendedoresCtrl',
251 size: 'lg' 329 size: 'lg'
252 } 330 }
253 ); 331 );
254 modalInstance.result.then( 332 modalInstance.result.then(
255 function(vendedor) { 333 function(vendedor) {
256 addCabecera('Vendedor:', vendedor.NomVen); 334 addCabecera('Vendedor:', vendedor.NomVen);
257 $scope.remito.vendedor.codigo = vendedor.CodVen; 335 $scope.remito.vendedor.codigo = vendedor.CodVen;
258 }, function() { 336 }, function() {
259 337
260 } 338 }
261 ); 339 );
262 }; 340 };
263 341
264 $scope.seleccionarProveedor = function() { 342 $scope.seleccionarProveedor = function() {
265 var modalInstance = $uibModal.open( 343 var modalInstance = $uibModal.open(
266 { 344 {
267 ariaLabelledBy: 'Busqueda de Proveedor', 345 ariaLabelledBy: 'Busqueda de Proveedor',
268 templateUrl: 'modal-proveedor.html', 346 templateUrl: 'modal-proveedor.html',
269 controller: 'focaModalProveedorCtrl', 347 controller: 'focaModalProveedorCtrl',
270 size: 'lg' 348 size: 'lg'
271 } 349 }
272 ); 350 );
273 modalInstance.result.then( 351 modalInstance.result.then(
274 function(proveedor) { 352 function(proveedor) {
275 $scope.remito.proveedor.codigo = proveedor.COD; 353 $scope.remito.proveedor.codigo = proveedor.COD;
276 addCabecera('Proveedor:', proveedor.NOM); 354 addCabecera('Proveedor:', proveedor.NOM);
277 }, function() { 355 }, function() {
278 356
279 } 357 }
280 ); 358 );
281 }; 359 };
282 360
283 $scope.seleccionarCliente = function() { 361 $scope.seleccionarCliente = function() {
284 362
285 var modalInstance = $uibModal.open( 363 var modalInstance = $uibModal.open(
286 { 364 {
287 ariaLabelledBy: 'Busqueda de Cliente', 365 ariaLabelledBy: 'Busqueda de Cliente',
288 templateUrl: 'foca-busqueda-cliente-modal.html', 366 templateUrl: 'foca-busqueda-cliente-modal.html',
289 controller: 'focaBusquedaClienteModalController', 367 controller: 'focaBusquedaClienteModalController',
290 size: 'lg' 368 size: 'lg'
291 } 369 }
292 ); 370 );
293 modalInstance.result.then( 371 modalInstance.result.then(
294 function(cliente) { 372 function(cliente) {
295 $scope.abrirModalDomicilios(cliente); 373 $scope.abrirModalDomicilios(cliente);
296 }, function() { 374 }, function() {
297 375
298 } 376 }
299 ); 377 );
300 }; 378 };
301 379
302 $scope.abrirModalDomicilios = function(cliente) { 380 $scope.abrirModalDomicilios = function(cliente) {
303 var modalInstanceDomicilio = $uibModal.open( 381 var modalInstanceDomicilio = $uibModal.open(
304 { 382 {
305 ariaLabelledBy: 'Busqueda de Domicilios', 383 ariaLabelledBy: 'Busqueda de Domicilios',
306 templateUrl: 'modal-domicilio.html', 384 templateUrl: 'modal-domicilio.html',
307 controller: 'focaModalDomicilioController', 385 controller: 'focaModalDomicilioController',
308 resolve: { idCliente: function() { return cliente.cod; }}, 386 resolve: { idCliente: function() { return cliente.cod; }},
309 size: 'lg', 387 size: 'lg',
310 } 388 }
311 ); 389 );
312 modalInstanceDomicilio.result.then( 390 modalInstanceDomicilio.result.then(
313 function(domicilio) { 391 function(domicilio) {
314 $scope.remito.domicilio.id = domicilio.nivel2; 392 $scope.remito.domicilio.id = domicilio.nivel2;
315 $scope.remito.cliente = cliente; 393 $scope.remito.cliente = cliente;
316 394
317 addCabecera('Cliente:', cliente.nom); 395 addCabecera('Cliente:', cliente.nom);
318 addCabecera('Domicilio:', domicilio.dom); 396 addCabecera('Domicilio:', domicilio.dom);
319 }, function() { 397 }, function() {
320 $scope.seleccionarCliente(); 398 $scope.seleccionarCliente();
321 return; 399 return;
322 } 400 }
323 ); 401 );
324 }; 402 };
325 403
326 $scope.mostrarFichaCliente = function() { 404 $scope.mostrarFichaCliente = function() {
327 $uibModal.open( 405 $uibModal.open(
328 { 406 {
329 ariaLabelledBy: 'Datos del Cliente', 407 ariaLabelledBy: 'Datos del Cliente',
330 templateUrl: 'foca-crear-remito-ficha-cliente.html', 408 templateUrl: 'foca-crear-remito-ficha-cliente.html',
331 controller: 'focaCrearRemitoFichaClienteController', 409 controller: 'focaCrearRemitoFichaClienteController',
332 size: 'lg' 410 size: 'lg'
333 } 411 }
334 ); 412 );
335 }; 413 };
336 414
337 $scope.getTotal = function() { 415 $scope.getTotal = function() {
338 var total = 0; 416 var total = 0;
339 var arrayTempArticulos = $scope.articulosTabla; 417 var arrayTempArticulos = $scope.articulosTabla;
340 for (var i = 0; i < arrayTempArticulos.length; i++) { 418 for (var i = 0; i < arrayTempArticulos.length; i++) {
341 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 419 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
342 } 420 }
343 return parseFloat(total.toFixed(2)); 421 return parseFloat(total.toFixed(2));
344 }; 422 };
345 423
346 $scope.getSubTotal = function() { 424 $scope.getSubTotal = function() {
347 if($scope.articuloACargar) { 425 if($scope.articuloACargar) {
348 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 426 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
349 } 427 }
350 }; 428 };
351 429
352 $scope.abrirModalListaPrecio = function() { 430 $scope.abrirModalListaPrecio = function() {
353 var modalInstance = $uibModal.open( 431 var modalInstance = $uibModal.open(
354 { 432 {
355 ariaLabelledBy: 'Busqueda de Precio Condición', 433 ariaLabelledBy: 'Busqueda de Precio Condición',
356 templateUrl: 'modal-precio-condicion.html', 434 templateUrl: 'modal-precio-condicion.html',
357 controller: 'focaModalPrecioCondicionController', 435 controller: 'focaModalPrecioCondicionController',
358 size: 'lg' 436 size: 'lg'
359 } 437 }
360 ); 438 );
361 modalInstance.result.then( 439 modalInstance.result.then(
362 function(precioCondicion) { 440 function(precioCondicion) {
363 var cabecera = ''; 441 var cabecera = '';
364 var plazosConcat = ''; 442 var plazosConcat = '';
365 if(!Array.isArray(precioCondicion)) { 443 if(!Array.isArray(precioCondicion)) {
366 $scope.plazosPagos = precioCondicion.plazoPago; 444 $scope.plazosPagos = precioCondicion.plazoPago;
367 $scope.idLista = precioCondicion.idListaPrecio; 445 $scope.idLista = precioCondicion.idListaPrecio;
368 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 446 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
369 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 447 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
370 } 448 }
371 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 449 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
372 } else { //Cuando se ingresan los plazos manualmente 450 } else { //Cuando se ingresan los plazos manualmente
373 $scope.idLista = -1; //-1, el modal productos busca todos los productos 451 $scope.idLista = -1; //-1, el modal productos busca todos los productos
374 $scope.plazosPagos = precioCondicion; 452 $scope.plazosPagos = precioCondicion;
375 for(var j = 0; j < precioCondicion.length; j++) { 453 for(var j = 0; j < precioCondicion.length; j++) {
376 plazosConcat += precioCondicion[j].dias + ' '; 454 plazosConcat += precioCondicion[j].dias + ' ';
377 } 455 }
378 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 456 cabecera = 'Ingreso manual ' + plazosConcat.trim();
379 } 457 }
380 $scope.articulosTabla = []; 458 $scope.articulosTabla = [];
381 addCabecera('Precios y condiciones:', cabecera); 459 addCabecera('Precios y condiciones:', cabecera);
382 }, function() { 460 }, function() {
383 461
384 } 462 }
385 ); 463 );
386 }; 464 };
387 465
388 $scope.abrirModalFlete = function() { 466 $scope.abrirModalFlete = function() {
389 var modalInstance = $uibModal.open( 467 var modalInstance = $uibModal.open(
390 { 468 {
391 ariaLabelledBy: 'Busqueda de Flete', 469 ariaLabelledBy: 'Busqueda de Flete',
392 templateUrl: 'modal-flete.html', 470 templateUrl: 'modal-flete.html',
393 controller: 'focaModalFleteController', 471 controller: 'focaModalFleteController',
394 size: 'lg', 472 size: 'lg',
395 resolve: { 473 resolve: {
396 parametrosFlete: 474 parametrosFlete:
397 function() { 475 function() {
398 return { 476 return {
399 flete: $scope.remito.flete ? '1' : 477 flete: $scope.remito.flete ? '1' :
400 ($scope.remito.fob ? 'FOB' : 478 ($scope.remito.fob ? 'FOB' :
401 ($scope.remito.flete === undefined ? null : '0')), 479 ($scope.remito.flete === undefined ? null : '0')),
402 bomba: $scope.remito.bomba ? '1' : 480 bomba: $scope.remito.bomba ? '1' :
403 ($scope.remito.bomba === undefined ? null : '0'), 481 ($scope.remito.bomba === undefined ? null : '0'),
404 kilometros: $scope.remito.kilometros 482 kilometros: $scope.remito.kilometros
405 }; 483 };
406 } 484 }
407 } 485 }
408 } 486 }
409 ); 487 );
410 modalInstance.result.then( 488 modalInstance.result.then(
411 function(datos) { 489 function(datos) {
412 $scope.remito.flete = datos.flete; 490 $scope.remito.flete = datos.flete;
413 $scope.remito.fob = datos.FOB; 491 $scope.remito.fob = datos.FOB;
414 $scope.remito.bomba = datos.bomba; 492 $scope.remito.bomba = datos.bomba;
415 $scope.remito.kilometros = datos.kilometros; 493 $scope.remito.kilometros = datos.kilometros;
416 494
417 addCabecera('Flete:', datos.flete ? 'Si' : 495 addCabecera('Flete:', datos.flete ? 'Si' :
418 ($scope.remito.fob ? 'FOB' : 'No')); 496 ($scope.remito.fob ? 'FOB' : 'No'));
419 if(datos.flete) { 497 if(datos.flete) {
420 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 498 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
421 addCabecera('Kilometros:', datos.kilometros); 499 addCabecera('Kilometros:', datos.kilometros);
422 } else { 500 } else {
423 removeCabecera('Bomba:'); 501 removeCabecera('Bomba:');
424 removeCabecera('Kilometros:'); 502 removeCabecera('Kilometros:');
425 $scope.remito.fob = false; 503 $scope.remito.fob = false;
426 $scope.remito.bomba = false; 504 $scope.remito.bomba = false;
427 $scope.remito.kilometros = null; 505 $scope.remito.kilometros = null;
428 } 506 }
429 }, function() { 507 }, function() {
430 508
431 } 509 }
432 ); 510 );
433 }; 511 };
434 512
435 $scope.abrirModalMoneda = function() { 513 $scope.abrirModalMoneda = function() {
436 var modalInstance = $uibModal.open( 514 var modalInstance = $uibModal.open(
437 { 515 {
438 ariaLabelledBy: 'Busqueda de Moneda', 516 ariaLabelledBy: 'Busqueda de Moneda',
439 templateUrl: 'modal-moneda.html', 517 templateUrl: 'modal-moneda.html',
440 controller: 'focaModalMonedaController', 518 controller: 'focaModalMonedaController',
441 size: 'lg' 519 size: 'lg'
442 } 520 }
443 ); 521 );
444 modalInstance.result.then( 522 modalInstance.result.then(
445 function(moneda) { 523 function(moneda) {
446 $scope.abrirModalCotizacion(moneda); 524 $scope.abrirModalCotizacion(moneda);
447 }, function() { 525 }, function() {
448 526
449 } 527 }
450 ); 528 );
451 }; 529 };
452 530
453 $scope.abrirModalCotizacion = function(moneda) { 531 $scope.abrirModalCotizacion = function(moneda) {
454 var modalInstance = $uibModal.open( 532 var modalInstance = $uibModal.open(
455 { 533 {
456 ariaLabelledBy: 'Busqueda de Cotización', 534 ariaLabelledBy: 'Busqueda de Cotización',
457 templateUrl: 'modal-cotizacion.html', 535 templateUrl: 'modal-cotizacion.html',
458 controller: 'focaModalCotizacionController', 536 controller: 'focaModalCotizacionController',
459 size: 'lg', 537 size: 'lg',
460 resolve: {idMoneda: function() {return moneda.ID;}} 538 resolve: {idMoneda: function() {return moneda.ID;}}
461 } 539 }
462 ); 540 );
463 modalInstance.result.then( 541 modalInstance.result.then(
464 function(cotizacion) { 542 function(cotizacion) {
465 var articulosTablaTemp = $scope.articulosTabla; 543 var articulosTablaTemp = $scope.articulosTabla;
466 for(var i = 0; i < articulosTablaTemp.length; i++) { 544 for(var i = 0; i < articulosTablaTemp.length; i++) {
467 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 545 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
468 $scope.remito.cotizacion.COTIZACION; 546 $scope.remito.cotizacion.COTIZACION;
469 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 547 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
470 cotizacion.COTIZACION; 548 cotizacion.COTIZACION;
471 } 549 }
472 $scope.articulosTabla = articulosTablaTemp; 550 $scope.articulosTabla = articulosTablaTemp;
473 $scope.remito.moneda = { 551 $scope.remito.moneda = {
474 id: moneda.ID, 552 id: moneda.ID,
475 detalle: moneda.DETALLE, 553 detalle: moneda.DETALLE,
476 simbolo: moneda.SIMBOLO 554 simbolo: moneda.SIMBOLO
477 }; 555 };
478 $scope.remito.cotizacion = { 556 $scope.remito.cotizacion = {
479 ID: cotizacion.ID, 557 ID: cotizacion.ID,
480 COTIZACION: cotizacion.COTIZACION, 558 COTIZACION: cotizacion.COTIZACION,
481 FECHA: cotizacion.FECHA 559 FECHA: cotizacion.FECHA
482 }; 560 };
483 addCabecera('Moneda:', moneda.DETALLE); 561 addCabecera('Moneda:', moneda.DETALLE);
484 addCabecera( 562 addCabecera(
485 'Fecha cotizacion:', 563 'Fecha cotizacion:',
486 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 564 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
487 ); 565 );
488 addCabecera('Cotizacion:', cotizacion.COTIZACION); 566 addCabecera('Cotizacion:', cotizacion.COTIZACION);
489 }, function() { 567 }, function() {
490 568
491 } 569 }
492 ); 570 );
493 }; 571 };
494 572
495 $scope.agregarATabla = function(key) { 573 $scope.agregarATabla = function(key) {
496 if(key === 13) { 574 if(key === 13) {
497 if($scope.articuloACargar.cantidad === undefined || 575 if($scope.articuloACargar.cantidad === undefined ||
498 $scope.articuloACargar.cantidad === 0 || 576 $scope.articuloACargar.cantidad === 0 ||
499 $scope.articuloACargar.cantidad === null ){ 577 $scope.articuloACargar.cantidad === null ){
500 focaModalService.alert('El valor debe ser al menos 1'); 578 focaModalService.alert('El valor debe ser al menos 1');
501 return; 579 return;
502 } 580 }
503 delete $scope.articuloACargar.sectorCodigo; 581 delete $scope.articuloACargar.sectorCodigo;
504 $scope.articulosTabla.push($scope.articuloACargar); 582 $scope.articulosTabla.push($scope.articuloACargar);
505 $scope.cargando = true; 583 $scope.cargando = true;
506 } 584 }
507 }; 585 };
508 586
509 $scope.quitarArticulo = function(key) { 587 $scope.quitarArticulo = function(key) {
510 $scope.articulosTabla.splice(key, 1); 588 $scope.articulosTabla.splice(key, 1);
511 }; 589 };
512 590
513 $scope.editarArticulo = function(key, articulo) { 591 $scope.editarArticulo = function(key, articulo) {
514 if(key === 13) { 592 if(key === 13) {
515 if(articulo.cantidad === null || articulo.cantidad === 0 || 593 if(articulo.cantidad === null || articulo.cantidad === 0 ||
516 articulo.cantidad === undefined){ 594 articulo.cantidad === undefined){
517 focaModalService.alert('El valor debe ser al menos 1'); 595 focaModalService.alert('El valor debe ser al menos 1');
518 return; 596 return;
519 } 597 }
520 articulo.editCantidad = false; 598 articulo.editCantidad = false;
521 articulo.editPrecio = false; 599 articulo.editPrecio = false;
522 } 600 }
523 }; 601 };
524 602
525 $scope.cambioEdit = function(articulo, propiedad) { 603 $scope.cambioEdit = function(articulo, propiedad) {
526 if(propiedad === 'cantidad') { 604 if(propiedad === 'cantidad') {
527 articulo.editCantidad = true; 605 articulo.editCantidad = true;
528 } else if(propiedad === 'precio') { 606 } else if(propiedad === 'precio') {
529 articulo.editPrecio = true; 607 articulo.editPrecio = true;
530 } 608 }
531 }; 609 };
532 610
533 $scope.limpiarFlete = function() { 611 $scope.limpiarFlete = function() {
534 $scope.remito.fleteNombre = ''; 612 $scope.remito.fleteNombre = '';
535 $scope.remito.chofer = ''; 613 $scope.remito.chofer = '';
536 $scope.remito.vehiculo = ''; 614 $scope.remito.vehiculo = '';
537 $scope.remito.kilometros = ''; 615 $scope.remito.kilometros = '';
538 $scope.remito.costoUnitarioKmFlete = ''; 616 $scope.remito.costoUnitarioKmFlete = '';
539 $scope.choferes = ''; 617 $scope.choferes = '';
540 $scope.vehiculos = ''; 618 $scope.vehiculos = '';
541 }; 619 };
542 620
543 $scope.limpiarPantalla = function() { 621 $scope.limpiarPantalla = function() {
544 $scope.limpiarFlete(); 622 $scope.limpiarFlete();
545 $scope.remito.flete = '0'; 623 $scope.remito.flete = '0';
546 $scope.remito.bomba = '0'; 624 $scope.remito.bomba = '0';
547 $scope.remito.precioCondicion = ''; 625 $scope.remito.precioCondicion = '';
548 $scope.articulosTabla = []; 626 $scope.articulosTabla = [];
549 $scope.remito.vendedor.nombre = ''; 627 $scope.remito.vendedor.nombre = '';
550 $scope.remito.cliente = {nombre: ''}; 628 $scope.remito.cliente = {nombre: ''};
551 $scope.remito.domicilio = {dom: ''}; 629 $scope.remito.domicilio = {dom: ''};
552 $scope.domiciliosCliente = []; 630 $scope.domiciliosCliente = [];
553 }; 631 };
554 632
555 $scope.resetFilter = function() { 633 $scope.resetFilter = function() {
556 $scope.articuloACargar = {}; 634 $scope.articuloACargar = {};
557 $scope.cargando = true; 635 $scope.cargando = true;
558 }; 636 };
559 637
560 $scope.selectFocus = function($event) { 638 $scope.selectFocus = function($event) {
561 $event.target.select(); 639 $event.target.select();
562 }; 640 };
563 641
564 $scope.salir = function() { 642 $scope.salir = function() {
565 $location.path('/'); 643 $location.path('/');
566 }; 644 };
567 645
568 function addCabecera(label, valor) { 646 function addCabecera(label, valor) {
569 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 647 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
570 if(propiedad.length === 1) { 648 if(propiedad.length === 1) {
571 propiedad[0].valor = valor; 649 propiedad[0].valor = valor;
572 } else { 650 } else {
573 $scope.cabecera.push({label: label, valor: valor}); 651 $scope.cabecera.push({label: label, valor: valor});
574 } 652 }
575 } 653 }
576 654
577 function removeCabecera(label) { 655 function removeCabecera(label) {
578 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 656 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
579 if(propiedad.length === 1){ 657 if(propiedad.length === 1){
580 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 658 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
581 } 659 }
582 } 660 }
583 } 661 }
584 ] 662 ]
585 ) 663 )
586 .controller('remitoListaCtrl', [ 664 .controller('remitoListaCtrl', [
587 '$scope', 665 '$scope',
588 'crearRemitoService', 666 'crearRemitoService',
589 '$location', 667 '$location',
590 function($scope, crearRemitoService, $location) { 668 function($scope, crearRemitoService, $location) {
591 crearRemitoService.obtenerRemito().then(function(datos) { 669 crearRemitoService.obtenerRemito().then(function(datos) {
592 $scope.remitos = datos.data; 670 $scope.remitos = datos.data;
593 }); 671 });
594 $scope.editar = function(remito) { 672 $scope.editar = function(remito) {
595 crearRemitoService.setRemito(remito); 673 crearRemitoService.setRemito(remito);
596 $location.path('/venta-nota-remito/abm/'); 674 $location.path('/venta-nota-remito/abm/');
597 }; 675 };
598 $scope.crearRemito = function() { 676 $scope.crearRemito = function() {
599 crearRemitoService.clearRemito(); 677 crearRemitoService.clearRemito();
600 $location.path('/venta-nota-remito/abm/'); 678 $location.path('/venta-nota-remito/abm/');
601 }; 679 };
602 } 680 }
603 ]) 681 ])
604 .controller('focaCrearRemitoFichaClienteController', [ 682 .controller('focaCrearRemitoFichaClienteController', [
605 '$scope', 683 '$scope',
606 'crearRemitoService', 684 'crearRemitoService',
607 '$location', 685 '$location',
608 function($scope, crearRemitoService, $location) { 686 function($scope, crearRemitoService, $location) {
609 crearRemitoService.obtenerRemito().then(function(datos) { 687 crearRemitoService.obtenerRemito().then(function(datos) {
610 $scope.remitos = datos.data; 688 $scope.remitos = datos.data;
611 }); 689 });
612 $scope.editar = function(remito) { 690 $scope.editar = function(remito) {
613 crearRemitoService.setRemito(remito); 691 crearRemitoService.setRemito(remito);
614 $location.path('/venta-nota-remito/abm/'); 692 $location.path('/venta-nota-remito/abm/');
615 }; 693 };
616 $scope.crearRemito = function() { 694 $scope.crearRemito = function() {
617 crearRemitoService.clearRemito(); 695 crearRemitoService.clearRemito();
618 $location.path('/venta-nota-remito/abm/'); 696 $location.path('/venta-nota-remito/abm/');
619 }; 697 };
620 } 698 }
621 ]); 699 ]);
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