Task #18325
Updated by Redmine Admin 6 months ago
When saving an invoice, the user should be able to select in which currency he/she wants to issue the invoice in foreign currency, view or adjust the applicable exchange rate, and choose the appropriate bank account linked to that currency before the invoice is finalised and the PDF is generated. **Acceptance Criteria:** 1. **Trigger on Save Invoice:** * When the user clicks the "Save" button on **any for any type of invoice type screen (Draft, Proforma, (draft, proforma or Standard)**, Standard) in the invoice screen, a modal dialog (popup) **MUST** appear. popup appears. 2. **Popup Fields:** 1. * **Currency Selection Dropdown:** * **Data Source:** Populated with values Pulls data from the "Additional “Additional Currencies for Invoices" Invoices” configuration list. list * **Behavior:** This field **MUST** be mandatory. **The invoice currency defaults to the default currency currency if not changed by the user.** Mandatory field. 2. * **Bank Account Dropdown:** * **Default Selection Logic:** * Upon selection of Auto-selects a currency from the "Currency Selection Dropdown," the system **MUST attempt to auto-select a default bank account** if one is explicitly configured and linked to account based on the selected currency. currency (if available in the system). * **User Override:** The user **MUST be able to override** Users may override the auto-selected default bank account by choosing another available bank from the dropdown. selection. * **No Linked Bank Scenario:** * If **no no bank account is explicitly linked** to exists for the selected currency in currency, the system, the dropdown user should display **all available either select one bank accounts**. * **The system should prompt from the user with a warning message:** "No specific bank account found for this currency. Please select an appropriate bank account." list or the default bank. 3. **Exchange * **FC Rate (FC Rate) Field:** * **Default Rate Population Logic:** * **Scenario 1: Charges in If the MBL/HBL/Clearing has the selected foreign currency exist (e.g., USD charges on HBL/MBL/Clearing, invoicing in USD).** * The field **MUST auto-populate with any of its charges, the _specific user should then take the saved exchange rate_** from rate, or else the relevant MBL/HBL/Clearing charges current exchange rate that are is recorded in the selected foreign currency. system. * _Example 1:_\* If Example 1: User is creating an invoice for HBL001 which has 3 charges, 2 in USD charges and 1 MUR charge, and in MUR. Now, the user selects USD for wants to generate the invoice, whole invoice in the currency USD. The system **MUST retrieve and display should take the pre-existing exchange rate from that is<span dir=""> </span>already in the USD charges on HBL001.** HBL charges. * **Scenario Example 2: No charges exist in the selected foreign currency (e.g., all charges in MUR, invoicing in USD).** * The field **MUST auto-populate with the _system's current default exchange rate_** user is creating an invoice for the selected foreign currency. * _Example 2:_\* If HBL001 that has 3 MUR charges, and all in MUR. Now, the user selects USD for wants to generate the invoice, the whole invoice in currency USD. The system **MUST retrieve and display should utilise the most current currently recorded exchange rate between MUR and USD from rate. * If the system's global exchange rate configuration.** * **Scenario 3: Invoice invoice is generated in Default System Currency (MUR).** * The FC Rate field **MUST display "1" (and be read-only/non-editable)**. * **User Editability:** The user **MUST be able to manually edit the populated default currency, MUR, the exchange rate** rate will display “1” in the FC Rate field, unless the invoice is in the default currency. textbox. * **Impact on Charges:** All invoice charges, regardless of their original currency, **MUST The charges should then be recalculated and displayed calculated based on the final exchange rate** entered or selected in this field. rate. * The user may edit the rate if needed. **Validation Rules (during popup interaction and on final save):** 3. **Validation:** * **Currency Not Selected:** If the "Currency Selection Dropdown" a currency is empty or not selected, a **mandatory validation error message MUST be displayed**, preventing further action until a currency the user is chosen. prompted to do so. * **Bank Account Not Available/Selected:** If no bank is available for the "Bank Account Dropdown" is empty or not selected (and currency, then the system didn't auto-select one default bank should be selected or the user hasn't chosen), should be given a **mandatory validation error warning message MUST be displayed**, preventing further action until a that no bank account is chosen. associated with this currency in the system. * **Exchange Rate Empty/Invalid:** If no rate is available and the "Exchange Rate (FC Rate) Field" field is empty (and not auto-populated) or contains an invalid value, empty, a **mandatory validation error warning message MUST be displayed**, prompting prompts the user to enter a valid rate. it. 4. **Invoice PDF Output:** * The final generated PDF invoice **MUST should clearly and prominently display**: reflect: * The **selected Selected Foreign Currency (e.g., "USD")**. * The **applicable Applicable FC Rate used for calculation**. * The **Bank Details** corresponding to the chosen bank account (Account Name, Account Number, SWIFT/BIC, Bank Name, Bank Address). Details 5. **Audit Trail:** * The system **MUST capture Capture and store the following details** as part of selected currency, bank, and FC rate in the finalized invoice record for auditing and reporting purposes: * Selected Foreign Currency * Selected Bank Account ID/Name * Applicable FC Rate used for calculations reporting.