void setItemProduct (final Product itemProduct);
/**
- * Getter for product discount
+ * Getter for product discount as fixed value
* <p>
- * @return Product discount
+ * @return Product discount as fixed value
*/
- Float getItemProductDiscount ();
+ Float getItemDiscountFixed ();
/**
- * Setter for product discount
+ * Setter for product discount as fixed value
* <p>
- * @param productDiscount Product discount
+ * @param itemDiscountFixed Product discount as fixed value
*/
- void setItemProductDiscount (final Float productDiscount);
+ void setItemDiscountFixed (final Float itemDiscountFixed);
+
+ /**
+ * Getter for product discount in percents
+ * <p>
+ * @return Product discount in percents
+ */
+ Float getItemDiscountPercent ();
+
+ /**
+ * Setter for product discount in percents
+ * <p>
+ * @param itemDiscountPercent Product discount in percents
+ */
+ void setItemDiscountPercent (final Float itemDiscountPercent);
/**
* Getter for product quantity
@Index (name = "item_receipt_product", columnList = "item_receipt_id,item_product_id", unique = true)
}
)
-@NamedQueries(
+@NamedQueries (
{
- @NamedQuery(name = "AllReceiptItems", query = "SELECT ri FROM receipt_items AS ri ORDER BY ri.itemId ASC"),
- @NamedQuery(name = "SearchAssignedReceiptItems", query = "SELECT ri FROM receipt_items AS ri WHERE ri.itemReceipt = :itemReceipt ORDER BY ri.itemId ASC"),
- @NamedQuery(name = "SearchAllUserReceiptItems", query = "SELECT ri FROM receipt_items AS ri JOIN receipts AS r ON ri.itemReceipt=r WHERE r.receiptUser = :receiptUser ORDER BY ri.itemId ASC")
+ @NamedQuery (name = "AllReceiptItems", query = "SELECT ri FROM receipt_items AS ri ORDER BY ri.itemId ASC"),
+ @NamedQuery (name = "SearchAssignedReceiptItems", query = "SELECT ri FROM receipt_items AS ri WHERE ri.itemReceipt = :itemReceipt ORDER BY ri.itemId ASC"),
+ @NamedQuery (name = "SearchAllUserReceiptItems", query = "SELECT ri FROM receipt_items AS ri JOIN receipts AS r ON ri.itemReceipt=r WHERE r.receiptUser = :receiptUser ORDER BY ri.itemId ASC")
}
)
@SuppressWarnings ("PersistenceUnitPresent")
/**
* 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)
+ @JoinColumn (name = "item_category_id", referencedColumnName = "category_id", updatable = false)
+ @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false)
private Category itemCategory;
/**
private Date itemCreated;
/**
- * Primary key
+ * Fixed discount on item
*/
- @Id
- @GeneratedValue (strategy = GenerationType.IDENTITY)
- @Column (name = "item_id", nullable = false, updatable = false)
- private Long itemId;
+ @Column (name = "item_discount_fixed")
+ private Float itemDiscountFixed;
/**
- * Product being linked in this itemReceipt item
+ * Percentage discount on item
*/
- @JoinColumn (name = "item_product_id", referencedColumnName = "product_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH, optional = false)
- private Product itemProduct;
+ @Column (name = "item_discount_percent")
+ private Float itemDiscountPercent;
/**
- * Discount on item
+ * Gross price of item
*/
- @Column (name = "item_product_discount")
- private Float itemProductDiscount;
+ @Column (name = "item_gross_price")
+ private Float itemGrossPrice;
/**
- * Net price of item
+ * Primary key
*/
- @Column (name = "item_net_price")
- private Float itemNetPrice;
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ @Column (name = "item_id", nullable = false, updatable = false)
+ private Long itemId;
/**
- * Gross price of item
+ * Net price of item
*/
- @Column (name = "item_gross_price")
- private Float itemGrossPrice;
+ @Column (name = "item_net_price")
+ private Float itemNetPrice;
/**
- * Tax rate
+ * Product being linked in this itemReceipt item
*/
- @Column (name = "item_tax_rate")
- private Float itemTaxRate;
+ @JoinColumn (name = "item_product_id", referencedColumnName = "product_id", nullable = false, updatable = false)
+ @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH, optional = false)
+ private Product itemProduct;
/**
* Product quantity
@OneToOne (targetEntity = FinancialReceipt.class, cascade = CascadeType.REFRESH, optional = false)
private BillableReceipt itemReceipt;
+ /**
+ * Tax rate
+ */
+ @Column (name = "item_tax_rate")
+ private Float itemTaxRate;
+
/**
* Default constructor
*/
this.itemCreated = itemCreated;
}
+ @Override
+ public Float getItemDiscountFixed () {
+ return this.itemDiscountFixed;
+ }
+
+ @Override
+ public void setItemDiscountFixed (final Float itemDiscountFixed) {
+ this.itemDiscountFixed = itemDiscountFixed;
+ }
+
+ @Override
+ public Float getItemDiscountPercent () {
+ return this.itemDiscountPercent;
+ }
+
+ @Override
+ public void setItemDiscountPercent (final Float itemDiscountPercent) {
+ this.itemDiscountPercent = itemDiscountPercent;
+ }
+
@Override
public Float getItemGrossPrice () {
return this.itemGrossPrice;
this.itemProduct = itemProduct;
}
- @Override
- public Float getItemProductDiscount () {
- return this.itemProductDiscount;
- }
-
- @Override
- public void setItemProductDiscount (final Float itemProductDiscount) {
- this.itemProductDiscount = itemProductDiscount;
- }
-
@Override
public Short getItemProductQuantity () {
return this.itemProductQuantity;