﻿<?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="03/26/2015 13:08:38" 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)
    {
      dtpFromDate.Text = System.DateTime.Now.ToString(&quot;d MMMM yyy&quot;);
      dtpToDate.Text = System.DateTime.Now.ToString(&quot;d MMMM yyy&quot;);
      
      cboSupplierName.Items.Insert(0, &quot;All&quot;);
      cboSupplierName.Text = &quot;All&quot;;
      cboOrderBy.Text = cboOrderBy.Items[0].ToString();
      

    }

    
    private void btnOk_Click(object sender, EventArgs e)
    {
      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;));       
      
      string orderBy = String.Empty;
      if (cboOrderBy.Text == &quot;Date&quot;)
        orderBy = &quot;DATE_FORMAT(`Date`,'%Y-%m-%d')&quot;;      
      else if (cboOrderBy.Text == &quot;Document #&quot;)      
        orderBy = &quot;TransID&quot;;      
      else if (cboOrderBy.Text == &quot;Supplier Name&quot;)
        orderBy = &quot;SupplierName&quot;;
      else if (cboOrderBy.Text == &quot;User&quot;)
        orderBy = &quot;User&quot;; 
      
      //For a specific Supplier
      string forSupplier = &quot;ID &gt;= 0&quot;;
      if (cboSupplierName.Text != &quot;All&quot;)
        forSupplier = String.Format(&quot;SupplierName = '{0}'&quot;, cboSupplierName.Text);
      
      //Purchase Orders
      grpHeadPO.Printable = chkShowPO.Checked;
      DataPO.Printable = chkShowPO.Checked;
      GrpFootPO.Printable = chkShowPO.Checked;
      
      if (chkShowPO.Checked)
      {
        TableDataSource tPO = Report.GetDataSource(&quot;PO&quot;) as TableDataSource;
        tPO.SelectCommand = tPO.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy);
        tPO.SelectCommand = tPO.SelectCommand.ToString().Replace(&quot;@ForSupplier&quot;, forSupplier);
      }
      
      
      
    }
       
    
    
    
    
  }
}
</ScriptText>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqomabmqtwD7y3BaVO988XrjoBefSoHBX+xGSDpo0d+ot8yrzL17EhRvx7tW87ZuxDTsXprPmiOj80ATh2Aow+2w==">
      <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="InvoiceStylePath" DataType="System.String"/>
        <Column Name="InvoiceSize" DataType="System.String"/>
        <Column Name="VATrate" DataType="System.String"/>
        <Column Name="BankingDetails" DataType="System.String"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table1" Alias="suppliers" DataType="System.Int32" Enabled="true" SelectCommand="SELECT Name FROM suppliers WHERE CompanyID = @CompanyID &#13;&#10;ORDER BY Name">
        <Column Name="Name" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="PO" DataType="System.Int32" PropName="Table" Enabled="true" TableName="PO" SelectCommand="SELECT * FROM purchase_orders &#13;&#10;WHERE CompanyID = @CompanyID AND DATE_FORMAT(`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d') &#13;&#10;AND @ForSupplier &#13;&#10;ORDER BY @OrderBy">
        <Column Name="ID" DataType="System.UInt32"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="Date" DataType="System.DateTime"/>
        <Column Name="ComputerName" DataType="System.String"/>
        <Column Name="SlipNote" DataType="System.String"/>
        <Column Name="Custom1" DataType="System.String"/>
        <Column Name="Custom2" DataType="System.String"/>
        <Column Name="Custom3" DataType="System.String"/>
        <Column Name="Custom4" DataType="System.String"/>
        <Column Name="Custom5" DataType="System.String"/>
        <Column Name="Custom6" DataType="System.String"/>
        <Column Name="TotalExcl" DataType="System.Decimal"/>
        <Column Name="TotalVAT" DataType="System.Decimal"/>
        <Column Name="TotalIncl" DataType="System.Decimal"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="DeliveryAddress" DataType="System.String"/>
        <Column Name="User" DataType="System.String"/>
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="SupplierName" DataType="System.String"/>
        <Column Name="RefNo" DataType="System.String"/>
        <CommandParameter Name="fromDate" DataType="254" Expression="[FromDate]"/>
        <CommandParameter Name="toDate" DataType="254" Expression="[ToDate]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="forSupplier" DataType="254"/>
        <CommandParameter Name="orderBy" DataType="254"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="FromDate" DataType="System.String"/>
    <Parameter Name="ToDate" DataType="System.String"/>
    <Total Name="Total_Excl_PO" Expression="[PO.TotalExcl]" Evaluator="DataPO"/>
    <Total Name="Total_VAT_PO" Expression="[PO.TotalVAT]" Evaluator="DataPO"/>
    <Total Name="Total_Incl_PO" Expression="[PO.TotalIncl]" Evaluator="DataPO"/>
    <Total Name="Count_Trans_PO" TotalType="Count" Evaluator="DataPO"/>
  </Dictionary>
  <inherited Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" FirstPageSource="15" OtherPagesSource="15">
    <inherited Name="PageHeader1" Width="1047.06" Height="47.25">
      <inherited Name="_CompanyName"/>
      <ChildBand Name="Child1" ZOrder="-1" Top="51.25" Width="1047.06" Height="66.15">
        <TextObject Name="Text31" Left="18.9" Top="9.45" Width="680.4" Height="56.7" Text="Transactions - Purchases - Other" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="Text80" Left="841.05" Top="9.45" Width="189" Height="18.9" Text="[FromDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text81" Left="841.05" Top="37.8" Width="189" Height="18.9" Text="[ToDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text22" Left="727.65" Top="9.45" Width="94.5" Height="18.9" Text="From Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text23" Left="727.65" Top="37.8" Width="94.5" Height="18.9" Text="To Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      </ChildBand>
    </inherited>
    <GroupHeaderBand Name="grpHeadPO" ZOrder="0" Top="121.4" Width="1047.06" Height="94.5" RepeatOnEveryPage="true" Condition="[PO.CompanyID]" SortOrder="None">
      <ShapeObject Name="Shape21" Top="9.45" Width="406.35" Height="47.25" Border.Color="Transparent" Fill="LinearGradient" Fill.StartColor="WhiteSmoke" Fill.EndColor="White" Fill.Angle="270" Fill.Focus="1" Fill.Contrast="0.89" Shape="RoundRectangle"/>
      <TextObject Name="Text126" Left="9.45" Top="18.9" Width="330.75" Height="28.35" Text="Purchase Orders" Font="Segoe UI Light, 14pt" TextFill.Color="Navy"/>
      <ShapeObject Name="Shape22" Top="47.25" Width="1039.5" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text127" Left="170.1" Top="56.7" Width="94.5" Height="18.9" Text="Document #" HorzAlign="Right"/>
      <TextObject Name="Text128" Left="548.1" Top="56.7" Width="141.75" Height="18.9" Text="User"/>
      <TextObject Name="Text129" Left="274.05" Top="56.7" Width="264.6" Height="18.9" Text="Supplier Name"/>
      <TextObject Name="Text130" Left="9.45" Top="56.7" Width="94.5" Height="18.9" Text="Date"/>
      <TextObject Name="Text86" Left="708.75" Top="56.7" Width="94.5" Height="18.9" Text="Total Excl" HorzAlign="Right"/>
      <TextObject Name="Text87" Left="812.7" Top="56.7" Width="85.05" Height="18.9" Text="Total VAT" HorzAlign="Right"/>
      <TextObject Name="Text88" Left="907.2" Top="56.7" Width="94.5" Height="18.9" Text="Total Incl" HorzAlign="Right"/>
      <DataBand Name="DataPO" Top="219.9" Width="1047.06" Height="18.9" DataSource="PO">
        <TextObject Name="Text132" Left="170.1" Width="94.5" Height="18.9" Text="[PO.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text133" Left="9.45" Width="151.2" Height="18.9" Text="[PO.Date]" Format="Custom" Format.Format="yyyy/MM/dd HH:mm"/>
        <TextObject Name="Text134" Left="274.05" Width="264.6" Height="18.9" Text="[PO.SupplierName]" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text135" Left="548.1" Width="141.75" Height="18.9" Text="[PO.User]" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text95" Left="708.75" Width="94.5" Height="18.9" Text="[PO.TotalExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text96" Left="812.7" Width="85.05" Height="18.9" Text="[PO.TotalVAT]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text97" Left="907.2" Width="94.5" Height="18.9" Text="[PO.TotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      </DataBand>
      <GroupFooterBand Name="GrpFootPO" Top="242.8" Width="1047.06" Height="56.7">
        <ShapeObject Name="Shape23" Top="9.45" Width="1039.5" Height="37.8" Border.Color="WhiteSmoke" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text137" Left="18.9" Top="18.9" Width="160.65" Height="18.9" Text="Transaction Qty:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text138" Left="189" Top="18.9" Width="94.5" Height="18.9" Text="[Count_Trans_PO]"/>
        <TextObject Name="Text20" Left="708.75" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Excl_PO]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text21" Left="812.7" Top="18.9" Width="85.05" Height="18.9" Text="[Total_VAT_PO]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text24" Left="907.2" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Incl_PO]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="303.5" Width="1047.06" Height="37.8">
      <TextObject Name="Text36" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" Font="Arial, 9pt" TextFill.Color="DimGray"/>
      <TextObject Name="Text79" Left="765.45" Top="9.45" Width="94.5" Height="18.9" Text="Print Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text78" Left="869.4" Top="9.45" Width="160.65" Height="18.9" Text="[Date]" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </inherited>
  <DialogPage Name="Form1" ZOrder="1" Width="650" Height="434" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="462" Top="343" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="545" Top="343" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <DateTimePickerControl Name="dtpFromDate" Left="220" Top="96" Width="220" Height="27" Font="Segoe UI, 11pt" ForeColor="DimGray" TabIndex="2" Text="2 January 2014" CustomFormat="d MMMM yyy" Format="Custom" Value="01/02/2014 16:15:55"/>
    <DateTimePickerControl Name="dtpToDate" Left="220" Top="136" Width="220" Height="27" Font="Segoe UI, 11pt" ForeColor="DimGray" TabIndex="3" Text="2 January 2014" CustomFormat="d MMMM yyy" Format="Custom" Value="01/02/2014 16:14:02"/>
    <LabelControl Name="Label1" Left="72" Top="100" Width="74" Height="20" Font="Segoe UI Light, 11pt" TabIndex="4" Text="From Date"/>
    <LabelControl Name="Label2" Left="72" Top="136" Width="56" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="To Date"/>
    <LabelControl Name="Label3" Left="16" Top="24" Width="242" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Transactions - Other"/>
    <ComboBoxControl Name="cboOrderBy" Left="220" Top="228" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="Document #&#13;&#10;Date&#13;&#10;Supplier Name&#13;&#10;User"/>
    <LabelControl Name="Label4" Left="72" Top="228" Width="116" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Order records By"/>
    <ComboBoxControl Name="cboSupplierName" Left="220" Top="188" Width="341" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DataColumn="suppliers.Name" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20"/>
    <LabelControl Name="Label5" Left="72" Top="188" Width="83" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="For Supplier"/>
    <CheckBoxControl Name="chkShowPO" Left="220" Top="280" Width="169" Font="Segoe UI Light, 11pt" TabIndex="8" Text="Show Purchase Orders" Checked="true" CheckState="Checked"/>
  </DialogPage>
</inherited>
