สอบถามการแบ่งหน้ารายงาน ใน fpdf แบบ Limit 0,5

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา สอบถามการแบ่งหน้ารายงาน ใน fpdf แบบ Limit 0,5

สอบถามการแบ่งหน้ารายงาน ใน fpdf แบบ Limit 0,5
1
พอดีอยากจะแบ่งรายงาน 1 หน้ามี 5 อัน (มีหลายหน้า) โดยคำนวณเงินรวมหน้าใครหน้ามันไปเลย แต่ไม่รู้ว่าควรเพิ่มโค้ตยังไง รบกวนช่วยหน่อยครับผม
crying
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
    include('../fpdf/fpdf.php');
    require_once('../controllers/database.php');
//$objCon -> set_charset("utf-8");
class PDF extends FPDF
{
// Page header
function Header()
{
    // Logo
    //$this->Image('logo.png',10,6,30);
    // Arial bold 15
    $this->SetFont('Arial','B',15);
    // Move to the right
    $this->Cell(80);
    // Title
    $this->Cell(30,10,'Title',1,0,'C');
    // Line break
    $this->Ln(20);
}
 
// Page footer
function Footer()
{
    // Position at 1.5 cm from bottom
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
//Select the Products you want to show in your PDF file
//$result=mysql_query("select Code,Name,Price from Products ORDER BY Code",$link);
$login_id = $_GET['login_id'];
$strSQL = "SELECT * FROM tt_login AS d1 LEFT JOIN tt_club AS d2 ON (d1.login_on_club = d2.club_id) WHERE d1.login_id = '".$login_id."' ";
$objQuery = mysqli_query($objCon,$strSQL);
$objResult = mysqli_fetch_array($objQuery,MYSQLI_ASSOC);
 
$login_on_club = $objResult['login_on_club'];
$name_id = $_GET['name_id'];
 
$strSQLListDetail = "SELECT * FROM tt_club_detail AS d1 LEFT JOIN tt_club_name AS d2 ON (d1.name_id = d2.name_id) LEFT JOIN tt_prefix AS d3 ON (d2.prefix_id = d3.prefix_id) LEFT JOIN tt_club AS d4 ON (d1.club_id = d4.club_id) WHERE d1.name_id = '".$name_id."'";
$objQueryListDetail = mysqli_query($objCon,$strSQLListDetail);
 
$rows = mysqli_num_rows($objQueryListDetail);
 
//$number_of_products = mysqli_numrows($result);
 
//Initialize the 3 columns and the total
$column_id = "";
$column_club = "";
$column_name = "";
$column_bill = "";
$column_money = "";
$column_price = "";
$total = 0;
 
//For each row, add the field to the corresponding column
while($objResultListDetail = mysqli_fetch_array($objQueryListDetail,MYSQLI_ASSOC))
{
    $detail_id = $objResultListDetail["detail_id"];
    $club_name = $objResultListDetail["club_name"];
    $prefix_name = $objResultListDetail["prefix_name"];
    $name_name = $objResultListDetail["name_name"];
    $name_lastname = $objResultListDetail["name_lastname"];
    $name_join = $objResultListDetail["name_join"];
    $detail_bill = $objResultListDetail["detail_bill"];
    $detail_money = $objResultListDetail["detail_money"];
    $detail_status = $objResultListDetail["detail_status"];
 
    $time = date("d/m/", strtotime($name_join));
    $year = date("Y",strtotime($name_join));
    $sum_year = $time.($year+543);
 
    //$code = $row["Code"];
    //$name = substr($row["Name"],0,20);
    //$real_price = $row["Price"];
    //$price_to_show = number_format($row["Price"],',','.','.');
 
    $column_id = $column_id.$detail_id."n";
    $column_club = $column_club.$club_name."n";
    $column_name = $column_name.$prefix_name.$name_name." "." ".$name_lastname." [ ".$sum_year." ]"."n";
    $column_bill = $column_bill.$detail_bill."n";
    $column_money = $column_money.$detail_money."n";
    $column_price = $column_price.$detail_money."n";
 
    //Sum all the Prices (TOTAL)
    $total = $total+$detail_money;
}
mysqli_close($objCon);
 
//Convert the Total Price to a number with (.) for thousands, and (,) for decimals.
//$total = number_format($total,',','.','.');
 
//Create a new PDF file
$pdf=new FPDF();
$pdf->AddPage();
$pdf->AddFont('THSarabunNew','','THSarabunNew.php');
$pdf->SetFont('THSarabunNew','',16);
//Fields Name position
$Y_Fields_Name_position = 20;
//Table position, under Fields Name
$Y_Table_Position = 26;
 
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(10);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->Cell(10,6,iconv("UTF-8","cp874",'#'),1,0,'C',1);
 
$pdf->SetX(20);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->Cell(30,6,iconv("UTF-8","cp874",'ชื่อสมาคม'),1,0,'C',1);
 
$pdf->SetX(50);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->Cell(100,6,iconv("UTF-8","cp874",'ชื่อ - สกุล'),1,0,'C',1);
 
$pdf->SetX(150);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->Cell(30,6,iconv("UTF-8","cp874",'รหัส'),1,0,'C',1);
 
$pdf->SetX(180);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->Cell(20,6,iconv("UTF-8","cp874",'จำนวน'),1,0,'C',1);
$pdf->Ln();
 
//Now show the 3 columns
$pdf->SetY($Y_Table_Position);
$pdf->SetX(10);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(10,6,iconv("UTF-8","cp874",$column_id),1,'C');
 
$pdf->SetY($Y_Table_Position);
$pdf->SetX(20);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(30,6,iconv("UTF-8","cp874",$column_club),1,'C');
 
$pdf->SetY($Y_Table_Position);
$pdf->SetX(50);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(100,6,iconv("UTF-8","cp874",$column_name),1,'L');
 
$pdf->SetY($Y_Table_Position);
$pdf->SetX(150);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(30,6,iconv("UTF-8","cp874",$column_bill),1,'C');
 
$pdf->SetY($Y_Table_Position);
$pdf->SetX(180);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(20,6,iconv("UTF-8","cp874",$column_money),1,'C');
 
$pdf->SetX(180);
//$pdf->SetFont('THSarabunNew','',16);
$pdf->MultiCell(20,6,'$ '.number_format($total),1,'C');
 
//Create lines (boxes) for each ROW (Product)
//If you don't use the following code, you don't create the lines separating each row
$i = 0;
$pdf->SetY($Y_Table_Position);
//while ($i < $number_of_products)
//{
//    $pdf->SetX(45);
//    $pdf->MultiCell(120,6,'',1);
//    $i = $i +1;
//}
 
$pdf->Output();
?>


Slayerz Namelezz 19-10-2018 13:41:14

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )







เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