Topic: Salary calculation

Hello everyone, is there a program to calculate working hours and salary?
I searched the forum but couldn't find anything.

Destiny

Re: Salary calculation

Salut Destiny,
What exactly do you want the program to do.
Can you provide more information - fields to be held, calculation to be performed etc?
Derek.

3 (edited by Destiny 2025-08-30 11:26:03)

Re: Salary calculation

Hi Derek, I just wanted an example of calculating hours worked and income because I have it in Excel but I would have liked to do it in MVD.
I don't have an example at the moment; I need to think about how to implement it.

Post's attachments

Attachment icon Feuille travail.png 46.86 kb, 21 downloads since 2025-08-30 

Destiny

Re: Salary calculation

Hi,
Attached is a suggested approach but it's difficult to be specific without knowing
1.  how you want to enter the 'time' (using a datetimepicker (as per the attachment), using 2 discrete fields for 'hours' and 'minutes' etc.
2.  do your work hours go across days (ie someone who works during the night).
3.  I haven't attempted to calculate salary because I don't know the rules (by the minute, by the hour, by partial hour etc).
But hopefully the attachment can give you some ideas.
Regards,
Derek.

Post's attachments

Attachment icon destiny worked time.zip 441.42 kb, 67 downloads since 2025-08-30 

Re: Salary calculation

Thanks Derek, I'll see what I can do.

Destiny

Re: Salary calculation

Hello, I'm having trouble with the minutes I'd like to display in the TableGrid to get the total hours worked. Can someone take a look?

Post's attachments

Attachment icon Temps de travail.zip 337.57 kb, 45 downloads since 2025-09-02 

Destiny

Re: Salary calculation

Hi Destiny, Derek


cfTotal

time(strftime('%s', Hmatin)+strftime('%s', hapm), 'unixepoch')

8 (edited by Destiny 2025-09-02 11:24:24)

Re: Salary calculation

Thanks sparrow, I would have liked a total at the bottom of the page to have all the hours worked for the month (addition of all the days at the bottom of the page).

Post's attachments

Attachment icon Total.png 48.93 kb, 15 downloads since 2025-09-02 

Destiny

Re: Salary calculation

Hi Destiny,
The thanks for this fix to the calculated field should go to Sparrow, not me - I wasn't even logged on!  big_smile
Derek.

Re: Salary calculation

Mise a jour éffectuée

Destiny

Re: Salary calculation

//Couleurs des colonnes
procedure FormHT_TableGrid1_OnChange (Sender: TObject);
begin
    FormHT.TableGrid1.Columns[1].Header.Color := $00FFFFCC;
    FormHT.TableGrid1.Columns[2].Header.Color := $00FFFFCC;
    FormHT.TableGrid1.Columns[3].Header.Color := $00FFFFCC;
    FormHT.TableGrid1.Columns[4].Header.Color := $00BBFFBB;
    FormHT.TableGrid1.Columns[5].Header.Color := $00BBFFBB;
    FormHT.TableGrid1.Columns[6].Header.Color := $00BBFFBB;
    FormHT.TableGrid1.Columns[8].Header.Color := $004080FF;
    FormHT.TableGrid1.Columns[8].Footer.Caption := SQLExecute('SELECT time(SUM(strftime("%s", Hmatin))+SUM(strftime("%s", hapm)), "unixepoch") FROM HeuresTravail');
end;

12 (edited by Destiny 2025-09-02 11:43:00)

Re: Salary calculation

Great, thanks sparrow, it's much better like that.

Destiny

13 (edited by sparrow 2025-09-02 11:46:22)

Re: Salary calculation

This is how it will be correct, otherwise the first zero gets lost and everything works incorrectly.

procedure On_Change (Sender: TObject);
begin
    FormHT.Edit5.Text := FormatDateTime('hh:nn:ss', StrToTime(FormHT.Edit1.Text)-StrToTime(FormHT.Edit2.Text));
    FormHT.Edit8.Text := FormatDateTime('hh:nn:ss', StrToTime(FormHT.Edit3.Text)-StrToTime(FormHT.Edit4.Text));
    FormHT.Edit6.Text := FormatDateTime('hh:nn:ss', StrToTime(FormHT.Edit5.Text)+StrToTime(FormHT.Edit8.Text));
end;

Re: Salary calculation

Thanks, I have another problem, when I click on 'New' to add hours I get an error.

Destiny

Re: Salary calculation

Where is this button? And what is the error?

Re: Salary calculation

It's the green + button and I've taken a picture of the error.

Post's attachments

Attachment icon Erreur.png 44.4 kb, 17 downloads since 2025-09-02 

Destiny

Re: Salary calculation

The error tells you that the time format is incorrect (_0:__).
Let's check the entered value and return the user back to correct the value, with a hint.

Post's attachments

Attachment icon Temps de travail tf.zip 7.67 kb, 34 downloads since 2025-09-02 

Re: Salary calculation

Without the 'New' button it works but as soon as I put it back the error comes back.

Destiny

Re: Salary calculation

Now there's a button.

Post's attachments

Attachment icon Temps de travail tf1.zip 8 kb, 44 downloads since 2025-09-02 

Re: Salary calculation

Now it's working properly, thank you very much sparrow. I had a little trouble with his schedules.

Destiny

Re: Salary calculation

Hi Destiny


Please update the query to calculate the footer in the table. My mistake.

    FormHT.TableGrid1.Columns[8].Footer.Caption :=
      SQLExecute('SELECT PRINTF("%02d:",SUM(STRFTIME("%s", "1970-01-01 "||TotalHeures))/3600)|| '+
      'PRINTF("%02d:",((SUM(STRFTIME("%s", "1970-01-01 "||TotalHeures)))%3600)/60)|| '+
      'PRINTF("%02d",(((SUM(STRFTIME("%s", "1970-01-01 "||TotalHeures)))%3600)%60)) FROM HeuresTravail');

Re: Salary calculation

Great, I had a problem with the pause times and now you've just fixed it.
Thanks, sparrow.

Destiny

23 (edited by Destiny 2025-09-06 15:28:22)

Re: Salary calculation

Hello, I'm having trouble displaying the total hours for the month (in the 'hours per day' column) in the printable report; I think something is preventing it from being displayed.
I am attaching the report.

Post's attachments

Attachment icon Pictures.zip 258.31 kb, 37 downloads since 2025-09-06 

Destiny

Re: Salary calculation

Hi,


For correct display you need to apply time formatting in the properties for this field in MasterData1.

Re: Salary calculation

Hello, sorry to bring this up again, but I'm having trouble displaying the monthly total in the report. I've looked into it, but it still shows the same thing.

Post's attachments

Attachment icon Temps de travail.zip 343.13 kb, 38 downloads since 2025-09-09 

Destiny