﻿<?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/11/2015 12:11:03" 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 suppliers owing&quot;);
        ComboBox1.Text = &quot;No suppliers 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 selectCreditPurchases = &quot;((TotalIncl - (TotalPaid + TotalDtNotesIncl) &lt;&gt; 0) OR DATE_FORMAT(`Date`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'))&quot;;
      string selectPaymentsAndNotes = &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;));
        
        selectCreditPurchases = &quot;((TotalIncl - (TotalPaid + TotalDtNotesIncl) &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;; 
        selectPaymentsAndNotes = &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;@SelectCreditPurchases&quot;, selectCreditPurchases);
      tStatement.SelectCommand = tStatement.SelectCommand.ToString().Replace(&quot;@SelectPaymentsAndNotes&quot;, selectPaymentsAndNotes);
      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;SelSupplier.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="rijcmlqvPT/uGtq7mDUOjqaWuhGg+L4M6JSzK6kmKcze5kxuKHd01n+NCUMF5bzQTKxV8yuYsuHNxpzF2pHC5nqnuwPf7ZS7eZRROEbpJvJ+05u5DM=">
      <TableDataSource Name="suppliers" DataType="System.Int32" PropName="clients" Enabled="true" TableName="suppliers" SelectCommand="SELECT * FROM suppliers &#13;&#10;WHERE CompanyID = @CompanyID AND (TotalDue &lt;&gt; 0  OR DATE_FORMAT(`LastTransDate`,'%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="LastJournalDate" DataType="System.DateTime"/>
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="BankingDetails" DataType="System.String"/>
        <Column Name="TaxOnInvoice" DataType="System.String"/>
        <Column Name="LastCashPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastCashPurchaseReturnDate" DataType="System.DateTime"/>
        <Column Name="LastAccountPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastDebitNoteDate" DataType="System.DateTime"/>
        <Column Name="LastPaymentDate" DataType="System.DateTime"/>
        <Column Name="LastTransDate" DataType="System.DateTime"/>
        <Column Name="Note" DataType="System.String"/>
        <Column Name="Status" DataType="System.String"/>
        <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="VATrate" DataType="System.String"/>
        <Column Name="InvoiceStylePath" DataType="System.String"/>
        <Column Name="InvoiceSize" DataType="System.String"/>
        <Column Name="BankingDetails" DataType="System.String"/>
        <Column Name="FinYearStartMonth" DataType="System.String"/>
        <Column Name="Scheme" 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 creditor_statement; &#13;&#10;CREATE TEMPORARY TABLE creditor_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;SupplierID 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;PaymentNo VARCHAR(150) NOT NULL,&#13;&#10;TotalDtNotesIncl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;DtNoteNo VARCHAR(150) NOT NULL,&#13;&#10;TotalDue DECIMAL(10,2) NOT NULL DEFAULT 0.00);&#13;&#10;INSERT INTO creditor_statement (TransDate, StatementNote, TransTotalIncl, TransID, SupplierID, CompanyID, TotalPaid, PaymentNo, TotalDtNotesIncl, DtNoteNo, TotalDue) &#13;&#10;SELECT `Date`, StatementNote, TotalIncl, TransID, SupplierID, CompanyID, TotalPaid*-1, RelPaymentIDs, TotalDtNotesIncl*-1, RelDtNoteIDs, TotalIncl - TotalPaid - TotalDtNotesIncl AS TotalDue FROM credit_purchases &#13;&#10;WHERE  (CompanyID = @CompanyID) AND (SupplierID = @SupplierID) AND @SelectCreditPurchases;&#13;&#10;INSERT INTO creditor_statement (TransDate, StatementNote, TransTotalIncl, TransID, SupplierID, CompanyID) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, AmountPaid, TransID, SupplierID, CompanyID FROM payments &#13;&#10;WHERE (CompanyID = @CompanyID) AND (SupplierID = @SupplierID) AND IsForAccount = 1 AND @SelectPaymentsAndNotes;&#13;&#10;INSERT INTO creditor_statement (TransDate, StatementNote, TransTotalIncl, TransID, SupplierID, CompanyID) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, TotalIncl, TransID, SupplierID, CompanyID FROM debit_notes &#13;&#10;WHERE (CompanyID = @CompanyID) AND (SupplierID = @SupplierID) AND @SelectPaymentsAndNotes;&#13;&#10;INSERT INTO creditor_statement (TransDate, StatementNote, TransTotalIncl, TransID, SupplierID, CompanyID, TotalPaid, TotalDue, PaymentNo) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-%d') AS `Date`, StatementNote, Amount, TransID, SupplierID, CompanyID, TotalPaid*-1, Amount - TotalPaid AS TotalDue, RelPaymentIDs FROM creditor_journals &#13;&#10;WHERE (CompanyID = @CompanyID) AND (SupplierID = @SupplierID) AND @SelectJournals;&#13;&#10;SELECT * FROM creditor_statement WHERE LEFT(StatementNote, 3) = 'GRV' 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="CompanyID" DataType="System.UInt32"/>
        <Column Name="TotalPaid" DataType="System.Decimal"/>
        <Column Name="TotalDue" DataType="System.Decimal"/>
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="PaymentNo" DataType="System.String"/>
        <Column Name="TotalDtNotesIncl" DataType="System.Decimal"/>
        <Column Name="DtNoteNo" DataType="System.String"/>
        <CommandParameter Name="supplierID" DataType="254" Expression="[SupplierID]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="SelectCreditPurchases" DataType="254"/>
        <CommandParameter Name="SelectPaymentsAndNotes" 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="DebitNotes" DataType="System.Int32" Enabled="true" SelectCommand="SELECT TransDate, StatementNote, TransID, TransTotalIncl FROM creditor_statement WHERE LEFT(StatementNote, 2) = 'DN'  &#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="Payments" DataType="System.Int32" Enabled="true" SelectCommand="SELECT TransDate, StatementNote, TransID, TransTotalIncl &#13;&#10;FROM creditor_statement &#13;&#10;WHERE LEFT(StatementNote, 4) = 'PMNT' &#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 creditor_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 creditor_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 creditor_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 creditor_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 creditor_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 creditor_statement ">
        <Column Name="SUM(TotalDue)" DataType="System.Decimal"/>
      </TableDataSource>
      <TableDataSource Name="Table9" Alias="SelSupplier" DataType="System.Int32" Enabled="true" SelectCommand="SELECT * FROM suppliers WHERE (SupplierID = @SupplierID) 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="CompanyID" DataType="System.UInt32"/>
        <Column Name="LastJournalDate" DataType="System.DateTime"/>
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="BankingDetails" DataType="System.String"/>
        <Column Name="TaxOnInvoice" DataType="System.String"/>
        <Column Name="LastCashPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastCashPurchaseReturnDate" DataType="System.DateTime"/>
        <Column Name="LastAccountPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastDebitNoteDate" DataType="System.DateTime"/>
        <Column Name="LastPaymentDate" DataType="System.DateTime"/>
        <Column Name="LastTransDate" DataType="System.DateTime"/>
        <CommandParameter Name="supplierID" DataType="254" Expression="[SupplierID]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table10" Alias="suppliers_RelatedID" DataType="System.Int32" Enabled="true" SelectCommand="SELECT * FROM suppliers &#13;&#10;WHERE CompanyID = @CompanyID AND (TotalDue &lt;&gt; 0  OR DATE_FORMAT(`LastTransDate`,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'))">
        <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="CompanyID" DataType="System.UInt32"/>
        <Column Name="LastJournalDate" DataType="System.DateTime"/>
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="BankingDetails" DataType="System.String"/>
        <Column Name="TaxOnInvoice" DataType="System.String"/>
        <Column Name="LastCashPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastCashPurchaseReturnDate" DataType="System.DateTime"/>
        <Column Name="LastAccountPurchaseDate" DataType="System.DateTime"/>
        <Column Name="LastDebitNoteDate" DataType="System.DateTime"/>
        <Column Name="LastPaymentDate" DataType="System.DateTime"/>
        <Column Name="LastTransDate" DataType="System.DateTime"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Relation Name="suppliers_Table10" ParentDataSource="suppliers" ChildDataSource="Table10" ParentColumns="SupplierID" ChildColumns="SupplierID" Enabled="true"/>
    <Parameter Name="SupplierID" DataType="System.String" Expression="1"/>
    <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 DN" Expression="[DebitNotes.TransTotalIncl]" Evaluator="Data4"/>
    <Total Name="Total PMNT" Expression="[Payments.TransTotalIncl]" Evaluator="Data5"/>
    <Total Name="Total_DtNotes" Expression="[statement.TotalDtNotesIncl]" Evaluator="Data3"/>
    <Total Name="Total_Pmnts" 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="[SelSupplier.Name]"/>
      <TextObject Name="Text22" Left="189" Top="47.25" Width="292.95" Height="66.15" Text="[SelSupplier.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="18.9" DataSource="Table">
      <TextObject Name="Text53" Left="9.45" Width="94.5" Height="18.9" Text="[statement.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
      <TextObject Name="Text54" Left="122.85" Width="217.35" Height="18.9" Text="[statement.StatementNote]"/>
      <TextObject Name="Text55" Left="349.65" Width="75.6" Height="18.9" Text="[statement.TransID]" HorzAlign="Right" Font="Arial, 10pt, style=Italic"/>
      <TextObject Name="Text8" Left="623.7" Width="94.5" Height="18.9" 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" 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" Text="[statement.TotalDtNotesIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text14" Left="935.55" Width="94.5" Height="18.9" Text="[statement.TotalDue]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text16" Left="434.7" Width="75.6" Height="18.9" Text="[statement.PaymentNo]" HorzAlign="Right" Font="Arial, 10pt, style=Italic" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text18" Left="519.75" Width="75.6" Height="18.9" Text="[statement.DtNoteNo]" 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="94.5" Height="18.9" Text="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="Grv/Jnl #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text9" Left="623.7" Top="56.7" Width="94.5" Height="18.9" Text="Total Grv/Jnl" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text11" Left="727.65" Top="56.7" Width="94.5" Height="18.9" Text="Total Paid" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text13" Left="831.6" Top="56.7" Width="94.5" Height="18.9" Text="Total Dt 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="PMNT #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text19" Left="519.75" Top="56.7" Width="75.6" Height="18.9" Text="Dt. Note #" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text25" Left="9.45" Top="18.9" Width="179.55" Height="28.35" Text="Purchases &amp; Journals" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      </DataHeaderBand>
      <DataFooterBand Name="DataFooter1" Top="299.5" 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"/>
        <TextObject Name="Text2" Left="831.6" Top="18.9" Width="94.5" Height="18.9" Text="[Total_DtNotes]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text3" Left="727.65" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Pmnts]" 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="350.75" Width="1047.06" Height="85.05" KeepWithData="true" RepeatOnEveryPage="true" Condition="[SupplierID]" 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="Debit 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="113.4" Height="18.9" Text="Dt. 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="Dt. 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="439.8" Width="1047.06" Height="18.9" DataSource="Table1">
        <TextObject Name="Text23" Left="56.7" Width="113.4" Height="18.9" Text="[DebitNotes.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
        <TextObject Name="Text24" Left="179.55" Width="321.3" Height="18.9" Text="[DebitNotes.StatementNote]"/>
        <TextObject Name="Text27" Left="510.3" Width="94.5" Height="18.9" Text="[DebitNotes.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text29" Left="623.7" Width="94.5" Height="18.9" Text="[DebitNotes.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      </DataBand>
      <GroupFooterBand Name="GroupFooter2" Top="462.7" 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 DN]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text70" Left="510.3" Top="18.9" Width="94.5" Height="18.9" Text="Total Paid" HorzAlign="Right" TextFill.Color="DimGray"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <GroupHeaderBand Name="GroupHeader1" Top="513.95" Width="1047.06" Height="85.05" KeepWithData="true" RepeatOnEveryPage="true" Condition="[SupplierID]" 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="Payments" 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="Payment 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="PMNT #" 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="603" Width="1047.06" Height="18.9" DataSource="Table2" KeepTogether="true">
        <TextObject Name="Text26" Left="56.7" Width="113.4" Height="18.9" Text="[Payments.TransDate]" Format="Custom" Format.Format="yyyy-MM-dd"/>
        <TextObject Name="Text33" Left="179.55" Width="321.3" Height="18.9" Text="[Payments.StatementNote]"/>
        <TextObject Name="Text34" Left="510.3" Width="94.5" Height="18.9" Text="[Payments.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text36" Left="623.7" Width="94.5" Height="18.9" Text="[Payments.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      </DataBand>
      <GroupFooterBand Name="GroupFooter1" Top="625.9" 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 PMNT]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text71" Left="510.3" Top="18.9" Width="94.5" Height="18.9" Text="Total Dt Note" HorzAlign="Right" TextFill.Color="DimGray"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <DataBand Name="Data6" Top="677.15" Width="1047.06" Height="103.95" PrintOnBottom="true">
      <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="368.55" Top="37.8" Width="94.5" Height="18.9" Text="Current" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text63" Left="481.95" Top="37.8" Width="94.5" Height="18.9" Text="30 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text64" Left="595.35" Top="37.8" Width="94.5" Height="18.9" Text="60 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text65" Left="708.75" Top="37.8" Width="94.5" Height="18.9" Text="90 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text66" Left="822.15" 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="368.55" Top="75.6" Width="94.5" Height="18.9" Text="[Ageing_Current.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text56" Left="481.95" Top="75.6" Width="94.5" Height="18.9" Text="[Ageing_30Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text57" Left="595.35" Top="75.6" Width="94.5" Height="18.9" Text="[Ageing_60Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text58" Left="708.75" Top="75.6" Width="94.5" Height="18.9" Text="[Ageing_90Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text59" Left="822.15" Top="75.6" Width="94.5" Height="18.9" Text="[Ageing_120Days.SUM(TotalDue)]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text60" Left="935.55" Top="75.6" Width="94.5" 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"/>
      <ShapeObject Name="Shape1" Left="349.65" Top="66.15" Width="689.85" Height="37.8" Border.Color="Gray" Shape="RoundRectangle"/>
    </DataBand>
    <PageFooterBand Name="PageFooter2" Top="785.1" 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="562" Height="275" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="374" Top="184" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="457" Top="184" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <ComboBoxControl Name="ComboBox1" Left="180" Top="96" Width="321" Font="Segoe UI Light, 11pt" TabIndex="2" AutoFilter="false" DataColumn="suppliers.Name" DetailControl="ComboBox2" DropDownStyle="DropDownList" DropDownWidth="261" ItemHeight="20"/>
    <ComboBoxControl Name="ComboBox2" Left="380" Top="72" Visible="false" Font="Tahoma, 8pt" TabIndex="3" Text="ComboBox" AutoFill="false" DataColumn="suppliers_RelatedID.SupplierID" ReportParameter="SupplierID" ItemHeight="13"/>
    <LabelControl Name="Label1" Left="68" Top="100" Width="83" Height="20" Font="Segoe UI Light, 11pt" ForeColor="Black" TabIndex="4" Text="For Supplier"/>
    <LabelControl Name="Label3" Left="36" Top="28" Width="131" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Statement"/>
    <CheckBoxControl Name="chkIncludeTrans" Left="180" Top="140" Width="159" Font="Segoe UI Light, 11pt" TabIndex="7" Text="Include transactions..." ClickEvent="chkIncludeTrans_Click"/>
    <DateTimePickerControl Name="dtpFromDate" Left="180" Top="184" Width="220" Height="27" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="8" CustomFormat=" d MMMM yyy" Format="Custom" Value="03/18/2015 08:18:52"/>
    <DateTimePickerControl Name="dtpToDate" Left="180" Top="220" Width="220" Height="27" Visible="false" Font="Segoe UI Light, 11pt" TabIndex="9" 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>
