diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/examples/ex0202.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/examples/ex0202.tex | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/examples/ex0202.tex b/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/examples/ex0202.tex new file mode 100644 index 00000000000..45275430788 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/examples/ex0202.tex @@ -0,0 +1,114 @@ +\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{Department f\"{u}r Versprechungen} +\lfoot{}\cfoot{}\rfoot{} +\pagestyle{fancy} +\usepackage{graphicx} +\usepackage{color} +\usepackage[pdftex,pdfpagelayout=SinglePage,% +pdftitle={Anlageberechnung},pdfsubject={Formular}% +]{hyperref} +\definecolor{background}{rgb}{0.99,0.98,0.85} +\pagecolor{background} +\setlength{\parindent}{0.0cm} +\usepackage[pdftex]{insdljs} +\begin{insDLJS}[exaacb]{exaacb}{JavaScript functions} +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 restrictDecimalDigits(s,n) +{ + var back = s; + return back; +} + +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 = wert.toFixed(0); + wert = 0.01 * wert; + wert = wert.toString(); + wert = restrictDecimalDigits(wert, 2); + 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{E\,i\,n\,g\,a\,b\,e\,d\,a\,t\,e\,n}% +}\\ +&\\*[-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}}~Jahre\\ +&\\*[-0.8em]\hline +\multicolumn{2}{|c|}{}\\*[-0.8em] +\multicolumn{2}{|c|}{\textsc{B\,e\,r\,e\,c\,h\,n\,u\,n\,g}}\\ +\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{A\,u\,s\,g\,a\,b\,e}}\\ +\multicolumn{2}{|c|}{}\\*[-0.8em]\textforlabel{l04}{% +Result:}&\TextField[name=ergebnis,width=10em,% +bordercolor={0 0 0}]{}~\texteuro\\ +\multicolumn{2}{|c|}{}\\ +\hline +\end{tabular} +\end{Form} +\end{document} |