Re: Who is on vacation?

Hi,
It's just a way of combining the 'first name' and 'last name' of the employee so that you can display it both in MVD and in FastReport as
'Fabio Bernini'. 
If you use the separate fields without combining them, then it would show as
'Fabio          Bernini'
There is probably a way to combine the 'first name' and the 'last name' in FastReport itself but I just prefer to do as much of the work as possible within MVD. 
Derek.

Re: Who is on vacation?

Thanks so much derek, another great idea! Thank you very much.

Re: Who is on vacation?

Hello friends! Thanks to your suggestions but mostly instruction, I almost managed to complete the project. I have only one thing left: it always concerns printing, how could I do, in the event that if an employee does not have any days off, which I understand is impossible, the name does not appear in the report, which would be empty as regards the days off holidays.
Thank you very much

Re: Who is on vacation?

Hi Fabio,
I think there are two problems with your report as you have written it.
1.  If you want to only show employees who are on vacation, then you should use the 'holidays' table and not 'employees' (see the screenshot in the attachment).
2.  I don't understand why your application checks to see what employees are on vacation on a certain day but your report ignores that check and shows all vacation days instead.  Surely you would want the report to perform the same checks (in which case you should add datetimepicker1 and datetimepicker2 as parameters to the report (see attached)).
Derek.

Post's attachments

Attachment icon Ferie3c.zip 398.81 kb, 97 downloads since 2023-04-20 

Re: Who is on vacation?

Hi Derek and thanks for the usual pointers and improvements. My intent was to print all the history of holidays but in the event that an employee does not have holidays, a situation I understand is impossible but maybe there are new hires who have not yet benefited from holidays, his name is not printed as I consider it a waste of ink or toner since it has nothing to print anyway. In any case your correction has given me yet another idea.

Re: Who is on vacation?

Hi Fabio,
Just to confirm - if you configure your report as I have outlined, then
1.  it will only print those employees who have arranged holiday;  those who have never arranged holiday will not be printed.
2.  if you want to print those employees with holiday in a certain date range, use the datetimepicker parameters.
3.  if you want to print a history of all holiday, then just leave the datetimepicker parameters unchecked.
I think this gives you all of the options you might want.
Derek.

Re: Who is on vacation?

Hi Derek, Fabio


Fabio,
If you want to print all employees, change the table to "employees" in the properties of the "print" button.
You now have a search and select from the "holidays" table. Naturally, if there are no records (dates),
then there is no name of the employee.
Changing the table will force all employee names to be displayed with or without dates.

Re: Who is on vacation?

Hello Derek,
What does the code  procedure frmEmployees_OnShow (Sender: TObject; Action: string) do?
You have used the procedure frmEmployees_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer); to activate the search button, and not used incremental search in tablegrid1. Is it because the search is on a different table, not directly related to tablegrid1?
Regards,
Eyeman

Re: Who is on vacation?

Hello Eyeman,

What does the code  procedure frmEmployees_OnShow (Sender: TObject; Action: string) do?

The original example application was created by Fabio (Reteinformatica) and has had a number of changes made to it in the meantime so I would guess that this procedure (although now empty) has just been left behind.

You have used the procedure frmEmployees_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer); to activate the search button, and not used incremental search in tablegrid1. Is it because the search is on a different table, not directly related to tablegrid1?

Again, it's not my code but, rather than use 'incremental search', I imagine Fabio has done it like this to avoid the situation where frmemployees.tablegrid1 loses focus (for example, after a record has been deleted).  If you then immediately click on the column headings to do a re-sort, it causes the 'incremental search' button to be triggered without any focus on a particular row in frmemployees_tablegrid1 and so ALL rows in frmemployees_tablegrid2 are retrieved;  this might be a bit confusing for the user.
Personally, I would prefer the 'tablegrid1_onclick' event to be restricted to the body of the tablegrid and not include the header (or footer) but it's not a deal-breaker and as you can see, there are ways to avoid it.
Hope that explains it,
Derek.

35 (edited by reteinformatica 2023-04-21 21:08:37)

Re: Who is on vacation?

Hello everyone, thank you I will never stop saying it.

derek wrote:

Hi Fabio,
Just to confirm - if you configure your report as I have outlined, then
1.  it will only print those employees who have arranged holiday;  those who have never arranged holiday will not be printed.
2.  if you want to print those employees with holiday in a certain date range, use the datetimepicker parameters.
3.  if you want to print a history of all holiday, then just leave the datetimepicker parameters unchecked.
I think this gives you all of the options you might want.
Derek.

Yes, it's actually the same thing

sparrow wrote:

If you want to print all employees, change the table to "employees" in the properties of the "print" button.
You now have a search and select from the "holidays" table. Naturally, if there are no records (dates),
then there is no name of the employee.
Changing the table will force all employee names to be displayed with or without dates.

Thanks sparrow, I understand what you mean.

eyeman303 wrote:

What does the code  procedure frmEmployees_OnShow (Sender: TObject; Action: string) do?
You have used the procedure frmEmployees_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer); to activate the search button, and not used incremental search in tablegrid1. Is it because the search is on a different table, not directly related to tablegrid1?

I'm not particularly experienced indeed not at all, I'm trying to learn. As you can see, I ask for a lot of explanations and luckily there are users like derek and sparrow who are extremely kind and knowledgeable. I made this preamble to tell you that I follow their instructions so what I then modify I do following these suggestions.
Basically I reply but sometimes I don't even know what I'm doing.
For example, with this question you confused me even more and the way I am now I'm immediately trying to modify the project to understand what is happening based on what you asked and Derek answered. Otherwise I won't sleep tonight big_smile