import java.io.Serializable;
import java.util.Date;
import org.mxchange.jfinancials.model.receipt.BillableReceipt;
+import org.mxchange.jproduct.model.category.Category;
import org.mxchange.jproduct.model.product.Product;
/**
*/
public interface BillableReceiptItem extends Serializable {
+ /**
+ * Getter for item's product category
+ * <p>
+ * @return Item's product category
+ */
+ Category getItemCategory ();
+
+ /**
+ * Setter for item's product category
+ * <p>
+ * @param itemCategory Item's product category
+ */
+ void setItemCategory (final Category itemCategory);
+
/**
* Getter when this receipt item has been created in database
* <p>
* <p>
* @return Product quantity
*/
- Long getItemProductQuantity ();
+ Short getItemProductQuantity ();
/**
* Setter for product quantity
* <p>
* @param itemProductQuantity Product quantity
*/
- void setItemProductQuantity (final Long itemProductQuantity);
+ void setItemProductQuantity (final Short itemProductQuantity);
+
+ /**
+ * Getter for item's net price
+ * <p>
+ * @return Item's net price
+ */
+ Float getItemNetPrice ();
+
+ /**
+ * Setter for item's net price
+ * <p>
+ * @param itemNetPrice Item's net price
+ */
+ void setItemNetPrice (final Float itemNetPrice);
+
+ /**
+ * Getter for item's tax rate
+ * <p>
+ * @return Item's tax rate
+ */
+ Float getItemTaxRate ();
+
+ /**
+ * Setter for item's tax rate
+ * <p>
+ * @param itemTaxRate Item's tax rate
+ */
+ void setItemTaxRate (final Float itemTaxRate);
+
+ /**
+ * Getter for item's gross price
+ * <p>
+ * @return Item's gross price
+ */
+ Float getItemGrossPrice ();
+
+ /**
+ * Setter for item's gross price
+ * <p>
+ * @param itemGrossPrice Item's gross price
+ */
+ void setItemGrossPrice (final Float itemGrossPrice);
@Override
boolean equals (final Object object);
import javax.persistence.Transient;
import org.mxchange.jfinancials.model.receipt.BillableReceipt;
import org.mxchange.jfinancials.model.receipt.FinancialReceipt;
+import org.mxchange.jproduct.model.category.Category;
+import org.mxchange.jproduct.model.category.ProductCategory;
import org.mxchange.jproduct.model.product.GenericProduct;
import org.mxchange.jproduct.model.product.Product;
@Transient
private static final long serialVersionUID = 126_498_698_378_571L;
+ /**
+ * Category being assigned to item's product
+ */
+ @JoinColumn(name = "item_category_id", referencedColumnName = "category_id", updatable = false)
+ @OneToOne(targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false)
+ private Category itemCategory;
+
/**
* When this item has been created in database
*/
@Column (name = "item_product_discount")
private Float itemProductDiscount;
+ /**
+ * Net price of item
+ */
+ @Column (name = "item_net_price")
+ private Float itemNetPrice;
+
+ /**
+ * Gross price of item
+ */
+ @Column (name = "item_gross_price")
+ private Float itemGrossPrice;
+
+ /**
+ * Tax rate
+ */
+ @Column (name = "item_tax_rate")
+ private Float itemTaxRate;
+
/**
* Product quantity
*/
@Basic (optional = false)
@Column (name = "item_product_quantity", nullable = false)
- private Long itemProductQuantity;
+ private Short itemProductQuantity;
/**
* Connected itemReceipt item
* @param itemProductQuantity Product quantity
* @param itemReceipt FinancialReceipt instance
*/
- public FinancialReceiptItem (final Product itemProduct, final Long itemProductQuantity, final BillableReceipt itemReceipt) {
+ public FinancialReceiptItem (final Product itemProduct, final Short itemProductQuantity, final BillableReceipt itemReceipt) {
// Call other constructor
this();
// Set all values
+ this.itemCategory = itemProduct.getProductCategory();
this.itemProduct = itemProduct;
this.itemProductQuantity = itemProductQuantity;
this.itemReceipt = itemReceipt;
return true;
}
+ @Override
+ public Category getItemCategory () {
+ return this.itemCategory;
+ }
+
+ @Override
+ public void setItemCategory (final Category itemCategory) {
+ this.itemCategory = itemCategory;
+ }
+
@Override
@SuppressWarnings ("ReturnOfDateField")
public Date getItemCreated () {
this.itemCreated = itemCreated;
}
+ @Override
+ public Float getItemGrossPrice () {
+ return this.itemGrossPrice;
+ }
+
+ @Override
+ public void setItemGrossPrice (final Float itemGrossPrice) {
+ this.itemGrossPrice = itemGrossPrice;
+ }
+
@Override
public Long getItemId () {
return this.itemId;
this.itemId = itemId;
}
+ @Override
+ public Float getItemNetPrice () {
+ return this.itemNetPrice;
+ }
+
+ @Override
+ public void setItemNetPrice (final Float itemNetPrice) {
+ this.itemNetPrice = itemNetPrice;
+ }
+
@Override
public Product getItemProduct () {
return this.itemProduct;
}
@Override
- public Long getItemProductQuantity () {
+ public Short getItemProductQuantity () {
return this.itemProductQuantity;
}
@Override
- public void setItemProductQuantity (final Long itemProductQuantity) {
+ public void setItemProductQuantity (final Short itemProductQuantity) {
this.itemProductQuantity = itemProductQuantity;
}
this.itemReceipt = itemReceipt;
}
+ @Override
+ public Float getItemTaxRate () {
+ return this.itemTaxRate;
+ }
+
+ @Override
+ public void setItemTaxRate (final Float itemTaxRate) {
+ this.itemTaxRate = itemTaxRate;
+ }
+
@Override
public int hashCode () {
int hash = 5;