
#!/bin/sh

# disable filename globbing

#echo
dat=`date +%d/%m/%Y`

 BASE=`pwd`
{
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
planc=tmpB/planc
jav=../js/tmp/rst$$
rm -f ../js/tmp/*
T1=`cat tmpB/cuent`
awk -F"^" ' FILENAME==ARGV[1] {
if(substr($1,1,1)=="C") r[substr($1,2)+0]=1
next
}
r[FNR]==1 {
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,0,"'"$T1"'"
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,1,"'"$T1"'"
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,2,$5
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,3,$7
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,4,$6
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,5,$8
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,6,$9
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,7,"'"$dat"'"
printf "document.vouchform.vouchD%.2d%.2d.value=\"%s\"\n",i,8,$11
i++
} END { print "swapout()"
 } ' $1 tmpB/S$T1 >$jav
awk '  $1=="</form>"  { printf "<script language=\"Javascript\" src=\"%s\"> </script>\n","'"$jav"'" }
{print  } ' ../vouch.htm
} 2>error/pagos.err
cat error/pagos.err
