0
$\begingroup$

I have a problem with showing my results correctly in a Manipulate in a cdf-file.

My program (for my bachelor thesis) can calculate the income law with a income entered into an input field; the use can also define some other parameters.

When I start this program (klicking on "Berechnen") in a notebook file, all results are shown correctly in the output. However, when I start the program as a demonstration, I only see the code of the "Einkommensteuer" and not the number.

Here is my code:

Manipulate[
 Text@TraditionalForm@
   Pane[Text[Column[{"Einkommensteuer:", "", Style[Row[{Which[
           j == "2013" \[And] p == "alleinstehend", 
           Floor[Ekst13[a, hilfsy13[a]]],
           j == "2013" \[And]  p == "verheiratet", 
           Floor[2*Ekst13[a/2, hilfsy13[a/2]]],
           j == "2014" \[And]  p == "alleinstehend", 
           Floor[Ekst[a, hilfsy[a]]],
           j == "2014" \[And] p == "verheiratet", 
           Floor[2*Ekst[a/2, hilfsy[a/2]]]], "\[Euro]"}], 
        FontColor -> farbe], "", "Solidaritätszuschlag:", "", 
       Style[Row[{Dynamic[Which[
            j == "2013" \[And] p == "alleinstehend", 
            Soli[Floor[Ekst13[a, hilfsy13[a]]], p],
            j == "2013" \[And]  p == "verheiratet", 
            Soli[Floor[2*Ekst13[a/2, hilfsy13[a/2]]], p],
            j == "2014" \[And]  p == "alleinstehend", 
            Soli[Floor[Ekst[a, hilfsy[a]]], p],
            j == "2014" \[And] p == "verheiratet", 
            Soli[Floor[2*Ekst[a/2, hilfsy[a/2]]], p]]], " \[Euro]"}], 
        FontColor -> farbe], "", "Kirchensteuer:", "", 
       Style[Row[{Dynamic[Which[
            j == "2013" \[And] p == "alleinstehend", 
            Kst[Floor[Ekst13[a, hilfsy13[a]]], k],
            j == "2013" \[And]  p == "verheiratet", 
            Kst[Floor[2*Ekst13[a/2, hilfsy13[a/2]]], k],
            j == "2014" \[And]  p == "alleinstehend", 
            Kst[Floor[Ekst[a, hilfsy[a]]], k],
            j == "2014" \[And] p == "verheiratet", 
            Kst[Floor[2*Ekst[a/2, hilfsy[a/2]]], k]]], " \[Euro]"}], 
        FontColor -> farbe], "", "Nettoeinkommen:", "", 
       Style[Row[{Which[
           j == "2013" \[And] p == "alleinstehend", 
           a - Floor[Ekst13[a, hilfsy13[a]]] - 
            Soli[Floor[Ekst13[a, hilfsy13[a]]], p] - 
            Kst[Floor[Ekst13[a, hilfsy13[a]]], k],
           j == "2013" \[And]  p == "verheiratet", 
           a - Floor[2*Ekst13[a/2, hilfsy13[a/2]]] - 
            Soli[Floor[2*Ekst13[a/2, hilfsy13[a/2]]], p] - 
            Kst[Floor[2*Ekst13[a/2, hilfsy13[a/2]]], k],
           j == "2014" \[And]  p == "alleinstehend", 
           a - Floor[Ekst[a, hilfsy[a]]] - 
            Soli[Floor[Ekst[a, hilfsy[a]]], p] - 
            Kst[Floor[Ekst[a, hilfsy[a]]], k],
           j == "2014" \[And] p == "verheiratet", 
           a - Floor[2*Ekst[a/2, hilfsy[a/2]]] - 
            Soli[Floor[2*Ekst[a/2, hilfsy[a/2]]], p] - 
            Kst[Floor[2*Ekst[a/2, hilfsy[a/2]]], k]], " \[Euro]"}], 
        FontColor -> farbe]}]], ImageSize -> {200, 300}, 
    ImageMargins -> 10], "Berechnung der Einkommensteuer",
 "", {{a, 0, "Zu versteuerndes Einkommen"}, ControlType -> InputField,
   ImageSize -> {100, 20}}, {{e, "2013", "Jahr"}, {"2013", "2014"}, 
  ControlType -> PopupMenu}, {{p, "alleinstehend", 
   "Persönliche Verhältnisse"}, {"alleinstehend", "verheiratet"}, 
  ControlType -> PopupMenu}, {{farbe, White, ""}, 
  ControlType -> None}, {{k, "0 %", "Kirchensteuer"}, {"0 %", "8 %", 
   "9 %"}, ControlType -> PopupMenu}, Delimiter, 
 Row[{Spacer[30], 
   Row[{Button["Berechnen", {farbe = Black}, ImageSize -> {100, 30}]}],
   Spacer[10],
   Button[
    "Zurücksetzen", {a = 0, e = "2013", p = "alleinstehend", 
     k = "0 %", farbe = White}, ImageSize -> {100, 30}]}
  ], ControlPlacement -> Left, ContinuousAction -> True, 
 Initialization :> (Ekst[a_, b_] := 
    Floor[Which[a <= 8354, 0, 
      a > 8354 \[And] a <= 13469, (974.58*b + 1400)*b, 
      a >= 13470 \[And] a <= 52881, (228.74*b + 2397)*b + 971, 
      a >= 52882 \[And] a <= 250730, 0.42*a - 8239, a >= 250731, 
      0.45*a - 15761]];
   hilfsy[a_] := 
    Which[Floor[a] >= 8355 \[And] 
      Floor[a] <= 13469, (Floor[a] - 8354)/10000, 
     Floor[a] >= 13470 \[And] Floor[a] <= 52881, (Floor[a] - 13469)/
      10000];
   Ekst13[a_, b_] := 
    Floor[Which[a <= 8130, 0, 
      a > 8131 \[And] a <= 13469, (933.70*b + 1400)*b, 
      a > 13470 \[And] a <= 52881, (228.74*b + 2397)*b + 1014, 
      a > 52882 \[And] a <= 250730, 0.42*a - 8196, a > 250731, 
      0.45*a - 15718]];
   hilfsy13[a_] := 
    Which[Floor[a] >= 8131 \[And] 
      Floor[a] <= 13469, (Floor[a] - 8130)/10000, 
     Floor[a] >= 13470 \[And] Floor[a] <= 52881, (Floor[a] - 13469)/
      10000];
   Soli[a_, p_] := 
    If[a < 972, 0, 
     Which[p == "alleinstehend", Min[0.2*(a - 972), 0.055*a], 
      p == "verheiratet", Min[0.2*(a - 1944), 0.055*a]]];
   Kst[a_, b_] := 
    Which[b == "0 %", 0, b == "8 %", 0.08*a, b == "9 %", 0.09*a];)]

