]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 4 Nov 2017 11:36:18 +0000 (12:36 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 4 Nov 2017 12:24:14 +0000 (13:24 +0100)
- receipts may also bear time when purchased, let's record this as well and
  java.util.Date can easily persist both, date and time, anyway.
- item's manufacturer can be different to generic product manufacturer, e.g.
  a sound system is unlikely being rebranded but surely many different companies
  will produce milk (which is a generic product that needs branding)
- bar codes are sometimes extremely long, even java.lang.Long was not enough to
  store them and I may not go to BigInteger, but maybe one day I will ...
- code convention applied: in comparison, first value then variable
- added brand name for receipt item

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jfinancials/beans/financial/model/receipt/FinancialAdminReceiptWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt/FinancialsReceiptWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/FinancialAdminReceiptItemWebRequestBean.java
src/java/org/mxchange/jfinancials/converter/financial/receipt/FinancialsReceiptConverter.java
src/java/org/mxchange/localization/project_de_DE.properties
src/java/org/mxchange/localization/project_en_US.properties
web/WEB-INF/templates/admin/financial/receipt/admin_form_financial_receipt.tpl
web/WEB-INF/templates/admin/financial/receipt_item/admin_form_financial_receipt_item.tpl
web/WEB-INF/templates/user/financial/receipt/login_form_financial_receipt.tpl

index 7b5505455cd0101a56c3d36f202c66e2423981b1..9d8606af3e2d6c7ccc26daa586a80332dde6a278 100644 (file)
@@ -67,7 +67,7 @@ public class FinancialAdminReceiptWebRequestBean extends BaseFinancialsBean impl
        /**
         * Bar-code number
         */
-       private Long receiptBarCodeNumber;
+       private String receiptBarCodeNumber;
 
        /**
         * Recipient issuing company (for example where the user went shopping to)
@@ -184,7 +184,7 @@ public class FinancialAdminReceiptWebRequestBean extends BaseFinancialsBean impl
         * <p>
         * @return Receipt's bar-code number
         */
-       public Long getReceiptBarCodeNumber () {
+       public String getReceiptBarCodeNumber () {
                return this.receiptBarCodeNumber;
        }
 
@@ -193,7 +193,7 @@ public class FinancialAdminReceiptWebRequestBean extends BaseFinancialsBean impl
         * <p>
         * @param receiptBarCodeNumber Receipt's bar-code number
         */
-       public void setReceiptBarCodeNumber (final Long receiptBarCodeNumber) {
+       public void setReceiptBarCodeNumber (final String receiptBarCodeNumber) {
                this.receiptBarCodeNumber = receiptBarCodeNumber;
        }
 
index 1ee5fbda4714049770ba1d3b7850a79340f413bb..16b180a9017f7e33dd243f18a65248a76375aa21 100644 (file)
@@ -82,7 +82,7 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsBean implemen
        /**
         * Bar-code number
         */
-       private Long receiptBarCodeNumber;
+       private String receiptBarCodeNumber;
 
        /**
         * EJB for general financial receipt purposes
@@ -329,7 +329,7 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsBean implemen
         * <p>
         * @return Receipt's bar-code number
         */
-       public Long getReceiptBarCodeNumber () {
+       public String getReceiptBarCodeNumber () {
                return this.receiptBarCodeNumber;
        }
 
@@ -338,7 +338,7 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsBean implemen
         * <p>
         * @param receiptBarCodeNumber Receipt's bar-code number
         */
-       public void setReceiptBarCodeNumber (final Long receiptBarCodeNumber) {
+       public void setReceiptBarCodeNumber (final String receiptBarCodeNumber) {
                this.receiptBarCodeNumber = receiptBarCodeNumber;
        }
 
index 34329211c8cb9cbc08197dc355f3afa27e81a77c..298e7b1250f2ce73ed3846fa75d3a0084bf4cd20 100644 (file)
@@ -24,6 +24,7 @@ import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 import org.mxchange.jfinancials.events.receipt_item.added.ObservableReceiptItemAddedEvent;
 import org.mxchange.jfinancials.events.receipt_item.added.ReceiptItemAddedEvent;
@@ -61,6 +62,11 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
        @EJB (lookup = "java:global/jfinancials-ejb/adminFinancialReceiptItem!org.mxchange.jfinancials.model.receipt_item.FinancialAdminReceiptItemSessionBeanRemote")
        private FinancialAdminReceiptItemSessionBeanRemote adminReceiptItemBean;
 
+       /**
+        * Item brand name
+        */
+       private String itemBrandName;
+
        /**
         * Fixed discount on product price (if any)
         */
@@ -97,6 +103,11 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
         */
        private Float productGrossPrice;
 
+       /**
+        * Item manufacturer/producer
+        */
+       private BasicData itemManufacturer;
+
        /**
         * Product's net price
         */
@@ -162,6 +173,24 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
                return "add_receipt_item?faces-redirect=true"; //NOI18N
        }
 
+       /**
+        * Getter for item brand name
+        * <p>
+        * @return Item brand name
+        */
+       public String getItemBrandName () {
+               return this.itemBrandName;
+       }
+
+       /**
+        * Setter for item brand name
+        * <p>
+        * @param itemBrandName Item brand name
+        */
+       public void setItemBrandName (final String itemBrandName) {
+               this.itemBrandName = itemBrandName;
+       }
+
        /**
         * Getter for item discount (fixed)
         * <p>
@@ -198,6 +227,24 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
                this.itemDiscountPercent = itemDiscountPercent;
        }
 
+       /**
+        * Getter for item manufacturer/producer
+        * <p>
+        * @return Item manufacturer/producer
+        */
+       public BasicData getItemManufacturer () {
+               return this.itemManufacturer;
+       }
+
+       /**
+        * Setter for item manufacturer/producer
+        * <p>
+        * @param itemManufacturer Item manufacturer/producer
+        */
+       public void setItemManufacturer (final BasicData itemManufacturer) {
+               this.itemManufacturer = itemManufacturer;
+       }
+
        /**
         * Getter for assigned product
         * <p>
@@ -329,8 +376,10 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
         */
        private void clear () {
                // Clear all fields
+               this.setItemBrandName(null);
                this.setItemDiscountFixed(null);
                this.setItemDiscountPercent(null);
+               this.setItemManufacturer(null);
                this.setItemProduct(null);
                this.setItemQuantity(null);
                this.setItemReceipt(null);
@@ -346,8 +395,10 @@ public class FinancialAdminReceiptItemWebRequestBean extends BaseFinancialsBean
                final BillableReceiptItem receiptItem = new FinancialReceiptItem(this.getItemProduct(), this.getItemQuantity(), this.getItemReceipt());
 
                // Set optional data
+               receiptItem.setItemBrandName(this.getItemBrandName());
                receiptItem.setItemDiscountFixed(this.getItemDiscountFixed());
                receiptItem.setItemDiscountPercent(this.getItemDiscountPercent());
+               receiptItem.setItemManufacturer(this.getItemManufacturer());
 
                // Return prepared instance
                return receiptItem;
index 5881e619086b8af83f394d917112ed225f3855c5..33d444d5a97e7d59e716c63a525c3fe5e1719c59 100644 (file)
@@ -43,7 +43,7 @@ public class FinancialsReceiptConverter implements Converter<BillableReceipt> {
        @Override
        public BillableReceipt getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (RECEIPT_CONTROLLER == null) {
+               if (null == RECEIPT_CONTROLLER) {
                        // Get bean from CDI directly
                        RECEIPT_CONTROLLER = CDI.current().select(FinancialsReceiptWebRequestBean.class).get();
                }
index c9baf0b3fcd5291ac17bc90e939a348ce0fc1ebf..21991c37e17603ccb6b07694381794b980e24ad6 100644 (file)
@@ -153,6 +153,8 @@ ADMIN_ENABLE_PRODUCT_AVAILABILITY_TITLE=Waehlen Sie aus, ob das Produkt verfuegb
 #@TODO Please fix German umlauts!
 ADMIN_ENTER_PRODUCT_CURRENCY_CODE=Waehrungscode eingeben:
 #@TODO Please fix German umlauts!
+ADMIN_ENTER_PRODUCT_CURRENCY_CODE_TITLE=Geben Sie den Waehrungscode fuer das Produkt ein. Beispiele: EUR, USD, PHP
+#@TODO Please fix German umlauts!
 ADMIN_ENTER_PRODUCT_UNIT_AMOUNT=Produktstueckzahl eingeben:
 ADMIN_ENTER_PRODUCT_UNIT_AMOUNT_TITLE=Geben Sie hier die Stueckzahl des Produktes ein. Zum Beispiel 500 fuer 500 Gramm. Unter Stueckzahleinheit geben Sie dann einfach nur "g" ein.
 #@TODO Please fix German umlauts!
@@ -189,3 +191,19 @@ ADMIN_ENABLE_CATEGORY_IN_STATISTICS=Soll die Kategorie in Statistiken auftauchen
 ADMIN_ENABLE_CATEGORY_IN_STATISTICS_TITLE=Waehlen Sie aus, ob diese Kategorie in Statistiken aufytauchen soll.
 ADMIN_ENABLE_CATEGORY_IN_STATISTICS_REQUIRED=Bitte waehlen Sie aus, ob diese Kategorie in Statistiken auftauchen soll.
 ENTER_RECEIPT_SEQUENCE_NUMBER=Sequenznummer eingeben:
+#@TODO Please fix German umlauts!
+ADMIN_ENTERED_CATEGORY_I18N_KEY_ALREADY_ADDED=Der von Ihnen eingegebene Uebersetzungsschluessel fuer die Kategorie ist bereits vorhanden. Bitte gebene Sie einen anderen an.
+#@TODO Please fix German umlauts!
+ADMIN_ENTERED_PRODUCT_I18N_KEY_ALREADY_ADDED=Der von Ihnen eingegebene Uebersetzungsschluessel fuer das Produkt ist bereits vorhanden. Bitte gebene Sie einen anderen an.
+#@TODO Please fix German umlauts!
+ADMIN_ENTER_PRODUCT_UNIT_TYPE=Einheit fuer Stueckzahl eingeben:
+#@TODO Please fix German umlauts!
+ADMIN_ENTER_PRODUCT_UNIT_TYPE_TITLE=Geben Sie hier die Einheit fuer die Produktstueckzahl ein, wie z.B. "l" fuer Liter oder "kg" fuer Kilogramm.
+ADMIN_ASSIGN_PRODUCT_MANUFACTURER=Produktehersteller dem Produkt zuweisen:
+#@TODO Please fix German umlauts!
+ADMIN_ASSIGN_PRODUCT_MANUFACTURER_TITLE=Zweisen Sie hier ein Hersteller dem Produkt zu. Supermaerke verkaufen oefters nur die Produkte, die ein anderes Unternehmen hergestellt hat.
+#@TODO Please fix German umlauts!
+SELECT_RECEIPT_ITEM_MANUFACTURER=Hersteller zum Kassenboneintrah auswaehlen:
+ADMIN_HEADER_RECEIPT_ITEM_MANUFACTURER_NAME=Hersteller des Boneintrages:
+ENTER_RECEIPT_ITEM_BRAND_NAME=Warenzeichen/Marke eingeben:
+ENTER_RECEIPT_ITEM_BRAND_NAME_TITLE=Geben Sie das Warenzeichen ein, dass Sie auf dem Kassenbon finden.
index 001d3195a1e7dc224253cd493ee39fcba8736837..4c2021edd22f0caf1d71215c2bb0ab85d21aec10 100644 (file)
@@ -114,8 +114,8 @@ ADMIN_ASSIGN_PRODUCT_CATEGORY_TITLE=Choose the product category for the to be ad
 ADMIN_ENTER_PRODUCT_I18N_KEY_TITLE=Enter product's i18n key. This must be unique.
 ADMIN_ENABLE_PRODUCT_AVAILABILITY_TITLE=Choose if the product is available/active.
 ADMIN_ENTER_PRODUCT_CURRENCY_CODE=Enter currency code:
+ADMIN_ENTER_PRODUCT_CURRENCY_CODE=Enter currency code:
 ADMIN_ENTER_PRODUCT_UNIT_AMOUNT=Enter product's unit amount:
-#Geben Sie hier die Stueckzahl des Produktes ein. Zum Beispiel 500 fuer 500 Gramm. Unter Stueckzahleinheit geben Sie dann einfach nur "g" ein.
 ADMIN_ENTER_PRODUCT_UNIT_AMOUNT_TITLE=Enter the product's unit amount. For example 500 for 500 grams. Under unit type, then just enter "g".
 BUTTON_ADMIN_ADD_GENERIC_PRODUCT=Add product
 ADMIN_PRODUCT_CATEGORY_REQUIRED=Please choose a product category.
@@ -141,3 +141,14 @@ ADMIN_ENABLE_CATEGORY_IN_STATISTICS=Enable whether category is in statistics:
 ADMIN_ENABLE_CATEGORY_IN_STATISTICS_TITLE=Choose if this category is enlisted in any kind of statistics.
 ADMIN_ENABLE_CATEGORY_IN_STATISTICS_REQUIRED=Please choose if this category should be shown in any statistics.
 ENTER_RECEIPT_SEQUENCE_NUMBER=Enter sequence number:
+ADMIN_ENTERED_CATEGORY_I18N_KEY_ALREADY_ADDED=Your entered category i18n key is already added. Please enter an other one.
+ADMIN_ENTERED_PRODUCT_I18N_KEY_ALREADY_ADDED=Your entered product i18n key is already added. Please enter an other one.
+ADMIN_ENTER_PRODUCT_UNIT_TYPE=Enter product's unit type:
+ADMIN_ENTER_PRODUCT_UNIT_TYPE_TITLE=Enter the product's unit type, like "l" for liter or "kg" for kilo grams.
+ADMIN_ASSIGN_PRODUCT_MANUFACTURER=Assign product's manufacturing/producing company:
+ADMIN_ASSIGN_PRODUCT_MANUFACTURER_TITLE=Assign a manufacturing/producing company to this product. Supermarkets are often only selling products other companies have produced.
+SELECT_RECEIPT_ITEM_MANUFACTURER=Choose manufacturer for receipt item:
+ADMIN_HEADER_RECEIPT_ITEM_MANUFACTURER_NAME=Manufacturer of product item:
+ADMIN_ENTER_PRODUCT_CURRENCY_CODE_TITLE=Enter the currency code for product. Examples: EUR, USD, PHP
+ENTER_RECEIPT_ITEM_BRAND_NAME=Enter item's brand name:
+ENTER_RECEIPT_ITEM_BRAND_NAME_TITLE=Enter the item's brand name found on receipt.
index 72ac9d9cdcb0f9bd27cf3929f47a6ae2d6ed1b83..77406c496d09e8c9ab085384cc9e232e6c566693 100644 (file)
                                value="#{adminReceiptController.receiptIssued}"
                                required="true"
                                requiredMessage="#{project.ADMIN_RECEIPT_ISSUE_DATE_REQUIRED}"
-                               pattern="#{msg.DATE_PATTERN}"
+                               pattern="#{msg.DATE_TIME_PATTERN}"
+                               showButtonPanel="true"
+                               showOtherMonths="true"
+                               showSecond="false"
                                navigator="true"
                                maskAutoClear="true"
                                title="#{project.ADMIN_RECEIPT_DATE_OF_ISSUE_TITLE}"
@@ -47,7 +50,7 @@
                                >
                                <f:converter converterId="PaymentTypeConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-                               <f:selectItems value="#{dataController.paymentTypes}" var="receiptPaymentType" itemValue="#{paymentType}" itemLabel="#{msg[paymentType.i18nKey]}" />
+                               <f:selectItems value="#{dataController.paymentTypes}" var="paymentType" itemValue="#{paymentType}" itemLabel="#{msg[paymentType.i18nKey]}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="receiptSellerEmployee" value="#{msg.ADMIN_SELECT_SELLER_EMPLOYEE}" />
                        </p:inputText>
 
                        <p:outputLabel for="receiptBarCodeNumber" value="#{project.ENTER_RECEIPT_BARCODE_NUMBER}" />
-                       <p:inputText id="receiptBarCodeNumber" size="24" maxlength="24" value="#{adminReceiptController.receiptBarCodeNumber}" />
+                       <p:inputText id="receiptBarCodeNumber" size="20" maxlength="255" value="#{adminReceiptController.receiptBarCodeNumber}" />
 
                        <p:outputLabel for="receiptSequenceNumber" value="#{project.ENTER_RECEIPT_SEQUENCE_NUMBER}" />
-                       <p:inputText id="receiptSequenceNumber" size="24" maxlength="24" value="#{adminReceiptController.receiptSequenceNumber}" />
+                       <p:inputText id="receiptSequenceNumber" size="10" maxlength="20" value="#{adminReceiptController.receiptSequenceNumber}" />
                </p:panelGrid>
        </p:fieldset>
 </ui:composition>
index 5fdc4297f199b43476dd9cb5de8987ebe03f4bcf..c086dca62cac0f60df793899db94954777496adb 100644 (file)
 
        <p:fieldset legend="#{project.ADMIN_RECEIPT_ITEM_LEGEND}">
                <p:panelGrid layout="grid" columns="2" columnClasses="ui-grid-col-4,ui-grid-col-8" styleClass="table table-full ui-noborder">
+                       <p:outputLabel for="itemBrandName" value="#{project.ENTER_RECEIPT_ITEM_BRAND_NAME}" />
+                       <p:inputNumber
+                               id="itemBrandName"
+                               value="#{adminReceiptItemController.itemBrandName}"
+                               title="#{project.ENTER_RECEIPT_ITEM_BRAND_NAME_TITLE}"
+                               />
+
                        <p:outputLabel for="itemProduct" value="#{project.SELECT_RECEIPT_ITEM_PRODUCT}" />
                        <p:selectOneMenu
                                id="itemProduct"
                                <f:selectItems value="#{productController.allProducts()}" var="product" itemValue="#{product}" itemLabel="#{beanHelper.renderGenericProduct(product)}" />
                        </p:selectOneMenu>
 
+                       <p:outputLabel for="itemManufacturer" value="#{project.SELECT_RECEIPT_ITEM_MANUFACTURER}" />
+                       <p:selectOneMenu
+                               id="itemManufacturer"
+                               value="#{adminReceiptItemController.itemManufacturer}"
+                               filter="true"
+                               filterMatchMode="contains"
+                               >
+                               <f:converter converterId="BasicCompanyDataConverter" />
+                               <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
+                               <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                       </p:selectOneMenu>
+
                        <p:outputLabel for="itemQuantity" value="#{project.ENTER_RECEIPT_ITEM_QUANTITY}" />
                        <p:inputNumber
                                id="itemQuantity"
index 850312b28747b06012e30633aadd14aa04e081fd..a4f5b3af9f2aecc421d1425f343f6139b42a4aab 100644 (file)
@@ -65,7 +65,7 @@
                                >
                                <f:converter converterId="EmployeeConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                               <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                               <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadquarter" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
                        </p:selectOneMenu>
                        <p:message for="receiptSellerEmployee" />
                </p:panelGrid>