Jump to content
Fivewin Brasil

Relatórios Lentos


evertonlb

Recommended Posts

Boa tarde amigos, estou com um problema e creio que poderão me dar uma luz.. 

Tenho um problema sério em relatórios na rede... quando tem mais de um usuário acessando o sistema o relatório fica lento demais.. mas quando digo demais e demais mesmo..

um relatório que sai em 30 segundos, vai para 15 minutos e alguns nem saem..

Alguém tem alguma ideia do porque ocorre e o que causa essa lentidão?  

Máquinas com Win7 e Servidor com o Win Server 

Uso Fw 6.12 e DBF!

Att.

Everton

Link to comment
Share on other sites

Passei por isso uma vez, tinha que mudar algo no registro da máquina mas não lembro onde... Achei este utilitário veja se resolve pra vc

 

http://www.pctoledo.com.br/forum/filebase.php?d=1&id=150&c_old=0&what=c&page=1

 

encontrei também este comando... Veja se ajuda

 

REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLinkedConnections /t REG_DWORD /d 00000001 /f
Link to comment
Share on other sites

 

Passei por isso uma vez, tinha que mudar algo no registro da máquina mas não lembro onde... Achei este utilitário veja se resolve pra vc

 

http://www.pctoledo.com.br/forum/filebase.php?d=1&id=150&c_old=0&what=c&page=1

 

encontrei também este comando... Veja se ajuda

 

REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLinkedConnections /t REG_DWORD /d 00000001 /f

Valeu Emotta.. vou ver isso hj a noite.. obrigado cara!

Link to comment
Share on other sites

Também sofri muito com isso. Hoje, quando o sistema começa a ficar lento em rede, mudo para TS (Terminal Service). Tem como fazer até com Windows XP e 7, mas com Windows Server 2012 fica bem melhor.

Vantagens:

1 - O sistema fica só no servidor, portanto a velocidade de processamento será sempre a mesma para todos os usuários;

2 - Não tem problema de corrompimento de dados (índices) por falha da rede porque o fluxo fica só no servidor;

3 - Não há perda de desempenho, não importa quantos usuários estejam usando o sistema ao mesmo tempo.

Detalhe: Esta dica eu encontrei aqui, neste fórum. Apliquei e tô feliz. :D

Link to comment
Share on other sites

 

Também sofri muito com isso. Hoje, quando o sistema começa a ficar lento em rede, mudo para TS (Terminal Service). Tem como fazer até com Windows XP e 7, mas com Windows Server 2012 fica bem melhor.

Vantagens:

1 - O sistema fica só no servidor, portanto a velocidade de processamento será sempre a mesma para todos os usuários;

2 - Não tem problema de corrompimento de dados (índices) por falha da rede porque o fluxo fica só no servidor;

3 - Não há perda de desempenho, não importa quantos usuários estejam usando o sistema ao mesmo tempo.

Detalhe: Esta dica eu encontrei aqui, neste fórum. Apliquei e tô feliz. :D

E o custo da licença?

Link to comment
Share on other sites

Para quem ainda esta em DBF e tem problema de lentidão, perca dois dias apenas em busca aqui no forum sobre ADS, eu nunca entendi o pq do pessoal não usar, lembro que em 2009 ia perder clientes potencias por problema de lentidão em rede com relatorios, alguns chegava a levar ate 15 minutos, com o ADS caiu para coisa de segundos, as mudança nos codigo fonte são retículas de tão simples. o desempenho é mesma coisa se tiver usando banco de dados relacional.

 

Luiz Fernando

Link to comment
Share on other sites

 

Para quem ainda esta em DBF e tem problema de lentidão, perca dois dias apenas em busca aqui no forum sobre ADS, eu nunca entendi o pq do pessoal não usar, lembro que em 2009 ia perder clientes potencias por problema de lentidão em rede com relatorios, alguns chegava a levar ate 15 minutos, com o ADS caiu para coisa de segundos, as mudança nos codigo fonte são retículas de tão simples. o desempenho é mesma coisa se tiver usando banco de dados relacional.

 

Luiz Fernando

Amigo, poste um prg simples, demonstrando como fazer um cadastro usando ADS.

Ah! E o link para a gente baixar o ADS.

Pode ser?

Link to comment
Share on other sites

 

Amigo, poste um prg simples, demonstrando como fazer um cadastro usando ADS.

Ah! E o link para a gente baixar o ADS.

Pode ser?

Ariston vou procurar em meus backup antigo,  pq deste 2011 qdo passei para mysql não mexo mais com ADS, com certeza algum projeto irei ter sim, dai retorno aqui.

mais acima vc perguntou se tem exemplo de cadastro, veja bem não muda nada tudo igual, vc ira colocar umas 4 linhas do inicio do sistema, usar o rddads no lugar do rddcdx, e nos relatorios ou browse que exige filtro, vc ira aplicar um comando proprio de filtro do ads, e isto vc vai fazendo conforme vai enxergando coisas que principalmente em rede o sistema fica lento.

 

Retorno assim que achar algum projeto antigo que tenha o uso do ADS, mais lembrando que aqui no forum tem muito material sobre o assunto

 

Abs

Luiz Fernando

 

Link to comment
Share on other sites

  • 2 months later...

Muuuiiiitttttoooo tempo depois...  O código para ver se tem algo de estranho...  Amanhã esse negócio vai ter que funcionar na marra!!!

#Include "Fivewin.ch"
#Include "vrmm.ch"
#Include "DtPicker.ch"
#Include "URLLink.ch"
#include "CORGET.CH"
************************************************** 
* Sistema .....: BS.Escola  
* Programa ....: VES09203.prg  
* Autor .......: Everton  
* Sintese .....: Relatório de Produtos Vendidos  
* Data ........: 04/05/2014 às 23:52:46  
* Revisado em .: 04/05/2014 às 23:52:46  
******************************************************************************
Function VES09203()

Private oGrp1, oGrp2, oGrp3,; 
        oGet1, oGet2,;
		  oRad1,;
        oDtP1, oDtP2,;  
        oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7,;
        oBtn1, oBtn2,; 
		  oChk1, oChk2

public _lTodasVendas     := .f.
public dDataInicial      := Date()
public dDataFinal        := Date()
public _lTodosOperadores := .t.
public CodigoOperador    := 0
Public NomeDoOperador    := Space( 30 )
Public nTipoOrdem        := 1
Public cCodSTMA          := Space( 08 )
Public cNomeSec          := Space( 20 )
Public cNomeTip          := Space( 20 )
Public cNomeMar          := Space( 20 )
*
DEFINE FONT oFONT1 NAME "Arial" SIZE   0, -12 BOLD
DEFINE FONT oFONT2 NAME "Arial" SIZE   0, -13
DEFINE FONT oFONT3 NAME "Ms Sans Serif" SIZE   0, -12
*
Define DIALOG oForm_Prd_Vendidos TITLE "..: Produtos Vendidos :.." Style 1;
       FROM 118, 266 to 467, 748 PIXEL COLOR 0, 15790320
