﻿<?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/11/2015 08:30:53" 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;);
      
      cboOrderBy.Text = &quot;Description&quot;;
      cboSelItem.Text = &quot;Date&quot;;
      
      cboSelection.Text = &quot;All&quot;;
    }

    private void Data2_AfterData(object sender, EventArgs e)
    {
      txtSelProductCode.Text = &quot;Items Sold for - &quot; + Report.GetParameterValue(&quot;SelProductCode&quot;).ToString();
      txtSelDescription.Text = Report.GetColumnValue(&quot;SelectedProduct.Description&quot;).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;));
      //Report.SetParameterValue(&quot;OrderBy&quot;, cboOrderBy.Text); DOES NOT WORK ?????
      
      TableDataSource tItemsSold = Report.GetDataSource(&quot;items_sold&quot;) as TableDataSource;
      
      //For Selection
      string selection = String.Empty;
      if (cboSelection.Text == &quot;All&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: All&quot;;
        selection = &quot;p.ID &gt; 0&quot;;
      }
      else if (cboSelection.Text == &quot;Products Only&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Products Only&quot;;
        selection = &quot;p.IsProduct = 1&quot;;
      }
      else if (cboSelection.Text == &quot;Services Only&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Services Only&quot;;
        selection = &quot;p.IsProduct = 0&quot;;
      }
      else if (cboSelection.Text == &quot;Category =&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Category = &quot; + cboCategory.Text;
        selection = &quot;p.Category = '&quot; + cboCategory.Text + &quot;'&quot;;
      }
      else if (cboSelection.Text == &quot;Sub Category =&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Sub Category = &quot; + cboSubCategory.Text;
        selection = &quot;p.SubCategory = '&quot; + cboSubCategory.Text + &quot;'&quot;; 
      }
      else if (cboSelection.Text == &quot;Location =&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Location = &quot; + cboLocation.Text;
        selection = &quot;p.Location = '&quot; + cboLocation.Text + &quot;'&quot;;
      }
      else if (cboSelection.Text == &quot;Sub Location =&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Sub Location = &quot; + cboSubLocation.Text;
        selection = &quot;p.SubLocation = '&quot; + cboSubLocation.Text + &quot;'&quot;; 
      }
      else if (cboSelection.Text == &quot;Below Min. Qty&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Items below Min. Qty&quot;;
        selection = &quot;p.QtyAvailable &lt; p.MinQty&quot;; 
      }     
      else if (cboSelection.Text == &quot;Main Supplier =&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Main Supplier = &quot; + cboSupplier.Text;
        selection = &quot;p.MainSupplierID = '&quot; + ComboBox2.Text + &quot;'&quot;;
      }
      else if (cboSelection.Text == &quot;On Promotion&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: On Promotion &quot;;
        selection = &quot;i.IsOnPromotion = 1&quot;;
      }
      else if (cboSelection.Text == &quot;Not on Promotion&quot;)
      {
        txtSelectionFeedback.Text = &quot;Selection: Not on Promotion &quot;;
        selection = &quot;i.IsOnPromotion = 0&quot;;
      }
      tItemsSold.SelectCommand = tItemsSold.SelectCommand.ToString().Replace(&quot;@Selection&quot;, selection);
      
      //For Items Sold       
      string orderBy = String.Empty;
      if (cboOrderBy.Text == &quot;Product code&quot;)
        orderBy = &quot;ProductCode&quot;;      
      else if (cboOrderBy.Text == &quot;Description&quot;)      
        orderBy = &quot;Description&quot;;      
      else if (cboOrderBy.Text == &quot;Qty sold&quot;)
        orderBy = &quot;Qty DESC&quot;;
      else if (cboOrderBy.Text == &quot;Profit made&quot;)
        orderBy = &quot;Profit DESC&quot;;       
      tItemsSold.SelectCommand = tItemsSold.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy);
      
      //For Selected Item
      TableDataSource tSelItem = Report.GetDataSource(&quot;SelectedProduct&quot;) as TableDataSource;
      if (cboSelItem.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;Client Name&quot;)
        orderBy = &quot;ClientName&quot;;
      else if (cboOrderBy.Text == &quot;Sales Rep&quot;)
        orderBy = &quot;SalesRep&quot;;       
      tSelItem.SelectCommand = tSelItem.SelectCommand.ToString().Replace(&quot;@OrderBy&quot;, orderBy);
    }

    private void DataFooter1_AfterData(object sender, EventArgs e)
    {
      decimal totProfit = Convert.ToDecimal(Report.GetTotalValue(&quot;Total_Profit&quot;).ToString());
      decimal totExcl = Convert.ToDecimal(Report.GetTotalValue(&quot;Total_Excl&quot;).ToString());
      if (totExcl != 0)
      {
        decimal avgGP = (totProfit/totExcl);
        decimal avgMUP = (avgGP/(1-avgGP));
      
        txtTotGP.Text = (avgGP * 100).ToString(&quot;#.00&quot;);
        txtTotMup.Text = (avgMUP * 100).ToString(&quot;#.00&quot;);
      }
      else
      {
        txtTotGP.Text = &quot;0.00&quot;;
        txtTotMup.Text = &quot;0.00&quot;;
      }
      
      //total Qty Column format      
      int decimalValue = Convert.ToInt32(Report.GetColumnValue(&quot;programs_config.QtyDecimalValue&quot;));
      decimal qtyVal = 0; 
      if (Decimal.TryParse(txtQtyTotal.Text, out qtyVal))
      {
        txtQtyTotal.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
    }

    private void Data1_AfterData(object sender, EventArgs e)
    {
      //total Qty Column format      
      int decimalValue = Convert.ToInt32(Report.GetColumnValue(&quot;programs_config.QtyDecimalValue&quot;));
      decimal qtyVal = 0; 
      if (Decimal.TryParse(txtQty.Text, out qtyVal))
      {
        txtQty.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
      if (Decimal.TryParse(txtQtyAvail.Text, out qtyVal))
      {
        txtQtyAvail.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
    }

    private void cboSelection_SelectedIndexChanged(object sender, EventArgs e)
    {
      cboCategory.Visible = false;
      cboSubCategory.Visible = false;
      cboLocation.Visible = false;
      cboSubLocation.Visible = false;
      cboSupplier.Visible = false;
      
      if (cboSelection.Text == &quot;Category =&quot;)
        cboCategory.Visible = true;       
      else if (cboSelection.Text == &quot;Sub Category =&quot;)
        cboSubCategory.Visible = true;
      else if (cboSelection.Text == &quot;Location =&quot;)
        cboLocation.Visible = true;       
      else if (cboSelection.Text == &quot;Sub Location =&quot;)
        cboSubLocation.Visible = true;
      else if (cboSelection.Text == &quot;Main Supplier =&quot;)
        cboSupplier.Visible = true;
    }
    
  }
}
</ScriptText>
  <Dictionary>
    <MySqlDataConnection Name="Connection" ConnectionString="rijcmlqvHU7gJfSuBQWLYh0DOGH36lfC1TcDtAUooRyTFZbrVjGmHtHf3N0GA+qWNyE3516M4ML27HL8NranU0mC//INFfcWYsXydOrrBdCwf9X7Dw=">
      <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="Table1" Alias="SelectedProduct" DataType="System.Int32" Enabled="true" SelectCommand="SELECT * FROM items_sold WHERE ProductCode = @SelProductCode">
        <Column Name="TransType" DataType="System.String"/>
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="ClientID" DataType="System.UInt32"/>
        <Column Name="ClientName" DataType="System.String"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="TransTotalCost" DataType="System.Decimal"/>
        <Column Name="TransTotalExcl" DataType="System.Decimal"/>
        <Column Name="TransTotalIncl" DataType="System.Decimal"/>
        <Column Name="ProductID" DataType="System.UInt32"/>
        <Column Name="ProductCode" DataType="System.String"/>
        <Column Name="Description" DataType="System.String"/>
        <Column Name="Qty" DataType="System.Decimal"/>
        <Column Name="IsProduct" DataType="System.Byte"/>
        <Column Name="SalesRep" DataType="System.String"/>
        <CommandParameter Name="selProductCode" DataType="254" Expression="[SelProductCode]"/>
      </TableDataSource>
      <TableDataSource Name="items_sold" DataType="System.Int32" Enabled="true" TableName="items_sold" SelectCommand="DROP TEMPORARY TABLE IF EXISTS items_sold; &#13;&#10;CREATE TEMPORARY TABLE items_sold (&#13;&#10;TransType VARCHAR(45) NOT NULL,&#13;&#10;TransDate DATETIME NOT NULL default '2000-01-01 00:00',&#13;&#10;TransID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;ClientID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;ClientName VARCHAR(245) NOT NULL,&#13;&#10;CompanyID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;TransTotalCost DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TransTotalExcl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;TransTotalIncl DECIMAL(10,2) NOT NULL DEFAULT 0.00,&#13;&#10;ProductID INT(10) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;ProductCode VARCHAR(45) NOT NULL,&#13;&#10;Description VARCHAR(450) NOT NULL,&#13;&#10;Qty DECIMAL(14,2) NOT NULL DEFAULT 0.00,&#13;&#10;IsProduct TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;IsOnPromotion TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,&#13;&#10;SalesRep VARCHAR(45) NOT NULL);&#13;&#10;INSERT INTO items_sold (TransType, TransDate, TransID, ClientID, ClientName, CompanyID, TransTotalCost, TransTotalExcl, TransTotalIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep) &#13;&#10;SELECT 'Cash Sale' AS TransType, `Date`, RelatedID, ClientID, '' AS ClientName, CompanyID, TotalCost, TotalSellingExcl, TotalSellingIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep FROM cash_sales_items &#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')) AND ProductID &gt; 0;&#13;&#10;INSERT INTO items_sold (TransType,TransDate, TransID, ClientID, ClientName, CompanyID, TransTotalCost, TransTotalExcl, TransTotalIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep) &#13;&#10;SELECT 'Cash Refund' AS TransType, `Date`, RelatedID, ClientID, '' AS ClientName, CompanyID, TotalCost*-1, TotalSellingExcl*-1, TotalSellingIncl*-1, ProductID, ProductCode, Description, Qty*-1, IsProduct, IsOnPromotion, SalesRep FROM cash_refunds_items &#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') AND ProductID &gt; 0;&#13;&#10;INSERT INTO items_sold (TransType,TransDate, TransID, ClientID, ClientName, CompanyID, TransTotalCost, TransTotalExcl, TransTotalIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep) &#13;&#10;SELECT 'Credit Sale' AS TransType, `Date`, RelatedID, ClientID, '' AS ClientName, CompanyID, TotalCost, TotalSellingExcl, TotalSellingIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep FROM credit_sales_items &#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') AND ProductID &gt; 0;&#13;&#10;INSERT INTO items_sold (TransType,TransDate, TransID, ClientID, ClientName, CompanyID, TransTotalCost, TransTotalExcl, TransTotalIncl, ProductID, ProductCode, Description, Qty, IsProduct, IsOnPromotion, SalesRep) &#13;&#10;SELECT 'Credit Note' AS TransType, `Date`, RelatedID, ClientID, '' AS ClientName, CompanyID, TotalCost*-1, TotalSellingExcl*-1, TotalSellingIncl*-1, ProductID, ProductCode, Description, Qty*-1, IsProduct, IsOnPromotion, SalesRep FROM credit_notes_items &#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') AND ProductID &gt; 0;&#13;&#10;UPDATE items_sold i, clients c SET i.ClientName = c.Name WHERE i.ClientID = c.ClientID AND (c.CompanyID = @CompanyID);&#13;&#10;SELECT i.TransType, i.TransDate, i.TransID, i.ClientID, i.ClientName, i.CompanyID, SUM(i.TransTotalCost) AS TransTotalCost, SUM(i.TransTotalExcl) AS TransTotalExcl, &#13;&#10;SUM(i.TransTotalIncl) AS TransTotalIncl, i.ProductID, i.ProductCode, i.Description, SUM(i.Qty) AS Qty, i.IsProduct, SUM(IF(TransTotalCost &lt;&gt; 0, (TransTotalExcl - TransTotalCost), 0)) AS Profit, &#13;&#10;SUM(IF(TransTotalCost &lt;&gt; 0, ((TransTotalExcl - TransTotalCost)/TransTotalExcl)*100, 0)) AS ProfitPercentage, &#13;&#10;SUM(IF(TransTotalCost &lt;&gt; 0, ((TransTotalExcl - TransTotalCost)/IF(TransTotalCost = 0, 1, TransTotalCost))*100, 0)) AS MupPercentage, p.QtyAvailable &#13;&#10;FROM items_sold i, products p WHERE (i.ProductID = p.ProductID) AND (p.CompanyID = @CompanyID) AND @Selection &#13;&#10;GROUP BY i.ProductID &#13;&#10;ORDER BY @OrderBy&#13;&#10;">
        <Column Name="TransType" DataType="System.String"/>
        <Column Name="TransDate" DataType="System.DateTime"/>
        <Column Name="TransID" DataType="System.UInt32"/>
        <Column Name="ClientID" DataType="System.UInt32"/>
        <Column Name="ClientName" DataType="System.String"/>
        <Column Name="CompanyID" DataType="System.UInt32"/>
        <Column Name="TransTotalCost" DataType="System.Decimal"/>
        <Column Name="TransTotalExcl" DataType="System.Decimal"/>
        <Column Name="TransTotalIncl" DataType="System.Decimal"/>
        <Column Name="ProductID" DataType="System.UInt32"/>
        <Column Name="ProductCode" DataType="System.String"/>
        <Column Name="Description" DataType="System.String"/>
        <Column Name="Qty" DataType="System.Decimal"/>
        <Column Name="IsProduct" DataType="System.Byte"/>
        <Column Name="Profit" DataType="System.Decimal"/>
        <Column Name="ProfitPercentage" DataType="System.Decimal"/>
        <Column Name="MupPercentage" DataType="System.Decimal"/>
        <Column Name="QtyAvailable" DataType="System.Decimal"/>
        <CommandParameter Name="FromDate" DataType="254" Expression="[FromDate]"/>
        <CommandParameter Name="ToDate" DataType="254" Expression="[ToDate]"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="orderBy" DataType="254"/>
        <CommandParameter Name="Selection" DataType="254"/>
      </TableDataSource>
      <TableDataSource Name="programs_config" DataType="System.Int32" Enabled="true" TableName="programs_config" SelectCommand="SELECT QtyDecimalValue FROM programs_config WHERE CompanyID = @CompanyID">
        <Column Name="QtyDecimalValue" DataType="System.UInt32"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table" Alias="Categories" DataType="System.Int32" Enabled="true" SelectCommand="SELECT DISTINCT(Category) AS Category FROM products WHERE CompanyID = @CompanyID ORDER BY Category">
        <Column Name="Category" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table2" Alias="SubCategories" DataType="System.Int32" Enabled="true" SelectCommand="SELECT DISTINCT(SubCategory) AS SubCategory FROM products WHERE CompanyID = @CompanyID ORDER BY SubCategory">
        <Column Name="SubCategory" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table3" Alias="Locations" DataType="System.Int32" Enabled="true" SelectCommand="SELECT DISTINCT(Location) AS Location FROM products WHERE CompanyID = @CompanyID ORDER BY Location">
        <Column Name="Location" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table4" Alias="SubLocations" DataType="System.Int32" Enabled="true" SelectCommand="SELECT DISTINCT(SubLocation) AS SubLocation FROM products WHERE CompanyID = @CompanyID ORDER BY SubLocation">
        <Column Name="SubLocation" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table5" Alias="suppliers_search" DataType="System.Int32" Enabled="true" SelectCommand="/*Not every company will have suppliers. So make provision for that */&#13;&#10;SELECT IF(Count(SupplierID) = 0, 0, SupplierID) AS SupplierID, IF(Count(SupplierID) = 0, 'None', Name) AS Name &#13;&#10;FROM suppliers WHERE CompanyID = @CompanyID &#13;&#10;UNION&#13;&#10;SELECT SupplierID, Name FROM suppliers WHERE CompanyID = @CompanyID &#13;&#10;ORDER BY Name">
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <Column Name="Name" DataType="System.String"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
      <TableDataSource Name="Table6" Alias="suppliers_relatedID" DataType="System.Int32" Enabled="true" SelectCommand="/* Not every company will have suppliers. So make provision for that */&#13;&#10;SELECT IF(COUNT(SupplierID) = 0, 0, SupplierID) AS SupplierID FROM suppliers WHERE CompanyID = @CompanyID&#13;&#10;UNION&#13;&#10;SELECT SupplierID FROM suppliers WHERE CompanyID = @CompanyID">
        <Column Name="SupplierID" DataType="System.UInt32"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Relation Name="Table5_Table6" ParentDataSource="Table5" ChildDataSource="Table6" ParentColumns="SupplierID" ChildColumns="SupplierID" Enabled="true"/>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="FromDate" DataType="System.String"/>
    <Parameter Name="ToDate" DataType="System.String"/>
    <Parameter Name="SelProductCode" DataType="System.String"/>
    <Parameter Name="OrderBy" DataType="System.String"/>
    <Parameter Name="SupplierID" DataType="System.String"/>
    <Total Name="Total_Excl" Expression="[items_sold.TransTotalExcl]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_Incl" Expression="[items_sold.TransTotalIncl]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_SelQty" Expression="[SelectedProduct.Qty]" Evaluator="Data2" PrintOn="DataFooter2"/>
    <Total Name="Avg_GP" Expression="[items_sold.ProfitPercentage]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Avg_MUP" Expression="[items_sold.MupPercentage]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_Profit" Expression="[items_sold.Profit]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Count_Qty" Expression="[items_sold.Qty]" Evaluator="Data1" PrintOn="PageFooter1"/>
    <Total Name="Count_Inique_Items" TotalType="Count" Evaluator="Data1"/>
    <Total Name="Total_Qty" Expression="[items_sold.Qty]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_SelExcl" Expression="[SelectedProduct.TransTotalExcl]" Evaluator="Data2" PrintOn="DataFooter2"/>
    <Total Name="Total_SelIncl" Expression="[SelectedProduct.TransTotalIncl]" Evaluator="Data2" PrintOn="DataFooter2"/>
  </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">
        <ShapeObject Name="Shape7" Top="66.15" Width="1048.95" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text1" Left="812.7" Width="189" Height="18.9" Text="[FromDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text3" Left="812.7" Top="28.35" Width="189" Height="18.9" Text="[ToDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text8" Left="472.5" Top="75.6" Width="94.5" Height="18.9" Text="Total Excl" HorzAlign="Right"/>
        <TextObject Name="Text10" Left="576.45" Top="75.6" Width="94.5" Height="18.9" Text="Total Incl." HorzAlign="Right"/>
        <TextObject Name="Text12" Left="680.4" Top="75.6" Width="94.5" Height="18.9" Text="Profit" HorzAlign="Right"/>
        <TextObject Name="Text14" Left="784.35" Top="75.6" Width="66.15" Height="18.9" Text="GP %" HorzAlign="Right"/>
        <TextObject Name="Text16" Left="859.95" Top="75.6" Width="66.15" Height="18.9" Text="MUP %" HorzAlign="Right"/>
        <TextObject Name="Text17" Left="378" Top="75.6" Width="75.6" Height="18.9" Text="Qty Sold" HorzAlign="Right"/>
        <TextObject Name="Text18" Left="141.75" Top="75.6" Width="94.5" Height="18.9" Text="Description"/>
        <TextObject Name="Text19" Left="9.45" Top="75.6" Width="94.5" Height="18.9" Text="Product Code"/>
        <TextObject Name="Text21" Left="935.55" Top="75.6" Width="94.5" Height="18.9" Text="QtyAvailable" HorzAlign="Right"/>
        <TextObject Name="Text22" Left="699.3" Width="94.5" Height="18.9" Text="From Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text23" Left="699.3" Top="28.35" Width="94.5" Height="18.9" Text="To Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text31" Left="37.8" Width="311.85" Height="37.8" Text="Items Sold" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="txtSelectionFeedback" Left="37.8" Top="37.8" Width="472.5" Height="28.35" Text="All" Font="Segoe UI Light, 14pt" TextFill.Color="OliveDrab"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data1" ZOrder="0" Top="159.2" Width="1047.06" Height="37.8" CanGrow="true" CanShrink="true" AfterDataEvent="Data1_AfterData" DataSource="items_sold">
      <TextObject Name="Text4" Left="9.45" Width="122.85" Height="18.9" Cursor="Hand" Hyperlink.Kind="DetailPage" Hyperlink.Expression="[items_sold.ProductCode]" Hyperlink.DetailPageName="Page2" Hyperlink.ReportParameter="SelProductCode" CanGrow="true" CanShrink="true" ClickEvent="Text4_Click" Text="[items_sold.ProductCode]" Font="Arial, 10pt, style=Underline" TextFill.Color="Blue"/>
      <TextObject Name="Text5" Left="141.75" Width="226.8" Height="37.8" CanGrow="true" CanShrink="true" Text="[items_sold.Description]"/>
      <TextObject Name="txtQty" Left="378" Width="75.6" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.Qty]" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text7" Left="472.5" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.TransTotalExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text9" Left="576.45" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text11" Left="680.4" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.Profit]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text13" Left="784.35" Width="66.15" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.ProfitPercentage]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text15" Left="859.95" Width="66.15" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.MupPercentage]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtQtyAvail" Left="935.55" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[items_sold.QtyAvailable]" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <DataFooterBand Name="DataFooter1" Top="201" Width="1047.06" Height="47.25" AfterDataEvent="DataFooter1_AfterData">
        <ShapeObject Name="Shape8" Top="9.45" Width="935.55" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="txtTotMup" Left="859.95" Top="18.9" Width="66.15" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text24" Left="472.5" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Excl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text25" Left="576.45" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Incl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="txtQtyTotal" Left="378" Top="18.9" Width="75.6" Height="18.9" Text="[Total_Qty]" HorzAlign="Right"/>
        <TextObject Name="txtTotGP" Left="784.35" Top="18.9" Width="66.15" Height="18.9" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text29" Left="680.4" Top="18.9" Width="94.5" Height="18.9" Text="[Total_Profit]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <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="252.25" Width="1047.06" Height="37.8">
      <TextObject Name="Text30" Left="198.45" Top="9.45" Width="94.5" Height="18.9" Text="[Count_Inique_Items]"/>
      <TextObject Name="Text33" Left="9.45" Top="9.45" Width="179.55" Height="18.9" Text="Item count:" HorzAlign="Right" TextFill.Color="DimGray"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="294.05" Width="1047.06" Height="18.9">
      <TextObject Name="Text36" Left="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" Font="Arial, 9pt" TextFill.Color="DimGray"/>
      <TextObject Name="Text79" Left="765.45" Width="94.5" Height="18.9" Text="Print Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text78" Left="869.4" Width="160.65" Height="18.9" Text="[Date]" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </inherited>
  <DialogPage Name="Form1" ZOrder="1" Width="574" Height="506" AcceptButton="btnOk" CancelButton="btnCancel" ShownEvent="Form1_Shown">
    <ButtonControl Name="btnOk" Left="334" Top="414" Width="107" Height="51" Anchor="Bottom, Right" Font="Segoe UI Light, 11pt" TabIndex="0" Text="OK" ClickEvent="btnOk_Click" DialogResult="OK"/>
    <ButtonControl Name="btnCancel" Left="449" Top="414" Width="107" Height="51" Anchor="Bottom, Right" Font="Segoe UI Light, 11pt" TabIndex="1" Text="Cancel" DialogResult="Cancel"/>
    <DateTimePickerControl Name="dtpFromDate" Left="272" Top="192" 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="272" Top="240" 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="64" Top="196" Width="74" Height="20" Font="Segoe UI Light, 11pt" TabIndex="4" Text="From Date"/>
    <LabelControl Name="Label2" Left="64" Top="240" Width="56" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="To Date"/>
    <LabelControl Name="Label3" Left="24" Top="24" Width="140" Height="37" Font="Segoe UI Light, 20pt" ForeColor="OliveDrab" TabIndex="6" Text="Items Sold "/>
    <ComboBoxControl Name="cboOrderBy" Left="272" Top="292" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="Product code&#13;&#10;Description&#13;&#10;Qty sold&#13;&#10;Profit made"/>
    <LabelControl Name="Label4" Left="64" Top="292" Width="134" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Order first report by"/>
    <ComboBoxControl Name="cboSelItem" Left="272" Top="336" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="Date&#13;&#10;Document #&#13;&#10;Transaction Type&#13;&#10;Client Name&#13;&#10;Sales Rep"/>
    <LabelControl Name="Label5" Left="64" Top="336" Width="157" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Order second report by"/>
    <ComboBoxControl Name="cboSelection" Left="272" Top="104" Width="233" Height="28" Font="Segoe UI Light, 11pt" TabIndex="7" ClickEvent="" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="20" ItemsText="All&#13;&#10;Products Only&#13;&#10;Services Only&#13;&#10;Category =&#13;&#10;Sub Category =&#13;&#10;Location =&#13;&#10;Sub Location =&#13;&#10;Below Min. Qty&#13;&#10;Main Supplier =&#13;&#10;On Promotion&#13;&#10;Not on Promotion" SelectedIndexChangedEvent="cboSelection_SelectedIndexChanged"/>
    <LabelControl Name="Label6" Left="64" Top="108" Width="65" Height="20" Font="Segoe UI Light, 11pt" TabIndex="5" Text="Selection"/>
    <ComboBoxControl Name="cboCategory" Left="272" Top="144" Width="233" Height="26" Visible="false" Font="Tahoma, 11pt" TabIndex="8" DataColumn="Categories.Category" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="18"/>
    <ComboBoxControl Name="cboSubCategory" Left="272" Top="144" Width="233" Height="26" Visible="false" Font="Tahoma, 11pt" TabIndex="8" DataColumn="SubCategories.SubCategory" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="18"/>
    <ComboBoxControl Name="cboLocation" Left="272" Top="144" Width="233" Height="26" Visible="false" Font="Tahoma, 11pt" TabIndex="8" DataColumn="Locations.Location" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="18"/>
    <ComboBoxControl Name="cboSubLocation" Left="272" Top="144" Width="233" Height="26" Visible="false" Font="Tahoma, 11pt" TabIndex="8" DataColumn="SubLocations.SubLocation" DropDownStyle="DropDownList" DropDownWidth="233" ItemHeight="18"/>
    <ComboBoxControl Name="cboSupplier" Left="272" Top="144" Width="233" Height="26" Visible="false" Font="Tahoma, 11pt" TabIndex="2" AutoFilter="false" DataColumn="suppliers_search.Name" DetailControl="ComboBox2" DropDownStyle="DropDownList" DropDownWidth="261" ItemHeight="18"/>
    <ComboBoxControl Name="ComboBox2" Left="384" Top="172" Visible="false" Font="Tahoma, 8pt" TabIndex="3" Text="ComboBox" AutoFill="false" DataColumn="suppliers_relatedID.SupplierID" ReportParameter="SupplierID" ItemHeight="13"/>
  </DialogPage>
  <ReportPage Name="Page2" ZOrder="2" Visible="false" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" FirstPageSource="15" OtherPagesSource="15">
    <PageHeaderBand Name="PageHeader2" Width="1047.06" Height="94.5" CanGrow="true" CanShrink="true">
      <TextObject Name="Text80" Left="9.45" Top="9.45" Width="349.65" Height="18.9" Text="[companies.Name]" Font="Tahoma, 11pt" TextFill.Color="DimGray"/>
      <ChildBand Name="Child2" Top="98.5" Width="1047.06" Height="122.85">
        <ShapeObject Name="Shape9" Top="75.6" Width="1039.5" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text37" Left="9.45" Top="85.05" Width="94.5" Height="18.9" Text="Date"/>
        <TextObject Name="Text39" Left="160.65" Top="85.05" Width="85.05" Height="18.9" Text="Document #" HorzAlign="Right"/>
        <TextObject Name="Text41" Left="481.95" Top="85.05" Width="103.95" Height="18.9" Text="Client Name"/>
        <TextObject Name="Text43" Left="708.75" Top="85.05" Width="75.6" Height="18.9" Text="Qty" HorzAlign="Right"/>
        <TextObject Name="Text45" Left="803.25" Top="85.05" Width="94.5" Height="18.9" Text="Total Excl" HorzAlign="Right"/>
        <TextObject Name="Text47" Left="916.65" Top="85.05" Width="94.5" Height="18.9" Text="Total Incl" HorzAlign="Right"/>
        <TextObject Name="txtSelProductCode" Left="37.8" Width="500.85" Height="47.25" Text="Items Sold for " Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="Text52" Left="359.1" Top="85.05" Width="94.5" Height="18.9" Text="Trans Type"/>
        <TextObject Name="Text84" Left="255.15" Top="85.05" Width="94.5" Height="18.9" Text="User"/>
        <TextObject Name="txtSelDescription" Left="236.25" Top="37.8" Width="548.1" Height="28.35" Font="Segoe UI Light, 16pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="Text88" Left="916.65" Top="37.8" Width="189" Height="18.9" Text="[ToDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text90" Left="803.25" Top="37.8" Width="94.5" Height="18.9" Text="To Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
        <TextObject Name="Text87" Left="916.65" Top="9.45" Width="189" Height="18.9" Text="[FromDate]" Format="Custom" Format.Format="d MMMM yyy"/>
        <TextObject Name="Text89" Left="803.25" Top="9.45" Width="94.5" Height="18.9" Text="From Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      </ChildBand>
    </PageHeaderBand>
    <DataBand Name="Data2" Top="225.35" Width="1047.06" Height="37.8" CanGrow="true" CanShrink="true" AfterDataEvent="Data2_AfterData" DataSource="Table1">
      <TextObject Name="Text35" Left="9.45" Width="141.75" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.TransDate]" Format="Custom" Format.Format="yyyy/MM/dd HH:mm"/>
      <TextObject Name="Text38" Left="160.65" Width="85.05" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.TransID]" HorzAlign="Right"/>
      <TextObject Name="Text40" Left="481.95" Width="217.35" Height="37.8" CanGrow="true" CanShrink="true" Text="[SelectedProduct.ClientName]"/>
      <TextObject Name="Text44" Left="708.75" Width="75.6" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.Qty]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text48" Left="803.25" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.TransTotalExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text50" Left="916.65" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.TransTotalIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text51" Left="359.1" Width="113.4" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.TransType]"/>
      <TextObject Name="Text85" Left="255.15" Width="94.5" Height="18.9" CanGrow="true" CanShrink="true" Text="[SelectedProduct.SalesRep]"/>
      <DataFooterBand Name="DataFooter2" Top="267.15" Width="1047.06" Height="47.25">
        <ShapeObject Name="Shape10" Left="510.3" Top="9.45" Width="529.2" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="Text49" Left="916.65" Top="18.9" Width="94.5" Height="18.9" Text="[Total_SelIncl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text42" Left="689.85" Top="18.9" Width="94.5" Height="18.9" Text="[Total_SelQty]" Format="Number" Format.UseLocale="false" Format.DecimalDigits="0" Format.DecimalSeparator="." Format.GroupSeparator=" " Format.NegativePattern="1" HorzAlign="Right"/>
        <TextObject Name="Text46" Left="803.25" Top="18.9" Width="94.5" Height="18.9" Text="[Total_SelExcl]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="Text83" Left="538.65" Top="18.9" Width="56.7" Height="18.9" Text="Totals:" TextFill.Color="DimGray"/>
      </DataFooterBand>
    </DataBand>
    <PageFooterBand Name="PageFooter2" Top="318.4" Width="1047.06" Height="37.8">
      <TextObject Name="Text86" Left="774.9" Top="9.45" Width="94.5" Height="18.9" Text="Print Date:" HorzAlign="Right" TextFill.Color="DimGray"/>
      <TextObject Name="Text81" Left="878.85" Top="9.45" Width="160.65" Height="18.9" Text="[Date]" TextFill.Color="DimGray"/>
      <TextObject Name="Text82" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="[PageNofM]" Font="Arial, 9pt" TextFill.Color="DimGray"/>
    </PageFooterBand>
  </ReportPage>
</inherited>
