Jump to content

[solved] invoice pdf neeedddd immediate help


Recommended Posts

whats wrong


   /* Display address information */
       $invoice_address = new Address(intval($order->id_address_invoice));
       $invoiceState = $invoice_address->id_state ? new State($invoice_address->id_state) : false;
       $delivery_address = new Address(intval($order->id_address_delivery));
       $deliveryState = $delivery_address->id_state ? new State($delivery_address->id_state) : false;
       $shop_country = Configuration::get('PS_SHOP_COUNTRY');


       $width = 100;

       $pdf->SetX(5);
       $pdf->SetY(25);
       $pdf->SetFont(self::fontname(), '', 12);
       $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
       $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
       $pdf->Ln(5);
       $pdf->SetFont(self::fontname(), 'B', 9);

       if (!empty($delivery_address->company) OR !empty($invoice_address->company))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->company), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->company), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->lastname), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->lastname), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address1), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address1), 0, 'L');
       $pdf->Ln(5);
       if (!empty($invoice_address->address2) OR !empty($delivery_address->address2))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address2), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address2), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, $delivery_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->city), 0, 'L');
       $pdf->Cell($width, 10, $invoice_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->city), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->country.($deliveryState ? ' - '.$deliveryState->name : '')), 0, 'L');    
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->country.($invoiceState ? ' - '.$invoiceState->name : '')), 0, 'L');
       $pdf->Cell(0, 10, self::l('PS_SHOP_NAME').Configuration::get('PS_SHOP_ADDR1', 'PS_SHOP_CODE', 'PS_SHOP_CITY', 'PS_SHOP_COUNTRY', 'PS_SHOP_DETAILS', 'PS_SHOP_PHONE', 'PS_SHOP_STATE'), 1, 2, 'L', 1);



       $pdf->Ln(5);
       $pdf->Cell($width, 10, $delivery_address->phone, 0, 'L');
       if (!empty($delivery_address->phone_mobile))
       {
           $pdf->Ln(5);
           $pdf->Cell($width, 10, $delivery_address->phone_mobile, 0, 'L');
       }


11851_QcRAFkxs6D0qx248LWro_t

Link to comment
Share on other sites

Did you try to add a text before the word "INVOICE #xxx", which reside inside a table ?

Well, open file pdf.php located inside classes directory.
Since it is a wall of text, search these words "display order information".

After you found it... below that display order information is where the program will draw the table.
Below it, you'll find : ( I'm referring these lines from the original pdf.php .... )

$pdf->Ln(12);
$pdf->SetFillColor(240, 240, 240);

Since you want to add text before the table which has INVOICE writing in it.... separate those two lines, so it will become this :
$pdf->Ln(12);
* this will the the area which you'll use to insert whatever text you want*
$pdf->SetFillColor(240, 240, 240);

For example, you want to write : "abc"

The lines will be :
$pdf->Ln(12);

$pdf->Cell(0, 0, self::l('abc'), '');
$pdf->Ln(6); <-- you will need this to make space between what you want to write with the table below it, otherwise the result will be unpleasant.
Readjust the number as you see fit. ( replace 6 with whatever you want, it represent space height )

$pdf->SetFillColor(240, 240, 240);

Hope it help.

Please note, I'm using 1.2.2.

Link to comment
Share on other sites

×
×
  • Create New...