Task #19828
Updated by Redmine Admin 4 months ago
Modify the existing **Shipment Charges Template** screen so that users can define both:
* **Cost Amount**
* **Sales Amount**
The template should continue to work based on the existing criteria:
* Cargo Type
* Shipment Line
* Container Type
* Type of Shipment
* Effective Date Range
* Status
### **Functional Requirements**
**Update Charges Template Popup**
1. Rename:
* **Amount → Cost Amount**
2. Add new field:
* **Sales Amount** (Textbox & Label)
3. ~~Add checkbox:~~ Add checkbox:
* **~~Apply **Apply Profit Margin~~** Margin**
4. Save **Sales Amount** in the database.
#### ~~Profit Profit Margin Logic~~ Logic
* ~~When When checkbox is checked:~~ checked:
~~Sales Sales Amount = Cost Amount + (Configured Profit Margin %)~~ %)
* ~~Profit Profit margin % is retrieved from **Company Configuration**~~ Configuration**
* ~~Calculated Calculated value is displayed in the Sales Amount textbox.~~ textbox.
* ~~Sales Sales Amount remains editable by the user.~~ user.
~~Example logic:~~ Example logic:
~~Sales Sales Amount = Cost Amount + configured profit margin~~ margin
#### Unit of Measure
The **Unit of Measure** logic should remain the same for both cost and sales charges.
### Validation Rules
System must allow:
* Cost only
* Sales only
* Both
:exclamation: Validation:
* At least one of the two must be filled
The system must allow the following cases:
| Cost Amount | Sales Amount | Allowed |
|-------------|--------------|---------|
| Filled | Filled | Yes |
| Filled | Empty | Yes |
| Empty | Filled | Yes |
| Empty | Empty | No, if charge line is being saved |
This is required because some charges may apply only as cost, while others may apply only as sales.
### **Acceptance Criteria**
* User can enter Cost and/or Sales Amount
* ~~Profit Profit margin auto-calculates Sales Amount~~ Amount
* Sales Amount is editable even after calculation
* System saves both values successfully
#### Scenario 1 – Template Supports Cost and Sales
**Given** user opens Charges Template\
**When** adding or updating a charge\
**Then** system displays:
* Cost Amount
* Sales Amount
* ~~Profit Profit Margin checkbox~~ checkbox
#### ~~Scenario Scenario 2 – Profit Margin Calculation~~ Calculation
**~~Given~~**~~ **Given** user enters Cost Amount\
**And** Profit Margin checkbox is checked\
**When** configured profit margin exists\
**Then** Sales Amount is calculated automatically\
**And** Sales Amount remains editable.~~ editable.
#### Scenario 3 – Manual Sales Amount
**Given** user does not tick Profit Margin\
**When** user enters Sales Amount manually\
**Then** system saves the Sales Amount successfully.
#### Scenario 4 – Cost Only Charge
**Given** Cost Amount is filled\
**And** Sales Amount is empty\
**When** user saves the charge\
**Then** system saves the charge successfully.
#### Scenario 5 – Sales Only Charge
**Given** Cost Amount is empty\
**And** Sales Amount is filled\
**When** user saves the charge\
**Then** system saves the charge successfully.
### **Technical Notes**
* Add new DB column: `SalesAmount`
* Ensure backward compatibility for existing templates
* Default existing records → SalesAmount = NULL