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.117.93.183
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/xattendance_report_05.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_year = $_POST['attn_year'];
$mysql = "select masempl.fdeptcode,masempl.femplcode,femplname,fdesnordr,left(fattndate,7) as latmnth,
count(case when fattnstat in ('pr','p1','p2','p3','po','d1','d2','d3') then fattnstat end) as lprdays,
count(case when fattnstat in ('hd','wo') then fattnstat end) as lhddays,
count(case when fattnstat='hw' then fattnstat end) as lhwdays,
count(case when fattnstat='ab' then fattnstat end) as labdays,
count(case when fattnstat='cl' then fattnstat end) as lcldays
from masempl,masdesn,attendance
where masempl.fempldesn=masdesn.fempldesn and masempl.femplcode=attendance.femplcode
and masempl.fdeptcode='$dept_code' and attendance.fattndate like '$attn_year%'
group by masempl.fdeptcode,masempl.femplcode,femplname,fdesnordr,left(fattndate,7) order by fempltype,fdesnordr,femplname,left(fattndate,7)";
$myres = mysqli_query($mycon, $mysql);
$mycnt = mysqli_num_rows($myres);
if ($mycnt == 0) {
$resp_mesg = "No records found!";
$resp_stat = "F";
} else {
$resp_stat = "T";
$dept_code = "";
$empl_code = "";
$line_no = 0;
$i = 0;
require_once("fpdf/fpdf.php");
$pdf = new FPDF('P', 'mm', 'A4');
while ($myrow = mysqli_fetch_assoc($myres)) {
if ($empl_code <> $myrow['femplcode']) {
$d = 1;
$dept_code = $myrow['fdeptcode'];
$header_dept_code = $dept_code;
$header_dept_name = get_dept_name($myrow['fdeptcode']);
$header_empl_name = get_empl_name($myrow['femplcode']);
if ($empl_code != "") {
$pdf->ln();
$line_no++;
$pdf->Cell(60, 7, "Total", 1, 0, "C");
$pdf->Cell(15, 7, "{$tmtdays}", 1, 0, "C");
$pdf->Cell(15, 7, "{$thddays}", 1, 0, "C");
$pdf->Cell(15, 7, "{$tprdays}", 1, 0, "C");
$pdf->Cell(15, 7, "{$thwdays}", 1, 0, "C");
$pdf->Cell(15, 7, "{$tcldays}", 1, 0, "C");
$pdf->Cell(15, 7, "{$tabdays}", 1, 0, "C");
$pdf->Cell(40, 7, "", 1, 0, "C");
$i = 0;
$tmtdays = 0;
$tprdays = 0;
$thwdays = 0;
$tcldays = 0;
$tabdays = 0;
}
$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, "YEARWISE ATTENDANCE SUMMARY", 0, 1, "C");
$line_no++;
$pdf->Cell(95, 7, "Department Name: {$header_dept_name}", 0, 0, "L");
$pdf->Cell(90, 7, "Empl.: {$header_empl_name}", 0, 0, "R");
$pdf->ln();
$line_no++;
$pdf->SetFont('Arial', 'B', 9);
$pdf->Cell(10, 7, "Sl No", 1, 0, "C");
$pdf->Cell(50, 7, "Month", 1, 0, "C");
$pdf->Cell(15, 7, "Days", 1, 0, "C");
$pdf->Cell(15, 7, "Hol.", 1, 0, "C");
$pdf->Cell(15, 7, "Pr.", 1, 0, "C");
$pdf->Cell(15, 7, "H.W.", 1, 0, "C");
$pdf->Cell(15, 7, "C.L.", 1, 0, "C");
$pdf->Cell(15, 7, "Ab.", 1, 0, "C");
$pdf->Cell(40, 7, "Remarks", 1, 0, "C");
}
$i++;
$pdf->SetFont('Arial', '', 9);
$pdf->ln();
$line_no++;
$year = substr($myrow['latmnth'], 0, 4);
$mnth = substr($myrow['latmnth'], 5, 2);
$days = cal_days_in_month(CAL_GREGORIAN, $mnth, $year);
$mnth = $myrow['latmnth'] . " " . strtoupper(date('F', strtotime($myrow['latmnth'])));
$pdf->Cell(10, 7, "{$i}", 1, 0, "C");
$pdf->Cell(50, 7, "{$mnth}", 1, 0, "L");
$pdf->Cell(15, 7, "{$days}", 1, 0, "C");
$pdf->Cell(15, 7, "{$myrow['lhddays']}", 1, 0, "C");
$pdf->Cell(15, 7, "{$myrow['lprdays']}", 1, 0, "C");
$pdf->Cell(15, 7, "{$myrow['lhwdays']}", 1, 0, "C");
$pdf->Cell(15, 7, "{$myrow['lcldays']}", 1, 0, "C");
$pdf->Cell(15, 7, "{$myrow['labdays']}", 1, 0, "C");
$pdf->Cell(40, 7, "", 1, 0, "C");
$tmtdays = $tmtdays + $days;
$thddays = $thddays + $myrow['lhddays'];
$tprdays = $tprdays + $myrow['lprdays'];
$thwdays = $thwdays + $myrow['lhwdays'];
$tabdays = $tabdays + $myrow['labdays'];
$tcldays = $tcldays + $myrow['lcldays'];
$empl_code = $myrow['femplcode'];
}
$resp_file = "reports/attendance_report_year_summary.pdf";
$pdf->output($resp_file, 'F');
}
echo json_encode(array("mesg" => $resp_mesg, "stat" => $resp_stat, "file" => $resp_file));
|