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