function calcular($fecha_inicial = false, $PrimerPago = false, $SegundoPago = false, $TercerPago = false)
 {
     $xCred = new cCredito($this->mClaveDeCredito);
     $xCred->init();
     $xF = new cFecha();
     $msg = "";
     $FORMA_DE_PAGO = $xCred->getFormaDePago();
     $PAGOS_AUTORIZADOS = $xCred->getPagosAutorizados();
     $PERIOCIDAD_DE_PAGO = $xCred->getPeriocidadDePago();
     $MONTO_AUTORIZADO = $xCred->getMontoAutorizado();
     $SALDO_ACTUAL = $xCred->getSaldoActual();
     $INTERES_PAGADO = $xCred->getInteresNormalPagado();
     $MORA_PAGADO = $xCred->getInteresMoratorioPagado();
     $xCred->initPagosEfectuados();
     $CAPITAL_PAGADO = setNoMenorQueCero($MONTO_AUTORIZADO - $SALDO_ACTUAL);
     $SALDO_DE_PLAN = $xCred->getMontoAutorizado();
     $TASA_NORMAL = $xCred->getTasaDeInteres();
     $TASA_MORA = $xCred->getTasaDeMora();
     $TASA_IVA = $xCred->getTasaIVA();
     $DIVISOR_DE_INTS = EACP_DIAS_INTERES;
     $FECHA_DE_PAGO = $xCred->getFechaPrimeraParc();
     $FECHA_INICIAL = $xCred->getFechaDeMinistracion();
     $opciondia_1 = $PrimerPago;
     $opciondia_2 = $SegundoPago;
     $opciondia_3 = $TercerPago;
     //sanitiza la fecha de pago
     if ($FECHA_DE_PAGO == false) {
         $FECHA_DE_PAGO = $xF->setSumarDias($PERIOCIDAD_DE_PAGO, $FECHA_INICIAL);
     }
     if (($PERIOCIDAD_DE_PAGO > CREDITO_TIPO_PERIOCIDAD_CATORCENAL or $PERIOCIDAD_DE_PAGO == CREDITO_TIPO_PERIOCIDAD_CATORCENAL) and ($opciondia_1 == false or $opciondia_2 == false or $opciondia_3 == false)) {
         if ($PERIOCIDAD_DE_PAGO == CREDITO_TIPO_PERIOCIDAD_QUINCENAL) {
             $opciondia_1 = $opciondia_1 == false ? PQ_DIA_PRIMERA_QUINCENA : $opciondia_1;
             $opciondia_2 = $opciondia_2 == false ? PQ_DIA_SEGUNDA_QUINCENA : $opciondia_2;
         } elseif ($PERIOCIDAD_DE_PAGO == CREDITO_TIPO_PERIOCIDAD_DECENAL) {
             $opciondia_1 = $opciondia_1 == false ? 10 : $opciondia_1;
             $opciondia_2 = $opciondia_2 == false ? 20 : $opciondia_2;
             $opciondia_3 = $opciondia_3 == false ? 30 : $opciondia_3;
         } else {
             $opciondia_1 = $opciondia_1 == false ? PM_DIA_DE_PAGO : $opciondia_1;
         }
     }
     //pagos decenales entre el mes
     $arrPagos = array();
     //obtener los dias de pago en el mes por tipo de pago
     $dia_de_pago = $xCred->getFechaDeMinistracion();
     for ($i = 1; $i <= $PAGOS_AUTORIZADOS; $i++) {
         $letra = $i;
         switch ($PERIOCIDAD_DE_PAGO) {
             case CREDITO_TIPO_PERIOCIDAD_DIARIO:
                 $dia_de_pago = $xF->getDiaHabil($xF->setSumarDias(1, $dia_de_pago));
                 $arrPagos[$letra][SYS_FECHA] = $dia_de_pago;
                 $msg .= "OK\t{$letra}\tDIARIO\tFecha de pago a {$dia_de_pago}\r\n";
                 break;
             case CREDITO_TIPO_PERIOCIDAD_SEMANAL:
                 break;
             case CREDITO_TIPO_PERIOCIDAD_DECENAL:
                 break;
             case CREDITO_TIPO_PERIOCIDAD_CATORCENAL:
                 //dias naturales, cada dos semanas?
                 break;
             case CREDITO_TIPO_PERIOCIDAD_QUINCENAL:
                 $dia_de_pago = $xF->setSumarDias(CREDITO_TIPO_PERIOCIDAD_QUINCENAL, $dia_de_pago);
                 $dia_de_pago = $xF->getDiaAbonoQuincenal($opciondia_1, $opciondia_2, $dia_de_pago);
                 $arrPagos[$letra][SYS_FECHA] = $dia_de_pago;
                 $msg .= "OK\t{$letra}\tQUINCENAL\tFecha de pago a {$dia_de_pago}, opcion {$opciondia_1}, {$opciondia_2}\r\n";
                 break;
             case CREDITO_TIPO_PERIOCIDAD_MENSUAL:
                 $dia_de_pago = date("Y-m-", $xF->getInt($dia_de_pago)) . $opciondia_1;
                 $dia_de_pago = $xF->setSumarMeses(1, $dia_de_pago);
                 $dia_de_pago = $xF->getDiaHabil($dia_de_pago);
                 $arrPagos[$letra][SYS_FECHA] = $dia_de_pago;
                 $msg .= "OK\t{$letra}\tMENSUAL\tFecha de pago a {$dia_de_pago}, opcion {$opciondia_1}\r\n";
                 break;
             case CREDITO_TIPO_PERIOCIDAD_BIMESTRAL:
                 break;
             case CREDITO_TIPO_PERIOCIDAD_TRIMESTRAL:
                 break;
         }
     }
     //$FORMULA_INT			= new cFormula("interes_normal");
     //dias de pago
     //si es empresa, tomar la fecha de la empresa semanal, quincenal, mensual, decenal
     //Iniciar los Pagos Actuales
     //$this->initParcsPendientes();
     $DatosDePagados = $xCred->getListadoDePagos();
     /* interes capital impuestos */
     switch ($FORMA_DE_PAGO) {
         case CREDITO_TIPO_PAGO_PERIODICO:
             //parcialidad interes + capital
             break;
         case CREDITO_TIPO_PAGO_FLAT_PARCIAL:
             for ($i = 1; $i <= $PAGOS_AUTORIZADOS; $i++) {
                 $letra = $i;
                 $letraAnterior = setNoMenorQueCero($letra - 1);
                 $PagoAnterior = isset($DatosDePagados[$letra]) ? $DatosDePagados[$letra] : array();
                 $capital_pagado = isset($DPago[SYS_CAPITAL]) ? $DPago[SYS_CAPITAL] : 0;
                 $SALDO_DE_PLAN = $SALDO_DE_PLAN - $capital_pagado;
                 $interes_normal = $MONTO_AUTORIZADO * $PERIOCIDAD_DE_PAGO * $TASA_NORMAL / $DIVISOR_DE_INTS;
                 $capital = $MONTO_AUTORIZADO / $PAGOS_AUTORIZADOS;
                 $capital = setNoMenorQueCero($capital - $capital_pagado);
                 $interes_pagado = isset($DPago[SYS_INTERES_NORMAL]) ? $DPago[SYS_INTERES_NORMAL] : 0;
                 $interes_normal = setNoMenorQueCero($interes_normal - $interes_pagado);
                 $arrPagos[$letra][SYS_INTERES_NORMAL] = $interes_normal;
                 if ($letra == $PAGOS_AUTORIZADOS) {
                     if ($SALDO_DE_PLAN > 0) {
                         $arrPagos[$letra][SYS_CAPITAL] = $SALDO_DE_PLAN;
                         $msg .= "WARN\t{$letra}\tCapital a ultimo pago {$SALDO_DE_PLAN} \r\n";
                     }
                 }
                 //determinar proxima fecha de pago
                 $msg .= "OK\t{$letra}\tInteres Normal en {$interes_normal}, Pagado {$interes_pagado} \r\n";
             }
             break;
         case CREDITO_TIPO_PAGO_INTERES_PERIODICO:
             for ($i = 1; $i <= $PAGOS_AUTORIZADOS; $i++) {
                 $letra = $i;
                 $letraAnterior = setNoMenorQueCero($letra - 1);
                 $DAnterior = isset($DatosDePagados[$letraAnterior]) ? $DatosDePagados[$letraAnterior] : array();
                 $capital_pagado = isset($DAnterior[SYS_CAPITAL]) ? $DAnterior[SYS_CAPITAL] : 0;
                 $SALDO_DE_PLAN = $SALDO_DE_PLAN - $capital_pagado;
                 $DPago = isset($DatosDePagados[$letra]) ? $DatosDePagados[$letra] : array();
                 $interes_pagado = isset($DPago[SYS_INTERES_NORMAL]) ? $DPago[SYS_INTERES_NORMAL] : 0;
                 //datos del pago anterior
                 $DLetraAnterior = isset($arrPagos[$letraAnterior]) ? $arrPagos[$letraAnterior] : array();
                 $DLetra = isset($arrPagos[$letra]) ? $arrPagos[$letra] : array();
                 $FechaAnterior = isset($DLetraAnterior[SYS_FECHA]) ? $DLetraAnterior[SYS_FECHA] : $xCred->getFechaDeMinistracion();
                 $FechaActual = isset($DLetra[SYS_FECHA]) ? $DLetra[SYS_FECHA] : false;
                 $DIAS_TRANSCURRIDOS = $xF->setRestarFechas($FechaActual, $FechaAnterior);
                 //INTERES NORMAL
                 $interes_normal = $SALDO_DE_PLAN * $DIAS_TRANSCURRIDOS * $TASA_NORMAL / $DIVISOR_DE_INTS;
                 $interes_normal = setNoMenorQueCero($interes_normal - $interes_pagado);
                 $arrPagos[$letra][SYS_INTERES_NORMAL] = $interes_normal;
                 if ($capital_pagado > 0) {
                     $msg .= "WARN\t{$letra}\tCapital en pago {$letraAnterior} de {$capital_pagado} \r\n";
                 }
                 if ($letra == $PAGOS_AUTORIZADOS) {
                     if ($SALDO_DE_PLAN > 0) {
                         $arrPagos[$letra][SYS_CAPITAL] = $SALDO_DE_PLAN;
                         $msg .= "WARN\t{$letra}\tCapital a ultimo pago {$SALDO_DE_PLAN} \r\n";
                     }
                 }
                 $msg .= "OK\t{$letra}\tInteres Normal en {$interes_normal}, Pagado {$interes_pagado}, Dias {$DIAS_TRANSCURRIDOS},Fecha : Actual {$FechaActual} Anterior {$FechaAnterior}\r\n";
             }
             break;
         case CREDITO_TIPO_PAGO_INTERES_COMERCIAL:
             for ($i = 1; $i <= $PAGOS_AUTORIZADOS; $i++) {
                 $letra = $i;
                 $letraAnterior = setNoMenorQueCero($letra - 1);
                 $DAnterior = isset($DatosDePagados[$letraAnterior]) ? $DatosDePagados[$letraAnterior] : array();
                 $capital_pagado = isset($DAnterior[SYS_CAPITAL]) ? $DAnterior[SYS_CAPITAL] : 0;
                 $SALDO_DE_PLAN = $SALDO_DE_PLAN - $capital_pagado;
                 $DPago = isset($DatosDePagados[$letra]) ? $DatosDePagados[$letra] : array();
                 $interes_pagado = isset($DPago[SYS_INTERES_NORMAL]) ? $DPago[SYS_INTERES_NORMAL] : 0;
                 //INTERES NORMAL
                 $interes_normal = $SALDO_DE_PLAN * $PERIOCIDAD_DE_PAGO * $TASA_NORMAL / $DIVISOR_DE_INTS;
                 $interes_normal = setNoMenorQueCero($interes_normal - $interes_pagado);
                 $arrPagos[$letra][SYS_INTERES_NORMAL] = $interes_normal;
                 if ($capital_pagado > 0) {
                     $msg .= "WARN\t{$letra}\tCapital en pago {$letraAnterior} de {$capital_pagado} \r\n";
                 }
                 if ($letra == $PAGOS_AUTORIZADOS) {
                     if ($SALDO_DE_PLAN > 0) {
                         $arrPagos[$letra][SYS_CAPITAL] = $SALDO_DE_PLAN;
                         $msg .= "WARN\t{$letra}\tCapital a ultimo pago {$SALDO_DE_PLAN} \r\n";
                     }
                 }
                 $msg .= "OK\t{$letra}\tInteres Normal en {$interes_normal}, Pagado {$interes_pagado} \r\n";
             }
             break;
     }
     $NumeroPlan = $this->mNumeroDePlan;
     //$this->setEliminar();
     //eliminar plan de pagos
     foreach ($arrPagos as $periodo) {
     }
     $this->mMessages .= $msg;
     return $msg;
 }
 $estatus = $xCred->getEstadoActual();
 $monto_autorizado = $xCred->getMontoAutorizado();
 $PAGOS_AUTORIZADOS = $xCred->getPagosAutorizados();
 $PERIOCIDAD_DE_PAGO = $xCred->getPeriocidadDePago();
 $socio = $xCred->getClaveDePersona();
 $DProducto = $xCred->getOProductoDeCredito();
 $tasa_ahorro = $DProducto->getTasaDeAhorro();
 $tasa_interes = $xCred->getTasaDeInteres();
 $dias_autorizados = $xCred->getDiasAutorizados();
 $saldo_historico = $xCred->getMontoAutorizado();
 $saldo_actual = $xCred->getSaldoActual();
 $MontoCubierto = $saldo_historico - $saldo_actual;
 //Cuanto ha abonado
 // ---------------------------------- Datos del Convenio -----------------------------------------
 $dias_tolerancia_no_pago = $DProducto->getDiasTolerados();
 $tasa_iva = $xCred->getTasaIVA();
 $iva_incluido = $DProducto->getTasaIncluyeIVA();
 $tipo_de_autorizacion = $xCred->getTipoDeAutorizacion();
 $tipo_de_integracion = $DProducto->getTipoDeIntegracion();
 $tipo_de_calculo = $xCred->getTipoDeCalculoDeInteres();
 $interes_normal_pagado = $xCred->getInteresNormalPagado();
 $credito_abonado = ($monto_autorizado > $saldo_actual + TOLERANCIA_SALDOS and $estatus < CREDITO_ESTADO_AUTORIZADO) ? true : false;
 // --------------------- DATOS OBTENIDOS DEL FORM
 $cuenta_captacion = isset($_POST["idcuenta"]) ? $_POST["idcuenta"] : DEFAULT_CUENTA_CORRIENTE;
 $observaciones = $_POST["observaciones"];
 $fecha_primer_abono = $_POST["elanno0"] . "-" . $_POST["elmes0"] . "-" . $_POST["eldia0"];
 $fecha_ministracion = $_POST["elanno1"] . "-" . $_POST["elmes1"] . "-" . $_POST["eldia1"];
 $tipo_de_plan = $_POST["tipo_plan_pagos"];
 $monto_extra = $_POST["cMontoCargoExtra"];
 $tipo_monto_extra = $_POST["cMvtosEsp"];
 $FormaDePago = isset($_POST["cFormaDePago"]) ? $_POST["cFormaDePago"] : 1;
 function getFactura($enviar = false, $out = OUT_PDF)
 {
     $ready = null;
     $xml = "";
     $unidad = "NO APLICA";
     $cantidad = 1;
     $mql = new MQL();
     $xLis = new cSQLListas();
     $xLoc = new cLocal();
     $xPais = new cDomiciliosPaises(EACP_CLAVE_DE_PAIS);
     $xLog = new cCoreLog();
     $sql = "SELECT * FROM `operaciones_archivo_de_facturas` WHERE `clave_de_recibo` = " . $this->mCodigoDeRecibo . " LIMIT 0,1";
     $xArch = new cOperaciones_archivo_de_facturas();
     $DFact = $mql->getDataRow($sql);
     if (isset($DFact["clave_de_recibo"])) {
         $xArch->setData($DFact);
         $this->mMessages .= "OK\tEl UUID existe  " . $xArch->uuid()->v(OUT_TXT) . "\r\n";
         if ($enviar == true) {
             if ($this->getOPersona() == null) {
             } else {
                 $xSoc = $this->getOPersona();
                 $email = $xSoc->getCorreoElectronico();
                 $comprobante = PATH_FACTURAS . $xArch->uuid()->v(OUT_TXT);
                 file_put_contents($comprobante . ".xml", base64_decode($xArch->contenido()->v(OUT_TXT)));
                 file_put_contents($comprobante . ".pdf", base64_decode($xArch->impreso()->v(OUT_TXT)));
                 $ready = $out == OUT_PDF ? base64_decode($xArch->impreso()->v(OUT_TXT)) : base64_decode($xArch->contenido()->v(OUT_TXT));
                 $xNotif = new cNotificaciones();
                 //PDF y XML
                 $arrFil = array();
                 $arrFil["archivo1"]["path"] = $comprobante . ".pdf";
                 $arrFil["archivo2"]["path"] = $comprobante . ".xml";
                 $xNotif->sendMail("Factura del Recibo " . $this->mCodigoDeRecibo, "Factura del Recibo " . $this->mCodigoDeRecibo, $email, $arrFil);
                 //Enviar al Archivo mail
                 $xNotif->sendMail("Factura del Recibo " . $this->mCodigoDeRecibo, "Factura del Recibo " . $this->mCodigoDeRecibo, FACTURACION_MAIL_ARCHIVO, $arrFil);
                 $this->mMessages .= $xNotif->getMessages();
             }
         } else {
             $ready = $out == OUT_PDF ? $xArch->impreso()->v(OUT_TXT) : $xArch->contenido()->v(OUT_TXT);
         }
     } else {
         $xLog->add("WARN\tGenerando Nueva Factura\r\n", $xLog->DEVELOPER);
         //cargar Archivo
         $xPais->init();
         if ($this->mReciboIniciado == false) {
             $this->init();
         }
         if ($this->getOPersona() == null) {
             $xLog->add("ERROR\tAl cargar la Persona\r\n");
         } else {
             $xFact = new cFacturaElectronica();
             //datos de la emisora
             //persona iniciada
             $xSoc = $this->getOPersona();
             $email = $xSoc->getCorreoElectronico();
             $xFact->setEmisor(EACP_NAME, EACP_RFC, EACP_DOMICILIO_CALLE, EACP_DOMICILIO_NUM_EXT, EACP_DOMICILIO_NUM_INT, EACP_CODIGO_POSTAL, EACP_COLONIA, EACP_MUNICIPIO, EACP_ESTADO, $xPais->getNombre());
             $xFact->setRegimenFiscal(EACP_REGIMEN_FISCAL);
             $calle = $xLoc->DomicilioCalle();
             $numeroInt = $xLoc->DomicilioNumeroInterior();
             $numeroExt = $xLoc->DomicilioNumeroExterior();
             $codigoPostal = $xLoc->DomicilioCodigoPostal();
             $colonia = $xLoc->DomicilioColonia();
             $xSocDom = $xSoc->getODomicilio();
             $pais = $xLoc->getNombreDePais();
             $estado = $xLoc->DomicilioEstado();
             $municipio = $xLoc->DomicilioMunicipio();
             $tasa_iva = TASA_IVA;
             $xFact->setLugarDeExpedicion($xLoc->DomicilioCalle(), $xLoc->DomicilioNumeroExterior(), $xLoc->DomicilioNumeroInterior(), $xLoc->DomicilioCodigoPostal(), $xLoc->DomicilioColonia(), $xLoc->DomicilioMunicipio(), $xLoc->DomicilioEstado(), $xLoc->getNombreDePais());
             if ($xSocDom == null) {
                 $xLog->add("WARN\tNo hay domicilio Valido\r\n", $xLog->DEVELOPER);
             } else {
                 $calle = $xSocDom->getCalle();
                 $numeroExt = $xSocDom->getNumeroExterior();
                 $numeroInt = $xSocDom->getNumeroInterior();
                 $codigoPostal = $xSocDom->getCodigoPostal();
                 $colonia = $xSocDom->getColonia();
                 $municipio = $xSocDom->getMunicipio();
                 $estado = $xSocDom->getEstado();
                 $pais = $xSocDom->getNombreDePais();
             }
             //Cargar datos del Docto
             //$this->getOrigen();
             $OTipoRec = $this->getOTipoRecibo();
             if ($OTipoRec->getOrigen() == RECIBOS_ORIGEN_MIXTO or $OTipoRec->getOrigen() == RECIBOS_ORIGEN_COLOCACION) {
                 $xCred = new cCredito($this->getCodigoDeDocumento());
                 $xCred->init();
                 $tasa_iva = $xCred->getTasaIVA();
                 $xLog->add("WARN\tLa tasa de IVA es {$tasa_iva}\r\n", $xLog->DEVELOPER);
             }
             $xFact->setReceptor($xSoc->getNombreCompleto(), $xSoc->getRFC(true, true), $calle, $numeroExt, $numeroInt, $codigoPostal, $colonia, $municipio, $estado, $pais);
             //Datos del pagos
             $formaDePago = "Pago en una sola exhibición";
             $cuentaDePago = "No Identificado";
             $arrEquiv = array(TESORERIA_COBRO_DOCTO => "Documentos", TESORERIA_COBRO_EFECTIVO => "Efectivo", TESORERIA_COBRO_INTERNO => "Documentos", TESORERIA_COBRO_MULTIPLE => "Documentos", TESORERIA_COBRO_NINGUNO => "Documentos", TESORERIA_COBRO_TRANSFERENCIA => "Transferencia", TESORERIA_COBRO_CHEQUE => "Cheque");
             $metodoDePago = $arrEquiv[$this->getTipoDePago()];
             //cargar equivalencias
             //TODO: Considerar cambios en otro de tipo de tributacion
             if ($this->getTipoDePago() == TESORERIA_COBRO_TRANSFERENCIA or $this->getTipoDePago() == TESORERIA_COBRO_CHEQUE) {
                 $OCaja = $this->getOCaja();
                 $cuentaDePago = $OCaja->getCuentaBancoActivo();
             }
             //Cheque, Transferencia, Depósito
             $xFact->setDatosDePago($formaDePago, $metodoDePago, $cuentaDePago);
             $sql = "SELECT\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t`operaciones_mvtos`.`recibo_afectado`,\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`,\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`subclasificacion`,\n\t\t\t\t\t`operaciones_tipos`.`descripcion_operacion` AS `operacion`,\n\t\t\t\t\t`operaciones_mvtos`.`fecha_operacion`,\n\t\t\t\t\t`operaciones_mvtos`.`afectacion_real` AS 'monto'  \n\t\t\t\tFROM\n\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos` \n\t\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros` \n\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros` \n\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = \n\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro` \n\t\t\t\t\t\t\tINNER JOIN `operaciones_tipos` `operaciones_tipos` \n\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` = `operaciones_tipos`.\n\t\t\t\t\t\t\t`idoperaciones_tipos` \n\t\t\t\tWHERE\n\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` =11000) AND\n\t\t\t\t\t(`operaciones_mvtos`.`recibo_afectado` =" . $this->mCodigoDeRecibo . " )";
             $iva = 0;
             $total = 0;
             $rs = $mql->getDataRecord($sql);
             foreach ($rs as $rows) {
                 $descripcion = $rows["operacion"];
                 $valor = $rows["monto"];
                 $tipo = $rows["subclasificacion"];
                 $total += $valor;
                 if ($tipo == 1000) {
                     $iva += $rows["monto"];
                 } else {
                     $xFact->addConcepto($cantidad, $unidad, $valor, $descripcion);
                 }
             }
             //agregar IVA
             if ($iva > 0) {
                 $xFact->addTrasladado("IVA", $tasa_iva, $iva);
             }
             $xml = $xFact->get();
             $this->mOFactura = $xFact;
             if ($total <= 0) {
                 $enviar = false;
             }
         }
         if ($enviar == true) {
             if ($this->mOFactura != null) {
                 if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
                     if ($this->mOFactura->timbrar() == 1) {
                         //ready = true
                         $xNotif = new cNotificaciones();
                         //PDF y XML
                         $arrFil = array();
                         $arrFil["archivo1"]["path"] = $this->mOFactura->getComprobante() . ".pdf";
                         $arrFil["archivo2"]["path"] = $this->mOFactura->getComprobante() . ".xml";
                         $xNotif->sendMail("Factura del Recibo " . $this->mCodigoDeRecibo, "Factura del Recibo " . $this->mCodigoDeRecibo, $email, $arrFil);
                         //Enviar al Archivo mail
                         $xNotif->sendMail("Factura del Recibo " . $this->mCodigoDeRecibo, "Factura del Recibo " . $this->mCodigoDeRecibo, FACTURACION_MAIL_ARCHIVO, $arrFil);
                         //Guardar en DB
                         $this->mOFactura->setArchivar($this->mCodigoDeRecibo);
                         $xLog->add($xNotif->getMessages(), $xLog->DEVELOPER);
                         $ready = $out == OUT_PDF ? $this->mOFactura->getPDF() : $this->mOFactura->getXML();
                     }
                 } else {
                     $xLog->add("WARN\tNo hay email valido para la Factura ({$email})\r\n", $xLog->DEVELOPER);
                 }
                 $xLog->add($this->mOFactura->getMessages(), $xLog->DEVELOPER);
             }
         }
     }
     $this->mMessages .= $xLog->getMessages();
     return $ready;
 }
