| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/workgroup/กลุ่มงานโภชนศาสตร์/ |
Upload File : |
<?php
if (isset($_GET['frd'])){ //กำหนดวันที่ &frd=01/12/2021&tod=31/12/2021
//echo $_GET['frd'].'<br>';
$UfromDate = $_GET['frd']; ;
if (isset($_GET['tod'])) $UtoDate = $_GET['tod'];
else $UtoDate = $UfromDate;
}else{ //ไม่กำหนดวันที่ ให้แสดงของเดือนนั้นๆ 01/12/2021 - 31/12/2021
$UfromDate = date('01/m/Y',time());
$UtoDate = date('t/m/Y',time());
}
if (isset($_POST['submit'])){
if ($_POST['submit']=="แสดง"){
$UfromDate =trim($_POST['DateFr']) ; //$_POST['DateFr']=01/01/2564
$UtoDate =trim($_POST['DateTo'] );
$UfromDate = substr($UfromDate,0,6).substr('0000'.trim(substr($UfromDate,6,4)-543) ,-4);//$UfromDate ='01/01/2021'
$UtoDate = substr($UtoDate,0,6). substr('0000'.trim(substr($UtoDate,6,4)-543) ,-4);
}
}
$end_date = substr($UtoDate,6,4).'-'.substr($UtoDate,3,2).'-'.substr($UtoDate,0,2);
$start_date = substr($UfromDate,6,4).'-'.substr($UfromDate,3,2).'-'.substr($UfromDate,0,2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>patientfood</title>
<script src="jquery-2.1.3.min.js"></script>
<link href="/workgroup/กลุ่มงานโภชนศาสตร์/bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet" />
<link href="/workgroup/กลุ่มงานโภชนศาสตร์/bootstrap-3.3.7-dist/css/bootstrap-theme.css" rel="stylesheet" />
<script src="/workgroup/กลุ่มงานโภชนศาสตร์/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<link href="/workgroup/กลุ่มงานโภชนศาสตร์/dist/css/bootstrap-datepicker.css" rel="stylesheet" />
<script src="/workgroup/กลุ่มงานโภชนศาสตร์/dist/js/bootstrap-datepicker-custom.js"></script>
<script src="/workgroup/กลุ่มงานโภชนศาสตร์/dist/locales/bootstrap-datepicker.th.min.js" charset="UTF-8"></script>
<script>
$(document).ready(function () {
$('.thdatepicker').datepicker({
format: 'dd/mm/yyyy',
todayBtn: true,
language: 'th', //เปลี่ยน label ต่างของ ปฏิทิน ให้เป็น ภาษาไทย (ต้องใช้ไฟล์ bootstrap-datepicker.th.min.js นี้ด้วย)
thaiyear: true //Set เป็นปี พ.ศ.
}).datepicker("setDate"); //กำหนดเป็นวันปัจุบัน
});
</script>
<script type="text/javascript">
<!--
function getValue(vname) {
var n = document.getElementById(vname).value
return n;
}
</script>
<style type="text/css">
@media print{
#hid{
display: none; /* ซ่อน */
}
#submit{
display: none; /* ซ่อน */
}
}
.style1 {font-family: "TH SarabunPSK";font-size: 20px}
.style117 {font-family: "TH SarabunPSK";}
.style2 {font-family: "TH SarabunPSK"; font-size: 20px; }
.style8 {font-family: "TH SarabunPSK"; font-size: 20px;color: #00FFFF }
.style9 {font-family: "TH SarabunPSK"; font-size: 20px;color: #FF0000; font-weight: bold;}
.style1 {color: #FFFFFF}
.style3 {color: #000000} </style>
</head>
<body>
<table width="100%" border="0" align="center" class="style117">
<form name="form1" method="post" action="patientfood.php">
<p align="center" ><br><label for="DateFr" class="style2" >สรุปยอดอาหารผู้ป่วยระหว่างวันที่</label>
<input name="DateFr" id="DateFr" class="thdatepicker" onKeyPress="event.returnValue = false;" size="10" width = "20px" data-date-format="mm/dd/yyyy" value = "<?php echo $UfromDate ; ?>" />
<label for="DateTo" class="style2">ถึงวันที่</label>
<input name="DateTo" id="DateTo" class="thdatepicker" onKeyPress="event.returnValue = false;" size="10" width = "20px" data-date-format="mm/dd/yyyy" value = " <?php echo $UtoDate ?>" />
<input type="submit" value="แสดง" id="submit" name="submit" >
</p>
</font> </p></table>
<div align="right">
<style>
table, td, th {
border: 2px solid green; //กำหนดความหนาและสีของเส้นขอบ
}
th {
background-color: #3366cc; //กำหนดสีพื้นหลังของหัวตาราง
}
.style 10 {
font-family: "TH SarabunPSK"; font-size: 24px;color:#000000;
}
</style>
<table width="7%" class="table" id="datatable">
<thead>
<th colspan='2'></th>
<th colspan='7' align='center'><span class="style1">อาหารผู้ป่วยสามัญ</span></th>
<th colspan='6' align='center'><span class="style1">อาหารผู้ป่วยพิเศษ</span></th>
</thead>
<thead>
<th><span class="style8">วันที่</span></th>
<th><span class="style8">ตึก</span></th>
<th><span class="style8">เช้า</span></th>
<th><span class="style8">กลางวัน</span></th>
<th><span class="style8">เย็น</span></th>
<th><span class="style8">อาหารสายยาง</span></th>
<th><span class="style8">อาหารสายยาง</span></th>
<th><span class="style8">อาหารสายยาง</span></th>
<th><span class="style8">รวมสามัญ</span></th>
<th><span class="style2">เช้า</span></th>
<th><span class="style2">กลางวัน</span></th>
<th><span class="style2">เย็น</span> </th>
<th><span class="style2">รวม</span> </th>
<th><span class="style2">อาหารว่าง</span> </th>
</thead>
<?php
$month_arr= Array("","ม.ค." , "ก.พ." , "มี.ค." , "เม.ย." , "พ.ค." , "มิ.ย." , "ก.ค." , "ส.ค." , "ก.ย." , "ต.ค." ,"พ.ย." , "ธ.ค." );
ini_set('display_errors', 1);
error_reporting(~0);
//ตั้งค่าการเชื่อมต่อฐานข้อมูล
$database_host = '192.168.1.39';
$database_port = '3306';
$database_username = 'root';
$database_password = '090407';
$database_name = 'report';
$mysqli = new mysqli($database_host, $database_username, $database_password, $database_name, $database_port);
$mysqli->set_charset("utf8");
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
$sql='SELECT * FROM PatientFood inner join station on PatientFood.ward = station.stationid where date>= "'.$start_date.'" AND date<="'.$end_date.'"';
$result=$mysqli->query( $sql);
while($PatientFood = $result->fetch_array()){
$date1 =$PatientFood['date'];
$new_date = substr( $date1,8,2).'/'.substr( $date1,5,2).'/'. substr('0000'.trim(substr($date1,0,4) +543),-4);
echo "<td>".$new_date."</td>";
echo "<td align='right'><span>".$PatientFood['station']."</span></td>";
echo "<td align='right'><span>".$PatientFood['morning']."</span></td>";
echo "<td align='right'><span>".$PatientFood['lunch']."</span></td>";
echo "<td align='right'><span>".$PatientFood['evening']."</span></td>";
echo "<td align='right'><span>".$PatientFood['tubefood1']."</span></td>";
echo "<td align='right'><span>".$PatientFood['tubefood2']."</span></td>";
echo "<td align='right'><span>".$PatientFood['tubefood3']."</span></td>";
$sum=$PatientFood['morning']+$PatientFood['lunch']+$PatientFood['evening']+$PatientFood['tubefood1']+$PatientFood['tubefood2']+$PatientFood['tubefood2']+$PatientFood['tubefood3'];
echo "<td class='style9' align='right'> ".$sum."</td> ";
echo "<td align='right'><span>".$PatientFood['spcmorning']."</span></td>";
echo "<td align='right'><span>".$PatientFood['spclunch']."</span></td>";
echo "<td align='right'><span>".$PatientFood['spcevening']."</span></td>";
$sum2=$PatientFood['spcmorning']+$PatientFood['spclunch']+$PatientFood['spcevening'];
echo "<td class='style9' align='right'> ".$sum2."</td> ";
echo "<td align='right'><span>".$PatientFood['snack']."</span></td>";
echo "</tr>";
}
mysqli_free_result($result);
$sql1='SELECT Sum(morning) ,Sum(lunch) ,Sum(evening) ,Sum(tubefood1) ,Sum(tubefood2) ,Sum(tubefood3) ,Sum(tubefood3) ,Sum(spcmorning) ,Sum(spclunch) ,Sum(spcevening) ,Sum(snack) FROM PatientFood where date>= "'.$start_date.'" AND date<="'.$end_date.'"';
$result1=$mysqli->query( $sql1);
while($PatientFood1 = $result1->fetch_array()){
$Summorning =0;
$Sumlunch=0;
$Sumevening =0;
$Sumtubefood1 =0;
$Sumtubefood2 =0;
$Sumtubefood3 =0;
$Sumspcmorning =0;
$Sumspclunch =0;
$Sumspcevening =0;
$Sumsnack =0;
$Summorning += $PatientFood1['Sum(morning)'];
$Sumlunch += $PatientFood1['Sum(lunch)'];
$Sumevening += $PatientFood1['Sum(evening)'];
$Sumtubefood1 += $PatientFood1['Sum(tubefood1)'];
$Sumtubefood2 += $PatientFood1['Sum(tubefood2)'];
$Sumtubefood3 += $PatientFood1['Sum(tubefood3)'];
$Sumspcmorning += $PatientFood1['Sum(spcmorning)'];
$Sumspclunch +=$PatientFood1['Sum(spclunch)'];
$Sumspcevening +=$PatientFood1['Sum(spcevening)'];
$Sumsnack +=$PatientFood1['Sum(snack)'];
$sumOrdinaryfood=$Summorning+$Sumlunch+$Sumevening+$Sumtubefood1+$Sumtubefood2+$Sumtubefood3;
$SumSpecialfood=$Sumspcmorning+$Sumspclunch+$Sumspcevening;
echo "<td class='style2' align='right'> ".''."</td> ";
echo "<td class='style2' align='right'> ".''."</td> ";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(morning)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(lunch)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(evening)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(tubefood1)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(tubefood2)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(tubefood3)']."</span></td>";
echo "<td class='style9' align='right'> ".$sumOrdinaryfood."</td> ";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(spcmorning)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(spclunch)']."</span></td>";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(spcevening)']."</span></td>";
echo "<td class='style9' align='right'> ".$SumSpecialfood."</td> ";
echo "<td class='style9' align='right'><span>".$PatientFood1['Sum(snack)']."</span></td>";
echo "</tr>";
}
?>
</tbody>
</table>
<p align='center'> อาหารผู้ป่วยสามัญ <?php echo "<td class='style2' align='right'> ".$sumOrdinaryfood."</td> " ?>มื้อ
อาหารผู้ป่วยพิเศษ <?php echo "<td class='style2' align='right'> ".$SumSpecialfood."</td> " ?> มื้อ
อาหารว่าง <?php echo "<td class='style2' align='right'> ".$Sumsnack."</td> " ?> มื้อ </strong></font> </p>
</div>
<div class='style10' align="right">(ลงชื่อ)............................................. </div>
<div class='style10' align="right"> (..นางสาวสำเนียง พงษ์แพทย์.) </div>
<div class='style10' align="right">โภชนากรชำนาญงาน </div>