$UltimaOperacion = $cT->cFecha($datos[9]); $ContratoCorriente = $cT->cInt($datos[10]); if ($socio == 0) { $msg .= "{$iReg}\t\tERROR\tLa Linea({$iReg}) no se leyo({$bufer})\r\n"; } else { $xCred = new cCredito(); //Crear Contrato corriente si el producto tiene ahorro $DConv = $xCred->getDatosDeProducto($producto); $tasaAhorro = $cT->cFloat($DConv["tasa_ahorro"]); if ($ContratoCorriente == 0 and $tasaAhorro > 0) { $xCapta = new cCuentaALaVista(false); $ContratoCorriente = $xCapta->setNuevaCuenta(99, DEFAULT_SUBPRODUCTO_CAPTACION, $socio, "CUENTA POR IMPORTACION", $credito); $msg .= "{$iReg}\t{$socio}\t{$credito}\tAgregando una Cuenta Corriente {$ContratoCorriente} NUEVO\r\n"; } //Agregar $ok = $xCred->add($producto, $socio, $ContratoCorriente, $monto, $periocidad, $pagos, 0, CREDITO_DEFAULT_DESTINO, $credito, DEFAULT_GRUPO, "", "CREDITO IMPORTADO #{$iReg}", DEFAULT_USER, $ministracion); if ($ok == true) { ///Inicializar //autorizar $xCred->setAutorizado($monto, $pagos, $periocidad, CREDITO_TIPO_AUTORIZACION_AUTOMATICA, $ministracion, "CREDITO IMPORTADO #{$iReg}", false, $ministracion, 2, false, $vencimiento, CREDITO_ESTADO_AUTORIZADO, $monto, 0, $UltimaOperacion); $xCred->init(); //ministrar $xCred->setForceMinistracion(); $xCred->setMinistrar(DEFAULT_RECIBO_FISCAL, DEFAULT_CHEQUE, $monto, DEFAULT_CUENTA_BANCARIA, 0, DEFAULT_CUENTA_BANCARIA, "CREDITO IMPORTADO #{$iReg}", $ministracion); if ($monto > $saldo) { $abono = $monto - $saldo; $msg .= "{$iReg}\t{$socio}\t{$credito}\tAgregando un Abono por {$abono} por el Saldo {$saldo} del Monto {$monto}\r\n"; $xCred->setAbonoCapital($abono, 1, DEFAULT_CHEQUE, DEFAULT_RECIBO_FISCAL, "CREDITO IMPORTADO #{$iReg}", DEFAULT_GRUPO, $UltimaOperacion); } } else { $msg .= "{$iReg}\t{$socio}\t{$credito}\tEL Credito no se pudo agregar\r\n";
my_query($sqls); $xCred = new cCredito(); $xConv = new cProductoDeCredito($producto); $xConv->init(); //Crear Contrato corriente si el producto tiene ahorro $DConv = $xCred->getDatosDeProducto($producto); $tasaAhorro = $xConv->getTasaDeAhorro(); // $cT->cFloat( $DConv["tasa_ahorro"] ); if ($ContratoCorriente == 0 and $tasaAhorro > 0) { /*$xCapta = new cCuentaALaVista(false); $ContratoCorriente = $xCapta->setNuevaCuenta(99, DEFAULT_SUBPRODUCTO_CAPTACION, $socio, "CUENTA POR IMPORTACION", $credito); $msg .= "$iReg\t$socio\t$credito\tAgregando una Cuenta Corriente $ContratoCorriente NUEVO\r\n";*/ } //Agregar $msg .= "{$iReg}\t{$socio}\t{$credito}\t-----------------------------------------\r\n"; $ok = $xCred->add($producto, $socio, $ContratoCorriente, $monto, $periocidad, $pagos, $dias, $aplicacion, $credito, DEFAULT_GRUPO, $descDestino, "CREDITO IMPORTADO #{$iReg}", DEFAULT_USER, $fechaSolicitado, CREDITO_TIPO_PAGO_PERIODICO, INTERES_POR_SALDO_INSOLUTO, $tasa); if ($ok == true) { ///Inicializar //autorizar $xCred->setAutorizado($monto, $pagos, $periocidad, CREDITO_TIPO_AUTORIZACION_AUTOMATICA, $ministracion, "CREDITO IMPORTADO #{$iReg}", false, $ministracion, 2, false, $vencimiento, CREDITO_ESTADO_AUTORIZADO, $monto, 0, $UltimaOperacion); $xCred->init(); //ministrar $xCred->setForceMinistracion(); $xCred->setMinistrar(DEFAULT_RECIBO_FISCAL, DEFAULT_CHEQUE, $monto, DEFAULT_CUENTA_BANCARIA, 0, DEFAULT_CUENTA_BANCARIA, "CREDITO IMPORTADO #{$iReg}", $ministracion); if ($monto > $saldo) { $abono = $monto - $saldo; $msg .= "{$iReg}\t{$socio}\t{$credito}\tAgregando un Abono por {$abono} por el Saldo {$saldo} del Monto {$monto}\r\n"; $xCred->setAbonoCapital($abono, 1, DEFAULT_CHEQUE, DEFAULT_RECIBO_FISCAL, "CREDITO IMPORTADO #{$iReg}", DEFAULT_GRUPO, $UltimaOperacion); } } else { $msg .= "{$iReg}\t{$socio}\t{$credito}\tEL Credito no se pudo agregar\r\n";
$numeropagos = $dias_solicitados - $xFecha->getDiasHabilesEnRango($fecha_vencimiento, $fecha_ministracion); } else { $dias_solicitados = $numeropagos * $periocidad; $fecha_vencimiento = $xFecha->setSumarDias($dias_solicitados, $fecha_ministracion); } $xConv = new cProductoDeCredito($tipoconvenio); $xConv->init(); if (USE_OFICIAL_BY_PRODUCTO == true) { $oficial_de_seguimiento = $xConv->getOficialDeSeguimiento(); } if ($esrenovado == true) { $TipoDeAutorizacion = CREDITO_AUTORIZACION_RENOVADO; $msg .= "WARN\tCredito marcado como Renovado \r\n"; } $xCred = new cCredito(); $result = $xCred->add($tipoconvenio, $persona, $contrato_corriente, $monto_solicitado, $periocidad, $numeropagos, $dias_solicitados, $rubro_destino, false, $grupo_asociado, $amp_destino, $observaciones, $oficial_de_credito, $fecha_solicitud, $tipo_de_pago, INTERES_POR_SALDO_INSOLUTO, false, $fecha_ministracion, $xSoc->getClaveDeEmpresa(), $TipoDeAutorizacion); if ($result == false) { $xFRM->addToolbar($xBtn->getRegresar("solicitud_de_credito.frm.php", true)); $xFRM->addAviso($xHP->lang(MSG_ERROR_SAVE)); $xFL = new cFileLog(); $xFL->setWrite($xCred->getMessages(OUT_TXT)); $xFL->setWrite($xSoc->getMessages()); $xFL->setClose(); $xFRM->addToolbar($xFL->getLinkDownload("Log de eventos", "")); $xFRM->addAviso($xCred->getMessages()); } else { $xCred->init(); $credito = $xCred->getNumeroDeCredito(); //Si es Automatizado $xCat = new cCreditosOtrosDatos(); if ($tieneprops == true) {
$messages .= "ERROR\t Caja No cerrada por tener fondos pendientes \r\n"; } else { $xCaja->setCloseBox(getUsuarioActual(), 0); } $messages .= $xCaja->getMessages(OUT_TXT); } //Verificar lo Valores por defecto if ($xSuc->existeSocio(DEFAULT_SOCIO) == false) { $cajaLocalR = $xSuc->getCajaLocalResidente(); $xSoc = new cSocio(DEFAULT_SOCIO); $xSoc->add("", "PUBLICO_GENERAL", "", "POR_REGISTRAR", "POR_REGISTRAR", $cajaLocalR, false, "DESCONOCIDO", 99, 99, 99, 99, 99, 1, DEFAULT_GRUPO, "", 1, "0", DEFAULT_SOCIO, getSucursal()); $messages .= $xSoc->getMessages(OUT_TXT); } if ($xSuc->existeCredito(DEFAULT_CREDITO) == false) { $xCred = new cCredito(DEFAULT_CREDITO, DEFAULT_SOCIO); $xCred->add(DEFAULT_TIPO_CONVENIO, DEFAULT_SOCIO, DEFAULT_CUENTA_CORRIENTE, 0, CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO, 1, 1, CREDITO_DEFAULT_DESTINO, DEFAULT_CREDITO, DEFAULT_GRUPO, "CREDITO POR DEFECTO"); $messages .= $xCred->getMessages(OUT_TXT); } if ($xSuc->existeCuenta(DEFAULT_CUENTA_CORRIENTE) == false) { $xCta = new cCuentaALaVista(DEFAULT_CUENTA_CORRIENTE); $xCta->setNuevaCuenta("99", "99", DEFAULT_SOCIO); $messages .= $xCta->getMessages(OUT_TXT); } $ql = new MQL(); /* * ==================================================================================================================================================== * Agregar codigo de actualizar menores a personas fisicas * ==================================================================================================================================================== */ $messages .= "=======================================================================================\r\n"; $messages .= "=========================\t\t" . EACP_NAME . " \r\n";