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