]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 23 Sep 2017 11:18:14 +0000 (13:18 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 23 Sep 2017 11:31:53 +0000 (13:31 +0200)
- 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 <roland@mxchange.org>
src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java
src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java

index cb58bf65656cd1be259c2d0cdf31dafb700ab221..5afec5d4b4bc5f33f572f293f3c3ddce320eaa2f 100644 (file)
@@ -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
+        * <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>
@@ -71,6 +86,20 @@ public interface BillableReceipt extends Serializable {
         */
        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>
@@ -85,7 +114,21 @@ public interface BillableReceipt extends Serializable {
         */
        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
index 7993c96a9f41d7a9fa58494715d57c98bd21f29c..a68dbcfcc222f64bfba1683d5b893e5679c81121 100644 (file)
@@ -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
-        *
+        * <p>
         * @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;