function jsaGetLocalidades($estado, $municipio, $pais, $cp)
{
    $xSel = new cHSelect();
    $text = new cHText();
    $txt = "";
    $mun = false;
    if (setNoMenorQueCero($cp) > 0) {
        if ($pais == EACP_CLAVE_DE_PAIS) {
            $xCol = new cDomiciliosColonias();
            $xCol->existe($cp);
            $mun = $xCol->getClaveDeMunicipio();
            //$xCol->getNombreMunicipio();
        }
    }
    if (PERSONAS_VIVIENDA_MANUAL == true) {
        $text->setDivClass("");
        $txt = $text->getDeNombreDeLocalidad("idnombrelocalidad", "", "TR.Localidad");
    } else {
        $xS = $xSel->getListaDeLocalidades("", $estado, $pais);
        $txt = $xS->get(false);
        if ($xS->getCountRows() <= 0) {
            //Corregir si no hay registros
            $text->setDivClass("");
            $txt = $text->getDeNombreDeLocalidad("idnombrelocalidad", "", "TR.Localidad");
        }
    }
    return $txt;
}
function jsaSetGenerarPolizaPorRecibo($numero)
{
    if (setNoMenorQueCero($numero) > 0) {
        //return $tab -> getString();
        $Recibo = $numero;
        $msg = "";
        $Regenerar = true;
        //( strtoupper($id2) == "SI") ? true : false;
        $xUCont = new cUtileriasParaContabilidad();
        $xBtn = new cHButton();
        if ($Regenerar == true) {
            $msg .= $xUCont->setRegenerarPrepolizaContable(false, $Recibo);
        }
        $xUCont->setPolizaPorRecibo($Recibo);
        $idPol = trim($xUCont->getIDPoliza());
        $xPolCW = new cPolizaCompacW(0);
        $xPolCW->initByID($idPol);
        $xPolCW->setRun();
        $strDown = $xPolCW->setExport();
        if (MODO_DEBUG == true) {
            $xLog = new cFileLog();
            $xLog->setWrite($xUCont->getMessages());
            $xLog->setClose();
            $strDown .= $xLog->getLinkDownload("TR.Log");
        }
        //return $xBtn->getBasic("TR.Modificar Poliza","jsModificarPoliza('$idPol')", $xBtn->ic()->EDITAR, "cmdeditpoliza") . $strDown ;
    } else {
        return "NO HAY REGISTRO QUE GENERAR [{$numero}]";
    }
}
function jsaAmortizarLetras($persona, $credito, $letra, $amortizable)
{
    $NLetra = $letra + 1;
    $xCred = new cCredito($credito);
    $xCred->init();
    if ($xCred->isAFinalDePlazo() == false) {
        $xPlan = new cPlanDePagos();
        $xPlan->initByCredito($credito);
        $msg = "";
        $DPlan = $xPlan->getLetrasInArray(OPERACION_CLAVE_PLAN_CAPITAL, $NLetra);
        $amortizable = setNoMenorQueCero($amortizable);
        for ($ixletra = $NLetra; $ixletra <= $xCred->getPagosAutorizados(); $ixletra++) {
            if (isset($DPlan[$ixletra])) {
                $monto = setNoMenorQueCero($DPlan[$ixletra]);
                if ($amortizable > 0) {
                    if ($amortizable >= $monto) {
                        //cancelar
                        $xPlan->setNeutralizarParcialidad($ixletra);
                    } else {
                        $xPlan->setActualizarParcialidad($ixletra, $monto - $amortizable, false, false);
                    }
                }
                $msg .= "WARN\t  {$ixletra} --- {$amortizable} {$monto};\r\n";
                $amortizable -= $monto;
            }
        }
        $msg .= $xPlan->getMessages();
        if (MODO_DEBUG == true) {
            setLog($msg);
        }
    }
}
function jsaGetLetras($idcredito)
{
    $idcred = setNoMenorQueCero($idcredito);
    $xF = new cFecha();
    if ($idcred > DEFAULT_CREDITO) {
        $xCred = new cCredito($idcred);
        $xCred->init();
        if ($xCred->getEsAfectable() == false or $xCred->getSaldoActual() <= 0) {
            if (MODO_CORRECION == true) {
                $xTxt = new cHText();
                $xTxt->setDivClass("");
                return $xTxt->getNumero("idparcialidad", $xCred->getPeriodoActual() + 1, "TR.Numero de Parcialidad");
            } else {
                return $xCred->getMessages();
            }
        } else {
            if ($xCred->getPeriocidadDePago() == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
                //
                $xTxt = new cHText();
                $xTxt->setDivClass("");
                return $xTxt->getNumero("idparcialidad", $xCred->getPeriodoActual() + 1, "TR.Numero de Parcialidad");
            } else {
                $plan = $xCred->getNumeroDePlanDePagos();
                if ($plan != false) {
                    $xPlan = new cPlanDePagos($plan);
                    $xPlan->init();
                    $parcs = $xPlan->getParcsPendientes();
                    //$txt		= "";
                    $arrD = array();
                    foreach ($parcs as $p) {
                        //setLog( $p[SYS_NUMERO]. " " . $xF->getFechaDDMM($p[SYS_FECHA]) . " ". getFMoney($p[SYS_TOTAL]));
                        if (setNoMenorQueCero($p[SYS_TOTAL]) > 0) {
                            $arrD[$p[SYS_NUMERO]] = $p[SYS_NUMERO] . " " . $xF->getFechaDDMM($p[SYS_FECHA]) . " " . getFMoney($p[SYS_TOTAL]);
                        }
                    }
                    $xSel = new cHSelect();
                    $xSel->addOptions($arrD);
                    $xSel->setEnclose(false);
                    return $xSel->get("idparcialidad", "TR.Numero de Parcialidad", $xCred->getPeriodoActual() + 1);
                } else {
                    if (MODO_CORRECION == true) {
                        $xTxt = new cHText();
                        $xTxt->setDivClass("");
                        return $xTxt->getNumero("idparcialidad", $xCred->getPeriodoActual() + 1, "TR.Numero de Parcialidad");
                    }
                }
            }
        }
    }
}
function jsaSetFinalizarPoliza($poliza, $cargos, $abonos)
{
    $xPol = new cPoliza(false);
    $xPol->setPorCodigo($poliza);
    $msg = "";
    if (setNoMenorQueCero($cargos) <= 0 or $cargos != $abonos) {
        $msg .= "ERROR\tPoliza descuadrada {$cargos} - {$abonos}\r\n";
    } else {
        $xPol->setTotalAbonos($abonos);
        $xPol->setTotalCargos($cargos);
        $xPol->setFinalizar();
        //$msg	.= "";
    }
    $msg .= $xPol->getMessages();
    return $msg;
}
function jsaInitPeriodo($empresa, $periocidad, $periodo)
{
    $xF = new cFecha();
    $xEmp = new cEmpresas($empresa);
    $xEmp->init();
    $tab = new TinyAjaxBehavior();
    $DPer = $xEmp->getOPeriodo($periocidad);
    $empPeriodo = $xEmp->getPeriodo();
    if ($periodo > $empPeriodo) {
        $fechaInicial = $xEmp->getFechaDeAviso($periocidad, false, $periodo, $periodo + 1);
    } else {
        $dias_dif = setNoMenorQueCero($periodo - $empPeriodo);
        $starD = $periocidad * $dias_dif + 1;
        $fechaInicial = $xF->setSumarDias($starD, $DPer->fecha_final()->v());
    }
    $fechaFinal = $xF->setSumarDias($xEmp->getPeriocidadPref(), $fechaInicial);
    $tab->add(TabSetvalue::getBehavior("idfecha-10", $xF->getFechaMX($fechaInicial, "-")));
    $tab->add(TabSetvalue::getBehavior("idfecha-11", $xF->getFechaMX($fechaFinal, "-")));
    return $tab->getString();
}
 function init()
 {
     $val = false;
     $cFld = "id";
     if ($this->mTypeById == false) {
         $cFld = "nombreusuario";
     }
     $sql = "SELECT * FROM usuarios WHERE {$cFld} = '" . $this->mCodeUser . "' ";
     $D = obten_filas($sql);
     if (isset($D["niveldeacceso"])) {
         $this->mDatosInArray = $D;
         $this->mNivel = $D["niveldeacceso"];
         $this->mClaveDePersona = $D["codigo_de_persona"];
         $this->mID = $D["idusuarios"];
         $this->mPWD = $D["contrasenna"];
         $this->mCuentaDeCaja = setNoMenorQueCero($D["cuenta_contable_de_caja"]) <= 0 ? CUENTA_DE_CUADRE : $D["cuenta_contable_de_caja"];
         $this->mUserIniciado = true;
     }
     unset($D);
     return $this->mUserIniciado;
 }
function jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final, $todas)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xT = new cTipos();
    $xF = new cFecha();
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    //
    $ByEstado = $xT->cBool($todas) == true ? "" : " AND `estado_en_sistema`= " . SYS_UNO;
    $ByEstado .= setNoMenorQueCero($tipo) <= 0 ? "" : "  AND (`aml_risk_catalog`.`tipo_de_riesgo` ={$tipo}) ";
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeAlertas(false, false, false, false, $ByEstado);
    $xT = new cTabla($sql);
    $xT->setWithMetaData();
    $xT->OButton("TR.Dictaminar", "jsModificarEstatus(_REPLACE_ID_)", $xT->ODicIcons()->REPORTE);
    $xT->OButton("TR.Panel", "jsToPanel(_REPLACE_ID_)", $xT->ODicIcons()->EJECUTAR);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
 function init($persona = false, $credito = false, $numero = false)
 {
     //TODO: Verificar cambios de incencias 2014-10-01
     $persona = setNoMenorQueCero($persona);
     $credito = setNoMenorQueCero($credito);
     $numero = setNoMenorQueCero($numero);
     $this->mPersona = $persona > 0 ? $persona : $this->mPersona;
     $this->mCredito = $credito > 0 ? $credito : $this->mCredito;
     $this->mNumero = $numero > 0 ? $numero : $this->mNumero;
     $sql = "SELECT * FROM letras WHERE socio_afectado={$persona} AND docto_afectado={$credito} AND periodo_socio={$numero} LIMIT 0,1";
     $init = true;
     if (count($this->mDatosInArray) > 2) {
         $Datos = $this->mDatosInArray;
     } else {
         $Datos = obten_filas($sql);
         if (!isset($Datos["letra"])) {
             $init = false;
         }
     }
     $this->mOB = new cLetrasVista();
     $this->mOB->setData($Datos);
     $this->mDatosInArray = $Datos;
     //$fecha					= $this->mOB->fecha_de_pago()->v();
     //$this->mMessages		.= "[FECHA_DE_PAGO : $fecha]\r\n";
     return $init;
 }
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("TR.Lista de Cuentas");
$xL = new cSQLListas();
$oficial = elusuario($iduser);
//$i 			= $_GET["i"];
$f = parametro("f", false, MQL_RAW);
$tipo = parametro("a", false, MQL_INT);
$c = parametro("c", "idcuenta");
$subtipo = parametro("s", SYS_TODAS, MQL_INT);
$OtherEvent = parametro("ev");
//Otro Evento Desatado
$slimit = "";
$mrkSubproducto = setNoMenorQueCero($subtipo) <= 0 ? "" : " AND (`captacion_cuentas`.`tipo_subproducto` = {$subtipo}) ";
$xEquiv = new cSistemaEquivalencias();
if ($tipo == iDE_CAPTACION) {
    $tipo = false;
}
if ($tipo == iDE_CVISTA) {
    $tipo = CLAVE_A_LA_VISTA;
}
if ($tipo == iDE_CINVERSION) {
    $tipo = CLAVE_INVERSION_A_PLAZO;
}
/*if (!$i){
	echo "<script languaje=\"javascript\"> window.close(); </script>";
}*/
$persona = parametro("persona", DEFAULT_SOCIO, MQL_INT);
$persona = parametro("socio", $persona, MQL_INT);
         $PagoActual = "V";
         $SaldoVencido = 0;
         $NumeroPagosVencidos = "";
         $FechaDePrimerIncumplimiento = "";
     }
 }
 /* 2014-08-03 */
 if ($SaldoVencido > 1 and $PagoActual == "V") {
     if (setNoMenorQueCero($NumeroPagosVencidos) <= 0) {
         $PagoActual = "01";
     } else {
         $PagoActual = "{$NumeroPagosVencidos}";
     }
 }
 if ($SaldoActual > TOLERANCIA_SALDOS + 0.01) {
     if (setNoMenorQueCero($PagoActual) > $xCred->getPagosAutorizados()) {
         //pago actual reset
         //$xMs	= new cNotificaciones();
         $xLog->add("WARN\t{$idpersona}-{$idcredito}\t{$sucres}\t({$PagoActual} . {$NumeroPagosVencidos})ERROR\tCredito " . $xCred->getNumeroDeCredito() . " Saldo {$SaldoActual}\r\n", $xLog->DEVELOPER);
         $PagoActual = "01";
         //sprintf("%02d", setNoMenorQueCero(($xCred->getPagosAutorizados() - $NumeroPagosVencidos)) );
     }
 }
 if ($SaldoVencido > $SaldoActual) {
     $SaldoVencido = $SaldoActual;
 }
 $HistoricoPagos = "";
 $ClavePrevencion = "";
 $TotalPagosReportados = 0;
 $ClaveOtorganteAnterior = "";
 //ENTIDAD_CLAVE_SIC;
 function getGenerarBaseGravadaMensualIDE($fecha = false)
 {
     if ($fecha == false) {
         $fecha = fechasys();
     }
     $msg = "";
     $msg .= "============== GENERANDO EL MOVIMIENTO DE BASE GRAVABLE DEL IDE\t==========\r\n";
     $msg .= "============== FECHA: {$fecha}                                    ==========\r\n";
     $xF = new cFecha(0, $fecha);
     $dia_inicial = $xF->getDiaInicial();
     $dia_final = $xF->getDiaFinal();
     $sqlGravados = "SELECT\n\t\t\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t\t\t\tSUM(`operaciones_mvtos`.`afectacion_real`) AS 'monto'\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\t\t\t\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos`\n\t\t\t\t\t\t\t\t\tON `operaciones_mvtos`.`recibo_afectado` = `operaciones_recibos`.\n\t\t\t\t\t\t\t\t\t`idoperaciones_recibos`\n\t\t\t\t\t\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` =\n\t\t\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` >='{$dia_inicial}')\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` <='{$dia_final}')\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` = 2600)\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t(`operaciones_recibos`.`tipo_pago` = 'efectivo' )\n\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t\t\t`operaciones_recibos`.`tipo_pago` ";
     //$msg		.= "$sqlGravados\r\n";
     //Agregar Recibo
     $xRec = new cReciboDeOperacion(10);
     //$xRec->setGenerarPoliza();
     $xRec->setForceUpdateSaldos();
     $idrecibo = $xRec->setNuevoRecibo(1, 1, $fecha, 1, 10, "BASE_REMANENTE_GRAVABLE_AL_IDE", "NA", "ninguno", "NA", DEFAULT_GRUPO);
     $xRec->setNumeroDeRecibo($idrecibo);
     $rs = getRecordset($sqlGravados);
     while ($rw = mysql_fetch_array($rs)) {
         $socio = $rw["socio_afectado"];
         $excencion = EXCENCION_IDE;
         $base_gravada = setNoMenorQueCero($rw["monto"] - $excencion);
         if ($base_gravada > 0) {
             $xRec->setNuevoMvto($dia_final, $base_gravada, 9302, 1, "", 1, false, $socio, 1);
         }
     }
     $xRec->setFinalizarRecibo();
     $msg .= $xRec->getMessages("txt");
     return $msg;
 }
         //echo $xEQ->CUENTA_FORMATEADA . "<br/>" . $xEQ->CUENTARAW ."<br />" . $xCW->getEquivalencia( $xFi->getV($tmp->NATURALEZA, "") )  . $xEQ->NIVEL_ACTUAL . "<hr />";
         $cuenta = $xEQ->CUENTA_FORMATEADA;
         $xCCont = new cCuentaContable($cuenta);
         $nivel = $xCCont->determineNivel($cuenta);
         $sucess = true;
         $nombre = $xFi->getV($colnombre, "");
         $nombre = trim($nombre);
         $superior = $xEQ->CUENTA_SUPERIOR;
         // $xCCont->getInmediatoSuperior();
         $cuenta = $xCCont->getCuentaCompleta($cuenta);
         $nombre = $xT->setNoAcentos($nombre);
         $nombre = str_replace("'", "", $nombre);
         $nombre = strtoupper($nombre);
         $naturaleza = $xFi->getV($colnat, "");
         if ($sucess == true and $action == MQL_ADD) {
             if (setNoMenorQueCero($cuenta) > 0) {
                 $xCta = new cCuentaContable($cuenta);
                 $xCta->add($nombre, $naturaleza, false, false, $nivel, false, false, $superior);
                 $msg .= $xCta->getMessages(OUT_TXT);
             }
         }
     } else {
         //$msg		.= "$conteo\t===============\r\n";
     }
     $conteo++;
 }
 $msg .= $xFi->getMessages(OUT_TXT);
 if (MODO_DEBUG == true) {
     $xLog = new cFileLog();
     $xLog->setWrite($msg);
     $xLog->setClose();
 function setPolizaPorRecibo($recibo, $generador = false)
 {
     $sucess = false;
     $QL = new MQL();
     $xLogg = new cCoreLog();
     //$arrEquivEfvo			=
     //if (GENERAR_CONTABILIDAD == true){
     $xLogg->add("=======\tGENERAR POLIZA POR RECIBO NUM {$recibo}\r\n", $xLogg->DEVELOPER);
     $xT = new cCatalogoOperacionesDeCaja();
     $centro_de_costo = DEFAULT_CENTRO_DE_COSTO;
     //($generador == GENERAR_POLIZAS_AL_CIERRE) AND
     if (setNoMenorQueCero($recibo) > 0) {
         $xRec = new cReciboDeOperacion(false, false, $recibo);
         if ($xRec->init() == true) {
             $sucess = true;
             //Obten datos del recibo para la Poliza
             $sqlRec = "SELECT\r\n\t\t\t\t\t\t\t`operaciones_recibos`.*,\r\n\t\t\t\t\t\t\t`operaciones_recibostipo`.`tipo_poliza_generada`,\r\n\t\t\t\t\t\t`operaciones_recibostipo`.`afectacion_en_flujo_efvo`\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t`operaciones_recibos` `operaciones_recibos`\r\n\t\t\t\t\t\t\t\tINNER JOIN `operaciones_recibostipo`\r\n\t\t\t\t\t\t\t\t`operaciones_recibostipo`\r\n\t\t\t\t\t\t\t\tON `operaciones_recibos`.`tipo_docto` =\r\n\t\t\t\t\t\t\t\t`operaciones_recibostipo`.\r\n\t\t\t\t\t\t\t\t`idoperaciones_recibostipo`\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t(`operaciones_recibos`.`idoperaciones_recibos` = {$recibo})\r\n\t\t\t\t\t\tLIMIT 0,1 ";
             $dRec = obten_filas($sqlRec);
             $tipo_de_pago = $xRec->getTipoDePago();
             //Corrige los cargos de la PolizaS
             $total_poliza = 0;
             $SQLSumCargos = "SELECT SUM(monto) AS 'total' FROM contable_polizas_proforma\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE contable_operacion = '" . TM_CARGO . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND numero_de_recibo={$recibo} ";
             $TMPCargos = mifila($SQLSumCargos, "total");
             $SQLSumAbonos = "SELECT SUM(monto) AS 'total' FROM contable_polizas_proforma\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE contable_operacion = '" . TM_ABONO . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND numero_de_recibo={$recibo} ";
             $TMPAbonos = mifila($SQLSumAbonos, "total");
             if ($TMPCargos > $TMPAbonos) {
                 $diferencia = $TMPAbonos - $TMPCargos;
                 $diferencia = $diferencia < 0 ? $diferencia * -1 : $diferencia;
                 $total_poliza = $TMPCargos;
                 setPolizaProforma($recibo, $xT->getTipoOperacionByTipoPago($tipo_de_pago), $diferencia, 1, 1, TM_ABONO);
                 $xLogg->add("OK\tCUADRAR\tABONO\tOperacion Agregada por DESCUADRE en {$tipo_de_pago} por {$diferencia}\r\n", $xLogg->DEVELOPER);
                 //$xLogg->add( , $xLogg->DEVELOPER);
             } elseif ($TMPCargos < $TMPAbonos) {
                 $diferencia = $TMPCargos - $TMPAbonos;
                 $diferencia = $diferencia < 0 ? $diferencia * -1 : $diferencia;
                 $total_poliza = $TMPAbonos;
                 setPolizaProforma($recibo, $xT->getTipoOperacionByTipoPago($tipo_de_pago), $diferencia, 1, 1, TM_CARGO);
                 $xLogg->add("OK\tCUADRAR\tCARGOS\tOperacion Agregada por DESCUADRE en {$tipo_de_pago} por {$diferencia}\r\n", $xLogg->DEVELOPER);
             } else {
                 $total_poliza = $TMPCargos;
             }
             //tipos de Poliza 1=ingreso, 2=egreso, 3 Diario, 4=orden 5
             $xD = new cFecha(0, $xRec->getFechaDeRecibo());
             $numero_de_recibo = $recibo;
             $tipo_de_poliza = $xRec->getOTipoRecibo()->getTipoPolizaContable();
             $fecha_de_poliza = $xRec->getFechaDeRecibo();
             $ejercicio_de_poliza = $xD->anno();
             $periodo_de_poliza = $xD->mes();
             $recibo_fiscal = strlen($xRec->getReciboFiscal()) > 2 ? ";RF:" . $xRec->getReciboFiscal() : "";
             $observacion_recibo = $xRec->getObservaciones();
             $cheque = strlen($xRec->getNumeroDeCheque()) > 2 ? ";Ch:" . $xRec->getNumeroDeCheque() : "";
             $concepto_poliza = substr("R:" . $numero_de_recibo . $recibo_fiscal . $cheque . ";" . $xRec->getObservaciones(), 0, 80);
             $flujo_efectivo = $xRec->getOTipoRecibo()->getAfectacionEnEfvo();
             $socio = $xRec->getCodigoDeSocio();
             $propietario = $xRec->getCodigoDeUsuario();
             $xLogg->add("=====\tRECIBO TIPO: " . $xRec->getTipoDeRecibo() . " SUMA: " . $xRec->getTotal() . " \r\n", $xLogg->DEVELOPER);
             //------------------ Agregar Poliza
             $xPol = new cPoliza($tipo_de_poliza, false, $ejercicio_de_poliza, $periodo_de_poliza);
             $xPol->add($concepto_poliza, $fecha_de_poliza, false, 0, 0, $propietario, $centro_de_costo, $recibo);
             $numero_de_poliza = $xPol->get();
             $xLogg->add("=====\tPOLIZA NUM: {$numero_de_poliza} | TIPO: {$tipo_de_poliza} | EJERCICIO: {$ejercicio_de_poliza} | PERIODO: {$periodo_de_poliza}\r\n", $xLogg->DEVELOPER);
             $sucess = $xPol->mRaiseError == true ? false : true;
             //------------------ Leer la PROFORMA
             $sqlMvtosToPoliza = "SELECT\r\n\t\t\t\t\t`contable_polizas_proforma`.*,\r\n\t\t\t\t\t`operaciones_tipos`.*\r\n\t\t\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t`operaciones_tipos` `operaciones_tipos`\r\n\t\t\t\t\t\tINNER JOIN `contable_polizas_proforma`\r\n\t\t\t\t\t\t`contable_polizas_proforma`\r\n\t\t\t\t\t\tON `operaciones_tipos`.`idoperaciones_tipos` =\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`tipo_de_mvto`\r\n\t\t\t\t\t\tAND `contable_polizas_proforma`.`numero_de_recibo` = {$numero_de_recibo}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`contable_operacion` DESC,\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`socio`,\r\n\t\t\t\t\t\t`contable_polizas_proforma`.`tipo_de_mvto`\t\t\t\t\r\n\t\t\t\t\t";
             if ($sucess == true) {
                 $rs = $QL->getDataRecord($sqlMvtosToPoliza);
                 foreach ($rs as $rw) {
                     $cuenta = CUENTA_DE_CUADRE;
                     $nombre = "";
                     $socio = $rw["socio"];
                     if (CONTABLE_CUENTAS_POR_SOCIO == true) {
                         $xSoc = new cSocio($socio, true);
                         $nombre = $xSoc->getNombreCompleto();
                     }
                     $documento = $rw["documento"];
                     $monto_movimiento = $rw["monto"];
                     $tipoOp = $rw["tipo_de_mvto"];
                     $tipo_movimiento = $rw["contable_operacion"];
                     $RecUsr = $rw["idusuario"];
                     $cuenta_bancaria = $rw["banco"];
                     $cargo_movimiento = 0;
                     $abono_movimiento = 0;
                     if ($tipo_movimiento == TM_CARGO) {
                         $cargo_movimiento = $monto_movimiento;
                         $abono_movimiento = 0;
                     } else {
                         $cargo_movimiento = 0;
                         $abono_movimiento = $monto_movimiento;
                     }
                     $formula = $rw["cuenta_contable"];
                     //Corregir de urgencia: OK: 06Oct2011
                     $sForms = new cValorarFormulas();
                     $cuenta = $sForms->getCuentaContable($socio, $documento, $formula, $RecUsr, $xRec->getNumeroDeCheque(), $cuenta_bancaria);
                     $xLogg->add($sForms->getMessages(), $xLogg->DEVELOPER);
                     //tipo de cuenta es Abonos a efectivo
                     if ($cuenta != "NO_CONTABILIZAR") {
                         $xCuenta = new cCuentaContable($cuenta);
                         $xCuenta->init();
                         $cuenta = $xCuenta->get();
                         //Carga los datos del Oficial
                         if ($xCuenta->getEsCuentaDeCirculante() == true) {
                             $xOf = new cSystemUser($RecUsr);
                             $xOf->init();
                             $nombre = $xOf->getNombreCompleto();
                             $xLogg->add("OK\tCUENTA_ADD\tLa Cuenta {$cuenta} de Carga por Usuario [ {$nombre} ]\r\n", $xLogg->DEVELOPER);
                         } else {
                             $xLogg->add("OK\tCUENTA\tLa Cuenta de Trabajo es {$cuenta} Originado del Socio {$socio}\r\n", $xLogg->DEVELOPER);
                         }
                         //verifica para dar de alta a la cuenta
                         $Existentes = $xCuenta->getCountCuenta();
                         if ($Existentes == false) {
                             $xLogg->add("WARN\tCUENTA_ADD\tLa Cuenta de Trabajo {$cuenta} NO EXISTE, se AGREGA\r\n", $xLogg->DEVELOPER);
                             $cuenta = $xCuenta->add($nombre);
                             if ($xCuenta->mRaiseError == true) {
                                 //$msg				.= "ERROR\tLa Cuenta de Trabajo $cuenta NO EXISTE\r\n";
                                 //$msg		= $xCuenta->getMessages();
                             }
                         }
                         $xCuenta->init();
                         $xPol->addMovimiento($cuenta, $cargo_movimiento, $abono_movimiento, "{$socio}", "{$documento}:{$tipoOp}", false, $fecha_de_poliza);
                         //$xLogg->add("WARN\tNO_CONT\tAGREGAR $cuenta, $cargo_movimiento, $abono_movimiento\r\n" , $xLogg->DEVELOPER);
                         $xLogg->add($xCuenta->getMessages(), $xLogg->DEVELOPER);
                     } else {
                         $xLogg->add("WARN\tNO_CONT\tEl Movimiento de {$socio} | {$documento} | {$tipoOp} de Monto {$monto_movimiento} se OMITE\r\n", $xLogg->DEVELOPER);
                     }
                 }
                 $xPol->setFinalizar();
             }
             //sucess
             $xLogg->add($xPol->getMessages(), $xLogg->DEVELOPER);
             $this->mIDDePoliza = $xPol->getCodigo();
         }
     }
     //END VALUE.- GENERAR AL FINAL
     //}		//END VALUE.- GENERAR CONTABILIDAD
     $this->mMessages .= $xLogg->getMessages();
     return $xLogg->getMessages();
 }
             $interes_normal_pagado = 0;
             $ultima_parcialidad = $letra - 1;
             //Regresa a la parcialidad anterior
         } else {
             $interes_normal_pagado = $interes_normal_pagado - $parcialidad_interes;
             $interes_normal_pagado = $interes_normal_pagado < 0 ? 0 : $interes_normal_pagado;
             $parcialidad_interes = 0;
             //setea a cero
             if ($interes_normal_pagado == 0) {
                 $ultima_parcialidad = $letra;
             }
         }
         $parcialidad_iva = PLAN_DE_PAGOS_SIN_REDONDEO == true ? $parcialidad_interes * $tasa_iva : round($parcialidad_interes * $tasa_iva, 2);
         $total_parcial = $total_parcial + ($parcialidad_interes + $parcialidad_iva);
         //Sumar el interes que resta
         $total_parcial = setNoMenorQueCero($total_parcial);
     }
 }
 $xPlan->setMontoOperado($total_parcial);
 $total_parcial = $xPlan->addMvtoDeInteres($parcialidad_interes, $fecha_de_pago, $letra);
 $total_parcial = $xPlan->addMvtoOtros($parcialidad_cargo, $fecha_de_pago, $letra, $tipo_monto_extra, true);
 $total_parcial = $xPlan->addMvtoDeIVA($fecha_de_pago, $letra);
 $total_parcial = $xPlan->addMvtoDeAhorro($parcialidad_ahorro, $fecha_de_pago, $letra);
 //Capital
 $parcialidad_capital = $total_parcial;
 $msgPIE .= "ADD\t{$parcialidad_interes}\t{$parcialidad_cargo}\t{$parcialidad_ahorro}\t{$parcialidad_capital}\r\n";
 if ($parcialidad_capital > 0) {
     //evaluar el Plan de Pagos
     $monto_capital_de_la_parcialidad = 0;
     switch ($FormaDePago) {
         //SI esCAPITAL + INTERES Periodico
$TipoDeAutorizacion = false;
$esrenovado = parametro("idrenovado", false, MQL_BOOL);
$tieneprops = parametro("idpropietario", false, MQL_BOOL);
//propietarios reales
$tieneprovs = parametro("idproveedor", false, MQL_BOOL);
//proveedores de recursos
$fecha_solicitud = $xFecha->getFechaISO($solicitado);
$fecha_ministracion = $xFecha->getFechaISO($ministrado);
$fecha_vencimiento = $xFecha->getFechaISO($vencido);
$oficial_de_credito = getUsuarioActual();
$xBtn = new cHButton();
$xFRM = new cHForm("frmcreditoautorizado");
$xFRM->setTitle($xHP->getTitle());
$xHP->init();
//Correccciones
$contrato_corriente = setNoMenorQueCero($contrato_corriente) <= 0 ? DEFAULT_CUENTA_CORRIENTE : $contrato_corriente;
$xSoc = new cSocio($persona);
$arrDatos = array("periocidad_de_pago" => $periocidad, "tipo_de_producto" => $tipoconvenio, "numero_de_pagos" => $numeropagos, "contrato_corriente_relacionado" => $contrato_corriente, "fecha_de_ministracion" => $ministrado, "fecha_de_vencimiento" => $vencido, "monto_solicitado" => $monto_solicitado);
$sucess = true;
if ($xSoc->isOperable() == true) {
    $sucess = $xSoc->setPrevalidarCredito($arrDatos);
    if ($xSoc->getUUID() != $_SESSION[SYS_UUID]) {
        $msg .= "ERROR\tEl credito Validado no es el mismo que intenta guardar(" . $xSoc->getUUID() . "|" . $_SESSION[SYS_UUID] . ")\r\n";
        $sucess = false;
    }
} else {
    $sucess = false;
}
if ($sucess == true) {
    $grupo_asociado = $xSoc->getClaveDeGrupo();
    if ($periocidad == CREDITO_TIPO_PERIOCIDAD_FINAL_DE_PLAZO) {
$jxc->exportFunction('jsaValidarPerfilTransaccional', array('idsocio'), "#fb_extrasocios");
$jxc->exportFunction('jsaAddDescuento', array('idsocio', 'iddescuento'), "#fb_extrasocios");
$jxc->exportFunction('jsaAddDescuentoDesdeEmpresa', array('idmodificado', 'idcantidad'), "#fb_extrasocios");
$jxc->exportFunction('jsaSetEnviarParaAsociada', array('idsocio'), "#fb_extrasocios");
$jxc->exportFunction('jsaActualizarEmpresa', array('idempresa'), "#fb_extrasocios");
$jxc->exportFunction('jsaActualizarSucursal', array('idsucursal'), "#fb_extrasocios");
$jxc->exportFunction('jsaActualizarUsuario', array('idusuario'), "#fb_extrasocios");
$jxc->process();
$xHP->addJsFile("../jsrsClient.js");
echo $xHP->getHeader();
echo $xJsB->setIncludeJQuery();
//$xJsB	= new jsBasicForm("extrasocios");
?>
<body>
<?php 
if (setNoMenorQueCero($idsocio) <= DEFAULT_SOCIO) {
    $xFRM = new cHForm("extrasocios", "socios.panel.frm.php");
    $xBtn = new cHButton();
    $xTxt = new cHText();
    $xFRM->setTitle($xHP->getTitle());
    $xFRM->addPersonaBasico();
    $xFRM->addSubmit();
    echo $xFRM->get();
} else {
    $xSoc = new cSocio($idsocio, true);
    $xHTabs = new cHTabs();
    $xBtn = new cHButton("");
    $oFrm = new cHForm("extrasocios", "");
    $xHSel = new cHSelect();
    $oFrm->OButton("TR.Recargar", "jsRecargar()", $oFrm->ic()->RECARGAR);
    $oFrm->addHTML($xSoc->getFicha(true));
     if (setNoMenorQueCero($idrecibocap) > 0) {
         $xRecCapt = new cReciboDeOperacion(false, false, $idrecibocap);
         $xRecCapt->init();
         if ($xRecCapt->setFinalizarRecibo(true) == true) {
             $xFRM->OButton("TR.Recibo de Abono", "jsImprimirReciboCapital()", "imprimir");
             $xFRM->addHTML($xRecCapt->getJsPrint(true, "jsImprimirReciboCapital"));
             //finalizar tesoreria
             $xRecCapt->setFinalizarTesoreria(array("cuenta" => $cuenta_cheques, "cheque" => $cheque));
         }
         $msg .= MODO_DEBUG == true ? $xRecCapt->getMessages() : "";
     }
 }
 if ($montocomision > 0) {
     $xRec = new cReciboDeOperacion();
     $idrecibo = $xRec->setNuevoRecibo($idsocio, $idsolicitud, $fecha, 1, RECIBOS_TIPO_OINGRESOS, $observaciones, $cheque, TESORERIA_COBRO_DESCTO, $recibo_fiscal);
     if (setNoMenorQueCero($idrecibo) > 0) {
         $montocomision = round($montocomision * (1 / (1 + TASA_IVA)), 2);
         $montoivacomi = round($montocomision * TASA_IVA, 2);
         $xRec->setNuevoMvto($fecha, $montocomision, OPERACION_CLAVE_COMISION_APERTURA, 1, $observaciones, 1, TM_CARGO, $idsocio);
         $xRec->setNuevoMvto($fecha, $montoivacomi, OPERACION_CLAVE_PAGO_IVA_OTROS, 1, $observaciones, 1, TM_CARGO, $idsocio);
         //$xRec->addMvtoContableByTipoDePago($montocomision, TM_CARGO);
         if ($xRec->setFinalizarRecibo(true) == true) {
             $xFRM->OButton("TR.Recibo de Comisiones", "jsImprimirRecibo()", "imprimir");
             $xFRM->addHTML($xRec->getJsPrint(true));
             $xRec->setFinalizarTesoreria(array("cuenta" => $cuenta_cheques, "cheque" => $cheque));
         }
         $msg .= MODO_DEBUG == true ? $xRec->getMessages() : "";
     }
 }
 //Buttons
 $xFRM->OButton("TR.VER/IMPRIMIR PAGARE DE CREDITO", "printpagare();", "imprimir", 'id1');
 $ficha_socio = $cSoc->getFicha();
 $numero_credito = $rw["credito"];
 $xCred = new cCredito($numero_credito, $numero_de_socio);
 $xCred->init();
 $DCred = $xCred->getDatosInArray();
 $svar_info_cred = $xCred->getShortDescription();
 $variable_lugar = "";
 $monto_inicial = 0;
 $monto_inicial_letras = 0;
 $numero_dias = 0;
 $variable_fecha_vencimiento = "";
 $nombre_mancomunados = "";
 $variable_tasa_otorgada = "";
 $monto_parcialidad = $rw["monto"];
 $TCobros += $monto_parcialidad;
 $numero_parcialidad = setNoMenorQueCero($rw["letra"]) == 0 ? 1 : $rw["letra"];
 $numero_de_pagos = $rw["pagos"];
 //$DCred[""];
 $periocidad_titulo = $xTPer->getNombre();
 $tipo_de_credito = "";
 $monto_ministrado = "";
 $DOficial = $xCred->getDatosOficialDeCredito_InArray();
 $oficial = $DOficial["nombre_completo"];
 $variable_oficial = $DOficial["nombre_completo"];
 $fecha_de_vencimiento = "";
 $tasa_interes_mensual_ordinario = "";
 $tasa_garantia_liquida = "";
 $tasa_interes_mensual_moratorio = 0;
 $fecha_de_ministracion = "";
 //cargar Datos de la Empresa
 $vars = array("variable_nombre_del_socio" => $cSoc->getNombreCompleto(), "variable_nombre_de_la_sociedad" => EACP_NAME, "variable_nombre_de_la_entidad" => EACP_NAME, "variable_domicilio_del_socio" => trim(substr($cSoc->getDomicilio(), 0, 60)), "variable_documento_de_constitucion_de_la_sociedad" => EACP_DOCTO_CONSTITUCION, "variable_rfc_de_la_entidad" => EACP_RFC, "variable_rfc_del_socio" => $DSoc["rfc"], "variable_curp_del_socio" => $DSoc["curp"], "variable_nombre_del_representante_legal_de_la_sociedad" => EACP_REP_LEGAL, "variable_informacion_del_credito" => $svar_info_cred, "variable_domicilio_de_la_entidad" => EACP_DOMICILIO_CORTO, "variable_acta_notarial_de_poder_al_representante" => EACP_DOCTO_REP_LEGAL, "variable_numero_de_socio" => $numero_de_socio, "variable_tipo_de_credito" => $tipo_de_credito, "variable_monto_ministrado" => getFMoney($monto_ministrado), "variable_tasa_mensual_de_interes_ordinario" => $tasa_interes_mensual_ordinario, "variable_credito_fecha_de_vencimiento" => getFechaLarga($fecha_de_vencimiento), "variable_tasa_mensual_de_interes_moratorio" => $tasa_interes_mensual_moratorio . " %", "variable_tasa_de_garantia_liquida" => $tasa_garantia_liquida . " %", "variable_horario_de_trabajo_de_la_entidad" => EACP_HORARIO_DE_TRABAJO, "variable_testigo_del_acto" => $oficial, "variable_fecha_larga_actual" => fecha_larga(), "variable_nombre_de_presidente_de_vigilancia_de_la_entidad" => EACP_PDTE_VIGILANCIA, "variable_en_letras_monto_ministrado" => convertirletras($monto_ministrado), "variable_credito_fecha_de_ministracion" => getFechaLarga($fecha_de_ministracion), "variable_informacion_del_socio" => $ficha_socio, "variable_oficial" => $variable_oficial, "variable_lugar" => $variable_lugar, "variable_lugar_actual" => $variable_lugar, "variable_monto_inicial_en_numero" => $monto_inicial, "variable_monto_inicial_en_letras" => $monto_inicial_letras, "variable_numero_de_dias" => $numero_dias, "variable_fecha_de_vencimiento" => $variable_fecha_vencimiento, "variable_tasa_otorgada" => $variable_tasa_otorgada, "variable_nombre_empresa" => $nempresa, "variable_numero_de_pagos" => $numero_de_pagos, "variable_numero_parcialidad_actual" => $numero_parcialidad, "variable_monto_parcialidad" => getFMoney($monto_parcialidad), "variable_monto_letras_parcialidad" => convertirletras($monto_parcialidad), "variable_encabezado_de_reporte" => getRawHeader(false, $out), "variable_pie_de_reporte" => getRawFooter(false, $out), "variable_paginas" => $contar);
 function __construct($clave = false)
 {
     $this->mClave = $clave;
     $this->mDestinoInt = CAPTACION_DESTINO_CTA_INTERES;
     if (setNoMenorQueCero($this->mClave) > 0) {
         $this->init();
     }
 }
    $xFRM->OMoneda("idmontomulta", 0, "TR.Monto de Multa", true);
    $xFRM->addGuardar();
} else {
    $xT = new cTipos();
    //===========================================================================
    $idsocio = isset($_POST["idsocio"]) ? $xT->cInt($_POST["idsocio"]) : 0;
    $observaciones = isset($_POST["idconceptomulta"]) ? $xT->cChar($_POST["idconceptomulta"]) : "";
    $monto = isset($_POST["idmontomulta"]) ? $xT->cFloat($_POST["idmontomulta"]) : 0;
    $cheque = isset($_POST["cheque"]) ? $xT->cChar($_POST["cheque"]) : DEFAULT_CHEQUE;
    $comopago = isset($_POST["ctipo_pago"]) ? $xT->cChar($_POST["ctipo_pago"]) : DEFAULT_TIPO_PAGO;
    $foliofiscal = isset($_POST["foliofiscal"]) ? $xT->cChar($_POST["foliofiscal"]) : DEFAULT_RECIBO_FISCAL;
    if (setNoMenorQueCero($idsocio) <= 0) {
        //header("location: frmcobrodemultas.php?msg=FALTAN_DATOS");
        $xFRM->addAvisoRegistroError();
    } else {
        if (setNoMenorQueCero($monto) <= 0) {
            $xFRM->addAvisoRegistroError();
        } else {
            $iddocto = DEFAULT_CREDITO;
            $xRec = new cReciboDeOperacion(RECIBOS_TIPO_TERCEROS, false, false);
            $xRec->setGenerarBancos();
            $xRec->setGenerarPoliza();
            $xRec->setGenerarTesoreria();
            $idrecibo = $xRec->setNuevoRecibo($idsocio, $iddocto, $fecha, 1, RECIBOS_TIPO_TERCEROS, $observaciones, $cheque, $comopago, $foliofiscal);
            $xRec->setNuevoMvto($fecha, $monto, OPERACION_CLAVE_MULTAS, 1, $observaciones, 1, TM_ABONO, $idsocio);
            $xRec->addMvtoContableByTipoDePago($monto, TM_CARGO);
            $xRec->setFinalizarRecibo(true);
            $xFRM->addHTML($xRec->getFichaSocio());
            $xFRM->addHTML($xRec->getFicha());
            $xFRM->addPrintRecibo();
            $xFRM->addHTML($xRec->getJsPrint(true));
 if ($xFil->processFile($doc1) == true) {
     $data = $xFil->getData();
     $linea = 0;
     foreach ($data as $valores => $cont) {
         //
         if ($linea == 0) {
         } else {
             $idlocalidad = $cont[0];
             $nombrelocal = $xT->setNoAcentos($cont[1]);
             $estadolocal = $cont[2];
             $paislocal = $cont[3];
             $idestadoloc = $xT->cInt($cont[4]);
             //cosulta de pais
             $municipio = EACP_CLAVE_DE_MUNICIPIO;
             $estado = EACP_CLAVE_DE_ENTIDADFED;
             if (setNoMenorQueCero($idestadoloc) == 0) {
                 $D = obten_filas("SELECT * FROM general_estados WHERE nombre LIKE '%{$estadolocal}%' LIMIT 0,1");
                 if (isset($D["clave_numerica"])) {
                     $idestadoloc = $D["clave_numerica"];
                 }
             }
             //calcular pais
             $D = obten_filas("SELECT * FROM `personas_domicilios_paises` WHERE `nombre_oficial` LIKE '%{$paislocal}%' LIMIT 0,1");
             if (isset($D["clave_de_control"])) {
                 $paislocal = $D["clave_de_control"];
             } else {
                 $paislocal = EACP_CLAVE_DE_PAIS;
             }
             $xLoc = new cCatalogos_localidades();
             $xLoc->altitud(0);
             $xLoc->clave_de_estado($idestadoloc);
$xTa->addTH("Servicios");
$xTa->addTH("Monto Otorgado");
$xTa->addTH("Monto Actual");
$xTa->addTH("Perfil Transaccional");
$xTa->addTH("Numero Maximo de Operaciones");
$xTa->addTH("Monto Maximo de Operaciones");
$xTa->endRow();
$xT = new cFileImporter();
$xClean = new cTiposLimpiadores();
foreach ($rs as $rows) {
    $xDSoc->setData($rows);
    $codigo_de_socio = $xDSoc->codigo()->v();
    $xSoc = new cSocio($codigo_de_socio);
    $xSoc->init($rows);
    $xSoc->getOEstats()->initDatosDeCredito();
    $saldoCred = setNoMenorQueCero($xSoc->getCreditosComprometidos());
    if ($saldoCred > 0) {
        $xTa->initRow();
        $xTa->addTD($xSoc->getSucursal());
        $xTa->addTD(htmlentities($xSoc->getApellidoPaterno()));
        $xTa->addTD(htmlentities($xSoc->getApellidoMaterno()));
        $xTa->addTD($xSoc->getNombre());
        $genero = isset($DGenero[$xSoc->getGenero()]) ? $DGenero[$xSoc->getGenero()] : "";
        $xTa->addTD($genero);
        $xTa->addTD($xF->getFechaMX($xSoc->getFechaDeNacimiento()));
        $pais = isset($DPaises[$xSoc->getPaisDeOrigen()]) ? $DPaises[$xSoc->getPaisDeOrigen()] : "";
        $xTa->addTD(htmlentities($pais));
        $xTa->addTD(htmlentities($xSoc->getLugarDeNacimiento()));
        $xTa->addTD("MEXICANA");
        $xTa->addTD($xSoc->getRFC());
        $xOAE = $xSoc->getOActividadEconomica();
}
if ($SUMIva == 0) {
    $thIVA = "";
    $tfIVA = 0;
}
foreach ($arrLetras as $parcial => $dat) {
    $txt = "<tr><th>" . $parcial . "</th>";
    $txt .= isset($dat[SYS_FECHA]) ? "<td>" . $xF->getDayName($dat[SYS_FECHA]) . "|" . $xF->getFechaCorta($dat[SYS_FECHA]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_CAPITAL]) ? "<td class='mny'>" . getFMoney($dat[SYS_CAPITAL]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_INTERES_NORMAL]) ? "<td class='mny'>" . getFMoney($dat[SYS_INTERES_NORMAL]) . "</td>" : "<td />";
    $txt .= isset($dat[SYS_GASTOS_DE_COBRANZA]) ? "<td class='mny'>" . getFMoney($dat[SYS_GASTOS_DE_COBRANZA]) . "</td>" : "";
    $txt .= isset($dat[SYS_IMPUESTOS]) ? "<td class='mny'>" . getFMoney($dat[SYS_IMPUESTOS]) . "</td>" : "";
    $txt .= isset($dat[SYS_AHORRO]) ? "<td class='mny'>" . getFMoney($dat[SYS_AHORRO]) . "</td>" : "";
    $txt .= "<td class='mny'>" . getFMoney($dat[SYS_TOTAL]) . "</td>";
    $netoNivel -= $dat[SYS_TOTAL];
    $txt .= "<th class='mny'>" . getFMoney($netoNivel) . "</th>";
    $txt .= "<tr>";
    $tmpcap = isset($dat[SYS_CAPITAL]) ? $dat[SYS_CAPITAL] : 0;
    if (setNoMenorQueCero($tmpcap) > 0 or $pagoactual == 0 or $xCred->getPagosSinCapital() == true) {
        $trs .= $txt;
    }
}
//<th>" . $xHP->lang("dia") . "</th>
$PlanBody .= "<table class='listado'>\n  <thead>\n    <tr>\n      <th>" . $xHP->lang("pago") . "</th>\n      \n      <th>" . $xHP->lang("fecha de", "pago") . "</th>\n      <th>" . $xHP->lang("capital") . "</th>\n      <th>" . $xHP->lang("interes") . "</th>\n      {$thOtros}\n      {$thIVA}\n     {$thAhorro}\n      <th>" . $xHP->lang("total") . "</th>\n      <th>" . $xHP->lang("saldo") . "</th>\n    </tr>\n    </thead>\n    <tbody>\n    {$trs}\n\t\n    <tr>\n      <td colspan='2'>" . $xHP->lang("sumas") . "</td>\n      <th class='mny'>" . getFMoney($SUMCap) . "</th>\n      <th class='mny'>" . getFMoney($SUMInt) . "</th>\n      {$tfOtros}\n      \n      {$tfIVA}\n      {$tfAhorro}\n      <th class='mny'>" . getFMoney($SumTotal) . "</th>\n      <td />\n    </tr>\n      \t\n\n    \n    </tbody>\n</table>";
$PlanBody .= "\n\t<table >\n\t<tr>\n\t<td><center>" . $xHP->lang("firma del", "solicitante") . "</td>\n\t<td><center>" . $xHP->lang("por la", "empresa") . "</center></td>\n\t</tr>\n\t<tr>\n\t<td>\n\t\t<br />\n\t\t<br />\n\t\t<br />\n\t</td>\n\t</tr>\n\t<tr>\n\t<td><center>{$nombre}</center></td>\n\t<td><center>{$oficial}</center></td>\n\t</tr>\n\t<tr>\n\t\t<th>" . $xHP->lang("observaciones") . "</th><td>{$observaciones}</td>\n\t</tr>\n\t</table>";
echo $PlanBody;
echo getRawFooter();
?>
</body>
</html>
 function getValor()
 {
     return setNoMenorQueCero($this->mObj->quivalencia_en_moneda_local()->v());
 }
            },
            ocupacion: {
                title: 'Ocupacion',
                width: '20%'
            },
            domicilio: {
                title: 'Domicilio',
                width: '30%'
            }
        }
    });
    	
});
function jsGuardarReferencia(){
	var idxpersona		= "<?php 
echo setNoMenorQueCero($persona);
?>
";
	var idpersona			= idxpersona;
	var idrelacionado		= $("#idpersona").val();
	var idtipoderelacion	= $("#idtipoderelacion").val();
	var idtipodeparentesco	= $("#idtipodeparentesco").val();
	var stat				= $('#depende').prop('checked');
	xPer.addRelacion({ persona : idpersona, relacionado : idrelacionado, tipo : idtipoderelacion, parentesco : idtipodeparentesco, depende : stat, callback : jsRefreshTable });
	$("#idpersona").val(0);
}
function jsRefreshTable(){ 
	$('#ListaDeRelaciones').jtable('load');
}
function onCloseVentanaRelaciones(){ jsRefreshTable(); }
 function add($persona, $tipo, $fecha, $valor, $documento, $tipo_de_documento = false, $usuario = false, $hora = false, $instrumento = false, $tipo_de_operacion = false, $tercero_relacionado = DEFAULT_SOCIO, $mensajes = "", $inmediato = false)
 {
     $hora = $hora == false ? date("Hi") : $hora;
     $usuario = $usuario == false ? getUsuarioActual() : $usuario;
     $tipo_de_documento = $tipo_de_documento == false ? iDE_RECIBO : $tipo_de_documento;
     $instrumento = setNoMenorQueCero($instrumento);
     if ($instrumento <= 0 or setNoMenorQueCero($tipo_de_operacion) <= 0) {
         switch ($tipo_de_documento) {
             case iDE_RECIBO:
                 $EqOps = new cSistemaEquivalencias(TOPERACIONES_RECIBOSTIPOS);
                 $EqTes = new cSistemaEquivalencias(TTESORERIA_TIPOS_DE_PAGO);
                 $xRec = new cReciboDeOperacion(false, false, $documento);
                 $instrumento = $EqTes->get($xRec->getTipoDePago());
                 $tipo_de_operacion = $EqOps->get($xRec->getTipoDeRecibo());
                 if ($xRec->isDivisaExtranjera() == true) {
                     $instrumento = AML_OPERACIONES_CLAVE_DIVISA;
                 }
                 if ($tipo_de_operacion == null) {
                     $tipo_de_operacion = "01";
                 }
                 break;
         }
     }
     if ($inmediato == true) {
         $inmediato = 1;
     }
     $inmediato = setNoMenorQueCero($inmediato);
     $xPR = new cAml_risk_register();
     $xPR->clave_de_riesgo($xPR->query()->getLastID());
     $xPR->escore($valor);
     $xPR->fecha_de_reporte($fecha);
     $xPR->hora_de_reporte($hora);
     $xPR->persona_relacionada($persona);
     $xPR->tipo_de_riesgo($tipo);
     $xPR->usuario_de_origen($usuario);
     $xPR->tipo_de_documento($tipo_de_documento);
     $xPR->documento_relacionado($documento);
     $xPR->estado_de_envio(SYS_UNO);
     $xPR->fecha_de_envio(0);
     $xPR->estado_de_envio(0);
     $xPR->fecha_de_checking(0);
     $xPR->oficial_de_checking(AML_OFICIAL_DE_CUMPLIMIENTO);
     $xPR->monto_total_relacionado(0);
     //cargar datos del recibo
     $xPR->instrumento_financiero($instrumento);
     //mejorar segun catalogo CNBV
     $xPR->tipo_de_operacion($tipo_de_operacion);
     $xPR->tercero_relacionado($tercero_relacionado);
     $xPR->mensajes_del_sistema($mensajes);
     $xPR->reporte_inmediato($inmediato);
     $ql = $xPR->query()->insert();
     $ql->save();
     $this->mMessages .= $ql->getMessages(OUT_TXT);
 }
        //sucess
        //eliminar anteriores
        $sqlNS = "SELECT getSaldoPendienteDesdeLetra({$credito}, ({$letra}-1)) AS 'saldo_anterior' ";
        $sdo_anterior = mifila($sqlNS, "saldo_anterior");
        $xO = new cEmpresas_cobranza();
        $idoriginal = $xO->query()->getLastID();
        $xO->idempresas_cobranza($idoriginal);
        $xO->clave_de_credito($credito);
        $xO->clave_de_nomina($idnomina);
        $xO->monto_enviado($monto);
        $xO->observaciones($notas);
        $xO->parcialidad($letra);
        $xO->saldo_inicial($sdo_anterior);
        $action = $xO->query()->insert();
        $id = $action->save();
        if (setNoMenorQueCero($id) > 0) {
            $rs["error"] = false;
            $rs["message"] = "Registro guardado con el ID {$id}-{$idoriginal}";
            $rs["credito"] = $credito;
        } else {
            $rs["error"] = true;
            $rs["credito"] = $credito;
            $rs["message"] = $action->getMessages();
        }
    } else {
        $rs["error"] = true;
        $rs["message"] = "credito invalido {$credito} ";
    }
}
header('Content-type: application/json');
echo json_encode($rs);
     $xTa->addTD(" ");
 } else {
     $idclave = $xOAE->getClaveDeActividad();
     $actividad = isset($DActividades[$idclave]) ? htmlentities($DActividades[$idclave]) : "";
     $actividad = strtoupper($xT->cleanString($actividad));
     $actividad = $actividad == "DESCONOCIDO_MIGRADO" ? "" : $actividad;
     $xTa->addTD($actividad);
     //$xTa->addTD( $xOAE->getPuesto(true) );
 }
 $xViv = $xSoc->getODomicilio();
 if ($xViv == null) {
     $xTa->addTD(" ");
 } else {
     $xTa->addTD(htmlentities($xViv->getDireccionBasica()));
 }
 $tel = setNoMenorQueCero($xSoc->getTelefonoPrincipal()) <= 0 ? "" : $xSoc->getTelefonoPrincipal();
 $xTa->addTD($tel);
 //apoderado
 $xTa->addTD($xSoc->getNombreDelRepresentanteLegal());
 $esPep = $xSoc->getEsPersonaPoliticamenteExpuesta() == false ? "NO" : "SI";
 $xTa->addTD($esPep);
 $esSDN = $xSoc->getEsPersonaSDN() == false ? "NO" : "SI";
 $xTa->addTD($esSDN);
 $griesgo = isset($DRiesgo[$xSoc->getNivelDeRiesgo()]) ? $DRiesgo[$xSoc->getNivelDeRiesgo()] : "";
 $xTa->addTD($griesgo);
 if ($saldoCred > 0) {
     $xTa->addTD("CREDITO");
     $xTa->addTD($xSoc->getOEstats()->getTotalCreditosActivosAutorizado());
     $xTa->addTD($saldoCred);
 } else {
     $xTa->addTD(" ");
 function init($arrDatos = false)
 {
     if (is_array($arrDatos)) {
         $this->mDataArray = $arrDatos;
     } else {
         $this->mDataArray = obten_filas("SELECT * FROM `tesoreria_cajas_movimientos` WHERE `idtesoreria_cajas_movimientos` =" . $this->mCodigo . " LIMIT 0,1");
     }
     //if($this->mObj	== null){
     $this->mObj = new cTesoreria_cajas_movimientos($this->mDataArray);
     //}
     if (setNoMenorQueCero($this->mCodigo) <= 0) {
         $this->mCodigo = $this->mObj->idtesoreria_cajas_movimientos()->v();
     }
     $this->mObj->setData($this->mDataArray);
     $this->mClaveDeBanco = $this->mObj->cuenta_bancaria()->v();
     $this->mCodigoDeRecibo = $this->mObj->recibo()->v();
 }