GWM : pos id handled

This commit is contained in:
Gowtham M 2025-12-18 09:31:53 +05:30
parent ab875a9ab6
commit fc45729bee
6 changed files with 21 additions and 20 deletions

View File

@ -101,7 +101,7 @@ class AgentController extends ResourceController
'sales_executive_id' => $data['sales_executive_id'],
'certificate_file_name' => $certificateFileName,
'created_by' => $data['created_by'],
'pos_id' => $data['pos_id']
'retention_rate' => $data['retention_rate']
];
$this->AgentModel->insert($insertData);
@ -142,7 +142,7 @@ class AgentController extends ResourceController
'agent_code' => $data['agent_code'] ?? null,
'sales_executive_id' => $data['sales_executive_id'] ?? null,
'updated_by' => $data['updated_by'] ?? null,
'pos_id' => $data['pos_id'] ?? null
'retention_rate' => $data['retention_rate'] ?? null
];
if ($certificateFile && $certificateFile->isValid()) {

View File

@ -35,11 +35,11 @@ class InvoiceController extends ResourceController
{
try {
$data = $this->InvoiceModel->select('partner_invoice.*, PB.name as broker_name, PA.name as agent_name,
$data = $this->InvoiceModel->select('partner_invoice.*, PB.name as broker_name, pos.name as pos_name,
FORMAT(partner_invoice.invoice_amount, 2, "en_IN") AS invoice_amount_indian_format,
DATE_FORMAT(partner_invoice.invoice_date, "%d-%m-%Y") AS invoice_date_ui_format')
->join('partner_brokers PB', 'PB.id = partner_invoice.broker_id', 'left')
->join('partner_agent PA', 'PA.id = partner_invoice.agent_id', 'left')
->join('partner_pos pos', 'pos.id = partner_invoice.pos_id', 'left')
->where('partner_invoice.is_active', 1)
->orderBy('partner_invoice.id', 'DESC')
->findAll();
@ -102,7 +102,7 @@ class InvoiceController extends ResourceController
'invoice_no' => $input['invoice_no'] ?? '',
'invoice_amount' => $input['invoice_amount'] ?? 0,
'broker_id' => $input['broker_id'] ?? 0,
'agent_id' => $input['agent_id'] ?? '',
'pos_id' => $input['pos_id'] ?? 0,
'till_date' => $input['till_date'] ? date('Y-m-d', strtotime($input['till_date'])) : null,
'invoice_date' => $input['invoice_date'] ? date('Y-m-d', strtotime($input['invoice_date'])) : null,
'payout_status' => 1,
@ -197,15 +197,13 @@ class InvoiceController extends ResourceController
public function getCommissionRateList()
{
try {
$input = $this->request->getJSON(true);
if (empty($input['agent_id']) || empty($input['issued_date'])) {
return $this->respond([
'status' => 'failed',
'code' => 400,
'message'=> 'agent_id and issued_date are required'
], 400);
if (empty($input['broker_id']) || empty($input['issued_date'])) {
return $this->respond([ 'status' => 'failed', 'code' => 400, 'message'=> 'issued_date are required' ], 400);
}
$invoice_id = isset($input['invoice_id']) ? $input['invoice_id'] : '';
@ -217,7 +215,7 @@ class InvoiceController extends ResourceController
'left'
)
->join('partner_quotation pq','pq.id = partner_policy.quotation_id ', 'left')
->where('partner_policy.agent_id', $input['agent_id'])
// ->where('partner_policy.pos_id', $input['pos_id'])
->where('partner_policy.issued_date <=', date('Y-m-d', strtotime($input['issued_date'])))
->where('partner_policy.is_active', 1)
->where('partner_policy.is_data_accuracy_checked', 1)
@ -234,7 +232,7 @@ class InvoiceController extends ResourceController
->join('partner_quotation pq','pq.id = partner_policy.quotation_id ', 'left')
->join('partner_invoice_items pii', 'pii.policy_id = partner_policy.id', 'left' )
->join('partner_invoice pi', 'pi.id = pii.invoice_id AND pi.is_active = 1', 'left')
->where('partner_policy.agent_id', $input['agent_id'])
// ->where('partner_policy.pos_id', $input['pos_id'])
->where('partner_policy.issued_date <=', date('Y-m-d', strtotime($input['issued_date'])))
->where('partner_policy.is_active', 1)
->where('partner_policy.commission_amount > 0')

View File

@ -93,7 +93,7 @@ class PolicyController extends ResourceController
try {
$id = $this->request->getGet('id');
$record = $this->PolicyModel->select('partner_policy.* , ipti.insurance_plan_type,')
$record = $this->PolicyModel->select('partner_policy.* , ipti.insurance_plan_type,pq.insurer_id')
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
->join('partner_insurance_plan_type_master ipti', 'ipti.id = pq.insurance_plan_type_id', 'left')
->find($id);
@ -342,7 +342,7 @@ class PolicyController extends ResourceController
}
//fetch enquiry_id & agent_id
$quotData = $this->QuotationModel->select('partner_quotation.*,E.agent_id,E.name , A.pos_id')
$quotData = $this->QuotationModel->select('partner_quotation.*,E.agent_id,E.name ')
->join('partner_enquiry E', 'E.id = partner_quotation.enquiry_id', 'left')
->join('partner_agent A', 'A.id = E.agent_id', 'left')
->where('partner_quotation.id',$data['quotation_id'])
@ -384,8 +384,7 @@ class PolicyController extends ResourceController
'manager_id' => $data['manager_id'],
'agent_id' => $quotData['agent_id'],
'policy_pdf_file_name' => $pdfFileName,
'created_by' => $data['created_by'],
'pos_id' => $quotData['pos_id']
'created_by' => $data['created_by']
];
$policyId = $this->PolicyModel->insert($insertData);

View File

@ -25,7 +25,8 @@ class AgentModel extends Model
'created_on',
'updated_by',
'updated_on',
'pos_id'
'pos_id',
'retention_rate'
];
protected $useTimestamps = false; // we manually handle created_on & updated_on

View File

@ -25,7 +25,8 @@ class InvoiceModel extends Model
'created_at',
'created_by',
'updated_at',
'updated_by'
'updated_by',
'pos_id',
];
// Timestamps

View File

@ -20,7 +20,9 @@ class StaffModel extends Model
'created_by',
'created_on',
'updated_by',
'updated_on'
'updated_on',
'pos_id',
'retention_rate'
];
protected $useTimestamps = false; // we manually manage created_on / updated_on