header('Content-Type: text/html; charset=tis-620');
echo "";
include("header.php");
require_once('db_config.php');
$sql0="select * from ad_reg where reg_id='$reg' ";
$result0=mysql_query($sql0);
$db0=mysql_fetch_array($result0);
$sql="select * from $_data where ad_reg='$reg' group by ad_chw order by ad_chw";
$result=mysql_query($sql);
echo "
";
$rw=1;
while ($db=mysql_fetch_array($result)) {
$sql4="select * from $_data where ad_reg='$reg' and ad_code='C'
and ad_chw='$db[ad_chw]' ";
$result4=mysql_query($sql4);
$nc=mysql_num_rows($result4);
$sql7="select * from $_data where ad_reg='$reg' and ad_code='F'
and ad_chw='$db[ad_chw]' ";
$result7=mysql_query($sql7);
$nf=mysql_num_rows($result7);
$sql8="select * from $_data where ad_reg='$reg' and ad_code= 'Fo'
and ad_chw='$db[ad_chw]' ";
$result8=mysql_query($sql8);
$nfo=mysql_num_rows($result8);
$treg=$nf+$nfo;
$cc=number_format($nc,0,'.',',');
$cf=number_format($nf,0,'.',',');
$cfo=number_format($nfo,0,'.',',');
$ctreg=number_format($treg,0,'.',',');
if ($nc==0) { $cc='-'; }
echo "