*
ACTIVATE DIALOG oForm_Prd_Vendidos ON INIT Ini_oForm_Prd_Vendidos() centered
Return NIL
//----------------------------------------------------------------------------
Function Ini_oForm_Prd_Vendidos()

   @   2,   6 GROUP oGrp1 TO  72, 470 LABEL "Período" PIXEL;
              OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1

      @  15,   8 CHECKBOX oChk1 VAR _lTodasVendas PROMPT "Todas" SIZE  78,  20 ;
                 COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1


      @  41,   8 SAY oSay1 VAR "Data Inicial" SIZE  66,  16 PIXEL;
                 OF oGrp1 COLOR 0, 15790320 FONT oFont2


      @  41, 246 SAY oSay2 VAR "Data Final" SIZE  62,  16 PIXEL;
                 OF oGrp1 COLOR 0, 15790320 FONT oFont2


      @  39,  85 DTPICKER oDtP1 VAR dDataInicial SIZE 120,  20;
                 COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1


      @  39, 311 DTPICKER oDtP2 VAR dDataFinal SIZE 120,  20;
                 COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1
                 
   @  72,   6 GROUP oGrp4 TO 142, 470 LABEL "Divisão de Estoque" PIXEL;
              OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1

      @  20,  10 GET oGet2 VAR cCodSTMA SIZE 120,  20;
                 COLOR 0, 16777215 PICTURE "@R 99.999.999" PIXEL OF oGrp4 FONT oFont1 valid VeStma( cCodSTMA )


      @  15, 140 SAY oSay5 VAR cNomeSec SIZE 250,  16 PIXEL;
                 OF oGrp4 COLOR 0, 15790320 FONT oFont1
                 
      @  32, 140 SAY oSay6 VAR cNomeTip SIZE 250,  16 PIXEL;
                 OF oGrp4 COLOR 0, 15790320 FONT oFont1
                 
      @  51, 140 SAY oSay7 VAR cNomeMar SIZE 250,  16 PIXEL;
                 OF oGrp4 COLOR 0, 15790320 FONT oFont1


   @  144,   6 GROUP oGrp2 TO 214, 470 LABEL "Operador" PIXEL;
              OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1

      @  16,   8 CHECKBOX oChk2 VAR _lTodosOperadores PROMPT "Todos" SIZE  86,  20 ;
                 COLOR 0, 15790320 PIXEL OF oGrp2 FONT oFont1


      @  39,  61 GET oGet1 VAR CodigoOperador SIZE  73,  20;
                 COLOR 0, 16777215 PICTURE "99999" PIXEL OF oGrp2 FONT oFont1


      @  41,   5 SAY oSay3 VAR "Código" SIZE  46,  16 PIXEL;
                 OF oGrp2 COLOR 0, 15790320 FONT oFont1


      @  41, 146 SAY oSay4 VAR NomeDoOperador SIZE 310,  16 PIXEL;
                 OF oGrp2 COLOR 0, 15790320 FONT oFont1

   @ 215,   6 GROUP oGrp3 TO 288, 470 LABEL "Ordem" PIXEL;
              OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1

      @  16,   8 RADIO oRad1 VAR nTipoOrdem Prompt "Alfabética",; 
                                                   "Código",; 
                                                   "Mais Vendidos",; 
                                                   "Maior Desconto",; 
                                                   "Maior Valor Final",;
																	"Com Clientes";
                 SIZE  86,  20 PIXEL OF oGrp3

              oRad1:aItems[1]:Move( 16, 8, 86, 20, .T. )
              oRad1:aItems[1]:SetColor( 0, 15790320 )
              oRad1:aItems[1]:SetFont( oFont2 )
              oRad1:aItems[2]:Move( 41, 8, 70, 20, .T. )
              oRad1:aItems[2]:SetColor( 0, 15790320 )
              oRad1:aItems[2]:SetFont( oFont2 )
              oRad1:aItems[3]:Move( 16, 154, 124, 20, .T. )
              oRad1:aItems[3]:SetColor( 0, 15790320 )
              oRad1:aItems[3]:SetFont( oFont2 )
              oRad1:aItems[4]:Move( 41, 154, 126, 20, .T. )
              oRad1:aItems[4]:SetColor( 0, 15790320 )
              oRad1:aItems[4]:SetFont( oFont2 )
              oRad1:aItems[5]:Move( 16, 323, 133, 20, .T. )
              oRad1:aItems[5]:SetColor( 0, 15790320 )
              oRad1:aItems[5]:SetFont( oFont2 )
              oRad1:aItems[6]:Move( 41, 323, 133, 20, .T. )
              oRad1:aItems[6]:SetColor( 0, 15790320 )
              oRad1:aItems[6]:SetFont( oFont2 )


   @ 292, 369 BTNBMP oBtn1 Prompt "Imprime";
              FILE "Imagens\16\Printer.bmp" SIZE 100,  26 PIXEL ; 
              OF oForm_Prd_Vendidos ACTION ImprimePrd() FONT oFont3 left
              oBtn1:SETCOLOR( 0, 14342874 ) 


   @ 292, 269 BTNBMP oBtn2 Prompt "Cancela";
              FILE "Imagens\16\Cancela.bmp" SIZE 100,  26 PIXEL ; 
              OF oForm_Prd_Vendidos ACTION oForm_Prd_Vendidos:end() FONT oFont3 left
              oBtn2:SETCOLOR( 0, 14342874 ) 

Return NIL
*-------------------------------------------*  
*  
* Define a Funcao ImprimePrd que Imprime o relatorio de produtos vendidos no periodo  
*  
* VES09203 28/05/2014 - 18:06:29  Everton  
*  
*----------------------------------------------------------*  
Static Function ImprimePrd()  
*
set softseek ON
*
cCodSec := left( cCodSTMA, 2 )
cCodTip := substr( cCodSTMA, 3, 3 )
cCodMar := right( cCodSTMA, 3 )
*
if !empty( cCodSec )
   cCondSc := "left( PD_MARC, 2 ) == cCodSec"
   cTitSc  :=  "* SEÇÃO.: " + cCodSec + " - " + left( cNomeSec, 30 ) + " *** "                                   
