]> git.mxchange.org Git - jbonuscard-core.git/commitdiff
Don't cherry-pick
authorRoland Häder <roland@mxchange.org>
Sun, 12 Nov 2017 12:54:50 +0000 (13:54 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 12 Nov 2017 15:04:36 +0000 (16:04 +0100)
- added entity for registering bonus cards, they will connect the buyer's "contact"
  entity with receipt entity
- added field for whether the item is a discount
- added field for item's coupon number
- removed percentage/fixed discounts as this should be done with fake products
- removed unique constrain between item's product and receipt as same discounts
  may be applied on more than one item

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java [new file with mode: 0644]
src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java [new file with mode: 0644]
src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java
src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java
src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java
src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java

diff --git a/src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java b/src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java
new file mode 100644 (file)
index 0000000..7833bd6
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.model.bonus_card;
+
+import java.io.Serializable;
+import java.util.Date;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcustomercore.model.customer.Customer;
+
+/**
+ * A POJI for bonus cards
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface BonusCard extends Serializable {
+
+       /**
+        * Getter for bonus card's bar code
+        * <p>
+        * @return Bonus card's bar code
+        */
+       String getBonusCardBarCode ();
+
+       /**
+        * Setter for bonus card's bar code
+        * <p>
+        * @param bonusCardBarCode Bonus card's bar code
+        */
+       void setBonusCardBarCode (final String bonusCardBarCode);
+
+       /**
+        * Getter for bonus card's contact data
+        * <p>
+        * @return Bonus card's contact data
+        */
+       Contact getBonusCardContact ();
+
+       /**
+        * Setter for bonus card's contact data
+        * <p>
+        * @param bonusCardContact Bonus card's contact data
+        */
+       void setBonusCardContact (final Contact bonusCardContact);
+
+       /**
+        * Getter for bonus card's creation timestamp
+        * <p>
+        * @return Bonus card's creation timestamp
+        */
+       Date getBonusCardCreated ();
+
+       /**
+        * Setter for bonus card's creation timestamp
+        * <p>
+        * @param bonusCardCreated Bonus card's creation timestamp
+        */
+       void setBonusCardCreated (final Date bonusCardCreated);
+
+       /**
+        * Getter for bonus card's customer data
+        * <p>
+        * @return Bonus card's customer data
+        */
+       Customer getBonusCardCustomer ();
+
+       /**
+        * Setter for bonus card's customer data
+        * <p>
+        * @param bonusCardCustomer Bonus card's customer data
+        */
+       void setBonusCardCustomer (final Customer bonusCardCustomer);
+
+       /**
+        * Getter for bonus card's primary key
+        * <p>
+        * @return Bonus card's primary key
+        */
+       Long getBonusCardId ();
+
+       /**
+        * Setter for bonus card's primary key
+        * <p>
+        * @param bonusCardId Bonus card's primary key
+        */
+       void setBonusCardId (final Long bonusCardId);
+
+       /**
+        * Getter for bonus card's issuing company
+        * <p>
+        * @return Bonus card's issuing company
+        */
+       BasicData getBonusCardIssuer ();
+
+       /**
+        * Setter for bonus card's issuing company
+        * <p>
+        * @param bonusCardIssuer Bonus card's issuing company
+        */
+       void setBonusCardIssuer (final BasicData bonusCardIssuer);
+
+       /**
+        * Getter for bonus card's number (other than customer/bar code)
+        * <p>
+        * @return Bonus card's number
+        */
+       String getBonusCardNumber ();
+
+       /**
+        * Setter for bonus card's number (other than customer/bar code)
+        * <p>
+        * @param bonusCardNumber Bonus card's number
+        */
+       void setBonusCardNumber (final String bonusCardNumber);
+
+       /**
+        * Getter for bonus card's partnering/branding company
+        * <p>
+        * @return Bonus card's partnering/branding company
+        */
+       BasicData getBonusCardPartner ();
+
+       /**
+        * Setter for bonus card's partnering/branding company
+        * <p>
+        * @param bonusCardPartner Bonus card's partnering/branding company
+        */
+       void setBonusCardPartner (final BasicData bonusCardPartner);
+
+       @Override
+       boolean equals (final Object object);
+
+       @Override
+       int hashCode ();
+
+}
diff --git a/src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java b/src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java
new file mode 100644 (file)
index 0000000..340e25c
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.model.bonus_card;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.Objects;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.contact.UserContact;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcustomercore.model.customer.ContactCustomer;
+import org.mxchange.jcustomercore.model.customer.Customer;
+
+/**
+ * A POJO (entity) for bonus cards
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Entity (name = "bonus_cards")
+@Table (
+               name = "bonus_cards"
+)
+@SuppressWarnings ("PersistenceUnitPresent")
+public class FinancialBonusCard implements BonusCard {
+
+       /**
+        * Serial number
+        */
+       @Transient
+       private static final long serialVersionUID = 12_586_367_165_980L;
+
+       /**
+        * Bar code on bonus card
+        */
+       @Column (name = "bonus_card_bar_code")
+       private String bonusCardBarCode;
+
+       /**
+        * The contact that this card is assigned to
+        */
+       @JoinColumn (name = "bonus_card_contact_id", referencedColumnName = "contact_id", nullable = false)
+       @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH, optional = false)
+       private Contact bonusCardContact;
+
+       /**
+        * When this entry has been created
+        */
+       @Basic (optional = false)
+       @Column (name = "bonus_card_created", nullable = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       private Date bonusCardCreated;
+
+       /**
+        * Bonus card customer id
+        */
+       @JoinColumn (name = "bonus_card_customer_id", referencedColumnName = "customer_id")
+       @OneToOne (targetEntity = ContactCustomer.class, cascade = CascadeType.REFRESH)
+       private Customer bonusCardCustomer;
+
+       /**
+        * Id number
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "bonus_card_id", nullable = false, updatable = false)
+       private Long bonusCardId;
+
+       /**
+        * Issuing company of this card
+        */
+       @JoinColumn (name = "bonus_card_issuer_id", referencedColumnName = "company_data_id", nullable = false)
+       @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH, optional = false)
+       private BasicData bonusCardIssuer;
+
+       /**
+        * Bonus card number
+        */
+       @Column (name = "bonus_card_number")
+       private String bonusCardNumber;
+
+       /**
+        * Partnering/branding company of this card
+        */
+       @JoinColumn (name = "bonus_card_partner_id", referencedColumnName = "company_data_id")
+       @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH)
+       private BasicData bonusCardPartner;
+
+       /**
+        * Default constructor (required for JPA)
+        */
+       public FinancialBonusCard () {
+       }
+
+       /**
+        * Constructor with all required fields
+        * <p>
+        * @param bonusCardContact Contact instance
+        */
+       public FinancialBonusCard (final Contact bonusCardContact) {
+               // Call other constructor first
+               this();
+
+               // Validate parameter
+               if (null == bonusCardContact) {
+                       // Throw NPE
+                       throw new NullPointerException("bonusCardContact is null"); //NOI18N
+               } else if (bonusCardContact.getContactId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("bonusCardContact.contactId is null"); //NOI18N
+               } else if (bonusCardContact.getContactId() < 1) {
+                       // Throw it again
+                       throw new NullPointerException(MessageFormat.format("bonusCardContact.contactId={0} is invalid", bonusCardContact.getContactId())); //NOI18N
+               }
+
+               // Set all
+               this.bonusCardContact = bonusCardContact;
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (this == object) {
+                       return true;
+               } else if (null == object) {
+                       return false;
+               }
+               if (this.getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final BonusCard other = (BonusCard) object;
+
+               if (!Objects.equals(this.getBonusCardBarCode(), other.getBonusCardBarCode())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardContact(), other.getBonusCardContact())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardCustomer(), other.getBonusCardCustomer())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardId(), other.getBonusCardId())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardIssuer(), other.getBonusCardIssuer())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardNumber(), other.getBonusCardNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getBonusCardPartner(), other.getBonusCardPartner())) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       @Override
+       public String getBonusCardBarCode () {
+               return this.bonusCardBarCode;
+       }
+
+       @Override
+       public void setBonusCardBarCode (final String bonusCardBarCode) {
+               this.bonusCardBarCode = bonusCardBarCode;
+       }
+
+       @Override
+       public Contact getBonusCardContact () {
+               return this.bonusCardContact;
+       }
+
+       @Override
+       public void setBonusCardContact (final Contact bonusCardContact) {
+               this.bonusCardContact = bonusCardContact;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getBonusCardCreated () {
+               return this.bonusCardCreated;
+       }
+
+       @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setBonusCardCreated (final Date bonusCardCreated) {
+               this.bonusCardCreated = bonusCardCreated;
+       }
+
+       @Override
+       public Customer getBonusCardCustomer () {
+               return this.bonusCardCustomer;
+       }
+
+       @Override
+       public void setBonusCardCustomer (final Customer bonusCardCustomer) {
+               this.bonusCardCustomer = bonusCardCustomer;
+       }
+
+       @Override
+       public Long getBonusCardId () {
+               return this.bonusCardId;
+       }
+
+       @Override
+       public void setBonusCardId (final Long bonusCardId) {
+               this.bonusCardId = bonusCardId;
+       }
+
+       @Override
+       public BasicData getBonusCardIssuer () {
+               return this.bonusCardIssuer;
+       }
+
+       @Override
+       public void setBonusCardIssuer (final BasicData bonusCardIssuer) {
+               this.bonusCardIssuer = bonusCardIssuer;
+       }
+
+       @Override
+       public String getBonusCardNumber () {
+               return this.bonusCardNumber;
+       }
+
+       @Override
+       public void setBonusCardNumber (final String bonusCardNumber) {
+               this.bonusCardNumber = bonusCardNumber;
+       }
+
+       @Override
+       public BasicData getBonusCardPartner () {
+               return this.bonusCardPartner;
+       }
+
+       @Override
+       public void setBonusCardPartner (final BasicData bonusCardPartner) {
+               this.bonusCardPartner = bonusCardPartner;
+       }
+
+       @Override
+       public int hashCode () {
+               int hash = 5;
+
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardBarCode());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardContact());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardCustomer());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardId());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardIssuer());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardNumber());
+               hash = 13 * hash + Objects.hashCode(this.getBonusCardPartner());
+
+               return hash;
+       }
+
+}
index a1eb9455610c636afafd02f7f0a992e33b915f08..6563ab4a3ccd5349b17f5a40df8cbfb6efcfb5c1 100644 (file)
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import java.util.Date;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jfinancials.model.bonus_card.BonusCard;
 import org.mxchange.jproduct.model.payment.PaymentType;
 import org.mxchange.jusercore.model.user.User;
 
