| Server IP : 104.21.21.239 / Your IP : 216.73.217.123 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/tgnewprod/admin/classes/ |
Upload File : |
<?php
require_once('lcs_db_report_html.php');
class lcs_db_report_email extends lcs_db_report_html implements report_interface {
protected $html = '';
public function __construct() {
}
public function report_start()
{
$this->html .= '<html><head><title>' . APP_TITLE . ' Report</title>';
if ($_POST['orientation'] == 'L') :
$this->html .= '<style>';
$this->html .= 'table {width:10in!important;}';
$this->html .= '</style>';
endif;
$this->html .= '</head><body>';
$this->html .= '<table style="border-collapse: collapse; width: 100%;">';
}
public function report_end()
{
$this->html .= '</table></body></html>';
}
public function header_start()
{
$this->html .= '<thead>';
$this->html .= '<tr class="page_header">';
$this->html .= '<td colspan="99">';
$this->html .= '<div style="width:33%; float:left; font-size:12px; font-style:italic; text-align:left;" >';
$this->html .= APP_COMPANY;
$this->html .= '</div>';
$this->html .= '<div style="width:34%; float:left; font-size:12px; font-style:italic; text-align:center;" >' . APP_TITLE . '</div>';
$this->html .= '<div style="width:33%; float:left; font-size:12px; font-style:italic; text-align:right;" >';
$this->html .= 'Date: '.date('m/d/Y');
$this->html .= '</div>';
$this->html .= '</td>';
$this->html .= '</tr>';
$this->html .= '<tr class="page_header"><td colspan="99"> </td></tr>';
$this->html .= '<tr class="page_header"><td colspan="99" align="center" style="font-size:20px;">'.htmlspecialchars($this->get_report_title()).'</td></tr>';
$this->html .= '<tr class="page_header"><td colspan="99"> </td></tr>';
}
public function header_end()
{
$this->html .= '</thead>';
}
public function header_row_start()
{
$this->html .= '<tr>';
}
public function header_row_end()
{
$this->html .= '</tr>';
}
public function header_cell_add($data = '', $args = [])
{
$attr = '';
$args['style'] = 'color: #FFFFFF; background-color: #000000; border: 1px solid #000; padding: 6px; vertical-align: top; ' . ($args['style'] ?? '');
foreach ($args as $key => $value) :
$attr .= ' '.$key.'="'.$value.'"';
endforeach;
$this->html .= '<th '.$attr.' >'.$data.'</th>';
}
public function footer_start()
{
$this->html .= '<tfoot>';
}
public function footer_end()
{
$this->html .= '<tr class="page_header"><td colspan="99"> </td></tr>';
$this->html .= '<tr class="page_header"><td colspan="99">';
$this->html .= '<div style="width:33%; float:left; font-size:12px; font-style:italic; text-align:left;" >'.date('m/d/Y').'</div>';
$this->html .= '<div style="width:33%; float:left; font-size:12px; font-style:italic; text-align:center;" > </div>';
$this->html .= '<div style="width:33%; float:left; font-size:12px; font-style:italic; text-align:right;" >';
$this->html .= 'User: '.$_SESSION['user_full_name'];
$this->html .= '</div></td></tr>';
$this->html .= '</tfoot>';
}
public function footer_row_start()
{
$this->html .= '<tr>';
}
public function footer_row_end()
{
$this->html .= '</tr>';
}
public function footer_cell_add($data = '', $args = [])
{
$attr = '';
foreach ($args as $key => $value) :
$attr .= ' '.$key.'="'.$value.'"';
endforeach;
$this->html .= '<td '.$attr.' >'.$data.'</td>';
}
public function data_start()
{
$this->html .= '<tbody>';
}
public function data_end()
{
$this->html .= '</tbody>';
}
public function data_row_start()
{
$this->html .= '<tr>';
}
public function data_row_end()
{
$this->html .= '</tr>';
}
public function data_cell_add($data = '', $args = [])
{
$attr = '';
$args['style'] = 'border: 1px solid #000; padding: 6px; vertical-align: top; ' . ($args['style'] ?? '');
foreach ($args as $key => $value) :
$attr .= ' '.$key.'="'.$value.'"';
endforeach;
$this->html .= '<td '.$attr.' >'.$data.'</td>';
}
public function output_report($filename = '')
{
if (empty($_POST['email_to'])) :
echo '<h2>Email recipient(s) not provided.</h2>';
return;
endif;
$attachments = [];
if (!empty($_POST['email_attachment']) && !empty($_POST['email_attachment_path'])) :
$attachments[] = $_POST['email_attachment_path'];
endif;
if (send_mail(APP_TITLE . ' - ' . $this->get_report_title(), $_POST['email_to'], '', '', $this->html, $attachments)) :
echo '<h2>Message has been sent.</h2>';
else :
echo '<h2>Error - message could not be sent.</h2>';
endif;
}
}