﻿<?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="06/11/2015 12:09:25" 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)
    {
      cboOrderBy.Text = cboOrderBy.Items[0].ToString();
    }
    
    

    private void btnOk_Click(object sender, EventArgs e)
    {
      
      //Include billing address
      txtBillingAddress.Visible = chkIncludeAddress.Checked;
      
      TableDataSource tSuppliers = Report.GetDataSource(&quot;suppliers&quot;) as TableDataSource;
      string orderBy = String.Empty;
      if (cboOrderBy.Text == &quot;Name&quot;)
        orderBy = &quot;Name&quot;;      
      else if (cboOrderBy.Text == &quot;Total Due&quot;)      
        orderBy = &quot;TotalDue DESC&quot;;      
      else if (cboOrderBy.Text == &quot;Last Purchase Date&quot;)
        orderBy = &quot;LastPurchaseDate&quot;;
      tSuppliers.SelectCommand = tSuppliers.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy); 
    }
    
    
  }
}
</ScriptText>
  <Styles>
    <Style Name="Even" Border.Lines="Top, Bottom" Border.TopLine.Color="WhiteSmoke" Border.BottomLine.Color="WhiteSmoke" ApplyFill="false" ApplyTextFill="false" ApplyFont="false"/>
  </Styles>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqvPT/uGtq7mDUOjqaWuhGg+L4M6JSzK6kmKcze5kxuKHd01n+NCUMF5bzQTKxV8yuYsuHNxpzF2pHC5nqnuwPf5SER2cwdlT8MKC9xMxMymA=">
      <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="suppliers" DataType="System.Int32" Enabled="true" TableName="suppliers" SelectCommand="SELECT Name, BillingAddress, ContactNo, Email, TotalDue, IF(LastAccountPurchaseDate &gt; LastCashPurchaseDate, LastAccountPurchaseDate, LastCashPurchaseDate) AS LastPurchaseDate &#13;&#10;FROM Suppliers WHERE CompanyID = @CompanyID AND Status = 'Active' ORDER BY @OrderBy">
        <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="LastPurchaseDate" DataType="System.DateTime"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="orderBy" DataType="254" Expression="[OrderBy]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="OrderBy" DataType="System.String"/>
    <Total Name="Count" TotalType="Count" Evaluator="Data1" PrintOn="ReportSummary1"/>
    <Total Name="Total_Due" Expression="[suppliers.TotalDue]" Evaluator="Data1" PrintOn="ReportSummary1"/>
  </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="113.4">
        <TextObject Name="Text31" Left="18.9" Width="557.55" Height="56.7" Text="Supplier - List" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <ShapeObject Name="Shape15" Top="66.15" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text67" Left="916.65" Top="75.6" Width="113.4" Height="18.9" Text="Total Due" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text68" Left="9.45" Top="75.6" Width="141.75" Height="18.9" Text="Name"/>
        <TextObject Name="Text62" Left="765.45" Top="75.6" Width="141.75" Height="18.9" Text="Contact Number"/>
        <TextObject Name="Text65" Left="359.1" Top="75.6" Width="141.75" Height="18.9" Text="E-mail"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data1" ZOrder="0" Top="159.2" Width="1047.06" Height="141.75" CanGrow="true" CanShrink="true" EvenStyle="Even" EvenStylePriority="UseAll" DataSource="suppliers">
      <TextObject Name="txtBillingAddress" Left="37.8" Top="39.25" Width="311.85" Height="85.05" CanGrow="true" CanShrink="true" Text="[suppliers.BillingAddress]" TextFill.Color="DimGray"/>
      <TextObject Name="Text5" Left="359.1" Top="1.45" Width="378" Height="18.9" CanGrow="true" CanShrink="true" Text="[suppliers.Email]"/>
      <TextObject Name="Text2" Left="9.45" Top="1.45" Width="340.2" Height="18.9" CanGrow="true" CanShrink="true" Text="[suppliers.Name]" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text7" Left="916.65" Top="1.45" Width="113.4" Height="18.9" CanGrow="true" CanShrink="true" Text="[suppliers.TotalDue]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text4" Left="765.45" Top="1.45" Width="141.75" Height="18.9" CanGrow="true" CanShrink="true" Text="[suppliers.ContactNo]"/>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" ZOrder="-1" Top="304.95" Width="1047.06" Height="47.25">
      <ShapeObject Name="Shape16" Top="9.45" Width="1039.5" Height="37.8" Border.Color="Silver" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text9" Left="18.9" Top="18.9" Width="170.1" Height="18.9" Text="Supplier count:" HorzAlign="Right"/>
      <TextObject Name="Text10" Left="198.45" Top="18.9" Width="66.15" Height="18.9" Text="[Count]"/>
      <TextObject Name="Text1" Left="916.65" Top="18.9" Width="113.4" Height="18.9" Text="[Total_Due]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="2" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right"/>
      <TextObject Name="Text69" Left="737.1" Top="18.9" Width="170.1" Height="18.9" Text="Total Due:" HorzAlign="Right"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="356.2" 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>
  <DialogPage Name="Form1" ZOrder="1" Width="454" Height="266" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="258" Top="186" Width="87" Height="39" Anchor="Bottom, Right" Font="Segoe UI, 11.25pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="353" Top="186" Width="87" Height="39" Anchor="Bottom, Right" Font="Segoe UI, 11.25pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <ComboBoxControl Name="cboOrderBy" Left="184" Top="88" Width="213" Font="Tahoma, 11pt" TabIndex="2" DropDownStyle="DropDownList" DropDownWidth="213" ItemHeight="18" ItemsText="Name&#13;&#10;Total Due&#13;&#10;Last Purchase Date"/>
    <LabelControl Name="Label1" Left="92" Top="92" Width="65" Height="20" Font="Segoe UI Light, 11pt" ForeColor="DimGray" TabIndex="3" Text="Order by"/>
    <LabelControl Name="Label3" Left="32" Top="24" Width="180" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Suppliers - List"/>
    <CheckBoxControl Name="chkIncludeAddress" Left="184" Top="132" Width="167" Font="Segoe UI Light, 11pt" ForeColor="DimGray" TabIndex="7" Text="Include Billing Address"/>
  </DialogPage>
</inherited>
