I would like to make report from sales data in a POS system.
So, I have a ReportGenerator
that has a List <Ticket>
The Ticket
class represents a registration in the cash register. This can be a SalesTicket
(DirectSalesTicket
, InvoiceSalesTicket
,...) or CashRegisterMovementTicket
for a registration of money leaving or entering the cash register without a sale (e.g. taking money to the bank).
InvoiceSalesTicket
has a invoiceNumber
which a DirectSalesTicket
doesn't have. So I'm OK with having 2 different classes.
For CashRegisterMovementTicket
I could make 2 classes (CashInRegisterMovementTicket
and CashOutRegisterMovementTicket
) that inherent from CashRegisterMovementTicket
(which is a Ticket
) that represent money that was added to the cash register or money that was taken out of the register. That would make 3 classes, that do not really differ from one another internally.
When I want to generate a report with al the money that has been taken out of the cash register I can just take the List <Ticket>
and only use the ones that are of the CashOutRegisterMovementTicket
type.
Another example:
SalesTicket
has List <SalesLine>
Some reports are based on SalesTicket
that have a gift certificate So I have NormalSalesLine
and GiftCertificateSalesLine
, both inherent from SalesLine
but internally they are the same.
It feels like I have a lot of classes that are sometimes very similar. What am I missing?
Aucun commentaire:
Enregistrer un commentaire