Barand Posted April 4, 2020 Share Posted April 4, 2020 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> Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576301 Share on other sites More sharing options...
mac_gyver Posted April 4, 2020 Share Posted April 4, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576303 Share on other sites More sharing options...
ramiwahdan Posted April 4, 2020 Author Share Posted April 4, 2020 (edited) 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 April 4, 2020 by ramiwahdan Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576304 Share on other sites More sharing options...
ginerjm Posted April 4, 2020 Share Posted April 4, 2020 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) Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576307 Share on other sites More sharing options...
Barand Posted April 4, 2020 Share Posted April 4, 2020 4 hours ago, ramiwahdan said: $pdf->output('D','filename.pdf'); Have you tried the "F" option? Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576308 Share on other sites More sharing options...
ginerjm Posted April 4, 2020 Share Posted April 4, 2020 FWIW - When I use FPDF I usually want the pdf document to just show up on a clean page of my web browser I use $pdf->Output(); That's all it takes. Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576310 Share on other sites More sharing options...
ramiwahdan Posted April 4, 2020 Author Share Posted April 4, 2020 29 minutes ago, Barand said: Have you tried the "F" option? yes it downloads the file instead of asking to download. I am done for today, I will resume tomorrow. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576315 Share on other sites More sharing options...
Barand Posted April 4, 2020 Share Posted April 4, 2020 4 minutes ago, ramiwahdan said: yes it downloads the file Then you have some more reading to do if that's what you think. Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576319 Share on other sites More sharing options...
ginerjm Posted April 4, 2020 Share Posted April 4, 2020 Can you show us some of your fpdf code? Just a sample of 20-30 lines from one of your routines that generates the pdf file? Just want to make sure of something since I'm still trying to help you. 1 Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576322 Share on other sites More sharing options...
Barand Posted April 4, 2020 Share Posted April 4, 2020 He already has 1 Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576324 Share on other sites More sharing options...
ginerjm Posted April 4, 2020 Share Posted April 4, 2020 And that hopefully has been corrected so as not to do that html output? Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576325 Share on other sites More sharing options...
ramiwahdan Posted April 4, 2020 Author Share Posted April 4, 2020 (edited) right now what i can do, click a link for each staff to generate that pdf file. what if i have 100 staff members, I don't want to click on all of them so i want to generate one pdf file for all of them. Edited April 4, 2020 by ramiwahdan Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576327 Share on other sites More sharing options...
Barand Posted April 4, 2020 Share Posted April 4, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576330 Share on other sites More sharing options...
ramiwahdan Posted April 4, 2020 Author Share Posted April 4, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576336 Share on other sites More sharing options...
ramiwahdan Posted April 4, 2020 Author Share Posted April 4, 2020 (edited) structure and data of my tables i am working with now. there are some fields i am not using now but included in the php file. Edited April 4, 2020 by ramiwahdan Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576340 Share on other sites More sharing options...
ginerjm Posted April 5, 2020 Share Posted April 5, 2020 Have you ever written reports before?? For that matter - have you ever read a report? What you are showing looks like no other report I have ever seen. Really??? Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576371 Share on other sites More sharing options...
ginerjm Posted April 5, 2020 Share Posted April 5, 2020 (edited) 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 April 5, 2020 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/310457-merge-fpdf-files/page/2/#findComment-1576372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.