Commit b84604bf9e8ed59b779bc1d2aef5a60768d84673
1 parent
62ce377367
Exists in
master
agrego componente foca-botonera-lateral
Showing
4 changed files
with
18 additions
and
31 deletions
Show diff stats
index.html
1 | <html ng-app="focaCrearCobranza"> | 1 | <html ng-app="focaCrearCobranza"> |
2 | <head> | 2 | <head> |
3 | <meta charset="UTF-8"/> | 3 | <meta charset="UTF-8"/> |
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
5 | 5 | ||
6 | <!--CSS--> | 6 | <!--CSS--> |
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | 7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> |
8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> |
9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> | 9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> |
10 | 10 | ||
11 | <!--VENDOR JS--> | 11 | <!--VENDOR JS--> |
12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> |
14 | <script src="node_modules/angular/angular.min.js"></script> | 14 | <script src="node_modules/angular/angular.min.js"></script> |
15 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 15 | <script src="node_modules/angular-route/angular-route.min.js"></script> |
16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 16 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
17 | <script src="node_modules/ladda/dist/spin.min.js"></script> | 17 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | 18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | 19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
20 | 20 | ||
21 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | ||
21 | <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script> | 22 | <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script> |
23 | <script src="node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js"></script> | ||
24 | <script src="node_modules/foca-cabecera-facturador/dist/foca-cabecera-facturador.min.js"></script> | ||
22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 25 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
23 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 26 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> |
24 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | ||
25 | <script src="node_modules/foca-modal-factura/dist/foca-modal-factura.min.js"></script> | 27 | <script src="node_modules/foca-modal-factura/dist/foca-modal-factura.min.js"></script> |
26 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | ||
27 | 28 | ||
28 | <script src="src/js/app.js"></script> | 29 | <script src="src/js/app.js"></script> |
29 | <script src="src/js/controller.js"></script> | 30 | <script src="src/js/controller.js"></script> |
30 | <script src="src/js/service.js"></script> | 31 | <script src="src/js/service.js"></script> |
31 | <script src="src/js/businessService.js"></script> | 32 | <script src="src/js/businessService.js"></script> |
32 | <script src="src/js/route.js"></script> | 33 | <script src="src/js/route.js"></script> |
33 | 34 | ||
34 | <script src="src/etc/develop.js"></script> | 35 | <script src="src/etc/develop.js"></script> |
35 | </head> | 36 | </head> |
36 | <body> | 37 | <body> |
37 | <div ng-view class="container-fluid"></div> | 38 | <div ng-view class="container-fluid"></div> |
38 | </body> | 39 | </body> |
src/js/app.js
1 | angular.module('focaCrearCobranza', [ | 1 | angular.module('focaCrearCobranza', [ |
2 | 'ngRoute', | 2 | 'ngRoute', |
3 | 'ui.bootstrap', | 3 | 'ui.bootstrap', |
4 | 'focaBotoneraLateral', | ||
4 | 'focaModal', | 5 | 'focaModal', |
5 | 'focaModalFactura', | 6 | 'focaModalFactura', |
6 | 'focaBusquedaCliente', | 7 | 'focaBusquedaCliente', |
7 | 'focaDirectivas', | 8 | 'focaDirectivas', |
8 | 'focaModalMoneda', | 9 | 'focaModalMoneda', |
9 | 'focaModalCotizacion' | 10 | 'focaModalCotizacion' |
10 | ]); | 11 | ]); |
11 | 12 |
src/js/controller.js
1 | angular.module('focaCrearCobranza') .controller('cobranzaController', | 1 | angular.module('focaCrearCobranza') .controller('cobranzaController', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$rootScope', | ||
5 | '$timeout', | ||
4 | '$uibModal', | 6 | '$uibModal', |
5 | '$location', | 7 | '$location', |
6 | '$filter', | ||
7 | 'focaCrearCobranzaService', | 8 | 'focaCrearCobranzaService', |
8 | 'focaModalService', | 9 | 'focaModalService', |
9 | '$cookies', | 10 | '$cookies', |
11 | '$filter', | ||
10 | 'focaSeguimientoService', | 12 | 'focaSeguimientoService', |
11 | function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService, | 13 | 'focaBotoneraLateralService', |
12 | $cookies, focaSeguimientoService) | 14 | function($scope, $rootScope, $timeout, $uibModal, $location, focaCrearCobranzaService, |
15 | focaModalService, $filter, $cookies, focaSeguimientoService, focaBotoneraLateralService) | ||
13 | { | 16 | { |
14 | 17 | ||
15 | $scope.botonera = focaCrearCobranzaService.getBotonera(); | 18 | $scope.botonera = focaCrearCobranzaService.getBotonera(); |
16 | $scope.datepickerAbierto = false; | 19 | $scope.datepickerAbierto = false; |
17 | $scope.cobroDeuda = true; | 20 | $scope.cobroDeuda = true; |
18 | $scope.show = false; | 21 | $scope.show = false; |
19 | $scope.cargando = true; | 22 | $scope.cargando = true; |
20 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
21 | maxDate: new Date(), | 24 | maxDate: new Date(), |
22 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
23 | }; | 26 | }; |
24 | 27 | ||
25 | $scope.cobranza = {}; | 28 | $scope.cobranza = {}; |
26 | 29 | ||
27 | $scope.fecha = new Date(); | 30 | $scope.fecha = new Date(); |
28 | $scope.puntoVenta = '0000'; | 31 | $scope.puntoVenta = '0000'; |
29 | $scope.comprobante = '00000000'; | 32 | $scope.comprobante = '00000000'; |
30 | $scope.facturaTabla = []; | 33 | $scope.facturaTabla = []; |
31 | $scope.cobrosTabla = []; | 34 | $scope.cobrosTabla = []; |
32 | 35 | ||
33 | focaCrearCobranzaService.getUsuario($cookies.get('idUsuario')).then(function(data) { | 36 | focaCrearCobranzaService.getUsuario($cookies.get('idUsuario')).then(function(data) { |
34 | $scope.usuario = data.data; | 37 | $scope.usuario = data.data; |
35 | }); | 38 | }); |
36 | 39 | ||
40 | $timeout(function() { | ||
41 | focaBotoneraLateralService.showSalir(true); | ||
42 | focaBotoneraLateralService.showPausar(true); | ||
43 | focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); | ||
44 | }); | ||
45 | |||
37 | $scope.crearCobranza = function() { | 46 | $scope.crearCobranza = function() { |
38 | if(!$scope.cobranza.cliente) { | 47 | if(!$scope.cobranza.cliente) { |
39 | focaModalService.alert('Ingrese Cliente'); | 48 | focaModalService.alert('Ingrese Cliente'); |
40 | return; | 49 | return; |
41 | } | 50 | } |
42 | if(!$scope.cobranza.cobrador) { | 51 | if(!$scope.cobranza.cobrador) { |
43 | focaModalService.alert('Ingrese Cobrador'); | 52 | focaModalService.alert('Ingrese Cobrador'); |
44 | return; | 53 | return; |
45 | } | 54 | } |
46 | if($scope.facturaTabla.length < 1) { | 55 | if($scope.facturaTabla.length < 1) { |
47 | focaModalService.alert('Ingrese al menos una factura'); | 56 | focaModalService.alert('Ingrese al menos una factura'); |
48 | return; | 57 | return; |
49 | } | 58 | } |
50 | if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { | 59 | if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { |
51 | focaModalService.alert('La diferencia debe ser ' + | 60 | focaModalService.alert('La diferencia debe ser ' + |
52 | $scope.cobranza.moneda.SIMBOLO + '0,00'); | 61 | $scope.cobranza.moneda.SIMBOLO + '0,00'); |
53 | return; | 62 | return; |
54 | } | 63 | } |
55 | var cobranza = {}; | 64 | var cobranza = {}; |
56 | var cheques = []; | 65 | var cheques = []; |
57 | var cuerpos = []; | 66 | var cuerpos = []; |
58 | //TODO: habilitar edición | 67 | //TODO: habilitar edición |
59 | $scope.editando = false; | 68 | $scope.editando = false; |
60 | $scope.saveLoading = true; | 69 | $scope.saveLoading = true; |
61 | for (var i = 0; i < $scope.facturaTabla.length; i++) { | 70 | for (var i = 0; i < $scope.facturaTabla.length; i++) { |
62 | var cuerpoFactura = { | 71 | var cuerpoFactura = { |
63 | CYV: 'V', | 72 | CYV: 'V', |
64 | TIP: 'C', | 73 | TIP: 'C', |
65 | TCO: 'RC', | 74 | TCO: 'RC', |
66 | PVE: $scope.puntoVenta, | 75 | PVE: $scope.puntoVenta, |
67 | NCO: $scope.comprobante, | 76 | NCO: $scope.comprobante, |
68 | LOP: 'L', | 77 | LOP: 'L', |
69 | TIL: $scope.facturaTabla[i].TCO, | 78 | TIL: $scope.facturaTabla[i].TCO, |
70 | COM: $scope.facturaTabla[i].numeroFactura + '-' + | 79 | COM: $scope.facturaTabla[i].numeroFactura + '-' + |
71 | $scope.rellenar($scope.facturaTabla[i].NCU,2), | 80 | $scope.rellenar($scope.facturaTabla[i].NCU,2), |
72 | FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), | 81 | FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), |
73 | IMP: Math.abs($scope.facturaTabla[i].IPA), | 82 | IMP: Math.abs($scope.facturaTabla[i].IPA), |
74 | RES: 0,//caja de tesorería | 83 | RES: 0,//caja de tesorería |
75 | SUBM: 0 | 84 | SUBM: 0 |
76 | }; | 85 | }; |
77 | cuerpos.push(cuerpoFactura); | 86 | cuerpos.push(cuerpoFactura); |
78 | } | 87 | } |
79 | 88 | ||
80 | for (var j = 0; j < $scope.cobrosTabla.length; j++) { | 89 | for (var j = 0; j < $scope.cobrosTabla.length; j++) { |
81 | 90 | ||
82 | var efectivo = $scope.cobrosTabla[j].tipo === 'Efectivo' ? true : false; | 91 | var efectivo = $scope.cobrosTabla[j].tipo === 'Efectivo' ? true : false; |
83 | 92 | ||
84 | var cuerpoCobros = { | 93 | var cuerpoCobros = { |
85 | CYV: 'V', | 94 | CYV: 'V', |
86 | TIP: 'C', | 95 | TIP: 'C', |
87 | TCO: 'RC', | 96 | TCO: 'RC', |
88 | PVE: $scope.puntoVenta, | 97 | PVE: $scope.puntoVenta, |
89 | NCO: $scope.comprobante, | 98 | NCO: $scope.comprobante, |
90 | LOP: 'P', | 99 | LOP: 'P', |
91 | TIL: 'EF', | 100 | TIL: 'EF', |
92 | COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : 'ch(' + | 101 | COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : 'ch(' + |
93 | $scope.cobrosTabla[j].numero + ')' + $scope.cobrosTabla[j].banco.desbco, | 102 | $scope.cobrosTabla[j].numero + ')' + $scope.cobrosTabla[j].banco.desbco, |
94 | FEC: efectivo ? | 103 | FEC: efectivo ? |
95 | $scope.cobrosTabla[j].fecha | 104 | $scope.cobrosTabla[j].fecha |
96 | .toISOString().slice(0, 19).replace('T', ' ') : | 105 | .toISOString().slice(0, 19).replace('T', ' ') : |
97 | $scope.cobrosTabla[j].fechaPresentacion | 106 | $scope.cobrosTabla[j].fechaPresentacion |
98 | .toISOString().slice(0, 19).replace('T', ' '), | 107 | .toISOString().slice(0, 19).replace('T', ' '), |
99 | IMP: Math.abs($scope.cobrosTabla[j].importe), | 108 | IMP: Math.abs($scope.cobrosTabla[j].importe), |
100 | RES: 0,//caja de tesorería | 109 | RES: 0,//caja de tesorería |
101 | SUBM: 0 | 110 | SUBM: 0 |
102 | }; | 111 | }; |
103 | cuerpos.push(cuerpoCobros); | 112 | cuerpos.push(cuerpoCobros); |
104 | 113 | ||
105 | if(!efectivo) { | 114 | if(!efectivo) { |
106 | var cheque = { | 115 | var cheque = { |
107 | BCO: $scope.cobrosTabla[j].banco.ID, | 116 | BCO: $scope.cobrosTabla[j].banco.ID, |
108 | NUM: $scope.comprobante, | 117 | NUM: $scope.comprobante, |
109 | FEP: $scope.cobrosTabla[j].fechaPresentacion | 118 | FEP: $scope.cobrosTabla[j].fechaPresentacion |
110 | .toISOString().slice(0, 19).replace('T', ' '), | 119 | .toISOString().slice(0, 19).replace('T', ' '), |
111 | FEE: $scope.cobrosTabla[j].fechaEmision | 120 | FEE: $scope.cobrosTabla[j].fechaEmision |
112 | .toISOString().slice(0, 19).replace('T', ' '), | 121 | .toISOString().slice(0, 19).replace('T', ' '), |
113 | LUG: $scope.cobrosTabla[j].localidad.NOMBRE, | 122 | LUG: $scope.cobrosTabla[j].localidad.NOMBRE, |
114 | IMP: $scope.cobrosTabla[j].importe, | 123 | IMP: $scope.cobrosTabla[j].importe, |
115 | LIB: $scope.cobrosTabla[j].librador, | 124 | LIB: $scope.cobrosTabla[j].librador, |
116 | EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera | 125 | EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera |
117 | PCI: $scope.cobrosTabla[j].provincia.ID, | 126 | PCI: $scope.cobrosTabla[j].provincia.ID, |
118 | LPLA: 0, | 127 | LPLA: 0, |
119 | PLA: 0, | 128 | PLA: 0, |
120 | VEN: $scope.usuario.CodVen,//Id vendedor | 129 | VEN: $scope.usuario.CodVen,//Id vendedor |
121 | CCLIE: $scope.cobranza.cliente.COD,//Id cliente | 130 | CCLIE: $scope.cobranza.cliente.COD,//Id cliente |
122 | REN: 0, | 131 | REN: 0, |
123 | PVEC: $scope.puntoVenta, | 132 | PVEC: $scope.puntoVenta, |
124 | NCOC: $scope.comprobante, | 133 | NCOC: $scope.comprobante, |
125 | OBSE: $scope.cobrosTabla[j].observaciones, | 134 | OBSE: $scope.cobrosTabla[j].observaciones, |
126 | LUV: 0, | 135 | LUV: 0, |
127 | ORI: 've', | 136 | ORI: 've', |
128 | FER: '', | 137 | FER: '', |
129 | BIMP: 0, | 138 | BIMP: 0, |
130 | COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, | 139 | COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, |
131 | VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso | 140 | VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso |
132 | VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso | 141 | VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso |
133 | REC_CAJ: 'D', | 142 | REC_CAJ: 'D', |
134 | TIPO_C: 0,//?? | 143 | TIPO_C: 0,//?? |
135 | SALDO_CAJ: 'S', | 144 | SALDO_CAJ: 'S', |
136 | FECHA_INGRESO: $scope.fecha | 145 | FECHA_INGRESO: $scope.fecha |
137 | .toISOString().slice(0, 19).replace('T', ' '), | 146 | .toISOString().slice(0, 19).replace('T', ' '), |
138 | Vendedor_valor: 0, | 147 | Vendedor_valor: 0, |
139 | FAMILIA: 0, | 148 | FAMILIA: 0, |
140 | CUIT_LIB: '', | 149 | CUIT_LIB: '', |
141 | COD_LUG: $scope.cobrosTabla[j].localidad.ID,//código lugar | 150 | COD_LUG: $scope.cobrosTabla[j].localidad.ID,//código lugar |
142 | SEN: '', | 151 | SEN: '', |
143 | NRC: 0, | 152 | NRC: 0, |
144 | COD_LARGO: '', | 153 | COD_LARGO: '', |
145 | VN: 0, | 154 | VN: 0, |
146 | ID_LECTOR: 0, | 155 | ID_LECTOR: 0, |
147 | NATHB: '' | 156 | NATHB: '' |
148 | }; | 157 | }; |
149 | cheques.push(cheque); | 158 | cheques.push(cheque); |
150 | } | 159 | } |
151 | } | 160 | } |
152 | 161 | ||
153 | cobranza = { | 162 | cobranza = { |
154 | recibo: { | 163 | recibo: { |
155 | CYV: 'V', | 164 | CYV: 'V', |
156 | TIP: 'C', | 165 | TIP: 'C', |
157 | TCO: 'RC', | 166 | TCO: 'RC', |
158 | PVE: $scope.puntoVenta, //Sucursar, punto de venta | 167 | PVE: $scope.puntoVenta, //Sucursar, punto de venta |
159 | NCO: $scope.comprobante, //Numero de comprobante | 168 | NCO: $scope.comprobante, //Numero de comprobante |
160 | FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), | 169 | FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), |
161 | CLI: $scope.cobranza.cliente.COD, | 170 | CLI: $scope.cobranza.cliente.COD, |
162 | ATO: 0, //número de asiento | 171 | ATO: 0, //número de asiento |
163 | CFE: $scope.cobranza.cobrador.nombre, | 172 | CFE: $scope.cobranza.cobrador.nombre, |
164 | PLA: '',//Numero de planilla, sin uso | 173 | PLA: '',//Numero de planilla, sin uso |
165 | ID_MONEDA: $scope.cobranza.moneda.ID, | 174 | ID_MONEDA: $scope.cobranza.moneda.ID, |
166 | COTIZACION: $scope.cobranza.cotizacion.VENDEDOR, | 175 | COTIZACION: $scope.cobranza.cotizacion.VENDEDOR, |
167 | idCobrador: $scope.cobranza.cobrador.id | 176 | idCobrador: $scope.cobranza.cobrador.id |
168 | }, | 177 | }, |
169 | cuerpo: cuerpos, | 178 | cuerpo: cuerpos, |
170 | cheques: cheques, | 179 | cheques: cheques, |
171 | acobypag: { | 180 | acobypag: { |
172 | CYV: 'V', | 181 | CYV: 'V', |
173 | COD: $scope.cobranza.cliente.COD, | 182 | COD: $scope.cobranza.cliente.COD, |
174 | FEP: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), | 183 | FEP: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), |
175 | TIP: 'C', | 184 | TIP: 'C', |
176 | TCO: 'RC', | 185 | TCO: 'RC', |
177 | SUC: $scope.puntoVenta, | 186 | SUC: $scope.puntoVenta, |
178 | NCO: $scope.comprobante, | 187 | NCO: $scope.comprobante, |
179 | IPA: $scope.getTotalCobrado(), | 188 | IPA: $scope.getTotalCobrado(), |
180 | SAL: '',//?? | 189 | SAL: '',//?? |
181 | TCA: 1, | 190 | TCA: 1, |
182 | ZONA: 1, | 191 | ZONA: 1, |
183 | FPA: 2,//Forma de pago | 192 | FPA: 2,//Forma de pago |
184 | REC: 0, | 193 | REC: 0, |
185 | REP: 0, | 194 | REP: 0, |
186 | FER: null, | 195 | FER: null, |
187 | REM: 0, | 196 | REM: 0, |
188 | FRE: null,//?? | 197 | FRE: null,//?? |
189 | PRO: 'N', | 198 | PRO: 'N', |
190 | FEV: $scope.fecha.toISOString().slice(0, 19).replace('T', ' ') | 199 | FEV: $scope.fecha.toISOString().slice(0, 19).replace('T', ' ') |
191 | }, | 200 | }, |
192 | datosCobrador: { | 201 | datosCobrador: { |
193 | COD: $scope.cobranza.cobrador.id, | 202 | COD: $scope.cobranza.cobrador.id, |
194 | PVE: $scope.puntoVenta, | 203 | PVE: $scope.puntoVenta, |
195 | NUM: $scope.comprobante, | 204 | NUM: $scope.comprobante, |
196 | EST: 'C', | 205 | EST: 'C', |
197 | OBS: 'RC: ' + $scope.comprobante + '-' + $scope.fecha.toLocaleDateString(), | 206 | OBS: 'RC: ' + $scope.comprobante + '-' + $scope.fecha.toLocaleDateString(), |
198 | DAT1: 'C', | 207 | DAT1: 'C', |
199 | CLI: $scope.cobranza.cliente.COD | 208 | CLI: $scope.cobranza.cliente.COD |
200 | } | 209 | } |
201 | }; | 210 | }; |
202 | focaCrearCobranzaService.guardarCobranza(cobranza).then( | 211 | focaCrearCobranzaService.guardarCobranza(cobranza).then( |
203 | function(result) { | 212 | function(result) { |
204 | $scope.saveLoading = false; | 213 | $scope.saveLoading = false; |
205 | focaModalService.alert('Cobranza guardada con éxito'); | 214 | focaModalService.alert('Cobranza guardada con éxito'); |
206 | 215 | ||
207 | focaSeguimientoService.guardarPosicion( | 216 | focaSeguimientoService.guardarPosicion( |
208 | result.data.numero, | 217 | result.data.numero, |
209 | 'Cobranza', | 218 | 'Cobranza', |
210 | 'Nº: ' + $filter('comprobante')([ | 219 | 'Nº: ' + $filter('comprobante')([ |
211 | result.data.sucursal, | 220 | result.data.sucursal, |
212 | result.data.numero | 221 | result.data.numero |
213 | ]) + '<br/>' + | 222 | ]) + '<br/>' + |
214 | 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + | 223 | 'Vendedor: ' + $scope.cobranza.cobrador.nombre + '<br/>' + |
215 | 'Total: ' + $filter('currency')($scope.getTotalCobrado()), | 224 | 'Total: ' + $filter('currency')($scope.getTotalCobrado()), |
216 | result.data.sucursal | 225 | result.data.sucursal |
217 | ); | 226 | ); |
218 | 227 | ||
219 | $scope.cobranza = { | 228 | $scope.cobranza = { |
220 | fecha: new Date() | 229 | fecha: new Date() |
221 | }; | 230 | }; |
222 | setearMonedaPorDefecto(); | 231 | setearMonedaPorDefecto(); |
223 | obtenerNumeroComprobante(); | 232 | obtenerNumeroComprobante(); |
224 | 233 | ||
225 | $scope.$broadcast('cleanCabecera'); | 234 | $scope.$broadcast('cleanCabecera'); |
226 | $scope.fecha = new Date(); | 235 | $scope.fecha = new Date(); |
227 | $scope.facturaTabla = []; | 236 | $scope.facturaTabla = []; |
228 | $scope.cobrosTabla = []; | 237 | $scope.cobrosTabla = []; |
229 | }, function(error) { | 238 | }, function(error) { |
230 | focaModalService.alert('Hubo un problema al cargar la cobranza'); | 239 | focaModalService.alert('Hubo un problema al cargar la cobranza'); |
231 | $scope.saveLoading = false; | 240 | $scope.saveLoading = false; |
232 | console.info(error); | 241 | console.info(error); |
233 | } | 242 | } |
234 | ); | 243 | ); |
235 | }; | 244 | }; |
236 | 245 | ||
237 | $scope.seleccionarCobros = function() { | 246 | $scope.seleccionarCobros = function() { |
238 | $scope.cobroDeuda = false; | 247 | $scope.cobroDeuda = false; |
239 | }; | 248 | }; |
240 | 249 | ||
241 | $scope.seleccionarComprobantes = function() { | 250 | $scope.seleccionarComprobantes = function() { |
242 | $scope.cobroDeuda = true; | 251 | $scope.cobroDeuda = true; |
243 | }; | 252 | }; |
244 | 253 | ||
245 | $scope.seleccionarCobranza = function() { | 254 | $scope.seleccionarCobranza = function() { |
246 | 255 | ||
247 | var modalInstance = $uibModal.open( | 256 | var modalInstance = $uibModal.open( |
248 | { | 257 | { |
249 | ariaLabelledBy: 'Busqueda de Cobranzas', | 258 | ariaLabelledBy: 'Busqueda de Cobranzas', |
250 | templateUrl: 'foca-modal-cobranza.html', | 259 | templateUrl: 'foca-modal-cobranza.html', |
251 | controller: 'focaModalCobranzaController', | 260 | controller: 'focaModalCobranzaController', |
252 | size: 'lg' | 261 | size: 'lg' |
253 | } | 262 | } |
254 | ); | 263 | ); |
255 | modalInstance.result.then(function(cobranza) { | 264 | modalInstance.result.then(function(cobranza) { |
256 | $scope.editando = true; | 265 | $scope.editando = true; |
257 | $scope.facturaTabla = []; | 266 | $scope.facturaTabla = []; |
258 | $scope.cobrosTabla = []; | 267 | $scope.cobrosTabla = []; |
259 | $scope.$broadcast('cleanCabecera'); | 268 | $scope.$broadcast('cleanCabecera'); |
260 | 269 | ||
261 | $scope.fecha = new Date(cobranza.fecha); | 270 | $scope.fecha = new Date(cobranza.fecha); |
262 | 271 | ||
263 | $scope.$broadcast('addCabecera', { | 272 | $scope.$broadcast('addCabecera', { |
264 | label: 'Cliente:', | 273 | label: 'Cliente:', |
265 | valor: cobranza.cliente.NOM | 274 | valor: cobranza.cliente.NOM |
266 | }); | 275 | }); |
267 | $scope.$broadcast('addCabecera', { | 276 | $scope.$broadcast('addCabecera', { |
268 | label: 'Cobrador:', | 277 | label: 'Cobrador:', |
269 | valor: cobranza.cobrador | 278 | valor: cobranza.cobrador |
270 | }); | 279 | }); |
271 | 280 | ||
272 | $scope.facturaTabla = cobranza.facturas; | 281 | $scope.facturaTabla = cobranza.facturas; |
273 | $scope.cobrosTabla = cobranza.cobros; | 282 | $scope.cobrosTabla = cobranza.cobros; |
274 | 283 | ||
275 | }); | 284 | }); |
276 | }; | 285 | }; |
277 | 286 | ||
278 | $scope.seleccionarCliente = function() { | 287 | $scope.seleccionarCliente = function() { |
279 | 288 | ||
280 | var modalInstance = $uibModal.open( | 289 | var modalInstance = $uibModal.open( |
281 | { | 290 | { |
282 | ariaLabelledBy: 'Busqueda de Cliente', | 291 | ariaLabelledBy: 'Busqueda de Cliente', |
283 | templateUrl: 'foca-busqueda-cliente-modal.html', | 292 | templateUrl: 'foca-busqueda-cliente-modal.html', |
284 | controller: 'focaBusquedaClienteModalController', | 293 | controller: 'focaBusquedaClienteModalController', |
285 | size: 'lg' | 294 | size: 'lg' |
286 | } | 295 | } |
287 | ); | 296 | ); |
288 | modalInstance.result.then( | 297 | modalInstance.result.then( |
289 | function(cliente) { | 298 | function(cliente) { |
290 | $scope.$broadcast('addCabecera', { | 299 | $scope.$broadcast('addCabecera', { |
291 | label: 'Cliente:', | 300 | label: 'Cliente:', |
292 | valor: cliente.nom | 301 | valor: cliente.nom |
293 | }); | 302 | }); |
294 | $scope.cobranza.cliente = { | 303 | $scope.cobranza.cliente = { |
295 | COD: cliente.cod, | 304 | COD: cliente.cod, |
296 | CUIT: cliente.cuit, | 305 | CUIT: cliente.cuit, |
297 | NOM: cliente.nom | 306 | NOM: cliente.nom |
298 | }; | 307 | }; |
299 | }, function() { | 308 | }, function() { |
300 | 309 | ||
301 | } | 310 | } |
302 | ); | 311 | ); |
303 | }; | 312 | }; |
304 | 313 | ||
305 | $scope.seleccionarFactura = function() { | 314 | $scope.seleccionarFactura = function() { |
306 | if(!$scope.cobranza.cliente) { | 315 | if(!$scope.cobranza.cliente) { |
307 | focaModalService.alert('Seleccione primero un cliente'); | 316 | focaModalService.alert('Seleccione primero un cliente'); |
308 | return; | 317 | return; |
309 | } | 318 | } |
310 | var modalInstance = $uibModal.open( | 319 | var modalInstance = $uibModal.open( |
311 | { | 320 | { |
312 | ariaLabelledBy: 'Busqueda de Facturas', | 321 | ariaLabelledBy: 'Busqueda de Facturas', |
313 | templateUrl: 'foca-modal-factura.html', | 322 | templateUrl: 'foca-modal-factura.html', |
314 | controller: 'focaModalFacturaController', | 323 | controller: 'focaModalFacturaController', |
315 | size: 'lg', | 324 | size: 'lg', |
316 | resolve: { | 325 | resolve: { |
317 | parametrosFactura: function() { | 326 | parametrosFactura: function() { |
318 | return { | 327 | return { |
319 | cliente: $scope.cobranza.cliente.COD, | 328 | cliente: $scope.cobranza.cliente.COD, |
320 | simbolo: $scope.cobranza.moneda.SIMBOLO, | 329 | simbolo: $scope.cobranza.moneda.SIMBOLO, |
321 | cotizacion: $scope.cobranza.cotizacion.VENDEDOR, | 330 | cotizacion: $scope.cobranza.cotizacion.VENDEDOR, |
322 | moneda: $scope.cobranza.moneda.ID | 331 | moneda: $scope.cobranza.moneda.ID |
323 | }; | 332 | }; |
324 | } | 333 | } |
325 | } | 334 | } |
326 | } | 335 | } |
327 | ); | 336 | ); |
328 | modalInstance.result.then( | 337 | modalInstance.result.then( |
329 | function(facturas) { | 338 | function(facturas) { |
330 | $scope.facturaTabla = $scope.facturaTabla.concat(facturas); | 339 | $scope.facturaTabla = $scope.facturaTabla.concat(facturas); |
331 | }, function() { | 340 | }, function() { |
332 | 341 | ||
333 | } | 342 | } |
334 | ); | 343 | ); |
335 | }; | 344 | }; |
336 | 345 | ||
337 | $scope.seleccionarCheque = function() { | 346 | $scope.seleccionarCheque = function() { |
338 | var modalInstance = $uibModal.open( | 347 | var modalInstance = $uibModal.open( |
339 | { | 348 | { |
340 | ariaLabelledBy: 'Carga de cheques', | 349 | ariaLabelledBy: 'Carga de cheques', |
341 | templateUrl: 'modal-cheque.html', | 350 | templateUrl: 'modal-cheque.html', |
342 | controller: 'focaModalChequeController', | 351 | controller: 'focaModalChequeController', |
343 | size: 'lg' | 352 | size: 'lg' |
344 | } | 353 | } |
345 | ); | 354 | ); |
346 | modalInstance.result.then( | 355 | modalInstance.result.then( |
347 | function(cheque) { | 356 | function(cheque) { |
348 | var cobro = { | 357 | var cobro = { |
349 | tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, | 358 | tipo: 'Ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, |
350 | numero: cheque.numero, | 359 | numero: cheque.numero, |
351 | banco: cheque.banco, | 360 | banco: cheque.banco, |
352 | fecha: cheque.fechaEmision.toLocaleDateString() + '-' + | 361 | fecha: cheque.fechaEmision.toLocaleDateString() + '-' + |
353 | cheque.fechaPresentacion.toLocaleDateString(), | 362 | cheque.fechaPresentacion.toLocaleDateString(), |
354 | fechaPresentacion: cheque.fechaPresentacion, | 363 | fechaPresentacion: cheque.fechaPresentacion, |
355 | fechaEmision: cheque.fechaEmision, | 364 | fechaEmision: cheque.fechaEmision, |
356 | importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR, | 365 | importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR, |
357 | localidad: cheque.localidad, | 366 | localidad: cheque.localidad, |
358 | librador: cheque.librador, | 367 | librador: cheque.librador, |
359 | provincia: cheque.provincia, | 368 | provincia: cheque.provincia, |
360 | observaciones: cheque.observaciones | 369 | observaciones: cheque.observaciones |
361 | }; | 370 | }; |
362 | $scope.cobrosTabla.push(cobro); | 371 | $scope.cobrosTabla.push(cobro); |
363 | }, function() { | 372 | }, function() { |
364 | 373 | ||
365 | } | 374 | } |
366 | ); | 375 | ); |
367 | }; | 376 | }; |
368 | 377 | ||
369 | $scope.seleccionarEfectivo = function() { | 378 | $scope.seleccionarEfectivo = function() { |
370 | var modalInstance = $uibModal.open( | 379 | var modalInstance = $uibModal.open( |
371 | { | 380 | { |
372 | ariaLabelledBy: 'Carga de cheques', | 381 | ariaLabelledBy: 'Carga de cheques', |
373 | templateUrl: 'modal-efectivo.html', | 382 | templateUrl: 'modal-efectivo.html', |
374 | controller: 'focaModalEfectivoController', | 383 | controller: 'focaModalEfectivoController', |
375 | size: 'sm', | 384 | size: 'sm', |
376 | resolve: { | 385 | resolve: { |
377 | sugerido: function() { | 386 | sugerido: function() { |
378 | var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); | 387 | var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); |
379 | return sugerido < 0 ? sugerido : null ; | 388 | return sugerido < 0 ? sugerido : null ; |
380 | } | 389 | } |
381 | } | 390 | } |
382 | } | 391 | } |
383 | ); | 392 | ); |
384 | modalInstance.result.then( | 393 | modalInstance.result.then( |
385 | function(efectivo) { | 394 | function(efectivo) { |
386 | var cobro = { | 395 | var cobro = { |
387 | tipo: 'Efectivo', | 396 | tipo: 'Efectivo', |
388 | fecha: new Date(), | 397 | fecha: new Date(), |
389 | importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR | 398 | importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR |
390 | }; | 399 | }; |
391 | $scope.cobrosTabla = $scope.cobrosTabla.filter(function(a) { | 400 | $scope.cobrosTabla = $scope.cobrosTabla.filter(function(a) { |
392 | return a.tipo !== 'Efectivo'; | 401 | return a.tipo !== 'Efectivo'; |
393 | }); | 402 | }); |
394 | $scope.cobrosTabla.push(cobro); | 403 | $scope.cobrosTabla.push(cobro); |
395 | }, function() { | 404 | }, function() { |
396 | 405 | ||
397 | } | 406 | } |
398 | ); | 407 | ); |
399 | }; | 408 | }; |
400 | 409 | ||
401 | $scope.seleccionarMoneda = function() { | 410 | $scope.seleccionarMoneda = function() { |
402 | var modalInstance = $uibModal.open( | 411 | var modalInstance = $uibModal.open( |
403 | { | 412 | { |
404 | ariaLabelledBy: 'Busqueda de Moneda', | 413 | ariaLabelledBy: 'Busqueda de Moneda', |
405 | templateUrl: 'modal-moneda.html', | 414 | templateUrl: 'modal-moneda.html', |
406 | controller: 'focaModalMonedaController', | 415 | controller: 'focaModalMonedaController', |
407 | size: 'lg' | 416 | size: 'lg' |
408 | } | 417 | } |
409 | ); | 418 | ); |
410 | modalInstance.result.then( | 419 | modalInstance.result.then( |
411 | function(moneda) { | 420 | function(moneda) { |
412 | $scope.seleccionarCotizacion(moneda); | 421 | $scope.seleccionarCotizacion(moneda); |
413 | }, function() { | 422 | }, function() { |
414 | 423 | ||
415 | } | 424 | } |
416 | ); | 425 | ); |
417 | }; | 426 | }; |
418 | 427 | ||
419 | $scope.seleccionarCotizacion = function(moneda) { | 428 | $scope.seleccionarCotizacion = function(moneda) { |
420 | var modalInstance = $uibModal.open( | 429 | var modalInstance = $uibModal.open( |
421 | { | 430 | { |
422 | ariaLabelledBy: 'Busqueda de Cotización', | 431 | ariaLabelledBy: 'Busqueda de Cotización', |
423 | templateUrl: 'modal-cotizacion.html', | 432 | templateUrl: 'modal-cotizacion.html', |
424 | controller: 'focaModalCotizacionController', | 433 | controller: 'focaModalCotizacionController', |
425 | size: 'lg', | 434 | size: 'lg', |
426 | resolve: {idMoneda: function() {return moneda.ID;}} | 435 | resolve: {idMoneda: function() {return moneda.ID;}} |
427 | } | 436 | } |
428 | ); | 437 | ); |
429 | modalInstance.result.then( | 438 | modalInstance.result.then( |
430 | function(cotizacion) { | 439 | function(cotizacion) { |
431 | $scope.cobranza.moneda = moneda; | 440 | $scope.cobranza.moneda = moneda; |
432 | $scope.cobranza.cotizacion = cotizacion; | 441 | $scope.cobranza.cotizacion = cotizacion; |
433 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 442 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
434 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 443 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
435 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 444 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
436 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 445 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
437 | }else { | 446 | }else { |
438 | $scope.$broadcast('addCabecera', { | 447 | $scope.$broadcast('addCabecera', { |
439 | label: 'Moneda:', | 448 | label: 'Moneda:', |
440 | valor: moneda.DETALLE | 449 | valor: moneda.DETALLE |
441 | }); | 450 | }); |
442 | $scope.$broadcast('addCabecera', { | 451 | $scope.$broadcast('addCabecera', { |
443 | label: 'Fecha cotizacion:', | 452 | label: 'Fecha cotizacion:', |
444 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 453 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
445 | }); | 454 | }); |
446 | $scope.$broadcast('addCabecera', { | 455 | $scope.$broadcast('addCabecera', { |
447 | label: 'Cotizacion:', | 456 | label: 'Cotizacion:', |
448 | valor: cotizacion.VENDEDOR | 457 | valor: cotizacion.VENDEDOR |
449 | }); | 458 | }); |
450 | } | 459 | } |
451 | }, function() { | 460 | }, function() { |
452 | 461 | ||
453 | } | 462 | } |
454 | ); | 463 | ); |
455 | }; | 464 | }; |
456 | 465 | ||
457 | $scope.seleccionarCobrador = function() { | 466 | $scope.seleccionarCobrador = function() { |
458 | var modalInstance = $uibModal.open( | 467 | var modalInstance = $uibModal.open( |
459 | { | 468 | { |
460 | ariaLabelledBy: 'Busqueda de Cobradores', | 469 | ariaLabelledBy: 'Busqueda de Cobradores', |
461 | templateUrl: 'modal-cobradores.html', | 470 | templateUrl: 'modal-cobradores.html', |
462 | controller: 'focaModalCobradoresController', | 471 | controller: 'focaModalCobradoresController', |
463 | size: 'lg' | 472 | size: 'lg' |
464 | } | 473 | } |
465 | ); | 474 | ); |
466 | modalInstance.result.then( | 475 | modalInstance.result.then( |
467 | function(cobrador) { | 476 | function(cobrador) { |
468 | $scope.$broadcast('addCabecera', { | 477 | $scope.$broadcast('addCabecera', { |
469 | label: 'Cobrador:', | 478 | label: 'Cobrador:', |
470 | valor: cobrador.nombre | 479 | valor: cobrador.nombre |
471 | }); | 480 | }); |
472 | $scope.cobranza.cobrador = cobrador; | 481 | $scope.cobranza.cobrador = cobrador; |
473 | }, function() { | 482 | }, function() { |
474 | 483 | ||
475 | } | 484 | } |
476 | ); | 485 | ); |
477 | }; | 486 | }; |
478 | 487 | ||
479 | $scope.getTotalDeuda = function() { | 488 | $scope.getTotalDeuda = function() { |
480 | var total = 0; | 489 | var total = 0; |
481 | for (var i = 0; i < $scope.facturaTabla.length; i++) { | 490 | for (var i = 0; i < $scope.facturaTabla.length; i++) { |
482 | total += $scope.facturaTabla[i].IPA; | 491 | total += $scope.facturaTabla[i].IPA; |
483 | } | 492 | } |
484 | return parseFloat(total.toFixed(2)); | 493 | return parseFloat(total.toFixed(2)); |
485 | }; | 494 | }; |
486 | 495 | ||
487 | $scope.getTotalCobrado = function() { | 496 | $scope.getTotalCobrado = function() { |
488 | var total = 0; | 497 | var total = 0; |
489 | for (var i = 0; i < $scope.cobrosTabla.length; i++) { | 498 | for (var i = 0; i < $scope.cobrosTabla.length; i++) { |
490 | total += $scope.cobrosTabla[i].importe; | 499 | total += $scope.cobrosTabla[i].importe; |
491 | } | 500 | } |
492 | return parseFloat(total.toFixed(2)); | 501 | return parseFloat(total.toFixed(2)); |
493 | }; | 502 | }; |
494 | 503 | ||
495 | $scope.getSubTotal = function() { | 504 | $scope.getSubTotal = function() { |
496 | if($scope.articuloACargar) { | 505 | if($scope.articuloACargar) { |
497 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 506 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
498 | } | 507 | } |
499 | }; | 508 | }; |
500 | //Recibe aviso si el teclado está en uso | 509 | //Recibe aviso si el teclado está en uso |
501 | // $rootScope.$on('usarTeclado', function(event, data) { | 510 | // $rootScope.$on('usarTeclado', function(event, data) { |
502 | // if(data) { | 511 | // if(data) { |
503 | // $scope.mostrarTeclado = true; | 512 | // $scope.mostrarTeclado = true; |
504 | // return; | 513 | // return; |
505 | // } | 514 | // } |
506 | // $scope.mostrarTeclado = false; | 515 | // $scope.mostrarTeclado = false; |
507 | // }) | 516 | // }) |
508 | $scope.selectFocus = function($event) { | 517 | $scope.selectFocus = function($event) { |
509 | //Si el teclado esta en uso no selecciona el valor | 518 | //Si el teclado esta en uso no selecciona el valor |
510 | // if($scope.mostrarTeclado) { | 519 | // if($scope.mostrarTeclado) { |
511 | // return; | 520 | // return; |
512 | // } | 521 | // } |
513 | $event.target.select(); | 522 | $event.target.select(); |
514 | }; | 523 | }; |
515 | 524 | ||
516 | $scope.salir = function() { | 525 | $scope.salir = function() { |
517 | $location.path('/'); | 526 | $location.path('/'); |
518 | }; | 527 | }; |
519 | 528 | ||
520 | $scope.parsearATexto = function(articulo) { | 529 | $scope.parsearATexto = function(articulo) { |
521 | articulo.cantidad = parseFloat(articulo.cantidad); | 530 | articulo.cantidad = parseFloat(articulo.cantidad); |
522 | articulo.precio = parseFloat(articulo.precio); | 531 | articulo.precio = parseFloat(articulo.precio); |
523 | }; | 532 | }; |
524 | 533 | ||
525 | $scope.rellenar = function(relleno, longitud) { | 534 | $scope.rellenar = function(relleno, longitud) { |
526 | relleno = '' + relleno; | 535 | relleno = '' + relleno; |
527 | while (relleno.length < longitud) { | 536 | while (relleno.length < longitud) { |
528 | relleno = '0' + relleno; | 537 | relleno = '0' + relleno; |
529 | } | 538 | } |
530 | 539 | ||
531 | return relleno; | 540 | return relleno; |
532 | }; | 541 | }; |
533 | 542 | ||
534 | $scope.quitarFactura = function(key) { | 543 | $scope.quitarFactura = function(key) { |
535 | $scope.facturaTabla.splice(key, 1); | 544 | $scope.facturaTabla.splice(key, 1); |
536 | }; | 545 | }; |
537 | 546 | ||
538 | $scope.quitarCobro = function(key) { | 547 | $scope.quitarCobro = function(key) { |
539 | $scope.cobrosTabla.splice(key, 1); | 548 | $scope.cobrosTabla.splice(key, 1); |
540 | }; | 549 | }; |
541 | 550 | ||
542 | function setearMonedaPorDefecto() { | 551 | function setearMonedaPorDefecto() { |
543 | var monedaPorDefecto; | 552 | var monedaPorDefecto; |
544 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 553 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
545 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { | 554 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { |
546 | monedaPorDefecto = res.data[0]; | 555 | monedaPorDefecto = res.data[0]; |
547 | $scope.cobranza.moneda = monedaPorDefecto; | 556 | $scope.cobranza.moneda = monedaPorDefecto; |
548 | $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0]; | 557 | $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0]; |
549 | }); | 558 | }); |
550 | } | 559 | } |
551 | 560 | ||
552 | function obtenerNumeroComprobante() { | 561 | function obtenerNumeroComprobante() { |
553 | focaCrearCobranzaService.getNumeroRecibo().then( | 562 | focaCrearCobranzaService.getNumeroRecibo().then( |
554 | function(res) { | 563 | function(res) { |
555 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); | 564 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
556 | $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8); | 565 | $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8); |
557 | }, | 566 | }, |
558 | function(err) { | 567 | function(err) { |
559 | focaModalService.alert('La terminal no esta configurada correctamente'); | 568 | focaModalService.alert('La terminal no esta configurada correctamente'); |
560 | console.info(err); | 569 | console.info(err); |
561 | } | 570 | } |
562 | ); | 571 | ); |
563 | } | 572 | } |
564 | obtenerNumeroComprobante(); | 573 | obtenerNumeroComprobante(); |
565 | setearMonedaPorDefecto(); | 574 | setearMonedaPorDefecto(); |
566 | } | 575 | } |
567 | ]); | 576 | ]); |
src/views/cobranza.html
1 | <div class="crear-nota-pedido foca-crear one-row row"> | 1 | <div class="crear-nota-pedido foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'RECIBO DE COBRANZA'" | 3 | titulo="'RECIBO DE COBRANZA'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
5 | fecha="fecha" | 5 | fecha="fecha" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | busqueda="seleccionarCobranza" | 7 | busqueda="seleccionarCobranza" |
8 | ></foca-cabecera-facturador> | 8 | ></foca-cabecera-facturador> |
9 | <div class="col-lg-12"> | 9 | <div class="col-lg-12"> |
10 | <div class="row mt-4"> | 10 | <div class="row mt-4"> |
11 | <div class="col-12 col-md-10 border border-light rounded"> | 11 | <div class="col-12 col-md-10 border border-light rounded"> |
12 | <div class="row px-5 py-2 botonera-secundaria"> | 12 | <div class="row px-5 py-2 botonera-secundaria"> |
13 | <div class="col-12"> | 13 | <div class="col-12"> |
14 | <foca-botonera-facturador botones="botonera" extra="1" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | <!-- PC --> | 17 | <!-- PC --> |
18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> | 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> |
19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
20 | <thead> | 20 | <thead> |
21 | <tr class="d-flex"> | 21 | <tr class="d-flex"> |
22 | <th class="col-auto">#</th> | 22 | <th class="col-auto">#</th> |
23 | <th class="col">Comprobante</th> | 23 | <th class="col">Comprobante</th> |
24 | <th class="col">Fecha</th> | 24 | <th class="col">Fecha</th> |
25 | <th class="col">Importe</th> | 25 | <th class="col">Importe</th> |
26 | <th class="col-auto"> | 26 | <th class="col-auto"> |
27 | <button | 27 | <button |
28 | class="btn btn-outline-light selectable" | 28 | class="btn btn-outline-light selectable" |
29 | ng-click="show = !show; masMenos()" | 29 | ng-click="show = !show; masMenos()" |
30 | > | 30 | > |
31 | <i | 31 | <i |
32 | class="fa fa-chevron-down" | 32 | class="fa fa-chevron-down" |
33 | ng-show="show" | 33 | ng-show="show" |
34 | aria-hidden="true" | 34 | aria-hidden="true" |
35 | > | 35 | > |
36 | </i> | 36 | </i> |
37 | <i | 37 | <i |
38 | class="fa fa-chevron-up" | 38 | class="fa fa-chevron-up" |
39 | ng-hide="show" | 39 | ng-hide="show" |
40 | aria-hidden="true"> | 40 | aria-hidden="true"> |
41 | </i> | 41 | </i> |
42 | </button> | 42 | </button> |
43 | </th> | 43 | </th> |
44 | </th> | 44 | </th> |
45 | </tr> | 45 | </tr> |
46 | </thead> | 46 | </thead> |
47 | <tbody class="tabla-articulo-body"> | 47 | <tbody class="tabla-articulo-body"> |
48 | <tr | 48 | <tr |
49 | ng-repeat="(key, factura) in facturaTabla" | 49 | ng-repeat="(key, factura) in facturaTabla" |
50 | class="d-flex" | 50 | class="d-flex" |
51 | ng-show="show || key == facturaTabla.length - 1" | 51 | ng-show="show || key == facturaTabla.length - 1" |
52 | > | 52 | > |
53 | <td ng-bind="key + 1" class="col-auto"></td> | 53 | <td ng-bind="key + 1" class="col-auto"></td> |
54 | <td class="col" ng-bind="factura.numeroFactura" | 54 | <td class="col" ng-bind="factura.numeroFactura" |
55 | ></td> | 55 | ></td> |
56 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> | 56 | <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> |
57 | <td | 57 | <td |
58 | class="col" | 58 | class="col" |
59 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 59 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
60 | currency: cobranza.moneda.SIMBOLO : 4"></td> | 60 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
61 | <td class="text-center col-auto"> | 61 | <td class="text-center col-auto"> |
62 | <button | 62 | <button |
63 | class="btn btn-outline-light" | 63 | class="btn btn-outline-light" |
64 | ng-click="quitarFactura(key)" | 64 | ng-click="quitarFactura(key)" |
65 | > | 65 | > |
66 | <i class="fa fa-trash"></i> | 66 | <i class="fa fa-trash"></i> |
67 | </button> | 67 | </button> |
68 | </td> | 68 | </td> |
69 | </tr> | 69 | </tr> |
70 | </tbody> | 70 | </tbody> |
71 | <tfoot> | 71 | <tfoot> |
72 | <tr ng-show="cargando" class="d-flex"> | 72 | <tr ng-show="cargando" class="d-flex"> |
73 | <td class="col-2 border-top-0"> | 73 | <td class="col-2 border-top-0"> |
74 | <a | 74 | <a |
75 | class="form-control form-control-sm btn btn-secondary" | 75 | class="form-control form-control-sm btn btn-secondary" |
76 | ng-click="seleccionarFactura()" | 76 | ng-click="seleccionarFactura()" |
77 | >Pendientes</a> | 77 | >Pendientes</a> |
78 | </td> | 78 | </td> |
79 | </tr> | 79 | </tr> |
80 | <tr class="d-flex"> | 80 | <tr class="d-flex"> |
81 | <td class="col-auto px-1 border-top-0"> | 81 | <td class="col-auto px-1 border-top-0"> |
82 | <strong>Comprobantes:</strong> | 82 | <strong>Comprobantes:</strong> |
83 | <a ng-bind="facturaTabla.length"></a> | 83 | <a ng-bind="facturaTabla.length"></a> |
84 | </td> | 84 | </td> |
85 | <td class="text-right ml-auto table-celda-total no-border-top"> | 85 | <td class="text-right ml-auto table-celda-total no-border-top"> |
86 | <strong>Cancela:</strong> | 86 | <strong>Cancela:</strong> |
87 | </td> | 87 | </td> |
88 | <td class="table-celda-total text-right no-border-top"> | 88 | <td class="table-celda-total text-right no-border-top"> |
89 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 89 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
90 | currency: cobranza.moneda.SIMBOLO}}</strong> | 90 | currency: cobranza.moneda.SIMBOLO}}</strong> |
91 | </td> | 91 | </td> |
92 | <td class="text-right ml-auto table-celda-total no-border-top"> | 92 | <td class="text-right ml-auto table-celda-total no-border-top"> |
93 | <strong>Total Cobrado:</strong> | 93 | <strong>Total Cobrado:</strong> |
94 | </td> | 94 | </td> |
95 | <td class="table-celda-total text-right no-border-top"> | 95 | <td class="table-celda-total text-right no-border-top"> |
96 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 96 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
97 | currency: cobranza.moneda.SIMBOLO}}</strong> | 97 | currency: cobranza.moneda.SIMBOLO}}</strong> |
98 | </td> | 98 | </td> |
99 | <td class="text-right ml-auto table-celda-total no-border-top"> | 99 | <td class="text-right ml-auto table-celda-total no-border-top"> |
100 | <strong>DF:</strong> | 100 | <strong>DF:</strong> |
101 | </td> | 101 | </td> |
102 | <td class="table-celda-total text-right no-border-top mr-1"> | 102 | <td class="table-celda-total text-right no-border-top mr-1"> |
103 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / | 103 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / |
104 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 104 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
105 | </strong> | 105 | </strong> |
106 | </td> | 106 | </td> |
107 | </tr> | 107 | </tr> |
108 | </tfoot> | 108 | </tfoot> |
109 | </table> | 109 | </table> |
110 | </div> | 110 | </div> |
111 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> | 111 | <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> |
112 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 112 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
113 | <thead> | 113 | <thead> |
114 | <tr class="d-flex"> | 114 | <tr class="d-flex"> |
115 | <th class="col-auto">#</th> | 115 | <th class="col-auto">#</th> |
116 | <th class="col">Cobro</th> | 116 | <th class="col">Cobro</th> |
117 | <th class="col">Fecha</th> | 117 | <th class="col">Fecha</th> |
118 | <th class="col">Importe</th> | 118 | <th class="col">Importe</th> |
119 | <th class="col-auto"> | 119 | <th class="col-auto"> |
120 | <button | 120 | <button |
121 | class="btn btn-outline-light selectable" | 121 | class="btn btn-outline-light selectable" |
122 | ng-click="show = !show; masMenos()" | 122 | ng-click="show = !show; masMenos()" |
123 | > | 123 | > |
124 | <i | 124 | <i |
125 | class="fa fa-chevron-down" | 125 | class="fa fa-chevron-down" |
126 | ng-show="show" | 126 | ng-show="show" |
127 | aria-hidden="true" | 127 | aria-hidden="true" |
128 | > | 128 | > |
129 | </i> | 129 | </i> |
130 | <i | 130 | <i |
131 | class="fa fa-chevron-up" | 131 | class="fa fa-chevron-up" |
132 | ng-hide="show" | 132 | ng-hide="show" |
133 | aria-hidden="true"> | 133 | aria-hidden="true"> |
134 | </i> | 134 | </i> |
135 | </button> | 135 | </button> |
136 | </th> | 136 | </th> |
137 | </th> | 137 | </th> |
138 | </tr> | 138 | </tr> |
139 | </thead> | 139 | </thead> |
140 | <tbody class="tabla-articulo-body"> | 140 | <tbody class="tabla-articulo-body"> |
141 | <tr | 141 | <tr |
142 | ng-repeat="(key, cobro) in cobrosTabla" | 142 | ng-repeat="(key, cobro) in cobrosTabla" |
143 | class="d-flex" | 143 | class="d-flex" |
144 | ng-show="show || key == cobrosTabla.length - 1" | 144 | ng-show="show || key == cobrosTabla.length - 1" |
145 | > | 145 | > |
146 | <td ng-bind="key + 1" class="col-auto"></td> | 146 | <td ng-bind="key + 1" class="col-auto"></td> |
147 | <td class="col" ng-bind="cobro.tipo"></td> | 147 | <td class="col" ng-bind="cobro.tipo"></td> |
148 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> | 148 | <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> |
149 | <td | 149 | <td |
150 | class="col" | 150 | class="col" |
151 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 151 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
152 | currency: cobranza.moneda.SIMBOLO : 4"></td> | 152 | currency: cobranza.moneda.SIMBOLO : 4"></td> |
153 | <td class="text-center col-auto"> | 153 | <td class="text-center col-auto"> |
154 | <button | 154 | <button |
155 | class="btn btn-outline-light" | 155 | class="btn btn-outline-light" |
156 | ng-click="quitarCobro(key)" | 156 | ng-click="quitarCobro(key)" |
157 | > | 157 | > |
158 | <i class="fa fa-trash"></i> | 158 | <i class="fa fa-trash"></i> |
159 | </button> | 159 | </button> |
160 | </td> | 160 | </td> |
161 | </tr> | 161 | </tr> |
162 | </tbody> | 162 | </tbody> |
163 | <tfoot> | 163 | <tfoot> |
164 | <tr ng-show="cargando" class="d-flex"> | 164 | <tr ng-show="cargando" class="d-flex"> |
165 | <td class="col-2 border-top-0"> | 165 | <td class="col-2 border-top-0"> |
166 | <a | 166 | <a |
167 | class="form-control form-control-sm btn btn-secondary" | 167 | class="form-control form-control-sm btn btn-secondary" |
168 | ng-click="seleccionarCheque()" | 168 | ng-click="seleccionarCheque()" |
169 | >Cheque</a> | 169 | >Cheque</a> |
170 | </td> | 170 | </td> |
171 | <td class="col-2 border-top-0"> | 171 | <td class="col-2 border-top-0"> |
172 | <a | 172 | <a |
173 | class="form-control form-control-sm btn btn-secondary" | 173 | class="form-control form-control-sm btn btn-secondary" |
174 | ng-click="seleccionarEfectivo()" | 174 | ng-click="seleccionarEfectivo()" |
175 | >Efectivo</a> | 175 | >Efectivo</a> |
176 | </td> | 176 | </td> |
177 | </tr> | 177 | </tr> |
178 | <tr class="d-flex"> | 178 | <tr class="d-flex"> |
179 | <td class="col-auto px-1 border-top-0"> | 179 | <td class="col-auto px-1 border-top-0"> |
180 | <strong>Cobros:</strong> | 180 | <strong>Cobros:</strong> |
181 | <a ng-bind="cobrosTabla.length"></a> | 181 | <a ng-bind="cobrosTabla.length"></a> |
182 | </td> | 182 | </td> |
183 | <td class="text-right ml-auto table-celda-total no-border-top"> | 183 | <td class="text-right ml-auto table-celda-total no-border-top"> |
184 | <strong>Cancela:</strong> | 184 | <strong>Cancela:</strong> |
185 | </td> | 185 | </td> |
186 | <td class="table-celda-total text-right no-border-top"> | 186 | <td class="table-celda-total text-right no-border-top"> |
187 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | | 187 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | |
188 | currency: cobranza.moneda.SIMBOLO}}</strong> | 188 | currency: cobranza.moneda.SIMBOLO}}</strong> |
189 | </td> | 189 | </td> |
190 | <td class="text-right ml-auto table-celda-total no-border-top"> | 190 | <td class="text-right ml-auto table-celda-total no-border-top"> |
191 | <strong>Total Cobrado:</strong> | 191 | <strong>Total Cobrado:</strong> |
192 | </td> | 192 | </td> |
193 | <td class="table-celda-total text-right no-border-top"> | 193 | <td class="table-celda-total text-right no-border-top"> |
194 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | | 194 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | |
195 | currency: cobranza.moneda.SIMBOLO}}</strong> | 195 | currency: cobranza.moneda.SIMBOLO}}</strong> |
196 | </td> | 196 | </td> |
197 | <td class="text-right ml-auto table-celda-total no-border-top"> | 197 | <td class="text-right ml-auto table-celda-total no-border-top"> |
198 | <strong>DF:</strong> | 198 | <strong>DF:</strong> |
199 | </td> | 199 | </td> |
200 | <td class="table-celda-total text-right no-border-top mr-1"> | 200 | <td class="table-celda-total text-right no-border-top mr-1"> |
201 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / | 201 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / |
202 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 202 | cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
203 | </strong> | 203 | </strong> |
204 | </td> | 204 | </td> |
205 | </tr> | 205 | </tr> |
206 | </tfoot> | 206 | </tfoot> |
207 | </table> | 207 | </table> |
208 | </div> | 208 | </div> |
209 | <!-- MOBILE --> | 209 | <!-- MOBILE --> |
210 | <div class="row d-sm-none mb-5"> | 210 | <div class="row d-sm-none mb-5"> |
211 | <!-- FACTURAS --> | 211 | <!-- FACTURAS --> |
212 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> | 212 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> |
213 | <thead> | 213 | <thead> |
214 | <tr class="d-flex"> | 214 | <tr class="d-flex"> |
215 | <th class="">#</th> | 215 | <th class="">#</th> |
216 | <th class="col px-0"> | 216 | <th class="col px-0"> |
217 | <div class="d-flex"> | 217 | <div class="d-flex"> |
218 | <div class="col-4 px-1">Factura</div> | 218 | <div class="col-4 px-1">Factura</div> |
219 | <div class="col-4 px-1">Fecha</div> | 219 | <div class="col-4 px-1">Fecha</div> |
220 | <div class="col-4 px-1">Importe</div> | 220 | <div class="col-4 px-1">Importe</div> |
221 | </div> | 221 | </div> |
222 | </th> | 222 | </th> |
223 | <th class="text-center tamaño-boton"> | 223 | <th class="text-center tamaño-boton"> |
224 | | 224 | |
225 | </th> | 225 | </th> |
226 | </tr> | 226 | </tr> |
227 | </thead> | 227 | </thead> |
228 | <tbody> | 228 | <tbody> |
229 | <tr | 229 | <tr |
230 | ng-repeat="(key, factura) in facturaTabla" | 230 | ng-repeat="(key, factura) in facturaTabla" |
231 | ng-show="show || key == facturaTabla.length - 1" | 231 | ng-show="show || key == facturaTabla.length - 1" |
232 | > | 232 | > |
233 | <td class="w-100 align-middle d-flex p-0"> | 233 | <td class="w-100 align-middle d-flex p-0"> |
234 | <div class="align-middle p-1"> | 234 | <div class="align-middle p-1"> |
235 | <span ng-bind="key+1" class="align-middle"></span> | 235 | <span ng-bind="key+1" class="align-middle"></span> |
236 | </div> | 236 | </div> |
237 | <div class="col px-0"> | 237 | <div class="col px-0"> |
238 | <div class="d-flex"> | 238 | <div class="d-flex"> |
239 | <div class="col-4 p-1"> | 239 | <div class="col-4 p-1"> |
240 | <span ng-bind="factura.numeroFactura" | 240 | <span ng-bind="factura.numeroFactura" |
241 | ></span> | 241 | ></span> |
242 | </div> | 242 | </div> |
243 | <div class="col-4 p-1"> | 243 | <div class="col-4 p-1"> |
244 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> | 244 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> |
245 | </div> | 245 | </div> |
246 | <div class="col-4 p-1"> | 246 | <div class="col-4 p-1"> |
247 | <span | 247 | <span |
248 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | | 248 | ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | |
249 | currency:cobranza.moneda.SIMBOLO : 4"></span> | 249 | currency:cobranza.moneda.SIMBOLO : 4"></span> |
250 | </div> | 250 | </div> |
251 | </div> | 251 | </div> |
252 | </div> | 252 | </div> |
253 | <div class="align-middle p-1"> | 253 | <div class="align-middle p-1"> |
254 | <button | 254 | <button |
255 | class="btn btn-outline-light" | 255 | class="btn btn-outline-light" |
256 | ng-click="quitarFactura(key)" | 256 | ng-click="quitarFactura(key)" |
257 | > | 257 | > |
258 | <i class="fa fa-trash"></i> | 258 | <i class="fa fa-trash"></i> |
259 | </button> | 259 | </button> |
260 | </div> | 260 | </div> |
261 | </td> | 261 | </td> |
262 | </tr> | 262 | </tr> |
263 | </tbody> | 263 | </tbody> |
264 | <tfoot> | 264 | <tfoot> |
265 | <!-- SELECCIONAR PRODUCTO --> | 265 | <!-- SELECCIONAR PRODUCTO --> |
266 | <tr ng-show="cargando" class="d-flex"> | 266 | <tr ng-show="cargando" class="d-flex"> |
267 | <td class="col-12"> | 267 | <td class="col-12"> |
268 | <input | 268 | <input |
269 | placeholder="Seleccione Factura" | 269 | placeholder="Seleccione Factura" |
270 | class="form-control form-control-sm" | 270 | class="form-control form-control-sm" |
271 | readonly | 271 | readonly |
272 | ng-click="seleccionarFactura()" | 272 | ng-click="seleccionarFactura()" |
273 | /> | 273 | /> |
274 | </td> | 274 | </td> |
275 | </tr> | 275 | </tr> |
276 | <!-- TOOGLE EXPANDIR --> | 276 | <!-- TOOGLE EXPANDIR --> |
277 | <tr> | 277 | <tr> |
278 | <td class="col"> | 278 | <td class="col"> |
279 | <button | 279 | <button |
280 | class="btn btn-outline-light selectable w-100" | 280 | class="btn btn-outline-light selectable w-100" |
281 | ng-click="show = !show; masMenos()" | 281 | ng-click="show = !show; masMenos()" |
282 | ng-show="facturaTabla.length > 0" | 282 | ng-show="facturaTabla.length > 0" |
283 | > | 283 | > |
284 | <i | 284 | <i |
285 | class="fa fa-chevron-down" | 285 | class="fa fa-chevron-down" |
286 | ng-hide="show" | 286 | ng-hide="show" |
287 | aria-hidden="true" | 287 | aria-hidden="true" |
288 | > | 288 | > |
289 | </i> | 289 | </i> |
290 | <i | 290 | <i |
291 | class="fa fa-chevron-up" | 291 | class="fa fa-chevron-up" |
292 | ng-show="show" | 292 | ng-show="show" |
293 | aria-hidden="true"> | 293 | aria-hidden="true"> |
294 | </i> | 294 | </i> |
295 | </button> | 295 | </button> |
296 | </td> | 296 | </td> |
297 | </tr> | 297 | </tr> |
298 | <!-- FOOTER --> | 298 | <!-- FOOTER --> |
299 | <tr class="d-flex"> | 299 | <tr class="d-flex"> |
300 | <td class="align-middle no-border-top" colspan="2"> | 300 | <td class="align-middle no-border-top" colspan="2"> |
301 | <strong>Cantidad Items:</strong> | 301 | <strong>Cantidad Items:</strong> |
302 | <a ng-bind="facturaTabla.length"></a> | 302 | <a ng-bind="facturaTabla.length"></a> |
303 | </td> | 303 | </td> |
304 | </tr> | 304 | </tr> |
305 | </tfoot> | 305 | </tfoot> |
306 | </table> | 306 | </table> |
307 | <!-- COBROS --> | 307 | <!-- COBROS --> |
308 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> | 308 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> |
309 | <thead> | 309 | <thead> |
310 | <tr class="d-flex"> | 310 | <tr class="d-flex"> |
311 | <th class="">#</th> | 311 | <th class="">#</th> |
312 | <th class="col px-0"> | 312 | <th class="col px-0"> |
313 | <div class="d-flex"> | 313 | <div class="d-flex"> |
314 | <div class="col-4 px-1">Cobro</div> | 314 | <div class="col-4 px-1">Cobro</div> |
315 | <div class="col-4 px-1">Fecha</div> | 315 | <div class="col-4 px-1">Fecha</div> |
316 | <div class="col-4 px-1">Importe</div> | 316 | <div class="col-4 px-1">Importe</div> |
317 | </div> | 317 | </div> |
318 | </th> | 318 | </th> |
319 | <th class="text-center tamaño-boton"> | 319 | <th class="text-center tamaño-boton"> |
320 | | 320 | |
321 | </th> | 321 | </th> |
322 | </tr> | 322 | </tr> |
323 | </thead> | 323 | </thead> |
324 | <tbody> | 324 | <tbody> |
325 | <tr | 325 | <tr |
326 | ng-repeat="(key, cobro) in cobrosTabla" | 326 | ng-repeat="(key, cobro) in cobrosTabla" |
327 | ng-show="show || key == cobrosTabla.length - 1" | 327 | ng-show="show || key == cobrosTabla.length - 1" |
328 | > | 328 | > |
329 | <td class="w-100 align-middle d-flex p-0"> | 329 | <td class="w-100 align-middle d-flex p-0"> |
330 | <div class="align-middle p-1"> | 330 | <div class="align-middle p-1"> |
331 | <span ng-bind="key+1" class="align-middle"></span> | 331 | <span ng-bind="key+1" class="align-middle"></span> |
332 | </div> | 332 | </div> |
333 | <div class="col px-0"> | 333 | <div class="col px-0"> |
334 | <div class="d-flex"> | 334 | <div class="d-flex"> |
335 | <div class="col-4 p-1"> | 335 | <div class="col-4 p-1"> |
336 | <span ng-bind="cobro.tipo" | 336 | <span ng-bind="cobro.tipo" |
337 | ></span> | 337 | ></span> |
338 | </div> | 338 | </div> |
339 | <div class="col-4 p-1"> | 339 | <div class="col-4 p-1"> |
340 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> | 340 | <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> |
341 | </div> | 341 | </div> |
342 | <div class="col-4 p-1"> | 342 | <div class="col-4 p-1"> |
343 | <span | 343 | <span |
344 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | | 344 | ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | |
345 | currency: cobranza.moneda.SIMBOLO : 4"></span> | 345 | currency: cobranza.moneda.SIMBOLO : 4"></span> |
346 | </div> | 346 | </div> |
347 | </div> | 347 | </div> |
348 | </div> | 348 | </div> |
349 | <div class="align-middle p-1"> | 349 | <div class="align-middle p-1"> |
350 | <button | 350 | <button |
351 | class="btn btn-outline-light" | 351 | class="btn btn-outline-light" |
352 | ng-click="quitarCobro(key)" | 352 | ng-click="quitarCobro(key)" |
353 | > | 353 | > |
354 | <i class="fa fa-trash"></i> | 354 | <i class="fa fa-trash"></i> |
355 | </button> | 355 | </button> |
356 | </div> | 356 | </div> |
357 | </td> | 357 | </td> |
358 | </tr> | 358 | </tr> |
359 | </tbody> | 359 | </tbody> |
360 | <tfoot> | 360 | <tfoot> |
361 | <!-- SELECCIONAR PRODUCTO --> | 361 | <!-- SELECCIONAR PRODUCTO --> |
362 | <tr ng-show="cargando" class="d-flex"> | 362 | <tr ng-show="cargando" class="d-flex"> |
363 | <td class="col-6"> | 363 | <td class="col-6"> |
364 | <input | 364 | <input |
365 | placeholder="Cheque" | 365 | placeholder="Cheque" |
366 | class="form-control form-control-sm" | 366 | class="form-control form-control-sm" |
367 | readonly | 367 | readonly |
368 | ng-click="seleccionarCheque()" | 368 | ng-click="seleccionarCheque()" |
369 | /> | 369 | /> |
370 | </td> | 370 | </td> |
371 | <td class="col-6"> | 371 | <td class="col-6"> |
372 | <input | 372 | <input |
373 | placeholder="Efectivo" | 373 | placeholder="Efectivo" |
374 | class="form-control form-control-sm" | 374 | class="form-control form-control-sm" |
375 | readonly | 375 | readonly |
376 | ng-click="seleccionarEfectivo()" | 376 | ng-click="seleccionarEfectivo()" |
377 | /> | 377 | /> |
378 | </td> | 378 | </td> |
379 | </tr> | 379 | </tr> |
380 | <!-- TOOGLE EXPANDIR --> | 380 | <!-- TOOGLE EXPANDIR --> |
381 | <tr> | 381 | <tr> |
382 | <td class="col"> | 382 | <td class="col"> |
383 | <button | 383 | <button |
384 | class="btn btn-outline-light selectable w-100" | 384 | class="btn btn-outline-light selectable w-100" |
385 | ng-click="show = !show; masMenos()" | 385 | ng-click="show = !show; masMenos()" |
386 | ng-show="cobrosTabla.length > 0" | 386 | ng-show="cobrosTabla.length > 0" |
387 | > | 387 | > |
388 | <i | 388 | <i |
389 | class="fa fa-chevron-down" | 389 | class="fa fa-chevron-down" |
390 | ng-hide="show" | 390 | ng-hide="show" |
391 | aria-hidden="true" | 391 | aria-hidden="true" |
392 | > | 392 | > |
393 | </i> | 393 | </i> |
394 | <i | 394 | <i |
395 | class="fa fa-chevron-up" | 395 | class="fa fa-chevron-up" |
396 | ng-show="show" | 396 | ng-show="show" |
397 | aria-hidden="true"> | 397 | aria-hidden="true"> |
398 | </i> | 398 | </i> |
399 | </button> | 399 | </button> |
400 | </td> | 400 | </td> |
401 | </tr> | 401 | </tr> |
402 | <!-- FOOTER --> | 402 | <!-- FOOTER --> |
403 | <tr class="d-flex"> | 403 | <tr class="d-flex"> |
404 | <td class="align-middle no-border-top col-6"> | 404 | <td class="align-middle no-border-top col-6"> |
405 | <strong>Cantidad Items:</strong> | 405 | <strong>Cantidad Items:</strong> |
406 | <a ng-bind="cobrosTabla.length"></a> | 406 | <a ng-bind="cobrosTabla.length"></a> |
407 | </td> | 407 | </td> |
408 | </tfoot> | 408 | </tfoot> |
409 | </table> | 409 | </table> |
410 | </tr> | 410 | </tr> |
411 | <!-- DEUDA, COBRADO, DIFERENCIA --> | 411 | <!-- DEUDA, COBRADO, DIFERENCIA --> |
412 | <table class="table-responsive fixed-bottom mb-5"> | 412 | <table class="table-responsive fixed-bottom mb-5"> |
413 | <tr class="d-flex row"> | 413 | <tr class="d-flex row"> |
414 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 414 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
415 | <strong>Cancela:</strong> | 415 | <strong>Cancela:</strong> |
416 | </td> | 416 | </td> |
417 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 417 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
418 | <strong>Cobrado:</strong> | 418 | <strong>Cobrado:</strong> |
419 | </td> | 419 | </td> |
420 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 420 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
421 | <strong>Diferencia:</strong> | 421 | <strong>Diferencia:</strong> |
422 | </td> | 422 | </td> |
423 | <td class="table-celda-total text-center no-border-top col-4"> | 423 | <td class="table-celda-total text-center no-border-top col-4"> |
424 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 424 | <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
425 | </td> | 425 | </td> |
426 | <td class="table-celda-total text-center no-border-top col-4"> | 426 | <td class="table-celda-total text-center no-border-top col-4"> |
427 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 427 | <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
428 | </td> | 428 | </td> |
429 | <td class="table-celda-total text-center no-border-top col-4"> | 429 | <td class="table-celda-total text-center no-border-top col-4"> |
430 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 430 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
431 | </td> | 431 | </td> |
432 | </tr> | 432 | </tr> |
433 | </table> | 433 | </table> |
434 | </div> | 434 | </div> |
435 | </div> | 435 | </div> |
436 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | ||
437 | <div class="col-12 mt-auto"> | ||
438 | <button | ||
439 | ng-click="crearCobranza()" | ||
440 | title="Crear nota pedido" | ||
441 | class="btn btn-default btn-block mb-2 border border-dark" | ||
442 | ng-disabled="editando || saveLoading"> | ||
443 | <strong>GUARDAR</strong> | ||
444 | </button> | ||
445 | <button | ||
446 | type="button" | ||
447 | title="Salir" | ||
448 | class="btn btn-default btn-block border border-dark"> | ||
449 | <strong>PAUSAR</strong> | ||
450 | </button> | ||
451 | <button | ||
452 | ng-click="salir()" | ||
453 | type="button" | ||
454 | title="Salir" | ||
455 | class="btn btn-default btn-block border border-dark"> | ||
456 | <strong>SALIR</strong> | ||
457 | </button> | ||
458 | </div> | ||
459 | </div> | ||
460 | </div> | 436 | </div> |
461 | </div> | 437 | </div> |
462 | <div class="row d-md-none fixed-bottom"> | 438 | <div class="row d-md-none fixed-bottom"> |
463 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 439 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
464 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 440 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
465 | <span | 441 | <span |
466 | class="mr-3 ml-auto" | 442 | class="mr-3 ml-auto" |
467 | ng-class="saveLoading ? 'text-muted' : ''" | 443 | ng-class="saveLoading ? 'text-muted' : ''" |
468 | ng-click="crearCobranza()" | 444 | ng-click="crearCobranza()" |
469 | ng-show="!editando" | 445 | ng-show="!editando" |
470 | ladda="saveLoading" | 446 | ladda="saveLoading" |
471 | data-style="expand-left" | 447 | data-style="expand-left" |
472 | >Guardar</span> | 448 | >Guardar</span> |
473 | </div> | 449 | </div> |
474 | </div> | 450 | </div> |
475 | </div> | 451 | </div> |
476 | 452 |