Viewing file: prePrintMoneyPersonPDF.php (10.63 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//PDF USING MULTIPLE PAGES
//FILE CREATED BY: Carlos José Vásquez Sáez
//YOU CAN CONTACT ME: carlos@magallaneslibre.com
//FROM PUNTA ARENAS, MAGALLANES
//INOVO GROUP - http://www.inovo.cl
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/connMySQL.class.php");
require('../fpdf/fpdf.php');
/** Create Database Object */
$dbObj = new DBConn;
$query = " SELECT * FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code WHERE personal_tb.Teacher_code='".$_REQUEST['Teacher_code']."'";
$result = $dbObj->execQuery($query);
$rs = $dbObj->fetchArray($result);
$query2 = " SELECT * FROM formaoffice WHERE codeId = '".$_REQUEST['codeId']."' ";
$result2 = $dbObj->execQuery($query2);
$rs2 = $dbObj->fetchArray($result2);
$query3 = "Select * From college Where collegeStatus ='1'";
$result3 = $dbObj->execQuery($query3);
$rs3 = $dbObj->fetchArray($result3);
$query4 = "SELECT * FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId LEFT JOIN position_tb ON personal_tb.PositionId = position_tb.PositionId LEFT JOIN faculty_tb ON personal_tb.Faculty_code = faculty_tb.Faculty_code Where personal_tb.Faculty_code = '".$rs['Faculty_code']."' and personal_tb.TeacherId = '1' ";
$result4 = $dbObj->execQuery($query4);
$rs4 = $dbObj->fetchArray($result4);
$query5 = " SELECT * FROM training_tb WHERE training_tb.Training_code = '".$_REQUEST['Training_code']."' ";
$result5 = $dbObj->execQuery($query5);
$rs5 = $dbObj->fetchArray($result5);
$query6 = " SELECT * FROM formaoffice WHERE maNo = '".$rs2['maNo']."'";
$result6 = $dbObj->execQuery($query6);
$num_rows = mysql_num_rows($result6);
function getMonthTh($mm) {
if($mm=='01') { $mm='Á¡ÃÒ¤Á'; }
else if($mm=='02') { $mm='¡ØÁÀҾѹ¸ì'; }
else if($mm=='03') { $mm='ÁÕ¹Ò¤Á'; }
else if($mm=='04') { $mm='àÁÉÒ¹'; }
else if($mm=='05') { $mm='¾ÄÉÀÒ¤Á';}
else if($mm=='06') { $mm='ÁԶعÒ¹'; }
else if($mm=='07') { $mm='¡Ã¡®Ò¤Á'; }
else if($mm=='08') { $mm='ÊÔ§ËÒ¤Á'; }
else if($mm=='09') { $mm='¡Ñ¹ÂÒ¹'; }
else if($mm=='10') { $mm='µØÅÒ¤Á';}
else if($mm=='11') { $mm='¾ÄȨԡÒ¹';}
else if($mm=='12') { $mm='¸Ñ¹ÇÒ¤Á'; }
return "$mm";
}
//Create new pdf file
$pdf = new FPDF();
//Set thai font
$pdf->SetThaiFont();
$pdf->AddPage();
//-- Load Form Image to Background
$pdf->Image('../form/memo_money_new.jpg', 0, 0, 203, 297);
//-- Set Font
$pdf->SetFont('AngsanaNew','',15);
//-- College name and Date , Top-Right Position
$date = explode("-",$rs2[Date]);
$day = intval($date[2]);
$month = getMonthTh(intval($date[1]));
$year = intval($date[0]);
$pdf->Text(40,27,$rs3['collegeName']);
if(!empty($day)){
$pdf->SetXY(141,29);
$pdf->Cell(9,5,$day,0,0,'C');
$pdf->SetXY(157,29);
$pdf->Cell(25,5,$month,0,0,'C');
$pdf->SetXY(187.4,29);
$pdf->Cell(12,5,$year,0,0,'C');
}
else{
$pdf->Text(144,33,' - - -');
}
//-- Set Font
$pdf->SetFont('AngsanaNew','',13);
//-- Request header
if(!empty($rs2['maNo'])){
$pdf->SetXY(24.5,29);
$pdf->Cell(33.5,5,$rs2['maNo'],0,0,'C');
}
else{
$pdf->Text(40,32.5,'-');
}
$pdf->Text(29,48.5,'¼ÙéÍӹǡÒà '.$rs3['collegeName']);
//-- Body
$pdf->SetXY(44,50.7);
$pdf->Cell(90.3,5,$rs['prefixName'].' '.$rs['Teacher_name'].' '.$rs['Teacher_lastname'],0,0,'C');
$pdf->SetXY(146.7,50.7);
$pdf->Cell(52,5,$rs['Position_name'],0,0,'C');
$pdf->SetXY(28.9,57.5);
$pdf->Cell(170.3,5,$rs['Faculty_name'].' '.$rs3['collegeName'].' ʶҺѹ¾ÃкÃÁÃÒªª¹¡',0,0,'C');
$pdf->SetFont('AngsanaNew','B',27);
switch($rs2['Travel']){
case "1" : $pdf->Text(74.2,70.1,'/'); break;
}
switch($rs2['Travel1']){
case "2" : $pdf->Text(125.5,70.1,'/'); break;
}
switch($rs2['Travel2']){
case "3" : $pdf->Text(165.5,70.1,'/'); break;
}
switch($rs2['Travel3']){
case "4" : $pdf->Text(74.2,75.7,'/'); break;
}
switch($rs2['Travel4']){
case "5" : $pdf->Text(125.5,75.7,'/'); break;
}
switch($rs2['Travel5']){
case "6" : $pdf->Text(165.5,75.7,'/'); break;
}
$pdf->SetFont('AngsanaNew','',13);
if(!empty($rs2['No_in'])){
$pdf->SetXY(48,77.9);
$pdf->Cell(99,5,$rs2['No_in'],0,0,'C');
}
else{
$pdf->Text(90,81.5,'-');
}
$pdf->SetXY(22,85);
$pdf->Cell(177,5,$rs2['Training_name'],0,0,'C');
$pdf->Text(27,95.7,$rs5['CNEU']);
$pdf->SetFont('AngsanaNew','',12);
if($num_rows){
$i = 1;
while($data = $dbObj->fetchObject($result6)){
$query7 = " SELECT * FROM personal_tb LEFT JOIN prefix ON personal_tb.First_name = prefix.prefixId WHERE Teacher_code='".$data->Teacher_code."' ";
$result7 = $dbObj->execQuery($query7);
$rs7 = $dbObj->fetchArray($result7);
$query8 = "SELECT SUM(Budget_use) AS SumB1 FROM project_tb WHERE ProjectId='".$data->ProjectId."' And Teacher_code='".$data->Teacher_code."'";
$result8 = $dbObj->execQuery($query8);
$rs8 = $dbObj->fetchArray($result8);
switch($i){
case "1" : $pdf->Text(25,109.4,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "2" : $pdf->Text(25,116.3,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "3" : $pdf->Text(25,123.5,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "4" : $pdf->Text(25,130.1,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "5" : $pdf->Text(25,137,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "6" : $pdf->Text(25,144,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "7" : $pdf->Text(25,151,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "8" : $pdf->Text(25,157.7,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "9" : $pdf->Text(115,109.4,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "10" : $pdf->Text(115,116.3,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "11" : $pdf->Text(115,123.5,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "12" : $pdf->Text(115,130.1,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "13" : $pdf->Text(115,137,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "14" : $pdf->Text(115,144,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "15" : $pdf->Text(115,151,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
case "16" : $pdf->Text(115,157.7,$rs7['prefixName'].' '.$rs7['Teacher_name'].' '.$rs7['Teacher_lastname'].' ¢éÍ '.$data->Orderlist.' , [ '.number_format($data->Budget_use,2,'.',',').' ] , [ '.$rs8['SumB1'].' ]'); break;
}
$i++;
}
}
else{
$query8 = "SELECT SUM(Budget_use) AS SumB1 FROM project_tb WHERE ProjectId='".$rs6['ProjectId']."' And Teacher_code='".$rs6['Teacher_code']."'";
$result8 = $dbObj->execQuery($query8);
$rs8 = $dbObj->fetchArray($result8);
$pdf->Text(25,109.4,$rs['prefixName'].' '.$rs['Teacher_name'].' '.$rs['Teacher_lastname'].' ¢éÍ '.$rs6['Orderlist'].' , [ '.number_format($rs6['Budget_use'],2,'.',',').' ] , [ '.$rs8['SumB1'].' ]');
}
$pdf->SetFont('AngsanaNew','',13);
$date_start = explode("-",$rs2['Date_start']);
$day_start = intval($date_start[2]);
$month_start = getMonthTh(intval($date_start[1]));
$year_start = intval($date_start[0]);
$date_finish = explode("-",$rs2['Date_finish']);
$day_finish = intval($date_finish[2]);
$month_finish = getMonthTh(intval($date_finish[1]));
$year_finish = intval($date_finish[0]);
$pdf->SetXY(52.8,160.7);
$pdf->Cell(30,5,$day_start.' '.$month_start.' '.$year_start,0,0,'C');
$pdf->SetXY(105.9,160.7);
$pdf->Cell(30,5,$day_finish.' '.$month_finish.' '.$year_finish,0,0,'C');
$pdf->SetXY(142.2,160.7);
$pdf->Cell(8,5,$rs2['Day'],0,0,'C');
if(!empty($rs2['assignMent'])){
// $pdf->SetXY(126.5,167.5);
// $pdf->Cell(71,5,$rs2['assignMent'],0,0,'C');
}
else{
// $pdf->SetXY(126.5,167.5);
// $pdf->Cell(71,5,'-',0,0,'C');
}
if(!empty($rs2['assignmentName'])){
// $pdf->SetXY(25,174.4);
//$pdf->Cell(43,5,$rs2['assignmentName'],0,0,'C');
}
else{
//$pdf->SetXY(25,174.4);
// $pdf->Cell(43,5,'-',0,0,'C');
}
//-- signature
$pdf->SetXY(30.8,205.5);
$pdf->Cell(44,5,$rs['prefixName'].' '.$rs['Teacher_name'].' '.$rs['Teacher_lastname'],0,0,'C');
$pdf->SetXY(28,212.5);
$pdf->Cell(47,5,$rs['Position_name'],0,0,'C');
$pdf->SetXY(119.5,205.5);
$pdf->Cell(51.5,5,$rs4['prefixName'].' '.$rs4['Teacher_name'].' '.$rs4['Teacher_lastname'],0,0,'C');
$pdf->SetXY(119.5,212.5);
$pdf->Cell(50,5,$rs4['Position_name'],0,0,'C');
//Create file
$pdf->Output();
?>
|