fix pbg task payment

This commit is contained in:
arifal
2025-09-11 13:17:55 +07:00
parent 53d12d6798
commit fc4b419878
5 changed files with 137 additions and 13 deletions

View File

@@ -486,14 +486,14 @@ class BigDataResumeController extends Controller
{
try {
// Get sum and count from PbgTaskPayment model
$totalSum = PbgTaskPayment::whereYear('payment_date', date('Y'))->sum('pad_amount') ?? 0;
$totalCount = PbgTaskPayment::whereYear('payment_date', date('Y'))->count() ?? 0;
$stats = PbgTaskPayment::whereNotNull('payment_date_raw')
->whereNotNull('retribution_total_pad')
->whereYear('payment_date_raw', date('Y'))
->selectRaw('SUM(retribution_total_pad) as total_sum, COUNT(*) as total_count')
->first();
Log::info("Real-time PBG Task Payments Data", [
'total_records' => $totalCount,
'total_sum' => $totalSum,
'source' => 'pbg_task_payments table'
]);
$totalSum = $stats->total_sum ?? 0;
$totalCount = $stats->total_count ?? 0;
return [
'sum' => (float) $totalSum,