segunda-feira, 6 de fevereiro de 2017

Aula 1058 - Windev - Webservice - 009 - Buscar Cep WebService Correio









Video no Youtube Se Gostou clique aqui para dar joinha






Nessa Aula vou Mostrar como Buscar o Cep no correio Via WebService.
Essa Dica peguei no Curso do pedrosão.



//Buscar Cep WebService

_url is string="http://correiosapi.apphb.com/cep/"+EDT_cep
solicitacao is a httpRequest //Inicia uma solicitacao HTTP em um Servidor.
resposta is a httpResponse // Recuperar a resposta do httprequest
solicitacao..URL=_url
solicitacao..Method=httpGet
resposta=RESTSend(solicitacao) // Envia uma solicitação e aguarda a resposta do servidor
IF resposta..StatusCode=200 THEN
ELSE
    Info(resposta..StatusCode+CR+resposta..DescriptionStatusCode)   
END
retorno is ANSI string=UTF8ToString(resposta..Content)
SAI_TextoJson=Utilitarios_matos_wdk.remove_acento_util_wdk(retorno)
// Estou colocando retorno no meu texto Json
_cep_ is Structure
    cep is string
    tipoDeLogradouro is string
    logradouro  is string
    bairro  is string
    cidade  is string
    estado  is string
END
//Criando uma Estrutura Cep
Estrutura_json is _cep_
Deserialize(Estrutura_json,SAI_TextoJson,psdJSON)
EDT_rua=Estrutura_json.logradouro
EDT_bairro=Estrutura_json.bairro
EDT_Cidade=Estrutura_json.cidade
EDT_Estado=Estrutura_json.estado
EDT_TipodeLogradouro=Estrutura_json.tipoDeLogradouro

//{"cep":"93410130","tipoDeLogradouro":"Rua","logradouro":"Paraíba",
//"bairro":"Pátria Nova","cidade":"Novo Hamburgo","estado":"RS"}
//200: solicitacao processada com êxito
//301: documento movido permanentemente
//302: Documento mudou temporariamente
//403: O servidor entendeu o pedido, mas recusa-se a executá-lo.
//404: não encontrado
//500: erro interno do servidor
//503: Serviço temporariamente indisponível ou manutenção



http://doc.windev.com/en-US/?1000021476&name=restsend_function
http://doc.pcsoft.fr/fr-FR/?1000021165&name=httpresponse_type_variable
http://doc.windev.com/en-US/?3043007&name=httprequest_function




Criar Projeto WebService - Lista Site - - WebService - 001/...
Deploy - Gerando WebService/Levando Servidor/Instalar/Mostrar - WebService - 002/...
Instalando SoapUI - Testar WebService - Aula 1040 - WebService - 003/...
Ajustando Xml Lista Site WebService - WebService - 004/...
Consumir WebService - WebService - 005
Xml - Consumir Ler Xml e colocar Tabela - WebService - 006
Dolar - Consumir WebService - Cotação Dolar - 007
Cnpj Receita - Consumir WebService - 008/...
Cep Buscar WebService Correio - WebService - 009/...
CONSULTA CADASTRO SEFAZ P-1 - DICAS 1871 - WINDEV_23 - WEBSERVICE 010 -
















sábado, 4 de fevereiro de 2017

Aula 1057 - WinDev Tabela - 042 - .Border Novidade Windev 22









Video no Youtube Se Gostou clique aqui para dar joinha







// Vou Mostrar como Alterar a Borda Via programacao.
// vou Fazer um colando borda na coluna de uma linha
// da tabela





_configura is a Border
_configura..Thickness = 2 // Espessura
_configura..Color = PastelRed // Cor
_configura..LineBottom..Color = DarkRed // Cor Linha Inferir
_configura..LineBottom..Type =LineDash // Tipo Linha

TABLE_indices[3].COL_Valor..Border = _configura
LIB_observacao..Border=_configura
Info("Continua.. Outras Configurações")

//Outras Configurações
_configura..Round=4 // Borda Arredondada

_configura..Line=TraitTiret // Tipo Da Linha

_configura..Edges=BorderBottom // Borda tem somente inferior

TABLE_indices[3].COL_Valor..Border = _configura
LIB_observacao..Border=_configura






http://doc.windev.com/en-US/?15140100&name=cadre_type_variable



