diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 7eb2bd9..7b5ee1a 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -342,10 +342,13 @@ class MasterController extends BaseController } $docStatusByClientId = []; - $data['clientdata'] = $this->ClientModel->select('client.*, client_branch.name as client_branch_name, client_branch.id as client_branch_id') - ->join('client_branch', 'client.client_id = client_branch.client_id', 'left') + // $data['clientdata'] = $this->ClientModel->select('client.*, client_branch.name as client_branch_name, client_branch.id as client_branch_id') + // ->join('client_branch', 'client.client_id = client_branch.client_id', 'left') + // ->findAll(); + $data['clientdata'] = $this->ClientBranchModel->select('client.*, client_branch.name as client_branch_name, client_branch.id as client_branch_id') + ->join('client', 'client_branch.client_id = client.client_id', 'left') + // ->where('client.business_id',$this->session->get('logged_in_staff_business_id')) ->findAll(); - $data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); // foreach ($data['serviceGroupData'] as $key => $value) { // $check_its_okay = 0; @@ -395,9 +398,10 @@ class MasterController extends BaseController } $docStatusByClientId = []; // Fetch all doc_status entries and group them by client_docs_id - $data['clientdata'] = $this->ClientModel->select('client.*, client_branch.name as client_branch_name, client_branch.id as client_branch_id') - ->join('client_branch', 'client.client_id = client_branch.client_id', 'left') - ->findAll(); + $data['clientdata'] = $this->ClientBranchModel->select('client.*, client_branch.name as client_branch_name, client_branch.id as client_branch_id') + ->join('client', 'client_branch.client_id = client.client_id', 'left') + // ->where('client.business_id',$this->session->get('logged_in_staff_business_id')) + ->findAll(); $data['serviceGroupData'] = $this->ServiceGroupModel->findAll(); // foreach ($data['serviceGroupData'] as $key => $value) { @@ -591,8 +595,14 @@ class MasterController extends BaseController }else if($this->session->has('is_client_logged_in')){ $userData = $this->ClientBranchModel->where('id',$this->session->get('is_client_logged_in'))->get()->getRow(); } + // dd(); $doc_id = $this->request->getVar('doc_id'); - $data['docData'] = $this->ClientDocsModel->docPreview($doc_id); + if(!empty($this->request->getVar('view_from')) && $this->request->getVar('view_from') == 'client'){ + $data['docData'] = $this->ClientDocsModel->clientDocPreview($doc_id); + }else{ + $data['docData'] = $this->ClientDocsModel->docPreview($doc_id); + } + // dd($data['docData']); $data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no , client_branch.gst_no , client_branch.mobile_no , client_branch.email , client_branch.address , @@ -626,23 +636,26 @@ class MasterController extends BaseController public function dateAndYearPlaceholder() { + $currentDate = date('d-m-Y'); $currentYear = date('Y'); - $currentMonth = date('m'); + // $currentMonth = date('m'); + $currentMonth = 1; if ($currentMonth >= 4) { $financialYearStart = $currentYear . '-04-01'; $financialYearEnd = ($currentYear + 1) . '-03-31'; - $financialYear = $currentYear . '-' . ($currentYear + 1); - $assessmentYear = ($currentYear + 1) . '-' . ($currentYear + 2); + $financialYear = ($currentYear - 1) . '-' . ($currentYear ); + $assessmentYear = $currentYear . '-' . ($currentYear + 1); $q1 = '01-04-' . $currentYear . ' to ' . '30-06-' . $currentYear; $q2 = '01-07-' . $currentYear . ' to ' . '30-09-' . $currentYear; $q3 = '01-10-' . $currentYear . ' to ' . '31-12-' . $currentYear; $q4 = '01-01-' . ($currentYear + 1) . ' to ' . '31-03-' . ($currentYear + 1); } else { + $financialYearStart = ($currentYear - 1) . '-04-01'; $financialYearEnd = $currentYear . '-03-31'; - $financialYear = ($currentYear - 1) . '-' . $currentYear; - $assessmentYear = $currentYear . '-' . ($currentYear + 1); + $financialYear = ($currentYear - 2) . '-' . $currentYear - 1; + $assessmentYear = ($currentYear - 1) . '-' . ($currentYear); $q1 = '01-04-' . ($currentYear - 1) . ' to ' . '30-06-' . ($currentYear - 1); $q2 = '01-07-' . ($currentYear - 1) . ' to ' . '30-09-' . ($currentYear - 1); $q3 = '01-10-' . ($currentYear - 1) . ' to ' . '31-12-' . ($currentYear - 1); diff --git a/app/Models/ClientDocsModel.php b/app/Models/ClientDocsModel.php index 27c3b69..ee56485 100644 --- a/app/Models/ClientDocsModel.php +++ b/app/Models/ClientDocsModel.php @@ -36,15 +36,30 @@ class ClientDocsModel extends Model public function docPreview($doc_id){ - $this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,client_docs.body_html ,client_docs.is_active,client_docs.document_name,client_docs.place_holder_object, services.service_name , business.header_html, business.footer_html'); $this->join('template', 'template.template_id = client_docs.template_id','left'); $this->join('services', 'services.service_id = template.service_id','left'); $this->join('business', 'business.business_id = template.template_header_business','left'); + + // if($this->session->get('logged_in_staff_role') == 'Admin' || ){ + // }else{ + // } + $this->where('md5(client_docs.id)', $doc_id); return $this->get()->getRow(); } - + + + public function clientDocPreview($doc_id){ + + $this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_branch_id ,client_docs.updated_at,client_docs.ip_address,template.template_name,client_docs.body_html ,client_docs.is_active,client_docs.document_name,client_docs.place_holder_object, services.service_name , business.header_html, business.footer_html'); + $this->join('template', 'template.template_id = client_docs.template_id','left'); + $this->join('services', 'services.service_id = template.service_id','left'); + $this->join('business', 'business.business_id = template.template_header_business','left'); + $this->where('client_docs.id', $doc_id); + + return $this->get()->getRow(); + } } \ No newline at end of file diff --git a/app/Views/client_home.php b/app/Views/client_home.php index c8bbd0e..2a6790b 100644 --- a/app/Views/client_home.php +++ b/app/Views/client_home.php @@ -63,7 +63,7 @@ diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 235a4a5..6b923e5 100644 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -171,7 +171,7 @@
- +
diff --git a/app/Views/share_docs.php b/app/Views/share_docs.php index 0048776..8f0c267 100644 --- a/app/Views/share_docs.php +++ b/app/Views/share_docs.php @@ -144,7 +144,7 @@ - Remember + Reminder