﻿<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" DoublePass="true" FinishReportEvent="_FinishReport" ReportInfo.Created="12/28/2013 11:07:54" ReportInfo.Modified="06/23/2015 14:37:02" ReportInfo.CreatorVersion="1.6.57.0">
  <ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;

namespace FastReport
{
  public class ReportScript
  {

    

    private void Form1_Shown(object sender, EventArgs e)
    {
      if (ComboBox2.Items.Count == 0)
      {
        ComboBox1.Items.Add(&quot;No clients owing&quot;);
        ComboBox1.Text = &quot;No clients owing&quot;;
      }
      
      dtpFromDate.Value = System.DateTime.Now;
      dtpToDate.Value = System.DateTime.Now;
    }

    private void chkIncludeTrans_Click(object sender, EventArgs e)
    {
      if (chkIncludeTrans.Checked)
      {
        Form1.Height = 375;
        lblFromDate.Visible = true;
        dtpFromDate.Visible = true;
        lblToDate.Visible = true;
        dtpToDate.Visible = true;
      }
      else
      {
        Form1.Height = 275;
        lblFromDate.Visible = false;
        dtpFromDate.Visible = false;
        lblToDate.Visible = false;
        dtpToDate.Visible = false;
      }
        
    }

    private void btnOk_Click(object sender, EventArgs e)
    {
      
      
      
      TableDataSource tStatement = Report.GetDataSource(&quot;statement&quot;) as TableDataSource;
      //The default strings
      string selectCreditSales = &quot;((TotalIncl - (TotalPaid + TotalCrNotesIncl) &lt;&gt; 0) OR DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'))&quot;;
      string selectReceiptsAndNotes = &quot;DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')&quot;;
      string selectJournals = &quot;((ABS(Amount) - ABS(TotalPaid) &lt;&gt; 0) OR (DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')))&quot;;
      
      //Override the default strings
      if (chkIncludeTrans.Checked)
      { 
        Report.SetParameterValue(&quot;FromDate&quot;, dtpFromDate.Value.ToString(&quot;yyyy-MM-dd&quot;));
        Report.SetParameterValue(&quot;ToDate&quot;, dtpToDate.Value.ToString(&quot;yyyy-MM-dd&quot;));
        
        selectCreditSales = &quot;((TotalIncl - (TotalPaid + TotalCrNotesIncl) &lt;&gt; 0) OR DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m') OR (DATE_FORMAT(`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d')))&quot;; 
        selectReceiptsAndNotes = &quot;(DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m') OR (DATE_FORMAT(`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d')))&quot;;
        selectJournals = &quot;(((ABS(Amount) - ABS(TotalPaid) &lt;&gt; 0) OR (DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'))) OR (DATE_FORMAT(`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d')))&quot;;
      }      
      
      //Apply the selection strings
      tStatement.SelectCommand = tStatement.SelectCommand.ToString().Replace(&quot;@SelectCreditSales&quot;, selectCreditSales);
      tStatement.SelectCommand = tStatement.SelectCommand.ToString().Replace(&quot;@SelectReceiptsAndNotes&quot;, selectReceiptsAndNotes);
      tStatement.SelectCommand = tStatement.SelectCommand.ToString().Replace(&quot;@SelectJournals&quot;, selectJournals);
      
      
      
    }

