328 lines
14 KiB
PHP
328 lines
14 KiB
PHP
@php
|
|
$period = $period ?? '';
|
|
$periodOptions = $periodOptions ?? collect();
|
|
$sellerEntity = $sellerEntity ?? '';
|
|
$rows = $rows ?? collect();
|
|
$summary = $summary ?? [];
|
|
$loadError = $loadError ?? null;
|
|
@endphp
|
|
|
|
<div class="business-page-header">
|
|
<span class="business-page-title">{{ $title ?? '发票额度' }}</span>
|
|
</div>
|
|
|
|
<div class="upstream-data-page invoice-quota-page">
|
|
@include('business.pages.partials.upstream-data-styles')
|
|
<style>
|
|
.invoice-quota-summary {
|
|
--upstream-summary-columns: 4;
|
|
--upstream-summary-min-width: 9rem;
|
|
}
|
|
|
|
.invoice-quota-summary small {
|
|
display: block;
|
|
overflow: hidden;
|
|
margin-top: 0.25rem;
|
|
color: var(--vip-content-muted, #595959);
|
|
font-size: 0.71875rem;
|
|
font-weight: 400;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.invoice-quota-table {
|
|
min-width: 58rem;
|
|
}
|
|
|
|
.invoice-quota-table .invoice-quota-entity {
|
|
min-width: 12rem;
|
|
max-width: 20rem;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.invoice-quota-table .is-negative {
|
|
color: var(--vip-danger, #b80000);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.invoice-quota-forecast small {
|
|
display: block;
|
|
margin-top: 0.125rem;
|
|
color: var(--vip-content-muted, #595959);
|
|
font-size: 0.6875rem;
|
|
font-weight: 400;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.invoice-quota-coverage {
|
|
font-variant-numeric: tabular-nums;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.invoice-quota-coverage.is-warning {
|
|
color: var(--vip-danger, #b80000);
|
|
font-weight: 700;
|
|
}
|
|
|
|
.invoice-quota-summary .is-negative {
|
|
color: var(--vip-danger, #b80000);
|
|
}
|
|
|
|
.invoice-quota-status {
|
|
display: inline-flex;
|
|
height: 1.5rem;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
padding: 0 0.5rem;
|
|
border: 1px solid var(--vip-border, #d8d2c7);
|
|
border-radius: 999px;
|
|
font-size: 0.71875rem;
|
|
font-weight: 600;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.invoice-quota-status .material-icons-outlined {
|
|
font-size: 0.9375rem;
|
|
}
|
|
|
|
.invoice-quota-status.is-danger {
|
|
border-color: #e7b4b4;
|
|
background: #fff5f5;
|
|
color: var(--vip-danger, #b80000);
|
|
}
|
|
|
|
.invoice-quota-status.is-warning {
|
|
border-color: #e6cf9f;
|
|
background: #fdf3e3;
|
|
color: var(--vip-warning, #935f07);
|
|
}
|
|
|
|
.invoice-quota-status.is-success {
|
|
border-color: #bfd0b5;
|
|
background: #f3f8f0;
|
|
color: var(--vip-success, #53793e);
|
|
}
|
|
|
|
.invoice-quota-status.is-muted {
|
|
background: #f5f4f1;
|
|
color: var(--vip-content-muted, #595959);
|
|
}
|
|
|
|
.invoice-quota-note {
|
|
margin: 0;
|
|
padding: 0.75rem 1rem;
|
|
border-top: 1px solid var(--vip-border, #d8d2c7);
|
|
color: var(--vip-content-muted, #595959);
|
|
font-size: 0.75rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
@media (max-width: 900px) and (min-width: 721px) {
|
|
.invoice-quota-summary {
|
|
--upstream-summary-columns: 2;
|
|
}
|
|
|
|
.invoice-quota-summary div:nth-child(2n) {
|
|
border-right: 0;
|
|
}
|
|
|
|
.invoice-quota-summary div:nth-child(-n + 2) {
|
|
border-bottom: 1px solid var(--vip-border, #d8d2c7);
|
|
}
|
|
}
|
|
</style>
|
|
|
|
@if ($loadError)
|
|
<div class="upstream-data-alert" role="alert">
|
|
<span class="material-icons-outlined" aria-hidden="true">error_outline</span>
|
|
<span>{{ $loadError }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
<form method="GET" action="{{ request()->url() }}" class="upstream-data-toolbar" aria-label="发票额度筛选">
|
|
<div class="upstream-data-field">
|
|
<label for="invoice-quota-period">期间</label>
|
|
<select id="invoice-quota-period" name="period">
|
|
@forelse ($periodOptions as $periodOption)
|
|
<option value="{{ $periodOption }}" @selected($period === $periodOption)>{{ $periodOption }}</option>
|
|
@empty
|
|
<option value="">{{ $period !== '' ? $period : '暂无期间' }}</option>
|
|
@endforelse
|
|
</select>
|
|
</div>
|
|
<div class="upstream-data-field">
|
|
<label for="invoice-quota-seller">开票主体</label>
|
|
<input
|
|
id="invoice-quota-seller"
|
|
type="search"
|
|
name="seller_entity"
|
|
value="{{ $sellerEntity }}"
|
|
maxlength="100"
|
|
placeholder="输入主体名称"
|
|
autocomplete="off"
|
|
>
|
|
</div>
|
|
<div class="upstream-data-actions">
|
|
<button type="submit" class="upstream-data-button upstream-data-button--primary">
|
|
<span class="material-icons-outlined" aria-hidden="true">search</span>
|
|
<span>查询</span>
|
|
</button>
|
|
@unless ($loadError)
|
|
<a
|
|
href="{{ route('business.invoice-quota.export', array_filter([
|
|
'period' => $period,
|
|
'seller_entity' => $sellerEntity,
|
|
], static fn ($value): bool => $value !== '' && $value !== null)) }}"
|
|
class="upstream-data-button"
|
|
title="按当前筛选导出全部记录"
|
|
>
|
|
<span class="material-icons-outlined" aria-hidden="true">download</span>
|
|
<span>导出</span>
|
|
</a>
|
|
@endunless
|
|
<a
|
|
href="{{ route('business.pages.show', ['section' => $section['slug'], 'page' => $page['slug']]) }}"
|
|
class="upstream-data-button"
|
|
>
|
|
<span class="material-icons-outlined" aria-hidden="true">refresh</span>
|
|
<span>重置</span>
|
|
</a>
|
|
</div>
|
|
</form>
|
|
|
|
@unless ($loadError)
|
|
<dl class="upstream-data-summary invoice-quota-summary" aria-label="发票额度汇总">
|
|
<div>
|
|
<dt>已开票金额</dt>
|
|
<dd>{{ number_format((float) ($summary['used_total'] ?? 0), 2) }}</dd>
|
|
<small>{{ $period !== '' ? $period . ' 期间' : '期间未设置' }} · {{ (int) ($summary['record_count'] ?? 0) }} 个主体</small>
|
|
</div>
|
|
<div>
|
|
<dt>预估整月开票</dt>
|
|
<dd>{{ number_format((float) ($summary['forecast_total'] ?? 0), 2) }}</dd>
|
|
<small>
|
|
@if ((bool) ($summary['forecast_is_current'] ?? false))
|
|
按 {{ (int) ($summary['forecast_elapsed_days'] ?? 0) }} 天日均推算 {{ (int) ($summary['forecast_days_in_month'] ?? 0) }} 天
|
|
@else
|
|
按 {{ (int) ($summary['forecast_days_in_month'] ?? 0) }} 天完整月份计算
|
|
@endif
|
|
</small>
|
|
</div>
|
|
<div>
|
|
<dt>票聚可用额度</dt>
|
|
<dd @class(['is-negative' => (float) ($summary['available_total'] ?? 0) < 0])>
|
|
{{ number_format((float) ($summary['available_total'] ?? 0), 2) }}
|
|
</dd>
|
|
<small>已匹配 {{ (int) ($summary['matched_count'] ?? 0) }} · 未匹配 {{ (int) ($summary['unmatched_count'] ?? 0) }}</small>
|
|
</div>
|
|
<div>
|
|
<dt>5天额度预警</dt>
|
|
<dd @class(['is-negative' => (int) ($summary['warning_count'] ?? 0) > 0])>
|
|
{{ (int) ($summary['warning_count'] ?? 0) }}
|
|
</dd>
|
|
<small>不可查看 {{ (int) ($summary['unavailable_count'] ?? 0) }} · 额度不足 {{ (int) ($summary['insufficient_count'] ?? 0) }}</small>
|
|
</div>
|
|
</dl>
|
|
@endunless
|
|
|
|
<div class="upstream-data-table-panel">
|
|
<div class="upstream-data-table-scroll">
|
|
<table class="upstream-data-table invoice-quota-table" aria-label="发票额度明细">
|
|
<thead>
|
|
<tr>
|
|
<th>序号</th>
|
|
<th>开票主体</th>
|
|
<th>开票员</th>
|
|
<th class="is-number">已开票金额</th>
|
|
<th class="is-number">预估整月开票</th>
|
|
<th class="is-number">票聚可用额度</th>
|
|
<th class="is-number">额度可支撑</th>
|
|
<th>额度更新时间</th>
|
|
<th>状态</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse ($rows as $row)
|
|
<tr>
|
|
<td>{{ $rows->firstItem() + $loop->index }}</td>
|
|
<td class="invoice-quota-entity" title="{{ $row->store_entity }}">{{ $row->store_entity }}</td>
|
|
<td>{{ $row->invoice_issuer ?: '—' }}</td>
|
|
<td class="is-number">{{ number_format((float) $row->output_amount, 2) }}</td>
|
|
<td class="is-number invoice-quota-forecast">
|
|
@if ($row->forecast_monthly !== null)
|
|
{{ number_format((float) $row->forecast_monthly, 2) }}
|
|
<small>日均 {{ number_format((float) $row->daily_average, 2) }}</small>
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td @class(['is-number', 'is-negative' => $row->available_amount !== null && $row->available_amount < 0])>
|
|
@if ($row->available_amount !== null)
|
|
{{ number_format((float) $row->available_amount, 2) }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td @class(['is-number', 'invoice-quota-coverage', 'is-warning' => $row->quota_warning])>
|
|
{{ $row->coverage_days !== null ? number_format((float) $row->coverage_days, 2) . ' 天' : '—' }}
|
|
</td>
|
|
<td>{{ $row->quota_updated_at ?: '—' }}</td>
|
|
<td>
|
|
<span class="invoice-quota-status is-{{ $row->status_tone }}">
|
|
<span class="material-icons-outlined" aria-hidden="true">{{ $row->status_icon }}</span>
|
|
<span>{{ $row->status }}</span>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr class="is-empty">
|
|
<td colspan="9">
|
|
@if ($loadError)
|
|
数据加载失败,请稍后重试。
|
|
@else
|
|
当前期间暂无可展示的发票额度数据,请先在发票基础信息中补充记录或切换期间。
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p class="invoice-quota-note">
|
|
“票聚可用额度”读取票聚·销方管理“可用发票额度(税局)”及最新获取时间,按开票主体名称匹配。当前月份按“截至今日已开票金额 ÷ 已过天数”估算日均开票,并推算整月开票金额和额度可支撑天数;可用额度可支撑不足 5 天时预警。未授权、授权过期或票聚未返回额度的主体不显示推测额度。
|
|
@if (!empty($summary['latest_source_fetched_at']))
|
|
最近同步:{{ $summary['latest_source_fetched_at'] }}。
|
|
@endif
|
|
</p>
|
|
|
|
@if ($rows->total() > 0)
|
|
<div class="upstream-data-pagination">
|
|
<span>
|
|
共 {{ $rows->total() }} 条 · 第 {{ $rows->currentPage() }} / {{ $rows->lastPage() }} 页
|
|
</span>
|
|
<span class="upstream-data-pagination__controls">
|
|
@if ($rows->onFirstPage())
|
|
<span class="upstream-data-button is-disabled" aria-disabled="true">
|
|
<span class="material-icons-outlined" aria-hidden="true">chevron_left</span>
|
|
</span>
|
|
@else
|
|
<a href="{{ $rows->previousPageUrl() }}" class="upstream-data-button" aria-label="上一页">
|
|
<span class="material-icons-outlined" aria-hidden="true">chevron_left</span>
|
|
</a>
|
|
@endif
|
|
@if ($rows->hasMorePages())
|
|
<a href="{{ $rows->nextPageUrl() }}" class="upstream-data-button" aria-label="下一页">
|
|
<span class="material-icons-outlined" aria-hidden="true">chevron_right</span>
|
|
</a>
|
|
@else
|
|
<span class="upstream-data-button is-disabled" aria-disabled="true">
|
|
<span class="material-icons-outlined" aria-hidden="true">chevron_right</span>
|
|
</span>
|
|
@endif
|
|
</span>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|