Commit 0d01c9d6c84b0ea276db7730a03a23322514dae9
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !3
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearCobranza') .controller('cobranzaController', | 1 | angular.module('focaCrearCobranza') .controller('cobranzaController', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | 'focaCrearCobranzaService', | 7 | 'focaCrearCobranzaService', |
8 | 'focaModalService', | 8 | 'focaModalService', |
9 | function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService) | 9 | function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService) |
10 | { | 10 | { |
11 | $scope.botonera = [ | 11 | $scope.botonera = [ |
12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
13 | {texto: 'Cobrador', accion: function() {$scope.seleccionarCobrador();}}, | 13 | {texto: 'Cobrador', accion: function() {$scope.seleccionarCobrador();}}, |
14 | {texto: 'Comprobantes', accion: function() {$scope.swichDeuda();}}, | 14 | {texto: 'Comprobantes', accion: function() {$scope.swichDeuda();}}, |
15 | {texto: 'Cobros', accion: function() {$scope.swichCobro();}}, | 15 | {texto: 'Cobros', accion: function() {$scope.swichCobro();}}, |
16 | {texto: 'Moneda', accion: function() {$scope.seleccionarMoneda();}}, | 16 | {texto: 'Moneda', accion: function() {$scope.seleccionarMoneda();}}, |
17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
18 | {texto: '', accion: function() {}}, | 18 | {texto: '', accion: function() {}}, |
19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
20 | ]; | 20 | ]; |
21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
22 | $scope.cobroDeuda = true; | 22 | $scope.cobroDeuda = true; |
23 | $scope.show = false; | 23 | $scope.show = false; |
24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
28 | }; | 28 | }; |
29 | 29 | ||
30 | $scope.cobranza = { | 30 | $scope.cobranza = { |
31 | fecha: new Date() | 31 | fecha: new Date() |
32 | }; | 32 | }; |
33 | 33 | ||
34 | $scope.cabecera = []; | 34 | $scope.cabecera = []; |
35 | $scope.showCabecera = true; | 35 | $scope.showCabecera = true; |
36 | 36 | ||
37 | $scope.now = new Date(); | 37 | $scope.now = new Date(); |
38 | $scope.puntoVenta = '0000'; | 38 | $scope.puntoVenta = '0000'; |
39 | $scope.comprobante = '00000000'; | 39 | $scope.comprobante = '00000000'; |
40 | $scope.facturaTabla = []; | 40 | $scope.facturaTabla = []; |
41 | $scope.cobrosTabla = []; | 41 | $scope.cobrosTabla = []; |
42 | 42 | ||
43 | var monedaPorDefecto; | 43 | var monedaPorDefecto; |
44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
45 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { | 45 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { |
46 | monedaPorDefecto = res.data[0]; | 46 | monedaPorDefecto = res.data[0]; |
47 | addCabecera('Moneda:', monedaPorDefecto.DETALLE); | 47 | addCabecera('Moneda:', monedaPorDefecto.DETALLE); |
48 | addCabecera('Fecha cotizacion:', | 48 | addCabecera('Fecha cotizacion:', |
49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | 49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR); | 50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR); |
51 | $scope.cobranza.moneda = monedaPorDefecto; | 51 | $scope.cobranza.moneda = monedaPorDefecto; |
52 | $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0]; | 52 | $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0]; |
53 | }); | 53 | }); |
54 | 54 | ||
55 | focaCrearCobranzaService.getNumeroRecibo().then( | 55 | focaCrearCobranzaService.getNumeroRecibo().then( |
56 | function(res) { | 56 | function(res) { |
57 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); | 57 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
58 | $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8); | 58 | $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8); |
59 | }, | 59 | }, |
60 | function(err) { | 60 | function(err) { |
61 | focaModalService.alert('La terminal no esta configurada correctamente'); | 61 | focaModalService.alert('La terminal no esta configurada correctamente'); |
62 | console.info(err); | 62 | console.info(err); |
63 | } | 63 | } |
64 | ); | 64 | ); |
65 | $scope.crearCobranza = function() { | 65 | $scope.crearCobranza = function() { |
66 | if(!$scope.cliente.COD) { | 66 | if(!$scope.cobranza.cliente) { |
67 | focaModalService.alert('Ingrese Cliente'); | 67 | focaModalService.alert('Ingrese Cliente'); |
68 | return; | 68 | return; |
69 | }else if($scope.facturaTabla.length < 1) { | 69 | } |
70 | if($scope.facturaTabla.length < 1) { | ||
70 | focaModalService.alert('Ingrese al menos una factura'); | 71 | focaModalService.alert('Ingrese al menos una factura'); |
71 | return; | 72 | return; |
72 | } | 73 | } |
74 | if($scope.getTotalCobrado() - $scope.getTotalDeuda() !== 0) { | ||
75 | focaModalService.alert('La diferencia debe ser ' + | ||
76 | $scope.cobranza.moneda.SIMBOLO + '0,00'); | ||
77 | return; | ||
78 | } | ||
73 | //TODO: Guarda cobranza | 79 | //TODO: Guarda cobranza |
74 | // var date = new Date(); | 80 | // var date = new Date(); |
75 | // var cobranza = { | 81 | // var cobranza = { |
76 | // }; | 82 | // }; |
77 | }; | 83 | }; |
78 | 84 | ||
79 | $scope.swichCobro = function() { | 85 | $scope.swichCobro = function() { |
80 | $scope.cobroDeuda = false; | 86 | $scope.cobroDeuda = false; |
81 | }; | 87 | }; |
82 | 88 | ||
83 | $scope.swichDeuda = function() { | 89 | $scope.swichDeuda = function() { |
84 | $scope.cobroDeuda = true; | 90 | $scope.cobroDeuda = true; |
85 | }; | 91 | }; |
86 | 92 | ||
87 | $scope.seleccionarCliente = function() { | 93 | $scope.seleccionarCliente = function() { |
88 | 94 | ||
89 | var modalInstance = $uibModal.open( | 95 | var modalInstance = $uibModal.open( |
90 | { | 96 | { |
91 | ariaLabelledBy: 'Busqueda de Cliente', | 97 | ariaLabelledBy: 'Busqueda de Cliente', |
92 | templateUrl: 'foca-busqueda-cliente-modal.html', | 98 | templateUrl: 'foca-busqueda-cliente-modal.html', |
93 | controller: 'focaBusquedaClienteModalController', | 99 | controller: 'focaBusquedaClienteModalController', |
94 | size: 'lg' | 100 | size: 'lg' |
95 | } | 101 | } |
96 | ); | 102 | ); |
97 | modalInstance.result.then( | 103 | modalInstance.result.then( |
98 | function(cliente) { | 104 | function(cliente) { |
99 | addCabecera('Cliente:', cliente.nom); | 105 | addCabecera('Cliente:', cliente.nom); |
100 | $scope.cobranza.cliente = { | 106 | $scope.cobranza.cliente = { |
101 | COD: cliente.cod, | 107 | COD: cliente.cod, |
102 | CUIT: cliente.cuit, | 108 | CUIT: cliente.cuit, |
103 | NOM: cliente.nom | 109 | NOM: cliente.nom |
104 | }; | 110 | }; |
105 | }, function() { | 111 | }, function() { |
106 | 112 | ||
107 | } | 113 | } |
108 | ); | 114 | ); |
109 | }; | 115 | }; |
110 | 116 | ||
111 | $scope.seleccionarFactura = function() { | 117 | $scope.seleccionarFactura = function() { |
112 | if(!$scope.cobranza.cliente) { | 118 | if(!$scope.cobranza.cliente) { |
113 | focaModalService.alert('Seleccione primero un cliente'); | 119 | focaModalService.alert('Seleccione primero un cliente'); |
114 | return; | 120 | return; |
115 | } | 121 | } |
116 | var modalInstance = $uibModal.open( | 122 | var modalInstance = $uibModal.open( |
117 | { | 123 | { |
118 | ariaLabelledBy: 'Busqueda de Facturas', | 124 | ariaLabelledBy: 'Busqueda de Facturas', |
119 | templateUrl: 'foca-modal-factura.html', | 125 | templateUrl: 'foca-modal-factura.html', |
120 | controller: 'focaModalFacturaController', | 126 | controller: 'focaModalFacturaController', |
121 | size: 'lg', | 127 | size: 'lg', |
122 | resolve: { | 128 | resolve: { |
123 | parametrosFactura: { | 129 | parametrosFactura: { |
124 | cliente: $scope.cobranza.cliente.COD, | 130 | cliente: $scope.cobranza.cliente.COD, |
125 | simbolo: $scope.cobranza.moneda.SIMBOLO, | 131 | simbolo: $scope.cobranza.moneda.SIMBOLO, |
126 | cotizacion: $scope.cobranza.cotizacion.VENDEDOR | 132 | cotizacion: $scope.cobranza.cotizacion.VENDEDOR |
127 | } | 133 | } |
128 | } | 134 | } |
129 | } | 135 | } |
130 | ); | 136 | ); |
131 | modalInstance.result.then( | 137 | modalInstance.result.then( |
132 | function(facturas) { | 138 | function(facturas) { |
133 | $scope.facturaTabla = $scope.facturaTabla.concat(facturas); | 139 | $scope.facturaTabla = $scope.facturaTabla.concat(facturas); |
134 | }, function() { | 140 | }, function() { |
135 | 141 | ||
136 | } | 142 | } |
137 | ); | 143 | ); |
138 | }; | 144 | }; |
139 | 145 | ||
140 | $scope.seleccionarCheque = function() { | 146 | $scope.seleccionarCheque = function() { |
141 | var modalInstance = $uibModal.open( | 147 | var modalInstance = $uibModal.open( |
142 | { | 148 | { |
143 | ariaLabelledBy: 'Carga de cheques', | 149 | ariaLabelledBy: 'Carga de cheques', |
144 | templateUrl: 'modal-cheque.html', | 150 | templateUrl: 'modal-cheque.html', |
145 | controller: 'focaModalChequeController', | 151 | controller: 'focaModalChequeController', |
146 | size: 'lg' | 152 | size: 'lg' |
147 | } | 153 | } |
148 | ); | 154 | ); |
149 | modalInstance.result.then( | 155 | modalInstance.result.then( |
150 | function(cheque) { | 156 | function(cheque) { |
151 | var cobro = { | 157 | var cobro = { |
152 | tipo: 'Cheque', | 158 | tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco, |
153 | fecha: cheque.fechaValor, | 159 | fecha: cheque.fechaPresentacion, |
154 | importe: cheque.importe | 160 | importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR |
155 | }; | 161 | }; |
156 | $scope.cobrosTabla.push(cobro); | 162 | $scope.cobrosTabla.push(cobro); |
157 | }, function() { | 163 | }, function() { |
158 | 164 | ||
159 | } | 165 | } |
160 | ); | 166 | ); |
161 | }; | 167 | }; |
162 | 168 | ||
163 | $scope.seleccionarEfectivo = function() { | 169 | $scope.seleccionarEfectivo = function() { |
164 | var modalInstance = $uibModal.open( | 170 | var modalInstance = $uibModal.open( |
165 | { | 171 | { |
166 | ariaLabelledBy: 'Carga de cheques', | 172 | ariaLabelledBy: 'Carga de cheques', |
167 | templateUrl: 'modal-efectivo.html', | 173 | templateUrl: 'modal-efectivo.html', |
168 | controller: 'focaModalEfectivoController', | 174 | controller: 'focaModalEfectivoController', |
169 | size: 'sm' | 175 | size: 'sm' |
170 | } | 176 | } |
171 | ); | 177 | ); |
172 | modalInstance.result.then( | 178 | modalInstance.result.then( |
173 | function(efectivo) { | 179 | function(efectivo) { |
174 | var cobro = { | 180 | var cobro = { |
175 | tipo: 'Efectivo', | 181 | tipo: 'Efectivo', |
176 | fecha: new Date(), | 182 | fecha: new Date(), |
177 | importe: efectivo | 183 | importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR |
178 | }; | 184 | }; |
179 | $scope.cobrosTabla.push(cobro); | 185 | $scope.cobrosTabla.push(cobro); |
180 | }, function() { | 186 | }, function() { |
181 | 187 | ||
182 | } | 188 | } |
183 | ); | 189 | ); |
184 | }; | 190 | }; |
185 | 191 | ||
186 | $scope.seleccionarMoneda = function() { | 192 | $scope.seleccionarMoneda = function() { |
187 | var modalInstance = $uibModal.open( | 193 | var modalInstance = $uibModal.open( |
188 | { | 194 | { |
189 | ariaLabelledBy: 'Busqueda de Moneda', | 195 | ariaLabelledBy: 'Busqueda de Moneda', |
190 | templateUrl: 'modal-moneda.html', | 196 | templateUrl: 'modal-moneda.html', |
191 | controller: 'focaModalMonedaController', | 197 | controller: 'focaModalMonedaController', |
192 | size: 'lg' | 198 | size: 'lg' |
193 | } | 199 | } |
194 | ); | 200 | ); |
195 | modalInstance.result.then( | 201 | modalInstance.result.then( |
196 | function(moneda) { | 202 | function(moneda) { |
197 | $scope.seleccionarCotizacion(moneda); | 203 | $scope.seleccionarCotizacion(moneda); |
198 | }, function() { | 204 | }, function() { |
199 | 205 | ||
200 | } | 206 | } |
201 | ); | 207 | ); |
202 | }; | 208 | }; |
203 | 209 | ||
204 | $scope.seleccionarCobrador = function() { | 210 | $scope.seleccionarCobrador = function() { |
205 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
206 | { | 212 | { |
207 | ariaLabelledBy: 'Busqueda de Cobradores', | 213 | ariaLabelledBy: 'Busqueda de Cobradores', |
208 | templateUrl: 'modal-cobradores.html', | 214 | templateUrl: 'modal-cobradores.html', |
209 | controller: 'focaModalCobradoresController', | 215 | controller: 'focaModalCobradoresController', |
210 | size: 'lg' | 216 | size: 'lg' |
211 | } | 217 | } |
212 | ); | 218 | ); |
213 | modalInstance.result.then( | 219 | modalInstance.result.then( |
214 | function(cobrador) { | 220 | function(cobrador) { |
215 | addCabecera('Cobrador:', cobrador.nombre); | 221 | addCabecera('Cobrador:', cobrador.nombre); |
216 | $scope.cobranza.cobrador = cobrador; | 222 | $scope.cobranza.cobrador = cobrador; |
217 | }, function() { | 223 | }, function() { |
218 | 224 | ||
219 | } | 225 | } |
220 | ); | 226 | ); |
221 | }; | 227 | }; |
222 | 228 | ||
223 | $scope.seleccionarCotizacion = function(moneda) { | 229 | $scope.seleccionarCotizacion = function(moneda) { |
224 | var modalInstance = $uibModal.open( | 230 | var modalInstance = $uibModal.open( |
225 | { | 231 | { |
226 | ariaLabelledBy: 'Busqueda de Cotización', | 232 | ariaLabelledBy: 'Busqueda de Cotización', |
227 | templateUrl: 'modal-cotizacion.html', | 233 | templateUrl: 'modal-cotizacion.html', |
228 | controller: 'focaModalCotizacionController', | 234 | controller: 'focaModalCotizacionController', |
229 | size: 'lg', | 235 | size: 'lg', |
230 | resolve: {idMoneda: function() {return moneda.ID;}} | 236 | resolve: {idMoneda: function() {return moneda.ID;}} |
231 | } | 237 | } |
232 | ); | 238 | ); |
233 | modalInstance.result.then( | 239 | modalInstance.result.then( |
234 | function(cotizacion) { | 240 | function(cotizacion) { |
235 | $scope.cobranza.moneda = moneda; | 241 | $scope.cobranza.moneda = moneda; |
236 | $scope.cobranza.cotizacion = cotizacion; | 242 | $scope.cobranza.cotizacion = cotizacion; |
237 | addCabecera('Moneda:', moneda.DETALLE); | 243 | addCabecera('Moneda:', moneda.DETALLE); |
238 | addCabecera( | 244 | addCabecera( |
239 | 'Fecha cotizacion:', | 245 | 'Fecha cotizacion:', |
240 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 246 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
241 | ); | 247 | ); |
242 | addCabecera('Cotizacion:', cotizacion.VENDEDOR); | 248 | addCabecera('Cotizacion:', cotizacion.VENDEDOR); |
243 | }, function() { | 249 | }, function() { |
244 | 250 | ||
245 | } | 251 | } |
246 | ); | 252 | ); |
247 | }; | 253 | }; |
248 | 254 | ||
249 | $scope.agregarCobro = function(key) { | 255 | $scope.agregarCobro = function(key) { |
250 | if(key === 13) { | 256 | if(key === 13) { |
251 | var cobro = { | 257 | var cobro = { |
252 | cobro: 'Efectivo', | 258 | cobro: 'Efectivo', |
253 | fecha: new Date(), | 259 | fecha: new Date(), |
254 | importe: $scope.cobroEfectivo | 260 | importe: $scope.cobroEfectivo |
255 | }; | 261 | }; |
256 | $scope.cobrosTabla.push(cobro); | 262 | $scope.cobrosTabla.push(cobro); |
257 | } | 263 | } |
258 | }; | 264 | }; |
259 | 265 | ||
260 | $scope.getTotalDeuda = function() { | 266 | $scope.getTotalDeuda = function() { |
261 | var total = 0; | 267 | var total = 0; |
262 | for (var i = 0; i < $scope.facturaTabla.length; i++) { | 268 | for (var i = 0; i < $scope.facturaTabla.length; i++) { |
263 | total += $scope.facturaTabla[i].IPA; | 269 | total += $scope.facturaTabla[i].IPA; |
264 | } | 270 | } |
265 | return parseFloat(total.toFixed(2)); | 271 | return parseFloat(total.toFixed(2)); |
266 | }; | 272 | }; |
267 | 273 | ||
268 | $scope.getTotalCobrado = function() { | 274 | $scope.getTotalCobrado = function() { |
269 | var total = 0; | 275 | var total = 0; |
270 | for (var i = 0; i < $scope.cobrosTabla.length; i++) { | 276 | for (var i = 0; i < $scope.cobrosTabla.length; i++) { |
271 | total += $scope.cobrosTabla[i].importe; | 277 | total += $scope.cobrosTabla[i].importe; |
272 | } | 278 | } |
273 | return parseFloat(total.toFixed(2)); | 279 | return parseFloat(total.toFixed(2)); |
274 | }; | 280 | }; |
275 | 281 | ||
276 | $scope.getSubTotal = function() { | 282 | $scope.getSubTotal = function() { |
277 | if($scope.articuloACargar) { | 283 | if($scope.articuloACargar) { |
278 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 284 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
279 | } | 285 | } |
280 | }; | 286 | }; |
281 | //Recibe aviso si el teclado está en uso | 287 | //Recibe aviso si el teclado está en uso |
282 | // $rootScope.$on('usarTeclado', function(event, data) { | 288 | // $rootScope.$on('usarTeclado', function(event, data) { |
283 | // if(data) { | 289 | // if(data) { |
284 | // $scope.mostrarTeclado = true; | 290 | // $scope.mostrarTeclado = true; |
285 | // return; | 291 | // return; |
286 | // } | 292 | // } |
287 | // $scope.mostrarTeclado = false; | 293 | // $scope.mostrarTeclado = false; |
288 | // }) | 294 | // }) |
289 | $scope.selectFocus = function($event) { | 295 | $scope.selectFocus = function($event) { |
290 | //Si el teclado esta en uso no selecciona el valor | 296 | //Si el teclado esta en uso no selecciona el valor |
291 | // if($scope.mostrarTeclado) { | 297 | // if($scope.mostrarTeclado) { |
292 | // return; | 298 | // return; |
293 | // } | 299 | // } |
294 | $event.target.select(); | 300 | $event.target.select(); |
295 | }; | 301 | }; |
296 | 302 | ||
297 | $scope.salir = function() { | 303 | $scope.salir = function() { |
298 | $location.path('/'); | 304 | $location.path('/'); |
299 | }; | 305 | }; |
300 | 306 | ||
301 | $scope.parsearATexto = function(articulo) { | 307 | $scope.parsearATexto = function(articulo) { |
302 | articulo.cantidad = parseFloat(articulo.cantidad); | 308 | articulo.cantidad = parseFloat(articulo.cantidad); |
303 | articulo.precio = parseFloat(articulo.precio); | 309 | articulo.precio = parseFloat(articulo.precio); |
304 | }; | 310 | }; |
305 | 311 | ||
306 | $scope.rellenar = function(relleno, longitud) { | 312 | $scope.rellenar = function(relleno, longitud) { |
307 | relleno = '' + relleno; | 313 | relleno = '' + relleno; |
308 | while (relleno.length < longitud) { | 314 | while (relleno.length < longitud) { |
309 | relleno = '0' + relleno; | 315 | relleno = '0' + relleno; |
310 | } | 316 | } |
311 | 317 | ||
312 | return relleno; | 318 | return relleno; |
313 | }; | 319 | }; |
314 | 320 | ||
315 | $scope.quitarFactura = function(key) { | 321 | $scope.quitarFactura = function(key) { |
316 | $scope.facturaTabla.splice(key, 1); | 322 | $scope.facturaTabla.splice(key, 1); |
317 | }; | 323 | }; |
318 | 324 | ||
319 | $scope.quitarCobro = function(key) { | 325 | $scope.quitarCobro = function(key) { |
320 | $scope.cobrosTabla.splice(key, 1); | 326 | $scope.cobrosTabla.splice(key, 1); |
321 | }; | 327 | }; |
322 | 328 | ||
323 | function addCabecera(label, valor) { | 329 | function addCabecera(label, valor) { |
324 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 330 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
325 | if(propiedad.length === 1) { | 331 | if(propiedad.length === 1) { |
326 | propiedad[0].valor = valor; | 332 | propiedad[0].valor = valor; |
327 | } else { | 333 | } else { |
328 | $scope.cabecera.push({label: label, valor: valor}); | 334 | $scope.cabecera.push({label: label, valor: valor}); |
329 | } | 335 | } |
330 | } | 336 | } |
331 | // TODO: descomentar cuando se use | 337 | // TODO: descomentar cuando se use |
332 | /*function removeCabecera(label) { | 338 | /*function removeCabecera(label) { |
333 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 339 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
334 | if(propiedad.length === 1){ | 340 | if(propiedad.length === 1){ |
335 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 341 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
336 | } | 342 | } |
337 | }*/ | 343 | }*/ |
338 | } | 344 | } |
339 | ]); | 345 | ]); |
340 | 346 |
src/views/cobranza.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row"> | 7 | <div class="row"> |
8 | <div class="col-12 col-sm-4 nota-pedido"> | 8 | <div class="col-12 col-sm-4 nota-pedido"> |
9 | <strong>RECIBO DE COBRANZA</strong> | 9 | <strong>RECIBO DE COBRANZA</strong> |
10 | </div> | 10 | </div> |
11 | <div class="col-5 col-sm-4 numero-pedido" | 11 | <div class="col-5 col-sm-4 numero-pedido" |
12 | >Nº {{puntoVenta}}-{{comprobante}} | 12 | >Nº {{puntoVenta}}-{{comprobante}} |
13 | </div> | 13 | </div> |
14 | <div class="col-7 col-sm-4 text-right"> | 14 | <div class="col-7 col-sm-4 text-right"> |
15 | Fecha: | 15 | Fecha: |
16 | <span | 16 | <span |
17 | ng-show="!datepickerAbierto" | 17 | ng-show="!datepickerAbierto" |
18 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 18 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" |
19 | ng-click="datepickerAbierto = true" | 19 | ng-click="datepickerAbierto = true" |
20 | > | 20 | > |
21 | </span> | 21 | </span> |
22 | <input | 22 | <input |
23 | ng-show="datepickerAbierto" | 23 | ng-show="datepickerAbierto" |
24 | type="date" | 24 | type="date" |
25 | ng-model="now" | 25 | ng-model="now" |
26 | ng-change="datepickerAbierto = false" | 26 | ng-change="datepickerAbierto = false" |
27 | ng-blur="datepickerAbierto = false" | 27 | ng-blur="datepickerAbierto = false" |
28 | class="form-control form-control-sm col-8 float-right" | 28 | class="form-control form-control-sm col-8 float-right" |
29 | foca-focus="datepickerAbierto" | 29 | foca-focus="datepickerAbierto" |
30 | hasta-hoy | 30 | hasta-hoy |
31 | /> | 31 | /> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | <div class="row"> | 34 | <div class="row"> |
35 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 35 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
36 | <span class="label" ng-bind="cab.label"></span> | 36 | <span class="label" ng-bind="cab.label"></span> |
37 | <span class="valor" ng-bind="cab.valor"></span> | 37 | <span class="valor" ng-bind="cab.valor"></span> |
38 | </div> | 38 | </div> |
39 | <a | 39 | <a |
40 | class="btn col-12 btn-secondary d-sm-none" | 40 | class="btn col-12 btn-secondary d-sm-none" |
41 | ng-show="cabecera.length > 0" | 41 | ng-show="cabecera.length > 0" |
42 | ng-click="showCabecera = !showCabecera" | 42 | ng-click="showCabecera = !showCabecera" |
43 | > | 43 | > |
44 | <i | 44 | <i |
45 | class="fa fa-chevron-down" | 45 | class="fa fa-chevron-down" |
46 | ng-hide="showCabecera" | 46 | ng-hide="showCabecera" |
47 | aria-hidden="true" | 47 | aria-hidden="true" |
48 | > | 48 | > |
49 | </i> | 49 | </i> |
50 | <i | 50 | <i |
51 | class="fa fa-chevron-up" | 51 | class="fa fa-chevron-up" |
52 | ng-show="showCabecera" | 52 | ng-show="showCabecera" |
53 | aria-hidden="true"> | 53 | aria-hidden="true"> |
54 | </i> | 54 | </i> |
55 | </a> | 55 | </a> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | <div class="row p-1 botonera-secundaria"> | 59 | <div class="row p-1 botonera-secundaria"> |
60 | <div class="col-12"> | 60 | <div class="col-12"> |
61 | <div class="row"> | 61 | <div class="row"> |
62 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 62 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
63 | <button | 63 | <button |
64 | type="button" | 64 | type="button" |
65 | class="btn btn-default btn-block btn-xs text-left py-2" | 65 | class="btn btn-default btn-block btn-xs text-left py-2" |
66 | ng-click="boton.accion()" | 66 | ng-click="boton.accion()" |
67 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 67 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
68 | > | 68 | > |
69 | <i | 69 | <i |
70 | class="fa fa-arrow-circle-right" | 70 | class="fa fa-arrow-circle-right" |
71 | ng-show="boton.texto != ''" | 71 | ng-show="boton.texto != ''" |
72 | ></i> | 72 | ></i> |
73 | | 73 | |
74 | {{boton.texto}} | 74 | {{boton.texto}} |
75 | </button> | 75 | </button> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | </div> | 79 | </div> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | </form> | 82 | </form> |
83 | <div class="row"> | 83 | <div class="row"> |
84 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 84 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
85 | <!-- PC --> | 85 | <!-- PC --> |
86 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> | 86 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> |
87 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 87 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
88 | <thead> | 88 | <thead> |
89 | <tr class="d-flex"> | 89 | <tr class="d-flex"> |
90 | <th class="col-auto">#</th> | 90 | <th class="col-auto">#</th> |
91 | <th class="col">Comprobante</th> | 91 | <th class="col">Comprobante</th> |
92 | <th class="col">Fecha</th> | 92 | <th class="col">Fecha</th> |
93 | <th class="col">Importe</th> | 93 | <th class="col">Importe</th> |
94 | <th class="col-auto"> | 94 | <th class="col-auto"> |
95 | <button | 95 | <button |
96 | class="btn btn-outline-secondary selectable" | 96 | class="btn btn-outline-secondary selectable" |
97 | ng-click="show = !show; masMenos()" | 97 | ng-click="show = !show; masMenos()" |
98 | > | 98 | > |
99 | <i | 99 | <i |
100 | class="fa fa-chevron-down" | 100 | class="fa fa-chevron-down" |
101 | ng-show="show" | 101 | ng-show="show" |
102 | aria-hidden="true" | 102 | aria-hidden="true" |
103 | > | 103 | > |
104 | </i> | 104 | </i> |
105 | <i | 105 | <i |
106 | class="fa fa-chevron-up" | 106 | class="fa fa-chevron-up" |
107 | ng-hide="show" | 107 | ng-hide="show" |
108 | aria-hidden="true"> | 108 | aria-hidden="true"> |
109 | </i> | 109 | </i> |
110 | </button> | 110 | </button> |
111 | </th> | 111 | </th> |
112 | </th> | 112 | </th> |
113 | </tr> | 113 | </tr> |
114 | </thead> | 114 | </thead> |
115 | <tbody class="tabla-articulo-body"> | 115 | <tbody class="tabla-articulo-body"> |
116 | <tr | 116 | <tr |
117 | ng-repeat="(key, factura) in facturaTabla" | 117 | ng-repeat="(key, factura) in facturaTabla" |
118 | class="d-flex" | 118 | class="d-flex" |
119 | ng-show="show || key == facturaTabla.length - 1" | 119 | ng-show="show || key == facturaTabla.length - 1" |
120 | > | 120 | > |
121 | <td ng-bind="key + 1" class="col-auto"></td> | 121 | <td ng-bind="key + 1" class="col-auto"></td> |
122 | <td class="col" | 122 | <td class="col" |
123 | ng-bind= | 123 | ng-bind= |
124 | "(factura.TCO + '-' + factura.TIP + '-' + | 124 | "(factura.TCO + '-' + factura.TIP + '-' + |
125 | factura.SUC + '-' + factura.NCO)" | 125 | factura.SUC + '-' + factura.NCO)" |
126 | ></td> | 126 | ></td> |
127 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> | 127 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> |
128 | <td | 128 | <td |
129 | class="col" | 129 | class="col" |
130 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 130 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
131 | currency: cobranza.moneda.SIMBOLO"></td> | 131 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
132 | <td class="text-center col-auto"> | 132 | <td class="text-center col-auto"> |
133 | <button | 133 | <button |
134 | class="btn btn-outline-secondary" | 134 | class="btn btn-outline-secondary" |
135 | ng-click="quitarFactura(key)" | 135 | ng-click="quitarFactura(key)" |
136 | > | 136 | > |
137 | <i class="fa fa-trash"></i> | 137 | <i class="fa fa-trash"></i> |
138 | </button> | 138 | </button> |
139 | </td> | 139 | </td> |
140 | </tr> | 140 | </tr> |
141 | </tbody> | 141 | </tbody> |
142 | <tfoot> | 142 | <tfoot> |
143 | <tr ng-show="cargando" class="d-flex"> | 143 | <tr ng-show="cargando" class="d-flex"> |
144 | <td class="col-2"> | 144 | <td class="col-2"> |
145 | <a | 145 | <a |
146 | class="form-control form-control-sm btn btn-secondary" | 146 | class="form-control form-control-sm btn btn-secondary" |
147 | ng-click="seleccionarFactura()" | 147 | ng-click="seleccionarFactura()" |
148 | >Pendientes</a> | 148 | >Pendientes</a> |
149 | </td> | 149 | </td> |
150 | </tr> | 150 | </tr> |
151 | <tr class="d-flex"> | 151 | <tr class="d-flex"> |
152 | <td class="col-auto px-1"> | 152 | <td class="col-auto px-1"> |
153 | <strong>Comprobantes:</strong> | 153 | <strong>Comprobantes:</strong> |
154 | <a ng-bind="facturaTabla.length"></a> | 154 | <a ng-bind="facturaTabla.length"></a> |
155 | </td> | 155 | </td> |
156 | <td class="text-right ml-auto table-celda-total no-border-top"> | 156 | <td class="text-right ml-auto table-celda-total no-border-top"> |
157 | <strong>Cancela:</strong> | 157 | <strong>Cancela:</strong> |
158 | </td> | 158 | </td> |
159 | <td class="table-celda-total text-right no-border-top"> | 159 | <td class="table-celda-total text-right no-border-top"> |
160 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 160 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
161 | currency: cobranza.moneda.SIMBOLO}}</strong> | 161 | currency: cobranza.moneda.SIMBOLO}}</strong> |
162 | </td> | 162 | </td> |
163 | <td class="text-right ml-auto table-celda-total no-border-top"> | 163 | <td class="text-right ml-auto table-celda-total no-border-top"> |
164 | <strong>Total Cobrado:</strong> | 164 | <strong>Total Cobrado:</strong> |
165 | </td> | 165 | </td> |
166 | <td class="table-celda-total text-right no-border-top"> | 166 | <td class="table-celda-total text-right no-border-top"> |
167 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 167 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
168 | currency: cobranza.moneda.SIMBOLO}}</strong> | 168 | currency: cobranza.moneda.SIMBOLO}}</strong> |
169 | </td> | 169 | </td> |
170 | <td class="text-right ml-auto table-celda-total no-border-top"> | 170 | <td class="text-right ml-auto table-celda-total no-border-top"> |
171 | <strong>DF:</strong> | 171 | <strong>DF:</strong> |
172 | </td> | 172 | </td> |
173 | <td class="table-celda-total text-right no-border-top"> | 173 | <td class="table-celda-total text-right no-border-top"> |
174 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / | 174 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / |
175 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 175 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
176 | </strong> | 176 | </strong> |
177 | </td> | 177 | </td> |
178 | </tr> | 178 | </tr> |
179 | </tfoot> | 179 | </tfoot> |
180 | </table> | 180 | </table> |
181 | </div> | 181 | </div> |
182 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> | 182 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> |
183 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 183 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
184 | <thead> | 184 | <thead> |
185 | <tr class="d-flex"> | 185 | <tr class="d-flex"> |
186 | <th class="col-auto">#</th> | 186 | <th class="col-auto">#</th> |
187 | <th class="col">Cobro</th> | 187 | <th class="col">Cobro</th> |
188 | <th class="col">Fecha</th> | 188 | <th class="col">Fecha</th> |
189 | <th class="col">Importe</th> | 189 | <th class="col">Importe</th> |
190 | <th class="col-auto"> | 190 | <th class="col-auto"> |
191 | <button | 191 | <button |
192 | class="btn btn-outline-secondary selectable" | 192 | class="btn btn-outline-secondary selectable" |
193 | ng-click="show = !show; masMenos()" | 193 | ng-click="show = !show; masMenos()" |
194 | > | 194 | > |
195 | <i | 195 | <i |
196 | class="fa fa-chevron-down" | 196 | class="fa fa-chevron-down" |
197 | ng-show="show" | 197 | ng-show="show" |
198 | aria-hidden="true" | 198 | aria-hidden="true" |
199 | > | 199 | > |
200 | </i> | 200 | </i> |
201 | <i | 201 | <i |
202 | class="fa fa-chevron-up" | 202 | class="fa fa-chevron-up" |
203 | ng-hide="show" | 203 | ng-hide="show" |
204 | aria-hidden="true"> | 204 | aria-hidden="true"> |
205 | </i> | 205 | </i> |
206 | </button> | 206 | </button> |
207 | </th> | 207 | </th> |
208 | </th> | 208 | </th> |
209 | </tr> | 209 | </tr> |
210 | </thead> | 210 | </thead> |
211 | <tbody class="tabla-articulo-body"> | 211 | <tbody class="tabla-articulo-body"> |
212 | <tr | 212 | <tr |
213 | ng-repeat="(key, cobro) in cobrosTabla" | 213 | ng-repeat="(key, cobro) in cobrosTabla" |
214 | class="d-flex" | 214 | class="d-flex" |
215 | ng-show="show || key == cobrosTabla.length - 1" | 215 | ng-show="show || key == cobrosTabla.length - 1" |
216 | > | 216 | > |
217 | <td ng-bind="key + 1" class="col-auto"></td> | 217 | <td ng-bind="key + 1" class="col-auto"></td> |
218 | <td class="col" ng-bind="cobro.tipo"></td> | 218 | <td class="col" ng-bind="cobro.tipo"></td> |
219 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> | 219 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> |
220 | <td | 220 | <td |
221 | class="col" | 221 | class="col" |
222 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 222 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
223 | currency: cobranza.moneda.SIMBOLO"></td> | 223 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
224 | <td class="text-center col-auto"> | 224 | <td class="text-center col-auto"> |
225 | <button | 225 | <button |
226 | class="btn btn-outline-secondary" | 226 | class="btn btn-outline-secondary" |
227 | ng-click="quitarCobro(key)" | 227 | ng-click="quitarCobro(key)" |
228 | > | 228 | > |
229 | <i class="fa fa-trash"></i> | 229 | <i class="fa fa-trash"></i> |
230 | </button> | 230 | </button> |
231 | </td> | 231 | </td> |
232 | </tr> | 232 | </tr> |
233 | </tbody> | 233 | </tbody> |
234 | <tfoot> | 234 | <tfoot> |
235 | <tr ng-show="cargando" class="d-flex"> | 235 | <tr ng-show="cargando" class="d-flex"> |
236 | <td class="col-2"> | 236 | <td class="col-2"> |
237 | <a | 237 | <a |
238 | class="form-control form-control-sm btn btn-secondary" | 238 | class="form-control form-control-sm btn btn-secondary" |
239 | ng-click="seleccionarCheque()" | 239 | ng-click="seleccionarCheque()" |
240 | >Cheque</a> | 240 | >Cheque</a> |
241 | </td> | 241 | </td> |
242 | <td class="col-2"> | 242 | <td class="col-2"> |
243 | <a | 243 | <a |
244 | class="form-control form-control-sm btn btn-secondary" | 244 | class="form-control form-control-sm btn btn-secondary" |
245 | ng-click="seleccionarEfectivo()" | 245 | ng-click="seleccionarEfectivo()" |
246 | >Efectivo</a> | 246 | >Efectivo</a> |
247 | </td> | 247 | </td> |
248 | </tr> | 248 | </tr> |
249 | <tr class="d-flex"> | 249 | <tr class="d-flex"> |
250 | <td class="col-auto px-1"> | 250 | <td class="col-auto px-1"> |
251 | <strong>Cobros:</strong> | 251 | <strong>Cobros:</strong> |
252 | <a ng-bind="cobrosTabla.length"></a> | 252 | <a ng-bind="cobrosTabla.length"></a> |
253 | </td> | 253 | </td> |
254 | <td class="text-right ml-auto table-celda-total no-border-top"> | 254 | <td class="text-right ml-auto table-celda-total no-border-top"> |
255 | <strong>Total Deuda:</strong> | 255 | <strong>Total Deuda:</strong> |
256 | </td> | 256 | </td> |
257 | <td class="table-celda-total text-right no-border-top"> | 257 | <td class="table-celda-total text-right no-border-top"> |
258 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 258 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
259 | currency: cobranza.moneda.SIMBOLO}}</strong> | 259 | currency: cobranza.moneda.SIMBOLO}}</strong> |
260 | </td> | 260 | </td> |
261 | <td class="text-right ml-auto table-celda-total no-border-top"> | 261 | <td class="text-right ml-auto table-celda-total no-border-top"> |
262 | <strong>Total Cobrado:</strong> | 262 | <strong>Total Cobrado:</strong> |
263 | </td> | 263 | </td> |
264 | <td class="table-celda-total text-right no-border-top"> | 264 | <td class="table-celda-total text-right no-border-top"> |
265 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 265 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
266 | currency: cobranza.moneda.SIMBOLO}}</strong> | 266 | currency: cobranza.moneda.SIMBOLO}}</strong> |
267 | </td> | 267 | </td> |
268 | <td class="text-right ml-auto table-celda-total no-border-top"> | 268 | <td class="text-right ml-auto table-celda-total no-border-top"> |
269 | <strong>DF:</strong> | 269 | <strong>DF:</strong> |
270 | </td> | 270 | </td> |
271 | <td class="table-celda-total text-right no-border-top"> | 271 | <td class="table-celda-total text-right no-border-top"> |
272 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / | 272 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / |
273 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 273 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
274 | </strong> | 274 | </strong> |
275 | </td> | 275 | </td> |
276 | </tr> | 276 | </tr> |
277 | </tfoot> | 277 | </tfoot> |
278 | </table> | 278 | </table> |
279 | </div> | 279 | </div> |
280 | <!-- MOBILE --> | 280 | <!-- MOBILE --> |
281 | <div class="row d-sm-none"> | 281 | <div class="row d-sm-none"> |
282 | <!-- FACTURAS --> | ||
282 | <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda"> | 283 | <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda"> |
283 | <thead> | 284 | <thead> |
284 | <tr class="d-flex"> | 285 | <tr class="d-flex"> |
285 | <th class="">#</th> | 286 | <th class="">#</th> |
286 | <th class="col px-0"> | 287 | <th class="col px-0"> |
287 | <div class="d-flex"> | 288 | <div class="d-flex"> |
288 | <div class="col-4 px-1">Factura</div> | 289 | <div class="col-4 px-1">Factura</div> |
289 | <div class="col-4 px-1">Fecha</div> | 290 | <div class="col-4 px-1">Fecha</div> |
290 | <div class="col-4 px-1">Importe</div> | 291 | <div class="col-4 px-1">Importe</div> |
291 | </div> | 292 | </div> |
292 | </th> | 293 | </th> |
293 | <th class="text-center tamaño-boton"> | 294 | <th class="text-center tamaño-boton"> |
294 | | 295 | |
295 | </th> | 296 | </th> |
296 | </tr> | 297 | </tr> |
297 | </thead> | 298 | </thead> |
298 | <tbody> | 299 | <tbody> |
299 | <tr | 300 | <tr |
300 | ng-repeat="(key, factura) in facturaTabla" | 301 | ng-repeat="(key, factura) in facturaTabla" |
301 | ng-show="show || key == facturaTabla.length - 1" | 302 | ng-show="show || key == facturaTabla.length - 1" |
302 | > | 303 | > |
303 | <td class="w-100 align-middle d-flex p-0"> | 304 | <td class="w-100 align-middle d-flex p-0"> |
304 | <div class="align-middle p-1"> | 305 | <div class="align-middle p-1"> |
305 | <span ng-bind="key+1" class="align-middle"></span> | 306 | <span ng-bind="key+1" class="align-middle"></span> |
306 | </div> | 307 | </div> |
307 | <div class="col px-0"> | 308 | <div class="col px-0"> |
308 | <div class="d-flex"> | 309 | <div class="d-flex"> |
309 | <div class="col-4 px-1"> | 310 | <div class="col-4 px-1"> |
310 | <span ng-bind= | 311 | <span ng-bind= |
311 | "(factura.TCO + '-' + factura.TIP + '-' + | 312 | "(factura.TCO + '-' + factura.TIP + '-' + |
312 | factura.SUC + '-' + factura.NCO)" | 313 | factura.SUC + '-' + factura.NCO)" |
313 | ></span> | 314 | ></span> |
314 | </div> | 315 | </div> |
315 | <div class="col-4 px-1"> | 316 | <div class="col-4 px-1"> |
316 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> | 317 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> |
317 | </div> | 318 | </div> |
318 | <div class="col-4 px-1"> | 319 | <div class="col-4 px-1"> |
319 | <span | 320 | <span |
320 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 321 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
321 | currency:cobranza.moneda.SIMBOLO"></span> | 322 | currency:cobranza.moneda.SIMBOLO : 4"></span> |
322 | </div> | 323 | </div> |
323 | </div> | 324 | </div> |
324 | </div> | 325 | </div> |
325 | <div class="align-middle p-1"> | 326 | <div class="align-middle p-1"> |
326 | <button | 327 | <button |
327 | class="btn btn-outline-secondary" | 328 | class="btn btn-outline-secondary" |
328 | ng-click="quitarFactura(key)" | 329 | ng-click="quitarFactura(key)" |
329 | > | 330 | > |
330 | <i class="fa fa-trash"></i> | 331 | <i class="fa fa-trash"></i> |
331 | </button> | 332 | </button> |
332 | </div> | 333 | </div> |
333 | </td> | 334 | </td> |
334 | </tr> | 335 | </tr> |
335 | </tbody> | 336 | </tbody> |
336 | <tfoot> | 337 | <tfoot> |
337 | <!-- SELECCIONAR PRODUCTO --> | 338 | <!-- SELECCIONAR PRODUCTO --> |
338 | <tr ng-show="cargando" class="d-flex"> | 339 | <tr ng-show="cargando" class="d-flex"> |
339 | <td class="col-12"> | 340 | <td class="col-12"> |
340 | <input | 341 | <input |
341 | placeholder="Seleccione Factura" | 342 | placeholder="Seleccione Factura" |
342 | class="form-control form-control-sm" | 343 | class="form-control form-control-sm" |
343 | readonly | 344 | readonly |
344 | ng-click="seleccionarFactura()" | 345 | ng-click="seleccionarFactura()" |
345 | /> | 346 | /> |
346 | </td> | 347 | </td> |
347 | </tr> | 348 | </tr> |
348 | <!-- TOOGLE EXPANDIR --> | 349 | <!-- TOOGLE EXPANDIR --> |
349 | <tr> | 350 | <tr> |
350 | <td class="col"> | 351 | <td class="col"> |
351 | <button | 352 | <button |
352 | class="btn btn-outline-secondary selectable w-100" | 353 | class="btn btn-outline-secondary selectable w-100" |
353 | ng-click="show = !show; masMenos()" | 354 | ng-click="show = !show; masMenos()" |
354 | ng-show="facturaTabla.length > 0" | 355 | ng-show="facturaTabla.length > 0" |
355 | > | 356 | > |
356 | <i | 357 | <i |
357 | class="fa fa-chevron-down" | 358 | class="fa fa-chevron-down" |
358 | ng-hide="show" | 359 | ng-hide="show" |
359 | aria-hidden="true" | 360 | aria-hidden="true" |
360 | > | 361 | > |
361 | </i> | 362 | </i> |
362 | <i | 363 | <i |
363 | class="fa fa-chevron-up" | 364 | class="fa fa-chevron-up" |
364 | ng-show="show" | 365 | ng-show="show" |
365 | aria-hidden="true"> | 366 | aria-hidden="true"> |
366 | </i> | 367 | </i> |
367 | </button> | 368 | </button> |
368 | </td> | 369 | </td> |
369 | </tr> | 370 | </tr> |
370 | <!-- FOOTER --> | 371 | <!-- FOOTER --> |
371 | <tr class="d-flex"> | 372 | <tr class="d-flex"> |
372 | <td class="align-middle no-border-top" colspan="2"> | 373 | <td class="align-middle no-border-top" colspan="2"> |
373 | <strong>Cantidad Items:</strong> | 374 | <strong>Cantidad Items:</strong> |
374 | <a ng-bind="facturaTabla.length"></a> | 375 | <a ng-bind="facturaTabla.length"></a> |
375 | </td> | 376 | </td> |
376 | </tr> | 377 | </tr> |
377 | </tfoot> | 378 | </tfoot> |
378 | </table> | 379 | </table> |
380 | <!-- COBROS --> | ||
379 | <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda"> | 381 | <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda"> |
380 | <thead> | 382 | <thead> |
381 | <tr class="d-flex"> | 383 | <tr class="d-flex"> |
382 | <th class="">#</th> | 384 | <th class="">#</th> |
383 | <th class="col px-0"> | 385 | <th class="col px-0"> |
384 | <div class="d-flex"> | 386 | <div class="d-flex"> |
385 | <div class="col-4 px-1">Cobro</div> | 387 | <div class="col-4 px-1">Cobro</div> |
386 | <div class="col-4 px-1">Fecha</div> | 388 | <div class="col-4 px-1">Fecha</div> |
387 | <div class="col-4 px-1">Importe</div> | 389 | <div class="col-4 px-1">Importe</div> |
388 | </div> | 390 | </div> |
389 | </th> | 391 | </th> |
390 | <th class="text-center tamaño-boton"> | 392 | <th class="text-center tamaño-boton"> |
391 | | 393 | |
392 | </th> | 394 | </th> |
393 | </tr> | 395 | </tr> |
394 | </thead> | 396 | </thead> |
395 | <tbody> | 397 | <tbody> |
396 | <tr | 398 | <tr |
397 | ng-repeat="(key, cobro) in cobrosTabla" | 399 | ng-repeat="(key, cobro) in cobrosTabla" |
398 | ng-show="show || key == cobrosTabla.length - 1" | 400 | ng-show="show || key == cobrosTabla.length - 1" |
399 | > | 401 | > |
400 | <td class="w-100 align-middle d-flex p-0"> | 402 | <td class="w-100 align-middle d-flex p-0"> |
401 | <div class="align-middle p-1"> | 403 | <div class="align-middle p-1"> |
402 | <span ng-bind="key+1" class="align-middle"></span> | 404 | <span ng-bind="key+1" class="align-middle"></span> |
403 | </div> | 405 | </div> |
404 | <div class="col px-0"> | 406 | <div class="col px-0"> |
405 | <div class="d-flex"> | 407 | <div class="d-flex"> |
406 | <div class="col-4 px-1"> | 408 | <div class="col-4 px-1"> |
407 | <span ng-bind="cobro.tipo" | 409 | <span ng-bind="cobro.tipo" |
408 | ></span> | 410 | ></span> |
409 | </div> | 411 | </div> |
410 | <div class="col-4 px-1"> | 412 | <div class="col-4 px-1"> |
411 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> | 413 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> |
412 | </div> | 414 | </div> |
413 | <div class="col-4 px-1"> | 415 | <div class="col-4 px-1"> |
414 | <span | 416 | <span |
415 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 417 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
416 | currency: cobranza.moneda.SIMBOLO"></span> | 418 | currency: cobranza.moneda.SIMBOLO : 4"></span> |
417 | </div> | 419 | </div> |
418 | </div> | 420 | </div> |
419 | </div> | 421 | </div> |
420 | <div class="align-middle p-1"> | 422 | <div class="align-middle p-1"> |
421 | <button | 423 | <button |
422 | class="btn btn-outline-secondary" | 424 | class="btn btn-outline-secondary" |
423 | ng-click="quitarCobro(key)" | 425 | ng-click="quitarCobro(key)" |
424 | > | 426 | > |
425 | <i class="fa fa-trash"></i> | 427 | <i class="fa fa-trash"></i> |
426 | </button> | 428 | </button> |
427 | </div> | 429 | </div> |
428 | </td> | 430 | </td> |
429 | </tr> | 431 | </tr> |
430 | </tbody> | 432 | </tbody> |
431 | <tfoot> | 433 | <tfoot> |
432 | <!-- SELECCIONAR PRODUCTO --> | 434 | <!-- SELECCIONAR PRODUCTO --> |
433 | <tr ng-show="cargando" class="d-flex"> | 435 | <tr ng-show="cargando" class="d-flex"> |
434 | <td class="col-6"> | 436 | <td class="col-6"> |
435 | <input | 437 | <input |
436 | placeholder="Cheque" | 438 | placeholder="Cheque" |
437 | class="form-control form-control-sm" | 439 | class="form-control form-control-sm" |
438 | readonly | 440 | readonly |
439 | ng-click="seleccionarCheque()" | 441 | ng-click="seleccionarCheque()" |
440 | /> | 442 | /> |
441 | </td> | 443 | </td> |
442 | <td class="col-6"> | 444 | <td class="col-6"> |
443 | <input | 445 | <input |
444 | placeholder="Efectivo" | 446 | placeholder="Efectivo" |
445 | class="form-control form-control-sm" | 447 | class="form-control form-control-sm" |
446 | readonly | 448 | readonly |
447 | ng-click="seleccionarEfectivo()" | 449 | ng-click="seleccionarEfectivo()" |
448 | /> | 450 | /> |
449 | </td> | 451 | </td> |
450 | </tr> | 452 | </tr> |
451 | <!-- TOOGLE EXPANDIR --> | 453 | <!-- TOOGLE EXPANDIR --> |
452 | <tr> | 454 | <tr> |
453 | <td class="col"> | 455 | <td class="col"> |
454 | <button | 456 | <button |
455 | class="btn btn-outline-secondary selectable w-100" | 457 | class="btn btn-outline-secondary selectable w-100" |
456 | ng-click="show = !show; masMenos()" | 458 | ng-click="show = !show; masMenos()" |
457 | ng-show="cobrosTabla.length > 0" | 459 | ng-show="cobrosTabla.length > 0" |
458 | > | 460 | > |
459 | <i | 461 | <i |
460 | class="fa fa-chevron-down" | 462 | class="fa fa-chevron-down" |
461 | ng-hide="show" | 463 | ng-hide="show" |
462 | aria-hidden="true" | 464 | aria-hidden="true" |
463 | > | 465 | > |
464 | </i> | 466 | </i> |
465 | <i | 467 | <i |
466 | class="fa fa-chevron-up" | 468 | class="fa fa-chevron-up" |
467 | ng-show="show" | 469 | ng-show="show" |
468 | aria-hidden="true"> | 470 | aria-hidden="true"> |
469 | </i> | 471 | </i> |
470 | </button> | 472 | </button> |
471 | </td> | 473 | </td> |
472 | </tr> | 474 | </tr> |
473 | <!-- FOOTER --> | 475 | <!-- FOOTER --> |
474 | <tr class="d-flex"> | 476 | <tr class="d-flex"> |
475 | <td class="align-middle no-border-top col-6"> | 477 | <td class="align-middle no-border-top col-6"> |
476 | <strong>Cantidad Items:</strong> | 478 | <strong>Cantidad Items:</strong> |
477 | <a ng-bind="cobrosTabla.length"></a> | 479 | <a ng-bind="cobrosTabla.length"></a> |
478 | </td> | 480 | </td> |
479 | </tfoot> | 481 | </tfoot> |
480 | </table> | 482 | </table> |
481 | </tr> | 483 | </tr> |
484 | <!-- DEUDA, COBRADO, DIFERENCIA --> | ||
482 | <table class="table-responsive"> | 485 | <table class="table-responsive"> |
483 | <tr class="d-flex row"> | 486 | <tr class="d-flex row"> |
484 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 487 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
485 | <strong>Deuda:</strong> | 488 | <strong>Deuda:</strong> |
486 | </td> | 489 | </td> |
487 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 490 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
488 | <strong>Cobrado:</strong> | 491 | <strong>Cobrado:</strong> |
489 | </td> | 492 | </td> |
490 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 493 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
491 | <strong>Diferencia:</strong> | 494 | <strong>Diferencia:</strong> |
492 | </td> | 495 | </td> |
493 | <td class="table-celda-total text-center no-border-top col-4"> | 496 | <td class="table-celda-total text-center no-border-top col-4"> |
494 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 497 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
495 | </td> | 498 | </td> |
496 | <td class="table-celda-total text-center no-border-top col-4"> | 499 | <td class="table-celda-total text-center no-border-top col-4"> |
497 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 500 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
498 | </td> | 501 | </td> |
499 | <td class="table-celda-total text-center no-border-top col-4"> | 502 | <td class="table-celda-total text-center no-border-top col-4"> |
500 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 503 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
501 | </td> | 504 | </td> |
502 | </tr> | 505 | </tr> |
503 | </table> | 506 | </table> |
504 | </div> | 507 | </div> |
505 | </div> | 508 | </div> |
506 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | 509 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> |
507 | <div class="row align-items-end"> | 510 | <div class="row align-items-end"> |
508 | <div class="col-12"> | 511 | <div class="col-12"> |
509 | <button | 512 | <button |
510 | ng-click="crearHojaRuta()" | 513 | ng-click="crearCobranza()" |
511 | type="submit" | ||
512 | title="Crear nota pedido" | 514 | title="Crear nota pedido" |
513 | class="btn btn-default btn-block mb-2"> | 515 | class="btn btn-default btn-block mb-2"> |
514 | Guardar | 516 | Guardar |
515 | </button> | 517 | </button> |
516 | <button | 518 | <button |
517 | ng-click="salir()" | 519 | ng-click="salir()" |
518 | type="button" | 520 | type="button" |
519 | title="Salir" | 521 | title="Salir" |
520 | class="btn btn-default btn-block"> | 522 | class="btn btn-default btn-block"> |
521 | Salir | 523 | Salir |
522 | </button> | 524 | </button> |
523 | </div> | 525 | </div> |
524 | </div> | 526 | </div> |
525 | </div> | 527 | </div> |
526 | </div> | 528 | </div> |
527 | <div class="row d-md-none fixed-bottom"> | 529 | <div class="row d-md-none fixed-bottom"> |
528 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 530 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
529 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 531 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
530 | <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> | 532 | <span class="mr-3 ml-auto" ng-click="crearCobranza()">Guardar</span> |
531 | </div> | 533 | </div> |
532 | </div> | 534 | </div> |
533 | </div> | 535 | </div> |