| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?php
- require_once '/var/www/html/custom/settlements/dompdf/autoload.inc.php';
- use Dompdf\Dompdf;
- use FontLib\Table\Type\head;
- class SettlementsPDFPrint
- {
- public $htmlTemplate = '';
- public function __construct($htmlContent = '')
- {
- $this->htmlTemplate = $htmlContent;
- }
- public function generateSettlementsPDF($userinvoice = null)
- {
- $dompdf = new Dompdf();
- $options = $dompdf->getOptions();
- $dompdf->set_option('defaultFont', 'DejaVu Sans');
- $dompdf->setOptions($options);
- $html = '
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <style type="text/css">
- * { font-family: "DejaVu Sans" !important; }
- </style>
- </head>
- <body>';
- $html .= $this->htmlTemplate;
- $html .= '<script type="text/php"><?=$PAGE_NUM?></script></body></html>';
- $dompdf->loadHtml($html, 'UTF-8');
- $dompdf->setPaper('A4', 'portrai');
- $dompdf->render();
- $fname = time() . '_' . uniqid();
- $filename = $fname . '.pdf';
- $directory_path = '/var/www/html/documents/settlements/pdf/';
- //$custompath = date('Y') . '/' . date('m') . '/' .
- if (!is_dir($directory_path)) {
- mkdir($directory_path, 0775, true);
- chmod($directory_path, 0775);
- }
- if (is_null($userinvoice)) {
- $full_path = $directory_path . $filename;
- } else {
- $full_path = $directory_path . $userinvoice . '/' . $filename;
- }
- $pdf_gen = $dompdf->output();
- file_put_contents($full_path, $pdf_gen);
- //$dompdf->stream($fname,array("Attachment"=>0));
- return $full_path;
- }
- public function generateCommissionSettlementsPDF()
- {
- $dompdf = new Dompdf();
- $options = $dompdf->getOptions();
- $dompdf->set_option('defaultFont', 'DejaVu Sans');
- $dompdf->setOptions($options);
- $html = '
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <style type="text/css">
- * { font-family: "DejaVu Sans" !important; }
- </style>
- </head>
- <body>';
- $html .= $this->htmlTemplate;
- $html .= '<script type="text/php"><?=$PAGE_NUM?></script></body></html>';
- $dompdf->loadHtml($html, 'UTF-8');
- $dompdf->setPaper('A4', 'portrai');
- $dompdf->render();
- $fname = time() . '_' . uniqid();
- $filename = $fname . '.pdf';
- $directory_path = '/var/www/html/documents/settlements/pdf/commissionsettlements/';
- if (!is_dir($directory_path)) {
- mkdir($directory_path, 0775, true);
- chmod($directory_path, 0775);
- }
- //$custompath = date('Y') . '/' . date('m') . '/' .
- $full_path = $directory_path . $filename;
- $pdf_gen = $dompdf->output();
- file_put_contents($full_path, $pdf_gen);
- //$dompdf->stream($fname,array("Attachment"=>0));
- return $full_path;
- }
- public function generateDailyClosuingCheckoutClosurePDF()
- {
- $dompdf = new Dompdf();
- $options = $dompdf->getOptions();
- $dompdf->set_option('defaultFont', 'DejaVu Sans');
- $dompdf->setOptions($options);
- $html = '
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <style type="text/css">
- * { font-family: "DejaVu Sans" !important; }
- </style>
- </head>
- <body>';
- $html .= $this->htmlTemplate;
- $html .= '<script type="text/php"><?=$PAGE_NUM?></script></body></html>';
- $dompdf->loadHtml($html, 'UTF-8');
- $dompdf->setPaper('A4', 'portrai');
- $dompdf->render();
- $fname = time() . '_' . uniqid();
- $filename = $fname . '.pdf';
- $directory_path = '/var/www/html/documents/settlements/pdf/dailyclosingcheckoutclosure/';
- //$custompath = date('Y') . '/' . date('m') . '/' .
- $full_path = $directory_path . $filename;
- $pdf_gen = $dompdf->output();
- file_put_contents($full_path, $pdf_gen);
- //$dompdf->stream($fname,array("Attachment"=>0));
- return $full_path;
- }
- public function generateVoucherPDF()
- {
- $dompdf = new Dompdf();
- $options = $dompdf->getOptions();
- $dompdf->set_option('defaultFont', 'DejaVu Sans');
- $dompdf->setOptions($options);
- $html = '
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <style type="text/css">
- * { font-family: "DejaVu Sans" !important; }
- </style>
- </head>
- <body>';
- $html .= $this->htmlTemplate;
- $html .= '<script type="text/php"><?=$PAGE_NUM?></script></body></html>';
- $dompdf->loadHtml($html, 'UTF-8');
- $dompdf->setPaper('A4', 'portrai');
- $dompdf->render();
- $fname = 'voucher_' . time() . '_' . uniqid();
- $filename = $fname . '.pdf';
- $directory_path = '/var/www/html/documents/voucher/pdf/voucher/';
- if (!is_dir($directory_path)) {
- mkdir($directory_path, 0775, true);
- chmod($directory_path, 0775);
- }
- //$custompath = date('Y') . '/' . date('m') . '/' .
- $full_path = $directory_path . $filename;
- $pdf_gen = $dompdf->output();
- file_put_contents($full_path, $pdf_gen);
- //$dompdf->stream($fname,array("Attachment"=>0));
- return $full_path;
- }
- }
|