ria/app/Views/po_pdf.php
2024-11-15 15:23:05 +05:30

861 lines
33 KiB
PHP
Executable File

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.text-center {
text-align: center;
}
.text-right {
text-align: right
}
a {
color: #375bc8;
text-decoration: underline
}
body {
position: relative;
width: 100%;
height: 29.7cm;
margin: 0 auto;
color: #3A3A3A;
background: #FFFFFF;
font-family: sans-serif;
font-size: 0.8em
}
header {
padding: 0px 0;
margin-right: -30px;
margin-bottom: 0px
}
footer {
color: #878686;
width: 100%;
border-top: 2px solid #878686;
padding: 5px 0
}
main {
padding: 0em 0;
margin-right: -30px;
margin-bottom: 0em
}
table.item-table {
width: 100%;
border-spacing: 0;
margin-bottom: 0em;
font-size: 1em;
}
table.item-table tr:nth-child(2n-1) th {
background: #ddd
}
table.item-table th {
padding: 0.625em 0.3125em;
border-bottom: 0.0625em solid #606060;
text-align: left
}
table.item-table th.text-right {
text-align: right
}
table.item-table td {
padding: 0.625em 0.3125em;
font-size: 1em;
}
table.item-table tr td,
table.item-table tr th {
page-break-inside: avoid !important;
}
.no-border {
border-top: none !important;
border-bottom: none !important;
}
#logo {
text-align: right;
}
#invoice-logo {
max-width: 14em !important;
max-height: 10em !important;
margin-bottom: 1em;
text-align: right
}
#client {
float: left;
width: 100%;
font-size: 1em
}
#logo img {
display: block !important;
margin: 3.75em auto !important;
}
@media print{
/* .GST-table table { page-break-inside: avoid !important;} */
/* .item-table { page-break-after: auto !important; } */
} </style>
</head>
<body>
<?php
if (!empty($AmendmentPDF) && isset($AmendmentPDF[0]->parentpostatus) && $AmendmentPDF[0]->parentpostatus == 'ST030') {
$pdftitle = "AMENDMENT PURCHASE ORDER";
} else {
$pdftitle = "PURCHASE ORDER";
}
$CompanyName = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->CompanyName)) ? $CompanyDetails[0]->CompanyName : "-";
$CompanyAddress = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->Address)) ? $CompanyDetails[0]->Address : "-";
$companyEmail = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->EmailAddress)) ? $CompanyDetails[0]->EmailAddress : "-";
$companyGst = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->GSTNO)) ? $CompanyDetails[0]->GSTNO : "-";
$companyPan = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->PAN)) ? $CompanyDetails[0]->PAN : "-";
$companyWebsit = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->companyWebsite)) ? $CompanyDetails[0]->companyWebsite : "-";
$CompanyStateCode = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->StateCode)) ? $CompanyDetails[0]->StateCode : "-";
$companyMsme = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->MSME)) ? $CompanyDetails[0]->MSME : "-";
$address = preg_replace('/SURVEY\s*:\s*[^,]+,/', '', $CompanyAddress);
$currencyCode = (!empty($CurrencySymbol) && !empty($CurrencySymbol[0]->FontCode2000)) ? $CurrencySymbol[0]->FontCode2000 : "-";
$PONO = (!empty($GetPoFormat) && !empty($GetPoFormat[0]->PONO)) ? $GetPoFormat[0]->PONO : "-";
$POType = (!empty($POItem) && !empty($POItem[0]->POType)) ? $POItem[0]->POType : "-";
$postatus = (!empty($POItem) && !empty($POItem[0]->Status)) ? $POItem[0]->Status : "-";
$SuplierName = (!empty($POItem) && !empty($POItem[0]->SupplierName)) ? $POItem[0]->SupplierName : "-";
$SuplierAddress = (!empty($POItem) && !empty($POItem[0]->Address)) ? $POItem[0]->Address : "-";
$DeliveryAddress = (!empty($POItem) && !empty($POItem[0]->DeliveryAddress)) ? $POItem[0]->DeliveryAddress : "-";
$SplserviceDescription = (!empty($POItem) && !empty($POItem[0]->ServiceDescription)) ? $POItem[0]->ServiceDescription : "-";
$SplserviceDescription = ($POType == 'SERVICE') ? $POItem[0]->Description_Of_Service : $SplserviceDescription;
$supRef = (!empty($POItem) && !empty($POItem[0]->Supplier_Reference)) ? $POItem[0]->Supplier_Reference : "-";
$supOfferNo = (!empty($POItem) && !empty($POItem[0]->Supplier_Offer_No)) ? $POItem[0]->Supplier_Offer_No : "-";
$supplierEmail = (!empty($POItem) && !empty($POItem[0]->EmailAddress)) ? $POItem[0]->EmailAddress : "-";
$supplierGst = (!empty($POItem) && !empty($POItem[0]->GSTNO)) ? $POItem[0]->GSTNO : "-";
$supplierPan = (!empty($POItem) && !empty($POItem[0]->PAN)) ? $POItem[0]->PAN : "-";
$supplierMsme = (!empty($POItem) && !empty($POItem[0]->MSME)) ? $POItem[0]->MSME : "-";
$supplierContact = (!empty($POItem) && !empty($POItem[0]->ContactNumber)) ? $POItem[0]->ContactNumber : "-";
$serviceDescription = (!empty($POItem) && !empty($POItem[0]->Description_Of_Service)) ? $POItem[0]->Description_Of_Service : "-";
$supplierVendor = (!empty($POItem) && !empty($POItem[0]->SupplierID)) ? $POItem[0]->SupplierID : "-";
$ourRef = (!empty($POItem) && !empty($POItem[0]->Other_Reference)) ? $POItem[0]->Other_Reference : "-";
$dispatch = (!empty($POItem) && !empty($POItem[0]->Import_DispatchDetails)) ? $POItem[0]->Import_DispatchDetails : "";
$advance = (!empty($POItem) && !empty($POItem[0]->AdvanceAmount)) ? $POItem[0]->AdvanceAmount : "-";
$modShp = (!empty($POItem) && !empty($POItem[0]->Mode_Of_Shipment)) ? $POItem[0]->Mode_Of_Shipment : "-";
$insNo = (!empty($POItem) && !empty($POItem[0]->InsuranceNumber)) ? $POItem[0]->InsuranceNumber : 'No';
$PaymentTerms = (!empty($POItem) && !empty($POItem[0]->PaymentTerms)) ? ($POItem[0]->PaymentTerms == 'Others' ? $POItem[0]->PaymentOtherDescription : $POItem[0]->PaymentTerms) : "";
$purchaseorderDate = (!empty($POItem) && !empty($POItem[0]->PODate)) ? new DateTime($POItem[0]->PODate, new DateTimeZone('Asia/Kolkata')) : "";
$poDate = $purchaseorderDate ? $purchaseorderDate->format('d-m-Y') : "-";
$IsOpenOrder = (!empty($POItem) && !empty($POItem[0]->IsOpenOrder)) ? $POItem[0]->IsOpenOrder : "";
$DeliveryDate = "";
$DeliverySchedule = "";
if (!empty($POItem) && !empty($POItem[0]->DeliveryOption)) {
if ($POItem[0]->DeliveryOption == 1) {
$DeliverySchedule = $POItem[0]->DeliverySchedule;
} else if ($POItem[0]->DeliveryOption == 0 && !empty($POItem[0]->DeliveryDate)) {
$dtDe = new DateTime($POItem[0]->DeliveryDate, new DateTimeZone('Asia/Kolkata'));
$DeliveryDate = $dtDe ? $dtDe->format('d-m-Y') : "";
}
}
$RequistionNo = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['RequistionNo'])) ? $RequistionDetails[0]['RequistionNo'] : "-";
$ReqDate = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['ReqDate'])) ? $RequistionDetails[0]['ReqDate'] : "";
// $RequestedDept = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['RequestedDept'])) ? $RequistionDetails[0]['RequestedDept'] : "-";
// $CostCenterCode = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['CostCenterCode'])) ? $RequistionDetails[0]['CostCenterCode'] : "-";
$costCenterName = $costCenterDetails[0]->CostCenterName ?? '-';
$releasedBy = (!empty($releasedetails) && !empty($releasedetails[0]->FirstName)) ? $releasedetails[0]->FirstName : "-";
$releasedDt = (!empty($releasedetails) && !empty($releasedetails[0]->ReleasedOn)) ? new DateTime($releasedetails[0]->ReleasedOn, new DateTimeZone('Asia/Kolkata')) : "";
$releasedOn = $releasedDt ? $releasedDt->format('d-m-Y') : "-";
$invoice_discount_percent = '0.00';
$invoice_discount_amount = '0.00';
$rowCount = count($POItem);
$minTableHeightEm = 100;
if ($rowCount <= 5) {
$rowHeightEm = $minTableHeightEm / $rowCount;
} else {
$rowHeightEm = 100 / 16;
}
?>
<?php $parent_invoice_number = "testing001"; ?>
<?php
$totalCGST = 0;
$totalSGST = 0;
$totalIGST = 0;
$invoiceTotalBasic = 0;
$invoiceTotalAmount = 0;
$invoiceTotalAmountInWords = '-';
// For Converting number to words
function convertNumber($amt)
{
$ShowPaise = '0';
$totalAmt = explode(".", $amt);
$number = $totalAmt[0];
$no = $number;
if (!empty($totalAmt[1]) && $totalAmt[1] != 0) {
$point = $totalAmt[1];
$ShowPaise = '1';
} else {
$point = 0;
$ShowPaise = '0';
}
$hundred = null;
$digits_1 = 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_1) {
$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) ? '' : null;
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
$str[] = ($number < 21) ? $words[$number] .
" " . $digits[$counter] . $plural . " " . $hundred
:
$words[floor($number / 10) * 10]
. " " . $words[$number % 10] . " "
. $digits[$counter] . $plural . " " . $hundred;
} else $str[] = null;
}
$str = array_reverse($str);
$result = implode('', $str);
$points = ($point) ?
" " . $words[$point / 10] . " " .
$words[$point = $point % 10] : '';
if ($ShowPaise == '0') {
$amountInWords = "Rupees " . $result . " Only";
} else {
$amountInWords = "Rupees " . $result . " Paise " . $points . " Only";
}
return $amountInWords;
}
?>
<header class="clearfix">
<table width="100%" class="text-center">
<tr>
<td><b>
<h1><?= $pdftitle; ?></h1>
</b> </td>
</tr>
</table>
<div style="text-align: right;"><small>RI/PUR/R 02</small></div>
<table border="1" style="border-collapse: collapse;" width="100%">
<tr>
<td rowspan="5" style="border-right: none; text-align: center;" width="30%">
<div id="logo"><?php echo invoice_logo_pdf(); ?></div>
</td>
<td rowspan="5" style="border-left: none; border-right: none;" width="50%">
<p style="font-size:1em;"><b><?php $CompanyName ? _htmlsc($CompanyName) : ""; ?></b></p>
<?php if ($CompanyAddress) {
echo '<div>' . htmlsc($CompanyAddress) . ' ' . '</div>';
} ?>
<?php
if ($companyEmail || $companyWebsit || $companyGst || $companyPan || $companyMsme) {
// if ($companyPhone) {
// echo '<div>'.trans('Phone') . ': ' . htmlsc($companyPhone).','.'</div>';
// }
if ($companyEmail !== '' && $companyEmail !== '-') {
echo '<div><b>' . trans('Email') . '</b> : ' . htmlsc($companyEmail) . '</div>';
}
if ($companyWebsit !== '' && $companyWebsit !== '-') {
echo '<div><b>' . trans('Website') . '</b> : ' . htmlsc($companyWebsit) . '</div>';
}
if ($companyGst !== '' && $companyGst !== '-') {
echo '<div><b>' . trans('GST') . '</b> : ' . htmlsc($companyGst) . '</div>';
}
if ($companyMsme !== '' && $companyMsme !== '-') {
echo '<div><b>' . trans('MSME') . '</b> : ' . htmlsc($companyMsme) . '</div>';
}
if ($companyPan !== '' && $companyPan !== '-') {
echo '<div><b>' . trans('PAN') . '</b> : ' . htmlsc($companyPan) . '</div>';
}
}
?>
</td>
<td colspan="2" style="border-left: none; text-align: center; vertical-align: middle;">
<?php if ($postatus == PO_DRAFT) { ?>
<p style="font-size:1.2em;"><b><?php _htmlsc("DRAFT"); ?></b></p>
<?php } ?>
<?php if ($IsOpenOrder) { ?>
<p style="font-size:1.2em;"><b><?php _htmlsc("OPEN ORDER"); ?></b></p>
<?php } ?>
</td>
</tr>
</table>
</header>
<main>
<table border="1" style="border-collapse: collapse; font-size: 1em; width: 100%;">
<tr>
<td width="50%">
<table border="1" style="border-collapse: collapse; width: 100%;">
<tr>
<td style="border:0em;"><?php echo trans('Purchase Order No'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo htmlsc($PONO); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Purchase Order Date'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo $poDate; ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Supplier`s Offer No'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($supOfferNo); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Our Reference'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($ourRef); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Delivery/Schedule By'); ?></td>
<td style="border:0em;"><?php echo (empty($DeliveryDate) && empty($DeliverySchedule) && empty($dispatch)) ? ': -' : ': ' . $DeliveryDate . $DeliverySchedule . $dispatch; ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Email'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($supplierEmail); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Cost Center'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($costCenterName); ?></td>
</tr>
</table>
</td>
<td width="50%">
<table border="1" style="border-collapse: collapse; width: 100%;">
<tr>
<td style="border:0em;"><?php echo trans('Req Number'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($RequistionNo); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Date of Supply'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo $ReqDate; ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('State Code'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($CompanyStateCode); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Mode of Shipment'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($modShp); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Insurance'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($insNo); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Released By'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($releasedBy); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Released On'); ?></td>
<td style="border:0em;"><?php echo ': ';
echo _htmlsc($releasedOn); ?></td>
</tr>
</table>
</td>
</tr>
</table>
<table border="1" style="border-collapse: collapse; font-size: 1em; width: 100%;">
<tr style="background: #ddd; border-top: none; border-bottom: none;">
<td colspan="3" width="50%"><b>Shipped From</b></td>
<td colspan="3" width="50%"><b>Shipped To</b></td>
</tr>
<tr>
<td colspan="3" width="50%">
<table id="client" border="1" style="border-collapse: collapse; width: 100%;">
<tr>
<td style="border:0em;"><?php echo trans('Name'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo '<b>' . htmlsc($SuplierName) . '</b>'; ?></td>
</tr>
<tr>
<td style="border:0em; vertical-align: top;"><?php echo trans('Address'); ?></td>
<td style="border:0em; vertical-align: top;" class="text-right">:</td>
<td style="border:0em;">
<p><?php echo nl2br(htmlsc($SuplierAddress)); ?></p>
</td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('GST'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($supplierGst); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('MSME'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($supplierMsme); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('PAN'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($supplierPan); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('Vendor Code'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($supplierVendor); ?></td>
</tr>
</table>
</td>
<td colspan="3" width="50%">
<table id="client" border="1" style="border-collapse: collapse; width: 100%;">
<tr>
<td style="border:0em;"><?php echo trans('Name'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo '<b>' . htmlsc($CompanyName) . '</b>'; ?></td>
</tr>
<tr>
<td style="border:0em; vertical-align: top;"><?php echo trans('Address'); ?></td>
<td style="border:0em; vertical-align: top;" class="text-right">:</td>
<td style="border:0em;"><?php echo nl2br(htmlsc($address)); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('GST'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($companyGst); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('MSME'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($companyMsme); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('PAN'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($companyPan); ?></td>
</tr>
<tr>
<td style="border:0em;"><?php echo trans('State Code'); ?></td>
<td class="text-right" style="border:0em;">:</td>
<td style="border:0em;"><?php echo htmlsc($CompanyStateCode); ?></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="item-table" style="border-collapse: collapse;" border="1" width="100%">
<thead>
<tr>
<th rowspan="2" style="width: 1.5625em; text-align: center; vertical-align: middle;">
<center><?php _trans('S.No'); ?></center>
</th>
<th rowspan="2" colspan="2" style="text-align: center; vertical-align: middle;">
<center><?php _trans('Name of Product /'); ?><br /><?php _trans('Service'); ?></center>
</th>
<th rowspan="2" style="white-space: nowrap;">
<center><?php _trans('HSN'); ?></center>
</th>
<!-- <th rowspan="2" style="white-space: nowrap;"><center><?php _trans('UOM'); ?></center></th> -->
<th rowspan="2" style="width: 3.125em; text-align: center; vertical-align: middle;">
<center><?php _trans('Qty'); ?></center>
</th>
<th rowspan="2" style="white-space: nowrap;">
<center><?php _trans('Rate'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
<th rowspan="2" style="white-space: nowrap;">
<center><?php _trans('Total'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
<th colspan="2" style="white-space: nowrap;">
<center><?php _trans('CGST'); ?></center>
</th>
<th colspan="2" style="white-space: nowrap;">
<center><?php _trans('SGST'); ?></center>
</th>
<th colspan="2" style="white-space: nowrap;">
<center><?php _trans('IGST'); ?></center>
</th>
<th rowspan="2" style="white-space: nowrap;">
<center><?php _trans('Total Tax'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
</tr>
<tr style="background: #ddd;">
<th>
<center><?php _trans('Rate'); ?><br /><?php _trans('%'); ?></center>
</th>
<th>
<center><?php _trans('Amount'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
<th>
<center><?php _trans('Rate'); ?><br /><?php _trans('%'); ?></center>
</th>
<th>
<center><?php _trans('Amount'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
<th>
<center><?php _trans('Rate'); ?><br /><?php _trans('%'); ?></center>
</th>
<th>
<center><?php _trans('Amount'); ?><br /> <?php echo $currencyCode; ?></center>
</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$basic = [];
$cgst = [];
$sgst = [];
$igst = [];
$tax = [];
if (!empty($POItem)) {
// print_r($POItem);die;
foreach ($POItem as $item) { ?>
<tr>
<td class="text-center no-border"><?php echo $i++; ?></td>
<td colspan="2" class="no-border" style="width:12.5em">
<?php if ($POType == REVENUE) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName . $item->ServiceMaterialDescription);
} ?>
<?php if ($POType == SERVICE) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName ? $item->MaterialName : $item->ServiceMaterialDescription);
} ?>
<?php if ($POType == IMPORT) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName);
} ?>
<?php if ($POType == CAPITAL) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName);
} ?>
</td>
<td class="text-right no-border"><?php echo $item->HSNCODE ?? 'N/A'; ?></td>
<td class="text-right no-border"><?php if ((int)$item->Quantity > 0) {
echo number_alignment($item->Quantity);
if ($item->Per) : ?>
<small><?php _htmlsc($item->Per); ?></small>
<?php endif;
} else if ((int)$item->Quantity == 0) {
echo "xxx";
} ?>
</td>
<td class="text-right no-border"><?php echo number_alignment($item->Rate); ?></td>
<td class="text-right no-border"><?php echo number_alignment(abs($item->BasicValue)); ?></td>
<td class="text-right no-border"><?php if(isset($item->CGST) && $item->CGST != '' ){ _htmlsc($item->CGST); }else{ echo 0; } ?></td>
<td class="text-right no-border"><?php if (isset($item->AfterCGST) && $item->AfterCGST != '') {
echo number_alignment(abs($item->AfterCGST));
} else {
echo '0.00';
} ?></td>
<td class="text-right no-border"><?php if(isset($item->SGST) && $item->SGST != '' ){ _htmlsc($item->SGST); }else{ echo 0; } ?></td>
<td class="text-right no-border"><?php if (isset($item->AfterSGST) && $item->AfterSGST != '') {
echo number_alignment(abs($item->AfterSGST));
} else {
echo '0.00';
} ?></td>
<td class="text-right no-border"><?php if(isset($item->IGST) && $item->IGST != '' ){ _htmlsc($item->IGST); }else{ echo 0; } ?></td>
<td class="text-right no-border"><?php if (isset($item->AfterIGST) && $item->AfterIGST != '') {
echo number_alignment(abs($item->AfterIGST));
} else {
echo '0.00';
} ?></td>
<td class="text-right no-border" style="vertical-align: middle;"><?php
$totalwithtax = (isset($item->Taxamount) ? $item->Taxamount : 0 ) + $item->BasicValue;
echo number_alignment(abs($totalwithtax));
?></td>
</tr>
<?php
$basic[] = $item->BasicValue;
$cgst[] = isset($item->AfterCGST) ? $item->AfterCGST : 0.00;
$sgst[] = isset($item->AfterSGST) ? $item->AfterSGST : 0.00;
$igst[] = isset($item->AfterIGST) ? $item->AfterIGST : 0.00;
$Insurance[] = isset($item->Insurance) ? $item->Insurance : 0.00;
$tax[] = $totalwithtax;
$invoiceTotalAmount = round($item->TotalOrderValue);
?>
<?php }
}
// else {
// echo "<tr><td colspan='14' class='text-center'>No items available.</td></tr>";
// }
$remaining_rows = max(15 - count($POItem), 0);
for ($j = 0; $j < $remaining_rows; $j++) { ?>
<tr>
<td class="text-center no-border"></td>
<td colspan="2" style="width:12.5em" class="no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>&nbsp;
<td style="text-align: right;" colspan="6"><strong>&nbsp;TOTAL</strong></td>
<td class="text-right"><?php echo number_alignment(abs(array_sum($basic))); ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if ($cgst) {
echo number_alignment(abs(array_sum($cgst)));
} ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if ($sgst) {
echo number_alignment(abs(array_sum($sgst)));
} ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if ($igst) {
echo number_alignment(abs(array_sum($igst)));
} ?></td>
<td class="text-right"><b><?php echo number_alignment(abs(array_sum($tax))); ?></b></td>
</tr>
</tfoot>
</table>
<table class="GST-table" border="1" style="border-collapse: collapse; font-size: 1em; width: 100%; page-break-inside: avoid !important;">
<tr>
<td colspan="6" style="border-bottom: none;">
<?php
$k = 0;
if (!empty($POItem)) {
foreach ($POItem as $x) {
if ($x->ParentPO != '' && isset($record->lineamenddetails) && count($record->lineamenddetails) > 1) {
// if ($x->ParentPO != '') {
$k++;
}
}
}
if ($k > 0) { ?>
<table style="border-collapse: collapse;border-left-style:hidden;border-right-style:hidden;" cellpadding="0" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td class="text-center" colspan="3">
<p>Amended Details</p>
</td>
</tr>
<tr>
<td colspan="3">
<?php
if (!empty($POItem)) {
foreach ($POItem as $v) {
echo "<b>" . $v->AmendedDetails . "</b>";
break;
}
} ?>
</td>
</tr>
<tr>
<td class="text-center"><strong>Item Description</strong></td>
<td class="text-center" rowspan="2"><strong>Current Details</strong></td>
<td class="text-center" rowspan="2"><strong>Revised Details</strong></td>
</tr>
<?php if (!empty($POItem)) {
foreach ($POItem as $record) {
echo $record->lineamenddetails ;
}
}
?>
<tr>
<td style="text-align: center;"><strong>Total</strong></td>
<td style="text-align: center;" rowspan="2"><b>Current Total Order :<?php echo $AmendmentPDF[0]->partenttotalorder ?></b></td>
<td style="text-align: center;" rowspan="2"><b>Revised Total Order :<?php echo $AmendmentPDF[0]->TotalOrderValue ?></b></td>
</tr>
</tbody>
</table>
<?php echo "</br>"; } ?>
<p style="text-align: center; margin: 0;"><strong>TOTAL AMOUNT IN WORDS :</strong>&nbsp;&nbsp;</p>
<p style="text-align: center; margin: 0;">
<?php
$invoiceTotalBasic = array_sum($basic);
if ($invoiceTotalAmount > 0) {
$invoiceTotalAmountInWords = convertNumber(abs(round($invoiceTotalAmount)));
}
echo $invoiceTotalAmountInWords; ?>
</p>
<?php if($PaymentTerms) { ?>
<br>
<p style="text-align: left; margin: 0;"><strong>Payment Terms :</strong>&nbsp;&nbsp;<?php echo $PaymentTerms; ?></p>
<?php } ?>
<br>
<p style="text-align: left; margin: 0;"><strong>Special Instructions :</strong>&nbsp;&nbsp;<?php echo $SplserviceDescription; ?></p>
</td>
</td>
<td colspan="9">
<table id="client" border="1" style="border-collapse: collapse; width: 100%;">
<tr>
<td class="text-right" style="border:0em;"><?php _trans('Total Amount Before Tax '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(abs($invoiceTotalBasic)); ?></td>
</tr>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('CGST '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(abs(array_sum($cgst))); ?></td>
</tr>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('SGST '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(abs(array_sum($sgst))); ?></td>
</tr>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('IGST '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(abs(array_sum($igst))); ?></td>
</tr>
<?php $AfterPackagingValue = []; $AfterFreightValue= []; $AfterDiscount =[];
if(isset($reveuetax)){ ?>
<?php foreach ($reveuetax as $key => $value) {
$AfterPackagingValue[] = isset($value->AfterPackagingValue) ? $value->AfterPackagingValue : 0.00;
$AfterFreightValue[] = isset($value->AfterFreightValue) ? $value->AfterFreightValue : 0.00;
$AfterDiscount[] = isset($value->AfterDiscount) ? $value->AfterDiscount : 0.00;
} ?>
<?php if(array_sum($AfterPackagingValue) != 0){ ?>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('Packaging '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(array_sum($AfterPackagingValue)); ?></td>
</tr>
<?php } ?>
<?php if(array_sum($AfterFreightValue) != 0){ ?>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('Freight '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(array_sum($AfterFreightValue)); ?></td>
</tr>
<?php } ?>
<?php if(array_sum($AfterDiscount) != 0){ ?>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('Discount '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo '-'.number_alignment(array_sum($AfterDiscount)); ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php if(array_sum($Insurance) != 0){ ?>
<tr>
<td class="text-right" style="border:0em;"><?php _trans('Insurance '); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_alignment(array_sum($Insurance)); ?></td>
</tr>
<?php } ?>
<tr>
<?php $invoiceTotalGST = array_sum($cgst) + array_sum($sgst) + array_sum($igst); ?>
<?php $differences = ($invoiceTotalGST + array_sum($Insurance) + $invoiceTotalBasic); ?>
<?php if(isset($reveuetax)){ $differences = ($differences + array_sum($AfterPackagingValue) + array_sum($AfterFreightValue)) - array_sum($AfterDiscount); }?>
<?php $roundOf = $invoiceTotalAmount - $differences; ?>
<td class="text-right" style="border:0em;"><?php _trans('Round Off'); ?></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><?php echo number_format($roundOf, 2); ?></td>
</tr>
<tr>
<td class="text-right" style="border:0em;"><b><?php _trans('Total Amount'); ?></b></td>
<td class="text-right" style="border:0em;"><?php echo $currencyCode; ?></td>
<td class="text-right" style="border:0em;"><b><?php echo number_alignment(abs($invoiceTotalAmount)); ?></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="6" style="border-top: none; border-bottom: none;">
<div class="notes">
<p><b>Note:</b> Please acknowledge receipt of this order for acceptance<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Material to be delivered to our stores before 3pm<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Please refer order number and item code in your challan/invoice</p>
</div>
</td>
<td style="text-align:center;" colspan="9">
<div style="text-align:center;"><?php echo authorized_signatory(); ?></div>
<div>
<h6 style="text-align:center;">Authorized Signatory</h6>
</div>
</td>
</tr>
<tr>
<td colspan="15" style="text-align:center;">Declaration: We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct</td>
</tr>
</table>
<table width="100%" class="text-center">
<tr>
<td><b><small>This is a system generated purchase order</small></b> </td>
</tr>
</table>
</main>
</body>
</html>