From 2392cb082aba87c38683d62a83588fd36ab8a846 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 1 Jun 2024 05:30:03 +0000 Subject: [PATCH] CHANGE_5point : ps --- app/Config/Routes.php | 4 + app/Controllers/BaseController.php | 41 + app/Controllers/Business.php | 4 +- app/Controllers/Customer.php | 191 ++- app/Controllers/Invoice.php | 241 +++- app/Models/AuthenticationModel.php | 12 + app/Models/BusinessModel.php | 2 +- app/Models/CustomerModel.php | 22 +- app/Models/InvoiceModel.php | 21 + app/Views/business_form.php | 52 +- app/Views/customer_form.php | 133 ++- app/Views/customer_list.php | 73 ++ app/Views/dashboard.php | 18 + app/Views/invoice_list.php | 96 +- app/Views/invoice_pdf_template.php | 5 +- app/Views/template/footer.php | 5 +- app/Views/template/topbar.php | 64 +- composer.json | 1 + composer.lock | 1778 +++++++++++++++++++++++----- 19 files changed, 2415 insertions(+), 348 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f20770c..e0f01c0 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -76,6 +76,8 @@ $routes->get('Customer/getReceiptDetails/(:num)', 'Customer::getReceiptDetails/$ $routes->post("insert_donor", "Customer::insert_donor"); $routes->post("insert_ajaxdonor", "Customer::insert_ajaxdonor"); $routes->get("delete_donor/(:any)", "Customer::delete_donor/$1"); +$routes->get("export_Donor", "Customer::export_donor"); +$routes->post("import_Donor", "Customer::import_donor"); #Donor group Routes (renamed as contributor group : 20/03/2024) $routes->get('contributor_group/', 'Customer::donor_group'); @@ -103,6 +105,8 @@ $routes->post("get_donor_details", "Invoice::get_donor_details"); $routes->post("save_invoice/", "Invoice::save_invoice/"); $routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1'); $routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1'); +$routes->get("export_receipt", "Invoice::export_receipt"); +$routes->post("import_receipt", "Invoice::import_receipt"); #Report Routes $routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp'); diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 924d1cb..6fed567 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -85,6 +85,10 @@ abstract class BaseController extends Controller $mergedData['browser_title']= $mergedData['company_name'] . ' | ' . $mergedData['company_short_name'] . ' ' . $mergedData['page_name']; $mergedData['heading']= $mergedData['page_name'] === "Dashboard" ? 'Welcome to ' . $mergedData['company_name'] : ""; + $reminder = $this->reminderMessage(); + if((int)count($reminder['reminder']) > 0){ + session()->setFlashdata('reminder', $reminder['reminder']); + } echo view('template/header.php', $mergedData ); echo view('template/topbar.php', $mergedData); echo view($viewpage, $mergedData); @@ -161,4 +165,41 @@ abstract class BaseController extends Controller } + public function reminderMessage(){ + + helper('session'); + $session_bid = get_business_id(); + // $reminderMessage = ""; + $reminderMessage = []; + + // $c = 0; //count + + $am = new AuthenticationModel(); + $bwhere = ['business_id'=> $session_bid,'isactive'=> 1]; + $getreminder = $am->getreminder($bwhere); + + $reminderThreshold = 30; // Set the reminder days (e.g., 30 days before expiration) + + if (!empty($getreminder['80G_vaildupto'])) { + $expirationDate1 = strtotime($getreminder['80G_vaildupto']); + $daysUntilExpiration1 = ($expirationDate1 - time()) / (60 * 60 * 24); + if ($daysUntilExpiration1 <= $reminderThreshold && $daysUntilExpiration1 >= 0) { + // $reminderMessage .= "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days."; + array_push($reminderMessage, "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days."); + // $c++; + } + } + + if (!empty($getreminder['12AA_vaildupto'])) { + $expirationDate2 = strtotime($getreminder['12AA_vaildupto']); + $daysUntilExpiration2 = ($expirationDate2 - time()) / (60 * 60 * 24); + if ($daysUntilExpiration2 <= $reminderThreshold && $daysUntilExpiration2 >= 0) { + // $reminderMessage .= "
Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days."; + array_push($reminderMessage, "Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days."); + // $c++; + } + } + return ["reminder"=>$reminderMessage];//,"count"=>$c]; + + } } \ No newline at end of file diff --git a/app/Controllers/Business.php b/app/Controllers/Business.php index 1c6d92a..07ec03e 100644 --- a/app/Controllers/Business.php +++ b/app/Controllers/Business.php @@ -141,6 +141,9 @@ class Business extends BaseController 'org_reg_no' => $this->request->getPost('org_reg_no'), 'terms' => $this->request->getPost('bterms'), '80G' => $this->request->getPost('80G'), + '12AA' => $this->request->getPost('12AA'), + '80G_vaildupto' => $this->request->getPost('80G_vaildupto'), + '12AA_vaildupto' => $this->request->getPost('12AA_vaildupto'), 'site_name' => $this->request->getPost('site_name'), 'site_title' => $this->request->getPost('site_title'), 'admin_email' => $this->request->getPost('admin_email'), @@ -228,7 +231,6 @@ class Business extends BaseController if (!empty($missingValues)) { $where = ['isactive' => 1, 'business_id'=>$bid]; $model->inactiveMissingBuinessBranchDetails($where, $missingValues); - echo $this->logger->info("BuinessBranch: Inactived Missing Count = " . count($missingValues)." That Primary ID = ".implode(",",$BBprimaryid)); } } diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php index c42d283..427fbc8 100644 --- a/app/Controllers/Customer.php +++ b/app/Controllers/Customer.php @@ -5,6 +5,12 @@ namespace App\Controllers; use App\Models\CustomerModel; use App\Models\SubscriptionModel; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx; + + class Customer extends BaseController { @@ -510,16 +516,183 @@ class Customer extends BaseController } return redirect()->route('donor_group'); } - // Example in your controller -public function getReceiptDetails($donorId) -{ - $CustomerModel = new CustomerModel(); - // Fetch receipt details from the model based on $donorId - $receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId); - // Return the details as JSON - return $this->response->setJSON($receiptDetails); -} + public function getReceiptDetails($donorId) + { + $CustomerModel = new CustomerModel(); + + $receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId); + + return $this->response->setJSON($receiptDetails); + } + + public function export_donor() + { + helper('session'); + + $session_bid = get_business_id(); + + $CustomerModel = new CustomerModel(); + + $data = $CustomerModel->export_excel($session_bid); + + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + + $sheet->mergeCells('B3:P3'); + $sheet->getStyle('B3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Contributor details'); + + $headers = [ + 'B3' => 'Contributor Details', + 'A5' => 'Contributor Name', + 'B5' => 'Contributor Type', + 'C5' => 'Organization Name', + 'D5' => 'Organization Reg Details', + 'E5' => 'Contact Number', + 'F5' => 'Email Address', + 'G5' => 'PAN', + 'H5' => 'Aadhaar Number', + 'I5' => 'Passport Number', + 'J5' => 'Address', + 'K5' => 'Country', + 'L5' => 'State', + 'M5' => 'City', + 'N5' => 'Postal Code', + 'O5' => 'CreatedBy', + 'P5' => 'UpdatedBy', + 'Q5' => 'CreatedAt', + 'R5' => 'UpdatedAt', + 'S5' => 'IsActive' + ]; + + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + if ($data) { + $row = 6; + foreach ($data as $d) { + $col = 'A'; // Start from column A + foreach ($d as $value) { + $sheet->setCellValue($col . $row, $value); + $col++; + } + $row++; + } + } + + ob_clean(); + + $writer = new Xlsx($spreadsheet); + $filename = 'exportDonor.xlsx'; + + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + header('Content-Disposition: attachment;filename="'. $filename .'"'); + header('Cache-Control: max-age=0'); + header('Expires: 0'); + header('Pragma: public'); + + $writer->save('php://output'); + exit; + } + + public function import_donor() + { + + $ip_address = $_SERVER['REMOTE_ADDR']; + + helper('session'); + $session_uid = get_logged_user_id(); + $session_bid = get_business_id(); + + $json = []; // Arr - Json For Message FrontEnd + $list = []; // Arr - Store on DB + $path = ROOTPATH . 'public/import/donor/'; + $fileNewName = ""; + + $file = $this->request->getFile('file'); + + if (!is_dir($path)) { + mkdir($path, 0777, true); + } + + $fileName = $file->getName(); + if ($fileName !== "") { + if ($file->isValid() && !$file->hasMoved()) { + $newName = $file->getRandomName(); + $file->move($path, $newName); + $fileNewName = $newName; + } + } + + if (!$fileNewName) { + $json = ['error_message' => "Failed to upload file"]; + return $this->response->setJSON($json); + } + + $arr_file = explode('.', $fileName); + $extension = $arr_file[1]; + if ('csv' == $extension) { + $reader = new ReaderCsv(); + } else if ('xlsx' == $extension) { + $reader = new ReaderXlsx(); + } else { + $json = ['error_message' => "Unsupported file type"]; + return $this->response->setJSON($json); + } + + if (!$reader) { + $json = ['error_message' => "Failed to initialize reader"]; + return $this->response->setJSON($json); + } + + $spreadsheet = $reader->load($path.$fileNewName); + $sheet_data = $spreadsheet->getActiveSheet()->toArray(); + + if(!empty($sheet_data)){ + foreach ($sheet_data as $key => $val) { + if ($key != 0) { // key zero - header + $list[] = [ + 'business_id' => $session_bid, + 'first_name' => $val[0], + 'donor_type' => $val[1], + 'org_name' => $val[2] ? $val[2] : null , + 'org_reg_details' => $val[3] ? $val[3] : null, + 'mobile_no' => $val[4] ? $val[4] : null, + 'email' => $val[5], + 'pan_no' => $val[6], + 'adhar_no' => $val[7], + 'passport_no' => $val[8] ? $val[8] : null , + 'address' => $val[9], + 'country' => $val[10], + 'state' => $val[11], + 'city' => $val[12], + 'postal_code' => $val[13], + 'created_by' => $session_uid, + 'XL_file_name' => $fileNewName, + 'ip_address' => $ip_address + ]; + } + } + }else{ + $json = ['error_message' => "There is no record to import"]; + return $this->response->setJSON($json); + } + + if (count($list) > 0) { + $CustomerModel = new CustomerModel(); + + $result = $CustomerModel->bulkInsert($list); + ($result) ? ['success_message' => "All Entries are imported successfully."] + : ['error_message' => "Something went wrong. Please try again."]; + } else { + $json = ['error_message' => "No new record is found."]; + } + return $this->response->setJSON($json); + } } diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index d494240..9ee95c3 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -15,6 +15,10 @@ use Mpdf\Mpdf; use Dompdf\Dompdf; use Dompdf\Options; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx; class Invoice extends BaseController { @@ -509,7 +513,7 @@ 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')->where($where)->findAll(); + $terms_data = $this->BusinessModel->select('terms,signature,80G,12AA,80G_vaildupto,12AA_vaildupto')->where($where)->findAll(); $data = $model->getInvoiceData($id); // print_r($data);die; // Check if data is empty @@ -544,6 +548,7 @@ 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, @@ -551,7 +556,11 @@ class Invoice extends BaseController 'baseurl' => $baseurl, 'signature' => $data[0]->signature, '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'] ? '
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'].'
' + : '', ]); // echo $html;die; @@ -679,6 +688,234 @@ class Invoice extends BaseController return $this->response->setJSON(['data' => $data]); } + public function export_receipt(){ + helper('session'); + $session_bid = (int)get_business_id(); + + $model = new InvoiceModel(); + $where = ['business_id' => $session_bid]; + $receipt = $model->where($where)->findAll(); + $alldonors = $model->getData('donor', ['business_id' => $session_bid , 'isactive' => 1]); + $export = []; + + if(!empty($receipt)){ + foreach ($receipt as $key => $value) { + $export[$key]['receipt_number'] = $receipt[$key]['receipt_number'] ; + $export[$key]['receipt_date'] = (isset($receipt[$key]['receipt_date']) && !empty($receipt[$key]['receipt_date']) && strtotime($receipt[$key]['receipt_date']) !== false) + ? date("d-m-Y", strtotime($receipt[$key]['receipt_date'])) + : '-'; + $export[$key]['receipt_type'] = $receipt[$key]['receipt_type']; + $export[$key]['donor'] = ''; + + foreach ($alldonors as $DonorData) { + if ($receipt[$key]['donor_id'] === $DonorData->donor_id) { + $suffix = ""; + if ($receipt[$key]['receipt_type'] == "organization" && !empty($DonorData->org_name)) { + $suffix = !empty($DonorData->org_name) ? " (" . $DonorData->org_name . ")" : " (-)"; + } + $export[$key]['donor'] = $DonorData->first_name . ' ' . $DonorData->last_name . $suffix; + break; + } + } + + $currencySymbol = ''; + switch (strtoupper($receipt[$key]['currency'])) { + case 'RS': + case 'INR': $currencySymbol = '₹'; break; + case 'USD': $currencySymbol = '$'; break; + case 'EUR': $currencySymbol = '€'; break; + default: $currencySymbol = ''; break; + } + $export[$key]['amount'] = $currencySymbol . ' ' . $receipt[$key]['amount']; + $paymentMode = ''; + switch (strtoupper($receipt[$key]['payment_mode'])) { + case 'DEBIT': $paymentMode = 'Debit Card'; break; + case 'CREDIT': $paymentMode = 'Credit Card'; break; + case 'CASH': $paymentMode = 'Cash'; break; + case 'UPI': $paymentMode = 'UPI'; break; + default: $paymentMode = $receipt[$key]['payment_mode']; break; + } + $status = ''; + switch (strtoupper($receipt[$key]['receipt_header'])) { + case 'TEMPORARY RECEIPT ': $status = 'Draft'; break; + case 'RECEIPT': $status = 'Completed'; break; + case 'REJECTED': $status = 'Rejected'; break; + default: $status = $receipt[$key]['receipt_header']; break; + } + $export[$key]['status'] = $status; + $export[$key]['payment_mode'] = $paymentMode; + $export[$key]['payment_ref_no'] = $receipt[$key]['payment_ref_no']; + $export[$key]['notes'] = $receipt[$key]['notes'] == null ? '-' : $receipt[$key]['notes']; + $export[$key]['reason'] = ($receipt[$key]['reason'] == null) ? '-' :$receipt[$key]['reason']; + $export[$key]['created_by'] = $this->UserModel->where('user_id', $receipt[$key]['created_by'])->get()->getRow()->first_name;// 2 + $export[$key]['updated_by'] = (isset($receipt[$key]['updated_by']) && !empty($receipt[$key]['updated_by']) && $receipt[$key]['updated_by'] !== null) + ? $this->UserModel->where('user_id', $receipt[$key]['updated_by'])->get()->getRow()->first_name + : '-';// 2 + $export[$key]['created_on'] = (isset($receipt[$key]['created_on']) && !empty($receipt[$key]['created_on']) && strtotime($receipt[$key]['created_on']) !== false) + ? date("d-m-Y", strtotime($receipt[$key]['created_on'])) + : '-'; + $export[$key]['updated_on'] = (isset($receipt[$key]['updated_on']) && !empty($receipt[$key]['updated_on']) && strtotime($receipt[$key]['updated_on']) !== false) + ? date("d-m-Y", strtotime($receipt[$key]['updated_on'])) + : '-'; + $export[$key]['isactive'] = (int)$receipt[$key]['isactive'] == 1 ? 'Active' : 'Inactive'; + } + } + $this->fetch_receipt($export); + } + public function fetch_receipt($export){ + $spreadsheet = new Spreadsheet(); // instantiate Spreadsheet + + $sheet = $spreadsheet->getActiveSheet(); + $sheet->mergeCells('B3:R3'); + $sheet->getStyle('B3')->getAlignment()->setHorizontal('center'); + $sheet->setTitle('Receipt details'); + + $headers = [ + 'B3' => 'Receipt Details', + 'A5' => 'Receipt Number', + 'B5' => 'Receipt Date', + 'C5' => 'Receipt Type', + 'D5' => 'Contributor Name', + 'E5' => 'Amount', + 'F5' => 'Status', + 'G5' => 'Payment Mode', + 'H5' => 'Payment Ref no', + 'I5' => 'Notes', + 'J5' => 'Reason', + 'K5' => 'CreatedBy', + 'L5' => 'UpdatedBy', + 'M5' => 'CreatedAt', + 'N5' => 'UpdatedAt', + 'O5' => 'IsActive' + ]; + foreach ($headers as $cell => $value) { + $sheet->setCellValue($cell, $value); + $sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12); + $sheet->getStyle($cell)->getFont()->setBold(true); + } + + + if($export){ + $row = 6; // Start from row 6 + foreach ($export as $d) { + $col = 'A'; // Start from column A + foreach ($d as $value) { + $sheet->setCellValue($col . $row, $value); + $col++; + } + $row++; + } + } + // Clear the output buffer to prevent any other output + ob_clean(); + + $writer = new Xlsx($spreadsheet); + $filename = 'exportReceipt.xlsx'; + + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + header('Content-Disposition: attachment;filename="'. $filename .'"'); + header('Cache-Control: max-age=0'); + header('Expires: 0'); + header('Pragma: public'); + + $writer->save('php://output'); + exit; + } + + + public function import_receipt() + { + + $ip_address = $_SERVER['REMOTE_ADDR']; + $InvoiceModel = new InvoiceModel(); + + helper('session'); + $session_uid = get_logged_user_id(); + $session_bid = get_business_id(); + + $json = []; // Arr - Json For Message FrontEnd + $list = []; // Arr - Store on DB + $path = ROOTPATH . 'public/import/receipt/'; + $fileNewName = ""; + + $file = $this->request->getFile('file'); + + if (!is_dir($path)) { + mkdir($path, 0777, true); + } + + $fileName = $file->getName(); + if ($fileName !== "") { + if ($file->isValid() && !$file->hasMoved()) { + $newName = $file->getRandomName(); + $file->move($path, $newName); + $fileNewName = $newName; + } + } + + if (!$fileNewName) { + $json = ['error_message' => "Failed to upload file"]; + return $this->response->setJSON($json); + } + + $arr_file = explode('.', $fileName); + $extension = $arr_file[1]; + if ('csv' == $extension) { + $reader = new ReaderCsv(); + } else if ('xlsx' == $extension) { + $reader = new ReaderXlsx(); + } else { + $json = ['error_message' => "Unsupported file type"]; + return $this->response->setJSON($json); + } + + if (!$reader) { + $json = ['error_message' => "Failed to initialize reader"]; + return $this->response->setJSON($json); + } + + $spreadsheet = $reader->load($path.$fileNewName); + $sheet_data = $spreadsheet->getActiveSheet()->toArray(); + + if(!empty($sheet_data)){ + foreach ($sheet_data as $key => $val) { + if ($key != 0) { // key zero - header + $list[] = [ + 'business_id' => $session_bid, + 'first_name' => $val[0], + 'donor_type' => $val[1], + 'org_name' => $val[2] ? $val[2] : null , + 'org_reg_details' => $val[3] ? $val[3] : null, + 'mobile_no' => $val[4] ? $val[4] : null, + 'email' => $val[5], + 'pan_no' => $val[6], + 'adhar_no' => $val[7], + 'passport_no' => $val[8] ? $val[8] : null , + 'address' => $val[9], + 'country' => $val[10], + 'state' => $val[11], + 'city' => $val[12], + 'postal_code' => $val[13], + 'created_by' => $session_uid, + 'XL_file_name' => $fileNewName, + 'ip_address' => $ip_address + ]; + } + } + }else{ + $json = ['error_message' => "There is no record to import"]; + return $this->response->setJSON($json); + } + + if (count($list) > 0) { + $result = $InvoiceModel->bulkInsert($list); + ($result) ? ['success_message' => "All Entries are imported successfully."] + : ['error_message' => "Something went wrong. Please try again."]; + } else { + $json = ['error_message' => "No new record is found."]; + } + return $this->response->setJSON($json); + } } \ No newline at end of file diff --git a/app/Models/AuthenticationModel.php b/app/Models/AuthenticationModel.php index 34b8cb5..349b699 100644 --- a/app/Models/AuthenticationModel.php +++ b/app/Models/AuthenticationModel.php @@ -30,5 +30,17 @@ class AuthenticationModel extends Model return $query->getResultArray(); } + + public function getreminder($bwhere){ + $query = $this->db->table('business'); + $result = $query->where($bwhere)->get()->getResultArray(); + if (count($result) > 0) { + $reminder = $result[0]; + } else { + $reminder = []; + } + return $reminder; + } + } diff --git a/app/Models/BusinessModel.php b/app/Models/BusinessModel.php index 8514d26..7a40ce4 100644 --- a/app/Models/BusinessModel.php +++ b/app/Models/BusinessModel.php @@ -9,7 +9,7 @@ class BusinessModel extends Model { protected $table = 'business'; protected $primaryKey = 'business_id'; - protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','currency']; + protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','currency','12AA','80G_vaildupto','12AA_vaildupto']; public function insertBusiness($data) { diff --git a/app/Models/CustomerModel.php b/app/Models/CustomerModel.php index 2f35653..4366fb5 100644 --- a/app/Models/CustomerModel.php +++ b/app/Models/CustomerModel.php @@ -10,7 +10,7 @@ class CustomerModel extends Model protected $table = 'donor'; protected $primaryKey = 'donor_id '; // protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','isactive','business_id']; - protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','org_name','date_of_birth','pan_no','adhar_no','org_reg_details','donor_type','isactive','business_id','created_by','updated_by']; + protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','org_name','date_of_birth','pan_no','adhar_no','org_reg_details','donor_type','isactive','business_id','created_by','updated_by','XL_file_name','ip_address']; public function insertCustomer($data) { @@ -81,7 +81,27 @@ public function getData($table, $where = null) return $query->get()->getResult(); } + function export_excel($business_id) + { + $builder = $this->db->table('donor') + ->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name') + ->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code') + ->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name') + ->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name') + ->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on') + ->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on') + ->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false) + + ->join('users as creator', ' donor.created_by = creator.user_id', 'left') + ->join('users as updater', ' donor.updated_by = updater.user_id', 'left') + ->where('donor.business_id', $business_id); + $query = $builder->get(); + return $query->getResultArray(); + } + public function bulkInsert($data) { + return $this->db->table('donor')->insertBatch($data); + } } ?> \ No newline at end of file diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index 9e6d133..cabeacb 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -42,4 +42,25 @@ protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes',' } + function export_excel($business_id) + { + $builder = $this->db->table('donor') + ->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name') + ->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code') + ->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name') + ->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name') + ->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on') + ->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on') + ->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false) + ->join('users as creator', ' donor.created_by = creator.user_id', 'left') + ->join('users as updater', ' donor.updated_by = updater.user_id', 'left') + ->where('donor.business_id', $business_id); + $query = $builder->get(); + return $query->getResultArray(); + } + + public function bulkInsert($data) { + return $this->db->table('donor')->insertBatch($data); + } + } \ No newline at end of file diff --git a/app/Views/business_form.php b/app/Views/business_form.php index 361f5a6..d96d89d 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -79,6 +79,28 @@
Please provide.
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
@@ -86,18 +108,11 @@
Please provide.
-
+
Please provide.
- - -
- - -
-
@@ -394,13 +409,34 @@
+ + + \ No newline at end of file diff --git a/app/Views/dashboard.php b/app/Views/dashboard.php index 9e5c002..6b475b6 100644 --- a/app/Views/dashboard.php +++ b/app/Views/dashboard.php @@ -1,3 +1,21 @@ +getFlashdata('reminder')) : + $messages = session()->getFlashdata('reminder'); ?> + + +
diff --git a/app/Views/invoice_list.php b/app/Views/invoice_list.php index 3971fae..99ef082 100644 --- a/app/Views/invoice_list.php +++ b/app/Views/invoice_list.php @@ -16,6 +16,8 @@
@@ -68,14 +70,18 @@ - - org_name.")"; } ?> - donor_id ? $DonorData->first_name . $DonorData->last_name.$suffix : ''; ?> - - + donor_id) { + $suffix = ""; + if ($row['receipt_type'] == "organization" ) { + $suffix = !empty($DonorData->org_name) ? " (" . $DonorData->org_name . ")" : " (-)"; + } + $donor = $DonorData->first_name . ' ' . $DonorData->last_name . $suffix; + break; + } + } ?> +
- \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index fc49aba..1061046 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -105,7 +105,10 @@ -Note:  + +
+
+ Note:  diff --git a/app/Views/template/footer.php b/app/Views/template/footer.php index a9d8148..deb46b7 100644 --- a/app/Views/template/footer.php +++ b/app/Views/template/footer.php @@ -147,7 +147,10 @@ // Automatically close both success and error messages after 5 seconds (5000 milliseconds) setTimeout(function() { document.querySelectorAll('.alert').forEach(function(alert) { - alert.classList.add('d-none'); + // alert.classList.add('d-none'); + if (!alert.classList.contains('remainder')) { // Exclude alerts with the class "remainder" + alert.classList.add('d-none'); + } }); }, 5000); // Adjust the time (in milliseconds) as needed diff --git a/app/Views/template/topbar.php b/app/Views/template/topbar.php index 8cbcdd1..e159c6d 100644 --- a/app/Views/template/topbar.php +++ b/app/Views/template/topbar.php @@ -14,7 +14,15 @@ - + + + +