Commit 6ba68ff2c6e76fec3b9b15c953f8d77084337a60

Authored by Eric
1 parent 39f02c6899
Exists in master

comprobante remito

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