FIX_1_IunsurerFilterforPolicyReportAndExportExcelAlso_2_AgentCodeAndAgentNameAddedForPolicyVerifyScreen
This commit is contained in:
parent
68ede6f3dd
commit
73bd213a07
@ -51,6 +51,7 @@ class EnquiryController extends ResourceController
|
||||
|
||||
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
||||
$show_policy_report = $this->request->getGet('show_policy_report') ?? 'All';
|
||||
$insurer_id = $this->request->getGet('insurer_id') ?? null;
|
||||
|
||||
|
||||
// Date filter handling
|
||||
@ -70,15 +71,15 @@ class EnquiryController extends ResourceController
|
||||
|
||||
|
||||
if (!empty($staff_id) && !empty($manager_id)) {
|
||||
$data = $this->enquiryModel->getEnquiry('STAFF&MANAGER', [$staff_id,$manager_id], $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||
$data = $this->enquiryModel->getEnquiry('STAFF&MANAGER', [$staff_id,$manager_id], $only_policy_data, $show_policy_report,$insurer_id , $from_date, $to_date, $status ,$enquiry_status);
|
||||
} elseif (!empty($agent_id)) {
|
||||
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $show_policy_report, $insurer_id , $from_date, $to_date, $status ,$enquiry_status);
|
||||
} elseif (!empty($staff_id)) {
|
||||
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $show_policy_report, $insurer_id , $from_date, $to_date, $status ,$enquiry_status);
|
||||
} elseif (!empty($enquiry_id)) {
|
||||
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data, $show_policy_report);
|
||||
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data, $show_policy_report,$insurer_id);
|
||||
} elseif (!empty($manager_id)) {
|
||||
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $show_policy_report, $insurer_id , $from_date, $to_date, $status ,$enquiry_status);
|
||||
}elseif (!empty($handler_id)) {
|
||||
|
||||
$staffData = $this->db->table('partner_staff ps')
|
||||
@ -91,7 +92,7 @@ class EnquiryController extends ResourceController
|
||||
->get()->getResultArray();
|
||||
$staffIds = array_column($staffData, 'id');
|
||||
|
||||
$data = $this->enquiryModel->getEnquiry('HANDLER',$staffIds, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||
$data = $this->enquiryModel->getEnquiry('HANDLER',$staffIds, $only_policy_data, $show_policy_report, $insurer_id , $from_date, $to_date, $status ,$enquiry_status);
|
||||
} else {
|
||||
$data = $this->enquiryModel->getEnquiry('ALL');
|
||||
}
|
||||
|
||||
@ -93,6 +93,7 @@ class PolicyController extends ResourceController
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
$record = $this->PolicyModel->select('partner_policy.* , ipti.insurance_plan_type,pq.insurance_plan_type_id,pq.insurer_id, i.name as insurer_name,i.short_name as insurer_short_name,Q.payment_mode_id,A.retention_rate as agent_retention_rate,S.retention_rate as manager_retention_rate, pe.vehicle_type_id as enquiry_vehicle_type_id_for_commission,pe.broker_id as enquiry_broker_id_for_commission, pe.reg_no as enquiry_reg_no_for_commission,pe.reg_no as enquiry_reg_no_for_commission')
|
||||
->select('a.agent_code,a.name as agent_name')
|
||||
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
|
||||
->join('partner_enquiry pe', 'pe.id = partner_policy.enquiry_id', 'left')
|
||||
->join('partner_quotation Q', 'Q.enquiry_id = pe.id AND Q.status = "Accepted" ', 'left')
|
||||
@ -100,6 +101,7 @@ class PolicyController extends ResourceController
|
||||
->join('partner_agent A', 'A.id = partner_policy.agent_id', 'left')
|
||||
->join('partner_staff S', 'S.id = partner_policy.manager_id', 'left')
|
||||
->join('insurers i', 'i.id = pq.insurer_id', 'left')
|
||||
->join('partner_agent a', 'a.id = pe.agent_id', 'left')
|
||||
->find((int)$id);
|
||||
|
||||
$record['issued_date'] = format_date_for_client($record['issued_date']);
|
||||
|
||||
@ -22,6 +22,7 @@ class PolicyReportController extends Controller
|
||||
$fromDate = DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d 00:00:00');
|
||||
$toDate = DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d 23:59:59');
|
||||
$show_policy_report = $this->request->getGet('show_policy_report') ?? 'All';
|
||||
$insurer_id = $this->request->getGet('insurer_id') ?? '';
|
||||
|
||||
if ($show_policy_report === 'Verified') {
|
||||
$statusValues = [1];
|
||||
@ -198,9 +199,10 @@ class PolicyReportController extends Controller
|
||||
AND pe.is_quick_quote = 0
|
||||
AND pp.id IS NOT NULL
|
||||
AND pp.created_on BETWEEN ? AND ?
|
||||
AND pe.manager_id = ?";
|
||||
AND pe.manager_id = ?
|
||||
AND ins.id = ?";
|
||||
|
||||
$bindings = [$fromDate, $toDate, $managerId ];
|
||||
$bindings = [$fromDate, $toDate, $managerId,$insurer_id ];
|
||||
|
||||
$whereIn = implode(',', array_fill(0, count($statusValues), '?'));
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class EnquiryModel extends Model
|
||||
protected $updatedField = 'updated_on';
|
||||
|
||||
|
||||
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $show_policy_report = 'All', $from_date = null, $to_date = null , $status = null , $enquiry_status = null)
|
||||
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $show_policy_report = 'All',$insurer_id = null, $from_date = null, $to_date = null , $status = null , $enquiry_status = null)
|
||||
{
|
||||
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
|
||||
VT.vehicle_type as vehicle_type,
|
||||
@ -91,6 +91,10 @@ class EnquiryModel extends Model
|
||||
|
||||
$data->where('P.id IS NOT NULL');
|
||||
|
||||
if($insurer_id != null){
|
||||
$data->where('partner_enquiry.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if($from_date != null){
|
||||
$data->where("P.created_on >=", $from_date)
|
||||
->where("P.created_on <=", $to_date);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user