$socio = $xCred->getClaveDePersona();
$dcredito = $xCred->getDatosDeCredito();
$fecha_ministracion = $xCred->getFechaDeMinistracion();
// $dcredito["fecha_ministracion"];
$fecha_ult_mvto = $xCred->getFechaUltimoDePago();
$fecha_vencimiento = $xCred->getFechaDeVencimiento();
// $dcredito["fecha_vencimiento"];
$numero_de_pagos = $xCred->getPagosAutorizados();
$estatus_del_credito = $xCred->getEstadoActual();
$saldo_actual = $xCred->getSaldoActual();
$saldo_del_credito = $saldo_actual;
$interes_anticipado = $dcredito["sdo_int_ant"];
$grupo = $xCred->getClaveDeGrupo();
$OProducto = $xCred->getOProductoDeCredito();
//$OEstado					= $xCred->getOEstado();
$tasa_iva = $generarIVA == false ? 0 : $xCred->getTasaIVA();
$interes_normal_devengado = $xCred->getInteresNormalDevengado();
$interes_normal_pagado = $xCred->getInteresNormalPagado();
$interes_moratorio_pagado = $xCred->getInteresMoratorioPagado();
$interes_moratorio_devengado = $xCred->getInteresMoratorioDev();
$periocidad = $xCred->getPeriocidadDePago();
$ByLetra = "";
$solo_mora_corriente = $pago_total == true ? true : false;
//Corrige calculo de Interes.- Si es primer pago
$DInteres = $xCred->getInteresDevengado($fecha_operacion, $parcialidad, false, $solo_mora_corriente);
$interes_normal_calculado = $DInteres[SYS_INTERES_NORMAL];
$interes_moratorio_calculado = $DInteres[SYS_INTERES_MORATORIO];
$gastos_de_cobranza_calculado = $DInteres[SYS_GASTOS_DE_COBRANZA];
$fecha_de_pago = $fecha_vencimiento;
if ($xCred->getPeriocidadDePago() != CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
    $xLetra = new cParcialidadDeCredito();