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