File: /var/www/html/video-rental/wp-content/themes/video-rental-old/invoices/affiliate-invoice.php
<?php
require_once('../../../../wp-load.php');
if (!current_user_can('manage_options')) {
wp_die('Access denied');
}
$affiliate_code = isset($_GET['code']) ? sanitize_text_field($_GET['code']) : '';
global $wpdb;
$transactions = $wpdb->get_results(
$wpdb->prepare(
"SELECT r.*, t.transaction_id, t.amount AS txn_amount, t.created_at, u.display_name, p.post_title
FROM wp_video_rentals r
LEFT JOIN wp_video_transactions t ON t.rental_id = r.id
LEFT JOIN $wpdb->users u ON u.ID = r.user_id
LEFT JOIN $wpdb->posts p ON p.ID = r.video_id
WHERE r.affiliate_code = %s",
$affiliate_code
)
);
$total = 0;
$rows = '';
$sl = 1;
foreach ($transactions as $txn) {
$total += floatval($txn->txn_amount);
$rows .= "<tr>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>{$sl}</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>{$txn->display_name}</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>" . date('M d, Y h:i A', strtotime($txn->created_at)) . "</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>{$txn->post_title}</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>$ {$txn->txn_amount}</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>{$txn->transaction_id}</td>
<td style='color: #ffffff; font-family: 'Ubuntu', sans-serif; font-size: 11px; font-weight: 400; padding: 19px 20px; background-color: #0E0E0E;'>Affiliate</td>
</tr>";
$sl++;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no">
<title>Invoice</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">
<style>
@page {
size: A4;
margin: 0 ;
}
</style>
</head>
<body style="margin: 0; background: #000000 !important;">
<div class="pdf-wrp" style="width: 100%; background-color: #000000 !important; padding:50px 0px;">
<header class="header" style="width: 100%;text-align: center;padding-top: 30px;padding-bottom: 20px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left; font-family: Arial, Helvetica, sans-serif; color: #F9B548; font-size: 30px; font-weight: bold; padding: 0 30px;">
Invoice
</td>
<td style="text-align: right; padding: 0 30px;">
<img style="width:81px; margin: 0; border: none; display: inline-block;" src="<?php echo get_template_directory_uri(); ?>/img/logo.svg" alt="">
</td>
</tr>
</table>
</header>
<div class="inner-wrp" style="padding: 0 30px;">
<!-- <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left; padding-bottom: 32px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630;">
<span style="display: block; margin-bottom: 2px;">Dalton Hwy</span>
<span style="display: block; margin-bottom: 2px;">United States</span>
<span style="display: block; margin-bottom: 2px;">99708</span>
</td>
<td style="text-align: left; padding-bottom: 32px; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630;"></td>
</tr>
<tr>
<td style="text-align: left; padding:15px 0; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630; vertical-align: top;">
<h4 style="display: block; font-weight: 700; font-size: 11px; color: #F9B548; margin-top: 0px; margin-bottom: 10px;">BILL TO</h4>
<span style="display: block; margin-bottom: 2px;">Dalton Hwy</span>
<span style="display: block; margin-bottom: 2px;">United States</span>
<span style="display: block; margin-bottom: 2px;">99708</span>
</td>
<td style="text-align: left; padding: 15px 0; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630; vertical-align: top;">
<h4 style="display: block; font-weight: 700; font-size: 11px; color: #F9B548; margin-top: 0px; margin-bottom: 10px;">SHIP TO</h4>
<span style="display: block; margin-bottom: 2px;">Dalton Hwy</span>
<span style="display: block; margin-bottom: 2px;">United States</span>
<span style="display: block; margin-bottom: 2px;">99708</span>
</td>
</tr>
<tr>
<td style="text-align: left; padding:15px 0; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630; vertical-align: top;">
<h4 style="display: block; font-weight: 500; font-size: 11px; color: #F9B548; margin-top: 0px; margin-bottom: 10px;">Payment Info: </h4>
<table width="200px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; padding: 2px;">
Account:
</td>
<td style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 11px; line-height: 15px; padding: 2px;">
1234 678 098 345
</td>
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; padding: 2px;">
A.C Name:
</td>
<td style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 11px; line-height: 15px; padding: 2px;">
Tony Stark
</td>
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; padding: 2px;">
Bank Detalis:
</td>
<td style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 11px; line-height: 15px; padding: 2px;">
Detalis
</td>
</tr>
</table>
</td>
<td style="text-align: left; padding: 15px 0; font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; border-bottom: 1px solid #10357630; vertical-align: top;">
<h4 style="display: block; font-weight: 500; font-size: 11px; color: #F9B548; margin-top: 0px; margin-bottom: 10px;">Invoice:</h4>
<table width="200px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; padding: 2px;">
No:
</td>
<td style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 11px; line-height: 15px; padding: 2px;">
1234 678 098 345
</td>
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; color: #ffffff; font-size: 11px; line-height: 15px; padding: 2px;">
Date:
</td>
<td style="font-family: Arial, Helvetica, sans-serif; color: #fff; font-size: 11px; line-height: 15px; padding: 2px;">
April 23, 2025
</td>
</tr>
</table>
</td>
</tr>
</table> -->
<div class="invoice-table" style="background-color: #000; border-radius: 12px 12px 0px 0px; display: block; margin-top: 50px; padding-bottom: 60px; border-bottom: 1px solid #10357630; margin-bottom: 40px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th width="40px" style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E; border-top-left-radius: 12px;">
Sl
</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E;">
User Name
</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E;">Date & Time</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E;">
Product Name
</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E;">
Transaction Amount
</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E; ">
Transaction ID
</th>
<th style="font-size: 10px; font-weight: 600;font-family: 'Ubuntu', sans-serif; color: #ffffff;; border-bottom: 1px solid #F6E1E4; padding: 19px 20px; text-align: left; background-color: #0E0E0E; border-top-right-radius: 12px;">
Type
</th>
</tr>
<tr>
</tr>
<tr>
<?php echo $rows ?: '<tr><td colspan="7">No transactions found</td></tr>'; ?>
</tr>
</table>
</div>
<div style="width: 100%; padding: 20px 0 60px;">
<table width="200px" align="right">
<tr>
<td style="color: #F9B548; font-size: 11px; text-align: right;">SubTotal:</td>
<td style="color: #fff; font-size: 11px; text-align: right;">$ <?php echo number_format($total, 2); ?></td>
</tr>
<tr>
<td style="color: #F9B548; font-size: 11px; font-weight: 700; text-align: right;">Total:</td>
<td style="color: #fff; font-size: 11px; font-weight: 700; text-align: right;">$ <?php echo number_format($total, 2); ?></td>
</tr>
</table>
<!-- <div style="clear: both;"></div>
<div style="margin-top: 40px;">
<p style="border-bottom: 1px solid #fff; width: 371px;"></p>
<p style="font-size: 12px;">Authorized sign</p>
</div> -->
</div>
</div>
</div>
</body>
</html>