import java.io.Serializable;
import java.util.Date;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.model.employee.Employee;
import org.mxchange.jproduct.model.payment.PaymentType;
import org.mxchange.jusercore.model.user.User;
*/
public interface BillableReceipt extends Serializable {
+ /**
+ * Getter for receipt bar-code number
+ * <p>
+ * @return Receipt bar-code number
+ */
+ Long getReceiptBarCodeNumber ();
+
+ /**
+ * Setter for receipt bar-code number
+ * <p>
+ * @param receiptBarCodeNumber Receipt bar-code number
+ */
+ void setReceiptBarCodeNumber (final Long receiptBarCodeNumber);
+
/**
* Getter for when this receipt has been created in database
* <p>
*/
void setReceiptId (final Long receiptId);
+ /**
+ * Getter for seller (employee)
+ * <p>
+ * @return Seller (employee)
+ */
+ Employee getReceiptSellerEmployee ();
+
+ /**
+ * Setter for seller (employee)
+ * <p>
+ * @param receiptSellerEmployee Seller (employee)
+ */
+ void setReceiptSellerEmployee (final Employee receiptSellerEmployee);
+
/**
* Getter for receipt number
* <p>
*/
void setReceiptNumber (final Long receiptNumber);
- /**
+ /**
+ * Getter for receipt register's number (cash register's number)
+ * <p>
+ * @return Receipt register's number
+ */
+ Long getReceiptRegisterNumber ();
+
+ /**
+ * Setter for receipt register's number (cash register's number)
+ * <p>
+ * @param receiptRegisterNumber Receipt register's number
+ */
+ void setReceiptRegisterNumber (final Long receiptRegisterNumber);
+
+ /**
* Getter for receipt's user
* <p>
* @return Receipt's user
import javax.persistence.Transient;
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.branchoffice.CompanyBranchOffice;
+import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployee;
+import org.mxchange.jcontactsbusiness.model.employee.Employee;
import org.mxchange.jproduct.model.payment.PaymentType;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
@Transient
private static final long serialVersionUID = 185_867_217_461L;
+ /**
+ * Receipt bar-code number
+ */
+ @Column (name = "receipt_barcode_number")
+ private Long receiptBarCodeNumber;
+
/**
* Seller instance
*/
@Enumerated (EnumType.STRING)
private PaymentType receiptPaymentType;
+ /**
+ * Receipt register number
+ */
+ @Column (name = "receipt_register_number")
+ private Long receiptRegisterNumber;
+
+ /**
+ * Selling employee instance
+ */
+ @JoinColumn (name = "receipt_seller_id", referencedColumnName = "employee_id")
+ @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.REFRESH)
+ private Employee receiptSellerEmployee;
+
/**
* Which user this receipt belongs to
*/
* @param receiptBranchOffice Branch office instance
* @param receiptUser User instance
* @param receiptIssued When this receipt has been issued
- *
+ * <p>
* @throws NullPointerException If user instance is not set
* @throws IllegalArgumentException If user instance's userId is invalid
*/
public boolean equals (final Object object) {
if (this == object) {
return true;
- }
- if (null == object) {
+ } else if (null == object) {
return false;
} else if (this.getClass() != object.getClass()) {
return false;
}
+ // Cast securely
final BillableReceipt receipt = (BillableReceipt) object;
+ // Now check some distincting class fields
if (!Objects.equals(this.getReceiptId(), receipt.getReceiptId())) {
return false;
} else if (!Objects.equals(this.getReceiptNumber(), receipt.getReceiptNumber())) {
return true;
}
+ @Override
+ public Long getReceiptBarCodeNumber () {
+ return this.receiptBarCodeNumber;
+ }
+
+ @Override
+ public void setReceiptBarCodeNumber (final Long receiptBarCodeNumber) {
+ this.receiptBarCodeNumber = receiptBarCodeNumber;
+ }
+
@Override
public BranchOffice getReceiptBranchOffice () {
return this.receiptBranchOffice;
this.receiptPaymentType = receiptPaymentType;
}
+ @Override
+ public Long getReceiptRegisterNumber () {
+ return this.receiptRegisterNumber;
+ }
+
+ @Override
+ public void setReceiptRegisterNumber (final Long receiptRegisterNumber) {
+ this.receiptRegisterNumber = receiptRegisterNumber;
+ }
+
+ @Override
+ public Employee getReceiptSellerEmployee () {
+ return this.receiptSellerEmployee;
+ }
+
+ @Override
+ public void setReceiptSellerEmployee (final Employee receiptSellerEmployee) {
+ this.receiptSellerEmployee = receiptSellerEmployee;
+ }
+
@Override
public User getReceiptUser () {
return this.receiptUser;