function jsaShowCalendarTasks($date)
{
    $xD = new cFecha();
    $date = $xD->getFechaISO($date);
    $xLi = new cSQLListas();
    $cTbl = new cTabla($xLi->getListadoDeTareas(getUsuarioActual(), $date));
    $cTbl->setKeyField("idusuarios_web_notas");
    $cTbl->setKeyTable("usuarios_web_notas");
    $cTbl->OButton("TR.Checado", "setUpdateEstatus(_REPLACE_ID_)", $cTbl->ODicIcons()->OK);
    return $cTbl->Show("TR.Tareas");
}
function jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xF = new cFecha();
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeRiesgosConfirmados($fecha_inicial, $fecha_final, $tipo);
    // getListadoDeAlertas($tipo, $fecha_inicial, $fecha_final, false, " AND `estado_en_sistema`= " . SYS_UNO);
    $xT = new cTabla($sql);
    $xT->addEspTool($xImg->get24("check", " onclick=\"jsConfirmRiesgo(_REPLACE_ID_)\" "));
    $xT->addEspTool($xImg->get24("delete", " onclick=\"jsDescartarRiesgo(_REPLACE_ID_)\" "));
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
function jsaGetListadoDeAvisos($tipo, $fecha_inicial, $fecha_final)
{
    $tipo = $tipo == SYS_TODAS ? false : $tipo;
    $xF = new cFecha();
    $xAl = new cAml_risk_register();
    $xlistas = new cSQLListas();
    $xBtn = new cHButton();
    $xImg = new cHImg();
    $fecha_inicial = $xF->getFechaISO($fecha_inicial);
    $fecha_final = $xF->getFechaISO($fecha_final);
    $sql = $xlistas->getListadoDeRiesgosConfirmados(false, false, false, $tipo, false, " AND (`aml_risk_register`.`estado_de_envio` =0) AND (`aml_risk_register`.`fecha_de_checking` =0) ");
    $xT = new cTabla($sql);
    //setLog($sql);
    $xT->OButton("TR.Dictaminar", "jsModificarEstatus(_REPLACE_ID_)", $xT->ODicIcons()->REPORTE);
    $xT->OButton("TR.Modificar", "jsEditarRiesgo(_REPLACE_ID_)", $xT->ODicIcons()->EDITAR);
    //$xT->addTool(1);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
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 jsaGetCobranza($empresa, $idperiodo)
{
    $xL = new cSQLListas();
    $xF = new cFecha();
    $sql = $xL->getListadoDeCobranza($idperiodo, SYS_UNO);
    //setLog($sql);
    //fecha de ministracion anterior al
    $xT = new cTabla($sql);
    $xT->setKeyField("numero_solicitud");
    $xT->setKey(2);
    $xT->setWidthTool("180px");
    $xT->setKeyTable("creditos_solicitud");
    $xT->setEventKey("jsGetRecibosByCredito");
    $xT->addEspTool("<div class='coolCheck'><input type='checkbox' id='chk_REPLACE_ID_' onclick='jsSetAlimentarCobros(this, _REPLACE_ID_)' /><label for='chk_REPLACE_ID_'></label></div>");
    $xT->addEspTool("<img src='../images/order.png' class='x24' onclick='getEstadoDeCuenta(_REPLACE_ID_)' />");
    $xT->addEspTool("<img src='../images/calendar.png' class='x24' onclick='getPlanDePagos(_REPLACE_ID_)' />");
    $xT->addEspTool("<img src='../images/view.png' class='x24' onclick='setOcultar(_REPLACE_ID_)' />");
    /*$subSQL		= "SELECT CONCAT(`socios_memo`.`fecha_memo`, '|',	`socios_memo`.`texto_memo`) AS 'memo' FROM `socios_memo` WHERE (`socios_memo`.`numero_solicitud` =" . HP_REPLACE_ID . ") AND (`socios_memo`.`tipo_memo` =11) ORDER BY `socios_memo`.`fecha_memo` ";
    	$xT->addSubQuery($subSQL);*/
    $xT->setWithMetaData();
    $xT->setFootSum(array(3 => "letra", 6 => "monto"));
    return $xT->Show();
}
function jsaCumplimiento($idsocio)
{
    $xAl = new cAml_alerts();
    $xlistas = new cSQLListas();
    $sql = $xlistas->getListadoDeAlertas(false, false, false, $idsocio);
    $xT = new cTabla($sql);
    $xT->setKeyField($xAl->getKey());
    $xT->setKeyTable($xAl->get());
    return $xT->Show();
}
$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");
$xT->setKeyTable("creditos_solicitud");
$xT->setTdClassByType();
$xT->setFootSum(array(3 => "letra", 6 => "monto"));
//$xT->getFieldsSum()
$xRPT->addContent($xT->Show());
echo $xRPT->render(true);