Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.12.146.108
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/employees_print_id_card.php |
<?php
include("sys_session.php");
include("sys_connect.php");
include("sys_mainphp.php");
$resp_mesg = "";
$resp_stat = "";
$resp_file = "";
$empl_code = $_POST['prim_code'];
$mysql = "select femplcode,femplname,fsalrhead,fpermadd1,fpermadd2,fpermadd3,fpermadd4,
date_format(fjoindate,'%D %M %Y') as ljoindate,
date_format(fndcadate,'%D %M %Y') as lndcadate
from masempl where femplcode = '$empl_code'";
$myres = mysqli_query($mycon, $mysql);
$mycnt = mysqli_num_rows($myres);
if ($mycnt == 0) {
$resp_mesg = "No records found!";
$resp_stat = "F";
} else {
require("fpdf/fpdf.php");
class PDF extends FPDF {
// Page header
function Header()
{
// Logo
// $pdf->Image('logo.png',10,6,30);
// Arial bold 15
// $pdf->SetFont('Arial','B',15);
// Move to the right
// $pdf->Cell(80);
// Title
// $pdf->Cell(30,6,'NDA',1,0,'C');
// Line break
// $pdf->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$pdf->SetY(-15);
// Arial italic 8
$pdf->SetFont('Arial','I',8);
// Page number
$pdf->Cell(0,6,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
}
}
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
$pdf->SetMargins(15, 15);
while ($myrow = mysqli_fetch_assoc($myres)) {
if ($myrow['femplphot'] == '') {
$empl_imge = "img-empl/blank.png";
} else {
$url = dirname($_SERVER['PHP_SELF']) . "/oums/img-empl/" . $myrow['femplphot'];
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($handle);
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if ($httpCode == 404) {
$empl_imge = "img-empl/blank.png";
$dept_imge = "img-empl/blank.png";
} else {
$empl_imge = "img-empl/" . $myrow['femplphot'];
$dept_logo = "img-dept/" . $myrow['fdeptlogo'];
}
curl_close($handle);
}
$pdf->SetFont('ARIAL', 'B', 16);
$pdf->Cell(0, 7, "ID CARD", 0, 1, "C");
$pdf->Image($empl_imge,10,6,30);
$pdf->SetFont('ARIAL', '', 12);
$pdf->Cell(0, 7, $myrow['femplname'], 0, 1, "C");
$pdf->Cell(0, 7, $myrow['fempldesn'], 0, 1, "C");
}
$resp_file = 'reports/empl_id_card_'.$empl_code.'.pdf';
$pdf->output($resp_file, 'F');
}
echo json_encode(array("mesg" => $resp_mesg, "stat" => $resp_stat, "file" => $resp_file));
|