Changes between Version 3 and Version 4 of UseCaseModel/ShipmentDetails


Ignore:
Timestamp:
12/25/24 22:53:27 (3 weeks ago)
Author:
153093
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCaseModel/ShipmentDetails

    v3 v4  
    1111        * Актерот навигира на **Достави** копчето од менито при што се прикажува табела со сите идни и минати достави.
    1212[[Image(step1.png)]]
     13        * Овој дел е опфатен во предходното сценарио за додавање на Достава.
    1314
    1415     ==== Чекор 2.
    1516        * На посакуваниот ред од табелата клика **Детали**
    16 
     17[[Image(step2.png)]]
     18        * Тука иницијално се вчитуваат основните податоци за доставата и податоците за цена.
     19{{{
     20SELECT
     21    s.shipment_id,
     22    p.payment_status,
     23    CONCAT(e.employee_name, ' ', e.employee_surname) AS employee_full_name,
     24    CONCAT(v.make, ' ', v.model, ' (', v.registration, ')') AS vehicle_info,
     25    s.shipment_date,
     26    Count(distinct sl.customer_id) as no_of_customers,
     27    SUM(sl.wine_quantity) as wine_quantity_shipped,
     28    SUM(sl.wine_base_price * sl.wine_quantity) AS shipment_base_price,
     29    SUM(sl.wine_agreed_price * sl.wine_quantity) AS shipment_agreed_price,
     30    COALESCE(ex.shipment_expenses, 0) as shipment_expenses,
     31    (SUM(sl.wine_agreed_price * sl.wine_quantity) - SUM(sl.wine_base_price * sl.wine_quantity) - COALESCE(ex.shipment_expenses, 0)) as shipment_profit
     32FROM shipment s
     33JOIN payment p ON s.payment_id = p.payment_id
     34JOIN employee e ON s.employee_id = e.employee_id
     35JOIN vehicle v ON s.vehicle_id = v.vehicle_id
     36JOIN shipment_load sl ON s.shipment_id = sl.shipment_id
     37JOIN ( SELECT shipment_id, SUM(amount) AS shipment_expenses FROM shipment_has_expense_of_expense_type GROUP BY shipment_id ) ex ON s.shipment_id = ex.shipment_id
     38WHERE s.shipment_id = 5
     39GROUP BY
     40    s.shipment_id,
     41    p.payment_status,
     42    e.employee_name,
     43    e.employee_surname,
     44    v.make,
     45    v.model,
     46    v.registration,
     47    s.shipment_date,
     48    ex.shipment_expenses;
     49}}}