Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros 3700 (Sybase) - SQL Query to record Sales to ERP

Status
Not open for further replies.

dstramilov

Vendor
May 8, 2015
3
0
0
US
Hello,

I need some help to write sql query that will generate Journal Entry by Revenue Centers (locations) that I can post to ERP.

DEBIT:
Cash
Credit Cards(Visa, AX,MC,etc.)
Discounts
Gift cards redeemed
Cash Short/Over
Other...

CREDIT:
Revenue (broken by major group types, like food/beverages/beer/wine etc.)
Tips due
Gift cards sold
Other...

DEBIT=CREDIT


 
I got some queries views done already:

1. ALTER VIEW "Cognos"."Cost_Point_AJE"( /* view_column_name, ... */ )
AS
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_01 "Names", v_R_rvc_trk.trk_cnt_01 "Counts", v_R_rvc_trk.trk_ttl_01 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_08 "Names", v_R_rvc_trk.trk_cnt_08 "Counts", v_R_rvc_trk.trk_ttl_08 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_09 "Names", v_R_rvc_trk.trk_cnt_09 "Counts", v_R_rvc_trk.trk_ttl_09 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_14 "Names", v_R_rvc_trk.trk_cnt_14 "Counts", v_R_rvc_trk.trk_ttl_14 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_15 "Names", v_R_rvc_trk.trk_cnt_15 "Counts", v_R_rvc_trk.trk_ttl_15 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_16 "Names", v_R_rvc_trk.trk_cnt_16 "Counts", v_R_rvc_trk.trk_ttl_16 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_17 "Names", v_R_rvc_trk.trk_cnt_17 "Counts", v_R_rvc_trk.trk_ttl_17 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_18 "Names", v_R_rvc_trk.trk_cnt_18 "Counts", v_R_rvc_trk.trk_ttl_18 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_19 "Names", v_R_rvc_trk.trk_cnt_19 "Counts", v_R_rvc_trk.trk_ttl_19 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_20 "Names", v_R_rvc_trk.trk_cnt_20 "Counts", v_R_rvc_trk.trk_ttl_20 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_21 "Names", v_R_rvc_trk.trk_cnt_21 "Counts", v_R_rvc_trk.trk_ttl_21 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_22 "Names", v_R_rvc_trk.trk_cnt_22 "Counts", v_R_rvc_trk.trk_ttl_22 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_23 "Names", v_R_rvc_trk.trk_cnt_23 "Counts", v_R_rvc_trk.trk_ttl_23 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_24 "Names", v_R_rvc_trk.trk_cnt_24 "Counts", v_R_rvc_trk.trk_ttl_24 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_25 "Names", v_R_rvc_trk.trk_cnt_25 "Counts", v_R_rvc_trk.trk_ttl_25 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_26 "Names", v_R_rvc_trk.trk_cnt_26 "Counts", v_R_rvc_trk.trk_ttl_26 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_27 "Names", v_R_rvc_trk.trk_cnt_27 "Counts", v_R_rvc_trk.trk_ttl_27 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_28 "Names", v_R_rvc_trk.trk_cnt_28 "Counts", v_R_rvc_trk.trk_ttl_28 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_29 "Names", v_R_rvc_trk.trk_cnt_29 "Counts", v_R_rvc_trk.trk_ttl_29 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_30 "Names", v_R_rvc_trk.trk_cnt_30 "Counts", v_R_rvc_trk.trk_ttl_30 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_31 "Names", v_R_rvc_trk.trk_cnt_31 "Counts", v_R_rvc_trk.trk_ttl_31 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_32 "Names", v_R_rvc_trk.trk_cnt_32 "Counts", v_R_rvc_trk.trk_ttl_32 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_33 "Names", v_R_rvc_trk.trk_cnt_33 "Counts", v_R_rvc_trk.trk_ttl_33 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_34 "Names", v_R_rvc_trk.trk_cnt_34 "Counts", v_R_rvc_trk.trk_ttl_34 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_35 "Names", v_R_rvc_trk.trk_cnt_35 "Counts", v_R_rvc_trk.trk_ttl_35 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_36 "Names", v_R_rvc_trk.trk_cnt_36 "Counts", v_R_rvc_trk.trk_ttl_36 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_37 "Names", v_R_rvc_trk.trk_cnt_37 "Counts", v_R_rvc_trk.trk_ttl_37 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_38 "Names", v_R_rvc_trk.trk_cnt_38 "Counts", v_R_rvc_trk.trk_ttl_38 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_39 "Names", v_R_rvc_trk.trk_cnt_39 "Counts", v_R_rvc_trk.trk_ttl_39 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_40 "Names", v_R_rvc_trk.trk_cnt_40 "Counts", v_R_rvc_trk.trk_ttl_40 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_41 "Names", v_R_rvc_trk.trk_cnt_41 "Counts", v_R_rvc_trk.trk_ttl_41 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_42 "Names", v_R_rvc_trk.trk_cnt_42 "Counts", v_R_rvc_trk.trk_ttl_42 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_43 "Names", v_R_rvc_trk.trk_cnt_43 "Counts", v_R_rvc_trk.trk_ttl_43 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_44 "Names", v_R_rvc_trk.trk_cnt_44 "Counts", v_R_rvc_trk.trk_ttl_44 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_45 "Names", v_R_rvc_trk.trk_cnt_45 "Counts", v_R_rvc_trk.trk_ttl_45 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_46 "Names", v_R_rvc_trk.trk_cnt_46 "Counts", v_R_rvc_trk.trk_ttl_46 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_47 "Names", v_R_rvc_trk.trk_cnt_47 "Counts", v_R_rvc_trk.trk_ttl_47 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_48 "Names", v_R_rvc_trk.trk_cnt_48 "Counts", v_R_rvc_trk.trk_ttl_48 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_49 "Names", v_R_rvc_trk.trk_cnt_49 "Counts", v_R_rvc_trk.trk_ttl_49 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_50 "Names", v_R_rvc_trk.trk_cnt_50 "Counts", v_R_rvc_trk.trk_ttl_50 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_51 "Names", v_R_rvc_trk.trk_cnt_51 "Counts", v_R_rvc_trk.trk_ttl_51 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_52 "Names", v_R_rvc_trk.trk_cnt_52 "Counts", v_R_rvc_trk.trk_ttl_52 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_53 "Names", v_R_rvc_trk.trk_cnt_53 "Counts", v_R_rvc_trk.trk_ttl_53 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_54 "Names", v_R_rvc_trk.trk_cnt_54 "Counts", v_R_rvc_trk.trk_ttl_54 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_55 "Names", v_R_rvc_trk.trk_cnt_55 "Counts", v_R_rvc_trk.trk_ttl_55 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_trk.business_date "Dates", v_R_rvc_trk.ttl_name_56 "Names", v_R_rvc_trk.trk_cnt_56 "Counts", v_R_rvc_trk.trk_ttl_56 "Amount", v_R_rvc_trk.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_trk" "v_R_rvc_trk") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0


UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Net Sales Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.net_sales_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Item Discount Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.item_discount_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Sbtl Discount Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.sbtl_discount_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Return Total' AS TEXT) "Names", v_R_rvc_sales.return_cnt "Counts", v_R_rvc_sales.return_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Service Charge Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.service_chg_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Void Total' AS TEXT) "Names", v_R_rvc_sales.void_cnt "Counts", v_R_rvc_sales.void_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Tax Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.tax_coll_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Credit Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.credit_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Rounding Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.rounding_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Change Grand Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.change_grand_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Grand Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.grand_total "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Training Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.training_total "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Non Taxbl Total' AS TEXT) "Names",1 "Counts", v_R_rvc_sales.non_txbl_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Cancel Total' AS TEXT) "Names", v_R_rvc_sales.cancel_cnt "Counts", v_R_rvc_sales.cancel_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Manager Void Total' AS TEXT) "Names", v_R_rvc_sales.mgr_void_cnt "Counts", v_R_rvc_sales.mgr_void_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Error Correction Total' AS TEXT) "Names", v_R_rvc_sales.error_correct_cnt "Counts", v_R_rvc_sales.error_correct_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Chk Carry Over Total' AS TEXT) "Names", v_R_rvc_sales.chk_carry_over_cnt "Counts", v_R_rvc_sales.chk_carry_over_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Chk Began Over Total' AS TEXT) "Names", v_R_rvc_sales.chk_begun_cnt "Counts", v_R_rvc_sales.chk_begun_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Chk Paid Total' AS TEXT) "Names", v_R_rvc_sales.chk_paid_cnt "Counts", v_R_rvc_sales.chk_paid_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Chk Xfer In Total' AS TEXT) "Names", v_R_rvc_sales.chk_xfer_in_cnt "Counts", v_R_rvc_sales.chk_xfer_in_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Chk Xfer Out Total' AS TEXT) "Names", v_R_rvc_sales.chk_xfer_out_cnt "Counts", v_R_rvc_sales.chk_xfer_out_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0
UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Gross Receipts Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.gross_receipts_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Charged Receipts Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.chgd_receipts_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Charged Tips Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.chgd_tips_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Tips Svc Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.tip_svc_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Tips Paid Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.tips_paid_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Tips Declared Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.tips_declared_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Indirect Tips Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.indirect_tips_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('OT Net Sales Total' AS TEXT) "Names", 1 "Counts", v_R_rvc_sales.ot_net_sales_ttl "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Check Count' AS TEXT) "Names", v_R_rvc_sales.check_count "Counts", 1 "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Cover Count' AS TEXT) "Names", v_R_rvc_sales.cover_count "Counts", 1 "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

