Jump to content

michelle1404

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by michelle1404

  1. @ Barand: Thank you very much. Its exactly the way i wanted it. I am able to put the logo in header. Thanks Sorry for asking you again , please can you guide me how to display the result. Now only the table headers are getting displayed. $this->SetFont('Arial','',9); if ($res->num_rows > 0) { while ($r = $res->fetch_row()) { foreach ($r as $c => $value) { if ($this->formats[$c]) { $value = number_format($value, 2); } $this->Cell($this->widths[$c],5,$value,'LR',0, $this->aligns[$c]); } $this->Ln(5); } within this function, where do it initialize the columns . And i have to display my pdf like this ... i struggled lot to make it happen . but only errors i got. Its really screwed me
  2. Hello, I am trying to print the invoice in pdf, using fpdf. i am not getting how to do it. I am able to display line items , but its not in proper format. I tried changing X, Y positions, but its not going into my head . Also i want to display Logo and address in left side, invoice number and order date in right side. Here is the code i have done so far... Please please help me in this <?php require('includes/fpdf/fpdf.php'); //Connect to your database include("connect/DB_Connect.php"); $id = $_GET['id']; //Select the Products you want to show in your PDF file $result=mysql_query("select invoice_no, order_no, order_date, completion_date, artwork, customer_po, order_quantity, comments, order_amount from invoice where invoice_no='".$id."' ") or die(mysql_error()); $number_of_products = mysql_numrows($result); //Initialize the 3 columns and the total $column_order_date = ""; $column_order_no = ""; $column_artwork = ""; $column_cpo = ""; $column_order_quantity = ""; $column_order_amount = ""; $column_comments = ""; $total = 0; //For each row, add the field to the corresponding column while($row = mysql_fetch_array($result)) { $order_date = $row["order_date"]; $order_no = $row["order_no"]; $artwork = $row['artwork']; $cpo = $row['customer_po']; $oquantity = $row['order_quantity']; $oamount = $row['order_amount']; $comments = $row['comments']; //$price_to_show = number_format($row["Price"],',','.','.'); $column_order_date = $column_order_date.$order_date."\n"; $column_order_no = $column_order_no.$order_no."\n"; $column_artwork = $column_artwork.$artwork."\n"; $column_cpo = $column_cpo.$cpo."\n"; $column_order_quantity = $column_order_quantity.$oquantity."\n"; $column_order_amount = $column_order_amount.$oamount."\n"; $column_comments = $column_comments.$comments."\n"; //Sum all the Prices (TOTAL) $total = $total+$oamount; } mysql_close(); //Create a new PDF file $pdf=new FPDF(); $pdf->AddPage(); //Fields Name position $Y_Fields_Name_position = 20; //Table position, under Fields Name $Y_Table_Position = 26; //First create each Field Name //Gray color filling each Field Name box $pdf->SetFillColor(232,232,232); //Bold Font for Field Name $pdf->SetFont('Arial','B',12); $pdf->SetY($Y_Fields_Name_position); $pdf->SetX(5); $pdf->Cell(25,6,'Order Date',1,0,'L',1); $pdf->SetX(30); $pdf->Cell(50,6,'Graphixide Order No',1,0,'L',1); $pdf->SetX(75); $pdf->Cell(40,6,'Artwork',1,0,'L',1); $pdf->SetX(110); $pdf->Cell(20,6,'PO #',1,0,'L',1); $pdf->SetX(130); $pdf->Cell(20,6,'Quantity',1,0,'L',1); $pdf->SetX(150); $pdf->Cell(25,6,'Amount',1,0,'L',1); $pdf->SetX(175); $pdf->Cell(25,6,'Comments',1,0,'L',1); //Now show the 3 columns $pdf->SetFont('Arial','',12); $pdf->SetY($Y_Table_Position); $pdf->SetX(5); $pdf->MultiCell(25,6,$column_order_date,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(30); $pdf->MultiCell(80,6,$column_order_no,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(75); $pdf->MultiCell(40,6,$column_artwork,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(110); $pdf->MultiCell(20,9,$column_cpo,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(130); $pdf->MultiCell(20,6,$column_order_quantity,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(150); $pdf->MultiCell(75,6,$column_order_amount,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(175); $pdf->MultiCell(25,10,$column_comments,1); $pdf->SetY($Y_Table_Position); $pdf->SetX(150); $pdf->MultiCell(130,6,'$ '.$total,1,'R'); //Create lines (boxes) for each ROW (Product) //If you don't use the following code, you don't create the lines separating each row $i = 0; while ($i < $number_of_products) { $pdf->SetX(45); $pdf->MultiCell(120,6,'',1); $i = $i +1; } $pdf->Output(); ?> Here is the output of this code If i use headers and footers like this class PDF extends FPDF { function Header() { // Logo $this->Image('images/logo.png',10,6,30); // Arial bold 15 $this->SetFont('Arial','B',15); // Move to the right $this->Cell(80); // Title $this->Cell(30,10,'Title',1,0,'C'); // Line break $this->Ln(20); } // Page footer function Footer() { // Position at 1.5 cm from bottom $this->SetY(-15); // Arial italic 8 $this->SetFont('Arial','I',; // Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } Only logo displays, not any contents,
  3. Hello, I want to calculate the difference between 2 textbox value live. I found this solution for adding http://forums.phpfreaks.com/topic/131592-solved-get-the-sum-of-many-text-box-values/ , but dont know how to convert this for subtracting here is my form echo '<tr><td></td><td style="text-align:center;">TOTAL</td><td style="text-align:center;"><input type="text" readonly="readonly" name="payamount" value='.$total.' style="text-align:center; font-weight:bold; font-size:13px;" ></td></tr>'; echo'<form name="form1" method="post" action="" > <tr><td></td><td style="text-align:center;">Advance</td><td style="text-align:center;"><input type="text" name="advance" ></td></tr> <tr><td></td><td style="text-align:center;">Discount</td><td style="text-align:center;"><input type="text" name="discount" ></td></tr> <tr><td></td><td style="text-align:center;">Total Payable</td><td style="text-align:center;"><input type="text" name="total" id="total"/></td></tr> <tr><td><input type="submit" name="submit" value="PAY NOW" > when i enter the value for advance and discount, it should subtract these values with Total and should get entered in Total Payable text box
×
×
  • 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.