Cutom Reports by Ticket Type

I have scenario that list of Menu items group by Item Group and by ticket type whether it is Dining or Parcel. I can achieve this by below command but the Menu Items is not in order and also appeared multiple times.

Overall Sales Report

@{TICKET TYPE LIST}
@{REPORT ORDER DETAILS:O.ItemGroup,O.ExactTotal.Sum::{0}:,}
@{REPORT ORDER DETAILS:O.MenuItemId,O.ExactTotal.Sum.desc:(ODI=True):{0}:,}
[$2 :8, 2, 2,2]
>{REPORT ORDER DETAILS:O.MenuItemName.asc,O.Quantity.Sum,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemId=$3 and (MG=$2) and (TY=$1)}
{REPORT ORDER DETAILS:T.TicketType,O.Quantity.Sum,O.ExactTotal.Sum.desc:(ODI=True) and O.MenuItemId=$3 and (MG=$2) and (TY=$1)}
>>Total $2|{REPORT ORDER DETAILS:O.Quantity.Sum,O.ExactTotal.Sum:(ODI=True) and (MG=$2) }

Please help

For a clear expectation, the report should be as follows
Item Group
->Item Name
->Dining
->Takeaway
->Total
->Item Name
->Dining
->Takeaway
->Total
Total for Group