<DODocTemplateConfigRoot><DODocTemplateList><DODocTemplate STATE="0"><DODocTemplate2DeviceList/><DODocTemplateParamList><DODocTemplateParam STATE="0"><DocTemplateParamId>1</DocTemplateParamId><DocTemplateId>1</DocTemplateId><ParamName NOTNULL="TRUE">$transactionid</ParamName><ParamType>1</ParamType><CntxPropertyType>22</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">$transactionid</ParamCaption></DODocTemplateParam><DODocTemplateParam STATE="0"><DocTemplateParamId>2</DocTemplateParamId><DocTemplateId>1</DocTemplateId><ParamName NOTNULL="TRUE">saleid</ParamName><ParamType>3</ParamType><CntxPropertyType>23</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">saleid</ParamCaption></DODocTemplateParam></DODocTemplateParamList><DODocRepositoryList/><DODocTemplateParamValueList><DODocTemplateParamValue STATE="0"><DocTemplateParamValueId>1</DocTemplateParamValueId><DocTemplateParamId>1</DocTemplateParamId><DocTemplateId>1</DocTemplateId><CntxPropertyType>0</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">$transactionid</ParamCaption><ReadOnly>1</ReadOnly><NotNull>0</NotNull></DODocTemplateParamValue><DODocTemplateParamValue STATE="0"><DocTemplateParamValueId>2</DocTemplateParamValueId><DocTemplateParamId>2</DocTemplateParamId><DocTemplateId>1</DocTemplateId><CntxPropertyType>0</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">saleid</ParamCaption><ReadOnly>1</ReadOnly><NotNull>0</NotNull></DODocTemplateParamValue></DODocTemplateParamValueList><DocTemplateId>2</DocTemplateId><SystemId>0</SystemId><DocTemplateAk NOTNULL="TRUE">E39526770D0A4072AA28D63F950998D1</DocTemplateAk><DocCntxType>2</DocCntxType><DocTemplateType>1</DocTemplateType><DirectPrint>0</DirectPrint><DocTemplateName NOTNULL="TRUE">Transaction Receipt datasource</DocTemplateName><Enabled>1</Enabled><DocDatasourceId>0</DocDatasourceId><PriorityOrder>0</PriorityOrder><DmgCategoryId>0</DmgCategoryId><SystemTemplate>1</SystemTemplate><DeleteFromConfig></DeleteFromConfig></DODocTemplate></DODocTemplateList><DODocTemplateDataList><DocTemplateData STATE="0"><DocTemplateAk>E39526770D0A4072AA28D63F950998D1</DocTemplateAk><DocTemplateContent>&lt;root namespaceuri="otn.overview7.xmldata"&gt;&lt;queries&gt;&lt;query name="reportxmldata" context="2"&gt;&lt;params&gt;&lt;param name="$transactionid" datatype="1" contextproperty="22"/&gt;&lt;param name="saleid" datatype="3" contextproperty="23"/&gt;&lt;/params&gt;&lt;/query&gt;&lt;/queries&gt;&lt;datasets&gt;&lt;dataset name="Transaction" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;SELECT
    DATA_Transaction.TransactionDate,
    DATA_Transaction.Serial AS TransactionNumber,
    DATA_Transaction.BoxId AS BoxNumber,
    CNF_Site.SiteCode,
    CNF_OperatingArea.AreaCode,
    CNF_Workstation.WorkstationAK AS Station,
    CNF_LookUp.Description AS TransactionType,
    CNF_Currency.Symbol AS Currency,    
    CNF_Currency.ISOCode,
    CNF_Site.SiteName,
    DATA_Transaction.TransactionAK,
    CNF_User.UserName,
    CNF_User.UserCode,    
    DATA_Transaction.Rounding
    
    FROM DATA_Transaction
    LEFT OUTER JOIN CNF_Site
      ON CNF_Site.SiteId = DATA_Transaction.SiteId
    LEFT OUTER JOIN CNF_Workstation
      ON CNF_Workstation.WorkStationId = DATA_Transaction.WorkStationId
    LEFT OUTER JOIN CNF_OperatingArea
      ON CNF_OperatingArea.OperatingAreaId = CNF_Workstation.OperatingAreaId
    LEFT OUTER JOIN CNF_LookUp
      ON CNF_LookUp.LookUpTableId = 3 -- Lookup_TransactionType
     AND CNF_LookUp.ItemId = DATA_Transaction.TransactionType
    LEFT OUTER JOIN CNF_User
      ON CNF_User.UserId = DATA_Transaction.UserId
    LEFT OUTER JOIN DATA_Sale
      ON DATA_Sale.SaleId = DATA_Transaction.SaleId
    LEFT OUTER JOIN CNF_Currency
      ON CNF_Currency.CurrencyId = DATA_Sale.CurrencyId
    
    WHERE DATA_Transaction.TransactionId in (/*$transactionid*/ 0 /*end*/)
    ORDER BY DATA_Transaction.TransactionId&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Totals" donotgeneratelist="S"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;SELECT
  SUM(DATA_Transaction.Revenue - DATA_Transaction.TaxRevenue) AS SubTotal,
  SUM(DATA_Transaction.TaxRevenue) AS TotalTaxes,
  SUM(DATA_Transaction.Revenue) AS TotalAmount,
  SUM(DATA_Transaction.Revenue - DATA_Transaction.Change + DATA_Transaction.Rounding) AS Tendered,
  SUM(DATA_Transaction.Change) AS Change,   
  SUM(DATA_Transaction.Tip) AS BreakageTip

  FROM DATA_Transaction
  WHERE DATA_Transaction.TransactionId in (/*$transactionid*/ 0 /*end*/)&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Item" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select
  SI.SaleItemId,          

  LkPtype.ItemId as ProductType,
  LkPtype.Description as ProductTypeName,
  ASet.AttributeNames,
  ASet.AttributeCodes,  
  MC.Description as ProductDescription,    
  MC.Description2 as ProductAdditionalDescription,
  case when MC.Code is null then ASet.AttributeCodes else MC.Code end as ProductCode, 
  case when MC.Name is null then ASet.AttributeNames else MC.Name end as ProductName, 
  SI.Quantity AS Qty,
  SI.UnitPrice AS ItemPrice,
  SI.UnitPrice AS ItemAltPrice,
  SI.Quantity * SI.UnitPrice AS ItemSubTotal,
  SI.UnitTaxes AS Tax,
  SI.Quantity * SI.UnitTaxes AS TaxSubTotal,
  CUR.Symbol AS Currency,  
  CUR.ISOCode,
  (
    select count(distinct DATA_SaleItem2Performance.PerformanceId) 
    from DATA_SaleItem2Performance
    where DATA_SaleItem2Performance.SaleItemId = SI.SaleItemId
  ) Performances  
  /*RmTrack #2828*/       
  , CASE  
      WHEN DATA_Account.SurName &amp;lt;&amp;gt; '' THEN DATA_Account.SurName 
    ELSE
      ''
    END SurName    
  , CASE  
      WHEN DATA_Account.SurName &amp;lt;&amp;gt; '' THEN DATA_Account.FirstName
    ELSE
      ''
    END FirstName    
  , CASE  
      WHEN DATA_Account.SurName &amp;lt;&amp;gt; '' THEN DATA_Account.MobilePhone
    ELSE
      ''
    END MobilePhone
