From ca8083bef92d73baa3b55070f9392f95218e96f9 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 20 May 2024 09:43:45 +0000 Subject: [PATCH] FIX_Mpdf : ps --- app/Controllers/Companycontroller.php | 3 +- app/Controllers/Purchaseorder.php | 3 +- app/Helpers/cias_helper.php | 4 +- app/Views/companyview.php | 31 ++-- app/Views/editRawmaterial.php | 9 +- app/Views/po_pdf.php | 214 +++++++++++++------------- 6 files changed, 138 insertions(+), 126 deletions(-) diff --git a/app/Controllers/Companycontroller.php b/app/Controllers/Companycontroller.php index 1b224fbb..b72ad125 100644 --- a/app/Controllers/Companycontroller.php +++ b/app/Controllers/Companycontroller.php @@ -163,6 +163,7 @@ class Companycontroller extends BaseController $Exiseregistration = $this->request->getPost('Exiseregistration1'); $TIN = $this->request->getPost('TIN'); $PAN = $this->request->getPost('PAN'); + $MSME = $this->request->getPost('MSME'); $GSTNO = $this->request->getPost('GSTNO'); $GSTRange = $this->request->getPost('GSTRange'); $CollectrateAddress = $this->request->getPost('CollectrateAddress'); @@ -198,7 +199,7 @@ class Companycontroller extends BaseController //$createdDate=$this->request->getPost('createdDate'); //$Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'PaymentTerms'=>$Payment ,'PaymentDays'=>$PaymentDays ,'PayableAT'=>$PayableAT ,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend); - $Company = array('CompID' => $CompID, 'CompanyName' => $CompanyName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'TIN' => $TIN, 'PAN' => $PAN, 'GSTNO' => $GSTNO, 'GSTRange' => $GSTRange, 'UANumber' => $UANumber, 'Createdby' => $createdby, 'ProfilePic' => $Picture, 'Exiseregistration' => $Exiseregistration, 'CollectrateAddress' => $CollectrateAddress, 'FiscalYearStartOn' => $financialstart, 'FiscalYearEndsOn' => $financialend, 'paymentID' => $PaymentId, 'companyWebsite' => $companywebsite, 'UpdatedBY' => $updatedby, 'Updatedon' => $updateddt); + $Company = array('CompID' => $CompID, 'CompanyName' => $CompanyName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'TIN' => $TIN, 'PAN' => $PAN, 'GSTNO' => $GSTNO, 'GSTRange' => $GSTRange, 'UANumber' => $UANumber, 'MSME' => $MSME , 'Createdby' => $createdby, 'ProfilePic' => $Picture, 'Exiseregistration' => $Exiseregistration, 'CollectrateAddress' => $CollectrateAddress, 'FiscalYearStartOn' => $financialstart, 'FiscalYearEndsOn' => $financialend, 'paymentID' => $PaymentId, 'companyWebsite' => $companywebsite, 'UpdatedBY' => $updatedby, 'Updatedon' => $updateddt); if (!empty($file)) { $myfile = array('CompID' => $CompID, 'filename' => $file, 'ID' => $ID, 'filedescription' => $filedescription1, 'createdDate' => $createddt); diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index 92249aa7..148a30e6 100644 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -369,11 +369,12 @@ class Purchaseorder extends BaseController // $html = view('pdf_view', $data); // $mpdf->WriteHTML($html); // Use WriteHTML() method to add body content $html = view('po_pdf', $data); + // echo $html; die; $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}"); + // $mpdf->setFooter('' . "Page {PAGENO} of {nb}"); // Output PDF $mpdf->Output('POReport' . $PONO . '.pdf', 'D'); diff --git a/app/Helpers/cias_helper.php b/app/Helpers/cias_helper.php index 4dc17523..0df54a71 100755 --- a/app/Helpers/cias_helper.php +++ b/app/Helpers/cias_helper.php @@ -54,7 +54,7 @@ if (!function_exists('generateCopyrightNotice')) { } } } -function format_currency($amount) +function number_alignment($amount) { if ($amount) { @@ -130,4 +130,4 @@ if (!function_exists('trans')) { return $lang_string; } -} +} \ No newline at end of file diff --git a/app/Views/companyview.php b/app/Views/companyview.php index f23f6365..23454014 100644 --- a/app/Views/companyview.php +++ b/app/Views/companyview.php @@ -37,6 +37,7 @@ $bankname=''; $bankifsc=''; $bankaddress=''; $bank_isactive = 1 ; +$MSME = ''; //print_r($userRecords);die(); if(!empty($userRecords)) { @@ -57,6 +58,7 @@ if(!empty($userRecords)) $UANumber = $uf->UANumber; $PaymentTerms = $uf->PaymentTerms ; $PaymentId = $uf->paymentID; + $MSME = $uf->MSME; //$PaymentDays = $uf->PaymentDays ; //$PayableAT = $uf->PayableAT ; $Createdby = $uf->Createdby; @@ -629,31 +631,36 @@ function ValidateUA() {
-
UA Number +
UA Number
-
TIN Number +
TIN Number
-
PAN Number* - - - +
MSME Number +
-
GST Number* +
+
+
GST Range + +
+
GST Number* -
+
+
PAN Number* + + +

