== EMPLOYEE MANAGES ORDER == === Actors === * Employee === Steps in the Scenario === **__1. Employee opens tab.__** {{{ SELECT p.name, p.price, oi.quantity FROM order_items oi JOIN products p ON p.id = oi.product_id WHERE oi.order_id = 1 }}} **__2. Employee adds order items.__** {{{ INSERT INTO order_items(id, order_id, product_id, is_processed, quantity) VALUES (7,1,1,false,1); INSERT INTO order_items(id ,order_id, product_id, is_processed, quantity) VALUES (8,1,2,false,1); }}} **__3. Employee marks order items as processed.__** {{{ UPDATE order_items SET is_processed=true WHERE id=7; UPDATE order_items SET is_processed=true WHERE id=8; }}} **__4. Employee closes tab.__** **__5. System prints bil.__** {{{ UPDATE orders SET status='CONFIRMED' WHERE id=1 }}} **__6. Employee finalizes payment.__** {{{ INSERT INTO payments(id, order_id, amount, payment_type, tip_amount) SELECT 3,1, SUM(oi.price), ‘cash’, 0 FROM order_items oi WHERE oi.order_id = 1 }}}