| Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/fertilizer/ |
| Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/fertilizer/report2.php |
<!doctype html>
<html lang="en">
<!-- head -->
<?php include 'head.php'; ?>
<body>
<div class="wrapper">
<!-- เมนูด้านซ้าย -->
<?php include 'leftside.php'; ?>
<div class="main-panel">
<!-- ส่วนหัว -->
<?php include 'header.php'; ?>
<?php include 'db/database.php';
?>
<div class="content">
<div class="container-fluid">
<div class="col-md-6">
<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="material-icons"><i class="fas fa-chalkboard-teacher"></i></i>
</div>
<div class="card-content">
<h4 class="card-title">รายงานการคำนวนวัตถุดิบแม่ปุ๋ยคงเหลือ</h4>
<form class="form-horizontal" id="form_home" method="get">
<div class="row">
<label class="col-md-4 label-on-left">กรุณาเลือกสหกรณ์</label>
<div class="col-md-8">
<?php
$sql = mysqli_query($link,'SELECT * FROM sahakorn') or die('Error query #12');
?>
<div class="form-group label-floating is-empty">
<label class="control-label"></label>
<select name="sahakorn" id="sahakorn" class="selectpicker" data-live-search="true" title="กรุณาเลือกสหกรณ์">
<?php
while ($Result1 = mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $Result1['sahakornID']; ?>">
<?php echo $Result1['name']; ?>
</option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="row">
<label class="col-md-4 label-on-left">กรุณาเลือกปีบัญชี</label>
<div class="col-md-8">
<?php
$year4=(date("Y")+543);
$year1=(date("Y")+543-1);
$year2=(date("Y")+543-2);
$year3=(date("Y")+543+1);
?>
<div class="form-group label-floating is-empty">
<label class="control-label"></label>
<select name="year" id="year" class="form-control" title="กรุณาเลือกปีบัญชี" required>
<option value="">กรุณาเลือก...</option>
<?php
echo '<option value="'.$year4.'" '.$selected.'>'.$year4.'</option>'."\n";
echo '<option value="'.$year1.'" '.$selected.'>'.$year1.'</option>'."\n";
echo '<option value="'.$year2.'" '.$selected.'>'.$year2.'</option>'."\n";
echo '<option value="'.$year3.'" '.$selected.'>'.$year3.'</option>'."\n";
?>
</select>
</div>
</div>
</div>
<?php
//$sql_information = "SELECT * FROM calculate_fertilizer WHERE sahakornID = $sahakorn AND year = $year AND name_pui_C = ";
//$result_information = mysqli_query($link, $sql_information);
//$year_balance = mysqli_fetch_assoc($result_information);
?>
<div class="row">
<label class="col-md-3"></label>
<div class="col-md-9">
<div class="form-group form-button">
<button type="submit" class="btn btn-fill btn-rose">แสดง</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<?php
$sahakorn = isset($_GET['sahakorn'])? $_GET['sahakorn'] : '';
$year = isset($_GET['year']) ? $_GET['year'] : '';
if (empty($sahakorn)){
} else {
?>
<?php
//ดึงข้อมูลจากแม่ปุ๋ย
$sql_pui = "SELECT * FROM mother_pui AS t1 LEFT JOIN sahakorn AS t2 ON (t1.sahakornID = t2.sahakornID) WHERE t1.sahakornID = $sahakorn and t1.year = $year";
$result_pui = mysqli_query($link, $sql_pui);
$mother_pui = mysqli_fetch_assoc($result_pui);
//แสดงข้อมูลในตาราง
$sql_report1 = "SELECT * FROM calculate_fertilizer AS t1 LEFT JOIN sahakorn AS t2 ON (t1.sahakornID = t2.sahakornID) WHERE t1.sahakornID = $sahakorn and t1.year = $year ";
$result_report1 = mysqli_query($link, $sql_report1);
?>
<div class="col-lg-11 col-md-12">
<div class="card">
<div class="card-header card-header-tabs" data-background-color="rose">
<h4 class="card-title">รายงานการคำนวนวัตถุดิบแม่ปุ๋ยคงเหลือ <?php echo $mother_pui['name']; ?> ปี <?php echo $year; ?> </h4>
</div>
<div class="card-content table-responsive">
<table id="datatables" class="table table-hover">
<thead class="text-success">
<th class="text-center">แม่ปุ๋ย</th>
<th class="text-right">วัตถุดิบคงเหลือต้นปี</th>
<th class="text-right">ซื้อวัตถุดิบระหว่างปี</th>
<th class="text-right">รวม</th>
<th class="text-right">ขายวัตถุดิบ</th>
<th class="text-right">เบิกวัตถุดิบไปผลิต</th>
<th class="text-right">วัตถุดิบคงเหลือสิ้นปี</th>
<th class="text-right">ปริมาณนับได้(กก.)</th>
<th class="text-right">ขาด/เกิน</th>
<th class="text-right">คิดเป็นกระสอบ</th>
</thead>
<?php
$tis = 0.00;
$le = 0.00;
$cq = 0.00;
$rmry = 0.00;
$mfp = 0.00;
$srm = 0.00;
$sum_sum_sum = 0.00;
$brm = 0.00;
$rmr = 0.00;
$sum_sum = 0.00;
while ($row_report1 = mysqli_fetch_array($result_report1)) {
$sum_sum = $row_report1['remaining'] + $row_report1['buy'];
//ผลรวมแถวล่างสุด
$rmr = $rmr + $row_report1['remaining'];
$brm = $brm + $row_report1['buy'];
$sum_sum_sum = $sum_sum_sum + $sum_sum;
$srm = $srm + $row_report1['sell'];
$mfp = $mfp + $row_report1['pick_up'];
$rmry = $rmry + $row_report1['year_balance'];
$cq = $cq + $row_report1['countable_F'];
$le = $le + $row_report1['tooshort_F'];
$tis = $tis + $row_report1['sack_C'];
?>
<tbody>
<tr>
<td class="text-center"><?php echo $row_report1['name_pui_C']; ?></td>
<td class="text-right"><?php echo number_format($row_report1['remaining'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['buy'],2); ?></td>
<td class="text-right"><?php echo number_format($sum_sum,2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['sell'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['pick_up'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['year_balance'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['countable_F'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['tooshort_F'],2); ?></td>
<td class="text-right"><?php echo number_format($row_report1['sack_C'],2); ?></td>
</tr>
<?php } ?>
<tr>
<td class="text-center">ผลรวม</td>
<td class="text-right"><?php echo number_format($rmr,2); ?></td>
<td class="text-right"><?php echo number_format($brm,2); ?></td>
<td class="text-right"><?php echo number_format($sum_sum_sum,2); ?></td>
<td class="text-right"><?php echo number_format($srm,2); ?></td>
<td class="text-right"><?php echo number_format($mfp,2); ?></td>
<td class="text-right"><?php echo number_format($rmry,2); ?></td>
<td class="text-right"><?php echo number_format($cq,2); ?></td>
<td class="text-right"><?php echo number_format($le,2); ?></td>
<td class="text-right"><?php echo number_format($tis,2); ?></td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<label class="col-md-1"></label>
<div class="col-md-10">
<div class="form-group form-button">
<a id="submit1" type="button" class="btn btn-fill btn-rose" href="report_pdf2.php?sahakorn=<?php echo $sahakorn; ?>&year=<?php echo $year; ?>" target="_blank"><i class="fas fa-print"></i> พิมพ์รายงาน</a>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<!-- footer1 -->
<?php include 'footer1.php'; ?>
</div>
</div>
<!-- footer2 -->
<?php include 'footer2.php'; ?>
<!-- Mirrored from demos.creative-tim.com/material-dashboard-pro/examples/dashboard.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 20 Mar 2017 21:32:16 GMT -->
</html>