diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index a39c5758..59c20943 100755
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -182,7 +182,12 @@ abstract class BaseController extends Controller
*/
function loadViews($viewName = "", $headerInfo = NULL, $pageInfo = NULL, $footerInfo = NULL)
{
-
+ if (!session()->has('name')) {
+ // Session is not active, destroy session and redirect to login
+ session()->destroy();
+ return redirect()->to('login');
+ }
+
$headerInfo['pageTitle'] = $this->CompanyName ." : ".$headerInfo['pageTitle'];
$header = view('includes/header', $headerInfo);
diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php
index 19255697..a7f02a34 100644
--- a/app/Controllers/Purchaseorder.php
+++ b/app/Controllers/Purchaseorder.php
@@ -1295,136 +1295,71 @@ class Purchaseorder extends BaseController
$data['TotalAmountInWords'] = $this->convertNumber($totalAmt);
$data['RequistionDetails'] = $this->purchaseorder_model->GetPdfRequistionDetails($PONO);
-// echo \Mpdf\Mpdf::VERSION;
-// die;
- // $mpdf = new Mpdf([
- // 'mode' => 'utf-8',
- // 'format' => 'A4', // Page format: A4 with portrait orientation
- // // 'format' => [148, 210], // Set custom width and height in millimeters
- // 'default_font_size' => 6,
- // 'default_font' => 'sans-serif',
- // 'margin_left' => 10,
- // 'margin_right' => 10,
- // 'margin_top' => 10,
- // 'margin_bottom' => 10,
- // 'margin_header' => 82,
- // 'margin_footer' => 38,
- // 'orientation' => 'P',
- // ]);
+
+ $mpdf = new Mpdf([
+ 'mode' => 'utf-8',
+ 'format' => 'A4', // Page format: A4 with portrait orientation
+ // 'format' => [148, 210], // Set custom width and height in millimeters
+ 'default_font_size' => 6,
+ 'default_font' => 'sans-serif',
+ 'margin_left' => 10,
+ 'margin_right' => 10,
+ 'margin_top' => 10,
+ 'margin_bottom' => 10,
+ 'margin_header' => 82,
+ 'margin_footer' => 38,
+ 'orientation' => 'P',
+ ]);
- // $mpdf->autoLangToFont = true;
- // $mpdf->autoScriptToLang = true;
- // // Set PDF properties
- // $mpdf->SetTitle('Invoice');
- // $mpdf->SetAuthor($data['CompanyDetails'][0]->CompanyName);
- // $mpdf->SetCreator('');
+ $mpdf->autoLangToFont = true;
+ $mpdf->autoScriptToLang = true;
+ // Set PDF properties
+ $mpdf->SetTitle('Invoice');
+ $mpdf->SetAuthor($data['CompanyDetails'][0]->CompanyName);
+ $mpdf->SetCreator('');
- // $htmlFooter = '
- //
';
- // $mpdf->setHTMLFooter($htmlFooter);
+ $htmlFooter = '
+

+
';
+ $mpdf->setHTMLFooter($htmlFooter);
- // // 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');
- // }
+ // 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');
+ }
- // $WatermarkImage = base_url()."public/assets/images/mpdf.png";
- // $mpdf->SetWatermarkImage($WatermarkImage, 8, 10);
+ $WatermarkImage = base_url()."public/assets/images/mpdf.png";
+ $mpdf->SetWatermarkImage($WatermarkImage, 8, 10);
- // $mpdf->showWatermarkImage = true;
- // $mpdf->watermark_font = 'DejaVuSansCondensed';
- // $mpdf->showWatermarkText = true;
+ $mpdf->showWatermarkImage = true;
+ $mpdf->watermark_font = 'DejaVuSansCondensed';
+ $mpdf->showWatermarkText = true;
// Set auto margins
- // $mpdf->setAutoTopMargin = 'stretch';
- // $mpdf->setAutoBottomMargin = 'stretch';
+ $mpdf->setAutoTopMargin = 'stretch';
+ $mpdf->setAutoBottomMargin = 'stretch';
// Set HTML header
- // $HtmlHeading = view('includes/pdfheader', $data);
- // $mpdf->SetHTMLHeader($HtmlHeading);
+ $HtmlHeading = view('includes/pdfheader', $data);
+ $mpdf->SetHTMLHeader($HtmlHeading);
// Set HTML body
- // $html = view('capitalpopdf', $data);
+ // $html = view('pdf_view', $data);
// $mpdf->WriteHTML($html); // Use WriteHTML() method to add body content
+ $html = view('capitalpopdf', $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}");
-
-
+ $HTMLFooter = view('includes/pdffooter', $data);
+ $mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
// Output PDF
- // $mpdf->Output('CapitalPOReport' . $PONO . '.pdf', 'D');
- // $pdf = myPdf('P');
-
- // $pdf->writeHTML( "Hello World" );
-
- // $pdf->Output( FCPATH . "writable/uploads/test.pdf", 'F');
-
- // return redirect()->to( site_url('/') );
+ $mpdf->Output('CapitalPOReport' . $PONO . '.pdf', 'D');
}
- function myPdf( $orientation ) {
-
- $defaultFontConfig = ( new Mpdf\Config\FontVariables() )->getDefaults();
- $fontData = $defaultFontConfig[ 'fontdata' ] + [
- 'homemadeapple' => [
- 'R' => 'HomemadeApple-Regular.ttf',
- ],
- 'roboto' => [
- 'R' => 'Roboto-Regular.ttf',
- 'I' => 'Roboto-Italic.ttf',
- 'B' => 'Roboto-Bold.ttf',
- 'BI' => 'Roboto-BoldItalic.ttf',
- ],
- 'robotocondensed' => [
- 'R' => 'RobotoCondensed-Regular.ttf',
- 'I' => 'RobotoCondensed-Italic.ttf',
- 'B' => 'RobotoCondensed-Bold.ttf',
- 'BI' => 'RobotoCondensed-BoldItalic.ttf',
- ],
- ];
- $defaultConfig = ( new Mpdf\Config\ConfigVariables() )->getDefaults();
- $fontDirs = $defaultConfig[ 'fontDir' ];
- if ( $orientation == 'L' ) {
- $myPdf = new \Mpdf\Mpdf(
- array(
- 'format' => 'A4-L',
- 'margin_left' => 10,
- 'margin_right' => 10,
- 'margin_top' => 30,
- 'margin_bottom' => 20,
- 'margin_header' => 8,
- 'margin_footer' => 8,
- 'orientation' => 'L',
- 'mode' => 's',
- 'fontDir' => array_merge( $fontDirs, [ FCPATH . 'public/assets-app/fonts', ] ),
- 'fontdata' => $fontData,
- ) );
- }
- else {
- $myPdf = new \Mpdf\Mpdf( array(
- 'format' => 'A4-P',
- 'margin_left' => 20,
- 'margin_right' => 10,
- 'margin_top' => 40,
- 'margin_bottom' => 20,
- 'margin_header' => 8,
- 'margin_footer' => 8,
- 'orientation' => 'P',
- 'mode' => 's',
- 'fontDir' => array_merge( $fontDirs, [ FCPATH . 'public/assets-app/fonts', ] ),
- 'fontdata' => $fontData,
- ) );
- }
-
- return $myPdf;
-
- }
-
public function servicepoprint($PONO)
diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php
index 36eb5861..d792b32a 100644
--- a/app/Models/Requistion_model.php
+++ b/app/Models/Requistion_model.php
@@ -255,9 +255,10 @@ class Requistion_model extends Model
*/
function getCostCenterUserID($UserID)
{
- $subQuery ='SELECT Mast.CostCenterCode,Mast.CostCenterName from T_CostCenter_Master Mast
- LEFT JOIN T_CostCenter_Departments COST ON COST.CostCenterCode = Mast.CostCenterCode
- WHERE COST.DEPCode=(select Departmentcode from T_Employee_Details where EmpID = (select EmpID from tbl_users where userId=?))';
+ // $subQuery ='SELECT Mast.CostCenterCode,Mast.CostCenterName from T_CostCenter_Master Mast
+ // LEFT JOIN T_CostCenter_Departments COST ON COST.CostCenterCode = Mast.CostCenterCode
+ // WHERE COST.DEPCode=(select Departmentcode from T_Employee_Details where EmpID = (select EmpID from tbl_users where userId=?))';
+ $subQuery ='SELECT Mast.CostCenterCode,Mast.CostCenterName from T_CostCenter_Master Mast';
$query = $this->db->query($subQuery, [$UserID]);
diff --git a/app/Views/AmendPOlist.php b/app/Views/AmendPOlist.php
index e48c7d4c..932105d0 100644
--- a/app/Views/AmendPOlist.php
+++ b/app/Views/AmendPOlist.php
@@ -21,7 +21,7 @@
-
+
| PONO# |
diff --git a/app/Views/POlist.php b/app/Views/POlist.php
index b9a31095..9215b502 100644
--- a/app/Views/POlist.php
+++ b/app/Views/POlist.php
@@ -42,7 +42,7 @@
-
+
| # |
PONO# |
diff --git a/app/Views/addSupplier.php b/app/Views/addSupplier.php
index ff00e883..200f3182 100644
--- a/app/Views/addSupplier.php
+++ b/app/Views/addSupplier.php
@@ -223,14 +223,16 @@