Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Delphi]: stringgrid problem

Empfohlene Antworten

Veröffentlicht

hallo leute

und zwar ich möcht in delphi einen Lineare Abschreibungsrechner machen

aber ich hab das problem ich gebe die laufzeit ein und den wert

er rechnet auch richtig aus aber nur für das 1. jahr

in den 2. jahr und den anderen jahren wird immer der gleiche wert vom 1. eingetragen

weil ich hab ja auch nur einmal eine berechnung dafür

aber wie macht man das, dass es bei jeder neuen zeile die von der zeile davor die zahlen nimmt und mit der gleichung neu berechnet?

das ist mein code:

var

 betrag, wert, satz, berechnung :real;

  i, dauer : integer;


implementation


{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);

begin


dauer := StrToInt (edt_dauer.Text);

wert := StrToFloat (edt_preis.Text);

StringGrid1.RowCount:=dauer+1;

for i:=1 to dauer do

begin


StringGrid1.Cells[0,i]:= IntToStr(i);

StringGrid1.Cells[1,i]:= FloatToStrF(betrag,ffFixed,10,2);

betrag :=wert /dauer;


StringGrid1.Cells[2,i]:= FloatToStrF(satz,ffFixed,10,2);

satz := wert - betrag;

end;

end;


end.

Hallo PSP_GIGA

Hier eine Schleife zum Setzen des Restwertes der Anschaffung in ein Stringgrid:

procedure TForm1.Button1Click(Sender: TObject);

var

betrag, wert, satz, berechnung :real;

i, dauer : integer;

begin

// Dauer = Abschreibung in Jahren

dauer := StrToInt (edt_dauer.Text);

// Wert = Anschaffungspreis

wert := StrToFloat (edt_preis.Text);

// Betrag = jährlicher Abschreibungsbetrag

betrag := wert /dauer;

StringGrid1.RowCount:=dauer+1;

for i:=1 to dauer do

begin

StringGrid1.Cells[0,i]:= IntToStr(i);

StringGrid1.Cells[1,i]:= FloatToStrF(betrag,ffFixed,10,2);

// Restwert

StringGrid1.Cells[2,i]:= FloatToStrF((wert - (betrag * i )),ffFixed,10,2);

end;

end;

Man nimmt den Bemessungswert des Gutes und teilt diesen durch die Nutzungsdauer. Schon erhält man den Abschreibungsbetrag, mit welchem man Jahr für Jahr abschreibt. Dabei ist zu beachten, dass jedes Jahr immer der selbe Abschreibungsbetrag vom Restwert des Gutes abgeschrieben wird. Am Ende der Nutzungsdauer hat das Gut dann einen Wert von 0 €.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.