Implement View Payslip History
<UserStory> EMP011 : View Payslip History </UserStory> <Changes> - Implemented Enums::Month enum and helper functions getMonth() and getMonthString() for month formatting. - Created viewPayslipHistory() helper in MenuHelper.h to display payslip history in aligned tabular format. - Integrated viewPayslipHistory() option into EmployeeMenu, FinanceExecutiveMenu, HRManagerMenu, ITExecutiveMenu, TalentExecutiveMenu, TeamExecutiveMenu, and TeamLeadMenu. </Changes> <Review> Smitha Mohan </Review>
This commit is contained in:
@@ -33,17 +33,16 @@ bool EmployeeMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
/*
|
||||
case 1:
|
||||
/*case 1:
|
||||
m_zenvyController.applyLeave();
|
||||
break;
|
||||
case 2:
|
||||
m_zenvyController.viewPayslip();
|
||||
break;
|
||||
break;*/
|
||||
case 3:
|
||||
m_zenvyController.viewPayslipHistory();
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4 :
|
||||
/*case 4 :
|
||||
m_zenvyController.raiseTicket();
|
||||
break;
|
||||
case 5 :
|
||||
|
||||
@@ -65,6 +65,9 @@ bool FinanceExecutiveMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ bool HRManagerMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ bool ITExecutiveMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <utility>
|
||||
#include "Enums.h"
|
||||
@@ -15,6 +17,33 @@
|
||||
|
||||
void createEmployee(std::shared_ptr<ZenvyController> controller);
|
||||
|
||||
inline void viewPayslipHistory(std::shared_ptr<ZenvyController> controller)
|
||||
{
|
||||
auto employeePayslips = controller->getCurrentEmployee()->getEmployeePayslips();
|
||||
util::clear();
|
||||
std::cout << "Payslips\n" << std::endl;
|
||||
std::cout << std::left
|
||||
<< std::setw(15) << "Date"
|
||||
<< std::setw(15) << "Payslip ID"
|
||||
<< std::setw(15) << "Employee ID"
|
||||
<< std::setw(12) << "Salary"
|
||||
<< std::setw(25) << "TimeStamp"
|
||||
<< std::endl;
|
||||
for (const auto& payslip : employeePayslips)
|
||||
{
|
||||
std::ostringstream dateStream;
|
||||
dateStream << payslip.second->getTimestamp().getYear() << " - " << Enums::getMonthString(Enums::getMonth(payslip.second->getTimestamp().getMonth()));
|
||||
std::cout << std::left
|
||||
<< std::setw(15) << dateStream.str()
|
||||
<< std::setw(15) << payslip.first
|
||||
<< std::setw(15) << payslip.second->getEmployeeId()
|
||||
<< std::setw(12) << payslip.second->getSalary()
|
||||
<< std::setw(25) << payslip.second->getTimestamp().toString()
|
||||
<< std::endl;
|
||||
}
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
inline void viewProfile(std::shared_ptr<ZenvyController> controller)
|
||||
{
|
||||
util::clear();
|
||||
|
||||
@@ -32,6 +32,9 @@ bool TalentExecutiveMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ bool TeamExecutiveMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 4:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ bool TeamLeadMenu::handleOperation(int choice)
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case 3:
|
||||
viewPayslipHistory(m_zenvyController);
|
||||
break;
|
||||
case 7:
|
||||
viewEmployees(m_zenvyController);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user