Forum » Server-Side scripting » euro symbool in pdf
I just love to drink
Berichten: 429
avatar
Offline Stuur privebericht
Beste

de pdf word automatisch gemaakt door een php bestand maar krijg maar niet de euro symbool er in weet iemand een oplossing

Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php



include('plugins/fpdf/fpdf.php');

class 
PDF extends FPDF
{


    function 
invoice($invoice)
    {
        
//TODO: authorized admin or owner...owner function
        
global $CONFIG;
        
setlocale(LC_MONETARY'en_EN');

        
//all date into simple variables
        
$company_details[0] = (isset($CONFIG['company']['address'])) ? $CONFIG['company']['address'] : '';
        
$company_details[1] = (isset($CONFIG['company']['address_2'])) ? $CONFIG['company']['address_2'] : '';
        
$company_details[2] = (isset($CONFIG['company']['email'])) ? $CONFIG['company']['email'] : '';
        
$company_details[3] = (isset($CONFIG['company']['phone'])) ? $CONFIG['company']['phone'] : '';
        
$company_details[4] = (isset($CONFIG['company']['bank'])) ? $CONFIG['company']['bank'] : '';
        
$company_details[5] = (isset($CONFIG['company']['bank2'])) ? $CONFIG['company']['bank2'] : '';
        
$company_details[6] = (isset($CONFIG['company']['bank3'])) ? $CONFIG['company']['bank3'] : '';

        
$client $invoice['client'];
        
$clientname = (!empty($client['name'])) ? $client['name'] : '';
        
$clientaddress1 = (!empty($client['address_line_1'])) ? $client['address_line_1'] : '';
        
$clientaddress2 = (!empty($client['address_line_2'])) ? $client['address_line_2'] : '';
        
$clientcontactemail = (!empty($client['contact_email'])) ? $client['contact_email'] : '';
        
$clientcontactphone = (!empty($client['contact_phone'])) ? $client['contact_phone'] : '';

        
$invoicenumber $invoice['main']['invoice_number'];
        
$invoicedate = ($invoice['main']['date_of_issue'] != 0) ? date('M j, Y'$invoice['main']['date_of_issue']) : '';
        
$invoicestatus InvoicesController::invoice_status($invoice['main']['balance'], $invoice['main']['due_date'], is_array($invoice['line_items']));
        
$invoiceduedate = ($invoice['main']['due_date'] != 0) ? date('M j, Y'$invoice['main']['due_date']) : '';


        
$this->AddPage();
        
$this->SetTextColor(119119119);
        
$this->SetFont('arial'''8);


        
$this->Image($CONFIG['company']['logo'], 121255);

        
$y getimagesize($CONFIG['company']['logo']);
        
$y_start $y[1] - 35;
        
$num_details 0;
        for (
$i 0$i count($company_details); $i++)
        {
            if (!empty(
$company_details[$i]))
            {
                
$y $y_start + ($num_details 5);
                
$this->Text(12$y$company_details[$i]);
                
$num_details++;
            }

        }

        
$this->SetFont('arial'''9);
        
$this->Text(1265"To");
        
$this->SetFont('arial''B'9);
        
$this->SetTextColor(000);
        
$this->Text(1270$clientname);
        
$this->SetTextColor(119119119);
        
$this->SetFont('arial'''8);
        
$this->Text(1275$clientcontactemail);
        
$this->Text(1279$clientcontactphone);

        
$c 170;
        
$this->SetXY(8062);
        
$this->SetFont('arial'''9);
        
$this->SetTextColor($c$c$c);
        
$this->Cell(205'Invoice No.'00'R');
        
$this->SetTextColor(000);
        
$this->Cell(205$invoicenumber02'L');
        
$this->SetTextColor($c$c$c);
        
$this->SetXY(8068);
        
$this->Cell(205'Invoice Date'00'R');
        
$this->SetTextColor(000);
        
$this->Cell(205$invoicedate02'L');
        
$this->SetTextColor($c$c$c);
        
$this->SetXY(8074);
        
$this->Cell(205'Invoice Status'00'R');
        
$this->SetTextColor(000);
        
$this->Cell(205$invoicestatus02'L');

        
$this->SetFillColor(224243251);
        
$this->RoundedRect(1705827100'F''1234');
        
$this->SetFont('arial'''10);
        
$this->SetTextColor(000);
        
$this->SetXY(15058);
        
$this->Cell(2010'Payment Due:'00'R');
        
$this->SetTextColor(000);
        
$this->Cell(2710$invoiceduedate02'C');

        
//Items Header
        
$w1 80;
        
$w2 35;
        
$w3 35;
        
$w4 35;
        
$this->SetXY(1295);
        
$this->SetFont('arial''B'8);
        
$this->SetTextColor(119119119);
        
$this->SetDrawColor(231240244);
        
$this->SetFillColor(248248248);
        
$this->Cell($w15'NAME''B'0'C'true);
        
$this->Cell($w25'HRS/QTY''B'0'C'true);
        
$this->Cell($w35'RATE''B'0'C'true);
        
$this->Cell($w45'SUBTOTAL''B'0'C'true);

        
//Items loop
        
for ($i 0;
             
$i count($invoice['line_items']);
             
$i++)
        {
            
$this->SetXY(12100.1 + (17 $i));
            
$this->SetFont('arial'''8);
            
$this->SetFillColor(244248250);
            
$this->Cell($w17$invoice['line_items'][$i]['item_name'], 00'L'true);
            
$this->Cell($w27$invoice['line_items'][$i]['item_quantity'], 00'C'true);
            
$this->Cell($w37'EURO' number_format($invoice['line_items'][$i]['item_rate'], 0'.'','), 00'C'true);
            
$this->Cell($w47'EURO' number_format($invoice['line_items'][$i]['item_quantity'] * $invoice['line_items'][$i]['item_rate'], 0'.'','), 00'C'true);
            
$this->SetXY(12107.1 + (17 $i));
            
$this->SetFont('arial'''8);
            
$this->MultiCell($w15$invoice['line_items'][$i]['description'], 0'L'false);
        }

//Totals table
        
$ht 7;
        
$this->SetXY(106120 + (15 $i));
        
$this->SetFont('arial''B'8);
        
$this->SetTextColor(119119119);
        
$this->SetDrawColor(231240244);
        
$this->SetFillColor(248248248);
        
$this->Cell(90$ht'INVOICE SUMMARY''B'0'C'true);
        
$this->SetXY(106120.1 + (15 $i) + ($ht 1));
        
$this->SetFont('arial'''8);
        
$this->SetTextColor(000);
        
$this->Cell(50$ht'Total:''B'0'L'false);
        
$this->Cell(40$ht'&#8364;' number_format($invoice['main']['total'], 0'.'','), 'B'0'R'false);
        
$this->SetXY(106120.2 + (15 $i) + ($ht 2));
        
$this->Cell(50$ht'Payments:''B'0'L'false);
        
$this->Cell(40$ht'&#8364;' number_format($invoice['main']['payments'], 0'.'','), 'B'0'R'false);
        
$this->SetXY(106120.3 + (15 $i) + ($ht 3));
        
$this->SetFont('arial''B'8);
        
$this->Cell(50$ht'Remaining Balance:''B'0'L'false);
        
$this->Cell(40$ht'&#8364;' number_format($invoice['main']['balance'], 0'.'','), 'B'0'R'false);

        
$terms = (isset($invoice['main']['terms'])) ? $invoice['main']['terms'] : $_CONFIG['invoice']['default_terms'];
        
$this->SetXY(12140.3 + (15 $i) + ($ht 3));
        
$this->SetFont('arial'''8);
        
$this->SetTextColor(119119119);
        
$this->MultiCell(1855$terms0'L'false);

        
$filename $CONFIG['uploads']['path'] . "invoices\" . $invoice['main']['invoice_number'] . '.pdf';
        
$this->Output($filename); //generat the invoice and then use any where.

        error_reporting(0);
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=' . basename(
$filename));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize(
$filename));
        ob_clean();
        flush();
        readfile(
$filename);
        unlink(
$filename);
        exit;
    }

    function RoundedRect(
$x$y$w$h$r$style = '', $angle = '1234')
    {
        
$k = $this->k;
        
$hp = $this->h;
        if (
$style == 'F')
            
$op = 'f';
        elseif (
$style == 'FD' or $style == 'DF')
            
$op = 'B';
        else
            
$op = 'S';
        
$MyArc = 4 / 3 * (sqrt(2) - 1);
        
$this->_out(sprintf('%.2f %.2f m', ($x + $r) * $k, ($hp - $y) * $k));

        
$xc = $x + $w - $r;
        
$yc = $y + $r;
        
$this->_out(sprintf('%.2f %.2f l', $xc * $k, ($hp - $y) * $k));
        if (strpos(
$angle, '2')===false)
            
$this->_out(sprintf('%.2f %.2f l', ($x + $w) * $k, ($hp - $y) * $k));
        else
            
$this->_Arc($xc + $r * $MyArc$yc - $r$xc + $r$yc - $r * $MyArc$xc + $r$yc);

        
$xc = $x + $w - $r;
        
$yc = $y + $h - $r;
        
$this->_out(sprintf('%.2f %.2f l', ($x + $w) * $k, ($hp - $yc) * $k));
        if (strpos(
$angle, '3')===false)
            
$this->_out(sprintf('%.2f %.2f l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
        else
            
$this->_Arc($xc + $r$yc + $r * $MyArc$xc + $r * $MyArc$yc + $r$xc$yc + $r);

        
$xc = $x + $r;
        
$yc = $y + $h - $r;
        
$this->_out(sprintf('%.2f %.2f l', $xc * $k, ($hp - ($y + $h)) * $k));
        if (strpos(
$angle, '4')===false)
            
$this->_out(sprintf('%.2f %.2f l', ($x) * $k, ($hp - ($y + $h)) * $k));
        else
            
$this->_Arc($xc - $r * $MyArc$yc + $r$xc - $r$yc + $r * $MyArc$xc - $r$yc);

        
$xc = $x + $r;
        
$yc = $y + $r;
        
$this->_out(sprintf('%.2f %.2f l', ($x) * $k, ($hp - $yc) * $k));
        if (strpos(
$angle, '1')===false)
        {
            
$this->_out(sprintf('%.2f %.2f l', ($x) * $k, ($hp - $y) * $k));
            
$this->_out(sprintf('%.2f %.2f l', ($x + $r) * $k, ($hp - $y) * $k));
        }
        else
            
$this->_Arc($xc - $r$yc - $r * $MyArc$xc - $r * $MyArc$yc - $r$xc$yc - $r);
        
$this->_out($op);
    }

    function _Arc(
$x1$y1$x2$y2$x3$y3)
    {
        
$h = $this->h;
        
$this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1 * $this->k, ($h - $y1) * $this->k,
                
$x2 * $this->k, ($h - $y2) * $this->k$x3 * $this->k, ($h - $y3) * $this->k));
    }
}

