Jump to content
Fivewin Brasil

Wellington Vieira

Membros
  • Posts

    424
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wellington Vieira

  1. Luiz, Entre em contacto com as homologadores do TEF,, e também com a RECEITA ESTADUAL a qual pertence a empresa que tem o sistema e tire suas dúvidas direto na FONTE,, é o mais indicado.. isso depende de ESTADO para ESTADO.. Homologadoras do TEF... Software Express Av. Paulista 2202,Sobreloja H São Paulo - SP CEP: 01310-300 E-mail: tef.discado@softwareexpress.com.br Fone: (0xx11) 3170-5333 SevenPDV Automação Av Paulista 475, 9° Andar São Paulo - SP CEP: 01311-908 E-mail: constec@sevenpdv.com.br Fone: (0xx11) 3549-6700 / Ramal 5 wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  2. Me desculpem,, pela repetição das outras postagem,,, não sei o que aconteceu..., meu equipamento travou e deu nisso.. Tive que repetir a mensagem... mas já havia postado.. Me desculpem... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  3. Me desculpem,, pela repetição das outras postagem,,, não sei o que aconteceu..., meu equipamento travou e deu nisso.. Tive que repetir a mensagem... mas já havia postado.. Me desculpem... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  4. Me desculpem,, pela repetição das outras postagem,,, não sei o que aconteceu..., meu equipamento travou e deu nisso.. Tive que repetir a mensagem... mas já havia postado.. Me desculpem... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  5. Ola a todos,, Não sei se será de alguma relevância,, mas lá vai... Utilizo o acesso ao postgresql, através da lib gerada na compilação do xharbour, na pasta \xharbour\contrib\pgsql\ que é a libhbpg.lib e a biblioteca gerada na instalação do POSTGRESQL, que é a libpq.lib, sendo esta ser convertida para o padrão da BORLAND.. utilizando o comando: implib -a libpq.lib libpq.dll Gostaria de saber,, se alguem mais utiliza esta forma de acesso,, pois queria trocar expe riencias,, e tirar algumas dúvidas que possuo.. claro se possível... Abaixo alguns exemplos... utilizando comando em SQL... ***----------------------------------------------------*** #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" **Para conectar a base de dados... oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif **Criando base de dados... if oServer:TableExists("p10300000") else cQuery := 'CREATE TABLE p10300000(' cQuery += 'dcct varchar(10) primary key,' cQuery += 'ccrd serial,' cQuery += 'ddes Varchar(40),' cQuery += 'dfiv character(1),' cQuery += 'dcdi boolean,' cQuery += 'dimp Numeric(1,0),' cQuery += 'ddre Numeric(1,0),' cQuery += 'dcla Varchar(15))' oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("ERRO.","ATENCAO") oServer:Destroy() return .t. endif oQuery:Destroy() endif ( Um pequeno exemplo de Inclusão,consultas e exclusão ).. #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "report.ch" function cp103000() private SalvaVar := "A" private otimgas, olbxgas nn = 1 define brush obrush color rgb(255,239,214) define dialog gastos title "Plano de Contas" from 010,010 to 170,435 pixel brush oBrush transparent define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 mdcct = space(10) && conta contabil.. mddes = space(30) && descricao mdfiv = 1 && fixo/variaveis mdcdi = .f. && custo direto s/n mdimp = "Outros" && 0-outros,1-impostos,2-f mddre = 0 && grupo do dem.res.exerc mdcla = space(15) && classificacao lttalgas := "" larraygas := {} mrec := {} @ 005.5, 005 say "Descricao da conta" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oddes var mddes picture "@!" font mtahoma size 095,9 of gastos color mcolorCA,mcolorCB pixel @ 015.5, 005 say "Conta" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get odcct var mdcct picture "@!" font mtahoma size 040,9 of gastos color mcolorCA,mcolorCB pixel @ 15.5,100 RADIO odfiv VAR mdfiv OF gastos color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 15.5,100, '&Fixo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, gastos, odfiv, , , , , .F., , ; 17, 10, , .F., .T. ) odfiv:AddRadio( oRadio ) oRadio := TRadio():New( 15.5, 120, '&Variavel', ; .F. , ; .F. , ; 2, gastos, odfiv, , , , , .F., , ; 30, 10, , .F., .T. ) odfiv:AddRadio( oRadio ) @ 25.5, 005 checkbox odcdi var mdcdi prompt "&Custo Direto"; font mtahoma colors mcolorAA,mcolorAB size 38, 11 of gastos pixel @ 40,005 say "Tipo de gasto" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 39,060 combobox odimp var mdimp items {"Outros","Impostos","Fornecedores"} font mtahoma size 050,90 of gastos color mcolorCA,mcolorCB pixel @ 51.5, 005 say "Grupo" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 051, 060 get oddre var mddre picture "9" font mtahoma size 007,9 of gastos color mcolorCA,mcolorCB pixel @ 061.5, 005 say "Classificacao" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 061, 060 get odcla var mdcla picture "@!" font mtahoma size 095,9 of gastos color mcolorCA,mcolorCB pixel @ 005,170 BUTTON ogasbut1 prompt "&Gravar" size 040,12 font oFont OF gastos pixel action ( grava_gasto() ) @ 020,170 BUTTON ogasbut2 prompt "&Alterar" size 040,12 font oFont OF gastos pixel action ( altera_gasto() ) @ 035,170 BUTTON ogasbut3 prompt "&Excluir" size 040,12 font oFont OF gastos pixel action ( exclui_gasto() ) @ 050,170 BUTTON ogasbut4 prompt "&Novo" size 040,12 font oFont OF gastos pixel action ( gas_novo() ) ogasbut2:disable() ogasbut3:disable() activate dialog gastos center on init Psqgastos("olbxgas") otimgas:end() return nil ***------------( Funcao de pesquisa da natureza de gasto ) ------------------*** function Psqgastos(mlistbox) define timer otimgas Interval 70 Action Psq_gastos( mlistbox ) //of &mdialog activate timer otimgas function Psq_gastos(mlistbox) ***-----------------( Foco no nome/razao social ) ------------------*** if oddes:lFocused() if SalvaVar <> oddes:cText if nn = 1 nn = 2 @ 030, 119 listbox &mlistbox VAR lttalgas items larraygas of gastos size 205,115 On DblClick( pegagastos() ); font ofontL color mcolorAA,mcolorAB pixel odfiv:disable() odcdi:disable() odimp:disable() oddre:disable() odcla:disable() endif SalvaVar := oddes:cText if empty(oddes:cText) &mlistbox:reset() &mlistbox:add("Plano de Contas ") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Plano de contas ") aadd(mRec,"00000") cQuery := "select dcct,ddes from p10300000 where "+; "substr(ddes,1"+","+alltrim(str(len(alltrim(oddes:cText))))+")"+; " = " + "'"+alltrim(oddes:cText)+"'" + " " +; "order by ddes asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('dcct')) b = oQuery:Fieldget(oQuery:Fieldpos('ddes')) if !empty(a) &mlistbox:add( aadd(mRec,a) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if odcct:lFocused() &mlistbox:end() odfiv:enable() odcdi:enable() odimp:enable() oddre:enable() odcla:enable() odcct:setfocus() odcct:gotfocus() nn = 1 //elseif odfiv:lFocused() .or.; // odcdi:lFocused() .or. odimp:lFocused() .or.; // oddre:lFocused() .or. odcla:lFocused() // &mlistbox:end() // nn = 1 endif endif endif return nil function pegagastos() if len(mrec) != 0 if mrec[olbxgas] != "00000" if !empty(mrec[olbxgas]) mdcct = mrec[olbxgas] cQuery := "select * from p10300000 where "+; "dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" +" order by dcct" oQuery := oServer:Query(cQuery) olbxgas:end() SalvaVar := "A" nn = 1 odfiv:enable() odcdi:enable() odimp:enable() oddre:enable() odcla:enable() mdcct := oQuery:Fieldget(oQuery:Fieldpos('dcct')) odcct:ctext := mdcct mddes := oQuery:Fieldget(oQuery:Fieldpos('ddes')) oddes:ctext := mddes mdfiv := iif(oQuery:Fieldget(oQuery:Fieldpos('dfiv')) = "F",1,2) odfiv:refresh() mdcdi := oQuery:Fieldget(oQuery:Fieldpos('dcdi')) odcdi:refresh() mdimp := oQuery:Fieldget(oQuery:Fieldpos('dimp')) if mdimp = 1 mdimp = "Outros" elseif mdimp = 2 mdimp = "Impostos" elseif mdimp = 3 mdimp = "Fornecedores" endif odimp:refresh() mddre := oQuery:Fieldget(oQuery:Fieldpos('ddre')) oddre:ctext := mddre mdcla := oQuery:Fieldget(oQuery:Fieldpos('dcla')) odcla:ctext := mdcla ogasbut1:disable() ogasbut2:enable() ogasbut3:enable() Keyboard( chr(9) ) odcct:setfocus() odcct:gotfocus() endif endif endif return nil ***------------------------( Fucao novo )----------------------------------*** function gas_novo() mdcct = space(10) odcct:ctext := mdcct mddes = space(30) && descricao oddes:ctext := mddes mdfiv = 1 && fixo/variaveis odfiv:refresh() mdcdi = .f. && custo direto s/n odcdi:refresh() mdimp = "Outros" && 0-outros,1-impostos,2-f odimp:refresh() mddre = 0 && grupo do dem.res.exerc oddre:ctext := mddre mdcla = space(15) && classificacao odcla:ctext := mdcla lttalgas := "" larraygas := {} mrec := {} if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oddes:setfocus() oddes:gotfocus() ogasbut1:enable() ogasbut2:disable() ogasbut3:disable() return nil ***-------------------------( Grava no arquivo de gastos ) ----------------**** function grava_gasto() if mdimp = "Outros" ndimp = "1" elseif mdimp = "Impostos" ndimp = "2" elseif mdimp = "Fornecedores" ndimp = "3" endif cQuery := "insert into p10300000(dcct,ddes,dfiv,dcdi,dimp,ddre,dcla)" cQuery += "values("+"'"+mdcct+"'"+","+"'"+mddes+"'"+","+"'"+; iif(mdfiv=1,"F","V")+"'"+","+"'"+iif(mdcdi = .t.,"y","n")+"'"+","+; ndimp+","+str(mddre)+","+"'"+mdcla+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de natureza de gasto.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() gas_novo() return nil function altera_gasto() if mdimp = "Outros" ndimp = "1" elseif mdimp = "Impostos" ndimp = "2" elseif mdimp = "Fornecedores" ndimp = "3" endif cQuery := "Update p10300000 set "+; "dcct = " + "'"+mdcct+"'"+","+; "ddes = " + "'"+mddes+"'"+","+; "dfiv = " + "'"+iif(mdfiv=1,"F","V")+"'"+","+; "dcdi = " + "'"+iif(mdcdi = .t.,"y","n")+"'"+","+; "dimp = " + ndimp+","+; "ddre = " + str(mddre)+","+; "dcla = " + "'"+mdcla+"'"+; " where " + " dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao no plano de contas.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() gas_novo() return nil function exclui_gasto() if mdcct != space(10) if msgyesno("Confirma a exclusao do plano de contas ?") == .t. cQuery := "delete from p10300000 where "+; "dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() gas_novo() endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br Editado por - SYSTEMUP on 05/01/2008 03:01:11
  6. Ola a todos,, Não sei se será de alguma relevância,, mas lá vai... Utilizo o acesso ao postgresql, através da lib gerada na compilação do xharbour, na pasta \xharbour\contrib\pgsql\ que é a libhbpg.lib e a biblioteca gerada na instalação do POSTGRESQL, que é a libpq.lib, sendo esta ser convertida para o padrão da BORLAND.. utilizando o comando: implib -a libpq.lib libpq.dll Gostaria de saber,, se alguem mais utiliza esta forma de acesso,, pois queria trocar expe riencias,, e tirar algumas dúvidas que possuo.. claro se possível... Abaixo alguns exemplos... utilizando comando em SQL... ***----------------------------------------------------*** #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" **Para conectar a base de dados... oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif **Criando base de dados... if oServer:TableExists("p10300000") else cQuery := 'CREATE TABLE p10300000(' cQuery += 'dcct varchar(10) primary key,' cQuery += 'ccrd serial,' cQuery += 'ddes Varchar(40),' cQuery += 'dfiv character(1),' cQuery += 'dcdi boolean,' cQuery += 'dimp Numeric(1,0),' cQuery += 'ddre Numeric(1,0),' cQuery += 'dcla Varchar(15))' oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("ERRO.","ATENCAO") oServer:Destroy() return .t. endif oQuery:Destroy() endif ( Um pequeno exemplo de Inclusão,consultas e exclusão ).. #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "report.ch" function cp103000() private SalvaVar := "A" private otimgas, olbxgas nn = 1 define brush obrush color rgb(255,239,214) define dialog gastos title "Plano de Contas" from 010,010 to 170,435 pixel brush oBrush transparent define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 mdcct = space(10) && conta contabil.. mddes = space(30) && descricao mdfiv = 1 && fixo/variaveis mdcdi = .f. && custo direto s/n mdimp = "Outros" && 0-outros,1-impostos,2-f mddre = 0 && grupo do dem.res.exerc mdcla = space(15) && classificacao lttalgas := "" larraygas := {} mrec := {} @ 005.5, 005 say "Descricao da conta" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oddes var mddes picture "@!" font mtahoma size 095,9 of gastos color mcolorCA,mcolorCB pixel @ 015.5, 005 say "Conta" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get odcct var mdcct picture "@!" font mtahoma size 040,9 of gastos color mcolorCA,mcolorCB pixel @ 15.5,100 RADIO odfiv VAR mdfiv OF gastos color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 15.5,100, '&Fixo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, gastos, odfiv, , , , , .F., , ; 17, 10, , .F., .T. ) odfiv:AddRadio( oRadio ) oRadio := TRadio():New( 15.5, 120, '&Variavel', ; .F. , ; .F. , ; 2, gastos, odfiv, , , , , .F., , ; 30, 10, , .F., .T. ) odfiv:AddRadio( oRadio ) @ 25.5, 005 checkbox odcdi var mdcdi prompt "&Custo Direto"; font mtahoma colors mcolorAA,mcolorAB size 38, 11 of gastos pixel @ 40,005 say "Tipo de gasto" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 39,060 combobox odimp var mdimp items {"Outros","Impostos","Fornecedores"} font mtahoma size 050,90 of gastos color mcolorCA,mcolorCB pixel @ 51.5, 005 say "Grupo" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 051, 060 get oddre var mddre picture "9" font mtahoma size 007,9 of gastos color mcolorCA,mcolorCB pixel @ 061.5, 005 say "Classificacao" of gastos font mtahoma color mcolorAA,mcolorAB pixel @ 061, 060 get odcla var mdcla picture "@!" font mtahoma size 095,9 of gastos color mcolorCA,mcolorCB pixel @ 005,170 BUTTON ogasbut1 prompt "&Gravar" size 040,12 font oFont OF gastos pixel action ( grava_gasto() ) @ 020,170 BUTTON ogasbut2 prompt "&Alterar" size 040,12 font oFont OF gastos pixel action ( altera_gasto() ) @ 035,170 BUTTON ogasbut3 prompt "&Excluir" size 040,12 font oFont OF gastos pixel action ( exclui_gasto() ) @ 050,170 BUTTON ogasbut4 prompt "&Novo" size 040,12 font oFont OF gastos pixel action ( gas_novo() ) ogasbut2:disable() ogasbut3:disable() activate dialog gastos center on init Psqgastos("olbxgas") otimgas:end() return nil ***------------( Funcao de pesquisa da natureza de gasto ) ------------------*** function Psqgastos(mlistbox) define timer otimgas Interval 70 Action Psq_gastos( mlistbox ) //of &mdialog activate timer otimgas function Psq_gastos(mlistbox) ***-----------------( Foco no nome/razao social ) ------------------*** if oddes:lFocused() if SalvaVar <> oddes:cText if nn = 1 nn = 2 @ 030, 119 listbox &mlistbox VAR lttalgas items larraygas of gastos size 205,115 On DblClick( pegagastos() ); font ofontL color mcolorAA,mcolorAB pixel odfiv:disable() odcdi:disable() odimp:disable() oddre:disable() odcla:disable() endif SalvaVar := oddes:cText if empty(oddes:cText) &mlistbox:reset() &mlistbox:add("Plano de Contas ") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Plano de contas ") aadd(mRec,"00000") cQuery := "select dcct,ddes from p10300000 where "+; "substr(ddes,1"+","+alltrim(str(len(alltrim(oddes:cText))))+")"+; " = " + "'"+alltrim(oddes:cText)+"'" + " " +; "order by ddes asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('dcct')) b = oQuery:Fieldget(oQuery:Fieldpos('ddes')) if !empty(a) &mlistbox:add( aadd(mRec,a) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if odcct:lFocused() &mlistbox:end() odfiv:enable() odcdi:enable() odimp:enable() oddre:enable() odcla:enable() odcct:setfocus() odcct:gotfocus() nn = 1 //elseif odfiv:lFocused() .or.; // odcdi:lFocused() .or. odimp:lFocused() .or.; // oddre:lFocused() .or. odcla:lFocused() // &mlistbox:end() // nn = 1 endif endif endif return nil function pegagastos() if len(mrec) != 0 if mrec[olbxgas] != "00000" if !empty(mrec[olbxgas]) mdcct = mrec[olbxgas] cQuery := "select * from p10300000 where "+; "dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" +" order by dcct" oQuery := oServer:Query(cQuery) olbxgas:end() SalvaVar := "A" nn = 1 odfiv:enable() odcdi:enable() odimp:enable() oddre:enable() odcla:enable() mdcct := oQuery:Fieldget(oQuery:Fieldpos('dcct')) odcct:ctext := mdcct mddes := oQuery:Fieldget(oQuery:Fieldpos('ddes')) oddes:ctext := mddes mdfiv := iif(oQuery:Fieldget(oQuery:Fieldpos('dfiv')) = "F",1,2) odfiv:refresh() mdcdi := oQuery:Fieldget(oQuery:Fieldpos('dcdi')) odcdi:refresh() mdimp := oQuery:Fieldget(oQuery:Fieldpos('dimp')) if mdimp = 1 mdimp = "Outros" elseif mdimp = 2 mdimp = "Impostos" elseif mdimp = 3 mdimp = "Fornecedores" endif odimp:refresh() mddre := oQuery:Fieldget(oQuery:Fieldpos('ddre')) oddre:ctext := mddre mdcla := oQuery:Fieldget(oQuery:Fieldpos('dcla')) odcla:ctext := mdcla ogasbut1:disable() ogasbut2:enable() ogasbut3:enable() Keyboard( chr(9) ) odcct:setfocus() odcct:gotfocus() endif endif endif return nil ***------------------------( Fucao novo )----------------------------------*** function gas_novo() mdcct = space(10) odcct:ctext := mdcct mddes = space(30) && descricao oddes:ctext := mddes mdfiv = 1 && fixo/variaveis odfiv:refresh() mdcdi = .f. && custo direto s/n odcdi:refresh() mdimp = "Outros" && 0-outros,1-impostos,2-f odimp:refresh() mddre = 0 && grupo do dem.res.exerc oddre:ctext := mddre mdcla = space(15) && classificacao odcla:ctext := mdcla lttalgas := "" larraygas := {} mrec := {} if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oddes:setfocus() oddes:gotfocus() ogasbut1:enable() ogasbut2:disable() ogasbut3:disable() return nil ***-------------------------( Grava no arquivo de gastos ) ----------------**** function grava_gasto() if mdimp = "Outros" ndimp = "1" elseif mdimp = "Impostos" ndimp = "2" elseif mdimp = "Fornecedores" ndimp = "3" endif cQuery := "insert into p10300000(dcct,ddes,dfiv,dcdi,dimp,ddre,dcla)" cQuery += "values("+"'"+mdcct+"'"+","+"'"+mddes+"'"+","+"'"+; iif(mdfiv=1,"F","V")+"'"+","+"'"+iif(mdcdi = .t.,"y","n")+"'"+","+; ndimp+","+str(mddre)+","+"'"+mdcla+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de natureza de gasto.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() gas_novo() return nil function altera_gasto() if mdimp = "Outros" ndimp = "1" elseif mdimp = "Impostos" ndimp = "2" elseif mdimp = "Fornecedores" ndimp = "3" endif cQuery := "Update p10300000 set "+; "dcct = " + "'"+mdcct+"'"+","+; "ddes = " + "'"+mddes+"'"+","+; "dfiv = " + "'"+iif(mdfiv=1,"F","V")+"'"+","+; "dcdi = " + "'"+iif(mdcdi = .t.,"y","n")+"'"+","+; "dimp = " + ndimp+","+; "ddre = " + str(mddre)+","+; "dcla = " + "'"+mdcla+"'"+; " where " + " dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao no plano de contas.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() gas_novo() return nil function exclui_gasto() if mdcct != space(10) if msgyesno("Confirma a exclusao do plano de contas ?") == .t. cQuery := "delete from p10300000 where "+; "dcct = " + "'"+ alltrim(mdcct) + space(10 - len(alltrim(mdcct))) + "'" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() gas_novo() endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br Editado por - SYSTEMUP on 05/01/2008 03:01:11
  7. Ola a todos,, Não sei se será de interesse, mas ... Estou utilizando a contrib do xharbour pgsql, para acessar bases de dados no POSTGRESQL, utilizando a lib gerada na compilação do xharbour a partir da pasta \xharbour\contrib\pgsql,, a biblioteca libhbpg.lib e utilizando a biblioteca após a instalação do postgresql a libpq.lib, que tem que ser convertida para a borland, pois ela vem na instalação do postgresql para microsoft visual C,, para converter utiliza-se o: implib -a libpq.lib libpq.dll,,, o implib da propra borland... OBS.. GOSTARIA DE SABER, SE ALGUEM MAIS UTILIZA ESTE TIPO DE ACESSO,, POIS GOSTARIA DE TROCAR INFORMAÇÕES,, QUE ME FALTAM... SE POSSÃVEL É CLARO.., COM ACESSO A PARTIR DA CONTRIB DO XHARBOUR.. Segue um exemplo abaixo... Para abrir a base de dados.. utilizo.. o seguinte... ..// oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif ..\\ ***-----( Exemplo que contém inclusão,alteração,exclusão e pesquisa com comando em SQL.... #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "Folder.ch" #include "report.ch" #Define CLR_VERMELHO nRGB( 255, 000, 000 ) //--> Vermelho Para a Letra #Define CLR_BlACK nRGB( 000, 000, 000 ) //--> PRETO // a funcao encheclifor(), esta no arquivo funcoes.prg function cr101000() private oandn,mandn,cTipo,oGet private SalvaVar := "A" private otim, oLbx nn = 1 DEFINE BRUSH oBrush COLOR rgb(255,239,214) define dialog atuclientes title "Clientes" from 010,010 to 438,700 pixel brush oBrush TRANSPARENT define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 @ 0,0 FOLDER oFld OF atuclientes prompt "&1. Dados", "&2. Comercial", "&3. Dados Pessoais","&4. Observações ","&5. Local de Entrega"; DIALOGS "PageDados","PageComercial","PagePessoal","PageObs","PageEntrega"; TABCOLOR CLR_BlACK; FOCUSCOLOR CLR_BLUE; size 295, 215; COLORS mcolorAA, mcolorAB; ADJUST oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oFld:Show() oFld:lWin95Look := .T. //-> Modifica o Estilo da Orelha. macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad := 1 mandn := space(14) manrs := space(50) manft := space(20) mativ := 1 madfn := ctod("") maend := space(50) macep := space(08) mabai := space(30) macid := space(30) maest := space(02) matf1 := space(10) matf2 := space(10) matfx := space(10) maeml := space(50) matpd := "Cedula de Identidade" mandl := space(18) madtc := date() madta := ctod("") macsn := .f. maccb := space(08) maecb := space(50) mabcb := space(30) maccr := space(30) maufc := space(02) mapct := space(30) mapcp := space(30) maufp := space(02) mavpr := space(02) marpf := space(03) && falta pegar da tabela de vendedores. malmc := 0 meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n menat := space(30) mencj := space(40) mepai := space(40) memae := space(40) meemt := space(40) metlf := space(10) meend := space(50) mefun := space(30) mesal := 0 merc1 := space(40) merc2 := space(40) merc3 := space(40) medtc := ctod("") mespc := space(40) maddv := ctod("") maobs := "" lttal := "" attal := "" larray := {} marray := {} aadd(marray," Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") mslcl = space(50) && local de entrega msend = space(50) && endere‡o de entrega msbai = space(30) && bairro de entrega mscep = space(08) && cep de entrega mscid = space(30) && cidade de entrega msest = space(02) mstel = space(10) && telefone de entrega mspct = space(30) && pessoa de contato msobs = "" && observa‡ao.. nVerCidade := "S" && faz parte da funcao geracidades() ***---------------( Informacoes da 1§ guia ) ---------------*** @ 3.5,000 RADIO orad VAR mrad OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,01, '&Fisica', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 030, '&Juridica', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) @ 05.5, 070 say "&CPF/CNPJ" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 100 get oandn var mandn picture "@r 999.999.999-99" valid ( pescnpjcpf(@mandn) == .t. ) font mtahoma size 060,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mrad = 1,VerificaCNPJCPF("F",oandn,@mandn,.t.),VerificaCNPJCPF("J",oandn,@mandn,.t.)) @ 3.5,165 RADIO oativ VAR mativ OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,165, '&Ativo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oativ, , , , , .F., , ; 20, 10, , .F., .T. ) oativ:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 190, '&Inativo', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oativ, , , , , .F., , ; 25, 10, , .F., .T. ) oativ:AddRadio( oRadio ) @ 05.5, 225 say "Inativado em" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 260 get oaddv var maddv font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mativ = 1,.f.,.t.) @ 25.5, 002 say "&Nome/Razão Social" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oanrs var manrs picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "F&antasia" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oanft var manft picture "@!" font mtahoma size 80,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 143 say "&Dt.Fundação/Nasc." of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 192 get oadfn var madfn font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Tipo de documento" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 060 combobox oatpd var matpd items {"Isento","Inscricao Estadual","Inscricao Municipal","Cedula de Identidade","Produtor Rural","Outros"} font mtahoma size 65,60 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 132 say "Nú&mero" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 152 get oandl var mandl picture "@!" font mtahoma size 68,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(matpd = "Isento",.f.,.t.) @ 65.5, 002 say "C&ep" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oacep var macep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 65.5, 100 say "&Endereço" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 128 get oaend var maend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "&Bairro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oabai var mabai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 160 say "C&idade" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 180 get oacid var macid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 075, 276 get oaest var maest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "Te&lefones" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oatf1 var matf1 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 095, 110 get oatf2 var matf2 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 160 say "Fa&x" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 180 get oatfx var matfx picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "E-mai&l" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 105, 060 get oaeml var maeml picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 115.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 115, 060 get oapct var mapct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 002 say "Dt. Cada&stro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 060 get oadtc var madtc font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 095 say "Dt.última alteração" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 145 get oadta var madta font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 134, 184 checkbox oacsn var macsn prompt "&Correntista"; font mtahoma colors mcolorAA,mcolorAB size 34, 11 of oFld:aDialogs[1] pixel @ 150,002 listbox oLax VAR attal items marray of oFld:aDialogs[1] Size 285,50; font ofontL color mcolorAA,mcolorAB pixel ***---------------( Informacoes da 2§ guia ) ---------------*** @ 05.5, 002 say "&Cep de Cobrança" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oaccb var maccb picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 05.5, 100 say "&Endereço" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 128 get oaecb var maecb picture "@!" font mtahoma size 160,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Bairro" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oabcb var mabcb picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 160 say "C&idade" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 180 get oaccr var maccr picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 015, 276 get oaufc var maufc picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Praça Pagto" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oapcp var mapcp picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 025, 156 get oaufp var maufp picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "&Vencimento Peferencial" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oavpr var mavpr picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Representante" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 55.5, 002 say "&Limite de Crédito" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oalmc var malmc picture "@e 999,999.99" font mtahoma size 040,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 3§ guia ) ---------------*** @ 005.5, 002 say "&Estado Civil" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 combobox oeecv var meecv items {"Solteiro(a)","Casado(a)","Divorciado(a)","Viuvo(a)","Outros"} font mtahoma size 65,60 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 015.5, 002 say "&Natural" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oenat var menat picture "@!" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "Nome do &Cônjuge" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oencj var mencj picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "Nome do &Pai" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oepai var mepai picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "Nome do &Mãe" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get oemae var memae picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 55.5, 002 say "Empresa que &Trabalha" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oeemt var meemt picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 65.5, 002 say "Te&lefone Comercial" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oetlf var metlf picture "@r (99)9999-9999" font mtahoma size 40,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "Ende&reço" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oeend var meend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 85.5, 002 say "&Função ( Cargo )" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 085, 060 get oefun var mefun picture "@!" font mtahoma size 76,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "&Salário" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oesal var mesal picture "@e 999,999.99" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "Referênci&as Comerciais" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 0115, 060 get oerc1 var merc1 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0125, 060 get oerc2 var merc2 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0135, 060 get oerc3 var merc3 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 145.5, 002 say "Data consulta SPC" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 145, 060 get oedtc var medtc font mtahoma size 28,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 155.5, 002 say "Informação" of ofld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 155, 060 get oespc var mespc picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 4§ guia ) ---------------*** @ 005, 02 get oaobs VAR maobs MEMO SIZE 285,150 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[4] ***---------------( Informacoes da 5§ guia ) ---------------*** @ 05.5, 002 say "&Local" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oslcl var mslcl picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Cep de Entrega" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 15, 060 get oscep var mscep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 100 say "&Endereço" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 128 get osend var msend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Bairro" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get osbai var msbai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 160 say "C&idade" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 180 get oscid var mscid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 025, 276 get osest var msest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 035.5, 002 say "&Telefone" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get ostel var mstel picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 045.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get ospct var mspct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 065, 002 get osobs VAR msobs MEMO SIZE 285,100 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[5] @ 185,002 BUTTON oentbut1 prompt "&Gravar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,044 BUTTON oentbut2 prompt "&Alterar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,086 BUTTON oentbut3 prompt "&Excluir" size 040,12 font oFont OF oFld:aDialogs[5] pixel oFld:aDialogs[1]:bPainted := { || FillWnd ( oFld:aDialogs[1], mcolorAB,"",5 ) } oFld:aDialogs[2]:bPainted := { || FillWnd ( oFld:aDialogs[2], mcolorAB,"",5 ) } oFld:aDialogs[3]:bPainted := { || FillWnd ( oFld:aDialogs[3], mcolorAB,"",5 ) } oFld:aDialogs[4]:bPainted := { || FillWnd ( oFld:aDialogs[4], mcolorAB,"",5 ) } oFld:aDialogs[5]:bPainted := { || FillWnd ( oFld:aDialogs[5], mcolorAB,"",5 ) } @ 015,300 BUTTON oclibut1 prompt "&Gravar" size 040,12 font oFont OF atuClientes pixel action ( gravaClientes("C") ) @ 030,300 BUTTON oclibut2 prompt "&Alterar" size 040,12 font oFont OF atuClientes pixel action ( GravaClientes("A") ) @ 045,300 BUTTON oclibut3 prompt "&Excluir" size 040,12 font oFont OF atuClientes pixel action ( excluiclientes() ) @ 060,300 BUTTON oclibut5 prompt "&Novo" size 040,12 font oFont OF atuClientes pixel action ( limpavariaveis() ) @ 095,300 BUTTON oclibut6 prompt "&Sair" size 040,12 font oFont OF atuClientes pixel action ( atuClientes:end() ) //@ 110,300 BUTTON oclibut4 prompt "&Imprimir" size 040,12 font oFont OF atuClientes pixel action ( ImprimeClientes() ) oclibut2:disable() oclibut3:disable() activate dialog atuclientes center on init consultaCliente( "oLbx") otim:end() return nil function GeraCidades() if nVercidade = "S" if !empty(macid) .and. !empty(maest) if empty(maccr) oaccr:ctext := macid oaufc:ctext := maest endif if empty(mapcp) oapcp:ctext := macid oaufc:ctext := maest endif endif endif return nil function excluiclientes() if macdc != 0 if msgyesno("Confirma a exclusao deste cliente ?") == .t. cQuery := "delete from r20000000 where "+; "acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() limpavariaveis() endif endif return nil function pescnpjcpf(cdocu) ww = .t. if !empty(cdocu) if mrad = 1 && CPF // ww = ver_cpf(cdocu) matpd := "Cedula de Identidade" elseif mrad = 2 && CNPJ // ww = ver_cgc(cdocu) matpd := "Inscricao Estadual" endif oatpd:refresh() cQuery := "select * from r20000000 where "+; "andn = " + cdocu + " order by andn" oQuery := oServer:Query(cQuery) if oQuery[11] = 1 macdc = oQuery:Fieldget(oQuery:Fieldpos('acdc')) concluialtera() else oQuery:destroy() endif endif return(ww) function concluialtera() a = oQuery:Fieldget(oQuery:Fieldpos('apfj')) mrad := iif(a="F",1,2) orad:refresh() mandn := oQuery:Fieldget(oQuery:Fieldpos('andn')) oandn:ctext := mandn manrs := oQuery:Fieldget(oQuery:Fieldpos('anrs')) oanrs:ctext := manrs manft := oQuery:Fieldget(oQuery:Fieldpos('anft')) oanft:ctext := manft mativ := iif(oQuery:Fieldget(oQuery:Fieldpos('aatv')) = .t.,1,2) oativ:refresh() madfn := oQuery:Fieldget(oQuery:Fieldpos('adfn')) oadfn:ctext := madfn maend := oQuery:Fieldget(oQuery:Fieldpos('aend')) oaend:ctext := maend macep := oQuery:Fieldget(oQuery:Fieldpos('acep')) oacep:ctext := macep mabai := oQuery:Fieldget(oQuery:Fieldpos('abai')) oabai:ctext := mabai macid := oQuery:Fieldget(oQuery:Fieldpos('acid')) oacid:ctext := macid maest := oQuery:Fieldget(oQuery:Fieldpos('aest')) oaest:ctext := maest matf1 := oQuery:Fieldget(oQuery:Fieldpos('atf1')) oatf1:ctext := matf1 matf2 := oQuery:Fieldget(oQuery:Fieldpos('atf2')) oatf2:ctext := matf2 matfx := oQuery:Fieldget(oQuery:Fieldpos('atfx')) oatfx:ctext := matfx maeml := oQuery:Fieldget(oQuery:Fieldpos('aeml')) oaeml:ctext := maeml natdl = oQuery:Fieldget(oQuery:Fieldpos('atdl')) if natdl = 1 matpd = "Isento" elseif natdl = 2 matpd ="Inscricao Estadual" elseif natdl = 3 matpd ="Inscricao Municipal" elseif natdl = 4 matpd ="Cedula de Identidade" elseif natdl = 5 matpd ="Produtor Rural" elseif natdl = 6 matpd ="Outros" endif oatpd:refresh() mandl := oQuery:Fieldget(oQuery:Fieldpos('andl')) oandl:ctext := mandl madtc := oQuery:Fieldget(oQuery:Fieldpos('adtc')) oadtc:ctext := madtc madta := oQuery:Fieldget(oQuery:Fieldpos('adta')) oadta:ctext := madta macsn := oQuery:Fieldget(oQuery:Fieldpos('acsn')) oacsn:refresh() maccb := oQuery:Fieldget(oQuery:Fieldpos('accb')) oaccb:ctext := maccb maecb := oQuery:Fieldget(oQuery:Fieldpos('aecb')) oaecb:ctext := maecb mabcb := oQuery:Fieldget(oQuery:Fieldpos('abcb')) oabcb:ctext := mabcb maccr := oQuery:Fieldget(oQuery:Fieldpos('accr')) oaccr:ctext := maccr maufc := oQuery:Fieldget(oQuery:Fieldpos('aufc')) oaufc:ctext := maufc mapct := oQuery:Fieldget(oQuery:Fieldpos('apct')) oapct:ctext := mapct mapcp := oQuery:Fieldget(oQuery:Fieldpos('apcp')) oapcp:ctext := mapcp maufp := oQuery:Fieldget(oQuery:Fieldpos('aufp')) oaufp:ctext := maufp mavpr := oQuery:Fieldget(oQuery:Fieldpos('avpr')) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := oQuery:Fieldget(oQuery:Fieldpos('almc')) oalmc:ctext := malmc maddv := oQuery:Fieldget(oQuery:Fieldpos('addv')) oaddv:ctext := maddv maobs := oQuery:Fieldget(oQuery:Fieldpos('aobs')) oaobs:refresh() oQuery:destroy() cQuery := "select * from r20400000 where "+; "ecdc = " + alltrim(str(macdc)) + " order by ecdc" oQuery := oServer:Query(cQuery) neecv := oQuery:Fieldget(oQuery:Fieldpos('eecv')) if neecv = 1 meecv = "Solteiro(a)" elseif neecv = 2 meecv = "Casado(a)" elseif neecv = 3 meecv = "Divorciado(a)" elseif neecv = 4 meecv = "Viuvo(a)" elseif neecv = 5 meecv = "Outros" endif oeecv:refresh() menat := oQuery:Fieldget(oQuery:Fieldpos('enat')) oenat:ctext := menat mencj := oQuery:Fieldget(oQuery:Fieldpos('encj')) oencj:ctext := mencj mepai := oQuery:Fieldget(oQuery:Fieldpos('epai')) oepai:ctext := mepai memae := oQuery:Fieldget(oQuery:Fieldpos('emae')) oemae:ctext := memae meemt := oQuery:Fieldget(oQuery:Fieldpos('eemt')) oeemt:ctext := meemt metlf := oQuery:Fieldget(oQuery:Fieldpos('etlf')) oetlf:ctext := metlf meend := oQuery:Fieldget(oQuery:Fieldpos('eend')) oeend:ctext := meend mefun := oQuery:Fieldget(oQuery:Fieldpos('efun')) oefun:ctext := mefun mesal := oQuery:Fieldget(oQuery:Fieldpos('esal')) oesal:ctext := mesal merc1 := oQuery:Fieldget(oQuery:Fieldpos('erc1')) oerc1:ctext := merc1 merc2 := oQuery:Fieldget(oQuery:Fieldpos('erc2')) oerc2:ctext := merc2 merc3 := oQuery:Fieldget(oQuery:Fieldpos('erc3')) oerc3:ctext := merc3 medtc := oQuery:Fieldget(oQuery:Fieldpos('edtc')) oedtc:ctext := medtc mespc := oQuery:Fieldget(oQuery:Fieldpos('espc')) oespc:ctext := mespc oQuery:destroy() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oclibut1:disable() nVerCidade := "N" oclibut2:enable() oclibut3:enable() VerificaCNPJCPF(upper(a),oandn,@mandn,.t.) //if GetKeyState(VK_RETURN) // Keyboard( chr(9) ) //endif oanft:setfocus() oanft:gotfocus() encheclifor("R") return nil function VerificaCNPJCPF(cTipo,oGet,cCgc,nTf) if cTipo = "F" If oget:cPicture!="@R 999.999.999-99" //cCgc:=Space(11) oget:cPicture:="@R 999.999.999-99" oget:oget:Picture:="@R 999.999.999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() elseif cTipo = "J" If oget:cPicture!="@R 99.999.999/9999-99" //cCgc:=Space(14) oget:cPicture:="@R 99.999.999/9999-99" oget:oget:Picture:="@R 99.999.999/9999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .F.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() endif return .t. function gravaclientes(objet) nobjet = objet ***-------------------------------( 1§ guia )-----------------------*** if empty(mandn) msgstop("E necessario informar o " + iif(mrad = 1,"CPF.","CNPJ."),"ATENCAO") oFld:SetOption(1) oandn:setfocus() oandn:gotfocus() return nil endif if empty(manrs) msgstop("E necessario informar o Nome/Razao Social","ATENCAO") oFld:SetOption(1) oanrs:setfocus() oanrs:gotfocus() return nil endif if empty(macep) msgstop("E necessario informar o CEP.","ATENCAO") oFld:SetOption(1) oacep:setfocus() oacep:gotfocus() return nil endif if empty(maend) msgstop("E necessario informar o ENDERECO.","ATENCAO") oFld:SetOption(1) oaend:setfocus() oaend:gotfocus() return nil endif if empty(mabai) msgstop("E necessario informar o BAIRRO.","ATENCAO") oFld:SetOption(1) oabai:setfocus() oabai:gotfocus() return nil endif if empty(macid) msgstop("E necessario informar a CIDADE.","ATENCAO") oFld:SetOption(1) oacid:setfocus() oacid:gotfocus() return nil endif if empty(maest) msgstop("E necessario informar o ESTADO.","ATENCAO") oFld:SetOption(1) oaest:setfocus() oaest:gotfocus() return nil endif ***-------------------------------( 2§ guia )-----------------------*** if empty(maccb) msgstop("E necessario informar o CEP DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccb:setfocus() oaccb:gotfocus() return nil endif if empty(maecb) msgstop("E necessario informar o ENDERECO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaecb:setfocus() oaecb:gotfocus() return nil endif if empty(mabcb) msgstop("E necessario informar o BAIRRO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oabcb:setfocus() oabcb:gotfocus() return nil endif if empty(maccr) msgstop("E necessario informar a CIDADE DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccr:setfocus() oaccr:gotfocus() return nil endif if empty(maufc) msgstop("E necessario informar o ESTADO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaufc:setfocus() oaufc:gotfocus() return nil endif if nobjet = "C" * Obs. as datas estao no padrao AAAA-MM-DD naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif ***--------------( Realiza a inclusao de clientes )--------------*** cQuery := "insert into r20000000(anrs,anft,aatv,addv,adfn,aend,abai,acep,"+; "acid,aest,adtc,adta,apfj,andn,atdl,andl,aeml,atf1,atf2,"+; "atfx,apct,acsn,avpr,aecb,abcb,accb,accr,aufc,apcp,"+; "aufp,arpf,almc,aobs)" cQuery += "values("+"'"+manrs+"'"+","+"'"+manft+"'"+","+"'"+; iif(mativ=1,"y","n")+"'"+","+"'"+naddv+"'"+","+; "'"+nadfn+"'"+","+"'"+maend+"'"+","+"'"+mabai+"'"+","+; "'"+macep+"'"+","+"'"+macid+"'"+","+"'"+maest+"'"+","+; "'"+nadtc+"'"+","+"'"+nadta+"'"+","+; "'"+iif(mrad=1,"F","J")+"'"+","+; "'"+mandn+"'"+","+natdl+","+"'"+mandl+"'"+","+; "'"+maeml+"'"+","+"'"+matf1+"'"+","+"'"+matf2+"'"+","+; "'"+matfx+"'"+","+"'"+mapct+"'"+","+; "'"+iif(macsn=.t.,"y","n")+"'"+","+"'"+mavpr+"'"+","+; "'"+maecb+"'"+","+"'"+mabcb+"'"+","+"'"+maccb+"'"+","+; "'"+maccr+"'"+","+"'"+maufc+"'"+","+"'"+mapcp+"'"+","+; "'"+maufp+"'"+","+"'"+marpf+"'"+","+str(malmc)+","+; "'"+maobs+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 ***---( Pega o ultimo numero sequencial do cadastro de clientes)----*** if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "select * from r20000000_acdc_seq;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() mecdc = oQuery:Fieldget(2) oQuery:Skip() END oQuery:destroy() cQuery := "insert into r20400000(ecdc,eecv,encj,enat,epai,emae,"+; "eemt,etlf,eend,efun,esal,erc1,erc2,erc3,edtc,espc)" cQuery += "values("+str(mecdc)+","+neecv+","+"'"+mencj+"'"+","+; "'"+menat+"'"+","+"'"+mepai+"'"+","+"'"+memae+"'"+","+; "'"+meemt+"'"+","+"'"+metlf+"'"+","+"'"+meend+"'"+","+; "'"+mefun+"'"+","+str(mesal)+","+"'"+merc1+"'"+","+; "'"+merc2+"'"+","+"'"+merc3+"'"+","+"'"+nedtc+"'"+","+; "'"+mespc+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de dados pessoais do cliente.","ATENCAO") // ? oQuery:error() endif oQuery:destroy() oServer:Commit() endif elseif nobjet = "A" naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif cQuery := "Update r20000000 set "+; "anrs = " + "'"+manrs+"'"+","+; "anft = " + "'"+manft+"'"+","+; "aatv = " + "'"+iif(mativ=1,"y","n")+"'"+","+; "addv = " + "'"+naddv+"'"+","+; "adfn = " + "'"+nadfn+"'"+","+; "aend = " + "'"+maend+"'"+","+; "abai = " + "'"+mabai+"'"+","+; "acep = " + "'"+macep+"'"+","+; "acid = " + "'"+macid+"'"+","+; "aest = " + "'"+maest+"'"+","+; "adtc = " + "'"+nadtc+"'"+","+; "adta = " + "'"+nadta+"'"+","+; "apfj = " + "'"+iif(mrad=1,"F","J")+"'"+","+; "andn = " + "'"+mandn+"'"+","+; "atdl = " + natdl+","+; "andl = " + "'"+mandl+"'"+","+; "aeml = " + "'"+maeml+"'"+","+; "atf1 = " + "'"+matf1+"'"+","+; "atf2 = " + "'"+matf2+"'"+","+; "atfx = " + "'"+matfx+"'"+","+; "apct = " + "'"+mapct+"'"+","+; "acsn = " + "'"+iif(macsn=.t.,"y","n")+"'"+","+; "avpr = " + "'"+mavpr+"'"+","+; "aecb = " + "'"+maecb+"'"+","+; "abcb = " + "'"+mabcb+"'"+","+; "accb = " + "'"+maccb+"'"+","+; "accr = " + "'"+maccr+"'"+","+; "aufc = " + "'"+maufc+"'"+","+; "apcp = " + "'"+mapcp+"'"+","+; "aufp = " + "'"+maufp+"'"+","+; "arpf = " + "'"+marpf+"'"+","+; "almc = " + str(malmc)+","+; "aobs = " + "'"+maobs+"'"+; " where " + " acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "Update r20400000 set "+; "eecv = " + neecv+","+; "encj = " + "'"+mencj+"'"+","+; "enat = " + "'"+menat+"'"+","+; "epai = " + "'"+mepai+"'"+","+; "emae = " + "'"+memae+"'"+","+; "eemt = " + "'"+meemt+"'"+","+; "etlf = " + "'"+metlf+"'"+","+; "eend = " + "'"+meend+"'"+","+; "efun = " + "'"+mefun+"'"+","+; "esal = " + str(mesal)+","+; "erc1 = " + "'"+merc1+"'"+","+; "erc2 = " + "'"+merc2+"'"+","+; "erc3 = " + "'"+merc3+"'"+","+; "edtc = " + "'"+nedtc+"'"+","+; "espc = " + "'"+mespc+"'"+; " where " + " ecdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() endif endif ***-----------( Fun‡Æo que lima as variaveis do sistema )-----------*** limpavariaveis() return nil function limpavariaveis() macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad = 1 orad:refresh() mandn := space(14) oandn:ctext := mandn manrs := space(50) oanrs:ctext := manrs manft := space(20) oanft:ctext := manft mativ = 1 oativ:refresh() madfn := ctod("") oadfn:ctext := madfn maend := space(50) oaend:ctext := maend macep := space(08) oacep:ctext := macep mabai := space(30) oabai:ctext := mabai macid := space(30) oacid:ctext := macid maest := space(02) oaest:ctext := maest matf1 := space(10) oatf1:ctext := matf1 matf2 := space(10) oatf2:ctext := matf2 matfx := space(10) oatfx:ctext := matfx maeml := space(50) oaeml:ctext := maeml matpd := "Cedula de Identidade" oatpd:refresh() mandl := space(18) oandl:ctext := mandl madtc := date() oadtc:ctext := madtc madta := ctod("") oadta:ctext := madta macsn := .f. oacsn:refresh() maccb := space(08) oaccb:ctext := maccb maecb := space(50) oaecb:ctext := maecb mabcb := space(30) oabcb:ctext := mabcb maccr := space(30) oaccr:ctext := maccr maufc := space(02) oaufc:ctext := maufc mapct := space(30) oapct:ctext := mapct mapcp := space(30) oapcp:ctext := mapcp maufp := space(02) oaufp:ctext := maufp mavpr := space(02) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := 0 oalmc:ctext := malmc meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n oeecv:refresh() menat := space(30) oenat:ctext := menat mencj := space(40) oencj:ctext := mencj mepai := space(40) oepai:ctext := mepai memae := space(40) oemae:ctext := memae meemt := space(40) oeemt:ctext := meemt metlf := space(10) oetlf:ctext := metlf meend := space(50) oeend:ctext := meend mefun := space(30) oefun:ctext := mefun mesal := 0 oesal:ctext := mesal merc1 := space(40) oerc1:ctext := merc1 merc2 := space(40) oerc2:ctext := merc2 merc3 := space(40) oerc3:ctext := merc3 medtc := ctod("") oedtc:ctext := medtc mespc := space(40) oespc:ctext := mespc maddv := ctod("") oaddv:ctext := maddv maobs := "" oaobs:refresh() lttal := "" larray := {} olax:reset() olax:add(" Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") olax:refresh() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) VerificaCNPJCPF("F",oandn,@mandn,.t.) if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oandn:setfocus() oandn:gotfocus() oclibut1:enable() nVerCidade := "S" oclibut2:disable() oclibut3:disable() return nil ***--------------( funcao de pesquisa de clientes e cidades )---------------*** function consultacliente( mlistbox) define timer otim Interval 70 Action PesquisaCliente ( mlistbox ) //of &mdialog activate timer otim function pesquisacliente( mlistbox ) ***-----------------( Foco no nome/razao social ) ------------------*** if oanrs:lFocused() if SalvaVar <> oanrs:cText if nn = 1 nn = 2 @ 069,002 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 578,115 On DblClick( alteracliente("A") ); font ofontL color mcolorAA,mcolorAB pixel //oanft:disable() oadfn:disable() oatpd:disable() oandl:disable() oacep:disable() oaend:disable() oabai:disable() oacid:disable() oaest:disable() endif SalvaVar := oanrs:cText if empty(oanrs:cText) &mlistbox:reset() &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") aadd(mRec,"00000") cQuery := "select acdc,anrs,andn,apfj from r20000000 where "+; "substr(anrs,1"+","+alltrim(str(len(alltrim(oanrs:cText))))+")"+; " = " + "'"+alltrim(oanrs:cText)+"'" + " " +; "order by anrs asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acdc')) b = oQuery:Fieldget(oQuery:Fieldpos('anrs')) c = oQuery:Fieldget(oQuery:Fieldpos('andn')) d = oQuery:Fieldget(oQuery:Fieldpos('apfj')) if !empty(a) &mlistbox:add(strzero(a,5) + " |" + substr(alltrim(,1,40) + space(40 -len(alltrim()) + "|" + iif(d="F",transform(c,"@r 999.999.999-99"),transform(c,"@r 99.999.999/9999-99"))) aadd(mRec,strzero(a,5)) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() ***-----------------( foco na cidade do clientes )------------------*** elseif oacid:lFocused() if SalvaVar <> oacid:cText if nn = 1 nn = 2 @ 170,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 300,115 On DblClick( alteracliente("B") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oacid:cText if empty(oacid:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select acid,aest from r20000000 where "+; "substr(acid,1"+","+alltrim(str(len(alltrim(oacid:cText))))+")"+; " = " + "'"+alltrim(oacid:cText)+"'" + " " +; "order by acid asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acid')) b = oQuery:Fieldget(oQuery:Fieldpos('aest')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oaccr:lFocused() if SalvaVar <> oaccr:cText if nn = 1 nn = 2 @ 050,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("C") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oaccr:cText if empty(oaccr:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select accr,aufc from r20000000 where "+; "substr(accr,1"+","+alltrim(str(len(alltrim(oaccr:cText))))+")"+; " = " + "'"+alltrim(oaccr:cText)+"'" + " " +; "order by accr asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('accr')) b = oQuery:Fieldget(oQuery:Fieldpos('aufc')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oapcp:lFocused() if SalvaVar <> oapcp:cText if nn = 1 nn = 2 @ 071,121 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("D") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oapcp:cText if empty(oapcp:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select apcp,aufp from r20000000 where "+; "substr(apcp,1"+","+alltrim(str(len(alltrim(oapcp:cText))))+")"+; " = " + "'"+alltrim(oapcp:cText)+"'" + " " +; "order by apcp asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('apcp')) b = oQuery:Fieldget(oQuery:Fieldpos('aufp')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if oanft:lFocused() //oanft:enable() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() oanft:setfocus() oanft:gotfocus() nn = 1 elseif oandn:lFocused() .or. oaddv:lFocused() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() nn = 1 elseif oaest:lFocused() &mlistbox:end() oaest:setfocus() oaest:gotfocus() nn = 1 elseif oaufc:lFocused() &mlistbox:end() oaufc:setfocus() oaufc:gotfocus() nn = 1 elseif oaufp:lFocused() &mlistbox:end() oaufp:setfocus() oaufp:gotfocus() nn = 1 elseif oaest:lFocused() .or. oabai:lFocused() .or.; oacep:lFocused() .or. oaend:lFocused() .or.; oadfn:lFocused() .or. oatpd:lFocused() .or.; oandl:lFocused() .or. oabcb:lFocused() .or.; oatf1:lFocused() .or. oatf2:lFocused() .or.; oatfx:lFocused() .or. oaeml:lFocused() .or.; oapct:lFocused() .or. oadtc:lFocused() .or.; oadta:lFocused() .or. oaccb:lFocused() .or.; oaecb:lFocused() .or. oapcp:lFocused() .or.; oavpr:lFocused() .or. oalmc:lFocused() &mlistbox:end() nn = 1 //elseif Valtype(&mlistbox) = "O" // &mlistbox:end() // nn = 1 endif endif endif return nil function alteracliente(objet) nobjet = objet if len(mrec) != 0 if mrec[olbx] != "00000" if nobjet = "A" if !empty(val(mrec[olbx])) macdc = val(mrec[olbx]) cQuery := "select * from r20000000 where "+; "acdc = " + alltrim(str(macdc)) + " order by acdc" oQuery := oServer:Query(cQuery) oLbx:end() concluialtera() SalvaVar := "A" nn = 1 oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() Keyboard( chr(9) ) endif elseif nobjet = "B" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oacid:ctext := substr(mtipo,1,30) oaest:ctext := substr(mtipo,33,2) oaest:setfocus() oaest:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "C" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oaccr:ctext := substr(mtipo,1,30) oaufc:ctext := substr(mtipo,33,2) oaufc:setfocus() oaufc:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "D" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oapcp:ctext := substr(mtipo,1,30) oaufp:ctext := substr(mtipo,33,2) oaufp:setfocus() oaufp:gotfocus() Keyboard( chr(9) ) endif endif endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  8. Ola a todos,, Não sei se será de interesse, mas ... Estou utilizando a contrib do xharbour pgsql, para acessar bases de dados no POSTGRESQL, utilizando a lib gerada na compilação do xharbour a partir da pasta \xharbour\contrib\pgsql,, a biblioteca libhbpg.lib e utilizando a biblioteca após a instalação do postgresql a libpq.lib, que tem que ser convertida para a borland, pois ela vem na instalação do postgresql para microsoft visual C,, para converter utiliza-se o: implib -a libpq.lib libpq.dll,,, o implib da propra borland... OBS.. GOSTARIA DE SABER, SE ALGUEM MAIS UTILIZA ESTE TIPO DE ACESSO,, POIS GOSTARIA DE TROCAR INFORMAÇÕES,, QUE ME FALTAM... SE POSSÃVEL É CLARO.., COM ACESSO A PARTIR DA CONTRIB DO XHARBOUR.. Segue um exemplo abaixo... Para abrir a base de dados.. utilizo.. o seguinte... ..// oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif ..\\ ***-----( Exemplo que contém inclusão,alteração,exclusão e pesquisa com comando em SQL.... #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "Folder.ch" #include "report.ch" #Define CLR_VERMELHO nRGB( 255, 000, 000 ) //--> Vermelho Para a Letra #Define CLR_BlACK nRGB( 000, 000, 000 ) //--> PRETO // a funcao encheclifor(), esta no arquivo funcoes.prg function cr101000() private oandn,mandn,cTipo,oGet private SalvaVar := "A" private otim, oLbx nn = 1 DEFINE BRUSH oBrush COLOR rgb(255,239,214) define dialog atuclientes title "Clientes" from 010,010 to 438,700 pixel brush oBrush TRANSPARENT define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 @ 0,0 FOLDER oFld OF atuclientes prompt "&1. Dados", "&2. Comercial", "&3. Dados Pessoais","&4. Observações ","&5. Local de Entrega"; DIALOGS "PageDados","PageComercial","PagePessoal","PageObs","PageEntrega"; TABCOLOR CLR_BlACK; FOCUSCOLOR CLR_BLUE; size 295, 215; COLORS mcolorAA, mcolorAB; ADJUST oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oFld:Show() oFld:lWin95Look := .T. //-> Modifica o Estilo da Orelha. macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad := 1 mandn := space(14) manrs := space(50) manft := space(20) mativ := 1 madfn := ctod("") maend := space(50) macep := space(08) mabai := space(30) macid := space(30) maest := space(02) matf1 := space(10) matf2 := space(10) matfx := space(10) maeml := space(50) matpd := "Cedula de Identidade" mandl := space(18) madtc := date() madta := ctod("") macsn := .f. maccb := space(08) maecb := space(50) mabcb := space(30) maccr := space(30) maufc := space(02) mapct := space(30) mapcp := space(30) maufp := space(02) mavpr := space(02) marpf := space(03) && falta pegar da tabela de vendedores. malmc := 0 meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n menat := space(30) mencj := space(40) mepai := space(40) memae := space(40) meemt := space(40) metlf := space(10) meend := space(50) mefun := space(30) mesal := 0 merc1 := space(40) merc2 := space(40) merc3 := space(40) medtc := ctod("") mespc := space(40) maddv := ctod("") maobs := "" lttal := "" attal := "" larray := {} marray := {} aadd(marray," Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") mslcl = space(50) && local de entrega msend = space(50) && endere‡o de entrega msbai = space(30) && bairro de entrega mscep = space(08) && cep de entrega mscid = space(30) && cidade de entrega msest = space(02) mstel = space(10) && telefone de entrega mspct = space(30) && pessoa de contato msobs = "" && observa‡ao.. nVerCidade := "S" && faz parte da funcao geracidades() ***---------------( Informacoes da 1§ guia ) ---------------*** @ 3.5,000 RADIO orad VAR mrad OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,01, '&Fisica', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 030, '&Juridica', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) @ 05.5, 070 say "&CPF/CNPJ" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 100 get oandn var mandn picture "@r 999.999.999-99" valid ( pescnpjcpf(@mandn) == .t. ) font mtahoma size 060,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mrad = 1,VerificaCNPJCPF("F",oandn,@mandn,.t.),VerificaCNPJCPF("J",oandn,@mandn,.t.)) @ 3.5,165 RADIO oativ VAR mativ OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,165, '&Ativo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oativ, , , , , .F., , ; 20, 10, , .F., .T. ) oativ:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 190, '&Inativo', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oativ, , , , , .F., , ; 25, 10, , .F., .T. ) oativ:AddRadio( oRadio ) @ 05.5, 225 say "Inativado em" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 260 get oaddv var maddv font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mativ = 1,.f.,.t.) @ 25.5, 002 say "&Nome/Razão Social" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oanrs var manrs picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "F&antasia" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oanft var manft picture "@!" font mtahoma size 80,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 143 say "&Dt.Fundação/Nasc." of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 192 get oadfn var madfn font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Tipo de documento" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 060 combobox oatpd var matpd items {"Isento","Inscricao Estadual","Inscricao Municipal","Cedula de Identidade","Produtor Rural","Outros"} font mtahoma size 65,60 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 132 say "Nú&mero" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 152 get oandl var mandl picture "@!" font mtahoma size 68,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(matpd = "Isento",.f.,.t.) @ 65.5, 002 say "C&ep" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oacep var macep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 65.5, 100 say "&Endereço" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 128 get oaend var maend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "&Bairro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oabai var mabai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 160 say "C&idade" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 180 get oacid var macid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 075, 276 get oaest var maest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "Te&lefones" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oatf1 var matf1 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 095, 110 get oatf2 var matf2 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 160 say "Fa&x" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 180 get oatfx var matfx picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "E-mai&l" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 105, 060 get oaeml var maeml picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 115.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 115, 060 get oapct var mapct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 002 say "Dt. Cada&stro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 060 get oadtc var madtc font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 095 say "Dt.última alteração" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 145 get oadta var madta font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 134, 184 checkbox oacsn var macsn prompt "&Correntista"; font mtahoma colors mcolorAA,mcolorAB size 34, 11 of oFld:aDialogs[1] pixel @ 150,002 listbox oLax VAR attal items marray of oFld:aDialogs[1] Size 285,50; font ofontL color mcolorAA,mcolorAB pixel ***---------------( Informacoes da 2§ guia ) ---------------*** @ 05.5, 002 say "&Cep de Cobrança" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oaccb var maccb picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 05.5, 100 say "&Endereço" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 128 get oaecb var maecb picture "@!" font mtahoma size 160,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Bairro" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oabcb var mabcb picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 160 say "C&idade" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 180 get oaccr var maccr picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 015, 276 get oaufc var maufc picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Praça Pagto" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oapcp var mapcp picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 025, 156 get oaufp var maufp picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "&Vencimento Peferencial" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oavpr var mavpr picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Representante" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 55.5, 002 say "&Limite de Crédito" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oalmc var malmc picture "@e 999,999.99" font mtahoma size 040,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 3§ guia ) ---------------*** @ 005.5, 002 say "&Estado Civil" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 combobox oeecv var meecv items {"Solteiro(a)","Casado(a)","Divorciado(a)","Viuvo(a)","Outros"} font mtahoma size 65,60 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 015.5, 002 say "&Natural" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oenat var menat picture "@!" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "Nome do &Cônjuge" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oencj var mencj picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "Nome do &Pai" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oepai var mepai picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "Nome do &Mãe" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get oemae var memae picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 55.5, 002 say "Empresa que &Trabalha" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oeemt var meemt picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 65.5, 002 say "Te&lefone Comercial" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oetlf var metlf picture "@r (99)9999-9999" font mtahoma size 40,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "Ende&reço" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oeend var meend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 85.5, 002 say "&Função ( Cargo )" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 085, 060 get oefun var mefun picture "@!" font mtahoma size 76,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "&Salário" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oesal var mesal picture "@e 999,999.99" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "Referênci&as Comerciais" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 0115, 060 get oerc1 var merc1 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0125, 060 get oerc2 var merc2 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0135, 060 get oerc3 var merc3 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 145.5, 002 say "Data consulta SPC" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 145, 060 get oedtc var medtc font mtahoma size 28,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 155.5, 002 say "Informação" of ofld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 155, 060 get oespc var mespc picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 4§ guia ) ---------------*** @ 005, 02 get oaobs VAR maobs MEMO SIZE 285,150 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[4] ***---------------( Informacoes da 5§ guia ) ---------------*** @ 05.5, 002 say "&Local" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oslcl var mslcl picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Cep de Entrega" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 15, 060 get oscep var mscep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 100 say "&Endereço" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 128 get osend var msend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Bairro" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get osbai var msbai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 160 say "C&idade" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 180 get oscid var mscid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 025, 276 get osest var msest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 035.5, 002 say "&Telefone" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get ostel var mstel picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 045.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get ospct var mspct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 065, 002 get osobs VAR msobs MEMO SIZE 285,100 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[5] @ 185,002 BUTTON oentbut1 prompt "&Gravar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,044 BUTTON oentbut2 prompt "&Alterar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,086 BUTTON oentbut3 prompt "&Excluir" size 040,12 font oFont OF oFld:aDialogs[5] pixel oFld:aDialogs[1]:bPainted := { || FillWnd ( oFld:aDialogs[1], mcolorAB,"",5 ) } oFld:aDialogs[2]:bPainted := { || FillWnd ( oFld:aDialogs[2], mcolorAB,"",5 ) } oFld:aDialogs[3]:bPainted := { || FillWnd ( oFld:aDialogs[3], mcolorAB,"",5 ) } oFld:aDialogs[4]:bPainted := { || FillWnd ( oFld:aDialogs[4], mcolorAB,"",5 ) } oFld:aDialogs[5]:bPainted := { || FillWnd ( oFld:aDialogs[5], mcolorAB,"",5 ) } @ 015,300 BUTTON oclibut1 prompt "&Gravar" size 040,12 font oFont OF atuClientes pixel action ( gravaClientes("C") ) @ 030,300 BUTTON oclibut2 prompt "&Alterar" size 040,12 font oFont OF atuClientes pixel action ( GravaClientes("A") ) @ 045,300 BUTTON oclibut3 prompt "&Excluir" size 040,12 font oFont OF atuClientes pixel action ( excluiclientes() ) @ 060,300 BUTTON oclibut5 prompt "&Novo" size 040,12 font oFont OF atuClientes pixel action ( limpavariaveis() ) @ 095,300 BUTTON oclibut6 prompt "&Sair" size 040,12 font oFont OF atuClientes pixel action ( atuClientes:end() ) //@ 110,300 BUTTON oclibut4 prompt "&Imprimir" size 040,12 font oFont OF atuClientes pixel action ( ImprimeClientes() ) oclibut2:disable() oclibut3:disable() activate dialog atuclientes center on init consultaCliente( "oLbx") otim:end() return nil function GeraCidades() if nVercidade = "S" if !empty(macid) .and. !empty(maest) if empty(maccr) oaccr:ctext := macid oaufc:ctext := maest endif if empty(mapcp) oapcp:ctext := macid oaufc:ctext := maest endif endif endif return nil function excluiclientes() if macdc != 0 if msgyesno("Confirma a exclusao deste cliente ?") == .t. cQuery := "delete from r20000000 where "+; "acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() limpavariaveis() endif endif return nil function pescnpjcpf(cdocu) ww = .t. if !empty(cdocu) if mrad = 1 && CPF // ww = ver_cpf(cdocu) matpd := "Cedula de Identidade" elseif mrad = 2 && CNPJ // ww = ver_cgc(cdocu) matpd := "Inscricao Estadual" endif oatpd:refresh() cQuery := "select * from r20000000 where "+; "andn = " + cdocu + " order by andn" oQuery := oServer:Query(cQuery) if oQuery[11] = 1 macdc = oQuery:Fieldget(oQuery:Fieldpos('acdc')) concluialtera() else oQuery:destroy() endif endif return(ww) function concluialtera() a = oQuery:Fieldget(oQuery:Fieldpos('apfj')) mrad := iif(a="F",1,2) orad:refresh() mandn := oQuery:Fieldget(oQuery:Fieldpos('andn')) oandn:ctext := mandn manrs := oQuery:Fieldget(oQuery:Fieldpos('anrs')) oanrs:ctext := manrs manft := oQuery:Fieldget(oQuery:Fieldpos('anft')) oanft:ctext := manft mativ := iif(oQuery:Fieldget(oQuery:Fieldpos('aatv')) = .t.,1,2) oativ:refresh() madfn := oQuery:Fieldget(oQuery:Fieldpos('adfn')) oadfn:ctext := madfn maend := oQuery:Fieldget(oQuery:Fieldpos('aend')) oaend:ctext := maend macep := oQuery:Fieldget(oQuery:Fieldpos('acep')) oacep:ctext := macep mabai := oQuery:Fieldget(oQuery:Fieldpos('abai')) oabai:ctext := mabai macid := oQuery:Fieldget(oQuery:Fieldpos('acid')) oacid:ctext := macid maest := oQuery:Fieldget(oQuery:Fieldpos('aest')) oaest:ctext := maest matf1 := oQuery:Fieldget(oQuery:Fieldpos('atf1')) oatf1:ctext := matf1 matf2 := oQuery:Fieldget(oQuery:Fieldpos('atf2')) oatf2:ctext := matf2 matfx := oQuery:Fieldget(oQuery:Fieldpos('atfx')) oatfx:ctext := matfx maeml := oQuery:Fieldget(oQuery:Fieldpos('aeml')) oaeml:ctext := maeml natdl = oQuery:Fieldget(oQuery:Fieldpos('atdl')) if natdl = 1 matpd = "Isento" elseif natdl = 2 matpd ="Inscricao Estadual" elseif natdl = 3 matpd ="Inscricao Municipal" elseif natdl = 4 matpd ="Cedula de Identidade" elseif natdl = 5 matpd ="Produtor Rural" elseif natdl = 6 matpd ="Outros" endif oatpd:refresh() mandl := oQuery:Fieldget(oQuery:Fieldpos('andl')) oandl:ctext := mandl madtc := oQuery:Fieldget(oQuery:Fieldpos('adtc')) oadtc:ctext := madtc madta := oQuery:Fieldget(oQuery:Fieldpos('adta')) oadta:ctext := madta macsn := oQuery:Fieldget(oQuery:Fieldpos('acsn')) oacsn:refresh() maccb := oQuery:Fieldget(oQuery:Fieldpos('accb')) oaccb:ctext := maccb maecb := oQuery:Fieldget(oQuery:Fieldpos('aecb')) oaecb:ctext := maecb mabcb := oQuery:Fieldget(oQuery:Fieldpos('abcb')) oabcb:ctext := mabcb maccr := oQuery:Fieldget(oQuery:Fieldpos('accr')) oaccr:ctext := maccr maufc := oQuery:Fieldget(oQuery:Fieldpos('aufc')) oaufc:ctext := maufc mapct := oQuery:Fieldget(oQuery:Fieldpos('apct')) oapct:ctext := mapct mapcp := oQuery:Fieldget(oQuery:Fieldpos('apcp')) oapcp:ctext := mapcp maufp := oQuery:Fieldget(oQuery:Fieldpos('aufp')) oaufp:ctext := maufp mavpr := oQuery:Fieldget(oQuery:Fieldpos('avpr')) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := oQuery:Fieldget(oQuery:Fieldpos('almc')) oalmc:ctext := malmc maddv := oQuery:Fieldget(oQuery:Fieldpos('addv')) oaddv:ctext := maddv maobs := oQuery:Fieldget(oQuery:Fieldpos('aobs')) oaobs:refresh() oQuery:destroy() cQuery := "select * from r20400000 where "+; "ecdc = " + alltrim(str(macdc)) + " order by ecdc" oQuery := oServer:Query(cQuery) neecv := oQuery:Fieldget(oQuery:Fieldpos('eecv')) if neecv = 1 meecv = "Solteiro(a)" elseif neecv = 2 meecv = "Casado(a)" elseif neecv = 3 meecv = "Divorciado(a)" elseif neecv = 4 meecv = "Viuvo(a)" elseif neecv = 5 meecv = "Outros" endif oeecv:refresh() menat := oQuery:Fieldget(oQuery:Fieldpos('enat')) oenat:ctext := menat mencj := oQuery:Fieldget(oQuery:Fieldpos('encj')) oencj:ctext := mencj mepai := oQuery:Fieldget(oQuery:Fieldpos('epai')) oepai:ctext := mepai memae := oQuery:Fieldget(oQuery:Fieldpos('emae')) oemae:ctext := memae meemt := oQuery:Fieldget(oQuery:Fieldpos('eemt')) oeemt:ctext := meemt metlf := oQuery:Fieldget(oQuery:Fieldpos('etlf')) oetlf:ctext := metlf meend := oQuery:Fieldget(oQuery:Fieldpos('eend')) oeend:ctext := meend mefun := oQuery:Fieldget(oQuery:Fieldpos('efun')) oefun:ctext := mefun mesal := oQuery:Fieldget(oQuery:Fieldpos('esal')) oesal:ctext := mesal merc1 := oQuery:Fieldget(oQuery:Fieldpos('erc1')) oerc1:ctext := merc1 merc2 := oQuery:Fieldget(oQuery:Fieldpos('erc2')) oerc2:ctext := merc2 merc3 := oQuery:Fieldget(oQuery:Fieldpos('erc3')) oerc3:ctext := merc3 medtc := oQuery:Fieldget(oQuery:Fieldpos('edtc')) oedtc:ctext := medtc mespc := oQuery:Fieldget(oQuery:Fieldpos('espc')) oespc:ctext := mespc oQuery:destroy() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oclibut1:disable() nVerCidade := "N" oclibut2:enable() oclibut3:enable() VerificaCNPJCPF(upper(a),oandn,@mandn,.t.) //if GetKeyState(VK_RETURN) // Keyboard( chr(9) ) //endif oanft:setfocus() oanft:gotfocus() encheclifor("R") return nil function VerificaCNPJCPF(cTipo,oGet,cCgc,nTf) if cTipo = "F" If oget:cPicture!="@R 999.999.999-99" //cCgc:=Space(11) oget:cPicture:="@R 999.999.999-99" oget:oget:Picture:="@R 999.999.999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() elseif cTipo = "J" If oget:cPicture!="@R 99.999.999/9999-99" //cCgc:=Space(14) oget:cPicture:="@R 99.999.999/9999-99" oget:oget:Picture:="@R 99.999.999/9999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .F.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() endif return .t. function gravaclientes(objet) nobjet = objet ***-------------------------------( 1§ guia )-----------------------*** if empty(mandn) msgstop("E necessario informar o " + iif(mrad = 1,"CPF.","CNPJ."),"ATENCAO") oFld:SetOption(1) oandn:setfocus() oandn:gotfocus() return nil endif if empty(manrs) msgstop("E necessario informar o Nome/Razao Social","ATENCAO") oFld:SetOption(1) oanrs:setfocus() oanrs:gotfocus() return nil endif if empty(macep) msgstop("E necessario informar o CEP.","ATENCAO") oFld:SetOption(1) oacep:setfocus() oacep:gotfocus() return nil endif if empty(maend) msgstop("E necessario informar o ENDERECO.","ATENCAO") oFld:SetOption(1) oaend:setfocus() oaend:gotfocus() return nil endif if empty(mabai) msgstop("E necessario informar o BAIRRO.","ATENCAO") oFld:SetOption(1) oabai:setfocus() oabai:gotfocus() return nil endif if empty(macid) msgstop("E necessario informar a CIDADE.","ATENCAO") oFld:SetOption(1) oacid:setfocus() oacid:gotfocus() return nil endif if empty(maest) msgstop("E necessario informar o ESTADO.","ATENCAO") oFld:SetOption(1) oaest:setfocus() oaest:gotfocus() return nil endif ***-------------------------------( 2§ guia )-----------------------*** if empty(maccb) msgstop("E necessario informar o CEP DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccb:setfocus() oaccb:gotfocus() return nil endif if empty(maecb) msgstop("E necessario informar o ENDERECO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaecb:setfocus() oaecb:gotfocus() return nil endif if empty(mabcb) msgstop("E necessario informar o BAIRRO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oabcb:setfocus() oabcb:gotfocus() return nil endif if empty(maccr) msgstop("E necessario informar a CIDADE DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccr:setfocus() oaccr:gotfocus() return nil endif if empty(maufc) msgstop("E necessario informar o ESTADO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaufc:setfocus() oaufc:gotfocus() return nil endif if nobjet = "C" * Obs. as datas estao no padrao AAAA-MM-DD naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif ***--------------( Realiza a inclusao de clientes )--------------*** cQuery := "insert into r20000000(anrs,anft,aatv,addv,adfn,aend,abai,acep,"+; "acid,aest,adtc,adta,apfj,andn,atdl,andl,aeml,atf1,atf2,"+; "atfx,apct,acsn,avpr,aecb,abcb,accb,accr,aufc,apcp,"+; "aufp,arpf,almc,aobs)" cQuery += "values("+"'"+manrs+"'"+","+"'"+manft+"'"+","+"'"+; iif(mativ=1,"y","n")+"'"+","+"'"+naddv+"'"+","+; "'"+nadfn+"'"+","+"'"+maend+"'"+","+"'"+mabai+"'"+","+; "'"+macep+"'"+","+"'"+macid+"'"+","+"'"+maest+"'"+","+; "'"+nadtc+"'"+","+"'"+nadta+"'"+","+; "'"+iif(mrad=1,"F","J")+"'"+","+; "'"+mandn+"'"+","+natdl+","+"'"+mandl+"'"+","+; "'"+maeml+"'"+","+"'"+matf1+"'"+","+"'"+matf2+"'"+","+; "'"+matfx+"'"+","+"'"+mapct+"'"+","+; "'"+iif(macsn=.t.,"y","n")+"'"+","+"'"+mavpr+"'"+","+; "'"+maecb+"'"+","+"'"+mabcb+"'"+","+"'"+maccb+"'"+","+; "'"+maccr+"'"+","+"'"+maufc+"'"+","+"'"+mapcp+"'"+","+; "'"+maufp+"'"+","+"'"+marpf+"'"+","+str(malmc)+","+; "'"+maobs+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 ***---( Pega o ultimo numero sequencial do cadastro de clientes)----*** if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "select * from r20000000_acdc_seq;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() mecdc = oQuery:Fieldget(2) oQuery:Skip() END oQuery:destroy() cQuery := "insert into r20400000(ecdc,eecv,encj,enat,epai,emae,"+; "eemt,etlf,eend,efun,esal,erc1,erc2,erc3,edtc,espc)" cQuery += "values("+str(mecdc)+","+neecv+","+"'"+mencj+"'"+","+; "'"+menat+"'"+","+"'"+mepai+"'"+","+"'"+memae+"'"+","+; "'"+meemt+"'"+","+"'"+metlf+"'"+","+"'"+meend+"'"+","+; "'"+mefun+"'"+","+str(mesal)+","+"'"+merc1+"'"+","+; "'"+merc2+"'"+","+"'"+merc3+"'"+","+"'"+nedtc+"'"+","+; "'"+mespc+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de dados pessoais do cliente.","ATENCAO") // ? oQuery:error() endif oQuery:destroy() oServer:Commit() endif elseif nobjet = "A" naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif cQuery := "Update r20000000 set "+; "anrs = " + "'"+manrs+"'"+","+; "anft = " + "'"+manft+"'"+","+; "aatv = " + "'"+iif(mativ=1,"y","n")+"'"+","+; "addv = " + "'"+naddv+"'"+","+; "adfn = " + "'"+nadfn+"'"+","+; "aend = " + "'"+maend+"'"+","+; "abai = " + "'"+mabai+"'"+","+; "acep = " + "'"+macep+"'"+","+; "acid = " + "'"+macid+"'"+","+; "aest = " + "'"+maest+"'"+","+; "adtc = " + "'"+nadtc+"'"+","+; "adta = " + "'"+nadta+"'"+","+; "apfj = " + "'"+iif(mrad=1,"F","J")+"'"+","+; "andn = " + "'"+mandn+"'"+","+; "atdl = " + natdl+","+; "andl = " + "'"+mandl+"'"+","+; "aeml = " + "'"+maeml+"'"+","+; "atf1 = " + "'"+matf1+"'"+","+; "atf2 = " + "'"+matf2+"'"+","+; "atfx = " + "'"+matfx+"'"+","+; "apct = " + "'"+mapct+"'"+","+; "acsn = " + "'"+iif(macsn=.t.,"y","n")+"'"+","+; "avpr = " + "'"+mavpr+"'"+","+; "aecb = " + "'"+maecb+"'"+","+; "abcb = " + "'"+mabcb+"'"+","+; "accb = " + "'"+maccb+"'"+","+; "accr = " + "'"+maccr+"'"+","+; "aufc = " + "'"+maufc+"'"+","+; "apcp = " + "'"+mapcp+"'"+","+; "aufp = " + "'"+maufp+"'"+","+; "arpf = " + "'"+marpf+"'"+","+; "almc = " + str(malmc)+","+; "aobs = " + "'"+maobs+"'"+; " where " + " acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "Update r20400000 set "+; "eecv = " + neecv+","+; "encj = " + "'"+mencj+"'"+","+; "enat = " + "'"+menat+"'"+","+; "epai = " + "'"+mepai+"'"+","+; "emae = " + "'"+memae+"'"+","+; "eemt = " + "'"+meemt+"'"+","+; "etlf = " + "'"+metlf+"'"+","+; "eend = " + "'"+meend+"'"+","+; "efun = " + "'"+mefun+"'"+","+; "esal = " + str(mesal)+","+; "erc1 = " + "'"+merc1+"'"+","+; "erc2 = " + "'"+merc2+"'"+","+; "erc3 = " + "'"+merc3+"'"+","+; "edtc = " + "'"+nedtc+"'"+","+; "espc = " + "'"+mespc+"'"+; " where " + " ecdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() endif endif ***-----------( Fun‡Æo que lima as variaveis do sistema )-----------*** limpavariaveis() return nil function limpavariaveis() macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad = 1 orad:refresh() mandn := space(14) oandn:ctext := mandn manrs := space(50) oanrs:ctext := manrs manft := space(20) oanft:ctext := manft mativ = 1 oativ:refresh() madfn := ctod("") oadfn:ctext := madfn maend := space(50) oaend:ctext := maend macep := space(08) oacep:ctext := macep mabai := space(30) oabai:ctext := mabai macid := space(30) oacid:ctext := macid maest := space(02) oaest:ctext := maest matf1 := space(10) oatf1:ctext := matf1 matf2 := space(10) oatf2:ctext := matf2 matfx := space(10) oatfx:ctext := matfx maeml := space(50) oaeml:ctext := maeml matpd := "Cedula de Identidade" oatpd:refresh() mandl := space(18) oandl:ctext := mandl madtc := date() oadtc:ctext := madtc madta := ctod("") oadta:ctext := madta macsn := .f. oacsn:refresh() maccb := space(08) oaccb:ctext := maccb maecb := space(50) oaecb:ctext := maecb mabcb := space(30) oabcb:ctext := mabcb maccr := space(30) oaccr:ctext := maccr maufc := space(02) oaufc:ctext := maufc mapct := space(30) oapct:ctext := mapct mapcp := space(30) oapcp:ctext := mapcp maufp := space(02) oaufp:ctext := maufp mavpr := space(02) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := 0 oalmc:ctext := malmc meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n oeecv:refresh() menat := space(30) oenat:ctext := menat mencj := space(40) oencj:ctext := mencj mepai := space(40) oepai:ctext := mepai memae := space(40) oemae:ctext := memae meemt := space(40) oeemt:ctext := meemt metlf := space(10) oetlf:ctext := metlf meend := space(50) oeend:ctext := meend mefun := space(30) oefun:ctext := mefun mesal := 0 oesal:ctext := mesal merc1 := space(40) oerc1:ctext := merc1 merc2 := space(40) oerc2:ctext := merc2 merc3 := space(40) oerc3:ctext := merc3 medtc := ctod("") oedtc:ctext := medtc mespc := space(40) oespc:ctext := mespc maddv := ctod("") oaddv:ctext := maddv maobs := "" oaobs:refresh() lttal := "" larray := {} olax:reset() olax:add(" Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") olax:refresh() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) VerificaCNPJCPF("F",oandn,@mandn,.t.) if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oandn:setfocus() oandn:gotfocus() oclibut1:enable() nVerCidade := "S" oclibut2:disable() oclibut3:disable() return nil ***--------------( funcao de pesquisa de clientes e cidades )---------------*** function consultacliente( mlistbox) define timer otim Interval 70 Action PesquisaCliente ( mlistbox ) //of &mdialog activate timer otim function pesquisacliente( mlistbox ) ***-----------------( Foco no nome/razao social ) ------------------*** if oanrs:lFocused() if SalvaVar <> oanrs:cText if nn = 1 nn = 2 @ 069,002 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 578,115 On DblClick( alteracliente("A") ); font ofontL color mcolorAA,mcolorAB pixel //oanft:disable() oadfn:disable() oatpd:disable() oandl:disable() oacep:disable() oaend:disable() oabai:disable() oacid:disable() oaest:disable() endif SalvaVar := oanrs:cText if empty(oanrs:cText) &mlistbox:reset() &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") aadd(mRec,"00000") cQuery := "select acdc,anrs,andn,apfj from r20000000 where "+; "substr(anrs,1"+","+alltrim(str(len(alltrim(oanrs:cText))))+")"+; " = " + "'"+alltrim(oanrs:cText)+"'" + " " +; "order by anrs asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acdc')) b = oQuery:Fieldget(oQuery:Fieldpos('anrs')) c = oQuery:Fieldget(oQuery:Fieldpos('andn')) d = oQuery:Fieldget(oQuery:Fieldpos('apfj')) if !empty(a) &mlistbox:add(strzero(a,5) + " |" + substr(alltrim(,1,40) + space(40 -len(alltrim()) + "|" + iif(d="F",transform(c,"@r 999.999.999-99"),transform(c,"@r 99.999.999/9999-99"))) aadd(mRec,strzero(a,5)) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() ***-----------------( foco na cidade do clientes )------------------*** elseif oacid:lFocused() if SalvaVar <> oacid:cText if nn = 1 nn = 2 @ 170,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 300,115 On DblClick( alteracliente("B") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oacid:cText if empty(oacid:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select acid,aest from r20000000 where "+; "substr(acid,1"+","+alltrim(str(len(alltrim(oacid:cText))))+")"+; " = " + "'"+alltrim(oacid:cText)+"'" + " " +; "order by acid asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acid')) b = oQuery:Fieldget(oQuery:Fieldpos('aest')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oaccr:lFocused() if SalvaVar <> oaccr:cText if nn = 1 nn = 2 @ 050,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("C") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oaccr:cText if empty(oaccr:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select accr,aufc from r20000000 where "+; "substr(accr,1"+","+alltrim(str(len(alltrim(oaccr:cText))))+")"+; " = " + "'"+alltrim(oaccr:cText)+"'" + " " +; "order by accr asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('accr')) b = oQuery:Fieldget(oQuery:Fieldpos('aufc')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oapcp:lFocused() if SalvaVar <> oapcp:cText if nn = 1 nn = 2 @ 071,121 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("D") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oapcp:cText if empty(oapcp:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select apcp,aufp from r20000000 where "+; "substr(apcp,1"+","+alltrim(str(len(alltrim(oapcp:cText))))+")"+; " = " + "'"+alltrim(oapcp:cText)+"'" + " " +; "order by apcp asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('apcp')) b = oQuery:Fieldget(oQuery:Fieldpos('aufp')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if oanft:lFocused() //oanft:enable() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() oanft:setfocus() oanft:gotfocus() nn = 1 elseif oandn:lFocused() .or. oaddv:lFocused() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() nn = 1 elseif oaest:lFocused() &mlistbox:end() oaest:setfocus() oaest:gotfocus() nn = 1 elseif oaufc:lFocused() &mlistbox:end() oaufc:setfocus() oaufc:gotfocus() nn = 1 elseif oaufp:lFocused() &mlistbox:end() oaufp:setfocus() oaufp:gotfocus() nn = 1 elseif oaest:lFocused() .or. oabai:lFocused() .or.; oacep:lFocused() .or. oaend:lFocused() .or.; oadfn:lFocused() .or. oatpd:lFocused() .or.; oandl:lFocused() .or. oabcb:lFocused() .or.; oatf1:lFocused() .or. oatf2:lFocused() .or.; oatfx:lFocused() .or. oaeml:lFocused() .or.; oapct:lFocused() .or. oadtc:lFocused() .or.; oadta:lFocused() .or. oaccb:lFocused() .or.; oaecb:lFocused() .or. oapcp:lFocused() .or.; oavpr:lFocused() .or. oalmc:lFocused() &mlistbox:end() nn = 1 //elseif Valtype(&mlistbox) = "O" // &mlistbox:end() // nn = 1 endif endif endif return nil function alteracliente(objet) nobjet = objet if len(mrec) != 0 if mrec[olbx] != "00000" if nobjet = "A" if !empty(val(mrec[olbx])) macdc = val(mrec[olbx]) cQuery := "select * from r20000000 where "+; "acdc = " + alltrim(str(macdc)) + " order by acdc" oQuery := oServer:Query(cQuery) oLbx:end() concluialtera() SalvaVar := "A" nn = 1 oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() Keyboard( chr(9) ) endif elseif nobjet = "B" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oacid:ctext := substr(mtipo,1,30) oaest:ctext := substr(mtipo,33,2) oaest:setfocus() oaest:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "C" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oaccr:ctext := substr(mtipo,1,30) oaufc:ctext := substr(mtipo,33,2) oaufc:setfocus() oaufc:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "D" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oapcp:ctext := substr(mtipo,1,30) oaufp:ctext := substr(mtipo,33,2) oaufp:setfocus() oaufp:gotfocus() Keyboard( chr(9) ) endif endif endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  9. Ola a todos,, Não sei se será de interesse, mas ... Estou utilizando a contrib do xharbour pgsql, para acessar bases de dados no POSTGRESQL, utilizando a lib gerada na compilação do xharbour a partir da pasta \xharbour\contrib\pgsql,, a biblioteca libhbpg.lib e utilizando a biblioteca após a instalação do postgresql a libpq.lib, que tem que ser convertida para a borland, pois ela vem na instalação do postgresql para microsoft visual C,, para converter utiliza-se o: implib -a libpq.lib libpq.dll,,, o implib da propra borland... OBS.. GOSTARIA DE SABER, SE ALGUEM MAIS UTILIZA ESTE TIPO DE ACESSO,, POIS GOSTARIA DE TROCAR INFORMAÇÕES,, QUE ME FALTAM... SE POSSÃVEL É CLARO.., COM ACESSO A PARTIR DA CONTRIB DO XHARBOUR.. Segue um exemplo abaixo... Para abrir a base de dados.. utilizo.. o seguinte... ..// oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif ..\\ ***-----( Exemplo que contém inclusão,alteração,exclusão e pesquisa com comando em SQL.... #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "Folder.ch" #include "report.ch" #Define CLR_VERMELHO nRGB( 255, 000, 000 ) //--> Vermelho Para a Letra #Define CLR_BlACK nRGB( 000, 000, 000 ) //--> PRETO // a funcao encheclifor(), esta no arquivo funcoes.prg function cr101000() private oandn,mandn,cTipo,oGet private SalvaVar := "A" private otim, oLbx nn = 1 DEFINE BRUSH oBrush COLOR rgb(255,239,214) define dialog atuclientes title "Clientes" from 010,010 to 438,700 pixel brush oBrush TRANSPARENT define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 @ 0,0 FOLDER oFld OF atuclientes prompt "&1. Dados", "&2. Comercial", "&3. Dados Pessoais","&4. Observações ","&5. Local de Entrega"; DIALOGS "PageDados","PageComercial","PagePessoal","PageObs","PageEntrega"; TABCOLOR CLR_BlACK; FOCUSCOLOR CLR_BLUE; size 295, 215; COLORS mcolorAA, mcolorAB; ADJUST oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oFld:Show() oFld:lWin95Look := .T. //-> Modifica o Estilo da Orelha. macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad := 1 mandn := space(14) manrs := space(50) manft := space(20) mativ := 1 madfn := ctod("") maend := space(50) macep := space(08) mabai := space(30) macid := space(30) maest := space(02) matf1 := space(10) matf2 := space(10) matfx := space(10) maeml := space(50) matpd := "Cedula de Identidade" mandl := space(18) madtc := date() madta := ctod("") macsn := .f. maccb := space(08) maecb := space(50) mabcb := space(30) maccr := space(30) maufc := space(02) mapct := space(30) mapcp := space(30) maufp := space(02) mavpr := space(02) marpf := space(03) && falta pegar da tabela de vendedores. malmc := 0 meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n menat := space(30) mencj := space(40) mepai := space(40) memae := space(40) meemt := space(40) metlf := space(10) meend := space(50) mefun := space(30) mesal := 0 merc1 := space(40) merc2 := space(40) merc3 := space(40) medtc := ctod("") mespc := space(40) maddv := ctod("") maobs := "" lttal := "" attal := "" larray := {} marray := {} aadd(marray," Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") mslcl = space(50) && local de entrega msend = space(50) && endere‡o de entrega msbai = space(30) && bairro de entrega mscep = space(08) && cep de entrega mscid = space(30) && cidade de entrega msest = space(02) mstel = space(10) && telefone de entrega mspct = space(30) && pessoa de contato msobs = "" && observa‡ao.. nVerCidade := "S" && faz parte da funcao geracidades() ***---------------( Informacoes da 1§ guia ) ---------------*** @ 3.5,000 RADIO orad VAR mrad OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,01, '&Fisica', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 030, '&Juridica', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) @ 05.5, 070 say "&CPF/CNPJ" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 100 get oandn var mandn picture "@r 999.999.999-99" valid ( pescnpjcpf(@mandn) == .t. ) font mtahoma size 060,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mrad = 1,VerificaCNPJCPF("F",oandn,@mandn,.t.),VerificaCNPJCPF("J",oandn,@mandn,.t.)) @ 3.5,165 RADIO oativ VAR mativ OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,165, '&Ativo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oativ, , , , , .F., , ; 20, 10, , .F., .T. ) oativ:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 190, '&Inativo', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oativ, , , , , .F., , ; 25, 10, , .F., .T. ) oativ:AddRadio( oRadio ) @ 05.5, 225 say "Inativado em" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 260 get oaddv var maddv font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mativ = 1,.f.,.t.) @ 25.5, 002 say "&Nome/Razão Social" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oanrs var manrs picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "F&antasia" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oanft var manft picture "@!" font mtahoma size 80,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 143 say "&Dt.Fundação/Nasc." of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 192 get oadfn var madfn font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Tipo de documento" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 060 combobox oatpd var matpd items {"Isento","Inscricao Estadual","Inscricao Municipal","Cedula de Identidade","Produtor Rural","Outros"} font mtahoma size 65,60 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 132 say "Nú&mero" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 152 get oandl var mandl picture "@!" font mtahoma size 68,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(matpd = "Isento",.f.,.t.) @ 65.5, 002 say "C&ep" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oacep var macep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 65.5, 100 say "&Endereço" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 128 get oaend var maend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "&Bairro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oabai var mabai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 160 say "C&idade" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 180 get oacid var macid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 075, 276 get oaest var maest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "Te&lefones" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oatf1 var matf1 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 095, 110 get oatf2 var matf2 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 160 say "Fa&x" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 180 get oatfx var matfx picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "E-mai&l" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 105, 060 get oaeml var maeml picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 115.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 115, 060 get oapct var mapct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 002 say "Dt. Cada&stro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 060 get oadtc var madtc font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 095 say "Dt.última alteração" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 145 get oadta var madta font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 134, 184 checkbox oacsn var macsn prompt "&Correntista"; font mtahoma colors mcolorAA,mcolorAB size 34, 11 of oFld:aDialogs[1] pixel @ 150,002 listbox oLax VAR attal items marray of oFld:aDialogs[1] Size 285,50; font ofontL color mcolorAA,mcolorAB pixel ***---------------( Informacoes da 2§ guia ) ---------------*** @ 05.5, 002 say "&Cep de Cobrança" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oaccb var maccb picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 05.5, 100 say "&Endereço" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 128 get oaecb var maecb picture "@!" font mtahoma size 160,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Bairro" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oabcb var mabcb picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 160 say "C&idade" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 180 get oaccr var maccr picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 015, 276 get oaufc var maufc picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Praça Pagto" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oapcp var mapcp picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 025, 156 get oaufp var maufp picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "&Vencimento Peferencial" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oavpr var mavpr picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Representante" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 55.5, 002 say "&Limite de Crédito" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oalmc var malmc picture "@e 999,999.99" font mtahoma size 040,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 3§ guia ) ---------------*** @ 005.5, 002 say "&Estado Civil" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 combobox oeecv var meecv items {"Solteiro(a)","Casado(a)","Divorciado(a)","Viuvo(a)","Outros"} font mtahoma size 65,60 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 015.5, 002 say "&Natural" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oenat var menat picture "@!" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "Nome do &Cônjuge" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oencj var mencj picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "Nome do &Pai" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oepai var mepai picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "Nome do &Mãe" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get oemae var memae picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 55.5, 002 say "Empresa que &Trabalha" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oeemt var meemt picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 65.5, 002 say "Te&lefone Comercial" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oetlf var metlf picture "@r (99)9999-9999" font mtahoma size 40,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "Ende&reço" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oeend var meend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 85.5, 002 say "&Função ( Cargo )" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 085, 060 get oefun var mefun picture "@!" font mtahoma size 76,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "&Salário" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oesal var mesal picture "@e 999,999.99" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "Referênci&as Comerciais" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 0115, 060 get oerc1 var merc1 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0125, 060 get oerc2 var merc2 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0135, 060 get oerc3 var merc3 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 145.5, 002 say "Data consulta SPC" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 145, 060 get oedtc var medtc font mtahoma size 28,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 155.5, 002 say "Informação" of ofld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 155, 060 get oespc var mespc picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 4§ guia ) ---------------*** @ 005, 02 get oaobs VAR maobs MEMO SIZE 285,150 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[4] ***---------------( Informacoes da 5§ guia ) ---------------*** @ 05.5, 002 say "&Local" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oslcl var mslcl picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Cep de Entrega" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 15, 060 get oscep var mscep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 100 say "&Endereço" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 128 get osend var msend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Bairro" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get osbai var msbai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 160 say "C&idade" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 180 get oscid var mscid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 025, 276 get osest var msest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 035.5, 002 say "&Telefone" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get ostel var mstel picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 045.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get ospct var mspct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 065, 002 get osobs VAR msobs MEMO SIZE 285,100 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[5] @ 185,002 BUTTON oentbut1 prompt "&Gravar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,044 BUTTON oentbut2 prompt "&Alterar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,086 BUTTON oentbut3 prompt "&Excluir" size 040,12 font oFont OF oFld:aDialogs[5] pixel oFld:aDialogs[1]:bPainted := { || FillWnd ( oFld:aDialogs[1], mcolorAB,"",5 ) } oFld:aDialogs[2]:bPainted := { || FillWnd ( oFld:aDialogs[2], mcolorAB,"",5 ) } oFld:aDialogs[3]:bPainted := { || FillWnd ( oFld:aDialogs[3], mcolorAB,"",5 ) } oFld:aDialogs[4]:bPainted := { || FillWnd ( oFld:aDialogs[4], mcolorAB,"",5 ) } oFld:aDialogs[5]:bPainted := { || FillWnd ( oFld:aDialogs[5], mcolorAB,"",5 ) } @ 015,300 BUTTON oclibut1 prompt "&Gravar" size 040,12 font oFont OF atuClientes pixel action ( gravaClientes("C") ) @ 030,300 BUTTON oclibut2 prompt "&Alterar" size 040,12 font oFont OF atuClientes pixel action ( GravaClientes("A") ) @ 045,300 BUTTON oclibut3 prompt "&Excluir" size 040,12 font oFont OF atuClientes pixel action ( excluiclientes() ) @ 060,300 BUTTON oclibut5 prompt "&Novo" size 040,12 font oFont OF atuClientes pixel action ( limpavariaveis() ) @ 095,300 BUTTON oclibut6 prompt "&Sair" size 040,12 font oFont OF atuClientes pixel action ( atuClientes:end() ) //@ 110,300 BUTTON oclibut4 prompt "&Imprimir" size 040,12 font oFont OF atuClientes pixel action ( ImprimeClientes() ) oclibut2:disable() oclibut3:disable() activate dialog atuclientes center on init consultaCliente( "oLbx") otim:end() return nil function GeraCidades() if nVercidade = "S" if !empty(macid) .and. !empty(maest) if empty(maccr) oaccr:ctext := macid oaufc:ctext := maest endif if empty(mapcp) oapcp:ctext := macid oaufc:ctext := maest endif endif endif return nil function excluiclientes() if macdc != 0 if msgyesno("Confirma a exclusao deste cliente ?") == .t. cQuery := "delete from r20000000 where "+; "acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() limpavariaveis() endif endif return nil function pescnpjcpf(cdocu) ww = .t. if !empty(cdocu) if mrad = 1 && CPF // ww = ver_cpf(cdocu) matpd := "Cedula de Identidade" elseif mrad = 2 && CNPJ // ww = ver_cgc(cdocu) matpd := "Inscricao Estadual" endif oatpd:refresh() cQuery := "select * from r20000000 where "+; "andn = " + cdocu + " order by andn" oQuery := oServer:Query(cQuery) if oQuery[11] = 1 macdc = oQuery:Fieldget(oQuery:Fieldpos('acdc')) concluialtera() else oQuery:destroy() endif endif return(ww) function concluialtera() a = oQuery:Fieldget(oQuery:Fieldpos('apfj')) mrad := iif(a="F",1,2) orad:refresh() mandn := oQuery:Fieldget(oQuery:Fieldpos('andn')) oandn:ctext := mandn manrs := oQuery:Fieldget(oQuery:Fieldpos('anrs')) oanrs:ctext := manrs manft := oQuery:Fieldget(oQuery:Fieldpos('anft')) oanft:ctext := manft mativ := iif(oQuery:Fieldget(oQuery:Fieldpos('aatv')) = .t.,1,2) oativ:refresh() madfn := oQuery:Fieldget(oQuery:Fieldpos('adfn')) oadfn:ctext := madfn maend := oQuery:Fieldget(oQuery:Fieldpos('aend')) oaend:ctext := maend macep := oQuery:Fieldget(oQuery:Fieldpos('acep')) oacep:ctext := macep mabai := oQuery:Fieldget(oQuery:Fieldpos('abai')) oabai:ctext := mabai macid := oQuery:Fieldget(oQuery:Fieldpos('acid')) oacid:ctext := macid maest := oQuery:Fieldget(oQuery:Fieldpos('aest')) oaest:ctext := maest matf1 := oQuery:Fieldget(oQuery:Fieldpos('atf1')) oatf1:ctext := matf1 matf2 := oQuery:Fieldget(oQuery:Fieldpos('atf2')) oatf2:ctext := matf2 matfx := oQuery:Fieldget(oQuery:Fieldpos('atfx')) oatfx:ctext := matfx maeml := oQuery:Fieldget(oQuery:Fieldpos('aeml')) oaeml:ctext := maeml natdl = oQuery:Fieldget(oQuery:Fieldpos('atdl')) if natdl = 1 matpd = "Isento" elseif natdl = 2 matpd ="Inscricao Estadual" elseif natdl = 3 matpd ="Inscricao Municipal" elseif natdl = 4 matpd ="Cedula de Identidade" elseif natdl = 5 matpd ="Produtor Rural" elseif natdl = 6 matpd ="Outros" endif oatpd:refresh() mandl := oQuery:Fieldget(oQuery:Fieldpos('andl')) oandl:ctext := mandl madtc := oQuery:Fieldget(oQuery:Fieldpos('adtc')) oadtc:ctext := madtc madta := oQuery:Fieldget(oQuery:Fieldpos('adta')) oadta:ctext := madta macsn := oQuery:Fieldget(oQuery:Fieldpos('acsn')) oacsn:refresh() maccb := oQuery:Fieldget(oQuery:Fieldpos('accb')) oaccb:ctext := maccb maecb := oQuery:Fieldget(oQuery:Fieldpos('aecb')) oaecb:ctext := maecb mabcb := oQuery:Fieldget(oQuery:Fieldpos('abcb')) oabcb:ctext := mabcb maccr := oQuery:Fieldget(oQuery:Fieldpos('accr')) oaccr:ctext := maccr maufc := oQuery:Fieldget(oQuery:Fieldpos('aufc')) oaufc:ctext := maufc mapct := oQuery:Fieldget(oQuery:Fieldpos('apct')) oapct:ctext := mapct mapcp := oQuery:Fieldget(oQuery:Fieldpos('apcp')) oapcp:ctext := mapcp maufp := oQuery:Fieldget(oQuery:Fieldpos('aufp')) oaufp:ctext := maufp mavpr := oQuery:Fieldget(oQuery:Fieldpos('avpr')) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := oQuery:Fieldget(oQuery:Fieldpos('almc')) oalmc:ctext := malmc maddv := oQuery:Fieldget(oQuery:Fieldpos('addv')) oaddv:ctext := maddv maobs := oQuery:Fieldget(oQuery:Fieldpos('aobs')) oaobs:refresh() oQuery:destroy() cQuery := "select * from r20400000 where "+; "ecdc = " + alltrim(str(macdc)) + " order by ecdc" oQuery := oServer:Query(cQuery) neecv := oQuery:Fieldget(oQuery:Fieldpos('eecv')) if neecv = 1 meecv = "Solteiro(a)" elseif neecv = 2 meecv = "Casado(a)" elseif neecv = 3 meecv = "Divorciado(a)" elseif neecv = 4 meecv = "Viuvo(a)" elseif neecv = 5 meecv = "Outros" endif oeecv:refresh() menat := oQuery:Fieldget(oQuery:Fieldpos('enat')) oenat:ctext := menat mencj := oQuery:Fieldget(oQuery:Fieldpos('encj')) oencj:ctext := mencj mepai := oQuery:Fieldget(oQuery:Fieldpos('epai')) oepai:ctext := mepai memae := oQuery:Fieldget(oQuery:Fieldpos('emae')) oemae:ctext := memae meemt := oQuery:Fieldget(oQuery:Fieldpos('eemt')) oeemt:ctext := meemt metlf := oQuery:Fieldget(oQuery:Fieldpos('etlf')) oetlf:ctext := metlf meend := oQuery:Fieldget(oQuery:Fieldpos('eend')) oeend:ctext := meend mefun := oQuery:Fieldget(oQuery:Fieldpos('efun')) oefun:ctext := mefun mesal := oQuery:Fieldget(oQuery:Fieldpos('esal')) oesal:ctext := mesal merc1 := oQuery:Fieldget(oQuery:Fieldpos('erc1')) oerc1:ctext := merc1 merc2 := oQuery:Fieldget(oQuery:Fieldpos('erc2')) oerc2:ctext := merc2 merc3 := oQuery:Fieldget(oQuery:Fieldpos('erc3')) oerc3:ctext := merc3 medtc := oQuery:Fieldget(oQuery:Fieldpos('edtc')) oedtc:ctext := medtc mespc := oQuery:Fieldget(oQuery:Fieldpos('espc')) oespc:ctext := mespc oQuery:destroy() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oclibut1:disable() nVerCidade := "N" oclibut2:enable() oclibut3:enable() VerificaCNPJCPF(upper(a),oandn,@mandn,.t.) //if GetKeyState(VK_RETURN) // Keyboard( chr(9) ) //endif oanft:setfocus() oanft:gotfocus() encheclifor("R") return nil function VerificaCNPJCPF(cTipo,oGet,cCgc,nTf) if cTipo = "F" If oget:cPicture!="@R 999.999.999-99" //cCgc:=Space(11) oget:cPicture:="@R 999.999.999-99" oget:oget:Picture:="@R 999.999.999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() elseif cTipo = "J" If oget:cPicture!="@R 99.999.999/9999-99" //cCgc:=Space(14) oget:cPicture:="@R 99.999.999/9999-99" oget:oget:Picture:="@R 99.999.999/9999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .F.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() endif return .t. function gravaclientes(objet) nobjet = objet ***-------------------------------( 1§ guia )-----------------------*** if empty(mandn) msgstop("E necessario informar o " + iif(mrad = 1,"CPF.","CNPJ."),"ATENCAO") oFld:SetOption(1) oandn:setfocus() oandn:gotfocus() return nil endif if empty(manrs) msgstop("E necessario informar o Nome/Razao Social","ATENCAO") oFld:SetOption(1) oanrs:setfocus() oanrs:gotfocus() return nil endif if empty(macep) msgstop("E necessario informar o CEP.","ATENCAO") oFld:SetOption(1) oacep:setfocus() oacep:gotfocus() return nil endif if empty(maend) msgstop("E necessario informar o ENDERECO.","ATENCAO") oFld:SetOption(1) oaend:setfocus() oaend:gotfocus() return nil endif if empty(mabai) msgstop("E necessario informar o BAIRRO.","ATENCAO") oFld:SetOption(1) oabai:setfocus() oabai:gotfocus() return nil endif if empty(macid) msgstop("E necessario informar a CIDADE.","ATENCAO") oFld:SetOption(1) oacid:setfocus() oacid:gotfocus() return nil endif if empty(maest) msgstop("E necessario informar o ESTADO.","ATENCAO") oFld:SetOption(1) oaest:setfocus() oaest:gotfocus() return nil endif ***-------------------------------( 2§ guia )-----------------------*** if empty(maccb) msgstop("E necessario informar o CEP DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccb:setfocus() oaccb:gotfocus() return nil endif if empty(maecb) msgstop("E necessario informar o ENDERECO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaecb:setfocus() oaecb:gotfocus() return nil endif if empty(mabcb) msgstop("E necessario informar o BAIRRO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oabcb:setfocus() oabcb:gotfocus() return nil endif if empty(maccr) msgstop("E necessario informar a CIDADE DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccr:setfocus() oaccr:gotfocus() return nil endif if empty(maufc) msgstop("E necessario informar o ESTADO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaufc:setfocus() oaufc:gotfocus() return nil endif if nobjet = "C" * Obs. as datas estao no padrao AAAA-MM-DD naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif ***--------------( Realiza a inclusao de clientes )--------------*** cQuery := "insert into r20000000(anrs,anft,aatv,addv,adfn,aend,abai,acep,"+; "acid,aest,adtc,adta,apfj,andn,atdl,andl,aeml,atf1,atf2,"+; "atfx,apct,acsn,avpr,aecb,abcb,accb,accr,aufc,apcp,"+; "aufp,arpf,almc,aobs)" cQuery += "values("+"'"+manrs+"'"+","+"'"+manft+"'"+","+"'"+; iif(mativ=1,"y","n")+"'"+","+"'"+naddv+"'"+","+; "'"+nadfn+"'"+","+"'"+maend+"'"+","+"'"+mabai+"'"+","+; "'"+macep+"'"+","+"'"+macid+"'"+","+"'"+maest+"'"+","+; "'"+nadtc+"'"+","+"'"+nadta+"'"+","+; "'"+iif(mrad=1,"F","J")+"'"+","+; "'"+mandn+"'"+","+natdl+","+"'"+mandl+"'"+","+; "'"+maeml+"'"+","+"'"+matf1+"'"+","+"'"+matf2+"'"+","+; "'"+matfx+"'"+","+"'"+mapct+"'"+","+; "'"+iif(macsn=.t.,"y","n")+"'"+","+"'"+mavpr+"'"+","+; "'"+maecb+"'"+","+"'"+mabcb+"'"+","+"'"+maccb+"'"+","+; "'"+maccr+"'"+","+"'"+maufc+"'"+","+"'"+mapcp+"'"+","+; "'"+maufp+"'"+","+"'"+marpf+"'"+","+str(malmc)+","+; "'"+maobs+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 ***---( Pega o ultimo numero sequencial do cadastro de clientes)----*** if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "select * from r20000000_acdc_seq;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() mecdc = oQuery:Fieldget(2) oQuery:Skip() END oQuery:destroy() cQuery := "insert into r20400000(ecdc,eecv,encj,enat,epai,emae,"+; "eemt,etlf,eend,efun,esal,erc1,erc2,erc3,edtc,espc)" cQuery += "values("+str(mecdc)+","+neecv+","+"'"+mencj+"'"+","+; "'"+menat+"'"+","+"'"+mepai+"'"+","+"'"+memae+"'"+","+; "'"+meemt+"'"+","+"'"+metlf+"'"+","+"'"+meend+"'"+","+; "'"+mefun+"'"+","+str(mesal)+","+"'"+merc1+"'"+","+; "'"+merc2+"'"+","+"'"+merc3+"'"+","+"'"+nedtc+"'"+","+; "'"+mespc+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de dados pessoais do cliente.","ATENCAO") // ? oQuery:error() endif oQuery:destroy() oServer:Commit() endif elseif nobjet = "A" naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif cQuery := "Update r20000000 set "+; "anrs = " + "'"+manrs+"'"+","+; "anft = " + "'"+manft+"'"+","+; "aatv = " + "'"+iif(mativ=1,"y","n")+"'"+","+; "addv = " + "'"+naddv+"'"+","+; "adfn = " + "'"+nadfn+"'"+","+; "aend = " + "'"+maend+"'"+","+; "abai = " + "'"+mabai+"'"+","+; "acep = " + "'"+macep+"'"+","+; "acid = " + "'"+macid+"'"+","+; "aest = " + "'"+maest+"'"+","+; "adtc = " + "'"+nadtc+"'"+","+; "adta = " + "'"+nadta+"'"+","+; "apfj = " + "'"+iif(mrad=1,"F","J")+"'"+","+; "andn = " + "'"+mandn+"'"+","+; "atdl = " + natdl+","+; "andl = " + "'"+mandl+"'"+","+; "aeml = " + "'"+maeml+"'"+","+; "atf1 = " + "'"+matf1+"'"+","+; "atf2 = " + "'"+matf2+"'"+","+; "atfx = " + "'"+matfx+"'"+","+; "apct = " + "'"+mapct+"'"+","+; "acsn = " + "'"+iif(macsn=.t.,"y","n")+"'"+","+; "avpr = " + "'"+mavpr+"'"+","+; "aecb = " + "'"+maecb+"'"+","+; "abcb = " + "'"+mabcb+"'"+","+; "accb = " + "'"+maccb+"'"+","+; "accr = " + "'"+maccr+"'"+","+; "aufc = " + "'"+maufc+"'"+","+; "apcp = " + "'"+mapcp+"'"+","+; "aufp = " + "'"+maufp+"'"+","+; "arpf = " + "'"+marpf+"'"+","+; "almc = " + str(malmc)+","+; "aobs = " + "'"+maobs+"'"+; " where " + " acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "Update r20400000 set "+; "eecv = " + neecv+","+; "encj = " + "'"+mencj+"'"+","+; "enat = " + "'"+menat+"'"+","+; "epai = " + "'"+mepai+"'"+","+; "emae = " + "'"+memae+"'"+","+; "eemt = " + "'"+meemt+"'"+","+; "etlf = " + "'"+metlf+"'"+","+; "eend = " + "'"+meend+"'"+","+; "efun = " + "'"+mefun+"'"+","+; "esal = " + str(mesal)+","+; "erc1 = " + "'"+merc1+"'"+","+; "erc2 = " + "'"+merc2+"'"+","+; "erc3 = " + "'"+merc3+"'"+","+; "edtc = " + "'"+nedtc+"'"+","+; "espc = " + "'"+mespc+"'"+; " where " + " ecdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() endif endif ***-----------( Fun‡Æo que lima as variaveis do sistema )-----------*** limpavariaveis() return nil function limpavariaveis() macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad = 1 orad:refresh() mandn := space(14) oandn:ctext := mandn manrs := space(50) oanrs:ctext := manrs manft := space(20) oanft:ctext := manft mativ = 1 oativ:refresh() madfn := ctod("") oadfn:ctext := madfn maend := space(50) oaend:ctext := maend macep := space(08) oacep:ctext := macep mabai := space(30) oabai:ctext := mabai macid := space(30) oacid:ctext := macid maest := space(02) oaest:ctext := maest matf1 := space(10) oatf1:ctext := matf1 matf2 := space(10) oatf2:ctext := matf2 matfx := space(10) oatfx:ctext := matfx maeml := space(50) oaeml:ctext := maeml matpd := "Cedula de Identidade" oatpd:refresh() mandl := space(18) oandl:ctext := mandl madtc := date() oadtc:ctext := madtc madta := ctod("") oadta:ctext := madta macsn := .f. oacsn:refresh() maccb := space(08) oaccb:ctext := maccb maecb := space(50) oaecb:ctext := maecb mabcb := space(30) oabcb:ctext := mabcb maccr := space(30) oaccr:ctext := maccr maufc := space(02) oaufc:ctext := maufc mapct := space(30) oapct:ctext := mapct mapcp := space(30) oapcp:ctext := mapcp maufp := space(02) oaufp:ctext := maufp mavpr := space(02) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := 0 oalmc:ctext := malmc meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n oeecv:refresh() menat := space(30) oenat:ctext := menat mencj := space(40) oencj:ctext := mencj mepai := space(40) oepai:ctext := mepai memae := space(40) oemae:ctext := memae meemt := space(40) oeemt:ctext := meemt metlf := space(10) oetlf:ctext := metlf meend := space(50) oeend:ctext := meend mefun := space(30) oefun:ctext := mefun mesal := 0 oesal:ctext := mesal merc1 := space(40) oerc1:ctext := merc1 merc2 := space(40) oerc2:ctext := merc2 merc3 := space(40) oerc3:ctext := merc3 medtc := ctod("") oedtc:ctext := medtc mespc := space(40) oespc:ctext := mespc maddv := ctod("") oaddv:ctext := maddv maobs := "" oaobs:refresh() lttal := "" larray := {} olax:reset() olax:add(" Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") olax:refresh() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) VerificaCNPJCPF("F",oandn,@mandn,.t.) if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oandn:setfocus() oandn:gotfocus() oclibut1:enable() nVerCidade := "S" oclibut2:disable() oclibut3:disable() return nil ***--------------( funcao de pesquisa de clientes e cidades )---------------*** function consultacliente( mlistbox) define timer otim Interval 70 Action PesquisaCliente ( mlistbox ) //of &mdialog activate timer otim function pesquisacliente( mlistbox ) ***-----------------( Foco no nome/razao social ) ------------------*** if oanrs:lFocused() if SalvaVar <> oanrs:cText if nn = 1 nn = 2 @ 069,002 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 578,115 On DblClick( alteracliente("A") ); font ofontL color mcolorAA,mcolorAB pixel //oanft:disable() oadfn:disable() oatpd:disable() oandl:disable() oacep:disable() oaend:disable() oabai:disable() oacid:disable() oaest:disable() endif SalvaVar := oanrs:cText if empty(oanrs:cText) &mlistbox:reset() &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") aadd(mRec,"00000") cQuery := "select acdc,anrs,andn,apfj from r20000000 where "+; "substr(anrs,1"+","+alltrim(str(len(alltrim(oanrs:cText))))+")"+; " = " + "'"+alltrim(oanrs:cText)+"'" + " " +; "order by anrs asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acdc')) b = oQuery:Fieldget(oQuery:Fieldpos('anrs')) c = oQuery:Fieldget(oQuery:Fieldpos('andn')) d = oQuery:Fieldget(oQuery:Fieldpos('apfj')) if !empty(a) &mlistbox:add(strzero(a,5) + " |" + substr(alltrim(,1,40) + space(40 -len(alltrim()) + "|" + iif(d="F",transform(c,"@r 999.999.999-99"),transform(c,"@r 99.999.999/9999-99"))) aadd(mRec,strzero(a,5)) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() ***-----------------( foco na cidade do clientes )------------------*** elseif oacid:lFocused() if SalvaVar <> oacid:cText if nn = 1 nn = 2 @ 170,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 300,115 On DblClick( alteracliente("B") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oacid:cText if empty(oacid:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select acid,aest from r20000000 where "+; "substr(acid,1"+","+alltrim(str(len(alltrim(oacid:cText))))+")"+; " = " + "'"+alltrim(oacid:cText)+"'" + " " +; "order by acid asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acid')) b = oQuery:Fieldget(oQuery:Fieldpos('aest')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oaccr:lFocused() if SalvaVar <> oaccr:cText if nn = 1 nn = 2 @ 050,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("C") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oaccr:cText if empty(oaccr:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select accr,aufc from r20000000 where "+; "substr(accr,1"+","+alltrim(str(len(alltrim(oaccr:cText))))+")"+; " = " + "'"+alltrim(oaccr:cText)+"'" + " " +; "order by accr asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('accr')) b = oQuery:Fieldget(oQuery:Fieldpos('aufc')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oapcp:lFocused() if SalvaVar <> oapcp:cText if nn = 1 nn = 2 @ 071,121 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("D") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oapcp:cText if empty(oapcp:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select apcp,aufp from r20000000 where "+; "substr(apcp,1"+","+alltrim(str(len(alltrim(oapcp:cText))))+")"+; " = " + "'"+alltrim(oapcp:cText)+"'" + " " +; "order by apcp asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('apcp')) b = oQuery:Fieldget(oQuery:Fieldpos('aufp')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if oanft:lFocused() //oanft:enable() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() oanft:setfocus() oanft:gotfocus() nn = 1 elseif oandn:lFocused() .or. oaddv:lFocused() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() nn = 1 elseif oaest:lFocused() &mlistbox:end() oaest:setfocus() oaest:gotfocus() nn = 1 elseif oaufc:lFocused() &mlistbox:end() oaufc:setfocus() oaufc:gotfocus() nn = 1 elseif oaufp:lFocused() &mlistbox:end() oaufp:setfocus() oaufp:gotfocus() nn = 1 elseif oaest:lFocused() .or. oabai:lFocused() .or.; oacep:lFocused() .or. oaend:lFocused() .or.; oadfn:lFocused() .or. oatpd:lFocused() .or.; oandl:lFocused() .or. oabcb:lFocused() .or.; oatf1:lFocused() .or. oatf2:lFocused() .or.; oatfx:lFocused() .or. oaeml:lFocused() .or.; oapct:lFocused() .or. oadtc:lFocused() .or.; oadta:lFocused() .or. oaccb:lFocused() .or.; oaecb:lFocused() .or. oapcp:lFocused() .or.; oavpr:lFocused() .or. oalmc:lFocused() &mlistbox:end() nn = 1 //elseif Valtype(&mlistbox) = "O" // &mlistbox:end() // nn = 1 endif endif endif return nil function alteracliente(objet) nobjet = objet if len(mrec) != 0 if mrec[olbx] != "00000" if nobjet = "A" if !empty(val(mrec[olbx])) macdc = val(mrec[olbx]) cQuery := "select * from r20000000 where "+; "acdc = " + alltrim(str(macdc)) + " order by acdc" oQuery := oServer:Query(cQuery) oLbx:end() concluialtera() SalvaVar := "A" nn = 1 oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() Keyboard( chr(9) ) endif elseif nobjet = "B" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oacid:ctext := substr(mtipo,1,30) oaest:ctext := substr(mtipo,33,2) oaest:setfocus() oaest:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "C" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oaccr:ctext := substr(mtipo,1,30) oaufc:ctext := substr(mtipo,33,2) oaufc:setfocus() oaufc:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "D" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oapcp:ctext := substr(mtipo,1,30) oaufp:ctext := substr(mtipo,33,2) oaufp:setfocus() oaufp:gotfocus() Keyboard( chr(9) ) endif endif endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  10. Ola a todos,, Não sei se será de interesse, mas ... Estou utilizando a contrib do xharbour pgsql, para acessar bases de dados no POSTGRESQL, utilizando a lib gerada na compilação do xharbour a partir da pasta \xharbour\contrib\pgsql,, a biblioteca libhbpg.lib e utilizando a biblioteca após a instalação do postgresql a libpq.lib, que tem que ser convertida para a borland, pois ela vem na instalação do postgresql para microsoft visual C,, para converter utiliza-se o: implib -a libpq.lib libpq.dll,,, o implib da propra borland... OBS.. GOSTARIA DE SABER, SE ALGUEM MAIS UTILIZA ESTE TIPO DE ACESSO,, POIS GOSTARIA DE TROCAR INFORMAÇÕES,, QUE ME FALTAM... SE POSSÃVEL É CLARO.., COM ACESSO A PARTIR DA CONTRIB DO XHARBOUR.. Segue um exemplo abaixo... Para abrir a base de dados.. utilizo.. o seguinte... ..// oServer := TPQServer():New(cServer, cDatabase, cUser, cPass) if oServer:NetErr() msgstop("erro de conexao com a base de dados!","Atencao") return nil endif ..\\ ***-----( Exemplo que contém inclusão,alteração,exclusão e pesquisa com comando em SQL.... #include "FiveWin.ch" #include "common.ch" #include "postgres.ch" #include "Folder.ch" #include "report.ch" #Define CLR_VERMELHO nRGB( 255, 000, 000 ) //--> Vermelho Para a Letra #Define CLR_BlACK nRGB( 000, 000, 000 ) //--> PRETO // a funcao encheclifor(), esta no arquivo funcoes.prg function cr101000() private oandn,mandn,cTipo,oGet private SalvaVar := "A" private otim, oLbx nn = 1 DEFINE BRUSH oBrush COLOR rgb(255,239,214) define dialog atuclientes title "Clientes" from 010,010 to 438,700 pixel brush oBrush TRANSPARENT define font mtahoma name "Tahoma" size 5.5,13 define font oFont name 'MS Sans Serif' size 6,15 define font ofontL name "Courier" size 11,11 @ 0,0 FOLDER oFld OF atuclientes prompt "&1. Dados", "&2. Comercial", "&3. Dados Pessoais","&4. Observações ","&5. Local de Entrega"; DIALOGS "PageDados","PageComercial","PagePessoal","PageObs","PageEntrega"; TABCOLOR CLR_BlACK; FOCUSCOLOR CLR_BLUE; size 295, 215; COLORS mcolorAA, mcolorAB; ADJUST oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oFld:Show() oFld:lWin95Look := .T. //-> Modifica o Estilo da Orelha. macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad := 1 mandn := space(14) manrs := space(50) manft := space(20) mativ := 1 madfn := ctod("") maend := space(50) macep := space(08) mabai := space(30) macid := space(30) maest := space(02) matf1 := space(10) matf2 := space(10) matfx := space(10) maeml := space(50) matpd := "Cedula de Identidade" mandl := space(18) madtc := date() madta := ctod("") macsn := .f. maccb := space(08) maecb := space(50) mabcb := space(30) maccr := space(30) maufc := space(02) mapct := space(30) mapcp := space(30) maufp := space(02) mavpr := space(02) marpf := space(03) && falta pegar da tabela de vendedores. malmc := 0 meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n menat := space(30) mencj := space(40) mepai := space(40) memae := space(40) meemt := space(40) metlf := space(10) meend := space(50) mefun := space(30) mesal := 0 merc1 := space(40) merc2 := space(40) merc3 := space(40) medtc := ctod("") mespc := space(40) maddv := ctod("") maobs := "" lttal := "" attal := "" larray := {} marray := {} aadd(marray," Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") mslcl = space(50) && local de entrega msend = space(50) && endere‡o de entrega msbai = space(30) && bairro de entrega mscep = space(08) && cep de entrega mscid = space(30) && cidade de entrega msest = space(02) mstel = space(10) && telefone de entrega mspct = space(30) && pessoa de contato msobs = "" && observa‡ao.. nVerCidade := "S" && faz parte da funcao geracidades() ***---------------( Informacoes da 1§ guia ) ---------------*** @ 3.5,000 RADIO orad VAR mrad OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,01, '&Fisica', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 030, '&Juridica', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oRad, , , , , .F., , ; 25, 10, , .F., .T. ) oRad:AddRadio( oRadio ) @ 05.5, 070 say "&CPF/CNPJ" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 100 get oandn var mandn picture "@r 999.999.999-99" valid ( pescnpjcpf(@mandn) == .t. ) font mtahoma size 060,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mrad = 1,VerificaCNPJCPF("F",oandn,@mandn,.t.),VerificaCNPJCPF("J",oandn,@mandn,.t.)) @ 3.5,165 RADIO oativ VAR mativ OF oFld:aDialogs[1] color mcolorAA,mcolorAB PIXEL SIZE 35,10 oRadio := TRadio():New( 3.5,165, '&Ativo', ; .T., ; // sempre o primeiro elemento recebe .t. .T., ; // .t. = selecionado (Checked) 1, oFld:aDialogs[1], oativ, , , , , .F., , ; 20, 10, , .F., .T. ) oativ:AddRadio( oRadio ) oRadio := TRadio():New( 3.5, 190, '&Inativo', ; .F. , ; .F. , ; 2, oFld:aDialogs[1], oativ, , , , , .F., , ; 25, 10, , .F., .T. ) oativ:AddRadio( oRadio ) @ 05.5, 225 say "Inativado em" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 260 get oaddv var maddv font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(mativ = 1,.f.,.t.) @ 25.5, 002 say "&Nome/Razão Social" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oanrs var manrs picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "F&antasia" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oanft var manft picture "@!" font mtahoma size 80,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 35.5, 143 say "&Dt.Fundação/Nasc." of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 192 get oadfn var madfn font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Tipo de documento" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 060 combobox oatpd var matpd items {"Isento","Inscricao Estadual","Inscricao Municipal","Cedula de Identidade","Produtor Rural","Outros"} font mtahoma size 65,60 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 45.5, 132 say "Nú&mero" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 45, 152 get oandl var mandl picture "@!" font mtahoma size 68,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel when iif(matpd = "Isento",.f.,.t.) @ 65.5, 002 say "C&ep" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oacep var macep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 65.5, 100 say "&Endereço" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 128 get oaend var maend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "&Bairro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oabai var mabai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 75.5, 160 say "C&idade" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 180 get oacid var macid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 075, 276 get oaest var maest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "Te&lefones" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oatf1 var matf1 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 095, 110 get oatf2 var matf2 picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 95.5, 160 say "Fa&x" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 180 get oatfx var matfx picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "E-mai&l" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 105, 060 get oaeml var maeml picture "@!" font mtahoma size 160,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 115.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 115, 060 get oapct var mapct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 002 say "Dt. Cada&stro" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 060 get oadtc var madtc font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 135.5, 095 say "Dt.última alteração" of oFld:aDialogs[1] font mtahoma color mcolorAA,mcolorAB pixel @ 135, 145 get oadta var madta font mtahoma size 28,9 of oFld:aDialogs[1] color mcolorCA,mcolorCB pixel @ 134, 184 checkbox oacsn var macsn prompt "&Correntista"; font mtahoma colors mcolorAA,mcolorAB size 34, 11 of oFld:aDialogs[1] pixel @ 150,002 listbox oLax VAR attal items marray of oFld:aDialogs[1] Size 285,50; font ofontL color mcolorAA,mcolorAB pixel ***---------------( Informacoes da 2§ guia ) ---------------*** @ 05.5, 002 say "&Cep de Cobrança" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oaccb var maccb picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 05.5, 100 say "&Endereço" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 128 get oaecb var maecb picture "@!" font mtahoma size 160,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Bairro" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oabcb var mabcb picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 15.5, 160 say "C&idade" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 180 get oaccr var maccr picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 015, 276 get oaufc var maufc picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Praça Pagto" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oapcp var mapcp picture "@!" font mtahoma size 095,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 025, 156 get oaufp var maufp picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "&Vencimento Peferencial" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oavpr var mavpr picture "@!" font mtahoma size 012,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "&Representante" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 55.5, 002 say "&Limite de Crédito" of oFld:aDialogs[2] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oalmc var malmc picture "@e 999,999.99" font mtahoma size 040,9 of oFld:aDialogs[2] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 3§ guia ) ---------------*** @ 005.5, 002 say "&Estado Civil" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 combobox oeecv var meecv items {"Solteiro(a)","Casado(a)","Divorciado(a)","Viuvo(a)","Outros"} font mtahoma size 65,60 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 015.5, 002 say "&Natural" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 060 get oenat var menat picture "@!" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "Nome do &Cônjuge" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get oencj var mencj picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 35.5, 002 say "Nome do &Pai" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get oepai var mepai picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 45.5, 002 say "Nome do &Mãe" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get oemae var memae picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 55.5, 002 say "Empresa que &Trabalha" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 055, 060 get oeemt var meemt picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 65.5, 002 say "Te&lefone Comercial" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 065, 060 get oetlf var metlf picture "@r (99)9999-9999" font mtahoma size 40,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 75.5, 002 say "Ende&reço" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 075, 060 get oeend var meend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 85.5, 002 say "&Função ( Cargo )" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 085, 060 get oefun var mefun picture "@!" font mtahoma size 76,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 95.5, 002 say "&Salário" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 095, 060 get oesal var mesal picture "@e 999,999.99" font mtahoma size 098,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 105.5, 002 say "Referênci&as Comerciais" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 0115, 060 get oerc1 var merc1 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0125, 060 get oerc2 var merc2 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 0135, 060 get oerc3 var merc3 picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 145.5, 002 say "Data consulta SPC" of oFld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 145, 060 get oedtc var medtc font mtahoma size 28,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel @ 155.5, 002 say "Informação" of ofld:aDialogs[3] font mtahoma color mcolorAA,mcolorAB pixel @ 155, 060 get oespc var mespc picture "@!" font mtahoma size 160,9 of oFld:aDialogs[3] color mcolorCA,mcolorCB pixel ***---------------( Informacoes da 4§ guia ) ---------------*** @ 005, 02 get oaobs VAR maobs MEMO SIZE 285,150 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[4] ***---------------( Informacoes da 5§ guia ) ---------------*** @ 05.5, 002 say "&Local" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 005, 060 get oslcl var mslcl picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 002 say "&Cep de Entrega" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 15, 060 get oscep var mscep picture "@r 99.999-999" font mtahoma size 36,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 15.5, 100 say "&Endereço" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 015, 128 get osend var msend picture "@!" font mtahoma size 160,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 002 say "&Bairro" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 060 get osbai var msbai picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 25.5, 160 say "C&idade" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 025, 180 get oscid var mscid picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 025, 276 get osest var msest picture "@!" font mtahoma size 012,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 035.5, 002 say "&Telefone" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 035, 060 get ostel var mstel picture "@r (99)9999-9999" font mtahoma size 040,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 045.5, 002 say "&Pessoa de Contato" of oFld:aDialogs[5] font mtahoma color mcolorAA,mcolorAB pixel @ 045, 060 get ospct var mspct picture "@!" font mtahoma size 095,9 of oFld:aDialogs[5] color mcolorCA,mcolorCB pixel @ 065, 002 get osobs VAR msobs MEMO SIZE 285,100 font mtahoma color mcolorCA,mcolorCB pixel of oFld:aDialogs[5] @ 185,002 BUTTON oentbut1 prompt "&Gravar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,044 BUTTON oentbut2 prompt "&Alterar" size 040,12 font oFont OF oFld:aDialogs[5] pixel @ 185,086 BUTTON oentbut3 prompt "&Excluir" size 040,12 font oFont OF oFld:aDialogs[5] pixel oFld:aDialogs[1]:bPainted := { || FillWnd ( oFld:aDialogs[1], mcolorAB,"",5 ) } oFld:aDialogs[2]:bPainted := { || FillWnd ( oFld:aDialogs[2], mcolorAB,"",5 ) } oFld:aDialogs[3]:bPainted := { || FillWnd ( oFld:aDialogs[3], mcolorAB,"",5 ) } oFld:aDialogs[4]:bPainted := { || FillWnd ( oFld:aDialogs[4], mcolorAB,"",5 ) } oFld:aDialogs[5]:bPainted := { || FillWnd ( oFld:aDialogs[5], mcolorAB,"",5 ) } @ 015,300 BUTTON oclibut1 prompt "&Gravar" size 040,12 font oFont OF atuClientes pixel action ( gravaClientes("C") ) @ 030,300 BUTTON oclibut2 prompt "&Alterar" size 040,12 font oFont OF atuClientes pixel action ( GravaClientes("A") ) @ 045,300 BUTTON oclibut3 prompt "&Excluir" size 040,12 font oFont OF atuClientes pixel action ( excluiclientes() ) @ 060,300 BUTTON oclibut5 prompt "&Novo" size 040,12 font oFont OF atuClientes pixel action ( limpavariaveis() ) @ 095,300 BUTTON oclibut6 prompt "&Sair" size 040,12 font oFont OF atuClientes pixel action ( atuClientes:end() ) //@ 110,300 BUTTON oclibut4 prompt "&Imprimir" size 040,12 font oFont OF atuClientes pixel action ( ImprimeClientes() ) oclibut2:disable() oclibut3:disable() activate dialog atuclientes center on init consultaCliente( "oLbx") otim:end() return nil function GeraCidades() if nVercidade = "S" if !empty(macid) .and. !empty(maest) if empty(maccr) oaccr:ctext := macid oaufc:ctext := maest endif if empty(mapcp) oapcp:ctext := macid oaufc:ctext := maest endif endif endif return nil function excluiclientes() if macdc != 0 if msgyesno("Confirma a exclusao deste cliente ?") == .t. cQuery := "delete from r20000000 where "+; "acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgstop("Nao foi possivel realizar a operacao de exclusao.","ATENCAO") end oQuery:destroy() oServer:Commit() limpavariaveis() endif endif return nil function pescnpjcpf(cdocu) ww = .t. if !empty(cdocu) if mrad = 1 && CPF // ww = ver_cpf(cdocu) matpd := "Cedula de Identidade" elseif mrad = 2 && CNPJ // ww = ver_cgc(cdocu) matpd := "Inscricao Estadual" endif oatpd:refresh() cQuery := "select * from r20000000 where "+; "andn = " + cdocu + " order by andn" oQuery := oServer:Query(cQuery) if oQuery[11] = 1 macdc = oQuery:Fieldget(oQuery:Fieldpos('acdc')) concluialtera() else oQuery:destroy() endif endif return(ww) function concluialtera() a = oQuery:Fieldget(oQuery:Fieldpos('apfj')) mrad := iif(a="F",1,2) orad:refresh() mandn := oQuery:Fieldget(oQuery:Fieldpos('andn')) oandn:ctext := mandn manrs := oQuery:Fieldget(oQuery:Fieldpos('anrs')) oanrs:ctext := manrs manft := oQuery:Fieldget(oQuery:Fieldpos('anft')) oanft:ctext := manft mativ := iif(oQuery:Fieldget(oQuery:Fieldpos('aatv')) = .t.,1,2) oativ:refresh() madfn := oQuery:Fieldget(oQuery:Fieldpos('adfn')) oadfn:ctext := madfn maend := oQuery:Fieldget(oQuery:Fieldpos('aend')) oaend:ctext := maend macep := oQuery:Fieldget(oQuery:Fieldpos('acep')) oacep:ctext := macep mabai := oQuery:Fieldget(oQuery:Fieldpos('abai')) oabai:ctext := mabai macid := oQuery:Fieldget(oQuery:Fieldpos('acid')) oacid:ctext := macid maest := oQuery:Fieldget(oQuery:Fieldpos('aest')) oaest:ctext := maest matf1 := oQuery:Fieldget(oQuery:Fieldpos('atf1')) oatf1:ctext := matf1 matf2 := oQuery:Fieldget(oQuery:Fieldpos('atf2')) oatf2:ctext := matf2 matfx := oQuery:Fieldget(oQuery:Fieldpos('atfx')) oatfx:ctext := matfx maeml := oQuery:Fieldget(oQuery:Fieldpos('aeml')) oaeml:ctext := maeml natdl = oQuery:Fieldget(oQuery:Fieldpos('atdl')) if natdl = 1 matpd = "Isento" elseif natdl = 2 matpd ="Inscricao Estadual" elseif natdl = 3 matpd ="Inscricao Municipal" elseif natdl = 4 matpd ="Cedula de Identidade" elseif natdl = 5 matpd ="Produtor Rural" elseif natdl = 6 matpd ="Outros" endif oatpd:refresh() mandl := oQuery:Fieldget(oQuery:Fieldpos('andl')) oandl:ctext := mandl madtc := oQuery:Fieldget(oQuery:Fieldpos('adtc')) oadtc:ctext := madtc madta := oQuery:Fieldget(oQuery:Fieldpos('adta')) oadta:ctext := madta macsn := oQuery:Fieldget(oQuery:Fieldpos('acsn')) oacsn:refresh() maccb := oQuery:Fieldget(oQuery:Fieldpos('accb')) oaccb:ctext := maccb maecb := oQuery:Fieldget(oQuery:Fieldpos('aecb')) oaecb:ctext := maecb mabcb := oQuery:Fieldget(oQuery:Fieldpos('abcb')) oabcb:ctext := mabcb maccr := oQuery:Fieldget(oQuery:Fieldpos('accr')) oaccr:ctext := maccr maufc := oQuery:Fieldget(oQuery:Fieldpos('aufc')) oaufc:ctext := maufc mapct := oQuery:Fieldget(oQuery:Fieldpos('apct')) oapct:ctext := mapct mapcp := oQuery:Fieldget(oQuery:Fieldpos('apcp')) oapcp:ctext := mapcp maufp := oQuery:Fieldget(oQuery:Fieldpos('aufp')) oaufp:ctext := maufp mavpr := oQuery:Fieldget(oQuery:Fieldpos('avpr')) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := oQuery:Fieldget(oQuery:Fieldpos('almc')) oalmc:ctext := malmc maddv := oQuery:Fieldget(oQuery:Fieldpos('addv')) oaddv:ctext := maddv maobs := oQuery:Fieldget(oQuery:Fieldpos('aobs')) oaobs:refresh() oQuery:destroy() cQuery := "select * from r20400000 where "+; "ecdc = " + alltrim(str(macdc)) + " order by ecdc" oQuery := oServer:Query(cQuery) neecv := oQuery:Fieldget(oQuery:Fieldpos('eecv')) if neecv = 1 meecv = "Solteiro(a)" elseif neecv = 2 meecv = "Casado(a)" elseif neecv = 3 meecv = "Divorciado(a)" elseif neecv = 4 meecv = "Viuvo(a)" elseif neecv = 5 meecv = "Outros" endif oeecv:refresh() menat := oQuery:Fieldget(oQuery:Fieldpos('enat')) oenat:ctext := menat mencj := oQuery:Fieldget(oQuery:Fieldpos('encj')) oencj:ctext := mencj mepai := oQuery:Fieldget(oQuery:Fieldpos('epai')) oepai:ctext := mepai memae := oQuery:Fieldget(oQuery:Fieldpos('emae')) oemae:ctext := memae meemt := oQuery:Fieldget(oQuery:Fieldpos('eemt')) oeemt:ctext := meemt metlf := oQuery:Fieldget(oQuery:Fieldpos('etlf')) oetlf:ctext := metlf meend := oQuery:Fieldget(oQuery:Fieldpos('eend')) oeend:ctext := meend mefun := oQuery:Fieldget(oQuery:Fieldpos('efun')) oefun:ctext := mefun mesal := oQuery:Fieldget(oQuery:Fieldpos('esal')) oesal:ctext := mesal merc1 := oQuery:Fieldget(oQuery:Fieldpos('erc1')) oerc1:ctext := merc1 merc2 := oQuery:Fieldget(oQuery:Fieldpos('erc2')) oerc2:ctext := merc2 merc3 := oQuery:Fieldget(oQuery:Fieldpos('erc3')) oerc3:ctext := merc3 medtc := oQuery:Fieldget(oQuery:Fieldpos('edtc')) oedtc:ctext := medtc mespc := oQuery:Fieldget(oQuery:Fieldpos('espc')) oespc:ctext := mespc oQuery:destroy() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) oclibut1:disable() nVerCidade := "N" oclibut2:enable() oclibut3:enable() VerificaCNPJCPF(upper(a),oandn,@mandn,.t.) //if GetKeyState(VK_RETURN) // Keyboard( chr(9) ) //endif oanft:setfocus() oanft:gotfocus() encheclifor("R") return nil function VerificaCNPJCPF(cTipo,oGet,cCgc,nTf) if cTipo = "F" If oget:cPicture!="@R 999.999.999-99" //cCgc:=Space(11) oget:cPicture:="@R 999.999.999-99" oget:oget:Picture:="@R 999.999.999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() elseif cTipo = "J" If oget:cPicture!="@R 99.999.999/9999-99" //cCgc:=Space(14) oget:cPicture:="@R 99.999.999/9999-99" oget:oget:Picture:="@R 99.999.999/9999-99" oget:Refresh() Endif if nTf = .t. oFld:aEnable := { .T., .T., .F.,.T.,.T. } //-> Inibe as Orelhas(Abas) endif oFld:refresh() endif return .t. function gravaclientes(objet) nobjet = objet ***-------------------------------( 1§ guia )-----------------------*** if empty(mandn) msgstop("E necessario informar o " + iif(mrad = 1,"CPF.","CNPJ."),"ATENCAO") oFld:SetOption(1) oandn:setfocus() oandn:gotfocus() return nil endif if empty(manrs) msgstop("E necessario informar o Nome/Razao Social","ATENCAO") oFld:SetOption(1) oanrs:setfocus() oanrs:gotfocus() return nil endif if empty(macep) msgstop("E necessario informar o CEP.","ATENCAO") oFld:SetOption(1) oacep:setfocus() oacep:gotfocus() return nil endif if empty(maend) msgstop("E necessario informar o ENDERECO.","ATENCAO") oFld:SetOption(1) oaend:setfocus() oaend:gotfocus() return nil endif if empty(mabai) msgstop("E necessario informar o BAIRRO.","ATENCAO") oFld:SetOption(1) oabai:setfocus() oabai:gotfocus() return nil endif if empty(macid) msgstop("E necessario informar a CIDADE.","ATENCAO") oFld:SetOption(1) oacid:setfocus() oacid:gotfocus() return nil endif if empty(maest) msgstop("E necessario informar o ESTADO.","ATENCAO") oFld:SetOption(1) oaest:setfocus() oaest:gotfocus() return nil endif ***-------------------------------( 2§ guia )-----------------------*** if empty(maccb) msgstop("E necessario informar o CEP DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccb:setfocus() oaccb:gotfocus() return nil endif if empty(maecb) msgstop("E necessario informar o ENDERECO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaecb:setfocus() oaecb:gotfocus() return nil endif if empty(mabcb) msgstop("E necessario informar o BAIRRO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oabcb:setfocus() oabcb:gotfocus() return nil endif if empty(maccr) msgstop("E necessario informar a CIDADE DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaccr:setfocus() oaccr:gotfocus() return nil endif if empty(maufc) msgstop("E necessario informar o ESTADO DE COBRANCA.","ATENCAO") oFld:SetOption(2) oaufc:setfocus() oaufc:gotfocus() return nil endif if nobjet = "C" * Obs. as datas estao no padrao AAAA-MM-DD naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif ***--------------( Realiza a inclusao de clientes )--------------*** cQuery := "insert into r20000000(anrs,anft,aatv,addv,adfn,aend,abai,acep,"+; "acid,aest,adtc,adta,apfj,andn,atdl,andl,aeml,atf1,atf2,"+; "atfx,apct,acsn,avpr,aecb,abcb,accb,accr,aufc,apcp,"+; "aufp,arpf,almc,aobs)" cQuery += "values("+"'"+manrs+"'"+","+"'"+manft+"'"+","+"'"+; iif(mativ=1,"y","n")+"'"+","+"'"+naddv+"'"+","+; "'"+nadfn+"'"+","+"'"+maend+"'"+","+"'"+mabai+"'"+","+; "'"+macep+"'"+","+"'"+macid+"'"+","+"'"+maest+"'"+","+; "'"+nadtc+"'"+","+"'"+nadta+"'"+","+; "'"+iif(mrad=1,"F","J")+"'"+","+; "'"+mandn+"'"+","+natdl+","+"'"+mandl+"'"+","+; "'"+maeml+"'"+","+"'"+matf1+"'"+","+"'"+matf2+"'"+","+; "'"+matfx+"'"+","+"'"+mapct+"'"+","+; "'"+iif(macsn=.t.,"y","n")+"'"+","+"'"+mavpr+"'"+","+; "'"+maecb+"'"+","+"'"+mabcb+"'"+","+"'"+maccb+"'"+","+; "'"+maccr+"'"+","+"'"+maufc+"'"+","+"'"+mapcp+"'"+","+; "'"+maufp+"'"+","+"'"+marpf+"'"+","+str(malmc)+","+; "'"+maobs+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 ***---( Pega o ultimo numero sequencial do cadastro de clientes)----*** if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "select * from r20000000_acdc_seq;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() mecdc = oQuery:Fieldget(2) oQuery:Skip() END oQuery:destroy() cQuery := "insert into r20400000(ecdc,eecv,encj,enat,epai,emae,"+; "eemt,etlf,eend,efun,esal,erc1,erc2,erc3,edtc,espc)" cQuery += "values("+str(mecdc)+","+neecv+","+"'"+mencj+"'"+","+; "'"+menat+"'"+","+"'"+mepai+"'"+","+"'"+memae+"'"+","+; "'"+meemt+"'"+","+"'"+metlf+"'"+","+"'"+meend+"'"+","+; "'"+mefun+"'"+","+str(mesal)+","+"'"+merc1+"'"+","+; "'"+merc2+"'"+","+"'"+merc3+"'"+","+"'"+nedtc+"'"+","+; "'"+mespc+"'"+")" oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a inclusÆo de dados pessoais do cliente.","ATENCAO") // ? oQuery:error() endif oQuery:destroy() oServer:Commit() endif elseif nobjet = "A" naddv = iif(!empty(maddv),(substr(dtos(maddv),1,4)+"-"+substr(dtos(maddv),5,2)+"-"+substr(dtos(maddv),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadfn = iif(!empty(madfn),(substr(dtos(madfn),1,4)+"-"+substr(dtos(madfn),5,2)+"-"+substr(dtos(madfn),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadtc = iif(!empty(madtc),(substr(dtos(madtc),1,4)+"-"+substr(dtos(madtc),5,2)+"-"+substr(dtos(madtc),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) nadta = iif(!empty(madta),(substr(dtos(madta),1,4)+"-"+substr(dtos(madta),5,2)+"-"+substr(dtos(madta),7,2)),; substr(dtos(date()),1,4)+"-"+substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)) if matpd = "Isento" natdl = "1" elseif matpd ="Inscricao Estadual" natdl = "2" elseif matpd ="Inscricao Municipal" natdl = "3" elseif matpd ="Cedula de Identidade" natdl = "4" elseif matpd ="Produtor Rural" natdl = "5" elseif matpd ="Outros" natdl = "6" endif cQuery := "Update r20000000 set "+; "anrs = " + "'"+manrs+"'"+","+; "anft = " + "'"+manft+"'"+","+; "aatv = " + "'"+iif(mativ=1,"y","n")+"'"+","+; "addv = " + "'"+naddv+"'"+","+; "adfn = " + "'"+nadfn+"'"+","+; "aend = " + "'"+maend+"'"+","+; "abai = " + "'"+mabai+"'"+","+; "acep = " + "'"+macep+"'"+","+; "acid = " + "'"+macid+"'"+","+; "aest = " + "'"+maest+"'"+","+; "adtc = " + "'"+nadtc+"'"+","+; "adta = " + "'"+nadta+"'"+","+; "apfj = " + "'"+iif(mrad=1,"F","J")+"'"+","+; "andn = " + "'"+mandn+"'"+","+; "atdl = " + natdl+","+; "andl = " + "'"+mandl+"'"+","+; "aeml = " + "'"+maeml+"'"+","+; "atf1 = " + "'"+matf1+"'"+","+; "atf2 = " + "'"+matf2+"'"+","+; "atfx = " + "'"+matfx+"'"+","+; "apct = " + "'"+mapct+"'"+","+; "acsn = " + "'"+iif(macsn=.t.,"y","n")+"'"+","+; "avpr = " + "'"+mavpr+"'"+","+; "aecb = " + "'"+maecb+"'"+","+; "abcb = " + "'"+mabcb+"'"+","+; "accb = " + "'"+maccb+"'"+","+; "accr = " + "'"+maccr+"'"+","+; "aufc = " + "'"+maufc+"'"+","+; "apcp = " + "'"+mapcp+"'"+","+; "aufp = " + "'"+maufp+"'"+","+; "arpf = " + "'"+marpf+"'"+","+; "almc = " + str(malmc)+","+; "aobs = " + "'"+maobs+"'"+; " where " + " acdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() if mrad = 1 if meecv = "Solteiro(a)" neecv = "1" elseif meecv = "Casado(a)" neecv = "2" elseif meecv = "Divorciado(a)" neecv = "3" elseif meecv = "Viuvo(a)" neecv = "4" elseif meecv = "Outros" neecv = "5" endif nedtc = iif(!empty(medtc),(substr(dtos(medtc),5,2)+"-"+substr(dtos(medtc),7,2)+"-"+substr(dtos(medtc),1,4)),; substr(dtos(date()),5,2)+"-"+substr(dtos(date()),7,2)+"-"+substr(dtos(date()),1,4)) cQuery := "Update r20400000 set "+; "eecv = " + neecv+","+; "encj = " + "'"+mencj+"'"+","+; "enat = " + "'"+menat+"'"+","+; "epai = " + "'"+mepai+"'"+","+; "emae = " + "'"+memae+"'"+","+; "eemt = " + "'"+meemt+"'"+","+; "etlf = " + "'"+metlf+"'"+","+; "eend = " + "'"+meend+"'"+","+; "efun = " + "'"+mefun+"'"+","+; "esal = " + str(mesal)+","+; "erc1 = " + "'"+merc1+"'"+","+; "erc2 = " + "'"+merc2+"'"+","+; "erc3 = " + "'"+merc3+"'"+","+; "edtc = " + "'"+nedtc+"'"+","+; "espc = " + "'"+mespc+"'"+; " where " + " ecdc = " + alltrim(str(macdc)) oQuery := oServer:Query(cQuery) if oQuery:neterr() msgStop("Nao foi possivel realizar a alteracao do cliente.","ATENCAO") //oQuery:error() endif oQuery:destroy() oServer:Commit() endif endif ***-----------( Fun‡Æo que lima as variaveis do sistema )-----------*** limpavariaveis() return nil function limpavariaveis() macdc := 0 && codigo do cliente,, fica interno no sistema.... mRec := {} mrad = 1 orad:refresh() mandn := space(14) oandn:ctext := mandn manrs := space(50) oanrs:ctext := manrs manft := space(20) oanft:ctext := manft mativ = 1 oativ:refresh() madfn := ctod("") oadfn:ctext := madfn maend := space(50) oaend:ctext := maend macep := space(08) oacep:ctext := macep mabai := space(30) oabai:ctext := mabai macid := space(30) oacid:ctext := macid maest := space(02) oaest:ctext := maest matf1 := space(10) oatf1:ctext := matf1 matf2 := space(10) oatf2:ctext := matf2 matfx := space(10) oatfx:ctext := matfx maeml := space(50) oaeml:ctext := maeml matpd := "Cedula de Identidade" oatpd:refresh() mandl := space(18) oandl:ctext := mandl madtc := date() oadtc:ctext := madtc madta := ctod("") oadta:ctext := madta macsn := .f. oacsn:refresh() maccb := space(08) oaccb:ctext := maccb maecb := space(50) oaecb:ctext := maecb mabcb := space(30) oabcb:ctext := mabcb maccr := space(30) oaccr:ctext := maccr maufc := space(02) oaufc:ctext := maufc mapct := space(30) oapct:ctext := mapct mapcp := space(30) oapcp:ctext := mapcp maufp := space(02) oaufp:ctext := maufp mavpr := space(02) oavpr:ctext := mavpr marpf := space(03) && falta pegar da tabela de vendedores. //oarpf:ctext := marpf malmc := 0 oalmc:ctext := malmc meecv := "Solteiro(a)" && no bco de dados esta como 01,0 n oeecv:refresh() menat := space(30) oenat:ctext := menat mencj := space(40) oencj:ctext := mencj mepai := space(40) oepai:ctext := mepai memae := space(40) oemae:ctext := memae meemt := space(40) oeemt:ctext := meemt metlf := space(10) oetlf:ctext := metlf meend := space(50) oeend:ctext := meend mefun := space(30) oefun:ctext := mefun mesal := 0 oesal:ctext := mesal merc1 := space(40) oerc1:ctext := merc1 merc2 := space(40) oerc2:ctext := merc2 merc3 := space(40) oerc3:ctext := merc3 medtc := ctod("") oedtc:ctext := medtc mespc := space(40) oespc:ctext := mespc maddv := ctod("") oaddv:ctext := maddv maobs := "" oaobs:refresh() lttal := "" larray := {} olax:reset() olax:add(" Titulo Vcto Valor(R$) Dias A Pagar Multa Juros") olax:refresh() oFld:SetOption(1) oFld:aEnable := { .T., .T., .T.,.T.,.T. } //-> Inibe as Orelhas(Abas) VerificaCNPJCPF("F",oandn,@mandn,.t.) if GetKeyState(VK_RETURN) Keyboard( chr(9) ) endif oandn:setfocus() oandn:gotfocus() oclibut1:enable() nVerCidade := "S" oclibut2:disable() oclibut3:disable() return nil ***--------------( funcao de pesquisa de clientes e cidades )---------------*** function consultacliente( mlistbox) define timer otim Interval 70 Action PesquisaCliente ( mlistbox ) //of &mdialog activate timer otim function pesquisacliente( mlistbox ) ***-----------------( Foco no nome/razao social ) ------------------*** if oanrs:lFocused() if SalvaVar <> oanrs:cText if nn = 1 nn = 2 @ 069,002 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 578,115 On DblClick( alteracliente("A") ); font ofontL color mcolorAA,mcolorAB pixel //oanft:disable() oadfn:disable() oatpd:disable() oandl:disable() oacep:disable() oaend:disable() oabai:disable() oacid:disable() oaest:disable() endif SalvaVar := oanrs:cText if empty(oanrs:cText) &mlistbox:reset() &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Codigo" + "|" + "Cliente " + "|" + "CNPJ/CPF") aadd(mRec,"00000") cQuery := "select acdc,anrs,andn,apfj from r20000000 where "+; "substr(anrs,1"+","+alltrim(str(len(alltrim(oanrs:cText))))+")"+; " = " + "'"+alltrim(oanrs:cText)+"'" + " " +; "order by anrs asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acdc')) b = oQuery:Fieldget(oQuery:Fieldpos('anrs')) c = oQuery:Fieldget(oQuery:Fieldpos('andn')) d = oQuery:Fieldget(oQuery:Fieldpos('apfj')) if !empty(a) &mlistbox:add(strzero(a,5) + " |" + substr(alltrim(,1,40) + space(40 -len(alltrim()) + "|" + iif(d="F",transform(c,"@r 999.999.999-99"),transform(c,"@r 99.999.999/9999-99"))) aadd(mRec,strzero(a,5)) endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() ***-----------------( foco na cidade do clientes )------------------*** elseif oacid:lFocused() if SalvaVar <> oacid:cText if nn = 1 nn = 2 @ 170,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[1] Size 300,115 On DblClick( alteracliente("B") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oacid:cText if empty(oacid:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select acid,aest from r20000000 where "+; "substr(acid,1"+","+alltrim(str(len(alltrim(oacid:cText))))+")"+; " = " + "'"+alltrim(oacid:cText)+"'" + " " +; "order by acid asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('acid')) b = oQuery:Fieldget(oQuery:Fieldpos('aest')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oaccr:lFocused() if SalvaVar <> oaccr:cText if nn = 1 nn = 2 @ 050,275 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("C") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oaccr:cText if empty(oaccr:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select accr,aufc from r20000000 where "+; "substr(accr,1"+","+alltrim(str(len(alltrim(oaccr:cText))))+")"+; " = " + "'"+alltrim(oaccr:cText)+"'" + " " +; "order by accr asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('accr')) b = oQuery:Fieldget(oQuery:Fieldpos('aufc')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() elseif oapcp:lFocused() if SalvaVar <> oapcp:cText if nn = 1 nn = 2 @ 071,121 listbox &mlistbox VAR lttal items larray of oFld:aDialogs[2] Size 300,115 On DblClick( alteracliente("D") ); font ofontL color mcolorAA,mcolorAB pixel endif SalvaVar := oapcp:cText if empty(oapcp:cText) &mlistbox:reset() &mlistbox:add("Cidade " + "|" + "UF") return .t. endif &mlistbox:reset() mrec := {} &mlistbox:add("Cidade " + "|" + "UF") aadd(mRec,"00000") cQuery := "select apcp,aufp from r20000000 where "+; "substr(apcp,1"+","+alltrim(str(len(alltrim(oapcp:cText))))+")"+; " = " + "'"+alltrim(oapcp:cText)+"'" + " " +; "order by apcp asc;" oQuery := oServer:Query(cQuery) DO WHILE ! oQuery:Eof() a = oQuery:Fieldget(oQuery:Fieldpos('apcp')) b = oQuery:Fieldget(oQuery:Fieldpos('aufp')) if !empty(a) msn = "S" for x = 1 to len(mrec) if alltrim(substr(mrec[x],1,30)) = alltrim(substr(a,1,30)) msn = "N" exit endif next if msn = "S" &mlistbox:add(a + " |" + aadd(mRec,a + " |" + endif endif oQuery:Skip() END oQuery:destroy() &mlistbox:refresh() endif &mlistbox:refresh() else if Valtype(&mlistbox) != "O" && objeto listbox nao esta presente else SalvaVar := "A" if oanft:lFocused() //oanft:enable() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() oanft:setfocus() oanft:gotfocus() nn = 1 elseif oandn:lFocused() .or. oaddv:lFocused() oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() &mlistbox:end() nn = 1 elseif oaest:lFocused() &mlistbox:end() oaest:setfocus() oaest:gotfocus() nn = 1 elseif oaufc:lFocused() &mlistbox:end() oaufc:setfocus() oaufc:gotfocus() nn = 1 elseif oaufp:lFocused() &mlistbox:end() oaufp:setfocus() oaufp:gotfocus() nn = 1 elseif oaest:lFocused() .or. oabai:lFocused() .or.; oacep:lFocused() .or. oaend:lFocused() .or.; oadfn:lFocused() .or. oatpd:lFocused() .or.; oandl:lFocused() .or. oabcb:lFocused() .or.; oatf1:lFocused() .or. oatf2:lFocused() .or.; oatfx:lFocused() .or. oaeml:lFocused() .or.; oapct:lFocused() .or. oadtc:lFocused() .or.; oadta:lFocused() .or. oaccb:lFocused() .or.; oaecb:lFocused() .or. oapcp:lFocused() .or.; oavpr:lFocused() .or. oalmc:lFocused() &mlistbox:end() nn = 1 //elseif Valtype(&mlistbox) = "O" // &mlistbox:end() // nn = 1 endif endif endif return nil function alteracliente(objet) nobjet = objet if len(mrec) != 0 if mrec[olbx] != "00000" if nobjet = "A" if !empty(val(mrec[olbx])) macdc = val(mrec[olbx]) cQuery := "select * from r20000000 where "+; "acdc = " + alltrim(str(macdc)) + " order by acdc" oQuery := oServer:Query(cQuery) oLbx:end() concluialtera() SalvaVar := "A" nn = 1 oadfn:enable() oatpd:enable() oandl:enable() oacep:enable() oaend:enable() oabai:enable() oacid:enable() oaest:enable() Keyboard( chr(9) ) endif elseif nobjet = "B" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oacid:ctext := substr(mtipo,1,30) oaest:ctext := substr(mtipo,33,2) oaest:setfocus() oaest:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "C" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oaccr:ctext := substr(mtipo,1,30) oaufc:ctext := substr(mtipo,33,2) oaufc:setfocus() oaufc:gotfocus() Keyboard( chr(9) ) endif elseif nobjet = "D" if !empty(mrec[olbx]) mtipo = mrec[olbx] oLbx:end() SalvaVar := "A" nn = 1 oapcp:ctext := substr(mtipo,1,30) oaufp:ctext := substr(mtipo,33,2) oaufp:setfocus() oaufp:gotfocus() Keyboard( chr(9) ) endif endif endif endif return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  11. Olá a todos,,, Primeiramente, gostaria de parabenizar a todos, que aqui se comunicam pelo grande apreço que demonstram a todos que postam as suas dúvidas profissionais ou até mesmo pessoais. Tenho percebido, algumas dificuldades em áreas específicas, como o SINTEGRA por exemplo que é a geração do arquivo magnético,o TEF, bco de dados e outras coisas a mais.. Gostaria de propor a apreciação de todos, o seguinte: De que bimestralmente,trimestralmente, semestralmente não sei, nós nos juntassemos coordenadamente, e desenvolvessemos soluções para as principais aflições que aqui se encontram.. Ex.. Sobre o Sintegra,, desenvolvessemos uma função, lib,ou uma solução, que recebesse os parametros que são fixos, e montasse o arquivo magnético por exemplo. e colocá-lo a disposição de todos sem custo, para ser integrado ao software de cada um.. Sei que todos aqui, inclusive eu.. temos o tempo muito apertado devido a nosso afazeres.., mas poderiamos unidos cada um com uma parte distinta, do trabalho,, fazer isto muito rápido.. Gostaria da apreciação de todos Isto é apenas uma sugestão.... Cordialmente, wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  12. Olá a todos,,, Primeiramente, gostaria de parabenizar a todos, que aqui se comunicam pelo grande apreço que demonstram a todos que postam as suas dúvidas profissionais ou até mesmo pessoais. Tenho percebido, algumas dificuldades em áreas específicas, como o SINTEGRA por exemplo que é a geração do arquivo magnético,o TEF, bco de dados e outras coisas a mais.. Gostaria de propor a apreciação de todos, o seguinte: De que bimestralmente,trimestralmente, semestralmente não sei, nós nos juntassemos coordenadamente, e desenvolvessemos soluções para as principais aflições que aqui se encontram.. Ex.. Sobre o Sintegra,, desenvolvessemos uma função, lib,ou uma solução, que recebesse os parametros que são fixos, e montasse o arquivo magnético por exemplo. e colocá-lo a disposição de todos sem custo, para ser integrado ao software de cada um.. Sei que todos aqui, inclusive eu.. temos o tempo muito apertado devido a nosso afazeres.., mas poderiamos unidos cada um com uma parte distinta, do trabalho,, fazer isto muito rápido.. Gostaria da apreciação de todos Isto é apenas uma sugestão.... Cordialmente, wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  13. boa tarde... É possivel,, gerar,, um relatório direto do preview..para o formato word ( *.doc), ou é necessário adquirir uma lib.. para fazer isto,, se sim de quem eu compro,, ou onde adquiro a mesma,, e tambem para o excell (*.xls)...,, Cordialmente,, wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  14. boa tarde... É possivel,, gerar,, um relatório direto do preview..para o formato word ( *.doc), ou é necessário adquirir uma lib.. para fazer isto,, se sim de quem eu compro,, ou onde adquiro a mesma,, e tambem para o excell (*.xls)...,, Cordialmente,, wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  15. ola, gilberto,, ou vc,, poderia fazer assim... #include "fivewin.ch" nArq = "cliente2.dbf" nInd = "cliente2.cdx" if !file("&nArq") banco := {} aadd(banco,{"codclient2","c",03,0}) && codigo do cliente. aadd(banco,{"cliente2 ","c",34,0}) && nome do cliente. dbcreate("&nArq", banco) endif select 02 set exclusive off use &nArq via "dbfcdx" alias cliente2 if neterr() msginfo("Clientes em uso exclusivo em outra esta‡Æo.") close all quit endif if !file("&nInd") MsgMeter( { | oMeter, oText, oDlg, lEnd | ; IniciIndex( oMeter, oText, oDlg, @lEnd,"cliente21","codclient2","&nInd" ) },; "clientes","Aguarde indexando arquivo ..." ) endif set index to &nInd additive function IniciIndex( oMeter, oText, oDlg, lEnd,ltag, campo, indice ) oMeter:nTotal = RecCount() index on &(campo) tag &(ltag) to &(indice); Eval( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd) return nil wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  16. Ola, ricardo... vc, esta onde? Patos de minas... foi transferido novamente,,, aqui é o wellington... entre em contato,,, email-systemup@bol.com.br wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  17. Judson... Também tive problemas com o foco do gerenciador padrão do TEF.., utilizo : oWnd:setfocus() oWnd:show() veja o exemplo em http://www.fivewin.com.br/exibedicas.asp?id=839 Isto ocorre, bastante com o aplicativo da REDECARD, o novo da VISA etc..,mas de uma olhada no seu código fonte e cheque os pontos onde é finalizado a ação do gerenciador padrão e force a alternância entre sua aplicação e o gerenciador padrão e vice versa. Obs. Isto ocorre com bastante frequência no WINDOWS XP. wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  18. Pode se utilizar qualquer linguagem de programação para trabalhar com cgi,, bastando que esta linguagen consiga ler entrade e saídas stdin e stdout, sendo que a variável de ambiente em método POST é REQUEST_METHOD e no método GET é QUERY_STRING, a função GetEnv funciona em clipper e harbour,xharbour etc.., bastando depois vc, selecionar as informações contidas nas variáveis de ambiente,, de acordo com as informações pré definidas para cada servidor.. Lembrando que hoje em dia é muito mais fácil utilizar linguagens script´s como ASP(ACTIVE SERVES PAGES), PERL, e muitas outras.. e bem mais rápido e eficiente.. ok wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  19. Fluna,,, não sei porque o dito popular,, se na realidade es tou apenas tentando ajudar.. CHUPA ESSA MANGA..., mas... é o seguinte... (CASO VC, FLUNA PRECISE DE AJUDA,, CASO NÃO É PARA OS OUTROS DO FORUM QUE PRECISAM...) Seguinte... 1º - Se o teste esta sendo feito em localhost(máquina local)no windows XP,e necessário verficar se o IIS(Internet Information Services) esteja instalado. 2º - Se não estiver instale a partir do CD de instalação do windows ou atravers (ADICIONAR OU REMOVER PROGRAMAS)-(ADICIONAR/REMOVER COMPONENTES DO WINDOWS)., após a instalação ele cria uma pasta chamada INETPUB\wwwroot\ 3º - Crie uma pasta dentro de c:\Inetpub\wwwroot\registro, neste caso criei a pasta chamada registro., aqui dentro coloca-se o executavel,dbf´s,ntx, e html.. 4º - No arquivo registro.html a chamada POST, SERA: , onde cgi é o alias criado para a pasta, no parágrafo 6º. 5º - No arquivo registro.prg, a localização dos arquivos dbf e ntx são.. #define DB_NAME "c:\Inetpub\wwwroot\registro\REGISTRO.DBF" #define NTX_NAME "c:\Inetpub\wwwroot\registro\REGISTRO.NTX 6º - Configure o IIS,da seguinte maneira..(Meu Computador,Painel de Controle,Internet Information Services. LOCALIZE(Site da Web padrão) e clique com o botão do mouse do lado direito (qdo destro) e em NOVO-DIRETORIO VIRTUAL, abrirá o assistente para criação de diretório virtual..em seguida ele pedira um alias para o diretorio no meu caso criei o alias CGI., depois localize a pasta que vc, criou com o executável e html que é a c:\Inetpub\wwwroot\registro, logo em seguida,ele pedirá as permissões de acesso, marque a opção EXECUTAR (APLICATIVOS ISAPI OU CGI, POR EXEMPLO).e finalize a operação.. 7º - Ainda com o Internet Informatin Services aberto clique sobre o apelido cgi, que foi criado no passo anterior que esta localizao logo abaixo de Site da Web Padrão +cgi..(clique com o botão do mouse do lado direito qdo destro) e vá em propriedades, certifique-se que esteja marcado as opções Ler,Criar log de visitantes,Indexar este recurso, depois vá no botão Configuração, clique no botão adicionar e localize o executável que esta em c:\Inetpub\wwwroot\registro\registro.exe, coloque a extensão .EXE, em verbos limitar a: GET,HEAD,POST,TRACE e clique no botão OK.. Está pronto para usar o exemplo em cgi... no internet explorer chame o html, assim: http://localhost/cgi/registro.html Qdo clicar no botão PROCESSAR, no rodapé aparecera o caminho do alias que vc, criou, que neste caso é /cgi/registro.exe que ira charmar o executável em http://localhost/cgi/registro.exe Refiz, o procedimento compilando o exemplo em xharbour,,sem alterar nenhuma virgula.. no fonte.. e funcionou perfeitamente,, lembrando que somente para servidores WINDOWS(x), NÃO LINUX... ESTES PROCEDIMENTOS SÃO PARA TESTAR O EXEMPLO QUE POSTEI..EM LOCALHOST.. EM UMA MÃQUINA LOCAL.. OK.. QUALQUER DÚVIDA É SÓ ME DIZER.. NÃO PRECISA USAR DE SARCASMO,, POIS AJUDO E RECEBO AJUDA, COMO TODO MUNDO.. E DESCULPE- QUALQUER COISA É PORQUE NÃO CONSEGUI ENTENDER O SARCASMO DO FLUNA... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  20. Alguem já utilizou a classe repexcel, o meu problema é que qdo aumento o fator e tento rolar o preview na horizontal e na vertical, não consigo visualizar o relatorio o preview fica em branco.. Não consigo imprimir nada em impressora nenhuma a partir do preview.. Esta postado em: 02/01/07 enviador por kleyber http://www.fivewin.com.br/exibedicas.asp?id=712 "Nova versão desta excelente classe para fazer com que os relatórios gerados tenham a opção de se criar planilhas Excel diretamente do Preview." wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  21. Alguem já utilizou a classe repexcel, o meu problema é que qdo aumento o fator e tento rolar o preview na horizontal e na vertical, não consigo visualizar o relatorio o preview fica em branco.. Não consigo imprimir nada em impressora nenhuma a partir do preview.. Esta postado em: 02/01/07 enviador por kleyber http://www.fivewin.com.br/exibedicas.asp?id=712 "Nova versão desta excelente classe para fazer com que os relatórios gerados tenham a opção de se criar planilhas Excel diretamente do Preview." wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  22. Vou postar um exemplo em DICAS, de script CGI EM CLipper,, usei como exemplo... e muito bom.... abraços... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  23. Já esta postado em dicas, os exemplos que utilizei para fazer o TEF, bemo como o roteiro de homologação do mesmo em São Paulo,, seguem em anexo roteiros,checklists e emuladores para realizarem os testes... Qualquer dúvida,, e eu podendo esclarecer.. e só dizer.. cordialmente wellington wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  24. Esta postado em dicas, os exemplos que utilizei como consulta para desenvolvimento do TEF... Até mais.. wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
  25. É sem custo,, nenhum... ok? Querendo.. e só dizer... fui... wellington fwh/xharbour0.99.71 Bd. Postgresql Systemup@bol.com.br
×
×
  • Create New...