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,027

HOME > PHP > PHP Forum > แต่ออกรายงานเป็น Mpdf ไม่ตัดขึ้นหน้าใหม่ให้ครับ ช่วยแนะนำหน่อยครับ



 

แต่ออกรายงานเป็น Mpdf ไม่ตัดขึ้นหน้าใหม่ให้ครับ ช่วยแนะนำหน่อยครับ

 



Topic : 136489



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



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



ออกรายงาน php mysql กด Ctrl P ออกมาปกติตัดหน้าขึ้นใหม่ตรงตามต้องการ
แต่ออกรายงานเป็น Mpdf มันตัดขึ้นหน้าใหม่ให้ครับ ช่วยแนะนำหน่อยครับ
หน้าแรก
11
หน้าสอง
22
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<title>PDF</title>
<link href="https://fonts.googleapis.com/css?family=Sarabun&display=swap" rel="stylesheet">
<style type="text/css">
.TH {
	font-family: "TH SarabunPSK";
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<?php
$date1 ='31122564';
$ex = explode('-',$date1);
$dataclose ='31122564';
$data_g = '0001';
$d1 =substr($dataclose, 0, 2);
$m1 =substr($dataclose, 2, 2); 
$y1 =substr($dataclose, 4, 4);					 
$data_close = $d1.'-'.$m1.'-'.$y1;		 
$data_close2 = $y1.'-'.$m1.'-'.$d1;
//echo $dataclose;
set_time_limit(0);
ini_set("memory_limit","256M");
include("../../Conn/connfoxpro.php");
//$ye = $y+543;
$date1 = date("Y-m-d");
//ที่มาของสหกรณ์
$sql_sys ="Select * From constsys 
  Inner Join location On constsys.prov = location.prov And constsys.subprov = location.subprov 
  Inner Join location location1 On location.prov = location1.prov where  location1.subprov='00'";
$results1 = odbc_exec($conn,$sql_sys);
while (odbc_fetch_row( $results1 )) {
	$consys = odbc_result($results1,"coname");
	$conv = iconv("windows-874","UTF-8",$consys );
	$coaddr = odbc_result($results1,"coaddr");
	$coadd = iconv("windows-874","UTF-8",$coaddr );	
	$lnames = odbc_result($results1,"lname");
	$lnamep = iconv("windows-874","UTF-8",$lnames );
	$tel = odbc_result($results1,"tel");
	$fax = odbc_result($results1,"fax");
	$zipcod1 = odbc_result($results1,"zipcode");
}
include("testcounttime.php");
$getpost1;
$date1 = date("Y-m-d");
		 $d4 =substr($date1, 8, 2);
		 $m4 =substr($date1, 5, 2); 
		 $y4 =substr($date1, 0, 4)+543;		 
		 $date_now = $d4.'-'.$m4.'-'.$y4;
include("../mpdf.php");
include("../../Conn/conn2.php");
  $sql_group =" SELECT * from (SELECT memberid,contractid,balanceamt,isstatus,loanid from t_contract where isstatus = 'Y' AND balanceamt <> 0.00 )as tb01
			    INNER JOIN (SELECT * FROM member_copy  Where groupid ='$data_g' ) AS tb02 on tb01.memberid=tb02.code_id GROUP by code_id ORDER by code_id ";
		
    $s_group = mysql_db_query($dbname,$sql_group);
	$i=0;
	while ($row =  mysql_fetch_array($s_group)) {

$html .= '<table  width="900px" border="0" align="center" cellpadding="3" cellspacing="3" class="TH">';
$html .= '<tr>';
$html .= ' <td colspan="2" >เรียน'.$row["name"].'</td>';
$html .= ' </tr>';
$html .= ' <tr>';
$html .= '  <td colspan="2" >บ้านเลขที่' .$row["address"].' หมู่ '.$row["mou"]. 'ตำบล'.$row["tombol"].'</td>';
$html .= '  </tr>';
$html .= ' <tr>';
$html .= '  <td colspan="2" >อำเภอ'.$row["amphor"].' จังหวัด'.$row["prov"].'&nbsp;&nbsp;'.$row["zipcode"].'</td>';
$html .= ' </tr>';
$html .= ' <tr>';
$html .= '    <td align="center" >&nbsp;</td>';
$html .= '    <td align="right" >กลุ่มที่ '.$row["groupid"].' เลขที่สมาชิก' .$row["code_id"].'</td>';
$html .= '  </tr>';
$html .= '<tr>';
$html .= ' <td align="left" colspan="2">วันที่&nbsp;'.y3($date_now).'</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">'.$conv.'</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">&nbsp;</td>';
$html .= '  </tr>';
 $html .= ' <tr>';
$html .= '    <td align="center" colspan="2">หนังสือเตือนให้ชำระหนี้เงินกู้</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">&nbsp;</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="left" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;โดยหนังสือฉบับนี้ สหกรณ์ขอเรียนให้ท่านทราบว่า จนถึงวันที่ '.y3($data_close).'&nbsp;&nbsp;ท่านต้องชำระหนี้ต่อสหกรณ์ ดังรายการต่อไปนี้ </td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="left" width="250" colspan="2">';
$html .= '	<table width="900" border="1" style="border-collapse: collapse">';
$html .= '<tr>';
$html .= '        <td align="center" valign="middle" rowspan="2">ลำดับที่</td>';
$html .= '        <td align="center" colspan="2">สัญญาเงินกู้</td>';
$html .= '        <td align="center" valign="middle" rowspan="2">วันที่สิ้นสุดสัญญา</td>';
$html .= '       <td align="center" valign="middle" rowspan="2">ต้นเงินคงเหลือ</td>';
$html .= '        <td align="center" colspan="3">จำนวนเงินที่ต้องชำระ</td>';
$html .= '        <td align="center" valign="middle"  rowspan="2">รวมเงิน</td>';
$html .= '      </tr>';
$html .= '      <tr>';
$html .= '        <td align="center" >ประเภท</td>';
$html .= '        <td align="center" >เลขที่</td>';
$html .= '        <td align="center" width="80px">ต้นเงิน</td>';
$html .= '        <td align="center" width="80px">ดอกเบี้ย</td>';
$html .= '        <td align="center" width="80px">ค่าปรับ</td>';
$html .= '      </tr>';

			
				$mem_c = $row['code_id'];
				$sum_bal_amt2 = 0;
				$sum_Sumdue_amt2 = 0;
				$sum_int_amt2 = 0;
				$sum_fee_amt2 = 0;
				$sum_Sumbal_amt2 = 0;
				$xxx = 0;
				$yyy = 0;
				$sql1 = "SELECT * from
					(SELECT contractid,memberid,contradate,isstatus,allowamt,balanceamt,intoverdue,foreint,feeoverdue,intrate,intdate,intdue,feedate,feedue,datediff('$data_close2',intdate) as d_int_count,datediff('$data_close2',feedate) as d_fee_count
					,forefee,workdate,loanid,loanname,name,address,mou,tombol,amphor,prov,zipcode,groupid,normalshare,name_unit,code_id from
					(SELECT * from t_contract Where memberid ='$mem_c')as tb01
					LEFT join (SELECT * from member_copy)as tb02
					on tb01.memberid=tb02.code_id )as tabjoin1
					LEFT join (SELECT memberid,contractid as contractid2,sum(balancedue) as balancedue_1,isstatus,duedate,datediff('$data_close2',duedate ) AS d_fee_count2 from t_contract_due 
					Where isstatus='W' AND duedate <= '$data_close2' AND memberid ='$mem_c' GROUP by contractid ) as tb_due
					on tabjoin1.contractid=tb_due.contractid2
					where code_id ='$mem_c'";
		     	$Qtotal = mysql_db_query($dbname,$sql1);
		     	$total = mysql_num_rows($Qtotal);
				
				$u=0;
				while ($row1 = mysql_fetch_array( $Qtotal )) { 
				$cont_id = $row1['contractid'];
				$bal_amt = $row1['balanceamt'];
				$bal_due = $row1['balancedue_1'];
				$ds_int = $row1['d_int_count'];
				$ds2_int = $ds_int;
				$ds_fee= $row1['d_fee_count'];
				$ds2_fee = $ds_fee;
				$ds_fee2= $row1['d_fee_count2'];
				$ds2_fee2 = $ds_fee2;
				if(($row1['duedate'] >= $row1['feedate'])&&($row1['duedate']<= $data_close2 )){ $dfe1 = $ds2_fee2;}
				else { $dfe1 = $ds2_fee ;};
				$Int_1 = ($row1['balanceamt']*$row1['intrate'])/100*($ds2_int/$getpost1);
				$Fee_1 = ($row1['balancedue_1']*3)/100*($dfe1/$getpost1);
				$All_int = $Int_1 + $row1['intdue'] + $row1['intoverdue'];
				$All_fee = $Fee_1 + $row1['feedue'] + $row1['feeoverdue'];
				$Sumbal = $row1['balancedue_1'] + $All_int + $All_fee;
				$sum_bal_amt2 = $sum_bal_amt2 + $bal_amt;
				$sum_Sumdue_amt2 = $sum_Sumdue_amt2 + $bal_due;
				$sum_int_amt2 = $sum_int_amt2 + $All_int ;
				$sum_fee_amt2 = $sum_fee_amt2 + $All_fee ;
				$sum_Sumbal_amt2 = $sum_Sumbal_amt2 + $Sumbal;
				$u++;
				
$html .= '      <tr>';
$html .= '        <td align="center">'.$u.'</td>';
$html .= '        <td align="left">'.$row1["loanname"].'</td>';
$html .= '        <td align="center">'.$row1["contractid"].'</td>';
 //วันสิ้นสุดสัญญา
				$sql_d="select memberid,contractid,balancedue,isstatus,duedate,dueid,MAX(duedate) as due_date from t_contract_due 
				Where contractid ='$cont_id' GROUP by contractid ";
				$d_total = mysql_db_query($dbname,$sql_d);
				while ($row2 = mysql_fetch_array( $d_total )) 
				$duedate1 = $row2['due_date'];
				$dd1 =substr($duedate1, 8, 2);
				$mm1 =substr($duedate1, 5, 2); 
				$yy1 =substr($duedate1, 0, 4);	 
				$due_date = $dd1.'/'.$mm1.'/'.$yy1;

$html .= '        <td align="right">'.$due_date.'</td>';
$html .= '        <td align="right">'.number_format($row1["balanceamt"],2).'</td>';
$html .= '        <td align="right">'.number_format($bal_due,2).'</td>';
$html .= '        <td align="right">'.number_format($All_int,2).'</td>';
$html .= '        <td align="right">'.number_format($All_fee,2).'</td>';
$html .= '        <td align="right">'.number_format($Sumbal,2).'</td>';
$html .= '     </tr>';
	}
$html .= '     <tr>';
$html .= '       <td align="center" colspan="4">รวม</td>';
$html .= '      <td align="right" >'.number_format($sum_bal_amt2,2).'</td>';
$html .= '      <td align="right" >'.number_format($sum_Sumdue_amt2,2).'</td>';
$html .= '      <td align="right" >'.number_format($sum_int_amt2,2).'</td>';
$html .= '      <td align="right" >'.number_format($sum_fee_amt2,2).'</td>';
$html .= '      <td align="right" >'.number_format($sum_Sumbal_amt2,2).'</td>';
$html .= '</tr>';
$html .= '</table>	';
$html .= '</td>';
$html .= '</tr><tr><td align="center" colspan="2">&nbsp;</td></tr>';
$html .= '<tr> ';
$html .= '<td align="left" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      จึงเรียนมาเพื่อ โปรดนำเงินจำนวน '.number_format($sum_Sumbal_amt2,2).' บาท ( '.num2Thai($sum_Sumbal_amt2).' )</td>';
$html .= ' 	  </tr>';
$html .= ' <tr>';
$html .= '   <td align="left" colspan="2">ไปชำระ ณ ที่ทำการ '.$conv.'ภายในวันที่ ............................................................... จักขอบพระคุณยิ่ง</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">&nbsp;</td>';
$html .= '  </tr>';
$html .= ' <tr>';
$html .= ' <td align="center" colspan="2">&nbsp;</td>';
$html .= ' </tr>';
$html .= ' <tr>';
 $html .= '   <td align="center">&nbsp;</td>';
 $html .= '   <td align="center">ขอแสดงความนับถือ</td>';
 $html .= ' </tr>';
 $html .= ' <tr>';
 $html .= '   <td align="center" colspan="2">&nbsp;</td>';
 $html .= ' </tr>';
 $html .= ' <tr>';
 $html .= '   <td align="center">&nbsp;</td>';
 $html .= '   <td align="center">..................................</td>';
 $html .= ' </tr>';
$html .= '  <tr>';
$html .= '    <td align="center">&nbsp;</td>';
$html .= '    <td align="center">ผู้จัดการ</td>';
$html .= '  </tr>';
while($u<8){
$u++;
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">'.$u.'</td>';
$html .= '  </tr>';
	}
$html .= '  <tr>';
$html .= '    <td align="center" width="250" colspan="2"><hr noshade />ใบตอบรับหนังสือเตือนให้ชำระหนี้เงินกู้</td>';
$html .= ' </tr>';
$html .= ' <tr>';
$html .= '   <td align="center" width="250" colspan="2">&nbsp;</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '<td align="right" colspan="2">วันที่........................................&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="center" colspan="2">&nbsp;</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="left" width="250" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      ข้าพเจ้า '.$row["name"].'</td>';
$html .= '  </tr>';
$html .= '  <tr>';
$html .= '    <td align="left" width="250" colspan="2">ได้รับหนังสือเตือนชำระหนี้เงินกู้ของสหกรณ์ ลงวันที่ี่ '.y3($date_now).' แล้ว</td>';
$html .= '  </tr>';
$html .= '  <tr><td align="left" colspan="2">ข้าพเจ้าจะนำเงินจำนวน........................................บาท ไปชำระให้แล้วเสร็จ ภายในวันที่........................................</td></tr>';
$html .= '  <tr><td width="250" colspan="2" align="center">&nbsp;</td></tr>';
$html .= '  <tr><td width="250" colspan="2" align="center">&nbsp;</td></tr>';
$html .= '  <tr>';
$html .= ' <td align="right" colspan="2">(ลงชื่อ)..............................................สมาชิก&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
$html .= ' </tr>';
$html .= ' <tr>';
$html .= ' <td align="center" width="250">&nbsp;</td>';
$html .= ' <td align="right" width="250" >กลุ่มที่&nbsp;'.$row["groupid"].'&nbsp;&nbsp;&nbsp;เลขที่สมาชิก&nbsp;'.$row["code_id"].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
$html .= ' </tr>';
$html .= ' <tr>';
$html .= ' <td align="center" width="250" colspan="2">&nbsp;</td>';
$html .= ' </tr>';
$html .= '</tbody>';
$html .= '</table>';			
}
?>
  <script>
window.alert('ส่งออก PDF เรียบร้อย');window.location='../examples/loan_warning_g_mem.pdf'
  </script>
 </body>
 </html>
<?
$mpdf = new mPDF('th', 'A4', '0', 'THSaraban');
//$mpdf->setFooter('{PAGENO}');
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($style);
$mpdf->WriteHTML($html,2);
$mpdf->Output('loan_warning_g_mem.pdf','F');
exit;
?>




Tag : PHP, MySQL, HTML, CSS, PDF









ประวัติการแก้ไข
2021-11-18 15:05:30
2021-11-19 11:26:04
2021-11-19 11:28:58
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2021-11-18 15:04:30 By : panyaadd View : 1092 Reply : 3
 

 

No. 1



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



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


https://mpdf.github.io/configuration/configuration-v7-x.html

https://mpdf.github.io/reference/mpdf-variables/overview.html

ถ้ารุ่น >= 7 ใช้คู่มือนี้






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-11-18 21:09:11 By : mr.v
 


 

No. 2



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



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

ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.v เมื่อวันที่ 2021-11-18 21:09:11
รายละเอียดของการตอบ ::
AppServ 2.5.9 PHP 5.2.3 เลยใช้ตัวนี้ครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-11-19 11:28:05 By : panyaadd
 

 

No. 3



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



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

ตอบความคิดเห็นที่ : 2 เขียนโดย : panyaadd เมื่อวันที่ 2021-11-19 11:28:05
รายละเอียดของการตอบ ::
<div style="page-break-after: always"></div>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2022-08-10 07:21:26 By : panyaadd
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : แต่ออกรายงานเป็น Mpdf ไม่ตัดขึ้นหน้าใหม่ให้ครับ ช่วยแนะนำหน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

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