?>

Laatst gewijzigd door baldex op 2011-10-24 20:19:07
24-10-2011 20:18
Dit topic is 183 keer bekeken door 31 verschillende leden
Reacties op: "euro symbool in pdf"
1
Cas
BuitengewoonUniek.nl
Berichten: 1156
avatar
Offline Stuur privébericht
Code | Selecteer Alles
minimaliseren
1
&euro;


Tenminste dit is de weergavecode voor een euroteken.
24-10-2011 20:21
Rapifia Europe
Berichten: 3718
avatar
Online Stuur privébericht
Je kan de volgende twee proberen:
&euro;
&#8364;

En anders even googlen:
http://tinyurl.com/69wvatq
24-10-2011 20:21
24-10-2011 20:23
I just love to drink
Berichten: 429
avatar
Offline Stuur privébericht
ja had op google gekeken maar geen van die symboolen werkt niet met $euro; krijg ik een super raar symbool en &#8364;
24-10-2011 20:54
Berichten: 401
avatar
Offline Stuur privébericht
Code | Selecteer Alles
minimaliseren
1
$objPDF->show(? Valuta ? . chr(128) . ?123.45?);
24-10-2011 21:13
Cas
BuitengewoonUniek.nl
Berichten: 1156
avatar
Offline Stuur privébericht
Quote: baldex

ja had op google gekeken maar geen van die symboolen werkt niet met $euro; krijg ik een super raar symbool en &#8364;




Het is ook &euro; niet $euro;
25-10-2011 10:25
Reageer op: "euro symbool in pdf"
1
Je kan niet reageren omdat je niet bent ingelogd. Inloggen of Aanmelden