bdmovies Posted October 23, 2007 Share Posted October 23, 2007 In the app I'm building, there wiill be times when users will enter a bunch of summons's or subpoenas. Then, I need to print out affidavit's for each of those cases. It's 10x easier to do a batch print of the affidavits than printing it out after each new insert. My question is how do I go about building the que for this? The DB has to be able to know which affidavits have and which have not been printed. I know there's no "real" way of knowing, but I was thinking show a list with checkboxes, at the end of the list, have a submit button, that opens a new window with the affidavit template in it. Then I just use a while for the cheked ones in the list for the template, giving me one really long web page, but I just build in page-breaks where neeed. That solves getting all of them batched together. Jump back to the que page. The first thing that happens on that page is a query to the db, it pulls everything where the print_que field == 0. Jump back to the actual print affidavit page. That page contains a print button which starts a print (I mean, it triggers the print window), I can then just attach a function to the click of the button which updates the print_que field in the db to 1 for all the cases displayed on the page. I'm sorry this is so long, I just wanted everyone's opinion on it before I went and started writing that. Does all of that make sense? Is it the most effective way? Nutshell: print_que.php SELECT * FROM case_information WHERE print_que = 0 WHILE (nice loop to display everything I just SELECTED Submit button <-- Onclick(affidavit_print.php opens!) affidavit_print.php WHILE (nice loop to display each summons / subpoena in the affidavit template) Print button <-- onclick... UPDATE every row displayed on this page print_que so now print_que = 1 Hmmm....that's the basic idea, I know I've got some kinks to work out... Thought, comments, suggestions? I can already tell you, I wouldn't know how to take the info from print_que and give it to affidavit_print so that page knows what to show, I guess I could put it into an array? maybe?.... Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/ Share on other sites More sharing options...
bdmovies Posted October 23, 2007 Author Share Posted October 23, 2007 bump? Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-376069 Share on other sites More sharing options...
bdmovies Posted October 24, 2007 Author Share Posted October 24, 2007 bump bump? Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-376711 Share on other sites More sharing options...
PHP_PhREEEk Posted October 24, 2007 Share Posted October 24, 2007 Each affidavit should have a unique ID, so most likely you would have a separate table called "affidavits" with a primary key of ID. Fill out the records of that table with the other fields you need to store a complete affidavit. You then need to ID each user and store their requests. You can do it by IP or a user login (if you have logins established). In a table we'll call "print_queue", you would store a user's request. Each record would be the user's ID (IP or whatever), the affidavit ID needed, and a bool field of whether it has been served or not. If a user needs 5 affidavits, there would now be 5 records in the print_queue for this user. Your print page would simply serve those affidavits that were requested, then tidy up the print_queue by updating the bool or deleting the record. Updating the bool and keeping the record would allow a repeat user to see what he's already got so far (if that would be handy). PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-376736 Share on other sites More sharing options...
bdmovies Posted October 31, 2007 Author Share Posted October 31, 2007 I have a case_information table which stores everything necessary to make an affidavit. It is also used to email updates, display results, etc....this has a uniqueID field that is formatted year+00000 or 00001, 00002, 03234, and an internalID which is just an auto_increment. So, if I understand you correctly, I would make "print_queue" and have the userID, uniqueID, and the bool. This is where I start to loose you. The bool shouldn't contain whether the paper has been served, rather whether or not it has been printed. (so, whether or not it has gone through the affidavit_print.php page.)... So, does this just mean on the print_queue.php page, I use the while loop to display all the affidavits that *haven't* been printed, and when I submit it, it inserts into that table? and then I get a new window that queries that table? Correct me if I'm wrong, but wouldn't moving the bool to the case_information table be better, because then on the print_queue.php page I can do SELECT * FROM case_information WHERE printed == 0.... What about doing something like this. case_information -> aff_print (just a field in the table) aff_print can equal: 0 = Affidavit has not been printed 1 = Affidavit is queued to be printed 2 = Affidavit has been printed when I submit my print_queue.php form with a bunch of checkboxes selected it updates the checked ones to 1, then the new window grabs those with values of 1, displays them, then changes them to 2. I make another table that is called print_details that contains: user_id (Who printed it) uniqueID (Which paper was printed) date time So then every time a paper gets printed it also gets logged so to keep track, then I can build a function to see how many times a paper has been printed, and by who. I am a young programmer and don't know if that makes sense or how economical it really is, but it makes sense to me Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-381677 Share on other sites More sharing options...
PHP_PhREEEk Posted November 1, 2007 Share Posted November 1, 2007 Looks like you are getting a handle on 'the bigger picture' of what might work for your needs. Unfortunately at this point I can't be of much help without becoming intimately familiar with your situation. Your project needing to be spread across several scripts and quite possibly several tables puts it into the realm of advanced programming. If time isn't of the essence, you could just struggle through it. If time is an issue, you might want to offer to pay someone to come in, analyze your project, work out the details that will make it efficient, and most importantly, make it work. PHrEEEk Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-382533 Share on other sites More sharing options...
bdmovies Posted November 1, 2007 Author Share Posted November 1, 2007 Time is a slight issue, but I think I'll struggle through, because then I'll know what to do for next time. Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/74418-solved-print-que/#findComment-382868 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.