<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3268238432720384647</id><updated>2025-05-07T17:45:03.144-07:00</updated><title type='text'>Programação Advpl</title><subtitle type='html'>Um espaço aonde será publicado artigos que focam a programação Advpl e exemplos práticos com base em possíveis necessidades dos usuários</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-7647796613390341525</id><published>2020-04-03T22:08:00.003-07:00</published><updated>2020-04-03T22:09:53.721-07:00</updated><title type='text'></title><content type='html'>&lt;h2 style=&quot;background-color: white; color: #222222; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;Hoje irei disponibilizar um código em advpl para verificar a similaridade de duas strings. Ele é uma adaptação que eu fiz baseado no algorítimo de&amp;nbsp;Levenshtein.&lt;br /&gt;Mais detalhes no link :&lt;a href=&quot;https://www.dotnetperls.com/levenshtein&quot; target=&quot;_blank&quot;&gt;Levenshtein distance&lt;/a&gt;&lt;br /&gt;Basicamente ele informa quantos operações serão necessárias para deixar uma string igual a outra. Algo muito utilizado em corretores ortográficos como também em aplicações de IA em que podemos analisar a resposta dada por algum usuário em um questionário ou um Chatbot.&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;background-color: white; color: #222222; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;Por exemplo, a distância Levenshtein entre as palavras inglesas &quot;kitten&quot; (gato) e &quot;sitting&quot; (sentando-se) é 3, já que com apenas 3 edições conseguimos transformar uma palavra na outra, e não há maneira de o fazer com menos de três edições:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;kitten&lt;/li&gt;
&lt;li&gt;
sitten (substituição de &#39;k&#39; por &#39;s&#39;)&lt;/li&gt;
&lt;li&gt;
sittin (substituição de &#39;e&#39; por &#39;i&#39;)&lt;/li&gt;
&lt;li&gt;
sitting (inserção de &#39;g&#39; no final)&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/span&gt;&lt;ol style=&quot;background-color: white; color: #222222; list-style-image: none; margin: 0.3em 0px 0px 3.2em; padding: 0px;&quot;&gt;
&lt;/ol&gt;
&lt;ol style=&quot;background-color: white; color: #222222; list-style-image: none; margin: 0.3em 0px 0px 3.2em; padding: 0px;&quot;&gt;
&lt;/ol&gt;
&lt;ol style=&quot;background-color: white; color: #222222; list-style-image: none; margin: 0.3em 0px 0px 3.2em; padding: 0px;&quot;&gt;
&lt;/ol&gt;
&lt;ol style=&quot;background-color: white; color: #222222; list-style-image: none; margin: 0.3em 0px 0px 3.2em; padding: 0px;&quot;&gt;
&lt;/ol&gt;
&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Segue o fonte:&lt;/div&gt;
&lt;div style=&quot;background-color: #1e1e1e; line-height: 19px;&quot;&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;#INCLUDE&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;PROTHEUS.CH&quot;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;#INCLUDE&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;RWMAKE.CH&quot;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;tbiconn.ch&#39;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #6a9955;&quot;&gt;//recebe&amp;nbsp;duas strings como parâmetro e realiza a comparação entre elas usando&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #6a9955; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier new&amp;quot; , monospace; font-size: 14px; white-space: pre;&quot;&gt;//o algorítimo de &lt;/span&gt;&lt;span style=&quot;color: #6a9955; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier new&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;font-size: 14px; white-space: pre;&quot;&gt;Levenshtein&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;User&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;Function&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;POSTRING&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;Local&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;Local&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;Local&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;sa&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;:=&amp;nbsp;{}&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;Local&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ta&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;:=&amp;nbsp;{}&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #6a9955;&quot;&gt;//transformar&amp;nbsp;string&amp;nbsp;em&amp;nbsp;array&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;len&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;aaDD&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;sa&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,SubStr&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;))&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;len&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;aaDD&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ta&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,SubStr&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;))&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;Len&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;Len&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;Array&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;)&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #6a9955;&quot;&gt;//colocando&amp;nbsp;zeros&amp;nbsp;nas&amp;nbsp;posições&amp;nbsp;do&amp;nbsp;array&amp;nbsp;pois&amp;nbsp;n&amp;nbsp;pode&amp;nbsp;ter&amp;nbsp;elemento&amp;nbsp;nulo&amp;nbsp;(nil)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;EndIf&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;Endif&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;:=&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;To&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cost&lt;/span&gt;&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;iif&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ta&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&amp;nbsp;==&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;sa&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;Min&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;Min&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;nbsp;-&amp;nbsp;&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&amp;nbsp;+&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cost&lt;/span&gt;)&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;next&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; white-space: pre;&quot;&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;Return&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;d&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/7647796613390341525/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2020/04/hoje-irei-disponibilizar-um-codigo-em.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7647796613390341525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7647796613390341525'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2020/04/hoje-irei-disponibilizar-um-codigo-em.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-464540565461005186</id><published>2018-07-03T19:07:00.002-07:00</published><updated>2018-07-03T19:07:55.543-07:00</updated><title type='text'></title><content type='html'>Novo Blogger da empresa ERP Consult Brasil&lt;br /&gt;
&lt;br /&gt;
http://erpconsultbrasil.blogspot.com/</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/464540565461005186/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2018/07/novo-blogger-da-empresa-erp-consult.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/464540565461005186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/464540565461005186'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2018/07/novo-blogger-da-empresa-erp-consult.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-2257950956227806898</id><published>2017-10-18T15:11:00.000-07:00</published><updated>2017-10-18T15:11:04.476-07:00</updated><title type='text'>Integração Protheus vs Arduino</title><content type='html'>Neste artigo rápido, gostaria de mostrar uma simples integração entre o ERP Protheus e o Arduino. Não irei aprofundar-me na arquitetura da plataforma arduino, mas resumidamente, ele permite uma ótima integração entre software e hardware.&lt;br /&gt;
&lt;br /&gt;
Imagine poder controlar a rotação de um motor elétrico, nível de luminosidade em determinado ambiente, abrir e fechar circuitos, acionar alarmes, trabalhar com diversos sensores como de temperatura, de presença&amp;nbsp; usando o ERP Protheus. Com o arduino, isso é possível. E para começar a mostrar as possibilidades, irei iniciar com um projeto bem simples aonde uma tela em advpl terá botões que irão controlar o acendimento de leds.&lt;br /&gt;
&lt;br /&gt;
Para começar, segue abaixo o código usado na IDE do Arduino:&lt;br /&gt;
&lt;br /&gt;
const int LEDa = 13;&lt;br /&gt;
const int LEDb = 12;&lt;br /&gt;
const int LEDc = 11;&lt;br /&gt;
const int LEDd = 10;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&amp;nbsp; Serial.begin(9600);&amp;nbsp; &amp;nbsp; //configura comunicação serial com 9600 bps&lt;br /&gt;
&amp;nbsp; pinMode(LEDa,OUTPUT);&amp;nbsp; &amp;nbsp;//configura pino do led como saída&lt;br /&gt;
&amp;nbsp; pinMode(LEDb,OUTPUT);&amp;nbsp; &amp;nbsp;//configura pino do led como saída&lt;br /&gt;
&amp;nbsp; pinMode(LEDc,OUTPUT);&amp;nbsp; &amp;nbsp;//configura pino do led como saída&lt;br /&gt;
&amp;nbsp; pinMode(LEDd,OUTPUT);&amp;nbsp; &amp;nbsp;//configura pino do led como saída&lt;br /&gt;
}&lt;br /&gt;
void loop() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if (Serial.available()) //se byte pronto para leitura&lt;br /&gt;
&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; apagaTudo();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; switch(Serial.read())&amp;nbsp; &amp;nbsp; &amp;nbsp; //verifica qual caracter recebido&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;A&#39;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //caso &#39;A&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; digitalWrite(LEDa,HIGH); //inverte estado do LED&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;B&#39;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //caso &#39;B&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; digitalWrite(LEDb,HIGH); //inverte estado do LED&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case &#39;C&#39;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //caso &#39;C&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; digitalWrite(LEDc,HIGH); //inverte estado do LED&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; case &#39;D&#39;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //caso &#39;D&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; digitalWrite(LEDd,HIGH); //inverte estado do LED&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void apagaTudo()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; digitalWrite(LEDa,LOW);&lt;br /&gt;
&amp;nbsp; digitalWrite(LEDb,LOW);&lt;br /&gt;
&amp;nbsp; digitalWrite(LEDc,LOW);&lt;br /&gt;
&amp;nbsp; digitalWrite(LEDd,LOW);&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Agora, a tela Protheus que irá controlar os leds:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
#INCLUDE &quot;rwmake.ch&quot;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
#INCLUDE &#39;PROTHEUS.CH&#39;&lt;/div&gt;
&lt;div&gt;
#include &quot;topconn.ch&quot;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
#INCLUDE &#39;FONT.CH&#39;&lt;/div&gt;
&lt;div&gt;
#INCLUDE &#39;COLORS.CH&#39;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
User Function intARDU()&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SetPrvt(&quot;oDlg1&quot;,&quot;oBtn1&quot;,&quot;oBtn2&quot;,&quot;oBtn3&quot;,&quot;oBtn4&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
oDlg1&amp;nbsp; &amp;nbsp; &amp;nbsp; := MSDialog():New( 092,232,225,748,&quot;INTEGRAÇÃO PROTHEUS VS ARDUINO&quot;,,,.F.,,,,,,.T.,,,.T. )&lt;/div&gt;
&lt;div&gt;
oBtn1&amp;nbsp; &amp;nbsp; &amp;nbsp; := TButton():New( 012,032,&quot;LED A&quot;,oDlg1,{|| SendMSG(&#39;A&#39;)},037,012,,,,.T.,,&quot;&quot;,,,,.F. )&lt;/div&gt;
&lt;div&gt;
oBtn2&amp;nbsp; &amp;nbsp; &amp;nbsp; := TButton():New( 012,080,&quot;LED B&quot;,oDlg1,{|| SendMSG(&#39;B&#39;)},037,012,,,,.T.,,&quot;&quot;,,,,.F. )&lt;/div&gt;
&lt;div&gt;
oBtn3&amp;nbsp; &amp;nbsp; &amp;nbsp; := TButton():New( 012,128,&quot;LED C&quot;,oDlg1,{|| SendMSG(&#39;C&#39;)},037,012,,,,.T.,,&quot;&quot;,,,,.F. )&lt;/div&gt;
&lt;div&gt;
oBtn4&amp;nbsp; &amp;nbsp; &amp;nbsp; := TButton():New( 012,176,&quot;LED E&quot;,oDlg1,{|| SendMSG(&#39;D&#39;)},037,012,,,,.T.,,&quot;&quot;,,,,.F. )&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
oDlg1:Activate(,,,.T.)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Return&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Static Function SendMSG(cMSG)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Local cCfg := &quot;COM3:9600,n,8,1&quot;&lt;/div&gt;
&lt;div&gt;
Local nH := 0&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
lRet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:= msOpenPort(nH,cCfg)&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
if(!lRet)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; Alert(&quot;Falha ao conectar com a porta serial&quot;)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; Return&lt;/div&gt;
&lt;div&gt;
EndIf&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
msWrite(nH,cMSG)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Return&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
A tela no Protheus deverá ficar assim:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwHo2j87htZKh8j4X7H-HvZIraZh1hZ0TqNqI-gCKI_n855ciDfGSTOimNektm4BX5YiIRNwdqHToz15E3OEYHMrroAVDRlJGRSJkJURIgW3CC5UOyjSUp8993k8NNq_O03bSRGxOkMAs/s1600/tela_protheus_arduino.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1600&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwHo2j87htZKh8j4X7H-HvZIraZh1hZ0TqNqI-gCKI_n855ciDfGSTOimNektm4BX5YiIRNwdqHToz15E3OEYHMrroAVDRlJGRSJkJURIgW3CC5UOyjSUp8993k8NNq_O03bSRGxOkMAs/s400/tela_protheus_arduino.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
O esquema da placa ficaria assim:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifRymVy61i5Rx9o9bQ5d0IdzpesH_19KBTKDS7UIpOJCxiYOlav4hDZuouLiAsbhIjiKZE4tPdO_SQrMyWxr3Qq35sWHv5oWQsFRsGPCsGy1DOPdo3SN9IJoCuMz_VPvyv3P5KkxXq3Ds/s1600/placa_arduino.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;900&quot; data-original-width=&quot;1600&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifRymVy61i5Rx9o9bQ5d0IdzpesH_19KBTKDS7UIpOJCxiYOlav4hDZuouLiAsbhIjiKZE4tPdO_SQrMyWxr3Qq35sWHv5oWQsFRsGPCsGy1DOPdo3SN9IJoCuMz_VPvyv3P5KkxXq3Ds/s400/placa_arduino.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Basicamente o Protheus irá se conectar com a placa Arduino usando a porta USB emulada como porta COM, por isso, o código advpl usa&amp;nbsp; msOpenPort.&lt;br /&gt;
&lt;br /&gt;
Por último, o resultado:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;iframe width=&quot;320&quot; height=&quot;266&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/SgXKyUqLH44/0.jpg&quot; src=&quot;https://www.youtube.com/embed/SgXKyUqLH44?feature=player_embedded&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/2257950956227806898/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2017/10/integracao-protheus-vs-arduino.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2257950956227806898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2257950956227806898'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2017/10/integracao-protheus-vs-arduino.html' title='Integração Protheus vs Arduino'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwHo2j87htZKh8j4X7H-HvZIraZh1hZ0TqNqI-gCKI_n855ciDfGSTOimNektm4BX5YiIRNwdqHToz15E3OEYHMrroAVDRlJGRSJkJURIgW3CC5UOyjSUp8993k8NNq_O03bSRGxOkMAs/s72-c/tela_protheus_arduino.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-5310645688398924112</id><published>2017-09-17T20:36:00.001-07:00</published><updated>2017-09-17T20:36:59.478-07:00</updated><title type='text'></title><content type='html'>Uma grande dor de cabeça para o desenvolvedor Advpl Protheus é a confecção de relatórios gráficos. Por não oferecer um bom ambiente de desenvolvimento, os relatórios à base do objeto TMSPrinter são construídos manualmente via código, gerando em muitos casos retrabalho, além de do fato do próprio componente em questão estar descontinuado pela TOTVS.&lt;br /&gt;
Uma opção para cobrir este &quot;vazio&quot; seria usar outras ferramentas disponíveis no mercado como o Crystal Reports ou Ireport. A primeira opção tem um custo um pouco elevado além da possibilidade de surgir problemas na integração e a exigência de cada micro ter uma ODBC criada para atender a conexão. Já o Ireport também pode apresentar problemas de integração e exige que cada micro tenha o Java instalado.&lt;br /&gt;
&lt;br /&gt;
Pesando em uma solução, criei uma arquitetura simples que oferece relatórios gráficos, com ferramenta de desenvolvimento rápido além de fácil integração com o Protheus, sem a necessidade de instalar dll, executáveis ou criação de ODBC. Basta apenas compilar um fonte e pronto, os relatórios já ficam disponíveis.&lt;br /&gt;
&lt;br /&gt;
A arquitetura basicamente é a seguinte:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhHwqWBe0kgZ9Ef4RAB0Y9YAjqDOJAGw1eYsmqI-DN5rqR1P7AoQyjKjvrENwH_SvPwNx8pI2aa_Daq4Z0j-ta1UczGOCe1TzveRQfY7OL4MLrMwN8lbyuD1q9WsVXc469k9lWy21V8jg/s1600/ARQUITETURA_RELATORIO.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;670&quot; data-original-width=&quot;722&quot; height=&quot;370&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhHwqWBe0kgZ9Ef4RAB0Y9YAjqDOJAGw1eYsmqI-DN5rqR1P7AoQyjKjvrENwH_SvPwNx8pI2aa_Daq4Z0j-ta1UczGOCe1TzveRQfY7OL4MLrMwN8lbyuD1q9WsVXc469k9lWy21V8jg/s400/ARQUITETURA_RELATORIO.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
O ambiente de desenvolvimento é bem parecida com as que temos hoje no mercado, abaixo um projeto aberto nele:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS5QzyweYEC7-wfSLo_7n_Idulh7F3EU47PVVqDv2_q2sh4aK06xlIclyGuMF0lZuvXylvNarvYiUPlGgJolxXY5n_4RuisOc48d_CC-mYWiO2NujyiKt8M3B7D9l8U29wUXE8jMicOvs/s1600/ambiente_desenvolvimento_rel.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;728&quot; data-original-width=&quot;1362&quot; height=&quot;342&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS5QzyweYEC7-wfSLo_7n_Idulh7F3EU47PVVqDv2_q2sh4aK06xlIclyGuMF0lZuvXylvNarvYiUPlGgJolxXY5n_4RuisOc48d_CC-mYWiO2NujyiKt8M3B7D9l8U29wUXE8jMicOvs/s640/ambiente_desenvolvimento_rel.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
E no Protheus um exemplo de um relatório feito pela ferramenta citada:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzG-moL-NZjCHSc52GuPhyHJvYFtniRBh-_7BWJNHXOmK81dfCYx130K38ct2NasHWr2ixB3ngQYd2WsuyoCsqaunSRHzCk6vGac_oVXGzexON_YAf-It5d_Ihhl_d3VMjwpZV1KvQN2U/s1600/parametros_protheus.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;724&quot; data-original-width=&quot;1364&quot; height=&quot;337&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzG-moL-NZjCHSc52GuPhyHJvYFtniRBh-_7BWJNHXOmK81dfCYx130K38ct2NasHWr2ixB3ngQYd2WsuyoCsqaunSRHzCk6vGac_oVXGzexON_YAf-It5d_Ihhl_d3VMjwpZV1KvQN2U/s640/parametros_protheus.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP6LFI571PokgG9zU8NDC8pMQ2hdrYTShBtRK9SDgDY8n7dr-XwwajqWoCj8I1S1lJFmWjOpG28c3YOlk5rp9oajSD3SsZLIEbdg2i5wJExxsReOoefxd6Sr6uv2gfiLGm9-x1FnA1l9c/s1600/relatorio_integrado.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1366&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP6LFI571PokgG9zU8NDC8pMQ2hdrYTShBtRK9SDgDY8n7dr-XwwajqWoCj8I1S1lJFmWjOpG28c3YOlk5rp9oajSD3SsZLIEbdg2i5wJExxsReOoefxd6Sr6uv2gfiLGm9-x1FnA1l9c/s640/relatorio_integrado.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
O relatório pode conter também gráficos, imagens etc.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Para mais informações, como valores , treinamento e implantações, basta entrar em contato pelo Skype luis.lacombe ou por e-mail : erpconsult@erpconsultbrasil.com.br&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/5310645688398924112/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2017/09/uma-grande-dor-de-cabeca-para-o.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5310645688398924112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5310645688398924112'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2017/09/uma-grande-dor-de-cabeca-para-o.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhHwqWBe0kgZ9Ef4RAB0Y9YAjqDOJAGw1eYsmqI-DN5rqR1P7AoQyjKjvrENwH_SvPwNx8pI2aa_Daq4Z0j-ta1UczGOCe1TzveRQfY7OL4MLrMwN8lbyuD1q9WsVXc469k9lWy21V8jg/s72-c/ARQUITETURA_RELATORIO.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-6921521897898203057</id><published>2015-06-17T19:19:00.001-07:00</published><updated>2015-06-17T19:19:28.590-07:00</updated><title type='text'></title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Olá desenvolvedores.... Publiquei um vídeo bem rápido ensinando o básico de como consumir um webservice em .net (C#) usando o Protheus. Espero que seja útil.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe width=&quot;320&quot; height=&quot;266&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/1yGw6LhsjlE/0.jpg&quot; src=&quot;https://www.youtube.com/embed/1yGw6LhsjlE?feature=player_embedded&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/6921521897898203057/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2015/06/ola-desenvolvedores.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6921521897898203057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6921521897898203057'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2015/06/ola-desenvolvedores.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/1yGw6LhsjlE/default.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-6007038413632637093</id><published>2014-07-13T21:14:00.002-07:00</published><updated>2014-07-13T21:14:51.860-07:00</updated><title type='text'>Pacote para desenvolvimento de integração Protheus e balança via porta serial</title><content type='html'>Estou disponibilizando um pacote para desenvolvedores advpl com o objetivo de desenvolver rdmakes de integração com balanças via comunicação serial. No vídeo&amp;nbsp;&lt;a href=&quot;http://youtu.be/28NJP7xbMpY&quot; style=&quot;background: rgb(255, 255, 255); border: 0px; color: #1b7fcc; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; line-height: 13px; margin: 0px; padding: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;http://youtu.be/28NJP7xbMpY&lt;/a&gt;&amp;nbsp;tem uma pequena demonstração e no link &amp;nbsp;http://www.4shared.com/rar/P-ejAam9ba/Pacote_Balanca.html? disponibilizo o pacote que vem com emulador de porta COM, simulador de balança além de um rdmake de exemplo.</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/6007038413632637093/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2014/07/pacote-para-desenvolvimento-de.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6007038413632637093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6007038413632637093'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2014/07/pacote-para-desenvolvimento-de.html' title='Pacote para desenvolvimento de integração Protheus e balança via porta serial'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-1958882815287231600</id><published>2014-03-09T18:38:00.003-07:00</published><updated>2014-03-09T18:38:50.114-07:00</updated><title type='text'></title><content type='html'>Obter endereço a partir de um cep com ADVPL&lt;br /&gt;
&lt;br /&gt;
Abaixo abaixo estou disponibilizando um pequeno código que recebe um cep como parâmetro e acessa um web service, obtendo como retorno o endereço correspondente. Espero que seja útil.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#INCLUDE &#39;PROTHEUS.CH&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#INCLUDE &#39;RWMAKE.CH&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#INCLUDE &#39;FONT.CH&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#INCLUDE &#39;COLORS.CH&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;User Function VerCep()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cBairro &amp;nbsp; &amp;nbsp;:= Space(100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cCidade &amp;nbsp; &amp;nbsp;:= Space(100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cLog &amp;nbsp; &amp;nbsp; &amp;nbsp; := Space(100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cTipLog &amp;nbsp; &amp;nbsp;:= Space(20)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cUF &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:= Space(20) &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Private cCep &amp;nbsp; &amp;nbsp; &amp;nbsp; := Space(12)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;SetPrvt(&quot;oDlg1&quot;,&quot;oSay1&quot;,&quot;oSay2&quot;,&quot;oSay3&quot;,&quot;oSay4&quot;,&quot;oSay5&quot;,&quot;oSay6&quot;,&quot;oGet1&quot;,&quot;oSBtn1&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oDlg1 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= MSDialog():New( 088,232,316,624,&quot;oDlg1&quot;,,,.F.,,,,,,.T.,,,.T. )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay1 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 012,012,{||&quot;Digite o CEP:&quot;},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,036,008)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay2 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 044,016,,oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,032,008)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay3 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 044,056,,oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,128,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay4 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 064,016,,oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,168,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay5 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 084,012,,oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,032,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay6 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 084,052,,oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,132,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oGet1 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TGet():New( 012,052,{|u| If(PCount()&amp;gt;0,cCep:=u,cCep)},oDlg1,060,008,&#39;&#39;,,CLR_BLACK,CLR_WHITE,,,,.T.,&quot;&quot;,,,.F.,.F.,,.F.,.F.,&quot;&quot;,&quot;cCep&quot;,,)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSBtn1 &amp;nbsp; &amp;nbsp; := SButton():New( 012,160,1,,oDlg1,,&quot;&quot;, ) &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSBtn1:bLClicked := {|| LoadCEP() }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oDlg1:Activate(,,,.T.)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Return&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Static Function LoadCEP()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Local cError &amp;nbsp; := &quot;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Local cWarning := &quot;&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Local aRetorno := {}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Local cRETORNO &amp;nbsp;//obtem o xml&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;cRETORNO := HttpGet( &#39;http://republicavirtual.com.br/web_cep.php?cep=&#39;+cCep+&#39;&amp;amp;formato=xml&#39; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;if cRETORNO == nil&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;MsgStop( Alert( &quot;Servidor de CEP indisponível.&quot; ) )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;oScript := XmlParser( cRETORNO, &quot;_&quot;, @cError, @cWarning )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;if oScript &amp;lt;&amp;gt; nil&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if XmlChildEx( oSCRIPT, &quot;_WEBSERVICECEP&quot; ) &amp;lt;&amp;gt; nil &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if Val(oSCRIPT:_WEBSERVICECEP:_RESULTADO:TEXT) &amp;gt; 0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cUF &amp;nbsp; &amp;nbsp; := oSCRIPT:_WEBSERVICECEP:_UF:TEXT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cCidade := oSCRIPT:_WEBSERVICECEP:_CIDADE:TEXT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cBairro := oSCRIPT:_WEBSERVICECEP:_BAIRRO:TEXT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cTipLog := oSCRIPT:_WEBSERVICECEP:_TIPO_LOGRADOURO:TEXT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cLog &amp;nbsp; &amp;nbsp;:= oSCRIPT:_WEBSERVICECEP:_LOGRADOURO:TEXT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;endif &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; endif&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;endif&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;endif&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay2 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 044,016,{||&quot;UF: &quot; + cUF},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,032,008)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay3 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 044,056,{||&quot;Cidade: &quot; + cCidade},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,128,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay4 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 064,016,{||&quot;Bairro: &quot; + cBairro},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,168,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay5 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 084,012,{|| cTipLog},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,032,012)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;oSay6 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 084,052,{|| cLog},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,132,012) &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Return&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------------------------------&lt;br /&gt;
A aparência do programa é simples, agora é só incrementar do jeito que você quiser.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiTPHlxVmUfTmQijXRHchArMi1bl9847oInYaNv-5zXscDkRhU83M44BNuiA-BTWR6Ote4J0L3IIM1oaR1H98p-C3xmgfi8X3tYJqpmkbwP2B1bESE3ptYRxBqCFrIhcuBlEJRyXXq-xY/s1600/vercep.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiTPHlxVmUfTmQijXRHchArMi1bl9847oInYaNv-5zXscDkRhU83M44BNuiA-BTWR6Ote4J0L3IIM1oaR1H98p-C3xmgfi8X3tYJqpmkbwP2B1bESE3ptYRxBqCFrIhcuBlEJRyXXq-xY/s1600/vercep.png&quot; height=&quot;210&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/1958882815287231600/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2014/03/obter-endereco-partir-de-um-cep-com.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1958882815287231600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1958882815287231600'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2014/03/obter-endereco-partir-de-um-cep-com.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiTPHlxVmUfTmQijXRHchArMi1bl9847oInYaNv-5zXscDkRhU83M44BNuiA-BTWR6Ote4J0L3IIM1oaR1H98p-C3xmgfi8X3tYJqpmkbwP2B1bESE3ptYRxBqCFrIhcuBlEJRyXXq-xY/s72-c/vercep.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-7057898163620544538</id><published>2013-11-06T06:12:00.000-08:00</published><updated>2013-11-06T06:12:17.807-08:00</updated><title type='text'>Integração Protheus x Balança rodoviária Lider</title><content type='html'>Abordando mais uma vez integrações entre protheus e balanças, hoje irei demonstrar uma rotina em advpl que lê o peso da balança rodoviária Lider pela porta serial. Para testar nossa aplicação, podemos baixar o emulador da balança Líder gratuitamente no site &amp;nbsp;&lt;a href=&quot;http://www.liderbalancas.com.br/2012/manuais-balancas.html&quot;&gt;http://www.liderbalancas.com.br/2012/manuais-balancas.html&lt;/a&gt;&amp;nbsp;no primeiro link de download.&lt;br /&gt;
&lt;br /&gt;
Para que eu consiga acessar a mesma porta COM com dois programas diferentes (emulador da balança e a rotina advpl), eu não uso a porta física e sim um emulador de porta serial VSPE,o qual pode ser baixado pelo site &amp;nbsp;&lt;a href=&quot;http://www.baixaki.com.br/download/free-virtual-serial-ports-emulator.htm&quot;&gt;http://www.baixaki.com.br/download/free-virtual-serial-ports-emulator.htm&lt;/a&gt;. Com o VSPE eu crio uma porta virtual COM1 e é com ela que iremos trabalhar.&lt;br /&gt;
&lt;br /&gt;
A rotina em advpl pode ser baixada no link &amp;nbsp;&lt;a href=&quot;http://www.4shared.com/file/EcFWKLrC/BalRodov.html?&quot;&gt;http://www.4shared.com/file/EcFWKLrC/BalRodov.html?&lt;/a&gt;Compile o fonte e em seguida iremos seguir os passos abaixo:&lt;br /&gt;
&lt;br /&gt;
1) Com o VSPE crie a porta serial virtual COM1&lt;br /&gt;
2)Acione o emulador da balança Líder ( arquivo&amp;nbsp;Emulador.exe)&lt;br /&gt;
3)Deixe o emulador configurado conforme imagem abaixo:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyndRzye1keVW-42vbCNZR4n-5Tip5O-q1DugxkopIV7Wy66fC5JUcaHAauUJn5Pa_eMMuZBXMjqGDoqubpPu2PoUyHIaQyDiWEW7SQRc1FWOSY46Wj8rPTIllmhsca3l7J4DlpuwRoAQ/s1600/emulador_lider.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyndRzye1keVW-42vbCNZR4n-5Tip5O-q1DugxkopIV7Wy66fC5JUcaHAauUJn5Pa_eMMuZBXMjqGDoqubpPu2PoUyHIaQyDiWEW7SQRc1FWOSY46Wj8rPTIllmhsca3l7J4DlpuwRoAQ/s1600/emulador_lider.png&quot; height=&quot;640&quot; width=&quot;514&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
4) Abra a IDE do protheus e com o fonte BALRODOV.PRW compilado, &amp;nbsp;execute a rotina.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOX3kz7DizG_Aj76-SXgTXsAmdcdRI-twvmZSyhffAdA1fZvPZgSxsMpPhLti6CHaku-js1mNjayKehcvO5tzi3R6iWTNlN7K85DdZLZibz1uWg1RJA0cKvQwZt1EX9bVgX8QtHe1lC48/s1600/ide_balrodov.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOX3kz7DizG_Aj76-SXgTXsAmdcdRI-twvmZSyhffAdA1fZvPZgSxsMpPhLti6CHaku-js1mNjayKehcvO5tzi3R6iWTNlN7K85DdZLZibz1uWg1RJA0cKvQwZt1EX9bVgX8QtHe1lC48/s1600/ide_balrodov.png&quot; height=&quot;234&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
5) No emulador da balança, clique em modo contínuo&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDr5Kp5dUHp4dfkdjweKEutYhAWF2O0NsONA5OgiBJ7CuRbWp0ApGW2pnRa7UoCPxkE64LW43M0Yv0MD1iHet_PRh-Tn6K6i4ef9d_Rfb_IRQNif4aeM_6q0kpD0emyRtqUC1oTDYhiSA/s1600/emulador_lider.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDr5Kp5dUHp4dfkdjweKEutYhAWF2O0NsONA5OgiBJ7CuRbWp0ApGW2pnRa7UoCPxkE64LW43M0Yv0MD1iHet_PRh-Tn6K6i4ef9d_Rfb_IRQNif4aeM_6q0kpD0emyRtqUC1oTDYhiSA/s1600/emulador_lider.png&quot; height=&quot;320&quot; width=&quot;257&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6)Se tudo estiver ok, teremos a captura do peso pelo protheus conforme print abaixo:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPbaav80iD4WHTVB0-Wkq4EZo2Facu9qM63EDf-q1mZ-FVKnSVwACMtOCjN3xYmJxBBOIhDREV-ODWIi2Ngg23O42G8TsmllrA_0RYlxw2-z6UpU4yagvElv-Kon3p43TQLnVGYdDLg7U/s1600/rotina_balanca.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPbaav80iD4WHTVB0-Wkq4EZo2Facu9qM63EDf-q1mZ-FVKnSVwACMtOCjN3xYmJxBBOIhDREV-ODWIi2Ngg23O42G8TsmllrA_0RYlxw2-z6UpU4yagvElv-Kon3p43TQLnVGYdDLg7U/s1600/rotina_balanca.png&quot; height=&quot;363&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7) Abaixo a rotina em advpl :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#INCLUDE &#39;RWMAKE.CH&#39;&lt;br /&gt;
&lt;br /&gt;
/*ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
±±ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿±±&lt;br /&gt;
±±³Programa &amp;nbsp;³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ Autor ³ LUIS LACOMBE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ Data ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Locacao &amp;nbsp; ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³Contato ³83 8819-6539 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±³ &amp;nbsp; ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³gustavo.lacombe@gmail.com &amp;nbsp; &amp;nbsp; &amp;nbsp; ³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Descricao ³ &amp;nbsp;Le peso da balanca rodoviaria Lider modelo LD 1001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Parametros³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Retorno &amp;nbsp; ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Aplicacao ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Uso &amp;nbsp; &amp;nbsp; &amp;nbsp; ³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÁÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Analista Resp.³ &amp;nbsp;Data &amp;nbsp;³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ &amp;nbsp;/ &amp;nbsp;/ &amp;nbsp;³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ &amp;nbsp;/ &amp;nbsp;/ &amp;nbsp;³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ³±±&lt;br /&gt;
±±ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ±±&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß*/&lt;br /&gt;
&lt;br /&gt;
User Function BalRodov&lt;br /&gt;
&lt;br /&gt;
Private cPesoAt &amp;nbsp; &amp;nbsp; &amp;nbsp;:= Space(30)&lt;br /&gt;
Private cPesStr &amp;nbsp; &amp;nbsp;:= Space(30) &amp;nbsp; &amp;nbsp; &lt;br /&gt;
Private cCfg &amp;nbsp; &amp;nbsp; :=&quot;COM1:4800,n,8,1&quot;&lt;br /&gt;
Private nH &amp;nbsp; &amp;nbsp; &amp;nbsp; := 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SetPrvt(&quot;oDlg1&quot;,&quot;oSay1&quot;,&quot;oSay2&quot;,&quot;oPesStr&quot;,&quot;oPeso&quot;,&quot;oSBtn1&quot;)&lt;br /&gt;
&lt;br /&gt;
oDlg1 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= MSDialog():New( 091,232,304,578,&quot;Balança rodoviária&quot;,,,.F.,,,,,,.T.,,,.T. )&lt;br /&gt;
oSay1 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 028,016,{||&quot;STRING DA COM1&quot;},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,060,008)&lt;br /&gt;
oSay2 &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TSay():New( 045,017,{||&quot;PESO TRATADO&quot;},oDlg1,,,.F.,.F.,.F.,.T.,CLR_BLACK,CLR_WHITE,059,008)&lt;br /&gt;
oPesStr &amp;nbsp; &amp;nbsp;:= TGet():New( 028,088,{|u| If(PCount()&amp;gt;0,cPesStr:=u,cPesStr)},oDlg1,060,008,&#39;&#39;,,CLR_BLACK,CLR_WHITE,,,,.T.,&quot;&quot;,,,.F.,.F.,,.F.,.F.,&quot;&quot;,&quot;cPesStr&quot;,,)&lt;br /&gt;
oPeso &amp;nbsp; &amp;nbsp; &amp;nbsp;:= TGet():New( 048,088,{|u| If(PCount()&amp;gt;0,cPesoAt:=u,cPesoAt)},oDlg1,060,008,&#39;&#39;,,CLR_BLACK,CLR_WHITE,,,,.T.,&quot;&quot;,,,.F.,.F.,,.F.,.F.,&quot;&quot;,&quot;cPesoAt&quot;,,)&lt;br /&gt;
oSBtn1 &amp;nbsp; &amp;nbsp; := SButton():New( 072,120,1,{|| LerPeso()},oDlg1,,&quot;&quot;, )&lt;br /&gt;
&lt;br /&gt;
oDlg1:Activate(,,,.T.)&lt;br /&gt;
&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*/&lt;br /&gt;
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
±±ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿±±&lt;br /&gt;
±±³ Programa ³ LerPeso &amp;nbsp;³ Autor ³ LUIS LACOMBE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ Data ³ 18/04/13 ³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Descri‡…o ³Faz a requisicao de peso para a balanca e le o retorno. &amp;nbsp; &amp;nbsp; ³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³Para funcionar, eh importante verificar o protocolo de &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³comunicacao da balanca. No caso da TOLEDO,ela tem que estar ³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³usando o protocolo que responda ao sinal ENQ, por exemplo &amp;nbsp; ³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³o protocolo P05 ou P05A. Importante lembrar que a funcao &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³nao trata a estabilizacao de peso. Se quiser receber o peso ³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³somente quando ele estabilizar,use o protocolo adequado como³±±&lt;br /&gt;
±±³ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³P05 da TOLEDO. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³±±&lt;br /&gt;
±±ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ±±&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß&lt;br /&gt;
/*/&lt;br /&gt;
Static Function LerPeso()&lt;br /&gt;
&lt;br /&gt;
Local cPeso := 0&lt;br /&gt;
Local cBuffer&lt;br /&gt;
&lt;br /&gt;
cCfg &amp;nbsp; &amp;nbsp; &amp;nbsp;:=&quot;COM1:4800,n,8,1&quot;&lt;br /&gt;
&lt;br /&gt;
lRet &amp;nbsp; &amp;nbsp; &amp;nbsp; := msOpenPort(nH,cCfg)&lt;br /&gt;
if(!lRet)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Alert(&quot;Falha ao conectar com a porta serial&quot;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Return&lt;br /&gt;
EndIf&lt;br /&gt;
&lt;br /&gt;
//msWrite(nH,Chr(5))&lt;br /&gt;
//Sleep(200)&lt;br /&gt;
For ncont := 1 To 50&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;msRead(nH,@cBuffer)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(!Empty(cBuffer))&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; // ALERT(cBuffer)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;cPesStr := cBuffer&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;cPeso := IsNumber(cBuffer)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Exit&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;EndIf&lt;br /&gt;
Next&lt;br /&gt;
msClosePort(nH) &lt;br /&gt;
&lt;br /&gt;
cPesoAt &amp;nbsp;:= cPeso&lt;br /&gt;
&lt;br /&gt;
// PRA TESTAR O PROGRAMA SEM BALANCA&lt;br /&gt;
//nPeso := Val(cSimPes)&lt;br /&gt;
&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*/&lt;br /&gt;
ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
±±ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿±±&lt;br /&gt;
±±³ Programa ³ IsNumber ³ Autor ³ LUIS LACOMBE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;³ Data ³ 18/04/13 ³±±&lt;br /&gt;
±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´±±&lt;br /&gt;
±±³Descri‡…o ³Separa os caracteres numericos da string recebida da balanca³±±&lt;br /&gt;
±±ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ±±&lt;br /&gt;
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±&lt;br /&gt;
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß&lt;br /&gt;
/*/&lt;br /&gt;
Static Function IsNumber(cNum)&lt;br /&gt;
&lt;br /&gt;
Local nPosPar &amp;nbsp;&lt;br /&gt;
Local cPesB &amp;nbsp; &amp;nbsp; := &quot;&quot;&lt;br /&gt;
Local cNumeros &amp;nbsp;:= &quot;0123456789.&quot; &lt;br /&gt;
Local cNewNum &amp;nbsp; := &quot;&quot;&lt;br /&gt;
Local nPes &amp;nbsp; &amp;nbsp; &amp;nbsp;:= 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//bloco que separa o numero da string enviada pela balanca&lt;br /&gt;
For nCont := 1 To Len(cNum)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(SubStr(cNum,nCont,1)==&quot;E&quot;) &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Exit&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndIf &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(SubStr(cNum,nCont,1)==&quot;I&quot;) // peso instavel &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return &quot;-1&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndIf&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if(SubStr(cNum,nCont,1)$cNumeros)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cNewNum += SubStr(cNum,nCont,1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; EndIf&lt;br /&gt;
Next nCont&lt;br /&gt;
&lt;br /&gt;
cPesB &amp;nbsp;:= &amp;nbsp;cNewNum&lt;br /&gt;
&lt;br /&gt;
Return cPesB&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/7057898163620544538/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2013/11/integracao-protheus-x-balanca.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7057898163620544538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7057898163620544538'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2013/11/integracao-protheus-x-balanca.html' title='Integração Protheus x Balança rodoviária Lider'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyndRzye1keVW-42vbCNZR4n-5Tip5O-q1DugxkopIV7Wy66fC5JUcaHAauUJn5Pa_eMMuZBXMjqGDoqubpPu2PoUyHIaQyDiWEW7SQRc1FWOSY46Wj8rPTIllmhsca3l7J4DlpuwRoAQ/s72-c/emulador_lider.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-1723098091206773438</id><published>2013-09-01T20:57:00.004-07:00</published><updated>2013-09-01T20:57:58.121-07:00</updated><title type='text'></title><content type='html'>&lt;span style=&quot;color: #444444;&quot;&gt;Integração Protheus X Balança via comunicação serial sem DLL&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;Neste artigo irei mostrar como podemos fazer uma rotina em advpl que irá requisitar o peso a uma balança Filizola via porta serial. Essa requisição funciona também para balanças TOLEDO, porém o layout de retorno é um pouco diferente. A vantagem desse método é não depender de DLL e assim não ficar preso a uma marca específica.
 
Antes de tudo é preciso que a balança esteja com o protocolo adequado para funcionar com requisição serial. Em muitos modelos da TOLEDO, o protocolo é o P05, já algumas balanças FILIZOLA já vem preparadas para responder a esse tipo de requisição.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O esquema abaixo resume o processo:
 
 
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpJcO4YKwKBmpn8-TVCvUR2MEQ50G95mRL-t2YcOAFEBZgr1lN383Nk_Xrjlh-BoE2OxFp7qDK0yrIpn25PJMcgG0CVh9t7vuawEKbpKa8bvGqi-0vIH9PUwAygsew1KXOz3aaO1ke9ec/s1600/esquema_bal.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpJcO4YKwKBmpn8-TVCvUR2MEQ50G95mRL-t2YcOAFEBZgr1lN383Nk_Xrjlh-BoE2OxFp7qDK0yrIpn25PJMcgG0CVh9t7vuawEKbpKa8bvGqi-0vIH9PUwAygsew1KXOz3aaO1ke9ec/s1600/esquema_bal.png&quot; height=&quot;148&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Primeiramente iremos fazer a comunicação com a porta serial. Para isso usamos o seguinte código Advpl:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Local&lt;/span&gt; cCfg    :=&lt;span style=&quot;color: red;&quot;&gt;”COM1:4800,n,8,1″&lt;/span&gt;&lt;br /&gt;
lRet       := msOpenPort(nH,cCfg)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(!lRet)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alert(“Falha ao conectar com a porta serial”)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Return&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;EndIf&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;O próximo passo será enviar um comando 5 HEXADECIMAL (ENQ)   para a porta aonde em que a balança está conectada. Eu tinha até aberto um chamado na TOTVS perguntando como isso poderia ser feito e responderam que não era possível, enfim , eu não acredite e pesquisei alguma forma de fazer isso. Até que consegui usando um comando super simples que é :&amp;nbsp;&lt;/div&gt;
&amp;nbsp;msWrite(nH,Chr(5))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Ou seja, eu escrevo na porta COM o Chr(5) e se tudo estiver certo a balança irá devolver o peso.
Resumidamente, a rotina básica ficaria assim:&lt;br /&gt;
lRet       := msOpenPort(nH,cCfg)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(!lRet)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alert(&lt;span style=&quot;color: red;&quot;&gt;“Falha ao conectar com a porta serial”&lt;/span&gt;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;EndIf&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
msWrite(nH,Chr(5))&lt;br /&gt;
Sleep(200)&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; ncont := 1 To 20&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; msRead(nH,@cBuffer)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt; if&lt;/span&gt;(!Empty(cBuffer)) &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cPeso :=IsNumber(cBuffer)    // IsNumber função que criei para tirar os caracteres especiais &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cBuffer := &lt;span style=&quot;color: red;&quot;&gt;“”&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Exit&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;EndIf&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Next&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
msClosePort(nH)&lt;br /&gt;
&lt;br /&gt;
Para que essa comunicação dê certo, é preciso atentar para alguns detalhes:&lt;br /&gt;
&amp;nbsp;1) Tentei várias combinações de velocidades para a porta COM1 do micro e a que deu mais certo foi  Bits &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; por segundo : 4800, Bits de dados: 7,Paridade: Even, Bits de parada: 2 e controle de fluxo: nenhum.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;2) Com relação a configuração da velocidade da balança, a melhor que eu achei foi 
A mesma configuração &amp;nbsp; &amp;nbsp; &amp;nbsp;da COM1 dita no primeiro item mudando apenas Bits de dados para 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Espero que este artigo tenha sido útil . Até a próxima.</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/1723098091206773438/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2013/09/integracao-protheus-x-balanca-via.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1723098091206773438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1723098091206773438'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2013/09/integracao-protheus-x-balanca-via.html' title=''/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpJcO4YKwKBmpn8-TVCvUR2MEQ50G95mRL-t2YcOAFEBZgr1lN383Nk_Xrjlh-BoE2OxFp7qDK0yrIpn25PJMcgG0CVh9t7vuawEKbpKa8bvGqi-0vIH9PUwAygsew1KXOz3aaO1ke9ec/s72-c/esquema_bal.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-2413265397986923390</id><published>2011-12-23T04:23:00.000-08:00</published><updated>2011-12-23T04:48:00.747-08:00</updated><title type='text'>Importar produtos de outros sistemas para o Protheus</title><content type='html'>Pessoal, desenvolvi um programa em C# que faz a importação de produtos de qualquer base de dados para o Protheus. Fica aí mais um exemplo de integração entre Protheus e C#.&lt;br /&gt;
&lt;br /&gt;
Este vídeo fala do passo a passo dos procedimentos iniciais&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/AhMMoVT7Rho&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Este outro vídeo mostra o programa funcionando&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/s6Ubvg5w9Qc&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
Aqui o link para baixar o programa&lt;br /&gt;
www.4shared.com/rar/qDP_ytZM/Imp_SB1.html?</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/2413265397986923390/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/12/importar-produtos-de-outros-sistemas.html#comment-form' title='4 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2413265397986923390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2413265397986923390'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/12/importar-produtos-de-outros-sistemas.html' title='Importar produtos de outros sistemas para o Protheus'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/AhMMoVT7Rho/default.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-3751202477889211784</id><published>2011-11-16T08:31:00.000-08:00</published><updated>2011-11-16T08:31:10.842-08:00</updated><title type='text'>Navegador Web feito em Advpl</title><content type='html'>Abaixo estou disponibilizando um código que monta um navegador em advpl. Ele guarda as páginas visitadas e permite a navegação entre elas como acontece em um navegador web. &lt;br /&gt;
&lt;br /&gt;
Obs: Para funcionar, é preciso configurar o smartcliente.ini e colocar logo abaixo da marcação [config] a opção: &lt;br /&gt;
BrowserEnabled=1 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &quot;protheus.ch&quot;&lt;br /&gt;
                                                                          &lt;br /&gt;
&lt;br /&gt;
User Function Navegador()&lt;br /&gt;
&lt;br /&gt;
Private aPages  := {} // array que guarda os endereços visitados&lt;br /&gt;
Private nPgVist := -1 // controle a posicao do array aPages &lt;br /&gt;
&lt;br /&gt;
Private  aSize := MsAdvSize()   // pega o tamanho da tela &lt;br /&gt;
Private oDlg1, oTIBrw&lt;br /&gt;
Private cNavegado := Space(80)  // usado no objeto get para guardar os endereços web                                  &lt;br /&gt;
Private lcont := .T. &lt;br /&gt;
&lt;br /&gt;
DEFINE MSDIALOG oDlg1 TITLE &quot;Navegador&quot; From aSize[7],0 to aSize[6],aSize[5] of oMainWnd PIXEL&lt;br /&gt;
&lt;br /&gt;
cNavegado := &quot;http://www.google.com&quot;   // pagina inicial&lt;br /&gt;
oNav:= TGet():New(10,10,{|u| if(PCount()&gt;0,cNavegado:=u,cNavegado)}, oDlg1,340,5,,,,,,,,.T.,,,,,,,,,,)   &lt;br /&gt;
&lt;br /&gt;
@ 010, 350 Button oBtnIr PROMPT &quot;Ir&quot; Size 40,10 Action(Processa({||Navegar()},&quot;Abrindo&quot;,&quot;Aguarde...&quot;)) Of oDlg1 Pixel     &lt;br /&gt;
@ 010, 390 Button oBtnImp PROMPT &quot;Imprimir&quot; Size 40,10 Action oTIBrw:Print() Of oDlg1 Pixel&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@ 010, 430 Button oBtnAnte PROMPT &quot;Anterior&quot; Size 40,10 Action (Retorna())  Of oDlg1 Pixel&lt;br /&gt;
@ 010, 470 Button oBtnDep PROMPT &quot;Avançar&quot; Size 40,10 Action(Avanca()) Of oDlg1 Pixel   &lt;br /&gt;
@ 010, 510 Button oBtnSair PROMPT &quot;Sair&quot; Size 40,10 Action(Sair()) Of oDlg1 Pixel         &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
oTIBrw:= TIBrowser():New( 025,010,aSize[5]-640, 270, &quot;http://www.google.com&quot;, oDlg1 )    &lt;br /&gt;
&lt;br /&gt;
aaDD(aPages,&quot;http://www.google.com&quot;)&lt;br /&gt;
&lt;br /&gt;
oNav:bLostFocus := { || Valido()}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Activate MsDialog oDlg1 Centered&lt;br /&gt;
&lt;br /&gt;
Return      &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Static Function Navegar() &lt;br /&gt;
     &lt;br /&gt;
 Ir()&lt;br /&gt;
&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Static Function Ir()&lt;br /&gt;
&lt;br /&gt;
 oTIBrw:Navigate(AllTrim(cNavegado),oDlg1)&lt;br /&gt;
 aaDD(aPages,AllTrim(cNavegado))  &lt;br /&gt;
 nPgVist := Len(aPages)&lt;br /&gt;
&lt;br /&gt;
Return   &lt;br /&gt;
           &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Static Function Avanca()      // proxima proxima pagina que jah foi visitada&lt;br /&gt;
  &lt;br /&gt;
  if(Len(aPages) &gt;  nPgVist .and. Len(aPages) &gt; 1 )&lt;br /&gt;
       nPgVist++   &lt;br /&gt;
       oTIBrw:Navigate(aPages[nPgVist],oDlg1)   &lt;br /&gt;
       cNavegado := aPages[nPgVist]&lt;br /&gt;
       oNav:Refresh()&lt;br /&gt;
  EndIf   &lt;br /&gt;
  &lt;br /&gt;
Return     &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Static Function Retorna()     // pagina anterior que foi visitada&lt;br /&gt;
 if(nPgVist&gt;1)&lt;br /&gt;
       nPgVist--  &lt;br /&gt;
       oTIBrw:Navigate(aPages[nPgVist],oDlg1) &lt;br /&gt;
       cNavegado := aPages[nPgVist]&lt;br /&gt;
       oNav:Refresh()      &lt;br /&gt;
  EndIf   &lt;br /&gt;
 &lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Static Function Sair()   // fecha a tela &lt;br /&gt;
oDlg1:End() &lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Abaixo um print da tela:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhA9JuLB7ysJI2yp2HX3gq2R2TgoJ8NRXpoAOawnUVIPFGgPVGIohVdt3sceqCv4O4hsnFrCgbVvW_qRGiMyVAo1h4gcKj4lRai_fiU-SDKladagzGY7t3SBu_ctUdGvJZzGl-NtzIWCw/s1600/browse_advpl.bmp&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;251&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhA9JuLB7ysJI2yp2HX3gq2R2TgoJ8NRXpoAOawnUVIPFGgPVGIohVdt3sceqCv4O4hsnFrCgbVvW_qRGiMyVAo1h4gcKj4lRai_fiU-SDKladagzGY7t3SBu_ctUdGvJZzGl-NtzIWCw/s400/browse_advpl.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/3751202477889211784/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/11/navegador-web-feito-em-advpl.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/3751202477889211784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/3751202477889211784'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/11/navegador-web-feito-em-advpl.html' title='Navegador Web feito em Advpl'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhA9JuLB7ysJI2yp2HX3gq2R2TgoJ8NRXpoAOawnUVIPFGgPVGIohVdt3sceqCv4O4hsnFrCgbVvW_qRGiMyVAo1h4gcKj4lRai_fiU-SDKladagzGY7t3SBu_ctUdGvJZzGl-NtzIWCw/s72-c/browse_advpl.bmp" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-1137596184405245959</id><published>2011-10-05T06:50:00.000-07:00</published><updated>2011-10-05T06:50:09.207-07:00</updated><title type='text'>Relatórios Mensais</title><content type='html'>Algumas vezes eu preciso gerar relatórios que mostrem dados entre determinados meses. Abaixo, um trecho desse tipo de relatório.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8K6JvaXsh7ZDUahla-IMu_nkocFmXPjcvQC8eIsnnT13-2-AG9v-lXqmdzG40P6YJ1l7B8v8dadQMde0y1Qo5cYsrW-9stsRDWwM5fBABOPC-Ah_OvXQOVazcF8yLw_vEHKN2-L7xeoE/s1600/trecho_rel.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;148&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8K6JvaXsh7ZDUahla-IMu_nkocFmXPjcvQC8eIsnnT13-2-AG9v-lXqmdzG40P6YJ1l7B8v8dadQMde0y1Qo5cYsrW-9stsRDWwM5fBABOPC-Ah_OvXQOVazcF8yLw_vEHKN2-L7xeoE/s400/trecho_rel.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Basicamente, o usuário informa o mês e ano inicial, mês e ano final e a partir daí eu gero um array contendo o intervalo. Ele tem a estrutura conforme figura abaixo:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEvGgobtJU0JH2YXMNlvPySQ3fA9LLHM1O0RPfJ7pe-_F4vRvfP19TQRvhNDBO8dGFhMK53qcnk6Bx4bmvTezUTBeN07B-gEdjRpyX9U72YQvaZWnS4WXzElXsTBqkTA_5yId1Xc7NN7E/s1600/array.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;181&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEvGgobtJU0JH2YXMNlvPySQ3fA9LLHM1O0RPfJ7pe-_F4vRvfP19TQRvhNDBO8dGFhMK53qcnk6Bx4bmvTezUTBeN07B-gEdjRpyX9U72YQvaZWnS4WXzElXsTBqkTA_5yId1Xc7NN7E/s400/array.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Posso então usar os elementos deste array como parâmetros em consultas que gerem tabelas temporárias além de imprimi-los no relatório conforme a primeira figura. &lt;br /&gt;
Abaixo, as funções que geram o array.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc4oWbngdvYBGbMYx2aOb-5iM60l9RqZRFgoDvTeBEGuW2udIZAM1ixkheineP-b5cwmigUWXjtHc3NtvpbyYkqxxUXkVvNE-NXnUoVfcAMYYK4yEh7Tq1_n3KcHnLG22_wOXtUSkp_9k/s1600/funcao_periodo.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc4oWbngdvYBGbMYx2aOb-5iM60l9RqZRFgoDvTeBEGuW2udIZAM1ixkheineP-b5cwmigUWXjtHc3NtvpbyYkqxxUXkVvNE-NXnUoVfcAMYYK4yEh7Tq1_n3KcHnLG22_wOXtUSkp_9k/s400/funcao_periodo.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Agora a função auxiliar da função acima que retorna o nome do mês:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Azx5n8pM1IeFzBTv_oaHdDRBofhCBPxl-kDxSaoKF3UihXBN_Cu5B726_bFYte0OXjjZ9U9iZLBSWU-1ih-XAjcRqjth6ZUrKZPbIYLHwZENUEK5WytiMo1fTFKqSGfUHBKejMC8QHw/s1600/Mes.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;59&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Azx5n8pM1IeFzBTv_oaHdDRBofhCBPxl-kDxSaoKF3UihXBN_Cu5B726_bFYte0OXjjZ9U9iZLBSWU-1ih-XAjcRqjth6ZUrKZPbIYLHwZENUEK5WytiMo1fTFKqSGfUHBKejMC8QHw/s400/Mes.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/1137596184405245959/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/10/relatorios-mensais.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1137596184405245959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/1137596184405245959'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/10/relatorios-mensais.html' title='Relatórios Mensais'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8K6JvaXsh7ZDUahla-IMu_nkocFmXPjcvQC8eIsnnT13-2-AG9v-lXqmdzG40P6YJ1l7B8v8dadQMde0y1Qo5cYsrW-9stsRDWwM5fBABOPC-Ah_OvXQOVazcF8yLw_vEHKN2-L7xeoE/s72-c/trecho_rel.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-3992772884133457736</id><published>2011-08-10T12:49:00.000-07:00</published><updated>2011-08-10T12:49:41.189-07:00</updated><title type='text'>Integração do Protheus com C# e .Net</title><content type='html'>  &lt;br /&gt;
   Hoje irei mostrar um outro exemplo de integração do Protheus com DotNet usando a linguagem C#. Neste exemplo irei solicitar ao protheus o cálculo do valor de parcelas (simulação de parcelas), ou seja,irei fazer a conexão da minha aplicação em DotNet com o servidor de aplicações, passarei alguns parâmetros como valor total, código da condição de pagamento e irei obter um array como retorno informando a data de vencimento e valor da parcela. Pra começar é necessário registrar a ocx apconnxcontrol.ocx e fazer referência da mesma no Visual Studio, para isso crie um novo projeto do tipo Console e siga os passos mostrados da publicação anterior  &quot;Integração do Protheus com C#  &quot;. Feito isso, minimize o Visual Studio, crie e compile o seguinte código fonte no Protheus.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeNqs-KX09U_iq3Hu8GEdxjjJY5z1Q6IO8k3cVO8cdBDQJgXaYeLHp7Ur6Q8jQI8Hz-sV4tDh8vH_rC20-yq5zqXPvg9B-KNBu33YsYUJwws4FStYGmjZcaVVcOujOtgIMTiSlyE2WN-4/s1600/fonte_simulacao.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;194&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeNqs-KX09U_iq3Hu8GEdxjjJY5z1Q6IO8k3cVO8cdBDQJgXaYeLHp7Ur6Q8jQI8Hz-sV4tDh8vH_rC20-yq5zqXPvg9B-KNBu33YsYUJwws4FStYGmjZcaVVcOujOtgIMTiSlyE2WN-4/s400/fonte_simulacao.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
No fonte eu expliquei que poderia referenciar diretamente a função do Protheus que realiza as simulações, mas tive dificuldade em passar como parâmetro o tipo data, então pra não ficar defendendo teoria, criei a user function que faz o tratamento da data que é passada pelo Visual Studio como string.&lt;br /&gt;
&lt;br /&gt;
Voltando ao Visual Studio, criei uma classe que realiza a conexão com o Protheus e também um método que aciona minha user function e obtém o resultado da simulaçao de parcelas. Observe o código da classe e seus comentários.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9VrpgCe3ZaMwit3VVaAFuQFkLK5GCicmSSDQDloFjkPZB7zNmnG7jUOgIWY4X_ZvAUyUu4xVYu1cSMFksIa7kOmqpbHFag2h-gO3fQY7wuIZyuvI3wehnqhMxCG3gi4lLc7se-rATyiE/s1600/cod_class_comProtheus.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9VrpgCe3ZaMwit3VVaAFuQFkLK5GCicmSSDQDloFjkPZB7zNmnG7jUOgIWY4X_ZvAUyUu4xVYu1cSMFksIa7kOmqpbHFag2h-gO3fQY7wuIZyuvI3wehnqhMxCG3gi4lLc7se-rATyiE/s400/cod_class_comProtheus.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
E na classe principal irei criar o seguinte código:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqhX7wXFpe2aKfvtH4kNYGrqUgXGNckPXzLi5kJG1JZGMZNX7Kp3FJYY6tl6WsLzpy2OcLU0b-K6dJueDOkoaD0VLBTLjhYY8gKj0_zKvH_0PYutto7QCqwZPqqH2j7LrdpliuITDBrYw/s1600/cod_princ_comprotheus.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqhX7wXFpe2aKfvtH4kNYGrqUgXGNckPXzLi5kJG1JZGMZNX7Kp3FJYY6tl6WsLzpy2OcLU0b-K6dJueDOkoaD0VLBTLjhYY8gKj0_zKvH_0PYutto7QCqwZPqqH2j7LrdpliuITDBrYw/s400/cod_princ_comprotheus.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Para ver o programa funcionando, veja o vídeo abaixo:  &lt;br /&gt;
obs: Veja em tela cheia para melhor visualização.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width=&quot;425&quot; height=&quot;349&quot; src=&quot;http://www.youtube.com/embed/ZBWC5muxb4c?hl=pt&amp;fs=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/3992772884133457736/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/08/integracao-do-protheus-com-c-e-net.html#comment-form' title='8 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/3992772884133457736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/3992772884133457736'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/08/integracao-do-protheus-com-c-e-net.html' title='Integração do Protheus com C# e .Net'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeNqs-KX09U_iq3Hu8GEdxjjJY5z1Q6IO8k3cVO8cdBDQJgXaYeLHp7Ur6Q8jQI8Hz-sV4tDh8vH_rC20-yq5zqXPvg9B-KNBu33YsYUJwws4FStYGmjZcaVVcOujOtgIMTiSlyE2WN-4/s72-c/fonte_simulacao.JPG" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-8689808892169764948</id><published>2011-08-08T19:57:00.000-07:00</published><updated>2011-08-09T09:56:10.287-07:00</updated><title type='text'>integração do Protheus com C#</title><content type='html'>   &lt;br /&gt;
Nessa postagem darei um exemplo bem simples de como integrar o Protheus com Csharp. Primeiramente temos que registrar no windows um arquivo ocx que está dentro do smartclient chamado apconnxcontrol.ocx . Para registrar é simples, eu copiei o arquivo para a pasta System32 do windows, logo depois executei o cmd.exe e fiz o seguinte comando:&lt;br /&gt;
regsvr32 apconnxcontrol.ocx . Lembrando que no Windows 7 você tem que executar o cmd.exe como administrador, caso contrário não dará certo.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG349PGL_I8eu2c2tFVj6lJf-0RIcKuKE-wv4aCVEKnVqkdU8OZ9LJ9dnRpwZYeZm-ry4QGgfqeFSS_LVZBlY44B-TjN_pDbxXm585CrjEaDL_vbRuV5ma-bQsSFg7CPw_okYAgl5lSJo/s1600/regsvr32.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear:right; float:right; margin-left:1em; margin-bottom:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;166&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG349PGL_I8eu2c2tFVj6lJf-0RIcKuKE-wv4aCVEKnVqkdU8OZ9LJ9dnRpwZYeZm-ry4QGgfqeFSS_LVZBlY44B-TjN_pDbxXm585CrjEaDL_vbRuV5ma-bQsSFg7CPw_okYAgl5lSJo/s320/regsvr32.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Concluída essa etapa, é hora de abrir o Visual Studio.&lt;br /&gt;
No exemplo a seguir eu usei o VS 2010 e criei um novo projeto do tipo Console. Faça o mesmo e com o Program.cs aberto clique em adicionar uma nova referencia conforme figura abaixo:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRKkI4Br8sotBVLF8XdDYvfEFBsYulu3OpGtY0qU9BfpyLe3CVN0ZJB1HOFaBFmITsH7fZ5mKT68qRa8RgHymD88W1ORIymeGFbgFbPPnABr55wrqX1dE0rKXU_y3S6k2dRjj-ep1D1sI/s1600/newref.jpg&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;182&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRKkI4Br8sotBVLF8XdDYvfEFBsYulu3OpGtY0qU9BfpyLe3CVN0ZJB1HOFaBFmITsH7fZ5mKT68qRa8RgHymD88W1ORIymeGFbgFbPPnABr55wrqX1dE0rKXU_y3S6k2dRjj-ep1D1sI/s320/newref.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Usando a guia Browse vá até a pasta System32 do Windows e selecione o arquivo apconnxcontrol.ocx:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYiiq6dmYg3klJhEmdt-cSj0kMmJ4NSev_FGAY8tbZO3zyKL2FDw_qq1vk_esDs6bvR26mR-04MiG4VqfAZ5ymBuJriuYgV_eDgI2dgNO8MmubMT2Uj4M072iTomdposH8tCrYdJX0dlU/s1600/refocx.jpg&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;184&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYiiq6dmYg3klJhEmdt-cSj0kMmJ4NSev_FGAY8tbZO3zyKL2FDw_qq1vk_esDs6bvR26mR-04MiG4VqfAZ5ymBuJriuYgV_eDgI2dgNO8MmubMT2Uj4M072iTomdposH8tCrYdJX0dlU/s320/refocx.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Nessa etapa já temos o &quot;link&quot; com nossa ocx do protheus. Agora é só por a mão na massa e começar a brincar com as funções. No exemplo abaixo criei uma User Function no protheus que retorna um array de string. Após compilado, fui no Visual Studio e feito as devidas referências eu fiz com que o código em C# executasse a minha User Function do protheus e exibisse o retorno dela no Console.&lt;br /&gt;
&lt;br /&gt;
//user function compilada no protheus&lt;br /&gt;
#INCLUDE &quot;rwmake.ch&quot;&lt;br /&gt;
&lt;br /&gt;
User Function RetTest()&lt;br /&gt;
&lt;br /&gt;
Local aTeste := {}&lt;br /&gt;
&lt;br /&gt;
aaDD(aTeste,&quot;teste1&quot;) &lt;br /&gt;
aaDD(aTeste,&quot;teste2&quot;)  &lt;br /&gt;
aaDD(aTeste,&quot;teste3&quot;)&lt;br /&gt;
&lt;br /&gt;
Return aTeste&lt;br /&gt;
&lt;br /&gt;
Código no C#, observe as referências :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmerwA6ZDWtZOtR5J0dYWZvHLy0xJSoHnyUW5t0bTiQB6VprLE1UZasbmkVDkl30W0tCMbaJJ1S8FFq35ZUa9xoyyECY4PffqdDfLddaroKRKnzYfeDGXuTL5eUv-rUKXv7Sn-aIcqfBY/s1600/codc1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; width=&quot;269&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmerwA6ZDWtZOtR5J0dYWZvHLy0xJSoHnyUW5t0bTiQB6VprLE1UZasbmkVDkl30W0tCMbaJJ1S8FFq35ZUa9xoyyECY4PffqdDfLddaroKRKnzYfeDGXuTL5eUv-rUKXv7Sn-aIcqfBY/s320/codc1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Se tudo der certo teremos o resultado abaixo:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsaZ1K3x-TpSTVpUaEJCRp0j2teGmgjfFTYxFpvm935RPMhsMZvf3bABp8aMlvLMPT4uvPCGNrvThF1bz9FhZpk85yrnHa7Ixtgi6IhsIUDxZYw5epf6XYX3xDW8Py3TNKdMwuMZmm_GE/s1600/result.jpg&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;154&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsaZ1K3x-TpSTVpUaEJCRp0j2teGmgjfFTYxFpvm935RPMhsMZvf3bABp8aMlvLMPT4uvPCGNrvThF1bz9FhZpk85yrnHa7Ixtgi6IhsIUDxZYw5epf6XYX3xDW8Py3TNKdMwuMZmm_GE/s320/result.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Tem uma documentação de RPC nos fóruns de advpl, lá tem mais detalhes. Espero ter colaborado com algum conhecimento e lembrando que podemos usar a ocx em outras linguagens que tem suporte a esse tipo de arquivo. Até a próxima.&lt;br /&gt;
&lt;br /&gt;
&lt;!-- Inclua esta tag na seção head ou logo antes da tag de fechamento da seção body --&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/plusone.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- Inclua esta tag onde desejar que o botão +1 seja exibido --&gt;&lt;br /&gt;
&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/8689808892169764948/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/08/integracao-do-protheus-com-c.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/8689808892169764948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/8689808892169764948'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/08/integracao-do-protheus-com-c.html' title='integração do Protheus com C#'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG349PGL_I8eu2c2tFVj6lJf-0RIcKuKE-wv4aCVEKnVqkdU8OZ9LJ9dnRpwZYeZm-ry4QGgfqeFSS_LVZBlY44B-TjN_pDbxXm585CrjEaDL_vbRuV5ma-bQsSFg7CPw_okYAgl5lSJo/s72-c/regsvr32.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-4967388556004328335</id><published>2011-04-13T06:05:00.000-07:00</published><updated>2011-04-13T08:17:08.752-07:00</updated><title type='text'>Conectar o Protheus a outra Base de Dados 2</title><content type='html'>Hoje irei detalhar melhor e passo a passo como podemos fazer uma integração entre o cadastro de clientes de um outro sistema e o sistema Protheus. A idéia é a seguinte:&lt;br /&gt;Ter um JOB que perceba uma inclusão, alteração ou exclusão de um cliente no outro sistema e reflita isso para o Protheus. Nosso primeiro obstáculo é o banco de dados, pois nessa demonstração o sistema Protheus funciona com SQL Server e o sistema que será integrado usa o PostGress. Apesar disso, podemos conectar o Protheus ao banco do outro sistema e extrair as informações do cliente e tratá-las para inserir no cadastro. Vamos então realizar as configurações para que o Protheus tenha acesso a base de dados PostGre.&lt;br /&gt;&lt;br /&gt;1)Baixe e instale o Drive ODBC no site http://www.postgresql.org/ftp/odbc/versions/msi/&lt;br /&gt;2) Após instalar, crie a conexão ODBC no mesmo servidor aonde está configurada a ODBC do Protheus para o BD PostGre e teste a conexão.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVh1WrOzD_ILPlwLZlKJyQKAVOdWxn2kvZ5pEirRKE95gYe53wdJpaXg46_RuqgHx3tjYWHdp_67nAE_sgvpYYdzBwkxGqc9sd6qgXsd3mYS90mYw2ZwNKCfZjkyB3AfLw5f3Z5uBc7Xw/s1600/config_odbc.JPG&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 334px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVh1WrOzD_ILPlwLZlKJyQKAVOdWxn2kvZ5pEirRKE95gYe53wdJpaXg46_RuqgHx3tjYWHdp_67nAE_sgvpYYdzBwkxGqc9sd6qgXsd3mYS90mYw2ZwNKCfZjkyB3AfLw5f3Z5uBc7Xw/s400/config_odbc.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595063851776325522&quot; /&gt;&lt;/a&gt;&lt;br /&gt;3)Com a conexão OK é hora de criar o TOPConnect para a ODBC criada.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxZ-5ldZNl2cYu0GZQGYbPuGF02lZ-ARAshUYy3Kd04fVNSMKGPHuIt9k55VH8YT0ptXcf6riFysoGs7q1sStI7LOlhMXLA_5rzEXPnAokW3ugQmo6ovaWZf7LdG6bdU1BY9reZoe5zk/s1600/topcon_.JPG&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 251px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxZ-5ldZNl2cYu0GZQGYbPuGF02lZ-ARAshUYy3Kd04fVNSMKGPHuIt9k55VH8YT0ptXcf6riFysoGs7q1sStI7LOlhMXLA_5rzEXPnAokW3ugQmo6ovaWZf7LdG6bdU1BY9reZoe5zk/s400/topcon_.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595065262401378914&quot; /&gt;&lt;/a&gt;&lt;br /&gt;4)Valide a conexão.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk6kuWXEzeU7bBz_yfpYeMmvh5v5449mdHH-cUdBE3u6BuZ0oGIWKUzSQ60Z-BhRYAZVv4msFZIOaSEhVtMCiOY-lTH_C0EFApGXfdO1xfVY0lmRz2Jb7tg_AehtP6D4hd1_DjtvrQslw/s1600/validConn1.JPG&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk6kuWXEzeU7bBz_yfpYeMmvh5v5449mdHH-cUdBE3u6BuZ0oGIWKUzSQ60Z-BhRYAZVv4msFZIOaSEhVtMCiOY-lTH_C0EFApGXfdO1xfVY0lmRz2Jb7tg_AehtP6D4hd1_DjtvrQslw/s400/validConn1.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595065815462242178&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlR2BeViNx4IOvqmhXp60CYh_fczjzM-lsfUwEsKqFPuYJtCfcR6YwQeOmV-esemvWUx_QLGew0czRw3033SbxHAkilLCLRvu7VIGFh63soBEk-OwbDvEzBli-obCq-nQ2c9CNE5Uvu-s/s1600/validConn2.JPG&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlR2BeViNx4IOvqmhXp60CYh_fczjzM-lsfUwEsKqFPuYJtCfcR6YwQeOmV-esemvWUx_QLGew0czRw3033SbxHAkilLCLRvu7VIGFh63soBEk-OwbDvEzBli-obCq-nQ2c9CNE5Uvu-s/s400/validConn2.JPG&quot; border=&quot;0&quot; &lt;br /&gt;alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595066254285455986&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOKGtvemdONKXy1WzxdidXEoGlGOjNU3iw5R9wkaNjVCosbhV-smmBDdCp_sTqeG2N-c4-6CLnhIlN0n2FWrJw31KVTkSSqdgisL5JnCXei9cTcjwzKuJLw77yA9cP_1U1MwEiSzY_xIw/s1600/validConn3.JPG&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOKGtvemdONKXy1WzxdidXEoGlGOjNU3iw5R9wkaNjVCosbhV-smmBDdCp_sTqeG2N-c4-6CLnhIlN0n2FWrJw31KVTkSSqdgisL5JnCXei9cTcjwzKuJLw77yA9cP_1U1MwEiSzY_xIw/s400/validConn3.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595067141491266946&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5) Para testar, podemos criar um pequeno Rdmake que irá na tabela do Postgre e trazer o nome do primeiro cliente cadastrado. Para visualizar melhor,abra a figura em uma nova guia.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFbuHH01h4Kq0n18Xlxv46g5LxUTLewNykad_Jgt39_9sAAbG1NwU6X6cVlzfMUJB5PfhP5owAmEXUxq4w5hyKq4Tb_2tBMLqsu2YaDVCnSHxGe0cbItedzvBeWyWex1mwKAdM_MISn2k/s1600/rdmake_connexao.bmp&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 600px; height: 323px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFbuHH01h4Kq0n18Xlxv46g5LxUTLewNykad_Jgt39_9sAAbG1NwU6X6cVlzfMUJB5PfhP5owAmEXUxq4w5hyKq4Tb_2tBMLqsu2YaDVCnSHxGe0cbItedzvBeWyWex1mwKAdM_MISn2k/s400/rdmake_connexao.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5595086432579159378&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Na próxima publicação eu irei mostrar como construir uma arquitetura de comunicação entre o Protheus e PostGre e assim deixar pronta a integração de clientes.</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/4967388556004328335/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/conectar-o-protheus-outra-base-de-dados.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4967388556004328335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4967388556004328335'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/conectar-o-protheus-outra-base-de-dados.html' title='Conectar o Protheus a outra Base de Dados 2'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVh1WrOzD_ILPlwLZlKJyQKAVOdWxn2kvZ5pEirRKE95gYe53wdJpaXg46_RuqgHx3tjYWHdp_67nAE_sgvpYYdzBwkxGqc9sd6qgXsd3mYS90mYw2ZwNKCfZjkyB3AfLw5f3Z5uBc7Xw/s72-c/config_odbc.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-2509756561459391351</id><published>2011-04-11T04:58:00.000-07:00</published><updated>2011-04-11T06:32:36.394-07:00</updated><title type='text'>DbTree recursiva 2</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNp6FVyzPd5Wyv8O-lYgibWpoUx0-jqyyFTtHFJCtGk94L73-zpzf4A4dqFwp_CMR3TbcHdYvJ7zu-O8kM0xZr5HErvX5lCsCmMtl6E7KtzcVxdC_KTsFuRjU7FvXgAY5Z4PE41tN6Ams/s1600/algoritmo.bmp&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 388px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNp6FVyzPd5Wyv8O-lYgibWpoUx0-jqyyFTtHFJCtGk94L73-zpzf4A4dqFwp_CMR3TbcHdYvJ7zu-O8kM0xZr5HErvX5lCsCmMtl6E7KtzcVxdC_KTsFuRjU7FvXgAY5Z4PE41tN6Ams/s400/algoritmo.bmp&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5594316406460731730&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Na última postagem falei sobre a DbTree baseada em uma única tabela mas que tem infinitas hierarquias. Hoje irei postar a estrutura da tabela e o código principal para poder gerar a árvore.&lt;br /&gt;Primeiramente temos a estrutura da tabela, a qual chamei de ZRA. Eu a fiz para funcionar no Protheus mas ela pode ser usada para qualquer linguagem:&lt;br /&gt;&lt;br /&gt;ZRA_COD -&amp;gt; Caracter tamanho 6. Irá guarda o ID único do registro.(Tem que ser auto-incremento. No caso do Protheus eu uso o GetSXEnum(&quot;ZRA&quot;,&quot;ZRA_COD&quot;)  )&lt;br /&gt;&lt;br /&gt;ZRA_DESCRI -&amp;gt; Caracter tamnho 20. Terá a descrição do registro.&lt;br /&gt;&lt;br /&gt;ZRA_PAI -&amp;gt; Caracter tamanho 6. Irá guarda o ID único do nó pai. É extremamente importante que este campo tenha as mesmas características do campo ZRA_COD.&lt;br /&gt;&lt;br /&gt;ZRA_ATIVO -&amp;gt; Caracter tamanho 1. Criei esse campo como um tipo de &quot;flag&quot; que terá a letra &quot;S&quot; se o nó estiver ativo e &quot;N&quot; caso não. Possibilita desativar um nó sem ter que exclui-lo.&lt;br /&gt;&lt;br /&gt;ZRA_BMP1 -&amp;gt; Caracter de tamanho 10. Guarda o nome do ícone que o nó terá.&lt;br /&gt;&lt;br /&gt;ZRA_BMP2 -&amp;gt; Caracter de tamanho 10. Guarda o nome do ícone que o nó terá quando estiver aberto, ou seja, exibindo os nós filhos.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ZRA_NIVEL -&amp;gt; Numérico. No caso do Protheus, esse campo será preenchido com 1 caso seja um nó raiz ou 2 caso seja um nó filho de outro nó.&lt;br /&gt;&lt;br /&gt;A figura tenta ilustrar genericamente o algoritmo da função principal e abaixo o código em advpl.&lt;br /&gt;&lt;br /&gt;Static Function LoadTree(lAt)  &lt;br /&gt;Local cATivo   := iif(lAt,&quot;S / N&quot;,&quot;S&quot;)  &lt;br /&gt;Local aGetArea := GetArea()     &lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;if(Empty(ZRA-&gt;ZRA_PAI))&lt;br /&gt;   Return&lt;br /&gt;EndIf      &lt;br /&gt;oTree1:BeginUpdate()                                          &lt;br /&gt;       if(AllTrim(ZRA-&gt;ZRA_PAI) == &quot;000000&quot; .and. Alltrim(ZRA-&gt;ZRA_ATIVO) $ cAtivo  )  &lt;br /&gt;        &lt;br /&gt;          if(oTree1:Total()&gt;0 .and. nContNo &gt; 0)&lt;br /&gt;            oTree1:EndTree()&lt;br /&gt;          EndIf  &lt;br /&gt;           &lt;br /&gt;       if(! oTree1:TreeSeek(ZRA-&gt;ZRA_COD))&lt;br /&gt;           oTree1:AddTree(ZRA-&gt;ZRA_DESCRI + iif(Alltrim(ZRA-&gt;ZRA_ATIVO)==&quot;N&quot;,&quot; [DESATIVADO]&quot;,&quot;&quot;)+Space(24),.T.,&quot;FOLDER5&quot;,&quot;FOLDER6&quot;,,,ZRA-&gt;ZRA_COD)&lt;br /&gt;       EndIf   &lt;br /&gt;          &lt;br /&gt;       Elseif(Alltrim(ZRA-&gt;ZRA_ATIVO) $ cAtivo)  &lt;br /&gt;           if(! oTree1:TreeSeek(ZRA-&gt;ZRA_COD))&lt;br /&gt;            if oTree1:TreeSeek(ZRA-&gt;ZRA_PAI)  &lt;br /&gt;               oTree1:AddItem(ZRA-&gt;ZRA_DESCRI + iif(Alltrim(ZRA-&gt;ZRA_ATIVO)==&quot;N&quot;,&quot; [DESATIVADO]&quot;,&quot;&quot;)+Space(24),ZRA-&gt;ZRA_COD,iif(Alltrim(ZRA-&gt;ZRA_ATIVO)==&quot;N&quot;,&quot;F5_VERM&quot;,&quot;GEOTRECHO&quot;),,,,2) &lt;br /&gt;            EndIf&lt;br /&gt;           EndIf &lt;br /&gt;           &lt;br /&gt;       EndIf  &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  nContNo++      &lt;br /&gt;     ZRA-&gt;(DbSkip())&lt;br /&gt;     if(ZRA-&gt;(EOF())) &lt;br /&gt;        nContNo := 0 &lt;br /&gt;        oTree1:EndTree() &lt;br /&gt;        RestArea(aGetArea)  &lt;br /&gt;        oTree1:EndUpdate()&lt;br /&gt;        Return&lt;br /&gt;     EndIf &lt;br /&gt;     LoadTree(lShowDe) &lt;br /&gt; &lt;br /&gt;Return</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/2509756561459391351/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/dbtree-recursiva-2.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2509756561459391351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2509756561459391351'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/dbtree-recursiva-2.html' title='DbTree recursiva 2'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNp6FVyzPd5Wyv8O-lYgibWpoUx0-jqyyFTtHFJCtGk94L73-zpzf4A4dqFwp_CMR3TbcHdYvJ7zu-O8kM0xZr5HErvX5lCsCmMtl6E7KtzcVxdC_KTsFuRjU7FvXgAY5Z4PE41tN6Ams/s72-c/algoritmo.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-5969231938795560626</id><published>2011-04-07T04:58:00.000-07:00</published><updated>2011-04-08T07:04:10.703-07:00</updated><title type='text'>DbTree recursiva</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjsXLjsinDEjZFj1UG2JD5pmC7NGCcrW5SeLJQk3q8-4BcPpyYr__QPFqQ6ltG0BiyGg_xRA89M5tp9OPfs3VA4T55J1ARu8ZGdoEj0mMoXF0wyMhqgqurxYf8vrw1zDODx0qAId6LIdI/s1600/dbtree.JPG&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 311px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjsXLjsinDEjZFj1UG2JD5pmC7NGCcrW5SeLJQk3q8-4BcPpyYr__QPFqQ6ltG0BiyGg_xRA89M5tp9OPfs3VA4T55J1ARu8ZGdoEj0mMoXF0wyMhqgqurxYf8vrw1zDODx0qAId6LIdI/s400/dbtree.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5592828859105329442&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBArkju_3rQkus3G8rAtgks4gbLHZgqSUkd1wXFclp-bkdhsFFPxEo_RTRAcnIJa9nyn66oQ74C385xjMEZvMLA14BQcBSPPqv_uHScFx5Wy9Enyz3ZSow1fwSzrCn1mns2qU0XiuCWRA/s1600/dbtree2.JPG&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 266px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBArkju_3rQkus3G8rAtgks4gbLHZgqSUkd1wXFclp-bkdhsFFPxEo_RTRAcnIJa9nyn66oQ74C385xjMEZvMLA14BQcBSPPqv_uHScFx5Wy9Enyz3ZSow1fwSzrCn1mns2qU0XiuCWRA/s400/dbtree2.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5592828774117239426&quot; /&gt;&lt;/a&gt;&lt;br /&gt;O objeto Dbtree tem usos bem interessantes. Um dos que eu  acho mais legal é a construção de uma estrutura DbTree baseada em uma única tabela e que pode conter infinitas hierarquias. O melhor é que a lógica pode ser usada não só para o componente usando na programação Advpl mas em outras linguagens. Já criei a mesma rotina em Visual Basic 6.0 como também no Access.  A cima, um print da tela e em seguida outro print com as funções dos objetos contidos nela. Também coloquei um vídeo mostrando a rotina em funcionamento. &lt;div&gt;Na próxima publicação irei mostrar a estrutura da tabela e o algorítimo que realiza todas as funções.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/x6Nw9hPMrqs?hl=pt&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/x6Nw9hPMrqs?hl=pt&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/5969231938795560626/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/dbtree-recursiva.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5969231938795560626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5969231938795560626'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/04/dbtree-recursiva.html' title='DbTree recursiva'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjsXLjsinDEjZFj1UG2JD5pmC7NGCcrW5SeLJQk3q8-4BcPpyYr__QPFqQ6ltG0BiyGg_xRA89M5tp9OPfs3VA4T55J1ARu8ZGdoEj0mMoXF0wyMhqgqurxYf8vrw1zDODx0qAId6LIdI/s72-c/dbtree.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-5234857585961063243</id><published>2011-03-14T05:30:00.000-07:00</published><updated>2011-03-14T05:43:48.583-07:00</updated><title type='text'>Erros na Rotina Automática</title><content type='html'>Alguns erros que ocorrem nas rotinas automáticas  podem ser exibidos através do comando MostraErro(). Porém alguns erros não são detectados e a rotina roda como se estivesse tudo certo, ou seja, como se a gravação tivesse ocorrido com sucesso. Mas quando vamos procurar o registro, ele não se encontra.  Passei várias vezes por isso, principalmente em cadastro que tem uma série de validações como por exemplo o cadastro de clientes.  O primeiro problema foi quando eu estava fazendo a integração do Protheus com outro sistema e o CPF vinha em branco ou errado. O controle de erro da rotina automática não era acionado e eu não sabia o motivo pelo qual o cliente não estava sendo inserido até que resolvi olhar o CPF e pronto... primeiro problema resolvido.  Verifiquei se o sistema mandava todos os campos obrigatórios para o Protheus e criei um log que avisava carro algum estivesse em branco. Para isso usei a função X3Obrigat(cCampo).&lt;div&gt;  Só que não parou por aí pois alguns clientes continuavam a chegar e não eram gravados. Investiguei e descobri que o número do IBGE estava vindo &#39;0000&#39; em muitos.. ou seja.... o sistema que mandava as informações deixava muito a desejar em algumas validações. Mais uma vez isso foi corrigido. Funcionou por um bom tempo até que em alguns clientes de pessoa Jurídica o erro de não gravar continuava. De novo, investigando, descobri que o sistema mandava de forma incorreta a inscrição estadual, ou seja, não vazia a validação antes de mandar para o Protheus e em alguns casos a inscrição vinha nula ou com números digitados de forma aleatória. Depois de corrigido, até o momento a integração de clientes funciona muito bem.  &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/5234857585961063243/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/erros-na-rotina-automatica.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5234857585961063243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5234857585961063243'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/erros-na-rotina-automatica.html' title='Erros na Rotina Automática'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-5252516139974575329</id><published>2011-03-11T04:29:00.001-08:00</published><updated>2011-07-11T12:10:07.646-07:00</updated><title type='text'>Conectar o Protheus a outra Base de Dados</title><content type='html'>&lt;!-- Inclua esta tag na seção head ou logo antes da tag de fechamento da seção body --&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/plusone.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- Inclua esta tag onde desejar que o botão +1 seja exibido --&gt;&lt;br /&gt;
&lt;g:plusone&gt;&lt;/g:plusone&gt;&lt;br /&gt;
Uma integração entre o Protheus e outros sistemas pode ser feita de várias formas, xml, arquivo  txt  etc. Eu resolvi fazer algo mais direto, ou seja,  uma aplicação no Protheus(BD Sql Server) que enxerga o banco de dados do outro sistema, que usa o BD Postgres, e monta uma tabela temporária tratando esses dados e logo depois inserindo-os no Protheus através de rotinas automáticas.  Apesar do banco do outro sistema não ter nada haver com o banco de dados do Protheus, podemos conectar a ele da seguinte forma:&lt;div&gt;1- Crie uma ODBC no servidor do BD do Protheus para o outro banco. No caso do Postgres, eu tive que baixar um drive para conexão ODBC específica para ele.  Observe configuração de porta, senha e tal. No final, verifique se a conexão foi bem sucedida. Caso tenha sido, deveremos executar o próximo passo.&lt;/div&gt;&lt;div&gt;2- Valide a conexão ODBC da mesma forma que se faz com uma ODBC criada para o Protheus, ou seja, vá ao TOTVSDBMonitor e na aba configurações, escolha a aba Postgres ou a do BD do outro sistema que você quer se conectar. Crie um ambiente, coloque a senha correta e no assistente é só fazer a validação da conexão.&lt;/div&gt;&lt;div&gt;3- Com a validação ok, é hora de enxergar o outro banco. Vamos então criar uma rotina básica de comunicação com nosso BD da outra aplicação.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;-----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div&gt;&lt;div&gt;User Function JOBATAE1()   &lt;/div&gt;&lt;div&gt;Private cBDProd := &quot;MSSQL/Interface&quot;    // comunicacao com BD Protheus. Usado na funcao                                                                                 //TCLINK.&lt;/div&gt;&lt;div&gt;Private cBDAtae  := &quot;POSTGRES/atae&quot;   // comunicacao com BD sistema ATAE. Usado na                                                                                   //funcao.&lt;/div&gt;&lt;div&gt;Private cIPBD      := &quot;192.168.1.244&quot;        // IP do servidor de aplicacoes&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Private _nTcConn   //  conectar com  ATAE&lt;/div&gt;&lt;div&gt;Private _nTcCon2   //  conectar com Protheus&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;TCCONTYPE(&quot;TCPIP&quot;)    // tipo de conexao que sera usada&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;_nTcConn := TCLink(cBDAtae,cIPBD)     // conexao com ATAE(sistema que usa o BD PostGres)&lt;/div&gt;&lt;div&gt;_nTcCon2 := TCLink(cBDProd,cIPBD)    // conexao com Protheus    &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;-----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Neste primeiro trecho observe que  criei duas variáves :&lt;/div&gt;&lt;div&gt;cBDProd&lt;/div&gt;&lt;div&gt;&lt;div&gt;cBDAtae&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Elas guardam a string de conexao com os respectivos BD.   Logo depois temos a variável&lt;/div&gt;&lt;div&gt;cIPBD    que contém o IP do servidor de aplicações do Protheus.  Essas variáveis serão usadas na função TCLink pois ela tem a seguinte sintaxe:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:0cm;text-align:justify;text-indent:0cm; mso-list:l0 level1 lfo1;tab-stops:list 36.0pt&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-bidi-font-family:Arial;mso-ansi-language:EN-US&quot;&gt;TCLink(cConectString,cServer)&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;mso-bidi-font-weight:normal&quot;&gt;&lt;span style=&quot;mso-bidi-font-size:10.0pt; mso-bidi-font-family:Arial&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:0cm;text-align:justify;text-indent:0cm; mso-list:l0 level1 lfo1;tab-stops:list 36.0pt&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-bidi-font-family:Arial;mso-ansi-language:EN-US&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size:10.0pt; mso-bidi-font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:Arial;mso-ansi-language:EN-US; mso-fareast-language:PT-BR;mso-bidi-language:AR-SA&quot;&gt;cConectString: &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;String composta conforme a regra:&lt;/p&gt;&lt;p class=&quot;MsoPlainText&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-font-family:Arial;mso-ansi-language:PT-BR&quot;&gt;Para TOPConnect NT : Nome do Banco de Dados / Nome do Ambiente&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoPlainText&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; &quot;&gt;Para TOPConnect/400: Nome do Ambiente&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoPlainText&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; &quot;&gt;&lt;table class=&quot;MsoNormalTable&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;632&quot; style=&quot;width:474.0pt;margin-left:17.4pt;border-collapse:collapse;border:none;  mso-border-alt:solid windowtext .5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt;  mso-border-insideh:.5pt solid windowtext;mso-border-insidev:.5pt solid windowtext&quot;&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoPlainText&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; &quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-size: 10pt; font-family: Verdana, sans-serif; &quot;&gt;&lt;b&gt;cServer:  &lt;/b&gt;E&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; font-size: 13px; &quot;&gt;ndereço IP do servidor TOPConnect.&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;As variáveis _nTcConn e _nTcCon2 recebem o resultado da conexão, ou seja, o TCLink retorna um número negativo caso a conexão não tenho tido êxito. Neste caso existe a possibilidade de algum dos servidores de BD estarem offline ou a string de conexão está incorreta.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Continuando nossa aplicação temos:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;-----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;If ( _nTcConn &lt;&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;//mostra alerta de erro com a conexão  BD postgres ou BD Protheus &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Alert(&quot;*** Erro de conexão  ***&quot;)    &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Else &lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Alert(&quot;*** Conexão OK ***&quot;)&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;TCSETCONN(_nTcConn)   // setando conexao com Postgres&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;LerTab()  // lendo uma tabela Postgres&lt;/div&gt;&lt;div&gt;InsProt()    // pegando os dados do Postgres e inserindo no Protheus&lt;/div&gt;&lt;div&gt;EndIf &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Return &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Static Function LerTab()&lt;/div&gt;&lt;div&gt;Local cQuery := &quot; SELECT * FROM CLIENTE &quot;&lt;/div&gt;&lt;div&gt;dbUseArea(.T., &quot;TOPCONN&quot;, TCGenQry(,,cQuery), &quot;TRS&quot;, .F., .T.)&lt;/div&gt;&lt;div&gt;TRS-&gt;(DbGoTop())&lt;/div&gt;&lt;div&gt;Alert(TRS-&gt;NOME)&lt;/div&gt;&lt;div&gt;Return&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Static Function InsProt() &lt;/div&gt;&lt;div&gt;TCSETCONN(_nTcCon2) // conectando com o Protheus&lt;/div&gt;&lt;div&gt;&lt;div&gt;RPCSetType(3)&lt;/div&gt;&lt;div&gt;RPCSetEnv(&quot;01&quot;,&quot;01&quot;,&quot;user&quot;,&quot;senhaUser&quot;) // logando no Protheus&lt;/div&gt;&lt;/div&gt;&lt;div&gt;// faca um loop para carregar os dados da tabela  TRS para seu array&lt;/div&gt;&lt;div&gt;// e execute sua rotina automática&lt;/div&gt;&lt;div&gt;TRS-&gt;(DbCloseArea())&lt;/div&gt;&lt;div&gt;Return&lt;/div&gt;&lt;div&gt;&lt;div&gt;-----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Na segunda parte da rotina podemos ver que após verificar se as conexões estão Ok, usamos o comando TCSETCONN(_nTcConn)  para setar a conexão da rotina para o BD postgres. A partir daí é tudo quase igual a qualquer rotina para criar uma tabela temporária baseada em informações do Protheus. Observe apenas a sintaxe usada na variável cQuery que terá que obedecer as regras do banco. Depois de recuperar as informações da tabela CLIENTE do postgres, é só usar o comando  TCSETCONN(_nTcCon2) para se comunicar com o Protheus e a parti daí usar os comandos RPCSetType e RPCSetEnv para logar na empresa e filial. Depois disso, execute sua rotina automática e pronto, sua integração foi feita.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/5252516139974575329/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/conectar-o-protheus-outra-base-de-dados.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5252516139974575329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5252516139974575329'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/conectar-o-protheus-outra-base-de-dados.html' title='Conectar o Protheus a outra Base de Dados'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-2185669890615640667</id><published>2011-03-04T03:49:00.000-08:00</published><updated>2011-06-14T06:41:55.901-07:00</updated><title type='text'>Rotinas Automáticas</title><content type='html'>Uma ferramenta importante para a integração são as rotinas automáticas. No projeto em que eu estou, toda a integração é baseada em rotinas automáticas, salvo algumas exceções em que o Protheus não disponibiliza tais rotinas como uma para gerar uma nota fiscal de saída pelo faturamento.  Tive algumas dores de cabeça com algumas rotinas automáticas pois elas são bem rígidas e não deixam passar em branco alguns erros. Inclusive, alguns  desses erros  são bem difíceis de identificar . Irei listar abaixo alguns deles e suas soluções:&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;eu estava gerando Notas Fiscais de entrada através da rotina MSExecAuto({|x,y,z| mata103(x,y,z)},aCabec,aItens,3) &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Conferi os dados, tudo certinho. Só que na hora de gerar a nota, a função MostraERRO() gerava o seguinte aviso:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;HELP: REGNOIS&lt;br /&gt;
Não existe registro relacionado a este&lt;br /&gt;
código.&lt;br /&gt;
&lt;br /&gt;
Tabela SF1 18/02/11 16:48:56&lt;br /&gt;
- cTipo :=N&lt;br /&gt;
- cFormul :=N&lt;br /&gt;
- cNFiscal :=102454&lt;br /&gt;
- cSerie :=01&lt;br /&gt;
- dDEmissao :=18/02/11&lt;br /&gt;
- cA100For :=000005&lt;br /&gt;
- cLoja :=01 &lt; -- Invalido
- cEspecie :=NFE
- cUfOrig :=PB
&lt;/span&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Só que a loja era realmente do fornecedor e todos os outros dados estavam corretos. A não ser por um detalhe. O código do fornecedor está com tamanho igual a 6, porém o campo correspondente do Protheus estava com tamanho 14.  Nada muito haver com o erro apresentado pelo Protheus, mas que causou bastante dor de cabeça. Então na linha:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;aadd(aCabec,{&quot;F1_FORNECE&quot;,&quot;&lt;wbr&gt;000005&quot;}) &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;Eu fiz assim:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;aadd(aCabec,{&quot;F1_FORNECE&quot;,&quot;&lt;wbr&gt;000005        &quot;}) &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;E  a rotina funcionou normalmente.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  &gt;Resumo da história, é altamente recomendável usar códigos com o mesmo tamanho do campo.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, sans-serif; font-size: 13px; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/2185669890615640667/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/rotinas-automaticas.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2185669890615640667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/2185669890615640667'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/rotinas-automaticas.html' title='Rotinas Automáticas'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-6002907387765305049</id><published>2011-03-02T09:38:00.000-08:00</published><updated>2011-03-02T09:57:02.979-08:00</updated><title type='text'>Integração</title><content type='html'>Hoje, muitas empresas tem a necessidade de migrar para sistemas mais robustos e confiáveis. O problema é que essa migração não pode ser feita de uma hora para outra. Na verdade para a migração ocorrer, muitas vezes é necessário que os dois sistemas funcionem em paralelo e assim integrem informações até que naturalmente ocorra a total substituição do sistema antigo pelo mais moderno. Outra situação é quando a empresa quer trabalhar com dois sistemas em paralelo, por exemplo, um sistema específico para front de loja e outro para ficar na retaguarda. No meu caso estou fazendo justamente isso. Estou integrando um sistema usado no front de loja  e caixa com o sistema Protheus que fica na retaguarda. A grande dificuldade é justamente tratar as diferente regras e situações mas nada impossível de se fazer. Nas próximas publicações irei mostrar toda a arquitetura usada como também como foi feita a primeira parte da integração aonde clientes cadastrados no sistema front de loja vão automaticamente ser cadastrados no Protheus. &lt;br /&gt;Em meu outro Blogger (http://sap-b1-sdk.blogspot.com) estarei falando do sistema SAP B1 e irei mostrar além de exemplos de customizações, integrações com o sistema Protheus na parte de compras, vendas e cadastros. Até breve.</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/6002907387765305049/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/integracao.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6002907387765305049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/6002907387765305049'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2011/03/integracao.html' title='Integração'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-4801834889939308323</id><published>2010-05-28T17:14:00.000-07:00</published><updated>2010-05-28T17:22:45.356-07:00</updated><title type='text'>Arquitetura Protheus</title><content type='html'>Pessoal, estou voltando a atualizar este blog e abordarei o assunto advpl de uma forma diferente. Nas próximas postagens falarei primeiramente sobre a arquitetura Protheus, em seguida irei aprofundar-me um pouco sobre a IDE e finalmente estarei fazendo passo a passo  customizações  simples e mais a frente customizações complexas. Opniões e sugestões são bem vindas.</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/4801834889939308323/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2010/05/arquitetura-protheus.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4801834889939308323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4801834889939308323'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2010/05/arquitetura-protheus.html' title='Arquitetura Protheus'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-4620085278030593176</id><published>2009-06-15T06:29:00.000-07:00</published><updated>2009-06-15T06:53:09.567-07:00</updated><title type='text'>Algumas funções</title><content type='html'>Para facilitar a vida do desenvolvedor e garantir a integridade das informações, podemos fazer uso de muitas funções dentro do Protheus. Vamos falar sobre algumas delas que com frequencia usamos na Val. Usuário&lt;br /&gt;&lt;br /&gt;Pertence(&quot;RJ/SP/PB&quot;): Função que garante que oque será digitado pertence ao conjunto descrito na função. Neste caso estamos garantido que o usuário só poderá digitar RJ, SP ou PB em um campo que receba Unidades Federativas. Caso ele tente digitar por exemplo MG, o Protheus acusará o erro.&lt;br /&gt;&lt;br /&gt;ExistChav(cAlias,cChave,nOrdem,cHelp): Evita chave repetida verificando se conteúdo da cChave já existe, com base no índice nOrdem. Caso o usuário tente inserir uma cChave repetida, o Protheus exibe a mensagem cHelp.&lt;br /&gt;&lt;br /&gt;ExistCPO(cAlias,cChave,nOrdem): Função para garantir a integridade referencial.&lt;br /&gt;Como exemplo podemos ter um cadastro de cliente e outro de vendedor. Para associar em uma terceira tabela um vedendor a um cliente, temos que garantir que o cliente digitado realmente esteja cadastrado assim como o vendedor. Como exemplo , podemos usar na Val. Usuário do campo que será digitado o código do cliente o seguinte comando: ExistChav(&quot;SA1&quot;,XFILIAL(&quot;SA1&quot;)+A1_COD,1,&quot;Cliente não cadastrado em SA1&quot;):&lt;br /&gt;&lt;br /&gt;Vazio(): Verifica se o campo está vazio</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/4620085278030593176/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/algumas-funcoes.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4620085278030593176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/4620085278030593176'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/algumas-funcoes.html' title='Algumas funções'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-7587645062259235224</id><published>2009-06-14T18:24:00.000-07:00</published><updated>2009-06-14T19:34:08.509-07:00</updated><title type='text'>Parâmetros</title><content type='html'>Uma forma simples de customização é através do uso de parâmetros. Um exemplo desta fucionalidade é o parâmetro MV_ESTNEG (estoque negativo).  Caso seu conteúdo seja S, a venda de um produto poderá ser feita com estoque negativo, caso seu conteúdo seja N, a venda só será permitida se houver estoque daquele produto. Para ilustrar  melhor a situação, podemos ter o seguinte trecho de um RDMake:&lt;br /&gt;&lt;br /&gt;Local cEst := GetMv(&#39;MV_ESTNEG&#39;)  // cEst recebe o conteúdo de MV_ESTNEG&lt;br /&gt;&lt;br /&gt;If cEst == &#39;S&#39;   .or.   Qtd &lt; B2_Saldo&lt;br /&gt;   &lt;br /&gt;    Venda sem restrição de saldo&lt;br /&gt;&lt;br /&gt;Else&lt;br /&gt;&lt;br /&gt;Verificar estoque e tratar possível erro por estoque negativo&lt;br /&gt;&lt;br /&gt;endIf</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/7587645062259235224/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/parametros.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7587645062259235224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/7587645062259235224'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/parametros.html' title='Parâmetros'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3268238432720384647.post-5065222464131430350</id><published>2009-06-14T18:14:00.000-07:00</published><updated>2009-06-14T18:15:52.305-07:00</updated><title type='text'>Primeiro artigo</title><content type='html'>Nas próximas publicações estaremos abordando a programação Advpl e suas peculiaridades</content><link rel='replies' type='application/atom+xml' href='http://advpl-protheus.blogspot.com/feeds/5065222464131430350/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/primeiro-artigo.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5065222464131430350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3268238432720384647/posts/default/5065222464131430350'/><link rel='alternate' type='text/html' href='http://advpl-protheus.blogspot.com/2009/06/primeiro-artigo.html' title='Primeiro artigo'/><author><name>luislacombe</name><uri>http://www.blogger.com/profile/10479476395791123100</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQMEv15d0tVeIGfDtoED51pngasgGvsI-zzQCCh0eov6q9XhtFMyq7WEWC639ej6ET8jNhQGVccKP36CogpcfSSdBx4rkb936HQKfNhx7s9YPHY8eDY_YmTWtHTtg7yY/s113/eu_ju.jpg'/></author><thr:total>0</thr:total></entry></feed>