Welcome Guest, Not a member yet? Register   Sign In
printing an invoice using CI
#1

[eluser]rangana[/eluser]
Hi guys,

I'm just started CI and,I'm developing a system for a hospital as my university project, i need to print a invoice kind of thing (actually it is a small chit given to the patient, it has patient reference number, doctor unit etc.) i want to print the point at the point where patient is registered as a patient in the hospital. can you please help me to do this? any tutorial link, or simple explanation containing how to do it is good!

regards,
Rangana
#2

[eluser]rwestergren[/eluser]
This isn't very specific, but you'll just need to pass your query results to the view with something like this:
Code:
//Get query results
$data['result'] = $this->SomeModel->someFunction();

//Pass to view
$this->load->view('someView', $data);

Display the results in view:
Code:
echo $result['column'];

Format the view however you'd like.
#3

[eluser]rangana[/eluser]
what i meant was i need to take a hard copy of the registration form, now we can put a print button there, how to code to that button? that was my question? how to perform a printout by pressing a button, how to code to the button it self to get out a print out?
#4

[eluser]rwestergren[/eluser]
[quote author="rangana" date="1281038947"]what i meant was i need to take a hard copy of the registration form, now we can put a print button there, how to code to that button? that was my question? how to perform a printout by pressing a button, how to code to the button it self to get out a print out?[/quote]

Coding a button to print the current page? You can bind a jQuery click event to the button and have it print like this:

Code:
$(document).ready(function()
{
        $('#button1').click(function()
        {
             window.print();
        });
}
#5

[eluser]stevezissou[/eluser]
Also, I would make use of CSS for print. i.e.

Code:
<link rel="stylesheet" href="yourdomain.com/print.css" type="text/css" media="print" />

You can then format your "invoice for print" separately from your "onscreen invoice".
#6

[eluser]rangana[/eluser]
Thank you very much rwestergren and stevezissou for the valuable answers, thanx again!




Theme © iAndrew 2016 - Forum software by © MyBB