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/report_pdf2.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_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);

      
      ?>
        
        <h3 class="text-center"><strong><?php echo $mother_pui['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 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>
            </tr>
        </thead>
        <tbody>
         <?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'];                                     
                       
              ?>  
              <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>    
      </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','A4-L');
            $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