403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wcfs/tabs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/export_daily_totals_pdf.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require __DIR__ . '/vendor/autoload.php';
require 'db.php';use Fpdf\Fpdf;

$start = $_GET['start'] ?? date('Y-m-01');
$end = $_GET['end'] ?? date('Y-m-d');

// Query daily totals
$stmt = $conn->prepare("
    SELECT DATE(date) as transaction_date, 
           SUM(quantity * price) as total_amount, 
           SUM(CASE WHEN taxable = 1 THEN quantity * price * 0.082 ELSE 0 END) as total_tax
    FROM transactions
    WHERE DATE(date) BETWEEN ? AND ?
    GROUP BY transaction_date
    ORDER BY transaction_date ASC
");
$stmt->bind_param("ss", $start, $end);
$stmt->execute();
$result = $stmt->get_result();

class PDF extends Fpdf
{
    function Header()
    {
        $this->SetFont('Arial', 'B', 16);
        $this->Cell(0, 10, 'Daily Totals Report', 0, 1, 'C');
        $this->Ln(5);
    }

    function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('Arial', 'I', 8);
        $this->Cell(0, 10, 'Page ' . $this->PageNo(), 0, 0, 'C');
    }
}

$pdf = new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(0, 10, "Date Range: $start to $end", 0, 1, 'C');
$pdf->Ln(5);

$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(50, 10, 'Date', 1);
$pdf->Cell(50, 10, 'Total Amount', 1);
$pdf->Cell(50, 10, 'Total Tax', 1);
$pdf->Ln();

$pdf->SetFont('Arial', '', 12);
while ($row = $result->fetch_assoc()) {
    $pdf->Cell(50, 10, $row['transaction_date'], 1);
    $pdf->Cell(50, 10, '$' . number_format($row['total_amount'], 2), 1);
    $pdf->Cell(50, 10, '$' . number_format($row['total_tax'], 2), 1);
    $pdf->Ln();
}

$pdf->Output('D', 'daily_totals_report.pdf');
exit;
?>

Youez - 2016 - github.com/yon3zu
LinuXploit