Manipulate[

If[k<0,k=0];
If[K<0,K=0];
If[FV<0,FV=K];

If[unknown==="K",K=N@Quiet[Solve[{AnnuityGeneral[k,K1,i,f,fK,initialDeposit,isDue]==FV,K1≥0},K1][[All,1,2]][[1]]]];
If[unknown==="FV",FV=N@Quiet[AnnuityGeneral[k,K,i,f,fK,initialDeposit,isDue]]];
If[unknown==="k",k=N@Quiet[Solve[{AnnuityGeneral[k1,K,i,f,fK,initialDeposit,isDue]==FV,k1≥0},k1][[All,1,2]][[1]]]];
If[unknown==="i",
tmpi=Quiet[Solve[{AnnuityGeneral[k,K,i1,f,fK,initialDeposit,isDue]==FV,i1>=0},i1,Reals]];
If[tmpi=={},i=0; message="Řešení neexistuje",i=i1/.tmpi[[1]]//N;message=""];
];

initialDepositInterest=initialDeposit*(1+i/(100*f))^k-initialDeposit;
depositsBase=k*K;
depositsInterest=Quiet[AnnuityGeneral[k,K,i,f,fK,0,isDue]]-depositsBase;

Column[
{Style[message,Bold,Red],
Grid[{
{"úložka [Kč]",NumberForm[N@K,{Infinity,precision}]},
{"naspořená částka [Kč]",NumberForm[N@FV,{Infinity,precision}]},
{"počet plateb",NumberForm[N@k,{Infinity,precision}]},
{"doba úročení [v letech]",NumberForm[N[k/f],{Infinity,precision}]},
{"nominální úroková míra [%]",NumberForm[N@i,{Infinity,precision}]},
{"efektivní úroková míra [%]",NumberForm[N[100*EffectiveInterest[i/100,1/f]],{Infinity,precision}]}
},
Alignment->Left,
Frame->All,
ItemSize->gridSize],
"",
"Struktura celkové naspořené částky",
PieChart[{N@depositsBase,N@depositsInterest,N@initialDeposit,N@initialDepositInterest},ChartLegends->{"vložené úložky","úrok z úložek", "počáteční stav","úrok z počátečního stavu"}]
}],

Style["Kombinované spoření",Bold],

{{unknown,"FV","Neznámá"},{"K"->"úložka","FV"->"naspořená částka","i"->"nominální úroková míra","k"->"počet plateb"},ControlType->PopupMenu},
{{precision,2,"Desetinná místa"},0,10,1,AppearanceElements->None, Appearance->"Labeled"},

Delimiter,

{{isDue,False,"typ spoření:"},{False->"předlhůtní",True->"polhůtní"}},
{{K,100,"úložka [Kč]"}, 1,10000,500,TrackingFunction->(K=If[And[#>FV,unknown=!="FV"],FV,#];&),Appearance->"Labeled",Enabled->(unknown=!="K"), AppearanceElements->None},
{{initialDeposit,0,"počáteční stav [Kč]"}, 0,10^5,TrackingFunction->(initialDeposit=If[And[#>FV,unknown=!="FV"],K,#];&),Appearance->"Labeled", AppearanceElements->None},
{{FV,10000,"naspořená částka"}, 1,10^6,TrackingFunction->(FV=If[And[#<K,unknown=!="K"],K,#];&),Appearance->"Labeled",Enabled->(unknown=!="FV"),AppearanceElements->None},
{{i,5,"nominální úroková míra (p.a.)"}, 0,10,0.1,Appearance->"Labeled",Enabled->(unknown=!="i"),AppearanceElements->None},
{{f,1,"frekvence úročení"}, {1->"rok",2->"půlrok",4->"čtvrtletí",12->"měsíc"},Enabled->(unknown=!="i"),AppearanceElements->None,ControlType->PopupMenu},
{{fK,1,"frekvence plateb"}, {1->"rok",2->"půlrok",4->"čtvrtletí",12->"měsíc"},AppearanceElements->None,ControlType->PopupMenu},
{{k,5,"počet plateb"}, 1,120,1,Appearance->"Labeled",Enabled->(unknown=!="k"),AppearanceElements->None},

{message,"",ControlType->None},
{depositsBase,"",ControlType->None},
{initialDepositInterest,ControlType->None},
{depositsInterest,ControlType->None},

Initialization:>(
AnnuityGeneral[k_,K_,i_,f_,fK_,initialDeposit_,isDue_]:=(
Clear@m;
Clear@x;
m=fK/f;
x=If[isDue==True,1,-1];
initialDeposit*(1+i/(100*f))^k+m*K*(1+(m+x)/(2*m)*i/100*1/f)*TimeValue[Annuity[K,k],i/(100*f),k]/K);
gridSize={20, 1.7};
),

AppearanceElements->"ResetButton",
SaveDefinitions->True,
ContinuousAction->False,
ControlPlacement->Left
]