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.138.34.93
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/attendance_report_month_details.php |
<?php
include("sys_session.php");
include("sys_connect.php");
include("sys_mainphp.php");
$resp_mesg="";
$resp_stat="";
$resp_file="";
$dept_code=$_POST['dept_code'];
$attn_mnth=$_POST['attn_mnth'];
$mysql ="";
$mysql.="select masempl.fdeptcode,masempl.femplcode,femplname,fdesnordr from masempl,masdesn,attendance ";
$mysql.="where masempl.fdesncode=masdesn.fdesncode and masempl.femplcode=attendance.femplcode ";
$mysql.="and masempl.fdeptcode='$dept_code' and attendance.fattndate like '$attn_mnth%'";
$mysql.="group by masempl.femplcode order by fempltype,fdesnordr,femplname";
$myres=mysqli_query($mycon,$mysql);
$mycnt=mysqli_num_rows($myres);
if($mycnt==0)
{
$mess_text="No records found!";
$resp_stat="F";
}
else
{
$resp_stat="T";
$dept_code="";
$line_no=0;
$i=0;
require_once("fpdf/fpdf.php");
$pdf = new FPDF('L','mm','A4');
while($row = mysqli_fetch_assoc($myres))
{
$attn_date=$row['fattndate'];
$year=substr($attn_mnth,0,4);
$mnth=substr($attn_mnth,5,2);
$days=cal_days_in_month(CAL_GREGORIAN, $mnth, $year);
if($line_no==0||$line_no%24==0)
{
$d=1;
$dept_code=$row['fdeptcode'];
$header_dept_code=$dept_code;
$header_dept_name=get_dept_name($row['fdeptcode']);
$header_attn_mnth=strtoupper(date('F Y',strtotime($attn_mnth)));
$pdf->AddPage();
$pdf->SetMargins(10,10);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,7,"LOGISYS, BANGALORE",0,1,"C"); $line_no++;
$pdf->Cell(0,7,"ATTENDANCE MONTHWISE DETAILS - {$header_attn_mnth}",0,1,"C");$line_no++;
$pdf->Cell(0,7,"[{$header_dept_name}]",0,1,"C"); $line_no++;
$pdf->SetFont('Arial','B',9);
$pdf->Cell(10,7,"Sl No",1,0,"C");
$pdf->Cell(55,7,"Empl. Name ",1,0,"C");
for($d=1; $d<=$days; $d++)
{
$pdf->Cell(7,7,"{$d}",1,0,"C");
}
}
$i++;
$empl_code=$row['femplcode'];
$pdf->SetFont('Arial','',9);
$pdf->ln();$line_no++;
$pdf->Cell(10,7,"{$i}",1,0,"C");
$pdf->Cell(55,7,"{$row['femplname']}",1,0,"L");
for($j=1;$j<=$days;$j++)
{
$attn_stat="";
$caln_date=$attn_mnth.'-'.substr('0'.$j,-2,2);
$mysql1="select * from attendance where femplcode='$empl_code' and fattndate='$caln_date'";
$myres1=mysqli_query($mycon,$mysql1);
while($row1 = mysqli_fetch_assoc($myres1))
{
$attn_stat=strtoupper($row1['fattnstat']);
if($attn_stat=="CD")
{
$attn_stat=intval($row1['fovertime']);
}
}
$pdf->Cell(7,7,"{$attn_stat}",1,0,"C");
}
}
$resp_file="reports/attendance_report_month_details.pdf";
$pdf->output($resp_file,'F');
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
?>
|