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