



CREATE PROCEDURE DBO.FixPackageCharge AS
SET NOCOUNT ON

select Reservations.ReferenceNumber,Reservations.GuestNumber,Reservations.SplitBill,Products.Dayproduct,* from transactions WITH (nolock) 
inner join Folios WITH (nolock) on transactions.FolioNumber = Folios.Folionumber
inner join ware WITH (nolock) on ware.Warenumber = transactions.WareNumber
inner join Waregroups WITH (nolock) on waregroups.WareGroupNumber = ware.WareGroupNumber
inner join Reservations WITH (nolock) on Reservations.ReferenceNumber = Folios.ReferenceNumber AND 
                                    Reservations.GuestNumber = Folios.GuestNumber
inner join ReservationAddress WITH (nolock) on ReservationAddress.AddressNumber = Folios.ReservationAddressNumber
inner join SplitBillWaregroupXTab WITH (nolock) on SplitBillWaregroupXTab.SplitBillNumber = Reservations.SplitBill AND
  SplitBillWaregroupXTab.WareGroupNumber = ware.WareGroupNumber
inner join Products WITH (nolock) on Products.ProductNumber = transactions.ProductNumber
Where ReservationAddress.AddressType=1 and waregroups.Payment=0
order by Reservations.referenceNumber

