function jsaGetCobranza($empresa, $periocidad, $variacion, $periodo, $fechaInicial, $fechaFinal)
{
    $ByPeriodo = $periocidad == "todos" ? "" : " AND creditos_solicitud.periocidad_de_pago = {$periocidad} ";
    $xF = new cFecha();
    $xNot = new cHNotif();
    $content = "";
    $fechaFinal = $xF->getFechaISO($fechaFinal);
    $fechaInicial = $xF->getFechaISO($fechaInicial);
    $xEmp = new cEmpresas($empresa);
    $xPer = $xEmp->getOPeriodo($periocidad, $periodo);
    $DDias = $xEmp->getFechaDeAviso();
    if ($xPer->getCobrados() > 0) {
        $content = $xNot->get("ERROR\tLa nomina tiene cobros " . $xPer->getCobrados() . " ACTIVOS ", "iderror", $xNot->ERROR);
    } else {
        $content = $xEmp->getListadoDeCobranza($empresa, $periocidad, $variacion, $periodo, $fechaInicial, $fechaFinal);
    }
    $periodo = $periodo + $variacion;
    return $content;
}
function getListadoDeGrupoParaGuardar($solicitud, $socio)
{
    $xNot = new cHNotif();
    $xCred = new cCredito($solicitud, $socio);
    $xCred->initCredito();
    $DCred = $xCred->getDatosDeCredito();
    $OConv = $xCred->getOProductoDeCredito();
    $grupo = $xCred->getClaveDeGrupo();
    $body = "";
    $elements = 0;
    $avisos = "";
    if ($OConv->getEsProductoDeGrupos() == true) {
        $body .= "<p class='aviso'>SE HA DETECTADO QUE ESTE CREDITO ES DEL GRUPO {$grupo}</p>";
        $xGrp = new cGrupo($grupo);
        $DPlan = $xGrp->getDatosDePlaneacionInArray();
        $recibo = $DPlan["idoperaciones_recibos"];
        $presidenta = $xGrp->getRepresentanteCodigo();
        $tds = "";
        if (isset($recibo)) {
            $body .= "<p class='aviso'>SE CARGAN DATOS DE LA PLANEACION # {$recibo}</p>";
            $sql = "SELECT\n\t\t\t\t\t`operaciones_mvtos`.`tipo_operacion`,\n\t\t\t\t\t`operaciones_mvtos`.`recibo_afectado`,\n\t\t\t\t\t`socios_general`.`codigo`,\n\t\t\t\t\tCONCAT(`socios_general`.`apellidopaterno`, ' ',\n\t\t\t\t\t`socios_general`.`apellidomaterno`, ' ',\n\t\t\t\t\t`socios_general`.`nombrecompleto`) AS 'nombre',\n\t\t\t\t\t`operaciones_mvtos`.`afectacion_real` AS 'monto',\n\t\t\t\t\t`operaciones_mvtos`.`detalles`\n\t\t\t\tFROM\n\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\t\t\tINNER JOIN `socios_general` `socios_general`\n\t\t\t\t\t\tON `operaciones_mvtos`.`socio_afectado` = `socios_general`.`codigo`\n\t\t\t\tWHERE\n\t\t\t\t\t(`operaciones_mvtos`.`tipo_operacion` =112) AND\n\t\t\t\t\t(`operaciones_mvtos`.`recibo_afectado` ={$recibo})";
            $rs = mysql_query($sql, cnnGeneral());
            while ($rw = mysql_fetch_array($rs)) {
                $socio = $rw["codigo"];
                $tds .= "\n\t\t\t\t\t\t\t<tr id=\"tr-{$grupo}-{$socio}\">\n\t\t\t\t\t\t\t\t<th>" . $socio . " <input type=\"hidden\" id=\"socio-{$grupo}-{$socio}\" value=\"" . $socio . "\" /></th>\n\t\t\t\t\t\t\t\t<td>" . htmlentities($rw["nombre"]) . "</td>\n\t\t\t\t\t\t\t\t<td><input type=\"text\" id=\"monto-{$grupo}-{$socio}\" value=\"" . $rw["monto"] . "\" class='mny' onchange=\"jsUpdateAutorizacion();\" maxlength=\"20\" /></td>\n\t\t\t\t\t\t\t\t<td><input type=\"text\" id=\"detalles-{$grupo}-{$socio}\" value=\"" . htmlentities($rw["detalles"]) . "\" maxlength=\"60\" /></td>\n\t\t\t\t\t\t\t</tr>";
                $elements++;
            }
            $body .= "<fieldset>\n\t\t\t\t\t\t\t<legend>|&nbsp;&nbsp;GUARDAR DATOS DE LA AUTORIZACION POR GRUPO&nbsp;&nbsp;|</legend>\n\t\t\t\t\t\t\t\t<table width='100%' align='center'>\n\t\t\t\t\t\t\t<th>Socio(a)</th>\n\t\t\t\t\t\t\t<th>Nombre Completo</th>\n\t\t\t\t\t\t\t<th>Monto Autorizado</th>\n\t\t\t\t\t\t\t<th>Observaciones</th>\n\t\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t\t{$tds}\n\t\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t\t\t<th colspan='4'><a class='button' id='icmdGoGroup' onclick='jsSavePlaneacion({$elements})'>Guardar Autorizacion Grupal y Enviar Autorizacion</a></th>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</fieldset>";
            //Crear el recibo
            $fecha = fechasys();
            $oficial = elusuario($_SESSION["SN_b80bb7740288fda1f201890375a60c8f"]);
            $xRec = setNuevorecibo($presidenta, $solicitud, $fecha, 1, 40, "CREDITO_DE_GRUPO_ELABORADO_POR_{$oficial}", DEFAULT_CHEQUE, DEFAULT_TIPO_PAGO, DEFAULT_RECIBO_FISCAL, $grupo);
            $body .= "<p class='aviso'>Se Crea el Recibo # {$xRec} para Trabajar</p>";
            if (isset($_SESSION["recibo_en_proceso"])) {
                $body .= "<p class='aviso'>Se Ha Liberado el Recibo # " . $_SESSION["recibo_en_proceso"] . " para Trabajar con # {$xRec}</p>";
                unset($_SESSION["recibo_en_proceso"]);
            }
            $_SESSION["recibo_en_proceso"] = $xRec;
        }
    } else {
        //XXX: COOOOOOOOOOOOOOOOOOOOOOOOOOOREGIR
        $body .= $xNot->get("Credito Sin problemas<input type='hidden' id='idesautorizado' />");
    }
    $body .= $avisos;
    return $body;
}
if ($recibo != false) {
    $xRec = new cReciboDeOperacion(false, false, $recibo);
    $xRec->init();
    $DRec = $xRec->getDatosInArray();
    $MontoOperacion = $DRec["total_operacion"];
    //=========================== HTML
    echo $xHP->getHeader();
    //echo $xJS->setIncludeJQuery();
    $jxc->drawJavaScript(false, true);
    echo $xHP->setBodyinit("initComponents()");
    ?>
 <style> #idavisopago, #idimporte, #iMontoRecibido { font-size : 1.3em !important; } </style> <?php 
    $xFRM = new cHForm("frmCobrosEnEfectivo", "cobro-efectivo.frm.php");
    $xFRM->addGuardar("jsActualizarPago()");
    //agrega en un hidden el idrecibo
    $xHNot = new cHNotif();
    $xTxt = new cHText("id");
    $xTxt->addEvent("this.select()", "onfocus");
    $xTxt->addEvent("jsActualizarPago()", "onblur");
    $xTxt->addEvent("jsSetEvalMonto(event, this)", "onkeyup");
    $xFRM->addHElem($xHNot->get($xHP->lang("importe") . " : " . getFMoney($MontoOperacion) . AML_CLAVE_MONEDA_LOCAL, "idimporte"));
    $xFRM->OHidden("iMontoOperacion", $MontoOperacion, "");
    $SMoneda = $xHSel->getListaDeMonedas("idcodigodemoneda");
    $SMoneda->addEvent("onblur", "jsGetEquivalenciasA");
    $xFRM->addHElem($SMoneda->get($xHP->lang("Moneda"), true));
    $xFRM->addHElem($xTxt->getDeMoneda("iMontoRecibido", "TR.Monto recibido", $MontoOperacion));
    $xFRM->addHElem($xHNot->get($xHP->lang("Cambio") . " : <mark id='idtotal'>0</mark>" . AML_CLAVE_MONEDA_LOCAL, "idavisopago", $xHNot->WARNING));
    $xFRM->addHElem($xHNot->get($xHP->lang("Cotizacion") . " : <mark id='idequivalente'>0</mark>", "idavisopago", $xHNot->SUCCESS));
    $xFRM->OHidden("iMontoCambio", 0, "");
    $xFRM->OHidden("idTipoCambio", 1, "");
    $xFRM->addHTML("<div id='avisos'></div>");
 function addAviso($txt, $id = "", $mostrarTip = false, $class = "notice")
 {
     $xHO = new cHObject();
     $txt = $xHO->Out($txt, OUT_HTML);
     $id = $id == "" ? "idmsgs" : $id;
     $xNot = new cHNotif($class);
     if ($mostrarTip == true) {
         $txt = str_replace("\r\n", "", $txt);
         $txt = str_replace("\r", "", $txt);
         $txt = str_replace("\n", "", $txt);
         $txt = str_replace("\t", ":", $txt);
         $xT = new cTipos();
         //$txt		= $xT->cChar($txt);
         $this->addFootElement("<script>setTimeout(\"jsGoTip()\", 1000); function jsGoTip(){tipSuggest(\"#{$id}\", \"" . addslashes($txt) . "\");}</script>");
     }
     $this->addFootElement($xNot->get($txt, $id));
     // "<div id='idmsgs' class='alert-box $class'>" . $txt . "</div>");
 }
$xFRM->OButton("TR.Salir", "var xG = new Gen(); xG.salir()", "salir");
$xFRM->addSeccion("idmastareas", "TR.Tareas");
$xFRM->addHElem("<div id=\"tcalendar-task\">{$alerts}</div>");
$xFRM->endSeccion();
$sysinfo = "";
if (MODO_DEBUG == true and SYSTEM_ON_HOSTING == false) {
    $xUL = new cHUl();
    $xUL2 = new cHUl();
    $sysinfo = $xUL->li("Base de Datos:" . MY_DB_IN)->li("Servidor: " . WORK_HOST)->li("Sucursal: " . getSucursal())->li("Version S.A.F.E.: " . SAFE_VERSION)->li("Revision S.A.F.E: " . SAFE_REVISION)->li("Path Temporal: " . PATH_TMP)->li("Path Backups: " . PATH_BACKUPS)->li("Fecha del Sistema: " . date("Y-m-d H:i:s"))->li("Usuario Activo: " . $xUsr->getNombreCompleto())->li("ID de Usuario: " . $xUsr->getID())->li("Nivel de Usuario: " . $xUsr->getNivel())->li("SAFE DB version : " . SAFE_DB_VERSION)->end();
    $sysinfo2 = $xUL2->li("Caja Local : " . $xLoc->getCajaLocal())->li("Localidad : " . $xLoc->DomicilioLocalidad())->li("Clave Localidad : " . $xLoc->DomicilioLocalidadClave())->li("Municipio : " . $xLoc->DomicilioMunicipio())->li("Estado : " . $xLoc->DomicilioEstado())->li("Clave Estado : " . $xLoc->DomicilioEstadoClaveABC())->li("C.P. : " . $xLoc->DomicilioCodigoPostal())->end();
    $xFRM->addSeccion("idmaslogs", "TR.Sistema");
    $xFRM->addDivSolo($sysinfo, $sysinfo2, "tx24", "tx24");
    $xFRM->endSeccion();
}
if (getUsuarioActual(SYS_USER_NIVEL) == USUARIO_TIPO_CAJERO) {
    $xNot = new cHNotif();
    $xCaja = new cCaja();
    if ($xCaja->getEstatus() == TESORERIA_CAJA_CERRADA) {
        $xNot->get("", "idestadocaja", $xNot->ERROR);
    } else {
    }
}
$xFRM->addAviso("", "idavisos");
$xFRM->OHidden("id-KeyEditable", "", "");
//$xFRM->addHTML($menu);
echo $xFRM->get();
$jxc->drawJavaScript(false, true);
?>
</body>
<script>
if (setNoMenorQueCero($recibo) <= 0) {
    header("location:../404.php?i=" . DEFAULT_CODIGO_DE_ERROR);
}
?>
 <style> #idavisopago, #idimporte, #iMonto { font-size : 1.3em !important; } </style> <?php 
if (setNoMenorQueCero($recibo) > 0) {
    $xRec = new cReciboDeOperacion(false, false, $recibo);
    $xRec->init();
    $DRec = $xRec->getDatosInArray();
    $MontoOperacion = $xRec->getTotal();
    // $DRec["total_operacion"];
    $xFRM = new cHForm("frmPagosEnCheques", "pago-cheques-internos.frm.php");
    $xTxt = new cHText("");
    $xDat = new cHDate();
    $xHSel = new cHSelect();
    $xHNot = new cHNotif();
    $xFRM->addGuardar("jsActualizarPago()");
    $xTxt->addEvent("this.select()", "onfocus");
    $xTxt->addEvent("jsActualizarPago()", "onblur");
    $xFRM->addHElem($xHSel->getListaDeCuentasBancarias("idcuentabancaria", true)->get("TR.Cuenta Bancaria del Cheque", true));
    $xFRM->addHElem($xHNot->get($xHP->lang("importe") . " : " . getFMoney($MontoOperacion), "idimporte"));
    $xFRM->ODate("idfechapago", $xRec->getFechaDeRecibo(), "TR.Fecha del Cheque");
    $xFRM->addHElem($xTxt->getDeMoneda("idcheque", "TR.Codigo de Cheque"));
    $xFRM->OHidden("iMonto", $MontoOperacion, "");
    $xFRM->addHTML("<input type='hidden' id='iRecibo' name='iRecibo' value='{$recibo}' />");
    $xFRM->addHTML("<input type='hidden' id='iTotal' name='iTotal' value='{$MontoOperacion}' />");
    $xFRM->addHTML("<div id='avisos'></div>");
    echo $xFRM->get();
    $jxc->drawJavaScript(false, true);
}
?>
if (setNoMenorQueCero($recibo) <= 0) {
    header("location:../404.php?i=" . DEFAULT_CODIGO_DE_ERROR);
}
?>
 <style> #idavisopago, #idimporte, #iMonto { font-size : 1.3em !important; } </style> <?php 
if (setNoMenorQueCero($recibo) > 0) {
    $xRec = new cReciboDeOperacion(false, false, $recibo);
    $xRec->init();
    $DRec = $xRec->getDatosInArray();
    $MontoOperacion = $xRec->getTotal();
    // $DRec["total_operacion"];
    $xFRM = new cHForm("frmCobrosEnEfectivo", "cobro-efectivo.frm.php");
    $xTxt = new cHText("id");
    $xDat = new cHDate();
    $xHSel = new cHSelect();
    $xHNot = new cHNotif();
    $xFRM->addGuardar("jsActualizarPago()");
    $xTxt->addEvent("this.select()", "onfocus");
    $xTxt->addEvent("jsActualizarPago", "onkeyup");
    $xFRM->addHElem($xHSel->getListaDeCuentasBancarias("iBancos", true)->get("TR.Cuenta Bancaria de Deposito", true));
    $xFRM->addHElem($xHNot->get($xHP->lang("importe") . " : " . getFMoney($MontoOperacion), "idimporte"));
    $xFRM->addHElem($xHSel->getListaDeTipoDePerfilTransaccional("", SYS_SALIDAS)->get(true));
    $xFRM->addHElem($xHSel->getListadoDeBancos()->get("TR.Banco de Origen", true));
    //TODO: Agregar cuenta de origen ultimo 4 digitos
    $xFRM->addHElem($xDat->get("TR.Fecha de Deposito", $xRec->getFechaDeRecibo()));
    $xFRM->addHElem($xTxt->getDeMoneda("iMonto", $xHP->lang("Monto de", "Deposito"), 0));
    $xFRM->addHElem($xHNot->get($xHP->lang("total") . " : <mark id='idtotal'>0</mark>", "idavisopago", $xHNot->WARNING));
    $xFRM->addHTML("<input type='hidden' id='iRecibo' name='iRecibo' value='{$recibo}' />");
    $xFRM->addHTML("<input type='hidden' id='iDiferencia' name='iDiferencia' value='0' />");
    $xFRM->addHTML("<input type='hidden' id='iTotal' name='iTotal' value='{$MontoOperacion}' />");
    $xFRM->addHTML("<div id='avisos'></div>");
    }
    return $xUL->get();
}
$jxc->exportFunction('jsaGetMunicipios', array('identidadfederativa', 'idpais', 'idcodigopostal'), "#txtmunicipio");
$jxc->exportFunction('jsaGetLocalidades', array('identidadfederativa', 'idmunicipio', 'idpais', 'idcodigopostal'), "#txtlocalidad");
$jxc->exportFunction('jsaBuscarCoincidencias', array('idnombrecompleto', 'idapellidopaterno', 'idapellidomaterno'), "#idcoincidencias");
$jxc->process();
$xHP->init();
$xFRM = new cHForm("frmsolingreso", "registro-personas.frm.php");
$xBtn = new cHButton();
$xTxt = new cHText();
$xTxt2 = new cHText();
$xDate = new cHDate();
$xDate2 = new cHDate(2, false, FECHA_TIPO_NACIMIENTO);
$xSel = new cHSelect();
$xHNot = new cHNotif();
$xChk = new cHCheckBox();
if ($action == SYS_NINGUNO) {
    $xFRM->addGuardar("jsCheck()");
}
//=========================================== AVALES
if (setNoMenorQueCero($con_relacion) > 0) {
    $xHSel = new cHSelect();
    $tipoRe = "";
    if (setNoMenorQueCero($persona_rel) <= 0) {
        if ($con_relacion == iDE_CREDITO) {
            $xDoc = new cCredito($documento_rel);
            $xDoc->init();
            $persona_rel = $xDoc->getClaveDePersona();
            $tipoRe = PERSONAS_REL_CLASE_AVAL;
        }