﻿<?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="08/06/2015 08:56:02" 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
  {
    
    string custom1 = string.Empty;
    string custom2 = string.Empty;
    string custom3 = string.Empty;
    string custom4 = string.Empty;
    string custom5 = string.Empty;
    string custom6 = string.Empty;
    
    private void Form1_Shown(object sender, EventArgs e)
    {
      //Shows today's date
      dtpFromDate.Text = System.DateTime.Now.ToString(&quot;d MMMM yyy&quot;);
      dtpToDate.Text = System.DateTime.Now.ToString(&quot;d MMMM yyy&quot;);
      
      cboOrderBy.Text = &quot;Document #&quot;;
      cboSelection.Text = &quot;Area&quot;;
      
      //Add the custom labels (if any)
      custom1 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel1&quot;).ToString();
      custom2 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel2&quot;).ToString();
      custom3 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel3&quot;).ToString();
      custom4 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel4&quot;).ToString();
      custom5 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel5&quot;).ToString();
      custom6 = Report.GetColumnValue(&quot;programs_config.InvCustomLabel6&quot;).ToString();
      if (custom1.Length &gt; 0) cboSelection.Items.Add(custom1);
      if (custom2.Length &gt; 0) cboSelection.Items.Add(custom2);
      if (custom3.Length &gt; 0) cboSelection.Items.Add(custom3);
      if (custom4.Length &gt; 0) cboSelection.Items.Add(custom4);
      if (custom5.Length &gt; 0) cboSelection.Items.Add(custom5);
      if (custom6.Length &gt; 0) cboSelection.Items.Add(custom6);
    }
   

    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;)); 
        
      /*
      Area
      City
      User
      */      
      string groupBy = String.Empty;
      if (cboSelection.Text == &quot;Area&quot;)
        groupBy = &quot;Area&quot;;
      else if (cboSelection.Text == &quot;City&quot;)
        groupBy = &quot;City&quot;; 
      else if (cboSelection.Text == &quot;User&quot;)
        groupBy = &quot;SalesRep&quot;; 
        //Custom fields
      else if (cboSelection.Text == custom1)
        groupBy = &quot;Custom1&quot;;
      else if (cboSelection.Text == custom2)
        groupBy = &quot;Custom2&quot;;
      else if (cboSelection.Text == custom3)
        groupBy = &quot;Custom3&quot;;
      else if (cboSelection.Text == custom4)
        groupBy = &quot;Custom4&quot;;
      else if (cboSelection.Text == custom5)
        groupBy = &quot;Custom5&quot;;
      else if (cboSelection.Text == custom6)
        groupBy = &quot;Custom6&quot;;
      
      //Document #
      //Date
      //Client Name
      string orderBy = string.Empty;
      if (cboOrderBy.Text == &quot;Document #&quot;)
        orderBy = &quot;TransID&quot;;
      else if (cboOrderBy.Text == &quot;Date&quot;)
        orderBy = &quot;TransDate&quot;;
      else if (cboOrderBy.Text == &quot;Client Name&quot;)
        orderBy = &quot;ClientName&quot;;      
      
      TableDataSource tSelection = Report.GetDataSource(&quot;total_sales&quot;) as TableDataSource; 
      tSelection.SelectCommand = tSelection.SelectCommand.ToString().Replace(&quot;@Selection&quot;, groupBy);
      
      TableDataSource tSubSelection = Report.GetDataSource(&quot;selection&quot;) as TableDataSource; 
      tSubSelection.SelectCommand = tSubSelection.SelectCommand.ToString().Replace(&quot;@Selection&quot;, groupBy);
      tSubSelection.SelectCommand = tSubSelection.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy);
      
      lblSelection.Text = cboSelection.Text;
      txtHeader.Text = &quot;Sales by &quot; + cboSelection.Text;
    }

    

    private void ReportSummary2_AfterData(object sender, EventArgs e)
    {
      decimal totProfit = Convert.ToDecimal(Report.GetTotalValue(&quot;P1_Total_Profit&quot;).ToString());
      decimal totExcl = Convert.ToDecimal(Report.GetTotalValue(&quot;P1_Total_Excl&quot;).ToString());
      if (totExcl != 0)
      {
        decimal avgGP = (totProfit/totExcl);        
        txtTotGP.Text = (avgGP * 100).ToString(&quot;#.00&quot;);  
      }
      else
      {
        txtTotGP.Text = &quot;0.00&quot;;  
      }
    }

    
    
  }
}
</ScriptText>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqvHU7gJfSuBQWLYh0DOGH3+Qi6ukYxcxpZPbTzhS1gWY2znM045239pVyhdFvZLSh9rUUZxOR6xchBWStN/gwd3TGh5B0YE4wZ7pU16+0AQo=">
      <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="total_sales" DataType="System.Int32" PropName="cash_sales" Enabled="true" TableName="total_sales" SelectCommand="DROP TEMPORARY TABLE IF EXISTS total_sales; &#13;&#10;CREATE TEMPORARY TABLE total_sales (&#13;&#10;TransDate date NOT NULL default '2000-01-01',&#13;&#10;TotalCost DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TotalProfit DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TotalExcl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TotalVAT DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TotalIncl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TransID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;TransType VARCHAR(150) NOT NULL,&#13;&#10;ClientID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;ClientName VARCHAR(150) NOT NULL,&#13;&#10;Area VARCHAR(45) NOT NULL,&#13;&#10;City VARCHAR(45) NOT NULL,&#13;&#10;SalesRep VARCHAR(45) NOT NULL,&#13;&#10;Custom1 VARCHAR(45) NOT NULL,&#13;&#10;Custom2 VARCHAR(45) NOT NULL,&#13;&#10;Custom3 VARCHAR(45) NOT NULL,&#13;&#10;Custom4 VARCHAR(45) NOT NULL,&#13;&#10;Custom5 VARCHAR(45) NOT NULL,&#13;&#10;Custom6 VARCHAR(45) NOT NULL);&#13;&#10;INSERT INTO total_sales (TransDate, TotalCost, TotalProfit, TotalExcl, TotalVAT, TotalIncl, TransID, TransType, ClientID, SalesRep, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6) &#13;&#10;SELECT i.`Date`, i.TotalCost, i.TotalSellingExcl - i.TotalCost, i.TotalSellingExcl, i.TotalVAT, i.TotalSellingIncl, s.TransID, 'Cash Sales', s.ClientID, i.SalesRep, s.Custom1, s.Custom2, s.Custom3, s.Custom4, s.Custom5, s.Custom6 &#13;&#10;FROM cash_sales_items i, cash_sales s &#13;&#10;WHERE i.ProductID &gt; 0 AND (i.CompanyID = @CompanyID) AND (s.CompanyID = @CompanyID) AND (i.RelatedID = s.TransID) AND (DATE_FORMAT(i.`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d'));&#13;&#10;INSERT INTO total_sales (TransDate, TotalCost, TotalProfit, TotalExcl, TotalVAT, TotalIncl, TransID, TransType, ClientID, SalesRep, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6) &#13;&#10;SELECT i.`Date`, i.TotalCost*-1, (i.TotalSellingExcl - i.TotalCost)*-1, i.TotalSellingExcl*-1, i.TotalVAT*-1, i.TotalSellingIncl*-1, s.TransID, 'Cash Refunds', s.ClientID, i.SalesRep, s.Custom1, s.Custom2, s.Custom3, s.Custom4, s.Custom5, s.Custom6 &#13;&#10;FROM cash_refunds_items i, cash_refunds s &#13;&#10;WHERE i.ProductID &gt; 0 AND (i.CompanyID = @CompanyID) AND (s.CompanyID = @CompanyID) AND (i.RelatedID = s.TransID) AND (DATE_FORMAT(i.`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d'));&#13;&#10;INSERT INTO total_sales (TransDate, TotalCost, TotalProfit, TotalExcl, TotalVAT, TotalIncl, TransID, TransType, ClientID, SalesRep, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6) &#13;&#10;SELECT i.`Date`, i.TotalCost, i.TotalSellingExcl - i.TotalCost, i.TotalSellingExcl, i.TotalVAT, i.TotalSellingIncl, s.TransID, 'Credit Sales', s.ClientID, i.SalesRep, s.Custom1, s.Custom2, s.Custom3, s.Custom4, s.Custom5, s.Custom6 &#13;&#10;FROM credit_sales_items i, credit_sales s &#13;&#10;WHERE i.ProductID &gt; 0 AND (i.CompanyID = @CompanyID) AND (s.CompanyID = @CompanyID) AND (i.RelatedID = s.TransID) AND (DATE_FORMAT(i.`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d'));&#13;&#10;INSERT INTO total_sales (TransDate, TotalCost, TotalProfit, TotalExcl, TotalVAT, TotalIncl, TransID, TransType, ClientID, SalesRep, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6) &#13;&#10;SELECT i.`Date`, i.TotalCost*-1, (i.TotalSellingExcl - i.TotalCost)*-1, i.TotalSellingExcl*-1, i.TotalVAT*-1, i.TotalSellingIncl*-1, s.TransID, 'Credit Notes', s.ClientID, i.SalesRep, s.Custom1, s.Custom2, s.Custom3, s.Custom4, s.Custom5, s.Custom6 &#13;&#10;FROM credit_notes_items i, credit_notes s &#13;&#10;WHERE i.ProductID &gt; 0 AND (i.CompanyID = @CompanyID) AND (s.CompanyID = @CompanyID) AND (i.RelatedID = s.TransID) AND (DATE_FORMAT(i.`Date`,'%Y-%m-%d') BETWEEN DATE_FORMAT(@FromDate,'%Y-%m-%d') AND DATE_FORMAT(@ToDate,'%Y-%m-%d'));&#13;&#10;UPDATE total_sales s, clients c SET s.ClientName = c.Name, s.Area = c.Area, s.City = c.City WHERE c.CompanyID = @CompanyID AND s.ClientID = c.ClientID;&#13;&#10;SELECT @Selection AS Selection, COUNT(DISTINCT(TransID)) AS TotalTrans, SUM(TotalProfit) AS TotalProfit, SUM(TotalExcl) AS TotalExcl, SUM(TotalIncl) AS TotalIncl, (SUM(TotalProfit)/SUM(TotalExcl))*100 AS GP &#13;&#10;FROM total_sales &#13;&#10;GROUP BY @Selection &#13;&#10;ORDER BY @OrderBy;">
        <Column Name="TotalProfit" DataType="System.Decimal"/>
        <Column Name="TotalIncl" DataType="System.Decimal"/>
        <Column Name="GP" DataType="System.Decimal"/>
        <Column Name="TotalTrans" DataType="System.Int64"/>
        <Column Name="TotalExcl" DataType="System.Decimal"/>
        <Column Name="Selection" DataType="System.String"/>
        <CommandParameter Name="companyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="fromDate" DataType="254" Expression="[FromDate]"/>
        <CommandParameter Name="toDate" DataType="254" Expression="[ToDate]"/>
        <CommandParameter Name="Selection" DataType="254"/>
        <CommandParameter Name="OrderBy" DataType="254"/>
      </TableDataSource>
      <TableDataSource Name="Table" Alias="selection" DataType="System.Int32" Enabled="true" SelectCommand="SELECT ClientName, TransDate, TransID, TransType, SUM(TotalExcl) AS TotalExcl, SUM(TotalVAT) AS TotalVAT, SUM(TotalIncl) AS TotalIncl &#13;&#10;FROM total_sales &#13;&#10;WHERE @Selection = @SubSelection &#13;&#10;GROUP BY TransType, TransID &#13;&#10;ORDER BY @OrderBy">
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="TransType" DataType="System.String"/>
        <Column Name="TotalExcl" DataType="System.Decimal"/>
        <Column Name="TotalVAT" DataType="System.Decimal"/>
        <Column Name="TotalIncl" DataType="System.Decimal"/>
        <Column Name="ClientName" DataType="System.String"/>
        <CommandParameter Name="Selection" DataType="254" Expression="[Selection]"/>
        <CommandParameter Name="SubSelection" DataType="254" Expression="[SubSelection]"/>
        <CommandParameter Name="OrderBy" DataType="254"/>
      </TableDataSource>
      <TableDataSource Name="programs_config" DataType="System.Int32" Enabled="true" TableName="programs_config" SelectCommand="SELECT QtyDecimalValue, InvCustomLabel1, InvCustomLabel2, InvCustomLabel3, InvCustomLabel4, InvCustomLabel5, InvCustomLabel6 FROM programs_config WHERE CompanyID = @CompanyID">
        <Column Name="InvCustomLabel1" DataType="System.String"/>
        <Column Name="InvCustomLabel2" DataType="System.String"/>
        <Column Name="InvCustomLabel3" DataType="System.String"/>
        <Column Name="InvCustomLabel4" DataType="System.String"/>
        <Column Name="InvCustomLabel5" DataType="System.String"/>
        <Column Name="InvCustomLabel6" DataType="System.String"/>
        <Column Name="QtyDecimalValue" DataType="System.UInt32"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="FromDate" DataType="System.String"/>
    <Parameter Name="ToDate" DataType="System.String"/>
    <Parameter Name="Selection" DataType="System.String"/>
    <Parameter Name="SubSelection" DataType="System.String"/>
    <Total Name="Sub_TotExcl" Expression="[selection.TotalExcl]" Evaluator="Data2" PrintOn="GroupFooter1"/>
    <Total Name="Sub_TotVAT" Expression="[selection.TotalVAT]" Evaluator="Data2" PrintOn="GroupFooter1"/>
    <Total Name="Sub_TotIncl" Expression="[selection.TotalIncl]" Evaluator="Data2" PrintOn="GroupFooter1"/>
    <Total Name="TotExcl" Expression="[selection.TotalExcl]" Evaluator="Data2"/>
    <Total Name="TotVAT" Expression="[selection.TotalVAT]" Evaluator="Data2"/>
    <Total Name="TotIncl" Expression="[selection.TotalIncl]" Evaluator="Data2"/>
    <Total Name="P1_Total_Profit" Expression="[total_sales.TotalProfit]" Evaluator="Data1" PrintOn="ReportSummary2"/>
    <Total Name="P1_Total_Excl" Expression="[total_sales.TotalExcl]" Evaluator="Data1" PrintOn="ReportSummary2"/>
    <Total Name="P1_Total_Trans" Expression="[total_sales.TotalTrans]" Evaluator="Data1" PrintOn="ReportSummary2"/>
    <Total Name="P1_Total_Incl" Expression="[total_sales.TotalIncl]" Evaluator="Data1" PrintOn="ReportSummary2"/>
    <Total Name="P1_AVG_GP" TotalType="Avg" Expression="[total_sales.GP]" Evaluator="Data1" PrintOn="ReportSummary2"/>
    <Total Name="SubTotal_Transactions" TotalType="Count" Evaluator="Data2" PrintOn="GroupFooter1"/>
    <Total Name="Total_Transactions" TotalType="Count" Evaluator="Data2" PrintOn="ReportSummary1"/>
  </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="75.6">
        <TextObject Name="txtHeader" Left="18.9" Top="9.45" Width="699.3" Height="56.7" Text="Sales - Grouped by [cboSelection.Text]" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="Text80" Left="859.95" Top="9.45" Width="170.1" Height="18.9" Text="[FromDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text81" Left="859.95" Top="37.8" Width="170.1" Height="18.9" Text="[ToDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text22" Left="756" Top="9.45" Width="94.5" Height="18.9" Text="From Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text23" Left="756" Top="37.8" Width="94.5" Height="18.9" Text="To Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data3" ZOrder="0" Top="130.85" Width="1047.06" Height="529.2" PrintOn="FirstPage">
      <MSChartObject Name="MSChart1" Left="18.9" Width="1011.15" Height="529.2" Hyperlink.Kind="DetailPage" Hyperlink.Expression="[total_sales.Selection]" Hyperlink.DetailPageName="Page2" Hyperlink.ReportParameter="SubSelection" DataSource="total_sales" ChartData="PENoYXJ0IFBhbGV0dGU9IlNlbWlUcmFuc3BhcmVudCIgU2l6ZT0iMjg4LCAyMzIiIEJhY2tHcmFkaWVudFN0eWxlPSJEaWFnb25hbExlZnQiIEJhY2tTZWNvbmRhcnlDb2xvcj0iV2hpdGUiIEJvcmRlcmxpbmVDb2xvcj0iU2lsdmVyIiBCb3JkZXJsaW5lRGFzaFN0eWxlPSJTb2xpZCI+DQogIDxTZXJpZXM+DQogICAgPFNlcmllcyBOYW1lPSJTZXJpZXMxIiBMZWdlbmQ9IkRlZmF1bHQiIFhWYWx1ZVR5cGU9IlN0cmluZyIgWVZhbHVlVHlwZT0iRG91YmxlIiBTaGFkb3dPZmZzZXQ9IjQiIFNoYWRvd0NvbG9yPSIxMjgsIDE5MiwgMTkyLCAxOTIiIENoYXJ0QXJlYT0iRGVmYXVsdCIgTGFiZWw9IiNWQUx7IyAjIyMgIyMjfSIgQ29sb3I9IjE0MiwgMzAsIDE0NCwgMjU1IiBCb3JkZXJDb2xvcj0iVHJhbnNwYXJlbnQiIEJhY2tTZWNvbmRhcnlDb2xvcj0iV2hpdGUiIExhYmVsRm9yZUNvbG9yPSJHcmF5IiBNYXJrZXJDb2xvcj0iQmxhY2siIE1hcmtlckJvcmRlckNvbG9yPSJJbmRpYW5SZWQiIEN1c3RvbVByb3BlcnRpZXM9IkRyYXdpbmdTdHlsZT1DeWxpbmRlciIgTGFiZWxCYWNrQ29sb3I9IjE4NCwgMjU1LCAyNTUsIDI1NSI+DQogICAgICA8UG9pbnRzPg0KICAgICAgICA8RGF0YVBvaW50IFlWYWx1ZXM9IjEiIEF4aXNMYWJlbD0iQSIgLz4NCiAgICAgICAgPERhdGFQb2ludCBZVmFsdWVzPSIyIiBBeGlzTGFiZWw9IkIiIC8+DQogICAgICA8L1BvaW50cz4NCiAgICA8L1Nlcmllcz4NCiAgPC9TZXJpZXM+DQogIDxMZWdlbmRzPg0KICAgIDxMZWdlbmQgTmFtZT0iRGVmYXVsdCIgRW5hYmxlZD0iRmFsc2UiPg0KICAgIDwvTGVnZW5kPg0KICA8L0xlZ2VuZHM+DQogIDxUaXRsZXM+DQogICAgPFRpdGxlIE5hbWU9IlRpdGxlMSIgVmlzaWJsZT0iRmFsc2UiPg0KICAgIDwvVGl0bGU+DQogIDwvVGl0bGVzPg0KICA8Q2hhcnRBcmVhcz4NCiAgICA8Q2hhcnRBcmVhIE5hbWU9IkRlZmF1bHQiIFNoYWRvd0NvbG9yPSIxMjgsIDEwNSwgMTA1LCAxMDUiPg0KICAgICAgPEF4aXNZPg0KICAgICAgICA8TWFqb3JHcmlkIExpbmVDb2xvcj0iNjQsIDIyMCwgMjIwLCAyMjAiIC8+DQogICAgICAgIDxNaW5vckdyaWQgTGluZUNvbG9yPSJXaGl0ZVNtb2tlIiBMaW5lRGFzaFN0eWxlPSJEb3QiIEVuYWJsZWQ9IlRydWUiIC8+DQogICAgICAgIDxMYWJlbFN0eWxlIEZvcm1hdD0iIyAjIyMgIyMwLjAwIiAvPg0KICAgICAgPC9BeGlzWT4NCiAgICAgIDxBeGlzWCBJbnRlcnZhbD0iMSI+DQogICAgICAgIDxNYWpvckdyaWQgTGluZUNvbG9yPSI2NCwgMjExLCAyMTEsIDIxMSIgRW5hYmxlZD0iRmFsc2UiIC8+DQogICAgICAgIDxNaW5vckdyaWQgTGluZUNvbG9yPSJXaGl0ZVNtb2tlIiBMaW5lRGFzaFN0eWxlPSJEb3QiIC8+DQogICAgICA8L0F4aXNYPg0KICAgICAgPEF4aXNYMj4NCiAgICAgICAgPE1ham9yR3JpZCBMaW5lQ29sb3I9IjY0LCA2NCwgNjQsIDY0IiAvPg0KICAgICAgPC9BeGlzWDI+DQogICAgICA8QXhpc1kyPg0KICAgICAgICA8TWFqb3JHcmlkIExpbmVDb2xvcj0iNjQsIDY0LCA2NCwgNjQiIC8+DQogICAgICA8L0F4aXNZMj4NCiAgICA8L0NoYXJ0QXJlYT4NCiAgPC9DaGFydEFyZWFzPg0KPC9DaGFydD4=">
        <MSChartSeries Name="Series1" XValue="[total_sales.Selection]" YValue1="[total_sales.TotalExcl]"/>
      </MSChartObject>
    </DataBand>
    <DataBand Name="Data1" ZOrder="1" Top="724.75" Width="1047.06" Height="18.9" DataSource="total_sales">
      <TextObject Name="Text1" Left="37.8" Width="472.5" Height="18.9" Cursor="Hand" Hyperlink.Kind="DetailPage" Hyperlink.Expression="[total_sales.Selection]" Hyperlink.DetailPageName="Page2" Hyperlink.ReportParameter="SubSelection" Text="[total_sales.Selection]" Font="Arial, 10pt, style=Underline" TextFill.Color="Blue"/>
      <TextObject Name="Text11" Left="916.65" Width="94.5" Height="18.9" Text="[total_sales.TotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text4" Left="812.7" Width="94.5" Height="18.9" Text="[total_sales.TotalExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text3" Left="708.75" Width="94.5" Height="18.9" Text="[total_sales.TotalProfit]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text14" Left="633.15" Width="66.15" Height="18.9" Text="[total_sales.GP]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text7" Left="519.75" Width="103.95" Height="18.9" Text="[total_sales.TotalTrans]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <DataHeaderBand Name="DataHeader2" Top="664.05" Width="1047.06" Height="56.7" StartNewPage="true">
        <ShapeObject Name="Shape7" Left="18.9" Top="9.45" Width="1011.15" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="lblSelection" Left="37.8" Top="18.9" Width="472.5" Height="18.9" Text="Selection"/>
        <TextObject Name="Text10" Left="519.75" Top="18.9" Width="103.95" Height="18.9" Text="Transactions" HorzAlign="Right"/>
        <TextObject Name="Text104" Left="633.15" Top="18.9" Width="66.15" Height="18.9" Text="GP %" HorzAlign="Right"/>
        <TextObject Name="Text105" Left="708.75" Top="18.9" Width="94.5" Height="18.9" Text="Total Profit" HorzAlign="Right"/>
        <TextObject Name="Text8" Left="812.7" Top="18.9" Width="94.5" Height="18.9" Text="Total Excl" HorzAlign="Right"/>
        <TextObject Name="Text12" Left="916.65" Top="18.9" Width="94.5" Height="18.9" Text="Total Incl" HorzAlign="Right"/>
      </DataHeaderBand>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary2" ZOrder="-1" Top="747.65" Width="1047.06" Height="56.7" AfterDataEvent="ReportSummary2_AfterData">
      <ShapeObject Name="Shape14" Left="18.9" Top="9.45" Width="1011.15" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="txtTotGP" Left="633.15" Top="18.9" Width="66.15" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text39" Left="708.75" Top="18.9" Width="94.5" Height="18.9" Text="[P1_Total_Profit]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text40" Left="812.7" Top="18.9" Width="94.5" Height="18.9" Text="[P1_Total_Excl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
      <TextObject Name="Text41" Left="519.75" Top="18.9" Width="103.95" Height="18.9" Text="[P1_Total_Trans]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right"/>
      <TextObject Name="Text42" Left="916.65" Top="18.9" Width="94.5" Height="18.9" Text="[P1_Total_Incl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="808.35" 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>
  <ReportPage Name="Page2" ZOrder="1" Visible="false">
    <ReportTitleBand Name="ReportTitle2" Width="718.2" Height="37.8"/>
    <PageHeaderBand Name="PageHeader2" Top="41.8" Width="718.2" Height="75.6" CanGrow="true" CanShrink="true">
      <TextObject Name="Text106" Left="18.9" Top="9.45" Width="359.1" Height="56.7" CanGrow="true" CanShrink="true" Text="Sales for [SubSelection]" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
      <TextObject Name="Text107" Left="500.85" Top="9.45" Width="189" Height="18.9" CanGrow="true" CanShrink="true" Text="[FromDate]" Format="Custom" Format.Format="d MMMM yyy"/>
      <TextObject Name="Text108" Left="500.85" Top="37.8" Width="189" Height="18.9" CanGrow="true" CanShrink="true" Text="[ToDate]" Format="Custom" Format.Format="d MMMM yyy"/>
      <TextObject Name="Text109" Left="387.45" Top="9.45" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="From Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text110" Left="387.45" Top="37.8" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="To Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
    </PageHeaderBand>
    <GroupHeaderBand Name="GroupHeader1" Top="121.4" Width="718.2" Height="94.5" RepeatOnEveryPage="true" Condition="[selection.TransType]" SortOrder="None">
      <ShapeObject Name="Shape9" Left="9.45" 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"/>
      <ShapeObject Name="Shape11" Left="9.45" Top="47.25" Width="699.3" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text21" Left="18.9" Top="18.9" Width="255.15" Height="28.35" Text="[selection.TransType]" Font="Segoe UI Light, 14pt" TextFill.Color="RoyalBlue"/>
      <TextObject Name="Text16" Left="18.9" Top="56.7" Width="94.5" Height="18.9" Text="Date"/>
      <TextObject Name="Text18" Left="122.85" Top="56.7" Width="103.95" Height="18.9" Text="Document #" HorzAlign="Right"/>
      <TextObject Name="Text25" Left="425.25" Top="56.7" Width="85.05" Height="18.9" Text="Total Excl" HorzAlign="Right"/>
      <TextObject Name="Text27" Left="519.75" Top="56.7" Width="85.05" Height="18.9" Text="Total VAT" HorzAlign="Right"/>
      <TextObject Name="Text29" Left="614.25" Top="56.7" Width="85.05" Height="18.9" Text="Total Incl" HorzAlign="Right"/>
      <TextObject Name="Text115" Left="236.25" Top="56.7" Width="179.55" Height="18.9" Text="Client Name"/>
      <DataBand Name="Data2" Top="219.9" Width="718.2" Height="47.25" CanGrow="true" CanShrink="true" DataSource="Table">
        <TextObject Name="Text15" Left="18.9" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[selection.TransDate]" Format="Date" Format.Format="d"/>
        <TextObject Name="Text17" Left="141.75" Width="85.05" Height="18.9" CanGrow="true" CanShrink="true" Text="[selection.TransID]" HorzAlign="Right"/>
        <TextObject Name="Text24" Left="425.25" Width="85.05" Height="18.9" CanGrow="true" CanShrink="true" Text="[selection.TotalExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text26" Left="519.75" Width="85.05" Height="18.9" CanGrow="true" CanShrink="true" Text="[selection.TotalVAT]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text28" Left="614.25" Width="85.05" Height="18.9" CanGrow="true" CanShrink="true" Text="[selection.TotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
        <TextObject Name="Text6" Left="236.25" Width="179.55" Height="47.25" CanGrow="true" CanShrink="true" Text="[selection.ClientName]"/>
      </DataBand>
      <GroupFooterBand Name="GroupFooter1" Top="271.15" Width="718.2" Height="56.7">
        <ShapeObject Name="Shape12" Left="9.45" Top="9.45" Width="699.3" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text30" Left="425.25" Top="18.9" Width="85.05" Height="18.9" Text="[Sub_TotExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text32" Left="519.75" Top="18.9" Width="85.05" Height="18.9" Text="[Sub_TotVAT]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text33" Left="614.25" Top="18.9" Width="85.05" Height="18.9" Text="[Sub_TotIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text2" Left="18.9" Top="18.9" Width="132.3" Height="18.9" Text="Transactions: [SubTotal_Transactions]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1"/>
        <TextObject Name="Text116" Left="321.3" Top="18.9" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="Sub Total:" HorzAlign="Right" TextFill.Color="DimGray"/>
      </GroupFooterBand>
    </GroupHeaderBand>
    <ReportSummaryBand Name="ReportSummary1" Top="331.85" Width="718.2" Height="47.25">
      <ShapeObject Name="Shape13" Left="9.45" Top="9.45" Width="699.3" Height="37.8" Border.Color="Transparent" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
      <TextObject Name="Text34" Left="425.25" Top="18.9" Width="85.05" Height="18.9" Text="[TotExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" Font="Arial, 10pt, style=Bold"/>
      <TextObject Name="Text35" Left="519.75" Top="18.9" Width="85.05" Height="18.9" Text="[TotVAT]" Format="Number" Format.UseLocale="true" HorzAlign="Right" Font="Arial, 10pt, style=Bold"/>
      <TextObject Name="Text37" Left="614.25" Top="18.9" Width="85.05" Height="18.9" Text="[TotIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" Font="Arial, 10pt, style=Bold"/>
      <TextObject Name="Text5" Left="18.9" Top="18.9" Width="132.3" Height="18.9" Text="Transactions: [Total_Transactions]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1"/>
      <TextObject Name="Text117" Left="321.3" Top="18.9" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="Total:" HorzAlign="Right" TextFill.Color="DimGray"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter2" Top="383.1" Width="718.2" Height="28.35">
      <TextObject Name="Text112" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" Font="Arial, 9pt" TextFill.Color="DimGray"/>
      <TextObject Name="Text113" Left="425.25" Top="9.45" Width="94.5" Height="18.9" Text="Print Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text114" Left="529.2" Top="9.45" Width="160.65" Height="18.9" Text="[Date]" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </ReportPage>
  <DialogPage Name="Form1" ZOrder="2" Width="582" Height="398" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="398" Top="311" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="481" Top="311" Height="40" Anchor="Bottom, Right" Font="Segoe UI, 10pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <DateTimePickerControl Name="dtpFromDate" Left="240" Top="96" Width="212" 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="240" Top="152" Width="212" 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="152" Width="56" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="To Date"/>
    <LabelControl Name="Label3" Left="16" Top="24" Width="197" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Sales - Grouped"/>
    <ComboBoxControl Name="cboOrderBy" Left="240" Top="252" 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;Client Name"/>
    <LabelControl Name="Label4" Left="72" Top="252" Width="116" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Order records By"/>
    <ComboBoxControl Name="cboSelection" Left="240" Top="204" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="Area&#13;&#10;City&#13;&#10;User"/>
    <LabelControl Name="Label5" Left="72" Top="204" Width="118" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Group records by"/>
  </DialogPage>
</inherited>
