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