﻿<?xml version="1.0" encoding="utf-8"?>
<inherited BaseReport="..\..\Reports\Base.frx" ScriptLanguage="CSharp" DoublePass="true" StartReportEvent="_StartReport" ReportInfo.Created="05/15/2013 14:45:40" ReportInfo.Modified="06/08/2015 10:48:31" 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
  {

    int decimalValue = 0;
    
    
    private void _StartReport(object sender, EventArgs e)
    {
      decimalValue = Convert.ToInt32(Report.GetColumnValue(&quot;programs_config.QtyDecimalValue&quot;));
      string selection = Convert.ToString(Report.GetParameterValue(&quot;Header&quot;));
      txtSelectionFeedback.Text = selection;
      
      
    }
    
    
    

    private void Data1_AfterData(object sender, EventArgs e)
    {
      //total Qty Column format      
      
      decimal qtyVal = 0; 
      if (Decimal.TryParse(txtQtyAvailable.Text, out qtyVal))
      {
        txtQtyAvailable.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
      if (Decimal.TryParse(txtQtyCounted.Text, out qtyVal))
      {
        txtQtyCounted.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
      if (Decimal.TryParse(txtQtyDiff.Text, out qtyVal))
      {
        txtQtyDiff.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
    }

    private void DataFooter1_AfterData(object sender, EventArgs e)
    {
      //total Qty Column format      
      decimal qtyVal = 0; 
      if (Decimal.TryParse(txtQtyAvailableTotal.Text, out qtyVal))
      {
        txtQtyAvailableTotal.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
      if (Decimal.TryParse(txtQtyCountedTotal.Text, out qtyVal))
      {
        txtQtyCountedTotal.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
      if (Decimal.TryParse(txtQtyDiffTotal.Text, out qtyVal))
      {
        txtQtyDiffTotal.Text = String.Format(&quot;{0:F&quot; + decimalValue + &quot;}&quot;, qtyVal);
      }
    }

    
   
    
  }
}
</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="Table" Alias="products" DataType="System.Int32" Enabled="true" SelectCommand="SELECT ProductCode, Description, QtyAvailable, QtyCounted, QtyCounted - QtyAvailable AS QtyDiff, &#13;&#10;CostPrice * QtyCounted AS TotalCostCounted, (QtyCounted - QtyAvailable) * CostPrice AS TotCostDiff &#13;&#10;FROM products WHERE CompanyID = @CompanyID &#13;&#10;AND @Selection &#13;&#10;ORDER BY @OrderBy">
        <Column Name="ProductCode" DataType="System.String"/>
        <Column Name="QtyAvailable" DataType="System.Decimal"/>
        <Column Name="Description" DataType="System.String"/>
        <Column Name="QtyCounted" DataType="System.Decimal"/>
        <Column Name="QtyDiff" DataType="System.Decimal"/>
        <Column Name="TotalCostCounted" DataType="System.Decimal"/>
        <Column Name="TotCostDiff" DataType="System.Decimal"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
        <CommandParameter Name="Selection" DataType="254"/>
        <CommandParameter Name="OrderBy" DataType="254"/>
      </TableDataSource>
      <TableDataSource Name="Table2" Alias="programs_config" DataType="System.Int32" Enabled="true" SelectCommand="SELECT QtyDecimalValue FROM programs_config WHERE CompanyID = @CompanyID">
        <Column Name="QtyDecimalValue" DataType="System.UInt32"/>
        <CommandParameter Name="CompanyID" DataType="254" Expression="[CompanyID]"/>
      </TableDataSource>
    </MySqlDataConnection>
    <Parameter Name="CompanyID" DataType="System.Int32"/>
    <Parameter Name="Header" DataType="System.String"/>
    <Total Name="Total_Cost" Expression="[products.TotalCostCounted]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_Variance" Expression="[products.TotCostDiff]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_QtyAvailable" Expression="[products.QtyAvailable]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Count_Total_Items" TotalType="Count" Evaluator="Data1"/>
    <Total Name="Total_QtyCounted" Expression="[products.QtyCounted]" Evaluator="Data1" PrintOn="DataFooter1"/>
    <Total Name="Total_QtyDiff" Expression="[products.QtyDiff]" Evaluator="Data1" PrintOn="DataFooter1"/>
  </Dictionary>
  <inherited Name="Page1" RawPaperSize="9" FirstPageSource="15" OtherPagesSource="15">
    <inherited Name="PageHeader1">
      <inherited Name="_CompanyName"/>
      <ChildBand Name="Child1" ZOrder="-1" Top="41.8" Width="718.2" Height="141.75">
        <ShapeObject Name="Shape7" Top="75.6" Width="718.2" Height="56.7" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="txtHeaderCost" Left="548.1" Top="85.05" Width="75.6" Height="37.8" Text="Counted Cost" HorzAlign="Center"/>
        <TextObject Name="txtHeaderSelling" Left="633.15" Top="85.05" Width="75.6" Height="37.8" Text="Variance Value" HorzAlign="Center"/>
        <TextObject Name="Text18" Left="141.75" Top="85.05" Width="179.55" Height="18.9" Text="Description"/>
        <TextObject Name="Text19" Left="9.45" Top="85.05" Width="122.85" Height="18.9" Text="Item Code"/>
        <TextObject Name="txtHeaderQtyAvail" Left="406.35" Top="85.05" Width="66.15" Height="37.8" Text="Qty Available" HorzAlign="Center"/>
        <TextObject Name="Text31" Left="37.8" Width="444.15" Height="56.7" Text="Stock-Take Variance report" Font="Segoe UI Light, 22pt" TextFill.Color="OliveDrab"/>
        <TextObject Name="txtSelectionFeedback" Left="217.35" Top="37.8" Width="472.5" Height="28.35" Text="All" HorzAlign="Right" Font="Segoe UI Light, 14pt"/>
        <TextObject Name="Text81" Left="330.75" Top="85.05" Width="66.15" Height="37.8" Text="Qty Counted" HorzAlign="Center"/>
        <TextObject Name="Text82" Left="481.95" Top="85.05" Width="56.7" Height="37.8" Text="Qty Diff." HorzAlign="Center"/>
      </ChildBand>
    </inherited>
    <DataBand Name="Data1" ZOrder="0" Top="187.55" Width="718.2" Height="18.9" AfterDataEvent="Data1_AfterData" DataSource="Table">
      <TextObject Name="Text4" Left="9.45" Width="122.85" Height="18.9" Cursor="Hand" Hyperlink.Kind="DetailPage" ClickEvent="Text4_Click" Text="[products.ProductCode]" Trimming="EllipsisCharacter"/>
      <TextObject Name="Text5" Left="141.75" Width="179.55" Height="18.9" Text="[products.Description]" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtCostData" Left="548.1" Width="75.6" Height="18.9" Text="[products.TotalCostCounted]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtVarianceData" Left="633.15" Width="75.6" Height="18.9" Text="[products.TotCostDiff]" Format="Number" Format.UseLocale="true" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtQtyAvailable" Left="406.35" Width="66.15" Height="18.9" Text="[products.QtyAvailable]" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtQtyCounted" Left="330.75" Width="66.15" Height="18.9" Text="[products.QtyCounted]" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <TextObject Name="txtQtyDiff" Left="481.95" Width="56.7" Height="18.9" Text="[products.QtyDiff]" HorzAlign="Right" WordWrap="false" Trimming="EllipsisCharacter"/>
      <DataFooterBand Name="DataFooter1" Top="210.45" Width="718.2" Height="56.7" AfterDataEvent="DataFooter1_AfterData">
        <ShapeObject Name="Shape8" Top="9.45" Width="718.2" Height="37.8" Border.Color="Gainsboro" Fill.Color="WhiteSmoke" Shape="RoundRectangle"/>
        <TextObject Name="txtTotalCost" Left="548.1" Top="18.9" Width="75.6" Height="18.9" Text="[Total_Cost]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="txtTotalVariance" Left="633.15" Top="18.9" Width="75.6" Height="18.9" Text="[Total_Variance]" Format="Number" Format.UseLocale="true" HorzAlign="Right"/>
        <TextObject Name="txtQtyAvailableTotal" Left="406.35" Top="18.9" Width="66.15" Height="18.9" Text="[Total_QtyAvailable]" HorzAlign="Right"/>
        <TextObject Name="Text32" Left="9.45" Top="18.9" Width="245.7" Height="18.9" Text="Totals Excl Tax:   (Units X Qty's)" TextFill.Color="DimGray"/>
        <TextObject Name="txtQtyCountedTotal" Left="330.75" Top="18.9" Width="66.15" Height="18.9" Text="[Total_QtyCounted]" HorzAlign="Right"/>
        <TextObject Name="txtQtyDiffTotal" Left="481.95" Top="18.9" Width="56.7" Height="18.9" Text="[Total_QtyDiff]" HorzAlign="Right"/>
      </DataFooterBand>
    </DataBand>
    <ReportSummaryBand Name="ReportSummary1" ZOrder="-1" Top="271.15" Width="718.2" 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="Item count:" HorzAlign="Right" TextFill.Color="DimGray"/>
    </ReportSummaryBand>
    <PageFooterBand Name="PageFooter1" ZOrder="-1" Top="312.95" Width="718.2" 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>
</inherited>
