header('Content-Type: text/html; charset=tis-620');
include('db_config.php');
$sql="select *,date_format(aback,'%Y%m%d') as dback
from aw9_nation where arep='1' order by acode,arcode";
$result=mysql_query($sql);
echo "
สรุปรายการเอกสาร OBEC Awards ตัวแทนระดับภาค นำส่งประกวดระดับชาติ ณ สพป.ศรีสะเกษ เขต 1
กลับ
ที่ |
รหัส กิจกรรม |
ชื่อตัวแทนระดับภาค |
แจ้งส่ง CD |
แจ้ง LineID |
เชิญเข้า กลุ่ม |
เข้ากลุ่ม Line |
วันที่ ได้รับCD |
ตรวจสอบ ไฟล์ CD |
";
$rw=$row=1; $or=$t1=$t2=$t3=$tget=$tgrp=$ttback=0; $cd='';
while ($db=mysql_fetch_array($result)) {
if ($db[acode]>=248 and $db[acode]<=251) {
$code="4-$db[acode]";
} elseif ($db[acode]<=52) {
$code="1-$db[acode]";
} elseif ($db[acode]>=87 and $db[acode]<=134) {
$code="2-$db[acode]";
} else {
$code="3-$db[acode]";
}
if ($cd!=$db[acode]) {
$ccode=$code;
$or=1;
} else {
$ccode='';
$or++;
}
$tback=tsdate($db[dback]);
if ($db[atype]=='1') {
$type1=""; $t1++;
} elseif ($db[atype]=='3') {
$type1=""; $t3++;
} else {
$type1='';
}
if (!empty($db[aline])) {
$tline=""; $t3++;
} else {
$tline='';
}
if (!empty($db[aget])) {
$aget=""; $tget++;
} else {
$aget='';
}
if (!empty($db[agrp])) {
$agrp=""; $tgrp++;
} else {
$agrp='';
}
if (!empty($db[cdn])) {
$cdn=""; $tcdn++;
} else {
$cdn="";
}
if ($db[aback]!='0000-00-00') {
$cback=$tback; $ttback++;
} else {
$cback='';
}
if ($row>31) {
echo " |
|
|
ที่ |
รหัส กิจกรรม |
ชื่อตัวแทนระดับภาค |
แจ้งส่ง CD |
แจ้ง LineID |
เชิญเข้า กลุ่ม |
เข้ากลุ่ม Line |
วันที่ ได้รับCD |
ตรวจสอบ ไฟล์ CD |
";
$row=1;
$ccode=$code;
}
echo <<
$rw |
$ccode |
$or. สพป.$db[areg] $db[aname] |
$type1 |
$tline |
$aget |
$agrp |
$tback |
$cdn |
TB;
$rw++;
$row++;
$cd=$db[acode];
}
$tbg=number_format($tbg);
echo "
รวม |
$t1 |
$t3 |
$tget |
$tgrp |
$ttback |
$tcdn |
กลับ";
function tsdate($day) {
$Tmnt=array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.",
"ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.") ;
if ($day != '00000000') {
return intval(substr($day,6,2))." ".$Tmnt[intval(substr($day,4,2)-1)].intval(substr($day,2,2)+43) ;
} else {
return ' ';
}
}
?>