-
GST Range - -
+ -
Collectrate Address* +
Collectrate Address*
diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index 059dd1d3..8d4e90ab 100644 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -49,9 +49,10 @@ if (!empty($currentstock)) { $todaydatemonth = format_date($date_today, 0, 'm'); $todaydatedate = format_date($date_today, 0, 'd'); $openstockdateyear = format_date($date, 0, 'Y'); + $parts = explode('-', $date); - $openstockdatemonth = $parts[1]; - $openstockdatedate = $parts[2]; + $openstockdatemonth = $parts[1] ?? 0; + $openstockdatedate = $parts[2] ?? ''; if ($openstockdateyear == $todaydateyear) { @@ -110,7 +111,7 @@ if ($total <= $reorder) {
- Back + Back

@@ -289,7 +290,7 @@ if ($total <= $reorder) {
diff --git a/app/Views/po_pdf.php b/app/Views/po_pdf.php index 5b6c2e87..49c30be4 100755 --- a/app/Views/po_pdf.php +++ b/app/Views/po_pdf.php @@ -1,28 +1,29 @@ - - + @@ -44,7 +45,7 @@ $companyPan = (!empty($CompanyDetails) && !empty($CompanyDetails[0]->PAN)) ? $Co $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 : [^,]+,/', '', $CompanyAddress); +$address = preg_replace('/SURVEY\s*:\s*[^,]+,/', '', $CompanyAddress); $currencyName = 'INR'; $currencyCode = (!empty($CurrencySymbol) && !empty($CurrencySymbol[0]->FontCode2000)) ? $CurrencySymbol[0]->FontCode2000 : "-"; @@ -65,7 +66,7 @@ $supplierContact = (!empty($POItem) && !empty($POItem[0]->ContactNumber)) ? $POI $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 : "-"; +$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 : "-"; @@ -84,8 +85,8 @@ $poDate = $purchaseorderDate ? $purchaseorderDate->format('d-m-Y') : "-"; $DeliverySchedule = ""; } }else{ - $DeliveryDate = "-"; - $DeliverySchedule = "-"; + $DeliveryDate = ""; + $DeliverySchedule = ""; } $RequistionNo = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['RequistionNo'])) ? $RequistionDetails[0]['RequistionNo'] : "-"; $ReqDate = (!empty($RequistionDetails) && !empty($RequistionDetails[0]['ReqDate'])) ? $RequistionDetails[0]['ReqDate'] : ""; @@ -108,8 +109,9 @@ $invoice_discount_amount = '0.00' ; $totalCGST=0; $totalSGST=0; $totalIGST=0; +$invoiceTotalBasic=0; $invoiceTotalAmount=0; -$invoiceTotalAmountInWords=''; +$invoiceTotalAmountInWords='-'; // For Converting number to words function convertNumber($amt){ @@ -249,7 +251,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; } ?>
-

+

RI/PUR/R 02
@@ -269,19 +271,19 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; // if ($companyPhone) { // echo '
'.trans('Phone') . ': ' . htmlsc($companyPhone).','.'
'; // } - if ($companyEmail) { + if ($companyEmail !== '' && $companyEmail !== '-') { echo '
'.trans('Email') . ' : ' . htmlsc($companyEmail).'
'; } - if ($companyWebsit ) { + if ($companyWebsit !== '' && $companyWebsit !== '-') { echo '
'.trans('Website') . ' : ' . htmlsc($companyWebsit ).'
'; } - if ($companyGst ) { - echo '
'.trans('GSTIN') . ' : ' . htmlsc($companyGst ).'
'; + if ($companyGst !== '' && $companyGst !== '-') { + echo '
'.trans('GST') . ' : ' . htmlsc($companyGst ).'
'; } - if ($companyMsme ) { + if ($companyMsme !== '' && $companyMsme !== '-') { echo '
'.trans('MSME') . ' : ' . htmlsc($companyMsme ).'
'; } - if ($companyPan ) { + if ($companyPan !== '' && $companyPan !== '-') { echo '
'.trans('PAN') . ' : ' . htmlsc($companyPan ).'
'; } @@ -298,8 +300,8 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only";
-
-
+ +
- + @@ -322,7 +324,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; - + @@ -346,7 +348,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; - + @@ -374,75 +376,87 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only";
@@ -310,7 +312,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only";
- - + + - -
Shipped FromShipped ToShipped FromShipped To
+ - + + - + + - - + + + - + + - + + - + +
' . htmlsc($SuplierName) . ''; ?>:' . htmlsc($SuplierName) . ''; ?>
:

:
:
:
:
+ - + + - + + - - + + + - + + - + + - + +
' . htmlsc($CompanyName) . ''; ?>:' . htmlsc($CompanyName) . ''; ?>
:
:
:
:
:
- +
- + - + @@ -472,109 +486,101 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; if (!empty($POItem)) { foreach ($POItem as $item) { ?> - - - + + - - - - + + + - + - BasicValue; $cgst[] = $item->AfterCGST; $sgst[] = $item->AfterSGST; $igst[] = $item->AfterIGST; $tax[] = $item->Taxamount; + $invoiceTotalAmount=round($item->TotalOrderValue); ?> + } + else { + echo ""; + } ?> - - - +   + + - - 0) - { - $invoiceTotalAmountInWords=convertNumber(abs(round($invoiceTotalAmount))); - } - else - { - $invoiceTotalAmountInWords=convertNumber(abs(round($invoiceTotalAmount))); - } - ?> +




MaterialCode); ?>MaterialName . $item->ServiceMaterialDescription); ?>MaterialCode.' - ') ._htmlsc($item->MaterialName . $item->ServiceMaterialDescription); ?> HSNCODE ?? 'N/A'; ?>UOM) : ?> + Quantity); if ($item->UOM) : ?> UOM); ?> - - Quantity); ?>Rate); ?>BasicValue)); ?>Rate); ?>BasicValue)); ?> CGST); ?> AfterCGST != '') { - echo format_currency(abs($item->AfterCGST)); + echo number_alignment(abs($item->AfterCGST)); } ?> SGST); ?> AfterSGST != '') { - echo format_currency(abs($item->AfterSGST)); + echo number_alignment(abs($item->AfterSGST)); } ?> IGST); ?> AfterIGST != '') { - echo format_currency(abs($item->AfterIGST)); + echo number_alignment(abs($item->AfterIGST)); } ?>Taxamount)); ?>Taxamount)); ?>
No items available.
 TOTAL
 TOTAL      
- - - @@ -603,11 +609,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only";
+

TOTAL AMOUNT IN WORDS:  

- + 0) + { + $invoiceTotalAmountInWords=convertNumber(abs(round($invoiceTotalAmount))); + } + echo $invoiceTotalAmountInWords; ?>
- + - + - + - + - TotalOrderValue); ?> + @@ -583,7 +589,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only"; - +
TotalOrderValue)));?>
Declaration: We Declare that this invoice shows the actual price of the goods described and that all particulars are true and correct
- -
-
This is a system generated purchase order
- - - +
This is a system generated purchase order
+
\ No newline at end of file