﻿<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright Archdiocese of Cincinnati use with permission only c/o bmaly@CatholicAOC.org-->
<Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily">
  <df:DefaultFontFamily>Segoe UI</df:DefaultFontFamily>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="AOC">
      <DataSourceReference>AOCds</DataSourceReference>
      <rd:SecurityType>DataBase</rd:SecurityType>
      <rd:DataSourceID>c5ba2cd7-0b75-42c4-bb59-9c110d202be0</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="MyChurches">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <CommandText>SELECT
  ChurchID
  ,ChurchName + ' - ' +City ChurchName
FROM
  xrpt.Churches_vw 
order by ChurchName</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
      <Fields>
        <Field Name="ChurchID">
          <DataField>ChurchID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="ChurchName">
          <DataField>ChurchName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="Statuses">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@ChurchID">
            <Value>=Parameters!ChurchID.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>Select * from 
(SELECT distinct 
StatusCode
FROM xrpt.Families_vw 
where ChurchID = @ChurchID
and statuscode is not null
and statuscode &lt;&gt;'deleted'
union all
select ' All Statuses') TEST
order by StatusCode</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
      <Fields>
        <Field Name="StatusCode">
          <DataField>StatusCode</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="Forms">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@ChurchID">
            <Value>=Parameters!ChurchID.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>Select distinct replace(MemberLastFirst,'Acknowledgement, ','') LetterForm
from xrpt.FamilyNotes_vw fn
where MemberLastFirst like 'Acknowledgement, %'
and exists ( select 1 from xrpt.Families_vw f
where f.familyid=fn.familyid
and ChurchID  = @ChurchID
and FamilyLastFirst = 'ADMIN')
and exists (select 1 from xrpt.members_vw m
where m.familyid=fn.familyid and m.statuscode='Active')</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
      <Fields>
        <Field Name="LetterForm">
          <DataField>LetterForm</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="MyFunds">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@ChurchID">
            <Value>=Parameters!ChurchID.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Buckets">
            <Value>=Parameters!Buckets.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@DateFrom">
            <Value>=Parameters!DateFrom.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@DateTo">
            <Value>=Parameters!DateTo.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>
Select * from 
(SELECT distinct c.[FundID]
     ,c.[FundDescription]
  FROM [xrpt].[FundContributions_vw] c
where c.ChurchID =@ChurchID
		and (0 in (@Buckets)
			or exists (
			select 1
			from xrpt.funds_vw fd 
			where fd.ChurchID = c.ChurchID
			and fd.FundID = c.FundID
			and isnull(fd.AnnualContributionBucket,1) in (@Buckets)
			)
		)
	and ContributionDate &gt;= @DateFrom and ContributionDate &lt;= @DateTo
union all 
select 0, ' All Funds' ) tst
order by FundDescription</CommandText>
      </Query>
      <Fields>
        <Field Name="FundID">
          <DataField>FundID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="FundDescription">
          <DataField>FundDescription</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="MyFamilies">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@ChurchID">
            <Value>=Parameters!ChurchID.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@DateFrom">
            <Value>=Parameters!DateFrom.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@DateTo">
            <Value>=Parameters!DateTo.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@CurrentUser">
            <Value>=Parameters!CurrentUser.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Statuses">
            <Value>=Parameters!Statuses.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Funds">
            <Value>=Parameters!Funds.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Buckets">
            <Value>=Parameters!Buckets.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@LimitLow">
            <Value>=Parameters!LimitLow.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>select * from 
