﻿<?xml version="1.0" encoding="utf-8"?>
<inherited BaseReport="..\Base.frx" ScriptLanguage="CSharp" DoublePass="true" ReportInfo.Created="05/15/2013 14:45:40" ReportInfo.Modified="04/03/2015 11:34:15" 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 ReportSummary1_AfterData(object sender, EventArgs e)
    {
      float Current = (float)Report.GetTotalValue(&quot;Total_Current&quot;);
      float Days30 = (float)Report.GetTotalValue(&quot;Total_30Days&quot;);
      float Days60 = (float)Report.GetTotalValue(&quot;Total_60Days&quot;);
      float Days90 = (float)Report.GetTotalValue(&quot;Total_90Days&quot;);
      float Days120 = (float)Report.GetTotalValue(&quot;Total_120Days&quot;);
      float Total = (float)Report.GetTotalValue(&quot;Total&quot;);
      
      float percCurrent = (Current/Total)*100;
      float perc30Days = (Days30/Total)*100;
      float perc60Days = (Days60/Total)*100;
      float perc90Days = (Days90/Total)*100;
      float perc120Days = (Days120/Total)*100;
      float percTotal = ((Current + Days30 + Days60 + Days90 + Days120)/Total)*100;
        
      
      txtPercCurrent.Text = percCurrent.ToString(&quot;0.00'%'&quot;);
      txtPerc30Days.Text = perc30Days.ToString(&quot;0.00'%'&quot;);
      txtPerc60Days.Text = perc60Days.ToString(&quot;0.00'%'&quot;);
      txtPerc90Days.Text = perc90Days.ToString(&quot;0.00'%'&quot;);
      txtPerc120Days.Text = perc120Days.ToString(&quot;0.00'%'&quot;);
      txtPercTotal.Text = percTotal.ToString(&quot;0.00'%'&quot;);
    }
  }
}
</ScriptText>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqomabmqtwD7y3BaVO988XrjoBefSoHBX+xGSDpo0d+ot8yrzL17EhRvx7tW87ZuxDTsXprPmiOj80ATh2Aow+2w==">
      <TableDataSource Name="companies" DataType="System.Int32" Enabled="true" TableName="companies">
        <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 suppliers_owing; &#13;&#10;CREATE TEMPORARY TABLE suppliers_owing (&#13;&#10;TransDate date NOT NULL default '2000-01-01',&#13;&#10;SupplierID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;SupplierName VARCHAR(150) NOT NULL,&#13;&#10;CompanyID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;TotalDue DECIMAL(10,2) NOT NULL DEFAULT 0.00);&#13;&#10;INSERT INTO suppliers_owing (TransDate, SupplierID, SupplierName, CompanyID, TotalDue) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-01'), SupplierID, SupplierName, CompanyID, TotalIncl - TotalPaid - TotalDtNotesIncl AS TotalDue FROM credit_purchases &#13;&#10;WHERE CompanyID = @CompanyID AND (TotalIncl - (TotalPaid + TotalDtNotesIncl) &lt;&gt; 0);&#13;&#10;INSERT INTO suppliers_owing (TransDate, SupplierID, SupplierName, CompanyID, TotalDue) &#13;&#10;SELECT DATE_FORMAT(`Date`,'%Y-%m-01'), SupplierID, SupplierName, CompanyID, Amount - TotalPaid AS TotalDue FROM creditor_journals &#13;&#10;WHERE CompanyID = @CompanyID AND (Amount - TotalPaid &lt;&gt; 0);&#13;&#10;SELECT SupplierID, SupplierName, DATE_FORMAT(TransDate,'%Y-%m') AS `Date`, &#13;&#10;SUM(IF(DATE_FORMAT(TransDate,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m'), TotalDue, 0)) AS Current, &#13;&#10;SUM(IF(TransDate = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -1 MONTH), TotalDue, 0)) AS `30Days`,&#13;&#10;SUM(IF(TransDate = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -2 MONTH), TotalDue, 0)) AS `60Days`,&#13;&#10;SUM(IF(TransDate = ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -3 MONTH), TotalDue, 0)) AS `90Days`,&#13;&#10;SUM(IF(TransDate &lt; ADDDATE(DATE_FORMAT(CURDATE(),'%Y-%m-01'), INTERVAL -3 MONTH), TotalDue, 0)) AS `120Days`,&#13;&#10;SUM(TotalDue) AS Total &#13;&#10;FROM suppliers_owing &#13;&#10;GROUP BY SupplierName">
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="SupplierName" DataType="System.String"/>
        <Column Name="Date" DataType="System.String"/>
        <Column Name="Current" DataType="System.Decimal"/>
        <Column Name="30Days" DataType="System.Decimal"/>
        <Column Name="60Days" DataType="System.Decimal"/>
        <Column Name="90Days" DataType="System.Decimal"/>
        <Column Name="120Days" DataType="System.Decimal"/>
        <Column Name="Total" DataType="System.Decimal"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="SupplierID" DataType="System.String"/>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Total Name="Total_Current" Expression="[statement.Current]" Evaluator="Data1"/>
    <Total Name="Total_30Days" Expression="[statement.30Days]" Evaluator="Data1"/>
    <Total Name="Total_60Days" Expression="[statement.60Days]" Evaluator="Data1"/>
    <Total Name="Total_90Days" Expression="[statement.90Days]" Evaluator="Data1"/>
    <Total Name="Total_120Days" Expression="[statement.120Days]" Evaluator="Data1"/>
    <Total Name="Total" Expression="[statement.Total]" Evaluator="Data1"/>
    <Total Name="Count" TotalType="Count" Evaluator="Data1"/>
  </Dictionary>
  <inherited Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" FirstPageSource="15" OtherPagesSource="15">
    <inherited Name="PageHeader1" Width="1047.06">
      <inherited Name="_CompanyName"/>
      <ChildBand Name="Child1" ZOrder="-1" Top="41.8" Width="1047.06" Height="122.85">
        <ShapeObject Name="Shape15" Top="75.6" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text62" Left="368.55" Top="85.05" Width="94.5" Height="18.9" Text="Current" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text63" Left="481.95" Top="85.05" Width="94.5" Height="18.9" Text="30 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text64" Left="595.35" Top="85.05" Width="94.5" Height="18.9" Text="60 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text65" Left="708.75" Top="85.05" Width="94.5" Height="18.9" Text="90 Days" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text66" Left="822.15" Top="85.05" Width="94.5" Height="18.9" Text="120+ Days" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text67" Left="935.55" Top="85.05" Width="94.5" Height="18.9" Text="Total Due" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text69" Left="18.9" Top="85.05" Width="179.55" Height="18.9" Text="Supplier Name" TextFill.Color="DimGray"/>
        <TextObject Name="Text31" Left="18.9" Top="9.45" Width="557.55" Height="56.7" Text="Suppliers Owing (Ageing) - List" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data1" ZOrder="0" Top="168.65" Width="1047.06" Height="18.9" DataSource="Table">
      <TextObject Name="Text68" Left="368.55" Width="94.5" Height="18.9" Text="[statement.Current]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text56" Left="481.95" Width="94.5" Height="18.9" Text="[statement.30Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text57" Left="595.35" Width="94.5" Height="18.9" Text="[statement.60Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text58" Left="708.75" Width="94.5" Height="18.9" Text="[statement.90Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text59" Left="822.15" Width="94.5" Height="18.9" Text="[statement.120Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text60" Left="935.55" Width="94.5" Height="18.9" Text="[statement.Total]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text2" Left="18.9" Width="340.2" Height="18.9" Hyperlink.DetailReportName="Statement.frx" Hyperlink.ReportParameter="ClientID" Text="[statement.SupplierName]" WordWrap="false" Trimming="EllipsisCharacter"/>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" ZOrder="-1" Top="191.55" Width="1047.06" Height="85.05" AfterDataEvent="ReportSummary1_AfterData">
      <ShapeObject Name="Shape16" Top="9.45" Width="1039.5" Height="75.6" Border.Color="Silver" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text3" Left="368.55" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Current]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text4" Left="481.95" Top="18.9" Width="94.5" Height="18.9" Text="[Total_30Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text5" Left="595.35" Top="18.9" Width="94.5" Height="18.9" Text="[Total_60Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text6" Left="708.75" Top="18.9" Width="94.5" Height="18.9" Text="[Total_90Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text7" Left="822.15" Top="18.9" Width="94.5" Height="18.9" Text="[Total_120Days]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text8" Left="935.55" Top="18.9" Width="94.5" Height="18.9" Text="[Total]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text9" Left="9.45" Top="18.9" Width="141.75" Height="18.9" Text="Total suppliers owing:" HorzAlign="Right"/>
      <TextObject Name="Text10" Left="160.65" Top="18.9" Width="66.15" Height="18.9" Text="[Count]"/>
      <TextObject Name="Text70" Left="245.7" Top="56.7" Width="113.4" Height="18.9" Text="% of Total:" HorzAlign="Right"/>
      <TextObject Name="txtPercCurrent" Left="368.55" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="txtPerc30Days" Left="481.95" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="txtPerc60Days" Left="595.35" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="txtPerc90Days" Left="708.75" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="txtPerc120Days" Left="822.15" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="txtPercTotal" Left="935.55" Top="56.7" Width="94.5" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text71" Left="245.7" Top="18.9" Width="113.4" Height="18.9" Text="Total Value" HorzAlign="Right"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="280.6" Width="1047.06" Height="37.8">
      <TextObject Name="Text35" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" HorzAlign="Center" Font="Segoe UI Light, 10pt" TextFill.Color="DimGray"/>
      <TextObject Name="Text48" Left="812.7" 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"/>
    </PageFooterBand>
  </inherited>
</inherited>
