<DODocTemplateConfigRoot><DODocTemplateList><DODocTemplate STATE="0">
			<DODocTemplate2DeviceList/>
			<DODocTemplateParamList>
				<DODocTemplateParam STATE="0">
					<DocTemplateParamId>38</DocTemplateParamId>
					<DocTemplateId>17</DocTemplateId>
					<ParamName NOTNULL="TRUE">depositid</ParamName>
					<ParamType>3</ParamType>
					<CntxPropertyType>91</CntxPropertyType>
					<ParamValue NOTNULL="TRUE"/>
					<ParamCaption NOTNULL="TRUE">depositid</ParamCaption>
				</DODocTemplateParam>
			</DODocTemplateParamList>
			<DODocRepositoryList/>
			<DODocTemplateParamValueList>
				<DODocTemplateParamValue STATE="0">
					<DocTemplateParamValueId>41</DocTemplateParamValueId>
					<DocTemplateParamId>38</DocTemplateParamId>
					<DocTemplateId>17</DocTemplateId>
					<CntxPropertyType>0</CntxPropertyType>
					<ParamValue NOTNULL="TRUE"/>
					<ParamCaption NOTNULL="TRUE">depositid</ParamCaption>
					<ReadOnly>1</ReadOnly>
					<NotNull>0</NotNull>
				</DODocTemplateParamValue>
			</DODocTemplateParamValueList>
			<DocTemplateId>18</DocTemplateId>
			<SystemId>0</SystemId>
			<DocTemplateAk NOTNULL="TRUE">09A52E637571464CA0652B87E963253C</DocTemplateAk>
			<DocCntxType>9</DocCntxType>
			<DocTemplateType>1</DocTemplateType>
			<DirectPrint>0</DirectPrint>
			<DocTemplateName NOTNULL="TRUE">Final Close V 1.2</DocTemplateName>
			<Enabled>1</Enabled>
			<DocDatasourceId>0</DocDatasourceId>
			<PriorityOrder>0</PriorityOrder>
			<DmgCategoryId>0</DmgCategoryId>
			<SystemTemplate>1</SystemTemplate>
			<DeleteFromConfig></DeleteFromConfig><DocTemplateGroup></DocTemplateGroup></DODocTemplate>
	</DODocTemplateList><DODocTemplateDataList><DocTemplateData STATE="0"><DocTemplateAk>09A52E637571464CA0652B87E963253C</DocTemplateAk><DocTemplateContent>&lt;root namespaceuri="otn.overview7.xmldata"&gt;&lt;queries&gt;&lt;query name="reportxmldata" context="9"&gt;&lt;params&gt;&lt;param name="depositid" datatype="3" contextproperty="91"/&gt;&lt;/params&gt;&lt;/query&gt;&lt;/queries&gt;&lt;datasets&gt;&lt;dataset name="MainData" donotgeneratelist="S"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  D.DepositAmount,
  D.DepositDate,
  D.BagNumber,
  Lk.Description as DepositType,
  Lookup_Deposit.Description,
  B.BoxAK,
  U.UserCode,
  U.UserName, 
  WS.WorkstationCode,
  WS.WorkstationAK,
  WS.WorkstationDescription,
  OA.AreaCode,
  OA.OpAreaName,  

  -D.DepositAmount as "DepAmount"

from DATA_Deposit D

left join CNF_LookUp Lk on (Lk.LookUpTableId = 64 and D.DepositType = Lk.ItemId)
LEFT OUTER JOIN     
      (
        SELECT
        CNF_LookUp.ItemId,
        ISNULL(dbo.CNF_MultiLanguage.Translation, dbo.CNF_LookUp.Description) AS Description 
        FROM
        CNF_Lookup LEFT JOIN
        CNF_MultiLanguage ON 
        (CNF_Lookup.LookupTableId=CNF_MultiLanguage.ComponentName) and
        (CNF_Lookup.ItemId=CNF_MultiLanguage.PropertyName) and
        (CNF_MultiLanguage.FormName = 'LOOKUP') and 
        (CNF_MultiLanguage.LanguageId = 1)     
  WHERE
        (CNF_LookUp.LookUpTableId =64) -- Lookup_Deposit
      ) AS Lookup_Deposit
      ON Lookup_Deposit.ItemId = D.DepositType
