diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/pdf-forms-tutorial-en/examples/ex0201.tex')
-rw-r--r-- | Master/texmf-doc/doc/english/pdf-forms-tutorial-en/examples/ex0201.tex | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/pdf-forms-tutorial-en/examples/ex0201.tex b/Master/texmf-doc/doc/english/pdf-forms-tutorial-en/examples/ex0201.tex new file mode 100644 index 00000000000..7108782c55d --- /dev/null +++ b/Master/texmf-doc/doc/english/pdf-forms-tutorial-en/examples/ex0201.tex @@ -0,0 +1,107 @@ +\documentclass{scrartcl} +\setcounter{secnumdepth}{0} +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\usepackage{mathptmx} +\usepackage[scaled=.92]{helvet} +\usepackage{courier} +\setlength{\paperwidth}{5.2075in} +\setlength{\paperheight}{3.75in} +\renewcommand*{\familydefault}{phv} +\usepackage[pdftex,margin=0.5in]{geometry} +\usepackage{fancyhdr} +\lhead{Big Money, Inc.}\chead{} +\rhead{Promises Dept.} +\lfoot{}\cfoot{}\rfoot{} +\pagestyle{fancy} +\usepackage{graphicx} +\usepackage{color} +\usepackage[pdftex,pdfpagelayout=SinglePage,% +pdftitle={Investment calculation},pdfsubject={Investment}% +]{hyperref} +\definecolor{background}{rgb}{0.99,0.98,0.85} +\pagecolor{background} +\setlength{\parindent}{0.0cm} +\usepackage[pdftex]{insdljs} +\begin{insDLJS}[exaaca]{exaaca}{JavaScript} +var done = 0; + +function docOpen() +{ + if(!done) { + done = 1; + var newcolor = [ "RGB", 0.99, 0.98, 0.85]; + var borcolor = [ "RGB", 0.65, 0.79, 0.94] + this.getField("l01").fillColor = newcolor; + this.getField("l01").strokeColor = newcolor; + this.getField("l02").fillColor = newcolor; + this.getField("l02").strokeColor = newcolor; + this.getField("l03").fillColor = newcolor; + this.getField("l03").strokeColor = newcolor; + this.getField("l04").fillColor = newcolor; + this.getField("l04").strokeColor = newcolor; + this.getField("zeit").currentValueIndices = 0; + this.getField("zeit").fillColor = newcolor; + this.getField("summe").fillColor = newcolor; + this.getField("zins").fillColor = newcolor; + this.getField("ergebnis").fillColor = newcolor; + } +} + +function doCalculation() +{ + var summe = 0.0 + this.getField("summe").value; + var zins = 0.0 + this.getField("zins").value; + var zeit = 0 + this.getField("zeit").value; + var i, faktor, wert; + faktor = 1.0 + 0.01 * zins; + for(i = 0; i < zeit; i++) { + summe = summe * faktor; + } + wert = Math.round(100.0 * summe); + wert = 0.01 * wert; + wert = wert.toFixed(2); + wert = wert.toString(); + this.getField("ergebnis").value = wert; +} +\end{insDLJS} +\OpenAction{/S /JavaScript /JS (docOpen();)} +\newcommand{\textforlabel}[2]{% +\TextField[name={#1},value={#2},width=9em,align=2,% +bordercolor={0.99 0.98 0.85},% +fillcolor={0.99 0.98 0.85},readonly=true]{}% +} +\begin{document} +\begin{Form} +\begin{tabular}{|rl|} +\hline +\multicolumn{2}{|c|}{}\\*[-0.8em]\multicolumn{2}{|c|}{% +\textsc{I\,n\,p\,u\,t~D\,a\,t\,a}% +}\\ +&\\*[-0.8em]\textforlabel{l01}{Investment capital:}&\TextField[% +name=summe,width=10em,bordercolor={0.65 0.79 0.94}]{}% +~\texteuro\\ +&\\*[-0.8em]\textforlabel{l02}{Zins:}&\TextField[% +name=zins,width=10em,bordercolor={0.65 0.79 0.94}]{}~\%\\ +&\\*[-0.8em]\textforlabel{l03}{Investment time:}&% +\ChoiceMenu[name=zeit,popdown=true,bordercolor={0.65 0.79 0.94}% +]{}{{1}={1},{2}={2},{3}={3},{4}={4},{5}={5},% +{6}={6},{7}={7},{8}={8},{9}={9},{10}={10}}~years\\ +&\\*[-0.8em]\hline +\multicolumn{2}{|c|}{}\\*[-0.8em] +\multicolumn{2}{|c|}{\textsc{C\,a\,l\,c\,u\,l\,a\,t\,i\,o\,n}}\\ +\multicolumn{2}{|c|}{}\\*[-0.8em] +\multicolumn{2}{|c|}{\PushButton[name=start,% +onclick={doCalculation()},bordercolor={0.65 0.79 0.94},% +fillcolor={0.5 0.5 0.5}]{Start}}\\ +\multicolumn{2}{|c|}{}\\*[-0.8em]\hline +\multicolumn{2}{|c|}{}\\*[-0.8em] +\multicolumn{2}{|c|}{\textsc{R\,e\,s\,u\,l\,t}}\\ +\multicolumn{2}{|c|}{}\\*[-0.8em]\textforlabel{l04}{% +Result:}&\TextField[name=ergebnis,width=10em,% +bordercolor={0 0 0},readonly=true]{}~\texteuro\\ +\multicolumn{2}{|c|}{}\\ +\hline +\end{tabular} +\end{Form} +\end{document} |