unit Kalk;
interface
procedure CalcRule01(EKAlt,BPAlt,LVPAlt,BruttoLVPAlt,MargeEAlt, MargeProzAlt, ProvLVPAlt, MwSt: Extended;
zuschlag,ProvSatz: Integer;
var ekneu, bpneu,lvpneu,margeEneu,margeprozneu,provlvpneu,bruttolvpneu,bpaender,lvpaender,bruttolvpaender,
ekaender, margeEaender, margeprozaender, provlvpaender: Extended);
implementation
function f_bpneu(ekneu: Extended; zuschlag: Integer): Extended;
forward;
function f_lvpneu(ekneu: Extended): Extended;
forward;
function f_margeEneu(ekneu: Extended; lvpneu: Extended):Extended;
forward;
function f_margeprozneu(ekneu: Extended; lvpneu: Extended):Extended;
forward;
function f_provlvpneu(bpneu: Extended; lvpneu: Extended; ProvSatz: Integer):Extended;
forward;
function f_bruttolvpneu(lvpneu: Extended; MwSt: Extended): Extended;
forward;
function f_ekaender(ekneu: Extended; EKAlt: Extended): Extended;
forward;
function f_bpaender(bpneu: Extended; BPAlt: Extended): Extended;
forward;
function f_lvpaender(lvpneu: Extended; LVPAlt: Extended): Extended;
forward;
function f_bruttolvpaender(bruttolvpneu: Extended; BruttoLVPAlt: Extended): Extended;
forward;
function f_margeEaender(margeEneu: Extended; MargeEAlt: Extended): Extended;
forward;
function f_margeprozaender(margeEneu: Extended; MargeEAlt: Extended): Extended;
forward;
function f_provlvpaender(provlvpneu: Extended; ProvLVPAlt: Extended): Extended;
forward;
function f_bpneu(ekneu: Extended; zuschlag: Integer): Extended;
begin
Result := ekneu + (ekneu * zuschlag / 100);
end;
function f_lvpneu(ekneu: Extended): Extended;
begin
Result := ekneu/55*100;
end;
function f_margeEneu(ekneu: Extended; lvpneu: Extended): Extended;
begin
Result := lvpneu-ekneu;
end;
function f_margeprozneu(ekneu: Extended; lvpneu: Extended): Extended;
begin
Result := (1-(ekneu/lvpneu)*100);
end;
function f_provlvpneu(bpneu: Extended; lvpneu: Extended; ProvSatz: Integer): Extended;
begin
Result := (lvpneu-bpneu)*ProvSatz/100;
end;
function f_bruttolvpneu(lvpneu: Extended; MwSt: Extended): Extended;
begin
Result := lvpneu+(lvpneu*MwSt/100);
end;
function f_ekaender(ekneu: Extended; EKAlt: Extended): Extended;
begin
Result := (ekneu/EKAlt-1)*100;
end;
function f_bpaender(bpneu: Extended; BPAlt: Extended): Extended;
begin
Result := (bpneu/BPAlt-1)*100;
end;
function f_lvpaender(lvpneu: Extended; LVPAlt: Extended): Extended;
begin
Result := (lvpneu/LVPAlt-1)*100;
end;
function f_bruttolvpaender(bruttolvpneu: Extended; BruttoLVPAlt: Extended): Extended;
begin
Result := (bruttolvpneu/BruttoLVPAlt-1)*100;
end;
function f_margeEaender(margeEneu: Extended; MargeEAlt: Extended): Extended;
begin
Result := (margeEneu-MargeEAlt);
end;
function f_margeprozaender(margeEneu: Extended; MargeEAlt: Extended): Extended;
begin
Result := (margeEneu/MargeEAlt-1)*100;
end;
function f_provlvpaender(provlvpneu: Extended; ProvLVPAlt: Extended): Extended;
begin
Result := (provlvpneu/ProvLVPAlt-1)*100;
end;
procedure CalcRule01(EKAlt,BPAlt,LVPAlt,BruttoLVPAlt,MargeEAlt, MargeProzAlt, ProvLVPAlt,MwSt: Extended;
zuschlag, ProvSatz: Integer;
var ekneu, bpneu,lvpneu,margeEneu,margeprozneu,provlvpneu,bruttolvpneu,bpaender,lvpaender,bruttolvpaender,
ekaender, margeEaender, margeprozaender, provlvpaender: Extended);
begin
bpneu := f_bpneu(ekneu, zuschlag);
lvpneu := f_lvpneu(ekneu);
margeEneu := f_margeEneu(ekneu, lvpneu);
margeprozneu := f_margeprozneu(ekneu, lvpneu);
provlvpneu := f_provlvpneu(bpneu, lvpneu, ProvSatz);
bruttolvpneu := f_bruttolvpneu(lvpneu, MwSt);
bpaender := f_bpaender(bpneu, BPAlt);
lvpaender := f_lvpaender(lvpneu, LVPAlt);
bruttolvpaender := f_bruttolvpaender(bruttolvpneu, BruttoLVPAlt);
ekaender := f_ekaender(ekneu, EKAlt);
margeEaender := f_margeEaender(margeEneu, MargeEAlt);
margeprozaender := f_margeProzaender(margeEneu, MargeEAlt);
provlvpaender := f_provlvpaender(provlvpneu, ProvLVPNeu);
end;
end.
//Konstanten:
// EKAlt = cxDBLabel8
// BPAlt = cxDBLabel5
// LVPAlt = cxDBLabel9
// BruttoLVPAlt = cxDBLabel17
// MargeEAlt = cxDBLabel11
// MargeProzAlt = cxDBLabel12
// ProvLVPAlt = cxDBLabel14
// MwSt = cxDBLabel16
// ProvSatz = cxDBLabel13
// Variablen
// ekneu = cxTextEdit1
// zuschlag = cxLookupCombobox1
// bpneu = cxLabel14
// lvpneu = cxTextEdit5
// bruttolvpneu = cxTextEdit4
// margeEneu = cxTextEdit2
// margeprozneu = cxTExtEdit3
// provlvpneu = cxTextEdit6
// + die Variablen, welche die Veränderungen neu gegen alt "anzeigen" sollen
// ekaender = cxLabel15
// bpaender = cxLabel18
// lvpaender = cxLabel19
// bruttolvpaender = cxLabel24 +++ eingentlich obsolet, aberwassolls +++
// margeEaender = cxLabel25
// margeprozaender = cxLabel26
// provlvpaender = cxLabel27