Fix payslip lookup logic and enable view option for finance executive
<UserStory> EMP010 : View Payslip </UserStory> <Changes> - Refactored getPayslipForMonth() to fetch payroll and payslips via employee data - Added validation for invalid employee ID - Simplified payslip search using employee-specific payslip records - Enabled “View Payslip” option in Finance Executive menu - Minor UI cleanup in payslip view (spacing and screen clear) </Changes> <Review> Smitha Mohan </Review>
This commit is contained in:
@@ -65,6 +65,8 @@ bool FinanceExecutiveMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 2:
|
||||
viewPayslip(m_zenvyController);
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -304,7 +304,7 @@ inline void viewPayslip(std::shared_ptr<ZenvyController> controller)
|
||||
util::clear();
|
||||
std::cout << "Enter the year: ";
|
||||
util::read(year);
|
||||
std::cout << "\nEnter the month: ";
|
||||
std::cout << "Enter the month: ";
|
||||
util::read(month);
|
||||
auto employee = controller->getCurrentEmployee();
|
||||
if (!employee)
|
||||
@@ -318,7 +318,8 @@ inline void viewPayslip(std::shared_ptr<ZenvyController> controller)
|
||||
auto payslip = result.second;
|
||||
if (payroll && payslip)
|
||||
{
|
||||
std::cout << "\nPayslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << std::setfill('0') << month << ")\n\n";
|
||||
util::clear();
|
||||
std::cout << "Payslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << std::setfill('0') << month << ")\n\n";
|
||||
std::cout << "Basic Salary : " << payroll->getBasicSalary() << "\n";
|
||||
std::cout << "House Rent Allowance : " << payroll->getHouseRentAllowance() << "\n";
|
||||
std::cout << "Food Allowance : " << payroll->getFoodAllowance() << "\n";
|
||||
|
||||
Reference in New Issue
Block a user