| | 1 | == Employee transfers tab == |
| | 2 | === Актери === |
| | 3 | * Employee |
| | 4 | === Scenario steps === |
| | 5 | 1. Employee selects a tab order |
| | 6 | 2. Employee chooses another front staff to transfer the tab to |
| | 7 | 3. Employee transfers tab to selected employee |
| | 8 | |
| | 9 | === SQL Queries === |
| | 10 | |
| | 11 | {{{ |
| | 12 | SELECT o.id AS order_id, t.table_number |
| | 13 | FROM tab_orders t |
| | 14 | JOIN orders o ON t.order_id = o.id |
| | 15 | WHERE t.frontstaff_id = 3 -- Current Employee ID |
| | 16 | }}} |
| | 17 | {{{ |
| | 18 | SELECT fs.employee_id |
| | 19 | FROM front_staff fs |
| | 20 | JOIN assignments a ON fs.employee_id = a.employee_id |
| | 21 | JOIN shifts s ON a.shift_id = s.shift_id |
| | 22 | WHERE a.clock_in_time IS NOT NULL |
| | 23 | AND a.clock_out_time IS NULL |
| | 24 | AND s.date = CURRENT_DATE |
| | 25 | AND fs.employee_id != 3 |
| | 26 | LIMIT 1; |
| | 27 | }}} |
| | 28 | {{{ |
| | 29 | UPDATE tab_orders |
| | 30 | SET frontstaff_id = 5 |
| | 31 | WHERE order_id = 12 |
| | 32 | AND frontstaff_id = 3; |
| | 33 | }}} |