UNION
SELECT a.Dates, a.Names, a.Counts, a.Amount, b.Revenue_Center
FROM (SELECT v_R_rvc_sales.business_date "Dates", CAST('Table Turn Count' AS TEXT) "Names", v_R_rvc_sales.table_turn_count "Counts", 1 "Amount", v_R_rvc_sales.rvc_seq "rvc_seq"
FROM "micros"."v_R_rvc_sales" "v_R_rvc_sales") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.Amount<>0

2. ALTER VIEW "Cognos"."Cost_Point_Revenue_Menu"( /* view_column_name, ... */ )
AS
SELECT a.Dates, a.group_number, a.group_name, b.Revenue_Center, a.sales_total, a.discount_total
FROM(SELECT v_R_rvc_menuitem_fam_grp.business_date "Dates", v_R_rvc_menuitem_fam_grp.rvc_seq, v_R_rvc_menuitem_fam_grp.group_number "group_number", v_R_rvc_menuitem_fam_grp.group_name "group_name", v_R_rvc_menuitem_fam_grp.P1_sales_total "sales_total", v_R_rvc_menuitem_fam_grp.P1_discount_total "discount_total"
FROM "micros"."v_R_rvc_menuitem_fam_grp") a
JOIN (SELECT v_rvc_cfg.seq "seq", v_rvc_cfg.name_1 "Revenue_Center" FROM "micros"."v_rvc_cfg" "v_rvc_cfg") b On a.rvc_seq=b.seq
WHERE a.sales_total<>0

 
Just a couple of things.

This is a holiday week for a lot of the world, so people are on vacation.
The people who contribute here do so to help others in the POS community, we don't get paid for it. The code you have looks like it's intended for a commercial product, IBM's Cognos Analytics for instance, but it's also seems that you're very new to SQL. Asking for free help of this scale on a paid project is rather bold.

You don't say what it is you need help with. The code you have is inefficient, but it works. What is it that you're asking?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top