inner join DATA_Box B on (D.BoxId = B.BoxId)
inner join CNF_User U on (D.UserId = U.UserId)
inner join CNF_Workstation WS on (D.WorkstationId = WS.WorkstationId)
inner join CNF_OperatingArea OA on (WS.OperatingAreaId = OA.OperatingAreaId)

where D.DepositId = :depositid&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="Deposit" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  DD.PaymentMethodId,
  DD.DetailCode,
  case 
    when max(DD.DetailCode) &amp;gt; 0 then upper(max(coalesce(Lookup_Translation.description, Fund.Description)))         
    when max(CNF_Currency.CurrencyType) = 2 then                  
       max(PM.Description + ' (' + CNF_Currency.Symbol + ' ' + CAST(ABS(ROUND(CNF_Currency.ExchangeRate* DD.Amount,2)) AS VARCHAR) + ')')
    else upper(max(PM.Description))
  end as Description,
  sum(-DD.Amount) as "Amount"  
 from DATA_DepositDetail DD
left join CNF_PaymentMethod PM on (DD.PaymentMethodId      = PM.PaymentMethodId)
left join CNF_Currency         on (CNF_Currency.CurrencyId = DD.CurrencyId)
left join CNF_LookUp Fund      on (Fund.LookUpTableId      = 71 and Fund.ItemId = DD.DetailCode)
LEFT OUTER JOIN     
      (
        SELECT
        CNF_LookUp.ItemId,
        ISNULL(dbo.CNF_MultiLanguage.Translation, dbo.CNF_LookUp.Description) AS Description 
        FROM
        CNF_Lookup LEFT JOIN
        CNF_MultiLanguage ON 
        (CNF_Lookup.LookupTableId=CNF_MultiLanguage.ComponentName) and
        (CNF_Lookup.ItemId=CNF_MultiLanguage.PropertyName) and
        (CNF_MultiLanguage.FormName = 'LOOKUP') and 
        (CNF_MultiLanguage.LanguageId = 1)     
  WHERE
        (CNF_LookUp.LookUpTableId = 71) -- Lookup_Coins
      ) AS Lookup_Translation 
      ON Lookup_Translation.ItemId = DD.detailcode
where DD.DepositId = :depositid
group by DD.CurrencyId, DD.PaymentMethodId, DD.DetailCode&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;dataset name="CashDeposit" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  DD.CurrencyId,
  DD.PaymentMethodId,
  DD.DetailCode,  
  case 
    when DD.DetailCode &amp;gt; 0 then upper(max(Lookup_Translation.Description))
    else upper(max(PM.Description))
  end as Description,

  abs(sum(DD.Amount)) as "Amount"

from DATA_DepositDetail DD
left join CNF_PaymentMethod PM on (DD.PaymentMethodId = PM.PaymentMethodId)
left join CNF_LookUp Fund on (Fund.LookUpTableId = 71 and Fund.ItemId = DD.DetailCode)
LEFT OUTER JOIN     
      (
        SELECT
        CNF_LookUp.ItemId,
        ISNULL(dbo.CNF_MultiLanguage.Translation, dbo.CNF_LookUp.Description) AS Description 
        FROM
        CNF_Lookup LEFT JOIN
        CNF_MultiLanguage ON 
        (CNF_Lookup.LookupTableId=CNF_MultiLanguage.ComponentName) and
        (CNF_Lookup.ItemId=CNF_MultiLanguage.PropertyName) and
        (CNF_MultiLanguage.FormName = 'LOOKUP') and 
        (CNF_MultiLanguage.LanguageId = 1)     
  WHERE
        (CNF_LookUp.LookUpTableId = 71) -- Lookup_Coins
      ) AS Lookup_Translation 
      ON Lookup_Translation.ItemId = DD.detailcode

