diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index b87741c7..fe8150a7 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -545,3 +545,6 @@ $routes->post('updateTrpProductionDetails', 'StockController::updateTrpProductio
$routes->post('updateAbstractDetails','StockController::updateAbstractDetails');
+//Reports Module
+
+$routes->get('allReports','Report::allReports');
\ No newline at end of file
diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php
index a53dc65f..0e8ed2db 100755
--- a/app/Controllers/Payslip.php
+++ b/app/Controllers/Payslip.php
@@ -2033,20 +2033,34 @@ class Payslip extends BaseController
public function leaveReport()
{
- $fyr = get_financial_year();
- if ($this->request->getMethod() == 'POST') {
- $fyr = $this->request->getPost('fyr');
- }
- // $fiscalYears = get_financial_year_list();
- $fiscalYears = get_financial_year_list(date('Y'), 8);
+
+ $report = [];
+
+ if ($this->request->getMethod(true) === 'POST' && $this->request->getPost('btn_submit')) {
+
+
+ $data['from_date'] = $this->request->getPost('from_date');
+ $data['to_date'] = $this->request->getPost('to_date');
+ $data['EmpID'] = $this->request->getPost('emp');
+
+
+
+ $report = $this->monthlypay_model->leave_report($data['from_date'], $data['to_date'], $data['EmpID']);
+
+
+ }
+
+ $data['EmpData'] = $this->monthlypay_model->getActiveEmployee();
+
+
+ $data['data'] = $report;
+// dd($data);
+ // Load the view
- $data['fiscalyears'] = $fiscalYears;
- $data['selectedfiscalyears'] = $fyr;
- $data['leaverecords'] = $this->payroll_model->getEmpDetailsforLeave($fyr);
- // echo '';
$this->global['pageTitle'] = 'Leave Reports';
$this->loadViews("leavereports", $this->global, $data, NULL);
}
+
function monthwiseLeaveReport($param1,$param2)
{
$EmployeeID = $param1;
diff --git a/app/Models/Dashboard_model.php b/app/Models/Dashboard_model.php
index 82e2cd67..3bfa49d0 100755
--- a/app/Models/Dashboard_model.php
+++ b/app/Models/Dashboard_model.php
@@ -1065,11 +1065,11 @@ pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
$sql = "SELECT
- CASE WHEN MONTH(PODate)>=4 THEN
- concat(YEAR(PODate), '-',YEAR(PODate)+1)
- ELSE concat(YEAR(PODate)-1,'-', YEAR(PODate)) END AS financial_year
- FROM t_purchaseorder_master
-GROUP BY financial_year";
+ CASE WHEN MONTH(PODate)>=4 THEN
+ concat(YEAR(PODate), '-',YEAR(PODate)+1)
+ ELSE concat(YEAR(PODate)-1,'-', YEAR(PODate)) END AS financial_year
+ FROM t_purchaseorder_master
+ GROUP BY financial_year";
$query = $this->db->query($sql);
return $query->getResult();
}
diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php
index 12903b92..3a6548ab 100755
--- a/app/Models/Monthlypay_model.php
+++ b/app/Models/Monthlypay_model.php
@@ -663,5 +663,45 @@ where Month_Year = ? and att.EmpID in (select EmpID from t_attendance)";
// return [$current];
}
+ function getActiveEmployee()
+ {
+ $array = $this->db->table('t_employee_details')
+ ->select("FirstName,LastName,Gender,EmpID")
+ ->where('IsActive', 1)
+ ->get()
+ ->getResultArray();
+
+ return $array;
+
+ }
+
+ function leave_report($from_date, $to_date, $empID)
+ {
+ $builder = $this->db->table('t_monthly_pay_inputs MPI');
+ $builder->selectSum('MPI.LOP_Days');
+ $builder->selectSum('MPI.Paid_leave');
+ $builder->selectSum('MPI.OT_Hrs_Worked');
+ $builder->selectSum('MPI.OTSalary');
+ $builder->select('MPI.EmpID, ED.FirstName , ED.LastName');
+ $builder->join('t_employee_details ED', 'MPI.EmpID = ED.EmpID', 'left');
+
+ // Filter by EmpID if set
+ if (!empty($empID)) {
+ $builder->where('MPI.EmpID', $empID);
+ }
+
+ // Filter by date range if both dates are provided
+ if (!empty($from_date) && !empty($to_date)) {
+ $builder->where("MPI.Month_Year >=", $from_date);
+ $builder->where("MPI.Month_Year <=", $to_date);
+ }
+
+ $builder->groupBy('MPI.EmpID');
+
+ $query = $builder->get();
+ return $query->getResultArray();
+ }
+
+
}
\ No newline at end of file
diff --git a/app/Views/Report_pending_purchase.php b/app/Views/Report_pending_purchase.php
index 24582bf8..913a9c29 100755
--- a/app/Views/Report_pending_purchase.php
+++ b/app/Views/Report_pending_purchase.php
@@ -125,6 +125,7 @@
+