Commit dfa9935fd7a85add6468aa148422339fb9517e2d

Authored by Marcelo Puebla
1 parent a328865de5
Exists in master

Agregado seteo de imagen por defecto

Showing 1 changed file with 7 additions and 5 deletions   Show diff stats
src/js/controller.js
1 angular.module('focaCrearFactura').controller('facturaController', [ 1 angular.module('focaCrearFactura').controller('facturaController', [
2 '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', 2 '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout',
3 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', 3 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService',
4 '$localStorage', 'APP', 4 '$localStorage', 'APP',
5 function ( 5 function (
6 $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, 6 $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService,
7 crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP) { 7 crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP) {
8 8
9 config(); 9 config();
10 10
11 function config() { 11 function config() {
12 $scope.tmpCantidad = Number; 12 $scope.tmpCantidad = Number;
13 $scope.tmpPrecio = Number; 13 $scope.tmpPrecio = Number;
14 $scope.botonera = crearFacturaService.getBotonera(); 14 $scope.botonera = crearFacturaService.getBotonera();
15 $scope.botoneraProductos = []; 15 $scope.botoneraProductos = [];
16 $scope.isNumber = angular.isNumber; 16 $scope.isNumber = angular.isNumber;
17 $scope.datepickerAbierto = false; 17 $scope.datepickerAbierto = false;
18 $scope.show = false; 18 $scope.show = false;
19 $scope.cargando = true; 19 $scope.cargando = true;
20 $scope.now = new Date(); 20 $scope.now = new Date();
21 $scope.puntoVenta = rellenar(0, 4); 21 $scope.puntoVenta = rellenar(0, 4);
22 $scope.comprobante = rellenar(0, 8); 22 $scope.comprobante = rellenar(0, 8);
23 $scope.dateOptions = { 23 $scope.dateOptions = {
24 maxDate: new Date(), 24 maxDate: new Date(),
25 minDate: new Date(2010, 0, 1) 25 minDate: new Date(2010, 0, 1)
26 }; 26 };
27 $scope.cabeceras = []; 27 $scope.cabeceras = [];
28 crearFacturaService.getParametros().then(function (res) { 28 crearFacturaService.getParametros().then(function (res) {
29 29
30 var parametros = JSON.parse(res.data[0].jsonText); 30 var parametros = JSON.parse(res.data[0].jsonText);
31 31
32 if ($localStorage.factura) { 32 if ($localStorage.factura) {
33 33
34 $timeout(function () { getLSFactura(); }); 34 $timeout(function () { getLSFactura(); });
35 } else { 35 } else {
36 36
37 for (var property in parametros) { 37 for (var property in parametros) {
38 $scope.factura[property] = parametros[property]; 38 $scope.factura[property] = parametros[property];
39 $scope.inicial[property] = parametros[property]; 39 $scope.inicial[property] = parametros[property];
40 } 40 }
41 41
42 setearFactura($scope.factura); 42 setearFactura($scope.factura);
43 } 43 }
44 44
45 }); 45 });
46 46
47 //SETEO BOTONERA LATERAL 47 //SETEO BOTONERA LATERAL
48 $timeout(function () { 48 $timeout(function () {
49 focaBotoneraLateralService.showSalir(false); 49 focaBotoneraLateralService.showSalir(false);
50 focaBotoneraLateralService.showPausar(true); 50 focaBotoneraLateralService.showPausar(true);
51 focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); 51 focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago);
52 focaBotoneraLateralService.addCustomButton('Salir', salir); 52 focaBotoneraLateralService.addCustomButton('Salir', salir);
53 }); 53 });
54 54
55 init(); 55 init();
56 56
57 } 57 }
58 58
59 function init() { 59 function init() {
60 60
61 $scope.$broadcast('cleanCabecera'); 61 $scope.$broadcast('cleanCabecera');
62 62
63 $scope.factura = { 63 $scope.factura = {
64 id: 0, 64 id: 0,
65 estado: 0, 65 estado: 0,
66 vendedor: {}, 66 vendedor: {},
67 cliente: {}, 67 cliente: {},
68 proveedor: {}, 68 proveedor: {},
69 domicilio: { dom: '' }, 69 domicilio: { dom: '' },
70 moneda: {}, 70 moneda: {},
71 cotizacion: $scope.cotizacionPorDefecto || {}, 71 cotizacion: $scope.cotizacionPorDefecto || {},
72 articulosFactura: [], 72 articulosFactura: [],
73 despachos: [] 73 despachos: []
74 }; 74 };
75 75
76 $scope.factura.articulosFactura = []; 76 $scope.factura.articulosFactura = [];
77 $scope.idLista = undefined; 77 $scope.idLista = undefined;
78 78
79 crearRemitoService.getNumeroRemito().then( 79 crearRemitoService.getNumeroRemito().then(
80 function (res) { 80 function (res) {
81 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 81 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
82 $scope.comprobante = rellenar(res.data.numeroRemito, 8); 82 $scope.comprobante = rellenar(res.data.numeroRemito, 8);
83 }, 83 },
84 function (err) { 84 function (err) {
85 focaModalService.alert('La terminal no esta configurada correctamente'); 85 focaModalService.alert('La terminal no esta configurada correctamente');
86 console.info(err); 86 console.info(err);
87 } 87 }
88 ); 88 );
89 89
90 $scope.inicial = angular.copy($scope.factura); 90 $scope.inicial = angular.copy($scope.factura);
91 } 91 }
92 92
93 $scope.$watch('factura', function (newValue) { 93 $scope.$watch('factura', function (newValue) {
94 focaBotoneraLateralService.setPausarData({ 94 focaBotoneraLateralService.setPausarData({
95 label: 'factura', 95 label: 'factura',
96 val: newValue 96 val: newValue
97 }); 97 });
98 }, true); 98 }, true);
99 99
100 $scope.seleccionarFormaDePago = function () { 100 $scope.seleccionarFormaDePago = function () {
101 if (!validarGuardar()) return; 101 if (!validarGuardar()) return;
102 var modalInstance = $uibModal.open( 102 var modalInstance = $uibModal.open(
103 { 103 {
104 templateUrl: 'modal-forma-pago.html', 104 templateUrl: 'modal-forma-pago.html',
105 controller: 'focaModalFormaPagoController', 105 controller: 'focaModalFormaPagoController',
106 resolve: { 106 resolve: {
107 parametros: function () { 107 parametros: function () {
108 return { 108 return {
109 importe: $scope.getTotal() 109 importe: $scope.getTotal()
110 }; 110 };
111 }, 111 },
112 }, 112 },
113 size: 'lg', 113 size: 'lg',
114 } 114 }
115 ); 115 );
116 modalInstance.result 116 modalInstance.result
117 .then(function (data) { 117 .then(function (data) {
118 118
119 $scope.crearFactura(data); 119 $scope.crearFactura(data);
120 }) 120 })
121 .catch(function (e) { console.error(e); }); 121 .catch(function (e) { console.error(e); });
122 }; 122 };
123 123
124 $scope.crearFactura = function (formaPago) { 124 $scope.crearFactura = function (formaPago) {
125 125
126 var save = { 126 var save = {
127 factura: { 127 factura: {
128 128
129 BONIF: 0, 129 BONIF: 0,
130 CLI: $scope.factura.cliente.cod, 130 CLI: $scope.factura.cliente.cod,
131 CUI: $scope.factura.cliente.cuit, 131 CUI: $scope.factura.cliente.cuit,
132 CTA: $scope.factura.cliente.cod, 132 CTA: $scope.factura.cliente.cod,
133 DC1: '', 133 DC1: '',
134 DC2: '', 134 DC2: '',
135 DE1: '', 135 DE1: '',
136 DOM: $scope.factura.cliente.DOM, 136 DOM: $scope.factura.cliente.DOM,
137 FACAUT: 0, 137 FACAUT: 0,
138 DTO: 0, 138 DTO: 0,
139 FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), 139 FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'),
140 FEC_ANT: '19000101', 140 FEC_ANT: '19000101',
141 FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente 141 FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente
142 IDEXCEPCION: 0, 142 IDEXCEPCION: 0,
143 IDLP: $scope.factura.cliente.mod.trim() || 0, 143 IDLP: $scope.factura.cliente.mod.trim() || 0,
144 IDPERSONERIA: 0, 144 IDPERSONERIA: 0,
145 IMI: 0, // TODO 145 IMI: 0, // TODO
146 IMI2: 0, // TODO 146 IMI2: 0, // TODO
147 IMI3: 0, // TODO 147 IMI3: 0, // TODO
148 IMP_LEY: 0, 148 IMP_LEY: 0,
149 IRI: 0, // TODO 149 IRI: 0, // TODO
150 IRS: 0, 150 IRS: 0,
151 LEG: '', 151 LEG: '',
152 LUG: $scope.factura.vendedor.LugVen, 152 LUG: $scope.factura.vendedor.LugVen,
153 MK_M: 0, 153 MK_M: 0,
154 NEE: 0, // TODO 154 NEE: 0, // TODO
155 NET: 0, // TODO 155 NET: 0, // TODO
156 NFI: '', 156 NFI: '',
157 NNP: 0, 157 NNP: 0,
158 NOM: $scope.factura.cliente.nom, 158 NOM: $scope.factura.cliente.nom,
159 OPE: $scope.factura.vendedor.CodVen, 159 OPE: $scope.factura.vendedor.CodVen,
160 PAG: $scope.getTotal(), 160 PAG: $scope.getTotal(),
161 PER: 0, 161 PER: 0,
162 PER_IVA: 0, 162 PER_IVA: 0,
163 PLA: $scope.factura.vendedor.NplVen, 163 PLA: $scope.factura.vendedor.NplVen,
164 PRO: '', 164 PRO: '',
165 REC_ANT: 0, 165 REC_ANT: 0,
166 SUC: parseInt($scope.puntoVenta), 166 SUC: parseInt($scope.puntoVenta),
167 TCA: 1, 167 TCA: 1,
168 TCO: 'FT', 168 TCO: 'FT',
169 TFI: '', 169 TFI: '',
170 TIP: $scope.factura.cliente.tipoFactura, 170 TIP: $scope.factura.cliente.tipoFactura,
171 TIV: 0, // TODO 171 TIV: 0, // TODO
172 TOT: $scope.getTotal(), 172 TOT: $scope.getTotal(),
173 TUR: 0, // TODO 173 TUR: 0, // TODO
174 VEN: $scope.factura.vendedor.CodVen, 174 VEN: $scope.factura.vendedor.CodVen,
175 VTO_CLI: '', 175 VTO_CLI: '',
176 ZON: 1, // TODO 176 ZON: 1, // TODO
177 OBSERVACIONES: $scope.factura.observaciones 177 OBSERVACIONES: $scope.factura.observaciones
178 }, 178 },
179 cuerpo: $scope.articulosFiltro(), 179 cuerpo: $scope.articulosFiltro(),
180 despachos: $scope.factura.despachos, 180 despachos: $scope.factura.despachos,
181 formaPago: formaPago 181 formaPago: formaPago
182 }; 182 };
183 183
184 crearFacturaService.guardarFactura(save).then(function (res) { 184 crearFacturaService.guardarFactura(save).then(function (res) {
185 185
186 focaBotoneraLateralService.endGuardar(true); 186 focaBotoneraLateralService.endGuardar(true);
187 187
188 focaModalService.alert('Comprobante guardado con éxito'); 188 focaModalService.alert('Comprobante guardado con éxito');
189 189
190 config(); 190 config();
191 191
192 }).catch(function (err) { 192 }).catch(function (err) {
193 focaModalService.alert('Hubo un error al guardar la factura'); 193 focaModalService.alert('Hubo un error al guardar la factura');
194 console.error(err); 194 console.error(err);
195 }); 195 });
196 196
197 }; 197 };
198 198
199 $scope.seleccionarCliente = function () { 199 $scope.seleccionarCliente = function () {
200 200
201 var modalInstance = $uibModal.open( 201 var modalInstance = $uibModal.open(
202 { 202 {
203 ariaLabelledBy: 'Busqueda de Cliente', 203 ariaLabelledBy: 'Busqueda de Cliente',
204 templateUrl: 'foca-busqueda-cliente-modal.html', 204 templateUrl: 'foca-busqueda-cliente-modal.html',
205 controller: 'focaBusquedaClienteModalController', 205 controller: 'focaBusquedaClienteModalController',
206 resolve: { 206 resolve: {
207 vendedor: function () { return null; }, 207 vendedor: function () { return null; },
208 cobrador: function () { return null; } 208 cobrador: function () { return null; }
209 }, 209 },
210 size: 'lg' 210 size: 'lg'
211 } 211 }
212 ); 212 );
213 modalInstance.result.then( 213 modalInstance.result.then(
214 function (cliente) { 214 function (cliente) {
215 var modalInstance = $uibModal.open( 215 var modalInstance = $uibModal.open(
216 { 216 {
217 templateUrl: 'modal-estado-cuenta.html', 217 templateUrl: 'modal-estado-cuenta.html',
218 controller: 'focaModalEstadoCuentaController', 218 controller: 'focaModalEstadoCuentaController',
219 size: 'lg', 219 size: 'lg',
220 resolve: { 220 resolve: {
221 parametros: function () { return { idCliente: cliente.cod }; }, 221 parametros: function () { return { idCliente: cliente.cod }; },
222 } 222 }
223 } 223 }
224 ); 224 );
225 modalInstance.result 225 modalInstance.result
226 .then(function (data) { 226 .then(function (data) {
227 227
228 $scope.factura.cliente = cliente; 228 $scope.factura.cliente = cliente;
229 229
230 $scope.$broadcast('addCabecera', { 230 $scope.$broadcast('addCabecera', {
231 label: 'Cliente:', 231 label: 'Cliente:',
232 valor: $filter('rellenarDigitos')(cliente.cod, 3) + 232 valor: $filter('rellenarDigitos')(cliente.cod, 3) +
233 ' - ' + cliente.nom 233 ' - ' + cliente.nom
234 }); 234 });
235 235
236 $filter('filter')($scope.botonera, 236 $filter('filter')($scope.botonera,
237 { label: 'Cliente' })[0].checked = true; 237 { label: 'Cliente' })[0].checked = true;
238 238
239 $scope.$broadcast('addCabecera', { 239 $scope.$broadcast('addCabecera', {
240 label: 'Tipo de pago: ', 240 label: 'Tipo de pago: ',
241 valor: data 241 valor: data
242 }); 242 });
243 }) 243 })
244 .catch(function () { 244 .catch(function () {
245 245
246 $scope.seleccionarCliente(); 246 $scope.seleccionarCliente();
247 }); 247 });
248 248
249 }, function () { 249 }, function () {
250 } 250 }
251 ); 251 );
252 252
253 }; 253 };
254 254
255 $scope.seleccionarVendedor = function () { 255 $scope.seleccionarVendedor = function () {
256 var parametrosModal = { 256 var parametrosModal = {
257 titulo: 'Búsqueda vendedores', 257 titulo: 'Búsqueda vendedores',
258 query: '/vendedor-playa', 258 query: '/vendedor-playa',
259 columnas: [ 259 columnas: [
260 { 260 {
261 propiedad: 'CodVen', 261 propiedad: 'CodVen',
262 nombre: 'Código', 262 nombre: 'Código',
263 filtro: { 263 filtro: {
264 nombre: 'rellenarDigitos', 264 nombre: 'rellenarDigitos',
265 parametro: 3 265 parametro: 3
266 } 266 }
267 }, 267 },
268 { 268 {
269 propiedad: 'NomVen', 269 propiedad: 'NomVen',
270 nombre: 'Nombre' 270 nombre: 'Nombre'
271 } 271 }
272 ], 272 ],
273 size: 'md' 273 size: 'md'
274 }; 274 };
275 focaModalService.modal(parametrosModal).then( 275 focaModalService.modal(parametrosModal).then(
276 function (vendedor) { 276 function (vendedor) {
277 277
278 indicarPassword(vendedor) 278 indicarPassword(vendedor)
279 .then(function () { 279 .then(function () {
280 validarPlanillaVendedor(vendedor) 280 validarPlanillaVendedor(vendedor)
281 .then(function () { 281 .then(function () {
282 282
283 $filter('filter')($scope.botonera, { 283 $filter('filter')($scope.botonera, {
284 label: 'Vendedor' 284 label: 'Vendedor'
285 })[0].checked = true; 285 })[0].checked = true;
286 286
287 $scope.$broadcast('addCabecera', { 287 $scope.$broadcast('addCabecera', {
288 label: 'Vendedor:', 288 label: 'Vendedor:',
289 valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + 289 valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) +
290 ' - ' + 290 ' - ' +
291 vendedor.NomVen 291 vendedor.NomVen
292 }); 292 });
293 293
294 $scope.factura.vendedor = vendedor; 294 $scope.factura.vendedor = vendedor;
295 295
296 getProductosByPlanilla(vendedor.NplVen); 296 getProductosByPlanilla(vendedor.NplVen);
297 }) 297 })
298 .catch($scope.seleccionarVendedor); 298 .catch($scope.seleccionarVendedor);
299 }) 299 })
300 .catch(function (err) { 300 .catch(function (err) {
301 console.error(err); 301 console.error(err);
302 }); 302 });
303 303
304 }, function () { } 304 }, function () { }
305 ); 305 );
306 }; 306 };
307 307
308 $scope.seleccionarMoneda = function () { 308 $scope.seleccionarMoneda = function () {
309 309
310 var parametrosModal = { 310 var parametrosModal = {
311 titulo: 'Búsqueda de monedas', 311 titulo: 'Búsqueda de monedas',
312 query: '/moneda', 312 query: '/moneda',
313 columnas: [ 313 columnas: [
314 { 314 {
315 propiedad: 'DETALLE', 315 propiedad: 'DETALLE',
316 nombre: 'Nombre' 316 nombre: 'Nombre'
317 }, 317 },
318 { 318 {
319 propiedad: 'SIMBOLO', 319 propiedad: 'SIMBOLO',
320 nombre: 'Símbolo' 320 nombre: 'Símbolo'
321 } 321 }
322 ], 322 ],
323 size: 'md' 323 size: 'md'
324 }; 324 };
325 focaModalService.modal(parametrosModal).then( 325 focaModalService.modal(parametrosModal).then(
326 function (moneda) { 326 function (moneda) {
327 327
328 if (moneda.ID !== 1) { 328 if (moneda.ID !== 1) {
329 $scope.abrirModalCotizacion(moneda); 329 $scope.abrirModalCotizacion(moneda);
330 return; 330 return;
331 } 331 }
332 332
333 crearRemitoService.getCotizacionByIdMoneda(1) 333 crearRemitoService.getCotizacionByIdMoneda(1)
334 .then(function (res) { 334 .then(function (res) {
335 335
336 var cotizacionPArgentino = res.data[0].cotizaciones[0]; 336 var cotizacionPArgentino = res.data[0].cotizaciones[0];
337 cotizacionPArgentino.moneda = moneda; 337 cotizacionPArgentino.moneda = moneda;
338 338
339 actualizarCabeceraMoneda(cotizacionPArgentino); 339 actualizarCabeceraMoneda(cotizacionPArgentino);
340 340
341 $scope.remito.cotizacion = cotizacionPArgentino; 341 $scope.remito.cotizacion = cotizacionPArgentino;
342 }); 342 });
343 }, function () { 343 }, function () {
344 344
345 } 345 }
346 ); 346 );
347 }; 347 };
348 348
349 $scope.abrirModalCotizacion = function (moneda) { 349 $scope.abrirModalCotizacion = function (moneda) {
350 var modalInstance = $uibModal.open( 350 var modalInstance = $uibModal.open(
351 { 351 {
352 ariaLabelledBy: 'Busqueda de Cotización', 352 ariaLabelledBy: 'Busqueda de Cotización',
353 templateUrl: 'modal-cotizacion.html', 353 templateUrl: 'modal-cotizacion.html',
354 controller: 'focaModalCotizacionController', 354 controller: 'focaModalCotizacionController',
355 size: 'lg', 355 size: 'lg',
356 resolve: { idMoneda: function () { return moneda.ID; } } 356 resolve: { idMoneda: function () { return moneda.ID; } }
357 } 357 }
358 ); 358 );
359 modalInstance.result.then( 359 modalInstance.result.then(
360 function (cotizacion) { 360 function (cotizacion) {
361 361
362 cotizacion.moneda = moneda; 362 cotizacion.moneda = moneda;
363 actualizarCabeceraMoneda(cotizacion); 363 actualizarCabeceraMoneda(cotizacion);
364 $scope.factura.cotizacion = cotizacion; 364 $scope.factura.cotizacion = cotizacion;
365 365
366 }, function () { 366 }, function () {
367 367
368 } 368 }
369 ); 369 );
370 }; 370 };
371 371
372 $scope.seleccionarObservaciones = function () { 372 $scope.seleccionarObservaciones = function () {
373 var observacion = { 373 var observacion = {
374 titulo: 'Ingrese Observaciones', 374 titulo: 'Ingrese Observaciones',
375 value: $scope.factura.observaciones, 375 value: $scope.factura.observaciones,
376 maxlength: 155, 376 maxlength: 155,
377 textarea: true 377 textarea: true
378 }; 378 };
379 379
380 focaModalService 380 focaModalService
381 .prompt(observacion) 381 .prompt(observacion)
382 .then(function (observaciones) { 382 .then(function (observaciones) {
383 $scope.factura.observaciones = observaciones; 383 $scope.factura.observaciones = observaciones;
384 }); 384 });
385 }; 385 };
386 386
387 $scope.articulosFiltro = function () { 387 $scope.articulosFiltro = function () {
388 return $scope.factura.articulosFactura.filter(function (articulo) { 388 return $scope.factura.articulosFactura.filter(function (articulo) {
389 return !articulo.desactivado; 389 return !articulo.desactivado;
390 }); 390 });
391 }; 391 };
392 392
393 $scope.getTotal = function () { 393 $scope.getTotal = function () {
394 394
395 var total = 0; 395 var total = 0;
396 396
397 $scope.articulosFiltro().forEach(function (articulo) { 397 $scope.articulosFiltro().forEach(function (articulo) {
398 total += articulo.PUN * articulo.CAN; 398 total += articulo.PUN * articulo.CAN;
399 }); 399 });
400 400
401 return parseFloat(total.toFixed(2)); 401 return parseFloat(total.toFixed(2));
402 }; 402 };
403 403
404 $scope.quitarDespacho = function (articulo, index) { 404 $scope.quitarDespacho = function (articulo, index) {
405 405
406 crearFacturaService 406 crearFacturaService
407 .setearDespachoDesocupado({ 407 .setearDespachoDesocupado({
408 surtidor: $scope.factura.despachos[index].SUR, 408 surtidor: $scope.factura.despachos[index].SUR,
409 producto: $scope.factura.despachos[index].PRO, 409 producto: $scope.factura.despachos[index].PRO,
410 carga: $scope.factura.despachos[index].CAR, 410 carga: $scope.factura.despachos[index].CAR,
411 planilla: $scope.factura.despachos[index].PLA 411 planilla: $scope.factura.despachos[index].PLA
412 }) 412 })
413 .then(function () { 413 .then(function () {
414 articulo.desactivado = true; 414 articulo.desactivado = true;
415 $scope.factura.despachos.splice(index, 1); 415 $scope.factura.despachos.splice(index, 1);
416 }) 416 })
417 .catch(function () { 417 .catch(function () {
418 focaModalService.alert('Hubo un error al desasociar este despacho'); 418 focaModalService.alert('Hubo un error al desasociar este despacho');
419 }); 419 });
420 }; 420 };
421 421
422 function getProductosByPlanilla(numeroPlanilla) { 422 function getProductosByPlanilla(numeroPlanilla) {
423 423
424 crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { 424 crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) {
425 $scope.botoneraProductos.length = 0; 425 $scope.botoneraProductos.length = 0;
426 res.data.forEach(function (producto) { 426 res.data.forEach(function (producto) {
427 427
428 $scope.botoneraProductos.push({ 428 $scope.botoneraProductos.push({
429 label: producto.DetArt, 429 label: producto.DetArt,
430 image: 'buscarProductos.png' 430 image: producto.nombreImagen,
431 imageDefault: 'productoDefault.png'
431 }); 432 });
432 433
433 434
434 crearFuncionesProductos(producto); 435 crearFuncionesProductos(producto);
435 436
436 }); 437 });
437 $scope.botoneraProductos.push({ 438 $scope.botoneraProductos.push({
438 label: 'Busqueda Productos', 439 label: 'Busqueda Productos',
439 image: 'buscarProductos.png' 440 image: 'buscarProductos.png',
441 imageDefault: 'productoDefault.png'
440 }); 442 });
441 }); 443 });
442 } 444 }
443 445
444 $scope.seleccionarBusquedaProductos = function () { 446 $scope.seleccionarBusquedaProductos = function () {
445 447
446 var modalInstance = $uibModal.open( 448 var modalInstance = $uibModal.open(
447 { 449 {
448 ariaLabelledBy: 'Busqueda de Productos', 450 ariaLabelledBy: 'Busqueda de Productos',
449 templateUrl: 'modal-busqueda-productos.html', 451 templateUrl: 'modal-busqueda-productos.html',
450 controller: 'modalBusquedaProductosCtrl', 452 controller: 'modalBusquedaProductosCtrl',
451 resolve: { 453 resolve: {
452 parametroProducto: { 454 parametroProducto: {
453 idLista: null, 455 idLista: null,
454 cotizacion: $scope.factura.cotizacion.VENDEDOR, 456 cotizacion: $scope.factura.cotizacion.VENDEDOR,
455 simbolo: $scope.factura.cotizacion.moneda.SIMBOLO, 457 simbolo: $scope.factura.cotizacion.moneda.SIMBOLO,
456 buscarTodos: true 458 buscarTodos: true
457 } 459 }
458 }, 460 },
459 size: 'lg' 461 size: 'lg'
460 } 462 }
461 ); 463 );
462 464
463 modalInstance.result 465 modalInstance.result
464 .then(function (producto) { 466 .then(function (producto) {
465 467
466 var articulo = { 468 var articulo = {
467 TIP: $scope.factura.cliente.tipoFactura, 469 TIP: $scope.factura.cliente.tipoFactura,
468 TCO: 'FT', 470 TCO: 'FT',
469 SUC: parseInt($scope.puntoVenta), 471 SUC: parseInt($scope.puntoVenta),
470 ORD: $scope.articulosFiltro().length + 1, 472 ORD: $scope.articulosFiltro().length + 1,
471 SEC: producto.sector, 473 SEC: producto.sector,
472 ART: producto.codigo, 474 ART: producto.codigo,
473 RUB: producto.CodRub, 475 RUB: producto.CodRub,
474 DES: producto.descripcionLarga, 476 DES: producto.descripcionLarga,
475 PUN: producto.precio, // TODO 477 PUN: producto.precio, // TODO
476 IVA: producto.IMPIVA, // TODO 478 IVA: producto.IMPIVA, // TODO
477 NET: 0, // TODO 479 NET: 0, // TODO
478 NEX: 0, // TODO 480 NEX: 0, // TODO
479 IMI: producto.ImpInt, // TODO 481 IMI: producto.ImpInt, // TODO
480 IMI2: producto.ImpInt2, // TODO 482 IMI2: producto.ImpInt2, // TODO
481 IMI3: producto.ImpInt3, // TODO 483 IMI3: producto.ImpInt3, // TODO
482 PUT: producto.PreNet, // TODO 484 PUT: producto.PreNet, // TODO
483 SUR: 0, 485 SUR: 0,
484 PLA: $scope.factura.vendedor.NplVen, 486 PLA: $scope.factura.vendedor.NplVen,
485 LUG: $scope.factura.vendedor.LugVen, 487 LUG: $scope.factura.vendedor.LugVen,
486 LEG: $scope.factura.vendedor.CodVen, 488 LEG: $scope.factura.vendedor.CodVen,
487 TUR: $scope.factura.vendedor.TurVen, 489 TUR: $scope.factura.vendedor.TurVen,
488 ORDEN_PRECOMPRA: '', 490 ORDEN_PRECOMPRA: '',
489 ESC: producto.tipoFactura === 'L' ? 1 : 0, 491 ESC: producto.tipoFactura === 'L' ? 1 : 0,
490 CMF: 0, 492 CMF: 0,
491 PTA: 0, 493 PTA: 0,
492 IVS: 0, 494 IVS: 0,
493 TIVA: 0, 495 TIVA: 0,
494 CON: 0, 496 CON: 0,
495 SINO: '', 497 SINO: '',
496 ORD_TRA: 0, 498 ORD_TRA: 0,
497 IMP_DESP: 0, 499 IMP_DESP: 0,
498 PCD: 0, 500 PCD: 0,
499 RTO: '' 501 RTO: ''
500 }; 502 };
501 // crearFacturaService.setearDespachoOcupado({ 503 // crearFacturaService.setearDespachoOcupado({
502 // surtidor: articulo.SUR, 504 // surtidor: articulo.SUR,
503 // producto: articulo.PRO, 505 // producto: articulo.PRO,
504 // carga: articulo.CAR 506 // carga: articulo.CAR
505 // }) 507 // })
506 // .then(function () { 508 // .then(function () {
507 $scope.factura.articulosFactura.push(articulo); 509 $scope.factura.articulosFactura.push(articulo);
508 $scope.cambioEdit(articulo, 'cantidad'); 510 $scope.cambioEdit(articulo, 'cantidad');
509 // }) 511 // })
510 // .catch(function (err) { 512 // .catch(function (err) {
511 513
512 // focaModalService.alert('El despacho esta en uso'); 514 // focaModalService.alert('El despacho esta en uso');
513 // }); 515 // });
514 }) 516 })
515 .catch(function (e) { console.error(e); }); 517 .catch(function (e) { console.error(e); });
516 }; 518 };
517 519
518 function crearFuncionesProductos(producto) { 520 function crearFuncionesProductos(producto) {
519 521
520 $scope[nombreFuncion(producto.DetArt)] = function () { 522 $scope[nombreFuncion(producto.DetArt)] = function () {
521 523
522 if (angular.equals($scope.factura.cliente, {})) { 524 if (angular.equals($scope.factura.cliente, {})) {
523 focaModalService.alert('Seleccione cliente'); 525 focaModalService.alert('Seleccione cliente');
524 return; 526 return;
525 } 527 }
526 528
527 var modalInstance = $uibModal.open( 529 var modalInstance = $uibModal.open(
528 { 530 {
529 templateUrl: 'modal-combustibles.html', 531 templateUrl: 'modal-combustibles.html',
530 controller: 'focaModalCombustiblesController', 532 controller: 'focaModalCombustiblesController',
531 resolve: { 533 resolve: {
532 parametros: function () { 534 parametros: function () {
533 return { 535 return {
534 despachos: producto.despachos, 536 despachos: producto.despachos,
535 nombreProducto: producto.DetArt 537 nombreProducto: producto.DetArt
536 }; 538 };
537 } 539 }
538 }, 540 },
539 size: 'md' 541 size: 'md'
540 } 542 }
541 ); 543 );
542 544
543 modalInstance.result.then(function (despacho) { 545 modalInstance.result.then(function (despacho) {
544 546
545 var articulo = { 547 var articulo = {
546 TIP: $scope.factura.cliente.tipoFactura, 548 TIP: $scope.factura.cliente.tipoFactura,
547 TCO: 'FT', 549 TCO: 'FT',
548 SUC: parseInt($scope.puntoVenta), 550 SUC: parseInt($scope.puntoVenta),
549 ORD: $scope.articulosFiltro().length + 1, 551 ORD: $scope.articulosFiltro().length + 1,
550 SEC: despacho.SEC, 552 SEC: despacho.SEC,
551 ART: despacho.PRO, 553 ART: despacho.PRO,
552 RUB: producto.CodRub, 554 RUB: producto.CodRub,
553 DES: producto.DetArt, 555 DES: producto.DetArt,
554 CAN: despacho.LTS, 556 CAN: despacho.LTS,
555 PUN: producto.PreVen, // TODO 557 PUN: producto.PreVen, // TODO
556 IVA: producto.IMPIVA, // TODO 558 IVA: producto.IMPIVA, // TODO
557 NET: 0, // TODO 559 NET: 0, // TODO
558 NEX: 0, // TODO 560 NEX: 0, // TODO
559 IMI: producto.ImpInt, // TODO 561 IMI: producto.ImpInt, // TODO
560 IMI2: producto.ImpInt2, // TODO 562 IMI2: producto.ImpInt2, // TODO
561 IMI3: producto.ImpInt3, // TODO 563 IMI3: producto.ImpInt3, // TODO
562 PUT: producto.PreNet, // TODO 564 PUT: producto.PreNet, // TODO
563 SUR: despacho.SUR, 565 SUR: despacho.SUR,
564 PLA: despacho.PLA, 566 PLA: despacho.PLA,
565 LUG: despacho.LUG, 567 LUG: despacho.LUG,
566 LEG: $scope.factura.vendedor.CodVen, 568 LEG: $scope.factura.vendedor.CodVen,
567 TUR: $scope.factura.vendedor.TurVen, 569 TUR: $scope.factura.vendedor.TurVen,
568 ORDEN_PRECOMPRA: '', 570 ORDEN_PRECOMPRA: '',
569 ESC: producto.tipoFactura === 'L' ? 1 : 0, 571 ESC: producto.tipoFactura === 'L' ? 1 : 0,
570 CMF: 0, 572 CMF: 0,
571 PTA: 0, 573 PTA: 0,
572 IVS: 0, 574 IVS: 0,
573 TIVA: 0, 575 TIVA: 0,
574 CON: 0, 576 CON: 0,
575 SINO: '', 577 SINO: '',
576 ORD_TRA: 0, 578 ORD_TRA: 0,
577 IMP_DESP: 0, 579 IMP_DESP: 0,
578 PCD: 0, 580 PCD: 0,
579 RTO: '' 581 RTO: ''
580 }; 582 };
581 583
582 crearFacturaService.setearDespachoOcupado({ 584 crearFacturaService.setearDespachoOcupado({
583 surtidor: despacho.SUR, 585 surtidor: despacho.SUR,
584 producto: despacho.PRO, 586 producto: despacho.PRO,
585 carga: despacho.CAR 587 carga: despacho.CAR
586 }) 588 })
587 .then(function () { 589 .then(function () {
588 $scope.factura.articulosFactura.push(articulo); 590 $scope.factura.articulosFactura.push(articulo);
589 $scope.factura.despachos.push(despacho); 591 $scope.factura.despachos.push(despacho);
590 }) 592 })
591 .catch(function (err) { 593 .catch(function (err) {
592 594
593 console.error(err); 595 console.error(err);
594 focaModalService.alert('El despacho esta en uso'); 596 focaModalService.alert('El despacho esta en uso');
595 }); 597 });
596 598
597 }) 599 })
598 .catch(function (err) { 600 .catch(function (err) {
599 console.error(err); 601 console.error(err);
600 }); 602 });
601 603
602 }; 604 };
603 } 605 }
604 606
605 function nombreFuncion(string) { 607 function nombreFuncion(string) {
606 var texto = 'seleccionar'; 608 var texto = 'seleccionar';
607 var arr = string.split(' '); 609 var arr = string.split(' ');
608 arr.forEach(function (palabra) { 610 arr.forEach(function (palabra) {
609 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); 611 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
610 texto += palabra; 612 texto += palabra;
611 }); 613 });
612 return texto; 614 return texto;
613 } 615 }
614 616
615 function indicarPassword(vendedor) { 617 function indicarPassword(vendedor) {
616 618
617 return new Promise(function (resolve, reject) { 619 return new Promise(function (resolve, reject) {
618 620
619 focaModalService 621 focaModalService
620 .prompt({ 622 .prompt({
621 titulo: 'Indique Contraseña', 623 titulo: 'Indique Contraseña',
622 value: '' 624 value: ''
623 }) 625 })
624 .then(function (contraseña) { 626 .then(function (contraseña) {
625 627
626 if (contraseña !== vendedor.ClaVen.trim()) { 628 if (contraseña !== vendedor.ClaVen.trim()) {
627 629
628 focaModalService.alert('Clave incorrecta').then(function () { 630 focaModalService.alert('Clave incorrecta').then(function () {
629 indicarPassword(vendedor); 631 indicarPassword(vendedor);
630 }); 632 });
631 } else { 633 } else {
632 resolve(); 634 resolve();
633 } 635 }
634 }) 636 })
635 .catch(reject); 637 .catch(reject);
636 }); 638 });
637 } 639 }
638 640
639 function validarPlanillaVendedor(vendedor) { 641 function validarPlanillaVendedor(vendedor) {
640 642
641 return new Promise(function (resolve, reject) { 643 return new Promise(function (resolve, reject) {
642 644
643 crearFacturaService 645 crearFacturaService
644 .validarPlanillaVendedor(vendedor.CodVen.trim()) 646 .validarPlanillaVendedor(vendedor.CodVen.trim())
645 .then(function (res) { 647 .then(function (res) {
646 648
647 if (!res.data.length) { 649 if (!res.data.length) {
648 650
649 focaModalService 651 focaModalService
650 .alert('No se encontró planilla abierta para el vendedor') 652 .alert('No se encontró planilla abierta para el vendedor')
651 .then(reject); 653 .then(reject);
652 654
653 } else { 655 } else {
654 resolve(); 656 resolve();
655 } 657 }
656 658
657 }) 659 })
658 .catch(reject); 660 .catch(reject);
659 }); 661 });
660 } 662 }
661 663
662 function rellenar(relleno, longitud) { 664 function rellenar(relleno, longitud) {
663 relleno = '' + relleno; 665 relleno = '' + relleno;
664 while (relleno.length < longitud) { 666 while (relleno.length < longitud) {
665 relleno = '0' + relleno; 667 relleno = '0' + relleno;
666 } 668 }
667 return relleno; 669 return relleno;
668 } 670 }
669 671
670 function salir() { 672 function salir() {
671 var confirmacion = false; 673 var confirmacion = false;
672 674
673 if (!angular.equals($scope.factura, $scope.inicial)) { 675 if (!angular.equals($scope.factura, $scope.inicial)) {
674 confirmacion = true; 676 confirmacion = true;
675 } 677 }
676 678
677 if (confirmacion) { 679 if (confirmacion) {
678 focaModalService.confirm( 680 focaModalService.confirm(
679 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 681 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
680 ).then(function (data) { 682 ).then(function (data) {
681 if (data) { 683 if (data) {
682 $location.path('/'); 684 $location.path('/');
683 } 685 }
684 }); 686 });
685 } else { 687 } else {
686 $location.path('/'); 688 $location.path('/');
687 } 689 }
688 } 690 }
689 691
690 function setearFactura(factura) { 692 function setearFactura(factura) {
691 693
692 $scope.$broadcast('cleanCabecera'); 694 $scope.$broadcast('cleanCabecera');
693 695
694 $scope.cabeceras = []; 696 $scope.cabeceras = [];
695 697
696 if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { 698 if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
697 $scope.cabeceras.push({ 699 $scope.cabeceras.push({
698 label: 'Moneda:', 700 label: 'Moneda:',
699 valor: factura.cotizacion.moneda.DETALLE 701 valor: factura.cotizacion.moneda.DETALLE
700 }); 702 });
701 $scope.cabeceras.push({ 703 $scope.cabeceras.push({
702 label: 'Fecha cotizacion:', 704 label: 'Fecha cotizacion:',
703 valor: $filter('date')(factura.cotizacion.FECHA, 705 valor: $filter('date')(factura.cotizacion.FECHA,
704 'dd/MM/yyyy') 706 'dd/MM/yyyy')
705 }); 707 });
706 $scope.cabeceras.push({ 708 $scope.cabeceras.push({
707 label: 'Cotizacion:', 709 label: 'Cotizacion:',
708 valor: $filter('number')(factura.cotizacion.VENDEDOR, 710 valor: $filter('number')(factura.cotizacion.VENDEDOR,
709 '2') 711 '2')
710 }); 712 });
711 } 713 }
712 714
713 if (factura.cotizacion && factura.cotizacion.moneda) { 715 if (factura.cotizacion && factura.cotizacion.moneda) {
714 $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; 716 $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
715 } 717 }
716 718
717 if (factura.cliente && factura.cliente.cod) { 719 if (factura.cliente && factura.cliente.cod) {
718 $scope.cabeceras.push({ 720 $scope.cabeceras.push({
719 label: 'Cliente:', 721 label: 'Cliente:',
720 valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + 722 valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' +
721 factura.cliente.nom 723 factura.cliente.nom
722 }); 724 });
723 725
724 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; 726 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
725 } 727 }
726 728
727 $scope.puntoVenta = rellenar(factura.sucursal, 4); 729 $scope.puntoVenta = rellenar(factura.sucursal, 4);
728 $scope.comprobante = rellenar(factura.numerofactura, 8); 730 $scope.comprobante = rellenar(factura.numerofactura, 8);
729 $scope.factura = factura; 731 $scope.factura = factura;
730 732
731 addArrayCabecera($scope.cabeceras); 733 addArrayCabecera($scope.cabeceras);
732 } 734 }
733 735
734 function getLSFactura() { 736 function getLSFactura() {
735 var factura = JSON.parse($localStorage.factura || null); 737 var factura = JSON.parse($localStorage.factura || null);
736 if (factura) { 738 if (factura) {
737 setearFactura(factura); 739 setearFactura(factura);
738 delete $localStorage.factura; 740 delete $localStorage.factura;
739 } 741 }
740 } 742 }
741 743
742 function addArrayCabecera(array) { 744 function addArrayCabecera(array) {
743 for (var i = 0; i < array.length; i++) { 745 for (var i = 0; i < array.length; i++) {
744 $scope.$broadcast('addCabecera', { 746 $scope.$broadcast('addCabecera', {
745 label: array[i].label, 747 label: array[i].label,
746 valor: array[i].valor 748 valor: array[i].valor
747 }); 749 });
748 } 750 }
749 } 751 }
750 752
751 $scope.cambioEdit = function (articulo, propiedad) { 753 $scope.cambioEdit = function (articulo, propiedad) {
752 if (propiedad === 'cantidad') { 754 if (propiedad === 'cantidad') {
753 articulo.editCantidad = true; 755 articulo.editCantidad = true;
754 } 756 }
755 }; 757 };
756 758
757 $scope.editarArticulo = function (key, articulo, tmpCantidad) { 759 $scope.editarArticulo = function (key, articulo, tmpCantidad) {
758 if (key === 13) { 760 if (key === 13) {
759 if (!articulo.cantidad && !tmpCantidad) { 761 if (!articulo.cantidad && !tmpCantidad) {
760 focaModalService.alert('Los valores deben ser al menos 1'); 762 focaModalService.alert('Los valores deben ser al menos 1');
761 return; 763 return;
762 } else if (tmpCantidad === '0') { 764 } else if (tmpCantidad === '0') {
763 focaModalService.alert('Esta ingresando un producto con valor 0'); 765 focaModalService.alert('Esta ingresando un producto con valor 0');
764 } else if (articulo.cantidad < 0) { 766 } else if (articulo.cantidad < 0) {
765 focaModalService.alert('Los valores no pueden ser negativos'); 767 focaModalService.alert('Los valores no pueden ser negativos');
766 return; 768 return;
767 } 769 }
768 articulo.CAN = parseInt(tmpCantidad); 770 articulo.CAN = parseInt(tmpCantidad);
769 $scope.getTotal(); 771 $scope.getTotal();
770 articulo.editCantidad = false; 772 articulo.editCantidad = false;
771 } 773 }
772 }; 774 };
773 775
774 $scope.cancelarEditar = function (articulo) { 776 $scope.cancelarEditar = function (articulo) {
775 $scope.tmpCantidad = articulo.CAN; 777 $scope.tmpCantidad = articulo.CAN;
776 articulo.editCantidad = false; 778 articulo.editCantidad = false;
777 }; 779 };
778 780
779 function actualizarCabeceraMoneda(cotizacion) { 781 function actualizarCabeceraMoneda(cotizacion) {
780 782
781 $scope.factura.articulosFactura.forEach(function (art) { 783 $scope.factura.articulosFactura.forEach(function (art) {
782 art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); 784 art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4);
783 art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); 785 art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4);
784 }); 786 });
785 787
786 if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { 788 if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') {
787 $scope.$broadcast('removeCabecera', 'Moneda:'); 789 $scope.$broadcast('removeCabecera', 'Moneda:');
788 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 790 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
789 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 791 $scope.$broadcast('removeCabecera', 'Cotizacion:');
790 } else { 792 } else {
791 $scope.$broadcast('addCabecera', { 793 $scope.$broadcast('addCabecera', {
792 label: 'Moneda:', 794 label: 'Moneda:',
793 valor: cotizacion.moneda.DETALLE 795 valor: cotizacion.moneda.DETALLE
794 }); 796 });
795 $scope.$broadcast('addCabecera', { 797 $scope.$broadcast('addCabecera', {
796 label: 'Fecha cotizacion:', 798 label: 'Fecha cotizacion:',
797 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 799 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
798 }); 800 });
799 $scope.$broadcast('addCabecera', { 801 $scope.$broadcast('addCabecera', {
800 label: 'Cotizacion:', 802 label: 'Cotizacion:',
801 valor: $filter('number')(cotizacion.VENDEDOR, '2') 803 valor: $filter('number')(cotizacion.VENDEDOR, '2')
802 }); 804 });
803 } 805 }
804 } 806 }
805 807
806 function validarGuardar() { 808 function validarGuardar() {
807 809
808 if (angular.equals({}, $scope.factura.vendedor)) { 810 if (angular.equals({}, $scope.factura.vendedor)) {
809 811
810 focaModalService.alert('Seleccione Vendedor'); 812 focaModalService.alert('Seleccione Vendedor');
811 return false; 813 return false;
812 } else if (angular.equals({}, $scope.factura.cliente)) { 814 } else if (angular.equals({}, $scope.factura.cliente)) {
813 815
814 focaModalService.alert('Seleccione Cliente'); 816 focaModalService.alert('Seleccione Cliente');
815 return false; 817 return false;
816 } else if (!$scope.articulosFiltro().length) { 818 } else if (!$scope.articulosFiltro().length) {
817 819
818 focaModalService.alert('Seleccione al menos un Articulo'); 820 focaModalService.alert('Seleccione al menos un Articulo');
819 return false; 821 return false;
820 } 822 }
821 823
822 return true; 824 return true;
823 } 825 }
824 } 826 }
825 ]); 827 ]);
826 828