public class Ticket extends AbstractVisiblyIdentifiedHibernateObject<Ticket> implements Cloneable, Auditable
- create visibleId outside of model to avoid gaps caused by ticket instances created through queries
- added calculateDebt
- added retrievePaymentInfo
- added comment
- clone fixed: lines will get the right parent id assigned
Modifier and Type | Field and Description |
---|---|
static Integer |
CLOSED |
static Integer |
DELIVERED |
static Integer |
DELIVERY |
static Integer |
ERP |
static Integer |
NORMAL |
static Integer |
ORDER |
static Integer |
SPLIT |
static Integer |
TRAINING |
static Integer |
UNLOCKED |
static Integer |
UNSIGNED |
static Integer |
UPDATED |
static Integer |
VOID |
static Integer |
VOIDING |
static Integer |
VOUCHER |
visibleId
id
Constructor and Description |
---|
Ticket()
Creates a new instance of Ticket
|
Modifier and Type | Method and Description |
---|---|
void |
addLine(TicketLine line) |
void |
addPayment(Payment payment)
Convenience method so we can have a bidirectional relationship still
controlled by the payment
|
void |
auditDeletion() |
double |
calculateDebt()
Calculates the sum of all paperin/paperout payments which is regarded the
outstanding amount.
|
double |
calculateSubTotal() |
double |
calculateTaxes() |
double |
calculateTotal() |
double |
calculateTotalPayments() |
void |
clearPayments()
Removes all payment records from the ticket.
|
Ticket |
clone()
Cloning a ticket creates a deep copy including lines and payments.
|
Ticket |
cloneWithoutPayments()
In some cases we need a clone without payments like for 'Edit sale'.
|
String |
getComment() |
Date |
getCreated_at() |
MagCardReader |
getCreditCard()
This transient property indicates that we have swiped a credit card and,
if configured, want to process the ticket through the configured credit
card gateway for full payment.
|
Customer |
getCustomer() |
Date |
getDateClose() |
Date |
getDateDelivered() |
Date |
getDateDueDelivery() |
Date |
getDateOpen() |
Integer |
getGuests() |
Boolean |
getHasNegativeLines() |
String |
getHost() |
List<TicketLine> |
getLines()
A ticket lines is what you see on a ticket.
|
Integer |
getNumber() |
String |
getOrderCode()
orderCode is meant to store an order code from a foreign ERP system for
back reference
|
CashRegister |
getParent()
The parent of each ticket, is the Active Cash Register.
|
List<Payment> |
getPayments()
This returns a list of the payments used to pay this ticket.
|
Place |
getPlace() |
Integer |
getReference() |
String |
getSignature() |
Integer |
getStatus() |
static Ticket |
getTicketByNumber(Integer iTicketNumber)
Retrieve a closed ticket by the ticket number
|
static Ticket |
getTicketByVisibleID(Integer iTicketVisibleID)
Retrieve a ticket by the visibleID.
|
Boolean |
getToGo() |
Long |
getTransactionNumber()
The transactionNumber is created by startTransaction when the German
Fiscal Security Element (TSE) is used
|
Long |
getTurnover()
For future use
|
Date |
getUpdated_at() |
User |
getUser() |
String |
getValueCard() |
String |
getzipCodeRes()
Return the customer field content of the first associated reservation
found.
|
boolean |
hasAccess(User oUser) |
boolean |
hasMembercardPayment() |
boolean |
hasProtectedLines() |
boolean |
hasReservations() |
boolean |
hasStatus(Integer status)
Check if the ticket has the given status
|
boolean |
inActiveCash()
Check if the ticket is closed and registered in active cash
|
boolean |
isEmpty() |
boolean |
isOverdue() |
Boolean |
isSynched() |
boolean |
isTraining() |
boolean |
isValid()
We set the status to UNSIGNED if the transaction could not be started or
finished - for German SE only.
|
Boolean |
isVoided()
Returns true if either the ticket belongs to the CANCELLED register or
has the CANCEL status bit set.
|
Boolean |
isVoiding()
Returns true if the ticket has the VOIDING status bit set.
|
int |
newVisibleId() |
long |
overdueTime() |
String |
printPlaceName()
Used for audit: get the name of the tickets place, if any.
|
double |
retrievePaymentInfo()
Retrieves paid amount and debt and set PaymentInfo accordingly.
|
Date |
returnReservationDate()
Check if the ticket has lines with status RESERVED
|
void |
revertGatewayPayments()
Revert all gateway payments but do not remove the payments from the
ticket.
|
void |
setComment(String comment) |
void |
setCreated_at(Date created_at) |
void |
setCreditCard(MagCardReader creditCardReader) |
void |
setCustomer(Customer customer) |
void |
setDateClose(Date close) |
void |
setDateDelivered(Date dateDelivered) |
void |
setDateDueDelivery(Date dateDueDelivery) |
void |
setDateOpen(Date dateOpen) |
void |
setGuests(Integer guests) |
void |
setHasNegativeLines(Boolean hasNegativeLines) |
void |
setHost(String host) |
void |
setLines(List<TicketLine> new_lines) |
void |
setNumber(Integer number) |
void |
setOrderCode(String orderCode)
Set optionally when backreference to foreign order codes is needed
|
void |
setParent(CashRegister newparent) |
void |
setPayments(List<Payment> payments) |
void |
setPlace(Place place) |
void |
setReference(Integer reference) |
void |
setSignature(String signature) |
void |
setStatus(Integer status)
Set the status field to the value of status.
|
void |
setStatusFlag(int flag)
Set the bits in the status field according to flag.
|
void |
setSynched(Boolean synched) |
void |
setToGo(Boolean toGo) |
void |
setTransactionNumber(Long transactionNumber) |
void |
setTurnover(Long turnover)
For future use;
|
void |
setUpdated_at(Date updated_at) |
void |
setUser(User us) |
void |
setValueCard(String valueCard) |
void |
setZipCode(String zip_code)
Store the zip_code in the comment field.
|
void |
setZipCodeRes(String zip_code)
Store the zip_code in the customer field of all associated reservations
|
void |
toggleStatusFlag(Integer flag)
Toggle the bits in the status field according to flag.
|
void |
unsetStatusFlag(Integer flag)
Unset the bits in the status field according to flag.
|
void |
updateAllReservationTimes(Date oDateRes)
Update the reservation time of all lines with status RESERVED.
|
void |
validate()
Assign a number to this ticket and generate a signature if appropriate.
|
getVisibleId, setVisibleId
equals, getId, getVersion, hashCode, setId, setVersion
delete, getGetters, getKeyValue, merge, refresh, save
public static final Integer NORMAL
public static final Integer SPLIT
public static final Integer CLOSED
public static final Integer ORDER
public static final Integer DELIVERY
public static final Integer DELIVERED
public static final Integer UNLOCKED
public static final Integer ERP
public static final Integer UPDATED
public static final Integer VOUCHER
public static final Integer VOID
public static final Integer VOIDING
public static final Integer TRAINING
public static final Integer UNSIGNED
public Date getDateOpen()
public void setDateOpen(Date dateOpen)
public Date getDateClose()
public void setDateClose(Date close)
public Customer getCustomer()
public void setCustomer(Customer customer)
public Date getDateDelivered()
public void setDateDelivered(Date dateDelivered)
public Date getDateDueDelivery()
public void setDateDueDelivery(Date dateDueDelivery)
public String getComment()
public void setComment(String comment)
public CashRegister getParent()
public void setParent(CashRegister newparent)
public List<TicketLine> getLines()
public void setLines(List<TicketLine> new_lines)
public User getUser()
public void setUser(User us)
public int newVisibleId() throws BasicException
BasicException
public double calculateTaxes()
public double calculateSubTotal()
public double calculateTotal()
public double calculateDebt()
public double calculateTotalPayments()
public String getHost()
public void setHost(String host)
host
- the host to setpublic Integer getNumber()
public void setNumber(Integer number)
number
- the number to setpublic void validate() throws BasicException
BasicException
- if no number could be asigned. No
signature will be generated in this case.public List<Payment> getPayments()
public Place getPlace()
public void setPlace(Place place)
public Ticket clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public Ticket cloneWithoutPayments()
public Boolean isSynched()
public void setSynched(Boolean synched)
public Integer getStatus()
public void setStatus(Integer status)
status
- public void setStatusFlag(int flag)
flag
- public void toggleStatusFlag(Integer flag)
flag
- public void unsetStatusFlag(Integer flag)
flag
- public boolean hasStatus(Integer status)
status
- public void addPayment(Payment payment)
payment
- public void addLine(TicketLine line)
public boolean hasMembercardPayment()
public void clearPayments() throws AggregateException
AggregateException
public void revertGatewayPayments() throws AggregateException
AggregateException
public void auditDeletion()
public double retrievePaymentInfo()
public Boolean isVoided()
public Boolean isVoiding()
public String getValueCard()
public void setValueCard(String valueCard)
public MagCardReader getCreditCard()
public void setCreditCard(MagCardReader creditCardReader)
public Integer getGuests()
public void setGuests(Integer guests)
public String getOrderCode()
public void setOrderCode(String orderCode)
orderCode
- public String printPlaceName()
public static Ticket getTicketByNumber(Integer iTicketNumber)
iTicketNumber
- public static Ticket getTicketByVisibleID(Integer iTicketVisibleID)
iTicketVisibleID
- public boolean hasAccess(User oUser)
public long overdueTime()
public boolean isOverdue()
public boolean isEmpty()
public Date returnReservationDate()
public void updateAllReservationTimes(Date oDateRes)
public void setZipCodeRes(String zip_code)
zip_code
- public void setZipCode(String zip_code)
zip_code
- public String getzipCodeRes()
public String getSignature()
public void setSignature(String signature)
public boolean hasReservations()
public boolean inActiveCash()
public Date getUpdated_at()
public void setUpdated_at(Date updated_at)
setUpdated_at
in interface Auditable
public Date getCreated_at()
public void setCreated_at(Date created_at)
setCreated_at
in interface Auditable
public boolean hasProtectedLines()
public Boolean getToGo()
public void setToGo(Boolean toGo)
public Boolean getHasNegativeLines()
public void setHasNegativeLines(Boolean hasNegativeLines)
public Long getTurnover()
public void setTurnover(Long turnover)
turnover
- public Long getTransactionNumber()
public void setTransactionNumber(Long transactionNumber)
public Integer getReference()
public void setReference(Integer reference)
public boolean isTraining()
public boolean isValid()
Copyright © 2021. All rights reserved.