function setActualizarPrimerPago($default_fecha = "2014-01-01")
 {
     $xLi = new cSQLListas();
     $query = new MQL();
     $sql = $xLi->getInicialDeCreditos() . " WHERE `creditos_solicitud`.`fecha_de_primer_pago` ='{$default_fecha}'";
     // AND `creditos_solicitud`.`periocidad_de_pago` != " . CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO . " ";
     $data = $query->getDataRecord($sql);
     $msg = "";
     $FechaFinal = "";
     $ByPersona1 = "";
     $ByPersona3 = "";
     $rsPagos = $query->getDataRecord("SELECT * FROM `creditos_abonos_parciales` WHERE periodo_socio = 1 ");
     // /*WHERE	(`creditos_abonos_parciales`.`fecha_de_pago` <='$FechaFinal') $ByPersona1 */");
     $DPagos = array();
     foreach ($rsPagos as $dpags) {
         $credito = $dpags["docto_afectado"];
         $DPagos[$credito][] = $dpags;
     }
     $rsCal = $query->getDataRecord("SELECT * FROM `letras` WHERE periodo_socio = 1 ");
     // /*WHERE	(`fecha_de_pago` <='$FechaFinal') $ByPersona3 */");
     $DCal = array();
     foreach ($rsCal as $dscal) {
         $credito = $dscal["docto_afectado"];
         $DCal[$credito][] = $dscal;
     }
     foreach ($data as $rows) {
         $idcredito = $rows["numero_solicitud"];
         $antes = $rows["fecha_de_primer_pago"];
         $periocidad = $rows["periocidad_de_pago"];
         $FPrimerAb = false;
         $Tipo = "";
         if ($periocidad == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
             $xCred = new cCredito($idcredito);
             $xCred->init($rows);
             $FPrimerAb = $xCred->getFechaDevencimientoLegal();
         } else {
             //info pagos
             $d1 = isset($DCal[$idcredito]) ? $DCal[$idcredito] : false;
             $d2 = isset($DPagos[$idcredito]) ? $DPagos[$idcredito] : false;
             if ($d2 == false) {
                 if ($d1 != false) {
                     $Tipo = "PLAN";
                     $record = $d2[0];
                     $FPrimerAb = $record["fecha_de_pago"];
                 }
             } else {
                 $Tipo = "PAG";
                 $record = $d2[0];
                 $FPrimerAb = $record["fecha_de_pago"];
             }
             if ($FPrimerAb == false) {
                 $xPlanGen = new cPlanDePagosGenerador();
                 $xPlanGen->initPorCredito($idcredito, $rows);
                 $FPrimerAb = $xPlanGen->getFechaDePrimerPago();
                 $Tipo = "EST";
             }
         }
         $msg .= "WARN\t{$idcredito}\t{$Tipo}\tLa fecha de Primer abono es {$FPrimerAb} de {$antes}\r\n";
         $query->setRawQuery("UPDATE creditos_solicitud SET `fecha_de_primer_pago`='{$FPrimerAb}' WHERE numero_solicitud = {$idcredito} ");
     }
     return $msg;
 }
 function getQueryInicial($tabla = false)
 {
     $this->init($tabla);
     $ql = "";
     $xli = new cSQLListas();
     switch ($this->mTabla) {
         case TCAPTACION_CUENTAS:
             $sql = $xli->getInicialDeCuentas();
             break;
         case TCREDITOS_REGISTRO:
             $sql = $xli->getInicialDeCreditos();
             break;
         case TPERSONAS_ACTIVIDAD_ECONOMICA:
             $sql = $xli->getInicialPersonasActividadEc();
             break;
         case TPERSONAS_DIRECCIONES:
             $sql = "SELECT `socios_vivienda`.*, `socios_vivienda`.`idsocios_vivienda`   AS 'id'\tFROM socios_vivienda ";
             break;
         case TPERSONAS_RELACIONES:
             $sql = $xli->getInicialPersonasRelaciones();
             break;
     }
     return $sql;
 }