nardeypm Posted May 21, 2013 Report Share Posted May 21, 2013 gostaria que me ajudassem a descobrir o que está errado. não é possÃvel desenvolver um sistema e descobrir que o mesmo não funciona a contento. tenho 3 (tres) micros que compartilham um sistema, sendo 01 deles onde estão a base de dados (corei5,4gb,500hd). os outros 2 são um corei3,2gb,hd500 e intel dualcore com 2gb, hd 160gb. o problema é que os terminais principalmente ficam extremamente lentos. isso fica mais explicito quando da confecção de relatorios. meus sistema deve ter uns 5mil clientes. base de dados dbf com cdx. já fiz de tudo para acelerar o acesso. estou completamente perdido. só escuto secretaria e atendentes reclamando que o sistema agarra, demora muito para abrir, etc e tal. detalhe: substitui todos os set filter por ordcope. aceito sugestões, mas já estou considerando mudar a linguagem de programação. Quote Link to comment Share on other sites More sharing options...
joaosolution Posted May 21, 2013 Report Share Posted May 21, 2013 Amigo não mude a linguagem, mude o banco. Após mudar para MySql e alterar algumas consultas ficou tranquilo. Não precisa pedir para organizar arquivos. Posso dar manutenção no banco de dados com todos trabalhando. Abertura rápida dos arquivos. Tenho cliente com servidor HP Core I5 HD 1.0TB 8Gb Ram, terminais pentium, athlon, dual core todos com xp ou Win7. Com 4 tabelas de atendimentos com mais de 600.000 registros (cada uma) clientes já está em 300.000. Att João Bosco Quote Link to comment Share on other sites More sharing options...
nardeypm Posted May 21, 2013 Author Report Share Posted May 21, 2013 amigo, não sei por onde começar para fazer isso. trabalho com dbf no clipper há muito tempo. não tenho ideia do tamanho da mudança para sql. em tese quais seriam as mudanças com relação aos comandos??? Quote Link to comment Share on other sites More sharing options...
Theotokos Posted May 22, 2013 Report Share Posted May 22, 2013 Existe uma mudança que se faz no registro do Windows que melhora o desempenho do banco de dados. Amanhã vou verificar nos meus arquivos e lhe passo. Quote Link to comment Share on other sites More sharing options...
gilmer Posted May 22, 2013 Report Share Posted May 22, 2013 O que você usa? passe seu dbf para usar ads, não terá nenhum problema de performace e não muda nada no seu código Quote Link to comment Share on other sites More sharing options...
nardeypm Posted May 22, 2013 Author Report Share Posted May 22, 2013 esqueci de mencionar que eu converti todo o sistema clipper para fivewin. a partir daà é que a lentidão apareceu. já reinstalei drivers de rede, troquei cabeamento e switch, formatei as maquinas, e nada..... hoje o programa está em fivewin com base de dados dbf/cdx. Quote Link to comment Share on other sites More sharing options...
marcioe Posted May 22, 2013 Report Share Posted May 22, 2013 amigo, O ideal é mudar para MYSQL mesmo ou outro banco de dados cliente/servidor mas enquanto isso não é possivel poste parte do código onde ocorre a lentidao ou ele na totalidade. digamos que seja um relatorio de vendas por cliente. O idela em alguns casos é usar chave composta é só uma ideia, vou postar um código apenas ilustrativo, pode ter erros de sintax dbselect('clientes') go top do while clientes->!eof() dbselect('clientes') t_cli= codigo_cliente dbselect('vendas') set order to indice com a chave de clientes+datavenda+etc... go top if dbseek t_cli+t_dt_inicio do while vendas->!eof() emite os dados da venda enddo endif dbselect('clientes') skip loop enddo Quote Link to comment Share on other sites More sharing options...
Theotokos Posted May 22, 2013 Report Share Posted May 22, 2013 Como disse, peguei esta rotina aqui mesmo no forum, talvez possso lhe ajudar, faça o teste: *--( Grava no registro do windows instrução para agilizar gravação em rede )--* Function TurbinaRede() local oReg oReg := TReg32():New( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" ) oReg:Set("EnableOplocks", "00000000") oReg:Set("CachedOpenLimit", "00000000") oReg:Set("Autodisconnect", "ffffffff") oReg:Set("EnableOplockForceClose", "00000001") oReg:Set("MaxKeepSearch", "000000b4") oReg:Set("MinKeepSearch", "0000000a") oReg:Set("ScavTimeout", "0000000a") oReg:Set("ThreadPriority", "00000002") oReg:Close() * If MsgYesNo("É Necessário Reiniciar o Computador"+CRLF+"Deseja Reiniciar Agora?","Reiniciar") oWndMain:End() WinExec( "ShutDown -s" ) End * RETURN NIL * -------------------- * Quote Link to comment Share on other sites More sharing options...
Theotokos Posted May 22, 2013 Report Share Posted May 22, 2013 O que você usa? passe seu dbf para usar ads, não terá nenhum problema de performace e não muda nada no seu código Olá gilmer, você pode dar uma idéia de como mudar para o ADS? os arquivos DBF tem que mudar ? nos fontes você já disse que não muda, mas é uma RDD? Vlw! Quote Link to comment Share on other sites More sharing options...
Valdir Posted May 22, 2013 Report Share Posted May 22, 2013 Olá Bobkolho e demais amigos... Essa lentidão provavelmente está relacionada com a estrutura da programação. Antigamente também sofria com esse tipo de problemas e resolvi da seguinte forma : - Crio todos os indices na inicialização do meu Sistema. - Esses Ãndices serão usados para Pesquisar ou Alterar as informações no sistema bem como nos relatórios. - Para cada alteração ou seleção de informações para relatórios uso arquivos temporários. - Arquivos temporários criados após a filtragem através do OrdScope ou do Set Index. - Em todos os while com dbskip(), acionei o comando sysrefresh() Praticamente foram essas mudanças que realizei e hoje tenho clientes que trabalham com 20 terminais plugados num servidor e faz um bom tempo que pararam as reclamações de lentidão. um abraço Quote Link to comment Share on other sites More sharing options...
gilmer Posted May 22, 2013 Report Share Posted May 22, 2013 O xHarbour tem um RDD Ads Free, ele não é a versão cliente/servidor, mas ganha recursos novos. Quote Link to comment Share on other sites More sharing options...
SAOliveira Posted May 22, 2013 Report Share Posted May 22, 2013 1 - Acho que o o ideal seria ajudarmos na situação atual. 2 - Como ele mesmo disse, passou a ocorrer depois da migração para FW. 3 - Secretarias dizem que o sistema agarra, demora para abrir. Seria possivel voce mostrar: - Código onde acusa a lentidão. - Forma de abrir os arquivos. Quote Link to comment Share on other sites More sharing options...
nardeypm Posted May 22, 2013 Author Report Share Posted May 22, 2013 os indices são abertos na entrada do sistema. SELECT 14 USE SAEMP SHARED SELECT 10 USE SACPMOV SHARED IF ! FILE("SACPMOV.CDX") MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "SACPMOV->N_DOC", "NDOC" ) },; "Classificando movimento por documento...", "Espere um momento!" ) MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "DTOS(DT_PGTO)+TIPO+N_DOC", "DTPNDOC" ) },; "Classificando movimento por data de pagamento + tipo + documento...", "Espere um momento!" ) MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "DTOS(DT_VENC)+TIPO+N_DOC", "DTVNDOC" ) },; "Classificando movimento por data de vencimento + tipo + documento...", "Espere um momento!" ) ENDIF ordListClear() OrdListAdd("SACPMOV", "NDOC", "DTPNDOC", "DTVNDOC") lá vai o codigo do modulo caixa, que parece ser o que deixa o sistema + lento. #include "FiveWin.ch" static mck3, mck4, oBanco static wcodi, wdata, whis1, whis2, wsant, wentr, wsaid, wsatu, wtipo,; wdesp, nEnHoje, nSaHoje #xcommand @ <nRow>,<nCol> SAY <cText> OF <oPrinter> => <oPrinter>:Say(<nRow>, <nCol>, <cText> ) Request OrdKeyNo Request OrdKeyCount //----------------------------------------------------------------------------// function Caixa() local oMeter, oText, lEnd, oDlg, oget1 local oLbx, mDini, mDfim, est:={} PUBLIC wdat1, wdat2, wtant, wtent, wtsai, wtatu, wScrd, wSdeb, wcdes,; wfil, wsubc, oget2 IF ! UsrFree(CaiCons) ; RETURN NIL ; ENDIF STORE CTOD(" ") TO wdat1, wdat2 STORE 1 TO word STORE 0 TO wtant, wtent, wtsai, wtatu, wsubc, nEnHoje, nSaHoje STORE DATE() TO wdata STORE 0 TO wcodi, wsant, wentr, wsaid, wsatu, wdesp STORE SPACE(30) TO whis1, whis2 wtipo:=" " CursorWait() SELE 14 wsaldo=saldo wdt_saldo=dt_saldo wnome=nome SELECT 10 SACPMOV->(DBCLEARFIL(NIL)) SACPMOV->(DBSETORDER(2)) SACPMOV->(DBGOTOP()) DEFINE FONT oGetFnt NAME "Arial" SIZE 0,-12 DEFINE FONT oSayFnt NAME "Arial" SIZE 0,-11 DEFINE FONT mBrwFnt NAME "Courier New" SIZE 0,-12 DEFINE DIALOG oDlg FROM 0, 0 TO nDlgHi, nDlgWdt TITLE "Controle de Movimento de Caixa" @ 2, 8 SAY "&Pagamentos e Recebimentos" OF oDlg PIXEL SIZE 100,10 @ 1, 1 LISTBOX oLbx FIELDS SACPMOV->N_DOC,; // C¢digo SACPMOV->DT_VENC,; // TRANS(SACPMOV->VALOR,"@e 999,999.99"),; // SACPMOV->TIPO,; // TRANS(SACPMOV->PARCELA,"99"),; // SACPMOV->DT_PGTO,; // TRANS(SACPMOV->VL_PG_REC,"@e 999,999.99"),; // SACPMOV->DESCRI,; // SACPMOV->DOC_PGTO,; // SACPMOV->ADQUI; // HEADERS OemToAnsi("Documento"),; OemToAnsi("Vencimento"),; OemToAnsi("Vl Docto R$"),; OemToAnsi("Tipo"),; OemToAnsi("Parc"),; OemToAnsi("Pgto/Rec"),; OemToAnsi("vl Pago/Rec"),; OemToAnsi("Pgto/Receb. referente a"),; OemToAnsi("Pgto efetuado em"),; OemToAnsi("Nome do credor/devedor"); FIELDSIZES 80,80,80,30,30,80,80,300,150,150; COLORS BrwText, BrwBack; ON RIGHT CLICK ShowPopup( oLbx, nRow, nCol,oDlg ) ; SIZE 100, 100 OF oDlg oLbx:SetFont(mBrwFnt) oLbx:nClrBackHead := RGB( 0, 0, 255 ) // Cor do Fundo do Cabe‡alho oLbx:nClrBackFocus := RGB( 040, 004, 090 ) // Cor do Cursor Em Cima do Ötem oLbx:nClrForeHead := RGB( 255, 255, 235 ) // Cor nos Headers - Cabe‡alhos oLbx:nClrPane := { || IIF( ( oLbx:cAlias)->( OrdKeyNo()) %2 == 1, RGB( 255, 255, 224 ),RGB( 255, 255, 224 ))} oLbx:nClrText:={|| IF(SACPMOV->TIPO == 'D',RGB(255,000,000),RGB(46,139,87)) } oLbx:SetFocus() nLin := 17.5*12 nCol := 55 @ nLin+3,(8+(nCol*1)-55) SAY oSay1 PROMPT OemToAnsi("Saldo anterior:") PIXEL SIZE 70,10 OF oDlg @ nLin+3,(8+(nCol*3)-55) SAY oSay2 PROMPT OemToAnsi("Entradas:") PIXEL SIZE 70,10 OF oDlg @ nLin+3,(8+(nCol*5)-55) SAY oSay3 PROMPT OemToAnsi("Saidas:") PIXEL SIZE 70,10 OF oDlg @ nLin+3,(8+(nCol*7)-55) SAY oSay4 PROMPT OemToAnsi("Saldo atual:") PIXEL SIZE 70,10 OF oDlg nLin += 12 @ nLin,(8+(nCol*1)-55) GET oGet1 VAR wsaldo PICTURE "@E 99,999,999.99" RIGHT PIXEL SIZE 45,10 OF oDlg UPDATE WHEN (1 = 2) COLORS RGB(139,0,139) FONT oSayFnt oGet1:lDisColors := .F. @ nLin,(8+(nCol*3)-55) GET oGet3 VAR nEnHoje PICTURE "@E 99,999,999.99" RIGHT PIXEL SIZE 45,10 OF oDlg UPDATE WHEN (1 = 2) COLORS RGB(46,139,87) FONT oSayFnt oGet3:lDisColors := .F. @ nLin,(8+(nCol*5)-55) GET oGet4 VAR -nSaHoje PICTURE "@E 99,999,999.99" RIGHT PIXEL SIZE 45,10 OF oDlg UPDATE WHEN (1 = 2) COLORS RGB(255,000,000) FONT oSayFnt oGet4:lDisColors := .F. @ nLin,(8+(nCol*7)-55) GET oGet5 VAR wtatu PICTURE "@E 99,999,999.99" RIGHT PIXEL SIZE 45,10 OF oDlg UPDATE WHEN (1 = 2) COLORS RGB(0,0,255) FONT oSayFnt oGet5:lDisColors := .F. nLin := 20*12 @ nLin, (8+(nCol*1)-55) BUTTON "&Novo" OF oDlg ACTION EditCai( oLbx, .t.,oDlg ) PIXEL SIZE 45, 12 @ nLin, (8+(nCol*3)-55) BUTTON "&Excluir" OF oDlg ACTION DelCai( oLbx, oDlg ) PIXEL SIZE 45, 12 @ nLin, (8+(nCol*5)-55) BUTTON "&Filtrar" OF oDlg ACTION SeekCai( oLbx ,oDlg ) PIXEL SIZE 34,12 @ nLin, (8+(nCol*6)-70) BUTTON "&Imprimir" ACTION MsgRun ("Aguarde um momento...","Aguarde...",{||ImprCai( oLbx ,oDlg )}) PIXEL SIZE 34, 12 OF oDlg @ nLin, (8+(nCol*7)-85) BUTTON "&Fechar Caixa" OF oDlg ACTION FechCai( oLbx ,oDlg ) PIXEL SIZE 34,12 @ nLin, (8+(nCol*7)-45) BUTTON "&Retornar" OF oDlg ACTION oDlg:End() PIXEL SIZE 34, 12 CursorArrow() ACTIVATE DIALOG oDlg ; ON INIT ( oLbx:Move(30, 4, oDlg:GetCliRect():nRight - oDlg:GetCliRect():nLeft - 8,; oDlg:GetCliRect():nBottom - oDlg:GetCliRect():nTop - 150, .t.),; oLbx:GoBottom(), IF(aRec[4] >= 800, oDlg:Center(),NIL) ) SACPMOV->( DBUNLOCK() ) SACPMOV->( DBCLEARFIL(NIL) ) SACPMOV->( DBSETORDER(1)) SACPMOV->( DBGOTOP(1)) RELEASE FONT mBrwFnt, oGetFnt, oSayFnt return nil //----------------------------------------------------------------------------// static function EditCai( oLbx, lAppend,oDlg ) LOCAL oDlg2, lSave, nOldRec IF lAppend IF ! UsrFree(CaiIncl) RETURN NIL ENDIF ELSE IF ! UsrFree(CaiAlte) RETURN NIL ENDIF ENDIF CursorWait() nOldRec := RecNo() DEFAULT lAppend := .f. DEFAULT lSave := .f. SACPMOV->(DBSETORDER(2)) IF lAppend wndoc=space(10) wval=0.00 wvl_pg_rec=0.00 wdt_pgto=date() wdt_venc=date() wdescri=space(25) wdoc_pgto=space(20) wnome=space(30) wtipo=space(1) wsaid=0 wentr=0 ELSE wndoc := SACPMOV->n_doc wval := SACPMOV->VALOR wvl_pg_rec := SACPMOV->VL_PG_REC wdt_pgto := SACPMOV->DT_PGTO wdt_venc := SACPMOV->DT_VENC wdescri := SACPMOV->DESCRI wdoc_pgto := SACPMOV->DOC_PGTO wtipo := IIF(SACPMOV->TIPO="C", OemToAnsi("CRDITO"), OemToAnsi("DBITO")) wnome := SACPMOV->ADQUI IF SUBSTR(wtipo,1,1) = "C" wentr := SACPMOV->vl_pg_rec wsaid := 0 ELSE wsaid := SACPMOV->vl_pg_rec wentr := 0 ENDIF ENDIF SACPMOV->(DBSETORDER(1)) DEFINE FONT oSayFnt NAME "Arial" SIZE 0, -12 BOLD ITALIC DEFINE FONT oGetFnt NAME "Arial" SIZE 0, -12 BOLD DEFINE FONT oFon1 NAME "Arial" SIZE 0, -17 BOLD DEFINE DIALOG oDlg RESOURCE "CAD_PAGREC" TITLE If( lAppend, "Cadastro dos Pagamentos e Recebimentos", "Alteração dos Pagamentos e Recebimentos" ) REDEFINE GET oL02 VAR wndoc ID 33 OF oDlg PICTURE "@!" VALID ChkNomPgr(wndoc,lAppend) REDEFINE COMBOBOX ocbx VAR wtipo ITEMS {OemToAnsi("CRDITO"),OemToAnsi("DBITO")} ID 34 OF oDlg REDEFINE GET oL04 VAR wdt_venc ID 35 OF oDlg PICTURE "@K,@D 99/99/9999" valid (wdt_venc#ctod(" / / ")) REDEFINE GET oL05 VAR wval ID 36 OF oDlg PICTURE "@E 999,999.99" VALID (IIF(left(wtipo,1)="C", wentr:=wval, wsaid:=wval), oL07:Refresh(), oL08:Refresh(),.t.) REDEFINE GET oL06 VAR wdt_pgto ID 37 OF oDlg PICTURE "@K,@D 99/99/9999" REDEFINE GET oL07 VAR wentr ID 38 OF oDlg PICTURE "@E 999,999.99" WHEN wsaid=0 .AND. SUBSTR(wtipo,1,1) = "C" UPDATE REDEFINE GET oL08 VAR wsaid ID 39 OF oDlg PICTURE "@E 999,999.99" COLORS RGB(255,000,000) WHEN wentr=0 .AND. SUBSTR(wtipo,1,1) = "D" UPDATE REDEFINE GET oL09 VAR wdoc_pgto ID 40 OF oDlg PICTURE "@!" REDEFINE GET oL10 VAR wdescri ID 41 OF oDlg PICTURE "@!" REDEFINE GET oL11 VAR wnome ID 42 OF oDlg PICTURE "@!" REDEFINE BUTTON oBt1 ID 30 OF oDlg ACTION ( lSave := .t. , oDlg:End()) WHEN ( !EMPTY(wndoc) .AND. !EMPTY(wtipo) .AND. !EMPTY(wval) .AND. !EMPTY(wdt_venc)) REDEFINE BUTTON oBt3 ID 31 OF oDlg ACTION ( lSave := .f. , oDlg:End()) ACTIVATE DIALOG oDlg CENTERED CursorArrow() if lSave SELECT 10 SACPMOV->(DBSETORDER(1)) WHIL ! SACPMOV->(RLOCK()) ; END if lAppend SACPMOV->(DBGOBOTTOM()) SACPMOV->(DBAPPEND()) endif SACPMOV->(DBSETORDER(0)) REPLACE SACPMOV->N_DOC WITH wndoc REPLACE SACPMOV->DT_VENC WITH wdt_venc REPLACE SACPMOV->VALOR WITH wval REPLACE SACPMOV->DT_PGTO WITH wdt_pgto if wentr=0 REPLACE SACPMOV->VL_PG_REC WITH wsaid else REPLACE SACPMOV->VL_PG_REC WITH wentr endif REPL SACPMOV->TIPO WITH SUBSTR(wtipo,1,1) REPLACE SACPMOV->ADQUI WITH wnome REPLACE SACPMOV->DOC_PGTO WITH wdoc_pgto REPLACE SACPMOV->DESCRI WITH wdescri SACPMOV->(DBSETORDER(1)) DbUnlock() CaixCalc() IF lAppend if wentr=0 LOGReg(nOper,cOper,"CADASTROU A DESPESA : "+wndoc+"-"+wnome, WSAID, "SACPMOV", 1) ELSE LOGReg(nOper,cOper,"CADASTROU A RECEITA : "+wndoc+"-"+wnome, WENTR, "SACPMOV", 1) ENDIF ELSE if wentr=0 LOGReg(nOper,cOper,"ALTEROU A DESPESA : "+wndoc+"-"+wnome, WSAID, "SACPMOV", 1) ELSE LOGReg(nOper,cOper,"ALTEROU A RECEITA : "+wndoc+"-"+wnome, WENTR, "SACPMOV", 1) ENDIF ENDIF oLbx:UpStable() oLbx:Refresh() oDlg:Update() ELSE GOTO nOldRec endif if lSave *--------impressão do recibo--------------------------------- cCabe := "" WMENS="VOCE ESTà MELHOR SOZINHO DO QUE ...... ACOMPANHADO" CursorWait() wcab2:="---------- ---------- ------------------------------- ---------- ----------" wcab2:=space(80) SELECT 14 SAEMP->(DBGOTOP()) PRINTER oPrn NAME "Recibos em geral" PREVIEW DEFINE FONT oFont NAME "Courier New" SIZE 0,-10 OF oPrn DEFINE FONT oFon0 NAME "Courier New" SIZE 0, -9 OF oPrn DEFINE FONT oFon1 NAME "Courier New" SIZE 0, -9 BOLD OF oPrn DEFINE FONT oFon2 NAME "Arial" SIZE 0, -10 OF oPrn DEFINE FONT oFon3 NAME "Arial" SIZE 0, -10 BOLD OF oPrn DEFINE FONT oFon4 NAME "Arial" SIZE 0, -12 BOLD OF oPrn DEFINE FONT oFon5 NAME "Arial" SIZE 0, -18 OF oPrn DEFINE FONT oFon6 NAME "Arial" SIZE 0, -20 ITALIC DEFINE FONT oFon7 NAME "Arial" SIZE 0, -25 BOLD DEFINE FONT oFon8 NAME "Arial Narrow" SIZE 0, -7 OF oPrn DEFINE FONT oFon9 NAME "Arial Narrow" SIZE 0, -8 OF oPrn DEFINE FONT oFon10 NAME "Arial Narrow" SIZE 0, -8 OF oPrn ITALIC BOLD mLin := 3 mLarg := oFont:nHeight mPos :=((oPrn:nHorzRes()/2) - ((oFont:nWidth * 80)/2)) / 2 oPrn:StartPage() oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"CDDD - "+LTRIM(SAEMP->razao)+" - CDDD", oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"CNPJ: "+ALLTRIM(SAEMP->cgc)+" - "+"Inscricao Municipal - "+SAEMP->insc_mun, oFont) mLin++ wtels="("+SAEMP->ddd+") "+substr(SAEMP->tel1,1,4)+"-"+substr(SAEMP->tel1,5,4) if !empty(tel2) wtels=wtels+" /"+substr(SAEMP->tel2,1,4)+"-"+substr(SAEMP->tel2,5,4) endif oPrn:Say(mLin*mLarg,mPos,Space(01)+RTRIM(SAEMP->rua_num)+" - Tel. "+wtels+" "+RTRIM(SAEMP->bairro)+" - "+RTRIM(SAEMP->cidade)+" - "+SAEMP->uf, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin+=6 oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"Recibo numero....: "+wndoc+" - "+wnome, oFont) mLin+=2 oPrn:Say(mLin*mLarg,mPos,Space(01)+"Descrição........: "+wdescri, oFont) mLin++ if !empty(wdt_pgto) oPrn:Say(mLin*mLarg,mPos,Space(01)+"Data da emissão..: "+dtoc(wdt_pgto), oFont) else oPrn:Say(mLin*mLarg,mPos,Space(01)+"Data da emissão..: "+dtoc(date()), oFont) endif mLin++ if SUBSTR(wtipo,1,1)="C" oPrn:Say(mLin*mLarg,mPos,Space(01)+"Valor............: R$"+TRANS(wentr,"@E 999,999.99"), oFont) else oPrn:Say(mLin*mLarg,mPos,Space(01)+"Valor............: R$"+TRANS(wsaid,"@E 999,999.99"), oFont) endif mLin++ wcc=space(30) if empty(wdt_pgto) wcc=" com vencimento em "+dtoc(wdt_venc) endif oPrn:Say(mLin*mLarg,mPos,Space(01)+"Docto. de pagto..: "+rtrim(wdoc_pgto)+wcc, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+wmens, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(76)+"via do cliente", oFon0) mLin+=3 oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("-", LEN(wcab2) ), oFont) mLin+=3 oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"CDDD - "+LTRIM(SAEMP->razao)+" - CDDD", oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"CNPJ: "+ALLTRIM(SAEMP->cgc)+" - "+"Inscricao Municipal - "+SAEMP->insc_mun, oFont) mLin++ wtels="("+SAEMP->ddd+") "+substr(SAEMP->tel1,1,4)+"-"+substr(SAEMP->tel1,5,4) if !empty(tel2) wtels=wtels+" /"+substr(SAEMP->tel2,1,4)+"-"+substr(SAEMP->tel2,5,4) endif oPrn:Say(mLin*mLarg,mPos,Space(01)+RTRIM(SAEMP->rua_num)+" - Tel. "+wtels+" "+RTRIM(SAEMP->bairro)+" - "+RTRIM(SAEMP->cidade)+" - "+SAEMP->uf, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin+=6 oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"Recibo numero....: "+wndoc+" - "+wnome, oFont) mLin+=2 oPrn:Say(mLin*mLarg,mPos,Space(01)+"Descrição........: "+wdescri, oFont) mLin++ if !empty(wdt_pgto) oPrn:Say(mLin*mLarg,mPos,Space(01)+"Data da emissão..: "+dtoc(wdt_pgto), oFont) else oPrn:Say(mLin*mLarg,mPos,Space(01)+"Data da emissão..: "+dtoc(date()), oFont) endif mLin++ if SUBSTR(wtipo,1,1)="C" oPrn:Say(mLin*mLarg,mPos,Space(01)+"Valor............: R$"+TRANS(wentr,"@E 999,999.99"), oFont) else oPrn:Say(mLin*mLarg,mPos,Space(01)+"Valor............: R$"+TRANS(wsaid,"@E 999,999.99"), oFont) endif mLin++ wcc=space(30) if empty(wdt_pgto) wcc=" com vencimento em "+dtoc(wdt_venc) endif oPrn:Say(mLin*mLarg,mPos,Space(01)+"Docto. de pagto..: "+rtrim(wdoc_pgto)+wcc, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+wmens, oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("=", LEN(wcab2) ), oFont) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(78)+" via do cddd", oFon0) mLin+=3 oPrn:Say(mLin*mLarg,mPos,Space(01)+REPL("-", LEN(wcab2) ), oFont) mLin+=3 oPrn:Preview() oPrn:EndPage() CursorArrow() SELECT 10 SACPMOV->(DBSETORDER(1)) endif SELECT 10 SACPMOV->(DBSETORDER(1)) IF oLbx <> NIL oLbx:UpStable() oLbx:Refresh() ENDIF RETURN(lSave) //---------------------------------------------------------------------------// static function DelCai( oLbx, oDlg ) IF ! UsrFree(CaiExcl) ; RETURN NIL ; ENDIF MsgAlert("A T E N Ç Ã O !!! Para efetuar retirada de movimento, faça o seguinte: 1- Faça um crédito ou débito. 2- Faça o lançamento novamente com os valores corretos. ALERTO QUE ESSE PROCEDIMENTO NAO É O NORMAL, DEVENDO O USUÃRIO PRESTAR + ATENÇÃO DURANTE O REFERIDO CADASTRO !!!","Atencao") oLbx:UpStable() // Corrects same page stabilizing Bug oLbx:Refresh() // Repaint the ListBox oDlg:Update() return nil //----------------------------------------------------------------------------// static function SeekCai( oLbx,oDlg ) local nRecNo := RecNo(), mck1, mck2 , mRet, oFilDl SELE 14 wsaldo=saldo wdt_saldo=dt_saldo wnome=nome SELECT 10 SACPMOV->(DBCLEARFIL(NIL)) SACPMOV->(DBSETORDER(2)) // indexado por dt_pgto wdat1 := CTOD(" ") wdat2 := CTOD(" ") STORE 1 TO word wScrd:="N" wSdeb:="N" wfil:="" mRet:=.t. mck3:=.f. mck4:=.f. wdat1 := wdt_saldo + 1 DEFINE DIALOG oFilDl RESOURCE "flt_caixa" REDEFINE GET oCt35 VAR wdat1 PICTURE "99/99/9999" ID 35 OF oFilDl REDEFINE GET oCt36 VAR wdat2 PICTURE "99/99/9999" ID 36 OF oFilDl REDEFINE CHECKBOX mck1 ID 37 OF oFilDl ON CHANGE (IIF(mck1 =.t.,( mck2:=.f., wScrd:="S", wSdeb:="N"), (wScrd:="N", wSdeb:="N")),; oFilDl:Update()) UpDate REDEFINE CHECKBOX mck2 ID 38 OF ofILdL ON CHANGE (IIF(mck2 =.t.,( mck1:=.f., wScrd:="N", wSdeb:="S"), (wScrd:="N", wSdeb:="N")),; oFilDl:Update()) UpDate REDEFINE BUTTON oBtn1 ID 30 OF oFilDl ACTION ( oFilDl:End()) REDEFINE BUTTON oBtn2 ID 31 OF oFilDl ACTION ( mRet:=.f., oFilDl:End()) ACTIVATE DIALOG oFilDl CENTERED IF ! mRet wdat1 := CTOD(" ") wdat2 := CTOD(" ") STORE 1 TO word wScrd:="N" wSdeb:="N" wfil:="" mck3:=.f. mck4:=.f. ENDIF if wdat1 < wdt_saldo MsgAlert("DATA INICIO NAO PODE SER MENOR QUE A DATA DO ULTIMO RELATORIO","Atencao") RETURN endif if wdat1 > wdat2 .or. empty(wdat2) SACPMOV->(OrdScope()) MsgAlert("DATA(S) INVALIDA(S) VERIFIQUE","Atencao") RETURN endif STORE 0 TO wtant, wtent, wtsai, wtatu, wsubc, wcdes wEnt := 0 wSai := 0 wtent := 0 wtsai := 0 nEnHoje:=0 nSaHoje:=0 SACPMOV->(OrdScope(0,dtos(wdat1))) SACPMOV->(OrdScope(1,DTOS(WDAT2))) SACPMOV->(DBGOTOP()) MsgRun( "Calculando saldo...", "Aguarde...",; {||SACPMOV->(DBEVAL({||(IIF( EMPTY(DTOS(wdat2)), nEnHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="C",VL_PG_REC,0),nEnHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="C",VL_PG_REC,0)) ,; IIF( EMPTY(DTOS(wdat2)), nSaHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="D",VL_PG_REC,0),nSaHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="D",VL_PG_REC,0)) ,; wtent := wtent + VL_PG_REC,; wtsai := wtsai + VL_PG_REC )},; NIL, NIL, NIL, NIL, .F.) )}) SACPMOV->(DBGOTOP()) oLbx:UpStable() // Corrects same page stabilizing Bug oLbx:Refresh() // Repaint the ListBox oDlg:Refresh() oDlg:Update() return ( mRet, oLbx, oDlg ) ///////////////// //----------------------------------------------------------------------------// FUNCTION ChkNomPgr(wndoc,lAppend) LOCAL lOk := .T. SACPMOV->(DBSETORDER(1)) IF ! lAppend IF LEFT(wdescri,4)="MENS" lOk := MsgNoYes(OemToAnsi("Este documento nÆo pode ser alterado por se tratar de mensalidade de Aluno. Gostaria de prosseguir ?"),OemToAnsi("Aten‡Æo!")) IF lOk IF ! ChkMangr() ; RETURN NIL ; ENDIF ELSE SET ORDER TO 1 RETURN .F. ENDIF ENDIF RETURN .T. ENDIF SACPMOV->(DBSETORDER(1)) SEEK wndoc IF FOUND() .and. lAppend MsgStop(OemToAnsi("Este documento j est cadastrado. Verifique antes de Prosseguir!"),OemToAnsi("Aten‡Æo!")) SET ORDER TO 1 RETURN .F. ENDIF SACPMOV->(DBSETORDER(1)) RETURN (!EMPTY(wndoc)) *+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+*+-+*+ FUNCTION CaixCalc() LOCAL mOrd, mRn, dData := CTOD("01/"+STRZERO(MONTH(DATE()),2)+"/"+STRZERO(YEAR(DATE()),4)) mRn := RECNO() SACPMOV->(DBGOTOP()) STORE 0 TO wtant, wtent, wtsai, nEnHoje, nSaHoje, wtatu MsgRun( "Calculando entradas...", "Aguarde...",; {||SACPMOV->(DBEVAL({||(IIF( EMPTY(DTOS(wdat2)), nEnHoje += IF((DT_PGTO=DATE() .and. TIPO="C"),VL_PG_REC,0),nEnHoje += IF((DT_PGTO=wdat2 .and. TIPO="C"),VL_PG_REC,0)) ,; IIF( EMPTY(DTOS(wdat2)), nSaHoje += IF((DT_PGTO=DATE() .and. TIPO="D"),VL_PG_REC,0),nSaHoje += IF((DT_PGTO=wdat2 .and. TIPO="D"),VL_PG_REC,0)) ,; wtent := wtent + VL_PG_REC,; wtsai := wtsai + VL_PG_REC )},; NIL, NIL, NIL, NIL, .F.) )}) wtant:=wsaldo wtatu:= (wtant + wtent) - wtsai SACPMOV->(DBCLEARFIL(NIL)) ordListClear() OrdListAdd("SACPMOV", "NDOC", "DTPNDOC", "DTVNDOC") SACPMOV->(DBGOTO(mRn)) SysRefresh() RETURN .T. //----------------------------------------------------------------------------// static function aCheca(wmatr,wcontr) vsit := space(10) SELECT 7 SANOTA->(DBSETORDER(4)) SANOTA->(DBGOTOP()) seek str(wmatr,6)+str(wcontr,3) IF FOUND() MsgStop(OemToAnsi("Matricula e controle encontrados. m= "+str(matric,6)+" ctr= "+str(controle,3)),OemToAnsi("Aten‡Æo!")) vsit := "ENCONTRADO" else MsgStop(OemToAnsi("Inexistentes."),OemToAnsi("Aten‡Æo!")) vsit := "INEXISTE" ENDIF RETURN (wmatr,wcontr,vsit) // ------------------------------------------------------------------------ FUNCTION ImprCai( oLbx,oDlg ) LOCAL oPrn, wper, wpag, wttenpg, wttaspg, mLin, wttenpr, wttsapr, wcab1,; wcab2, mRcNo, Cx, mDias, wflag:=1, mck4:=.f., mDlg2, nRecNo := RecNo(), mck1, mck2 , mRet SELE 14 wsaldo=saldo wdt_saldo=dt_saldo wnome=nome SELECT 10 SACPMOV->(DBCLEARFIL(NIL)) SACPMOV->(DBSETORDER(2)) // indexado por dt_pgto STORE CTOD(" ") TO wdat1, wdat2 STORE 1 TO word wScrd:="N" wSdeb:="N" wfil:="" mRet:=.t. mck3:=.f. mck4:=.f. wdat1 := wdt_saldo + 1 wdat2 := date() DEFINE DIALOG oFilDl RESOURCE "flt_caixa" REDEFINE GET oCt35 VAR wdat1 PICTURE "99/99/9999" ID 35 OF oFilDl REDEFINE GET oCt36 VAR wdat2 PICTURE "99/99/9999" ID 36 OF oFilDl REDEFINE CHECKBOX mck1 ID 37 OF oFilDl ON CHANGE (IIF(mck1 =.t.,( mck2:=.f., wScrd:="S", wSdeb:="N"), (wScrd:="N", wSdeb:="N")),; oFilDl:Update()) UpDate REDEFINE CHECKBOX mck2 ID 38 OF ofILdL ON CHANGE (IIF(mck2 =.t.,( mck1:=.f., wScrd:="N", wSdeb:="S"), (wScrd:="N", wSdeb:="N")),; oFilDl:Update()) UpDate REDEFINE BUTTON oBtn1 ID 30 OF oFilDl ACTION ( oFilDl:End()) REDEFINE BUTTON oBtn2 ID 31 OF oFilDl ACTION ( mRet:=.f., oFilDl:End()) ACTIVATE DIALOG oFilDl CENTERED IF ! mRet STORE CTOD(" ") TO wdat1, wdat2 STORE 1 TO word wScrd:="N" wSdeb:="N" wfil:="" mck3:=.f. mck4:=.f. ENDIF if wdat1 < wdt_saldo MsgAlert("DATA INICIO NAO PODE SER MENOR QUE A DATA DO ULTIMO RELATORIO","Atencao") RETURN endif if wdat1 > wdat2 .or. empty(wdat2) SACPMOV->(OrdScope()) MsgAlert("DATA(S) INVALIDA(S) VERIFIQUE","Atencao") RETURN endif STORE 0 TO wtant, wtent, wtsai, wtatu, wsubc, wcdes wEnt := 0 wSai := 0 wtent := 0 wtsai := 0 nEnHoje:=0 nSaHoje:=0 SACPMOV->(OrdScope(0,dtos(wdat1))) SACPMOV->(OrdScope(1,DTOS(WDAT2))) SACPMOV->(DBGOTOP()) MsgRun( "Calculando saldo...", "Aguarde...",; {||SACPMOV->(DBEVAL({||(IIF( EMPTY(DTOS(wdat2)), nEnHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="C",VL_PG_REC,0),nEnHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="C",VL_PG_REC,0)) ,; IIF( EMPTY(DTOS(wdat2)), nSaHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="D",VL_PG_REC,0),nSaHoje += IF( DT_PGTO>=wdat1 .AND. DT_PGTO<=wdat2 .AND. TIPO="D",VL_PG_REC,0)) ,; wtent := wtent + VL_PG_REC,; wtsai := wtsai + VL_PG_REC )},; NIL, NIL, NIL, NIL, .F.) )}) wtatu:=(wsaldo+nEnHoje-nSaHoje) CursorWait() mRcNo := RecNo() GO TOP WTOTPGC=0 WTOTPGD=0 WS_ENTRA=0.00 WS_SAIDA=0.00 WSUB_TOT=0.00 wpag:=1 Cx := 1 wpg:="PAG. "+ALLTRIM(STR(wpag)) wttenpg:=wttaspg:=wttenpr:=wttsapr:=0 wper:=dtos(wdat1)+dtos(wdat2) wcab1:="PAGTO DOCUMENTO HISTORICO CREDITO DEBITO" wcab2:="__________ __________ _______________________________ __________ __________" PRINTER oPrn NAME "Movimento do Caixa" PREVIEW DEFINE FONT oFont NAME "Courier New" SIZE 0,-10 OF oPrn DEFINE FONT oFon0 NAME "Courier New" SIZE 0, -9 OF oPrn DEFINE FONT oFon1 NAME "Courier New" SIZE 0, -9 BOLD OF oPrn DEFINE FONT oFon2 NAME "Arial" SIZE 0, -10 OF oPrn DEFINE FONT oFon3 NAME "Arial" SIZE 0, -10 BOLD OF oPrn DEFINE FONT oFon4 NAME "Arial" SIZE 0, -12 BOLD OF oPrn DEFINE FONT oFon5 NAME "Arial" SIZE 0, -18 OF oPrn DEFINE FONT oFon6 NAME "Arial" SIZE 0, -20 ITALIC DEFINE FONT oFon7 NAME "Arial" SIZE 0, -25 BOLD DEFINE FONT oFon8 NAME "Arial Narrow" SIZE 0, -7 OF oPrn DEFINE FONT oFon9 NAME "Arial Narrow" SIZE 0, -8 OF oPrn DEFINE FONT oFon10 NAME "Arial Narrow" SIZE 0, -8 OF oPrn ITALIC BOLD DEFINE FONT oFon11 NAME "Courier New" SIZE 0, -10 BOLD OF oPrn DEFINE PEN oPen COLOR CLR_BLACK WIDTH (oFont:nHeight/10) mLin := 2 mLarg := oFont:nHeight mPos :=((oPrn:nHorzRes()/2) - ((oFont:nWidth * 80)/2)) / 2 nTab := oPrn:nHorzRes()/15 nSpc := (oPrn:nHorzRes()-(2*nTab)) / 120 oPrn:StartPage() oPrn:Box(mLin*mLarg, nTab, oPrn:nVertRes()-(04*mLarg), oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+RTRIM(WNOME)+" - "+"LIVRO CAIXA", oFon11) oPrn:Say(mLin*mLarg,mPos,Space(78-len(wpg))+wpg, oFont) mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) IF wScrd = "N" .AND. wSdeb = "N" oPrn:Say(mLin*mLarg,mPos,Space(01)+"RELATORIO DE MOVIMENTO DE CAIXA "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ELSEIF wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(01)+"MAPA DE DETALHAMENTO DE CREDITOS "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ELSEIF wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(01)+"MAPA DE DETALHAMENTO DE DEBITOS "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ENDI IF ! mck4 // Sem fechamento di rio mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+wcab1, oFont) oPrn:Say(mLin*mLarg,mPos,Space(01)+wcab2, oFont) mLin++ if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mlin*mLarg,mPos,Space(01)+dtoc(wdt_saldo), oFont) oPrn:Say(mLin*mLarg,mPos,Space(23)+"SALDO ANTERIOR", oFont) IF wsaldo < 0 oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wsaldo,"@E 999,999.99"), oFont) ELSE oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(wsaldo,"@E 999,999.99"), oFont) ENDIF WSUB_TOT=WSUB_TOT+WSALDO mLin++ endif DO WHIL ! EOF() SYSREFRESH() wdtfim = dt_pgto if wSdeb != "S" .AND. TIPO="C" oPrn:Say(mlin*mLarg,mPos,Space(01)+dtoc(dt_pgto), oFont) oPrn:Say(mlin*mLarg,mPos,Space(12)+n_doc, oFont) oPrn:Say(mlin*mLarg,mPos,Space(23)+left(DESCRI,28)+right(DESCRI,6), oFont) oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(VL_PG_REC,"@E 999,999.99"), oFont) WSUB_TOT=WSUB_TOT-VL_PG_REC WS_ENTRA=WS_ENTRA+VL_PG_REC WTOTPGC=WTOTPGC+VL_PG_REC mLin ++ endi if wScrd != "S" .AND. TIPO="D" oPrn:Say(mlin*mLarg,mPos,Space(01)+dtoc(dt_pgto), oFont) oPrn:Say(mlin*mLarg,mPos,Space(12)+n_doc, oFont) oPrn:Say(mlin*mLarg,mPos,Space(23)+left(DESCRI,28)+right(DESCRI,6), oFont) oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(VL_PG_REC,"@E 999,999.99"), oFont) WSUB_TOT=WSUB_TOT+VL_PG_REC WS_SAIDA=WS_SAIDA+VL_PG_REC WTOTPGD=WTOTPGD+VL_PG_REC mLin ++ endif IF (mLin*mLarg) >= ( oPrn:nVertRes()-(8*mLarg) ) oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+UPPER("TOTAL DESTA PAGINA"), oFont) if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(wTOTPGC,"@E 999,999.99"), oFont) oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wTOTPGD,"@E 999,999.99"), oFont) else if wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(wTOTPGC,"@E 999,999.99"), oFont) endif if wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wTOTPGD,"@E 999,999.99"), oFont) endif endif mLin ++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) mLin ++ oPrn:Say(mLin*mLarg,mPos,Space(01)+UPPER("SALDO PARCIAL"), oFont) if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(WSALDO+WS_ENTRA-WS_SAIDA,"@E 999,999.99"), oFont) else if wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(WS_ENTRA,"@E 999,999.99"), oFont) endif if wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(WS_SAIDA,"@E 999,999.99"), oFont) endif endif mLin ++ oPrn:EndPage() oPrn:StartPage() wpag++ mLin := 2 wTOTPGC:=wTOTPGD:=0 oPrn:Box(mLin*mLarg, nTab, oPrn:nVertRes()-(04*mLarg), oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+RTRIM(WNOME)+" - "+"LIVRO CAIXA", oFon11) wpg:="PAG. "+ALLTRIM(STR(wpag)) oPrn:Say(mLin*mLarg,mPos,Space(78-len(wpg))+wpg, oFont) mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) IF wScrd = "N" .AND. wSdeb = "N" oPrn:Say(mLin*mLarg,mPos,Space(01)+"RELATORIO DE MOVIMENTO DE CAIXA "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ELSEIF wScrd = "S" mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"MAPA DE DETALHAMENTO DE CREDITOS "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ELSEIF wSdeb = "S" mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+"MAPA DE DETALHAMENTO DE DEBITOS "+IIF(Cx = 2,"-ORCAMENTO","") +; IIF(! empty(wper)," - PERIODO: "+DTOC(wdat1)+" A "+DTOC(wdat2),"- COMPLETO"), oFont) ENDI mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+"SALDO TRANSPORTADO DA PAGINA ANTERIOR", oFont) if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(WSALDO+WS_ENTRA-WS_SAIDA,"@E 999,999.99"), oFont) else if wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(WS_ENTRA,"@E 999,999.99"), oFont) endif if wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(WS_SAIDA,"@E 999,999.99"), oFont) endif endif mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+wcab1, oFont) oPrn:Say(mLin*mLarg,mPos,Space(01)+wcab2, oFont) mLin ++ ENDI SKIP ENDD IF (mLin*mLarg) >= ( oPrn:nVertRes()-(6*mLarg) ) oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) mLin++ oPrn:Say(mLin*mLarg,mPos,Space(01)+UPPER("Continua na pagina seguinte."), oFont) mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) oPrn:EndPage() oPrn:StartPage() mLin:=3 ENDI IF wpag>1 oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+UPPER("TOTAL DESTA PAGINA"), oFont) if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(wTOTPGC,"@E 999,999.99"), oFont) oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wTOTPGD,"@E 999,999.99"), oFont) else if wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(wTOTPGC,"@E 999,999.99"), oFont) endif if wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wTOTPGD,"@E 999,999.99"), oFont) endif endif ENDIF mLin ++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) oPrn:Say(mLin*mLarg,mPos,Space(01)+"T O T A I S ...............................R$", oFont) if wScrd != "S" .AND. wSdeb != "S" IF !EMPTY(WS_SAIDA) oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(ws_entra, "@E 999,999.99"), oFont) ENDIF IF !EMPTY(WS_ENTRA) oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(ws_saida, "@E 999,999.99"), oFont) ENDIF else if wScrd = "S" oPrn:Say(mLin*mLarg,mPos,Space(56)+TRANS(ws_entra, "@E 999,999.99"), oFont) endif if wSdeb = "S" oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(ws_saida, "@E 999,999.99"), oFont) endif endif mLin++ oPrn:Line(mLin*mLarg,nTab, mLin*mLarg,oPrn:nHorzRes()-nTab, oPen ) mLin++ if wScrd != "S" .AND. wSdeb != "S" oPrn:Say(mLin*mLarg,mPos,Space(01)+"S A L D O A T U A L E M "+DTOC(WDAT2)+" ...R$", oFont) wtg=(wsaldo + (ws_entra-ws_saida)) oPrn:Say(mLin*mLarg,mPos,Space(68)+TRANS(wtg, "@E 999,999.99"), oFont) endif ENDIF IF (mLin*mLarg) >= ( oPrn:nVertRes()-(5*mLarg) ) oPrn:EndPage() oPrn:StartPage() mLin:=3 endif mLin +=4 oPrn:Say(mLin*mLarg,mPos,Space(01)+"________________________ ________________________ ________________________", oFont) mLin ++ oPrn:Say(mLin*mLarg,mPos,Space(01)+" RESPONSAVEL GER. FINANCEIRO DIRETOR", oFont) oPrn:Preview() oPrn:EndPage() CursorArrow() SACPMOV->(DBGOTOP()) SELECT 10 oLbx:UpStable() // Corrects same page stabilizing Bug oLbx:Refresh() // Repaint the ListBox oDlg:Refresh() oDlg:Update() RETURN oPrn //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 22, 2013 Report Share Posted May 22, 2013 Olá, mostre: FUNCTION UsrFree() Outra, ao sair de uma função, feche todas as FONTES, ex: oFont:End(), oFnt:End(), etc. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 22, 2013 Report Share Posted May 22, 2013 SELECT 10 USE SACPMOV SHARED IF ! FILE("SACPMOV.CDX") MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "SACPMOV->N_DOC", "NDOC" ) },; "Classificando movimento por documento...", "Espere um momento!" ) MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "DTOS(DT_PGTO)+TIPO+N_DOC", "DTPNDOC" ) },; "Classificando movimento por data de pagamento + tipo + documento...", "Espere um momento!" ) MsgMeter( { | oMeter, oText, oDlg, lEnd | ; BuildIndex( oMeter, oText, oDlg, @lEnd, "DTOS(DT_VENC)+TIPO+N_DOC", "DTVNDOC" ) },; "Classificando movimento por data de vencimento + tipo + documento...", "Espere um momento!" ) ENDIF Isto aqui voce cria aonde?? Em minha opinião, você deve criar uma função de INDEXAÇÃO, e antes de INDEXAR, obrigatóriamente, você tem que matar os .CDX antes, para que eles não superlotem. Verifique o tamanho dos arquivos .CDX e veja se eles não estão gigantescos, na prática, eles devem estar pequenos. abs, Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 22, 2013 Report Share Posted May 22, 2013 Veja como eu faco antes de indexar os aquivos... #Include "Directry.ch" #Include "Ord.Ch" FUNCTION INDEXAR() LOCAL DEL_INDICE //-> Ideia original By Kleyber Derick DEL_INDICE := DIRECTORY( "*.CDX" ) // APAGA TODOS OS .CDX PARA NAO LOTAR. FOR I = 1 TO LEN( Del_Indice ) FERASE( DEL_INDICE[I][1] ) NEXT I INDEX ON... RETURN NIL Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 22, 2013 Report Share Posted May 22, 2013 Colega o ideal é a mudança do banco de dados, mais isto vc não ira fazer da noite pro dia, a solução de momento seria como o Gilmer postou acima, usar o ADS, só consegui sobreviver aqui com DBf graças ao ADS, base de dados com mais de 1 milhao de registro , aonde relatorios chegava ate 10 minutos, passou para menos de 10 segundos, a diferença é muito grande... Obs: faz uma busca aqui no forum que vc ira encontrar tudo que precisa para usar o ADS Abraços Luiz Fernando Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted May 22, 2013 Report Share Posted May 22, 2013 So para reforçar o que o kapiaba ja colocou acima, andes de criar seus CDX, vc precisar apagar o ja existente, senão a cada reindexada o cdx ira aumentar de tamanho, causando lentidao, o exenmplo do Marcio tb é muito valido... Abraços Luiz Fernando Quote Link to comment Share on other sites More sharing options...
nardeypm Posted May 22, 2013 Author Report Share Posted May 22, 2013 //----------------------------------------------------------------------------// FUNCTION UsrFree(lSection) LOCAL lResp lResp := .T. IF ! lSection lResp := .F. IF MsgNoYes("Acesso restrito. Gostaria de entrar com autorização do administrador?","Acesso restrito!") lResp := ChkMangr() ENDIF ENDIF RETURN lResp //----------------------------------------------------------------------------// esclarecendo que o meu sistema funciona da seguinte forma: -micro servidor com o sistema completo (executavel + base de dados dbf + indices cdx -terminal1 com executavel local direcionando para buscar a base de dados + utilização de indices do servidor -terminal2 tb com executavel local direcionado para acessar base de dados e indices do servidor. obs.; o sistema verifica a existencia dos arquivos de indices no servidor ao entrar,. se existirem os indices, ele os utiliza. se ele não encontra, aà ele cria novos. ele não reindexa toda vez que entra. só reindexa se o usuário administrador solicitar (avisa que todos os terminais devem sair do sistema. se tentar reindexar pelo terminal, ele avisa que a operação só pode ser feita no servidor.) ou quando os indices não exsitirem. pergunta: se utilizar a função para deletar os cdx e algum terminal ou os dois estiverem com o executavel aberto não irá corromper ou danificar os indices ??? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 22, 2013 Report Share Posted May 22, 2013 se utilizar a função para deletar os cdx e algum terminal ou os dois estiverem com o executavel aberto não irá corromper ou danificar os indices ??? Não irá CORROMPER, mas também não INDEXARÃ(E destruir), pois o INDICE e o .DBF estarão ABERTOS e o processador irá protege-lo. Você deve CRIAR um CHECADOR antes, para verificar se o banco não está em USO no memento de INDEXAR, Por exemplo: LOCAL cMsg := "ATENÇÃO USUÃRIO: -> CHAME O SUPERVISOR IMEDIATAMENTE!!!" ; + CRLF +; + CRLF +; "ERRO! ERRO! ERRO! ERRO! ERRO! ERRO! ERRO! ERRO! ERRO! " ; + CRLF +; + CRLF +; "ERRO FATAL DE REDE! TOME TODO O CUIDADO POSSIVEL! " ; + CRLF +; "IMPOSSIVEL CONTINUAR UTILIZANDO OS BANCOS DE DADOS! " ; + CRLF +; "VOCÊ PRECISA TIRAR TODOS OS USUÃRIOS DA REDE, AGORA! " ; + CRLF +; "TENTE REINDEXAR OS BANCOS SOMENTE PELO SERVIDOR! " ; + CRLF +; "CASO NÃO CONSIGA REINDEXAR OS BANCOS, SAIA DO PROGRAMA " ; + CRLF +; "DESLIGUE OU REINICIE O SERVIDOR, E DEPOIS, VOCÊ PODERà " ; + CRLF +; "REINDEXAR OS BANCOS DE DADOS. ATENÇÃO MÃXIMA!!! " ; + CRLF +; "VOU DESLIGAR ESTE PROGRAMA, AVISE A TODOS OS OUTROS " ; + CRLF +; "USUÃRIOS, PARA SAIREM IMEDIATAMENTE DA REDE. PERIGO!!! " ; + CRLF +; " " // DEPOIS DE DESTRUIR OS INDICES, ANTES DE INDEXAR, CHEQUE SE NAO TEM // BANCO ABERTO, NO SERVIDOR OU VIA REMOTO. // PARA VERIFICAR SE A REDE TRAVOU OS BANCOS DE DADOS... ABORTAR. // CASO O FERASE NAO CONSIGA DELETAR, E PORQUE A REDE ESTA TRAVADA! // OU OS BANCOS ESTAO ABERTOS... IF FILE( "CADETIQ.cdx" ) .OR. ; FILE( "CADFORNE.cdx" ) .OR. ; FILE( "ANIMAIS.cdx" ) .OR. ; FILE( "VEICULOS.cdx" ) .OR. ; FILE( "VENDEDOR.cdx" ) .OR. ; FILE( XARQPED+".cdx" ) // E QUANTOS + .CDX QUISERES CHECAR. MsgStop( cMsg, "Problemas Na Rede ou no Computador, Cuidado!" ) DBCLOSEALL() RELEASE ALL SYSREFRESH() __QUIT() ENDIF Quote Link to comment Share on other sites More sharing options...
nardeypm Posted May 22, 2013 Author Report Share Posted May 22, 2013 entendi o q vc quis mostrar. mas tenho uma dúvida. raciocine comigo. exemplo: executo o sistema no servidor com a função acima ativada. o sistema entra apaga e recria os indices. ok. lá no terminal, quando eu acionar o executavel, ele irá verificar se existem indices abertos. o que é verdade, ou seja, ele irá destruir os indices no servidor e tentar recriá-los novamente. e o meu servidor que estava com o sistema aberto, como fica???? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 22, 2013 Report Share Posted May 22, 2013 Faça um teste, crie um indexador e abra o programa em um terminal, entre no servidor e tente dar um FERASE() no .CDX, verás que somente apagará, os .CDX que não estão abertos. E outra coisa, não vejo nenhum motivo para você ter um executável em cada máquina, pode usar o programa em rede, via icone chamando direto do servidor a velocidade é a mesma(desde q seja uma máquina de última geração), não esquecendo de tirar todos da REDE, antes de reindexar o bancos de dados. Quote Link to comment Share on other sites More sharing options...
Yury Posted May 22, 2013 Report Share Posted May 22, 2013 Olá provavelmente vc vai revisar seu código e descobrir que não há nada errado... claro que podem haver otimizações a serem feitas, ordscope no lugar de setfilter é uma delas mas o problema real é o DBF (sem ADS) em rede, o desempenho fica comprometido... quando vc roda os programas em somente um terminal vai rápido que é uma beleza, mas a partir do momento que mais terminais acessam os mesmos arquivos o desempenho cai infelizmente as soluções são as que já foram apresentadas no post: - manter em DBF e utilizar ADS, obtenha mais informações sobre como fazer isso, pois não domino o assunto - alterar a base de dados para MySql e utilizar um conector de terceiros, SQLLIB ou SQLRDD, para fazer a manipulação das tabelas ; vou falar sobre a SQLLIB, que é qual eu utilizo: vc pode manter o código do seus programas 99,99 % igual e migrar para MySQL , oq vai fazer a performance melhorar bastante ; são necessárias algumas mudanças relacionadas à rotina de conexão ao banco e alguns Ãndices que terá que mudar (não pode usar DESCEND na chave, por exemplo), mas são questões plenamente contornáveis ; o grande problema da SQLLIB é que a mesma foi descontinuada (infelizmente) então não sei como está atualmente para obtê-la, licença, coisa e tal estou falando desta mudança pra vc pois eu estava enfrentando este mesmo problema em alguns clientes, reclamação de lentidão, em um momento fica rápido, depois cai a performance conforme mais operadores vão utilizando, etc... verifiquei todas as possibilidades de otimizar em DBF, melhorar o desempenho, tudo que tentei foi paliativo, com ganhos mÃnimos de performance sem falar que o cliente chamava os técnicos de rede para ver se havia algum problema de hardware e os mesmos constatavam que tudo estava ok e quando os mesmos viam que o sistema rodava em DBF diziam na cara dura que o problema era esse, que é tecnologia ultrapassada, bom, vc sabem bem como é essa história... então basicamente oq eu fiz para resolver este problema de lentidão foi compilar o sistema (mesmo código) com o rdd da SQLLIB e a performance melhorou bastante, além de todas as vantagens de trabalhar com o BD abraço Yury Quote Link to comment Share on other sites More sharing options...
kleyber Posted May 22, 2013 Report Share Posted May 22, 2013 entendi o q vc quis mostrar. mas tenho uma dúvida. raciocine comigo. exemplo: executo o sistema no servidor com a função acima ativada. o sistema entra apaga e recria os indices. ok. lá no terminal, quando eu acionar o executavel, ele irá verificar se existem indices abertos. o que é verdade, ou seja, ele irá destruir os indices no servidor e tentar recriá-los novamente. e o meu servidor que estava com o sistema aberto, como fica???? Crie um campo tipo INDEXA do tipo logical onde quando iniciar a rotina de indexação, ele fica .T. Quando acessarem via terminal basta verificar esse campo, se estiver .T. mostra uma mensagem. Quando terminar a indexação, muda ele pra .F. Quote Link to comment Share on other sites More sharing options...
vagner Posted May 23, 2013 Report Share Posted May 23, 2013 Olá, Faça um teste e retire o #xcommand @ <nRow>,<nCol> SAY <cText> OF <oPrinter> => <oPrinter>:Say(<nRow>, <nCol>, <cText> ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.