Files
2026-05-19 09:56:36 +05:30

160 lines
3.0 KiB
C++

#include "Invoice.h"
int Invoice::m_uid = 0;
Invoice::Invoice()
: m_id("INV" + std::to_string(++m_uid)),
m_booking(nullptr),
m_laborCost(0.0),
m_partsCost(0.0),
m_discountPercentage(0.0),
m_totalAmount(0.0),
m_paymentMethod(util::PaymentMode()),
m_status(util::PaymentStatus()) {}
Invoice::Invoice(
const std::string& bookingId,
ServiceBooking* booking,
const util::Timestamp& invoiceDate,
double laborCost, const util::Map<int,
InventoryItem*>& parts,
double partsCost,
double discountPercentage,
double totalAmount,
const util::Timestamp& paymentDate,
util::PaymentMode paymentMethod,
util::PaymentStatus status
)
: m_id("INV" + std::to_string(++m_uid)),
m_bookingId(bookingId),
m_booking(booking),
m_invoiceDate(invoiceDate),
m_laborCost(laborCost),
m_parts(parts),
m_partsCost(partsCost),
m_discountPercentage(discountPercentage),
m_totalAmount(totalAmount),
m_paymentDate(paymentDate),
m_paymentMethod(paymentMethod),
m_status(status) {}
const std::string& Invoice::getId() const
{
return m_id;
}
const std::string& Invoice::getBookingId() const
{
return m_bookingId;
}
ServiceBooking* Invoice::getBooking() const
{
return m_booking;
}
const util::Timestamp& Invoice::getInvoiceDate() const
{
return m_invoiceDate;
}
double Invoice::getLaborCost() const
{
return m_laborCost;
}
const util::Map<int, InventoryItem*>& Invoice::getParts() const
{
return m_parts;
}
double Invoice::getPartsCost() const
{
return m_partsCost;
}
double Invoice::getDiscountPercentage() const
{
return m_discountPercentage;
}
double Invoice::getTotalAmount() const
{
return m_totalAmount;
}
const util::Timestamp& Invoice::getPaymentDate() const
{
return m_paymentDate;
}
util::PaymentMode Invoice::getPaymentMethod() const
{
return m_paymentMethod;
}
util::PaymentStatus Invoice::getStatus() const
{
return m_status;
}
void Invoice::setId(const std::string& id)
{
m_id = id;
}
void Invoice::setBookingId(const std::string& bookingId)
{
m_bookingId = bookingId;
}
void Invoice::setBooking(ServiceBooking* booking)
{
m_booking = booking;
}
void Invoice::setInvoiceDate(const util::Timestamp& invoiceDate)
{
m_invoiceDate = invoiceDate;
}
void Invoice::setLaborCost(double laborCost)
{
m_laborCost = laborCost;
}
void Invoice::setParts(const util::Map<int, InventoryItem*>& parts)
{
m_parts = parts;
}
void Invoice::setPartsCost(double partsCost)
{
m_partsCost = partsCost;
}
void Invoice::setDiscountPercentage(double discountPercentage)
{
m_discountPercentage = discountPercentage;
}
void Invoice::setTotalAmount(double totalAmount)
{
m_totalAmount = totalAmount;
}
void Invoice::setPaymentDate(const util::Timestamp& paymentDate)
{
m_paymentDate = paymentDate;
}
void Invoice::setPaymentMethod(util::PaymentMode paymentMethod)
{
m_paymentMethod = paymentMethod;
}
void Invoice::setStatus(util::PaymentStatus status)
{
m_status = status;
}