Jump to content
Fivewin Brasil

zekasan

Membros
  • Posts

    146
  • Joined

  • Last visited

  • Days Won

    6

Reputation Activity

  1. Like
    zekasan got a reaction from aferra in INSERT COM WHERE   
    Precisei algo parecido, caso exista eu atualizo algumas variáveis, caso contrário eu insiro os dados:
        cCmdSql:="if exists (select usuario from SSW_USUARIO where Usuario = '"+cGet01_S1+"') "+;
                    "    begin "+;
                    "        update ssw_usuario set "+;
                    "            nome = '"+ cGet06_S1 +"',"+;
                    "            senha = '"+ cGet02_S1 +"',"+;
                    "            nivel = "+ str(cGet05_S1,1)+","+;
                    "            email = '"+ cGetEma +"',"+;
                    "            emailsenha = '"+ cGetSen +"',"+;
                    "            telddd = '"+ cGetDDD +"',"+;
                    "            telnr = '"+ cGetTel +"',"+;
                    "            telramal = '"+ cGetRam +"'"+;
                    "        where usuario = '"+cGet01_S1+"' "+;
                    "    end "+;
                    "else "+;
                    "    begin "+;
                    "        insert into ssw_usuario(filial,usuario,nome,senha,nivel,email,emailsenha,telddd,telnr,telramal) "+;
                    "            values( "+;
                    "            '"+RET_FILIAL_SSW(cGet04_S1)+"',"+;
                    "            '"+cGet01_S1+"',"+;
                    "            '"+cGet06_S1+"',"+;
                    "            '"+cGet02_S1+"',"+;
                    "            "+str(cGet05_S1,1)+","+;
                    "            '"+cGetEma+"',"+;
                    "            '"+cGetSen+"',"+;
                    "            '"+cGetDDD+"',"+;
                    "            '"+cGetTel+"',"+;
                    "            '"+cGetRam+"')"+;
                    "    end"
  2. Like
    zekasan got a reaction from Luiz Fernando in INSERT COM WHERE   
    Precisei algo parecido, caso exista eu atualizo algumas variáveis, caso contrário eu insiro os dados:
        cCmdSql:="if exists (select usuario from SSW_USUARIO where Usuario = '"+cGet01_S1+"') "+;
                    "    begin "+;
                    "        update ssw_usuario set "+;
                    "            nome = '"+ cGet06_S1 +"',"+;
                    "            senha = '"+ cGet02_S1 +"',"+;
                    "            nivel = "+ str(cGet05_S1,1)+","+;
                    "            email = '"+ cGetEma +"',"+;
                    "            emailsenha = '"+ cGetSen +"',"+;
                    "            telddd = '"+ cGetDDD +"',"+;
                    "            telnr = '"+ cGetTel +"',"+;
                    "            telramal = '"+ cGetRam +"'"+;
                    "        where usuario = '"+cGet01_S1+"' "+;
                    "    end "+;
                    "else "+;
                    "    begin "+;
                    "        insert into ssw_usuario(filial,usuario,nome,senha,nivel,email,emailsenha,telddd,telnr,telramal) "+;
                    "            values( "+;
                    "            '"+RET_FILIAL_SSW(cGet04_S1)+"',"+;
                    "            '"+cGet01_S1+"',"+;
                    "            '"+cGet06_S1+"',"+;
                    "            '"+cGet02_S1+"',"+;
                    "            "+str(cGet05_S1,1)+","+;
                    "            '"+cGetEma+"',"+;
                    "            '"+cGetSen+"',"+;
                    "            '"+cGetDDD+"',"+;
                    "            '"+cGetTel+"',"+;
                    "            '"+cGetRam+"')"+;
                    "    end"
  3. Like
    zekasan reacted to fluna in Integração com WEB   
    Como ficou: ************************** Function Whatsapp( cPara ) ************************** Local oShell,wCodCli,lSair,lOk If !IsInternet() MsgInfo("Necessário Uma Conexão com Internet !"+CRLF+"Operação cancelada") Return(.f.) Endif wCodCli:=alltrim(right(cpara,5)) Select cli cli->(OrdSetFocus("codigo")) seek wcodcli lOk:=found() Select SRV if !lok ? "Erro! cliente não encontrado on cadastro!" return(.f.) endif cPara:=alltrim(CLI->FONE_MOVEL) cNome:=alltrim(CLI->NOME) CursorWait() nSegs:=val(GetPvProfString("WhatsApp","SecWaitPage","0",SysArq)) cMens:=GetPvProfString("WhatsApp","MsgPrinting" ," ",SysArq) cSair:=GetPvProfString("WhatsApp","FechaNavegador" ," ",SysArq) If empty(nSegs) nSegs:=10 // 10 segundos WritePProString( "WhatsApp","SecWaitPage","10",SysArq ) Endif If empty(cMens) cMens:="Avisamos que O SEU APARELHO ja esta disponivel! Voce ja pode vir retira-lo." WritePProString( "WhatsApp","MsgPrinting",cMens,SysArq ) Endif If empty(cSair) cSair:="S" WritePProString( "WhatsApp","FechaNavegador","S",SysArq ) Endif cPara:=AjustaFone( cPara ) If Empty( cPara ) MsgInfo("Número do telefone de "+cNome+" inválido, verifique!") return(.f.) endif cHora:=Time() nHora:=val(substr(cHora,1,2)+substr(cHora,4,2)) cHora:=iif(nHora>=0000 .and. nHora <=1200 ,"Bom Dia, " , "" ) cHora:=iif(nHora>=1201 .and. nHora <=1800 ,"Boa Tarde, ",cHora) cHora:=iif(nHora>=1801 .and. nHora <=2359 ,"Boa Noite, ",cHora) cCabc:= cHora+"A "+wNomeEmpresa+" tem um recado para voce!" oShell:= CreateObject( "WScript.Shell" ) oShell:run("https://web.whatsapp.com/send?phone="+cPara) WaitSeconds(nSegs) oShell:sendkeys("*"+cCabc+"*") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 1 ) oShell:sendkeys("_"+cMens+"_") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 1 ) oShell:sendkeys("*Nosso contato: "+wFoneEmpresa+"*") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 3 ) If cSair="S" oShell:SendKeys("%{F4}") // ALT+F4 fecha o navegador, mas deixar aberto fica mais rápido.... Endif CursorArrow() Return nil ***************************** FUNCTION AjustaFone( xFone ) ***************************** Local i,cLetra,cFone:="" For i=1 to len(xFone) cLetra:=Substr(xFone,i,1) cFone+=iif(cLetra="0","0",iif( val(cletra)>0,cLetra,"")) Next If Substr(cFone,1,2)#"55" cFone:="55"+cFone Endif cFone:=alltrim(cFone) If len( cFone ) # 13 cFone:=" " endif Return( cFone )  
  4. Like
    zekasan reacted to emotta in Gerar QRCODE - FIVEWIN   
    Um amigo me pediu um exemplo para gerar QRCODE em xHarbour/Fivewin. Procurei no forum achei alguns exemplos mas faltava a DLL, em outros exemplos tinha um codigo fonte gigante, enfim, achei bem complicado. Então consegui a DLL (vlw Luis Batata - MicroFly) analisando alguns fontes montei um exemplo bem prático que gera o QRCODE em bitmap e até exibe ele. Espero que ajude outros
     
    obs: neste link tem o codigo fonte e a dll
    http://www.emotta.com.br/qrcode/qrcode.rar
     
    #include "fivewin.ch" Function u_Teste() Local cStr := "AQUI DEVE SER COLOCADO O CONTEUDO DO QRCODE" Local cFile := "arq.bmp" Local oDlg Local oBmp1 QRCode(cStr,cFile) // aqui vc chama a funcao passando como parametro o conteudo do QRCODE e o arquivo BMP que será gerado DEFINE DIALOG oDlg FROM 0,0 TO 300,300 TITLE "Exibir QRCODE" PIXEL @ 10,10 BITMAP oBmp1 FILE cFile OF oDlg Size 200,200 Pixel NOBORDER ACTIVATE DIALOG oDlg CENTERED Return DLL32 STATIC FUNCTION QRCode(cStr As STRING, cFile As STRING) AS LONG PASCAL FROM "FastQRCode" LIB "QRCodelib.Dll"  
  5. Like
    zekasan reacted to kapiaba in Copiar muitos arquivos.   
    http://forums.fivetechsupport.com/viewtopic.php?f=6&t=35644&p=212224#p212224
     
    Perfect mister Rao. Many thanks.

    #Include "FiveWin.ch" static oWnd //----------------------------------------------------------------// FUNCTION Main()    LOCAL oBar, cOrigen, cDestino    cOrigen  := Curdrive()+":\fwh1701\samples\*.prg"    cDestino := Curdrive()+":\backup\"    DEFINE WINDOW oWnd TITLE "Copiar Archivos"    DEFINE BUTTONBAR oBar _3D OF oWnd    DEFINE BUTTON OF oBar ACTION( Copiar( cOrigen, cDestino ), oWnd:End() )    SET MESSAGE OF oWnd TO "Copiar Archivos" NOINSET CLOCK DATE KEYBOARD    ACTIVATE WINDOW oWnd CENTER RETURN NIL //----------------------------------------------------------------// FUNCTION Copiar( cOrigen, cDestino )    LOCAL oFs    If .not. Lisdir( cDestino )       LMkdir( cDestino )    Endif    CURSORWAIT()    oFs   := CreateObject( "Scripting.FileSystemObject" )    // oFs:CopyFile( "z:\systems\xml\*.xml" , "r:\backups\systems\xml\", .t. ) // .t. for overwrite    oFs:CopyFile( cOrigen, cDestino, .T. ) // .t. for overwrite    CURSORARROW()    ? "Pronto..." RETURN NIL
     
  6. Like
    zekasan got a reaction from kapiaba in Janela está aberta??? CreateObject("InternetExplorer.Application")   
    COLOQUEI O SEGUINTE
        do whil .t.
            try
                CONDICAO:=oOle:readystate
            catch
                exit
            end
            syswait(.5)
        enddo
  7. Like
    zekasan got a reaction from kapiaba in Problema na Busca do Cnpj site da receita   
    caracas, comeu de novo o caracter colchete, tem quer sre IO:=ARR0+caracter colchete+ I + caracter colchete
     
  8. Like
    zekasan got a reaction from kapiaba in Problema na Busca do Cnpj site da receita   
    Boa tarde, eu dei uma mudadinha, retorna um array com os dados
     
    FUNCTION PEGA_CNPJ(PROC_CNPJ)
        Local oServerWS, cUrl, aCNPJ[12]
        if LEN(PROC_CNPJ)#14
            MSGINFO("Este busca não funciona para CPF!")
            return .t.
        endif
        
        cUrl:= "https://www.receitaws.com.br/v1/cnpj/"+PROC_CNPJ
        Try
            oServerWS := CreateObject( 'MSXML2.ServerXMLHTTP.5.0' )  
        Catch oError
            try
                oServerWS := CreateObject( 'MSXML2.ServerXMLHTTP.6.0' )  
            catch oError
                try
                    oServerWS := CreateObject("Microsoft.XMLHTTP")
                catch oError
                    ? e:Description
                    return nil
                end
            END
        end
        TRY
            oServerWS:open('GET', cUrl, .f.)
            oServerWS:setRequestHeader('Content-Type'    , 'text/xml; charset=utf-8')    // Obtém ou define o valor de cabeçalho de Content-type HTTP. 
            oServerWS:send()    
        CATCH
            ? "Não conseguiu enviar solicitação para requisição dos dados do CNPJ"
            return .t.
        END
         
        * Verifica o status do request. Exibe erro se houver
        IF oServerWS:Status != 200 // OK
            MsgStop( Alltrim(STR(oServerWS:Status)) +" - "+ oServerWS:StatusText , "Erro")
            RETURN NIL
        ENDIF
         
        WHILE oServerWS:readyState != 4
            oServerWS:waitForResponse(1000)
        END   
             
        * decodifica o arquivo json e transforma em um array multidimensional
        **    x :=  hb_jsondecode( oServerWS:responseText, @aArray )
        txt:=  oServerWS:responseText
    *? txt   
        Arq_1:=ALLTRIM(txt)                                              
        ARR0:=HB_ATokens( Arq_1, CHR(10) )
    *xbrowse(ARR0)
        TAB:={}
        QT:=0
        n_f1:=""
        n_f2:=""
        FOR I=1 TO LEN(ARR0)
            if substr(ARR0,4,4) = "nome"  // REG 1 - Nome
                I0:=ARR0   
                I0:=StrTran( I0, "nome" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[1] := alltrim(I0)
                endif
            endif
            if substr(ARR0,4,2) = "uf"  // REG 2 - UF
                I0:=ARR0    
                I0:=StrTran( I0, "uf" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[2] := alltrim(I0)
                endif
            ENDIF
            if substr(ARR0,4,10) = "logradouro"  // REG 3 - LOGRADOURO
                I0:=ARR0
                I0:=StrTran( I0, "logradouro" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[3] := alltrim(I0)
                endif
            ENDIF
            if substr(ARR0,4,6) = "numero"  // REG 4 - NÚMERO
                I0:=ARR0
                I0:=StrTran( I0, "numero" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[4] := alltrim(I0)
                endif
            ENDIF
            
            if substr(ARR0,4,3) = "cep"  // REG 5 - CEP
                I0:=ARR0
                I0:=StrTran( I0, "cep" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" )
                I0:=StrTran( I0, "." )
                I0:=StrTran( I0, "-" )
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[5] := transform(alltrim(I0),"@R 99999-999")
                endif
            ENDIF
            
            if substr(ARR0,4,9) = "municipio"  // REG 6 - MUNICÍPIO
                I0:=ARR0
                I0:=StrTran( I0, "municipio" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[6] := alltrim(I0)
                endif
            ENDIF
            
            if substr(ARR0,4,8) = "abertura"  // REG 7 - DT ABERTURA
                I0:=ARR0
                I0:=StrTran( I0, "abertura" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[7] := alltrim(I0)
                endif
            ENDIF
            
            if substr(ARR0,4,6) = "bairro" // REG 8 - BAIRRO
                I0:=ARR0
                I0:=StrTran( I0, "bairro" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[8] := alltrim(I0)
                endif
            ENDIF
            
            if substr(ARR0,4,11) = "complemento"  // REG 9 - COMPLEMENTO
                I0:=ARR0
                I0:=StrTran( I0, "complemento" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[9] := alltrim(I0)
                endif
            ENDIF
            
            if substr(ARR0,4,5) = "email"  // REG 10 - EMAIL
                I0:=ARR0
                I0:=StrTran( I0, "email" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[10] := alltrim(I0)
                endif
            ENDIF
            
            
            if substr(ARR0,4,8) = "telefone"  // REG 11 - TELEFONE
                I0:=ARR0
                I0:=StrTran( I0, "telefone" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[11] := alltrim(I0)
    *                IF AT("/",TEL_C)>0
    *                    TEL_C:=ALLTRIM(LEFT(TEL_C,AT("/",TEL_C)-1))
    *                ENDIF
                endif
            ENDIF
            
            
            if substr(ARR0,4,8) = "fantasia"  // REG 12 - FANTASIA
                I0:=ARR0
                I0:=StrTran( I0, "fantasia" ) 
                I0:=StrTran( I0, ":" ) 
                I0:=StrTran( I0, "," ) 
                I0:=StrTran( I0, ";" ) 
                I0:=StrTran( I0, CHR(34) ) 
                if len(alltrim(I0))>0
                    aCNPJ[12] := alltrim(I0)
                endif
            ENDIF
        
        NEXT
    *    xbrowse(aCNPJ)
    RETURN(aCNPJ)
  9. Like
    zekasan got a reaction from Ronaldbuch in CAPTCHA - isto me tira do sério   
    Ele de vez em qdo demora prá responder
  10. Like
    zekasan got a reaction from Ronaldbuch in CAPTCHA - isto me tira do sério   
    Bom dia, alguma alma caridosa poderia me dizer como eu pego esta bendita imagem (www.ietpb.com.br) e a coloco em uma dialog?
    Já vasculhei em todo canto e não consegui, nadei e morri na praia. Esta imagem é gerada pelo link "http://www.ieptb.com.br/geracaptcha.php".
    Obrigado.
  11. Like
    zekasan reacted to emotta in Por uma data saber qual numero da semana dentro do mes   
    Essa é ainda melhor:
    Function SemanaMes(dData) Return WoM(dData)
  12. Like
    zekasan got a reaction from kapiaba in Por uma data saber qual numero da semana dentro do mes   
    Function SemanaMes( data )
    return (week(data) - week(bom(data)) + 1)
  13. Like
    zekasan got a reaction from kapiaba in Consulta SINTEGRA pelo CNPJ   
    ELSEIF ::cUF == "RJ"
    oActiveXdo:All:Item("CGC",0):Value := cCnpj
    * oActiveXdo:All:Item("cod_img",0):Focus()
    oActiveXdo:All:Item("recaptcha_response_field",0):Focus()
×
×
  • Create New...