Contribution Statement with Start and End Month Page Parameters

Créé Le diff n'expire jamais
5 suppressions
202 lignes
29 ajouts
226 lignes
// <copyright>
// <copyright>
// Copyright by the Spark Development Network
// Copyright by the Spark Development Network
//
//
// Licensed under the Rock Community License (the "License");
// Licensed under the Rock Community License (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.rockrms.com/license
// http://www.rockrms.com/license
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
// </copyright>
// </copyright>
using System;
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Linq;
using System.Linq;
using System.Net;
using System.Net;
using System.Web.UI;
using System.Web.UI;


using Rock;
using Rock;
using Rock.Attribute;
using Rock.Attribute;
using Rock.Data;
using Rock.Data;
using Rock.Financial;
using Rock.Financial;
using Rock.Model;
using Rock.Model;
using Rock.Web.UI;
using Rock.Web.UI;


namespace RockWeb.Blocks.Finance
namespace RockWeb.Blocks.Finance
{
{
/// <summary>
/// <summary>
/// </summary>
/// </summary>
[DisplayName( "Contribution Statement Generator" )]
[DisplayName( "Contribution Statement Generator" )]
[Category( "Finance" )]
[Category( "Finance" )]
[Description( "Block for generating a Contribution Statement" )]
[Description( "Block for generating a Contribution Statement" )]




[BooleanField(
[BooleanField(
"Allow Person QueryString",
"Allow Person QueryString",
Key = AttributeKey.AllowPersonQueryString,
Key = AttributeKey.AllowPersonQueryString,
Description = "Determines if any person other than the currently logged in person is allowed to be passed through the query string. For security reasons this is not allowed by default.",
Description = "Determines if any person other than the currently logged in person is allowed to be passed through the query string. For security reasons this is not allowed by default.",
DefaultBooleanValue = false,
DefaultBooleanValue = false,
Order = 0 )]
Order = 0 )]


[FinancialStatementTemplateField(
[FinancialStatementTemplateField(
"Statement Template",
"Statement Template",
Key = AttributeKey.FinancialStatementTemplate,
Key = AttributeKey.FinancialStatementTemplate,
DefaultValue = Rock.SystemGuid.FinancialStatementTemplate.ROCK_DEFAULT,
DefaultValue = Rock.SystemGuid.FinancialStatementTemplate.ROCK_DEFAULT,
Order = 1 )]
Order = 1 )]


[Rock.SystemGuid.BlockTypeGuid( "E0A699C3-61AA-4522-9067-1FE56FA80972" )]
[Rock.SystemGuid.BlockTypeGuid( "E0A699C3-61AA-4522-9067-1FE56FA80972" )]
public partial class ContributionStatementGenerator : RockBlock
public partial class ContributionStatementGenerator : RockBlock
{
{
#region Attribute Keys
#region Attribute Keys


private static class AttributeKey
private static class AttributeKey
{
{
public const string FinancialStatementTemplate = "FinancialStatementTemplate";
public const string FinancialStatementTemplate = "FinancialStatementTemplate";
public const string AllowPersonQueryString = "AllowPersonQueryString";
public const string AllowPersonQueryString = "AllowPersonQueryString";
}
}


#endregion Attribute Keys
#endregion Attribute Keys


#region PageParameterKeys
#region PageParameterKeys


private static class PageParameterKey
private static class PageParameterKey
{
{
public const string StatementYear = "StatementYear";
public const string StatementYear = "StatementYear";
public const string StatementStartMonth = "StatementStartMonth";
public const string StatementEndMonth = "StatementEndMonth";
public const string StatementEndMonth = "StatementEndMonth";
public const string PersonActionIdentifier = "rckid";
public const string PersonActionIdentifier = "rckid";
public const string PersonGuid = "PersonGuid";
public const string PersonGuid = "PersonGuid";
}
}


#endregion PageParameterKeys
#endregion PageParameterKeys


#region Events
#region Events


/// <summary>
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
/// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
/// </summary>
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
/// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnInit( EventArgs e )
protected override void OnInit( EventArgs e )
{
{
base.OnInit( e );
base.OnInit( e );


// this event gets fired after block settings are updated. it's nice to repaint the screen if these settings would alter it
// this event gets fired after block settings are updated. it's nice to repaint the screen if these settings would alter it
this.BlockUpdated += Block_BlockUpdated;
this.BlockUpdated += Block_BlockUpdated;
}
}


/// <summary>
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
/// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
/// </summary>
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
/// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnLoad( EventArgs e )
protected override void OnLoad( EventArgs e )
{
{
base.OnLoad( e );
base.OnLoad( e );


if ( !Page.IsPostBack )
if ( !Page.IsPostBack )
{
{