BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
frm=`echo $* |./get | awk ' { print $1 }'`
FIL=`echo $* |./get | awk ' { print $2 }'`

SRC=tmp/$frm"list.cgi"
RES="appl/$frm/$frm.t0 appl/$frm/$frm.t1"
echo $FIL $SRC,$frm,$RES,
titu=`ihmq newform H01^$frm H02^ | awk -F^ ' NR==1 { print $2}'`
{
awk -F: ' BEGIN { h[0]=1 ; z=0 }
{ split($0,x,"=") }
FILENAME==ARGV[1] && /H/ { h[substr(x[1],length(x[1])-1,2)+0]=1 }
FILENAME==ARGV[1] && /D/ { d[substr(x[1],length(x[1])-3,2)+0]=1 }
FILENAME==ARGV[1] { next }
FILENAME==ARGV[2] && FNR==1 { next }
FILENAME==ARGV[2] && h[FNR-2] { fr[z++]=$3 }
FILENAME==ARGV[3] && d[FNR-1] { fr[z++]=$3 }
END { for (i=0;i<z;i++) printf "%d^",fr[i]
print "" }
' $FIL $RES >XLS/FRM

awk -F^ ' { nf=NF}
END {
getline < "XLS/FRM"
alg=0
ffc=0
for (i=1;i<NF;i++) if($i==15 || $i==8 || $i==9) { alig[i]=1; if(i>1 && i<NF-1) alg++ }
for (i=1;i<NF;i++) if($i==8 || $i==9) { fec[i]=1;if(i>1 && i<NF-1) ffc++ }
print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
"
print "<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" mc:Ignorable=\"x14ac\">"
if(ffc|| fec[1] || fec[NF-1]) {
print "  <numFmts count=\"1\">"
print "    <numFmt numFmtId=\"164\" formatCode=\"yyyy/mm/dd;@\"/>"
print "  </numFmts>"
} 
print "  <fonts count=\"3\" x14ac:knownFonts=\"1\">"
print "    <font>"
print "      <sz val=\"11\"/>"
print "      <color theme=\"1\"/>"
print "      <name val=\"Calibri\"/>"
print "      <family val=\"2\"/>"
print "      <scheme val=\"minor\"/>"
print "    </font>"
print "    <font>"
print "      <b/>"
print "      <sz val=\"11\"/>"
print "      <color rgb=\"FFFFFF00\"/>"
print "      <name val=\"Calibri\"/>"
print "      <family val=\"2\"/>"
print "      <scheme val=\"minor\"/>"
print "    </font>"
print "    <font>"
print "      <b/>"
print "      <sz val=\"14\"/>"
print "      <color theme=\"1\"/>"
print "      <name val=\"Calibri\"/>"
print "      <family val=\"2\"/>"
print "      <scheme val=\"minor\"/>"
print "    </font>"
print "  </fonts>"
print "  <fills count=\"3\">"
print "    <fill>"
print "      <patternFill patternType=\"none\"/>"
print "    </fill>"
print "    <fill>"
print "      <patternFill patternType=\"gray125\"/>"
print "    </fill>"
print "    <fill>"
print "      <patternFill patternType=\"solid\">"
print "        <fgColor rgb=\"FF0070C0\"/>"
print "        <bgColor indexed=\"64\"/>"
print "      </patternFill>"
print "    </fill>"
print "  </fills>"
nf=4
nr=4
f=nr*(nf-1)
print "   <borders count=\"10\">"
print "    <border>"
print "      <left/>"
print "      <right/>"
print "      <top/>"
print "      <bottom/>"
print "      <diagonal/>"
print "    </border>"
ffl[1]="medium"
ffr[1]="thin"
fft[1]="medium"
ffb[1]="medium"

ffl[2]="thin"
ffr[2]="thin"
fft[2]="medium"
ffb[2]="medium"

ffl[3]="thin"
ffr[3]="medium"
fft[3]="medium"
ffb[3]="medium"

ffl[4]="medium"
ffr[4]="thin"
fft[4]=""
ffb[4]="thin"

ffl[5]="thin"
ffr[5]="thin"
fft[5]=""
ffb[5]="thin"

ffl[6]="thin"
ffr[6]="medium"
fft[6]=""
ffb[6]="thin"

ffl[7]="medium"
ffr[7]="thin"
fft[7]=""
ffb[7]="medium"

ffl[8]="thin"
ffr[8]="thin"
fft[8]=""
ffb[8]="medium"

ffl[9]="thin"
ffr[9]="medium"
fft[9]=""
ffb[9]="medium"
for (z=1;z<10; z++)
{
printf "    <border>\n"
printf "      <left style=\"%s\">\n",ffl[z]
printf "        <color auto=\"1\"/>\n"
printf "      </left>\n"
printf "      <right style=\"%s\">\n",ffr[z]
printf "        <color auto=\"1\"/>\n"
printf "      </right>\n"
if(fft[z]=="") printf "      <top/>\n"
else {
printf "      <top style=\"%s\">\n",fft[z]
printf "        <color auto=\"1\"/>\n"
printf "      </top>\n"
	}
printf "      <bottom style=\"%s\">\n",ffb[z]
printf "        <color auto=\"1\"/>\n"
printf "      </bottom>\n"
printf "      <diagonal/>\n"
printf "    </border>\n"
}
print "   </borders>"
print "  <cellStyleXfs count=\"1\">"
print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/>"
print "  </cellStyleXfs>"
if(alg && NF-3 !=alg && alg!=ffc) cellxfs=13
else  cellxfs=10
if (ffc) cellxfs+=2
if (NF < 4) cellxfs=6
print  ++cellxfs >"XLS/Cxf"
printf "  <cellXfs count=\"%d\">\n",cellxfs
if("'"$deb"'"!="") print "NF="NF,"alg="alg,"ffc="ffc >"/dev/tty"
	print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/>"
if (alig[1])
{
if("'"$deb"'"!="")      print "IZQ CEN" >"/dev/tty"
	 print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"1\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
	 print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"4\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
	 print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"7\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
}
else
{
if("'"$deb"'"!="")      print "IZQ NO CEN" >"/dev/tty"
	print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"1\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\"/>"
	print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"4\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
	print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"7\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
}
if (alig[NF-1])
{
if("'"$deb"'"!="")      print "DER CEN" >"/dev/tty"
	 print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"3\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
applyNumberFormat="" 
numFmtId=0
if(fec[NF-1]) { numFmtId=164; applyNumberFormat="applyNumberFormat=\"1\" " }
	 printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"6\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
	 printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"9\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
}
else
{
if("'"$deb"'"!="")      print "DER NO CEN" >"/dev/tty"
	print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"3\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\"/>"
	print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"6\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
	print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"9\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
}
if (NF >3)
{
if (!alg)
{
if("'"$deb"'"!="")      print "NINGUN CEN" >"/dev/tty"
        print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"2\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\"/>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
}
if("'"$deb"'"!="")      print NF-3,alg,ffc >"/dev/tty"
if(NF-3==alg)
{
if("'"$deb"'"!="")      print "TODOS CEN" >"/dev/tty"
         print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"2\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
applyNumberFormat="" 
numFmtId=0
if(ffc) { numFmtId=164; applyNumberFormat="applyNumberFormat=\"1\" " }
if(alg==ffc)
{
#print "<!--TODOS CEN SIN FECHA -->"
         printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
         printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
}
else {
#print "<!-- TODOS CEN CON FECHA -->"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
         printf "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n"
         printf "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n"
}
}
else if (NF >4 && alg )
{
#print "<!-- CEN  NO CEN -->"
        print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"2\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\"/>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\"/>"
        print "    <xf numFmtId=\"0\" fontId=\"1\" fillId=\"2\" borderId=\"2\" xfId=\"0\" applyFont=\"1\" applyFill=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
        print "    <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" applyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"
applyNumberFormat="" 
numFmtId=0
#print "<!-- CEN +CON FECHA -->"
if(ffc) { numFmtId=164; applyNumberFormat="applyNumberFormat=\"1\" "
         printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"5\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
         printf "    <xf numFmtId=\"%d\" fontId=\"0\" fillId=\"0\" borderId=\"8\" xfId=\"0\" %sapplyFont=\"1\" applyBorder=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>\n",numFmtId,applyNumberFormat
}
}
}
	print "    <xf numFmtId=\"0\" fontId=\"2\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\" applyAlignment=\"1\">\n      <alignment horizontal=\"center\"/>\n    </xf>"


print "  </cellXfs>"
print "  <cellStyles count=\"1\">"
print "    <cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/>"
print "  </cellStyles>"
print "  <dxfs count=\"0\"/>"
print "  <tableStyles count=\"0\" defaultTableStyle=\"TableStyleMedium2\" defaultPivotStyle=\"PivotStyleLight16\"/>"
print "  <extLst>"
print "    <ext xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\" uri=\"{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}\">"
print "      <x14:slicerStyles defaultSlicerStyle=\"SlicerStyleLight1\"/>"
print "    </ext>"
print "    <ext xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\" uri=\"{9260A510-F301-46a8-8635-F512D64BE5F5}\">"
print "      <x15:timelineStyles defaultTimelineStyle=\"TimeSlicerStyleLight1\"/>"
print "    </ext>"
print "  </extLst>"
print "</styleSheet>"

} ' $SRC >XLS/expo/xl/styles.xml # |  awk ' { printf "%s",$1;for (i=2;i<=NF;i++) printf " %s",$i  } ' > XLS/expo/xl/styles.xml

awk -F^ ' BEGIN {
print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
"
z=0
}
{
	nf=NF
	for (i=1;i<nf;i++) if($i+0==0 && $i!="0" || $i+0 > 0 && substr($i,1,1)=="0") reg[z++]=$i
	for (i=1;i<nf;i++) if(length($i)> llg[i]) llg[i]=length($i)
}
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
END {
	for (i=1;i<nf;i++) printf "%d^",llg[i] >"XLS/LGC"
	print "" >>"XLS/LGC"
printf "<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"%d\" uniqueCount=\"%d\">\n",z,z
reg[z++]=trail("'"$titu"'")
	for (i=0;i<z;i++) printf "  <si>\n    <t>%s</t>\n  </si>\n",reg[i]
print "</sst>"
} ' $SRC  | awk ' { printf "%s",$1;for (i=2;i<=NF;i++) printf " %s",$i  } '  > XLS/expo/xl/sharedStrings.xml
Cxf=`cat XLS/Cxf`
awk -F^ ' BEGIN {
zz=0
rv=0
}
{
nf=NF
for (i=1;i<nf;i++)
{
	if(substr($i,5,1)=="-" && substr($i,8,1)=="-")
	{
		if(a==$i) reg[zz]=b
		else
		{
			shel=sprintf("date -d %s +%%s",$i)
			shel | getline reg[zz]
			reg[zz] /=86400; reg[zz]+=25569; reg[zz]=sprintf("%d",reg[zz])
		}
		a=$i
		b=reg[zz]
        }
	else reg[zz]=$i
	zz++
	if($i+0==0 && $i!="0" || $i+0 > 0 && substr($i,1,1)=="0") z++
}
}
END {
print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
"
print "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" mc:Ignorable=\"x14ac\">"
printf "  <dimension ref=\"A2:%c%d\"/>\n",nf+63,NR+3
print "  <sheetViews>"
print "    <sheetView tabSelected=\"1\" workbookViewId=\"0\"/>"
print "  </sheetViews>"
print "  <sheetFormatPr baseColWidth=\"10\" defaultRowHeight=\"15\" x14ac:dyDescent=\"0.25\"/>"
print "  <cols>"
getline < "XLS/LGC"
for (i=1;i<NF;i++) 
printf "    <col min=\"%d\" max=\"%d\" width=\"%.3f\" bestFit=\"1\" customWidth=\"1\"/>\n",i,i,$i+3+i*.1
print "  </cols>"

print "  <sheetData>"
rw=4
nr=NR
rs=0
rg=0
vv=0
nf=NF
getline < "XLS/FRM"
alg=0
ffc=0
for (i=1;i<NF;i++) if($i==15 || $i==8 || $i==9) alig[i]=++alg
for (i=1;i<NF;i++) if($i==8 || $i==9) fec[i]=++ffc
printf "    <row r=\"2\" spans=\"1:%d\" ht=\"18.75\" x14ac:dyDescent=\"0.3\">\n",nf-1
printf "      <c r=\"A2\" s=\"%d\" t=\"s\">\n","'"$Cxf"'"-1
printf "        <v>%d</v>\n",z
printf "      </c>\n"
for (i=2;i<NF;i++) printf "      <c r=\"%c2\" s=\"%d\"/>\n",i+64,"'"$Cxf"'"-1
print "    </row>"
printf "    <row r=\"%d\" spans=\"1:%d\" ht=\"15.75\" thickBot=\"1\" x14ac:dyDescent=\"0.3\"/>\n",rw-1,nf-1
printf "    <row r=\"%d\" spans=\"1:%d\" ht=\"15.75\" thickBot=\"1\" x14ac:dyDescent=\"0.3\">\n",rw,nf-1
for (i=1;i<nf;i++)
{
	if(alig[i] && NF>4) z=10
	else z=7
	if(i==1) z=1
	if(i==nf-1) z=4
	if(reg[rg]+0==0 && reg[rg]!="0" || reg[rg]+0 > 0 && substr(reg[rg],1,1)=="0")
	{

		printf "      <c r=\"%c%d\" s=\"%d\" t=\"s\">\n",i+64,rw,z
		printf "        <v>%d</v>\n",rs++
	}
	else
	{
		printf "      <c r=\"%c%d\" s=\"%d\">\n",i+64,rw,z
		printf "        <v>%s</v>\n",reg[rg]
	}
	print "      </c>"
	rg++
}
	print "    </row>"
for (j=2;j<nr;j++)
{

	print "    <row r=\""++rw"\" spans=\"1:"nf-1"\" x14ac:dyDescent=\"0.25\">"
	for (i=1;i<nf; i++)
	{
		if(alig[i] && NF>4) z=11
		else z=8
		if(fec[i]) z=13
		if(i==1) z=2
		if(i==nf-1) z=5
		if(reg[rg]+0==0 && reg[rg]!="0"  || reg[rg]+0 > 0 && substr(reg[rg],1,1)=="0")
		{
			printf "      <c r=\"%c%d\" s=\"%d\" t=\"s\">\n",i+64,rw,z
			printf "        <v>%d</v>\n",rs++
		}
		else
		{
			printf "      <c r=\"%c%d\" s=\"%d\">\n",i+64,rw,z
			printf "        <v>%s</v>\n",reg[rg]
		}
		print "      </c>"
		rg++
	}
	print "    </row>"
}
	print "    <row r=\""++rw"\" spans=\"1:"nf-1"\" x14ac:dyDescent=\"0.25\">"
for (i=1;i<nf;i++)
{
	if(alig[i] && NF>4) z=12
	else z=9
	if(fec[i]) z=14
        if(i==1) z=3
        if(i==nf-1) z=6
	if(reg[rg]+0==0 && reg[rg]!="0" ||  reg[rg]+0 > 0 && substr(reg[rg],1,1)=="0")
        {
                printf "      <c r=\"%c%d\" s=\"%d\" t=\"s\">\n",i+64,rw,z
                printf "        <v>%d</v>\n",rs++
        }
        else
        {
                printf "      <c r=\"%c%d\" s=\"%d\">\n",i+64,rw,z
                printf "        <v>%s</v>\n",reg[rg]
        }
	print "      </c>"
	rg++
}
	print "    </row>"

print "  </sheetData>"
print "  <mergeCells count=\"1\">"
printf "    <mergeCell ref=\"A2:%c2\"/>\n",nf+63
print "  </mergeCells>"

print "  <pageMargins left=\"0.7\" right=\"0.7\" top=\"0.75\" bottom=\"0.75\" header=\"0.3\" footer=\"0.3\"/>"
print "</worksheet>"

} ' $SRC  > XLS/expo/xl/worksheets/sheet1.xml #| awk ' { printf "%s",$1;for (i=2;i<=NF;i++) printf " %s",$i  } '  > XLS/expo/xl/worksheets/sheet1.xml
ex=Xls`date +%s`.xlsx

echo $ex
cd XLS/expo
zip -rq ../../../../xls/$ex *
echo $ex |awk ' {
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html\">"
print "<meta name=\"GENERATOR\" content=\"Inhedo 4gt 1.0\">"
print "<meta name=\"ProgId\" content=\"Inhedo Form Generator\">"
printf "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=https://xls.inhedo.com/%s\">\n",$1
print "</head>"
print "</body>"
print "</head>"
} ' 
} 2>tmp/err
cd
cat tmp/err
