Histórico da Página
HTML |
---|
<div id="main-content" class="wiki-content group">
<h1 id="id-2.1Formulário-ComocriarumformuláriodiretamentenoECM">How
to create a form directly in ECM.</h1>
<ol>
<li>Create an HTML file with the fields with the same name used
in Microsiga Protheus.</li>
<li>Add the HTML file as a New Card Index in the Documents of ECM
and check the Code that was generated. This code will be used in the
creation of the future Process.</li>
</ol>
<p> </p>
<p>
<em>* For more information about form customizations in ECM, see
the ECM documentation. The Objective of this documentation is to
provide the care we must take to build a form for integration with
Microsiga Protheus.</em>
</p>
<h2 id="id-2.1Formulário-Exemplodeformulário">Sample form.</h2>
<blockquote>
<p align="left"><HTML></p>
<p align="left"><HEAD></p>
<p align="left">  <TITLE> Example - Customer </TITLE></p>
<p align="left">  <LINK REL=STYLESHEET
HREF="/webdesk203/wdk/global.css"></p>
<p align="left"></HEAD></p>
<p align="left"><BODY scroll=yes></p>
<p align="left"><span class="NumSecao"></p>
<p align="left"><strong> Registration</strong></span></p>
<p align="left"><HR></p>
<p align="left"><br></p>
<p align="left"><form></p>
<p align="left"><table></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Code:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="6"
name="A1_COD"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Loja:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="2"
name="A1_LOJA"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Física/Jurídica:</b></td></p>
<p align="left">    <td
class="Normal"><strong></p>
<p align="left">       
<select name="A1_PESSOA"></p>
<p align="left">           
<option value="F">Física</option></p>
<p align="left">           
<option value="J">Jurídica</option></p>
<p align="left">       
</select></p>
<p align="left">      
</strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Name:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="40"
name="A1_NOME"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Trade Name:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="20"
name="A1_NREDUZ"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Address:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="40"
name="A1_END"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>Type:</b></td></p>
<p align="left">    <td
class="Normal"><strong></p>
<p align="left">       
<select name="A1_TIPO"></p>
<p align="left">           
< option value = "F" > Cons. End </option></p>
<p align="left">           
<option value="L">Rural Producer</option></p>
<p align="left">           
<option value="R">Reseller</option></p>
<p align="left">           
<option value="S">Solidary</option></p>
<p align="left">           
<option value="X">Export</option></p>
<p align="left">       
</select></p>
<p align="left">    </strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>City:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="60"
name="A1_MUN"></strong></td></p>
<p align="left">  </tr></p>
<p align="left">  <tr></p>
<p align="left">    <td align="right"
width="150" class="Labels"><b>State:</b></td></p>
<p align="left">    <td
class="Normal"><strong><input type="text" size="2"
name="A1_EST"></strong></td></p>
<p align="left">  </tr></p>
<p align="left"> </table></p>
<p align="left"></form></p>
<p align="left"></BODY></p>
<p align="left"></HTML></p>
</blockquote>
<h1 id="id-2.1Formulário-Construindoformuláriospararotinasautomáticas">Building
forms for automatic routines.</h1>
<ol>
<li>Configure the integration for GED between Protheus and ECM in
the Configurator, in the <em>Environment > Totvs ECM > GED
Wizard</em> option.
</li>
<li>Use the <strong>FWECMPutCard</strong> function to send the
form to the ECM according to the example below (the card index will
be created in the <em>ERP_MP \ <empresas> \ MP_CARDS</em> folder
in ECM):
</li>
</ol>
<h2 id="id-2.1Formulário-Exemplodecódigo-fonte">Example of source
code.</h2>
<blockquote>
<p align="left" style="margin-left: 30.0px;">#include "totvs.ch".</p>
<p align="left" style="margin-left: 30.0px;">User Function
FormCliente().</p>
<p align="left" style="margin-left: 30.0px;">Local cProcessId :=
"CLIENTE" // if provided, it updates the form related to the process,
otherwise, creates a new one.</p>
<p align="left" style="margin-left: 30.0px;">Local cDescription :=
"Customer file form".</p>
<p align="left" style="margin-left: 30.0px;">Local
cCardDescription := "".</p>
<p align="left" style="margin-left: 30.0px;">Local aHTML :=
Array(1,2) // form files.</p>
<p align="left" style="margin-left: 30.0px;">Local aEvents :=
Array(1,2) // events that will not be customized for the form.</p>
<p align="left" style="margin-left: 30.0px;">Local nFormId</p>
<p align="left" style="margin-left: 30.0px;">Local aError</p>
<p align="left"> </p>
<p align="left" style="margin-left: 30.0px;">aHTML[1][1] :=
"cliente.html" // file name</p>
<p align="left" style="margin-left: 30.0px;">aHTML[1][2] :=
'<HTML>'+; // file content</p>
<p align="left" style="margin-left: 30.0px;">'<HEAD>'+;</p>
<p align="left" style="margin-left: 30.0px;">' 
<TITLE>Example - Customer</TITLE>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <LINK
REL=STYLESHEET HREF="/webdesk203/wdk/global.css">'+;</p>
<p align="left" style="margin-left: 30.0px;">'</HEAD>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<BODY
scroll=yes>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<span
class="NumSecao">'+;</p>
<p align="left" style="margin-left: 30.0px;">'<strong> Registration</strong></span>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<HR>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<br>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<form>'+;</p>
<p align="left" style="margin-left: 30.0px;">'<table>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Code:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="6"
name="A1_COD"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Store:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="2"
name="A1_LOJA"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Individual/Legal Entity:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong>'+;</p>
<p align="left" style="margin-left: 30.0px;">'       
<select name="A1_PESSOA">'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="I">Individual</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="E">Legal Entity</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'       
</select>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
</strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Name:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="40"
name="A1_NOME"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150" class="Labels"><b>Trade
Name:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="20"
name="A1_NREDUZ"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Address:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="40"
name="A1_END"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>Type:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong>'+;</p>
<p align="left" style="margin-left: 30.0px;">'       
<select name="A1_TIPO">'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="F">Cons. Final</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="L">Rural Producer</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="R">Reseller</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="S">Solidary</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
<option value="X">Export</option>'+;</p>
<p align="left" style="margin-left: 30.0px;">'           
</select>'+;</p>
<p align="left" style="margin-left: 30.0px;">'      
</strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>City:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="60"
name="A1_MUN"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  <tr> '+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td align="right" width="150"
class="Labels"><b>State:</b></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'   
<td class="Normal"><strong><input type="text" size="2"
name="A1_EST"></strong></td>'+;</p>
<p align="left" style="margin-left: 30.0px;">'  </tr>'+;</p>
<p align="left" style="margin-left: 30.0px;">' </table>'+;</p>
<p align="left" style="margin-left: 30.0px;">'</form>'+;</p>
<p align="left" style="margin-left: 30.0px;">'</BODY>'+;</p>
<p align="left" style="margin-left: 30.0px;">'</HTML>'</p>
<p align="left"> </p>
<p align="left" style="margin-left: 30.0px;">aEvents[1][1] :=
"setEnable" // name of the event</p>
<p align="left" style="margin-left: 30.0px;">aEvents[1][2] :=
'function setEnable() {'+; // JavaScript language script</p>
<p align="left" style="margin-left: 30.0px;">'log.info("Function
call test");'+;</p>
<p align="left" style="margin-left: 30.0px;">'}'</p>
<p align="left"> </p>
<p align="left" style="margin-left: 30.0px;">
nFormId := <strong>FWECMPutCard(cProcessId,cDescription,cCardDescription,aHTML,aEvents)</strong>
// returns the ECM card index code
</p>
<p align="left" style="margin-left: 30.0px;">If FWWFIsError()</p>
<p align="left" style="margin-left: 30.0px;">   aError
:= FWWFGetError()</p>
<p align="left" style="margin-left: 30.0px;">  
MsgStop(aError[2])</p>
<p align="left" style="margin-left: 30.0px;">Else</p>
<p align="left" style="margin-left: 30.0px;">  
MsgInfo("Card index updated successfully")</p>
<p align="left" style="margin-left: 30.0px;">EndIf</p>
<p align="left" style="margin-left: 30.0px;">Return</p>
</blockquote>
<h1 id="id-2.1Formulário-ConstruindoformuláriospararotinasMVC">Building
forms for MVC routines.</h1>
<ol>
<li>Configure the integration for GED between Protheus and ECM in
the Configurator, in the Environment > Totvs ECM > GED Wizard option.</li>
<li>Use the <strong>GetXMLLayout</strong> method of the View to
generate the HTML.<br />
<ol>
<li>Only the Fields and Grid components will be converted into
HTML.</li>
<li>Only the forms of the CRUD and Master/Detail type can be
exported to ECM, since you cannot simulate all the events from the
other types of Microsiga Protheus forms.</li>
<li>This method is just a demonstration of how the mechanism is
in Microsiga Protheus. MVC forms have an automatic way of
generating a process with form in ECM, in the routine 'Related
Actions'.</li>
</ol></li>
</ol>
<blockquote>
<p align="left">#include "totvs.ch".</p>
<p align="left">User Function FormView()</p>
<p align="left">Local oView := FWLoadView("MATA030_MVC")</p>
<p align="left">Local cProcessId := "CLIENTE" // if provided, it
updates the form related to the process, otherwise, creates a new
one.</p>
<p align="left">Local cDescription := "Customer file form".</p>
<p align="left">Local cCardDescription := "".</p>
<p align="left">Local aEvents := Array(1,2) // events that will
not be customized for the form.</p>
<p align="left">Local nFormId</p>
<p align="left">Local aError</p>
<p align="left">Local aFiles</p>
<p align="left">Local lHtm := .T.</p>
<p align="left">Local lEmbedded := .F.</p>
<p align="left">Local lDocType := .T.</p>
<p align="left"> </p>
<p align="left">
<a href="http://oViewsetOperation(3)" class="external-link"
rel="nofollow">oView:setOperation(3)</a>
</p>
<p align="left"> </p>
<p align="left">
aFiles := oView:<strong>GetXMLLayOut(lHtm,lEmbedded,lDocType)</strong>
</p>
<p align="left"> </p>
<p align="left">aEvents[1][1] := "setEnable" // name of the event</p>
<p align="left">aEvents[1][2] := 'function setEnable() {'+; //
JavaScript language script</p>
<p align="left">'log.info("Function call test");'+;</p>
<p align="left">'}'</p>
<p align="left"> </p>
<p align="left">nFormId :=
FWECMPutCard(cProcessId,cDescription,cCardDescription,aFiles,aEvents)
// returns the card index code in ECM</p>
<p align="left">If FWWFIsError()</p>
<p align="left">   aError := FWWFGetError()</p>
<p align="left">   MsgStop(aError[2])</p>
<p align="left">Else</p>
<p align="left">   MsgInfo("Card index updated
successfully")</p>
<p align="left">EndIf</p>
<p align="left">Return</p>
</blockquote>
<h2 id="id-2.1Formulário-UsandoMVCnosformuláriosModelo1">Using MVC
Model 1 forms</h2>
<p>For automatic routines of the Model 1 (CRUD) type that use only
Data Dictionary fields, you can use MVC to simplify the form
customization process, as follows:</p>
<blockquote>
<p align="left">#include "totvs.ch".</p>
<p align="left">User Function FormTable()</p>
<p align="left">Local cTable := "SA1"</p>
<p align="left">Local cProcessId := "MATA030"</p>
<p align="left">Local cDescription := "Customer (automatic
routine)"</p>
<p align="left">Local oView</p>
<p align="left">Local aEvents := Array(1,2) // events that will
not be customized for the form.</p>
<p align="left">Local nFormId</p>
<p align="left">Local aError</p>
<p align="left">Local aFiles</p>
<p align="left">Local lHtm := .T.</p>
<p align="left">Local lEmbedded := .F.</p>
<p align="left">Local lDocType := .T.</p>
<p align="left"> </p>
<p align="left">
<strong>FwAliasMVC(cTable,cProcessId,cDescription)</strong>
</p>
<p align="left"> </p>
<p align="left">oView := FwLoadView("PROTHEUSMVC")</p>
<p align="left">
<a href="http://oViewsetOperation(3)" class="external-link"
rel="nofollow">oView:setOperation(3)</a>
</p>
<p align="left"> </p>
<p align="left">
aFiles := <strong>oView:GetXMLLayOut(lHtm,lEmbedded,lDocType)</strong>
</p>
<p align="left">aEvents[1][1] := "setEnable" // name of the event</p>
<p align="left">aEvents[1][2] := 'function setEnable() {'+; //
JavaScript language script</p>
<p align="left">'log.info("Function call test");'+;</p>
<p align="left">'}'</p>
<p align="left"> </p>
<p align="left">nFormId :=
FWECMPutCard(cProcessId,cDescription,cCardDescription,aFiles,aEvents)
// returns the card index code in ECM</p>
<p align="left">If FWWFIsError()</p>
<p align="left">   aError := FWWFGetError()</p>
<p align="left">   MsgStop(aError[2])</p>
<p align="left">Else</p>
<p align="left">   MsgInfo("Card index updated
successfully")</p>
<p align="left">EndIf</p>
<p align="left">Return</p>
</blockquote>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p>
<br />
<br />
</p>
<p> </p>
</div>
|
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas