vb_book/app/Views/invoice_pdf_template_old_design.php
2024-10-29 15:37:48 +05:30

388 lines
14 KiB
PHP
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
@page {
size: 148mm 210mm; /* Width Height */
}
/* Add your CSS styles here to format the invoice for mPDF */
td{
/* display: flex;
*/
/* align-items: flex-start; */
}
body {
font-family: 'Times New Roman', Times, sans-serif;
color : black !important;
font-size: 8pt;
/* Change this value to your desired font size */
}
/* Style for the main table with border */
table.main-table {
width: 100%;
margin-bottom: 1rem;
/* border-collapse: collapse; */
/* border: -0.5px solid black; */
/* Add a border around the entire invoice */
}
table.main-table th,
table.main-table td {
border: none;
/* Remove borders from all cells inside the main table */
/* padding: 8px; */
}
/* Style for the table containing business details */
table.business-details-table {
width: 100%;
}
table.business-details-table td {
text-align: left;
}
/* Style for the business logo and title */
.business-logo-container {
text-align: center;
}
img.business-logo {
max-width: 200px;
/* Adjust the size of the logo */
}
/* Style for the business name */
.business-name {
font-size: 16px;
font-weight: bold;
margin-top: 10px;
}
/* Style for the table containing invoice info */
table.invoice-info-table {
width: 100%;
border-collapse: collapse;
}
table.invoice-info-table th,
table.invoice-info-table td {
text-align: right;
padding: 8px;
}
/* Style for the addresses table */
table.addresses-table {
width: 100%;
}
table.addresses-table th {
text-align: left;
}
/* Style for the billing and shipping addresses */
.billing-address,
.shipping-address {
width: 50%;
}
/* Style for the invoice-related table */
table.invoice-related-table {
width: 100%;
border-collapse: collapse;
}
table.invoice-related-table th,
table.invoice-related-table td {
border: none;
/* Remove borders from all cells in the invoice items table */
padding: 8px;
/* text-align: center; */
/* Center-align text in cells */
}
table.invoice-related-table th {
/* background-color: #f2f2f2; */
background-color: #D0D0CD;
font-weight: bold;
}
/* Style for the business stamp and terms */
.business-stamp,
.terms {
text-align: center;
margin-top: 20px;
}
.subtotal-table {
width: 100%;
margin-top: 20px;
}
.subtotal-table table {
width: 100%;
border-collapse: collapse;
border: 1px solid black;
/* Add a border around the subtotal table */
}
.subtotal-table th,
.subtotal-table td {
border: none;
/* Remove borders from cells inside the subtotal table */
padding: 3px;
text-align: right;
}
.subtotal-table th {
background-color: #f2f2f2;
font-weight: bold;
}
.subtotal-table td:last-child {
font-weight: bold;
/* Make the last column (total values) bold */
}
td.invoice-number {
font-size: 18px;
/* Increase font size to your desired value */
/* Highlight background color */
font-weight: bold;
/* Make the text bold */
}
p {
margin-top: 0;
margin-bottom: 0rem;
}
.test-works p {
margin-left: 6px;
}
</style>
</head>
<body>
<table class="main-table">
<tr>
<td>
<table class="business-details-table">
<?php foreach ($data as $value) : ?>
<tr>
<td class="business-logo-container">
<img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo">
</td>
</tr>
<tr>
<td class="test-works">
<p> <?= $value->company_address ?>,<br>
<?= $value->company_city ?>,
<?= $value->company_state ?>
<?= $value->company_postal_code ? " - " . $value->company_postal_code : "" ?>.</p>
<p><?= $value->company_email ?></p>
<p ><?= $value->company_mobile_no ?></p>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
<td style="padding: 8px!important">
<table class="invoice-info-table">
<?php foreach ($data as $value) : ?>
<tr>
<th><?php echo ($value->wp_api_order_id) ? 'Order # ' . $value->invoice_number : 'Invoice # ' . $value->invoice_number; ?></th>
</tr>
<tr>
<th>Invoice Date : <?= $value->formatted_invoice_date ?></th>
</tr>
<?php if ($value->due_date) : ?>
<tr>
<th>Due Date : <?= $value->formatted_due_date ?></th>
</tr>
<?php endif; ?>
<?php if ($invoice_type === '2') : ?>
<?php foreach ($invoiceItems as $item) : ?>
<tr>
<th>From Subscription : <?= date('d/m/y', strtotime($item->from_subscription)) ?></th>
</tr>
<tr>
<th>To Subscription : <?= date('d/m/y', strtotime($item->to_subscription)) ?></th>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</td>
</tr>
</table>
<table class="addresses-table" style="margin-left: 7px;">
<tr>
<th class="billing-address">Billing Address</th>
<th class="shipping-address">Shipping Address</th>
</tr>
<tr>
<td class="billing-address">
<?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br>
<?php if($value->customer_bill_address && ($value->baddr_id !== null || $value->baddr_id !== '')){ ?>
<?= $value->customer_bill_address ? $value->customer_bill_address." ," : ""?><br>
<?= $value->customer_bill_city ? $value->customer_bill_city : "" ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_bill_postal_code ? " - " . $value->customer_bill_postal_code : ""; ?>
<?= $value->customer_bill_country ? $value->customer_bill_country . "." : $value->bcountry ?><br>
<?php }else if ($value->baddr_id === null || $value->baddr_id === '') {
echo $value->billing_address ? '<p style="white-space: pre-line">'.$value->billing_address.'</p>' : '';
} ?>
<?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php endforeach; ?>
</td>
<td class="shipping-address">
<?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br>
<?php if($value->customer_ship_address && ($value->saddr_id !== null || $value->saddr_id !== '')){ ?>
<?= $value->customer_ship_address ? $value->customer_ship_address." ," : "" ?><br>
<?= $value->customer_ship_city ? $value->customer_ship_city : "" ?>&nbsp;<?= $value->customer_ship_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_ship_postal_code ? " - " . $value->customer_ship_postal_code : ""; ?>
<?= $value->customer_ship_country ? $value->customer_ship_country . "." : $value->scountry ?><br>
<?php }else if ($value->saddr_id === null || $value->saddr_id === '') {
echo $value->shipping_address ? '<p style="white-space: pre-line">'.$value->shipping_address.'</p>' : '';
} ?>
<?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php endforeach; ?>
</td>
</tr>
</table>
<br> <br>
<table class="invoice-related-table">
<thead >
<tr>
<th>S.no</th>
<th style="text-align: left;">Item Name</th>
<th>Qty</th>
<th>Rate</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php $serialNumber = 1; ?>
<?php foreach ($invoiceItems as $item) : ?>
<tr>
<td style="display:flex;algin-items:flex-start">
<?= $serialNumber++; ?>
</td>
<td><span style="font-size:10pt"><?= $item->title ?></span><br>
<span ><?php if($item->description != ''){?><span style="font-size:6pt"><?php echo $item->description ?></span><?php }?></span>
</td>
<td style="align-content: flex-start;text-align: start;"><?= $item->quantity ?></td>
<td style="align-content: flex-start;text-align: start;">₹<?= number_format($item->unit_price, 2, '.', ',') ?></td>
<td style="align-content: flex-start;">₹<?= number_format($item->subtotal, 2, '.', ',') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<table class="subtotal-table">
<?php foreach ($data as $value) : ?>
<tr>
<td colspan="5" align="right">Subtotal : &nbsp;&nbsp;₹<?= number_format($value->subtotal, 2, '.', ',') ?></td>
</tr>
<tr>
<?php if($value->dis_type == "%"){
$dis_value = ($value->subtotal * $value->discount) / 100;
$dis_percent = '('.$value->discount.$value->dis_type.')';
}else{
$dis_value = $value->discount ? $value->discount : 0;
$dis_percent = '';
} ?>
<td colspan="5" align="right">Discount<?=$dis_percent;?> : &nbsp;&nbsp;<?= $dis_value ? "-₹". number_format($dis_value, 2, '.', ',') : "₹".number_format(0, 2, '.', ',') ?></td>
</tr>
<!-- -->
<?php if ($value->shipping_label != '') : ?>
<tr>
<td colspan="5" align="right"><?= $value->shipping_label ?> : &nbsp;&nbsp;₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<tr>
<?php
$sign = ($value->total_amount >= $value->exact_total_amount) ? '+' : '-';
$difference = abs($value->exact_total_amount - $value->total_amount);
?>
<td colspan="5" align="right"> Rounding : &nbsp;&nbsp;<?= $sign . number_format($difference, 2, '.', ',') ?></td>
</tr>
<tr>
<td colspan="5" align="right">Total : &nbsp;&nbsp;₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr>
<?php if ($value->status === 'Draft') : ?>
<!-- Set Balance if status is draft and paid is 0 -->
<tr>
<td colspan="5" align="right">Balance : &nbsp;&nbsp;₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<?php if ($value->status === 'Approved') : ?>
<tr>
<td colspan="5" align="right">Paid : &nbsp;&nbsp;₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
<div class="business-stamp">
</div>
<?php foreach ($data as $value) : ?>
<div class="terms">
<!-- <if(!empty($value->notes)){
<br><p style="text-align: left !important;"><b>Notes:</b> $value->notes; ?></p>
} ?> -->
<?php if (!empty($value->reason)) { ?>
<br>
<p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p>
<?php } ?>
<?php foreach ($invoiceTerms as $row) :
if (!empty($row->terms)) { ?>
<br>
<pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">
<?= $row->terms ?>
</pre>
<?php }
endforeach; ?>
</div>
<br>
<div class="" style="margin-left: 9px;margin-top: -135px;">
<h4 style="margin-bottom: 5px;">Bank Details</h4>
<?php echo nl2br($business['terms']); ?>
</div>
<?php endforeach; ?>
<!-- ... (your existing HTML template) -->
<!-- Add this to the end of your HTML template -->
<!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> -->
</body>
</html>