Commit c4a7701a authored by Administrator's avatar Administrator

Update 6 files via Son of Anton

parent 6140d228
...@@ -4,9 +4,9 @@ declare(strict_types=1); ...@@ -4,9 +4,9 @@ declare(strict_types=1);
return [ return [
['GET', '/payments', 'Payments\Controllers\PaymentController@index', ['auth'], 'payment.view'], ['GET', '/payments', 'Payments\Controllers\PaymentController@index', ['auth'], 'payment.view'],
['GET', '/payments/daily-report', 'Payments\Controllers\PaymentController@dailyReport', ['auth'], 'payment.view'], ['GET', '/payments/daily-report', 'Payments\Controllers\PaymentController@dailyReport', ['auth'], 'payment.view'],
['GET', '/payments/process/{memberId}', 'Payments\Controllers\PaymentController@processForm', ['auth'], 'payment.process_cash'], ['GET', '/payments/process/{memberId}', 'Payments\Controllers\PaymentController@process', ['auth'], 'payment.create'],
['POST', '/payments/process/{memberId}', 'Payments\Controllers\PaymentController@processStore', ['auth'], 'payment.process_cash'], ['POST', '/payments/process/{memberId}', 'Payments\Controllers\PaymentController@store', ['auth'], 'payment.create'],
['GET', '/payments/member/{memberId}', 'Payments\Controllers\PaymentController@memberHistory',['auth'], 'payment.view'], ['GET', '/payments/member/{memberId}', 'Payments\Controllers\PaymentController@memberHistory', ['auth'], 'payment.view'],
['GET', '/payments/{id}', 'Payments\Controllers\PaymentController@show', ['auth'], 'payment.view'], ['GET', '/payments/{id}', 'Payments\Controllers\PaymentController@show', ['auth'], 'payment.view'],
['POST', '/payments/{id}/void', 'Payments\Controllers\PaymentController@voidPayment', ['auth'], 'payment.void_receipt'], ['POST', '/payments/{id}/void', 'Payments\Controllers\PaymentController@void', ['auth'], 'payment.void'],
]; ];
\ No newline at end of file
...@@ -2,77 +2,86 @@ ...@@ -2,77 +2,86 @@
<?php $__template->section('title'); ?>التقرير اليومي — <?= e($date) ?><?php $__template->endSection(); ?> <?php $__template->section('title'); ?>التقرير اليومي — <?= e($date) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?> <?php $__template->section('content'); ?>
<!-- Date Filter -->
<div class="card" style="margin-bottom:20px;padding:15px;"> <div class="card" style="margin-bottom:20px;padding:15px;">
<form method="GET" action="/payments/daily-report" style="display:flex;gap:10px;align-items:end;"> <form method="GET" action="/payments/daily-report" style="display:flex;gap:10px;align-items:end;">
<div><label class="form-label" style="font-size:12px;">التاريخ</label><input type="date" name="date" value="<?= e($date) ?>" class="form-input" required></div> <div class="form-group">
<div><label class="form-label" style="font-size:12px;">الفرع</label> <label class="form-label" style="font-size:12px;">التاريخ</label>
<select name="branch_id" class="form-select"><option value="">جميع الفروع</option> <input type="date" name="date" value="<?= e($date) ?>" class="form-input">
<?php foreach ($branches as $b): ?><option value="<?= (int) $b['id'] ?>" <?= $branchId == $b['id'] ? 'selected' : '' ?>><?= e($b['name_ar']) ?></option><?php endforeach; ?> </div>
<div class="form-group">
<label class="form-label" style="font-size:12px;">الفرع</label>
<select name="branch_id" class="form-select">
<option value="">كل الفروع</option>
<?php foreach ($branches as $b): ?>
<option value="<?= (int) $b['id'] ?>" <?= $branchId == $b['id'] ? 'selected' : '' ?>><?= e($b['name_ar']) ?></option>
<?php endforeach; ?>
</select> </select>
</div> </div>
<button type="submit" class="btn btn-outline">عرض</button> <button type="submit" class="btn btn-primary">عرض التقرير</button>
</form> </form>
</div> </div>
<?php $totals = $report['totals'] ?? []; ?> <!-- Summary Cards -->
<?php $grand = $totals['grand_total'] ?? ['count' => 0, 'total' => '0.00']; ?> <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin-bottom:20px;">
<?php $voided = $report['voided'] ?? ['cnt' => 0, 'total' => '0.00']; ?> <div class="card" style="padding:20px;text-align:center;background:#F0FDF4;border:1px solid #BBF7D0;">
<div style="font-size:32px;font-weight:700;color:#059669;"><?= money($report['grand_total']['total'] ?? '0') ?></div>
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:15px;margin-bottom:20px;"> <div style="color:#6B7280;font-size:14px;">إجمالي التحصيل</div>
<div style="background:#F0FDF4;padding:20px;border-radius:8px;text-align:center;"> <div style="color:#9CA3AF;font-size:12px;margin-top:5px;"><?= (int) ($report['grand_total']['count'] ?? 0) ?> دفعة</div>
<div style="font-size:28px;font-weight:700;color:#059669;"><?= money($grand['total'] ?? '0') ?></div>
<div style="color:#6B7280;">إجمالي التحصيل (<?= (int) ($grand['count'] ?? 0) ?> عملية)</div>
</div>
<div style="background:#FEF2F2;padding:20px;border-radius:8px;text-align:center;">
<div style="font-size:28px;font-weight:700;color:#DC2626;"><?= money($voided['total'] ?? '0') ?></div>
<div style="color:#6B7280;">إيصالات ملغاة (<?= (int) ($voided['cnt'] ?? 0) ?>)</div>
</div> </div>
<div style="background:#EFF6FF;padding:20px;border-radius:8px;text-align:center;">
<div style="font-size:28px;font-weight:700;color:#0284C7;"><?= money(bcsub($grand['total'] ?? '0', $voided['total'] ?? '0', 2)) ?></div>
<div style="color:#6B7280;">الصافي</div>
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px;">
<div class="card" style="padding:20px;"> <div class="card" style="padding:20px;">
<h4 style="color:#0D7377;margin-bottom:15px;">حسب النوع</h4> <h4 style="color:#0D7377;margin:0 0 10px;font-size:14px;">حسب النوع</h4>
<table style="width:100%;font-size:14px;"> <?php foreach ($report['by_type'] as $t): ?>
<?php foreach ($totals['by_type'] ?? [] as $t): ?> <div style="display:flex;justify-content:space-between;padding:4px 0;font-size:13px;">
<tr><td style="padding:6px 0;"><?= e(\App\Modules\Payments\Models\Payment::getPaymentTypeLabel($t['payment_type'])) ?></td><td style="padding:6px 0;text-align:left;"><?= (int) $t['count'] ?> عملية</td><td style="padding:6px 0;font-weight:700;direction:ltr;text-align:left;"><?= money($t['total']) ?></td></tr> <span><?= e(\App\Modules\Payments\Services\PaymentService::getPaymentTypeLabel($t['payment_type'])) ?></span>
<strong><?= money($t['total']) ?> <small style="color:#9CA3AF;">(<?= (int) $t['count'] ?>)</small></strong>
</div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if (empty($totals['by_type'])): ?><tr><td colspan="3" style="text-align:center;color:#6B7280;padding:15px;">لا توجد بيانات</td></tr><?php endif; ?>
</table>
</div> </div>
<div class="card" style="padding:20px;"> <div class="card" style="padding:20px;">
<h4 style="color:#0D7377;margin-bottom:15px;">حسب طريقة الدفع</h4> <h4 style="color:#0D7377;margin:0 0 10px;font-size:14px;">حسب طريقة الدفع</h4>
<table style="width:100%;font-size:14px;"> <?php foreach ($report['by_method'] as $m): ?>
<?php foreach ($totals['by_method'] ?? [] as $m): ?> <div style="display:flex;justify-content:space-between;padding:4px 0;font-size:13px;">
<tr><td style="padding:6px 0;"><?= e(\App\Modules\Payments\Models\Payment::getPaymentMethodLabel($m['payment_method'])) ?></td><td style="padding:6px 0;text-align:left;"><?= (int) $m['count'] ?> عملية</td><td style="padding:6px 0;font-weight:700;direction:ltr;text-align:left;"><?= money($m['total']) ?></td></tr> <span><?= e(\App\Modules\Payments\Models\Payment::getPaymentMethodLabel($m['payment_method'])) ?></span>
<strong><?= money($m['total']) ?> <small style="color:#9CA3AF;">(<?= (int) $m['count'] ?>)</small></strong>
</div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if (empty($totals['by_method'])): ?><tr><td colspan="3" style="text-align:center;color:#6B7280;padding:15px;">لا توجد بيانات</td></tr><?php endif; ?>
</table>
</div> </div>
</div> </div>
<!-- Individual Payments Table -->
<div class="card"> <div class="card">
<div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;"><h3 style="margin:0;color:#0D7377;">تفاصيل العمليات</h3></div> <div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;display:flex;justify-content:space-between;align-items:center;">
<h3 style="margin:0;color:#0D7377;">تفاصيل الدفعات</h3>
<button onclick="window.print()" class="btn btn-sm btn-outline">🖨️ طباعة</button>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="data-table"> <table class="data-table">
<thead><tr><th>#</th><th>الإيصال</th><th>العضو</th><th>النوع</th><th>الطريقة</th><th>المبلغ</th></tr></thead> <thead><tr><th>#</th><th>الإيصال</th><th>العضو</th><th>النوع</th><th>الطريقة</th><th>المبلغ</th></tr></thead>
<tbody> <tbody>
<?php foreach ($report['payments'] ?? [] as $i => $p): ?> <?php $grandTotal = '0.00'; ?>
<?php foreach ($payments as $i => $p): ?>
<?php $grandTotal = bcadd($grandTotal, $p['amount'], 2); ?>
<tr> <tr>
<td><?= $i + 1 ?></td> <td><?= $i + 1 ?></td>
<td style="font-size:12px;direction:ltr;text-align:right;"><?= e($p['receipt_number'] ?? '—') ?></td> <td style="direction:ltr;text-align:right;font-weight:600;"><?= e($p['receipt_number'] ?? '—') ?></td>
<td><a href="/members/<?= (int) $p['member_id'] ?>" style="color:#0D7377;"><?= e($p['member_name']) ?></a></td> <td><a href="/members/<?= (int) $p['member_id'] ?>" style="color:#0D7377;"><?= e($p['member_name']) ?></a></td>
<td style="font-size:13px;"><?= e(\App\Modules\Payments\Models\Payment::getPaymentTypeLabel($p['payment_type'])) ?></td> <td style="font-size:13px;"><?= e(\App\Modules\Payments\Services\PaymentService::getPaymentTypeLabel($p['payment_type'])) ?></td>
<td style="font-size:13px;"><?= e(\App\Modules\Payments\Models\Payment::getPaymentMethodLabel($p['payment_method'])) ?></td> <td style="font-size:13px;"><?= e(\App\Modules\Payments\Models\Payment::getPaymentMethodLabel($p['payment_method'])) ?></td>
<td style="font-weight:700;direction:ltr;text-align:right;"><?= money($p['amount']) ?></td> <td style="font-weight:700;direction:ltr;text-align:right;"><?= money($p['amount']) ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php if (empty($report['payments'])): ?><tr><td colspan="6" style="text-align:center;padding:40px;color:#6B7280;">لا توجد عمليات في هذا اليوم</td></tr><?php endif; ?> <?php if (empty($payments)): ?>
<tr><td colspan="6" style="text-align:center;padding:40px;color:#6B7280;">لا توجد دفعات في هذا التاريخ</td></tr>
<?php else: ?>
<tr style="background:#F0FDF4;font-weight:700;">
<td colspan="5" style="padding:12px 15px;">الإجمالي</td>
<td style="padding:12px 15px;direction:ltr;text-align:right;font-size:18px;color:#059669;"><?= money($grandTotal) ?></td>
</tr>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<?php $__template->endSection(); ?> <?php $__template->endSection(); ?>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment