CHANGES_po mpf : ps

This commit is contained in:
VE10-Sanjeev 2024-05-17 13:39:31 +00:00
parent 11358c8c3d
commit bbb89d27e6
11 changed files with 803 additions and 25 deletions

4
.gitignore vendored
View File

@ -103,8 +103,8 @@ php_errors.log
/app/Views/*.tmp
# Ignore Composer files
/vendor/*
!/vendor/.gitkeep
vendor/*
!vendor/.gitkeep
composer.lock
# Ignore environment-specific settings

View File

@ -290,22 +290,95 @@ class Purchaseorder extends BaseController
{
$PONO = $this->request->getVar('PONO');
// print_r($PONO);
$ReqType = $this->request->getVar('ReqType');
// print_r($ReqType);
$this->poprint($PONO);
if ($ReqType == SERVICE) {
$this->servicepoprint($PONO);
} else if ($ReqType == REVENUE) {
$this->revenuepoprint($PONO);
} else if ($ReqType == IMPORT) {
$this->importpoprint($PONO);
} else if ($ReqType == CAPITAL) {
$this->CapitalPoPrint($PONO);
}
// if ($ReqType == SERVICE) {
// $this->servicepoprint($PONO);
// } else if ($ReqType == REVENUE) {
// $this->revenuepoprint($PONO);
// } else if ($ReqType == IMPORT) {
// $this->importpoprint($PONO);
// } else if ($ReqType == CAPITAL) {
// $this->CapitalPoPrint($PONO);
// }
}
public function poprint($PONO)
{
// Load all views as normal
//$PONO = $this->request->getVar('PO');
$PoStatus = '';
$data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO);
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF();
$data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO);
$data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO);
$data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO);
$data['CurrencySymbol'] = $this->purchaseorder_model->GerCurrencyCodeName('INR');
$data['reveuetax'] = $this->purchaseorder_model->getRevenueTaxinforforpdf($PONO);
$data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO);
$Currencycode = '';
$TotalOrderValue = $data['POItem'][0]->TotalOrderValue;
$AdvanceAmount = 0.00;
foreach ($data['POItem'] as $POI) {
$AdvanceAmount = $POI->AdvanceAmount;
$PoStatus = $POI->Status;
}
$TotaltoPay = 0.00;
$TotaltoPay = $TotalOrderValue - $AdvanceAmount;
$totalAmt = sprintf("%.2f", $TotalOrderValue);
$data['TotalAmountInWords'] = $this->convertNumber($totalAmt);
$data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO);
$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8',
'format' => 'A4',
'default_font' => 'sans-serif',
'orientation' => 'P']);
// Set PDF properties
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data['CompanyDetails'][0]->CompanyName);
$mpdf->SetCreator('Venba');
// Generate the PDF content (HTML)
// if ($PoStatus == PO_RELEASED || $PoStatus == PO_SERVICE_COMPLETED || $PoStatus == MRIR_APPROVED || $PoStatus == MRIR_REJECTED || $PoStatus == IGR_CREATED || $PoStatus == '' || $PoStatus == SPECIAL_PO) {
// $mpdf->SetWatermarkText('');
// } else {
// $mpdf->SetWatermarkText('DRAFT');
// }
// Set auto margins
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
// Set HTML header
// $HtmlHeading = view('includes/pdfheader', $data);
// $mpdf->SetHTMLHeader($HtmlHeading);
// Set HTML body
// $html = view('pdf_view', $data);
// $mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
$html = view('po_pdf', $data);
$mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
// Set HTML footer
// $HTMLFooter = view('includes/pdffooter', $data);
// $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
// Output PDF
$mpdf->Output('POReport' . $PONO . '.pdf', 'D');
}

View File

@ -54,8 +54,6 @@ class User extends BaseController
log_message('error', '#####Dashboard session name : ' . $this->session->get('name'));
$this->global['pageTitle'] = 'Dashboard';
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
$data['UserCount'] = $this->dahsboard_Model->getUserCount();
@ -1217,7 +1215,7 @@ class User extends BaseController
$this->global['pageTitle'] = 'Delivery Performance';
if ($this->request->getPost('btn_submit')) {
$ab = $this->request->getPost('financialyear');
$ab = (string)$this->request->getPost('financialyear');
$fa = substr($ab, 0, -5);
$aa = substr($ab, 5, 5);
@ -1583,7 +1581,7 @@ class User extends BaseController
}
// curl_close($ch);
// }
} catch (Exception $e) {
} catch (\Exception $e) {
$data['err'] = $e->getMessage();
$data['last_query'] = $this->db->getLastQuery();
$Zohobook_model->customInsert($data, 'zohobook_api_err');

79
app/Helpers/cias_helper.php Normal file → Executable file
View File

@ -53,4 +53,81 @@ if (!function_exists('generateCopyrightNotice')) {
return " Copyright © $current_year ";
}
}
}
}
function format_currency($amount)
{
if ($amount) {
// Ensure the number has two decimal places
$number = number_format($amount, 2, '.', '');
// Split the number into integer and decimal parts
$numberParts = explode('.', $number);
$integerPart = $numberParts[0];
$decimalPart = isset($numberParts[1]) ? $numberParts[1] : '00';
// Format the integer part with commas according to the Indian numbering system
$lastThree = substr($integerPart, -3);
$restUnits = substr($integerPart, 0, -3);
if (strlen($restUnits) > 0) {
$formattedInteger = preg_replace('/\B(?=(\d{2})+(?!\d))/', ',', $restUnits) . ',' . $lastThree;
} else {
$formattedInteger = $lastThree;
}
return $formattedInteger . '.' . $decimalPart;
}
return "0.00";
}
if (!function_exists('htmlsc')) {
function htmlsc($output)
{
return htmlspecialchars($output, ENT_QUOTES);
}}
if (!function_exists('_htmlsc')) {
function _htmlsc($output)
{
echo htmlspecialchars($output, ENT_QUOTES);
}}
if (!function_exists('_htmle')) {
function _htmle($output)
{
echo htmlentities($output);
}}
if (!function_exists('_trans')) {
function _trans($line, $id = '', $default = null)
{
echo trans($line, $id, $default);
}}
if (!function_exists('trans')) {
function trans($line, $id = '', $default = null)
{
// Load the Language service
$lang = service('language');
// Get the translation
$lang_string = $lang->getLine($line);
// Fall back to default language if translation is not found
if (empty($lang_string)) {
$lang->setLocale('english'); // Set the default locale
$lang_string = $lang->getLine($line);
}
// Fall back to the $line value if the default language has no translation either
if (empty($lang_string)) {
$lang_string = $default ?? $line;
}
if ($id != '') {
$lang_string = '<label for="' . $id . '">' . $lang_string . '</label>';
}
return $lang_string;
}
}

View File

@ -143,6 +143,22 @@ if (!function_exists('get_shorten_financial_year')) {
}
}
if (!function_exists('date_from_mysql')) {
function date_from_mysql($date, $ignore_post_check = false)
{
if ($date !== '0000-00-00') {
if (!$ignore_post_check) {
$dateObj = DateTime::createFromFormat('Y-m-d', $date);
$retDate = $dateObj->format('Y-m-d');
return $retDate;
}
return $date;
}
return '';
}
}
if (!function_exists('add_one_hour_date')) {
function add_one_hour_date($dateString) {
$date = new DateTime($dateString);

File diff suppressed because one or more lines are too long

0
app/Helpers/session_helper.php Normal file → Executable file
View File

0
app/Helpers/zohobook_helper.php Normal file → Executable file
View File

View File

@ -340,7 +340,7 @@ function synczohobooks(){
var options = {
width: 600, height: 250,
redFrom: 00, redTo: 20,
redFrom: 0, redTo: 20,
yellowFrom:20, yellowTo: 50,
greenFrom:50, greenTo: 100,
minorTicks: 5
@ -532,7 +532,7 @@ function synczohobooks(){
var options = {
width: 600, height: 250,
redFrom: 00, redTo: 20,
redFrom: 0, redTo: 20,
yellowFrom:20, yellowTo: 50,
greenFrom:50, greenTo: 100,
minorTicks: 5
@ -680,9 +680,11 @@ $('#datepick').change(function() {
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner">
<h3>44</h3>
<?php $users = isset($UserCount[0]->users) ? $UserCount[0]->users : 0 ;?>
<h3><?= $users; ?></h3>
<p>User Registrations</p>
<?php $employees = isset($EmpCount[0]->EmpCount) ? $EmpCount[0]->EmpCount : 0 ;?>
<?php echo $employees > 1 ? '<small>' . $employees . ' Employees </small>' : ($employees == 1 ? '<small>' . $employees . ' Employee</small>' : ''); ?>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
@ -700,11 +702,14 @@ $('#datepick').change(function() {
<!-- small box -->
<a href=" javascript:void(0)" type="button" class="btn btn-success" onclick="synczohobooks()">Sync With Zoho Books</a>
<?php //echo session()->getFlashdata('error'); ?>
<br/>
<!-- <br/>
<a class="btn btn-success" href="<?php echo base_url(); ?>pdf/preview" target="_blank">MPDF preview</a>
<br/>
<a class="btn btn-success" href="<?php echo base_url(); ?>pdf/download">MPDF Download</a>
<br/>
<br/>
<a class="btn btn-success" href="<?php echo base_url(); ?>pdf/po" target="_blank">PO preview</a> -->
</div>

View File

@ -247,7 +247,7 @@ if (!empty($getlogpodtl)) {
var insuranceno = '<?php echo $insurenceno; ?>';
var statuscheck = '<?php echo $PONOStatus; ?>';
$(document).ready(function() {
alert('capital-');
//alert('capital-');
if (statuscheck == "<?php echo SPECIAL_PO; ?>") {
$('#splpodiv').show();
// var js_array =<?php echo json_encode($billfile); ?>;

595
app/Views/po_pdf.php Executable file
View File

@ -0,0 +1,595 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.center {text-align: center;}
.clearfix:after{content:"";display:table;clear:both}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}
main{padding:0px 0;margin-right:-30px;margin-bottom:0px}#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}.invoice-details{text-align:right}.invoice-details table{border-collapse:collapse;border-spacing:0;text-align:right;width:100%;margin:0 0 0 auto;font-size:1em}.invoice-details table td{width:100%;margin:0;padding:0 0 0.5em 0}table.item-table{width:100%;border-spacing:0;margin-bottom:0px;font-size:1em}table.item-table tr:nth-child(2n-1) th{background:#ddd}table.item-table th{padding:10px 5px;border-bottom:1px solid #606060;white-space:nowrap;text-align:left}table.item-table th.text-right{text-align:right}table.item-table td{padding:10px 5px;font-size:1em;}table.item-table .invoice-sums{text-align:right}footer{color:#878686;width:100%;border-top:2px solid #878686;padding:5px 0}.text-right{text-align:right}.text-red{color:#ea5340}.text-green{color:#77b632}
#logo img{display: block !important;margin: 60px auto !important;}
#page_break { page-break-before: always; }
</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 : "-";
$currencyName = 'INR';
$currencyCode = (!empty($CurrencySymbol) && !empty($CurrencySymbol[0]->FontCode2000)) ? $CurrencySymbol[0]->FontCode2000 : "-";
$PONO = (!empty($GetPoFormat) && !empty($GetPoFormat[0]->PONO)) ? $GetPoFormat[0]->PONO : "-";
$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 : "-";
$ServiceDescription = (!empty($POItem) && !empty($POItem[0]->ServiceDescription)) ? $POItem[0]->ServiceDescription : "-";
$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 : "-";
$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 : "-";
$finCap = (!empty($POItem) && !empty($POItem[0]->Fincap)) ? $POItem[0]->Fincap : "-";
$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') : "-";
if(!empty($POItem) && !empty($POItem[0]->DeliveryOption)){
if ($POItem[0]->DeliveryOption == 1) {
$DeliverySchedule = $PO->DeliverySchedule;
$DeliveryDate = "";
} 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') : "";
$DeliverySchedule = "";
}
}else{
$DeliveryDate = "-";
$DeliverySchedule = "-";
}
$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'] : "-";
$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' ;
?>
<?php $parent_invoice_number = "testing001"; ?>
<?php
$totalCGST=0;
$totalSGST=0;
$totalIGST=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;
}
?>
<?php
function convertNumbersforextra($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="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:16px;"><b><?php _htmlsc($CompanyName); ?></b></p>
<?php if ($CompanyAddress) {
echo '<div>'.htmlsc($CompanyAddress) .' '.'</div>';
} ?>
<?php
if ($companyEmail || $companyWebsit || $companyGst || $companyPan ) {
// if ($companyPhone) {
// echo '<div>'.trans('Phone') . ': ' . htmlsc($companyPhone).','.'</div>';
// }
if ($companyEmail) {
echo '<div><b>'.trans('Email') . '</b> : ' . htmlsc($companyEmail).'</div>';
}
if ($companyWebsit ) {
echo '<div><b>'.trans('Website') . '</b> : ' . htmlsc($companyWebsit ).'</div>';
}
if ($companyGst ) {
echo '<div><b>'.trans('GSTIN') . '</b> : ' . htmlsc($companyGst ).'</div>';
}
if ($companyPan ) {
echo '<div><b>'.trans('PAN') . '</b> : ' . htmlsc($companyPan ).'</div>';
}
}
?>
</td>
<td colspan="2" style="border-left: none;">
<?php if($postatus == PO_DRAFT){ ?>
<p style="font-size:0.8em; text-align : right"><b><?php _htmlsc("DRAFT"); ?></b></p> <?php } ?>
</td>
</tr>
</table>
</header>
<main>
<table class="tablepadding" border="1" style="border-collapse: collapse;font-size:1em;" width="100%">
<tr>
<td colspan="2" width="50%">
<table class="tablepadding" border="1" style="border-collapse: collapse;" >
<tr><td style="border:0px;"> <?php echo trans(' Purchase Order No / Date'); ?></td><td style="border:0px;"><?php echo ': ';echo htmlsc($PONO ) . ' / ' . date_from_mysql($poDate , true);?></td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Supplier`s Offer No') ; ?></td><td style="border:0px;"><?php echo ': ';echo _htmlsc($supOfferNo); ?></td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Our Reference') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($ourRef); ?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' State Code') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($CompanyStateCode)?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Delivery/Schedule By') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo $DeliveryDate . $DeliverySchedule . $dispatch; ?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Contact') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($supRef)?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Email') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($supplierEmail)?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Mode of Shipment') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($modShp)?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans(' Insurance') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($insNo)?> </td></tr>
</table>
</td>
<td colspan="2" width="50%">
<table class="tablepadding" border="1" style="border-collapse: collapse;" >
<tr><td style="border:0px;"> <?php echo trans('Req Number ') ; ?> </td><td style="border:0px;"><?php echo ': ';echo _htmlsc($RequistionNo) ?></td></tr>
<tr><td style="border:0px;"> <?php echo trans('Date of Supply ') ; ?> </td><td style="border:0px;"> <?php echo ': '.date_from_mysql($ReqDate , true); ?></td></tr>
<tr><td style="border:0px;"> <?php echo trans('Dept') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($RequestedDept);?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans('CCD'); ?></td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($CostCenterCode);?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans('Fin cap') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($finCap); ?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans('Payment Terms') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($PaymentTerms); ?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans('Released By') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($releasedBy); ?> </td></tr>
<tr><td style="border:0px;"> <?php echo trans('Released On') ; ?> </td><td style="border:0px;"> <?php echo ': ';echo _htmlsc($releasedOn); ?> </td></tr>
</table>
</td>
</tr>
</table>
<table class="tablepadding" border="1" style="border-collapse: collapse;font-size:1em;" width="100%">
<tr style="background: #ddd; border-top: none; border-bottom: none;">
<td colspan="2" width="50%"><b>Shipped From</b></td>
<td colspan="2" width="50%"><b>Shipped To</b></td>
</tr>
<tr>
<td colspan="2" width="50%">
<table id="client" class="tablepadding" border="1" style="border-collapse: collapse;" >
<tr>
<td style="border:0px;"> <?php echo trans('Name');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($SuplierName) ; ?> </td>
</tr>
<tr>
<td style="border:0px;"> <?php echo 'Address <br><br><br><br>';?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($SuplierAddress).'<br>'; ?>
</td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('GSTIN');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($supplierGst) ; ?> </td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('PAN');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($supplierPan) ; ?> </td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('Vendor Code');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($supplierVendor) ; ?> </td>
</tr>
</table>
</td>
<td colspan="2" width="50%">
<table id="client" class="tablepadding" border="1" style="border-collapse: collapse;" >
<tr>
<td style="border:0px;" ><?php echo 'Name';?></td>
<td style="border:0px;" ><?php echo ': '. htmlsc($CompanyName); ?> </td>
</tr>
<tr>
<td style="border:0px;" ><?php echo 'Address <br><br><br><br>';?></td>
<td style="border:0px;">
<?php echo ': '.htmlsc($CompanyAddress).'<br>'; ?>
</td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('GSTIN');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($companyGst) ; ?> </td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('PAN');?> </td>
<td style="border:0px;"> <?php echo ': '.htmlsc($companyPan) ; ?> </td>
</tr>
<tr>
<td style="border:0px;"> <?php echo trans('State Code');?> </td>
<td style="border:0px;"> <?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" class="item-name" ><center><?php _trans('S.No'); ?></center></th>
<th rowspan="2" colspan="2" class="item-name"><center><?php _trans('Name of Product /'); ?><br/><?php _trans('Service'); ?></center></th>
<th rowspan="2" class="item-name"><center><?php _trans('HSN'); ?></center></th>
<th rowspan="2" class="item-amount"><center><?php _trans('UOM'); ?></center></th>
<th rowspan="2" class="item-amount"><center><?php _trans('Qty'); ?></center></th>
<th rowspan="2" class="item-price"><center><?php _trans('Rate'); ?><br/> ₹</center></th>
<th rowspan="2" class="item-amount"><center><?php _trans('Total'); ?><br/> ₹</center></th>
<!-- <th rowspan="2" class="item-price"><center><?php _trans('Discount'); ?><br/>₹</center></th> -->
<th colspan="2" class="item-price"><center><?php _trans('CGST'); ?></center></th>
<th colspan="2" class="item-price"><center><?php _trans('SGST'); ?></center></th>
<th colspan="2" class="item-pric"><center><?php _trans('IGST'); ?></center></th>
<th rowspan="2" class="item-total "><center><?php _trans('Total Tax'); ?><br/> ₹</center></th>
</tr>
<tr style="background: #ddd;">
<th><center><?php _trans('Rate'); ?><br/><?php _trans('%'); ?></center></th>
<th><center><?php _trans('Amount'); ?><br/> ₹</center></th>
<th><center><?php _trans('Rate'); ?><br/><?php _trans('%'); ?></center></th>
<th><center><?php _trans('Amount'); ?><br/> ₹</center></th>
<th><center><?php _trans('Rate'); ?><br/><?php _trans('%'); ?></center></th>
<th><center><?php _trans('Amount'); ?><br/> ₹</center></th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$basic = [];
$cgst =[];
$sgst =[];
$igst =[];
$tax = [];
if(!empty($POItem)){
foreach ($POItem as $item) { ?>
<tr>
<td class="center" height="100"><?php echo $i++;?> </td>
<td colspan="2"><?php _htmlsc($item->MaterialCode.'/'.$item->MaterialName.$item->ServiceMaterialDescription);?></td>
<td class="text-right"><?php echo $item->HSNCODE ?? 'N/A'; ?></td>
<td>
<?php if ($item->UOM) : ?>
<small><?php _htmlsc($item->UOM); ?></small>
<?php endif; ?>
</td>
<td class="text-right">
<?php echo _htmlsc($item->Quantity); ?>
</td>
<td class="text-right">
<?php echo format_currency($item->Rate); ?>
</td>
<td class="text-right">
<?php echo format_currency(abs($item->BasicValue));?>
</td>
<!-- <td class="text-right">
<?php //echo format_currency( abs(1)); ?>
</td> -->
<td class="text-right">
<?php _htmlsc($item->CGST); ?><!-- Cgst % --->
</td>
<td class="text-right">
<?php
if ($item->AfterCGST != ''){
echo format_currency(abs($item->AfterCGST));}
else { }
?><!-- Cgst --->
</td>
<td class="text-right">
<?php _htmlsc($item->SGST); ?><!-- Sgst %-->
</td>
<td class="text-right">
<?php
if ($item->AfterSGST != ''){
echo format_currency(abs($item->AfterSGST));}
else { }
?><!-- Sgst-->
</td>
<td class="text-right">
<?php _htmlsc($item->IGST); ?><!-- Igst % -->
</td>
<td class="text-right">
<?php
if ($item->AfterIGST != ''){
echo format_currency(abs($item->AfterIGST)); }
else { }
?><!-- Igst -->
</td>
<td class="text-right">
<?php echo format_currency(abs($item->Taxamount));
$totalBasic = $item->BasicValue;
$totalCGST = $item->AfterCGST ;
$totalSGST = $item->AfterSGST ;
$totalIGST = $item->AfterIGST ;
$totalTax = $item->Taxamount;
?>
</td>
</tr>
<?php
$basic[] = $totalBasic;
$cgst[]=$totalCGST;
$sgst[]=$totalSGST;
$igst[]=$totalIGST;
$tax[] = $totalTax;
}} ?>
<tr>
<!-- <td class="center" height="150"> <br></td>
<td colspan="2"></td><td></td>
<td></td><td></td>
<td></td><td></td>
<td></td><td></td> <td></td> <td></td>
<td></td><td></td> <td></td><td></td>
<td></td>
</tr>
-->
<tr>
<td style="text-align: right;" colspan="7">&nbsp;&nbsp;&nbsp;<strong>&nbsp;TOTAL</strong></td>
<td class="text-right"><?php echo format_currency(abs(array_sum($basic))); ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if($cgst){echo format_currency(abs(array_sum($cgst)));} else { } ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if($sgst){echo format_currency(abs(array_sum($sgst)));} else { } ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if($igst){ echo format_currency(abs(array_sum($igst)));} else { } ?></td>
<td class="text-right">
<b><?php echo format_currency(abs(array_sum($tax)));
$invoiceTotalAmount=array_sum($basic);
if($invoiceTotalAmount>0)
{
$invoiceTotalAmountInWords=convertNumber(abs(round($invoiceTotalAmount)));
}
else
{
$invoiceTotalAmountInWords=convertNumber(abs(round($invoiceTotalAmount)));
}
?></b>
</td>
</tr>
<tr>
<td colspan="8" rowspan="7" style="border-bottom: none;">
<p style="text-align: center;"><strong>TOTAL AMOUNT IN WORDS:</strong>&nbsp;&nbsp;</p>
<?php echo $invoiceTotalAmountInWords; ?>
</td>
<td colspan="5"> <?php _trans('Total Amount Before Tax '); ?></td><td class="text-right">₹</td>
<td class="text-right"><?php echo format_currency(abs($invoiceTotalAmount)); ?></td>
</tr>
<tr>
<td colspan="5">Add :CGST</td><td class="text-right"></td>
<td class="text-right"><?php echo format_currency(abs(array_sum($cgst))); ?></td>
</tr>
<tr>
<td colspan="5">Add :SGST</td><td class="text-right"></td>
<td class="text-right"><?php echo format_currency(abs(array_sum($sgst))); ?></td>
</tr>
<tr>
<td colspan="5" >Add :IGST</td><td class="text-right"></td>
<td class="text-right"><?php echo format_currency(abs(array_sum($igst))); ?></td>
</tr>
<tr>
<td colspan="5" > <?php _trans('Tax Amount : GST'); ?></td><td class="text-right">₹</td>
<?php $invoiceTotalGST = array_sum($cgst) + array_sum($sgst) + array_sum($igst); ?>
<td class="text-right"><?php echo format_currency(abs($invoiceTotalGST)); ?></td>
</tr>
<tr>
<td colspan="5"><?php _trans('Round Off'); ?></td><td class="text-right">₹</td>
<?php $differences = ($invoiceTotalGST + $invoiceTotalAmount)- round($item->TotalOrderValue); ?>
<td class="text-right"><b><?php echo number_format($differences, 2);?></b></td>
</tr>
<tr>
<td colspan="5"><?php _trans('Total Amount'); ?></td><td class="text-right">₹</td>
<td class="text-right"><b><?php echo format_currency(abs(round($item->TotalOrderValue)));?></b></td>
</tr>
<tr>
<td colspan="8" 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>
<!-- <?php // echo nl2br(htmlsc("invoice_terms")); ?> -->
</div>
</td>
<td style="text-align:right;" colspan="7" rowspan="2">
<div><center><?php echo authorized_signatory(); ?></center></div>
<div><h6>Authorized Signatory</h6></div>
</td>
</tr>
<tr><td colspan="8">Declaration: We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct </td></tr>
</tbody>
</table>
</main>
<table width="100%" class="center"><tr><td><b><small>This is a system generated purchase orde</small></b> </td></tr></table>
<!-- <div id="page_break"></div> -->
</body>
</html>