</thead>
</table>
<?php 
$rs = mysql_query($sql, cnnGeneral());
$gvalues = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw[1] / 1000, 2);
    $lbl[] = $rw[0];
    $sm += $rw[1];
    $tds = $tds . "<tr>\n\t<td>{$rw['0']}</td>\n\t<td class='mny'>" . getFMoney($rw[1]) . "</td>\n\t\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
$sm = getFMoney($sm);
echo "<table width='100%' aling='center'>\n\t<tr>\n\t\t<th>Concepto</th>\n\t\t<th>Monto</th>\n\t</tr>\n\t\n\t{$tds}\n\t\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<td>{$sm}</td>\n\t</tr>\n\t\n\t</table>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("SALDOS DE CREDITOS MINISTRADOS EN UN RANGO DE FECHAS(Miles)");
$mFile = $x->ChartPIE();
open_flash_chart_object(800, 512, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
</table>
<?php 
$rs = mysql_query($sql, cnnGeneral());
$gvalues = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw[1] / 1000, 2);
    $lbl[] = $rw[0];
    $sm += $rw[1];
    $tds = $tds . "<tr>\n\t<td>{$rw['0']}</td>\n\t<td class='mny'>" . getFMoney($rw[1]) . "</td>\n\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
$sm = getFMoney($sm);
echo "<table width='100%' aling='center'>\n\t<tr>\n\t\t<th>Concepto</th>\n\t\t<th>Monto</th>\n\t</tr>\n\n\t{$tds}\n\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<td>{$sm}</td>\n\t</tr>\n\n\t</table>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("INGRESOS ACUMULADOS EN UN RANGO DE FECHAS(Miles)");
$mFile = $x->Chart3DBAR(10000);
open_flash_chart_object(768, 512, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
$sql = "select convenio, count(solicitud) AS 'numero', SUM(monto_solicitado) AS 'total_colocado' FROM solicitudes {$si_es_por_fecha} AND monto_solicitado>=0.99 GROUP BY convenio";
$rs = mysql_query($sql);
//echo $sql;
$gvalues = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
$nm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw[2] / 1000, 2);
    $lbl[] = $rw[0];
    $sm = $sm + $rw[2];
    $nm = $nm + $rw[1];
    $tds = $tds . "<tr>\n\t<td>{$rw['0']}</td>\n\t<td>{$rw['1']}</td>\n\t<td class='mny'>" . getFMoney($rw[2]) . "</td>\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
echo "<table  >\n\t<tr>\n\t\t<th>Tipo de Convenio</th>\n\t\t<th>Numero Solicitado</th>\n\t\t<th>Cantidad</th>\n\t</tr>\n\t\n\t{$tds}\n\t\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<th>{$nm}</th>\n\t\t<th class='mny'>" . getFMoney($sm) . "</th>\n\t</tr>\n\t</td>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("REPORTE DE SOLICITUDES DE CREDITO EN FECHA DADA(Miles)");
$mFile = $x->Chart3DBAR(2500);
open_flash_chart_object(768, 512, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
$x2->setValues($valMC);
$x2->setLabels($lblMC);
$x2->setTitle("CIFRAS DE CAPTACION EN MILES");
$mFile2 = $x2->Chart3DBar(10000);
open_flash_chart_object(648, 512, $mFile2, true, "../");
//====================================================================================================
//CREDITOS
$lblMD = array();
$valMD = array();
$lblND = array();
$valND = array();
$W3 = "\tAND\n\t\t\t\t(`creditos_solicitud`.`saldo_actual` >0)\n\t\t\t\tAND\n\t\t\t\t(`creditos_solicitud`.`fecha_ministracion` >= '{$fecha_inicial}')\n\t\t\t\tAND\n\t\t\t\t(`creditos_solicitud`.`fecha_ministracion` <= '{$fecha_final}')\n";
$DCreds = $cSuc->getColocacionTotal($W3);
$lblND[] = "Creditos";
$valND[] = $DCreds["numero"];
$lblMD[] = "Tot. Solicitado";
$valMD[] = round($DCreds["solicitado"] / 1000, 2);
$lblMD[] = "Tot. Ministrado";
$valMD[] = round($DCreds["ministrado"] / 1000, 2);
$lblMD[] = "Tot. Insoluto";
$valMD[] = round($DCreds["saldo"] / 1000, 2);
$x2 = new SAFEChart();
$x2->setValues($valMD);
$x2->setLabels($lblMD);
$x2->setTitle("CIFRAS GENERALES DE CREDITOS(MILES)");
$mFile2 = $x2->Chart3DBar(20000);
open_flash_chart_object(648, 512, $mFile2, true, "../");
echo getRawFooter();
?>
</body>
</html>
?>
</td>
		</tr>		
	</thead>
</table>
<?php 
$x = "SELECT\n\t`oficiales`.`nombre_completo`,\n\tSUM(`creditos_solicitud`.`saldo_actual`)       AS `monto`,\n\tCOUNT(`creditos_solicitud`.`numero_solicitud`) AS `numero` \nFROM\n\t`creditos_solicitud` `creditos_solicitud` \n\t\tINNER JOIN `oficiales` `oficiales` \n\t\tON `creditos_solicitud`.`oficial_credito` = `oficiales`.`id` \nWHERE\n\t(`creditos_solicitud`.`saldo_actual` >=" . TOLERANCIA_SALDOS . ")\n\t{$BySuc}\n\t{$ByStat}\nGROUP BY\n\t`creditos_solicitud`.`idusuario` \nORDER BY\n\t`creditos_solicitud`.`estatus_actual`";
$rs = mysql_query($sql, cnnGeneral());
$lbl = array();
$val = array();
$tds = "";
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw["monto"] / 1000, 2);
    $lbl[] = $rw["nombre_completo"];
}
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("Concentacion de la Cartera por Sucursal(Miles)");
$mFile = $x->Chart3DBAR(25000);
open_flash_chart_object(600, 300, $mFile, true, "../");
echo getRawFooter();
?>
</body>
<script  >
<?php 
?>
function initComponents(){
	window.print();
}
</script>
}
$ByStat = "";
$inputG = $_GET["outg"];
if ($Stat != "todas") {
    $ByStat = " AND\n\t\t\t\t(`creditos_solicitud`.`estatus_actual` ={$Stat})  ";
}
$sql = "SELECT\n\t`creditos_periocidadpagos`.`descripcion_periocidadpagos` AS `periocidad`,\n\tCOUNT(`creditos_solicitud`.`numero_solicitud`)           AS `numero`,\n\tSUM(`creditos_solicitud`.`saldo_actual`)                 AS\n\t`monto`,\n\t`creditos_solicitud`.`periocidad_de_pago`\nFROM\n\t`creditos_solicitud` `creditos_solicitud`\n\t\tINNER JOIN `creditos_periocidadpagos` `creditos_periocidadpagos`\n\t\tON `creditos_solicitud`.`periocidad_de_pago` =\n\t\t`creditos_periocidadpagos`.`idcreditos_periocidadpagos`\nWHERE\n\t(`creditos_solicitud`.`saldo_actual` >=0.99)\n\t{$ByStat}\n\t{$BySuc}\n\tGROUP BY\n\t\t`creditos_solicitud`.`periocidad_de_pago`";
$rs = mysql_query($sql, cnnGeneral());
$lbl = array();
$val = array();
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw["monto"] / 1000, 2);
    $lbl[] = $rw["destino"];
    $sm += $rw["monto"];
    $nm += $rw["numero"];
    $tds = $tds . "<tr>\n\t<td>" . $rw["periocidad"] . "</td>\n\t<td>" . $rw["numero"] . "</td>\n\t<td class='mny'>" . getFMoney($rw["monto"]) . "</td>\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
echo "<table align=\"center\" width='100%'>\n\t<tr>\n\t\t<th>Destino del Credito</th>\n\t\t<th>Numero de Credito</th>\n\t\t<th>Saldo del Capital Insoluto</th>\n\t</tr>\n\n\t{$tds}\n\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<th>" . getFMoney($nm) . "</th>\n\t\t<th>" . getFMoney($sm) . "</th>\n\t</tr>\n\t</td>\n\t</table>\n";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("REPORTE DE CONCENTRACION DE LA CARTERA POR DESTINO ECONOMICO(Miles)");
$mFile = $x->ChartPIE();
open_flash_chart_object(768, 512, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
</table>
<?php 
$rs = mysql_query($sql, cnnGeneral());
$gvalues = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw[1] / 1000, 2);
    $lbl[] = $rw[0];
    $sm += round($rw[1] / 1000, 2);
    $tds = $tds . "<tr>\n\t<td>{$rw['0']}</td>\n\t<td class='mny'>" . getFMoney(round($rw[1] / 1000, 2)) . "</td>\n\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