@@ -44,6 +45,20 @@ public interface BillableReceipt extends Serializable {
         */
        void setReceiptBarCodeNumber (final String receiptBarCodeNumber);
 
+       /**
+        * Getter for receipt's assigned bonus card
+        * <p>
+        * @return Receipt's assigned bonus card
+        */
+       BonusCard getReceiptBonusCard ();
+
+       /**
+        * Setter for receipt's assigned bonus card
+        * <p>
+        * @param receiptBonusCard Receipt's assigned bonus card
+        */
+       void setReceiptBonusCard (final BonusCard receiptBonusCard);
+
        /**
         * Getter for when this receipt has been created in database
         * <p>
index 2ab24960412574615d3ee71a2da09e8ae2a8fac0..09792d697784661170dec3c5b0be360a8fa9d6f4 100644 (file)
@@ -40,6 +40,8 @@ import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jfinancials.model.bonus_card.BonusCard;
+import org.mxchange.jfinancials.model.bonus_card.FinancialBonusCard;
 import org.mxchange.jproduct.model.payment.PaymentType;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
@@ -73,6 +75,13 @@ public class FinancialReceipt implements BillableReceipt {
        @Column (name = "receipt_barcode_number")
        private String receiptBarCodeNumber;
 
+       /**
+        * Assigned bonus card
+        */
+       @JoinColumn (name = "receipt_bonus_card_id", referencedColumnName = "bonus_card_id")
+       @OneToOne (targetEntity = FinancialBonusCard.class, cascade = CascadeType.REFRESH)
+       private BonusCard receiptBonusCard;
+
        /**
         * Seller instance
         */
@@ -260,6 +269,16 @@ public class FinancialReceipt implements BillableReceipt {
                this.receiptBarCodeNumber = receiptBarCodeNumber;
        }
 
+       @Override
+       public BonusCard getReceiptBonusCard () {
+               return this.receiptBonusCard;
+       }
+
+       @Override
+       public void setReceiptBonusCard (final BonusCard receiptBonusCard) {
+               this.receiptBonusCard = receiptBonusCard;
+       }
+
        @Override
        public BranchOffice getReceiptBranchOffice () {
                return this.receiptBranchOffice;
index 228d69c59d112db2531dedb9488d2826cfa82b24..bc0edafbede07f5797895d23778571455875127e 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jfinancials.model.receipt_item;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jfinancials.model.receipt.BillableReceipt;
@@ -73,60 +74,61 @@ public interface BillableReceiptItem extends Serializable {
        void setItemId (final Long itemId);
 
        /**
-        * Getter for receipt instance
+        * Getter for whether the item is a discount on whole receipt
         * <p>
-        * @return Receipt instance
+        * @return Whether the item is a discount on whole receipt
         */
-       BillableReceipt getItemReceipt ();
+       Boolean getItemIsDiscount ();
 
        /**
-        * Setter for receipt instance
+        * Setter for whether the item is a discount on whole receipt or item
         * <p>
-        * @param itemReceipt Receipt instance
+        * @param itemIsDiscount Whether the item is a discount on whole receipt or
+        *                       item
         */
-       void setItemReceipt (final BillableReceipt itemReceipt);
+       void setItemIsDiscount (final Boolean itemIsDiscount);
 
        /**
-        * Getter for linked product
+        * Getter for whether the item is a refund
         * <p>
-        * @return Product
+        * @return Whether the item is a refund
         */
-       Product getItemProduct ();
+       Boolean getItemIsRefund ();
 
        /**
-        * Setter for linked product
+        * Setter for whether the item is a refund
         * <p>
-        * @param itemProduct Product
+        * @param itemIsRefund Whether the item is a refund
         */
-       void setItemProduct (final Product itemProduct);
+       void setItemIsRefund (final Boolean itemIsRefund);
 
        /**
-        * Getter for product discount as fixed value
+        * Getter for receipt instance
         * <p>
-        * @return Product discount as fixed value
+        * @return Receipt instance
         */
-       Float getItemDiscountFixed ();
+       BillableReceipt getItemReceipt ();
 
        /**
-        * Setter for product discount as fixed value
+        * Setter for receipt instance
         * <p>
-        * @param itemDiscountFixed Product discount as fixed value
+        * @param itemReceipt Receipt instance
         */
-       void setItemDiscountFixed (final Float itemDiscountFixed);
+       void setItemReceipt (final BillableReceipt itemReceipt);
 
        /**
-        * Getter for product discount in percents
+        * Getter for linked product
         * <p>
-        * @return Product discount in percents
+        * @return Product
         */
-       Float getItemDiscountPercent ();
+       Product getItemProduct ();
 
        /**
-        * Setter for product discount in percents
+        * Setter for linked product
         * <p>
-        * @param itemDiscountPercent Product discount in percents
+        * @param itemProduct Product
         */
-       void setItemDiscountPercent (final Float itemDiscountPercent);
+       void setItemProduct (final Product itemProduct);
 
        /**
         * Getter for product quantity
@@ -147,42 +149,42 @@ public interface BillableReceiptItem extends Serializable {
         * <p>
         * @return Item's net price
         */
-       Float getItemNetPrice ();
+       BigDecimal getItemNetPrice ();
 
        /**
         * Setter for item's net price
         * <p>
         * @param itemNetPrice Item's net price
         */
-       void setItemNetPrice (final Float itemNetPrice);
+       void setItemNetPrice (final BigDecimal itemNetPrice);
 
        /**
         * Getter for item's tax rate
         * <p>
         * @return Item's tax rate
         */
-       Float getItemTaxRate ();
+       BigDecimal getItemTaxRate ();
 
        /**
         * Setter for item's tax rate
         * <p>
         * @param itemTaxRate Item's tax rate
         */
-       void setItemTaxRate (final Float itemTaxRate);
+       void setItemTaxRate (final BigDecimal itemTaxRate);
 
        /**
         * Getter for item's gross price
         * <p>
         * @return Item's gross price
         */
-       Float getItemGrossPrice ();
+       BigDecimal getItemGrossPrice ();
 
        /**
         * Setter for item's gross price
         * <p>
         * @param itemGrossPrice Item's gross price
         */
-       void setItemGrossPrice (final Float itemGrossPrice);
+       void setItemGrossPrice (final BigDecimal itemGrossPrice);
 
        /**
         * Getter for manufacturer/producer of this item
@@ -226,6 +228,20 @@ public interface BillableReceiptItem extends Serializable {
         */
        void setItemNumber (final Long itemNumber);
 
+       /**
+        * Getter for item's coupon number
+        * <p>
+        * @return Item's coupon number
+        */
+       String getItemCouponNumber ();
+
+       /**
+        * Setter for item's coupon number
+        * <p>
+        * @param itemCouponNumber Item's coupon number
+        */
+       void setItemCouponNumber (final String itemCouponNumber);
+
        @Override
        boolean equals (final Object object);
 
index 35a00e5b56850024363aef7ac0440a4a452b0bda..7c6203713a25d0982255d91e443ef277d4206991 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jfinancials.model.receipt_item;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Objects;
 import javax.persistence.Basic;
@@ -25,7 +26,6 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
-import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
@@ -50,10 +50,7 @@ import org.mxchange.jproduct.model.product.Product;
  */
 @Entity (name = "receipt_items")
 @Table (
-               name = "receipt_items",
-               indexes = {
-                       @Index (name = "item_receipt_product", columnList = "item_receipt_id,item_product_id", unique = true)
-               }
+               name = "receipt_items"
 )
 @NamedQueries (
                {
@@ -84,6 +81,12 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false)
        private Category itemCategory;
 
+       /**
+        * Item 's coupon number
+        */
+       @Column (name = "item_coupon_number")
+       private String itemCouponNumber;
+
        /**
         * When this item has been created in database
         */
@@ -92,23 +95,11 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        @Column (name = "item_created", nullable = false)
        private Date itemCreated;
 
-       /**
-        * Fixed discount on item
-        */
-       @Column (name = "item_discount_fixed")
-       private Float itemDiscountFixed;
-
-       /**
-        * Percentage discount on item
-        */
-       @Column (name = "item_discount_percent")
-       private Float itemDiscountPercent;
-
        /**
         * Gross price of item
         */
-       @Column (name = "item_gross_price")
-       private Float itemGrossPrice;
+       @Column (name = "item_gross_price", precision = 2)
+       private BigDecimal itemGrossPrice;
 
        /**
         * Primary key
@@ -118,6 +109,20 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        @Column (name = "item_id", nullable = false, updatable = false)
        private Long itemId;
 
+       /**
+        * Whether the item is a discount on whole receipt or single item
+        */
+       @Basic (optional = false)
+       @Column (name = "item_is_discount", nullable = false)
+       private Boolean itemIsDiscount;
+
+       /**
+        * Whether the item is a refund
+        */
+       @Basic (optional = false)
+       @Column (name = "item_is_refund", nullable = false)
+       private Boolean itemIsRefund;
+
        /**
         * Manufacturer/producer of this item
         */
@@ -128,13 +133,13 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        /**
         * Net price of item
         */
-       @Column (name = "item_net_price")
-       private Float itemNetPrice;
+       @Column (name = "item_net_price", precision = 2)
+       private BigDecimal itemNetPrice;
 
        /**
         * Item's number
         */
-       @Column(name = "item_number")
+       @Column (name = "item_number")
        private Long itemNumber;
 
        /**
@@ -161,8 +166,8 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        /**
         * Tax rate
         */
-       @Column (name = "item_tax_rate")
-       private Float itemTaxRate;
+       @Column (name = "item_tax_rate", precision = 2)
+       private BigDecimal itemTaxRate;
 
        /**
         * Default constructor
@@ -233,6 +238,16 @@ public class FinancialReceiptItem implements BillableReceiptItem {
                this.itemCategory = itemCategory;
        }
 
+       @Override
+       public String getItemCouponNumber () {
+               return this.itemCouponNumber;
+       }
+
+       @Override
+       public void setItemCouponNumber (final String itemCouponNumber) {
+               this.itemCouponNumber = itemCouponNumber;
+       }
+
        @Override
        @SuppressWarnings ("ReturnOfDateField")
        public Date getItemCreated () {
@@ -246,43 +261,43 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        }
 
        @Override
-       public Float getItemDiscountFixed () {
-               return this.itemDiscountFixed;
+       public BigDecimal getItemGrossPrice () {
+               return this.itemGrossPrice;
        }
 
        @Override
-       public void setItemDiscountFixed (final Float itemDiscountFixed) {
-               this.itemDiscountFixed = itemDiscountFixed;
+       public void setItemGrossPrice (final BigDecimal itemGrossPrice) {
+               this.itemGrossPrice = itemGrossPrice;
        }
 
        @Override
-       public Float getItemDiscountPercent () {
-               return this.itemDiscountPercent;
+       public Long getItemId () {
+               return this.itemId;
        }
 
        @Override
-       public void setItemDiscountPercent (final Float itemDiscountPercent) {
-               this.itemDiscountPercent = itemDiscountPercent;
+       public void setItemId (final Long itemId) {
+               this.itemId = itemId;
        }
 
        @Override
-       public Float getItemGrossPrice () {
-               return this.itemGrossPrice;
+       public Boolean getItemIsDiscount () {
+               return this.itemIsDiscount;
        }
 
        @Override
-       public void setItemGrossPrice (final Float itemGrossPrice) {
-               this.itemGrossPrice = itemGrossPrice;
+       public void setItemIsDiscount (final Boolean itemIsDiscount) {
+               this.itemIsDiscount = itemIsDiscount;
        }
 
        @Override
-       public Long getItemId () {
-               return this.itemId;
+       public Boolean getItemIsRefund () {
+               return this.itemIsRefund;
        }
 
        @Override
-       public void setItemId (final Long itemId) {
-               this.itemId = itemId;
+       public void setItemIsRefund (final Boolean itemIsRefund) {
+               this.itemIsRefund = itemIsRefund;
        }
 
        @Override
@@ -296,12 +311,12 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        }
 
        @Override
-       public Float getItemNetPrice () {
+       public BigDecimal getItemNetPrice () {
                return this.itemNetPrice;
        }
 
        @Override
-       public void setItemNetPrice (final Float itemNetPrice) {
+       public void setItemNetPrice (final BigDecimal itemNetPrice) {
                this.itemNetPrice = itemNetPrice;
        }
 
@@ -346,12 +361,12 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        }
 
        @Override
-       public Float getItemTaxRate () {
+       public BigDecimal getItemTaxRate () {
                return this.itemTaxRate;
        }
 
        @Override
-       public void setItemTaxRate (final Float itemTaxRate) {
+       public void setItemTaxRate (final BigDecimal itemTaxRate) {
                this.itemTaxRate = itemTaxRate;
        }