Change_bug : ps

This commit is contained in:
VE10-Sanjeev 2024-06-05 06:29:11 +00:00
parent 635c477812
commit edadba1a41
2 changed files with 11 additions and 9 deletions

2
.gitignore vendored
View File

@ -82,7 +82,7 @@ writable/**/*.sqlite
#------------------------- #-------------------------
# Composer # Composer
#------------------------- #-------------------------
!vendor/ vendor
composer.lock composer.lock
tests tests

View File

@ -272,6 +272,7 @@ class Invoice extends BaseController
'business_id' => (int)get_business_id(), 'business_id' => (int)get_business_id(),
'isactive' => 1 'isactive' => 1
]; ];
// print_r($data);die;
## Based on the invoice ID, we designated Insert or Update on Details... ## Based on the invoice ID, we designated Insert or Update on Details...
if (empty($receipt_id)) { if (empty($receipt_id)) {
$data['created_by'] = (int)get_logged_user_id(); $data['created_by'] = (int)get_logged_user_id();
@ -291,6 +292,7 @@ class Invoice extends BaseController
'updated_by' => (int)get_logged_user_id() 'updated_by' => (int)get_logged_user_id()
]; ];
$this->AuditHistoryModel->save($audit_data); $this->AuditHistoryModel->save($audit_data);
/************************************* */ /************************************* */
session()->setFlashdata('success', 'Receipt has been added successfully.'); session()->setFlashdata('success', 'Receipt has been added successfully.');
$this->logger->info("Receipt: has been added successfully. Inserted ID = " . $receipt_id); $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); $donordata = $model->getData('donor', $where);
// generate recipt // generate recipt
$html = $this->generate_invoice_pdf($receipt_id, 'mail'); $html = $this->generate_invoice_pdf($receipt_id, 'mail');
// echo $html;die;
// send mail // send mail
$notification = new NotificationHelper(); $notification = new NotificationHelper();
if($donordata[0]->email != null || $donordata[0]->email != '') if($donordata[0]->email != null || $donordata[0]->email != '')
@ -513,9 +514,8 @@ class Invoice extends BaseController
$where = ['business_id' => (int)get_business_id()]; $where = ['business_id' => (int)get_business_id()];
$currency_data = $model->setTable('business')->select('currency')->where($where)->findAll(); $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); $data = $model->getInvoiceData($id);
// print_r($data);die;
// Check if data is empty // Check if data is empty
if (!$data || !$currency_data) { if (!$data || !$currency_data) {
throw new \Exception('Data not found or empty'); throw new \Exception('Data not found or empty');
@ -548,7 +548,6 @@ class Invoice extends BaseController
} }
$digits = strlen((string)$data[0]->amount); $digits = strlen((string)$data[0]->amount);
$amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount; $amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount;
;
$html = view('invoice_pdf_template', [ $html = view('invoice_pdf_template', [
'data' => $data[0], 'data' => $data[0],
'currency' => $data[0]->currency, 'currency' => $data[0]->currency,
@ -557,10 +556,8 @@ class Invoice extends BaseController
'signature' => $data[0]->signature, 'signature' => $data[0]->signature,
'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'], 'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'],
'Notes' => $terms_data[0]['terms'], 'Notes' => $terms_data[0]['terms'],
'eightyG' => $terms_data[0]['80G'] ? '<div><strong style="float: left;">80G Registration No: </strong><span>'.$terms_data[0]['80G'].'</span><strong style="float: right;">Valid Upto : </strong><span>'. $terms_data[0]['80G_validupto'].'</span></div>' 'eightyG' => $terms_data[0]['eightyG'] ? '<div><strong style="float: left;">80G Registration No: </strong><span>'.$terms_data[0]['eightyG'].'</span><strong style="float: right;">Valid Upto : </strong><span>'. (!empty($terms_data[0]['eightyGVaildUpto'])) ?? date("d-m-Y", strtotime($terms_data[0]['eightyGVaildUpto'])) .'</span></div>' : '',
: '', 'twelveAA' => $terms_data[0]['twelveAA'] ? '<div><strong style="float: left;">12AA Registration No: </strong><span>'.$terms_data[0]['twelveAA'].'</span><strong style="float: right;">Valid Upto : </strong><span>'. (!empty($terms_data[0]['twelveAAVaildUpto'])) ?? date("d-m-Y", strtotime($terms_data[0]['twelveAAVaildUpto'])) .'</span></div>' : ''
'twelveAA' => $terms_data[0]['12AA'] ? '<div><strong style="float: left;">12AA Registration No: </strong><span>'.$terms_data[0]['12AA'].'</span><strong style="float: right;">Valid Upto : </strong><span>'. $terms_data[0]['12AA_validupto'].'</span></div>'
: '',
]); ]);
// echo $html;die; // echo $html;die;
@ -590,6 +587,11 @@ class Invoice extends BaseController
// Handle the exception // Handle the exception
// For example, log the error, display a user-friendly message, or return an error response // For example, log the error, display a user-friendly message, or return an error response
echo 'Error: ' . $e->getMessage(); 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());
} }
} }