73 lines
2.2 KiB
PHP
Executable File
73 lines
2.2 KiB
PHP
Executable File
<?php
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class PartnerPolicyModel extends Model
|
|
{
|
|
protected $table = 'partner_policy';
|
|
protected $primaryKey = 'id';
|
|
protected $useAutoIncrement = true;
|
|
|
|
// Allowed fields (make sure to include only updatable/insertable ones)
|
|
protected $allowedFields = [
|
|
'quotation_id',
|
|
'insured_name',
|
|
'rc_no',
|
|
'premium_amount',
|
|
'policy_number',
|
|
'payment_mode',
|
|
'policy_pdf_file_name',
|
|
'policy_payment_receipt_file_name',
|
|
'is_active',
|
|
'issued_date',
|
|
'start_date',
|
|
'end_date',
|
|
'manager_id',
|
|
'client_id',
|
|
'client_policy_id',
|
|
'vehicle_id',
|
|
'policy_transaction_id',
|
|
'pt_oc_share_details_id',
|
|
'created_by',
|
|
'updated_by'
|
|
];
|
|
|
|
// Optional settings
|
|
protected $useTimestamps = true; // enables auto timestamp
|
|
protected $createdField = 'created_on';
|
|
protected $updatedField = 'updated_on';
|
|
protected $dateFormat = 'datetime';
|
|
|
|
|
|
public function partnerPolicyList()
|
|
{
|
|
return $this->db->table('partner_policy as pp')
|
|
->select('
|
|
pp.id,
|
|
pp.id as partner_policy_id,
|
|
pp.enquiry_id,
|
|
pp.insured_name,
|
|
pp.policy_number,
|
|
pp.agent_id,
|
|
pp.manager_id,
|
|
pp.client_id,
|
|
pp.client_policy_id,
|
|
pp.is_active as partner_policy_is_active,
|
|
pe.insurer_id,
|
|
pe.is_active as partner_enquiry_is_active,
|
|
i.name as insurer_name,
|
|
i.short_name as insurer_short_name,
|
|
i.is_active as insurer_is_active
|
|
')
|
|
->join('partner_enquiry as pe', 'pe.id = pp.enquiry_id', 'left')
|
|
->join('insurers as i', 'i.id = pe.insurer_id', 'left')
|
|
->where('pp.is_active', 1)
|
|
->get()
|
|
->getResultArray();
|
|
}
|
|
// $data['partner_policy_list'] = $this->partnerPolicyModel
|
|
// ->where('is_active', 1)
|
|
// ->findAll();
|
|
}
|