else
   cCondSc := ".t."
   cTitSc  :=  "* SEÇÃO.: *** TODAS *** "                                   
endif   
*                                                                            
if !empty( cCodTip )
   cCondTp := "substr( PD_MARC, 3, 3 ) == cCodTip"
   cTitTp  :=  "* TIPO.: " + cCodTip + " - " + left( cNomeTip, 30 ) + " *** "                                   
else
   cCondTp := ".t."
   cTitTp  :=  "* TIPO.: *** TODOS *** "
endif   
*
if !empty( cCodMar )
   cCondMr := "right( PD_MARC, 3 ) == cCodMar"
   cTitMr  :=  "* TIPO.: " + cCodMar + " - " + left( cNomeMar, 30 ) + " *** "                                   
else
   cCondMr := ".t."          
   cTitMr  :=  "* MARCA.: *** TODAS *** "
endif   
*
if _lTodasVendas
   dDataInicial := ctod( "01/01/2000" )
   dDataFinal   := date()
   Condi_1 := "VEN_DATA >= dDataInicial .and. VEN_DATA <= dDataFinal"
else
   Condi_1 := "VEN_DATA >= dDataInicial .and. VEN_DATA <= dDataFinal"
endif
*
if _lTodosOperadores
   Condi_2 := ".t."
else   
   Condi_2 := "VEN_VEND == CodigoOperador"
endif
*
public _cNomArq := "T" + strzero( secs( time() ), 7, 0 )
if !_Abre( "TEMPP1.KI", _cNomArq, {"TEMPP1A.IND", "TEMPP1B.IND", "TEMPP1C.IND"}, {"DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .t., 2 )
   if !_Abre( "TEMPP2.KI", _cNomArq, {"TEMPP2A.IND", "TEMPP2B.IND", "TEMPP2C.IND"}, {"DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .t., 2 )
      if !_Abre( "TEMPP3.KI", _cNomArq, {"TEMPP3A.IND", "TEMPP3B.IND", "TEMPP3C.IND"}, {"DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .t., 2 )
         break
      else
         n_xTemp := 3	   
      endif
   else
      n_xTemp := 2	   
   endif
else
   n_xTemp := 1
endif   
*
select ( _cNomArq ) 
set Order to 02
zap
*
select Produtos
set order to 01
go top
*
select DetVenda
set Order to 04
go top
*
select CabVenda
set Order to 02
go top
*
if dbseek( dtos( dDataInicial ), .t. )
   *
   do while !eof() .and. &Condi_1.
      *
      if &Condi_2. .and. !VEN_CANC
         CodVenda     := VEN_SEQU
         CodCliVndRel := VEN_CLIE
         NomCliVndRel := alltrim( VEN_NOME )
         *
         select DetVenda
         go top
         *
         if dbseek( CodVenda )
            *
            do while DEV_PEDI == CodVenda
               *
               CodiProd  := DEV_ITEM
               QtdeProd  := DEV_QUAN
               ValoUnit  := DEV_VALO
               DescProd  := DEV_DESC
               TotaProd  := DEV_TOTA
               NomeProd  := DEV_NOME
               *
               select Produtos
               go top
               *
               if dbseek( CodiProd )
                  if &cCondSc. .and. &cCondTp. .and. &cCondMr.
                     NomeProd := PD_DESC
                     nEstoque := PD_ESTO + PD_ESPA
                     *
                     * Por cliente
                     *
                        select ( _cNomArq )
                        set Order to 02
                        go top
                        *
                        if !dbseek( CodiProd  )
                           append blank
                           replace DET_ITEM with CodiProd,;
									        DET_QUAN with DET_QUAN + QtdeProd,;
                                   DET_VALO with ValoUnit,;
                                   DET_DESC with DET_DESC + DescProd,;
                                   DET_TOTA with DET_TOTA + TotaProd,;
                                   DET_NOME with NomeProd,;
                                   DET_CLIE with CodCliVndRel
                           DbUnlock()
                        else
                           rlock()
                           replace DET_QUAN with DET_QUAN + QtdeProd,;
                                   DET_VALO with DET_VALO + ValoUnit,;
                                   DET_DESC with DET_DESC + DescProd,;
                                   DET_TOTA with DET_TOTA + TotaProd
                        endif
                     *
                  endif
               else
                  NomeProd := "Produto Não Encontrado"
               endif
               *
               select DetVenda
               skip
            enddo
         endif
      endif
      *
      select CabVenda
      skip
   enddo
endif
*
PRINT oPrinter FROM USER PREVIEW;
NAME "Produtos Vendidos  -  Battiston Sistemas - (49)3323-8032"
*
DEFINE FONT oXFont   NAME "ARIAL"  SIZE 0, -8       OF oPrinter
DEFINE FONT oXFont1  NAME "ARIAL"  SIZE 0, -8 BOLD  OF oPrinter
DEFINE FONT oXFont2  NAME "ARIAL"  SIZE 0, -10      OF oPrinter
DEFINE FONT oXFont3  NAME "ARIAL"  SIZE 0, -9 BOLD OF oPrinter
DEFINE FONT oXFontC2 NAME "ARIAL"  SIZE 0, -10      OF oPrinter
DEFINE FONT oXFontC3 NAME "ARIAL"  SIZE 0, -10 BOLD OF oPrinter

DEFINE PEN  oPen1   WIDTH 10 COLOR CLR_BLACK       OF oPrinter
*
CursorWait()
*
select ( _cNomArq )
*
if nTipoOrdem == 1
   index on DET_NOME to Indi01.Ind
elseif nTipoOrdem == 2
   index on DET_ITEM to Indi01.Ind
elseif nTipoOrdem == 3
   index on DESCEND( DET_QUAN ) to Indi01.Ind
elseif nTipoOrdem == 4
   index on DESCEND( DET_DESC ) to Indi01.Ind
elseif nTipoOrdem == 5
   index on DESCEND( DET_TOTA ) to Indi01.Ind
endif

set index to Indi01.Ind 
go top
*
nRow       := 0.50
nCol       := 1.00
nContaLin  := 1
nPagina    := 1
nImpressos := 0
nCodAcha   := Space( 07 )
nEstoque   := 0
*
oPrinter:SetPage(9)
oPrinter:StartPage()
ResLinha  := oPrinter:nLogPixely() / 2.54
ResColuna := oPrinter:nLogPixelx() / 2.54
*
__nProPec :=  __nDesTot :=  __nVndTot :=  __nProIte := 0
cTitulo2 := "Entre..: " + dtoc( dDataInicial ) + " e " + dtoc( dDataFinal )
*
do while !eof()
   *
	if nPagina == 1 
		oPrinter:SayBitmap( nRow * ResLinha, 1.00 * ResColuna, "LogoImpr.BMP", 420 , 300 )
		nRow += 0.50
		oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, cEmpresa, oXFontC3, 0 )
		nRow += 0.50
		oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, cTelefone, oXFontC2, 0 )
		nRow += 0.50
		oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, "Relatório de Produtos Vendidos" + "   " + cTitulo2, oXFont1, 0 )
		oPrinter:say( nRow * ResLinha, 17.50 * ResColuna, "Página.:" + strzero( nPagina, 3, 0 ), oXFont1, 0 )
		nRow += 0.50
      oPrinter:Say( nRow * ResLinha, 4.10 * ResColuna, cTitSc, oXFont  )
		nRow += 0.50
      oPrinter:Say( nRow * ResLinha, 5.10 * ResColuna, cTitTp, oXFont  )
		nRow += 0.50
      oPrinter:Say( nRow * ResLinha, 6.10 * ResColuna, cTitMr, oXFont  )            
      nRow += 0.50
		oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, (nCol + 18.1) * ResColuna  )
		nRow += 0.30
	   oPrinter:Say( nRow * ResLinha, 1.00 * ResColuna, " Código        Descrição                                                                     Vendida       Estoque       Valor Unitário            Desconto             Valor Total", oXFont1  )
	   nRow += 0.50
		oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, (nCol + 18.1) * ResColuna  )
	   nRow += 0.50
	   nPagina ++
	   nContaLin := 7
	endif
   * 
   nCodAcha := DET_ITEM
	select Produtos
	go top
	if dbseek( nCodAcha )
      nEstoque := PD_ESTO + PD_ESPA
   endif
	*
	select ( _cNomArq )
	CodCLiente := DET_CLIE
	*
   oPrinter:Say( nRow * ResLinha, 1.65 * ResColuna,  transform( DET_ITEM, "@R 999999-9"), oXFont,,,,2 )
   oPrinter:Say( nRow * ResLinha, 2.70 * ResColuna,  alltrim(DET_NOME), oXFont,,,,0 )
	oPrinter:Say( nRow * ResLinha, 10.00 * ResColuna, transform( DET_QUAN, "999,999" ), oXFont,,,,1 )
   oPrinter:Say( nRow * ResLinha, 11.50 * ResColuna, transform( nEstoque, "999,999" ), oXFont,,,,1 )
   oPrinter:Say( nRow * ResLinha, 14.00 * ResColuna, transform( DET_VALO, "999,999.99" ), oXFont,,,,1 )
   oPrinter:Say( nRow * ResLinha, 16.50 * ResColuna, transform( DET_DESC, "999,999.99" ), oXFont,,,,1 )
   oPrinter:Say( nRow * ResLinha, 19.00 * ResColuna, transform( DET_VALO * DET_QUAN, "999,999.99" ), oXFont,,,,1 )
   nRow       += 0.40
   *
   nContaLin ++
   *
   __nProIte ++
	__nProPec += DET_QUAN
   __nDesTot += DET_DESC
   __nVndTot += DET_VALO * DET_QUAN
   *
   if nContaLin >= 57
      nRow       := 0.50
      nCol       := 1.00
      oPrinter:endPage()
      oPrinter:StartPage()
      nContaLin  := 1
      nPagina := 1
      SYSREFRESH()
   endif
   *
   skip
enddo   
*
if nContaLin >= 57
   nRow       := 0.50
   nCol       := 1.00
   nContaLin  := 1
   oPrinter:endPage()
   oPrinter:StartPage()
   nPagina := 1
else
   nRow += 0.35
   nContaLin ++
endif
*
oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, (nCol + 18.1) * ResColuna  )
nRow += 0.50
oPrinter:Say( nRow * ResLinha, 1.00 * ResColuna, "TOTAIS DO RELATÓRIO ->    Itens...:                  Peças..:                            Desc Concedidos.:                                      Valor Total..:", oXFont  )
*
oPrinter:Say( nRow * ResLinha, 6.70 * ResColuna, transform( __nProIte, "999,999" ), oXFont1,,,,2 )
oPrinter:Say( nRow * ResLinha, 9.50 * ResColuna, transform( __nProPec, "999,999" ), oXFont1,,,,2 )
oPrinter:Say( nRow * ResLinha, 14.00 * ResColuna, transform( __nDesTot, "999,999.99" ), oXFont1,,,,2 )
oPrinter:Say( nRow * ResLinha, 18.00 * ResColuna, transform( __nVndTot, "999,999.99" ), oXFont1,,,,2 )
*
nRow += 0.50
oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, (nCol + 18.1) * ResColuna  )
*
CursorArrow()
* 
oPrinter:EndPage()
oPrinter:Preview()

