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

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

สอบถามการแบ่งหน้ารายงาน ใน fpdf แบบ Limit 0,5
พอดีอยากจะแบ่งรายงาน 1 หน้ามี 5 อัน (มีหลายหน้า) โดยคำนวณเงินรวมหน้าใครหน้ามันไปเลย แต่ไม่รู้ว่าควรเพิ่มโค้ตยังไง รบกวนช่วยหน่อยครับผม 
crying


<?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 223.206.8.xxx 19-10-2018 13:41:14

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

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


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


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







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