Commit f7458e1596aac8b82bd83db3d9f9d463fb1a7593
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !9
Showing
2 changed files
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 |
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 p-2"> | 15 | <div class="col-12 col-lg-10 p-2"> |
16 | <div class="row border border-light rounded m-0"> | 16 | <div class="row border border-light rounded m-0"> |
17 | <div class="col-12 col-md-10 col-lg-10"> | 17 | <div class="col-12 col-sm-12"> |
18 | <div class="row p-1 botonera-secundaria px-3 py-2"> | 18 | <div class="row p-1 botonera-secundaria px-3 py-2"> |
19 | <div class="col-12"> | 19 | <div class="col-12"> |
20 | <foca-botonera-facturador | 20 | <foca-botonera-facturador |
21 | botones="botonera" | 21 | botones="botonera" |
22 | max="botonera.length" | 22 | max="botonera.length" |
23 | class="row"> | 23 | class="row"> |
24 | </foca-botonera-facturador> | 24 | </foca-botonera-facturador> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | <div ng-show="botoneraProductos.length > 0" class="row botonera-secundaria pb-3 px-3"> | 27 | <div ng-show="botoneraProductos.length > 0" class="row botonera-secundaria pb-3 px-3"> |
28 | <div class="col-12"> | 28 | <div class="col-12"> |
29 | <foca-botonera-productos | 29 | <foca-botonera-productos |
30 | botones="botoneraProductos" | 30 | botones="botoneraProductos" |
31 | max="1" | 31 | max="1" |
32 | class="row" | 32 | class="row" |
33 | > | 33 | > |
34 | </foca-botonera-productos> | 34 | </foca-botonera-productos> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | <!-- PC --> | 37 | <!-- PC --> |
38 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 38 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
39 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 39 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
40 | <thead> | 40 | <thead> |
41 | <tr class="d-flex"> | 41 | <tr class="d-flex"> |
42 | <th class="">#</th> | 42 | <th class="">#</th> |
43 | <th class="col">Código</th> | 43 | <th class="col">Código</th> |
44 | <th class="col-4">Descripción</th> | 44 | <th class="col-4">Descripción</th> |
45 | <th class="col text-right">Cantidad</th> | 45 | <th class="col text-right">Cantidad</th> |
46 | <th class="col text-right">Precio Unitario</th> | 46 | <th class="col text-right">Precio Unitario</th> |
47 | <th class="col text-right">SubTotal</th> | 47 | <th class="col text-right">SubTotal</th> |
48 | <th class="text-right"> | 48 | <th class="text-right"> |
49 | <button | 49 | <button |
50 | class="btn btn-outline-light selectable" | 50 | class="btn btn-outline-light selectable" |
51 | ng-click="show = !show; masMenos()" | 51 | ng-click="show = !show; masMenos()" |
52 | > | 52 | > |
53 | <i | 53 | <i |
54 | class="fa fa-chevron-down" | 54 | class="fa fa-chevron-down" |
55 | ng-show="show" | 55 | ng-show="show" |
56 | aria-hidden="true" | 56 | aria-hidden="true" |
57 | > | 57 | > |
58 | </i> | 58 | </i> |
59 | <i | 59 | <i |
60 | class="fa fa-chevron-up" | 60 | class="fa fa-chevron-up" |
61 | ng-hide="show" | 61 | ng-hide="show" |
62 | aria-hidden="true"> | 62 | aria-hidden="true"> |
63 | </i> | 63 | </i> |
64 | </button> | 64 | </button> |
65 | </th> | 65 | </th> |
66 | </tr> | 66 | </tr> |
67 | </thead> | 67 | </thead> |
68 | <tbody class="tabla-articulo-body"> | 68 | <tbody class="tabla-articulo-body"> |
69 | <tr | 69 | <tr |
70 | ng-repeat="(key, articulo) in articulosFiltro()" | 70 | ng-repeat="(key, articulo) in articulosFiltro()" |
71 | ng-show="show || key == (articulosFiltro().length - 1)" | 71 | ng-show="show || key == (articulosFiltro().length - 1)" |
72 | class="d-flex" | 72 | class="d-flex" |
73 | > | 73 | > |
74 | <td ng-bind="key + 1"></td> | 74 | <td ng-bind="key + 1"></td> |
75 | <td | 75 | <td |
76 | class="col" | 76 | class="col" |
77 | ng-bind="articulo.SEC + '-' + articulo.ART" | 77 | ng-bind="articulo.SEC + '-' + articulo.ART" |
78 | ></td> | 78 | ></td> |
79 | <td | 79 | <td |
80 | class="col-4" | 80 | class="col-4" |
81 | ng-bind="articulo.DES" | 81 | ng-bind="articulo.DES" |
82 | ></td> | 82 | ></td> |
83 | <td class="col text-right"> | 83 | <td class="col text-right"> |
84 | <input | 84 | <input |
85 | ng-show="articulo.editCantidad" | 85 | ng-show="articulo.editCantidad" |
86 | ng-model="tmpCantidad" | 86 | ng-model="tmpCantidad" |
87 | class="form-control" | 87 | class="form-control" |
88 | foca-tipo-input | 88 | foca-tipo-input |
89 | min="1" | 89 | min="1" |
90 | foca-focus="articulo.editCantidad" | 90 | foca-focus="articulo.editCantidad" |
91 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad);" | 91 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad);" |
92 | esc-key="cancelarEditar(articulo)" | 92 | esc-key="cancelarEditar(articulo)" |
93 | ng-focus="selectFocus($event); tmpCantidad = articulo.CAN;" | 93 | ng-focus="selectFocus($event); tmpCantidad = articulo.CAN;" |
94 | teclado-virtual | 94 | teclado-virtual |
95 | > | 95 | > |
96 | <i | 96 | <i |
97 | class="selectable" | 97 | class="selectable" |
98 | ng-click="cambioEdit(articulo, 'cantidad')" | 98 | ng-click="cambioEdit(articulo, 'cantidad')" |
99 | ng-hide="articulo.editCantidad" | 99 | ng-hide="articulo.editCantidad" |
100 | ng-bind="articulo.CAN"> | 100 | ng-bind="articulo.CAN"> |
101 | </i> | 101 | </i> |
102 | </td> | 102 | </td> |
103 | <td class="col text-right"> | 103 | <td class="col text-right"> |
104 | <i | 104 | <i |
105 | class="selectable" | 105 | class="selectable" |
106 | ng-bind="articulo.PUN | number: 4"> | 106 | ng-bind="articulo.PUN | number: 4"> |
107 | </i> | 107 | </i> |
108 | </td> | 108 | </td> |
109 | <td | 109 | <td |
110 | class="col text-right" | 110 | class="col text-right" |
111 | ng-bind="(articulo.PUN * articulo.CAN) | number: 2"> | 111 | ng-bind="(articulo.PUN * articulo.CAN) | number: 2"> |
112 | </td> | 112 | </td> |
113 | <td class="text-center"> | 113 | <td class="text-center"> |
114 | <button | 114 | <button |
115 | class="btn btn-outline-light" | 115 | class="btn btn-outline-light" |
116 | ng-click="quitarDespacho(articulo, key)" | 116 | ng-click="quitarDespacho(articulo, key)" |
117 | > | 117 | > |
118 | <i class="fa fa-trash"></i> | 118 | <i class="fa fa-trash"></i> |
119 | </button> | 119 | </button> |
120 | <button | 120 | <button |
121 | class="btn btn-outline-light" | 121 | class="btn btn-outline-light" |
122 | ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" | 122 | ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" |
123 | ng-show="articulo.editCantidad || articulo.editPrecio" | 123 | ng-show="articulo.editCantidad || articulo.editPrecio" |
124 | > | 124 | > |
125 | <i class="fa fa-save"></i> | 125 | <i class="fa fa-save"></i> |
126 | </button> | 126 | </button> |
127 | </td> | 127 | </td> |
128 | </tr> | 128 | </tr> |
129 | </tbody> | 129 | </tbody> |
130 | <tfoot> | 130 | <tfoot> |
131 | <tr class="d-flex"> | 131 | <tr class="d-flex"> |
132 | <td colspan="4" class="no-border-top"> | 132 | <td colspan="4" class="no-border-top"> |
133 | <strong>Items:</strong> | 133 | <strong>Items:</strong> |
134 | <a ng-bind="articulosFiltro().length"></a> | 134 | <a ng-bind="articulosFiltro().length"></a> |
135 | </td> | 135 | </td> |
136 | <td class="text-right ml-auto table-celda-total no-border-top"> | 136 | <td class="text-right ml-auto table-celda-total no-border-top"> |
137 | <h3>Total:</h3> | 137 | <h3>Total:</h3> |
138 | </td> | 138 | </td> |
139 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 139 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
140 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> | 140 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> |
141 | </td> | 141 | </td> |
142 | <td class="text-right no-border-top"> | 142 | <td class="text-right no-border-top"> |
143 | <button | 143 | <button |
144 | type="button" | 144 | type="button" |
145 | class="btn btn-sm" | 145 | class="btn btn-sm" |
146 | > | 146 | > |
147 | Totales | 147 | Totales |
148 | </button> | 148 | </button> |
149 | </td> | 149 | </td> |
150 | </tr> | 150 | </tr> |
151 | </tfoot> | 151 | </tfoot> |
152 | </table> | 152 | </table> |
153 | </div> | 153 | </div> |
154 | <!-- MOBILE --> | 154 | <!-- MOBILE --> |
155 | <div class="row d-sm-none"> | 155 | <div class="row d-sm-none"> |
156 | <div class="col p-0 m-2 mb-5"> | 156 | <div class="col p-0 m-2 mb-5"> |
157 | <table class="table table-sm table-striped tabla-articulo"> | 157 | <table class="table table-sm table-striped tabla-articulo"> |
158 | <thead> | 158 | <thead> |
159 | <tr class="d-flex"> | 159 | <tr class="d-flex"> |
160 | <th class="">#</th> | 160 | <th class="">#</th> |
161 | <th class="col px-0"> | 161 | <th class="col px-0"> |
162 | <div class="d-flex"> | 162 | <div class="d-flex"> |
163 | <div class="col-4 px-1">Código</div> | 163 | <div class="col-4 px-1">Código</div> |
164 | <div class="col-8 px-1">Descripción</div> | 164 | <div class="col-8 px-1">Descripción</div> |
165 | </div> | 165 | </div> |
166 | <div class="d-flex"> | 166 | <div class="d-flex"> |
167 | <div class="col-3 px-1">Cantidad</div> | 167 | <div class="col-3 px-1">Cantidad</div> |
168 | <div class="col px-1 text-right">P. Uni.</div> | 168 | <div class="col px-1 text-right">P. Uni.</div> |
169 | <div class="col px-1 text-right">Subtotal</div> | 169 | <div class="col px-1 text-right">Subtotal</div> |
170 | </div> | 170 | </div> |
171 | </th> | 171 | </th> |
172 | <th class="text-center tamaño-boton"> | 172 | <th class="text-center tamaño-boton"> |
173 | | 173 | |
174 | </th> | 174 | </th> |
175 | </tr> | 175 | </tr> |
176 | </thead> | 176 | </thead> |
177 | <tbody> | 177 | <tbody> |
178 | <tr | 178 | <tr |
179 | ng-repeat="(key, articulo) in articulosFiltro()" | 179 | ng-repeat="(key, articulo) in articulosFiltro()" |
180 | ng-show="show || key == articulosFiltro().length - 1" | 180 | ng-show="show || key == articulosFiltro().length - 1" |
181 | > | 181 | > |
182 | <td class="w-100 d-flex p-0"> | 182 | <td class="w-100 d-flex p-0"> |
183 | <div class="p-1 m-auto"> | 183 | <div class="p-1 m-auto"> |
184 | <span ng-bind="key + 1"></span> | 184 | <span ng-bind="key + 1"></span> |
185 | </div> | 185 | </div> |
186 | <div class="col px-0"> | 186 | <div class="col px-0"> |
187 | <div class="d-flex"> | 187 | <div class="d-flex"> |
188 | <div class="col-4 px-1"> | 188 | <div class="col-4 px-1"> |
189 | <span | 189 | <span |
190 | ng-bind="articulo.SEC + '-' + articulo.ART" | 190 | ng-bind="articulo.SEC + '-' + articulo.ART" |
191 | ></span> | 191 | ></span> |
192 | </div> | 192 | </div> |
193 | <div class="col-8 px-1"> | 193 | <div class="col-8 px-1"> |
194 | <span ng-bind="articulo.DES"></span> | 194 | <span ng-bind="articulo.DES"></span> |
195 | </div> | 195 | </div> |
196 | </div> | 196 | </div> |
197 | <div class="d-flex"> | 197 | <div class="d-flex"> |
198 | <div class="col-4 px-1"> | 198 | <div class="col-4 px-1"> |
199 | <span | 199 | <span |
200 | ng-bind="'x' + articulo.CAN" | 200 | ng-bind="'x' + articulo.CAN" |
201 | ng-hide="articulo.editCantidad" | 201 | ng-hide="articulo.editCantidad" |
202 | ></span> | 202 | ></span> |
203 | <i | 203 | <i |
204 | class="fa fa-pencil text-white-50" | 204 | class="fa fa-pencil text-white-50" |
205 | aria-hidden="true" | 205 | aria-hidden="true" |
206 | ng-hide="articulo.editCantidad" | 206 | ng-hide="articulo.editCantidad" |
207 | ng-click="articulo.editCantidad = true" | 207 | ng-click="articulo.editCantidad = true" |
208 | ></i> | 208 | ></i> |
209 | <input | 209 | <input |
210 | ng-show="articulo.editCantidad" | 210 | ng-show="articulo.editCantidad" |
211 | ng-model="articulo.CAN" | 211 | ng-model="articulo.CAN" |
212 | class="form-control" | 212 | class="form-control" |
213 | foca-tipo-input | 213 | foca-tipo-input |
214 | min="1" | 214 | min="1" |
215 | step="0.001" | 215 | step="0.001" |
216 | foca-focus="articulo.editCantidad" | 216 | foca-focus="articulo.editCantidad" |
217 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio)" | 217 | ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio)" |
218 | ng-focus="selectFocus($event)" | 218 | ng-focus="selectFocus($event)" |
219 | > | 219 | > |
220 | </div> | 220 | </div> |
221 | <div class="col px-1 text-right"> | 221 | <div class="col px-1 text-right"> |
222 | <span ng-bind="articulo.PUN | | 222 | <span ng-bind="articulo.PUN | |
223 | currency: factura.cotizacion.moneda.SIMBOLO : 4"></span> | 223 | currency: factura.cotizacion.moneda.SIMBOLO : 4"></span> |
224 | ></span> | 224 | ></span> |
225 | </div> | 225 | </div> |
226 | <div class="col px-1 text-right"> | 226 | <div class="col px-1 text-right"> |
227 | <span | 227 | <span |
228 | ng-bind="(articulo.PUN * articulo.CAN) | | 228 | ng-bind="(articulo.PUN * articulo.CAN) | |
229 | currency: factura.cotizacion.moneda.SIMBOLO" | 229 | currency: factura.cotizacion.moneda.SIMBOLO" |
230 | > | 230 | > |
231 | </span> | 231 | </span> |
232 | </div> | 232 | </div> |
233 | </div> | 233 | </div> |
234 | </div> | 234 | </div> |
235 | <div class="m-auto p-1"> | 235 | <div class="m-auto p-1"> |
236 | <button | 236 | <button |
237 | class="btn btn-outline-light" | 237 | class="btn btn-outline-light" |
238 | ng-click="quitarDespacho(key)" | 238 | ng-click="quitarDespacho(key)" |
239 | > | 239 | > |
240 | <i class="fa fa-trash"></i> | 240 | <i class="fa fa-trash"></i> |
241 | </button> | 241 | </button> |
242 | </div> | 242 | </div> |
243 | </td> | 243 | </td> |
244 | </tr> | 244 | </tr> |
245 | </tbody> | 245 | </tbody> |
246 | <tfoot> | 246 | <tfoot> |
247 | <!-- TOOGLE EXPANDIR --> | 247 | <!-- TOOGLE EXPANDIR --> |
248 | <tr> | 248 | <tr> |
249 | <td class="col"> | 249 | <td class="col"> |
250 | <button | 250 | <button |
251 | class="btn btn-outline-light selectable w-100" | 251 | class="btn btn-outline-light selectable w-100" |
252 | ng-click="show = !show; masMenos()" | 252 | ng-click="show = !show; masMenos()" |
253 | ng-show="articulosFiltro().length > 0" | 253 | ng-show="articulosFiltro().length > 0" |
254 | > | 254 | > |
255 | <i | 255 | <i |
256 | class="fa fa-chevron-down" | 256 | class="fa fa-chevron-down" |
257 | ng-hide="show" | 257 | ng-hide="show" |
258 | aria-hidden="true" | 258 | aria-hidden="true" |
259 | > | 259 | > |
260 | </i> | 260 | </i> |
261 | <i | 261 | <i |
262 | class="fa fa-chevron-up" | 262 | class="fa fa-chevron-up" |
263 | ng-show="show" | 263 | ng-show="show" |
264 | aria-hidden="true"> | 264 | aria-hidden="true"> |
265 | </i> | 265 | </i> |
266 | </button> | 266 | </button> |
267 | </td> | 267 | </td> |
268 | </tr> | 268 | </tr> |
269 | <!-- FOOTER --> | 269 | <!-- FOOTER --> |
270 | <tr class="d-flex"> | 270 | <tr class="d-flex"> |
271 | <td class="m-auto no-border-top" colspan="2"> | 271 | <td class="m-auto no-border-top" colspan="2"> |
272 | <strong>Cantidad Items:</strong> | 272 | <strong>Cantidad Items:</strong> |
273 | <a ng-bind="articulosFiltro().length"></a> | 273 | <a ng-bind="articulosFiltro().length"></a> |
274 | </td> | 274 | </td> |
275 | <td class="text-right ml-auto table-celda-total no-border-top"> | 275 | <td class="text-right ml-auto table-celda-total no-border-top"> |
276 | <h3>Total:</h3> | 276 | <h3>Total:</h3> |
277 | </td> | 277 | </td> |
278 | <td class="table-celda-total text-right no-border-top"> | 278 | <td class="table-celda-total text-right no-border-top"> |
279 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> | 279 | <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3> |
280 | </td> | 280 | </td> |
281 | </tr> | 281 | </tr> |
282 | </tfoot> | 282 | </tfoot> |
283 | </table> | 283 | </table> |
284 | </div> | 284 | </div> |
285 | </div> | 285 | </div> |
286 | </div> | 286 | </div> |
287 | </div> | 287 | </div> |
288 | </div> | 288 | </div> |
289 | <div class="row d-md-none fixed-bottom disable-selection"> | 289 | <div class="row d-md-none fixed-bottom disable-selection"> |
290 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 290 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
291 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 291 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
292 | <span | 292 | <span |
293 | class="mr-3 ml-auto" | 293 | class="mr-3 ml-auto" |
294 | ng-class="saveLoading ? 'text-muted' : ''" | 294 | ng-class="saveLoading ? 'text-muted' : ''" |
295 | ng-click="seleccionarFormaDePago()" | 295 | ng-click="seleccionarFormaDePago()" |
296 | ladda="saveLoading" | 296 | ladda="saveLoading" |
297 | data-style="expand-left" | 297 | data-style="expand-left" |
298 | >Pago</span> | 298 | >Pago</span> |
299 | </div> | 299 | </div> |
300 | </div> | 300 | </div> |
301 | </div> | 301 | </div> |
302 | 302 |