select ( _cNomArq )
close
* 
set softseek OFF  
Return .t.
*-------------------------------*
* Nome...: VeMarca
* data...: 08/06/07
* funcao.: Verifica o codigo do Marca digitado, se encontra retorna o codigo
*          e imprime o nome, senao encontra, abre o ListBox com a opcao
*          de cadastrar.
*---------------------------------------------------------------------*
function VeSTMA( CodSTMA )
*
CodSecao := left( CodSTMA, 2 ) 
CodTipo  := left( CodSTMA, 5 )  
CodMarca := CodSTMA
*                                          @  15, 140 SAY oSay5 VAR cNomeSec SIZE 250,  16 PIXEL;
select Secao
set Order to 01
go top
*
if val( CodSecao ) > 0
   if dbseek( CodSecao )
      cNomeSec := alltrim( SEC_DESC )
   	oSay5:VarPut( cNomeSec )
   	oSay5:refresh()
   else
      MsgInfo( "Esta SEÇÃO não foi encontrada, verefique o código digitado!", "..: Atenção :.." )
      select Produtos   
      return .t.
   endif 
else
  cNomeSec := "Todas as Seções"
  oSay5:VarPut( cNomeSec )
  oSay5:refresh()
endif
*
select Tipo
set Order to 01
go top
*
if Val( right( CodTipo, 3 ) ) > 0
   if dbseek( CodTipo )
      cNomeTip := alltrim( TIP_DESC )
   	oSay6:VarPut( cNomeTip )
   	oSay6:refresh()
   else
      MsgInfo( "Este SEÇÃO/TIPO não foi encontrado, verefique o código digitado!", "..: Atenção :.." )
      select Produtos   
      return .t.
   endif
else
  cNomeTip := "Todas os Tipos"
  oSay6:VarPut( cNomeTip )
  oSay6:refresh()
