diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/constants.class.php | 76 | ||||
-rw-r--r-- | classes/correspondence.class.php | 16 | ||||
-rw-r--r-- | classes/offer.class.php | 12 |
3 files changed, 60 insertions, 44 deletions
diff --git a/classes/constants.class.php b/classes/constants.class.php index 517db21..aa11ffb 100644 --- a/classes/constants.class.php +++ b/classes/constants.class.php @@ -25,47 +25,47 @@ * A class for some constants */ class constants { - /** @const db_prefix A prefix to add to the tables in the database (leave empty for none) */ - const db_prefix = ''; + /** @const db_prefix A prefix to add to the tables in the database (leave empty for none) */ + const db_prefix = ''; - /** @const files_folder The folder to store all files (appendices, invoices, etc.) in; with a trailing slash */ - const files_folder = '/var/www/localhost/BusinessAdmin/files/'; - /** @const files_folder_external The external URI to this folder; with a trailing slash */ - const files_folder_external = 'http://localhost/BusinessAdmin/files/'; - /** @const files_folder_trash The folder inside files_folder to use a trash, without any trailing slashes */ - const files_folder_trash = 'trash'; + /** @const files_folder The folder to store all files (appendices, invoices, etc.) in; with a trailing slash */ + const files_folder = '/var/www/localhost/BusinessAdmin/files/'; + /** @const files_folder_external The external URI to this folder; with a trailing slash */ + const files_folder_external = 'http://localhost/BusinessAdmin/files/'; + /** @const files_folder_trash The folder inside files_folder to use a trash, without any trailing slashes */ + const files_folder_trash = 'trash'; - /** @const url_external The external URI to this folder; with a trailing slash */ - const url_external = 'http://localhost/BusinessAdmin/'; - /** @const url_internal The URI without the domain name; with a slash at the beginning but not at the end */ - const url_internal = '/BusinessAdmin'; + /** @const url_external The external URI to this folder; with a trailing slash */ + const url_external = 'http://localhost/BusinessAdmin/'; + /** @const url_internal The URI without the domain name; with a slash at the beginning but not at the end */ + const url_internal = '/BusinessAdmin'; - /** @const my_name Name of this control panel */ - const my_name = 'BusinessAdmin'; + /** @const my_name Name of this control panel */ + const my_name = 'BusinessAdmin'; - /** - * @const invoice_name Your name or the name of your business - * @const invoice_address_1 First address line - * @const invoice_address_2 Second address line - * @const invoice_address_3 Third address line - * @const invoice_tax_nr Your tax number - * @const invoice_iban Your IBAN number - * @const invoice_bic The BIC code of your bank - * @const invoice_tel_nr Your telephone number - * @const invoice_email Your email address - * @const invoice_valuta The valuta symbol (will be placed in front of amounts). You can use a symbol like $ or a code like USD - */ - const invoice_name = 'BusinessAdmin'; - const invoice_address_1 = 'My Street 1'; - const invoice_address_2 = '12345 My City'; - const invoice_address_3 = 'My Country'; - const invoice_tax_nr = 'XX123456789A00'; - const invoice_iban = 'XX00 ABCD 1234 5678 90'; - const invoice_bic = 'XXXX XXXX'; - const invoice_tel_nr = '+31 6 1234 5678'; - const invoice_email = 'my-email@domain.tld'; - const invoice_valuta = '$'; // chr(128) for euro + /** + * @const invoice_name Your name or the name of your business + * @const invoice_address_1 First address line + * @const invoice_address_2 Second address line + * @const invoice_address_3 Third address line + * @const invoice_tax_nr Your tax number + * @const invoice_iban Your IBAN number + * @const invoice_bic The BIC code of your bank + * @const invoice_tel_nr Your telephone number + * @const invoice_email Your email address + * @var invoice_valuta The valuta symbol (will be placed in front of amounts). You can use a symbol like $ or a code like USD + */ + const invoice_name = 'BusinessAdmin'; + const invoice_address_1 = 'My Street 1'; + const invoice_address_2 = '12345 My City'; + const invoice_address_3 = 'My Country'; + const invoice_tax_nr = 'XX123456789A00'; + const invoice_iban = 'XX00 ABCD 1234 5678 90'; + const invoice_bic = 'XXXX XXXX'; + const invoice_tel_nr = '+31 6 1234 5678'; + const invoice_email = 'my-email@domain.tld'; + const invoice_valuta = '€'; - /** @const version Version of BusinessAdmin. Don't change this yourself! */ - const version = '0.2'; + /** @const version Version of BusinessAdmin. Don't change this yourself! */ + const version = '0.2.1'; }
\ No newline at end of file diff --git a/classes/correspondence.class.php b/classes/correspondence.class.php index 6e17528..ac3da64 100644 --- a/classes/correspondence.class.php +++ b/classes/correspondence.class.php @@ -134,6 +134,22 @@ class correspondence extends FPDF { $this->SetDisplayMode('fullpage','continuous'); } + /** + * Workaround for euro signs + * + * Euro signs in FPDF should be chr(128). Other signs don't have to be changed. + * + * @return a valuta symbol that can be used in FPDF + */ + public static function valuta() { + switch (constants::invoice_valuta) { + case '€': + return chr(128); + default: + return constants::invoice_valuta; + } + } + /** * Set the language of the correspondence (used to translate stuff) * diff --git a/classes/offer.class.php b/classes/offer.class.php index 6dedd09..d8e2692 100644 --- a/classes/offer.class.php +++ b/classes/offer.class.php @@ -530,9 +530,9 @@ class offer { $pdf->MultiCell($width[0],6,$row[0],0,'L'); $newy = $pdf->getY(); $pdf->SetXY($x + $width[0], $y); - $pdf->Cell($width[1],6,constants::invoice_valuta.number_format($row[1],2),'',0,'R'); + $pdf->Cell($width[1],6,correspondence::valuta().number_format($row[1],2),'',0,'R'); $pdf->Cell($width[2],6,round($row[2],0) . '%','',0,'R'); - $pdf->Cell($width[3],6,constants::invoice_valuta.number_format($row[3],2),'',0,'R'); + $pdf->Cell($width[3],6,correspondence::valuta().number_format($row[3],2),'',0,'R'); $pdf->Ln(); $pdf->SetY($newy); $subtotal += $row[1]; @@ -553,13 +553,13 @@ class offer { $pdf->SetFont('','B'); $pdf->Cell($width[1] + $width[2],7,$pdf->_('amount')); $pdf->SetFont('',''); - $pdf->Cell($width[3],7,constants::invoice_valuta . $this->calculate(self::SUBTOTAL),'',0,'R'); + $pdf->Cell($width[3],7,correspondence::valuta() . $this->calculate(self::SUBTOTAL),'',0,'R'); $pdf->Ln(); foreach ($btw as $p => $m) { $pdf->Cell($width[0],7); $pdf->Cell($width[1] + $width[2],7,$pdf->_('vat') . ' '.round($p,0).'%'); - $pdf->Cell($width[3],7,constants::invoice_valuta . number_format($m,2),'',0,'R'); + $pdf->Cell($width[3],7,correspondence::valuta() . number_format($m,2),'',0,'R'); $pdf->Ln(); } @@ -570,7 +570,7 @@ class offer { $pdf->SetFont('','B'); $pdf->Cell($width[1] + $width[2],7,$pdf->_('total')); $pdf->SetFont('',''); - $pdf->Cell($width[3],7,constants::invoice_valuta . $this->calculate(self::TOTAL),'T',0,'R'); + $pdf->Cell($width[3],7,correspondence::valuta() . $this->calculate(self::TOTAL),'T',0,'R'); $pdf->Ln(); // Footer @@ -607,7 +607,7 @@ class offer { $pdf->Cell(17.5,5); $pdf->Cell(40,5,$invoice_nr); $pdf->Cell(17.5,5); - $pdf->Cell(40,5,constants::invoice_valuta . $this->calculate(self::TOTAL)); + $pdf->Cell(40,5,correspondence::valuta() . $this->calculate(self::TOTAL)); $pdf->SetY($oldY + 14); |