File: /var/www/unbox/uc-live/admin-dash/txn_receipt.php
<?php
include_once('../wp-config.php');
global $wpdb;
$id = $_REQUEST['id'];
// query to get invoice receipt as per id
$invoiceData = $wpdb->get_row("SELECT * FROM unbox_invoice where invoice_id=$id");
if ($invoiceData->customer_state_id == 36) {
$amount = $invoiceData->product_mrp;
$taxable_amount = $invoiceData->taxable_amount;
$total_amount = $taxable_amount;
$igst_amount = 0;
$cgst_amount = $invoiceData->cgst_amount;
$sgst_amount = $invoiceData->sgst_amount;
$grand_amount = round(($taxable_amount + $cgst_amount + $sgst_amount), 1);
} else {
$cgst_amount = 0;
$sgst_amount = 0;
$amount = $invoiceData->product_mrp;
$taxable_amount = $invoiceData->taxable_amount;
$total_amount = $taxable_amount;
$igst_amount = $invoiceData->igst_amount;
$grand_amount = round(($taxable_amount + $igst_amount), 1);
}
?>
<script type="text/javascript">
function printReport(divName) {
var printContents = document.getElementById(divName).innerHTML;
document.title = "\u00A0";
var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
disp_setting += "scrollbars=no,left=0,top=0,resizable=yes,width=950, height=650,";
var docprint = window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html dir="<%=_direction %>"><head><title></title>');
//For Adding the proper StyleSheet
docprint.document.write('</head><body>');
docprint.document.write(printContents);
docprint.document.write("</b" + "ody></html>");
docprint.print();
docprint.close();
window.close();
}
</script>
<body>
<table width="100%" border="0">
<tr>
<td style=" text-align:right;">
<a href="#" class="btn btn-primary no-print" name="print" onClick="printReport('print_area')">
<img src="https://unboxcatalysts.com/admin-dash/assets/images/printer-circle-blue-512.webp" alt="print-icon" />
</a>
</td>
</tr>
</table>
<div id="print_area">
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
@media only screen and (max-width: 600px) {
.mob {
min-width: 100px;
}
.center_border {}
}
td,
th {
text-align: left;
padding: 4px;
font-size: 11px;
}
@media only screen and (max-width: 600px) {
.box {
width: 100% !important;
margin: auto !important;
}
}
.box {
border: 1px solid #000;
background: #f1f1f1;
width: 90%;
margin: 0 auto;
}
.image {
padding: 2px 0 0;
display: block;
margin-left: auto;
width: 16%;
margin-right: auto;
}
.title {
text-align: center;
margin-bottom: 0.5em;
margin-top: 10px;
text-transform: uppercase;
background: #fff;
padding: 5px 0;
border-top: 2px solid #000;
font-family: arial;
font-size: 15px;
letter-spacing: 1px;
border-bottom: 2px solid #000;
color: #000;
}
.title2 {
text-align: center;
margin-bottom: 0.5em;
margin-top: 10px;
text-transform: uppercase;
background: #fff;
padding: 5px 0;
border-top: 2px solid #000;
font-family: arial;
font-size: 15px;
letter-spacing: 1px;
border-bottom: 2px solid #000;
color: #000;
}
@media only screen and (max-width: 600px) {
.align_right {
position: absolute;
top: 16em;
left: 10px;
}
.total {
font-size: 10px !important;
}
.title {
text-align: center;
font-size: 14px;
}
.title2 {
text-align: center;
font-size: 16px;
margin-top: 5.5em;
}
.image {
padding: 8px 10px 0;
display: block;
width: 20%;
}
.invoice {
position: absolute;
top: 20em;
left: 10px;
}
.supply {
position: absolute;
left: 0.7em;
top: 33.5em;
}
.state {
position: absolute;
left: 13.9em;
top: 33.5em;
}
.marmob {
margin-top: 2em;
}
.marmob2 {
margin-top: 0em;
}
.indat {
position: absolute;
top: 18em;
left: 9.6em;
}
.tran {
position: absolute;
top: 18em;
left: 10px;
}
.trandat {
position: absolute;
top: 16em;
left: 9.6em;
}
.datdat {
position: absolute;
top: 14em;
left: 9.6em;
}
.tax_invoice {
position: absolute !important;
left: 3em !important;
top: 16.9em !important;
}
.line {
margin-top: 7em !important;
}
.linetwo {
margin-top: 1em !important;
}
}
.align_right {
text-align: right;
}
.pad {
text-align: right;
padding-right: 6px;
}
.tax_invoice {
font-family: arial;
display: inline-block;
background: #fff;
padding: 5px 5em;
position: absolute;
top: 13.4em;
left: 29em;
border: 3px solid #000;
}
.line {
height: 4px;
background: #000;
margin-top: 1em;
}
.linetwo {
height: 2px;
background: #000;
margin-top: 1em;
}
.ltd {
margin-top: 0px;
margin-bottom: 0px;
font-size: 12px;
font-family: arial;
padding-left: 9px;
}
.address {
margin-top: 5px;
font-size: 11px;
font-family: arial;
padding: 0 8px;
}
.font_size {
font-size: 11px;
}
.font_size2 {
float: right;
font-size: 11px;
}
.table_row {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
color: #000;
}
.center {
font-size: 12px;
text-align: center;
padding: 10px;
}
.second_row {
background: #e0d6d6;
font-weight: bolder;
}
.center_border {
border-bottom: 1px solid;
font-size: 12px;
border-right: 1px solid;
text-align: center;
padding: 10px;
}
.third_row {
font-weight: bolder;
}
.weight {
font-weight: 100;
text-align: right;
padding: 10px;
}
.bolder {
font-weight: bolder;
}
.total {
margin-bottom: 10px;
text-align: right;
padding-right: 5px;
font-family: arial;
font-size: 10px;
margin-top: -10px;
}
.weight_100 {
font-weight: 100;
}
.footer_title {
margin-bottom: 0px;
text-align: center;
text-transform: uppercase;
padding-right: 5px;
font-family: arial;
font-size: 15px;
margin-top: -8px;
}
.footer_title2 {
text-align: center;
text-transform: capitalize;
padding-right: 5px;
font-family: arial;
font-size: 12px;
margin-top: 5px;
margin-bottom: 0px;
}
.sign {
margin-bottom: -10px;
text-align: right;
font-weight: 200;
padding-right: 5px;
font-family: arial;
font-size: 15px;
margin-top: 0px;
}
.signi {
width: 100px;
padding: 10px;
}
.sign2 {
padding: 0;
border-right: none;
float: right;
}
#print_area {
width: 100%;
}
td img {
position: absolute;
right: 23em;
top: 16px;
width: 50px;
}
</style>
<div class="box">
<div>
<img src="/wp-content/themes/unbox_c/images/logo/unbox-logo.png" class="image" alt="logo">
<h4 class="title">UNBOX CATALYSTS PRIVATE LIMITED</h4>
<table>
<tr>
<td class="mob">PAN No. : AACCU9245Q</td>
<td class="align_right">DATE : <?php echo date('d-M-Y', strtotime($invoiceData->transaction_date)); ?></td>
</tr>
<tr>
<td class="mob">GSTIN : 07AACCU9245Q1ZK</td>
<td class="align_right tran">TRANSACTION ID : <?php echo $invoiceData->transaction_id1; ?></td>
</tr>
<tr>
<td class="mob">CIN : U72900DL2021PTC386947</td>
<td class="align_right invoice">INVOICE : <?php echo $invoiceData->invoice_id . " / " . $invoiceData->year_extn; ?></td>
</tr>
</table>
<h4 class="title2">TAX INVOICE</h4>
<h4 class="ltd"><?php echo $invoiceData->customer_name; ?></h4>
<p class="address"><?php echo $invoiceData->customer_address; ?></p>
<table>
<tr>
<th class="font_size">GSTIN : <?php echo $invoiceData->customer_gstin; ?></th>
<th class="font_size2 supply">Place of Supply : <?php echo $invoiceData->customer_state_name; ?></th>
</tr>
</table>
<table class="marmob">
<tr class="table_row">
<th class="center_border">QTY</th>
<th class="center_border">DESCRIPTION</th>
<th class="center_border">SAC</th>
<th style="border-right:none;" class="center_border">TOTAL</th>
</tr>
<tr class="second_row">
<td class="center_border">1</td>
<?php if ($invoiceData->source == 'M') { ?>
<td class="center_border"><?php echo $invoiceData->ref_id3; ?></td>
<?php } else { ?>
<td class="center_border"><?php echo $invoiceData->transaction_type; ?></td>
<?php } ?>
<td class="center_border"><?php if ($extn == "WDR") {
echo "998315";
} else {
echo "999293";
} ?> </td>
<td style="border-right:none;" class="center_border"><?php echo number_format($total_amount, 2); ?></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<table class="marmob2">
<tr class="table_row">
<th class="center_border">TAXABLE VALUE</th>
<th class="center_border">SGST<br>@9%</th>
<th class="center_border">CGST<br>@9%</th>
<th class="center_border">IGST<br>@18%</th>
<th style="border-right:none;" class="center_border">GRAND TOTAL</th>
</tr>
<tr class="second_row">
<td class="center_border"><?php echo number_format($total_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($sgst_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($cgst_amount, 2); ?></td>
<td class="center_border"><?php echo number_format($igst_amount, 2); ?></td>
<td style="border-right:none;" class="center_border"><?php echo number_format($grand_amount, 2); ?></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<table>
<tr>
<th></th>
</tr>
</table>
<h4 class="total">Total In Words: <?php echo convertToIndianCurrency($grand_amount); ?>
<?php
function convertToIndianCurrency($number)
{
$no = round($number);
$decimal = round($number - ($no = floor($number)), 2) * 100;
$digits_length = strlen($no);
$i = 0;
$str = array();
$words = array(
0 => '',
1 => 'One',
2 => 'Two',
3 => 'Three',
4 => 'Four',
5 => 'Five',
6 => 'Six',
7 => 'Seven',
8 => 'Eight',
9 => 'Nine',
10 => 'Ten',
11 => 'Eleven',
12 => 'Twelve',
13 => 'Thirteen',
14 => 'Fourteen',
15 => 'Fifteen',
16 => 'Sixteen',
17 => 'Seventeen',
18 => 'Eighteen',
19 => 'Nineteen',
20 => 'Twenty',
30 => 'Thirty',
40 => 'Forty',
50 => 'Fifty',
60 => 'Sixty',
70 => 'Seventy',
80 => 'Eighty',
90 => 'Ninety'
);
$digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore');
while ($i < $digits_length) {
$divider = ($i == 2) ? 10 : 100;
$number = floor($no % $divider);
$no = floor($no / $divider);
$i += $divider == 10 ? 1 : 2;
if ($number) {
$plural = (($counter = count($str)) && $number > 9) ? 's' : null;
$str[] = ($number < 21) ? $words[$number] . ' ' . $digits[$counter] . $plural : $words[floor($number / 10) * 10] . ' ' . $words[$number % 10] . ' ' . $digits[$counter] . $plural;
} else {
$str[] = null;
}
}
$Rupees = implode(' ', array_reverse($str));
$paise = ($decimal) ? "And " . ($words[$decimal - $decimal % 10]) . " Paise" . ($words[$decimal % 10]) : '';
return ($Rupees ? 'Rupees ' . $Rupees : '') . $paise . " Only";
}
?>
</h4>
<!-- <h4 class="total"><span class="weight_100">For</span> Graposs Edutech Pvt. Ltd.</h4> -->
<table>
<tr>
<th></th>
<th></th>
<th></th>
<!-- <th class="sign2"><img class="signi" src="https://lh3.googleusercontent.com/-tHsyXr6i2N4/Wv1eVDs8QoI/AAAAAAAABdQ/8mIbm77Ql3kZg4nmfb16Ih3Z46K04RFlgCL0BGAYYCw/h76/2018-05-17.png"></th> -->
</tr>
</table>
<h4 class="sign">
<!-- <img class="signi" src="https://mail.google.com/mail/u/0?ui=2&ik=a8c5826bd0&attid=0.1.1&permmsgid=msg-f:1600707380328931942&th=1636dae1a9da2266&view=fimg&sz=w1600-h1000&attbid=ANGjdJ_bOSkQUwKuuVIfSrfWU4mHzM-DlKHtW2LP11erWlixyGCcGzgEwwzYd12_TG047Sl48qL8bBzz_-dpqBSkQ4JBYfVgXCbEaACCz38Nh-PiuTJiWVd4MhP2a_8&disp=emb"> -->
Authorized Signatory
</h4>
<hr class="linetwo">
<h4 class="footer_title">UNBOX CATALYSTS PRIVATE LIMITED</h4>
<h4 class="footer_title2">Regd. Office: UNBOX CATALYSTS PRIVATE LIMITED, 1/22, 2nd Floor, Asaf Ali road, New Delhi - 110002</h4>
<h4 class="footer_title2">Phone Number: 011-41038474 / 49066459</h4>
<div>
</div>
</div>
</div>
</div>