Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/fertilizer/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/fertilizer/report1.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-5">
                            <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_fertilizer" 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>  
                                                                                                                                                                         
                                        <div class="row">
                                            <label class="col-md-4"></label>
                                            <div class="col-md-8">
                                                <div class="form-group form-button">
                                                    <button id="submit" 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'] : '';
                                                        
                             
                           ?>
                        
                          <?php
                             if (empty($year)){
                             
                                 
                             } else {
                              ?> 
                           
                           <?php
                            $sql_name = "SELECT * FROM sahakorn WHERE sahakornID = $sahakorn ";
                            $result_name = mysqli_query($link, $sql_name);
                            $name_sahakorn = mysqli_fetch_assoc($result_name);
                        
                            ?>
                        
                             <?php
                              //ลูบข้อมูลจากตารางมาแสดง
                             $sql = "SELECT DISTINCT fl.name_formula as'sut',t1.sack as'sk', t2.sum as'46-0-0',t3.sum as'18-46-0',t4.sum as'0-0-60'
                             FROM sahakorn AS sk
                             INNER JOIN sahakorn_process AS t1 ON t1.sahakornID=sk.sahakornID
                             INNER JOIN sahakorn_process AS t2 ON t2.S_mother_pui='46-0-0' AND t2.sahakornID=sk.sahakornID AND t1.sack=t2.sack AND t1.formulaID=t2.formulaID AND t1.`year`=t2.`year`
                             INNER JOIN sahakorn_process AS t3 ON t3.S_mother_pui='18-46-0' AND t3.sahakornID=sk.sahakornID AND t2.sack=t3.sack AND t2.formulaID=t3.formulaID AND t2.`year`=t3.`year`
                             INNER JOIN sahakorn_process AS t4 ON t4.S_mother_pui='0-0-60' AND t4.sahakornID=sk.sahakornID AND t3.sack=t4.sack AND t3.formulaID=t4.formulaID AND t3.`year`=t4.`year`
                             INNER JOIN formula AS fl ON fl.formulaID=t1.formulaID WHERE t1.sahakornID=$sahakorn and t1.year = $year";
                             $result = mysqli_query($link, $sql);
                             ?>
                             <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 $name_sahakorn['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">แม่ปุ๋ย46-0-0</th>
                                             <th  class="text-right">แม่ปุ๋ย18-46-0</th> 
                                            <th  class="text-right">แม่ปุ๋ย0-0-60</th> 
                                            <th  class="text-right">รวมทั้งสิ้น(กิโลกรัม)</th>
                                        </thead>
                                         <?php 
                                                $total_sack = 0.00;
                                                $total_46 = 0.00;
                                                $total_18 = 0.00;
                                                $total_0 = 0.00;
                                                $total_sum = 0.00;
                                               while ($row_loop = mysqli_fetch_array($result))  {   
                                                 $total = 0.00;
                                                 $total = $total + $row_loop['46-0-0'] + $row_loop['18-46-0'] + $row_loop['0-0-60'];
                                                 $total_sack = $total_sack + $row_loop['sk'];
                                                 $total_46 = $total_46 + $row_loop['46-0-0'];
                                                 $total_18 = $total_18 + $row_loop['18-46-0'];
                                                 $total_0 = $total_0 + $row_loop['0-0-60'];
                                                 $total_sum = $total_sum + $total;
                                                   ?>
                                           <tr>
                                                <td class="text-center"><?php echo $row_loop['sut']; ?></td>
                                                <td class="text-right"><?php echo number_format($row_loop['sk'],2); ?></td>
                                                <td class="text-right"><?php echo number_format($row_loop['46-0-0'],2); ?></td>
                                                <td class="text-right"><?php echo number_format($row_loop['18-46-0'],2); ?></td> 
                                                <td class="text-right"><?php echo number_format($row_loop['0-0-60'],2); ?></td>   
                                                <td class="text-right"><?php echo number_format($total,2); ?></td>                          
                                            </tr>
                                        <tbody>
                                               <?php } ?>  
                                            
                                           <tr>
                                                <td class="text-center">ผลรวม</td>
                                                <td class="text-right"> <?php echo number_format($total_sack,2); ?> </td>
                                                <td class="text-right"> <?php echo number_format($total_46,2); ?> </td>
                                                <td class="text-right"> <?php echo number_format($total_18,2);  ?> </td>
                                                <td class="text-right"> <?php echo number_format($total_0,2); ?> </td>  
                                                <td class="text-right"> <?php echo number_format($total_sum,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_pdf1.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>  

Zerion Mini Shell 1.0