FIX_BDS_REPORT QUERY
This commit is contained in:
parent
491788189b
commit
1c03df4848
@ -336,9 +336,9 @@ class EmployeeController extends AdminController
|
|||||||
//endof validation process
|
//endof validation process
|
||||||
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
||||||
if(!empty($post_data)){
|
if(!empty($post_data)){
|
||||||
return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id];
|
return ['status' => false, 'message' => 'File rejected with errors', 'file_id' => $file_id];
|
||||||
}else{
|
}else{
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File rejected with errors'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else //if file size greater than 1 add the file as job
|
} else //if file size greater than 1 add the file as job
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
|
use Kint;
|
||||||
|
|
||||||
class PolicyTransactionModel extends Model
|
class PolicyTransactionModel extends Model
|
||||||
{
|
{
|
||||||
@ -3168,9 +3169,10 @@
|
|||||||
pt.installment,
|
pt.installment,
|
||||||
nhance_branch.branch_name as nhance_branch,
|
nhance_branch.branch_name as nhance_branch,
|
||||||
|
|
||||||
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month,
|
||||||
pt.month as statement_month,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS statement_year_month,
|
||||||
|
pcsd.pt_policy_issue_date as statement_month,
|
||||||
|
|
||||||
'no statement uploaded' AS statement_uploaded,
|
'no statement uploaded' AS statement_uploaded,
|
||||||
|
|
||||||
@ -3331,8 +3333,9 @@
|
|||||||
pt.installment,
|
pt.installment,
|
||||||
nhance_branch.branch_name as nhance_branch,
|
nhance_branch.branch_name as nhance_branch,
|
||||||
|
|
||||||
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
|
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
|
||||||
|
DATE_FORMAT(insq.month, '%b %Y') AS statement_year_month,
|
||||||
insq.month as statement_month,
|
insq.month as statement_month,
|
||||||
|
|
||||||
'statement uploaded' AS statement_uploaded,
|
'statement uploaded' AS statement_uploaded,
|
||||||
@ -3392,7 +3395,7 @@
|
|||||||
(pcsd.agreed_tp_per + pcsd.agreed_tep_per) AS agreed_tp_or_ter_per,
|
(pcsd.agreed_tp_per + pcsd.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN insq.month = pt.month THEN pcsd.exp_amt
|
WHEN DATE_FORMAT(insq.month, '%Y-%m') = DATE_FORMAT(pcsd.pt_policy_issue_date, '%Y-%m') THEN pcsd.exp_amt
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END AS total_irda_amt_2,
|
END AS total_irda_amt_2,
|
||||||
|
|
||||||
@ -3521,8 +3524,9 @@
|
|||||||
pt.installment,
|
pt.installment,
|
||||||
nhance_branch.branch_name as nhance_branch,
|
nhance_branch.branch_name as nhance_branch,
|
||||||
|
|
||||||
DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
|
DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month,
|
||||||
|
DATE_FORMAT(insq.month, '%b %Y') AS statement_year_month,
|
||||||
insq.month as statement_month,
|
insq.month as statement_month,
|
||||||
|
|
||||||
'statement uploaded' AS statement_uploaded,
|
'statement uploaded' AS statement_uploaded,
|
||||||
@ -3704,7 +3708,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// $countofalldata = count($result);
|
// $countofalldata = count($result);
|
||||||
// dd($result);
|
// Kint::dump($result);
|
||||||
// dd($this->db->getLastQuery()->getQuery());
|
// dd($this->db->getLastQuery()->getQuery());
|
||||||
|
|
||||||
$keys = [];
|
$keys = [];
|
||||||
@ -3732,7 +3736,7 @@
|
|||||||
|
|
||||||
// ✅ Stable key (NO reward flag)
|
// ✅ Stable key (NO reward flag)
|
||||||
$key = implode('|', [
|
$key = implode('|', [
|
||||||
$row['statement_month'],
|
$row['statement_year_month'],
|
||||||
$row['insurer_name'],
|
$row['insurer_name'],
|
||||||
$row['policy_no'],
|
$row['policy_no'],
|
||||||
$endorsement_number,
|
$endorsement_number,
|
||||||
@ -3753,7 +3757,7 @@
|
|||||||
// Reindex final output
|
// Reindex final output
|
||||||
$result = array_values($filtered);
|
$result = array_values($filtered);
|
||||||
|
|
||||||
// dd($countofalldata, $result);
|
// dd($result);
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -3776,7 +3780,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($totalIrdaMap);
|
// dd($totalBilled, $totalIrdaMap);
|
||||||
|
|
||||||
$ptSeen = [];
|
$ptSeen = [];
|
||||||
$final = [];
|
$final = [];
|
||||||
@ -3785,8 +3789,10 @@
|
|||||||
$ptId = $row['pt_id'].'-'.$row['insurer_id'];
|
$ptId = $row['pt_id'].'-'.$row['insurer_id'];
|
||||||
if (!isset($ptSeen[$ptId])) {
|
if (!isset($ptSeen[$ptId])) {
|
||||||
// First entry → set unbilled amount
|
// First entry → set unbilled amount
|
||||||
$row['unbilled_amount'] = (float) (($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0)) ?? '0.00';
|
$row['unbilled_amount'] = round(
|
||||||
|
(float) (($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0)),
|
||||||
|
2
|
||||||
|
);
|
||||||
$ptSeen[$ptId] = true;
|
$ptSeen[$ptId] = true;
|
||||||
} else {
|
} else {
|
||||||
// Other entries → zero
|
// Other entries → zero
|
||||||
|
|||||||
@ -2713,13 +2713,10 @@
|
|||||||
if(allocg != 'EB'){
|
if(allocg != 'EB'){
|
||||||
tp = parseFloat($('#tp_premium_' + input).val()) || 0;
|
tp = parseFloat($('#tp_premium_' + input).val()) || 0;
|
||||||
}
|
}
|
||||||
// do not remove this commented item
|
|
||||||
// if(bap == 'Motor'){
|
|
||||||
// tp = parseFloat($('#tp_premium_' + input).val()) || 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
var tep = 0;
|
var tep = 0;
|
||||||
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
|
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
|
||||||
|
if(allocg != 'EB'){
|
||||||
tep = parseFloat($('#ter_premium_' + input).val()) || 0;
|
tep = parseFloat($('#ter_premium_' + input).val()) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2732,7 +2729,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cotep = 0;
|
var cotep = 0;
|
||||||
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
|
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
|
||||||
|
if(allocg != 'EB'){
|
||||||
cotep = parseFloat($('#co_ter_premium_' + input).val()) || 0;
|
cotep = parseFloat($('#co_ter_premium_' + input).val()) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user