    private void _FinishReport(object sender, EventArgs e)
    {
      //Add the client's email to the report settings
      string[] names = new string[1] {Report.GetColumnValue(&quot;SelClient.Email&quot;).ToString()};
      Report.EmailSettings.Recipients = names;
      Report.EmailSettings.Subject = string.Format(&quot;Statement from - {0}&quot;, Report.GetColumnValue(&quot;companies.Name&quot;).ToString());
      
    }
  }
}
</ScriptText>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqmUGi0DHzhik04BO5+uxHPNJg6XdWlo9sfl3oNLbLcC5ELgVy3yM4U7/vviW/yU/VlCYnkUjA+BNt9VEI/Ru/Vow9j4CVvocTU7qd7D1WjNg=">
      <TableDataSource Name="clients" DataType="System.Int32" Enabled="true" TableName="clients" SelectCommand="SELECT * FROM clients &#13;&#10;WHERE CompanyID = @CompanyID AND (TotalDue &lt;&gt; 0  OR DATE_FORMAT(`LastAccountTransDate`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')) &#13;&#10;ORDER BY Name&#13;&#10;">
        <Column Name="ID" DataType="System.UInt32"/>
        <Column Name="Name" DataType="System.String"/>
        <Column Name="Email" Enabled="false" DataType="System.String"/>
        <Column Name="BillingAddress" DataType="System.String"/>
        <Column Name="ContactNo" DataType="System.String"/>
        <Column Name="TotalDue" DataType="System.Decimal"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="LastAccountInvoiceDate" DataType="System.DateTime"/>
        <Column Name="LastCreditNoteDate" DataType="System.DateTime"/>
        <Column Name="LastReceiptDate" DataType="System.DateTime"/>
        <Column Name="LastJournalDate" DataType="System.DateTime"/>
        <Column Name="LastAccountTransDate" DataType="System.DateTime"/>
        <Column Name="LastCashTransDate" DataType="System.DateTime"/>
        <Column Name="LastCashInvoiceDate" DataType="System.DateTime"/>
        <Column Name="LastCashRefundDate" DataType="System.DateTime"/>
        <Column Name="ClientID" DataType="System.UInt32"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="companies" DataType="System.Int32" Enabled="true" TableName="companies" SelectCommand="SELECT * FROM companies WHERE ID = @CompanyID">
        <Column Name="ID" DataType="System.UInt32"/>
        <Column Name="Name" DataType="System.String"/>
        <Column Name="Email" DataType="System.String"/>
        <Column Name="Address" DataType="System.String"/>
        <Column Name="RegNo" DataType="System.String"/>
        <Column Name="VATno" DataType="System.String"/>
        <Column Name="ContactNo" DataType="System.String"/>
        <Column Name="AltNo" DataType="System.String"/>
        <Column Name="FaxNo" DataType="System.String"/>
        <Column Name="CellNo" DataType="System.String"/>
        <Column Name="LogoPath" DataType="System.String"/>
        <Column Name="InvoiceStyleNo" DataType="System.String"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table" Alias="statement" DataType="System.Int32" Enabled="true" SelectCommand="DROP TEMPORARY TABLE IF EXISTS debtor_statement; &#13;&#10;CREATE TEMPORARY TABLE debtor_statement (&#13;&#10;TransDate date NOT NULL default '2000-01-01',&#13;&#10;StatementNote VARCHAR(150) NOT NULL,&#13;&#10;TransTotalIncl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TransID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;ClientID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;CompanyID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;TotalPaid DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;ReceiptNo VARCHAR(150) NOT NULL,&#13;&#10;TotalCrNotesIncl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;CrNoteNo VARCHAR(150) NOT NULL,&#13;&#10;TotalDue DECIMAL(10,2) NOT NULL DEFAULT 0.00);&#13;&#10;INSERT INTO debtor_statement (TransDate, StatementNote, TransTotalIncl, TransID, ClientID, CompanyID, TotalPaid, ReceiptNo, TotalCrNotesIncl, CrNoteNo, TotalDue) &#13;&#10;SELECT `Date`, StatementNote, TotalIncl, TransID, ClientID, CompanyID, TotalPaid*-1, RelReceiptIDs, TotalCrNotesIncl*-1, RelCrNoteIDs, TotalIncl - TotalPaid - TotalCrNotesIncl AS TotalDue FROM credit_sales &#13;&#10;WHERE  (CompanyID = @CompanyID) AND (ClientID = @ClientID) AND @SelectCreditSales;&#13;&#10;INSERT INTO debtor_statement (TransDate, StatementNote, TransTotalIncl, TransID, ClientID, CompanyID) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, AmountPaid, TransID, ClientID, CompanyID FROM receipts &#13;&#10;WHERE (CompanyID = @CompanyID) AND (ClientID = @ClientID) AND IsForAccount = 1 AND @SelectReceiptsAndNotes;&#13;&#10;INSERT INTO debtor_statement (TransDate, StatementNote, TransTotalIncl, TransID, ClientID, CompanyID) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, TotalIncl, TransID, ClientID, CompanyID FROM credit_notes &#13;&#10;WHERE (CompanyID = @CompanyID) AND (ClientID = @ClientID) AND @SelectReceiptsAndNotes;&#13;&#10;INSERT INTO debtor_statement (TransDate, StatementNote, TransTotalIncl, TransID, ClientID, CompanyID, TotalPaid, TotalDue, ReceiptNo) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, Amount, TransID, ClientID, CompanyID,  TotalPaid*-1, Amount - TotalPaid AS TotalDue, RelReceiptIDs FROM debtor_journals &#13;&#10;WHERE (CompanyID = @CompanyID) AND (ClientID = @ClientID) AND @SelectJournals;&#13;&#10;SELECT * FROM debtor_statement WHERE LEFT(StatementNote, 3) = 'INV' OR  LEFT(StatementNote, 3) = 'JNL' &#13;&#10;ORDER BY DATE_FORMAT(TransDate,'%Y-%m-%d'), TransID;">
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="StatementNote" DataType="System.String"/>
        <Column Name="TransTotalIncl" DataType="System.Decimal"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="ClientID" DataType="System.UInt32"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="TotalPaid" DataType="System.Decimal"/>
        <Column Name="ReceiptNo" DataType="System.String"/>
        <Column Name="TotalCrNotesIncl" DataType="System.Decimal"/>
        <Column Name="CrNoteNo" DataType="System.String"/>
        <Column Name="TotalDue" DataType="System.Decimal"/>
        <CommandParameter Name="clientID" DataType="254" Expression="[ClientID]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="SelectCreditSales" DataType="254"/>
        <CommandParameter Name="SelectReceiptsAndNotes" DataType="254"/>
        <CommandParameter Name="SelectJournals" DataType="254"/>
        <CommandParameter Name="FromDate" DataType="254" Expression="[FromDate]"/>
        <CommandParameter Name="ToDate" DataType="254" Expression="[ToDate]"/>
      </TableDataSource>
      <TableDataSource Name="Table1" Alias="CreditNotes" DataType="System.Int32" Enabled="true" SelectCommand="SELECT TransDate, StatementNote, TransID, TransTotalIncl FROM debtor_statement WHERE LEFT(StatementNote, 2) = 'CN'  &#13;&#10;ORDER BY TransDate, TransID;">
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="StatementNote" DataType="System.String"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="TransTotalIncl" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table2" Alias="Receipts" DataType="System.Int32" Enabled="true" SelectCommand="SELECT TransDate, StatementNote, TransID, TransTotalIncl &#13;&#10;FROM debtor_statement &#13;&#10;WHERE LEFT(StatementNote, 4) = 'RCPT' &#13;&#10;ORDER BY TransDate, TransID;">
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="StatementNote" DataType="System.String"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="TransTotalIncl" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table3" Alias="Ageing_Current" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement &#13;&#10;WHERE (DATE_FORMAT(TransDate,'%Y-%m-01') = DATE_FORMAT(CURDATE(),'%Y-%m-01'))">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table4" Alias="Ageing_30Days" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement &#13;&#10;WHERE DATE_FORMAT(TransDate,'%Y-%m-01') = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -1 MONTH)">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table5" Alias="Ageing_60Days" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement &#13;&#10;WHERE DATE_FORMAT(TransDate,'%Y-%m-01') = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -2 MONTH)">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table6" Alias="Ageing_90Days" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement &#13;&#10;WHERE DATE_FORMAT(TransDate,'%Y-%m-01') = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -3 MONTH)">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table7" Alias="Ageing_120Days" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement &#13;&#10;WHERE DATE_FORMAT(TransDate,'%Y-%m-01') &lt; ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -3 MONTH)">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table8" Alias="Ageing_Total" DataType="System.Int32" Enabled="true" SelectCommand="SELECT SUM(TotalDue) FROM debtor_statement ">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table9" Alias="SelClient" DataType="System.Int32" Enabled="true" SelectCommand="SELECT * FROM clients WHERE (ClientID = @ClientID) AND (CompanyID = @CompanyID)">
        <Column Name="ID" DataType="System.UInt32"/>
        <Column Name="Name" DataType="System.String"/>
        <Column Name="Email" DataType="System.String"/>
        <Column Name="BillingAddress" DataType="System.String"/>
        <Column Name="ContactNo" DataType="System.String"/>
        <Column Name="TotalDue" DataType="System.Decimal"/>
        <Column Name="ClientID" DataType="System.UInt32"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="LastCashTransDate" DataType="System.DateTime"/>
        <Column Name="LastCashInvoiceDate" DataType="System.DateTime"/>
        <Column Name="LastCashRefundDate" DataType="System.DateTime"/>
        <Column Name="LastAccountTransDate" DataType="System.DateTime"/>
        <Column Name="LastAccountInvoiceDate" DataType="System.DateTime"/>
        <Column Name="LastCreditNoteDate" DataType="System.DateTime"/>
        <Column Name="LastReceiptDate" DataType="System.DateTime"/>
        <Column Name="LastJournalDate" DataType="System.DateTime"/>
        <CommandParameter Name="clientID" DataType="254" Expression="[ClientID]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table10" Alias="clients_RelatedID" DataType="System.Int32" Enabled="true" SelectCommand="SELECT ClientID FROM clients &#13;&#10;WHERE CompanyID = @CompanyID AND (TotalDue &lt;&gt; 0  OR DATE_FORMAT(`LastAccountTransDate`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'))">
        <Column Name="ClientID" DataType="System.UInt32"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Relation Name="clients_Table10" ParentDataSource="clients" ChildDataSource="Table10" ParentColumns="ClientID" ChildColumns="ClientID" Enabled="true"/>
    <Parameter Name="ClientID" DataType="System.String"/>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="FromDate" DataType="System.String"/>
    <Parameter Name="ToDate" DataType="System.String"/>
    <Total Name="Total Due" Expression="[statement.TotalDue]" Evaluator="Data3" PrintOn="DataFooter1"/>
    <Total Name="Total CN" Expression="[CreditNotes.TransTotalIncl]" Evaluator="Data4"/>
    <Total Name="Total RCPT" Expression="[Receipts.TransTotalIncl]" Evaluator="Data5"/>
    <Total Name="Total_CrNotes" Expression="[statement.TotalCrNotesIncl]" Evaluator="Data3"/>
    <Total Name="Total_Rcpts" Expression="[statement.TotalPaid]" Evaluator="Data3"/>
    <Total Name="Total_TransTotal" Expression="[statement.TransTotalIncl]" Evaluator="Data3"/>
  </Dictionary>
  <ReportPage Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9">
    <ReportTitleBand Name="ReportTitle2" Width="1047.06" Height="47.25">
      <TextObject Name="Text49" Left="9.45" Top="-9.45" Width="179.55" Height="56.7" Text="Statement" Font="Segoe UI Light, 24pt" TextFill.Color="OliveDrab"/>
      <TextObject Name="Text48" Left="803.25" Top="9.45" Width="217.35" Height="18.9" Text="Printed on:   [Date]" Format="Custom" Format.Format="yyyy-MM-dd HH:MM" Font="Segoe UI Light, 10pt"/>
    </ReportTitleBand>
    <PageHeaderBand Name="PageHeader2" Top="51.25" Width="1047.06" Height="122.85">
      <ShapeObject Name="Shape17" Left="567" Top="9.45" Width="207.9" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <ShapeObject Name="Shape16" Left="652.05" Top="9.45" Width="387.45" Height="113.4" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <ShapeObject Name="Shape11" Top="9.45" Width="207.9" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text50" Left="9.45" Top="9.45" Width="160.65" Height="28.35" Text="Account Holder:" VertAlign="Center" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      <ShapeObject Name="Shape5" Left="160.65" Top="9.45" Width="387.45" Height="113.4" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text21" Left="189" Top="18.9" Width="349.65" Height="18.9" Text="[SelClient.Name]"/>
      <TextObject Name="Text22" Left="189" Top="47.25" Width="292.95" Height="66.15" Text="[SelClient.BillingAddress]"/>
      <TextObject Name="Text1" Left="670.95" Top="18.9" Width="359.1" Height="18.9" Text="[companies.Name]"/>
      <TextObject Name="Text69" Left="576.45" Top="9.45" Width="75.6" Height="28.35" Text="From:" VertAlign="Center" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      <TextObject Name="Text5" Left="670.95" Top="47.25" Width="311.85" Height="66.15" Text="[companies.Address]"/>
    </PageHeaderBand>
    <DataBand Name="Data3" Top="276.6" Width="1047.06" Height="47.25" CanGrow="true" CanShrink="true" DataSource="Table">
      <TextObject Name="Text53" Left="9.45" Width="103.95" Height="18.9" CanGrow="true" CanShrink="true" Text="[statement.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
      <TextObject Name="Text54" Left="122.85" Width="217.35" Height="47.25" CanGrow="true" CanShrink="true" Text="[statement.StatementNote]"/>
      <TextObject Name="Text55" Left="349.65" Width="75.6" Height="47.25" CanGrow="true" CanShrink="true" Text="[statement.TransID]" HorzAlign="Right" Font="Arial, 10pt, style=Italic"/>
      <TextObject Name="Text8" Left="623.7" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[statement.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtTotalRCPT" Left="727.65" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[statement.TotalPaid]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text12" Left="831.6" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[statement.TotalCrNotesIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text14" Left="935.55" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[statement.TotalDue]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text16" Left="434.7" Width="75.6" Height="47.25" CanGrow="true" CanShrink="true" Text="[statement.ReceiptNo]" HorzAlign="Right" Font="Arial, 10pt, style=Italic" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text18" Left="519.75" Width="85.05" Height="47.25" CanGrow="true" CanShrink="true" Text="[statement.CrNoteNo]" HorzAlign="Right" Font="Arial, 10pt, style=Italic" Trimming="EllipsisCharacter"/>
      <DataHeaderBand Name="DataHeader1" Top="178.1" Width="1047.06" Height="94.5" RepeatOnEveryPage="true">
        <ShapeObject Name="Shape10" Top="18.9" Width="207.9" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <ShapeObject Name="Shape12" Top="47.25" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text51" Left="9.45" Top="56.7" Width="103.95" Height="18.9" Text="Inv. Date" TextFill.Color="DimGray"/>
        <TextObject Name="Text52" Left="122.85" Top="56.7" Width="141.75" Height="18.9" Text="Note" TextFill.Color="DimGray"/>
        <TextObject Name="Text7" Left="349.65" Top="56.7" Width="75.6" Height="18.9" Text="Inv/Jnl #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text9" Left="623.7" Top="56.7" Width="94.5" Height="18.9" Text="Total Inv/Jnl" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text11" Left="727.65" Top="56.7" Width="94.5" Height="18.9" Text="Total RCPT" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text13" Left="831.6" Top="56.7" Width="94.5" Height="18.9" Text="Total Cr Note" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text15" Left="935.55" Top="56.7" Width="94.5" Height="18.9" Text="Total Due" HorzAlign="Right" Font="Arial, 12pt" TextFill.Color="DimGray"/>
        <TextObject Name="Text17" Left="434.7" Top="56.7" Width="75.6" Height="18.9" Text="RCPT #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text19" Left="519.75" Top="56.7" Width="75.6" Height="18.9" Text="Cr. Note #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text25" Left="9.45" Top="18.9" Width="189" Height="28.35" Text="Invoices &amp; Journals" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      </DataHeaderBand>
      <DataFooterBand Name="DataFooter1" Top="327.85" Width="1047.06" Height="47.25">
        <ShapeObject Name="Shape2" Top="9.45" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text20" Left="935.55" Top="18.9" Width="94.5" Height="18.9" Text="[Total Due]" Format="Number" Format.UseLocale="true" HorzAlign="Right" Font="Arial, 12pt" Trimming="Character"/>
        <TextObject Name="Text2" Left="831.6" Top="18.9" Width="94.5" Height="18.9" Text="[Total_CrNotes]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text3" Left="727.65" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Rcpts]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text4" Left="623.7" Top="18.9" Width="94.5" Height="18.9" Text="[Total_TransTotal]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      </DataFooterBand>
    </DataBand>
    <GroupHeaderBand Name="GroupHeader2" Top="379.1" Width="1047.06" Height="85.05" KeepWithData="true" RepeatOnEveryPage="true" Condition="[ClientID]" SortOrder="None" KeepTogether="true">
      <ShapeObject Name="Shape9" Top="9.45" Width="207.9" Height="47.25" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text31" Left="9.45" Top="9.45" Width="151.2" Height="28.35" Text="Credit Notes" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      <ShapeObject Name="Shape6" Top="37.8" Width="727.65" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text37" Left="56.7" Top="47.25" Width="94.5" Height="18.9" Text="Cr. Note Date" TextFill.Color="DimGray"/>
      <TextObject Name="Text38" Left="179.55" Top="47.25" Width="94.5" Height="18.9" Text="Note" TextFill.Color="DimGray"/>
      <TextObject Name="Text39" Left="510.3" Top="47.25" Width="94.5" Height="18.9" Text="Cr. Note #" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text40" Left="623.7" Top="47.25" Width="94.5" Height="18.9" Text="Total Incl" HorzAlign="Right" TextFill.Color="DimGray"/>
      <DataBand Name="Data4" Top="468.15" Width="1047.06" Height="18.9" DataSource="Table1">
        <TextObject Name="Text23" Left="56.7" Width="94.5" Height="18.9" Text="[CreditNotes.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
        <TextObject Name="Text24" Left="179.55" Width="321.3" Height="18.9" Text="[CreditNotes.StatementNote]"/>
        <TextObject Name="Text27" Left="510.3" Width="94.5" Height="18.9" Text="[CreditNotes.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text29" Left="623.7" Width="94.5" Height="18.9" Text="[CreditNotes.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      </DataBand>
      <GroupFooterBand Name="GroupFooter2" Top="491.05" Width="1047.06" Height="47.25">
        <ShapeObject Name="Shape4" Top="9.45" Width="727.65" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text28" Left="623.7" Top="18.9" Width="94.5" Height="18.9" Fill.Color="WhiteSmoke" Text="[Total CN]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text71" Left="510.3" Top="18.9" Width="94.5" Height="18.9" Text="Total Cr Note" HorzAlign="Right" TextFill.Color="DimGray"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <GroupHeaderBand Name="GroupHeader1" Top="542.3" Width="1047.06" Height="85.05" KeepWithData="true" RepeatOnEveryPage="true" Condition="[ClientID]" SortOrder="None" KeepTogether="true">
      <ShapeObject Name="Shape8" Top="9.45" Width="207.9" Height="47.25" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text32" Left="9.45" Top="9.45" Width="132.3" Height="28.35" Text="Receipts" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      <ShapeObject Name="Shape7" Top="37.8" Width="727.65" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text41" Left="56.7" Top="47.25" Width="113.4" Height="18.9" Text="Receipt Date" TextFill.Color="DimGray"/>
      <TextObject Name="Text42" Left="179.55" Top="47.25" Width="94.5" Height="18.9" Text="Note" TextFill.Color="DimGray"/>
      <TextObject Name="Text43" Left="510.3" Top="47.25" Width="94.5" Height="18.9" Text="RCPT #" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text44" Left="623.7" Top="47.25" Width="94.5" Height="18.9" Text="Total Incl" HorzAlign="Right" TextFill.Color="DimGray"/>
      <DataBand Name="Data5" Top="631.35" Width="1047.06" Height="18.9" DataSource="Table2" KeepTogether="true">
        <TextObject Name="Text26" Left="56.7" Width="113.4" Height="18.9" Text="[Receipts.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
        <TextObject Name="Text33" Left="179.55" Width="321.3" Height="18.9" Text="[Receipts.StatementNote]"/>
        <TextObject Name="Text34" Left="510.3" Width="94.5" Height="18.9" Text="[Receipts.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text36" Left="623.7" Width="94.5" Height="18.9" Text="[Receipts.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      </DataBand>
      <GroupFooterBand Name="GroupFooter1" Top="654.25" Width="1047.06" Height="47.25">
        <ShapeObject Name="Shape13" Top="9.45" Width="727.65" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text30" Left="623.7" Top="18.9" Width="94.5" Height="18.9" Fill.Color="WhiteSmoke" Text="[Total RCPT]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text70" Left="510.3" Top="18.9" Width="94.5" Height="18.9" Text="Total RCPT" HorzAlign="Right" TextFill.Color="DimGray"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <DataBand Name="Data6" Top="705.5" Width="1047.06" Height="103.95" PrintOnBottom="true">
      <ShapeObject Name="Shape1" Left="236.25" Top="66.15" Width="803.25" Height="37.8" Border.Color="Gray" Shape="RoundRectangle"/>
      <ShapeObject Name="Shape14" Top="9.45" Width="207.9" Height="47.25" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <ShapeObject Name="Shape15" Top="28.35" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text62" Left="274.05" Top="37.8" Width="94.5" Height="18.9" Text="Current" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text63" Left="406.35" Top="37.8" Width="94.5" Height="18.9" Text="30 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text64" Left="538.65" Top="37.8" Width="94.5" Height="18.9" Text="60 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text65" Left="670.95" Top="37.8" Width="94.5" Height="18.9" Text="90 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text66" Left="803.25" Top="37.8" Width="94.5" Height="18.9" Text="120+ Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text67" Left="935.55" Top="37.8" Width="94.5" Height="18.9" Text="Total Due" HorzAlign="Right" Font="Arial, 12pt" TextFill.Color="DimGray"/>
      <TextObject Name="Text68" Left="245.7" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_Current.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text56" Left="378" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_30Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text57" Left="510.3" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_60Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text58" Left="642.6" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_90Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text59" Left="774.9" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_120Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text60" Left="907.2" Top="75.6" Width="122.85" Height="18.9" Text="[Ageing_Total.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Font="Arial, 12pt" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text61" Left="9.45" Top="9.45" Width="94.5" Height="28.35" Text="Ageing" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
    </DataBand>
    <PageFooterBand Name="PageFooter2" Top="813.45" Width="1047.06" Height="18.9">
      <TextObject Name="Text35" Left="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" HorzAlign="Center" Font="Segoe UI Light, 10pt" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </ReportPage>
  <DialogPage Name="Form1" Width="566" Height="275" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="378" Top="184" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="461" Top="184" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <ComboBoxControl Name="ComboBox1" Left="176" Top="96" Width="321" Height="28" Font="Segoe UI Light, 11pt" TabIndex="2" AutoFilter="false" DataColumn="clients.Name" DetailControl="ComboBox2" DropDownStyle="DropDownList" DropDownWidth="261" ItemHeight="20"/>
    <ComboBoxControl Name="ComboBox2" Left="376" Top="72" Visible="false" Font="Tahoma, 8pt" TabIndex="3" Text="ComboBox" AutoFill="false" DataColumn="clients_RelatedID.ClientID" ReportParameter="ClientID" ItemHeight="13"/>
    <LabelControl Name="Label1" Left="68" Top="100" Width="68" Height="20" Font="Segoe UI Light, 11pt" TabIndex="4" Text="For Client"/>
    <LabelControl Name="Label3" Left="32" Top="28" Width="131" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Statement"/>
    <CheckBoxControl Name="chkIncludeTrans" Left="176" Top="140" Width="159" Font="Segoe UI Light, 11pt" TabIndex="7" Text="Include transactions..." ClickEvent="chkIncludeTrans_Click"/>
    <DateTimePickerControl Name="dtpFromDate" Left="176" Top="184" Width="224" Height="27" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="8" Text="  18 March 2015" CustomFormat="  d MMMM yyy" Format="Custom" Value="03/18/2015 08:18:52"/>
    <DateTimePickerControl Name="dtpToDate" Left="176" Top="220" Width="224" Height="27" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="9" Text="  18 March 2015" CustomFormat="  d MMMM yyy" Format="Custom" Value="03/18/2015 08:18:56"/>
    <LabelControl Name="lblFromDate" Left="68" Top="184" Width="74" Height="20" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="4" Text="From Date"/>
    <LabelControl Name="lblToDate" Left="68" Top="220" Width="56" Height="20" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="4" Text="To Date"/>
  </DialogPage>
</Report>
