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