|
 |
|
HTML - Reading XML with HTML Posted By: JimmyOctane Contact |
<br>
<br>
<a name="Top10Sales">
<H3>Top 10 Customers</H3></a>
<xml src="http://www.code400.com/xml/SomeSalesData.xml"
id="xmlitem4"
async="false">
</xml>
<table
datasrc="#xmlitem4"
width="100%"
border="1" class="smalltext" bordercolor="#0D0D71" style="font-size: xx-small;">
<thead>
<th>Customer #</th>
<th>Customer Name</th>
<th>Total Sales</th>
</thead>
<tr align="left">
<td><span datafld="Customer"></span></td>
<td><span datafld="CustName"></span></td>
<td><span datafld="YTDSales"></span></td>
===XML===
<SomeSalesData>
- <Group>
<Customer>1</Customer>
<CustName>Customer#1</CustName>
<YTDSales>$2,130,836.45</YTDSales>
</Group>
- <Group>
<Customer>2</Customer>
<CustName>Customer#2</CustName>
<YTDSales>$1,530,490.72</YTDSales>
</Group>
- <Group>
<Customer>3</Customer>
<CustName>Customer#3</CustName>
<YTDSales>$815,344.27</YTDSales>
</Group>
- <Group>
<Customer>4</Customer>
<CustName>Customer#4</CustName>
<YTDSales>$551,465.85</YTDSales>
</Group>
- <Group>
<Customer>5</Customer>
<CustName>Customer#5</CustName>
<YTDSales>$518,783.12</YTDSales>
</Group>
- <Group>
<Customer>6</Customer>
<CustName>Customer#6</CustName>
<YTDSales>$481,718.62</YTDSales>
</Group>
- <Group>
<Customer>7</Customer>
<CustName>Customer#7</CustName>
<YTDSales>$465,357.76</YTDSales>
</Group>
- <Group>
<Customer>8</Customer>
<CustName>Customer#8</CustName>
<YTDSales>$440,793.49</YTDSales>
</Group>
- <Group>
<Customer>9</Customer>
<CustName>Customer#9</CustName>
<YTDSales>$366,586.31</YTDSales>
</Group>
- <Group>
<Customer>10</Customer>
<CustName>Customer#10</CustName>
<YTDSales>$362,484.27</YTDSales>
</Group>
</SomeSalesData>
</pre> | |
HTML - RPGLE HTML Generator Posted By: Arshad Khan Contact |
<pre><br> This code builds HTML in side RPG programe and It can be save as .HTML and .EXL when FTPed Or Email,
You can open this source code in IE ,Excel Spread Sheet. Let me know any question. Akhan@servicecraft.com
</pre><br> | |
HTML - RPGLE HTML Generator Posted By: Arshad Khan Contact |
<pre><br> This code builds HTML in side RPG programe and It can be save as .HTML and .EXL when FTPed Or Email,
You can open this source code in IE ,Excel Spread Sheet. Let me know any question. Akhan@servicecraft.com
hDFTACTGRP(*NO)
*=================================================================================*
* Program : PREXCLR *
* Description : Generic Program to write HTML from RPG for Excel Sheet *
* Author : Arshad Khan *
* Date : 06/06/06 *
*=================================================================================*
* Programer Date PCR Description *
* Arshad 06/06/06 001 Created *
*=================================================================================*
* File Definations
fcext if e k Disk
fProd if e k Disk
fBpu if e k Disk
fPrExlPF if a e Disk
fPr3500lf if e k Disk
fPr3500lf1 if e k Disk Rename(PRO01R:PRO02R)
* Work Variables
d@Data s 9000 Inz(*Blanks)
dOutputfile s 9000 Inz(*Blanks)
dHeadTitle s 30a Inz('Product')
dsHeadTitle s 30a Inz('Product Description')
dDoNotBuildTag s 1a Inz('N')
dSvProd s 15a Inz(*Blanks)
dxPrProd s LIKE(PrProd)
dsPRCUSTL s LIKE(PRCUSTL)
dsPrName s LIKE(PrName)
dsPrBPU s LIKE(PrBPU)
dsProdDes s LIKE(PrDes1)
dsBPDESC s LIKE(BpDesc)
dsPrcust s LIKE(Prcust)
*=================================================================================*
* Procedure
d DataAdd Pr
d tempstr 300a Value Comment
*=================================================================================*
/Free
Exsr Buildheader;
Exsr HeaderMargine;
Exsr FillMonths;
Exsr FilltheShells;
Exsr WritetoExcel;
*Inlr = *On;
//*=================================================================================*
//* Build the header *
//*=================================================================================*
BegSr Buildheader;
Read Pr3500lf;
Dow Not %Eof;
If Prcust <> 0 ;
sPrCust = PrCust;
Chain (Prcust ) CEXT;
If %Found;
sPrname = CeNAME;
Endif;
Leave;
Endif;
Read Pr3500lf;
EndDo;
DataAdd('<table Border="1" width="100%" cellspacing="0" '+
'cellpadding="0" bordercolor="#083194"> </B></font></TD>' +
'<tr><td align="center" colspan="17"><B> Product ' +
' Analysis Reports <br> ' +
'</TD> </b></tr>' );
DataAdd('<table Border="1" width="100%" cellspacing="0" '+
'cellpadding="0" bordercolor="#083194"> </B></font></TD>' +
'<tr><td align="center" colspan="17"><B> ' +
sPrName + '(' + %Char(sPRCUST) + ')' +
' <br> ' +
'</TD> </b></tr>' );
EndSr;
//*=================================================================================*
//* Build the Header Margine *
//*=================================================================================*
Begsr HeaderMargine;
DataAdd('<tr><TD bgcolor="#cccccc"> <font color="#083194">' +
'<b>' + %Trim(HeadTitle) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194">' +
'<b>' + 'Product Description' + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194">' +
'<b>' + 'BPU Description ' + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
' Activies ' +'</B></font></TD> ');
EndSr;
//*=================================================================================*
//* Build the Header Margine *
//*=================================================================================*
Begsr FillMonths;
Chain ( 0 :'HEADER': ' ') Pr3500lf;
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE1)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE2)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE3)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>'+
%Trim(%Char(PRDATE4)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE5)) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE6)) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>'+
%Trim(%Char(PRDATE7)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE8)) +'</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(PRDATE9)) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(Prdat10)) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(Prdat11)) + '</B></font></TD> ');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
%Trim(%Char(Prdat12)) + '</B></font></TD>');
DataAdd('<TD bgcolor="#cccccc"> <font color="#083194"><b>' +
'Gnd Tot'+ '</B></font></TD>');
DataAdd( '</tr>');
Endsr;
//*=================================================================================*
//* Fill the Shells in each colums and row *
//*=================================================================================*
Begsr FilltheShells;
Setll *Start Pr3500LF1;
Read Pr3500LF1;
Dow Not %Eof;
xPrProd = PrProd;
Exsr CheckRejection;
If DoNotBuildTag = 'N';
Exsr Grouptheselection;
Exsr WriteGrandTotalwithZeros;
Exsr WritetoExcel;
EndIf;
Read PR3500LF1;
EndDo;
Endsr;
//*=================================================================================*
//* Build the Header Margine *
//*=================================================================================*
BegSr WritetoExcel;
if @data <> *Blank;
Outputfile = @Data;
PROUTPUT1= Outputfile;
Write PREXLPFR;
Endif;
@Data = *Blank;
EndSr;
//*=================================================================================*
//* Check Reject *
//*=================================================================================*
BegSr CheckRejection;
If PRCUST = 0;
DoNotBuildTag = 'Y';
Else;
DoNotBuildTag = 'N';
Endif;
EndSr;
//*=================================================================================*
//* Group the selection *
//*=================================================================================*
BegSr Grouptheselection;
Setll (PrCUST:xPrProd ) Pr3500lf ;
ReadE (PrCUST:xPrProd ) Pr3500lf ;
Dow Not %Eof;
Exsr ObtainProdDescBPUDesc;
If PrSrc = 'T';
sPRCUSTL = PRCUSTL;
/End-Free
c Goto Nextlevel
/Free
Endif;
DataAdd('<tr>');
DataAdd('<td>' + PRPROD + '</td>');
DataAdd('<td>' + %Trim(sProdDes) + '</td>');
DataAdd('<td>' + %Trim(sBPDESC) + '</td>');
Exsr FillTypePrSrc;
DataAdd('<td>' + %Char(PRAQTY1) + '</td>');
DataAdd('<td>' + %Char(PRAQTY2) + '</td>');
DataAdd('<td>' + %Char(PRAQTY3) + '</td>');
DataAdd('<td>' + %Char(PRAQTY4) + '</td>');
DataAdd('<td>' + %Char(PRAQTY5) + '</td>');
DataAdd('<td>' + %Char(PRAQTY6) + '</td>');
DataAdd('<td>' + %Char(PRAQTY7) + '</td>');
DataAdd('<td>' + %Char(PRAQTY8) + '</td>');
DataAdd('<td>' + %Char(PRAQTY9) + '</td>');
DataAdd('<td>' + %Char(PRAQT10) + '</td>');
DataAdd('<td>' + %Char(PRAQT11) + '</td>');
DataAdd('<td>' + %Char(PRAQT12) + '</td>');
DataAdd('<td>' + %Char(PRTOTAL) + '</td>');
DataAdd('</tr>');
/End-Free
c Nextlevel Tag
/Free
ReadE (PrCUST:xPrProd ) Pr3500lf ;
EndDo;
EndSr;
//*=================================================================================*
//* Write GrandTotal with filled line with zeros *
//*=================================================================================*
Begsr WriteGrandTotalwithZeros;
DataAdd('<tr>');
DataAdd('<td> <B> ' + PRPROD + '</B> </td>');
DataAdd('<td> <B> ' + %Trim(sProdDes) + ' </B> </td>');
DataAdd('<td> <B> ' + %Trim(sBPDESC) + ' </B> </td>');
Exsr FillTypePrSrc;
DataAdd('<td> <B> ' + %Char(PRAQTY1) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY2) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY3) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY4) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY5) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY6) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY7) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY8) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQTY9) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQT10) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQT11) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(PRAQT12) + ' </B> </td>');
DataAdd('<td> <B> ' + %Char(sPRCUSTL) + ' </B> </td>');
DataAdd('</tr>');
EndSr;
//*=================================================================================*
//* Obtain Prod Description and BPU Descriptions *
//*=================================================================================*
Begsr ObtainProdDescBPUDesc;
Chain (PrCust:PrProd) Prod;
If %Found;
sPrBPU = PrBPU;
sProdDes = PrDES1;
BpCUST = PrCust;
Chain (BpCUST:sPrBPU) BPU;
If %Found;
sBPDESC = BPDESC;
Endif;
Endif;
EndSr;
//*=================================================================================*
//* Procedure to append Data *
//*=================================================================================*
BegSr FillTypePrSrc;
If PrSrc = 'R';
DataAdd('<td>' + 'Rcv' + '</td>');
Endif;
If PrSrc = 'S';
DataAdd('<td>' + 'Shp' + '</td>');
Endif;
If PrSrc = 'A';
DataAdd('<td>' + 'Adj' + '</td>');
Endif;
If PrSrc = 'T';
DataAdd('<td> <B> ' + '****' + ' </B> </td>');
Endif;
Endsr;
/End-Free
*====================================================================================*
* Procedure to append Data
*====================================================================================*
p DataAdd B
d DataAdd PI
d TempStr 300a Value
/Free
@Data = %TrimR(@Data) + %Trim(TempStr);
/End-Free
p E
</pre><br> | |
|
|
| |
| |
Suggestions ©
Monday Sep 06, 2010 @ 5:36 PM
|
|
|