Commit 3b090edbdadb3c0d57df95582a1741e19c25c856

Authored by Eric Fernandez
1 parent 59e0b69f87
Exists in master

delete articulo

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', 4 '$localStorage',
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) { 7 crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage) {
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.isNumber = angular.isNumber; 15 $scope.isNumber = angular.isNumber;
16 $scope.datepickerAbierto = false; 16 $scope.datepickerAbierto = false;
17 $scope.show = false; 17 $scope.show = false;
18 $scope.cargando = true; 18 $scope.cargando = true;
19 $scope.now = new Date(); 19 $scope.now = new Date();
20 $scope.puntoVenta = rellenar(0, 4); 20 $scope.puntoVenta = rellenar(0, 4);
21 $scope.comprobante = rellenar(0, 8); 21 $scope.comprobante = rellenar(0, 8);
22 $scope.dateOptions = { 22 $scope.dateOptions = {
23 maxDate: new Date(), 23 maxDate: new Date(),
24 minDate: new Date(2010, 0, 1) 24 minDate: new Date(2010, 0, 1)
25 }; 25 };
26 $scope.cabeceras = []; 26 $scope.cabeceras = [];
27 crearFacturaService.getParametros().then(function (res) { 27 crearFacturaService.getParametros().then(function (res) {
28 28
29 var parametros = JSON.parse(res.data[0].jsonText); 29 var parametros = JSON.parse(res.data[0].jsonText);
30 30
31 if ($localStorage.factura) { 31 if ($localStorage.factura) {
32 32
33 $timeout(function () { getLSFactura(); }); 33 $timeout(function () { getLSFactura(); });
34 } else { 34 } else {
35 35
36 for (var property in parametros) { 36 for (var property in parametros) {
37 $scope.factura[property] = parametros[property]; 37 $scope.factura[property] = parametros[property];
38 $scope.inicial[property] = parametros[property]; 38 $scope.inicial[property] = parametros[property];
39 } 39 }
40 40
41 setearFactura($scope.factura); 41 setearFactura($scope.factura);
42 } 42 }
43 43
44 }); 44 });
45 45
46 //SETEO BOTONERA LATERAL 46 //SETEO BOTONERA LATERAL
47 $timeout(function () { 47 $timeout(function () {
48 focaBotoneraLateralService.showSalir(false); 48 focaBotoneraLateralService.showSalir(false);
49 focaBotoneraLateralService.showPausar(true); 49 focaBotoneraLateralService.showPausar(true);
50 focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); 50 focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago);
51 focaBotoneraLateralService.addCustomButton('Salir', salir); 51 focaBotoneraLateralService.addCustomButton('Salir', salir);
52 }); 52 });
53 53
54 init(); 54 init();
55 55
56 } 56 }
57 57
58 function init() { 58 function init() {
59 59
60 $scope.$broadcast('cleanCabecera'); 60 $scope.$broadcast('cleanCabecera');
61 61
62 $scope.factura = { 62 $scope.factura = {
63 id: 0, 63 id: 0,
64 estado: 0, 64 estado: 0,
65 vendedor: {}, 65 vendedor: {},
66 cliente: {}, 66 cliente: {},
67 proveedor: {}, 67 proveedor: {},
68 domicilio: { dom: '' }, 68 domicilio: { dom: '' },
69 moneda: {}, 69 moneda: {},
70 cotizacion: $scope.cotizacionPorDefecto || {}, 70 cotizacion: $scope.cotizacionPorDefecto || {},
71 articulosFactura: [], 71 articulosFactura: [],
72 despachos: [] 72 despachos: []
73 }; 73 };
74 74
75 $scope.factura.articulosFactura = []; 75 $scope.factura.articulosFactura = [];
76 $scope.idLista = undefined; 76 $scope.idLista = undefined;
77 77
78 crearRemitoService.getNumeroRemito().then( 78 crearRemitoService.getNumeroRemito().then(
79 function (res) { 79 function (res) {
80 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 80 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
81 $scope.comprobante = rellenar(res.data.numeroRemito, 8); 81 $scope.comprobante = rellenar(res.data.numeroRemito, 8);
82 }, 82 },
83 function (err) { 83 function (err) {
84 focaModalService.alert('La terminal no esta configurada correctamente'); 84 focaModalService.alert('La terminal no esta configurada correctamente');
85 console.info(err); 85 console.info(err);
86 } 86 }
87 ); 87 );
88 88
89 $scope.inicial = angular.copy($scope.factura); 89 $scope.inicial = angular.copy($scope.factura);
90 } 90 }
91 91
92 $scope.$watch('factura', function (newValue) { 92 $scope.$watch('factura', function (newValue) {
93 focaBotoneraLateralService.setPausarData({ 93 focaBotoneraLateralService.setPausarData({
94 label: 'factura', 94 label: 'factura',
95 val: newValue 95 val: newValue
96 }); 96 });
97 }, true); 97 }, true);
98 98
99 $scope.seleccionarFormaDePago = function () { 99 $scope.seleccionarFormaDePago = function () {
100 if (!validarGuardar()) return; 100 if (!validarGuardar()) return;
101 var modalInstance = $uibModal.open( 101 var modalInstance = $uibModal.open(
102 { 102 {
103 templateUrl: 'modal-forma-pago.html', 103 templateUrl: 'modal-forma-pago.html',
104 controller: 'focaModalFormaPagoController', 104 controller: 'focaModalFormaPagoController',
105 resolve: { 105 resolve: {
106 filters: function () { return null; }, 106 filters: function () { return null; },
107 }, 107 },
108 size: 'lg', 108 size: 'lg',
109 } 109 }
110 ); 110 );
111 modalInstance.result 111 modalInstance.result
112 .then(function (data) { 112 .then(function (data) {
113 console.log(data); 113 console.log(data);
114 $scope.crearFactura(); 114 $scope.crearFactura();
115 }) 115 })
116 .catch(function (e) { console.error(e); }); 116 .catch(function (e) { console.error(e); });
117 }; 117 };
118 118
119 $scope.crearFactura = function () { 119 $scope.crearFactura = function () {
120 120
121 var save = { 121 var save = {
122 factura: { 122 factura: {
123 123
124 BONIF: 0, 124 BONIF: 0,
125 CLI: $scope.factura.cliente.cod, 125 CLI: $scope.factura.cliente.cod,
126 CUI: $scope.factura.cliente.cuit, 126 CUI: $scope.factura.cliente.cuit,
127 CTA: $scope.factura.cliente.cod, 127 CTA: $scope.factura.cliente.cod,
128 DC1: '', 128 DC1: '',
129 DC2: '', 129 DC2: '',
130 DE1: '', 130 DE1: '',
131 DOM: $scope.factura.cliente.DOM, 131 DOM: $scope.factura.cliente.DOM,
132 FACAUT: 0, 132 FACAUT: 0,
133 DTO: 0, 133 DTO: 0,
134 FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), 134 FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'),
135 FEC_ANT: '19000101', 135 FEC_ANT: '19000101',
136 FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente 136 FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente
137 IDEXCEPCION: 0, 137 IDEXCEPCION: 0,
138 IDLP: $scope.factura.cliente.mod.trim() || 0, 138 IDLP: $scope.factura.cliente.mod.trim() || 0,
139 IDPERSONERIA: 0, 139 IDPERSONERIA: 0,
140 IMI: 0, // TODO 140 IMI: 0, // TODO
141 IMI2: 0, // TODO 141 IMI2: 0, // TODO
142 IMI3: 0, // TODO 142 IMI3: 0, // TODO
143 IMP_LEY: 0, 143 IMP_LEY: 0,
144 IRI: 0, // TODO 144 IRI: 0, // TODO
145 IRS: 0, 145 IRS: 0,
146 LEG: '', 146 LEG: '',
147 LUG: $scope.factura.vendedor.LugVen, 147 LUG: $scope.factura.vendedor.LugVen,
148 MK_M: 0, 148 MK_M: 0,
149 NEE: 0, // TODO 149 NEE: 0, // TODO
150 NET: 0, // TODO 150 NET: 0, // TODO
151 NFI: '', 151 NFI: '',
152 NNP: 0, 152 NNP: 0,
153 NOM: $scope.factura.cliente.nom, 153 NOM: $scope.factura.cliente.nom,
154 OPE: $scope.factura.vendedor.CodVen, 154 OPE: $scope.factura.vendedor.CodVen,
155 PAG: $scope.getTotal(), 155 PAG: $scope.getTotal(),
156 PER: 0, 156 PER: 0,
157 PER_IVA: 0, 157 PER_IVA: 0,
158 PLA: $scope.factura.vendedor.NplVen, 158 PLA: $scope.factura.vendedor.NplVen,
159 PRO: '', 159 PRO: '',
160 REC_ANT: 0, 160 REC_ANT: 0,
161 SUC: parseInt($scope.puntoVenta), 161 SUC: parseInt($scope.puntoVenta),
162 TCA: 1, 162 TCA: 1,
163 TCO: 'FT', 163 TCO: 'FT',
164 TFI: '', 164 TFI: '',
165 TIP: $scope.factura.cliente.tipoFactura, 165 TIP: $scope.factura.cliente.tipoFactura,
166 TIV: 0, // TODO 166 TIV: 0, // TODO
167 TOT: $scope.getTotal(), 167 TOT: $scope.getTotal(),
168 TUR: 0, // TODO 168 TUR: 0, // TODO
169 VEN: $scope.factura.vendedor.CodVen, 169 VEN: $scope.factura.vendedor.CodVen,
170 VTO_CLI: '', 170 VTO_CLI: '',
171 ZON: 1, // TODO 171 ZON: 1, // TODO
172 OBSERVACIONES: $scope.factura.observaciones 172 OBSERVACIONES: $scope.factura.observaciones
173 }, 173 },
174 cuerpo: $scope.articulosFiltro(), 174 cuerpo: $scope.articulosFiltro(),
175 despachos: $scope.factura.despachos 175 despachos: $scope.factura.despachos
176 }; 176 };
177 177
178 crearFacturaService.guardarFactura(save).then(function(res) { 178 crearFacturaService.guardarFactura(save).then(function(res) {
179 179
180 focaBotoneraLateralService.endGuardar(true); 180 focaBotoneraLateralService.endGuardar(true);
181 181
182 focaModalService.alert('Comprobante guardado con éxito'); 182 focaModalService.alert('Comprobante guardado con éxito');
183 183
184 config(); 184 config();
185 185
186 }).catch(function(err) { 186 }).catch(function(err) {
187 focaModalService.alert('Hubo un error al guardar la factura'); 187 focaModalService.alert('Hubo un error al guardar la factura');
188 console.log(err); 188 console.log(err);
189 }); 189 });
190 190
191 }; 191 };
192 192
193 $scope.seleccionarCliente = function () { 193 $scope.seleccionarCliente = function () {
194 194
195 var modalInstance = $uibModal.open( 195 var modalInstance = $uibModal.open(
196 { 196 {
197 ariaLabelledBy: 'Busqueda de Cliente', 197 ariaLabelledBy: 'Busqueda de Cliente',
198 templateUrl: 'foca-busqueda-cliente-modal.html', 198 templateUrl: 'foca-busqueda-cliente-modal.html',
199 controller: 'focaBusquedaClienteModalController', 199 controller: 'focaBusquedaClienteModalController',
200 resolve: { 200 resolve: {
201 vendedor: function () { return null; }, 201 vendedor: function () { return null; },
202 cobrador: function () { return null; } 202 cobrador: function () { return null; }
203 }, 203 },
204 size: 'lg' 204 size: 'lg'
205 } 205 }
206 ); 206 );
207 modalInstance.result.then( 207 modalInstance.result.then(
208 function (cliente) { 208 function (cliente) {
209 $scope.factura.cliente = cliente; 209 $scope.factura.cliente = cliente;
210 210
211 $scope.$broadcast('addCabecera', { 211 $scope.$broadcast('addCabecera', {
212 label: 'Cliente:', 212 label: 'Cliente:',
213 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom 213 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
214 }); 214 });
215 215
216 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; 216 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
217 217
218 }, function () { 218 }, function () {
219 } 219 }
220 ); 220 );
221 221
222 }; 222 };
223 223
224 $scope.seleccionarVendedor = function() { 224 $scope.seleccionarVendedor = function() {
225 var parametrosModal = { 225 var parametrosModal = {
226 titulo: 'Búsqueda vendedores', 226 titulo: 'Búsqueda vendedores',
227 query: '/vendedor-playa', 227 query: '/vendedor-playa',
228 columnas: [ 228 columnas: [
229 { 229 {
230 propiedad: 'CodVen', 230 propiedad: 'CodVen',
231 nombre: 'Código', 231 nombre: 'Código',
232 filtro: { 232 filtro: {
233 nombre: 'rellenarDigitos', 233 nombre: 'rellenarDigitos',
234 parametro: 3 234 parametro: 3
235 } 235 }
236 }, 236 },
237 { 237 {
238 propiedad: 'NomVen', 238 propiedad: 'NomVen',
239 nombre: 'Nombre' 239 nombre: 'Nombre'
240 } 240 }
241 ], 241 ],
242 size: 'md' 242 size: 'md'
243 }; 243 };
244 focaModalService.modal(parametrosModal).then( 244 focaModalService.modal(parametrosModal).then(
245 function (vendedor) { 245 function (vendedor) {
246 246
247 indicarPassword(vendedor) 247 indicarPassword(vendedor)
248 .then(function() { 248 .then(function() {
249 validarPlanillaVendedor(vendedor) 249 validarPlanillaVendedor(vendedor)
250 .then(function() { 250 .then(function() {
251 251
252 $filter('filter')($scope.botonera, { 252 $filter('filter')($scope.botonera, {
253 label: 'Vendedor' 253 label: 'Vendedor'
254 })[0].checked = true; 254 })[0].checked = true;
255 255
256 $scope.$broadcast('addCabecera', { 256 $scope.$broadcast('addCabecera', {
257 label: 'Vendedor:', 257 label: 'Vendedor:',
258 valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + 258 valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) +
259 ' - ' + 259 ' - ' +
260 vendedor.NomVen 260 vendedor.NomVen
261 }); 261 });
262 262
263 $scope.factura.vendedor = vendedor; 263 $scope.factura.vendedor = vendedor;
264 264
265 getProductosByPlanilla(vendedor.NplVen); 265 getProductosByPlanilla(vendedor.NplVen);
266 }) 266 })
267 .catch($scope.seleccionarVendedor); 267 .catch($scope.seleccionarVendedor);
268 }) 268 })
269 .catch(function(err) { 269 .catch(function(err) {
270 console.log(err) 270 console.log(err)
271 }); 271 });
272 272
273 }, function () { } 273 }, function () { }
274 ); 274 );
275 }; 275 };
276 276
277 $scope.seleccionarMoneda = function () { 277 $scope.seleccionarMoneda = function () {
278 278
279 var parametrosModal = { 279 var parametrosModal = {
280 titulo: 'Búsqueda de monedas', 280 titulo: 'Búsqueda de monedas',
281 query: '/moneda', 281 query: '/moneda',
282 columnas: [ 282 columnas: [
283 { 283 {
284 propiedad: 'DETALLE', 284 propiedad: 'DETALLE',
285 nombre: 'Nombre' 285 nombre: 'Nombre'
286 }, 286 },
287 { 287 {
288 propiedad: 'SIMBOLO', 288 propiedad: 'SIMBOLO',
289 nombre: 'Símbolo' 289 nombre: 'Símbolo'
290 } 290 }
291 ], 291 ],
292 size: 'md' 292 size: 'md'
293 }; 293 };
294 focaModalService.modal(parametrosModal).then( 294 focaModalService.modal(parametrosModal).then(
295 function (moneda) { 295 function (moneda) {
296 296
297 if (moneda.ID !== 1) { 297 if (moneda.ID !== 1) {
298 $scope.abrirModalCotizacion(moneda); 298 $scope.abrirModalCotizacion(moneda);
299 return; 299 return;
300 } 300 }
301 301
302 crearRemitoService.getCotizacionByIdMoneda(1) 302 crearRemitoService.getCotizacionByIdMoneda(1)
303 .then(function (res) { 303 .then(function (res) {
304 304
305 cotizacionPArgentino = res.data[0].cotizaciones[0]; 305 cotizacionPArgentino = res.data[0].cotizaciones[0];
306 cotizacionPArgentino.moneda = moneda; 306 cotizacionPArgentino.moneda = moneda;
307 307
308 actualizarCabeceraMoneda(cotizacionPArgentino); 308 actualizarCabeceraMoneda(cotizacionPArgentino);
309 309
310 $scope.remito.cotizacion = cotizacionPArgentino; 310 $scope.remito.cotizacion = cotizacionPArgentino;
311 }); 311 });
312 }, function () { 312 }, function () {
313 313
314 } 314 }
315 ); 315 );
316 }; 316 };
317 317
318 $scope.abrirModalCotizacion = function (moneda) { 318 $scope.abrirModalCotizacion = function (moneda) {
319 var modalInstance = $uibModal.open( 319 var modalInstance = $uibModal.open(
320 { 320 {
321 ariaLabelledBy: 'Busqueda de Cotización', 321 ariaLabelledBy: 'Busqueda de Cotización',
322 templateUrl: 'modal-cotizacion.html', 322 templateUrl: 'modal-cotizacion.html',
323 controller: 'focaModalCotizacionController', 323 controller: 'focaModalCotizacionController',
324 size: 'lg', 324 size: 'lg',
325 resolve: { idMoneda: function () { return moneda.ID; } } 325 resolve: { idMoneda: function () { return moneda.ID; } }
326 } 326 }
327 ); 327 );
328 modalInstance.result.then( 328 modalInstance.result.then(
329 function (cotizacion) { 329 function (cotizacion) {
330 330
331 cotizacion.moneda = moneda; 331 cotizacion.moneda = moneda;
332 actualizarCabeceraMoneda(cotizacion); 332 actualizarCabeceraMoneda(cotizacion);
333 $scope.factura.cotizacion = cotizacion; 333 $scope.factura.cotizacion = cotizacion;
334 334
335 }, function () { 335 }, function () {
336 336
337 } 337 }
338 ); 338 );
339 }; 339 };
340 340
341 $scope.seleccionarObservaciones = function () { 341 $scope.seleccionarObservaciones = function () {
342 var observacion = { 342 var observacion = {
343 titulo: 'Ingrese Observaciones', 343 titulo: 'Ingrese Observaciones',
344 value: $scope.factura.observaciones, 344 value: $scope.factura.observaciones,
345 maxlength: 155, 345 maxlength: 155,
346 textarea: true 346 textarea: true
347 }; 347 };
348 348
349 focaModalService 349 focaModalService
350 .prompt(observacion) 350 .prompt(observacion)
351 .then(function (observaciones) { 351 .then(function (observaciones) {
352 $scope.factura.observaciones = observaciones; 352 $scope.factura.observaciones = observaciones;
353 }); 353 });
354 }; 354 };
355 355
356 $scope.articulosFiltro = function () { 356 $scope.articulosFiltro = function () {
357 return $scope.factura.articulosFactura; 357 return $scope.factura.articulosFactura.filter(function (articulo) {
358 return !articulo.desactivado;
359 });
358 }; 360 };
359 361
360 $scope.getTotal = function () { 362 $scope.getTotal = function () {
361 363
362 var total = 0; 364 var total = 0;
363 365
364 $scope.articulosFiltro().forEach(function (articulo) { 366 $scope.articulosFiltro().forEach(function (articulo) {
365 total += articulo.PUN * articulo.CAN; 367 total += articulo.PUN * articulo.CAN;
366 }); 368 });
367 369
368 return parseFloat(total.toFixed(2)); 370 return parseFloat(total.toFixed(2));
369 }; 371 };
370 372
373 $scope.quitarDespacho = function (articulo, index) {
374
375 crearFacturaService
376 .setearDespachoDesocupado({
377 surtidor: $scope.factura.despachos[index].SUR,
378 producto: $scope.factura.despachos[index].PRO,
379 carga: $scope.factura.despachos[index].CAR,
380 planilla: $scope.factura.despachos[index].PLA
381 })
382 .then(function () {
383 articulo.desactivado = true;
384 $scope.factura.despachos.splice(index, 1);
385 })
386 .catch(function() {
387 focaModalService.alert('Hubo un error al desasociar este despacho');
388 });
389 };
390
371 function getProductosByPlanilla(numeroPlanilla) { 391 function getProductosByPlanilla(numeroPlanilla) {
372 392
373 crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) { 393 crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) {
374 394
375 res.data.forEach(function (producto) { 395 res.data.forEach(function (producto) {
376 396
377 $scope.botonera.push({ 397 $scope.botonera.push({
378 label: producto.DetArt, 398 label: producto.DetArt,
379 image: 'productos.png' 399 image: 'productos.png'
380 }); 400 });
381 401
382 402
383 crearFuncionesProductos(producto); 403 crearFuncionesProductos(producto);
384 404
385 }); 405 });
386 }); 406 });
387 } 407 }
388 408
389 function crearFuncionesProductos(producto) { 409 function crearFuncionesProductos(producto) {
390 410
391 $scope[nombreFuncion(producto.DetArt)] = function() { 411 $scope[nombreFuncion(producto.DetArt)] = function() {
392 412
393 if (angular.equals($scope.factura.cliente, {})) { 413 if (angular.equals($scope.factura.cliente, {})) {
394 focaModalService.alert('Seleccione cliente'); 414 focaModalService.alert('Seleccione cliente');
395 return; 415 return;
396 } 416 }
397 417
398 var modalInstance = $uibModal.open( 418 var modalInstance = $uibModal.open(
399 { 419 {
400 templateUrl: 'modal-combustibles.html', 420 templateUrl: 'modal-combustibles.html',
401 controller: 'focaModalCombustiblesController', 421 controller: 'focaModalCombustiblesController',
402 resolve: { 422 resolve: {
403 parametros: function() { 423 parametros: function() {
404 return { 424 return {
405 despachos: producto.despachos, 425 despachos: producto.despachos,
406 nombreProducto: producto.DetArt 426 nombreProducto: producto.DetArt
407 } 427 }
408 } 428 }
409 }, 429 },
410 size: 'lg' 430 size: 'md'
411 } 431 }
412 ); 432 );
413 433
414 modalInstance.result.then(function(despacho) { 434 modalInstance.result.then(function(despacho) {
415 435
416 var articulo = { 436 var articulo = {
417 TIP: $scope.factura.cliente.tipoFactura, 437 TIP: $scope.factura.cliente.tipoFactura,
418 TCO: 'FT', 438 TCO: 'FT',
419 SUC: parseInt($scope.puntoVenta), 439 SUC: parseInt($scope.puntoVenta),
420 ORD: $scope.articulosFiltro().length + 1, 440 ORD: $scope.articulosFiltro().length + 1,
421 SEC: despacho.SEC, 441 SEC: despacho.SEC,
422 ART: despacho.PRO, 442 ART: despacho.PRO,
423 RUB: producto.CodRub, 443 RUB: producto.CodRub,
424 DES: producto.DetArt, 444 DES: producto.DetArt,
425 CAN: despacho.LTS, 445 CAN: despacho.LTS,
426 PUN: producto.PreVen, // TODO 446 PUN: producto.PreVen, // TODO
427 IVA: producto.IMPIVA, // TODO 447 IVA: producto.IMPIVA, // TODO
428 NET: 0, // TODO 448 NET: 0, // TODO
429 NEX: 0, // TODO 449 NEX: 0, // TODO
430 IMI: producto.ImpInt, // TODO 450 IMI: producto.ImpInt, // TODO
431 IMI2: producto.ImpInt2, // TODO 451 IMI2: producto.ImpInt2, // TODO
432 IMI3: producto.ImpInt3, // TODO 452 IMI3: producto.ImpInt3, // TODO
433 PUT: producto.PreNet, // TODO 453 PUT: producto.PreNet, // TODO
434 SUR: despacho.SUR, 454 SUR: despacho.SUR,
435 PLA: despacho.PLA, 455 PLA: despacho.PLA,
436 LUG: despacho.LUG, 456 LUG: despacho.LUG,
437 LEG: $scope.factura.vendedor.CodVen, 457 LEG: $scope.factura.vendedor.CodVen,
438 TUR: $scope.factura.vendedor.TurVen, 458 TUR: $scope.factura.vendedor.TurVen,
439 ORDEN_PRECOMPRA: '', 459 ORDEN_PRECOMPRA: '',
440 ESC: producto.tipoFactura == 'L' ? 1 : 0, 460 ESC: producto.tipoFactura == 'L' ? 1 : 0,
441 CMF: 0, 461 CMF: 0,
442 PTA: 0, 462 PTA: 0,
443 IVS: 0, 463 IVS: 0,
444 TIVA: 0, 464 TIVA: 0,
445 CON: 0, 465 CON: 0,
446 SINO: '', 466 SINO: '',
447 ORD_TRA: 0, 467 ORD_TRA: 0,
448 IMP_DESP: 0, 468 IMP_DESP: 0,
449 PCD: 0, 469 PCD: 0,
450 RTO: '' 470 RTO: ''
451 }; 471 };
452 472
453 crearFacturaService.setearDespachoOcupado({ 473 crearFacturaService.setearDespachoOcupado({
454 surtidor: despacho.SUR, 474 surtidor: despacho.SUR,
455 producto: despacho.PRO, 475 producto: despacho.PRO,
456 carga: despacho.CAR 476 carga: despacho.CAR
457 }) 477 })
458 .then(function () { 478 .then(function () {
459 $scope.factura.articulosFactura.push(articulo); 479 $scope.factura.articulosFactura.push(articulo);
460 $scope.factura.despachos.push(despacho); 480 $scope.factura.despachos.push(despacho);
461 }) 481 })
462 .catch(function (err) { 482 .catch(function (err) {
463 483
464 focaModalService.alert('El despacho esta en uso'); 484 focaModalService.alert('El despacho esta en uso');
465 }); 485 });
466 486
467 }) 487 })
468 .catch(function (err) { 488 .catch(function (err) {
469 console.log(err); 489 console.log(err);
470 }); 490 });
471 491
472 }; 492 };
473 } 493 }
474 494
475 function nombreFuncion(string) { 495 function nombreFuncion(string) {
476 var texto = 'seleccionar'; 496 var texto = 'seleccionar';
477 var arr = string.split(' '); 497 var arr = string.split(' ');
478 arr.forEach(function(palabra) { 498 arr.forEach(function(palabra) {
479 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); 499 palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
480 texto += palabra; 500 texto += palabra;
481 }); 501 });
482 return texto; 502 return texto;
483 } 503 }
484 504
485 function indicarPassword(vendedor) { 505 function indicarPassword(vendedor) {
486 506
487 return new Promise(function(resolve, reject) { 507 return new Promise(function(resolve, reject) {
488 508
489 focaModalService 509 focaModalService
490 .prompt({ 510 .prompt({
491 titulo: 'Indique Contraseña', 511 titulo: 'Indique Contraseña',
492 value: '' 512 value: ''
493 }) 513 })
494 .then(function (contraseña) { 514 .then(function (contraseña) {
495 515
496 if (contraseña != vendedor.ClaVen.trim()) { 516 if (contraseña != vendedor.ClaVen.trim()) {
497 517
498 focaModalService.alert('Clave incorrecta').then(function() { 518 focaModalService.alert('Clave incorrecta').then(function() {
499 indicarPassword(vendedor); 519 indicarPassword(vendedor);
500 }); 520 });
501 } else { 521 } else {
502 resolve(); 522 resolve();
503 } 523 }
504 }) 524 })
505 .catch(reject); 525 .catch(reject);
506 }); 526 });
507 } 527 }
508 528
509 function validarPlanillaVendedor(vendedor) { 529 function validarPlanillaVendedor(vendedor) {
510 530
511 return new Promise(function(resolve, reject) { 531 return new Promise(function(resolve, reject) {
512 532
513 crearFacturaService 533 crearFacturaService
514 .validarPlanillaVendedor(vendedor.CodVen.trim()) 534 .validarPlanillaVendedor(vendedor.CodVen.trim())
515 .then(function (res) { 535 .then(function (res) {
516 536
517 if (!res.data.length) { 537 if (!res.data.length) {
518 538
519 focaModalService 539 focaModalService
520 .alert('No se encontró planilla abierta para el vendedor') 540 .alert('No se encontró planilla abierta para el vendedor')
521 .then(reject); 541 .then(reject);
522 542
523 } else { 543 } else {
524 resolve(); 544 resolve();
525 } 545 }
526 546
527 }) 547 })
528 .catch(reject); 548 .catch(reject);
529 }); 549 });
530 } 550 }
531 551
532 function rellenar(relleno, longitud) { 552 function rellenar(relleno, longitud) {
533 relleno = '' + relleno; 553 relleno = '' + relleno;
534 while (relleno.length < longitud) { 554 while (relleno.length < longitud) {
535 relleno = '0' + relleno; 555 relleno = '0' + relleno;
536 } 556 }
537 return relleno; 557 return relleno;
538 } 558 }
539 559
540 function salir() { 560 function salir() {
541 var confirmacion = false; 561 var confirmacion = false;
542 562
543 if (!angular.equals($scope.factura, $scope.inicial)) { 563 if (!angular.equals($scope.factura, $scope.inicial)) {
544 confirmacion = true; 564 confirmacion = true;
545 } 565 }
546 566
547 if (confirmacion) { 567 if (confirmacion) {
548 focaModalService.confirm( 568 focaModalService.confirm(
549 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 569 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
550 ).then(function (data) { 570 ).then(function (data) {
551 if (data) { 571 if (data) {
552 $location.path('/'); 572 $location.path('/');
553 } 573 }
554 }); 574 });
555 } else { 575 } else {
556 $location.path('/'); 576 $location.path('/');
557 } 577 }
558 } 578 }
559 579
560 function setearFactura(factura) { 580 function setearFactura(factura) {
561 581
562 $scope.$broadcast('cleanCabecera'); 582 $scope.$broadcast('cleanCabecera');
563 583
564 $scope.cabeceras = []; 584 $scope.cabeceras = [];
565 585
566 if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { 586 if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
567 $scope.cabeceras.push({ 587 $scope.cabeceras.push({
568 label: 'Moneda:', 588 label: 'Moneda:',
569 valor: factura.cotizacion.moneda.DETALLE 589 valor: factura.cotizacion.moneda.DETALLE
570 }); 590 });
571 $scope.cabeceras.push({ 591 $scope.cabeceras.push({
572 label: 'Fecha cotizacion:', 592 label: 'Fecha cotizacion:',
573 valor: $filter('date')(factura.cotizacion.FECHA, 593 valor: $filter('date')(factura.cotizacion.FECHA,
574 'dd/MM/yyyy') 594 'dd/MM/yyyy')
575 }); 595 });
576 $scope.cabeceras.push({ 596 $scope.cabeceras.push({
577 label: 'Cotizacion:', 597 label: 'Cotizacion:',
578 valor: $filter('number')(factura.cotizacion.VENDEDOR, 598 valor: $filter('number')(factura.cotizacion.VENDEDOR,
579 '2') 599 '2')
580 }); 600 });
581 } 601 }
582 602
583 if (factura.cotizacion && factura.cotizacion.moneda) { 603 if (factura.cotizacion && factura.cotizacion.moneda) {
584 $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; 604 $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
585 } 605 }
586 606
587 if (factura.cliente && factura.cliente.cod) { 607 if (factura.cliente && factura.cliente.cod) {
588 $scope.cabeceras.push({ 608 $scope.cabeceras.push({
589 label: 'Cliente:', 609 label: 'Cliente:',
590 valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + 610 valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' +
591 factura.cliente.nom 611 factura.cliente.nom
592 }); 612 });
593 613
594 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; 614 $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
595 } 615 }
596 616
597 $scope.puntoVenta = rellenar(factura.sucursal, 4); 617 $scope.puntoVenta = rellenar(factura.sucursal, 4);
598 $scope.comprobante = rellenar(factura.numerofactura, 8); 618 $scope.comprobante = rellenar(factura.numerofactura, 8);
599 $scope.factura = factura; 619 $scope.factura = factura;
600 620
601 addArrayCabecera($scope.cabeceras); 621 addArrayCabecera($scope.cabeceras);
602 } 622 }
603 623
604 function getLSFactura() { 624 function getLSFactura() {
605 var factura = JSON.parse($localStorage.factura || null); 625 var factura = JSON.parse($localStorage.factura || null);
606 if (factura) { 626 if (factura) {
607 setearFactura(factura); 627 setearFactura(factura);
608 delete $localStorage.factura; 628 delete $localStorage.factura;
609 } 629 }
610 } 630 }
611 631
612 function addArrayCabecera(array) { 632 function addArrayCabecera(array) {
613 for (var i = 0; i < array.length; i++) { 633 for (var i = 0; i < array.length; i++) {
614 $scope.$broadcast('addCabecera', { 634 $scope.$broadcast('addCabecera', {
615 label: array[i].label, 635 label: array[i].label,
616 valor: array[i].valor 636 valor: array[i].valor
617 }); 637 });
618 } 638 }
619 } 639 }
620 640
621 function actualizarCabeceraMoneda(cotizacion) { 641 function actualizarCabeceraMoneda(cotizacion) {
622 642
623 $scope.factura.articulosFactura.forEach(function (art) { 643 $scope.factura.articulosFactura.forEach(function (art) {
624 art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); 644 art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4);
625 art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); 645 art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4);
626 }); 646 });
627 647
628 if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { 648 if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') {
629 $scope.$broadcast('removeCabecera', 'Moneda:'); 649 $scope.$broadcast('removeCabecera', 'Moneda:');
630 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 650 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
631 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 651 $scope.$broadcast('removeCabecera', 'Cotizacion:');
632 } else { 652 } else {
633 $scope.$broadcast('addCabecera', { 653 $scope.$broadcast('addCabecera', {
634 label: 'Moneda:', 654 label: 'Moneda:',
635 valor: cotizacion.moneda.DETALLE 655 valor: cotizacion.moneda.DETALLE
636 }); 656 });
637 $scope.$broadcast('addCabecera', { 657 $scope.$broadcast('addCabecera', {
638 label: 'Fecha cotizacion:', 658 label: 'Fecha cotizacion:',
639 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 659 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
640 }); 660 });
641 $scope.$broadcast('addCabecera', { 661 $scope.$broadcast('addCabecera', {
642 label: 'Cotizacion:', 662 label: 'Cotizacion:',
643 valor: $filter('number')(cotizacion.VENDEDOR, '2') 663 valor: $filter('number')(cotizacion.VENDEDOR, '2')
644 }); 664 });
645 } 665 }
646 } 666 }
647 667
648 function validarGuardar() { 668 function validarGuardar() {
649 669
650 if (angular.equals({}, $scope.factura.vendedor)) { 670 if (angular.equals({}, $scope.factura.vendedor)) {
651 671
652 focaModalService.alert('Seleccione Vendedor'); 672 focaModalService.alert('Seleccione Vendedor');
653 return false; 673 return false;
654 } else if (angular.equals({}, $scope.factura.cliente)) { 674 } else if (angular.equals({}, $scope.factura.cliente)) {
655 675
656 focaModalService.alert('Seleccione Cliente') 676 focaModalService.alert('Seleccione Cliente')
657 return false; 677 return false;
658 } else if (!$scope.articulosFiltro().length) { 678 } else if (!$scope.articulosFiltro().length) {
659 679
660 focaModalService.alert('Seleccione al menos un Articulo'); 680 focaModalService.alert('Seleccione al menos un Articulo');
661 return false; 681 return false;
662 } 682 }
663 683
664 return true; 684 return true;
665 } 685 }
666 } 686 }
667 ]); 687 ]);
668 688
1 angular.module('focaCrearFactura') 1 angular.module('focaCrearFactura')
2 .service('crearFacturaService', ['$http', 'API_ENDPOINT', 2 .service('crearFacturaService', ['$http', 'API_ENDPOINT',
3 function($http, API_ENDPOINT) { 3 function($http, API_ENDPOINT) {
4 var route = API_ENDPOINT.URL; 4 var route = API_ENDPOINT.URL;
5 return { 5 return {
6 guardarFactura: function (factura) { 6 guardarFactura: function (factura) {
7 return $http.post(route + '/factura/guardar', factura) 7 return $http.post(route + '/factura/guardar', factura)
8 }, 8 },
9 getParametros: function() { 9 getParametros: function() {
10 return $http.get(API_ENDPOINT.URL + '/parametros/factura'); 10 return $http.get(API_ENDPOINT.URL + '/parametros/factura');
11 }, 11 },
12 validarPlanillaVendedor: function(idVendedor) { 12 validarPlanillaVendedor: function(idVendedor) {
13 return $http.get(route + '/turnos/validar-planilla/' + idVendedor); 13 return $http.get(route + '/turnos/validar-planilla/' + idVendedor);
14 }, 14 },
15 getProductosByPlanilla: function (numeroPlanilla) { 15 getProductosByPlanilla: function (numeroPlanilla) {
16 return $http.get(route + '/turnos/productos/' + numeroPlanilla); 16 return $http.get(route + '/turnos/productos/' + numeroPlanilla);
17 }, 17 },
18 setearDespachoOcupado: function (parametros) { 18 setearDespachoOcupado: function (parametros) {
19 return $http.post(route + '/turnos/despacho-en-uso', parametros); 19 return $http.post(route + '/turnos/despacho-en-uso', parametros);
20 }, 20 },
21 setearDespachoDesocupado: function (parametros) {
22 return $http.post(route + '/turnos/depacho-sin-uso', parametros);
23 },
21 getBotonera: function() { 24 getBotonera: function() {
22 return [ 25 return [
23 { 26 {
24 label: 'Vendedor', 27 label: 'Vendedor',
25 image: 'vendedor.png' 28 image: 'vendedor.png'
26 }, 29 },
27 { 30 {
28 label: 'Cliente', 31 label: 'Cliente',
29 image: 'cliente.png' 32 image: 'cliente.png'
30 }, 33 },
31 { 34 {
32 label: 'Moneda', 35 label: 'Moneda',
33 image: 'moneda.png' 36 image: 'moneda.png'
34 }, 37 },
35 { 38 {
36 label: 'Observaciones', 39 label: 'Observaciones',
37 image: 'botonObservaciones.png' 40 image: 'botonObservaciones.png'
38 } 41 }
39 ]; 42 ];
40 } 43 }
41 }; 44 };
42 }]); 45 }]);
43 46
src/views/factura.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="'Factura'" 3 titulo="'Factura'"
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 9 <marquee
10 bgcolor="#FF9900" 10 bgcolor="#FF9900"
11 behavior="scroll" 11 behavior="scroll"
12 direction="left" 12 direction="left"
13 ng-bind="factura.observaciones" 13 ng-bind="factura.observaciones"
14 ></marquee> 14 ></marquee>
15 <div class="col-lg-12"> 15 <div class="col-lg-12">
16 <div class="row mt-4"> 16 <div class="row mt-4">
17 <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> 17 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
18 <div class="row p-1 botonera-secundaria px-5 py-2"> 18 <div class="row p-1 botonera-secundaria px-5 py-2">
19 <div class="col-12"> 19 <div class="col-12">
20 <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> 20 <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador>
21 </div> 21 </div>
22 </div> 22 </div>
23 <!-- PC --> 23 <!-- PC -->
24 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 24 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
25 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 25 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
26 <thead> 26 <thead>
27 <tr class="d-flex"> 27 <tr class="d-flex">
28 <th class="">#</th> 28 <th class="">#</th>
29 <th class="col">Código</th> 29 <th class="col">Código</th>
30 <th class="col-4">Descripción</th> 30 <th class="col-4">Descripción</th>
31 <th class="col text-right">Cantidad</th> 31 <th class="col text-right">Cantidad</th>
32 <th class="col text-right">Precio Unitario</th> 32 <th class="col text-right">Precio Unitario</th>
33 <th class="col text-right">SubTotal</th> 33 <th class="col text-right">SubTotal</th>
34 <th class="text-right"> 34 <th class="text-right">
35 <button 35 <button
36 class="btn btn-outline-light selectable" 36 class="btn btn-outline-light selectable"
37 ng-click="show = !show; masMenos()" 37 ng-click="show = !show; masMenos()"
38 > 38 >
39 <i 39 <i
40 class="fa fa-chevron-down" 40 class="fa fa-chevron-down"
41 ng-show="show" 41 ng-show="show"
42 aria-hidden="true" 42 aria-hidden="true"
43 > 43 >
44 </i> 44 </i>
45 <i 45 <i
46 class="fa fa-chevron-up" 46 class="fa fa-chevron-up"
47 ng-hide="show" 47 ng-hide="show"
48 aria-hidden="true"> 48 aria-hidden="true">
49 </i> 49 </i>
50 </button> 50 </button>
51 </th> 51 </th>
52 </tr> 52 </tr>
53 </thead> 53 </thead>
54 <tbody class="tabla-articulo-body"> 54 <tbody class="tabla-articulo-body">
55 <tr 55 <tr
56 ng-repeat="(key, articulo) in articulosFiltro()" 56 ng-repeat="(key, articulo) in articulosFiltro()"
57 ng-show="show || key == (articulosFiltro().length - 1)" 57 ng-show="show || key == (articulosFiltro().length - 1)"
58 class="d-flex" 58 class="d-flex"
59 > 59 >
60 <td ng-bind="key + 1"></td> 60 <td ng-bind="key + 1"></td>
61 <td 61 <td
62 class="col" 62 class="col"
63 ng-bind="articulo.SEC + '-' + articulo.ART" 63 ng-bind="articulo.SEC + '-' + articulo.ART"
64 ></td> 64 ></td>
65 <td 65 <td
66 class="col-4" 66 class="col-4"
67 ng-bind="articulo.DES" 67 ng-bind="articulo.DES"
68 ></td> 68 ></td>
69 <td class="col text-right"> 69 <td class="col text-right">
70 <input 70 <input
71 ng-show="articulo.editCantidad" 71 ng-show="articulo.editCantidad"
72 ng-model="tmpCantidad" 72 ng-model="tmpCantidad"
73 class="form-control" 73 class="form-control"
74 foca-tipo-input 74 foca-tipo-input
75 min="1" 75 min="1"
76 foca-focus="articulo.editCantidad" 76 foca-focus="articulo.editCantidad"
77 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);" 77 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
78 esc-key="cancelarEditar(articulo)" 78 esc-key="cancelarEditar(articulo)"
79 ng-focus="selectFocus($event); tmpCantidad = articulo.CAN; tmpPrecio = articulo.PUN" 79 ng-focus="selectFocus($event); tmpCantidad = articulo.CAN; tmpPrecio = articulo.PUN"
80 teclado-virtual 80 teclado-virtual
81 > 81 >
82 <i 82 <i
83 class="selectable" 83 class="selectable"
84 ng-click="cambioEdit(articulo, 'cantidad')" 84 ng-click="cambioEdit(articulo, 'cantidad')"
85 ng-hide="articulo.editCantidad" 85 ng-hide="articulo.editCantidad"
86 ng-bind="articulo.CAN"> 86 ng-bind="articulo.CAN">
87 </i> 87 </i>
88 </td> 88 </td>
89 <td class="col text-right"> 89 <td class="col text-right">
90 <input 90 <input
91 ng-show="articulo.editPrecio" 91 ng-show="articulo.editPrecio"
92 ng-model="tmpPrecio" 92 ng-model="tmpPrecio"
93 class="form-control" 93 class="form-control"
94 foca-tipo-input 94 foca-tipo-input
95 min="1" 95 min="1"
96 step="0.0001" 96 step="0.0001"
97 foca-focus="articulo.editPrecio" 97 foca-focus="articulo.editPrecio"
98 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);" 98 ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
99 esc-key="cancelarEditar(articulo)" 99 esc-key="cancelarEditar(articulo)"
100 ng-focus="selectFocus($event); 100 ng-focus="selectFocus($event);
101 tmpCantidad = articulo.CAN; 101 tmpCantidad = articulo.CAN;
102 tmpPrecio = articulo.PUN" 102 tmpPrecio = articulo.PUN"
103 teclado-virtual 103 teclado-virtual
104 > 104 >
105 <i 105 <i
106 class="selectable" 106 class="selectable"
107 ng-click="cambioEdit(articulo, 'precio')" 107 ng-click="cambioEdit(articulo, 'precio')"
108 ng-hide="articulo.editPrecio" 108 ng-hide="articulo.editPrecio"
109 ng-bind="articulo.PUN | number: 4"> 109 ng-bind="articulo.PUN | number: 4">
110 </i> 110 </i>
111 </td> 111 </td>
112 <td 112 <td
113 class="col text-right" 113 class="col text-right"
114 ng-bind="(articulo.PUN * articulo.CAN) | number: 2"> 114 ng-bind="(articulo.PUN * articulo.CAN) | number: 2">
115 </td> 115 </td>
116 <td class="text-center"> 116 <td class="text-center">
117 <button 117 <button
118 class="btn btn-outline-light" 118 class="btn btn-outline-light"
119 ng-click="quitarArticulo(articulo)" 119 ng-click="quitarDespacho(articulo, key)"
120 > 120 >
121 <i class="fa fa-trash"></i> 121 <i class="fa fa-trash"></i>
122 </button> 122 </button>
123 <button 123 <button
124 class="btn btn-outline-light" 124 class="btn btn-outline-light"
125 ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" 125 ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);"
126 ng-show="articulo.editCantidad || articulo.editPrecio" 126 ng-show="articulo.editCantidad || articulo.editPrecio"
127 > 127 >
128 <i class="fa fa-save"></i> 128 <i class="fa fa-save"></i>
129 </button> 129 </button>
130 </td> 130 </td>
131 </tr> 131 </tr>
132 </tbody> 132 </tbody>
133 <tfoot> 133 <tfoot>
134 <tr class="d-flex"> 134 <tr class="d-flex">
135 <td colspan="4" class="no-border-top"> 135 <td colspan="4" class="no-border-top">
136 <strong>Items:</strong> 136 <strong>Items:</strong>
137 <a ng-bind="articulosFiltro().length"></a> 137 <a ng-bind="articulosFiltro().length"></a>
138 </td> 138 </td>
139 <td class="text-right ml-auto table-celda-total no-border-top"> 139 <td class="text-right ml-auto table-celda-total no-border-top">
140 <h3>Total:</h3> 140 <h3>Total:</h3>
141 </td> 141 </td>
142 <td class="table-celda-total text-right no-border-top" colspan="1"> 142 <td class="table-celda-total text-right no-border-top" colspan="1">
143 <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> 143 <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3>
144 </td> 144 </td>
145 <td class="text-right no-border-top"> 145 <td class="text-right no-border-top">
146 <button 146 <button
147 type="button" 147 type="button"
148 class="btn btn-sm" 148 class="btn btn-sm"
149 > 149 >
150 Totales 150 Totales
151 </button> 151 </button>
152 </td> 152 </td>
153 </tr> 153 </tr>
154 </tfoot> 154 </tfoot>
155 </table> 155 </table>
156 </div> 156 </div>
157 </div> 157 </div>
158 </div> 158 </div>
159 </div> 159 </div>
160 <div class="row d-md-none fixed-bottom"> 160 <div class="row d-md-none fixed-bottom">
161 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 161 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
162 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 162 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
163 <span 163 <span
164 class="mr-3 ml-auto" 164 class="mr-3 ml-auto"
165 ng-class="saveLoading ? 'text-muted' : ''" 165 ng-class="saveLoading ? 'text-muted' : ''"
166 ng-click="seleccionarFormaDePago()" 166 ng-click="seleccionarFormaDePago()"
167 ladda="saveLoading" 167 ladda="saveLoading"
168 data-style="expand-left" 168 data-style="expand-left"
169 >Guardar</span> 169 >Guardar</span>
170 </div> 170 </div>
171 </div> 171 </div>
172 </div> 172 </div>
173 173