How can I fix this problem?

P.S.: Sorry for my english ;-), not my mother tongue.

$\endgroup$
6
  • $\begingroup$ Even in a notebook file, all I see under Einkommensteuer: is code. $\endgroup$
    – bbgodfrey
    Feb 26, 2015 at 1:41
  • $\begingroup$ hm, strange... I show you a pic how it looks like in my mathematica-software: img4.fotos-hochladen.net/uploads/ekst31zqncb2sl.png On the left in a cdf-file, on the right how it should look in a cdf-file and not only in a nb-file $\endgroup$
    – Manu
    Feb 26, 2015 at 1:50
  • $\begingroup$ a = 0 and p = alleinstehend at the beginning... Both are defined in the parametres... $\endgroup$
    – Manu
    Feb 26, 2015 at 1:55
  • $\begingroup$ I replaced e by j where it appears in your code, and it runs fine. And, the cdf runs fine too, at least in preview mode. $\endgroup$
    – bbgodfrey
    Feb 26, 2015 at 2:03
  • $\begingroup$ Sure, I see the wrong e... Now it works :-) little fault, big consequence $\endgroup$
    – Manu
    Feb 26, 2015 at 2:06

1 Answer 1

2
$\begingroup$

Replacing two instances of e by j in the code allows it to run correctly both as a notebook and a cdf.

$\endgroup$
2
  • $\begingroup$ four eyes are better than only two $\endgroup$
    – Manu
    Feb 26, 2015 at 2:09
  • $\begingroup$ @Manu Please take a tour $\endgroup$
    – Kuba
    Mar 24, 2015 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.