function RegistrarSuce($params)
{
    $db = new ConSQL();
    $db->connect();
    $objFormato = new cFormato();
    $objFormato->llenar($params);
    $db->beginTransacction();
    $res = $objFormato->insertar($db);
    if ($res != null) {
        $db->commit();
        $msj = array("codigo" => "OK", "texto" => "Exito");
    } else {
        error_log("Entidad.WebServices ServicioEntidad->RegistrarSuce failed");
        $db->rollback();
        $msj = array("codigo" => "ERROR", "texto" => "No se pudo insertar: ");
    }
    return $msj;
}
 function sendAlerts($PersonaDeOrigen, $PersonaDeDestino, $TipoDeAlerta, $mensaje = "", $documento = false, $fecha = false, $hora = false, $valorDeterminado = 0, $tipo_de_docto = false, $tercero_relacionado = DEFAULT_SOCIO)
 {
     $hora = setNoMenorQueCero($hora) <= 0 ? date("Hi") : $hora;
     $fecha = $fecha == false ? fechasys() : $fecha;
     $documento = $documento == false ? DEFAULT_RECIBO : $documento;
     $tipo_de_docto = $tipo_de_docto == false ? $this->mTipoDeDocto : $tipo_de_docto;
     $this->mTipoDeDocto = $tipo_de_docto;
     $resultado = true;
     $xRsk = new cAml_risk_catalog();
     $xSuc = new cSucursal();
     $xSuc->init();
     $idnumerico = $xSuc->getClaveNumerica();
     $xRsk->setData($xRsk->query()->initByID($TipoDeAlerta));
     $riesgo = $xRsk->valor_ponderado()->v();
     $nombreRies = $xRsk->descripcion()->v();
     $claseRies = $xRsk->tipo_de_riesgo()->v();
     $valorDeterminado = $valorDeterminado == 0 ? $xRsk->valor_ponderado()->v() : $valorDeterminado;
     $xF = new cFecha();
     $fecha = $xF->getInt($fecha);
     $xAl = new cAml_alerts();
     $xAl->estado_en_sistema(SYS_UNO);
     $xAl->fecha_de_checking(SYS_CERO);
     $xAl->fecha_de_origen($fecha);
     $xAl->fecha_de_registro($xF->getInt(fechasys()));
     $xAl->hora_de_proceso($hora);
     $xAl->documento_relacionado($documento);
     $xAl->medio_de_envio(AML_ALERT_MAIL);
     $xAl->mensaje($mensaje);
     $xAl->riesgo_calificado($valorDeterminado);
     $xAl->tipo_de_aviso($TipoDeAlerta);
     $xAl->sucursal($idnumerico);
     //Verificar
     $xAl->entidad(EACP_CLAVE_CASFIN);
     //Actualizar
     $xAl->usuario(getUsuarioActual());
     $xAl->persona_de_destino($PersonaDeDestino);
     $xAl->persona_de_origen($PersonaDeOrigen);
     $xAl->tipo_de_documento($tipo_de_docto);
     $xAl->tercero_relacionado($tercero_relacionado);
     $id_de_alerta = $xAl->query()->getLastID();
     $xAl->clave_de_control($id_de_alerta);
     $ql = $xAl->query()->insert();
     $res = $ql->save();
     if (setNoMenorQueCero($res) <= 0) {
         $this->mMessages .= "ERROR\tAl guardar registro ({$idnumerico})\r\n";
         if (MODO_DEBUG == true) {
             $this->mMessages .= $ql->getMessages(OUT_TXT);
         }
         $resultado = false;
     }
     //$xCatRiesgo				= new cAml_risk_catalog();
     //$xCatRiesgo->setData( $xCatRiesgo->query()->initByID($TipoDeAlerta) );
     //
     $xCatRiesgos = new cAml_risk_catalog();
     $xCatRiesgos->setData($xCatRiesgos->query()->initByID($TipoDeAlerta));
     $nombre_riesgo = $xCatRiesgos->descripcion()->v();
     //Enviar SMS
     $xMail = new cNotificaciones();
     //obtener los datos del usuario
     $xVUser = new cVistaUsuarios();
     $xD = $xVUser->query()->initByID($PersonaDeDestino);
     $xVUser->setData($xD);
     $userP = $xVUser->codigo_de_persona()->v();
     $mailD = false;
     $telD = false;
     $xSoc = new cSocio($userP);
     if ($xSoc->existe($userP) == true) {
         $xSoc->init();
         $mailD = $xSoc->getCorreoElectronico();
         $telD = $xSoc->getTelefonoPrincipal();
     } else {
         $this->mMessages .= "ERROR\tNo existe la persona de envio {$userP}\r\n";
     }
     //Array de valores
     $arrV = array();
     $fechacorta = $xF->getFechaCorta($xF->getFechaByInt($fecha));
     $arrV["variable_documento_codigo"] = $documento;
     $arrV["variable_docto_fecha"] = $fechacorta;
     $arrV["variable_docto_hora"] = $hora;
     $arrV["variable_nivel_de_riesgo"] = $riesgo;
     $arrV["variable_tipo_de_riesgo"] = $nombreRies;
     $arrV["variable_clasificacion_de_riesgo"] = $claseRies;
     $arrV["variable_codigo_de_alerta"] = $id_de_alerta;
     $arrV["variable_mensaje_de_alerta"] = $mensaje;
     $arrV["variable_url_del_sistema"] = SAFE_HOST_URL;
     //Enviar Mail
     $xFmt = new cFormato(800);
     $xFmt->setUsuario($PersonaDeDestino);
     $xFmt->setPersona($PersonaDeOrigen);
     $xFmt->setProcesarVars($arrV);
     $txtMail = $xFmt->get();
     if ($valorDeterminado > 51 or $this->mForceAvisos == true) {
         $xMail->setTitulo(AML_TITULO_DE_ALERTA);
         $this->mMessages .= $xMail->send($txtMail, $mailD, $telD, $PersonaDeDestino, "{$fechacorta}-{$claseRies}-{$mensaje}", "aml.{$mailD}");
         if ($this->mForceRegRiesgo == true) {
             //Agregar el riesgo
             $xAlert = new cAMLAlertas($id_de_alerta);
             $regFecha = $xF->getFechaByInt($fecha);
             $xAlert->setConfirmaAlerta($mensaje, $regFecha);
             $this->mMessages .= $xAlert->getMessages();
             //$xPAML		= new cAMLPersonas($PersonaDeOrigen);
             //$xPAML->setAgregarPerfilDeRiesgo($TipoDeAlerta, $fecha, $valorDeterminado, $documento, $tipo_de_docto, $PersonaDeDestino, $hora, $tercero_relacionado, $mensaje );
             //$this->mMessages	.= $xPAML->getMessages();
         }
     }
     return $resultado;
 }