from DATA_SaleItem SI
  left outer join DATA_Sale S on SI.SaleId = S.SaleId 
  left outer join CNF_LookUp LkPtype on LkPtype.LookUpTableId = 18 /*Lookup_ProductType*/ 
              and LkPtype.ItemId = SI.ProductType 
  left outer join CNF_MatrixCell MC on MC.MatrixCellId = SI.MatrixCellId
  left outer join CNF_AttributeSet ASet on ASet.AttributeSetId = MC.AttributeSetId
  left outer join CNF_Currency CUR on CUR.CurrencyId = S.CurrencyId  
  Left outer join DATA_SaleItem2Account as SI2A on (SI2A.SaleItemId=SI.SaleItemId)
  LEFT OUTER JOIN DATA_Account ON (DATA_Account.AccountId = SI2A.AccountId) /*RmTrack #2828*/    
where 
  (SI.SaleId = :saleid)&lt;/db&gt;&lt;/select&gt;&lt;datasets&gt;&lt;dataset name="Performance" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select
  DATA_SaleItem2Performance.SaleItemId,
  CNF_Performance.PerfDateTime,
  CNF_Event.EventName,
  CNF_Location.Name as LocationName

  from DATA_SaleItem2Performance
  left outer join CNF_Performance 
    on DATA_SaleItem2Performance.PerformanceId = CNF_Performance.PerformanceId
  left outer join CNF_Event 
    on CNF_Performance.EventId = CNF_Event.EventId
  left outer join ADM_AccessConfiguration  
    on CNF_Performance.AccessConfigurationId = ADM_AccessConfiguration.AccessConfigurationId
  left outer join CNF_Location  
    on ADM_AccessConfiguration.LocationId = CNF_Location.LocationId

  WHERE (DATA_SaleItem2Performance.SaleItemId = :SaleItemId)  
  order by CNF_Performance.PerfDateTime&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="MediaIdentifier" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select S2T.SaleItemId,
       MI.IdentifierCode
  from DATA_SaleItem2Ticket S2T   
 -- inner join DATA_Ticket TCK on (TCK.TicketId = S2T.TicketId) 
 inner join DATA_Ticket2Media T2M on (T2M.TicketId = S2T.TicketId)
 --inner join DATA_Media MD on (MD.MediaId = T2M.MediaId)
 inner join DATA_MediaIdentifier MI on (MI.MediaId = T2M.MediaId)   

 where S2T.SaleItemId = :SaleItemId&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/dataset&gt;&lt;dataset name="Payment" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select
  PAY.PaymentId,  
  LkPType.Description as BOSPaymentType,
  PDR.Description as PaymentTypeDesc,
  PM.Description as PaymentMethod,
  CUR.Symbol as Currency,
  CUR.ISOCode,  
  case CUR.CurrencyType  
    -- main currency type is 1
    when 1 then PAY.PaymentAmount
    else PAY.CurrencyAmount
  end as Amount,      
  case PAY.PaymentType
    when 2 then PCARD.CardNumber
    when 6 then '[' + AccountCredit.AccountAK + '] ' + AccountCredit.DisplayName + ' #' + VOUCH.VoucherCode
    else ''  
  end as PaymentDetails

           from DATA_Payment PAY 
     inner join CNF_LookUp LkPType on LkPType.LookupTableId = 7 and LkPType.ItemId = PAY.PaymentType 
     inner join CNF_PaymentMethod PM on PAY.PaymentMethodId = PM.PaymentMethodId
     inner join CNF_Driver PDR on PDR.DriverId = PM.DriverId
