github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/design/schemas/air-views.vsql (about) 1 -- Copyright (c) 2020-present unTill Pro, Ltd. 2 3 SCHEMA air; 4 5 IMPORT SCHEMA "github.com/untillpro/airs-bp3/packages/untill" 6 7 WORKSPACE Restaurant ( 8 9 -- dashboard: hourly sales 10 VIEW HourlySalesView( 11 yyyymmdd, 12 hour, 13 total, 14 count 15 ) AS SELECT 16 working_day, 17 EXTRACT(hour from ord_datetime), 18 (select sum(price * quantity) from order_item), 19 (select sum(quantity) from order_item), 20 from untill.orders 21 WITH Comment=PosComment, PrimaryKey='(yyyymmdd, hour), asdas'; 22 23 -- dashboard: daily categories 24 VIEW DailyCategoriesView(yyyymmdd PK, id_category, total) A 25 SELECT 26 working_day as yyyymmdd, 27 id_category, 28 SUM(price * quantity) as total, 29 from untill.orders 30 join order_item on order_item.id_orders = orders.id 31 join articles on id_articles = articles.id 32 join department on id_departments = articles.id_department 33 join food_group on id_food_group = department.id_food_group 34 group by working_day, id_category 35 36 37 VIEW TablesOverview( 38 partitionKey int32, tableNumber int32, tablePart text, wDocID id, 39 PRIMARY KEY((partitionKey), tableno, table_part) 40 ) as select 41 2 as partitionKey, 42 tableno as tableNumber, 43 table_part as tablePart, 44 sys.ID as id 45 from untill.bill 46 47 VIEW TransactionHistory(wDocID id, offs offset, PRIMARY KEY((id), offs)) AS 48 select id, sys.Offset from untill.bill 49 union all select id_bill, sys.Offset from orders 50 union all select id_bill, sys.Offset from pbill ; 51 52 VIEW XZReports( 53 Year int32, 54 Month int32, 55 Day int32, 56 Kind int32, 57 Number int32, 58 XZReportWDocID id, 59 PRIMARY KEY((Year), Month, Day, Kind, Number) 60 ) AS RESULT OF UpdateXZReportsView 61 62 63 64 ) -- WORKSPACE Restaurant