Commit 1515b17487d19ab37506d45bb7b8e2b685799f1c
1 parent
2a6ca4e38e
Exists in
master
valido que la diferencia sea 0
Showing
2 changed files
with
21 additions
and
13 deletions
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: 'Deuda', 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>Cobranza</strong> | 9 | <strong>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">Factura</th> |
92 | <th class="col">Cliente</th> | 92 | <th class="col">Cliente</th> |
93 | <th class="col">Fecha</th> | 93 | <th class="col">Fecha</th> |
94 | <th class="col">Importe</th> | 94 | <th class="col">Importe</th> |
95 | <th class="col-auto"> | 95 | <th class="col-auto"> |
96 | <button | 96 | <button |
97 | class="btn btn-outline-secondary selectable" | 97 | class="btn btn-outline-secondary selectable" |
98 | ng-click="show = !show; masMenos()" | 98 | ng-click="show = !show; masMenos()" |
99 | > | 99 | > |
100 | <i | 100 | <i |
101 | class="fa fa-chevron-down" | 101 | class="fa fa-chevron-down" |
102 | ng-show="show" | 102 | ng-show="show" |
103 | aria-hidden="true" | 103 | aria-hidden="true" |
104 | > | 104 | > |
105 | </i> | 105 | </i> |
106 | <i | 106 | <i |
107 | class="fa fa-chevron-up" | 107 | class="fa fa-chevron-up" |
108 | ng-hide="show" | 108 | ng-hide="show" |
109 | aria-hidden="true"> | 109 | aria-hidden="true"> |
110 | </i> | 110 | </i> |
111 | </button> | 111 | </button> |
112 | </th> | 112 | </th> |
113 | </th> | 113 | </th> |
114 | </tr> | 114 | </tr> |
115 | </thead> | 115 | </thead> |
116 | <tbody class="tabla-articulo-body"> | 116 | <tbody class="tabla-articulo-body"> |
117 | <tr | 117 | <tr |
118 | ng-repeat="(key, factura) in facturaTabla" | 118 | ng-repeat="(key, factura) in facturaTabla" |
119 | class="d-flex" | 119 | class="d-flex" |
120 | ng-show="show || key == facturaTabla.length - 1" | 120 | ng-show="show || key == facturaTabla.length - 1" |
121 | > | 121 | > |
122 | <td ng-bind="key + 1" class="col-auto"></td> | 122 | <td ng-bind="key + 1" class="col-auto"></td> |
123 | <td class="col" | 123 | <td class="col" |
124 | ng-bind= | 124 | ng-bind= |
125 | "(factura.TCO + '-' + factura.TIP + '-' + | 125 | "(factura.TCO + '-' + factura.TIP + '-' + |
126 | factura.SUC + '-' + factura.NCO)" | 126 | factura.SUC + '-' + factura.NCO)" |
127 | ></td> | 127 | ></td> |
128 | <td class="col" ng-bind="factura.cliente.NOM"></td> | 128 | <td class="col" ng-bind="factura.cliente.NOM"></td> |
129 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> | 129 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> |
130 | <td | 130 | <td |
131 | class="col" | 131 | class="col" |
132 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 132 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
133 | currency: cobranza.moneda.SIMBOLO"></td> | 133 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
134 | <td class="text-center col-auto"> | 134 | <td class="text-center col-auto"> |
135 | <button | 135 | <button |
136 | class="btn btn-outline-secondary" | 136 | class="btn btn-outline-secondary" |
137 | ng-click="quitarFactura(key)" | 137 | ng-click="quitarFactura(key)" |
138 | > | 138 | > |
139 | <i class="fa fa-trash"></i> | 139 | <i class="fa fa-trash"></i> |
140 | </button> | 140 | </button> |
141 | </td> | 141 | </td> |
142 | </tr> | 142 | </tr> |
143 | </tbody> | 143 | </tbody> |
144 | <tfoot> | 144 | <tfoot> |
145 | <tr ng-show="cargando" class="d-flex"> | 145 | <tr ng-show="cargando" class="d-flex"> |
146 | <td class="col-2"> | 146 | <td class="col-2"> |
147 | <a | 147 | <a |
148 | class="form-control form-control-sm btn btn-secondary" | 148 | class="form-control form-control-sm btn btn-secondary" |
149 | ng-click="seleccionarFactura()" | 149 | ng-click="seleccionarFactura()" |
150 | >Factura</a> | 150 | >Factura</a> |
151 | </td> | 151 | </td> |
152 | </tr> | 152 | </tr> |
153 | <tr class="d-flex"> | 153 | <tr class="d-flex"> |
154 | <td class="col-auto px-1"> | 154 | <td class="col-auto px-1"> |
155 | <strong>Comprobantes:</strong> | 155 | <strong>Comprobantes:</strong> |
156 | <a ng-bind="facturaTabla.length"></a> | 156 | <a ng-bind="facturaTabla.length"></a> |
157 | </td> | 157 | </td> |
158 | <td class="text-right ml-auto table-celda-total no-border-top"> | 158 | <td class="text-right ml-auto table-celda-total no-border-top"> |
159 | <strong>Total Deuda:</strong> | 159 | <strong>Total Deuda:</strong> |
160 | </td> | 160 | </td> |
161 | <td class="table-celda-total text-right no-border-top"> | 161 | <td class="table-celda-total text-right no-border-top"> |
162 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 162 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
163 | currency: cobranza.moneda.SIMBOLO}}</strong> | 163 | currency: cobranza.moneda.SIMBOLO}}</strong> |
164 | </td> | 164 | </td> |
165 | <td class="text-right ml-auto table-celda-total no-border-top"> | 165 | <td class="text-right ml-auto table-celda-total no-border-top"> |
166 | <strong>Total Cobrado:</strong> | 166 | <strong>Total Cobrado:</strong> |
167 | </td> | 167 | </td> |
168 | <td class="table-celda-total text-right no-border-top"> | 168 | <td class="table-celda-total text-right no-border-top"> |
169 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 169 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
170 | currency: cobranza.moneda.SIMBOLO}}</strong> | 170 | currency: cobranza.moneda.SIMBOLO}}</strong> |
171 | </td> | 171 | </td> |
172 | <td class="text-right ml-auto table-celda-total no-border-top"> | 172 | <td class="text-right ml-auto table-celda-total no-border-top"> |
173 | <strong>DF:</strong> | 173 | <strong>DF:</strong> |
174 | </td> | 174 | </td> |
175 | <td class="table-celda-total text-right no-border-top"> | 175 | <td class="table-celda-total text-right no-border-top"> |
176 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / | 176 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / |
177 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 177 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
178 | </strong> | 178 | </strong> |
179 | </td> | 179 | </td> |
180 | </tr> | 180 | </tr> |
181 | </tfoot> | 181 | </tfoot> |
182 | </table> | 182 | </table> |
183 | </div> | 183 | </div> |
184 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> | 184 | <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"> | 185 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
186 | <thead> | 186 | <thead> |
187 | <tr class="d-flex"> | 187 | <tr class="d-flex"> |
188 | <th class="col-auto">#</th> | 188 | <th class="col-auto">#</th> |
189 | <th class="col">Cobro</th> | 189 | <th class="col">Cobro</th> |
190 | <th class="col">Fecha</th> | 190 | <th class="col">Fecha</th> |
191 | <th class="col">Importe</th> | 191 | <th class="col">Importe</th> |
192 | <th class="col-auto"> | 192 | <th class="col-auto"> |
193 | <button | 193 | <button |
194 | class="btn btn-outline-secondary selectable" | 194 | class="btn btn-outline-secondary selectable" |
195 | ng-click="show = !show; masMenos()" | 195 | ng-click="show = !show; masMenos()" |
196 | > | 196 | > |
197 | <i | 197 | <i |
198 | class="fa fa-chevron-down" | 198 | class="fa fa-chevron-down" |
199 | ng-show="show" | 199 | ng-show="show" |
200 | aria-hidden="true" | 200 | aria-hidden="true" |
201 | > | 201 | > |
202 | </i> | 202 | </i> |
203 | <i | 203 | <i |
204 | class="fa fa-chevron-up" | 204 | class="fa fa-chevron-up" |
205 | ng-hide="show" | 205 | ng-hide="show" |
206 | aria-hidden="true"> | 206 | aria-hidden="true"> |
207 | </i> | 207 | </i> |
208 | </button> | 208 | </button> |
209 | </th> | 209 | </th> |
210 | </th> | 210 | </th> |
211 | </tr> | 211 | </tr> |
212 | </thead> | 212 | </thead> |
213 | <tbody class="tabla-articulo-body"> | 213 | <tbody class="tabla-articulo-body"> |
214 | <tr | 214 | <tr |
215 | ng-repeat="(key, cobro) in cobrosTabla" | 215 | ng-repeat="(key, cobro) in cobrosTabla" |
216 | class="d-flex" | 216 | class="d-flex" |
217 | ng-show="show || key == cobrosTabla.length - 1" | 217 | ng-show="show || key == cobrosTabla.length - 1" |
218 | > | 218 | > |
219 | <td ng-bind="key + 1" class="col-auto"></td> | 219 | <td ng-bind="key + 1" class="col-auto"></td> |
220 | <td class="col" ng-bind="cobro.tipo"></td> | 220 | <td class="col" ng-bind="cobro.tipo"></td> |
221 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> | 221 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> |
222 | <td | 222 | <td |
223 | class="col" | 223 | class="col" |
224 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 224 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
225 | currency: cobranza.moneda.SIMBOLO"></td> | 225 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
226 | <td class="text-center col-auto"> | 226 | <td class="text-center col-auto"> |
227 | <button | 227 | <button |
228 | class="btn btn-outline-secondary" | 228 | class="btn btn-outline-secondary" |
229 | ng-click="quitarCobro(key)" | 229 | ng-click="quitarCobro(key)" |
230 | > | 230 | > |
231 | <i class="fa fa-trash"></i> | 231 | <i class="fa fa-trash"></i> |
232 | </button> | 232 | </button> |
233 | </td> | 233 | </td> |
234 | </tr> | 234 | </tr> |
235 | </tbody> | 235 | </tbody> |
236 | <tfoot> | 236 | <tfoot> |
237 | <tr ng-show="cargando" class="d-flex"> | 237 | <tr ng-show="cargando" class="d-flex"> |
238 | <td class="col-2"> | 238 | <td class="col-2"> |
239 | <a | 239 | <a |
240 | class="form-control form-control-sm btn btn-secondary" | 240 | class="form-control form-control-sm btn btn-secondary" |
241 | ng-click="seleccionarCheque()" | 241 | ng-click="seleccionarCheque()" |
242 | >Cheque</a> | 242 | >Cheque</a> |
243 | </td> | 243 | </td> |
244 | <td class="col-2"> | 244 | <td class="col-2"> |
245 | <a | 245 | <a |
246 | class="form-control form-control-sm btn btn-secondary" | 246 | class="form-control form-control-sm btn btn-secondary" |
247 | ng-click="seleccionarEfectivo()" | 247 | ng-click="seleccionarEfectivo()" |
248 | >Efectivo</a> | 248 | >Efectivo</a> |
249 | </td> | 249 | </td> |
250 | </tr> | 250 | </tr> |
251 | <tr class="d-flex"> | 251 | <tr class="d-flex"> |
252 | <td class="col-auto px-1"> | 252 | <td class="col-auto px-1"> |
253 | <strong>Cobros:</strong> | 253 | <strong>Cobros:</strong> |
254 | <a ng-bind="cobrosTabla.length"></a> | 254 | <a ng-bind="cobrosTabla.length"></a> |
255 | </td> | 255 | </td> |
256 | <td class="text-right ml-auto table-celda-total no-border-top"> | 256 | <td class="text-right ml-auto table-celda-total no-border-top"> |
257 | <strong>Total Deuda:</strong> | 257 | <strong>Total Deuda:</strong> |
258 | </td> | 258 | </td> |
259 | <td class="table-celda-total text-right no-border-top"> | 259 | <td class="table-celda-total text-right no-border-top"> |
260 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 260 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
261 | currency: cobranza.moneda.SIMBOLO}}</strong> | 261 | currency: cobranza.moneda.SIMBOLO}}</strong> |
262 | </td> | 262 | </td> |
263 | <td class="text-right ml-auto table-celda-total no-border-top"> | 263 | <td class="text-right ml-auto table-celda-total no-border-top"> |
264 | <strong>Total Cobrado:</strong> | 264 | <strong>Total Cobrado:</strong> |
265 | </td> | 265 | </td> |
266 | <td class="table-celda-total text-right no-border-top"> | 266 | <td class="table-celda-total text-right no-border-top"> |
267 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 267 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
268 | currency: cobranza.moneda.SIMBOLO}}</strong> | 268 | currency: cobranza.moneda.SIMBOLO}}</strong> |
269 | </td> | 269 | </td> |
270 | <td class="text-right ml-auto table-celda-total no-border-top"> | 270 | <td class="text-right ml-auto table-celda-total no-border-top"> |
271 | <strong>DF:</strong> | 271 | <strong>DF:</strong> |
272 | </td> | 272 | </td> |
273 | <td class="table-celda-total text-right no-border-top"> | 273 | <td class="table-celda-total text-right no-border-top"> |
274 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / | 274 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / |
275 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 275 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
276 | </strong> | 276 | </strong> |
277 | </td> | 277 | </td> |
278 | </tr> | 278 | </tr> |
279 | </tfoot> | 279 | </tfoot> |
280 | </table> | 280 | </table> |
281 | </div> | 281 | </div> |
282 | <!-- MOBILE --> | 282 | <!-- MOBILE --> |
283 | <div class="row d-sm-none"> | 283 | <div class="row d-sm-none"> |
284 | <!-- FACTURAS --> | ||
284 | <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda"> | 285 | <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda"> |
285 | <thead> | 286 | <thead> |
286 | <tr class="d-flex"> | 287 | <tr class="d-flex"> |
287 | <th class="">#</th> | 288 | <th class="">#</th> |
288 | <th class="col px-0"> | 289 | <th class="col px-0"> |
289 | <div class="d-flex"> | 290 | <div class="d-flex"> |
290 | <div class="col-4 px-1">Factura</div> | 291 | <div class="col-4 px-1">Factura</div> |
291 | <div class="col-4 px-1">Fecha</div> | 292 | <div class="col-4 px-1">Fecha</div> |
292 | <div class="col-4 px-1">Importe</div> | 293 | <div class="col-4 px-1">Importe</div> |
293 | </div> | 294 | </div> |
294 | </th> | 295 | </th> |
295 | <th class="text-center tamaño-boton"> | 296 | <th class="text-center tamaño-boton"> |
296 | | 297 | |
297 | </th> | 298 | </th> |
298 | </tr> | 299 | </tr> |
299 | </thead> | 300 | </thead> |
300 | <tbody> | 301 | <tbody> |
301 | <tr | 302 | <tr |
302 | ng-repeat="(key, factura) in facturaTabla" | 303 | ng-repeat="(key, factura) in facturaTabla" |
303 | ng-show="show || key == facturaTabla.length - 1" | 304 | ng-show="show || key == facturaTabla.length - 1" |
304 | > | 305 | > |
305 | <td class="w-100 align-middle d-flex p-0"> | 306 | <td class="w-100 align-middle d-flex p-0"> |
306 | <div class="align-middle p-1"> | 307 | <div class="align-middle p-1"> |
307 | <span ng-bind="key+1" class="align-middle"></span> | 308 | <span ng-bind="key+1" class="align-middle"></span> |
308 | </div> | 309 | </div> |
309 | <div class="col px-0"> | 310 | <div class="col px-0"> |
310 | <div class="d-flex"> | 311 | <div class="d-flex"> |
311 | <div class="col-4 px-1"> | 312 | <div class="col-4 px-1"> |
312 | <span ng-bind= | 313 | <span ng-bind= |
313 | "(factura.TCO + '-' + factura.TIP + '-' + | 314 | "(factura.TCO + '-' + factura.TIP + '-' + |
314 | factura.SUC + '-' + factura.NCO)" | 315 | factura.SUC + '-' + factura.NCO)" |
315 | ></span> | 316 | ></span> |
316 | </div> | 317 | </div> |
317 | <div class="col-4 px-1"> | 318 | <div class="col-4 px-1"> |
318 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> | 319 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> |
319 | </div> | 320 | </div> |
320 | <div class="col-4 px-1"> | 321 | <div class="col-4 px-1"> |
321 | <span | 322 | <span |
322 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 323 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
323 | currency:cobranza.moneda.SIMBOLO"></span> | 324 | currency:cobranza.moneda.SIMBOLO : 4"></span> |
324 | </div> | 325 | </div> |
325 | </div> | 326 | </div> |
326 | </div> | 327 | </div> |
327 | <div class="align-middle p-1"> | 328 | <div class="align-middle p-1"> |
328 | <button | 329 | <button |
329 | class="btn btn-outline-secondary" | 330 | class="btn btn-outline-secondary" |
330 | ng-click="quitarFactura(key)" | 331 | ng-click="quitarFactura(key)" |
331 | > | 332 | > |
332 | <i class="fa fa-trash"></i> | 333 | <i class="fa fa-trash"></i> |
333 | </button> | 334 | </button> |
334 | </div> | 335 | </div> |
335 | </td> | 336 | </td> |
336 | </tr> | 337 | </tr> |
337 | </tbody> | 338 | </tbody> |
338 | <tfoot> | 339 | <tfoot> |
339 | <!-- SELECCIONAR PRODUCTO --> | 340 | <!-- SELECCIONAR PRODUCTO --> |
340 | <tr ng-show="cargando" class="d-flex"> | 341 | <tr ng-show="cargando" class="d-flex"> |
341 | <td class="col-12"> | 342 | <td class="col-12"> |
342 | <input | 343 | <input |
343 | placeholder="Seleccione Factura" | 344 | placeholder="Seleccione Factura" |
344 | class="form-control form-control-sm" | 345 | class="form-control form-control-sm" |
345 | readonly | 346 | readonly |
346 | ng-click="seleccionarFactura()" | 347 | ng-click="seleccionarFactura()" |
347 | /> | 348 | /> |
348 | </td> | 349 | </td> |
349 | </tr> | 350 | </tr> |
350 | <!-- TOOGLE EXPANDIR --> | 351 | <!-- TOOGLE EXPANDIR --> |
351 | <tr> | 352 | <tr> |
352 | <td class="col"> | 353 | <td class="col"> |
353 | <button | 354 | <button |
354 | class="btn btn-outline-secondary selectable w-100" | 355 | class="btn btn-outline-secondary selectable w-100" |
355 | ng-click="show = !show; masMenos()" | 356 | ng-click="show = !show; masMenos()" |
356 | ng-show="facturaTabla.length > 0" | 357 | ng-show="facturaTabla.length > 0" |
357 | > | 358 | > |
358 | <i | 359 | <i |
359 | class="fa fa-chevron-down" | 360 | class="fa fa-chevron-down" |
360 | ng-hide="show" | 361 | ng-hide="show" |
361 | aria-hidden="true" | 362 | aria-hidden="true" |
362 | > | 363 | > |
363 | </i> | 364 | </i> |
364 | <i | 365 | <i |
365 | class="fa fa-chevron-up" | 366 | class="fa fa-chevron-up" |
366 | ng-show="show" | 367 | ng-show="show" |
367 | aria-hidden="true"> | 368 | aria-hidden="true"> |
368 | </i> | 369 | </i> |
369 | </button> | 370 | </button> |
370 | </td> | 371 | </td> |
371 | </tr> | 372 | </tr> |
372 | <!-- FOOTER --> | 373 | <!-- FOOTER --> |
373 | <tr class="d-flex"> | 374 | <tr class="d-flex"> |
374 | <td class="align-middle no-border-top" colspan="2"> | 375 | <td class="align-middle no-border-top" colspan="2"> |
375 | <strong>Cantidad Items:</strong> | 376 | <strong>Cantidad Items:</strong> |
376 | <a ng-bind="facturaTabla.length"></a> | 377 | <a ng-bind="facturaTabla.length"></a> |
377 | </td> | 378 | </td> |
378 | </tr> | 379 | </tr> |
379 | </tfoot> | 380 | </tfoot> |
380 | </table> | 381 | </table> |
382 | <!-- COBROS --> | ||
381 | <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda"> | 383 | <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda"> |
382 | <thead> | 384 | <thead> |
383 | <tr class="d-flex"> | 385 | <tr class="d-flex"> |
384 | <th class="">#</th> | 386 | <th class="">#</th> |
385 | <th class="col px-0"> | 387 | <th class="col px-0"> |
386 | <div class="d-flex"> | 388 | <div class="d-flex"> |
387 | <div class="col-4 px-1">Cobro</div> | 389 | <div class="col-4 px-1">Cobro</div> |
388 | <div class="col-4 px-1">Fecha</div> | 390 | <div class="col-4 px-1">Fecha</div> |
389 | <div class="col-4 px-1">Importe</div> | 391 | <div class="col-4 px-1">Importe</div> |
390 | </div> | 392 | </div> |
391 | </th> | 393 | </th> |
392 | <th class="text-center tamaño-boton"> | 394 | <th class="text-center tamaño-boton"> |
393 | | 395 | |
394 | </th> | 396 | </th> |
395 | </tr> | 397 | </tr> |
396 | </thead> | 398 | </thead> |
397 | <tbody> | 399 | <tbody> |
398 | <tr | 400 | <tr |
399 | ng-repeat="(key, cobro) in cobrosTabla" | 401 | ng-repeat="(key, cobro) in cobrosTabla" |
400 | ng-show="show || key == cobrosTabla.length - 1" | 402 | ng-show="show || key == cobrosTabla.length - 1" |
401 | > | 403 | > |
402 | <td class="w-100 align-middle d-flex p-0"> | 404 | <td class="w-100 align-middle d-flex p-0"> |
403 | <div class="align-middle p-1"> | 405 | <div class="align-middle p-1"> |
404 | <span ng-bind="key+1" class="align-middle"></span> | 406 | <span ng-bind="key+1" class="align-middle"></span> |
405 | </div> | 407 | </div> |
406 | <div class="col px-0"> | 408 | <div class="col px-0"> |
407 | <div class="d-flex"> | 409 | <div class="d-flex"> |
408 | <div class="col-4 px-1"> | 410 | <div class="col-4 px-1"> |
409 | <span ng-bind="cobro.tipo" | 411 | <span ng-bind="cobro.tipo" |
410 | ></span> | 412 | ></span> |
411 | </div> | 413 | </div> |
412 | <div class="col-4 px-1"> | 414 | <div class="col-4 px-1"> |
413 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> | 415 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> |
414 | </div> | 416 | </div> |
415 | <div class="col-4 px-1"> | 417 | <div class="col-4 px-1"> |
416 | <span | 418 | <span |
417 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 419 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
418 | currency: cobranza.moneda.SIMBOLO"></span> | 420 | currency: cobranza.moneda.SIMBOLO : 4"></span> |
419 | </div> | 421 | </div> |
420 | </div> | 422 | </div> |
421 | </div> | 423 | </div> |
422 | <div class="align-middle p-1"> | 424 | <div class="align-middle p-1"> |
423 | <button | 425 | <button |
424 | class="btn btn-outline-secondary" | 426 | class="btn btn-outline-secondary" |
425 | ng-click="quitarCobro(key)" | 427 | ng-click="quitarCobro(key)" |
426 | > | 428 | > |
427 | <i class="fa fa-trash"></i> | 429 | <i class="fa fa-trash"></i> |
428 | </button> | 430 | </button> |
429 | </div> | 431 | </div> |
430 | </td> | 432 | </td> |
431 | </tr> | 433 | </tr> |
432 | </tbody> | 434 | </tbody> |
433 | <tfoot> | 435 | <tfoot> |
434 | <!-- SELECCIONAR PRODUCTO --> | 436 | <!-- SELECCIONAR PRODUCTO --> |
435 | <tr ng-show="cargando" class="d-flex"> | 437 | <tr ng-show="cargando" class="d-flex"> |
436 | <td class="col-6"> | 438 | <td class="col-6"> |
437 | <input | 439 | <input |
438 | placeholder="Cheque" | 440 | placeholder="Cheque" |
439 | class="form-control form-control-sm" | 441 | class="form-control form-control-sm" |
440 | readonly | 442 | readonly |
441 | ng-click="seleccionarCheque()" | 443 | ng-click="seleccionarCheque()" |
442 | /> | 444 | /> |
443 | </td> | 445 | </td> |
444 | <td class="col-6"> | 446 | <td class="col-6"> |
445 | <input | 447 | <input |
446 | placeholder="Efectivo" | 448 | placeholder="Efectivo" |
447 | class="form-control form-control-sm" | 449 | class="form-control form-control-sm" |
448 | readonly | 450 | readonly |
449 | ng-click="seleccionarEfectivo()" | 451 | ng-click="seleccionarEfectivo()" |
450 | /> | 452 | /> |
451 | </td> | 453 | </td> |
452 | </tr> | 454 | </tr> |
453 | <!-- TOOGLE EXPANDIR --> | 455 | <!-- TOOGLE EXPANDIR --> |
454 | <tr> | 456 | <tr> |
455 | <td class="col"> | 457 | <td class="col"> |
456 | <button | 458 | <button |
457 | class="btn btn-outline-secondary selectable w-100" | 459 | class="btn btn-outline-secondary selectable w-100" |
458 | ng-click="show = !show; masMenos()" | 460 | ng-click="show = !show; masMenos()" |
459 | ng-show="cobrosTabla.length > 0" | 461 | ng-show="cobrosTabla.length > 0" |
460 | > | 462 | > |
461 | <i | 463 | <i |
462 | class="fa fa-chevron-down" | 464 | class="fa fa-chevron-down" |
463 | ng-hide="show" | 465 | ng-hide="show" |
464 | aria-hidden="true" | 466 | aria-hidden="true" |
465 | > | 467 | > |
466 | </i> | 468 | </i> |
467 | <i | 469 | <i |
468 | class="fa fa-chevron-up" | 470 | class="fa fa-chevron-up" |
469 | ng-show="show" | 471 | ng-show="show" |
470 | aria-hidden="true"> | 472 | aria-hidden="true"> |
471 | </i> | 473 | </i> |
472 | </button> | 474 | </button> |
473 | </td> | 475 | </td> |
474 | </tr> | 476 | </tr> |
475 | <!-- FOOTER --> | 477 | <!-- FOOTER --> |
476 | <tr class="d-flex"> | 478 | <tr class="d-flex"> |
477 | <td class="align-middle no-border-top col-6"> | 479 | <td class="align-middle no-border-top col-6"> |
478 | <strong>Cantidad Items:</strong> | 480 | <strong>Cantidad Items:</strong> |
479 | <a ng-bind="cobrosTabla.length"></a> | 481 | <a ng-bind="cobrosTabla.length"></a> |
480 | </td> | 482 | </td> |
481 | </tfoot> | 483 | </tfoot> |
482 | </table> | 484 | </table> |
483 | </tr> | 485 | </tr> |
486 | <!-- DEUDA, COBRADO, DIFERENCIA --> | ||
484 | <table class="table-responsive"> | 487 | <table class="table-responsive"> |
485 | <tr class="d-flex row"> | 488 | <tr class="d-flex row"> |
486 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 489 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
487 | <strong>Deuda:</strong> | 490 | <strong>Deuda:</strong> |
488 | </td> | 491 | </td> |
489 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 492 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
490 | <strong>Cobrado:</strong> | 493 | <strong>Cobrado:</strong> |
491 | </td> | 494 | </td> |
492 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 495 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
493 | <strong>Diferencia:</strong> | 496 | <strong>Diferencia:</strong> |
494 | </td> | 497 | </td> |
495 | <td class="table-celda-total text-center no-border-top col-4"> | 498 | <td class="table-celda-total text-center no-border-top col-4"> |
496 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 499 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
497 | </td> | 500 | </td> |
498 | <td class="table-celda-total text-center no-border-top col-4"> | 501 | <td class="table-celda-total text-center no-border-top col-4"> |
499 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 502 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
500 | </td> | 503 | </td> |
501 | <td class="table-celda-total text-center no-border-top col-4"> | 504 | <td class="table-celda-total text-center no-border-top col-4"> |
502 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 505 | <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
503 | </td> | 506 | </td> |
504 | </tr> | 507 | </tr> |
505 | </table> | 508 | </table> |
506 | </div> | 509 | </div> |
507 | </div> | 510 | </div> |
508 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | 511 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> |
509 | <div class="row align-items-end"> | 512 | <div class="row align-items-end"> |
510 | <div class="col-12"> | 513 | <div class="col-12"> |
511 | <button | 514 | <button |
512 | ng-click="crearHojaRuta()" | 515 | ng-click="crearCobranza()" |
513 | type="submit" | ||
514 | title="Crear nota pedido" | 516 | title="Crear nota pedido" |
515 | class="btn btn-default btn-block mb-2"> | 517 | class="btn btn-default btn-block mb-2"> |
516 | Guardar | 518 | Guardar |
517 | </button> | 519 | </button> |
518 | <button | 520 | <button |
519 | ng-click="salir()" | 521 | ng-click="salir()" |
520 | type="button" | 522 | type="button" |
521 | title="Salir" | 523 | title="Salir" |
522 | class="btn btn-default btn-block"> | 524 | class="btn btn-default btn-block"> |
523 | Salir | 525 | Salir |
524 | </button> | 526 | </button> |
525 | </div> | 527 | </div> |
526 | </div> | 528 | </div> |
527 | </div> | 529 | </div> |
528 | </div> | 530 | </div> |
529 | <div class="row d-md-none fixed-bottom"> | 531 | <div class="row d-md-none fixed-bottom"> |
530 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 532 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
531 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 533 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
532 | <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> | 534 | <span class="mr-3 ml-auto" ng-click="crearCobranza()">Guardar</span> |
533 | </div> | 535 | </div> |
534 | </div> | 536 | </div> |
535 | </div> | 537 | </div> |