Emp and load detail export : GWM

This commit is contained in:
Gowtham M 2025-03-26 15:37:59 +05:30
parent d498906d8e
commit d74b222aa0
7 changed files with 191 additions and 9 deletions

View File

@ -121,6 +121,7 @@ $routes->post('addNewEmployee', 'Employeedetails::AddNewEmployee');
$routes->post('deleteEmployeeFile', 'Employeedetails::deleteEmployeeFile');
$routes->get('employeeListing', 'Employeedetails::index');
$routes->get('employeedetails/ViewEmployee', 'Employeedetails::ViewEmployee');
$routes->get('employeedetails/downloadEmployeeDetails', 'Employeedetails::downloadEmployeeDetails');
$routes->post('employeedetails/UpdateEmployee', 'Employeedetails::UpdateEmployee');
$routes->get('exportemployee', 'Employeedetails::exportemployee');
@ -199,6 +200,7 @@ $routes->post('monthlypay/deletePublicHoliday', 'Monthlypay::deletePublicHoliday
$routes->get('emppaydate/addemppaydate', 'Emppaydate::addemppaydate');
$routes->post('emppaydate/addNewemppay', 'Emppaydate::addNewemppay');
$routes->get('emppaydate/editOldemppay/(:num)', 'Emppaydate::editOldemppay/$1');
$routes->get('emppaydate/downloadEmpLoanData/(:num)', 'Emppaydate::downloadEmpLoanData/$1');
$routes->post('emppaydate/editemppay', 'Emppaydate::editemppay');
$routes->post('emppaydate/deleteEmpPay', 'Emppaydate::deleteEmpPay');

View File

@ -14,6 +14,8 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Mpdf\Mpdf;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use App\Models\EmpFilesModel;
use App\Models\AppConfigModel;
@ -637,6 +639,33 @@ class Employeedetails extends BaseController
$this->loadViews("editEmployeenew", $this->global, $data, NULL);
}
function downloadEmployeeDetails($EmpNO = '')
{
$EmpID = $_GET['EmpID'];
$data['EmpDetails'] = $this->employeedetails_model->viewemployee($EmpID);
$data['emp_data'] = $this->empFiles->where('emp_id', $EmpID)->where('is_active', 1)->findAll();
$data['empPay'] = $this->emppaydate_model->getEmpPayData($EmpID);
// dd($data);
// Load the HTML view and pass data
$html = view('employee_pdf_view', $data);
$mpdf = new Mpdf();
$mpdf->WriteHTML($html);
// Output the PDF
$fName = $data['EmpDetails'][0]->EmpID.'-Employee-Details.pdf';
return $mpdf->Output($fName, "D");
}
/* To Check the email exists in the database or not for the employee*/
function checkMailEmp()
{

View File

@ -10,7 +10,7 @@ use App\Models\Emppaydate_model;
use App\Models\Payroll_model;
use Mpdf\Mpdf;
/**
* Module : Payslip
* Emppaydate Class to control all Employee paydate related operations.
@ -142,13 +142,32 @@ class Emppaydate extends BaseController
$data['loan_histoty'] = $this->emppaydate_model->getUserLoanHistoryInfo($data['emppay'][0]->Loan_ID);
// print_r($data['loan_histoty']);die;
$this->global['pageTitle'] = 'Edit Employee Pay Monthly Details ';
$this->loadViews("editOldemppay", $this->global, $data, NULL);
}
function downloadEmpLoanData($paydataid = "")
{
$data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid);
$data['loan_histoty'] = $this->emppaydate_model->getUserLoanHistoryInfo($data['emppay'][0]->Loan_ID);
// Load HTML view
$html = view('loan_pdf', $data);
$mpdf = new Mpdf();
$mpdf->SetTitle("Employee Loan Report");
$mpdf->WriteHTML($html);
// Download the PDF
$fName = $data['emppay'][0]->PAYEMPID."-loan-details.pdf";
return $mpdf->Output($fName, "D");
}
/**

View File

@ -135,13 +135,14 @@
} else {
$cdate = date('d-m-Y', strtotime($record->Created_date));
} ?>
<td><a class="a_tag_link" href="<?php echo base_url() . 'employeedetails/ViewEmployee/?EmpID=' . $record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u>
<?php if($record->is_driver){ ?>
&nbsp;&nbsp;&nbsp;
<a title="Trip Details" style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?drv_id=' . $record->EmpID; ?>">
<i class="fa fa-truck"></i>&nbsp;&nbsp;&nbsp;
<td>
<a class="a_tag_link" href="<?php echo base_url() . 'employeedetails/ViewEmployee/?EmpID=' . $record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u>
&nbsp;&nbsp;&nbsp;
<a href="<?php echo base_url() . 'employeedetails/downloadEmployeeDetails/?EmpID=' . $record->EmpID; ?>">
<i class="fas fa-download"></i>
</a>
<?php } ?>
</td>
<td><?php echo $record->FirstName; ?></td>

View File

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee Details</title>
<style>
body { font-family: Arial, sans-serif; font-size: 12px; }
.container { width: 100%; margin: 20px auto; }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
.header { font-size: 18px; font-weight: bold; text-align: center; margin-bottom: 20px; }
</style>
</head>
<body>
<div class="container">
<div class="header">Employee Details</div>
<!-- Employee Personal Details -->
<table>
<tr>
<th>Employee ID</th> <td><?= $EmpDetails[0]->EmpID ?? '-' ?></td>
<th>Name</th> <td><?= $EmpDetails[0]->FirstName . ' ' . ($EmpDetails[0]->LastName ?? '') ?></td>
</tr>
<tr>
<th>Gender</th> <td><?= $EmpDetails[0]->Gender ?? '-' ?></td>
<th>Date of Birth</th> <td><?= date('d-m-Y', strtotime($EmpDetails[0]->DateofBirth ?? '')) ?></td>
</tr>
<tr>
<th>Contact Number</th> <td><?= $EmpDetails[0]->ContactNumber ?? '-' ?></td>
<th>Email</th> <td><?= $EmpDetails[0]->EmailId ?? '-' ?></td>
</tr>
<tr>
<th>Department</th> <td><?= $EmpDetails[0]->DepartmentName ?? '-' ?></td>
<th>Designation</th> <td><?= $EmpDetails[0]->Designation ?? '-' ?></td>
</tr>
<tr>
<th>Date of Joining</th> <td><?= date('d-m-Y', strtotime($EmpDetails[0]->DateofJoining ?? '')) ?></td>
<th>Marital Status</th> <td><?= $EmpDetails[0]->MartialStatus ?? '-' ?></td>
</tr>
<tr>
<th>Blood Group</th> <td><?= $EmpDetails[0]->BloodGroup ?? '-' ?></td>
<th>Father's Name</th> <td><?= $EmpDetails[0]->FatherName ?? '-' ?></td>
</tr>
<tr>
<th>Aadhar No</th> <td><?= $EmpDetails[0]->AadharNo ?? '-' ?></td>
<th>PAN No</th> <td><?= $EmpDetails[0]->PANNo ?? '-' ?></td>
</tr>
<tr>
<th>Present Address</th> <td colspan="3"><?= $EmpDetails[0]->PresentAddress ?? '-' ?></td>
</tr>
<tr>
<th>Permanent Address</th> <td colspan="3"><?= $EmpDetails[0]->PermanentAddress ?? '-' ?></td>
</tr>
</table>
<!-- Employee Salary Details -->
<div class="header">Salary Details</div>
<table>
<tr>
<th>Basic Pay</th> <td><?= number_format($empPay->Basic_Pay ?? 0, 2) ?></td>
<th>HRA Amount</th> <td><?= number_format($empPay->HRA_Amount ?? 0, 2) ?></td>
</tr>
<tr>
<th>HRA Rate</th> <td><?= number_format($empPay->HRA_Rate ?? 0, 2) ?>%</td>
<th>PF Rate</th> <td><?= number_format($empPay->PF_Rate ?? 0, 2) ?>%</td>
</tr>
<tr>
<th>ESI Rate</th> <td><?= number_format($empPay->ESI_Rate ?? 0, 2) ?>%</td>
<th>Total Salary</th> <td><strong><?= number_format($empPay->TotalSalary ?? 0, 2) ?></strong></td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -55,6 +55,8 @@
<td><?php echo $record->Remaining_Due; ?></td>
<td><?php echo $record->Paid_Amount; ?></td>
<td>
<a href="<?php echo base_url() . 'emppaydate/downloadEmpLoanData/' . $record->Pay_Data_ID; ?>"><i class="fas fa-download"></i></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?php echo base_url() . 'emppaydate/editOldemppay/' . $record->Pay_Data_ID; ?>"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>

49
app/Views/loan_pdf.php Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loan Report</title>
<style>
body { font-family: Arial, sans-serif; }
h2 { text-align: center; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border: 1px solid black; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>Employee Loan Report</h2>
<table>
<tr><th>Employee ID</th><td><?= $emppay[0]->PAYEMPID; ?></td></tr>
<tr><th>Employee Name</th><td><?= $emppay[0]->FirstName; ?></td></tr>
<tr><th>Basic Pay</th><td><?= $emppay[0]->Basic_Pay; ?></td></tr>
<tr><th>Total Salary</th><td><?= $emppay[0]->TotalSalary; ?></td></tr>
<tr><th>Loan Amount</th><td><?= $emppay[0]->Loan_Amount; ?></td></tr>
<tr><th>Loan Issued Date</th><td><?= $emppay[0]->Loan_Issued_Date; ?></td></tr>
<tr><th>Monthly Due</th><td><?= $emppay[0]->Monthly_Due; ?></td></tr>
<tr><th>Remaining Dues</th><td><?= $emppay[0]->Remaining_Due; ?></td></tr>
<tr><th>Paid Amount</th><td><?= $emppay[0]->Paid_Amount; ?></td></tr>
</table>
<h3>Loan History</h3>
<table>
<tr>
<th>Due Amount</th>
<th>Balance Amount</th>
<th>Due Date</th>
<th>Entry Date</th>
</tr>
<?php foreach ($loan_histoty as $key => $value) { ?>
<tr>
<td><?= $value->Due_Amount; ?></td>
<td><?= $value->Balance_Amount; ?></td>
<td><?= $value->Due_Date; ?></td>
<td><?= $value->Entry_Date; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>