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
#-------------------------
!vendor/
vendor
composer.lock
tests

View File

@ -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'] ? '<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>'
: '',
'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>'
: '',
'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>' : ''
]);
// 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());
}
}