FIX_REPORT_DATES
This commit is contained in:
parent
281516c5dc
commit
b59ea85659
@ -82,8 +82,8 @@ class AbhiMisReportService
|
|||||||
$data = [
|
$data = [
|
||||||
'meta' => [
|
'meta' => [
|
||||||
'policy_id' => $policyId,
|
'policy_id' => $policyId,
|
||||||
'last_refresh' => $this->dumpFileModel->getGeneratedAtForPolicy($policyId),
|
'last_refresh' => $this->dumpFileModel->getGeneratedAtForPolicy($policyId, 'd-M-Y') ?: date('d-M-Y'),
|
||||||
'generated_at' => date('d-M-Y'),
|
'generated_at' => $this->dumpFileModel->getGeneratedAtForPolicy($policyId, 'd-M-Y') ?: date('d-M-Y'),
|
||||||
'quote_type' => 'IPD + OPD',
|
'quote_type' => 'IPD + OPD',
|
||||||
'client_name' => trim((string) ($policy['client_name'] ?? '')),
|
'client_name' => trim((string) ($policy['client_name'] ?? '')),
|
||||||
'tpa_name' => trim((string) ($policy['tpa_name'] ?? 'Aditya Birla Health Insurance Co. Limited')),
|
'tpa_name' => trim((string) ($policy['tpa_name'] ?? 'Aditya Birla Health Insurance Co. Limited')),
|
||||||
|
|||||||
@ -125,15 +125,17 @@ class IciciMisReportService
|
|||||||
|
|
||||||
$startDate = $this->formatDate($policy['policy_start_date'] ?? $exposure['policy_start_date'] ?? null);
|
$startDate = $this->formatDate($policy['policy_start_date'] ?? $exposure['policy_start_date'] ?? null);
|
||||||
$endDate = $this->formatDate($policy['policy_end_date'] ?? $exposure['policy_end_date'] ?? null);
|
$endDate = $this->formatDate($policy['policy_end_date'] ?? $exposure['policy_end_date'] ?? null);
|
||||||
$uploadAt = $this->dumpFileModel->getGeneratedAtForPolicy($policyId) ?: date('d/m/Y g:i:s A');
|
$dumpTs = $this->dumpFileModel->getLatestClaimDumpTimestamp($policyId) ?: time();
|
||||||
|
$uploadAt = date('d/m/Y g:i:s A', $dumpTs);
|
||||||
|
$reportMonth = date('F-Y', $dumpTs);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'meta' => [
|
'meta' => [
|
||||||
'policy_id' => $policyId,
|
'policy_id' => $policyId,
|
||||||
'client_name' => trim((string) ($policy['client_name'] ?? '')),
|
'client_name' => trim((string) ($policy['client_name'] ?? '')),
|
||||||
'report_month' => date('F-Y'),
|
'report_month' => $reportMonth,
|
||||||
'data_upload' => $uploadAt,
|
'data_upload' => $uploadAt,
|
||||||
'generated_at' => date('d-M-Y'),
|
'generated_at' => date('d-M-Y', $dumpTs),
|
||||||
'tpa_name' => trim((string) ($policy['tpa_name'] ?? 'ICICI Lombard')),
|
'tpa_name' => trim((string) ($policy['tpa_name'] ?? 'ICICI Lombard')),
|
||||||
],
|
],
|
||||||
'header' => [
|
'header' => [
|
||||||
@ -153,7 +155,7 @@ class IciciMisReportService
|
|||||||
'claim_cost' => $claimCost,
|
'claim_cost' => $claimCost,
|
||||||
'gross_incurred_cost' => $grossInc,
|
'gross_incurred_cost' => $grossInc,
|
||||||
'loss_ratio' => $lossRatio,
|
'loss_ratio' => $lossRatio,
|
||||||
'as_on' => date('m/d/Y'),
|
'as_on' => date('m/d/Y', $dumpTs),
|
||||||
],
|
],
|
||||||
'claims_summary' => $claimsSummary,
|
'claims_summary' => $claimsSummary,
|
||||||
'iltc_summary' => $iltcSummary,
|
'iltc_summary' => $iltcSummary,
|
||||||
|
|||||||
@ -127,8 +127,9 @@ class MediAssistMisReportService
|
|||||||
$policyEndRaw = $policy['policy_end_date'] ?? $exposure['policy_end_date'] ?? null;
|
$policyEndRaw = $policy['policy_end_date'] ?? $exposure['policy_end_date'] ?? null;
|
||||||
$startDate = $this->formatDateLong($policyStartRaw);
|
$startDate = $this->formatDateLong($policyStartRaw);
|
||||||
$endDate = $this->formatDateLong($policyEndRaw);
|
$endDate = $this->formatDateLong($policyEndRaw);
|
||||||
$reportAsOn = $this->formatDateShort($this->dumpFileModel->getGeneratedAtForPolicy($policyId) ?: date('Y-m-d'));
|
$dumpTs = $this->dumpFileModel->getLatestClaimDumpTimestamp($policyId) ?: time();
|
||||||
$uploadAt = $this->dumpFileModel->getGeneratedAtForPolicy($policyId) ?: date('d/m/Y g:i:s A');
|
$reportAsOn = date('d M Y', $dumpTs);
|
||||||
|
$uploadAt = date('d/m/Y g:i:s A', $dumpTs);
|
||||||
$runDays = $this->policyRunDays($policyStartRaw, $policyEndRaw);
|
$runDays = $this->policyRunDays($policyStartRaw, $policyEndRaw);
|
||||||
|
|
||||||
$statusAgg = $this->aggregateStatus($dumpRows);
|
$statusAgg = $this->aggregateStatus($dumpRows);
|
||||||
@ -161,7 +162,7 @@ class MediAssistMisReportService
|
|||||||
'report_as_on' => $reportAsOn,
|
'report_as_on' => $reportAsOn,
|
||||||
'units' => 'Actuals',
|
'units' => 'Actuals',
|
||||||
'version' => self::VERSION,
|
'version' => self::VERSION,
|
||||||
'generated_at' => date('d-M-Y'),
|
'generated_at' => date('d-M-Y', $dumpTs),
|
||||||
'generated_by' => '',
|
'generated_by' => '',
|
||||||
'upload_at' => $uploadAt,
|
'upload_at' => $uploadAt,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -182,10 +182,8 @@ class VidalMisReportService
|
|||||||
?? $exposure['policy_end_date']
|
?? $exposure['policy_end_date']
|
||||||
?? ($firstDump['policy_end_date'] ?? null);
|
?? ($firstDump['policy_end_date'] ?? null);
|
||||||
|
|
||||||
$generatedAt = $this->dumpFileModel->getGeneratedAtForPolicy($policyId);
|
$generatedAtTs = $this->dumpFileModel->getLatestClaimDumpTimestamp($policyId) ?: time();
|
||||||
$generatedAtDisplay = $generatedAt
|
$generatedAtDisplay = date('d-M-Y', $generatedAtTs);
|
||||||
? $this->formatDateTimeDisplay($generatedAt)
|
|
||||||
: date('d-M-Y H:i');
|
|
||||||
|
|
||||||
$corporateName = trim((string) (
|
$corporateName = trim((string) (
|
||||||
$firstDump['corporate_name']
|
$firstDump['corporate_name']
|
||||||
|
|||||||
@ -58,10 +58,9 @@ class ClaimDumpFileModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latest claim_dump_date for a policy, formatted as dd-mm-yyyy.
|
* Latest claim_dump_date timestamp for a policy (active rows only).
|
||||||
* Returns null when no dump file has a claim_dump_date.
|
|
||||||
*/
|
*/
|
||||||
public function getGeneratedAtForPolicy(int $policyId): ?string
|
public function getLatestClaimDumpTimestamp(int $policyId): ?int
|
||||||
{
|
{
|
||||||
if ($policyId <= 0) {
|
if ($policyId <= 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -82,10 +81,21 @@ class ClaimDumpFileModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ts = strtotime($raw);
|
$ts = strtotime($raw);
|
||||||
if ($ts === false) {
|
|
||||||
|
return $ts === false ? null : $ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Latest claim_dump_date for a policy, formatted.
|
||||||
|
* Returns null when no dump file has a claim_dump_date.
|
||||||
|
*/
|
||||||
|
public function getGeneratedAtForPolicy(int $policyId, string $format = 'd-m-Y'): ?string
|
||||||
|
{
|
||||||
|
$ts = $this->getLatestClaimDumpTimestamp($policyId);
|
||||||
|
if ($ts === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return date('d-m-Y', $ts);
|
return date($format, $ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user