Projects:Split line in WebPOS/Functional Specifications
Split line in WebPOS - Functional Specifications
The aim of the project is to provide a way to split a ticket line in two or more lines in the WebPOS.
When a ticket line is selected on EDIT panel show a button to allow split selected line on two or more lines.
- Lines with one unit cannot be split
- It's not possible to split lines in multi selection mode
- If a line has associated services, it cannot be split
- If the line has associated complementary products, it cannot be split
- In the split lines window, Number of Lines must have a minimum value of 2 and every Line Quantity must have a minimum value of 1
- In order to split a line, Original Quantity must be equal to Split Quantity, that is to say Difference is zero.
In Web POS allow to select a ticket line that has more than one unit and divide it into two or more lines with smaller amounts.
1. In the EDIT panel add a button Split that will visible when the selected line has more than one unit and not is in multi selection mode
2. When button Split is clicked a popup is shown.
- At the top of a warning message indicating that this action can not be reversed once it is applied.
- Next show a row, with follow information:
- Original Quantity: Quantity of selected line for split
- Split Quantity: Quantity assigned to split lines
- Difference: Difference between Original Quantity and Split Quantity
- Number of Lines: Editable value to set a number of split lines
Initially it makes an initial proposal to split the line into two lines
When Number of Lines is changed, follow behavior are possible:
1. Line quantities are edited or some line is removed: Lines are append/removed, if added only one line it quantity calculate to fix Difference of zero, it not possible is set to one.
2. While not line quantities are edited or some line is removed, automatically at the bottom panel of a proposal for split lines it is made. For example if change to 4, follow proposal is shown, 4 lines of 2 units each.
This project is implemented in Web POS core modules:
Changes on org.openbravo.mobile.core
A new component OB.UI.EditNumber is added to file: source/component/ob-commonbuttons.js.
- value: Initial value, set default to zero
- min: Minimum value, if enter a value less than min value is reset to min
- max: Maximum value, if enter a value great than max value is reset to max
- numberId: Set identifier for a component, this value is send on events
- onNumberChange: This event is triggered when a value of component is changed. Follow parameters are send:
- numberId: Component identifier (numberId property)
- value: Value of number
Changes on org.openbravo.retail.posterminal
- web/org.openbravo.retail.posterminal/js/model/order.js: Modify a private function addProductToOrder on _addProduct method of Order model, to allow grouped product split in several lines. Every line when split is marked with property splitline.
- web/org.openbravo.retail.posterminal/js/pointofsale/view/editline.js: Add a button Split to toolbar and modify function selectedListener to implement show/hide logic. See next section: Hooks
- web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js: Add a modal dialog: OB.UI.ModalSplitLine
- web/org.openbravo.retail.posterminal/js/components/modalsplitlines.js: A modal dialog to implement split line logic.
To implement the show/hide logic for button Split is possible for other modules implement a hook: OBPOS_CheckSplitLine to indicate if Split button is visible or not.
- Arguments: A hook is called with follow arguments:
- receipt: Current order
- orderline: Line to be split
- Result: If cancelOperation is set to true then button Split is hide.