Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > จะตัดส่วนที่ไม่ต้องการให้เเสดงในรายงาน pdf ขอคำแนะนำหน่อยครับ


[PHP] จะตัดส่วนที่ไม่ต้องการให้เเสดงในรายงาน pdf ขอคำแนะนำหน่อยครับ

 
Topic : 133185



โพสกระทู้ ( 18 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook


คือผมอยากตัดส่วนที่มันเเสดงออกมาในรายงานที่ผมวงสีแดงไว้ ถ้าไม่อยากให้มันเเสดงต้องแก้โค้ดยังไงครับ

editreport

Code (PHP)
001.<?php
002. 
003.include('database_connection.php');
004. 
005.list($year, $term) = explode("/",$_POST["filter_year"]);
006. 
007.function show_date($tmp) {
008.    if($tmp!="0000-00-00") {
009.        list($date,$time) = explode(" ",$tmp);
010.        list($y,$m,$d) = explode("-",$date);
011.        $y += 543;
012.        return $d."/".$m."/".$y;
013.    }
014.}
015. 
016.?>
017. 
018.<html>
019.   <head>
020.   <title>พิมพ์กราฟ</title>
023.    <script src="js/Chart.bundle.js"></script>
024.    <style type="text/css" media="print">
025.      @page { size: landscape; }
026. 
027.        @media print
028.        {   
029.            .no-print, .no-print *
030.            {
031.                display: none !important;
032.            }
033.        }
034.    </style>
035. 
036.   </head>
037. 
038.   <body>
039.         <div class=" box">
040.            <h1 align="center">สรุปรายงานนัดหมายอาจารย์ที่ปรึกษา</h1>
041.                        <h3 align="center">ปีการศึกษา : <?php print ($term)?>/<?php print ($year+543)?> &nbsp;&nbsp; ประเภท : <?php print $_POST["filter_category"]?></h3>
042. 
043.            <br />
044.<?php if($_POST["print"]!="") { ?>
045.        <style>
046.        table {
047.            border-collapse: collapse;
048.        }
049.         table,th,tr,td {
050.            border: 1px solid #8b8b8b;     
051.        }      
052.    </style>
053. 
054.               <div class="table-responsive">
055.                  <table border="1" cellpadding="5" width="100%">
056.                     <thead>
057.                        <tr  align="center">
058.                        <th>รหัสนักศึกษา</th>
059.                        <th>ชื่อ</th>
060.                        <th>วันที่</th>
061.                        <th>เวลา</th>
062.                        <th>ประเภท</th>
063.                        <th>ปีการศึกษา</th>
064.                        <th>เรื่อง</th>
065.                        </tr>
066.                     </thead>
067.                    <tbody>
068.<?php
069. 
070.                    $column = array('student_number', 'student_name', 'app_date', 'time_id', 'category_id', 'app_year', 'app_message');
071. 
072.                    $query = "SELECT * FROM appointment ";
073. 
074.                    if(isset($_POST['filter_year'], $_POST['filter_category']) && $_POST['filter_year'] != '' && $_POST['filter_category'] != '')
075.                    {
076.                        list($year, $term) = explode("/",$_POST['filter_year']);
077.                        if($term=="1") {
078.                            $fyear = " app_date between '".$year."-06-15' and '".$year."-10-24' ";
079.                        } elseif($term=="2") {
080.                            $fyear = " app_date between '".$year."-11-19' and '".($year+1)."-03-17' ";
081.                        } else {
082.                            $fyear = " app_date between '".($year+1)."-04-08' and '".($year+1)."-06-09' ";
083.                        }
084.                    #   $query .= ' WHERE app_year = "'.$_POST['filter_year'].'" AND category_id = "'.$_POST['filter_category'].'" ';
085.                        $query .= ' WHERE  '.$fyear.' AND category_id = "'.$_POST['filter_category'].'" ';
086.                    }
087. 
088.                    if(isset($_POST['order']))
089.                    {
090.                     $query .= 'ORDER BY '.$column[$_POST['order']['0']['column']].' '.$_POST['order']['0']['dir'].' ';
091.                    }
092.                    else
093.                    {
094.                     $query .= 'ORDER BY appstudent_id DESC ';
095.                    }
096. 
097.                    $statement = $connect->prepare($query);
098. 
099.                    $statement->execute();
100. 
101.                    $result = $statement->fetchAll();
102. 
103. 
104. 
105.                    $data = array();
106. 
107.                    foreach($result as $row)
108.                    {
109.?>
110.                        <tr align="center">
111.                            <td><?php print $row["student_number"]?></td>
112.                            <td><?php print $row["student_name"]?></td>
113.                            <td><?php print show_date($row['app_date'])?></td>
114.                            <td><?php print $row["time_id"]?></td>
115.                            <td><?php print $row["category_id"]?></td>
116.                            <td><?php print $row["app_year"]?></td>
117.                            <td><?php print $row["app_message"]?></td>
118.                        </tr>
119.<?php } ?>
120.                    <tbody>
121.                  </table>
122. 
123.                  <br />
124.                  <br />
125.                  <br />
126.               </div>
127.<?php } else { ?>
128.<?php
129. 
130.    $query = "SELECT month(app_date) as app_month, year(app_date) as app_year, count(   appstudent_id) as qty FROM appointment ";
131.    if($term=="1") {
132.        $fyear = " app_date between '".$year."-06-15' and '".$year."-10-24' ";
133.    } elseif($term=="2") {
134.        $fyear = " app_date between '".$year."-11-19' and '".($year+1)."-03-17' ";
135.    } else {
136.        $fyear = " app_date between '".($year+1)."-04-08' and '".($year+1)."-06-09' ";
137.    }
138. 
139.    $query .= ' WHERE  '.$fyear.' AND category_id = "'.$_POST['filter_category'].'" ';
140.    $query .= ' group by app_month order by  app_date';
141. 
142.    $statement = $connect->prepare($query);
143. 
144.    $statement->execute();
145.    $result = $statement->fetchAll();
146.    foreach($result as $row) {
147. 
148.        $data .= ($data!="")?",":"";
149.        $data .= $row['qty'];
150. 
151.        $labels .= ($labels!="")?",":"";
152.        $labels .= '"'.$row['app_month'].'/'.($row['app_year']+543).'"';
153. 
154.    }
155.?>
156.    <canvas id="myChart" style="width: 75%; height: 50%;"></canvas>
157.<?php } ?>
158.    <button type="submit" name="graph" id="graph" class="no-print" value="graph" onclick="window.print();">พิมพ์กราฟ</button>    
159. 
160.      </div>
161.   </body>
162.</html>
163. 
164.<?php if($_POST["print"]!="") { ?>
165. 
166.<script type="text/javascript" language="javascript" >
167.    window.print();
168.</script>
169. 
170.<?php }  else { ?>
171. 
172.<script>
173.  var ctx = document.getElementById("myChart").getContext('2d');
174.  var myChart = new Chart(ctx, {
175.    type: 'bar',
176.    data: {
177.      labels: [<?php print $labels?>],
178.      datasets: [{
179.        label: '# จำนวน',
180.        data: [<?php print $data?>],
181.        backgroundColor: [
182.          'rgba(255, 99, 132, 0.2)',
183.          'rgba(54, 162, 235, 0.2)',
184.          'rgba(255, 206, 86, 0.2)',
185.          'rgba(75, 192, 192, 0.2)',
186.          'rgba(153, 102, 255, 0.2)',
187.          'rgba(255, 159, 64, 0.2)'
188.        ],
189.        borderColor: [
190.          'rgba(255,99,132,1)',
191.          'rgba(54, 162, 235, 1)',
192.          'rgba(255, 206, 86, 1)',
193.          'rgba(75, 192, 192, 1)',
194.          'rgba(153, 102, 255, 1)',
195.          'rgba(255, 159, 64, 1)'
196.        ],
197.        borderWidth: 1
198.      }]
199.    },
200.    options: {
201.      scales: {
202.        yAxes: [{
203.          ticks: {
204.            beginAtZero: true
205.          }
206.        }]
207.      }
208.    }
209. 
210.  });
211. 
212.</script>
213. 
214.<?php } ?>




Tag : PHP, MySQL

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2019-02-23 17:06:53 By : max View : 661 Reply : 2
 

 

No. 1



โพสกระทู้ ( 4,765 )
บทความ ( 8 )



สถานะออฟไลน์


หน้านี้มัน html แล้วสั่ง print

มันไปทำงาน pdf ตรงไหนครับ?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-02-24 16:39:16 By : mr.v
 

 

No. 2



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ใช้ CSS ลองดูครับ

01.<html>
02.    <head>
03.        <title></title>
04.        <style type="text/css">
05.            .a {color: green;}
06.            .b {color: blue;}
07.            .printMe {display: none;}
08.            @media print {
09.                div {display: none;}
10.                .printMe {display: block;}
11.            }
12.        </style>
13.    </head>
14.    <body>
15.        <div class="a">Some text.</div>
16.        <div class="printMe">Only to be shown in print.</div>
17.        <div class="b">More characters.</div>
18.    </body>
19.</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-02-25 07:10:42 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : จะตัดส่วนที่ไม่ต้องการให้เเสดงในรายงาน pdf ขอคำแนะนำหน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่