awk -F= 'BEGIN { 
T["00"]="FORM ID"
T["01"]="FORM NAME"
T["02"]="FORM TYPE"
T["03"]="LINES"
T["04"]="PAGES"
T["05"]="PERIOD 1"
T["06"]="PERIOD 2"
T["07"]="REGS"
T["08"]="JAVASCRIPTS"
T["09"]="HIDDEN FLAGS"
T["10"]="EXTRA SUBMIT BAR"
T["11"]="L"
T["12"]="ID_DAT"
T["13"]="DESCRIPTION"
T["14"]="DATA TYPE"
T["15"]="LG"
T["16"]="AT"
T["17"]="NFORM"
T["18"]="LFIELD"
T["19"]="DS"
T["20"]="LGD"
T["21"]="FUNCTION"
	printf "%s^",T["00"]
}
substr($1,1,6)=="formsD" && substr($1,1,8)!="formsD00"  { next }
$2!="" && substr($1,1,6)=="formsH" {
        if(substr($1,length($1)-1)!="00")
        {
                x=substr($1,length($1)-1)
                printf "%s^",T[x]
        }
}
$2!="" && substr($1,1,6)=="formsD" {
                printf "%s^",T[NR-1]
}
END {
	print ""
} ' $1 |
 awk -F"^" ' BEGIN {ttop("Consulta de Datos en FORMS...................................");bgcolor="#FFFFFF"}
NR==1 { for (i=1; i<NF; i++) labels($i)
print "</tr>"
next
}
{ for (i=1; i<NF; i++)if (i==1) boton($i)
else label($i)
print "</tr>"
if (NR%2==0 ) bgcolor="#E1E1E1"
else bgcolor="#FFFFFF"
}
END { foot() } 
function boton(value)
{
	print "<td bgcolor=\"#E1E1E1\">"
printf "<p><input type=\"submit\" style=\"width: 120\" value=\"%s\" name=\"T02\"></p>\n",value
print "</td>"
}
function label(value)
{
printf "<td bgcolor=\"%s\">",bgcolor
printf "<p align=\"center\"><font face=\"Arial\" size=\"3\">&nbsp;%s&nbsp;</font></p>\n",value
print "</td>"
}
function labels(value)
{
print "<td bordercolor=\"#C0C0C0\" bgcolor=\"#003399\" align=\"center\">"
printf "<p align=\"center\"><b><font color=\"#FFFFFF\">%s</font></b></p>\n",value
print "</td>"
}
function ttop(value)
{
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
print "<meta name=\"GENERATOR\" content=\"Inhedo 4gt 1.0\">"
print "<meta name=\"ProgId\" content=\"Inhedo Form Generator\">"
printf "<title>%s</title>\n",value
print "</head>"
print "<center>"
print "<body bgcolor=\"#D0D0DF\">"
print "<p align=\"center\"><img border=\"0\" src=\"../logol.jpg\" width=\"200\" height=\"97\"></p>"
printf "<H1>FORMS...................................</H1>\n"
print "<form method=\"post\" action=\"../cgi-bin/formsbsc.cgi\" name=billform>"
print "<center>"
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#999999\" height=\"50\">"
printf "<input type=\"hidden\" value=\"Query\" name=\"B1\">\n"
print "<tr>"
print "</center>"
}
function foot()
{
print "</table>"
print "</center>"
print "</form>"
print "</body>"
print "</html>"
} ' - $2
awk ' BEGIN {
print "</body>"
print "</form>"
print "<form method=\"GET\" action=\"../forms.htm\">"
printf "<p align=\"center\"><input type=\"submit\" value=\"Continuar\" name=\"B1\" style=\"width: 200; height: 50; font-weight: bold; font-size: 18pt\"></p>\n"
print "</form>"
print "</body>"
print "</html>"
exit } ' - $2
