Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/backup_full/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/backup_full/report_pdf1.php

<?php
  include 'mpdf/mpdf.php';
  include 'db/database.php';
  ob_start();
?>
<link rel="icon" type="image/x-icon" href="icon1.ico" />
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/logo1.gif" />
<html lang="en">
    <head>
        
    </head>  
    <body>
    <?php
    $sahakorn= $_GET['sahakorn'];
    $year= $_GET['year'];
    if(empty($year)){
	
      }else{
       $sql_name = "SELECT * FROM sahakorn WHERE sahakornID = $sahakorn ";
       $result_name = mysqli_query($link, $sql_name);
       $name_sahakorn = mysqli_fetch_assoc($result_name);
        
       $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);
      
      ?>
        
        <h3 class="text-center"><strong><?php echo $name_sahakorn['name']; ?> </strong></h3>
        <h4 class="text-center"><strong>รายงานข้อมูลแปรรูปปุ๋ยผสม ปีบัญชี&nbsp;<?php echo $year; ?></strong></h4>       
        
        <section class="content">

        <div class="col-md-8 col-md-offset-2">

<div  class="table-responsive">
    <table  align="center"id="mytable" class="table table-bordered">
        <thead >
            <tr class="active">
              <th class="text-center">สูตรปุ๋ยที่ผสม</th>                
                <th style="text-align: center;">จำนวนที่ผสม(เป็นกระสอบ)</th>
                <th style="text-align: center;">แม่ปุ๋ย46-0-0</th>
                <th style="text-align: center;">แม่ปุ๋ย18-46-0</th>
                <th style="text-align: center;">แม่ปุ๋ย0-0-60</th>
                <th style="text-align: center;">รวมทั้งสิ้น(กิโลกรัม)</th>              
            </tr>
        </thead>
        <tbody>
            <?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-center"><?php echo $row_loop['sk']; ?></td>
                <td class="text-center"><?php echo number_format($row_loop['46-0-0'],2); ?></td>
                <td class="text-center"><?php echo number_format($row_loop['18-46-0'],2); ?></td> 
                <td class="text-center"><?php echo number_format($row_loop['0-0-60'],2); ?></td>   
                <td class="text-center"><?php echo number_format($total,2); ?></td>                          
              </tr>
            <?php  }  ?>
         
             <tr>
                <td class="text-center">ผลรวม</td>
                <td class="text-center"> <?php echo $total_sack; ?> </td>
                <td class="text-center"> <?php echo number_format($total_46,2); ?> </td>
                <td class="text-center"> <?php echo number_format($total_18,2);  ?> </td>
                <td class="text-center"> <?php echo number_format($total_0,2); ?> </td>  
                <td class="text-center"> <?php echo number_format($total_sum,2);  ?> </td>
             </tr>
           </tbody>
         </table>
        </div>         
       </div>    
      </section>
     <?php  }  ?>
        
          <?php
          include 'function_datethai.php';
          date_default_timezone_set("Asia/Bangkok");
          $eng_date=time();
           
            $html = ob_get_contents();
            ob_end_clean();
            
            $mpdf=new mPDF('utf-8');
            $mpdf->margin_header = 9;
            $mpdf->SetHeader('รายงานโดย กรมตรวจบัญชีสหกรณ์ | รายงานข้อมูลแปรรูปปุ๋ยผสม  | ออกรายงานเมื่อ: '.thai_date($eng_date));
            $mpdf->margin_footer = 9;
            $mpdf->SetFooter('หน้าที่ {PAGENO}');
            // Define a Landscape page size/format by name
            //$mpdf=new mPDF('utf-8', 'A4-L');
            // Define a page size/format by array - page will be 190mm wide x 236mm height
            //$mpdf=new mPDF('utf-8', array(190,236));  
            $stylesheet = file_get_contents('assets/css/printpdf.css');
            //$mpdf->SetDisplayMode('fullpage');
            $mpdf->WriteHTML($stylesheet,1);
            $mpdf->WriteHTML($html,2);
            //$mpdf->Output();
            $mpdf->Output(time().'.pdf','I');
            
            
            exit;
        ?>
    </body>
</html>

Zerion Mini Shell 1.0