From edadba1a41ae377174794e4a4ddc2fc34ffd1ae2 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 5 Jun 2024 06:29:11 +0000 Subject: [PATCH] Change_bug : ps --- .gitignore | 2 +- app/Controllers/Invoice.php | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 941e295..e5707a4 100644 --- a/.gitignore +++ b/.gitignore @@ -82,7 +82,7 @@ writable/**/*.sqlite #------------------------- # Composer #------------------------- -!vendor/ +vendor composer.lock tests diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 9ee95c3..caac569 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -272,6 +272,7 @@ class Invoice extends BaseController 'business_id' => (int)get_business_id(), 'isactive' => 1 ]; + // print_r($data);die; ## Based on the invoice ID, we designated Insert or Update on Details... if (empty($receipt_id)) { $data['created_by'] = (int)get_logged_user_id(); @@ -291,6 +292,7 @@ class Invoice extends BaseController 'updated_by' => (int)get_logged_user_id() ]; $this->AuditHistoryModel->save($audit_data); + /************************************* */ session()->setFlashdata('success', 'Receipt has been added successfully.'); $this->logger->info("Receipt: has been added successfully. Inserted ID = " . $receipt_id); @@ -346,7 +348,6 @@ class Invoice extends BaseController $donordata = $model->getData('donor', $where); // generate recipt $html = $this->generate_invoice_pdf($receipt_id, 'mail'); - // echo $html;die; // send mail $notification = new NotificationHelper(); if($donordata[0]->email != null || $donordata[0]->email != '') @@ -513,9 +514,8 @@ class Invoice extends BaseController $where = ['business_id' => (int)get_business_id()]; $currency_data = $model->setTable('business')->select('currency')->where($where)->findAll(); - $terms_data = $this->BusinessModel->select('terms,signature,80G,12AA,80G_vaildupto,12AA_vaildupto')->where($where)->findAll(); + $terms_data = $this->BusinessModel->select('terms,signature,80G as eightyG ,12AA as twelveAA,80G_vaildupto as eightyGVaildUpto,12AA_vaildupto as twelveAAVaildUpto')->where($where)->findAll(); $data = $model->getInvoiceData($id); - // print_r($data);die; // Check if data is empty if (!$data || !$currency_data) { throw new \Exception('Data not found or empty'); @@ -548,7 +548,6 @@ class Invoice extends BaseController } $digits = strlen((string)$data[0]->amount); $amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount; - ; $html = view('invoice_pdf_template', [ 'data' => $data[0], 'currency' => $data[0]->currency, @@ -557,10 +556,8 @@ class Invoice extends BaseController 'signature' => $data[0]->signature, 'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'], 'Notes' => $terms_data[0]['terms'], - 'eightyG' => $terms_data[0]['80G'] ? '
80G Registration No: '.$terms_data[0]['80G'].'Valid Upto : '. $terms_data[0]['80G_validupto'].'
' - : '', - 'twelveAA' => $terms_data[0]['12AA'] ? '
12AA Registration No: '.$terms_data[0]['12AA'].'Valid Upto : '. $terms_data[0]['12AA_validupto'].'
' - : '', + 'eightyG' => $terms_data[0]['eightyG'] ? '
80G Registration No: '.$terms_data[0]['eightyG'].'Valid Upto : '. (!empty($terms_data[0]['eightyGVaildUpto'])) ?? date("d-m-Y", strtotime($terms_data[0]['eightyGVaildUpto'])) .'
' : '', + 'twelveAA' => $terms_data[0]['twelveAA'] ? '
12AA Registration No: '.$terms_data[0]['twelveAA'].'Valid Upto : '. (!empty($terms_data[0]['twelveAAVaildUpto'])) ?? date("d-m-Y", strtotime($terms_data[0]['twelveAAVaildUpto'])) .'
' : '' ]); // echo $html;die; @@ -590,6 +587,11 @@ class Invoice extends BaseController // Handle the exception // For example, log the error, display a user-friendly message, or return an error response echo 'Error: ' . $e->getMessage(); + log_message('error', sprintf( + "Exception caught: [message: %s] [code: %d] [file: %s] [line: %d]", + $e->getMessage(), $e->getCode(),$e->getFile(),$e->getLine() + )); + log_message('error', $e->getTraceAsString()); } }