From: Roland Häder Date: Thu, 2 Nov 2017 21:13:26 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=45eedcfa3abc52f3763c20c7b3e305b81c23265c;p=jfinancials-core.git Continued: - items may have own manufacturer, mostly then the product itself is an abstract product and does not have a direct manufacturer. Example: Milk can be made by many producers ("manufacturer", I known it isn't the same but here productProducer sounds a bit strange ...) - bar code numbers might be very long, resulting an overflow of Long (!), so let's take String for now - brand name of products happens very often in for example supermarkets - manufacturer is now optional 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 af12bc3..a1eb945 100644 --- a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java @@ -35,14 +35,14 @@ public interface BillableReceipt extends Serializable { *

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

* @param receiptBarCodeNumber Receipt bar-code number */ - void setReceiptBarCodeNumber (final Long receiptBarCodeNumber); + void setReceiptBarCodeNumber (final String receiptBarCodeNumber); /** * Getter for when this receipt has been created in database diff --git a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java index 56dd98e..2ab2496 100644 --- a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java @@ -71,7 +71,7 @@ public class FinancialReceipt implements BillableReceipt { * Receipt bar-code number */ @Column (name = "receipt_barcode_number") - private Long receiptBarCodeNumber; + private String receiptBarCodeNumber; /** * Seller instance @@ -251,12 +251,12 @@ public class FinancialReceipt implements BillableReceipt { } @Override - public Long getReceiptBarCodeNumber () { + public String getReceiptBarCodeNumber () { return this.receiptBarCodeNumber; } @Override - public void setReceiptBarCodeNumber (final Long receiptBarCodeNumber) { + public void setReceiptBarCodeNumber (final String receiptBarCodeNumber) { this.receiptBarCodeNumber = receiptBarCodeNumber; } diff --git a/src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java b/src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java index b6dc9c2..c2dc8bd 100644 --- a/src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java +++ b/src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java @@ -18,6 +18,7 @@ package org.mxchange.jfinancials.model.receipt_item; import java.io.Serializable; import java.util.Date; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jfinancials.model.receipt.BillableReceipt; import org.mxchange.jproduct.model.category.Category; import org.mxchange.jproduct.model.product.Product; @@ -183,6 +184,34 @@ public interface BillableReceiptItem extends Serializable { */ void setItemGrossPrice (final Float itemGrossPrice); + /** + * Getter for manufacturer/producer of this item + *

+ * @return Manufacturer/producer of this item + */ + BasicData getItemManufacturer (); + + /** + * Setter for manufacturer/producer of this item + *

+ * @param itemManufacturer Manufacturer/producer of this item + */ + void setItemManufacturer (final BasicData itemManufacturer); + + /** + * Getter for item brand name + *

+ * @return Item brand name + */ + String getItemBrandName (); + + /** + * Setter for item brand name + *

+ * @param itemBrandName Item brand name + */ + void setItemBrandName (final String itemBrandName); + @Override boolean equals (final Object object); diff --git a/src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java b/src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java index 596c9a0..bc695ed 100644 --- a/src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java +++ b/src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java @@ -34,6 +34,8 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; +import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; import org.mxchange.jfinancials.model.receipt.BillableReceipt; import org.mxchange.jfinancials.model.receipt.FinancialReceipt; import org.mxchange.jproduct.model.category.Category; @@ -69,6 +71,12 @@ public class FinancialReceiptItem implements BillableReceiptItem { @Transient private static final long serialVersionUID = 126_498_698_378_571L; + /** + * Item branding + */ + @Column(name = "item_brand_name") + private String itemBrandName; + /** * Category being assigned to item's product */ @@ -110,6 +118,13 @@ public class FinancialReceiptItem implements BillableReceiptItem { @Column (name = "item_id", nullable = false, updatable = false) private Long itemId; + /** + * Manufacturer/producer of this item + */ + @JoinColumn (name = "item_manufacturer_id", referencedColumnName = "company_data_id") + @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH) + private BasicData itemManufacturer; + /** * Net price of item */ @@ -192,6 +207,16 @@ public class FinancialReceiptItem implements BillableReceiptItem { return true; } + @Override + public String getItemBrandName () { + return this.itemBrandName; + } + + @Override + public void setItemBrandName (final String itemBrandName) { + this.itemBrandName = itemBrandName; + } + @Override public Category getItemCategory () { return this.itemCategory; @@ -254,6 +279,16 @@ public class FinancialReceiptItem implements BillableReceiptItem { this.itemId = itemId; } + @Override + public BasicData getItemManufacturer () { + return this.itemManufacturer; + } + + @Override + public void setItemManufacturer (final BasicData itemManufacturer) { + this.itemManufacturer = itemManufacturer; + } + @Override public Float getItemNetPrice () { return this.itemNetPrice;