Commit f91a30d67ddbe9150db19be301872e5a2e7a489c
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !73
Showing
3 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearCobranza') .controller('cobranzaController', | 1 | angular.module('focaCrearCobranza') .controller('cobranzaController', |
2 | [ | 2 | [ |
3 | '$scope', '$timeout', '$uibModal', '$location', | 3 | '$scope', '$timeout', '$uibModal', '$location', |
4 | 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService', | 4 | 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService', |
5 | 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage', | 5 | 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage', |
6 | function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, | 6 | function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, |
7 | focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService, | 7 | focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService, |
8 | APP, loginService, $localStorage) | 8 | APP, loginService, $localStorage) |
9 | { | 9 | { |
10 | config(); | 10 | config(); |
11 | 11 | ||
12 | function config() { | 12 | function config() { |
13 | $scope.datepickerAbierto = false; | 13 | $scope.datepickerAbierto = false; |
14 | $scope.cobroDeuda = true; | 14 | $scope.cobroDeuda = true; |
15 | $scope.show = false; | 15 | $scope.show = false; |
16 | $scope.cargando = true; | 16 | $scope.cargando = true; |
17 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | 17 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); |
18 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | 18 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); |
19 | $scope.botonera = focaCrearCobranzaService.getBotonera(); | 19 | $scope.botonera = focaCrearCobranzaService.getBotonera(); |
20 | $scope.dateOptions = { | 20 | $scope.dateOptions = { |
21 | maxDate: new Date(), | 21 | maxDate: new Date(), |
22 | minDate: new Date(2010, 0, 1) | 22 | minDate: new Date(2010, 0, 1) |
23 | }; | 23 | }; |
24 | 24 | ||
25 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 25 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
26 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { | 26 | focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { |
27 | var moneda = res.data[0]; | 27 | var moneda = res.data[0]; |
28 | moneda.cotizacion = moneda.cotizaciones[0]; | 28 | moneda.cotizacion = moneda.cotizaciones[0]; |
29 | $scope.cobranza.moneda = $scope.inicial.moneda = moneda; | 29 | $scope.cobranza.moneda = $scope.inicial.moneda = moneda; |
30 | $timeout(function() {getLSCobranza();}); | 30 | $filter('filter')( $scope.botonera, { |
31 | label: 'Moneda' | ||
32 | })[0].checked = true; | ||
33 | $timeout(function() { getLSCobranza();} ); | ||
31 | }); | 34 | }); |
32 | 35 | ||
33 | $timeout(function() { | 36 | $timeout(function() { |
34 | focaBotoneraLateralService.showSalir(false); | 37 | focaBotoneraLateralService.showSalir(false); |
35 | focaBotoneraLateralService.showPausar(true); | 38 | focaBotoneraLateralService.showPausar(true); |
36 | focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); | 39 | focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); |
37 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 40 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
38 | }); | 41 | }); |
39 | 42 | ||
40 | if (APP === 'cobranza') { | 43 | if (APP === 'cobranza') { |
41 | $scope.idCobrador = loginService.getLoginData().vendedorCobrador; | 44 | $scope.idCobrador = loginService.getLoginData().vendedorCobrador; |
42 | } | 45 | } |
43 | 46 | ||
44 | init(); | 47 | init(); |
45 | |||
46 | } | 48 | } |
47 | 49 | ||
48 | function init() { | 50 | function init() { |
49 | $scope.$broadcast('cleanCabecera'); | 51 | $scope.$broadcast('cleanCabecera'); |
50 | $scope.cobranza = { | 52 | $scope.cobranza = { |
51 | FEC: new Date(), | 53 | FEC: new Date(), |
52 | moneda: {}, | 54 | moneda: {}, |
53 | facturas: [], | 55 | facturas: [], |
54 | cobros: [], | 56 | cobros: [], |
55 | cliente: {}, | 57 | cliente: {}, |
56 | cobrador: {} | 58 | cobrador: {} |
57 | }; | 59 | }; |
60 | |||
58 | if (APP === 'cobranza') { | 61 | if (APP === 'cobranza') { |
59 | focaCrearCobranzaService.getCobradorById($scope.idCobrador).then( | 62 | focaCrearCobranzaService.getCobradorById($scope.idCobrador).then( |
60 | function(res) { | 63 | function(res) { |
61 | var cobrador = res.data; | 64 | var cobrador = res.data; |
62 | 65 | ||
63 | $scope.$broadcast('addCabecera', { | 66 | $scope.$broadcast('addCabecera', { |
64 | label: 'Cobrador:', | 67 | label: 'Cobrador:', |
65 | valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + | 68 | valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + |
66 | cobrador.NOM | 69 | cobrador.NOM |
67 | }); | 70 | }); |
68 | 71 | ||
69 | $scope.cobranza.cobrador = cobrador; | 72 | $scope.cobranza.cobrador = cobrador; |
70 | $scope.inicial.cobranza.cobrador = $scope.cobranza.cobrador; | 73 | $scope.inicial.cobrador = $scope.cobranza.cobrador; |
71 | } | 74 | } |
72 | ); | 75 | ); |
73 | } | 76 | } |
74 | 77 | ||
75 | $scope.inicial = angular.copy($scope.cobranza); | 78 | $scope.inicial = angular.copy($scope.cobranza); |
76 | 79 | ||
77 | focaCrearCobranzaService.getNumeroRecibo().then( | 80 | focaCrearCobranzaService.getNumeroRecibo().then( |
78 | function(res) { | 81 | function(res) { |
79 | $scope.puntoVenta = $filter('rellenarDigitos')( | 82 | $scope.puntoVenta = $filter('rellenarDigitos')( |
80 | res.data.sucursal, 4 | 83 | res.data.sucursal, 4 |
81 | ); | 84 | ); |
82 | 85 | ||
83 | $scope.comprobante = $filter('rellenarDigitos')( | 86 | $scope.comprobante = $filter('rellenarDigitos')( |
84 | res.data.numeroRecibo, 8 | 87 | res.data.numeroRecibo, 8 |
85 | ); | 88 | ); |
86 | }, | 89 | }, |
87 | function(err) { | 90 | function(err) { |
88 | focaModalService.alert( | 91 | focaModalService.alert( |
89 | 'La terminal no esta configurada correctamente' | 92 | 'La terminal no esta configurada correctamente' |
90 | ); | 93 | ); |
91 | console.info(err); | 94 | console.info(err); |
92 | } | 95 | } |
93 | ); | 96 | ); |
94 | } | 97 | } |
95 | 98 | ||
96 | $scope.$watch('cobranza', function(newValue) { | 99 | $scope.$watch('cobranza', function(newValue) { |
97 | focaBotoneraLateralService.setPausarData({ | 100 | focaBotoneraLateralService.setPausarData({ |
98 | label: 'cobranza', | 101 | label: 'cobranza', |
99 | val: newValue | 102 | val: newValue |
100 | }); | 103 | }); |
101 | }, true); | 104 | }, true); |
102 | 105 | ||
103 | $scope.crearCobranza = function() { | 106 | $scope.crearCobranza = function() { |
104 | if (!$scope.cobranza.cliente.COD) { | 107 | if (!$scope.cobranza.cliente.COD) { |
105 | focaModalService.alert('Ingrese Cliente'); | 108 | focaModalService.alert('Ingrese Cliente'); |
106 | return; | 109 | return; |
107 | } | 110 | } |
108 | if (!$scope.cobranza.cobrador.NUM) { | 111 | if (!$scope.cobranza.cobrador.NUM) { |
109 | focaModalService.alert('Ingrese Cobrador'); | 112 | focaModalService.alert('Ingrese Cobrador'); |
110 | return; | 113 | return; |
111 | } | 114 | } |
112 | if ($scope.cobranza.facturas.length < 1) { | 115 | if ($scope.cobranza.facturas.length < 1) { |
113 | focaModalService.alert('Ingrese al menos una factura'); | 116 | focaModalService.alert('Ingrese al menos una factura'); |
114 | return; | 117 | return; |
115 | } | 118 | } |
116 | if ($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { | 119 | if ($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { |
117 | focaModalService.alert('La diferencia debe ser ' + | 120 | focaModalService.alert('La diferencia debe ser ' + |
118 | $scope.cobranza.moneda.SIMBOLO + '0,00'); | 121 | $scope.cobranza.moneda.SIMBOLO + '0,00'); |
119 | return; | 122 | return; |
120 | } | 123 | } |
121 | var cobranza = {}; | 124 | var cobranza = {}; |
122 | var cheques = []; | 125 | var cheques = []; |
123 | var cuerpos = []; | 126 | var cuerpos = []; |
124 | var imgs = []; | 127 | var imgs = []; |
125 | var observacion; | 128 | var observacion; |
126 | //TODO: habilitar edición | 129 | //TODO: habilitar edición |
127 | $scope.editando = false; | 130 | $scope.editando = false; |
128 | focaBotoneraLateralService.startGuardar(); | 131 | focaBotoneraLateralService.startGuardar(); |
129 | $scope.saveLoading = true; | 132 | $scope.saveLoading = true; |
130 | for(var i = 0; i < $scope.cobranza.facturas.length; i++) { | 133 | for(var i = 0; i < $scope.cobranza.facturas.length; i++) { |
131 | var cuerpoFactura = { | 134 | var cuerpoFactura = { |
132 | CYV: 'V', | 135 | CYV: 'V', |
133 | TIP: 'C', | 136 | TIP: 'C', |
134 | TCO: 'RC', | 137 | TCO: 'RC', |
135 | PVE: $scope.puntoVenta, | 138 | PVE: $scope.puntoVenta, |
136 | NCO: $scope.comprobante, | 139 | NCO: $scope.comprobante, |
137 | LOP: 'L', | 140 | LOP: 'L', |
138 | TIL: $scope.cobranza.facturas[i].TCO, | 141 | TIL: $scope.cobranza.facturas[i].TCO, |
139 | COM: $scope.cobranza.facturas[i].COM + '-' + | 142 | COM: $scope.cobranza.facturas[i].COM + '-' + |
140 | $filter('rellenarDigitos')($scope.cobranza.facturas[i].NCU,2), | 143 | $filter('rellenarDigitos')($scope.cobranza.facturas[i].NCU,2), |
141 | FEC: new Date($scope.cobranza.FEC) | 144 | FEC: new Date($scope.cobranza.FEC) |
142 | .toISOString().slice(0, 19).replace('T', ' '), | 145 | .toISOString().slice(0, 19).replace('T', ' '), |
143 | IMP: Math.abs($scope.cobranza.facturas[i].IMP || | 146 | IMP: Math.abs($scope.cobranza.facturas[i].IMP || |
144 | $scope.cobranza.facturas[i].IPA), | 147 | $scope.cobranza.facturas[i].IPA), |
145 | RES: 0,//caja de tesorería | 148 | RES: 0,//caja de tesorería |
146 | SUBM: 0, | 149 | SUBM: 0, |
147 | NCU: $scope.cobranza.facturas[i].NCU | 150 | NCU: $scope.cobranza.facturas[i].NCU |
148 | }; | 151 | }; |
149 | cuerpos.push(cuerpoFactura); | 152 | cuerpos.push(cuerpoFactura); |
150 | 153 | ||
151 | } | 154 | } |
152 | 155 | ||
153 | for (var j = 0; j < $scope.cobranza.cobros.length; j++) { | 156 | for (var j = 0; j < $scope.cobranza.cobros.length; j++) { |
154 | 157 | ||
155 | var efectivo = $scope.cobranza.cobros[j].tipo === 'Efectivo'; | 158 | var efectivo = $scope.cobranza.cobros[j].tipo === 'Efectivo'; |
156 | var cuerpoCobros = { | 159 | var cuerpoCobros = { |
157 | CYV: 'V', | 160 | CYV: 'V', |
158 | TIP: 'C', | 161 | TIP: 'C', |
159 | TCO: 'RC', | 162 | TCO: 'RC', |
160 | PVE: $scope.puntoVenta, | 163 | PVE: $scope.puntoVenta, |
161 | NCO: $scope.comprobante, | 164 | NCO: $scope.comprobante, |
162 | LOP: 'P', | 165 | LOP: 'P', |
163 | TIL: $scope.cobranza.cobros[j].TIL, | 166 | TIL: $scope.cobranza.cobros[j].TIL, |
164 | COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].COM, | 167 | COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].COM, |
165 | FEC: !$scope.cobranza.cobros[j].fechaPresentacion ? | 168 | FEC: !$scope.cobranza.cobros[j].fechaPresentacion ? |
166 | new Date($scope.cobranza.cobros[j].FEC) | 169 | new Date($scope.cobranza.cobros[j].FEC) |
167 | .toISOString().slice(0, 19).replace('T', ' ') : | 170 | .toISOString().slice(0, 19).replace('T', ' ') : |
168 | new Date($scope.cobranza.cobros[j].fechaPresentacion) | 171 | new Date($scope.cobranza.cobros[j].fechaPresentacion) |
169 | .toISOString().slice(0, 19).replace('T', ' '), | 172 | .toISOString().slice(0, 19).replace('T', ' '), |
170 | IMP: Math.abs($scope.cobranza.cobros[j].IMP), | 173 | IMP: Math.abs($scope.cobranza.cobros[j].IMP), |
171 | RES: 0,//caja de tesorería | 174 | RES: 0,//caja de tesorería |
172 | SUBM: 0 | 175 | SUBM: 0 |
173 | }; | 176 | }; |
174 | cuerpos.push(cuerpoCobros); | 177 | cuerpos.push(cuerpoCobros); |
175 | 178 | ||
176 | if ($scope.cobranza.cobros[j].observacion) | 179 | if ($scope.cobranza.cobros[j].observacion) |
177 | observacion = $scope.cobranza.cobros[j].observacion; | 180 | observacion = $scope.cobranza.cobros[j].observacion; |
178 | 181 | ||
179 | if ($scope.cobranza.cobros[j].banco) { | 182 | if ($scope.cobranza.cobros[j].banco) { |
180 | var cheque = { | 183 | var cheque = { |
181 | BCO: $scope.cobranza.cobros[j].banco.ID, | 184 | BCO: $scope.cobranza.cobros[j].banco.ID, |
182 | NUM: $scope.comprobante, | 185 | NUM: $scope.comprobante, |
183 | FEP: new Date($scope.cobranza.cobros[j].fechaPresentacion) | 186 | FEP: new Date($scope.cobranza.cobros[j].fechaPresentacion) |
184 | .toISOString().slice(0, 19).replace('T', ' '), | 187 | .toISOString().slice(0, 19).replace('T', ' '), |
185 | FEE: new Date($scope.cobranza.cobros[j].fechaEmision) | 188 | FEE: new Date($scope.cobranza.cobros[j].fechaEmision) |
186 | .toISOString().slice(0, 19).replace('T', ' '), | 189 | .toISOString().slice(0, 19).replace('T', ' '), |
187 | LUG: $scope.cobranza.cobros[j].localidad.NOMBRE, | 190 | LUG: $scope.cobranza.cobros[j].localidad.NOMBRE, |
188 | IMP: $scope.cobranza.cobros[j].importe, | 191 | IMP: $scope.cobranza.cobros[j].importe, |
189 | LIB: $scope.cobranza.cobros[j].librador, | 192 | LIB: $scope.cobranza.cobros[j].librador, |
190 | EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera | 193 | EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera |
191 | PCI: $scope.cobranza.cobros[j].provincia.ID, | 194 | PCI: $scope.cobranza.cobros[j].provincia.ID, |
192 | LPLA: 0, | 195 | LPLA: 0, |
193 | PLA: 0, | 196 | PLA: 0, |
194 | VEN: $scope.cobranza.cobrador.id,//Id vendedor | 197 | VEN: $scope.cobranza.cobrador.id,//Id vendedor |
195 | CCLIE: $scope.cobranza.cliente.COD,//Id cliente | 198 | CCLIE: $scope.cobranza.cliente.COD,//Id cliente |
196 | REN: 0, | 199 | REN: 0, |
197 | PVEC: $scope.puntoVenta, | 200 | PVEC: $scope.puntoVenta, |
198 | NCOC: $scope.comprobante, | 201 | NCOC: $scope.comprobante, |
199 | OBSE: $scope.cobranza.cobros[j].observaciones, | 202 | OBSE: $scope.cobranza.cobros[j].observaciones, |
200 | LUV: 0, | 203 | LUV: 0, |
201 | ORI: 've', | 204 | ORI: 've', |
202 | FER: '', | 205 | FER: '', |
203 | BIMP: 0, | 206 | BIMP: 0, |
204 | COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, | 207 | COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, |
205 | VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso | 208 | VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso |
206 | VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso | 209 | VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso |
207 | REC_CAJ: 'D', | 210 | REC_CAJ: 'D', |
208 | TIPO_C: 0,//?? | 211 | TIPO_C: 0,//?? |
209 | SALDO_CAJ: 'S', | 212 | SALDO_CAJ: 'S', |
210 | FECHA_INGRESO: new Date($scope.cobranza.FEC) | 213 | FECHA_INGRESO: new Date($scope.cobranza.FEC) |
211 | .toISOString().slice(0, 19).replace('T', ' '), | 214 | .toISOString().slice(0, 19).replace('T', ' '), |
212 | Vendedor_valor: 0, | 215 | Vendedor_valor: 0, |
213 | FAMILIA: 0, | 216 | FAMILIA: 0, |
214 | CUIT_LIB: '', | 217 | CUIT_LIB: '', |
215 | COD_LUG: $scope.cobranza.cobros[j].localidad.ID,//código lugar | 218 | COD_LUG: $scope.cobranza.cobros[j].localidad.ID,//código lugar |
216 | SEN: '', | 219 | SEN: '', |
217 | NRC: 0, | 220 | NRC: 0, |
218 | COD_LARGO: '', | 221 | COD_LARGO: '', |
219 | VN: 0, | 222 | VN: 0, |
220 | ID_LECTOR: 0, | 223 | ID_LECTOR: 0, |
221 | NATHB: '' | 224 | NATHB: '' |
222 | }; | 225 | }; |
223 | cheques.push(cheque); | 226 | cheques.push(cheque); |
224 | } | 227 | } |
225 | if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs; | 228 | if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs; |
226 | 229 | ||
227 | } | 230 | } |
228 | 231 | ||
229 | cobranza = { | 232 | cobranza = { |
230 | recibo: { | 233 | recibo: { |
231 | CYV: 'V', | 234 | CYV: 'V', |
232 | TIP: 'C', | 235 | TIP: 'C', |
233 | TCO: 'RC', | 236 | TCO: 'RC', |
234 | PVE: $scope.puntoVenta, //Sucursar, punto de venta | 237 | PVE: $scope.puntoVenta, //Sucursar, punto de venta |
235 | NCO: $scope.comprobante, //Numero de comprobante | 238 | NCO: $scope.comprobante, //Numero de comprobante |
236 | FEC: new Date($scope.cobranza.FEC) | 239 | FEC: new Date($scope.cobranza.FEC) |
237 | .toISOString().slice(0, 19).replace('T', ' '), | 240 | .toISOString().slice(0, 19).replace('T', ' '), |
238 | CLI: $scope.cobranza.cliente.COD, | 241 | CLI: $scope.cobranza.cliente.COD, |
239 | ATO: 0, //número de asiento | 242 | ATO: 0, //número de asiento |
240 | CFE: $scope.cobranza.cobrador.NOM, | 243 | CFE: $scope.cobranza.cobrador.NOM, |
241 | PLA: '',//Numero de planilla, sin uso | 244 | PLA: '',//Numero de planilla, sin uso |
242 | ID_MONEDA: $scope.cobranza.moneda.ID, | 245 | ID_MONEDA: $scope.cobranza.moneda.ID, |
243 | COTIZACION: $scope.cobranza.moneda.cotizacion.VENDEDOR, | 246 | COTIZACION: $scope.cobranza.moneda.cotizacion.VENDEDOR, |
244 | idCobrador: $scope.cobranza.cobrador.id | 247 | idCobrador: $scope.cobranza.cobrador.id |
245 | }, | 248 | }, |
246 | cuerpo: cuerpos, | 249 | cuerpo: cuerpos, |
247 | cheques: cheques, | 250 | cheques: cheques, |
248 | acobypag: { | 251 | acobypag: { |
249 | CYV: 'V', | 252 | CYV: 'V', |
250 | COD: $scope.cobranza.cliente.COD, | 253 | COD: $scope.cobranza.cliente.COD, |
251 | FEP: new Date($scope.cobranza.FEC) | 254 | FEP: new Date($scope.cobranza.FEC) |
252 | .toISOString().slice(0, 19).replace('T', ' '), | 255 | .toISOString().slice(0, 19).replace('T', ' '), |
253 | TIP: 'C', | 256 | TIP: 'C', |
254 | TCO: 'RC', | 257 | TCO: 'RC', |
255 | SUC: $scope.puntoVenta, | 258 | SUC: $scope.puntoVenta, |
256 | NCO: $scope.comprobante, | 259 | NCO: $scope.comprobante, |
257 | IPA: $scope.getTotalCobrado(), | 260 | IPA: $scope.getTotalCobrado(), |
258 | SAL: '',//?? | 261 | SAL: '',//?? |
259 | TCA: 1, | 262 | TCA: 1, |
260 | ZONA: 1, | 263 | ZONA: 1, |
261 | FPA: 2,//Forma de pago | 264 | FPA: 2,//Forma de pago |
262 | REC: 0, | 265 | REC: 0, |
263 | REP: 0, | 266 | REP: 0, |
264 | FER: null, | 267 | FER: null, |
265 | REM: 0, | 268 | REM: 0, |
266 | FRE: null,//?? | 269 | FRE: null,//?? |
267 | PRO: 'N', | 270 | PRO: 'N', |
268 | FEV: new Date($scope.cobranza.FEC) | 271 | FEV: new Date($scope.cobranza.FEC) |
269 | .toISOString().slice(0, 19).replace('T', ' ') | 272 | .toISOString().slice(0, 19).replace('T', ' ') |
270 | }, | 273 | }, |
271 | datosCobrador: { | 274 | datosCobrador: { |
272 | COD: $scope.cobranza.cobrador.NUM, | 275 | COD: $scope.cobranza.cobrador.NUM, |
273 | PVE: $scope.puntoVenta, | 276 | PVE: $scope.puntoVenta, |
274 | NUM: $scope.comprobante, | 277 | NUM: $scope.comprobante, |
275 | EST: 'C', | 278 | EST: 'C', |
276 | OBS: 'RC: ' + $scope.comprobante + '-' + | 279 | OBS: 'RC: ' + $scope.comprobante + '-' + |
277 | new Date($scope.cobranza.FEC).toLocaleDateString(), | 280 | new Date($scope.cobranza.FEC).toLocaleDateString(), |
278 | DAT1: 'C', | 281 | DAT1: 'C', |
279 | CLI: $scope.cobranza.cliente.COD | 282 | CLI: $scope.cobranza.cliente.COD |
280 | }, | 283 | }, |
281 | cliente: $scope.cobranza.cliente, | 284 | cliente: $scope.cobranza.cliente, |
282 | imgs: imgs, | 285 | imgs: imgs, |
283 | observacion: observacion | 286 | observacion: observacion |
284 | }; | 287 | }; |
285 | //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS | 288 | //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS |
286 | var cobranzaMail = angular.copy(cobranza); | 289 | var cobranzaMail = angular.copy(cobranza); |
287 | cobranza.cuerpo = cobranza.cuerpo.map(function(c) { | 290 | cobranza.cuerpo = cobranza.cuerpo.map(function(c) { |
288 | if (c.NCU) delete c.NCU; | 291 | if (c.NCU) delete c.NCU; |
289 | return c; | 292 | return c; |
290 | }); | 293 | }); |
291 | 294 | ||
292 | focaCrearCobranzaService | 295 | focaCrearCobranzaService |
293 | .guardarCobranza(cobranza) | 296 | .guardarCobranza(cobranza) |
294 | .then( | 297 | .then( |
295 | function(result) { | 298 | function(result) { |
296 | focaBotoneraLateralService.endGuardar(true); | 299 | focaBotoneraLateralService.endGuardar(true); |
297 | $scope.saveLoading = false; | 300 | $scope.saveLoading = false; |
298 | 301 | ||
299 | enviarMail(cobranzaMail); | 302 | enviarMail(cobranzaMail); |
300 | 303 | ||
301 | focaSeguimientoService.guardarPosicion( | 304 | focaSeguimientoService.guardarPosicion( |
302 | 'Cobranza', | 305 | 'Cobranza', |
303 | result.data, | 306 | result.data, |
304 | '' | 307 | '' |
305 | ); | 308 | ); |
306 | 309 | ||
307 | init(); | 310 | init(); |
308 | }, function(error) { | 311 | }, function(error) { |
309 | focaModalService.alert('Hubo un problema al cargar la cobranza'); | 312 | focaModalService.alert('Hubo un problema al cargar la cobranza'); |
310 | focaBotoneraLateralService.endGuardar(); | 313 | focaBotoneraLateralService.endGuardar(); |
311 | $scope.saveLoading = false; | 314 | $scope.saveLoading = false; |
312 | console.info(error); | 315 | console.info(error); |
313 | } | 316 | } |
314 | ); | 317 | ); |
315 | }; | 318 | }; |
316 | 319 | ||
317 | $scope.seleccionarCobros = function() { | 320 | $scope.seleccionarCobros = function() { |
318 | $scope.cobroDeuda = false; | 321 | $scope.cobroDeuda = false; |
319 | }; | 322 | }; |
320 | 323 | ||
321 | $scope.seleccionarComprobantes = function() { | 324 | $scope.seleccionarComprobantes = function() { |
322 | $scope.cobroDeuda = true; | 325 | $scope.cobroDeuda = true; |
323 | }; | 326 | }; |
324 | 327 | ||
325 | $scope.seleccionarCobranza = function() { | 328 | $scope.seleccionarCobranza = function() { |
326 | 329 | ||
327 | var modalInstance = $uibModal.open( | 330 | var modalInstance = $uibModal.open( |
328 | { | 331 | { |
329 | ariaLabelledBy: 'Busqueda de Cobranzas', | 332 | ariaLabelledBy: 'Busqueda de Cobranzas', |
330 | templateUrl: 'foca-modal-cobranza.html', | 333 | templateUrl: 'foca-modal-cobranza.html', |
331 | controller: 'focaModalCobranzaController', | 334 | controller: 'focaModalCobranzaController', |
332 | size: 'lg' | 335 | size: 'lg' |
333 | } | 336 | } |
334 | ); | 337 | ); |
335 | modalInstance.result.then(function(cobranza) { | 338 | modalInstance.result.then(function(cobranza) { |
336 | cobranza.moneda.cotizacion = cobranza.moneda.cotizaciones[0]; | 339 | cobranza.moneda.cotizacion = cobranza.moneda.cotizaciones[0]; |
337 | setearCobranza(cobranza); | 340 | setearCobranza(cobranza); |
338 | }); | 341 | }); |
339 | }; | 342 | }; |
340 | 343 | ||
341 | $scope.seleccionarResumenDeCuenta = function() { | 344 | $scope.seleccionarResumenDeCuenta = function() { |
342 | if (!$scope.cobranza.cliente.COD) { | 345 | if (!$scope.cobranza.cliente.COD) { |
343 | focaModalService.alert('Seleccione primero un cliente'); | 346 | focaModalService.alert('Seleccione primero un cliente'); |
344 | return; | 347 | return; |
345 | } | 348 | } |
346 | var modalInstance = $uibModal.open( | 349 | var modalInstance = $uibModal.open( |
347 | { | 350 | { |
348 | ariaLabelledBy: 'Resumen de cuentas', | 351 | ariaLabelledBy: 'Resumen de cuentas', |
349 | templateUrl: 'modal-resumen-cuenta.html', | 352 | templateUrl: 'modal-resumen-cuenta.html', |
350 | controller: 'focaModalResumenCuentaController', | 353 | controller: 'focaModalResumenCuentaController', |
351 | resolve: { | 354 | resolve: { |
352 | cliente: function() { return $scope.cobranza.cliente; } | 355 | cliente: function() { return $scope.cobranza.cliente; } |
353 | }, | 356 | }, |
354 | size: 'lg' | 357 | size: 'lg' |
355 | } | 358 | } |
356 | ); | 359 | ); |
357 | modalInstance.result.then( | 360 | modalInstance.result.then( |
358 | function(cliente) { | 361 | function(cliente) { |
359 | $scope.abrirModalDomicilios(cliente); | 362 | $scope.abrirModalDomicilios(cliente); |
360 | $scope.cliente = cliente; | 363 | $scope.cliente = cliente; |
361 | }, function() {} | 364 | }, function() {} |
362 | ); | 365 | ); |
363 | }; | 366 | }; |
364 | 367 | ||
365 | $scope.seleccionarCliente = function() { | 368 | $scope.seleccionarCliente = function() { |
366 | $scope.seleccionarCobrador(function() { | 369 | $scope.seleccionarCobrador(function() { |
367 | var modalInstance = $uibModal.open( | 370 | var modalInstance = $uibModal.open( |
368 | { | 371 | { |
369 | ariaLabelledBy: 'Busqueda de Cliente', | 372 | ariaLabelledBy: 'Busqueda de Cliente', |
370 | templateUrl: 'foca-busqueda-cliente-modal.html', | 373 | templateUrl: 'foca-busqueda-cliente-modal.html', |
371 | controller: 'focaBusquedaClienteModalController', | 374 | controller: 'focaBusquedaClienteModalController', |
372 | resolve: { | 375 | resolve: { |
373 | vendedor: function() { return null; }, | 376 | vendedor: function() { return null; }, |
374 | cobrador: function() { return $scope.cobranza.cobrador; } | 377 | cobrador: function() { return $scope.cobranza.cobrador; } |
375 | }, | 378 | }, |
376 | size: 'lg' | 379 | size: 'lg' |
377 | } | 380 | } |
378 | ); | 381 | ); |
379 | modalInstance.result.then( | 382 | modalInstance.result.then( |
380 | function(cliente) { | 383 | function(cliente) { |
381 | var clienteMayus = { | 384 | var clienteMayus = { |
382 | COD: cliente.cod, | 385 | COD: cliente.cod, |
383 | NOM: cliente.nom, | 386 | NOM: cliente.nom, |
384 | CUIT: cliente.cuit, | 387 | CUIT: cliente.cuit, |
385 | MAIL: cliente.mail | 388 | MAIL: cliente.mail |
386 | }; | 389 | }; |
387 | 390 | ||
388 | $scope.$broadcast('addCabecera', { | 391 | $scope.$broadcast('addCabecera', { |
389 | label: 'Cliente:', | 392 | label: 'Cliente:', |
390 | valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' + | 393 | valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' + |
391 | clienteMayus.NOM | 394 | clienteMayus.NOM |
392 | }); | 395 | }); |
396 | |||
397 | $filter('filter')($scope.botonera, | ||
398 | { label: 'Cliente'})[0].checked = true; | ||
399 | |||
393 | $scope.cobranza.cliente = clienteMayus; | 400 | $scope.cobranza.cliente = clienteMayus; |
394 | $scope.cobranza.facturas = []; | 401 | $scope.cobranza.facturas = []; |
395 | }, function() { | 402 | }, function() { |
396 | if (APP !== 'cobranza') $scope.seleccionarCliente(); | 403 | if (APP !== 'cobranza') $scope.seleccionarCliente(); |
397 | } | 404 | } |
398 | ); | 405 | ); |
399 | }); | 406 | }); |
400 | }; | 407 | }; |
401 | 408 | ||
402 | $scope.seleccionarCobrador = function(callback) { | 409 | $scope.seleccionarCobrador = function(callback) { |
403 | 410 | ||
404 | if (APP === 'cobranza') { | 411 | if (APP === 'cobranza') { |
405 | callback(); | 412 | callback(); |
406 | return; | 413 | return; |
407 | } | 414 | } |
408 | 415 | ||
409 | var parametrosModal = { | 416 | var parametrosModal = { |
410 | query: '/cobrador', | 417 | query: '/cobrador', |
411 | columnas: [ | 418 | columnas: [ |
412 | { | 419 | { |
413 | propiedad: 'NUM', | 420 | propiedad: 'NUM', |
414 | nombre: 'Codigo', | 421 | nombre: 'Codigo', |
415 | filtro: { | 422 | filtro: { |
416 | nombre: 'rellenarDigitos', | 423 | nombre: 'rellenarDigitos', |
417 | parametro: 3 | 424 | parametro: 3 |
418 | } | 425 | } |
419 | }, | 426 | }, |
420 | { | 427 | { |
421 | propiedad: 'NOM', | 428 | propiedad: 'NOM', |
422 | nombre: 'Nombre' | 429 | nombre: 'Nombre' |
423 | } | 430 | } |
424 | ], | 431 | ], |
425 | titulo:'Búsqueda de cobradores' | 432 | titulo:'Búsqueda de cobradores' |
426 | }; | 433 | }; |
427 | focaModalService.modal(parametrosModal).then( | 434 | focaModalService.modal(parametrosModal).then( |
428 | function(cobrador) { | 435 | function(cobrador) { |
429 | $scope.$broadcast('addCabecera', { | 436 | $scope.$broadcast('addCabecera', { |
430 | label: 'Cobrador:', | 437 | label: 'Cobrador:', |
431 | valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + | 438 | valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + |
432 | cobrador.NOM | 439 | cobrador.NOM |
433 | }); | 440 | }); |
434 | $scope.cobranza.cobrador = cobrador; | 441 | $scope.cobranza.cobrador = cobrador; |
435 | 442 | ||
436 | //ELIMINO CLIENTE | 443 | //ELIMINO CLIENTE |
437 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 444 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
438 | $scope.cobranza.cliente = {}; | 445 | $scope.cobranza.cliente = {}; |
439 | 446 | ||
440 | callback(); | 447 | callback(); |
441 | }, function() {} | 448 | }, function() {} |
442 | ); | 449 | ); |
443 | }; | 450 | }; |
444 | 451 | ||
445 | $scope.seleccionarFactura = function() { | 452 | $scope.seleccionarFactura = function() { |
446 | if (!$scope.cobranza.cliente.COD) { | 453 | if (!$scope.cobranza.cliente.COD) { |
447 | focaModalService.alert('Seleccione primero un cliente'); | 454 | focaModalService.alert('Seleccione primero un cliente'); |
448 | return; | 455 | return; |
449 | } | 456 | } |
450 | var modalInstance = $uibModal.open( | 457 | var modalInstance = $uibModal.open( |
451 | { | 458 | { |
452 | ariaLabelledBy: 'Busqueda de Facturas', | 459 | ariaLabelledBy: 'Busqueda de Facturas', |
453 | templateUrl: 'foca-modal-factura.html', | 460 | templateUrl: 'foca-modal-factura.html', |
454 | controller: 'focaModalFacturaController', | 461 | controller: 'focaModalFacturaController', |
455 | size: 'lg', | 462 | size: 'lg', |
456 | resolve: { | 463 | resolve: { |
457 | parametrosFactura: function() { | 464 | parametrosFactura: function() { |
458 | return { | 465 | return { |
459 | cliente: $scope.cobranza.cliente, | 466 | cliente: $scope.cobranza.cliente, |
460 | simbolo: $scope.cobranza.moneda.SIMBOLO, | 467 | simbolo: $scope.cobranza.moneda.SIMBOLO, |
461 | cotizacion: $scope.cobranza.moneda, | 468 | cotizacion: $scope.cobranza.moneda, |
462 | moneda: $scope.cobranza.moneda.ID | 469 | moneda: $scope.cobranza.moneda.ID |
463 | }; | 470 | }; |
464 | } | 471 | } |
465 | } | 472 | } |
466 | } | 473 | } |
467 | ); | 474 | ); |
468 | modalInstance.result.then( | 475 | modalInstance.result.then( |
469 | function(facturas) { | 476 | function(facturas) { |
470 | var facturasResult = []; | 477 | var facturasResult = []; |
471 | //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS | 478 | //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS |
472 | facturas.forEach(function(factura) { | 479 | facturas.forEach(function(factura) { |
473 | var existe = $scope.cobranza.facturas.filter(function(e) { | 480 | var existe = $scope.cobranza.facturas.filter(function(e) { |
474 | return angular.equals(factura, e); | 481 | return angular.equals(factura, e); |
475 | }); | 482 | }); |
476 | 483 | ||
477 | if (!existe.length) facturasResult.push(factura); | 484 | if (!existe.length) facturasResult.push(factura); |
478 | }); | 485 | }); |
479 | 486 | ||
480 | $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult); | 487 | $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult); |
481 | }, function() { } | 488 | }, function() { } |
482 | ); | 489 | ); |
483 | }; | 490 | }; |
484 | 491 | ||
485 | $scope.seleccionarCheque = function(cheque) { | 492 | $scope.seleccionarCheque = function(cheque) { |
486 | 493 | ||
487 | var parametros; | 494 | var parametros; |
488 | 495 | ||
489 | if(!cheque) { | 496 | if(!cheque) { |
490 | parametros = { | 497 | parametros = { |
491 | importe: getSugerido(), | 498 | importe: getSugerido(), |
492 | esNuevo : true | 499 | esNuevo : true |
493 | }; | 500 | }; |
494 | } else { | 501 | } else { |
495 | parametros = cheque; | 502 | parametros = cheque; |
496 | parametros.importe = cheque.IMP; | 503 | parametros.importe = cheque.IMP; |
497 | } | 504 | } |
498 | 505 | ||
499 | var modalInstance = $uibModal.open( | 506 | var modalInstance = $uibModal.open( |
500 | { | 507 | { |
501 | ariaLabelledBy: 'Carga de cheques', | 508 | ariaLabelledBy: 'Carga de cheques', |
502 | templateUrl: 'modal-cheque.html', | 509 | templateUrl: 'modal-cheque.html', |
503 | controller: 'focaModalChequeController', | 510 | controller: 'focaModalChequeController', |
504 | size: 'lg', | 511 | size: 'lg', |
505 | resolve: { | 512 | resolve: { |
506 | cheque: function() { | 513 | cheque: function() { |
507 | return parametros; | 514 | return parametros; |
508 | } | 515 | } |
509 | } | 516 | } |
510 | } | 517 | } |
511 | ); | 518 | ); |
512 | modalInstance.result.then( | 519 | modalInstance.result.then( |
513 | function(cheque) { | 520 | function(cheque) { |
514 | var cobro = { | 521 | var cobro = { |
515 | COM: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, | 522 | COM: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, |
516 | numero: cheque.numero, | 523 | numero: cheque.numero, |
517 | banco: cheque.banco, | 524 | banco: cheque.banco, |
518 | FEC: cheque.fechaEmision.toLocaleDateString() + '-' + | 525 | FEC: cheque.fechaEmision.toLocaleDateString() + '-' + |
519 | cheque.fechaPresentacion.toLocaleDateString(), | 526 | cheque.fechaPresentacion.toLocaleDateString(), |
520 | fechaPresentacion: cheque.fechaPresentacion, | 527 | fechaPresentacion: cheque.fechaPresentacion, |
521 | fechaEmision: cheque.fechaEmision, | 528 | fechaEmision: cheque.fechaEmision, |
522 | IMP: cheque.importe, | 529 | IMP: cheque.importe, |
523 | localidad: cheque.localidad, | 530 | localidad: cheque.localidad, |
524 | librador: cheque.librador, | 531 | librador: cheque.librador, |
525 | provincia: cheque.provincia, | 532 | provincia: cheque.provincia, |
526 | observaciones: cheque.observaciones, | 533 | observaciones: cheque.observaciones, |
527 | TIL: 'EF' | 534 | TIL: 'EF' |
528 | }; | 535 | }; |
529 | pushearCobro(cobro, cheque.$$hashKey); | 536 | pushearCobro(cobro, cheque.$$hashKey); |
530 | }, function() { | 537 | }, function() { |
531 | 538 | ||
532 | } | 539 | } |
533 | ); | 540 | ); |
534 | }; | 541 | }; |
535 | 542 | ||
536 | $scope.seleccionarEfectivo = function() { | 543 | $scope.seleccionarEfectivo = function() { |
537 | 544 | ||
538 | var importe = 0; | 545 | var importe = 0; |
539 | $scope.cobranza.cobros.filter(function(a) { | 546 | $scope.cobranza.cobros.filter(function(a) { |
540 | if(a.COM === 'Efectivo') { | 547 | if(a.COM === 'Efectivo') { |
541 | importe = a.IMP; | 548 | importe = a.IMP; |
542 | } | 549 | } |
543 | }); | 550 | }); |
544 | 551 | ||
545 | var modalInstance = $uibModal.open( | 552 | var modalInstance = $uibModal.open( |
546 | { | 553 | { |
547 | ariaLabelledBy: 'Carga de cheques', | 554 | ariaLabelledBy: 'Carga de cheques', |
548 | templateUrl: 'modal-efectivo.html', | 555 | templateUrl: 'modal-efectivo.html', |
549 | controller: 'focaModalEfectivoController', | 556 | controller: 'focaModalEfectivoController', |
550 | size: 'sm', | 557 | size: 'sm', |
551 | resolve: { | 558 | resolve: { |
552 | sugerido: function() { | 559 | sugerido: function() { |
553 | return parseFloat(getSugerido()) + parseFloat(importe); | 560 | return parseFloat(getSugerido()) + parseFloat(importe); |
554 | } | 561 | } |
555 | } | 562 | } |
556 | } | 563 | } |
557 | ); | 564 | ); |
558 | modalInstance.result.then( | 565 | modalInstance.result.then( |
559 | function(efectivo) { | 566 | function(efectivo) { |
560 | 567 | ||
561 | var cobro = { | 568 | var cobro = { |
562 | COM: 'Efectivo', | 569 | COM: 'Efectivo', |
563 | FEC: new Date(), | 570 | FEC: new Date(), |
564 | IMP: efectivo, | 571 | IMP: efectivo, |
565 | TIL: 'EF' | 572 | TIL: 'EF' |
566 | }; | 573 | }; |
567 | 574 | ||
568 | $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) { | 575 | $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) { |
569 | return a.COM !== 'Efectivo'; | 576 | return a.COM !== 'Efectivo'; |
570 | }); | 577 | }); |
571 | 578 | ||
572 | $scope.cobranza.cobros.push(cobro); | 579 | $scope.cobranza.cobros.push(cobro); |
573 | }, function() { | 580 | }, function() { |
574 | 581 | ||
575 | } | 582 | } |
576 | ); | 583 | ); |
577 | }; | 584 | }; |
578 | 585 | ||
579 | $scope.seleccionarDetalles = function(detalle) { | 586 | $scope.seleccionarDetalles = function(detalle) { |
580 | 587 | ||
581 | var parametro = {}; | 588 | var parametro = {}; |
582 | 589 | ||
583 | if(!detalle) { | 590 | if(!detalle) { |
584 | parametro = { | 591 | parametro = { |
585 | importe: getSugerido(), | 592 | importe: getSugerido(), |
586 | files: [] | 593 | files: [] |
587 | }; | 594 | }; |
588 | } else { | 595 | } else { |
589 | parametro = detalle; | 596 | parametro = detalle; |
590 | parametro.importe = detalle.IMP; | 597 | parametro.importe = detalle.IMP; |
591 | parametro.files= detalle.imgs; | 598 | parametro.files= detalle.imgs; |
592 | } | 599 | } |
593 | 600 | ||
594 | var modalInstance = $uibModal.open( | 601 | var modalInstance = $uibModal.open( |
595 | { | 602 | { |
596 | ariaLabelledBy: 'Carga de detalles', | 603 | ariaLabelledBy: 'Carga de detalles', |
597 | templateUrl: 'modal-detalles.html', | 604 | templateUrl: 'modal-detalles.html', |
598 | controller: 'focaModalDetallesController', | 605 | controller: 'focaModalDetallesController', |
599 | size: 'lg', | 606 | size: 'lg', |
600 | resolve: { | 607 | resolve: { |
601 | parametros: function() { | 608 | parametros: function() { |
602 | return parametro; | 609 | return parametro; |
603 | } | 610 | } |
604 | } | 611 | } |
605 | } | 612 | } |
606 | ); | 613 | ); |
607 | modalInstance.result.then( | 614 | modalInstance.result.then( |
608 | function(detalles) { | 615 | function(detalles) { |
609 | 616 | ||
610 | var cobro = { | 617 | var cobro = { |
611 | COM: 'de(COBRO POR DETALLES)', | 618 | COM: 'de(COBRO POR DETALLES)', |
612 | FEC: new Date(), | 619 | FEC: new Date(), |
613 | IMP: detalles.importe, | 620 | IMP: detalles.importe, |
614 | imgs: detalles.files, | 621 | imgs: detalles.files, |
615 | TIL: 'DE', | 622 | TIL: 'DE', |
616 | observacion: detalles.observacion | 623 | observacion: detalles.observacion |
617 | }; | 624 | }; |
618 | pushearCobro(cobro, detalles.$$hashKey); | 625 | pushearCobro(cobro, detalles.$$hashKey); |
619 | }, function() {} | 626 | }, function() {} |
620 | ); | 627 | ); |
621 | }; | 628 | }; |
622 | 629 | ||
623 | $scope.seleccionarMoneda = function() { | 630 | $scope.seleccionarMoneda = function() { |
624 | var parametrosModal = { | 631 | var parametrosModal = { |
625 | titulo: 'Búsqueda de monedas', | 632 | titulo: 'Búsqueda de monedas', |
626 | query: '/moneda', | 633 | query: '/moneda', |
627 | columnas: [ | 634 | columnas: [ |
628 | { | 635 | { |
629 | propiedad: 'DETALLE', | 636 | propiedad: 'DETALLE', |
630 | nombre: 'Nombre' | 637 | nombre: 'Nombre' |
631 | }, | 638 | }, |
632 | { | 639 | { |
633 | propiedad: 'SIMBOLO', | 640 | propiedad: 'SIMBOLO', |
634 | nombre: 'Símbolo' | 641 | nombre: 'Símbolo' |
635 | } | 642 | } |
636 | ], | 643 | ], |
637 | size: 'md' | 644 | size: 'md' |
638 | }; | 645 | }; |
639 | focaModalService.modal(parametrosModal).then( | 646 | focaModalService.modal(parametrosModal).then( |
640 | function(moneda) { | 647 | function(moneda) { |
641 | $scope.seleccionarCotizacion(moneda); | 648 | $scope.seleccionarCotizacion(moneda); |
642 | }, function() { | 649 | }, function() { |
643 | 650 | ||
644 | } | 651 | } |
645 | ); | 652 | ); |
646 | }; | 653 | }; |
647 | 654 | ||
648 | $scope.seleccionarCotizacion = function(moneda) { | 655 | $scope.seleccionarCotizacion = function(moneda) { |
649 | var modalInstance = $uibModal.open( | 656 | var modalInstance = $uibModal.open( |
650 | { | 657 | { |
651 | ariaLabelledBy: 'Busqueda de Cotización', | 658 | ariaLabelledBy: 'Busqueda de Cotización', |
652 | templateUrl: 'modal-cotizacion.html', | 659 | templateUrl: 'modal-cotizacion.html', |
653 | controller: 'focaModalCotizacionController', | 660 | controller: 'focaModalCotizacionController', |
654 | size: 'lg', | 661 | size: 'lg', |
655 | resolve: {idMoneda: function() {return moneda.ID;}} | 662 | resolve: {idMoneda: function() {return moneda.ID;}} |
656 | } | 663 | } |
657 | ); | 664 | ); |
658 | modalInstance.result.then( | 665 | modalInstance.result.then( |
659 | function(cotizacion) { | 666 | function(cotizacion) { |
660 | $scope.cobranza.moneda = moneda; | 667 | $scope.cobranza.moneda = moneda; |
661 | $scope.cobranza.moneda.cotizacion = cotizacion; | 668 | $scope.cobranza.moneda.cotizacion = cotizacion; |
662 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { | 669 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { |
663 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 670 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
664 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 671 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
665 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 672 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
666 | } else { | 673 | } else { |
667 | $scope.$broadcast('addCabecera', { | 674 | $scope.$broadcast('addCabecera', { |
668 | label: 'Moneda:', | 675 | label: 'Moneda:', |
669 | valor: moneda.DETALLE | 676 | valor: moneda.DETALLE |
670 | }); | 677 | }); |
671 | $scope.$broadcast('addCabecera', { | 678 | $scope.$broadcast('addCabecera', { |
672 | label: 'Fecha cotizacion:', | 679 | label: 'Fecha cotizacion:', |
673 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 680 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
674 | }); | 681 | }); |
675 | $scope.$broadcast('addCabecera', { | 682 | $scope.$broadcast('addCabecera', { |
676 | label: 'Cotizacion:', | 683 | label: 'Cotizacion:', |
677 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 684 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
678 | }); | 685 | }); |
679 | } | 686 | } |
680 | 687 | ||
688 | $filter('filter')( $scope.botonera, { | ||
689 | label: 'Moneda' | ||
690 | })[0].checked = true; | ||
691 | |||
681 | }, function() { | 692 | }, function() { |
682 | 693 | ||
683 | } | 694 | } |
684 | ); | 695 | ); |
685 | }; | 696 | }; |
686 | 697 | ||
687 | $scope.getTotalDeuda = function() { | 698 | $scope.getTotalDeuda = function() { |
688 | var total = 0; | 699 | var total = 0; |
689 | for (var i = 0; i < $scope.cobranza.facturas.length; i++) { | 700 | for (var i = 0; i < $scope.cobranza.facturas.length; i++) { |
690 | total += $scope.cobranza.facturas[i].IMP || $scope.cobranza.facturas[i].IPA; | 701 | total += $scope.cobranza.facturas[i].IMP || $scope.cobranza.facturas[i].IPA; |
691 | } | 702 | } |
692 | return parseFloat(total.toFixed(2)); | 703 | return parseFloat(total.toFixed(2)); |
693 | }; | 704 | }; |
694 | 705 | ||
695 | $scope.getTotalCobrado = function() { | 706 | $scope.getTotalCobrado = function() { |
696 | var total = 0; | 707 | var total = 0; |
697 | for (var i = 0; i < $scope.cobranza.cobros.length; i++) { | 708 | for (var i = 0; i < $scope.cobranza.cobros.length; i++) { |
698 | total += $scope.cobranza.cobros[i].IMP; | 709 | total += $scope.cobranza.cobros[i].IMP; |
699 | } | 710 | } |
700 | return parseFloat(total.toFixed(2)); | 711 | return parseFloat(total.toFixed(2)); |
701 | }; | 712 | }; |
702 | 713 | ||
703 | $scope.getSubTotal = function() { | 714 | $scope.getSubTotal = function() { |
704 | if ($scope.articuloACargar) { | 715 | if ($scope.articuloACargar) { |
705 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 716 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
706 | } | 717 | } |
707 | }; | 718 | }; |
708 | //Recibe aviso si el teclado está en uso | 719 | //Recibe aviso si el teclado está en uso |
709 | // $rootScope.$on('usarTeclado', function(event, data) { | 720 | // $rootScope.$on('usarTeclado', function(event, data) { |
710 | // if(data) { | 721 | // if(data) { |
711 | // $scope.mostrarTeclado = true; | 722 | // $scope.mostrarTeclado = true; |
712 | // return; | 723 | // return; |
713 | // } | 724 | // } |
714 | // $scope.mostrarTeclado = false; | 725 | // $scope.mostrarTeclado = false; |
715 | // }) | 726 | // }) |
716 | $scope.selectFocus = function($event) { | 727 | $scope.selectFocus = function($event) { |
717 | //Si el teclado esta en uso no selecciona el valor | 728 | //Si el teclado esta en uso no selecciona el valor |
718 | // if($scope.mostrarTeclado) { | 729 | // if($scope.mostrarTeclado) { |
719 | // return; | 730 | // return; |
720 | // } | 731 | // } |
721 | $event.target.select(); | 732 | $event.target.select(); |
722 | }; | 733 | }; |
723 | 734 | ||
724 | $scope.salir = function() { | 735 | $scope.salir = function() { |
725 | $location.path('/'); | 736 | $location.path('/'); |
726 | }; | 737 | }; |
727 | 738 | ||
728 | $scope.parsearATexto = function(articulo) { | 739 | $scope.parsearATexto = function(articulo) { |
729 | articulo.cantidad = parseFloat(articulo.cantidad); | 740 | articulo.cantidad = parseFloat(articulo.cantidad); |
730 | articulo.precio = parseFloat(articulo.precio); | 741 | articulo.precio = parseFloat(articulo.precio); |
731 | }; | 742 | }; |
732 | 743 | ||
733 | $scope.quitarFactura = function(key) { | 744 | $scope.quitarFactura = function(key) { |
734 | $scope.cobranza.facturas.splice(key, 1); | 745 | $scope.cobranza.facturas.splice(key, 1); |
735 | }; | 746 | }; |
736 | 747 | ||
737 | $scope.quitarCobro = function(key) { | 748 | $scope.quitarCobro = function(key) { |
738 | $scope.cobranza.cobros.splice(key, 1); | 749 | $scope.cobranza.cobros.splice(key, 1); |
739 | }; | 750 | }; |
740 | 751 | ||
741 | $scope.editarCobro = function(cobro) { | 752 | $scope.editarCobro = function(cobro) { |
742 | if(cobro.COM === 'Efectivo') { | 753 | if(cobro.COM === 'Efectivo') { |
743 | $scope.seleccionarEfectivo(); | 754 | $scope.seleccionarEfectivo(); |
744 | } else if(cobro.COM.substring(0, 2) === 'de') { | 755 | } else if(cobro.COM.substring(0, 2) === 'de') { |
745 | $scope.seleccionarDetalles(cobro); | 756 | $scope.seleccionarDetalles(cobro); |
746 | } else if(cobro.COM.substring(0, 2) === 'ch') { | 757 | } else if(cobro.COM.substring(0, 2) === 'ch') { |
747 | $scope.seleccionarCheque(cobro); | 758 | $scope.seleccionarCheque(cobro); |
748 | } | 759 | } |
749 | }; | 760 | }; |
750 | 761 | ||
762 | $scope.$watch('cobranza.facturas', function() { | ||
763 | if ($scope.cobranza.facturas.length) { | ||
764 | $filter('filter')( $scope.botonera, { | ||
765 | label: 'Comprobantes' | ||
766 | })[0].checked = true; | ||
767 | } else { | ||
768 | $filter('filter')( $scope.botonera, { | ||
769 | label: 'Comprobantes' | ||
770 | })[0].checked = false; | ||
771 | } | ||
772 | }, true); | ||
773 | |||
774 | $scope.$watch('cobranza.cobros', function() { | ||
775 | if ($scope.cobranza.cobros.length) { | ||
776 | $filter('filter')( $scope.botonera, { | ||
777 | label: 'Cobros' | ||
778 | })[0].checked = true; | ||
779 | } else { | ||
780 | $filter('filter')( $scope.botonera, { | ||
781 | label: 'Cobros' | ||
782 | })[0].checked = false; | ||
783 | } | ||
784 | }, true); | ||
785 | |||
751 | function pushearCobro(cobro, hashKey) { | 786 | function pushearCobro(cobro, hashKey) { |
752 | var existe; | 787 | var existe; |
753 | 788 | ||
754 | $scope.cobranza.cobros.forEach(function(c, idx) { | 789 | $scope.cobranza.cobros.forEach(function(c, idx) { |
755 | if(c.$$hashKey === hashKey) { | 790 | if(c.$$hashKey === hashKey) { |
756 | $scope.cobranza.cobros[idx] = cobro; | 791 | $scope.cobranza.cobros[idx] = cobro; |
757 | existe = true; | 792 | existe = true; |
758 | } | 793 | } |
759 | }); | 794 | }); |
760 | if (!existe) { | 795 | if (!existe) { |
761 | $scope.cobranza.cobros.push(cobro); | 796 | $scope.cobranza.cobros.push(cobro); |
762 | } | 797 | } |
763 | } | 798 | } |
764 | 799 | ||
765 | function salir() { | 800 | function salir() { |
766 | var confirmacion = false; | 801 | var confirmacion = false; |
767 | 802 | ||
768 | if (!angular.equals($scope.cobranza, $scope.inicial)) { | 803 | if (!angular.equals($scope.cobranza, $scope.inicial)) { |
769 | confirmacion = true; | 804 | confirmacion = true; |
770 | } | 805 | } |
771 | 806 | ||
772 | if (confirmacion) { | 807 | if (confirmacion) { |
773 | focaModalService.confirm( | 808 | focaModalService.confirm( |
774 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 809 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
775 | ).then(function(data) { | 810 | ).then(function(data) { |
776 | if (data) { | 811 | if (data) { |
777 | $location.path('/'); | 812 | $location.path('/'); |
778 | } | 813 | } |
779 | }); | 814 | }); |
780 | } else { | 815 | } else { |
781 | $location.path('/'); | 816 | $location.path('/'); |
782 | } | 817 | } |
783 | } | 818 | } |
784 | 819 | ||
785 | function setearCobranza(cobranza) { | 820 | function setearCobranza(cobranza) { |
786 | $scope.editando = true; | 821 | $scope.editando = true; |
787 | $scope.$broadcast('cleanCabecera'); | 822 | $scope.$broadcast('cleanCabecera'); |
788 | 823 | ||
789 | if (cobranza.cliente) { | 824 | if (cobranza.cliente) { |
790 | $scope.$broadcast('addCabecera', { | 825 | $scope.$broadcast('addCabecera', { |
791 | label: 'Cliente:', | 826 | label: 'Cliente:', |
792 | valor: $filter('rellenarDigitos')(cobranza.cliente.COD, 5) + ' - ' + | 827 | valor: $filter('rellenarDigitos')(cobranza.cliente.COD, 5) + ' - ' + |
793 | cobranza.cliente.NOM | 828 | cobranza.cliente.NOM |
794 | }); | 829 | }); |
830 | |||
831 | $filter('filter')( $scope.botonera, { | ||
832 | label: 'Cliente' | ||
833 | })[0].checked = true; | ||
795 | } | 834 | } |
796 | if (cobranza.cobrador && cobranza.cobrador.NUM) { | 835 | if (cobranza.cobrador && cobranza.cobrador.NUM) { |
797 | $scope.$broadcast('addCabecera', { | 836 | $scope.$broadcast('addCabecera', { |
798 | label: 'Cobrador:', | 837 | label: 'Cobrador:', |
799 | valor: (cobranza.cobrador.NUM) ? | 838 | valor: (cobranza.cobrador.NUM) ? |
800 | $filter('rellenarDigitos')(cobranza.cobrador.NUM, 5) + ' - ' + | 839 | $filter('rellenarDigitos')(cobranza.cobrador.NUM, 5) + ' - ' + |
801 | cobranza.cobrador.NOM : cobranza.cobrador | 840 | cobranza.cobrador.NOM : cobranza.cobrador |
802 | 841 | ||
803 | }); | 842 | }); |
804 | } | 843 | } |
805 | 844 | ||
845 | // TODO: Setear moneda | ||
846 | if (cobranza.moneda) { | ||
847 | $filter('filter')( $scope.botonera, { | ||
848 | label: 'Moneda' | ||
849 | })[0].checked = true; | ||
850 | } | ||
851 | |||
806 | $scope.cobranza = cobranza; | 852 | $scope.cobranza = cobranza; |
807 | } | 853 | } |
808 | 854 | ||
809 | function getLSCobranza() { | 855 | function getLSCobranza() { |
810 | var cobranza = JSON.parse($localStorage.cobranza || null); | 856 | var cobranza = JSON.parse($localStorage.cobranza || null); |
811 | if (cobranza) { | 857 | if (cobranza) { |
812 | setearCobranza(cobranza); | 858 | setearCobranza(cobranza); |
813 | delete $localStorage.cobranza; | 859 | delete $localStorage.cobranza; |
814 | } | 860 | } |
815 | } | 861 | } |
816 | 862 | ||
817 | function enviarMail(recibo) { | 863 | function enviarMail(recibo) { |
818 | focaModalService.mail( | 864 | focaModalService.mail( |
819 | { | 865 | { |
820 | titulo: 'Enviar recibo', | 866 | titulo: 'Enviar recibo', |
821 | descarga: { | 867 | descarga: { |
822 | nombre: recibo.recibo.PVE + '-' + recibo.recibo.NCO + '.pdf', | 868 | nombre: recibo.recibo.PVE + '-' + recibo.recibo.NCO + '.pdf', |
823 | url: '/mail/recibo/descargar', | 869 | url: '/mail/recibo/descargar', |
824 | }, | 870 | }, |
825 | envio: { | 871 | envio: { |
826 | mailCliente: recibo.cliente.MAIL, | 872 | mailCliente: recibo.cliente.MAIL, |
827 | url: '/mail/recibo', | 873 | url: '/mail/recibo', |
828 | }, | 874 | }, |
829 | options: { | 875 | options: { |
830 | recibo: recibo | 876 | recibo: recibo |
831 | } | 877 | } |
832 | } | 878 | } |
833 | ); | 879 | ); |
834 | } | 880 | } |
835 | 881 | ||
836 | function getSugerido() { | 882 | function getSugerido() { |
837 | var result; | 883 | var result; |
838 | 884 | ||
839 | var valor = $scope.getTotalDeuda() + $scope.getTotalCobrado(); | 885 | var valor = $scope.getTotalDeuda() + $scope.getTotalCobrado(); |
840 | 886 | ||
841 | if (valor < 0) { | 887 | if (valor < 0) { |
842 | result = Math.abs(valor).toFixed(4); | 888 | result = Math.abs(valor).toFixed(4); |
843 | } | 889 | } |
844 | 890 | ||
845 | return result; | 891 | return result; |
846 | } | 892 | } |
847 | } | 893 | } |
848 | ]); | 894 | ]); |
src/js/service.js
1 | angular.module('focaCrearCobranza') | 1 | angular.module('focaCrearCobranza') |
2 | .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', | 2 | .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | 3 | function($http, API_ENDPOINT) { |
4 | return { | 4 | return { |
5 | getNumeroRecibo: function() { | 5 | getNumeroRecibo: function() { |
6 | return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente'); | 6 | return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente'); |
7 | }, | 7 | }, |
8 | getCotizacionByIdMoneda: function(id) { | 8 | getCotizacionByIdMoneda: function(id) { |
9 | return $http.get(API_ENDPOINT.URL + '/moneda/' + id); | 9 | return $http.get(API_ENDPOINT.URL + '/moneda/' + id); |
10 | }, | 10 | }, |
11 | guardarCobranza: function(cobranza) { | 11 | guardarCobranza: function(cobranza) { |
12 | return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza); | 12 | return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza); |
13 | }, | 13 | }, |
14 | getCobradorById: function(id) { | 14 | getCobradorById: function(id) { |
15 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); | 15 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); |
16 | }, | 16 | }, |
17 | actualizarEmail: function(mail, idCliente) { | 17 | actualizarEmail: function(mail, idCliente) { |
18 | return $http.post(API_ENDPOINT.URL + '/cliente/update/email', | 18 | return $http.post(API_ENDPOINT.URL + '/cliente/update/email', |
19 | {mail: mail, id: idCliente}); | 19 | {mail: mail, id: idCliente}); |
20 | }, | 20 | }, |
21 | getBotonera: function() { | 21 | getBotonera: function() { |
22 | var result = [ | 22 | var result = [ |
23 | { | 23 | { |
24 | label: 'Cliente', | 24 | label: 'Cliente', |
25 | image: 'cliente.png' | 25 | image: 'cliente.png' |
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | label: 'Comprobantes', | 28 | label: 'Comprobantes', |
29 | image: 'comprobante.png' | 29 | image: 'comprobante.png' |
30 | }, | 30 | }, |
31 | { | 31 | { |
32 | label: 'Cobros', | 32 | label: 'Cobros', |
33 | image: 'cobros.png' | 33 | image: 'cobros.png' |
34 | }, | 34 | }, |
35 | { | 35 | { |
36 | label: 'Moneda', | 36 | label: 'Moneda', |
37 | image: 'moneda.png' | 37 | image: 'moneda.png' |
38 | }, | 38 | }, |
39 | { | 39 | { |
40 | label: 'Resumen de cuenta', | 40 | label: 'Resumen de cuenta', |
41 | image: 'moneda.png' | 41 | image: 'resumen.png' |
42 | } | 42 | } |
43 | ]; | 43 | ]; |
44 | return result; | 44 | return result; |
45 | } | 45 | } |
46 | }; | 46 | }; |
47 | }]); | 47 | }]); |
48 | 48 |
src/views/cobranza.html
1 | <div class="crear-nota-pedido foca-crear 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="cobranza.FEC" | 5 | fecha="cobranza.FEC" |
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 py-2 botonera-secundaria"> |
13 | <div class="col-12"> | 13 | <div class="col-12 foca-facturador-px"> |
14 | <foca-botonera-facturador botones="botonera" extra="7" 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 cobranza.facturas" | 49 | ng-repeat="(key, factura) in cobranza.facturas" |
50 | class="d-flex" | 50 | class="d-flex" |
51 | ng-show="show || key == cobranza.facturas.length - 1" | 51 | ng-show="show || key == cobranza.facturas.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.COM || factura.numeroFactura" | 54 | <td class="col" ng-bind="factura.COM || factura.numeroFactura" |
55 | ></td> | 55 | ></td> |
56 | <td class="col" ng-bind="factura.FEC || factura.FEP | date : 'dd/MM/yyyy'"></td> | 56 | <td class="col" ng-bind="factura.FEC || factura.FEP | date : 'dd/MM/yyyy'"></td> |
57 | <td | 57 | <td |
58 | class="col" | 58 | class="col" |
59 | ng-bind="((factura.IMP ||factura.IPA) / cobranza.moneda.cotizacion.VENDEDOR) | | 59 | ng-bind="((factura.IMP ||factura.IPA) / cobranza.moneda.cotizacion.VENDEDOR) | |
60 | number: 4"></td> | 60 | number: 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="cobranza.facturas.length"></a> | 83 | <a ng-bind="cobranza.facturas.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.moneda.cotizacion.VENDEDOR) | | 89 | <strong>{{(getTotalDeuda() / cobranza.moneda.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.moneda.cotizacion.VENDEDOR) | | 96 | <strong>{{(getTotalCobrado() / cobranza.moneda.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.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 104 | cobranza.moneda.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 cobranza.cobros" | 142 | ng-repeat="(key, cobro) in cobranza.cobros" |
143 | class="d-flex" | 143 | class="d-flex" |
144 | ng-show="show || key == cobranza.cobros.length - 1" | 144 | ng-show="show || key == cobranza.cobros.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.COM"></td> | 147 | <td class="col" ng-bind="cobro.COM"></td> |
148 | <td class="col" ng-bind="cobro.FEC | date : 'dd/MM/yyyy'"></td> | 148 | <td class="col" ng-bind="cobro.FEC | date : 'dd/MM/yyyy'"></td> |
149 | <td | 149 | <td |
150 | class="col" | 150 | class="col" |
151 | ng-bind="(cobro.IMP / cobranza.moneda.cotizacion.VENDEDOR) | | 151 | ng-bind="(cobro.IMP / cobranza.moneda.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 | ng-disabled="cobranza.id" | 155 | ng-disabled="cobranza.id" |
156 | class="btn btn-outline-light" | 156 | class="btn btn-outline-light" |
157 | ng-click="editarCobro(cobro)" | 157 | ng-click="editarCobro(cobro)" |
158 | > | 158 | > |
159 | <i class="fa fa-edit"></i> | 159 | <i class="fa fa-edit"></i> |
160 | </button> | 160 | </button> |
161 | <button | 161 | <button |
162 | class="btn btn-outline-light" | 162 | class="btn btn-outline-light" |
163 | ng-click="quitarCobro(key)" | 163 | ng-click="quitarCobro(key)" |
164 | > | 164 | > |
165 | <i class="fa fa-trash"></i> | 165 | <i class="fa fa-trash"></i> |
166 | </button> | 166 | </button> |
167 | </td> | 167 | </td> |
168 | </tr> | 168 | </tr> |
169 | </tbody> | 169 | </tbody> |
170 | <tfoot> | 170 | <tfoot> |
171 | <tr ng-show="cargando" class="d-flex"> | 171 | <tr ng-show="cargando" class="d-flex"> |
172 | <td class="col-2 border-top-0"> | 172 | <td class="col-2 border-top-0"> |
173 | <a | 173 | <a |
174 | class="form-control form-control-sm btn btn-secondary" | 174 | class="form-control form-control-sm btn btn-secondary" |
175 | ng-click="seleccionarCheque()" | 175 | ng-click="seleccionarCheque()" |
176 | >Cheque</a> | 176 | >Cheque</a> |
177 | </td> | 177 | </td> |
178 | <td class="col-2 border-top-0"> | 178 | <td class="col-2 border-top-0"> |
179 | <a | 179 | <a |
180 | class="form-control form-control-sm btn btn-secondary" | 180 | class="form-control form-control-sm btn btn-secondary" |
181 | ng-click="seleccionarEfectivo()" | 181 | ng-click="seleccionarEfectivo()" |
182 | >Efectivo</a> | 182 | >Efectivo</a> |
183 | </td> | 183 | </td> |
184 | <td class="col-2 border-top-0"> | 184 | <td class="col-2 border-top-0"> |
185 | <a | 185 | <a |
186 | class="form-control form-control-sm btn btn-secondary" | 186 | class="form-control form-control-sm btn btn-secondary" |
187 | ng-click="seleccionarDetalles()" | 187 | ng-click="seleccionarDetalles()" |
188 | >Detalle</a> | 188 | >Detalle</a> |
189 | </td> | 189 | </td> |
190 | </tr> | 190 | </tr> |
191 | <tr class="d-flex"> | 191 | <tr class="d-flex"> |
192 | <td class="col-auto px-1 border-top-0"> | 192 | <td class="col-auto px-1 border-top-0"> |
193 | <strong>Cobros:</strong> | 193 | <strong>Cobros:</strong> |
194 | <a ng-bind="cobranza.cobros.length"></a> | 194 | <a ng-bind="cobranza.cobros.length"></a> |
195 | </td> | 195 | </td> |
196 | <td class="text-right ml-auto table-celda-total no-border-top"> | 196 | <td class="text-right ml-auto table-celda-total no-border-top"> |
197 | <strong>Cancela:</strong> | 197 | <strong>Cancela:</strong> |
198 | </td> | 198 | </td> |
199 | <td class="table-celda-total text-right no-border-top"> | 199 | <td class="table-celda-total text-right no-border-top"> |
200 | <strong>{{(getTotalDeuda() / cobranza.moneda.cotizacion.VENDEDOR) | | 200 | <strong>{{(getTotalDeuda() / cobranza.moneda.cotizacion.VENDEDOR) | |
201 | currency: cobranza.moneda.SIMBOLO}}</strong> | 201 | currency: cobranza.moneda.SIMBOLO}}</strong> |
202 | </td> | 202 | </td> |
203 | <td class="text-right ml-auto table-celda-total no-border-top"> | 203 | <td class="text-right ml-auto table-celda-total no-border-top"> |
204 | <strong>Total Cobrado:</strong> | 204 | <strong>Total Cobrado:</strong> |
205 | </td> | 205 | </td> |
206 | <td class="table-celda-total text-right no-border-top"> | 206 | <td class="table-celda-total text-right no-border-top"> |
207 | <strong>{{(getTotalCobrado() / cobranza.moneda.cotizacion.VENDEDOR) | | 207 | <strong>{{(getTotalCobrado() / cobranza.moneda.cotizacion.VENDEDOR) | |
208 | currency: cobranza.moneda.SIMBOLO}}</strong> | 208 | currency: cobranza.moneda.SIMBOLO}}</strong> |
209 | </td> | 209 | </td> |
210 | <td class="text-right ml-auto table-celda-total no-border-top"> | 210 | <td class="text-right ml-auto table-celda-total no-border-top"> |
211 | <strong>DF:</strong> | 211 | <strong>DF:</strong> |
212 | </td> | 212 | </td> |
213 | <td class="table-celda-total text-right no-border-top mr-1"> | 213 | <td class="table-celda-total text-right no-border-top mr-1"> |
214 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / | 214 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / |
215 | cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} | 215 | cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} |
216 | </strong> | 216 | </strong> |
217 | </td> | 217 | </td> |
218 | </tr> | 218 | </tr> |
219 | </tfoot> | 219 | </tfoot> |
220 | </table> | 220 | </table> |
221 | </div> | 221 | </div> |
222 | <!-- MOBILE --> | 222 | <!-- MOBILE --> |
223 | <div class="row d-sm-none mb-5"> | 223 | <div class="row d-sm-none mb-5"> |
224 | <!-- FACTURAS --> | 224 | <!-- FACTURAS --> |
225 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> | 225 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> |
226 | <thead> | 226 | <thead> |
227 | <tr class="d-flex"> | 227 | <tr class="d-flex"> |
228 | <th class="">#</th> | 228 | <th class="">#</th> |
229 | <th class="col px-0"> | 229 | <th class="col px-0"> |
230 | <div class="d-flex"> | 230 | <div class="d-flex"> |
231 | <div class="col-4 px-1">Factura</div> | 231 | <div class="col-4 px-1">Factura</div> |
232 | <div class="col-4 px-1">Fecha</div> | 232 | <div class="col-4 px-1">Fecha</div> |
233 | <div class="col-4 px-1">Importe</div> | 233 | <div class="col-4 px-1">Importe</div> |
234 | </div> | 234 | </div> |
235 | </th> | 235 | </th> |
236 | <th class="text-center tamaño-boton"> | 236 | <th class="text-center tamaño-boton"> |
237 | | 237 | |
238 | </th> | 238 | </th> |
239 | </tr> | 239 | </tr> |
240 | </thead> | 240 | </thead> |
241 | <tbody> | 241 | <tbody> |
242 | <tr | 242 | <tr |
243 | ng-repeat="(key, factura) in cobranza.facturas" | 243 | ng-repeat="(key, factura) in cobranza.facturas" |
244 | ng-show="show || key == cobranza.facturas.length - 1" | 244 | ng-show="show || key == cobranza.facturas.length - 1" |
245 | > | 245 | > |
246 | <td class="w-100 align-middle d-flex p-0"> | 246 | <td class="w-100 align-middle d-flex p-0"> |
247 | <div class="align-middle p-1"> | 247 | <div class="align-middle p-1"> |
248 | <span ng-bind="key+1" class="align-middle"></span> | 248 | <span ng-bind="key+1" class="align-middle"></span> |
249 | </div> | 249 | </div> |
250 | <div class="col px-0"> | 250 | <div class="col px-0"> |
251 | <div class="d-flex"> | 251 | <div class="d-flex"> |
252 | <div class="col-4 p-1"> | 252 | <div class="col-4 p-1"> |
253 | <span ng-bind="factura.numeroFactura" | 253 | <span ng-bind="factura.numeroFactura" |
254 | ></span> | 254 | ></span> |
255 | </div> | 255 | </div> |
256 | <div class="col-4 p-1"> | 256 | <div class="col-4 p-1"> |
257 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> | 257 | <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> |
258 | </div> | 258 | </div> |
259 | <div class="col-4 p-1"> | 259 | <div class="col-4 p-1"> |
260 | <span | 260 | <span |
261 | ng-bind="(factura.IPA / cobranza.moneda.cotizacion.VENDEDOR) | | 261 | ng-bind="(factura.IPA / cobranza.moneda.cotizacion.VENDEDOR) | |
262 | currency: cobranza.moneda.SIMBOLO : 4"></span> | 262 | currency: cobranza.moneda.SIMBOLO : 4"></span> |
263 | </div> | 263 | </div> |
264 | </div> | 264 | </div> |
265 | </div> | 265 | </div> |
266 | <div class="align-middle p-1"> | 266 | <div class="align-middle p-1"> |
267 | <button | 267 | <button |
268 | class="btn btn-outline-light" | 268 | class="btn btn-outline-light" |
269 | ng-click="quitarFactura(key)" | 269 | ng-click="quitarFactura(key)" |
270 | > | 270 | > |
271 | <i class="fa fa-trash"></i> | 271 | <i class="fa fa-trash"></i> |
272 | </button> | 272 | </button> |
273 | </div> | 273 | </div> |
274 | </td> | 274 | </td> |
275 | </tr> | 275 | </tr> |
276 | </tbody> | 276 | </tbody> |
277 | <tfoot> | 277 | <tfoot> |
278 | <!-- SELECCIONAR PRODUCTO --> | 278 | <!-- SELECCIONAR PRODUCTO --> |
279 | <tr ng-show="cargando" class="d-flex"> | 279 | <tr ng-show="cargando" class="d-flex"> |
280 | <td class="col-12"> | 280 | <td class="col-12"> |
281 | <input | 281 | <input |
282 | placeholder="Seleccione Factura" | 282 | placeholder="Seleccione Factura" |
283 | class="form-control form-control-sm" | 283 | class="form-control form-control-sm" |
284 | readonly | 284 | readonly |
285 | ng-click="seleccionarFactura()" | 285 | ng-click="seleccionarFactura()" |
286 | /> | 286 | /> |
287 | </td> | 287 | </td> |
288 | </tr> | 288 | </tr> |
289 | <!-- TOOGLE EXPANDIR --> | 289 | <!-- TOOGLE EXPANDIR --> |
290 | <tr> | 290 | <tr> |
291 | <td class="col"> | 291 | <td class="col"> |
292 | <button | 292 | <button |
293 | class="btn btn-outline-light selectable w-100" | 293 | class="btn btn-outline-light selectable w-100" |
294 | ng-click="show = !show; masMenos()" | 294 | ng-click="show = !show; masMenos()" |
295 | ng-show="cobranza.facturas.length > 0" | 295 | ng-show="cobranza.facturas.length > 0" |
296 | > | 296 | > |
297 | <i | 297 | <i |
298 | class="fa fa-chevron-down" | 298 | class="fa fa-chevron-down" |
299 | ng-hide="show" | 299 | ng-hide="show" |
300 | aria-hidden="true" | 300 | aria-hidden="true" |
301 | > | 301 | > |
302 | </i> | 302 | </i> |
303 | <i | 303 | <i |
304 | class="fa fa-chevron-up" | 304 | class="fa fa-chevron-up" |
305 | ng-show="show" | 305 | ng-show="show" |
306 | aria-hidden="true"> | 306 | aria-hidden="true"> |
307 | </i> | 307 | </i> |
308 | </button> | 308 | </button> |
309 | </td> | 309 | </td> |
310 | </tr> | 310 | </tr> |
311 | <!-- FOOTER --> | 311 | <!-- FOOTER --> |
312 | <tr class="d-flex"> | 312 | <tr class="d-flex"> |
313 | <td class="align-middle no-border-top" colspan="2"> | 313 | <td class="align-middle no-border-top" colspan="2"> |
314 | <strong>Cantidad Items:</strong> | 314 | <strong>Cantidad Items:</strong> |
315 | <a ng-bind="cobranza.facturas.length"></a> | 315 | <a ng-bind="cobranza.facturas.length"></a> |
316 | </td> | 316 | </td> |
317 | </tr> | 317 | </tr> |
318 | </tfoot> | 318 | </tfoot> |
319 | </table> | 319 | </table> |
320 | <!-- COBROS --> | 320 | <!-- COBROS --> |
321 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> | 321 | <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> |
322 | <thead> | 322 | <thead> |
323 | <tr class="d-flex"> | 323 | <tr class="d-flex"> |
324 | <th class="">#</th> | 324 | <th class="">#</th> |
325 | <th class="col px-0"> | 325 | <th class="col px-0"> |
326 | <div class="d-flex"> | 326 | <div class="d-flex"> |
327 | <div class="col-4 px-1">Cobro</div> | 327 | <div class="col-4 px-1">Cobro</div> |
328 | <div class="col-4 px-1">Fecha</div> | 328 | <div class="col-4 px-1">Fecha</div> |
329 | <div class="col-4 px-1">Importe</div> | 329 | <div class="col-4 px-1">Importe</div> |
330 | </div> | 330 | </div> |
331 | </th> | 331 | </th> |
332 | <th class="text-center tamaño-boton"> | 332 | <th class="text-center tamaño-boton"> |
333 | | 333 | |
334 | </th> | 334 | </th> |
335 | </tr> | 335 | </tr> |
336 | </thead> | 336 | </thead> |
337 | <tbody> | 337 | <tbody> |
338 | <tr | 338 | <tr |
339 | ng-repeat="(key, cobro) in cobranza.cobros" | 339 | ng-repeat="(key, cobro) in cobranza.cobros" |
340 | ng-show="show || key == cobranza.cobros.length - 1" | 340 | ng-show="show || key == cobranza.cobros.length - 1" |
341 | > | 341 | > |
342 | <td class="w-100 align-middle d-flex p-0"> | 342 | <td class="w-100 align-middle d-flex p-0"> |
343 | <div class="align-middle p-1"> | 343 | <div class="align-middle p-1"> |
344 | <span ng-bind="key+1" class="align-middle"></span> | 344 | <span ng-bind="key+1" class="align-middle"></span> |
345 | </div> | 345 | </div> |
346 | <div class="col px-0"> | 346 | <div class="col px-0"> |
347 | <div class="d-flex"> | 347 | <div class="d-flex"> |
348 | <div class="col-4 p-1"> | 348 | <div class="col-4 p-1"> |
349 | <span ng-bind="cobro.COM" | 349 | <span ng-bind="cobro.COM" |
350 | ></span> | 350 | ></span> |
351 | </div> | 351 | </div> |
352 | <div class="col-4 p-1"> | 352 | <div class="col-4 p-1"> |
353 | <span ng-bind="cobro.FEC | date : 'dd/MM/yyyy'"></span> | 353 | <span ng-bind="cobro.FEC | date : 'dd/MM/yyyy'"></span> |
354 | </div> | 354 | </div> |
355 | <div class="col-4 p-1"> | 355 | <div class="col-4 p-1"> |
356 | <span | 356 | <span |
357 | ng-bind="(cobro.IMP / cobranza.moneda.cotizacion.VENDEDOR) | | 357 | ng-bind="(cobro.IMP / cobranza.moneda.cotizacion.VENDEDOR) | |
358 | currency: cobranza.moneda.SIMBOLO : 4"></span> | 358 | currency: cobranza.moneda.SIMBOLO : 4"></span> |
359 | </div> | 359 | </div> |
360 | </div> | 360 | </div> |
361 | </div> | 361 | </div> |
362 | <div class="col-2 align-middle p-1"> | 362 | <div class="col-2 align-middle p-1"> |
363 | <button | 363 | <button |
364 | ng-disabled="cobranza.id" | 364 | ng-disabled="cobranza.id" |
365 | class="btn btn-outline-light" | 365 | class="btn btn-outline-light" |
366 | ng-click="editarCobro(cobro)" | 366 | ng-click="editarCobro(cobro)" |
367 | > | 367 | > |
368 | <i class="fa fa-edit"></i> | 368 | <i class="fa fa-edit"></i> |
369 | </button> | 369 | </button> |
370 | <button | 370 | <button |
371 | class="btn btn-outline-light" | 371 | class="btn btn-outline-light" |
372 | ng-click="quitarCobro(key)" | 372 | ng-click="quitarCobro(key)" |
373 | > | 373 | > |
374 | <i class="fa fa-trash"></i> | 374 | <i class="fa fa-trash"></i> |
375 | </button> | 375 | </button> |
376 | </div> | 376 | </div> |
377 | </td> | 377 | </td> |
378 | </tr> | 378 | </tr> |
379 | </tbody> | 379 | </tbody> |
380 | <tfoot> | 380 | <tfoot> |
381 | <!-- SELECCIONAR PRODUCTO --> | 381 | <!-- SELECCIONAR PRODUCTO --> |
382 | <tr ng-show="cargando" class="d-flex"> | 382 | <tr ng-show="cargando" class="d-flex"> |
383 | <td class="col-4"> | 383 | <td class="col-4"> |
384 | <input | 384 | <input |
385 | placeholder="Cheque" | 385 | placeholder="Cheque" |
386 | class="form-control form-control-sm" | 386 | class="form-control form-control-sm" |
387 | readonly | 387 | readonly |
388 | ng-click="seleccionarCheque()" | 388 | ng-click="seleccionarCheque()" |
389 | /> | 389 | /> |
390 | </td> | 390 | </td> |
391 | <td class="col-4"> | 391 | <td class="col-4"> |
392 | <input | 392 | <input |
393 | placeholder="Efectivo" | 393 | placeholder="Efectivo" |
394 | class="form-control form-control-sm" | 394 | class="form-control form-control-sm" |
395 | readonly | 395 | readonly |
396 | ng-click="seleccionarEfectivo()" | 396 | ng-click="seleccionarEfectivo()" |
397 | /> | 397 | /> |
398 | </td> | 398 | </td> |
399 | <td class="col-4"> | 399 | <td class="col-4"> |
400 | <input | 400 | <input |
401 | placeholder="Detalles" | 401 | placeholder="Detalles" |
402 | class="form-control form-control-sm" | 402 | class="form-control form-control-sm" |
403 | readonly | 403 | readonly |
404 | ng-click="seleccionarDetalles()" | 404 | ng-click="seleccionarDetalles()" |
405 | /> | 405 | /> |
406 | </td> | 406 | </td> |
407 | </tr> | 407 | </tr> |
408 | <!-- TOOGLE EXPANDIR --> | 408 | <!-- TOOGLE EXPANDIR --> |
409 | <tr> | 409 | <tr> |
410 | <td class="col"> | 410 | <td class="col"> |
411 | <button | 411 | <button |
412 | class="btn btn-outline-light selectable w-100" | 412 | class="btn btn-outline-light selectable w-100" |
413 | ng-click="show = !show; masMenos()" | 413 | ng-click="show = !show; masMenos()" |
414 | ng-show="cobranza.cobros.length > 0" | 414 | ng-show="cobranza.cobros.length > 0" |
415 | > | 415 | > |
416 | <i | 416 | <i |
417 | class="fa fa-chevron-down" | 417 | class="fa fa-chevron-down" |
418 | ng-hide="show" | 418 | ng-hide="show" |
419 | aria-hidden="true" | 419 | aria-hidden="true" |
420 | > | 420 | > |
421 | </i> | 421 | </i> |
422 | <i | 422 | <i |
423 | class="fa fa-chevron-up" | 423 | class="fa fa-chevron-up" |
424 | ng-show="show" | 424 | ng-show="show" |
425 | aria-hidden="true"> | 425 | aria-hidden="true"> |
426 | </i> | 426 | </i> |
427 | </button> | 427 | </button> |
428 | </td> | 428 | </td> |
429 | </tr> | 429 | </tr> |
430 | <!-- FOOTER --> | 430 | <!-- FOOTER --> |
431 | <tr class="d-flex"> | 431 | <tr class="d-flex"> |
432 | <td class="align-middle no-border-top col-6"> | 432 | <td class="align-middle no-border-top col-6"> |
433 | <strong>Cantidad Items:</strong> | 433 | <strong>Cantidad Items:</strong> |
434 | <a ng-bind="cobranza.cobros.length"></a> | 434 | <a ng-bind="cobranza.cobros.length"></a> |
435 | </td> | 435 | </td> |
436 | </tfoot> | 436 | </tfoot> |
437 | </table> | 437 | </table> |
438 | </tr> | 438 | </tr> |
439 | <!-- DEUDA, COBRADO, DIFERENCIA --> | 439 | <!-- DEUDA, COBRADO, DIFERENCIA --> |
440 | <table class="table-responsive fixed-bottom mb-5"> | 440 | <table class="table-responsive fixed-bottom mb-5"> |
441 | <tr class="d-flex row"> | 441 | <tr class="d-flex row"> |
442 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 442 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
443 | <strong>Cancela:</strong> | 443 | <strong>Cancela:</strong> |
444 | </td> | 444 | </td> |
445 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 445 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
446 | <strong>Cobrado:</strong> | 446 | <strong>Cobrado:</strong> |
447 | </td> | 447 | </td> |
448 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> | 448 | <td class="text-center ml-auto table-celda-total no-border-top col-4"> |
449 | <strong>Diferencia:</strong> | 449 | <strong>Diferencia:</strong> |
450 | </td> | 450 | </td> |
451 | <td class="table-celda-total text-center no-border-top col-4"> | 451 | <td class="table-celda-total text-center no-border-top col-4"> |
452 | <strong>{{(getTotalDeuda() / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 452 | <strong>{{(getTotalDeuda() / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
453 | </td> | 453 | </td> |
454 | <td class="table-celda-total text-center no-border-top col-4"> | 454 | <td class="table-celda-total text-center no-border-top col-4"> |
455 | <strong>{{(getTotalCobrado() / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 455 | <strong>{{(getTotalCobrado() / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
456 | </td> | 456 | </td> |
457 | <td class="table-celda-total text-center no-border-top col-4"> | 457 | <td class="table-celda-total text-center no-border-top col-4"> |
458 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> | 458 | <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.moneda.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> |
459 | </td> | 459 | </td> |
460 | </tr> | 460 | </tr> |
461 | </table> | 461 | </table> |
462 | </div> | 462 | </div> |
463 | </div> | 463 | </div> |
464 | </div> | 464 | </div> |
465 | </div> | 465 | </div> |
466 | <div class="row d-md-none fixed-bottom"> | 466 | <div class="row d-md-none fixed-bottom"> |
467 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 467 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
468 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 468 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
469 | <span | 469 | <span |
470 | class="mr-3 ml-auto" | 470 | class="mr-3 ml-auto" |
471 | ng-class="saveLoading ? 'text-muted' : ''" | 471 | ng-class="saveLoading ? 'text-muted' : ''" |
472 | ng-click="crearCobranza()" | 472 | ng-click="crearCobranza()" |
473 | ng-show="!editando" | 473 | ng-show="!editando" |
474 | ladda="saveLoading" | 474 | ladda="saveLoading" |
475 | data-style="expand-left" | 475 | data-style="expand-left" |
476 | >Guardar</span> | 476 | >Guardar</span> |
477 | </div> | 477 | </div> |
478 | </div> | 478 | </div> |
479 | </div> | 479 | </div> |
480 | 480 |