where DD.DepositId = :depositid
  and DD.DetailCode &amp;gt; 0

group by DD.CurrencyId, DD.PaymentMethodId, DD.DetailCode&lt;/db&gt;&lt;/select&gt;&lt;datasets&gt;&lt;dataset name="CashItem" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  C.Symbol as Currency,
  ABS(CD.Amount) as SinglePrice,
  CD.FundCategory as DetailCode,
  case 
    when DD.Quantity is null then 0
    else DD.Quantity 
  end as Quantity,
  case 
    when abs(DD.Amount) is null then 0
    else abs(DD.Amount)
  end as Amount,
  DD.PaymentMethodId

from CNF_Currency C 
inner join CNF_CurrencyDetail CD on (C.CurrencyId = CD.CurrencyId)
left join DATA_DepositDetail DD on (
          DD.DepositId = :depositid and             
          DD.PaymentMethodId = :PaymentMethodId and
          DD.CurrencyId = C.CurrencyId and 
          DD.DetailCode = CD.FundCategory and 
          ABS(CD.Amount) = ABS(DD.SinglePrice)
)

where 
      C.CurrencyId = :CurrencyId      
  and CD.FundCategory = :DetailCode

order by CD.FundCategory, ABS(CD.Amount)&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/dataset&gt;&lt;dataset name="NoCashDeposit" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  DD.CurrencyId,
  DD.PaymentMethodId,
  DD.DetailCode,  
  case 
    when max(CNF_Currency.CurrencyType) = 2 then 
        max(PM.Description + ' ' + CNF_Currency.Symbol)    
    else upper(max(PM.Description))
  end as Description,

  sum(-DD.Amount) as "Amount"

from DATA_DepositDetail DD
left join CNF_PaymentMethod PM on (DD.PaymentMethodId = PM.PaymentMethodId)
left join CNF_Currency on (CNF_Currency.CurrencyId = DD.CurrencyId)
left join CNF_LookUp Fund on (Fund.LookUpTableId = 71 and Fund.ItemId = DD.DetailCode)

where DD.DepositId = :depositid
  and DD.DetailCode = 0

group by DD.CurrencyId, DD.PaymentMethodId, DD.DetailCode&lt;/db&gt;&lt;/select&gt;&lt;datasets&gt;&lt;dataset name="NoCashItem" donotgeneratelist="N"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;select 
  C.Symbol as Currency,
  DD.SinglePrice,
  DD.DetailCode,  
  CASE 
    WHEN DD.Quantity &amp;gt; 0 THEN CAST(ROUND(DD.Quantity, 7,2) AS VARCHAR(9))
    WHEN C.CurrencyType = 2 THEN CAST(ROUND(DD.CurrencyAmount, 7,2) AS VARCHAR(9)) + ' ' + C.Symbol    
    ELSE '' 
  END Quantity,
  -(DD.Amount) as Amount,
  DD.PaymentMethodId
from DATA_DepositDetail DD
inner join CNF_Currency C on (DD.CurrencyId = C.CurrencyId)
where 
     DD.DepositId = :depositid
 and DD.PaymentMethodId = :PaymentMethodId
 and C.CurrencyId = :CurrencyId
order by ABS(SinglePrice)&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/dataset&gt;&lt;dataset name="DefaultCurrency" donotgeneratelist="S"&gt;&lt;select&gt;&lt;db query="reportxmldata" type="*" commadtype="query"&gt;SELECT CNF_Currency.IsoCode
     , CNF_Currency.Symbol
     , CNF_Currency.Name
  FROM CNF_Currency
WHERE CNF_Currency.CurrencyType = 1&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/root&gt;
</DocTemplateContent><ArchiveFileName>09A52E637571464CA0652B87E963253C</ArchiveFileName></DocTemplateData></DODocTemplateDataList></DODocTemplateConfigRoot>