ERP 2.50:Developers Guide/Code Snippets/Report
Adding a link to a report
What?
Given a report we would like to link the value of a column with the correspondent window in the application. As a basis we are going to use the example of this manual in the wiki.
Get the original source code from there. Once we have the code what we are going to do is to link the name of a client with the Business Partner window.
How?
We are going to modify the original source code like this:
ReportBusinessPartner.html
The first step is to define a hidden parameter in the html file. You can do it like this:
... <FORM method="POST" action="ReportBusinessPartner.html" name="frmMain" id="form"> <INPUT type="hidden" name="Command"></INPUT> <INPUT type="hidden" name="inpcBpartnerId"></INPUT> <table height="100%" border="0" cellpadding="0" cellspacing="0" id="main"> <tr> <td valign="top" id="tdleftTabs"></td> ...
Then, the original code define, in the OUTPUT section, a column
... <TD width="68%" class="DataGrid_Body_Cell" id="field">xxName</TD> ...
let's modify it for:
... <TD width="20%" class="DataGrid_Body_Cell" > <A href="#" onclick="submitCommandFormParameter('DIRECT', document.frmMain.inpcBpartnerId, yy, false, document.frmMain, '../BusinessPartner/BusinessPartner_Relation.html', null, false, true);return false;" onmouseover="window.status='Tercero';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="idfieldCBPartnerId"> <SPAN id="fieldName">xxName</SPAN> </A> <SPAN> </SPAN> </TD> ...
ReportBusinessPartner.xml
Now let's add a new field in the structure with name "structure1". Define it with the other fields so,
... <FIELD id="idfieldCBPartnerId" attribute="onclick" replace="yy">partnerid</FIELD> ....
ReportBusinessPartner.xsql
Modify the original select like this,
SELECT AD_ORG.NAME AS AD_ORG, C_BP_GROUP.NAME AS BPGROUP, C_BPARTNER.C_BPARTNER_ID AS PARTNERID, C_BPARTNER.NAME, C_BPARTNER.ISVENDOR, C_BPARTNER.ISCUSTOMER, C_BPARTNER.ISEMPLOYEE, C_BPARTNER.ISSALESREP FROM C_BPARTNER, AD_ORG, C_BP_GROUP WHERE C_BPARTNER.AD_ORG_ID = AD_ORG.AD_ORG_ID AND C_BP_GROUP.C_BP_GROUP_ID = C_BPARTNER.C_BP_GROUP_ID AND C_BPARTNER.AD_CLIENT_ID IN ('1') AND C_BPARTNER.AD_ORG_ID IN ('1') AND 1=1 ORDER BY AD_ORG ASC, BPGROUP ASC, NAME ASC
Once compiled you should see something like that:
Languages: |
ERP 2.50:Developers Guide/Code Snippets/SOAP WebService | ERP 2.50:Developers Guide/Code Snippets/Window and Tab