WinDev - Tabela - 001/... Ancorar Tabela e coluna
WinDev - Tabela - 002/... Esconder ou Mostrar Coluna Tabela 
WinDev - Tabela - 003/... Mudar Cor e Fundo da Coluna da Tabela 
WinDev - Tabela - 004/... Mudar Largura e Fonte da Coluna da Tabela 
WinDev - Tabela - 005/... Coluna de valor Deixar em Branco 
WinDev - Tabela - 006/... Alterar Nome,Cor,Cor de Fundo da Coluna da Tabela 
WinDev - Tabela - 007/... Alterar ordem das Colunas por Programacao
WinDev - Tabela - 008/... TableSeek Pesquizar se Existe
WinDev - Tabela - 009/... TableSelectPlus - Seleciona Iten tabela
WinDev - Tabela - 010/... TableSort - Classifica Coluna
WinDev - Tabela - 011/... Zoom
WinDev - Tabela - 012/... for Each Row Of - Percorrer
WinDev - Tabela - 013/... Selecionar Varias Linhas
WinDev - Tabela - 014/... Balao - Tabela ToolTip
WinDev - Tabela - 015/... Coluna Contrainer
WinDev - Tabela - 016/... Sum - Como Mudar Nome
WinDev - Tabela - 017/... TableInfoXY - Saber Nome,Posição e Linha da Coluna 
WinDev - Tabela - 018/... Guardar e Recuperar Posição Tabela
WinDev - Tabela - 019/... TableInputsearch
WinDev - Tabela - 020/... Descobrir Posição cliente Novo
WinDev - Tabela - 021/... Saber quantos e nome das Colunas
WinDev - Tabela - 022/... Tableselect - Selecionar varias linhas tabela e Ler
WinDev - Tabela - 023/... BuildBrowsingTable - Cria Tabela Manual
WinDev - Tabela - 024/... Somar Valor Tabela Automatico ou Manual - rowtotal
WinDev - Tabela - 025/... Eventos no cabecalho da Tabela
WinDev - Tabela - 026/... Tabela - Break - Totalizadores
WinDev - Tabela - 027/... Tabela - Colorir Linha
WinDev - Tabela - 028/... Double click Na seleção Item
WinDev - Tabela - 029/... Tabela - Descrição, Em Varias Linhas Coluna Tabela
WinDev - Tabela - 030/... Tabela - Fazer titulos com colunas
WinDev - Tabela - 031/... Tabela - Sql - Query - Agrupar Datas Nas Notas
WinDev - Tabela - 032/... Pintando Tabela
WinDev - Tabela - 033/... FOR EACH / WHERE / on / Ordem
WinDev - Tabela - 034/... Filter 
WinDev - Tabela - 035/... HFilter
WinDev - Tabela - 036/... Ultimo Registro - TableSelectPlus
WinDev - Tabela - 037/... Desabilitar Edição Tabela
WinDev - Tabela - 038/... Pesquisa - TableEnableFilter
Blog - WinDev - Relatorio - 039/... Copias - IParameter - Icopies
WinDev - Tabela - 040/... Cor Negativo Coluna Saldo
WinDev - Tabela - 041/... - Criar Tabela via programação
Borda - TAbela - 042/... - Novidade Windev22
..VisibleInExportAndPrint - Colunas Nao Levar Exportar e Imprimir - WinDev - Tabela - 043




Alinhar - Relatorio Alinhar Texto - Blog - WinDev - Relatorio - 009/... 
Borda - Iborder - Blog - WinDev - Relatorio - 034/...
Break - Pular Página Break - IpageEnd() - Blog - WinDev - Relatorio - 023/... 
Break e totalizadores de valores - Blog - WinDev - Relatorio - 012/...
Campo Vertical - Angle Blog - WinDev - Relatorio - 005/...
Caption Mudar - Blog - WinDev - Relatorio - 031/...  
Configura e Filtro - Blog - WinDev - Relatorio - 001/... 
Criar Tabela via programação - WinDev - Tabela - 041/... -
Copias - IParameter - Icopies - Blog - WinDev - Relatorio - 039/... 
Cor Negativo Coluna Saldo - WinDev - Tabela - 040/...  
Data - Pagina Inicial/Final - Data Hora - Blog - WinDev - Relatorio - 022/...
Destino - IDestination - Destino do Relatorio - Blog - WinDev - Relatorio - 027/...
Duas Paginas - Como fazer quando sai duas paginas? - Blog - WinDev - Relatorio - 006/...
Filtro - Blog - WinDev - Relatorio - 021/...
Impressoras - Mostrar impressoras/Selecionar e Imprimir - Blog - WinDev - Relatorio - 026/... 
Intervalo Bancos - Blog - WinDev - Relatorio - 032/...  
Configuracao - IParameterReport - Blog - WinDev - Relatorio - 002/... 
Fonte Alterar - Blog - WinDev - Relatorio - 018/...  
Fonte Seleciona - ISelectFont - Blog - WinDev - Relatorio - 037/...
Layout - Blog - WinDev - Relatorio - 004/... 
Linha Acrescentar - Blog - WinDev - Relatorio - 019/... Acrescentar -  
Linha Mais de 2 - Mais informacoes no Campo - Blog - WinDev - Relatorio - 038/...
Manual - Relatorio - Totalmente Manual - Blog - WinDev - Relatorio - 015/... 
Manual Linha - IHLine - Blog - WinDev - Relatorio - 033/...
Manual - Iprint - Relatorio Manual - Blog - WinDev - Relatorio - 028/...
Marca D´Agua - Blog - WinDev - Relatório - 003/...
Multi Line - Imprimir Linha Multi Line - Blog - WinDev - Relatorio - 007/... 
Numero Com Espaco - Blog - WinDev - Relatorio - 036/...
Orientação - Relatorio Mudar Orientação - Blog - WinDev - Relatorio - 025/... 
Pagina Numero - IPageNum - Blog - WinDev - Relatorio - 035/...  
Pdf - Relatorio - Gerar Pdf - Blog - WinDev - Relatorio - 020/... 
Posicoes do Relatorio Alterar - Blog - WinDev - Relatorio - 017/... Alterar - 
Retorno de Relatorio - Result - Blog - WinDev - Relatorio - 013/...
Selecionados - Imprime Somente Selecionados/Todos Tabela - Blog - WinDev - Relatorio - 011/...
Tabela - Imprimir Tabela com TablePrint - Blog - WinDev - Relatorio - 024/...
Tabela - Dica Tabela e print - Blog - WinDev - Relatorio - 029/...
Totalizador - Colocar Totalizador - Blog - WinDev - Relatorio - 010/...
Totalizadores - Blog - WinDev - Relatorio - 030/...
Zebrada - Linha Zebrada - Blog - WinDev - Relatorio - 016/...
Zerar Totalizador - Blog - WinDev - Relatorio - 014/...
Zero - Relatorio Valor Zero deixar Branco - Blog - WinDev - Relatorio - 008/...













sexta-feira, 3 de fevereiro de 2017

Aula 1056 - WebService - 008 - Consumir WebService - Cnpj Receita









Video no Youtube Se Gostou clique aqui para dar joinha

Video ErpMatos, Já com a Função de Buscar Cnpj Receita



help1


https://www.receitaws.com.br/api




Criar Projeto WebService - Lista Site - - WebService - 001/...
Deploy - Gerando WebService/Levando Servidor/Instalar/Mostrar - WebService - 002/...
Instalando SoapUI - Testar WebService - Aula 1040 - WebService - 003/...
Ajustando Xml Lista Site WebService - WebService - 004/...
Consumir WebService - WebService - 005
Xml - Consumir Ler Xml e colocar Tabela - WebService - 006
Dolar - Consumir WebService - Cotação Dolar - 007
Cnpj Receita - Consumir WebService - 008/...
Cep Buscar WebService Correio - WebService - 009/...



//Retorno Json
{
  "atividade_principal": [
    {
      "text": "Desenvolvimento e licenciamento de programas de computador customizáveis",
      "code": "62.02-3-00"
    }
  ],
  "data_situacao": "03/11/2005",
  "complemento": "SALA 15",
  "nome": "MATOS INFORMATICA - EIRELI - EPP",
  "uf": "RS",
  "telefone": "(51) 3595-1132 / (51) 3595-2474",
  "atividades_secundarias": [
    {
      "text": "Desenvolvimento e licenciamento de programas de computador não-customizáveis",
      "code": "62.03-1-00"
    }
  ],
  "qsa": [
    {
      "qual": "65-Titular Pessoa Física Residente ou Domiciliado no Brasil",
      "nome": "AMARILDO DE MATOS"
    }
  ],
  "situacao": "ATIVA",
  "bairro": "PATRIA NOVA",
  "logradouro": "R PARAIBA",
  "numero": "198",
  "cep": "93.410-130",
  "municipio": "NOVO HAMBURGO",
  "abertura": "23/05/1989",
  "natureza_juridica": "230-5 - Empresa Individual de Responsabilidade Limitada (de Natureza Empresária)",
  "cnpj": "92.715.978/0001-58",
  "ultima_atualizacao": "2017-01-04T22:35:08.977Z",
  "status": "OK",
  "tipo": "MATRIZ",
  "fantasia": "",
  "email": "",
  "efr": "",
  "motivo_situacao": "",
  "situacao_especial": "",
  "data_situacao_especial": "",
  "capital_social": "100000.00",
  "extra": {}
}
//





