<DODocTemplateConfigRoot><DODocTemplateList><DODocTemplate STATE="0"><DODocTemplate2DeviceList/><DODocTemplateParamList><DODocTemplateParam STATE="0"><DocTemplateParamId>4237</DocTemplateParamId><DocTemplateId>6087</DocTemplateId><ParamName NOTNULL="TRUE">depositid</ParamName><ParamType>3</ParamType><CntxPropertyType>91</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">depositid</ParamCaption></DODocTemplateParam></DODocTemplateParamList><DODocRepositoryList/><DODocTemplateParamValueList><DODocTemplateParamValue STATE="0"><DocTemplateParamValueId>4255</DocTemplateParamValueId><DocTemplateParamId>4237</DocTemplateParamId><DocTemplateId>6087</DocTemplateId><CntxPropertyType>0</CntxPropertyType><ParamValue NOTNULL="TRUE"></ParamValue><ParamCaption NOTNULL="TRUE">depositid</ParamCaption><ReadOnly>1</ReadOnly><NotNull>0</NotNull></DODocTemplateParamValue></DODocTemplateParamValueList><DocTemplateId>66</DocTemplateId><SystemId>0</SystemId><DocTemplateAk NOTNULL="TRUE">0877FC4D6559435C82A16129503AF9B1</DocTemplateAk><DocCntxType>9</DocCntxType><DocTemplateType>1</DocTemplateType><DirectPrint>0</DirectPrint><DocTemplateName NOTNULL="TRUE">Box Deposit</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>0877FC4D6559435C82A16129503AF9B1</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,
  B.BoxAK,
  U.UserCode,
  U.UserName, 
  WS.WorkstationCode,
  WS.WorkstationAK,
  WS.WorkstationDescription,
  OA.AreaCode,
  OA.OpAreaName,  

  (-1*D.DepositAmount) as "DepAmount"

from DATA_Deposit D

left join CNF_LookUp Lk on (Lk.LookUpTableId = 64 and D.DepositType = Lk.ItemId)
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 DD.DetailCode &amp;gt; 0 then upper(max(Fund.Description))
    else upper(max(PM.Description))
  end as Description,

  (sum(-1*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)

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(Fund.Description))
    else upper(max(PM.Description))
  end as Description,

  sum(DD.Amount*-1) 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)

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 (DD.Amount) is null then 0
    else (-1*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 DD.DetailCode &amp;gt; 0 then upper(max(Fund.Description))
    else upper(max(PM.Description))
  end as Description,

  (sum(-1*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)

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,
  DD.Quantity,
  (-1*DD.Amount)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 DD.DetailCode = :DetailCode
order by ABS(SinglePrice)&lt;/db&gt;&lt;/select&gt;&lt;datasets/&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/dataset&gt;&lt;/datasets&gt;&lt;/root&gt;


</DocTemplateContent><ArchiveFileName>0877FC4D6559435C82A16129503AF9B1</ArchiveFileName></DocTemplateData></DODocTemplateDataList></DODocTemplateConfigRoot>