left outer join CNF_Currency CUR on PAY.CurrencyID = CUR.CurrencyId 
left outer join DATA_PaymentCard PCARD on PAY.PaymentId = PCARD.PaymentId 
left outer join DATA_PaymentCredit PCRED on PAY.PaymentId = PCRED.PaymentId 
left outer join DATA_Account AccountCredit on AccountCredit.AccountId = PCRED.AccountId 
left outer join DATA_Voucher VOUCH on PCRED.EntityTable = 186 and PCRED.EntityId = VOUCH.VoucherId  

where 
  PAY.TransactionId in (/*$transactionid*/ 0 /*end*/) and
  PAY.PaymentStatus = 1
order by
  PAY.TransactionId&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Reservation" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select
  DATA_Reservation.ReservationAK,  
  DATA_Account.*,  
  CUR.ISOCode,
  PA.PaymentAmount
from DATA_Reservation 
  left outer join DATA_Account on DATA_Reservation.AccountId=DATA_Account.AccountId 
  left outer join DATA_Transaction as TR on (TR.SaleId = DATA_Reservation.SaleId)
  left outer join DATA_Payment as PA on (PA.TransactionId=TR.TransactionId)
  left outer join CNF_Currency as CUR on (CUR.CurrencyId=PA.CurrencyId)
 where
   DATA_Reservation.SaleId = :saleid
   and TR.TransactionType = 12&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="MoneyCardRecharge" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select (TI.Quantity * TI.UnitRecharge) Amount,
       case when MC.Code is null then ASet.AttributeCodes else MC.Code end as ProductCode, 
       case when MC.Name is null then ASet.AttributeNames else MC.Name end as ProductName, 
       ASET.AttributeCodes,        
       ASET.AttributeNames,
       case when LkTrType.ItemId in (14, 16) then 'Money Card Recharge' else LkTrType.Description end MoneyCardOperation
            from DATA_TransactionItem TI
      inner join DATA_Transaction TR on (TI.TransactionId = TR.TransactionId)
      inner join CNF_LookUp LkTrType on (TR.TransactionType = LkTrType.ItemId and LkTrType.LookUpTableId = 3)
      inner join DATA_SaleItem SI on (TI.SaleItemId = SI.SaleItemId)
      inner join CNF_MatrixCell MC on (SI.MatrixCellId = MC.MatrixCellId)
      inner join CNF_AttributeSet ASET on ASET.AttributeSetId = MC.AttributeSetId
 where TI.TransactionId in (/*$transactionid*/ 0 /*end*/)    
   and TI.UnitRecharge &amp;lt;&amp;gt; 0
 order by TI.TransactionId&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Sale" donotgeneratelist="S"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select SaleId,
       LkType.Description SaleType,
       LkStatus.Description SaleStatus,
       FSaleDate,
       Serial,
       SaleAk,

       Quantity,
       TicketCount,
      
       --TotalAmount,
       --TotalTaxes,
       --Revenue,
       --TaxRevenue,

       --Paid,
       --Approved,
       --Validated,
       --Encoded,
       --Completed,

       CNF_Site.SiteId,
       CNF_Site.SiteName,
       CNF_Site.SiteDescription,
       CNF_Site.SiteAK,
       
       SYST.SystemId,
       SYST.SystemCode,
       
       CUR.ISOCode,
       CUR.Symbol Currency

             from DATA_Sale S
  left outer join CNF_LookUp LkType on (S.SaleType = LkType.ItemId and LkType.LookUpTableId = 48) /* Lk_SaleType */
  left outer join CNF_LookUp LkStatus on (S.StatusCode = LkStatus.ItemId and LkStatus.LookUpTableId = 39) /* Lk_SaleType */
  left outer join CNF_Workstation WS on (S.WorkstationId = WS.WorkstationId)
  left outer join CNF_Site on (WS.SiteId = CNF_Site.SiteId)
  left outer join CNF_System SYST on (S.SystemId = SYST.SystemId)
  left outer join CNF_Currency CUR on S.CurrencyId = CUR.CurrencyId  
 where S.SaleId = :saleid&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Promotion" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;SELECT CNF_Promotion.Description as PromotionName
FROM CNF_Promotion INNER JOIN
DATA_SaleCoupon ON CNF_Promotion.PromotionId = DATA_SaleCoupon.PromotionId INNER JOIN
DATA_Sale ON DATA_SaleCoupon.SaleId = DATA_Sale.SaleId INNER JOIN
DATA_Transaction ON DATA_Sale.SaleId = DATA_Transaction.SaleId
where DATA_Transaction.TransactionId in (/*$transactionid*/ 0 /*end*/)&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/root&gt;
</DocTemplateContent><ArchiveFileName>E39526770D0A4072AA28D63F950998D1</ArchiveFileName></DocTemplateData></DODocTemplateDataList></DODocTemplateConfigRoot>