Task #19826
Updated by Redmine Admin 4 months ago
~~Enable automatic population of **Sales Charges** in File Reference (House BL level) using Charges Template.~~
#### **~~Functional Requirements~~**
1. ~~Upon selecting the **Shipment Reference** from the File Reference screen:~~
* ~~When user adds House BL information, the Sales Charges section should be prepopulated using the **Sales Amount** from the Charges Template.~~
* ~~The matching criteria should be the same as the Shipment Cost template logic.~~
2. ~~User must still be able to:~~
* ~~Update prepopulated sales charges~~
* ~~Delete sales charges~~
* ~~Add additional sales charges manually~~
#### **~~Acceptance Criteria~~**
* ~~Sales Charges are auto-populated correctly~~
* ~~Matching logic works same as Shipment Cost~~
* ~~Only Sales Amount is used~~
* ~~Prepopulated values are editable~~
* ~~User can delete any charge~~
* ~~User can add additional charges~~
* ~~No restriction from template logic~~
##### ~~Scenario 1 – File Reference Pulls Sales Charges~~
**~~Given~~**\~\~ **~~Given~~**~~ File Reference is linked to a Shipment Reference\
**When** user adds House BL information\
**Then** Sales Charges are prepopulated using Sales Amount from the template.\~\~ template.~~
##### ~~Scenario 2 – Sales Charges Remain Editable~~
**~~Given~~**\~\~ **~~Given~~**~~ sales charges are prepopulated\
**When** user updates, deletes, or adds charges\
**Then** system allows the changes successfully.\~\~ successfully.~~
#### **~~Technical Notes~~**
* ~~Reuse existing template matching logic~~
* ~~Fetch `SalesAmount` instead of `CostAmount`~~
The existing requirement was to automatically populate **Sales Charges** in the File Reference / House BL level using the **Charges Template** when the Shipment Reference is selected.
After discussion with the development team, the approach has been revised.
Instead of auto-populating the Sales Charges immediately, the system will provide a new button above the **Sales Charges grid**. The user can click this button to fetch sales charges from the Charges Template when required.
## Requirement
Add a new button above the **Sales Charges grid**:
**Refresh Charges from Template**
When the user clicks this button, the system should fetch matching sales charges from the Charges Template and populate them in the Sales Charges grid.
## Functional Requirements
### 1. Add New Button
Add a new button above the Sales Charges grid:
**Refresh Charges from Template**
Suggested placement:
* Above the Sales Charges grid
* Button should be clearly visible to the user
### 2. Fetch Sales Charges from Charges Template
When the user clicks **Refresh Charges from Template**, the system should retrieve charges from the Charges Template based on the same matching criteria used in Shipment Cost.
Matching criteria should include, where applicable:
* Cargo Type
* Shipping Line
* Container Type
* Type of Shipment
* Effective Date Range
* Status = Active
When user clicks **Refresh Charges from Template**:
* System fetches matching Sales Charges from the Charges Template.
* System appends the fetched charges to the existing Sales Charges grid.
* Existing charges remain unchanged.
* Duplicate charges are allowed.
* User can manually delete unwanted charges.
### 3. Use Sales Amount Only
The system must fetch only the **Sales Amount** from the Charges Template.
The **Cost Amount** must not be used in the Sales Charges grid.
### 4. Populate Sales Charges Grid
After fetching the matching template charges, the system should populate the Sales Charges grid with the retrieved sales charges.
The following details should be populated where available:
* Charge Code
* Charge Description
* Freight Type
* Currency
* Sales Amount
* VAT Type
* VAT Amount
* Total
* Unit of Measure
* Any other standard fields already used in the Sales Charges grid
### 5. User Control After Fetching
After the charges are fetched and displayed, the user must still be able to:
* Update prepopulated sales charges
* Delete prepopulated sales charges
* Add additional sales charges manually
There should be no restriction preventing the user from changing the fetched values.
### 6. **Duplicate Handling / Append Behaviour**
As discussed with the development team, the system will continue to **auto-populate the Sales Charges grid with the same charges retrieved for Shipment Cost**, based on the existing shipment cost template logic.
In addition, when the user clicks **Refresh Charges from Template**, the system will **append** the matching Sales Charges from the Charges Template to the existing Sales Charges grid.
If the same charge already exists in the Sales Charges grid:
* The system should still append the charge again.
* The system should not block duplicate charges.
* The system should not overwrite existing charges.
* The user will manually delete any charge lines that are not required.
This approach gives the user full control over the final Sales Charges list.
## Acceptance Criteria
### 1 – Button Display
**Given** user is in the File Reference / House BL Sales Charges section\
**Then** the system displays a button named **Refresh Charges from Template** above the Sales Charges grid.
---
### 2 – Fetch Matching Template Charges
**Given** a valid Shipment Reference / File Reference exists\
**And** matching active Charges Template records exist\
**When** user clicks **Refresh Charges from Template**\
**Then** the system retrieves matching sales charges based on the same criteria as Shipment Cost.
---
### 3 – Sales Amount Only
**Given** Charges Template contains both Cost Amount and Sales Amount\
**When** sales charges are fetched\
**Then** only the **Sales Amount** is used to populate the Sales Charges grid.
---
### 4 – Cost Amount Not Used
**Given** a template charge has only Cost Amount and no Sales Amount\
**When** user clicks **Refresh Charges from Template**\
**Then** that charge should not be inserted into the Sales Charges grid.
---
### 5 – Sales-Only Charges
**Given** a template charge has Sales Amount and no Cost Amount\
**When** user clicks **Refresh Charges from Template**\
**Then** the charge should be inserted into the Sales Charges grid.
---
### 6 – Editable Sales Charges
**Given** charges are fetched from the template\
**When** user edits a fetched charge\
**Then** the system allows the update.
---
### 7 – Delete Sales Charges
**Given** charges are fetched from the template\
**When** user deletes a fetched charge\
**Then** the system allows the deletion.
---
### 8 – Add Manual Charges
**Given** charges are fetched from the template\
**When** user adds an additional sales charge manually\
**Then** the system allows the new charge to be added.
---
### **9 9 – Append Duplicate Charges Even If Same Charge Exists**
**Given** the Sales Charges grid already contains one or more charges\
**When** user clicks **Refresh Charges from Template**\
**Then** the system appends the matching charges from the Charges Template to the existing list. ---
### **10 10 – Duplicate Charges Allowed** No Auto-Population
**Given** user selects a charge already exists in the Shipment Reference or adds House BL information\
**Then** Sales Charges grid\
**When** the same charge is fetched again from the Charges Template\
**Then** the system should still add not be automatically populated unless the charge as a new line.
### **11 – Existing Charges Not Overwritten**
**Given** the Sales Charges grid contains existing charges\
**When** user clicks **Refresh Charges from Template**\
**Then** the existing charges should remain unchanged. Template**.
### **12 – User Can Manually Remove Unwanted Charges**
**Given** duplicate or unwanted charges exist in the Sales Charges grid\
**When** user deletes selected charge lines manually\
**Then** the system removes only the selected charge lines. ---
## Validation / Warning Messages
### No Matching Template Found
If no matching template charges are found, display:
**“No matching sales charges found in Charges Template.”**
---
### Refresh Confirmation
Before refreshing charges, display:
**“This action will fetch sales charges from the Charges Template. Do you want to continue?”**
---
### Duplicate Handling Message
If matching charges already exist, display either:
**“Some charges already exist and will be duplicated. Do you want to continue?”**