Jump to content

Recommended Posts

13 minutes ago, ramiwahdan said:

if i am not passing anything to the fpdf functions

I thought you needed start and end dates? For example ...

<a href="my_pdf_report.php?sdate=2020-03-01&edate=2020-03-05">Create PDF</a>

 

have you defined what you want the output to look like? this will define what data you need to get/produce, which will also define what inputs you need. you would then query to get the necessary data in the order that you want it. you would then loop over that data to produce the output that you want.

btw - some of the xPDF libraries have writeHTML() methods that allow you to produce html (or capture the html of an existing page), then supply that as input to produce the pdf document, so that you don't need to build the pdf document at the x/y/cell level.

22 minutes ago, Barand said:

I thought you needed start and end dates? For example ...


<a href="my_pdf_report.php?sdate=2020-03-01&edate=2020-03-05">Create PDF</a>

 

i just need to know the concept. If i need all records why will i need to pass the dates? I will then still use a link for each staff as you mention here. Is there a way or video demonstrate how to make separate fpdf file and php file and make them work together with a loop if no one can help. I did paste my full code so you can get better idea what i am doing. I am getting totals for each staff then want all of them to be printed in one report file. i dont want to use one line for each staff. 

how to make a continuous pdf from the file made. right now each staff will have 2 pages one for attendance and one for absent, how to go to pages 3,4 with new staff and so on... 

Edited by ramiwahdan

Again - let me try 

Your query will build a result set of all the data you need to report on.  As you fetch each row (assuming mutiple ones for each person being reported) you will gather the data and use it to write out pieces of your pdf document.  Read another row and build some more pdf output.  When you recognize the need to end the first page do your addpage call and continue on with person until the second page is done.  That will be noticed when the next fetch has a new userid key telling you to start the next person.  Close out the current page that you just finished, reset the page number and start the new page  (basically just an add page call with perhaps new headings).

Hopefully you wrote your FPDF logic to simply write out your well-designed page using a set of data.   You need to see that set of FPDF logic as the way to generate a report.  Wrap that in something so that you can loop thru the query results, get all the data you need for the FPDF process and call it.

This isn't rocket science.  It just needs the proper design to collect data and to make the necessary FPDF function calls and a bit of php to recognize when a new page needs to be added and to recognize the start of a new person's data.

(Please don't re-post this)

1 hour ago, ramiwahdan said:

If i need all records why will i need to pass the dates?

So if someone has worked there for 10 years you want to list all 10 years' worth of their attendances and absences?

You want all employees; that is not the same as all records.

13 minutes ago, Barand said:

So if someone has worked there for 10 years you want to list all 10 years' worth of their attendances and absences?

You want all employees; that is not the same as all records.

there is option in the db if the staff no longer in the company to delete his staff records and will no longer be considered in the attendance system.

Curious question.  Why do you have a field named "Oracleid"?  Is this an oracle db?  Do you work with Oracle people? Do you work for Oracle?  For an id-type field a size of 150 chars seems rather large.  Why so big?  It's just an id, a key, a lookup value or user number or record number, isn't it?  Do people have to remember their Oracleid?

Why the field named 'theday'?  What day is it.  The day you created the record?  Today? A day related to one of the six time fields you have stored?  You should name it so that one knows what it represents at the very least.  Not "theday".   OR MORE you should not have it at all.  You have all these time/timestamp fields which represent values that can easily produce the day from their values, so do that instead.

Reason.  500 chars?  Is this a free-form text field that describes something that can be read only?  You can't use it to categorize any kind of actions among all of your people.  That would require some kind of code that helped to identify various types of "reasons".  Is that what you are trying to do by even recording a "reason" field?

Fullday.  Looks like a good place for a boolean-type field.  Why a tinyint?  Same for "isdone".

And why would you remove the records for former employees?  You would be losing valuable data that might come in handy for research or for answering questions about former employees.  Why not just add a status code to the table with a lookup table to define the different codes you may have.  When someone departs, you mark them "gone" or "retired" or "inactive" or "fired", etc.  If these are truly employees does your government not require you to keep their records for a number of years?

Edited by ginerjm
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.