//Buscar em Json
// https://www.receitaws.com.br/v1/cnpj/NumeroCnpj
//https://www.receitaws.com.br/v1/cnpj/92715978000158
s_url is string="https://www.receitaws.com.br/v1/cnpj/"+SAI_Cnpj
IF HTTPRequest(s_url) THEN
    SAI_resultado= HTTPGetResult()
    //Vai retornar os dados do cnpj em Json
END

_dados_atividade is Structure
    text is string
    code is string
FIN
_dados_qsa is Structure
    qual is string 
    nome is string
FIN
_dados_cnpj is Structure
    atividade_principal is array of _dados_atividade
    atividades_secundarias  is array of _dados_atividade
    qsa is array of _dados_qsa
    data_situacao is string
    complemento is string
    nome is string
    uf is string
    telefone is string   
    situacao is string
    bairro is string
    logradouro is string
    numero is string
    cep is string
    municipio is string
    abertura is string
    natureza_juridica is string
    cnpj is string
    ultima_atualizacao is string
    status is string
    tipo is string
    fantasia is string
    email is string
    efr is string
    motivo_situacao is string
    situacao_especial is string
    data_situacao_especial is string
    capital_social is string   
END
   
_estrutura_dados_cnpj is _dados_cnpj
Deserialize(_estrutura_dados_cnpj,SAI_resultado,psdJSON)

FOR EACH _atividade OF _estrutura_dados_cnpj.atividade_principal
    Info(_atividade.text+CR+_atividade.code)   
END
FOR EACH _atividade_secundaria OF _estrutura_dados_cnpj.atividades_secundarias
    Info(_atividade_secundaria.text+CR+_atividade_secundaria.code)   
END
FOR EACH _dados_qsa OF _estrutura_dados_cnpj.qsa
    Info(_dados_qsa.qual+CR+_dados_qsa.nome)   
END
Info(_estrutura_dados_cnpj.nome+CR+...
_estrutura_dados_cnpj.data_situacao+CR+...
_estrutura_dados_cnpj.complemento+CR+...
_estrutura_dados_cnpj.nome+CR+...
_estrutura_dados_cnpj.uf+CR+...
_estrutura_dados_cnpj.telefone+CR+...
_estrutura_dados_cnpj.situacao+CR+...
_estrutura_dados_cnpj.bairro+CR+...
_estrutura_dados_cnpj.logradouro+CR+...
_estrutura_dados_cnpj.numero+CR+...
_estrutura_dados_cnpj.cep+CR+...
_estrutura_dados_cnpj.municipio+CR+...
_estrutura_dados_cnpj.abertura+CR+...
_estrutura_dados_cnpj.natureza_juridica+CR+...
_estrutura_dados_cnpj.cnpj+CR+...
_estrutura_dados_cnpj.ultima_atualizacao+CR+...
_estrutura_dados_cnpj.status+CR+...
_estrutura_dados_cnpj.tipo+CR+...
_estrutura_dados_cnpj.fantasia+CR+...
_estrutura_dados_cnpj.email+CR+...
_estrutura_dados_cnpj.efr+CR+...
_estrutura_dados_cnpj.capital_social)




















quinta-feira, 2 de fevereiro de 2017

Aula 1055 - WebService - 007 - Consumir WebService - Cotação Dolar









Video no Youtube Se Gostou clique aqui para dar joinha



http://api.promasters.net.br/cotacao/



help1




Criar Projeto WebService - Lista Site - - WebService - 001/...
Deploy - Gerando WebService/Levando Servidor/Instalar/Mostrar - WebService - 002/...
Instalando SoapUI - Testar WebService - Aula 1040 - WebService - 003/...
Ajustando Xml Lista Site WebService - WebService - 004/...
Consumir WebService - WebService - 005
Xml - Consumir Ler Xml e colocar Tabela - WebService - 006
Dolar - Consumir WebService - Cotação Dolar - 007
Cnpj Receita - Consumir WebService - 008/...




//Buscar em Json
// http://api.promasters.net.br/cotacao/
s_url is string="http://api.promasters.net.br/cotacao/v1/valores"
IF HTTPRequest(s_url) THEN
    SAI_Resultado= HTTPGetResult()
