$xCol = new cDomiciliosColonias();
    $codCol = $xCol->getClavePorCodigoPostal($DDom["codigo_postal"]);
    $xCol->set($codCol);
    $xCol->init();
    $DCol = $xCol->getDatosInArray();
    $cp = $xT->cSerial(5, $DDom["codigo_postal"]);
    $claveMun = $DCol["codigo_de_municipio"];
    $claveEnt = $DCol["codigo_de_estado"];
    $localidad = $DDom["localidad"];
    $xLoc = new cDomicilioLocalidad("");
    $claveLoc = $xLoc->setBuscar($localidad, $claveEnt, $claveMun);
    $xLoc->set($claveLoc);
    $DLoc = $xLoc->getDatosInArray();
    $claveLocInegi = $DLoc["clave_de_localidad"];
    $DAports = $xSoc->getDatosAportaciones();
    $montoParteSoc = $xSoc->getAportacionesSociales();
    $linea = "{$punto_de_acceso},{$socio},{$tipoDato},{$fechaNac},{$primerApellido},{$segundoApellido},{$primerNombre},{$segundoNombre},{$tipoPersona},{$fechaInscripcion}";
    $linea .= ",{$genero},{$calle},{$numero},{$colonia},{$cp},{$claveLocInegi},{$montoParteSoc},\r\n";
    echo $linea;
}
//echo getRawFooter();
//echo $xHP->setBodyEnd();
/*
<script  >

function initComponents(){
	window.print();
}
</script>
*/
//$xHP->end();
 /**
  * Funcion que asiste en la Ministracion del Credito
  */
 function setMinistrar($recibo_fiscal, $cheque, $monto_cheque = 0, $cuenta_cheques = false, $cheque2 = 0, $cuenta_cheques2 = 0, $observaciones = "", $fecha = false, $recibo = false, $tipo_de_pago = TESORERIA_PAGO_CHEQUE)
 {
     $sucess = true;
     $monto_cheque = $monto_cheque == 0 ? $this->getMontoAutorizado() : $monto_cheque;
     $cuenta_cheques = $cuenta_cheques == false ? DEFAULT_CUENTA_BANCARIA : $cuenta_cheques;
     $cheque = setNoMenorQueCero($cheque);
     $xSocio = new cSocio($this->mNumeroSocio);
     $xSocio->init();
     //Corrige la Inicializacion del credito
     if (!isset($this->mNumeroSocio) or $this->mNumeroSocio == 1) {
         $this->init();
     }
     $DIngreso = $xSocio->getDatosDeIngreso_InArray();
     $msg = "";
     //$tipo_de_pago			= TESORERIA_PAGO_CHEQUE;
     $recibo = setNoMenorQueCero($recibo);
     $DConvenio = $this->getDatosDeProducto();
     $idsolicitud = $this->mNumeroCredito;
     $solicitud = $this->mNumeroCredito;
     /* ------------------------------ obtiene el Monto Autorizado ---------------------------------- */
     $dsol = $this->getDatosDeCredito();
     $montoaut = $this->getMontoAutorizado();
     // $dsol["monto_autorizado"];	// Monto Autorizado
     $fvcred = $dsol["fecha_vencimiento"];
     $modpagos = $this->getPeriocidadDePago();
     $tasacred = $this->getTasaDeInteres();
     $totalop = $montoaut;
     $tipoaut = $dsol["tipo_autorizacion"];
     $socio = $this->mNumeroSocio;
     $intdi = $dsol["interes_diario"];
     $diasa = $dsol["dias_autorizados"];
     $tipoconvenio = $dsol["tipo_convenio"];
     $elgrupo = $dsol["grupo_asociado"];
     $grupo = $elgrupo;
     $idsocio = $socio;
     $fecha_propuesta = $dsol["fecha_ministracion"];
     $tasa_ordinaria_de_interes = $tasacred;
     $monto_autorizado_a_ministrar = $dsol["monto_autorizado"];
     $grupo = $this->mGrupoAsociado;
     if ($fecha == false) {
         $fecha = $this->mFechaOperacion;
     }
     $socio = $this->mNumeroSocio;
     //Valores conservados
     $fechavcto = $fvcred;
     $diasaut = $diasa;
     $intdiario = $intdi;
     /**
      * Corrige la opcion de que el Cheque es Igual a Cero
      */
     if ($monto_cheque == 0) {
         $monto_cheque = $montoaut;
     }
     //Corrige el dato de recibo no valido
     if ($recibo <= 0 and setNoMenorQueCero($this->mReciboDeOperacion) > 0) {
         $recibo = $this->mReciboDeOperacion;
     }
     /*	--------------------------------------------------------------------------------------------------------- */
     $OConv = $this->getOProductoDeCredito($tipoconvenio);
     if ($this->mForceMinistracion == false) {
         // Checa si el credito ya fue Ministrado
         //Modificar
         $montomin = $this->getSumMovimiento(OPERACION_CLAVE_MINISTRACION);
         if ($montomin > 1) {
             $msg .= "ERROR\tEl credito se ha ministrado de forma parcial / Total, o se ha forzado su edicion; el Monto Ministrado es {$montomin} \r\n";
             $sucess = false;
         }
     }
     // verificar si tiene aportaciones sociales
     if ($this->mForceMinistracion == false) {
         $aportaciones = $xSocio->getAportacionesSociales();
         $cuotas = $DIngreso["parte_social"] + $DIngreso["parte_permanente"];
         if ($aportaciones < $cuotas) {
             $msg .= "ERROR\tNo ha Pagado sus Cuotas Sociales por {$cuotas}, ha pagado {$aportaciones} \r\n";
             $sucess = false;
         }
     }
     // verificar si pago su fondo de defuncion. // SI ES DIFERENTE A AUTOMATIZADO
     if ($this->mForceMinistracion == false) {
         $fondo_def_ob = $DConvenio["monto_fondo_obligatorio"];
         $fondo_def_pag = $xSocio->getFondoDeDefuncion();
         if ($fondo_def_pag < $fondo_def_pag) {
             $msg .= "ERROR\tNo ha Pagado sus Fondo de Defuncion por {$fondo_def_pag}, ha pagado {$fondo_def_pag} \r\n";
             $sucess = false;
         }
     }
     // condiciones del credito autorizado por sesion de credito.
     //si el convenio Aplica Gtos Notariales
     $aplica_gtos_not = $DConvenio["aplica_gastos_notariales"];
     if ($aplica_gtos_not == 1 and $this->mForceMinistracion == false) {
         $gastos_not_pagados = $this->getPagoDeGastosNotariales();
         if ($gastos_not_pagados < TOLERANCIA_SALDOS) {
             $msg .= "ERROR\tNo ha Pagado sus Gastos Notariales\r\n";
             $sucess = false;
         }
     }
     // verificar si tiene garantia liquida
     $porc_garantia_liquida = $OConv->getTasaDeGarantiaLiquida();
     if ($porc_garantia_liquida > 0 and $this->mForceMinistracion == false) {
         $msg .= "WARN\tLa Garantia Liquida es de {$porc_garantia_liquida} sobre el Monto Autorizado\r\n";
         if ($OConv->getEsProductoDeGrupos() == true) {
             $condicionante_de_garantia_liquida = " (`socios_general`.`grupo_solidario` = {$elgrupo}) ";
             $msg .= "WARN\tLa Garantia Liquida es valuado por GRUPO \r\n";
         } else {
             $condicionante_de_garantia_liquida = " (`socios_general`.`codigo` = {$idsocio})";
             $msg .= "WARN\tLa Garantia Liquida es valuado por SOCIO \r\n";
         }
         $tgtia = $montoaut * $porc_garantia_liquida;
         $subproducto_de_ahorro_inicial = CAPTACION_PRODUCTO_GARANTIALIQ;
         $sqlSUMDepInicial = "\n\t\t\t\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\t\t\t\t`socios_general`.`grupo_solidario`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(`captacion_cuentas`.`saldo_cuenta`) AS 'sumas'\n\t\t\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\t\t\t`socios_general` `socios_general`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN `captacion_cuentas` `captacion_cuentas`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON `socios_general`.`codigo` = `captacion_cuentas`.`numero_socio`\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\t\t(`captacion_cuentas`.`tipo_subproducto` ={$subproducto_de_ahorro_inicial})\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t\t\t\t{$condicionante_de_garantia_liquida}\n\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t\t\t\t\t\t\t`socios_general`.`grupo_solidario`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`captacion_cuentas`.`tipo_cuenta` ";
         $garliq = mifila($sqlSUMDepInicial, "sumas");
         if ($garliq < $tgtia - TOLERANCIA_SALDOS) {
             $msg .= "ERROR\tNo ha depositado el su totalidad la Garantia Liquida, ha Depositado {$garliq} de un total de {$tgtia} \r\n";
             $msg .= "WARN\tRecuerde que el DEPOSITO DE LA GARANTIA LIQUIDA se efectua en el Modulo de Captacion \r\n";
             $sucess = false;
         }
     }
     //END: verificar Garantia
     // VERIFICA LA GARANTIA SEGUN TIPO CONVENIO.- La seleccion se hace segun el Numero de Socio y no debe estar entregada
     // NO APLICA EN GRUPOS SOLIDARIOS
     $razon_garantias = $DConvenio["razon_garantia"];
     if ($razon_garantias > 0 and $this->mForceMinistracion == false) {
         $monto_garantizado = $xSocio->getGarantiasFisicasDepositadas();
         $monto_a_garantizar = $montoaut * $razon_garantias;
         if ($monto_garantizado < $monto_a_garantizar) {
             $msg .= "ERROR\tNo ha garantizado el Total del Credito, se debe garantizar {$monto_a_garantizar} y solamente se tiene en resguardo {$monto_garantizado} \r\n";
             $sucess = false;
         }
     }
     // SI EL CREDITO ES AUTOMATIZADO
     if ($modpagos == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
         $diasaut = restarfechas($fechavcto, $fecha);
         //$dsol["dias_autorizados"];				// Dias Autorizados.
         $msg .= "WARN\tLos dias Autorizados se cambian a {$diasaut}\r\n";
         //$fechavcto 	= sumardias($fecha, $diasaut);				// Fecha del Sistema + Dias Autorizados
         $intdiario = $montoaut * $tasacred / EACP_DIAS_INTERES;
     } else {
         //Verifica si existe el Plan de Pagos:
         $sqlck = "SELECT COUNT(tipo_docto) AS 'planes' FROM operaciones_recibos WHERE docto_afectado={$idsolicitud} AND tipo_docto=11";
         $plan = $this->getNumeroDePlanDePagos();
         if (!isset($plan) or empty($plan)) {
             $msg .= "ERROR\tNo se ha Generado el PLAN DE PAGOS \r\n";
             $sucess = false;
         }
         if (strtotime($fecha) != strtotime($fecha_propuesta)) {
             $msg .= "ERROR\tNo se puede ministrar el Credito({$fecha}), ya que el PLAN DE PAGO de calcula desde la fecha " . getFechaLarga($fecha_propuesta) . ", vuelva a elaborar el PLAN DE PAGOS\r\n";
             $sucess = false;
         }
     }
     //VERIFICA EL ICA A PAGAR
     $razon_interes_anticipado = $DConvenio["porcentaje_ica"];
     $iva_incluido = $DConvenio["iva_incluido"];
     $tasa_iva = $DConvenio["tasa_iva"];
     //RULE: Modificar segun el Tipo de pago
     if ($razon_interes_anticipado > 0 and $this->mForceMinistracion == false) {
         // verifica si tiene el Pago de Int Anticipado
         $sumia = $dsol["sdo_int_ant"];
         $mIntDiario = $monto_autorizado_a_ministrar * $tasa_ordinaria_de_interes / EACP_DIAS_INTERES;
         $mntia = $mIntDiario * $diasa * $razon_interes_anticipado - TOLERANCIA_SALDOS;
         $MontoICA = $mntia;
         if ($iva_incluido == '1') {
             $MontoICA = $MontoICA * (1 / (1 + $tasa_iva));
         }
         if ($sumia < $MontoICA) {
             $msg .= "ERROR\tNo se ha cubierto el Interes Anticipado, se ha pagado {$sumia} de {$MontoICA} \r\n";
             $sucess = false;
         } else {
             //
         }
     }
     if ($this->mForceMinistracion == true) {
         $sucess = true;
         $msg .= "WARN\tLa Ministracion es FORZADA \r\n";
     }
     /*------------------------------- AFECTACIONES ------------------------------------------------- */
     if ($sucess == true) {
         $monto = $montoaut;
         $parcialidad = 1;
         if ($monto != 0) {
             $CRecibo = new cReciboDeOperacion(RECIBOS_TIPO_MINISTRACION, true, $recibo);
             //Set a Mvto Contable
             //$CRecibo->setGenerarPoliza();
             $CRecibo->setGenerarTesoreria();
             $CRecibo->setGenerarBancos(true);
             //Agregar recibo si no hay
             if (setNoMenorQueCero($recibo) <= 0) {
                 $recibo = $CRecibo->setNuevoRecibo($socio, $solicitud, $fecha, $parcialidad, RECIBOS_TIPO_MINISTRACION, $observaciones, $cheque, $tipo_de_pago, $recibo_fiscal, $grupo);
                 //Checar si se agrego el recibo
                 if (setNoMenorQueCero($recibo) > 0) {
                     $this->mMessages .= "OK\tSe Agrego Exitosamente el Recibo {$recibo} de la Cuenta " . $this->mNumeroCredito . " \r\n";
                     $this->mReciboDeOperacion = $recibo;
                     $this->mSucess = true;
                 } else {
                     $this->mMessages .= "ERROR\tSe Fallo al Agregar el Recibo {$recibo} de la Cuenta " . $this->mNumeroCredito . " \r\n";
                     $this->mSucess = false;
                 }
             }
             $this->mReciboDeOperacion = $recibo;
             if (setNoMenorQueCero($recibo) > 0) {
                 //Agregar el Movimiento
                 $CRecibo->setNuevoMvto($fecha, $monto, OPERACION_CLAVE_MINISTRACION, $parcialidad, $observaciones, 1, TM_CARGO, $socio, $solicitud);
                 /** @since 2010-11-21 */
                 $this->addSDPM(0, 0, $fecha, 0, CREDITO_ESTADO_VIGENTE, $fecha, OPERACION_CLAVE_MINISTRACION);
                 //$this->mMessages	.= $CRecibo->getMessages();
                 $this->mSucess = true;
             } else {
                 $this->mMessages .= "ERROR\tNo Existe Recibo con el cual trabajar ({$recibo}) \r\n";
             }
             $CRecibo->setFinalizarRecibo(true);
             $this->mMessages .= $CRecibo->getMessages();
         }
         // Actualiza el estatus del credito a Vigente, la fecha de Operacion y la de vencimiento.
         $arrAct = array("fecha_ministracion" => $fecha, "fecha_ultimo_mvto" => $fecha, "estatus_actual" => CREDITO_ESTADO_VIGENTE, "fecha_vencimiento" => $fechavcto, "plazo_en_dias" => $diasaut, "dias_autorizados" => $diasaut, "interes_diario" => $intdiario, "saldo_actual" => $montoaut);
         $this->setUpdate($arrAct);
         // --------------------------------- ENVIA LAS SENTENCIAS SQL----------------------------------------
         //verifica la dif entre cheque 1 y el monto a ministrar
         if ($monto_cheque <= 0) {
             $monto_cheque = $montoaut;
         }
         $difCheque = $montoaut - $monto_cheque;
         $beneficiario = $xSocio->getNombreCompleto();
         $descuento = 0;
         //Separar la generación del cheque
         setNuevoCheque($cheque, $cuenta_cheques, $recibo, $beneficiario, $monto_cheque, $fecha, false, $descuento);
         setUltimoCheque($cuenta_cheques, $cheque);
         if ($difCheque > 0) {
             //setPolizaProforma($recibo, 9200, $difCheque, $socio, $idsolicitud, TM_ABONO);
             setNuevoCheque($cheque2, $cuenta_cheques2, $recibo, $beneficiario, $difCheque, $fecha, false, $descuento);
             setUltimoCheque($cuenta_cheques2, $cheque2);
         }
         //Agregar Avisos de Credito por renovacion
         if ($this->getTipoDeAutorizacion() == CREDITO_TIPO_AUTORIZACION_RENOVACION) {
             //$xSoc		= $this->getOPersona();
             $xSocio->initDatosDeCredito();
             $DCreds = $xSocio->getDatosDeCreditos();
             $xCred = new cCreditos_solicitud();
             foreach ($DCreds as $clave => $valores) {
                 $xCred->setData($valores);
                 if ($xCred->saldo_actual()->v() >= TOLERANCIA_SALDOS) {
                     if ($xCred->numero_solicitud()->v() != $this->getNumeroDeCredito()) {
                         //agregar aviso
                         $xSocio->addMemo(MEMOS_TIPO_NOTA_RENOVACION, "Credito Renovado en la solicitud #" . $this->getNumeroDeCredito(), $xCred->numero_solicitud()->v(), $fecha);
                         $msg .= $xSocio->getMessages();
                     }
                 }
             }
         }
         //ejecutar alertas por Ministracion de Reglas de Negocios
         //Ministracion de Credito de la persona {clave_de_persona} {nombre_de_persona}
         //credito numero {clave_de_credito} con monto {monto_de_credito} y tipo de autorizacion {tipo_de_autorizacion}.
         $OTipoAut = new cCreditos_tipo_de_autorizacion();
         $OTipoAut->setData($OTipoAut->query()->initByID($this->getTipoDeAutorizacion()));
         $xRegla = new cReglaDeNegocio();
         $xRegla->setVariables(array("clave_de_persona" => $xSocio->getCodigo(), "nombre_de_persona" => $xSocio->getNombreCompleto(), "clave_de_credito" => $this->getNumeroDeCredito(), "monto_de_credito" => $this->getMontoAutorizado(), "tipo_de_autorizacion" => $OTipoAut->descripcion_tipo_de_autorizacion()->v(OUT_TXT)));
         $xRegla->setExecuteActions($xRegla->reglas()->RN_MINISTRAR_CREDITO);
     } else {
         $msg .= "ERROR\tNo se efectua operacion alguna\r\n";
     }
     $this->mMessages .= $msg;
     return $recibo;
 }