Implement Review Fixes
This commit is contained in:
@@ -77,10 +77,7 @@ void ZenvyController::persistStates()
|
||||
m_payslipManagementService->savePayslips();
|
||||
}
|
||||
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>
|
||||
ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month)
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>> ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month)
|
||||
{
|
||||
return m_payslipManagementService->getPayslipForMonth(employeeId, month, year);
|
||||
}
|
||||
|
||||
|
||||
return m_payslipManagementService->getPayslipForMonth(employeeId, year, month);
|
||||
}
|
||||
@@ -62,8 +62,7 @@ public:
|
||||
//Payslip management
|
||||
void updateSalary(const std::string&, double, double, double, double, double);
|
||||
void generatePayslips();
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>
|
||||
getPayslipForMonth(const std::string&, int, int);
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>getPayslipForMonth(const std::string&, int, int);
|
||||
|
||||
//File Management
|
||||
void loadStates();
|
||||
|
||||
@@ -87,8 +87,7 @@ void PayslipManagementService::savePayrolls()
|
||||
payrollFileManager.save(payrolls);
|
||||
}
|
||||
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>
|
||||
PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month)
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>> PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month)
|
||||
{
|
||||
auto& payrolls = m_dataStore.getPayrolls();
|
||||
auto& payslips = m_dataStore.getPayslips();
|
||||
@@ -97,10 +96,10 @@ PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int
|
||||
const auto& payroll = payrollsPair.second;
|
||||
if (payroll->getEmployeeId() == employeeId)
|
||||
{
|
||||
auto iterator = payslips.find(payroll->getId());
|
||||
if (iterator != payslips.end())
|
||||
auto payslipIterator = payslips.find(payroll->getId());
|
||||
if (payslipIterator != payslips.end())
|
||||
{
|
||||
const auto& payslip = iterator->second;
|
||||
const auto& payslip = payslipIterator->second;
|
||||
if (payslip->getTimestamp().getYear() == year && payslip->getTimestamp().getMonth() == month)
|
||||
{
|
||||
return { payroll, payslip };
|
||||
|
||||
@@ -11,10 +11,9 @@ public:
|
||||
PayslipManagementService() : m_dataStore(DataStore::getInstance()) {};
|
||||
void updateSalary(const std::string&, double, double, double, double, double);
|
||||
void generatePayslips();
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>getPayslipForMonth(const std::string&, int, int);
|
||||
void loadPayrolls();
|
||||
void savePayrolls();
|
||||
void loadPayslips();
|
||||
void savePayslips();
|
||||
std::pair<std::shared_ptr<Payroll>, std::shared_ptr<Payslip>>
|
||||
getPayslipForMonth(const std::string&, int, int);
|
||||
};
|
||||
};
|
||||
@@ -40,21 +40,6 @@ double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, co
|
||||
return std::difftime(endTimestamp.m_time, startTimestamp.m_time);
|
||||
}
|
||||
|
||||
int util::Timestamp::getYear() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int util::Timestamp::getMonth() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int util::Timestamp::getDay() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int util::Timestamp::getDateAsInt() const
|
||||
{
|
||||
std::tm timeStruct{};
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace util
|
||||
static double getDurationInHours(const Timestamp&, const Timestamp&);
|
||||
static double getDurationInMinutes(const Timestamp&, const Timestamp&);
|
||||
static double getDurationInSeconds(const Timestamp&, const Timestamp&);
|
||||
int getYear() const;
|
||||
int getMonth() const;
|
||||
int getDay() const;
|
||||
int getDateAsInt() const;
|
||||
int getMonth() const;
|
||||
int getYear() const;
|
||||
|
||||
@@ -318,9 +318,7 @@ 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";
|
||||
|
||||
std::cout << "\nPayslip 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";
|
||||
@@ -335,4 +333,4 @@ inline void viewPayslip(std::shared_ptr<ZenvyController> controller)
|
||||
std::cout << "Payslip not available for " << year << "-" << month << ".\n";
|
||||
}
|
||||
util::pressEnter();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user