From: Roland Häder Date: Sat, 23 Sep 2017 11:18:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5bba47029c48ca36bac506a621d58959b2081eec;p=jfinancials-core.git Continued: - added seller (Employee) reference as some receipts bears it who/only number has sold the item - added class fields for receipt register's number and bar-code number Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java index cb58bf6..5afec5d 100644 --- a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java @@ -19,6 +19,7 @@ package org.mxchange.jfinancials.model.receipt; 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; @@ -29,6 +30,20 @@ import org.mxchange.jusercore.model.user.User; */ public interface BillableReceipt extends Serializable { + /** + * Getter for receipt bar-code number + *

+ * @return Receipt bar-code number + */ + Long getReceiptBarCodeNumber (); + + /** + * Setter for receipt bar-code number + *

+ * @param receiptBarCodeNumber Receipt bar-code number + */ + void setReceiptBarCodeNumber (final Long receiptBarCodeNumber); + /** * Getter for when this receipt has been created in database *

@@ -71,6 +86,20 @@ public interface BillableReceipt extends Serializable { */ void setReceiptId (final Long receiptId); + /** + * Getter for seller (employee) + *

+ * @return Seller (employee) + */ + Employee getReceiptSellerEmployee (); + + /** + * Setter for seller (employee) + *

+ * @param receiptSellerEmployee Seller (employee) + */ + void setReceiptSellerEmployee (final Employee receiptSellerEmployee); + /** * Getter for receipt number *

@@ -85,7 +114,21 @@ public interface BillableReceipt extends Serializable { */ void setReceiptNumber (final Long receiptNumber); - /** + /** + * Getter for receipt register's number (cash register's number) + *

+ * @return Receipt register's number + */ + Long getReceiptRegisterNumber (); + + /** + * Setter for receipt register's number (cash register's number) + *

+ * @param receiptRegisterNumber Receipt register's number + */ + void setReceiptRegisterNumber (final Long receiptRegisterNumber); + + /** * Getter for receipt's user *

* @return Receipt's user diff --git a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java index 7993c96..a68dbcf 100644 --- a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java @@ -38,6 +38,8 @@ import javax.persistence.TemporalType; 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; @@ -65,6 +67,12 @@ public class FinancialReceipt implements BillableReceipt { @Transient private static final long serialVersionUID = 185_867_217_461L; + /** + * Receipt bar-code number + */ + @Column (name = "receipt_barcode_number") + private Long receiptBarCodeNumber; + /** * Seller instance */ @@ -110,6 +118,19 @@ public class FinancialReceipt implements BillableReceipt { @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 */ @@ -130,7 +151,7 @@ public class FinancialReceipt implements BillableReceipt { * @param receiptBranchOffice Branch office instance * @param receiptUser User instance * @param receiptIssued When this receipt has been issued - * + *

* @throws NullPointerException If user instance is not set * @throws IllegalArgumentException If user instance's userId is invalid */ @@ -196,15 +217,16 @@ public class FinancialReceipt implements BillableReceipt { 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())) { @@ -222,6 +244,16 @@ public class FinancialReceipt implements BillableReceipt { 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; @@ -286,6 +318,26 @@ public class FinancialReceipt implements BillableReceipt { 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;