//header("Content-type: text/plain");
//=====================================================================================================
//=====>	INICIO_H
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//<=====	FIN_H
$iduser = $_SESSION["log_id"];
//=====================================================================================================
$xHP = new cHPage("PAGARE", HP_REPORT);
$oficial = elusuario($iduser);
$idsolicitud = parametro("i", DEFAULT_CREDITO, MQL_INT);
$idsolicitud = parametro("credito", $idsolicitud, MQL_INT);
$idsolicitud = parametro("solicitud", $idsolicitud, MQL_INT);
$formato = parametro("forma", 21, MQL_INT);
$xHP->init();
$xForma = new cFormato($formato);
$xForma->setCredito($idsolicitud);
$xForma->setProcesarVars();
echo $xForma->get();
?>
</body>
</html>
//=====================================================================================================
$xHP = new cHPage("TR.Editor de contratos");
$oficial = elusuario($iduser);
$idcontrato = parametro("idcontrato", 0, MQL_INT);
$a = parametro("s");
$jscallback = parametro("callback");
$tiny = parametro("tiny");
$form = parametro("form");
$action = parametro("action", SYS_NINGUNO);
$xHP->addJsFile("../js/ckeditor/ckeditor.js");
$xFRM = new cHForm("frmeditor", "frmeditor_contratos.php?action=1");
$xBtn = new cHButton();
$xTxt = new cHText();
$xDate = new cHDate();
$xSel = new cHSelect();
$xFMT = new cFormato(false);
$jxc = new TinyAjax();
function jsAgregarContrato($id, $nombre)
{
    $xForma = new cFormato();
}
//$jxc ->exportFunction('jsAgregarContrato', array('idsolicitud', 'idparcialidad'), "#iddatos_pago");
$jxc->process();
//ini_set("display_errors", "on");
$xHP->init("initComponents()");
if ($action == SYS_NINGUNO) {
    $xFRM->addHElem($xFMT->getSelectDeFormatos()->get(true));
    $xFRM->addSubmit();
} elseif ($action == SYS_UNO) {
    //editar
    $xFMT->init($idcontrato);
$xCred = new cCredito($idsolicitud);
$xCred->initCredito();
$acreditante = $xCred->getClaveDePersona();
$xFMT = new cFormato($formato);
$xFMT->setCredito($idsolicitud);
$xFMT->setProcesarVars();
echo $xFMT->get();
$mSQL = new cSQLListas();
$mql = new MQL();
$sql = $mSQL->getListadoDeAvales($idsolicitud, $acreditante);
$rs = $mql->getDataRecord($sql);
//setLog($sql);
$forma = 5002;
//$xAval		= new cSocios_relaciones();
foreach ($rs as $rows) {
    echo "<br class='nuevapagina' />";
    $persona = $rows["numero_socio"];
    $idrelacion = $rows["num"];
    $xSoc = new cSocio($persona);
    //$xRel		= new cPersonasRelaciones($idrelacion); $xRel->init();
    if ($xSoc->init() == true) {
        $xFMT2 = new cFormato($forma);
        $xFMT2->setCredito($idsolicitud);
        $xFMT2->setProcesarVars(array("aval_nombre_completo" => $xSoc->getNombreCompleto()));
        echo $xFMT2->get();
    }
}
?>
</body>
</html>
/**
 * Reporte de
 *
 * @author Balam Gonzalez Luis Humberto
 * @version 1.0
 * @package seguimiento
 * @subpackage reports
 */
//=====================================================================================================
include_once "../core/go.login.inc.php";
include_once "../core/core.error.inc.php";
include_once "../core/core.html.inc.php";
include_once "../core/core.init.inc.php";
include_once "../core/core.db.inc.php";
$theFile = __FILE__;
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("TR.REPORTE DE ", HP_REPORT);
$mql = new cSQLListas();
$xF = new cFecha();
$query = new MQL();
$forma = parametro("forma", SYS_TODAS);
echo $xHP->init();
$xForm = new cFormato($forma);
echo $xForm->get();
echo $xHP->fin();
             $xDom = new cPersonasVivienda();
             $xDom->init(false, $rwr);
             $adr .= $xDom->getFicha();
         }
         //$xTbl->addTH();
         //$xTbl->addTD($adr);
         $xTbl->addRaw("<tr><td colspan='3'><h1>" . $xLng->getT("TR.Direcciones") . "<h1><hr />{$adr}</td></tr>");
         //$xTbl->endRow()
         $xFld = new cHFieldset($flTitle);
         $xFld->addHElem($xTbl->get());
         $txtLst .= $xFld->get();
     }
 }
 if ($getPDF == true) {
     //base64_encode($sql)
     $xFMT = new cFormato(8801);
     $xFMT->setProcesarVars(array("variable_listado_de_cedulas" => $txtLst, "variable_item_buscado" => "{$nombre} / {$apaterno} / {$amaterno}", "variable_cadena_consulta" => ""));
     $xRPT = new cReportes($xHP->getTitle());
     $xRPT->getEncabezado($xHP->getTitle());
     if ($ret == true) {
         $xRPT->setOut(OUT_HTML);
         $xRPT->setFile("ofacs_list_");
         $xRPT->addContent($xFMT->get());
         $xRPT->render(true);
         $dompdf = new DOMPDF();
         $dompdf->load_html($xRPT->render(true));
         $dompdf->set_paper("letter", "portrait");
         $dompdf->render();
         $json["pdf"] = base64_encode($dompdf->output());
     } else {
         $xRPT->setSenders($mails);
$permiso = getSIPAKALPermissions($theFile);
if ($permiso === false) {
    header("location:../404.php?i=999");
}
$_SESSION["current_file"] = addslashes($theFile);
//=====================================================================================================
$xHP = new cHPage("REPORTE DE ", HP_REPORT);
$xHP->setTitle($xHP->lang("catalogo de", "riesgo"));
$oficial = elusuario($iduser);
/**
 */
$xF = new cFecha();
$clave = isset($_GET["clave"]) ? $_GET["clave"] : SYS_NINGUNO;
echo $xHP->getHeader();
echo $xHP->setBodyinit("initComponents();");
$xFMT = new cFormato(151);
$xGar = new cCreditosGarantias($clave);
$xGar->init();
$xFMT->setPersona($xGar->getClaveDePersona());
$xFMT->setCredito($xGar->getClaveDeCredito());
$xFMT->setGarantiaDeCredito($clave);
$xFMT->setProcesarVars();
echo $xFMT->get();
echo $xHP->setBodyEnd();
?>
<script>
function initComponents(){
	window.print();
}
</script>
<?php 
if ($xEmp->getEsPeriodoCerrado($periocidad, $periodo) == false) {
    $xHP->goToPageError(20101, $out);
}
$periodo = $xF->semana();
$bheader = "";
$title = $xHP->getTitle() . "_" . $xEmp->getNombre() . "_" . $xTPer->getNombre() . "_{$periodo}";
$xPer = $xEmp->getOPeriodo(false, false, $idnomina);
$xRPT->setTitle($title);
$xRPT->setOut($out);
$xRPT->setSenders($mails);
$xRPT->setResponse();
//if($out == OUT_EXCEL ){
//$xRPT->setOut($out);
//} else {
// $xLoc->DomicilioLocalidad() . "," . $xLoc->DomicilioEstado() . "," .
$xFMT = new cFormato($xEmp->getIDDeFormatoDeAviso());
$xFMT->setEmpresaPeriodo($empresa, $idnomina);
$xFMT->setProcesarVars();
$xRPT->addContent($xFMT->get());
$xRPT->addContent("<hr />");
//}
$xRPT->setBodyMail($bheader);
//filtrar domicilio -> socio -> credito -> letra
$sql = $xL->getListadoDeCobranza($idnomina);
$xRPT->setSQL($sql);
//exit($sql);
$xT = new cTabla($sql);
$xT->setTipoSalida($out);
$xT->setRowCSS("monto", "mnyres");
$xT->setColTitle("monto", "Monto de Retencion");
$xT->setKeyField("numero_solicitud");
 function render()
 {
     $xRec = new cReciboDeOperacion(false, false, $this->mClave);
     $html = "";
     $recibo = $this->mClave;
     if ($xRec->init() == true) {
         $scripts = "";
         $xCaja = $xRec->getOCaja();
         //TODO: Resolver ajuste y permisos de ajuste
         if (MODULO_CAJA_ACTIVADO == true and $xRec->isPagable() == true) {
             $totaloperacion = $xRec->getTotal();
             $TesMontoPagado = $xRec->getSaldoEnCaja();
             $forma = $xRec->getURI_Formato();
             if ($TesMontoPagado > 0) {
                 $xFRM = new cHForm("frmrecibo");
                 $arrTPag = $xFRM->getAFormsDeTipoPago();
                 $frm = $arrTPag[$xRec->getTipoDePago()];
                 //si la caja de tesoreria esta abierta, proceder, si no cerrar
                 if ($xCaja->getEstatus() == TESORERIA_CAJA_CERRADA) {
                     $scripts = "<script>alert('El Recibo {$recibo} no ha sido SALDADO({$TesMontoPagado}) en su totalidad({$totaloperacion}),\\n No se puede efectuar operaciones en Caja Cerrada\\nNecesita Autorizar una Sesion de Caja'); document.location = '../404.php?i=7001';</script>";
                 } else {
                     $scripts = "<script> TINY.box.show({iframe:'../frmtesoreria/{$frm}?r={$recibo}',boxid:'frameless',width:400,height:540,fixed:false,maskid:'bluemask',maskopacity:40,closejs:function(){ jsRevalidarRecibo() }})</script>";
                 }
             } else {
                 $scripts = "<script>window.print();</script>";
             }
             //$html.= $xRec->getMessages(OUT_HTML);
             $xForms = new cFormato($this->mForma);
             //$xForms->init();
             $xForms->setRecibo($this->mClave);
             $xForms->setProcesarVars();
             $html .= $xForms->get();
             $html .= "<script>function jsRevalidarRecibo(){document.location = \"{$forma}\"; }</script>";
             $html .= $scripts;
         }
     }
     return $html;
 }
$senders = getEmails($_REQUEST);
$ejercicio = parametro("ejercicio", 0, MQL_INT);
$periodo = parametro("periodo", 0, MQL_INT);
$moneda = parametro("moneda", AML_CLAVE_MONEDA_LOCAL);
$fecha = $xF->getDiaFinal("{$ejercicio}-{$periodo}-01");
$sql = "";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
$activo = 1;
$xHP->init();
$xFormat = new cFormato(501);
//============ Reporte
$xSec = new cCuentasPorSector(1, $fecha);
$xSec->init(false);
$activo = $xSec->render();
$suma_activo = $xSec->getSumaTitulo();
$xSec = new cCuentasPorSector(2, $fecha);
$xSec->init(false);
$pasivo = $xSec->render();
$suma_pasivo = $xSec->getSumaTitulo();
$xSec = new cCuentasPorSector(3, $fecha);
$xSec->init(false);
$capital = $xSec->render();
$suma_capital = $xSec->getSumaTitulo() + CONTABLE_RESULTADO_DEL_PERIODO;
$pasivo_mas_capital = $suma_pasivo + $suma_capital;
$xFormat->setProcesarVars(array("variable_ficha_activo" => $activo, "variable_total_activo" => getFMoney($suma_activo), "variable_ficha_pasivo" => $pasivo, "variable_total_pasivo" => getFMoney($suma_pasivo), "variable_ficha_capital" => $capital, "variable_total_capital" => getFMoney($suma_capital), "variable_pasivo_mas_capital" => getFMoney($pasivo_mas_capital), "variable_resultado_del_periodo" => getFMoney(CONTABLE_RESULTADO_DEL_PERIODO)));
$senders = getEmails($_REQUEST);
$ejercicio = parametro("ejercicio", 0, MQL_INT);
$periodo = parametro("periodo", 0, MQL_INT);
$moneda = parametro("moneda", AML_CLAVE_MONEDA_LOCAL);
$fecha = $xF->getDiaFinal("{$ejercicio}-{$periodo}-01");
$sql = "";
$titulo = "";
$archivo = "";
$xRPT = new cReportes($titulo);
$xRPT->setFile($archivo);
$xRPT->setOut($out);
$xRPT->setSQL($sql);
$xRPT->setTitle($xHP->getTitle());
$activo = 1;
$xHP->init();
$xFormat = new cFormato(502);
//============ Reporte
$xSec = new cCuentasPorSector(5, $fecha);
$xSec->init(false);
$ingresos = $xSec->render();
$suma_ingresos = $xSec->getSumaTitulo();
$xSec = new cCuentasPorSector(4, $fecha);
$xSec->init(false);
$egresos = $xSec->render();
$suma_egresos = $xSec->getSumaTitulo();
$resultado = $suma_ingresos - $suma_egresos;
//Actualizar Resultados
$xConf = new cConfiguration();
$xConf->set("resultado_del_periodo_contable", $resultado);
$xFormat->setProcesarVars(array("variable_ficha_ingresos" => $ingresos, "variable_total_ingresos" => getFMoney($suma_ingresos), "variable_ficha_egresos" => $egresos, "variable_total_egresos" => getFMoney($suma_egresos), "variable_resultado_del_periodo" => $resultado));
echo $xFormat->get();