diff --git a/app/Controllers/Business.php b/app/Controllers/Business.php
index 07ec03e..ba3c10c 100644
--- a/app/Controllers/Business.php
+++ b/app/Controllers/Business.php
@@ -69,6 +69,8 @@ class Business extends BaseController
$data['master_organzation_details']=$this->organzation_details();
$data['session_bid']=$session_bid;
+ $data['country_details'] = $this->get_country_details();
+ // print_r($data['donation']);die;
$this->render_page('business_form', $data);
}
@@ -129,6 +131,8 @@ class Business extends BaseController
## Business Data
$BusinessModel = new BusinessModel();
+ print_r( $this->request->getPost('currency'));
+
$data = [
'title' => $this->request->getPost('bname'),
'email' => $this->request->getPost('bmail'),
@@ -149,13 +153,12 @@ class Business extends BaseController
'admin_email' => $this->request->getPost('admin_email'),
'site_mobile'=> $this->request->getPost('site_mobile'),
'copyright'=> $this->request->getPost('copyright'),
- 'currency'=> $this->request->getPost('currency'),
+ 'currency'=> serialize($this->request->getPost('currency')),
'country'=> $this->request->getPost('country'),
'start_no'=> $this->request->getPost('start_no'),
'left_pad'=> $this->request->getPost('left_pad'),
'prefix_format'=> $this->request->getPost('prefix_format'),
];
-
if ($fileName !== "") {
$data['business_logo'] = $fileName;
}
@@ -167,7 +170,7 @@ class Business extends BaseController
}
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
-
+// print_r($data);die;
if (empty($business_id)) {
// It's an insert operation
$data['created_by'] = $session_uid;
@@ -305,4 +308,12 @@ class Business extends BaseController
$db->table('donation_business')->insertBatch($donationData);
}
}
+
+ public function get_country_details()
+ {
+ $model = new BusinessModel();
+ $model->setTable('countries');
+ $country_details = $model->orderBy('country_id', 'ASC')->findAll();
+ return $country_details;
+ }
}
diff --git a/app/Controllers/Customer.php b/app/Controllers/Customer.php
index c9d54f0..718e407 100644
--- a/app/Controllers/Customer.php
+++ b/app/Controllers/Customer.php
@@ -658,41 +658,45 @@ class Customer extends BaseController
$spreadsheet = $reader->load($path.$fileNewName);
$sheet_data = $spreadsheet->getActiveSheet()->toArray();
if (!empty($sheet_data)) {
- $flag = 0;
$final_notes = [];
$list = [];
foreach ($sheet_data as $key => $val) {
if ($key != 0 && trim($val[0]) && trim($val[1])) { // key zero - header
- $flag = 0;
+ // $flag = 0;
+ $is_duplicate = false;
$notes = [];
- if ($val[4]) {
- $validate = $this->check_existing($val[4], 'donor', 'mobile_no');
- if ($validate) { $notes[] = $validate; $flag++;}
+ $invalid_fields = [];
+ if($val[6] != ""){
+ if ($this->check_existing($val[6], 'donor', 'pan_no')) {
+ $is_duplicate = true;
+ $invalid_fields[] = "PAN number";
+ }
}
- if ($val[5]) {
- $validate = $this->check_existing($val[5], 'donor', 'email');
- if ($validate) { $notes[] = $validate; $flag++;}
+ if($val[7] != ""){
+ if ($this->check_existing($val[7], 'donor', 'adhar_no')) {
+ $is_duplicate = true;
+ $invalid_fields[] = "Aadhar number";
+ }
}
- if ($val[6]) {
- $validate = $this->check_existing($val[6], 'donor', 'pan_no');
- if ($validate) { $notes[] = $validate; $flag++;}
+ if($val[8] != ""){
+ if ($this->check_existing($val[8], 'donor', 'passport_no')) {
+ $is_duplicate = true;
+ $invalid_fields[] = "passport number";
+ }
}
- if ($val[7]) {
- $validate = $this->check_existing($val[7], 'donor', 'adhar_no');
- if ($validate) { $notes[] = $validate; $flag++;}
- }
- if ($val[8]) {
- $validate = $this->check_existing($val[8], 'donor', 'passport_no');
- if ($validate) { $notes[] = $validate; $flag++;}
- }
- if ($flag > 0) {
- $final_notes[] = $val[0] . ' has duplicate entries: ' . implode(',', $notes);
- } else {
+ if ($is_duplicate) {
+ $notes[] = $val[0] . " is invalid because " . implode(" and ", $invalid_fields) . " (already exists)";
+ }
+
+
+ if ($is_duplicate) {
+ $final_notes = array_merge($final_notes, $notes);
+ } else {
$list[] = [
'business_id' => $session_bid,
'first_name' => $val[0],
- 'donor_type' => ucfirst(strtolower($val[1])),
+ 'donor_type' => strtolower($val[1]),
'org_name' => $val[2] ? $val[2] : null,
'org_reg_details' => $val[3] ? $val[3] : null,
'mobile_no' => $val[4] ? $val[4] : null,
@@ -718,13 +722,16 @@ class Customer extends BaseController
$CustomerModel = new CustomerModel();
$result = $CustomerModel->bulkInsert($list);
$response = $result ? [
- 'success_message' => count($list) . " Contributors imported successfully. " . implode("\n", $final_notes)
+ 'success_message' => count($list) . " Contributors imported successfully.".(count($final_notes) > 0 ? count($final_notes) . " duplicate entries found.
" : ""),
] : ['error_message' => "Something went wrong. Please try again."];
+ $response['message_in_details'] = implode("
", $final_notes);
} else {
- $response = ['error_message' => "No new record is found." . implode("\n", $final_notes)];
- }
+ $response = [
+ 'error_message' => "No new record is found.",
+ 'message_in_details' => implode("
", $final_notes),
+ ]; }
} else {
- $response = ['error_message' => "There is no record to import"];
+ $response = ['error_message' => "There is no record to import", 'message_in_details' => ''];
}
return $this->response->setJSON($response);
}
diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php
index 9f6ce6a..33f0cb7 100644
--- a/app/Controllers/Invoice.php
+++ b/app/Controllers/Invoice.php
@@ -148,6 +148,8 @@ class Invoice extends BaseController
// Get customer names for the dropdown, events details, and books details
$data['currency'] = $this->BusinessModel->select('currency')->where($where)->findAll();
$data['currency_code'] = $this->BusinessModel->select('currency')->where($where)->first()['currency'] ?? null;
+ $query = $this->BusinessModel->select('currency')->where($where)->first();
+ $data['currencies'] = unserialize($query['currency']);
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id())->where('isactive',1)->get()->getResult();
$data['campaign'] = $model->getData('campaign', $where);
@@ -174,7 +176,7 @@ class Invoice extends BaseController
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$data['receipt_type']];
$data['typebaseddonors'] = $model->getData('donor', $cus_where);
$data['alldonors'] = $model->getData('donor', ['business_id' => (int)get_business_id() , 'isactive' => 1]);
-// print_r($data);die;
+// print_r($data);die;
$this->render_page('invoice_form', $data);
}
@@ -526,14 +528,15 @@ class Invoice extends BaseController
}
$options = new Options();
+ $options->set('defaultFont', 'DejaVu Sans');
$options->set('isHtml5ParserEnabled', true);
+ $options->set('isFontSubsettingEnabled', true);
$options->set('isPhpEnabled', true);
$options->set('isRemoteEnabled', true);
$options->set('font_subsetting', true);
$options->set('tempDir', sys_get_temp_dir());
- $options->set('defaultFont', 'DejaVuSans');
-
- $options->set('chroot', base_url()."public/uploads");
+ //$options->set('chroot', base_url()."public/uploads");
+ $options->set('chroot', FCPATH . 'public/uploads');
$dompdf = new Dompdf($options);
@@ -542,14 +545,9 @@ class Invoice extends BaseController
clearstatcache();
- // var_dump(file_exists($logoPath));
- if ($data[0]->business_logo && file_exists(ROOTPATH."public/uploads/".$data[0]->business_logo)) {
- // echo "Inside: Logo exists
";
- $baseurl = base_url()."public/uploads/".$data[0]->business_logo;
- } else {
- // echo "Inside: Logo does not exist
"; die;
- $baseurl = base_url()."public/uploads/default.png";
- }
+ $logoPath = FCPATH . "public/uploads/" . $data[0]->business_logo;
+ $baseurl = $data[0]->business_logo && file_exists($logoPath) ? base_url("public/uploads/" . $data[0]->business_logo) : base_url("public/uploads/default.png");
+
$digits = strlen((string)$data[0]->amount);
$amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount;
$html = view('invoice_pdf_template', [
@@ -566,11 +564,13 @@ class Invoice extends BaseController
'twelveAAVaildUpto' => $terms_data[0]['twelveAAVaildUpto'],
]);
- // echo $html;die;
+ //echo $html;die;
$dompdf->loadHtml($html);
- $dompdf->setPaper('letter', 'landscape');
-
+ // $dompdf->setPaper('letter', 'landscape');
+
+ $dompdf->setPaper('A5', 'landscape');
+
$dompdf->render();
if($dest == 'mail') {
diff --git a/app/Models/BusinessModel.php b/app/Models/BusinessModel.php
index 7a40ce4..f140422 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','12AA','80G_vaildupto','12AA_vaildupto'];
+ 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','country','currency','12AA','80G_vaildupto','12AA_vaildupto'];
public function insertBusiness($data)
{
diff --git a/app/Views/auth_confirm_mail.php b/app/Views/auth_confirm_mail.php
index 69be357..70666a0 100644
--- a/app/Views/auth_confirm_mail.php
+++ b/app/Views/auth_confirm_mail.php
@@ -42,7 +42,7 @@
-
+
" alt="" height="55">
diff --git a/app/Views/auth_lock_screen.php b/app/Views/auth_lock_screen.php
index 08ecefa..c1905aa 100644
--- a/app/Views/auth_lock_screen.php
+++ b/app/Views/auth_lock_screen.php
@@ -40,7 +40,7 @@
-
+
" alt="" height="55">
diff --git a/app/Views/auth_login.php b/app/Views/auth_login.php
index db6830b..a8b07d9 100644
--- a/app/Views/auth_login.php
+++ b/app/Views/auth_login.php
@@ -43,7 +43,7 @@
-
+
" alt="" height="80">
diff --git a/app/Views/auth_logout.php b/app/Views/auth_logout.php
index ff52303..2c13e07 100644
--- a/app/Views/auth_logout.php
+++ b/app/Views/auth_logout.php
@@ -41,7 +41,7 @@
-
+
" alt="" height="55">
diff --git a/app/Views/business_form.php b/app/Views/business_form.php
index 1dbc4d4..c559221 100644
--- a/app/Views/business_form.php
+++ b/app/Views/business_form.php
@@ -115,21 +115,34 @@
= $data->org_address ?> = $data->org_city ? ",".$data->org_city :""; ?> = $data->org_state ? ",".$data->org_state :""; ?> = $data->org_zip ? ",".$data->org_zip.".":""; ?>
- = $data->org_mobile ? "Mobile No: ".$data->org_mobile.", ":""; ?> = $data->org_email ? "Email: ".$data->org_email.", ":""; ?>
+ = $data->org_mobile ? "Mobile No: ".$data->org_mobile.", ":""; ?> = $data->org_email ? "Email: ".$data->org_email.",
":""; ?>
= $data->org_pan ? "PAN No: ".$data->org_pan.", ":""; ?> = $data->org_reg_no ? "Register No: ".$data->org_reg_no:""; ?>
Received with thanks from = $data->customer_name . ($data->cust_org_name ? ' (' . $data->cust_org_name . ')' : '') ?>cust_pan_no) { echo ', PAN '.$data->cust_pan_no.''; } ?>, a sum of = $currency ?> = $currency_in_words ? $currency_in_words.' Only' :'' ?> (= $currency ?>.= $data->amount ?>), towards = $data->cause_name ?>.
Received with thanks from = $data->customer_name . ($data->cust_org_name ? ' (' . $data->cust_org_name . ')' : '') ?>cust_pan_no) { echo ', PAN '.$data->cust_pan_no.''; } ?>,
a sum of = $currency ?> = $currency_in_words ? $currency_in_words.' Only' :'' ?> (= $currency ?>.= $data->amount ?>),
towards = $data->cause_name ?>.