$sm = getFMoney($sm);
echo "<table width='100%' aling='center'>\n\t<tr>\n\t\t<th>Concepto</th>\n\t\t<th>Monto</th>\n\t</tr>\n\n\t{$tds}\n\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<th class='mny'>{$sm}</th>\n\t</tr>\n\n\t</table>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("DEPOSITOS DE CAPTACION POR SUCURSAL EN UN RANGO DE FECHAS(MILES)");
$mFile = $x->Chart3DBAR(20000);
open_flash_chart_object(768, 512, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
</td>
		</tr>			
	</thead>
</table>
<?php 
$sql = "SELECT\n\tCOUNT(`socios_general`.`codigo`) AS 'numero',\n\t`socios_genero`.`descripcion_genero` AS  'genero'\n\nFROM\n\t`socios_general` `socios_general` \n\t\tINNER JOIN `socios_genero` `socios_genero` \n\t\tON `socios_general`.`genero` = `socios_genero`.`idsocios_genero` \nWHERE\n\t(`socios_general`.`estatusactual` != 20) \n\t{$BySuc}\n\t{$si_es_por_fecha}\nGROUP BY\n\t`socios_general`.`genero`\n\t\n";
//exiT($x);
$rs = mysql_query($sql, cnnGeneral());
$lbl = array();
$val = array();
$tds = "";
while ($rw = mysql_fetch_array($rs)) {
    $val[] = $rw["numero"];
    $lbl[] = $rw["genero"];
}
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("ACUMULADO DE PERSONAS ACTIVAS POR GENERO");
$mFile = $x->ChartPIE();
open_flash_chart_object(600, 300, $mFile, true, "../");
echo getRawFooter();
?>
</body>
<script  >
<?php 
?>
function initComponents(){
	window.print();
}
</script>
$gvalues2 = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
$nm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw[2] / 1000, 2);
    $lbl[] = $rw[0];
    $mnt = cmoney($rw[2]);
    $sm = $sm + $rw[2];
    $nm = $nm + $rw[1];
    $tds = $tds . "<tr>\n\t<td>{$rw['0']}</td>\n\t<td>{$rw['1']}</td>\n\t<td class='mny'>{$mnt}</td>\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
$sm = cmoney($sm);
echo "<table  >\n\t<tr>\n\t\t<th>Tipo de Convenio</th>\n\t\t<th>Numero de Operaciones</th>\n\t\t<th>Cantidad</th>\n\t</tr>\n\t\n\t{$tds}\n\t\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<th>{$nm}</th>\n\t\t<th>{$sm}</th>\n\t</tr>\n\t</td>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("REPORTE DE RECUPERACION DE CREDITOS BASADO EN MOVIMIENTOS(Miles)");
$mFile = $x->Chart3DBAR(1000);
open_flash_chart_object(768, 512, $mFile, true, "../");
echo getRawFooter();
echo getRawFooter();
?>
</body>
</html>
$rs = mysql_query($sql);
//echo $sql; exit;
$gvalues = "";
$gvalues2 = "";
$gnames = "";
$i = 0;
$tds = "";
$mnt = 0;
$sm = 0;
$nm = 0;
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw["monto"] / 1000, 2);
    $lbl[] = $rw["operacion"];
    $sm += $rw["monto"];
    $nm += $rw["numero"];
    $tds = $tds . "<tr>\n\t<td>" . $rw["operacion"] . "</td>\n\t<td>" . $rw["numero"] . "</td>\n\t<td class='mny'>" . getFMoney($rw["monto"]) . "</td>\n\t</tr>";
    $i++;
}
//echo $gnames;
//echo $gvalues;
echo "<table width='100%'>\n\t<tr>\n\t\t<th>Tipo de Operacion</th>\n\t\t<th>Numero de Operaciones</th>\n\t\t<th>monto</th>\n\t</tr>\n\n\t{$tds}\n\n\t<tr>\n\t\t<td>Sumas</td>\n\t\t<th>" . getFMoney($nm) . "</th>\n\t\t<th>" . getFMoney($sm) . "</th>\n\t</tr>\n\t</td>";
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("Reporte de Operaciones Acumuladas por Tipo(Miles)");
$mFile = $x->Chart3DBAR(10000);
open_flash_chart_object(800, 500, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>
?>
</td>
		</tr>
								<tr>
			<td>&nbsp;</td>
			<td>Fecha Final</td>
			<td><?php 
echo fecha_corta($fecha_final);
?>
</td>
		</tr>
	</thead>
</table>
<?php 
while ($rw = mysql_fetch_array($rs)) {
    $val[] = round($rw["monto"] / 1000, 2);
    $lbl[] = date("d/m", strtotime($rw["fecha"]));
    $sm += $rw["monto"];
    $nm += $rw["numero"];
    $i++;
}
$x = new SAFEChart();
$x->setValues($val);
$x->setLabels($lbl);
$x->setTitle("Calendario de Vencimientos de Inversion(Miles de Pesos)");
$mFile = $x->Chart3DBar(500);
open_flash_chart_object(800, 400, $mFile, true, "../");
echo getRawFooter();
?>
</body>
</html>