Line 7... |
Line 7... |
7 |
require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
|
7 |
require_once WPSG_PATH_LIB.'FPDF_1.81/fpdf.php';
|
8 |
require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
|
8 |
require_once WPSG_PATH_LIB.'FPDI_2.2.0/autoload.php';
|
9 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
9 |
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
|
10 |
|
10 |
|
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
11 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
12 |
|
12 |
|
- |
|
13 |
/** @var \wpsg\wpsg_invoice|null $oInvoice */
|
- |
|
14 |
$oInvoice = $this->view['oInvoice']??null;
|
- |
|
15 |
|
13 |
// Positionierung der Absenderadresszeile
|
16 |
// Positionierung der Absenderadresszeile
|
14 |
$absender_left = 25;
|
17 |
$absender_left = 25;
|
15 |
$absender_top = 50;
|
18 |
$absender_top = 50;
|
16 |
|
19 |
|
17 |
// Positionierung der Zieladress
|
20 |
// Positionierung der Zieladress
|
Line 45... |
Line 48... |
45 |
|
48 |
|
46 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
49 |
global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
|
47 |
|
50 |
|
48 |
$pdf->AddPage();
|
51 |
$pdf->AddPage();
|
49 |
|
52 |
|
50 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf")) {
|
53 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf")) {
|
51 |
|
54 |
|
52 |
$pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf");
|
55 |
$pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.pdf");
|
53 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
56 |
$tplidx = $pdf->importPage(1, '/MediaBox');
|
54 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
57 |
$pdf->useTemplate($tplidx, 0, 0, 210);
|
55 |
|
58 |
|
56 |
} else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg")) {
|
59 |
} else if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg")) {
|
57 |
|
60 |
|
58 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
61 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
|
59 |
|
62 |
|
60 |
}
|
63 |
}
|
61 |
|
64 |
|
62 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
|
65 |
if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg"))
|
63 |
{
|
66 |
{
|
64 |
|
67 |
|
65 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
|
68 |
list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg");
|
66 |
|
69 |
|
67 |
// Umrechnung von Inch zu Pixel
|
70 |
// Umrechnung von Inch zu Pixel
|
68 |
$wPix = (25.4 * (int)$width) / 96;
|
71 |
$wPix = (25.4 * (int)$width) / 96;
|
69 |
$hPix = (25.4 * (int)$height) / 96;
|
72 |
$hPix = (25.4 * (int)$height) / 96;
|
70 |
|
73 |
|
Line 87... |
Line 90... |
87 |
if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
|
90 |
if(isset($logo_pos) && $logo_pos === "left") { $abscissa = $leftPos; $ordinate = 20; }
|
88 |
if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
|
91 |
if(isset($logo_pos) && $logo_pos === "center") { $abscissa = $midPos; $ordinate = 20; }
|
89 |
if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
|
92 |
if(isset($logo_pos) && $logo_pos === "right") { $abscissa = $rightPos; }
|
90 |
|
93 |
|
91 |
$pdf->SetAlpha($alpha);
|
94 |
$pdf->SetAlpha($alpha);
|
92 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
|
95 |
$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getPaperPath', array())."wpsg_rechnungen_logo.jpg", $abscissa, $ordinate, $wPix, $hPix);
|
93 |
$pdf->SetAlpha(1);
|
96 |
$pdf->SetAlpha(1);
|
94 |
|
97 |
|
95 |
}
|
98 |
}
|
96 |
|
99 |
|
97 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
100 |
// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
|
98 |
$pdf->SetFont('Arial', '', 6);
|
101 |
$pdf->SetFont('Arial', '', 6);
|
99 |
$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));
|
102 |
$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']??0));
|
100 |
|
103 |
|
101 |
if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
104 |
if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
|
102 |
|
105 |
|
103 |
// Adresse des Kunden
|
106 |
// Adresse des Kunden
|
104 |
$pdf->SetFont('Arial', '', 12);
|
107 |
$pdf->SetFont('Arial', '', 12);
|
105 |
$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
|
108 |
$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']??'');
|
106 |
$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
|
109 |
$pdf->Text($adress_left, $adress_top + 5, ($shop->view['kunde']['vname']??'').' '.($shop->view['kunde']['name']??''));
|
107 |
$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['nr']));
|
110 |
$pdf->Text($adress_left, $adress_top + 10, ($shop->view['kunde']['strasse']??'').' '.($shop->view['kunde']['nr']??''));
|
108 |
$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
|
111 |
$pdf->Text($adress_left, $adress_top + 15, ($shop->view['kunde']['plz']??'').' '.($shop->view['kunde']['ort']??''));
|
109 |
|
112 |
|
110 |
if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
|
113 |
if ($shop->get_option("wpsg_mod_rechnungen_hideCountry") == '0') $pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));
|
111 |
|
114 |
|
112 |
// Rechnungsdaten
|
115 |
// Rechnungsdaten
|
113 |
$pdf->SetFont('Arial', 'B', 16);
|
116 |
$pdf->SetFont('Arial', 'B', 16);
|
Line 898... |
Line 901... |
898 |
|
901 |
|
899 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars);
|
902 |
$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset - 6, 5, $strBVars);
|
900 |
|
903 |
|
901 |
}
|
904 |
}
|
902 |
|
905 |
|
903 |
if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
|
- |
|
904 |
{
|
- |
|
905 |
|
- |
|
906 |
mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
|
- |
|
907 |
|
- |
|
908 |
}
|
- |
|
909 |
|
- |
|
910 |
$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
|
906 |
$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
|
911 |
|
907 |
|
912 |
$filename = $this->view['filename'].".pdf";
|
908 |
$filename = $this->view['filename'].".pdf";
|
913 |
|
909 |
|
914 |
ob_end_clean();
|
910 |
ob_end_clean();
|
Line 917... |
Line 913... |
917 |
|
913 |
|
918 |
$pdf->Output($filename, 'I');
|
914 |
$pdf->Output($filename, 'I');
|
919 |
|
915 |
|
920 |
} else {
|
916 |
} else {
|
921 |
|
917 |
|
922 |
$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, 'F');
|
918 |
$pdf->Output($oInvoice->getFilePath(), 'F');
|
923 |
|
919 |
|
924 |
// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
|
920 |
// Hier wird der Dateiname an FPD übergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument über die ID gespeichert ist.
|
925 |
if ($this->view['output'] === true) $pdf->Output($this->view['filename_out'], 'I');
|
921 |
if ($this->view['output'] === true) $pdf->Output($this->view['filename_out'], 'I');
|
926 |
|
922 |
|
927 |
}
|
923 |
}
|
928 |
|
924 |
|
929 |
?>
|
- |
|
930 |
|
925 |
|