END
let jz=JSONToVariant(SAI_Resultado)
TableDeleteAll(TABLE_indices)
FOR EACH _m OF jz..Member
    TableAddLine(TABLE_indices,_m..Name+TAB+" = "+_m..Value)
    TableAddLine(TABLE_indices,"=========================")
    mebros(_m)   
END
    INTERNAL PROCEDURE mebros(x)   
    FOR EACH _m2 OF x..Member
        TableAddLine(TABLE_indices,_m2.nome,_m2.valor,_m2.fonte,_m2.ultima_consulta)
    END          
    END





//

//Buscal em Xml
s_url is string="http://api.promasters.net.br/cotacao/v1/valores?alt=xml"
IF HTTPRequest(s_url) THEN   
    SAI_Resultado= HTTPGetResult()   
END
TableDeleteAll(TABLE_indices) // Elimina Dados da Tabela
XMLDocument("XML1",SAI_Resultado)
_status is string=XMLRead("XML1","/Root/status")
TableAddLine(TABLE_indices,"Status",_status)
s_nome is string=""
s_valor is string=""
s_fonte is string=""
s_ultima_consulta is string=""
s_nome_tag is string=""  
XMLFind("XML1",Null,XMLElément+XMLChildItem,XMLStartWith)
WHILE XMLFound("XML1")   //Percorrer xml       
    SWITCH XMLElementType("XML1") 
        CASE XMLTag :
            s_nome_tag = XMLElementName("XML1") // vou pegar nome da tag
            IF s_nome_tag="nome" THEN s_nome=XMLData("XML1")
            IF s_nome_tag="valor" THEN s_valor=XMLData("XML1")
            IF s_nome_tag="ultima_consulta" THEN s_ultima_consulta=XMLData("XML1")
            IF s_nome_tag="fonte" THEN s_fonte=XMLData("XML1")
    END
    IF s_fonte<>"" THEN
        TableAddLine(TABLE_indices,s_nome,s_valor,s_fonte,s_ultima_consulta)       
        s_nome=""
        s_valor=""
        s_fonte=""
        s_ultima_consulta=""       
    END
    XMLNext("XML1")
END
XMLClose("XML1")
//Fim Buscal em Xml






Criar Projeto WebService - Lista Site - - WebService - 001/...
Deploy - Gerando WebService/Levando Servidor/Instalar/Mostrar - WebService - 002/...
Instalando SoapUI - Testar WebService - Aula 1040 - WebService - 003/...
Ajustando Xml Lista Site WebService - WebService - 004/...
Consumir WebService - WebService - 005
Xml - Consumir Ler Xml e colocar Tabela - WebService - 006



















quarta-feira, 1 de fevereiro de 2017

Aula 1053 - WinDev json 2/... - Ler Jason e Adicionar Tabela - JSONVersVariant









Video no Youtube Se Gostou clique aqui para dar joinha



http://doc.pcsoft.fr/fr-FR/?1000021296&name=jsonversvariant_fonction



//Nessa aula vou mostrar como ler dados Json e colocar Tabela

s_json_dados is string=[
{"status": true,"valores":
{
"USD": {"nome": "Dolar","valor": 2.333,"ultima_consulta": 1386349203,"fonte": "UOL Economia - http://economia.uol.com.br/cotacoes/"},
"EUR": {"nome": "Euro","valor": 3.195,"ultima_consulta": 1386349203,"fonte": "UOL Economia - http://economia.uol.com.br/cotacoes/"},
"BTC": {"nome": "Bitcoin","valor": 2620,"ultima_consulta": 1386352803,"fonte": "Mercado Bitcoin - http://www.mercadobitcoin.com.br/"
}
}
}
]
let jz=JSONToVariant(s_json_dados)
TableDeleteAll(TABLE_indices)
FOR EACH _m OF jz..Member
    TableAddLine(TABLE_indices,_m..Name+TAB+" = "+_m..Value)
    TableAddLine(TABLE_indices,"=========================")
    mebros(_m)   
END
    INTERNAL PROCEDURE mebros(x)   
    FOR EACH _m2 OF x..Member
        TableAddLine(TABLE_indices,_m2.nome,_m2.valor,_m2.fonte,_m2.ultima_consulta)
    END          
    END
   
   






















Deserialise - Aula 1050 - WinDev Json - 001/...
JSONVersVariant - Aula 1053 - WinDev Json - 002/...
DICAS 2047 - WINDEV WEBDEV IOS - JSON 3 - HExportJSON





Teste

Teste
teste