<?xml version="1.0" encoding="utf-8" standalone="no"?>
<TfrxReport Version="4.8.27" DotMatrixReport="False" EngineOptions.MaxMemSize="20" EngineOptions.SilentMode="True" EngineOptions.NewSilentMode="simSilent" IniFile="\Software\Fast Reports" PreviewOptions.Buttons="4095" PreviewOptions.Zoom="1" PrintOptions.Printer="Default" PrintOptions.PrintOnSheet="0" ReportOptions.CreateDate="40602,6690597801" ReportOptions.Description.Text="" ReportOptions.LastChange="41731,6259671412" ScriptLanguage="PascalScript" ScriptText.Text="{&#13;&#10;========================================================================                                                                          &#13;&#10;Relatório Padrão Simples&#13;&#10;&#13;&#10;  Não exclua os Objetos das Bands: &#34;TituloRelatorio&#34; (Filtros = opcional),   &#13;&#10;  &#34;Rodape Pagina&#34; e nem os bjs &#34;QPrincipal&#34; e &#34;QEmpresa&#34;.&#13;&#10;  Use a QPrincipal para o SQL principal, pois a checagem abaixo é para&#13;&#10;  verificar se há registros na mesma.&#13;&#10;  O cabeçalho já esta pronto, não esqueça de alterar o objeto &#34;Título&#34; &#13;&#10;  e/ou &#34;Referencia&#34; (opcional) e de alimentar a variavel  &#34;CodEmpresa&#34; &#13;&#10;  (pelo programa) para que o nome da empresa seja mostrado e tbm a &#13;&#10;  variável &#34;Filtros&#34; (opcional, mas lembre-se de passar por aspas os &#13;&#10;  valores do filtro)&#13;&#10;  Procure passar todos os valores para o filtros do SQL (cláusula WHERE)&#13;&#10;  por variavéis (componente TfrxVariables) pelo programa.&#13;&#10;  Mantenha os objetos alinhados sem deixar espeços entre eles (sujestão.:&#13;&#10;  use propriedade Align)                                                            &#13;&#10;&#13;&#10;&#13;&#10;  por Jaime P.Jr em 15/04/2013&#13;&#10;========================================================================}&#13;&#10;  var aux:string;                               &#13;&#10;  &#13;&#10;begin&#13;&#10;  //Teste - Descomente as linhas  abaixo para teste e acrescente suas variáveis&#13;&#10;  //Não esqueça de comentar ao término do relatório                                                                                                                                      &#13;&#10;{&#13;&#10;  Set('CodEmpresa','1');&#13;&#10;  Set('RelReferencia','''????''');&#13;&#10;  Set('Filtros','''????''');      &#13;&#10;}&#13;&#10;  &#13;&#10;{Checagem de dados - Não remova as linhas abaixo}                                                &#13;&#10;  QPrincipal.Open;                 &#13;&#10;  if QPrincipal.IsEmpty then&#13;&#10;  begin              &#13;&#10;    CreateError('Não exitem registros para os filtros selecionados.');&#13;&#10;  end;&#13;&#10;{fim}&#13;&#10;&#13;&#10;   aux:='Período de '+DateToStr(&#60;DtIni&#62;)+' à '+DateToStr(&#60;DtFin&#62;)+' ';&#13;&#10;   aux:=aux+iif(&#60;CodProf&#62; &#62;0,' - Profissional: '+PegaValorCampoTabela('cadcli','CLI_NOMCLI','CLI_CODIGO='+IntToStr(&#60;CodProf&#62;))+' ','');&#13;&#10;   aux:=aux+iif(&#60;CodEmp&#62; &#62;0,' - Empresa: '+PegaValorCampoTabela('cademp','EMP_NOMEMP','EMP_CODIGO='+IntToStr(&#60;CodEmp&#62;))+' ','');&#13;&#10;   aux:=aux+iif(&#60;CodIte&#62; &#62;0,' - Produto: '+PegaValorCampoTabela('cadite','ITE_DESCRI','ITE_CODIGO='+IntToStr(&#60;CodIte&#62;))+' ','');&#13;&#10;&#13;&#10;   Set('Filtros',''''+aux+'''');       &#13;&#10;&#13;&#10;  &#13;&#10;end." StoreInDFM="False" PropData="044C65667403D80203546F7002100844617461736574730101062A20446174615365743D2251456D70726573612220446174615365744E616D653D2251456D7072657361220001062E20446174615365743D22515072696E636970616C2220446174615365744E616D653D22515072696E636970616C220000095661726961626C65730101061C204E616D653D22436F64456D7072657361222056616C75653D2231220001061A204E616D653D2246696C74726F73222056616C75653D2227272200010624204E616D653D2252656C5265666572656E636961222056616C75653D22273231423027220001061B204E616D653D224474496E69222056616C75653D223431363430220001061B204E616D653D22447446696E222056616C75653D2234313733312200010619204E616D653D22436F6450726F66222056616C75653D22302200010618204E616D653D22436F64456D70222056616C75653D22302200010618204E616D653D22436F64497465222056616C75653D2230220000055374796C650100">
  <TfrxDataPage Name="Data" Height="1000" Left="0" Top="0" Width="1000">
    <TfrxADOQuery Name="QPrincipal" UserName="QPrincipal" CloseDataSource="True" FieldAliases.Text="" BCDToCurrency="False" IgnoreDupParams="False" SQL.Text="declare &#13;&#10;        @DtIni   date = :DtIni,&#13;&#10;        @DtFin   date = :DtFin,&#13;&#10;        @CodProf int  = :CodProf,&#13;&#10;        @CodIte  int  = :CodIte,&#13;&#10;        @CodEmp  int  = :CodEmp               &#13;&#10;        &#13;&#10;select FTG_CODPROF, CLI_NOMCLI, FTD_NUMDOC, FTD_ESPDOC, &#13;&#10;       ( select Top 1(CBR_CODBAR)&#13;&#10;         from CADCBR&#13;&#10;         where ITE_CODIGO = CBR_CODITE&#13;&#10;        ) AS CBR_CODBAR, ITE_DESCRI, ITE_COMPRO,&#13;&#10;       round(FTD_TOTITE * FTD_FATDES, 2) as TotalVenda,&#13;&#10;       round(((FTD_TOTITE * FTD_FATDES)/100) * (ite_compro),2) as TotalComissao           &#13;&#10;from fatdet&#13;&#10;left join       cadite on FTD_CODITE = ITE_CODIGO&#13;&#10;left outer join cadcbr on CBR_CODITE = ITE_CODIGO  &#13;&#10;left outer join fatger on FTD_CODEMP = FTG_CODEMP and&#13;&#10;                          FTD_NUMCAX = FTG_NUMCAX and&#13;&#10;                          FTD_NUMDOC = FTG_NUMDOC and&#13;&#10;                          FTD_ESPDOC = FTG_ESPDOC and&#13;&#10;                          FTD_SEQCAI = FTG_SEQCAI&#13;&#10;left outer join cadcli on CLI_CODIGO = ftg_CODPROF    &#13;&#10;where FTD_CANCEL &#60;&#62; 'S' AND&#13;&#10;      (((@CodProf = 0) and (FTG_CODPROF is not NULL)) or ((@CodProf &#60;&#62; 0) and (FTG_CODPROF = @CodProf))) and&#13;&#10;      ITE_COMPRO is not null and&#13;&#10;      (cast(FTD_DTAENT as date) between @DtIni and @DtFin ) AND&#13;&#10;      ((@CodEmp=0 ) or (FTD_CODEMP = @CodEmp)) and         &#13;&#10;      ((@CodIte=0 ) or (CBR_CODBAR = @CodIte))  &#13;&#10;group by ITE_CODIGO, ITE_DESCRI, FTG_CODPROF, &#13;&#10;         CLI_NOMCLI, FTD_NUMDOC, FTD_ESPDOC,  &#13;&#10;         ITE_COMPRO, FTD_TOTITE, FTD_FATDES      &#13;&#10;order by FTG_CODPROF       " CommandTimeout="1800" LockType="ltReadOnly" PropData="05704C65667402490470546F70021C0A506172616D65746572730101063C204E616D653D224474496E69222044617461547970653D22667444617465222045787072657373696F6E3D22262336303B4474496E69262336323B220001063C204E616D653D22447446696E222044617461547970653D22667444617465222045787072657373696F6E3D22262336303B447446696E262336323B2200010643204E616D653D22436F6450726F66222044617461547970653D226674496E7465676572222045787072657373696F6E3D22262336303B436F6450726F66262336323B2200010641204E616D653D22436F64497465222044617461547970653D226674496E7465676572222045787072657373696F6E3D22262336303B436F64497465262336323B2200010641204E616D653D22436F64456D70222044617461547970653D226674496E7465676572222045787072657373696F6E3D22262336303B436F64456D70262336323B220000"/>
    <TfrxADOQuery Name="QEmpresa" UserName="QEmpresa" CloseDataSource="True" FieldAliases.Text="" BCDToCurrency="False" IgnoreDupParams="False" SQL.Text="select emp_nomemp &#13;&#10;from cademp &#13;&#10;where EMP_CODIGO=:CodEmpresa" CommandTimeout="1800" LockType="ltReadOnly" PropData="05704C656674038C000470546F70021C0A506172616D657465727301010649204E616D653D22436F64456D7072657361222044617461547970653D226674496E7465676572222045787072657373696F6E3D22262336303B436F64456D7072657361262336323B220000"/>
  </TfrxDataPage>
  <TfrxReportPage Name="Relatorio1" PaperWidth="210" PaperHeight="297" PaperSize="9" LeftMargin="10" RightMargin="10" TopMargin="10" BottomMargin="10" ColumnWidth="0" ColumnPositions.Text="" HGuides.Text="" VGuides.Text="">
    <TfrxReportTitle Name="TituloRelatorio" Height="68,91342" Left="0" Top="18,89765" Width="718,1107" Stretched="True">
      <TfrxMemoView Name="Titulo" Align="baWidth" Left="0" Top="18,8976378" Width="517,79561" Height="18,89765" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-15" Font.Name="Courier New" Font.Style="1" ParentFont="False" VAlign="vaCenter" Text="Comissão de Profissional"/>
      <TfrxMemoView Name="RelReferencia" Align="baRight" Left="517,79561" Top="19" Width="200,31509" Height="18,89765" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-11" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" VAlign="vaCenter" Text="[IIF(&#60;RelReferencia&#62;='','','(Ref.:'+&#60;RelReferencia&#62;+')')]"/>
      <TfrxMemoView Name="Filtros" Align="baWidth" Left="56,69295" Top="38,67718" Width="661,41775" Height="30,23624" ShowHint="False" StretchMode="smMaxHeight" Font.Charset="0" Font.Color="0" Font.Height="-11" Font.Name="Courier New" Font.Style="0" ParentFont="False" Text="[&#60;Filtros&#62;]"/>
      <TfrxMemoView Name="LblFiltros" Align="baLeft" Left="0" Top="38,67718" Width="56,69295" Height="30,23624" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-11" Font.Name="Courier New" Font.Style="0" ParentFont="False" Text="Filtros:"/>
      <TfrxMemoView Name="NomeEmpresa" Align="baWidth" Left="0" Top="0" Width="517,79561" Height="18,89765" ShowHint="False" DataField="EMP_NOMEMP" DataSet="QEmpresa" DataSetName="QEmpresa" Font.Charset="0" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="0" ParentFont="False" Text="[QEmpresa.&#34;EMP_NOMEMP&#34;]"/>
      <TfrxMemoView Name="Emissao" Align="baRight" Left="517,79561" Top="0" Width="200,31509" Height="15,11812" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-11" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="Emissão: [DATE] [Time]"/>
    </TfrxReportTitle>
    <TfrxPageHeader Name="CabecalhoPagina" Height="49,1338778" Left="0" Top="109,60637" Width="718,1107">
      <TfrxMemoView Name="Mem_CodProf" Left="0,23624" Top="5,55906" Width="98,26772142" Height="15,11810291" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="Cod. Prof."/>
      <TfrxLineView Name="Line1" Left="0" Top="3,77953" Width="718,1107" Height="0" ShowHint="False" Frame.Typ="4"/>
      <TfrxMemoView Name="MemDocEspecie" Left="0,23624" Top="22,67718" Width="98,26778" Height="18,8976378" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="Doc./Espécie"/>
      <TfrxMemoView Name="Mem_NomeProf" Left="102,50402" Top="5,55906" Width="351,49629" Height="15,11810291" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="Nome do Profissional"/>
      <TfrxMemoView Name="Mem_Descricao" Left="102,50402" Top="22,67718" Width="351,49629" Height="18,8976378" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="Descrição "/>
      <TfrxMemoView Name="Mem_Valor" Left="452,90569" Top="5,55906" Width="86,92913386" Height="26,45669291" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="Valor"/>
      <TfrxMemoView Name="Mem_Comissao" Left="540,30736" Top="5,55906" Width="90,70872" Height="26,45669291" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="Comissão %"/>
      <TfrxMemoView Name="Mem_ValorComissao" Align="baRight" Left="631,18151" Top="5,55906" Width="86,92919" Height="30,2362278" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haCenter" ParentFont="False" Text="Vlr. Comissão"/>
    </TfrxPageHeader>
    <TfrxReportSummary Name="ResumoRelatorio" Height="45,35436" Left="0" Top="404,40971" Width="718,1107">
      <TfrxMemoView Name="Mem_TotalGeral" Left="0,00029291" Top="5" Width="453,54330709" Height="18,89765" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="Total Geral:"/>
      <TfrxMemoView Name="TotalGeralTotalVenda" Left="452,90569" Top="5" Width="86,92913386" Height="18,89765" ShowHint="False" DataSetName="QItem" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;QPrincipal.&#34;TotalVenda&#34;&#62;,MDPrincipal)]"/>
      <TfrxMemoView Name="TotalGeralTotalComissao" Align="baRight" Left="631,18156614" Top="5" Width="86,92913386" Height="18,89765" ShowHint="False" DataSetName="QItem" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;QPrincipal.&#34;TotalComissao&#34;&#62;,MDPrincipal)]"/>
      <TfrxLineView Name="Line2" Left="0" Top="2" Width="718,1107" Height="0" ShowHint="False" Frame.Typ="4"/>
    </TfrxReportSummary>
    <TfrxPageFooter Name="RodapePagina" Font.Charset="1" Font.Color="0" Font.Height="-12" Font.Name="Arial" Font.Style="0" Height="15,11812" Left="0" ParentFont="False" Top="472,44125" Width="718,1107">
      <TfrxSysMemoView Name="TotalPaginas" Align="baRight" Left="612,28386" Top="0,13385827" Width="105,82684" Height="15,11812" ShowHint="False" Font.Charset="0" Font.Color="0" Font.Height="-12" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[PAGE#]/[TOTALPAGES#]"/>
    </TfrxPageFooter>
    <TfrxMasterData Name="MDPrincipal" Height="22,6771678" Left="0" Top="275,90569" Width="718,1107" ColumnWidth="0" ColumnGap="0" DataSet="QPrincipal" DataSetName="QPrincipal" RowCount="0">
      <TfrxMemoView Name="QPrincipalFTD_NUMDOC" Left="0,23624" Top="1,33859" Width="98,26771654" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="0" ParentFont="False" Text="[QPrincipal.&#34;FTD_NUMDOC&#34;]-[QPrincipal.&#34;FTD_ESPDOC&#34;]"/>
      <TfrxMemoView Name="QPrincipalITE_DESCRI" Left="102,50402" Top="1,33859" Width="351,49606299" Height="18,89765" ShowHint="False" DataField="ITE_DESCRI" DataSet="QPrincipal" DataSetName="QPrincipal" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="0" ParentFont="False" Text="[QPrincipal.&#34;ITE_DESCRI&#34;]"/>
      <TfrxMemoView Name="QPrincipalTotalVenda" Left="452,90569" Top="1,33859" Width="86,92913386" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[QPrincipal.&#34;TotalVenda&#34;]"/>
      <TfrxMemoView Name="QPrincipalITE_COMPRO" Left="540,30741858" Top="1,33859" Width="90,70866142" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[QPrincipal.&#34;ITE_COMPRO&#34;]%"/>
      <TfrxMemoView Name="QPrincipalTotalComissao" Align="baRight" Left="631,18156614" Top="1,33859" Width="86,92913386" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="0" HAlign="haRight" ParentFont="False" Text="[QPrincipal.&#34;TotalComissao&#34;]"/>
    </TfrxMasterData>
    <TfrxGroupHeader Name="GroupHeader2" Height="34,01577" Left="0" Top="219,21274" Width="718,1107" Condition="QPrincipal.&#34;FTG_CODPROF&#34;">
      <TfrxLineView Name="Line5" Left="0" Top="3,77953" Width="718,1107" Height="0" ShowHint="False" Frame.Typ="4"/>
      <TfrxMemoView Name="QPrincipalFTG_CODPROF1" Left="0,23624" Top="8,33859" Width="98,2677165354331" Height="18,89765" ShowHint="False" DataField="FTG_CODPROF" DataSet="QPrincipal" DataSetName="QPrincipal" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="[QPrincipal.&#34;FTG_CODPROF&#34;]"/>
      <TfrxMemoView Name="QPrincipalCLI_NOMCLI1" Left="102,50402" Top="8,33859" Width="612,28386" Height="18,89765" ShowHint="False" DataField="CLI_NOMCLI" DataSet="QPrincipal" DataSetName="QPrincipal" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" ParentFont="False" Text="[QPrincipal.&#34;CLI_NOMCLI&#34;]"/>
    </TfrxGroupHeader>
    <TfrxGroupFooter Name="GroupFooter1" Height="22,67718" Left="0" Top="321,26005" Width="718,1107">
      <TfrxMemoView Name="Memo1" Left="0" Top="0" Width="453,5436" Height="18,89765" ShowHint="False" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="Total:"/>
      <TfrxMemoView Name="QPrincipalTotalVenda1" Left="453,90569" Top="0" Width="86,92913386" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;QPrincipal.&#34;TotalVenda&#34;&#62;,MDPrincipal)]"/>
      <TfrxMemoView Name="QPrincipalTotalComissao1" Align="baRight" Left="631,18156614" Top="0" Width="86,92913386" Height="18,89765" ShowHint="False" DataSet="QPrincipal" DataSetName="QPrincipal" DisplayFormat.FormatStr="%2.2f" DisplayFormat.Kind="fkNumeric" Font.Charset="1" Font.Color="-16777208" Font.Height="-13" Font.Name="Courier New" Font.Style="1" HAlign="haRight" ParentFont="False" Text="[SUM(&#60;QPrincipal.&#34;TotalComissao&#34;&#62;,MDPrincipal)]"/>
    </TfrxGroupFooter>
  </TfrxReportPage>
</TfrxReport>
