function jsaGetIDE($socio, $monto, $tipo_de_pago)
{
    $xSoc = new cSocio($socio);
    $xSoc->init();
    $x = $xSoc->getIDExPagarByPeriodo(false, $monto, $tipo_de_pago);
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idide", $x));
    return $tab->getString();
}
function jsaGetCalculos($socio, $acciones, $tipo_de_pago)
{
    $xSoc = new cSocio($socio);
    $coste = COSTE_POR_ACCION * $acciones;
    $monto = $tipo_de_pago == "efectivo" ? $coste : 0;
    $ide = $tipo_de_pago == "efectivo" ? $xSoc->getIDExPagarByPeriodo(false, $monto) : 0;
    $tab = new TinyAjaxBehavior();
    $tab->add(TabSetValue::getBehavior("idCoste", getFMoney($coste)));
    $tab->add(TabSetValue::getBehavior("idide", getFMoney($ide)));
    //$tab -> add( TabSetValue::getBehavior("idObservaciones", $xSoc->getMessages("txt") ) );
    return $tab->getString();
}
 function setGenerarIDExPagar($fecha)
 {
     $fecha_inicial = date("Y-m-", strtotime($fecha)) . "01";
     $fecha_final = date("Y-m-t", strtotime($fecha));
     $sql = "SELECT\r\n\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\r\n\t\t\t\t\t\t`operaciones_recibos`.`tipo_pago`,\r\n\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\r\n\t\t\t\t\t\tSUM(`operaciones_mvtos`.`afectacion_real`) AS 'monto'\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\r\n\t\t\t\t\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos`\r\n\t\t\t\t\t\t\tON `operaciones_mvtos`.`recibo_afectado` = `operaciones_recibos`.\r\n\t\t\t\t\t\t\t`idoperaciones_recibos`\r\n\t\t\t\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\r\n\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`\r\n\t\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` =\r\n\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` >='{$fecha_inicial}')\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` <='{$fecha_final}')\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` = 2600)\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t(`operaciones_recibos`.`tipo_pago` = 'efectivo' )\r\n\t\t\t\t\t{$BySucursal}\r\n\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\r\n\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\r\n\t\t\t\t\t`operaciones_recibos`.`tipo_pago`";
     $rsIDE = mysql_query($sql, cnnGeneral());
     while ($rwIDE = mysql_fetch_array($rsIDE)) {
         $socio = $rwIDE["socio_afectado"];
         $monto = $rwIDE["monto"];
         if ($monto > EXCENCION_IDE) {
             $cSoc = new cSocio($socio, true);
             $nombre = $cSoc->getNombreCompleto();
             $DSoc = $cSoc->getDatosInArray();
             $rfc = $DSoc["rfc"];
             $ide_pagado = $cSoc->getIDEPagadoByPeriodo($fecha_final);
             $ide_pendiente = $cSoc->getIDExPagarByPeriodo($fecha_final);
             $base_gravada = $cSoc->getBaseGravadaIDE();
         }
     }
 }
 function getMontoIDE($fecha = false, $monto = 0, $tipodepago = "efectivo")
 {
     $ide = 0;
     if (CAPTACION_IMPUESTOS_A_DEPOSITOS_ACTIVO == true) {
         if ($this->mCuentaIniciada == false) {
             $this->init();
         }
         $xSoc = new cSocio($this->mSocioTitular, true);
         $ide = $xSoc->getIDExPagarByPeriodo($fecha, $monto, $tipodepago);
         $this->mMessages .= $xSoc->getMessages();
         $this->mIDExRetener = $ide;
     }
     return $ide;
 }