endif
*
select Marca
set Order to 01
go top
*
DEFINE FONT oFont8 NAME "Arial Black" SIZE   0, -13 ITALIC	

if Val( right( CodMarca, 3 ) ) > 0
	if dbseek( CodMarca )
	   cNomeMar := alltrim( MAR_DESC )
		oSay7:VarPut( cNomeMar )
		oSay7:refresh()
	else
	   MsgInfo( "Esta SEÇÃO/TIPO/MARCA não foi encontrado, verefique o código digitado!", "..: Atenção :.." )
	   select Produtos   
	   return .t.
	endif
else
  cNomeMar := "Todas as Marcas"
  oSay7:VarPut( cNomeMar )
  oSay7:refresh()
endif
select Produtos   
return .t.

 

Link to comment
Share on other sites

Confusão do kão! Veja como eu enxergo o modulo ou como faria se ajuda. Eres aprendiz?

#include "Fivewin.ch"
#include "vrmm.ch"
#include "DtPicker.ch"
#include "URLLink.ch"
#include "CORGET.CH"
	//*************************************************
// Sistema .....: BS.Escola
// Programa ....: VES09203.prg
// Autor .......: Everton
// Sintese .....: Relatório de Produtos Vendidos
// Data ........: 04/05/2014 às 23:52:46
// Revisado em .: 04/05/2014 às 23:52:46
//*****************************************************************************
	FUNCTION VES09203()
	   PRIVATE oGrp1, oGrp2, oGrp3, ;
      oGet1, oGet2, ;
      oRad1, ;
      oDtP1, oDtP2, ;
      oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7, ;
      oBtn1, oBtn2, ;
      oChk1, oChk2
	   // SE POSSIVEL, TROQUE O QUE FOR POSSIVEL, POR STATIC
   PUBLIC _lTodasVendas     := .F.
   PUBLIC dDataInicial      := Date()
   PUBLIC dDataFinal        := Date()
   PUBLIC _lTodosOperadores := .T.
   PUBLIC CodigoOperador    := 0
   PUBLIC NomeDoOperador    := Space( 30 )
   PUBLIC nTipoOrdem        := 1
   PUBLIC cCodSTMA          := Space( 08 )
   PUBLIC cNomeSec          := Space( 20 )
   PUBLIC cNomeTip          := Space( 20 )
   PUBLIC cNomeMar          := Space( 20 )
	   // LOCAL E FECHE AO SAIR DO DIALOGO PARA NAO FICAR NA MEMORIA
   DEFINE FONT oFONT1 NAME "Arial" SIZE   0, - 12 BOLD
   DEFINE FONT oFONT2 NAME "Arial" SIZE   0, - 13
   DEFINE FONT oFONT3 NAME "Ms Sans Serif" SIZE   0, - 12
	   Define DIALOG oForm_Prd_Vendidos TITLE "..: Produtos Vendidos :.." Style 1;
      FROM 118, 266 TO 467, 748 PIXEL COLOR 0, 15790320
	   ACTIVATE DIALOG oForm_Prd_Vendidos ;
      ON INIT Ini_oForm_Prd_Vendidos() centered
	   // FECHE AS FONTES AO SAIR AQUI, E PONHA-AS COMO LOCAL
	RETURN NIL
	//----------------------------------------------------------------------------
	FUNCTION Ini_oForm_Prd_Vendidos()
	   @   2,   6 GROUP oGrp1 TO  72, 470 LABEL "Período" PIXEL;
      OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1
	   @  15,   8 CHECKBOX oChk1 VAR _lTodasVendas PROMPT "Todas" SIZE  78,  20 ;
      COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1
	
   @  41,   8 SAY oSay1 VAR "Data Inicial" SIZE  66,  16 PIXEL;
      OF oGrp1 COLOR 0, 15790320 FONT oFont2
	
   @  41, 246 SAY oSay2 VAR "Data Final" SIZE  62,  16 PIXEL;
      OF oGrp1 COLOR 0, 15790320 FONT oFont2
	
   @  39,  85 DTPICKER oDtP1 VAR dDataInicial SIZE 120,  20;
      COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1
	
   @  39, 311 DTPICKER oDtP2 VAR dDataFinal SIZE 120,  20;
      COLOR 0, 15790320 PIXEL OF oGrp1 FONT oFont1
                 
   @  72,   6 GROUP oGrp4 TO 142, 470 LABEL "Divisão de Estoque" PIXEL;
      OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1
	   @  20,  10 GET oGet2 VAR cCodSTMA SIZE 120,  20;
      COLOR 0, 16777215 PICTURE "@R 99.999.999" PIXEL OF oGrp4 FONT oFont1 VALID VeStma( cCodSTMA )
	
   @  15, 140 SAY oSay5 VAR cNomeSec SIZE 250,  16 PIXEL;
      OF oGrp4 COLOR 0, 15790320 FONT oFont1
                 
   @  32, 140 SAY oSay6 VAR cNomeTip SIZE 250,  16 PIXEL;
      OF oGrp4 COLOR 0, 15790320 FONT oFont1
                 
   @  51, 140 SAY oSay7 VAR cNomeMar SIZE 250,  16 PIXEL;
      OF oGrp4 COLOR 0, 15790320 FONT oFont1
	
   @  144,   6 GROUP oGrp2 TO 214, 470 LABEL "Operador" PIXEL;
      OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1
	   @  16,   8 CHECKBOX oChk2 VAR _lTodosOperadores PROMPT "Todos" SIZE  86,  20 ;
      COLOR 0, 15790320 PIXEL OF oGrp2 FONT oFont1
	
   @  39,  61 GET oGet1 VAR CodigoOperador SIZE  73,  20;
      COLOR 0, 16777215 PICTURE "99999" PIXEL OF oGrp2 FONT oFont1
	   @  41,   5 SAY oSay3 VAR "Código" SIZE  46,  16 PIXEL;
      OF oGrp2 COLOR 0, 15790320 FONT oFont1
	
   @  41, 146 SAY oSay4 VAR NomeDoOperador SIZE 310,  16 PIXEL;
      OF oGrp2 COLOR 0, 15790320 FONT oFont1
	   @ 215,   6 GROUP oGrp3 TO 288, 470 LABEL "Ordem" PIXEL;
      OF oForm_Prd_Vendidos COLOR 0, 15790320 FONT oFont1
	   @  16,   8 RADIO oRad1 VAR nTipoOrdem PROMPT "Alfabética", ;
      "Código", ;
      "Mais Vendidos", ;
      "Maior Desconto", ;
      "Maior Valor Final", ;
      "Com Clientes";
      SIZE  86,  20 PIXEL OF oGrp3
	   oRad1:aItems[1]:Move( 16, 8, 86, 20, .T. )
   oRad1:aItems[1]:SetColor( 0, 15790320 )
   oRad1:aItems[1]:SetFont( oFont2 )
   oRad1:aItems[2]:Move( 41, 8, 70, 20, .T. )
   oRad1:aItems[2]:SetColor( 0, 15790320 )
   oRad1:aItems[2]:SetFont( oFont2 )
   oRad1:aItems[3]:Move( 16, 154, 124, 20, .T. )
   oRad1:aItems[3]:SetColor( 0, 15790320 )
   oRad1:aItems[3]:SetFont( oFont2 )
   oRad1:aItems[4]:Move( 41, 154, 126, 20, .T. )
   oRad1:aItems[4]:SetColor( 0, 15790320 )
   oRad1:aItems[4]:SetFont( oFont2 )
   oRad1:aItems[5]:Move( 16, 323, 133, 20, .T. )
   oRad1:aItems[5]:SetColor( 0, 15790320 )
   oRad1:aItems[5]:SetFont( oFont2 )
   oRad1:aItems[6]:Move( 41, 323, 133, 20, .T. )
   oRad1:aItems[6]:SetColor( 0, 15790320 )
   oRad1:aItems[6]:SetFont( oFont2 )
	   @ 292, 369 BTNBMP oBtn1 PROMPT "Imprime";
      FILE "Imagens\16\Printer.bmp" SIZE 100,  26 PIXEL ;
      OF oForm_Prd_Vendidos ACTION ImprimePrd() FONT oFont3 left
   oBtn1:SETCOLOR( 0, 14342874 )
	
   @ 292, 269 BTNBMP oBtn2 PROMPT "Cancela";
      FILE "Imagens\16\Cancela.bmp" SIZE 100,  26 PIXEL ;
      OF oForm_Prd_Vendidos ACTION oForm_Prd_Vendidos:end() FONT oFont3 left
   oBtn2:SETCOLOR( 0, 14342874 )
	RETURN NIL
	//-------------------------------------------*
