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 : 18.223.209.114
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/attendance_report_monthwise_individual.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'];
$empl_code="";
$mysql = "";
$mysql.= "select attendance.femplcode ";
$mysql.= "from mas_empl,mas_desn,attendance ";
$mysql.= "where mas_empl.fdesncode=mas_desn.fdesncode and attendance.fdeptcode='$dept_code' ";
$mysql.= "and mas_empl.femplcode=attendance.femplcode and left(attendance.fattndate,7)='$attn_mnth' ";
$mysql.= "group by attendance.femplcode ";
$myres = mysqli_query($mycon,$mysql);
$mycnt = mysqli_num_rows($myres);
if($mycnt==0)
{
$resp_mesg="No records found!";
$resp_stat="F";
}
else
{
$line_no=0;
$i=1;
require_once("fpdf/fpdf.php");
$pdf = new FPDF('P','mm','A4');
$pdf->SetMargins(15,15);
$pdf->SetFont('Arial','',9);
while($myrow = mysqli_fetch_assoc($myres))
{
if($empl_code<>$myrow['femplcode'])
{
$line_no=0;
$i=1;
}
$empl_code=$myrow['femplcode'];
$year=substr($attn_mnth,0,4);
$mnth=substr($attn_mnth,5,2);
$days=cal_days_in_month(CAL_GREGORIAN, $mnth, $year);
$strt_date=date("01-m-Y");
$curr_date=date("d-m-Y");
for($j=1;$j<=$days;$j++)
{
if($line_no==0||$line_no%36==0)
{
$header_dept_code=$dept_code;
$header_dept_name=get_dept_name($dept_code);
$header_empl_code=$empl_code;
$header_empl_name=get_empl_name($empl_code);
$header_attn_mnth=strtoupper(date('F Y',strtotime($attn_mnth)));
$pdf->AddPage();
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,7,"LOGISYS, BANGALORE",0,1,"C"); $line_no++;
$pdf->Cell(0,7,"MONTHWISE ATTENDANCE REPORT (INDIVIDUAL)",0,1,"C"); $line_no++;
$pdf->Cell(90,7,"Employee Name: {$header_empl_name}",0,0,"L");
$pdf->Cell(90,7,"Month: {$header_attn_mnth}",0,0,"R");
$pdf->ln();$line_no++;
$pdf->SetFont('Arial','B',9);
$x = $pdf->GetX(); $y = $pdf->GetY();
$pdf->MultiCell(10,7,"Sl. No.",1,"C");
$pdf->SetXY($x + 10, $y);
$pdf->MultiCell(20,14,"Date",1,"C");
$pdf->SetXY($x + 30, $y);
$pdf->MultiCell(40,14,"Status",1,"C");
$pdf->SetXY($x + 70, $y);
$pdf->MultiCell(45,7,"Log In",1,"C");
$pdf->SetXY($x + 70, $y + 7);
$pdf->MultiCell(15,7,"Time",1,"C");
$pdf->SetXY($x + 85, $y + 7);
$pdf->MultiCell(30,7,"Remarks",1,"C");
$pdf->SetXY($x + 115, $y);
$pdf->MultiCell(45,7,"Log Out",1,"C");
$pdf->SetXY($x + 115, $y + 7);
$pdf->MultiCell(15,7,"Time",1,"C");
$pdf->SetXY($x + 130, $y + 7);
$pdf->MultiCell(30,7,"Remarks",1,"C");
$pdf->SetXY($x + 160, $y);
$pdf->MultiCell(20,14,"Work Hours",1,"C");
$line_no++;
}
$pdf->SetFont('Arial','',9);
$attn_stat = "";
$caln_date = $attn_mnth.'-'.substr('0'.$j,-2,2);
$mysql1 = "select attendance.*, mas_attend_stat.fstatdesc from mas_attend_stat,attendance ";
$mysql1.= "where femplcode='$empl_code' and fattndate='$caln_date' ";
$mysql1.= "and attendance.fdeptcode=mas_attend_stat.fdeptcode and attendance.fdeptcode='$dept_code' ";
$mysql1.= "and attendance.fattnstat=mas_attend_stat.fattnstat ";
$myres1 = mysqli_query($mycon,$mysql1);
$myrow1 = mysqli_fetch_assoc($myres1);
$mycnt1 = mysqli_num_rows($myres1);
if($mycnt1==0)
{
$pdf->Cell(10,7,"{$i}",1,0,"C"); //SL NO
$pdf->Cell(20,7,"{$caln_date}",1,0,"C"); //DATE
$pdf->Cell(40,7,"Pending",1,0,"C"); //STATUS
$pdf->Cell(15,7,"-",1,0,"C"); //LOGIN TIME
$pdf->Cell(30,7,"-",1,0,"C"); //LOGIN DIFF
$pdf->Cell(15,7,"-",1,0,"C"); //LOGOUT TIME
$pdf->Cell(30,7,"-",1,0,"C"); //LOGOUT DIFF
$pdf->Cell(20,7,"-",1,0,"C"); //WORK HOURS
}
else
{
$attn_stat=strtolower($myrow1['fattnstat']);
$attn_desc=$myrow1['fstatdesc'];
$pdf->Cell(10,7,"{$i}",1,0,"C");
$pdf->Cell(20,7,"{$caln_date}",1,0,"C");
$pdf->Cell(40,7,"{$attn_desc}",1,0,"C");
if($attn_stat=="ab"||$attn_stat=="cl"||$attn_stat=="hd"||$attn_stat=="wo")
{
$pdf->Cell(15,7,"-",1,0,"C");
$pdf->Cell(30,7,"-",1,0,"C");
$pdf->Cell(15,7,"-",1,0,"C");
$pdf->Cell(30,7,"-",1,0,"C");
$pdf->Cell(20,7,"-",1,0,"C");
}
else
{
$logi_time = $myrow1['flogitime'];
$logi_diff = $myrow1['flogidiff'];
$pdf->Cell(15,7,"{$logi_time}",1,0,"C");
if($logi_diff>"00:00:00")
{
$pdf->Cell(30,7,"{$logi_diff} delay",1,0,"C");
}
elseif($logi_diff<"00:00:00")
{
$pdf->Cell(30,7,"{$logi_diff} early",1,0,"C");
}
else
{
$pdf->Cell(30,7,"-",1,0,"C");
}
$logo_time = $myrow1['flogotime'];
$logo_diff = $myrow1['flogodiff'];
if($logo_time=="00:00:00")
{
$pdf->Cell(15,7,"-",1,0,"C");
$pdf->Cell(30,7,"Pending",1,0,"C");
}
else
{
if($logo_diff>"00:00:00")
{
$pdf->Cell(15,7,"{$logo_time}",1,0,"C");
$pdf->Cell(30,7,"{$logo_diff} late",1,0,"C");
}
elseif($logo_diff<"00:00:00")
{
$pdf->Cell(15,7,"{$logo_time}",1,0,"C");
$pdf->Cell(30,7,"{$logo_diff} early",1,0,"C");
}
elseif($logo_diff=="00:00:00")
{
$pdf->Cell(15,7,"{$logo_time}",1,0,"C");
$pdf->Cell(30,7,"-",1,0,"C");
}
else
{
$pdf->Cell(15,7,"-",1,0,"C");
$pdf->Cell(30,7,"-",1,0,"C");
}
}
$work_hour = $myrow1['fworkhour'];
if($work_hour>"00:00:00")
{
$pdf->Cell(20,7,"{$work_hour}",1,0,"C");
}
else
{
$pdf->Cell(20,7,"-",1,0,"C");
}
}
}
$i++;
$pdf->ln();$line_no++;
}
}
$resp_file="reports/attendance_report_monthwise_individual.pdf";
$pdf->output($resp_file,'F');
}
echo json_encode(array("mesg"=>$resp_mesg, "stat"=>$resp_stat, "file"=>$resp_file));
?>
|