(select distinct 
	fc.ContributionID
,fc.lastName+'('+FORMAT(fc.GrossAmount, 'C', 'en-us')+')' Items
from xrpt.FundContributions_vw fc 
where fc.ChurchID= @ChurchID
and fc.ContributionDate &gt;= @DateFrom and fc.ContributionDate &lt; dateadd(dd,1,@DateTo)
and exists (select 1 from xrpt.ChurchUsers_vw cu 
	where fc.ChurchID = cu.ChurchID 
	and cu.UserName=@CurrentUser 
	and (cu.ChurchAdministrator = 1 or cu.FundManager = 1))
and (' All Statuses' in (@Statuses) 
	or exists (select 1 from xrpt.families_vw f
	where f.familyID=fc.FamilyID
		and f.StatusCode in (@Statuses)))
and (( 0 in (@Funds) and 0 in (@Buckets))
	or (0 in (@Funds) 
		and exists (select 1 from xrpt.funds_vw fd 
		where fd.ChurchID = fc.ChurchID
		and fd.FundID = fc.FundID
		and isnull(fd.AnnualContributionBucket,4) in (@Buckets)) )
	or fc.fundid in (@Funds))
--and (fc.GrossAmount &gt;= @LimitLow 
and (Case when @LimitLow = 0 then case when isnull(fc.GrossAmount,0) = 0 then 1 else 0 end
 else case when fc.GrossAmount &gt;= @LimitLow  then 1 else 0 end end = 1 
or fc.Comment like '%{ack}%')
union all
select 0, ' All Families' ) txt
order by items</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
      <Fields>
        <Field Name="ContributionID">
          <DataField>ContributionID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Items">
          <DataField>Items</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="Details">
      <Query>
        <DataSourceName>AOC</DataSourceName>
        <QueryParameters>
          <QueryParameter Name="@DateFrom">
            <Value>=Parameters!DateFrom.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Statuses">
            <Value>=Parameters!Statuses.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@ChurchID">
            <Value>=Parameters!ChurchID.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@DateTo">
            <Value>=Parameters!DateTo.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@CurrentUser">
            <Value>=Parameters!CurrentUser.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Funds">
            <Value>=Parameters!Funds.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Address">
            <Value>=Parameters!Address.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Buckets">
            <Value>=Parameters!Buckets.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@LimitLow">
            <Value>=Parameters!LimitLow.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@FForm">
            <Value>=Parameters!FForm.Value</Value>
          </QueryParameter>
          <QueryParameter Name="@Families">
            <Value>=Parameters!Families.Value</Value>
          </QueryParameter>
        </QueryParameters>
        <CommandText>--Created for the Archdiocese of Cincinnati 
--bmaly@catholicaoc.org
--Create Date 2021.10.14

Declare @ChurchData Table
(ChurchID int
,YOUTUBE nvarchar(200)
,WWW nvarchar(200)
,PIC nvarchar(200)
,FACEBOOK nvarchar(200)
,Logo  nvarchar(200)
,LogoOrientation nvarchar(200)
,LetterTextP1 nvarchar(2000)
,LetterTextP2 nvarchar(2000)
,LetterSign nvarchar(200)
,LetterSignURL nvarchar(200)
,ChurchName nvarchar(200)
,ChurchCity nvarchar(200)
,CAddr1 nvarchar(200)
,CAddr2 nvarchar(200)
,CCity nvarchar(200)
,CState nvarchar(200)
,CZipCode nvarchar(200)
,CphoneNumber  nvarchar(200))
insert into @ChurchData
SELECT CV.ChurchID
,YOUTUBE=isnull((select top 1 replace(note,'YOUTUBE:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'YOUTUBE:%'),(select top 1 replace(note,'YOUTUBE:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.FamilyLastFirst = 'ADMIN'
	and memberid is null
	and note like 'YOUTUBE:%'))
,WWW=isnull((select top 1 replace(note,'WWW:YES','')+c.Website  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	Join xrpt.churches_vw c on c.ChurchID=fn.ChurchID
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'WWW:%'),(select top 1 replace(note,'WWW:YES','')+c.Website  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	Join xrpt.churches_vw c on c.ChurchID=f.ChurchID
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.FamilyLastFirst = 'ADMIN'
	and memberid is null
	and note like 'WWW:%'))
,PIC='https://finance.catholicaoc.org/PIC-c'+convert(varchar(4),cv.ChurchID)+'.png'
,FACEBOOK=isnull((select top 1 replace(note,'FACEBOOK:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'FACEBOOK:%'),(select top 1 replace(note,'FACEBOOK:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.FamilyLastFirst = 'ADMIN'
	and memberid is null
	and note like 'FACEBOOK:%'))
,Logo=isnull((select top 1 replace(note,'LogoURL:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'LogoURL:%'),(select top 1 replace(note,'LogoURL:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.FamilyLastFirst = 'ADMIN'
	and memberid is null
	and note like 'LogoURL:%'))
,LogoOrientation=isnull((select top 1 replace(note,'LogoOrientation:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'Logo:%'),(select top 1 replace(note,'LogoOrientation:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.FamilyLastFirst = 'ADMIN'
	and memberid is null
	and note like 'LogoOrientation:%'))
,LetterTextP1=replace(replace(replace(replace(replace(replace(replace(replace(replace(replace((select top 1 replace(note,'TextP1:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'TextP1:%'),char(13),'&lt;br&gt;'),'/','&lt;br&gt;'),'~I','&lt;i&gt;'),'!I','&lt;/i&gt;'),'~B','&lt;b&gt;'),'!B','&lt;/b&gt;'),'~U','&lt;u&gt;'),'!U','&lt;/u&gt;'),'~C','&lt;p style="text-align:center"&gt;'),'!C','&lt;/p&gt;')
,LetterTextP2=replace(replace(replace(replace(replace(replace(replace(replace(replace(replace((select top 1 replace(note,'TextP2:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'TextP2:%'),char(13),'&lt;br&gt;'),'/','&lt;br&gt;'),'~I','&lt;i&gt;'),'!I','&lt;/i&gt;'),'~B','&lt;b&gt;'),'!B','&lt;/b&gt;'),'~U','&lt;u&gt;'),'!U','&lt;/u&gt;'),'~C','&lt;p style="text-align:center"&gt;'),'!C','&lt;/p&gt;')
,LetterSign=(select top 1 replace(note,'SIGN:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'Sign:%')
,LetterSignURL=(select top 1 replace(note,'SIGNURL:','')  from xrpt.FamilyNotes_vw fn
	join xrpt.families_vw f on f.familyid=fn.familyid and f.statuscode&lt;&gt;'DELETED'
	where fn.ChurchID =CV.ChurchID
	and fn.ContactType = 'Other'
	and fn.MemberLastFirst = 'Acknowledgement, '+@FForm
	and note like 'SignURL:%')
,replace(CV.ChurchName,' Parish','')  ChurchName
,CV.ChurchName +' , '+ CV.City  ChurchCity
,CV.Addr1 CAddr1
,isnull(CV.Addr2,'') CAddr2
,CV.City CCity
,CV.State CState
,CV.ZipCode CZipCode
,CV.PhoneNumber CPhoneNumber
from xrpt.churches_vw CV where Churchid = @ChurchID

declare @contribution table (cid int)
insert into @contribution
select distinct 
	fc.ContributionID
from xrpt.FundContributions_vw fc 
where fc.ChurchID= @ChurchID
and fc.ContributionDate &gt;= @DateFrom and fc.ContributionDate &lt; dateadd(dd,1,@DateTo)
and exists (select 1 from xrpt.ChurchUsers_vw cu 
	where fc.ChurchID = cu.ChurchID 
	and cu.UserName=@CurrentUser 
	and (cu.ChurchAdministrator = 1 or cu.FundManager = 1))
and (' All Statuses' in (@Statuses) 
	or exists (select 1 from xrpt.families_vw f
	where f.familyID=fc.FamilyID
		and f.StatusCode in (@Statuses)))
and (( 0 in (@Funds) and 0 in (@Buckets))
	or (0 in (@Funds) 
		and exists (select 1 from xrpt.funds_vw fd 
		where fd.ChurchID = fc.ChurchID
		and fd.FundID = fc.FundID
		and isnull(fd.AnnualContributionBucket,4) in (@Buckets)) )
	or fc.fundid in (@Funds))
and (Case when @LimitLow = 0 then case when isnull(fc.GrossAmount,0) = 0 then 1 else 0 end
 else case when fc.GrossAmount &gt;= @LimitLow  then 1 else 0 end end = 1 
or fc.Comment like '%{ack}%')

select FData.*,CV.*
,NewLetterTextP1=case when isnull(FDATA.GrossAmount,0) = 0 then 
replace(Replace(cv.LetterTextP1,'AMOUNT',FDATA.Reference),'COMMENT',isnull(' '+FDATA.mComment,''))
else 
replace(Replace(cv.LetterTextP1,'AMOUNT',FORMAT(FDATA.GrossAmount,'$#,#')),'COMMENT',isnull(' '+FDATA.mComment,''))
end
from 
(select  f.familyid
-- ,convert(int,case when replace(f.budgetnumber,' ','') like  '%[a-z]%' then 0 else replace(f.budgetnumber,' ','') end) BudgetNumber
,isnull(f.budgetnumber,'') BudgetNumber 
,F.HasEnvelopes
,f.BudgetNumberInactive
,convert(varchar(12),f.registrationdate ,101) RegistrationDate
--,RegisteredChurches = stuff((Select '~'+rc.ChurchName+'-'+c.City+'-'+rc.StatusCode+'-'+convert(varchar(10),RegistrationDate,101) 
--		from xrpt.families_vw rc
--		join xrpt.churches_vw c on rc.ChurchID=c.ChurchID 
--		where rc.FamilyID=f.FamilyID
--		and rc.churchid &lt;&gt; @ChurchID
--				 FOR XML PATH ('')), 1, 1, '') 
,f.IsRegistered
  , f.Salutation  
, f.MailName
 ,f.FirstName
  ,f.LastName
  ,case when @Address = 0 then ml.Addr1 else  f.Addr1 end Addr1
  ,isnull(case when @Address = 0 then ml.Addr2 else  f.Addr2 end, '') Addr2
  ,case when @Address = 0 then ml.City else  f.City end City
  ,case when @Address = 0 then ml.[State] else  f.[State] end [State]
  ,case when @Address = 0 then ml.ZipCode else  f.ZipCode end ZipCode
 -- ,F.PhoneNumber
 -- ,F.PhoneSmsAlerts
 -- ,F.PhoneVoiceAlerts
 -- ,F.PhoneUnlisted
  ,F.EmailAddress
  ,F.EmailAlerts 
 --,MemberEmails = isnull(STUFF((SELECT  ';' + isnull(m.EmailAddress,'')
--				FROM xrpt.Members_vw m
--				join xrpt.Families_vw f3 
--				on m.churchid = @ChurchID
--				and m.FamilyID = f3.FamilyID
--				WHERE  m.FamilyID = f.FamilyID
--				and isnull(m.EmailAddress,'') &lt;&gt;''
--				order by birthdate
--				 FOR XML PATH ('')
--				 ), 1, 1, '') ,'')
  ,F.StatusCode
-- ,F.StatusDate
-- ,F.Notes
--  ,Tags = isnull(STUFF((SELECT distinct '~' + isnull(t.TagName ,'')
--				FROM xrpt.FamilyTagMembers_vw t
--				join xrpt.Families_vw f2 
--				on t.churchid  = @ChurchID 
--				and t.FamilyID = f2.FamilyID
--				 WHERE  f2.FamilyID = f.FamilyID
--				 FOR XML PATH ('')), 1, 1, '') ,'')
--
,GiveTuesday=(select 1 from xrpt.fundcontributions_vw fct
		where fct.FamilyID= fc.FamilyID
		and fct.FundDescription like '%Tuesday%'
		and fct.ContributionDate &gt;= @DateFrom and fct.ContributionDate &lt; @DateTo)
	,fc.FundID
	--,fc.FundDescription
	,FundDescription = case when fc.FundDescription like '%{%}%' 
	then replace(fc.FundDescription,'{'+isnull(SUBSTRING(fc.FundDescription,CHARINDEX('{',fc.FundDescription)+1,(CHARINDEX('}',fc.FundDescription)-CHARINDEX('{',fc.FundDescription))-1),fc.FundDescription)+'}','') 
	else fc.FundDescription end
	,fc.BatchDescription
	,fc.ContributionDate
	,fc.EnteredBy
	,fc.EnteredDate
	,fc.Reference
	,fc.BatchID
	,isnull(fd.[AnnualContributionBucket],0) [AnnualContributionBucket]
	,mComment = isnull(', '+fc.comment,'')
	,Comment = case when fc.nondeductible = 1 then 'Non-Deductible ' + 
	case when isnull(fc.comment,'') = '' then '' else ' - ' end else '' end
	+case when isnull(fc.Comment,'') like '%{%}%' then 
isnull(replace(fc.Comment,'{'+isnull(SUBSTRING(fc.Comment,CHARINDEX('{',fc.Comment)+1,(CHARINDEX('}',fc.Comment)-CHARINDEX('{',fc.Comment))-1),fc.Comment)+'}','') ,'') 
else isnull(fc.comment,'') end
	,fc.NonDeductible
	,Deductible = Case when isnull(fc.NonDeductible,0) = 1 
		or isnull(fd.[AnnualContributionBucket],'1') = 2 then 0 else 1 end
	,fc.GrossAmount
	,GrossAmountDed =Case when isnull(fc.NonDeductible,0) = 1 
		or isnull(fd.[AnnualContributionBucket],'1') = 2 then 0 else fc.GrossAmount end
	,fc.NetAmount
	,NetAmountDed =Case when isnull(fc.NonDeductible,0) = 1 
		or isnull(fd.[AnnualContributionBucket],'1') = 2 then 0 else fc.NetAmount end
	,GrossAmountNonDed =Case when isnull(fc.NonDeductible,0) = 1 
		or isnull(fd.[AnnualContributionBucket],'1') = 2 then fc.GrossAmount else 0 end
	,NetAmountNonDed =Case when isnull(fc.NonDeductible,0) = 1 
		or isnull(fd.[AnnualContributionBucket],'1') = 2 then fc.NetAmount else 0 end
FROM xrpt.FundContributions_vw fc 
join xrpt.funds_vw fd 
	on fd.churchid=fc.churchid
	and fd.fundid=fc.fundid
join xrpt.MailingLabels_vw ml 
	on fc.familyID=ml.familyID
join xrpt.Churches_vw AS CV 
	on fc.ChurchID=CV.ChurchID
join xrpt.families_vw f
	on fc.ChurchID=f.ChurchID
	and fc.FamilyID=f.FamilyID 
join @contribution cx on cx.cid=fc.ContributionID
where (0 in (@Families) 
	or cx.cid in (@Families))) FDATA
cross join @ChurchData CV
order by fdata.LastName</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>
      <Fields>
        <Field Name="ChurchID">
          <DataField>ChurchID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Logo">
          <DataField>Logo</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LogoOrientation">
          <DataField>LogoOrientation</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LetterTextP1">
          <DataField>LetterTextP1</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LetterSign">
          <DataField>LetterSign</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LetterTextP2">
          <DataField>LetterTextP2</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="ChurchName">
          <DataField>ChurchName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LetterSignURL">
          <DataField>LetterSignURL</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="ChurchCity">
          <DataField>ChurchCity</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CAddr1">
          <DataField>CAddr1</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CAddr2">
          <DataField>CAddr2</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CCity">
          <DataField>CCity</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CZipCode">
          <DataField>CZipCode</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="CPhoneNumber">
          <DataField>CphoneNumber</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="familyid">
          <DataField>familyid</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="BudgetNumber">
          <DataField>BudgetNumber</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="HasEnvelopes">
          <DataField>HasEnvelopes</DataField>
          <rd:TypeName>System.Boolean</rd:TypeName>
        </Field>
        <Field Name="BudgetNumberInactive">
          <DataField>BudgetNumberInactive</DataField>
          <rd:TypeName>System.Boolean</rd:TypeName>
        </Field>
        <Field Name="RegistrationDate">
          <DataField>RegistrationDate</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="IsRegistered">
          <DataField>IsRegistered</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Salutation">
          <DataField>Salutation</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="MailName">
          <DataField>MailName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="FirstName">
          <DataField>FirstName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="LastName">
          <DataField>LastName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Addr1">
          <DataField>Addr1</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Addr2">
          <DataField>Addr2</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="City">
          <DataField>City</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="State">
          <DataField>State</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="ZipCode">
          <DataField>ZipCode</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="mComment">
          <DataField>mComment</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="EmailAddress">
          <DataField>EmailAddress</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="EmailAlerts">
          <DataField>EmailAlerts</DataField>
          <rd:TypeName>System.Boolean</rd:TypeName>
        </Field>
        <Field Name="StatusCode">
          <DataField>StatusCode</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="GiveTuesday">
          <DataField>GiveTuesday</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="FundID">
          <DataField>FundID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="FundDescription">
          <DataField>FundDescription</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="BatchDescription">
          <DataField>BatchDescription</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="ContributionDate">
          <DataField>ContributionDate</DataField>
          <rd:TypeName>System.DateTime</rd:TypeName>
        </Field>
        <Field Name="EnteredBy">
          <DataField>EnteredBy</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="YOUTUBE">
          <DataField>YOUTUBE</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="EnteredDate">
          <DataField>EnteredDate</DataField>
          <rd:TypeName>System.DateTime</rd:TypeName>
        </Field>
        <Field Name="PIC">
          <DataField>PIC</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Reference">
          <DataField>Reference</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="WWW">
          <DataField>WWW</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="BatchID">
          <DataField>BatchID</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="FACEBOOK">
          <DataField>FACEBOOK</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="AnnualContributionBucket">
          <DataField>AnnualContributionBucket</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Comment">
          <DataField>Comment</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="NonDeductible">
          <DataField>NonDeductible</DataField>
          <rd:TypeName>System.Boolean</rd:TypeName>
        </Field>
        <Field Name="Deductible">
          <DataField>Deductible</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="GrossAmount">
          <DataField>GrossAmount</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="GrossAmountDed">
          <DataField>GrossAmountDed</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="NetAmount">
          <DataField>NetAmount</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="NetAmountDed">
          <DataField>NetAmountDed</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="CState">
          <DataField>CState</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="GrossAmountNonDed">
          <DataField>GrossAmountNonDed</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="NetAmountNonDed">
          <DataField>NetAmountNonDed</DataField>
          <rd:TypeName>System.Decimal</rd:TypeName>
        </Field>
        <Field Name="NewLetterTextP1">
          <DataField>NewLetterTextP1</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <ReportSections>
    <ReportSection>
      <Body>
        <ReportItems>
          <Tablix Name="Tablix3">
            <TablixBody>
              <TablixColumns>
                <TablixColumn>
                  <Width>5.5in</Width>
                </TablixColumn>
              </TablixColumns>
              <TablixRows>
                <TablixRow>
                  <Height>3.78347in</Height>
                  <TablixCells>
                    <TablixCell>
                      <CellContents>
                        <Rectangle Name="RepeatingValue">
                          <ReportItems>
                            <Textbox Name="Letter">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>="Dear " &amp; iif(Parameters!Greeting.Value=1,Fields!FirstName.Value,iif(Fields!Salutation.Value="",Fields!MailName.Value,Fields!Salutation.Value)) &amp; "," 
&amp; "&lt;br&gt;&lt;br&gt;" &amp; Fields!NewLetterTextP1.Value</Value>
                                      <MarkupType>HTML</MarkupType>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                        <FontSize>=Parameters!FontSize.Value</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <Top>1.37137in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.28086in</Height>
                              <Width>5.18753in</Width>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="Letter2">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=Fields!LetterTextP2.Value</Value>
                                      <MarkupType>HTML</MarkupType>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                        <FontSize>=Parameters!FontSize.Value</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <Top>1.65223in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.30866in</Height>
                              <Width>5.18753in</Width>
                              <ZIndex>1</ZIndex>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="Letter3">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=Fields!LetterSign.Value</Value>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                        <FontSize>=Parameters!FontSize.Value</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <Top>2.54449in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.24353in</Height>
                              <Width>5.18753in</Width>
                              <ZIndex>2</ZIndex>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="Textbox6">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=replace(Fields!ChurchName.Value," Parish","") &amp; " Parish has not provided, in whole or in part, any goods or services to the above-named donor in exchange for this gift.  " &amp;
replace(Fields!ChurchName.Value," Parish","") &amp; " Parish is recognized as a tax-exempt organization under section 501(c)(3) of the Internal Revenue Code. Contributions to organizations with 501(c)(3) status may be tax deductible. Please consult your tax advisor to determine deductibility of this contribution. This letter is your receipt for income tax purposes. "</Value>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                        <FontSize>8pt</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style>
                                    <TextAlign>Center</TextAlign>
                                  </Style>
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>Textbox6</rd:DefaultName>
                              <Top>2.88525in</Top>
                              <Left>0.1215in</Left>
                              <Height>0.14583in</Height>
                              <Width>5.18753in</Width>
                              <ZIndex>3</ZIndex>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Image Name="Signature">
                              <Source>External</Source>
                              <Value>=Fields!LetterSignURL.Value</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>2.03033in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.44472in</Height>
                              <Width>2.52893in</Width>
                              <ZIndex>4</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Fields!LetterSignURL.Value="",True,False)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Textbox Name="ChurchRight">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=chr(10) 
&amp; iif(Parameters!FO.Value=1,"",trim(replace(Fields!ChurchName.Value,"Parish","")) &amp; " Parish" 
&amp; chr(10) &amp; Fields!CAddr1.Value 
&amp; chr(10) &amp; Fields!CCity.Value &amp; ", " &amp; Fields!CState.Value &amp; " " &amp; Fields!CZipCode.Value)</Value>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style>
                                    <TextAlign>Right</TextAlign>
                                  </Style>
                                </Paragraph>
                              </Paragraphs>
                              <Top>0.76631in</Top>
                              <Left>3.26736in</Left>
                              <Height>0.53562in</Height>
                              <Width>2.04167in</Width>
                              <ZIndex>5</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Fields!LogoOrientation.Value="WIDE",False,True)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="FamilyID">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=Format(Parameters!Date.Value, "MMMM dd,yyyy") 
&amp; chr(10) &amp; chr(10) 
&amp; iif(Parameters!AddressCase.Value=1 , strconv(IIf(Fields!MailName.Value="",Fields!FirstName.Value &amp; " " &amp; Fields!LastName.Value,Fields!MailName.Value) &amp;chr(10) 
&amp; Fields!Addr1.Value &amp; chr(10) &amp; iif(Fields!Addr2.Value="","",Fields!Addr2.Value &amp; chr(10))  
&amp; Fields!City.Value &amp; ", " &amp; Fields!State.Value &amp; " " &amp; Fields!ZipCode.Value,1) , 

iif(Parameters!AddressCase.Value=2 , strconv(IIf(Fields!MailName.Value="",Fields!FirstName.Value &amp; " " &amp; Fields!LastName.Value,Fields!MailName.Value) &amp;chr(10) 
&amp; Fields!Addr1.Value &amp; chr(10) &amp; iif(Fields!Addr2.Value="","",Fields!Addr2.Value &amp; chr(10)) 
&amp; Fields!City.Value &amp; ", " &amp; Fields!State.Value &amp; " " &amp; Fields!ZipCode.Value,3) , 

IIf(Fields!MailName.Value="",Fields!FirstName.Value &amp; " " &amp; Fields!LastName.Value,Fields!MailName.Value) &amp;chr(10) 
&amp; Fields!Addr1.Value &amp; chr(10) &amp; iif(Fields!Addr2.Value="","",Fields!Addr2.Value &amp; chr(10)) 
&amp; Fields!City.Value &amp; ", " &amp; Fields!State.Value &amp; " " &amp; Fields!ZipCode.Value ))</Value>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>FamilyID</rd:DefaultName>
                              <Top>0.76631in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.53562in</Height>
                              <Width>3.00351in</Width>
                              <ZIndex>6</ZIndex>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Image Name="LogoSquare">
                              <Source>External</Source>
                              <Value>=Fields!Logo.Value</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>0.14443in</Top>
                              <Left>4.05902in</Left>
                              <Height>1.15749in</Height>
                              <Width>1.25in</Width>
                              <ZIndex>7</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Fields!LogoOrientation.Value="WIDE",True,False)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Image Name="LogoWide">
                              <Source>External</Source>
                              <Value>=Fields!Logo.Value</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>0.10277in</Top>
                              <Left>0.85066in</Left>
                              <Height>0.59409in</Height>
                              <Width>3.89375in</Width>
                              <ZIndex>8</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Fields!LogoOrientation.Value="WIDE",False,True)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Textbox Name="ChurchTop">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=iif(Parameters!FO.Value=1,chr(10)&amp;chr(10)&amp;chr(10), trim(replace(Fields!ChurchName.Value,"Parish","")) &amp; " Parish" 
&amp; chr(10) &amp; Fields!CAddr1.Value 
&amp; chr(10) &amp; Fields!CCity.Value &amp; ", " &amp; Fields!CState.Value &amp; " " &amp; Fields!CZipCode.Value)</Value>
                                      <Style>
                                        <FontFamily>=Parameters!Font.Value</FontFamily>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style>
                                    <TextAlign>Left</TextAlign>
                                  </Style>
                                </Paragraph>
                              </Paragraphs>
                              <Top>0.14443in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.44826in</Height>
                              <Width>3.00351in</Width>
                              <ZIndex>9</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Fields!LogoOrientation.Value="WIDE",True,False)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="EmailAddress">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>="EMAIL:" &amp; iif(str(Fields!EmailAlerts.Value)=TRUE, Fields!EmailAddress.Value,"")</Value>
                                      <Style>
                                        <FontSize>8pt</FontSize>
                                        <Color>White</Color>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>EmailAddress</rd:DefaultName>
                              <Left>0.12149in</Left>
                              <Height>0.07499in</Height>
                              <Width>3.125in</Width>
                              <ZIndex>10</ZIndex>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Image Name="web">
                              <Source>External</Source>
                              <Value>=Fields!PIC.Value</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>3.07275in</Top>
                              <Left>0.12149in</Left>
                              <Height>0.43642in</Height>
                              <Width>0.37028in</Width>
                              <ZIndex>11</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Image Name="FACEBOOK">
                              <Source>External</Source>
                              <Value>https://finance.catholicaoc.org/FACEBOOK.png</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>3.07275in</Top>
                              <Left>1.82858in</Left>
                              <Height>0.43642in</Height>
                              <Width>0.46875in</Width>
                              <ZIndex>12</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Image Name="YOUTUBE">
                              <Source>External</Source>
                              <Value>https://finance.catholicaoc.org/YOUTUBE.png</Value>
                              <Sizing>FitProportional</Sizing>
                              <Top>3.05886in</Top>
                              <Left>3.81816in</Left>
                              <Height>0.43642in</Height>
                              <Width>0.375in</Width>
                              <ZIndex>13</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                              </Style>
                            </Image>
                            <Textbox Name="WWW2">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=First(Fields!FACEBOOK.Value)</Value>
                                      <Style>
                                        <FontSize>8pt</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>WWW</rd:DefaultName>
                              <Top>3.52306in</Top>
                              <Left>1.82858in</Left>
                              <Height>0.20485in</Height>
                              <Width>1.92013in</Width>
                              <ZIndex>14</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="WWW3">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=First(Fields!YOUTUBE.Value)</Value>
                                      <Style>
                                        <FontSize>8pt</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>WWW</rd:DefaultName>
                              <Top>3.52306in</Top>
                              <Left>3.81816in</Left>
                              <Height>0.20485in</Height>
                              <Width>1.49086in</Width>
                              <ZIndex>15</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                            <Textbox Name="WWW">
                              <CanGrow>true</CanGrow>
                              <KeepTogether>true</KeepTogether>
                              <Paragraphs>
                                <Paragraph>
                                  <TextRuns>
                                    <TextRun>
                                      <Value>=Fields!WWW.Value</Value>
                                      <Style>
                                        <FontSize>8pt</FontSize>
                                      </Style>
                                    </TextRun>
                                  </TextRuns>
                                  <Style />
                                </Paragraph>
                              </Paragraphs>
                              <rd:DefaultName>WWW</rd:DefaultName>
                              <Top>3.53347in</Top>
                              <Left>0.1215in</Left>
                              <Height>0.19444in</Height>
                              <Width>1.63764in</Width>
                              <ZIndex>16</ZIndex>
                              <Visibility>
                                <Hidden>=iif(Parameters!Social.Value=1,true,false)</Hidden>
                              </Visibility>
                              <Style>
                                <Border>
                                  <Style>None</Style>
                                </Border>
                                <PaddingLeft>2pt</PaddingLeft>
                                <PaddingRight>2pt</PaddingRight>
                                <PaddingTop>2pt</PaddingTop>
                                <PaddingBottom>2pt</PaddingBottom>
                              </Style>
                            </Textbox>
                          </ReportItems>
                          <KeepTogether>true</KeepTogether>
                          <Style>
                            <Border>
                              <Style>None</Style>
                            </Border>
                          </Style>
                        </Rectangle>
                      </CellContents>
                    </TablixCell>
                  </TablixCells>
                </TablixRow>
              </TablixRows>
            </TablixBody>
            <TablixColumnHierarchy>
              <TablixMembers>
                <TablixMember />
              </TablixMembers>
            </TablixColumnHierarchy>
            <TablixRowHierarchy>
              <TablixMembers>
                <TablixMember>
                  <Group Name="Details1">
                    <GroupExpressions>
                      <GroupExpression>=Fields!NewLetterTextP1.Value</GroupExpression>
                    </GroupExpressions>
                    <PageBreak>
                      <BreakLocation>Between</BreakLocation>
                    </PageBreak>
                  </Group>
                  <SortExpressions>
                    <SortExpression>
                      <Value>=iif(Parameters!Sort.Value=0,Fields!LastName.Value,Fields!ZipCode.Value+Fields!LastName.Value)</Value>
                    </SortExpression>
                  </SortExpressions>
                </TablixMember>
              </TablixMembers>
            </TablixRowHierarchy>
            <DataSetName>Details</DataSetName>
            <Height>3.78347in</Height>
            <Width>5.5in</Width>
            <Style>
              <Border>
                <Style>None</Style>
              </Border>
            </Style>
          </Tablix>
        </ReportItems>
        <Height>3.78347in</Height>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
        </Style>
      </Body>
      <Width>5.5in</Width>
      <Page>
        <PageHeight>8.5in</PageHeight>
        <PageWidth>5.5in</PageWidth>
        <LeftMargin>0.1in</LeftMargin>
        <RightMargin>0.1in</RightMargin>
        <TopMargin>0.1in</TopMargin>
        <BottomMargin>0.1in</BottomMargin>
        <Style />
      </Page>
    </ReportSection>
  </ReportSections>
  <ReportParameters>
    <ReportParameter Name="CurrentUser">
      <DataType>String</DataType>
      <DefaultValue>
        <Values>
          <Value>=User!UserID</Value>
        </Values>
      </DefaultValue>
      <Prompt>Current User</Prompt>
      <Hidden>true</Hidden>
    </ReportParameter>
    <ReportParameter Name="ChurchID">
      <DataType>Integer</DataType>
      <Prompt>Church</Prompt>
      <ValidValues>
        <DataSetReference>
          <DataSetName>MyChurches</DataSetName>
          <ValueField>ChurchID</ValueField>
          <LabelField>ChurchName</LabelField>
        </DataSetReference>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="FForm">
      <DataType>String</DataType>
      <Prompt>Form</Prompt>
      <ValidValues>
        <DataSetReference>
          <DataSetName>Forms</DataSetName>
          <ValueField>LetterForm</ValueField>
          <LabelField>LetterForm</LabelField>
        </DataSetReference>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Statuses">
      <DataType>String</DataType>
      <Prompt>Select Family Status</Prompt>
      <ValidValues>
        <DataSetReference>
          <DataSetName>Statuses</DataSetName>
          <ValueField>StatusCode</ValueField>
          <LabelField>StatusCode</LabelField>
        </DataSetReference>
      </ValidValues>
      <MultiValue>true</MultiValue>
    </ReportParameter>
    <ReportParameter Name="DateFrom">
      <DataType>DateTime</DataType>
      <Prompt>Begin Date</Prompt>
    </ReportParameter>
    <ReportParameter Name="DateTo">
      <DataType>DateTime</DataType>
      <Prompt>End Date</Prompt>
    </ReportParameter>
    <ReportParameter Name="Buckets">
      <DataType>Integer</DataType>
      <Prompt>Select Buckets</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>All Buckets</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>Bucket 1</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>2</Value>
            <Label>Bucket 2</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>3</Value>
            <Label>Bucket 3</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
      <MultiValue>true</MultiValue>
    </ReportParameter>
    <ReportParameter Name="Funds">
      <DataType>Integer</DataType>
      <Prompt>Select Funds</Prompt>
      <ValidValues>
        <DataSetReference>
          <DataSetName>MyFunds</DataSetName>
          <ValueField>FundID</ValueField>
          <LabelField>FundDescription</LabelField>
        </DataSetReference>
      </ValidValues>
      <MultiValue>true</MultiValue>
    </ReportParameter>
    <ReportParameter Name="LimitLow">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>250</Value>
        </Values>
      </DefaultValue>
      <Prompt>Limit Low</Prompt>
    </ReportParameter>
    <ReportParameter Name="Families">
      <DataType>Integer</DataType>
      <Prompt>Families</Prompt>
      <ValidValues>
        <DataSetReference>
          <DataSetName>MyFamilies</DataSetName>
          <ValueField>ContributionID</ValueField>
          <LabelField>Items</LabelField>
        </DataSetReference>
      </ValidValues>
      <MultiValue>true</MultiValue>
    </ReportParameter>
    <ReportParameter Name="Greeting">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>0</Value>
        </Values>
      </DefaultValue>
      <Prompt>Greeting</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>Use Family Salutation</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>User Family First Name</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Date">
      <DataType>DateTime</DataType>
      <DefaultValue>
        <Values>
          <Value>=Today()</Value>
        </Values>
      </DefaultValue>
      <Prompt>Date</Prompt>
    </ReportParameter>
    <ReportParameter Name="Address">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>0</Value>
        </Values>
      </DefaultValue>
      <Prompt>Address to use</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>Mailing Address</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>Street Address</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="AddressCase">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>0</Value>
        </Values>
      </DefaultValue>
      <Prompt>Address Format</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>Current Data Format</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>Upper Case (USPS)</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>2</Value>
            <Label>Proper Case (mixed)</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="FO">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>1</Value>
        </Values>
      </DefaultValue>
      <Prompt>Format Options</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>1</Value>
            <Label>Suppress Return Address</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>0</Value>
            <Label>Display Return Address</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Sort">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>0</Value>
        </Values>
      </DefaultValue>
      <Prompt>Select Sort Order</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>Last Name</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>Zip Code / Last Name</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Font">
      <DataType>String</DataType>
      <DefaultValue>
        <Values>
          <Value>Arial</Value>
        </Values>
      </DefaultValue>
      <Prompt>Select Font</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>Arial</Value>
            <Label>Arial</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Calibri</Value>
            <Label>Calibri</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Century</Value>
            <Label>Century</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Comic Sans MS</Value>
            <Label>Comic Sans MS</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Lucida Sans</Value>
            <Label>Lucida Sans</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Georgia</Value>
            <Label>Georgia</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Tahoma</Value>
            <Label>Tahoma</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Times New Roman</Value>
            <Label>Times New Roman</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>Verdana</Value>
            <Label>Verdana</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="FontSize">
      <DataType>String</DataType>
      <DefaultValue>
        <Values>
          <Value>11pt</Value>
        </Values>
      </DefaultValue>
      <Prompt>Select Font Size</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>11pt</Value>
            <Label>11 Point</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>10pt</Value>
            <Label>10 Point</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>8pt</Value>
            <Label>8 point</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Social">
      <DataType>Integer</DataType>
      <DefaultValue>
        <Values>
          <Value>0</Value>
        </Values>
      </DefaultValue>
      <Prompt>Display Social Media?</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>0</Value>
            <Label>Yes</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1</Value>
            <Label>No</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
  </ReportParameters>
  <ReportParametersLayout>
    <GridLayoutDefinition>
      <NumberOfColumns>3</NumberOfColumns>
      <NumberOfRows>7</NumberOfRows>
      <CellDefinitions>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>0</RowIndex>
          <ParameterName>CurrentUser</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>0</RowIndex>
          <ParameterName>ChurchID</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>0</RowIndex>
          <ParameterName>FForm</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>1</RowIndex>
          <ParameterName>Statuses</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>1</RowIndex>
          <ParameterName>DateFrom</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>1</RowIndex>
          <ParameterName>DateTo</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>2</RowIndex>
          <ParameterName>Buckets</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>2</RowIndex>
          <ParameterName>Funds</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>2</RowIndex>
          <ParameterName>LimitLow</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>3</RowIndex>
          <ParameterName>Families</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>3</RowIndex>
          <ParameterName>Greeting</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>3</RowIndex>
          <ParameterName>Date</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>4</RowIndex>
          <ParameterName>Address</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>4</RowIndex>
          <ParameterName>AddressCase</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>4</RowIndex>
          <ParameterName>FO</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>5</RowIndex>
          <ParameterName>Sort</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>1</ColumnIndex>
          <RowIndex>5</RowIndex>
          <ParameterName>Font</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>2</ColumnIndex>
          <RowIndex>5</RowIndex>
          <ParameterName>FontSize</ParameterName>
        </CellDefinition>
        <CellDefinition>
          <ColumnIndex>0</ColumnIndex>
          <RowIndex>6</RowIndex>
          <ParameterName>Social</ParameterName>
        </CellDefinition>
      </CellDefinitions>
    </GridLayoutDefinition>
  </ReportParametersLayout>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>72829793-6244-472b-b4c1-dd9b28fc0ea1</rd:ReportID>
</Report>