//
// Define a Funcao ImprimePrd que Imprime o relatorio de produtos vendidos no periodo
//
// VES09203 28/05/2014 - 18:06:29  Everton
//
//----------------------------------------------------------*
	STATIC FUNCTION ImprimePrd()
	   PUBLIC _cNomArq := "T" + strzero( secs( time() ), 7, 0 )
	   SET SOFTSEEK ON
	   cCodSec := left( cCodSTMA, 2 )
   cCodTip := substr( cCodSTMA, 3, 3 )
   cCodMar := right( cCodSTMA, 3 )
	   IF !empty( cCodSec )
      cCondSc := "left( PD_MARC, 2 ) == cCodSec"
      cTitSc  :=  "* SEÇÃO.: " + cCodSec + " - " + left( cNomeSec, 30 ) + " *** "
   ELSE
      cCondSc := ".t."
      cTitSc  :=  "* SEÇÃO.: *** TODAS *** "
   ENDIF
	   IF !empty( cCodTip )
      cCondTp := "substr( PD_MARC, 3, 3 ) == cCodTip"
      cTitTp  :=  "* TIPO.: " + cCodTip + " - " + left( cNomeTip, 30 ) + " *** "
   ELSE
      cCondTp := ".t."
      cTitTp  :=  "* TIPO.: *** TODOS *** "
   ENDIF
	   IF !empty( cCodMar )
      cCondMr := "right( PD_MARC, 3 ) == cCodMar"
      cTitMr  :=  "* TIPO.: " + cCodMar + " - " + left( cNomeMar, 30 ) + " *** "
   ELSE
      cCondMr := ".t."
      cTitMr  :=  "* MARCA.: *** TODAS *** "
   ENDIF
	   IF _lTodasVendas
      dDataInicial := ctod( "01/01/2000" )
      dDataFinal   := date()
      Condi_1 := "VEN_DATA >= dDataInicial .and. VEN_DATA <= dDataFinal"
   ELSE
      Condi_1 := "VEN_DATA >= dDataInicial .and. VEN_DATA <= dDataFinal"
   ENDIF
	   IF _lTodosOperadores
      Condi_2 := ".t."
   ELSE
      Condi_2 := "VEN_VEND == CodigoOperador"
   ENDIF
	   IF !_Abre( "TEMPP1.KI", _cNomArq, { "TEMPP1A.IND", "TEMPP1B.IND", "TEMPP1C.IND" }, { "DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .T. , 2 )
	      IF !_Abre( "TEMPP2.KI", _cNomArq, { "TEMPP2A.IND", "TEMPP2B.IND", "TEMPP2C.IND" }, { "DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .T. , 2 )
         IF !_Abre( "TEMPP3.KI", _cNomArq, { "TEMPP3A.IND", "TEMPP3B.IND", "TEMPP3C.IND" }, { "DET_PEDI + DET_ITEM", "DET_ITEM", "DET_CLIE" }, .T. , 2 )
            break
         ELSE
            n_xTemp := 3 
         ENDIF
      ELSE
         n_xTemp := 2 
      ENDIF
   ELSE
      n_xTemp := 1
   ENDIF
	   SELECT ( _cNomArq )
   SET ORDER TO 02
   ZAP
	   SELECT Produtos
   SET ORDER TO 01
   GO TOP
	   SELECT DetVenda
   SET ORDER TO 04
   GO TOP
	   SELECT CabVenda
   SET ORDER TO 02
   GO TOP
	   IF dbseek( dtos( dDataInicial ), .T. )
      //
      DO WHILE !eof() .AND. &Condi_1.
	         SYSREFRESH()
         //
         if &Condi_2. .AND. !VEN_CANC
            CodVenda     := VEN_SEQU
            CodCliVndRel := VEN_CLIE
            NomCliVndRel := alltrim( VEN_NOME )
            //
            SELECT DetVenda
            GO TOP
            //
            IF dbseek( CodVenda )
               //
               DO WHILE DEV_PEDI == CodVenda
	                  SYSREFRESH()
                  //
                  CodiProd  := DEV_ITEM
                  QtdeProd  := DEV_QUAN
                  ValoUnit  := DEV_VALO
                  DescProd  := DEV_DESC
                  TotaProd  := DEV_TOTA
                  NomeProd  := DEV_NOME
                  //
                  SELECT Produtos
                  GO TOP
                  //
                  IF dbseek( CodiProd )
                     if &cCondSc. .AND. &cCondTp. .AND. &cCondMr.
                        NomeProd := PD_DESC
                        nEstoque := PD_ESTO + PD_ESPA
                        //
                        // Por cliente
                        //
                        SELECT ( _cNomArq )
                        SET ORDER TO 02
                        GO TOP
                        //
                        IF !dbseek( CodiProd  )
                           APPEND BLANK
                           REPLACE DET_ITEM WITH CodiProd, ;
                              DET_QUAN WITH DET_QUAN + QtdeProd, ;
                              DET_VALO WITH ValoUnit, ;
                              DET_DESC WITH DET_DESC + DescProd, ;
                              DET_TOTA WITH DET_TOTA + TotaProd, ;
                              DET_NOME WITH NomeProd, ;
                              DET_CLIE WITH CodCliVndRel
                           DbUnlock()
                           COMMIT
                        ELSE
                           rlock()
                           REPLACE DET_QUAN WITH DET_QUAN + QtdeProd, ;
                              DET_VALO WITH DET_VALO + ValoUnit, ;
                              DET_DESC WITH DET_DESC + DescProd, ;
                              DET_TOTA WITH DET_TOTA + TotaProd
                           COMMIT
                           UNLOCK
                        ENDIF
                        //
                     ENDIF
                  ELSE
                     NomeProd := "Produto Não Encontrado"
                  ENDIF
                  //
                  SELECT DetVenda
                  SKIP
               ENDDO
            ENDIF
         ENDIF
	         SELECT CabVenda
         SKIP
	      ENDDO
	   ENDIF
	   SELECT ( _cNomArq )
	
   // SE POSSIVEL, JA VENHA COM OS INDICES DE UM INDEXADOR. E USE .CDX
   IF nTipoOrdem == 1
      INDEX ON DET_NOME TO Indi01.Ind
   ELSEIF nTipoOrdem == 2
      INDEX ON DET_ITEM TO Indi01.Ind
   ELSEIF nTipoOrdem == 3
      INDEX ON DESCEND( DET_QUAN ) TO Indi01.Ind
   ELSEIF nTipoOrdem == 4
      INDEX ON DESCEND( DET_DESC ) TO Indi01.Ind
   ELSEIF nTipoOrdem == 5
      INDEX ON DESCEND( DET_TOTA ) TO Indi01.Ind
   ENDIF
	   SET INDEX TO Indi01.Ind
   GO TOP
	   DEFINE FONT oXFont   NAME "ARIAL"  SIZE 0, - 8       OF oPrinter
   DEFINE FONT oXFont1  NAME "ARIAL"  SIZE 0, - 8 BOLD  OF oPrinter
   DEFINE FONT oXFont2  NAME "ARIAL"  SIZE 0, - 10      OF oPrinter
   DEFINE FONT oXFont3  NAME "ARIAL"  SIZE 0, - 9 BOLD  OF oPrinter
   DEFINE FONT oXFontC2 NAME "ARIAL"  SIZE 0, - 10      OF oPrinter
   DEFINE FONT oXFontC3 NAME "ARIAL"  SIZE 0, - 10 BOLD OF oPrinter
	   DEFINE PEN  oPen1   WIDTH 10 COLOR CLR_BLACK       OF oPrinter
	   ResLinha  := oPrinter:nLogPixely() / 2.54
   ResColuna := oPrinter:nLogPixelx() / 2.54
	   // DEFINA COMO LOCAL
   nRow       := 0.50
   nCol       := 1.00
   nContaLin  := 1
   nPagina    := 1
   nImpressos := 0
   nCodAcha   := Space( 07 )
   nEstoque   := 0
	   CursorWait()
	   PRINT oPrinter FROM USER PREVIEW;
      NAME "Produtos Vendidos  -  Battiston Sistemas - (49)3323-8032"
	   oPrinter:SetPage( 9 )
   oPrinter:StartPage()
	   __nProPec :=  __nDesTot :=  __nVndTot :=  __nProIte := 0
   cTitulo2 := "Entre..: " + dtoc( dDataInicial ) + " e " + dtoc( dDataFinal )
	   DO WHILE !eof()
	      SYSREFRESH()
      //
      IF nPagina == 1
         oPrinter:SayBitmap( nRow * ResLinha, 1.00 * ResColuna, "LogoImpr.BMP", 420 , 300 )
         nRow += 0.50
         oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, cEmpresa, oXFontC3, 0 )
         nRow += 0.50
         oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, cTelefone, oXFontC2, 0 )
         nRow += 0.50
         oPrinter:say( nRow * ResLinha, 4.10 * ResColuna, "Relatório de Produtos Vendidos" + "   " + cTitulo2, oXFont1, 0 )
         oPrinter:say( nRow * ResLinha, 17.50 * ResColuna, "Página.:" + strzero( nPagina, 3, 0 ), oXFont1, 0 )
         nRow += 0.50
         oPrinter:Say( nRow * ResLinha, 4.10 * ResColuna, cTitSc, oXFont  )
         nRow += 0.50
         oPrinter:Say( nRow * ResLinha, 5.10 * ResColuna, cTitTp, oXFont  )
         nRow += 0.50
         oPrinter:Say( nRow * ResLinha, 6.10 * ResColuna, cTitMr, oXFont  )
         nRow += 0.50
         oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, ( nCol + 18.1 ) * ResColuna  )
         nRow += 0.30
         oPrinter:Say( nRow * ResLinha, 1.00 * ResColuna, " Código        Descrição                                                                     Vendida       Estoque       Valor Unitário            Desconto             Valor Total", oXFont1  )
         nRow += 0.50
         oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, ( nCol + 18.1 ) * ResColuna  )
         nRow += 0.50
         nPagina ++
         nContaLin := 7
      ENDIF
      //
      nCodAcha := DET_ITEM
	      SELECT Produtos
      GO TOP
	      IF dbseek( nCodAcha )
         nEstoque := PD_ESTO + PD_ESPA
      ENDIF
      //
      SELECT ( _cNomArq )
	      CodCLiente := DET_CLIE
      //
      oPrinter:Say( nRow * ResLinha, 1.65 * ResColuna,  transform( DET_ITEM, "@R 999999-9" ), oXFont, , , , 2 )
      oPrinter:Say( nRow * ResLinha, 2.70 * ResColuna,  alltrim( DET_NOME ), oXFont, , , , 0 )
      oPrinter:Say( nRow * ResLinha, 10.00 * ResColuna, transform( DET_QUAN, "999,999" ), oXFont, , , , 1 )
      oPrinter:Say( nRow * ResLinha, 11.50 * ResColuna, transform( nEstoque, "999,999" ), oXFont, , , , 1 )
      oPrinter:Say( nRow * ResLinha, 14.00 * ResColuna, transform( DET_VALO, "999,999.99" ), oXFont, , , , 1 )
      oPrinter:Say( nRow * ResLinha, 16.50 * ResColuna, transform( DET_DESC, "999,999.99" ), oXFont, , , , 1 )
      oPrinter:Say( nRow * ResLinha, 19.00 * ResColuna, transform( DET_VALO * DET_QUAN, "999,999.99" ), oXFont, , , , 1 )
      nRow       += 0.40
      //
      nContaLin ++
      //
      __nProIte ++
      __nProPec += DET_QUAN
      __nDesTot += DET_DESC
      __nVndTot += DET_VALO * DET_QUAN
      //
      IF nContaLin >= 57
	         nRow       := 0.50
         nCol       := 1.00
         oPrinter:endPage()
         oPrinter:StartPage()
         nContaLin  := 1
         nPagina := 1
	      ENDIF
	      SKIP
	   ENDDO
	   // ???
   IF nContaLin >= 57  // 24.50
      nRow       := 0.50
      nCol       := 1.00
      nContaLin  := 1
      oPrinter:endPage()
      oPrinter:StartPage() // NOVA PAGINA
      nPagina := 1  // ??
   ELSE
      nRow += 0.35
      nContaLin ++
   ENDIF
	   oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, ( nCol + 18.1 ) * ResColuna  )
	   nRow += 0.50
   oPrinter:Say( nRow * ResLinha, 1.00 * ResColuna, "TOTAIS DO RELATÓRIO ->    Itens...:                  Peças..:                            Desc Concedidos.:                                      Valor Total..:", oXFont  )
	   oPrinter:Say( nRow * ResLinha, 6.70 * ResColuna, transform( __nProIte, "999,999" ), oXFont1, , , , 2 )
   oPrinter:Say( nRow * ResLinha, 9.50 * ResColuna, transform( __nProPec, "999,999" ), oXFont1, , , , 2 )
   oPrinter:Say( nRow * ResLinha, 14.00 * ResColuna, transform( __nDesTot, "999,999.99" ), oXFont1, , , , 2 )
   oPrinter:Say( nRow * ResLinha, 18.00 * ResColuna, transform( __nVndTot, "999,999.99" ), oXFont1, , , , 2 )
	   nRow += 0.50
	   oPrinter:Line( nRow * ResLinha, 1.00 * ResColuna, nRow * ResLinha, ( nCol + 18.1 ) * ResColuna  )
	   oPrinter:EndPage()
   oPrinter:Preview()
	   SELECT ( _cNomArq )
   CLOSE
	   SET SOFTSEEK OFF
	   CursorArrow()
	RETURN .T.
	//-------------------------------*