$tds = "";
$gravados = 0;
$pendiente = 0;
$retenido = 0;
$sql = "SELECT\n\t\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t\t`operaciones_recibos`.`tipo_pago`,\n\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t\tSUM(`operaciones_mvtos`.`afectacion_real`) AS 'monto'\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`operaciones_mvtos` `operaciones_mvtos`\n\t\t\t\t\t\t\tINNER JOIN `operaciones_recibos` `operaciones_recibos`\n\t\t\t\t\t\t\tON `operaciones_mvtos`.`recibo_afectado` = `operaciones_recibos`.\n\t\t\t\t\t\t\t`idoperaciones_recibos`\n\t\t\t\t\t\t\t\tINNER JOIN `eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`\n\t\t\t\t\t\t\t\tON `operaciones_mvtos`.`tipo_operacion` =\n\t\t\t\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`miembro`\n\t\t\t\tWHERE\n\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` >='{$fecha_inicial}')\n\t\t\t\t\tAND\n\t\t\t\t\t(`operaciones_mvtos`.`fecha_afectacion` <='{$fecha_final}')\n\t\t\t\t\tAND\n\t\t\t\t\t(`eacp_config_bases_de_integracion_miembros`.`codigo_de_base` = 2600)\n\t\t\t\t\tAND\n\t\t\t\t\t(`operaciones_recibos`.`tipo_pago` = 'efectivo' )\n\t\t\t\t\t{$BySucursal}\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t`eacp_config_bases_de_integracion_miembros`.`codigo_de_base`,\n\t\t\t\t\t`operaciones_mvtos`.`socio_afectado`,\n\t\t\t\t\t`operaciones_recibos`.`tipo_pago`";
$rsIDE = mysql_query($sql, cnnGeneral());
while ($rwIDE = mysql_fetch_array($rsIDE)) {
    $socio = $rwIDE["socio_afectado"];
    $monto = $rwIDE["monto"];
    if ($monto > EXCENCION_IDE) {
        $cSoc = new cSocio($socio, true);
        $nombre = $cSoc->getNombreCompleto();
        $DSoc = $cSoc->getDatosInArray();
        $rfc = $DSoc["rfc"];
        $ide_pagado = $cSoc->getIDEPagadoByPeriodo($fecha_final);
        $ide_pendiente = $cSoc->getIDExPagarByPeriodo($fecha_final);
        $base_gravada = $cSoc->getBaseGravadaIDE();
        $pendiente += $ide_pendiente;
        $gravados += $base_gravada;
        $retenido += $ide_pagado;
        $tds .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>{$socio}</td>\n\t\t\t\t\t\t<td>{$nombre}</td>\n\t\t\t\t\t\t<td>{$rfc}</td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<td class='mny'>" . getFMoney($base_gravada) . "</td>\n\t\t\t\t\t\t<td class='mny'>" . getFMoney($ide_pagado) . "</td>\n\t\t\t\t\t\t<td class='mny'>" . getFMoney($ide_pendiente) . "</td>\n\t\t\t\t\t</tr>";
    }
}
$tbl .= "<table width=\"100%\" aling=\"center\" border=\"0\">\n\t\t\t\t<thead>\n\t\t\t\t\t<th>Num. Socio</th>\n\t\t\t\t\t<th>Nombre</th>\n\t\t\t\t\t<th>R.F.C.</th>\n\t\t\t\t\t<th>Operaciones <br />Gravadas</th>\n\t\t\t\t\t<th>IDE <br />Retenido</th>\n\t\t\t\t\t<th>IDE <br />Pendiente</th>\n\t\t\t\t\t\n\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{$tds}\n\t\t\t\t\t</tbody>\n\t\t\t\t\t<tfoot>\n\t\t\t\t\t<td />\n\t\t\t\t\t<th >TOTALES</th>\n\t\t\t\t\t<td />\n\t\t\t\t\t\t<th class='mny'>" . getFMoney($gravados) . "</th>\n\t\t\t\t\t\t<th class='mny'>" . getFMoney($retenido) . "</th>\n\t\t\t\t\t\t<th class='mny'>" . getFMoney($pendiente) . "</th>\t\t\t\t\t\n\t\t\t\t\t</tfoot>\n\t\t\t\t</table> ";
echo $tbl;
echo getRawFooter();
?>
</body>
<script  >
<?php 
?>