﻿<?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/31/2015 12:10:21" 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 btnOk_Click(object sender, EventArgs e)
    {
      //Report.SetParameterValue(&quot;OrderBy&quot;, cboOrderBy.Text); DOES NOT WORK ?????
      
      TableDataSource tEmails = Report.GetDataSource(&quot;emails_sent_history&quot;) as TableDataSource; 
      string orderBy = String.Empty;
      if (cboOrderBy.Text == &quot;Date&quot;)
        orderBy = &quot;`Date`&quot;;      
      else if (cboOrderBy.Text == &quot;Transaction Type&quot;)      
        orderBy = &quot;TransType&quot;;      
      else if (cboOrderBy.Text == &quot;Recipient&quot;)
        orderBy = &quot;Recipient&quot;;
      else if (cboOrderBy.Text == &quot;Status&quot;)
        orderBy = &quot;Status&quot;;
      tEmails.SelectCommand = tEmails.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy);
      
      string selection = String.Empty;
      if (cboSelection.Text == &quot;All&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: All&quot;;
        selection = &quot;ID &gt; 0&quot;;
      }
      else if (cboSelection.Text == &quot;Failed Only&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Failed Only&quot;;
        selection = &quot;Failed = 1&quot;;
      }
      else if (cboSelection.Text == &quot;Success Only&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Success Only&quot;;
        selection = &quot;Failed = 0&quot;;
      }
      
      tEmails.SelectCommand = tEmails.SelectCommand.ToString().Replace(&quot;@Selection&quot;, selection);
    }
   
    
   

    

    private void Form1_Shown(object sender, EventArgs e)
    {
      cboSelection.Text = &quot;All&quot;;
      cboOrderBy.Text = &quot;Date&quot;;
    }
    
    
  }
}
</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"/>
        <Column Name="FinYearStartMonth" DataType="System.String"/>
        <Column Name="Scheme" DataType="System.String"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="emails_sent_history" DataType="System.Int32" Enabled="true" TableName="emails_sent_history" SelectCommand="SELECT *, IF(Failed = 1, 'Failed', 'Success') AS Status FROM emails_Sent_history WHERE companyID = @companyID AND @Selection ORDER BY @OrderBy DESC">
        <Column Name="ID" DataType="System.UInt32"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="TransType" DataType="System.String"/>
        <Column Name="Date" DataType="System.DateTime"/>
        <Column Name="Failed" DataType="System.SByte"/>
        <Column Name="FailedReason" DataType="System.String"/>
        <Column Name="User" DataType="System.String"/>
        <Column Name="Recipient" DataType="System.String"/>
        <Column Name="Status" DataType="System.String"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="orderBy" DataType="254"/>
        <CommandParameter Name="selection" DataType="254"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Total Name="Count_Total_Items" 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"/>
      <TextObject Name="Text6" ZOrder="1" Left="604.8" Width="94.5" Height="18.9" Text="Status" HorzAlign="Right"/>
      <ChildBand Name="Child1" ZOrder="-1" Top="41.8" Width="1047.06" Height="122.85">
        <ShapeObject Name="Shape7" Top="75.6" Width="1030.05" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text8" Left="406.35" Top="85.05" Width="122.85" Height="18.9" Text="Transaction Type"/>
        <TextObject Name="Text10" Left="538.65" Top="85.05" Width="94.5" Height="18.9" Text="Document #" HorzAlign="Right"/>
        <TextObject Name="Text18" Left="170.1" Top="85.05" Width="151.2" Height="18.9" Text="To e-mail address"/>
        <TextObject Name="Text19" Left="9.45" Top="85.05" Width="94.5" Height="18.9" Text="Date sent"/>
        <TextObject Name="Text21" Left="642.6" Top="85.05" Width="85.05" Height="18.9" Text="Status"/>
        <TextObject Name="Text31" Left="37.8" Top="9.45" Width="359.1" Height="56.7" Text="E-mail sent history" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="txtSelectionFeedback" Left="415.8" Top="28.35" Width="274.05" Height="28.35" Text="All" HorzAlign="Right" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="Text80" Left="737.1" Top="85.05" Width="283.5" Height="18.9" Text="Details"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data1" ZOrder="0" Top="168.65" Width="1047.06" Height="85.05" CanGrow="true" CanShrink="true" DataSource="emails_sent_history">
      <TextObject Name="Text1" Left="9.45" Width="151.2" Height="18.9" CanGrow="true" CanShrink="true" Text="[emails_sent_history.Date]" Format="Custom" Format.Format="yyyy-MM-dd HH:mm"/>
      <TextObject Name="Text2" Left="170.1" Width="226.8" Height="75.6" CanGrow="true" CanShrink="true" Text="[emails_sent_history.Recipient]"/>
      <TextObject Name="Text3" Left="406.35" Width="122.85" Height="18.9" CanGrow="true" CanShrink="true" Text="[emails_sent_history.TransType]"/>
      <TextObject Name="Text5" Left="538.65" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[emails_sent_history.TransID]" HorzAlign="Right"/>
      <TextObject Name="Text7" Left="737.1" Width="283.5" Height="75.6" CanGrow="true" CanShrink="true" Text="[emails_sent_history.FailedReason]"/>
      <TextObject Name="Text4" Left="642.6" Width="85.05" Height="18.9" Text="[emails_sent_history.Status]"/>
      <DataFooterBand Name="DataFooter1" Top="257.7" Width="1047.06" Height="56.7">
        <ShapeObject Name="Shape8" Top="9.45" Width="1030.05" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text32" Left="9.45" Top="18.9" Width="56.7" Height="18.9" Text="Totals:" TextFill.Color="DimGray"/>
      </DataFooterBand>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" ZOrder="-1" Top="318.4" Width="1047.06" Height="37.8">
      <TextObject Name="Text30" Left="189" Top="9.45" Width="94.5" Height="18.9" Text="[Count_Total_Items]"/>
      <TextObject Name="Text33" Top="9.45" Width="179.55" Height="18.9" Text="Total Product / Service Items:" HorzAlign="Right" TextFill.Color="DimGray"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="360.2" 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="434.7" Top="9.45" Width="94.5" Height="18.9" Text="Print Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text78" Left="538.65" Top="9.45" Width="160.65" Height="18.9" Text="[Date]" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </inherited>
  <DialogPage Name="Form1" ZOrder="1" Width="546" Height="302" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="350" Top="203" Height="40" Anchor="Bottom, Right" Font="Segoe UI Light, 11pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="433" Top="203" Height="40" Anchor="Bottom, Right" Font="Segoe UI Light, 11pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <LabelControl Name="Label3" Left="24" Top="24" Width="246" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Emails sent - History"/>
    <ComboBoxControl Name="cboOrderBy" Left="236" Top="144" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="Date&#13;&#10;Transaction Type&#13;&#10;Recipient&#13;&#10;Status"/>
    <LabelControl Name="Label4" Left="68" Top="148" Width="116" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Order records by"/>
    <ComboBoxControl Name="cboSelection" Left="236" Top="100" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="All&#13;&#10;Failed Only&#13;&#10;Success Only" SelectedIndexChangedEvent="cboSelection_SelectedIndexChanged"/>
    <LabelControl Name="Label5" Left="68" Top="104" Width="65" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Selection"/>
  </DialogPage>
</inherited>