// Nome...: VeMarca
// data...: 08/06/07
// funcao.: Verifica o codigo do Marca digitado, se encontra retorna o codigo
//          e imprime o nome, senao encontra, abre o ListBox com a opcao
//          de cadastrar.
//---------------------------------------------------------------------*
	FUNCTION VeSTMA( CodSTMA )
	
   CodSecao := left( CodSTMA, 2 )
   CodTipo  := left( CodSTMA, 5 )
   CodMarca := CodSTMA
   //  @  15, 140 SAY oSay5 VAR cNomeSec SIZE 250,  16 PIXEL;
   SELECT Secao
   SET ORDER TO 01
   GO TOP
	   IF val( CodSecao ) > 0
      IF dbseek( CodSecao )
         cNomeSec := alltrim( SEC_DESC )
         oSay5:VarPut( cNomeSec )
         oSay5:refresh()
      ELSE
         MsgInfo( "Esta SEÇÃO não foi encontrada, verefique o código digitado!", "..: Atenção :.." )
         SELECT Produtos
         RETURN .T.
      ENDIF
   ELSE
      cNomeSec := "Todas as Seções"
      oSay5:VarPut( cNomeSec )
      oSay5:refresh()
   ENDIF
	   SELECT Tipo
   SET ORDER TO 01
   GO TOP
	   IF Val( right( CodTipo, 3 ) ) > 0
      IF dbseek( CodTipo )
         cNomeTip := alltrim( TIP_DESC )
         oSay6:VarPut( cNomeTip )
         oSay6:refresh()
      ELSE
         MsgInfo( "Este SEÇÃO/TIPO não foi encontrado, verefique o código digitado!", "..: Atenção :.." )
         SELECT Produtos
         RETURN .T.
      ENDIF
   ELSE
      cNomeTip := "Todas os Tipos"
      oSay6:VarPut( cNomeTip )
      oSay6:refresh()
   ENDIF
	   SELECT Marca
   SET ORDER TO 01
   GO TOP
	   DEFINE FONT oFont8 NAME "Arial Black" SIZE   0, - 13 ITALIC 
	   IF Val( right( CodMarca, 3 ) ) > 0
      IF dbseek( CodMarca )
         cNomeMar := alltrim( MAR_DESC )
         oSay7:VarPut( cNomeMar )
         oSay7:refresh()
      ELSE
         MsgInfo( "Esta SEÇÃO/TIPO/MARCA não foi encontrado, verefique o código digitado!", "..: Atenção :.." )
         SELECT Produtos
         RETURN .T.
      ENDIF
   ELSE
      cNomeMar := "Todas as Marcas"
      oSay7:VarPut( cNomeMar )
      oSay7:refresh()
   ENDIF
	   SELECT Produtos
	RETURN .T.


 

Link to comment
Share on other sites

Everton retire o COMMIT e o DBUNLOCK

São tabelas temporárias certo? Sendo temporarias vc nao precisa se preocupar com lock de registro e tb com descarregar em disco...

Mude todos os locais onde está SYSREFRESH e coloque a funcao MY_SYSREFRESH() e o fonte dela segue abaixo:

Static Function MY_SYSREFRESH()
Static nCont := 100
nCont++
If nCont > 100
   SysRefresh()
   nCont := 0
EndIf
Return

 

Faça isso e ja vai melhorar muito, testa ai

 

Link to comment
Share on other sites

 

Everton retire o COMMIT e o DBUNLOCK

São tabelas temporárias certo? Sendo temporarias vc nao precisa se preocupar com lock de registro e tb com descarregar em disco...

Mude todos os locais onde está SYSREFRESH e coloque a funcao MY_SYSREFRESH() e o fonte dela segue abaixo:


Static Function MY_SYSREFRESH()
Static nCont := 100
nCont++
If nCont > 100
   SysRefresh()
   nCont := 0
EndIf
Return

 

Faça isso e ja vai melhorar muito, testa ai

 

blz.. obrigado!!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...