158 lines
9.1 KiB
PHP
158 lines
9.1 KiB
PHP
<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>报价确认单 {{ $version->version_code }}</title>
|
||
<style>
|
||
@font-face { font-family: "Droid Sans Fallback"; font-style: normal; font-weight: 400; src: url("file://{{ $fontPath }}") format("truetype"); }
|
||
@page { margin: 18mm 14mm 16mm; }
|
||
* { box-sizing: border-box; }
|
||
body { margin: 0; color: #171717; font-family: "Droid Sans Fallback", sans-serif; font-size: 9px; line-height: 1.45; }
|
||
.latin { font-family: "DejaVu Sans", sans-serif; }
|
||
h1, h2, p, dl, dd { margin: 0; }
|
||
h1 { font-size: 20px; font-weight: 400; }
|
||
h2 { margin: 16px 0 7px; border-bottom: 1px solid #9b7a3f; padding-bottom: 4px; color: #6f5426; font-size: 12px; font-weight: 400; }
|
||
.heading { display: table; width: 100%; border-bottom: 2px solid #171717; padding-bottom: 10px; }
|
||
.heading__title, .heading__mark { display: table-cell; vertical-align: bottom; }
|
||
.heading__mark { color: #6b6b6b; text-align: right; }
|
||
.meta { display: table; width: 100%; margin-top: 12px; table-layout: fixed; }
|
||
.meta__item { display: table-cell; border-left: 2px solid #b69455; padding: 2px 9px; }
|
||
.meta dt { color: #666; font-size: 8px; }
|
||
.meta dd { margin-top: 2px; font-size: 10px; }
|
||
.details { width: 100%; margin-top: 12px; border-collapse: collapse; table-layout: fixed; }
|
||
.details th, .details td { border: 1px solid #cfcfcf; padding: 5px 7px; vertical-align: middle; }
|
||
.details th { width: 11%; background: #eee8db; font-weight: 400; white-space: nowrap; }
|
||
.details td { width: 22%; }
|
||
.notice { margin-top: 12px; border: 1px solid #c9b27f; background: #faf6ea; padding: 7px 9px; color: #5c451e; }
|
||
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||
th, td { overflow-wrap: anywhere; border: 1px solid #cfcfcf; padding: 4px 5px; text-align: left; vertical-align: top; }
|
||
th { background: #eee8db; font-weight: 400; }
|
||
.number { text-align: right; }
|
||
.matrix { font-size: 7.5px; table-layout: auto; }
|
||
.matrix thead { display: table-header-group; }
|
||
.matrix tr { page-break-inside: avoid; }
|
||
.matrix th, .matrix td { max-width: 90px; padding: 3px 4px; }
|
||
.matrix .matrix__note { width: 30%; max-width: none; background: #faf6ea; }
|
||
.matrix th.matrix__note { background: #eee8db; }
|
||
.formula { color: #735c31; font-size: 7px; }
|
||
.signature { page-break-before: always; }
|
||
.signature h2 { margin-top: 0; }
|
||
.signature__meta { margin-bottom: 18px; color: #555; }
|
||
.signature__box { width: 360px; margin-left: auto; padding: 14px 16px; color: #666; page-break-inside: avoid; }
|
||
.signature__blank { height: 240px; }
|
||
.document-control { margin-top: 22px; border-top: 1px solid #bbb; padding-top: 6px; color: #777; font-size: 7.5px; text-align: right; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
@php
|
||
$mixedText = static function ($value): string {
|
||
// Spreadsheet-pasted whitespace has no glyph in the CJK font.
|
||
$text = str_replace(["\r\n", "\r", "\t", "\u{00A0}"], ["\n", "\n", ' ', ' '], (string) $value);
|
||
// Keep real line breaks without reproducing spreadsheet alignment padding.
|
||
$text = preg_replace('/[ \x{3000}]+/u', ' ', $text) ?? $text;
|
||
// Droid Sans Fallback also lacks common dash and currency glyphs.
|
||
$latinCharacters = '\x20-\x7E\x{00A5}\x{00B0}\x{00B7}\x{00D7}\x{00F7}\x{2010}-\x{2015}\x{2212}';
|
||
$parts = preg_split('/([' . $latinCharacters . ']+)/u', $text, -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
|
||
|
||
return nl2br(implode('', array_map(static function (string $part) use ($latinCharacters): string {
|
||
$escaped = e($part);
|
||
|
||
return preg_match('/^[' . $latinCharacters . ']+$/u', $part) === 1
|
||
? '<span class="latin">' . $escaped . '</span>'
|
||
: $escaped;
|
||
}, $parts)), false);
|
||
};
|
||
@endphp
|
||
<header class="heading">
|
||
<div class="heading__title">
|
||
<h1>报价确认单</h1>
|
||
<p>{!! $mixedText($version->carrier_name) !!} <span class="latin">·</span> {!! $mixedText($version->quote_type) !!}</p>
|
||
</div>
|
||
<div class="heading__mark">不可覆盖版本:{!! $mixedText($version->version_code) !!}</div>
|
||
</header>
|
||
|
||
<dl class="meta">
|
||
<div class="meta__item"><dt>快递公司</dt><dd>{!! $mixedText($version->carrier_name) !!}</dd></div>
|
||
<div class="meta__item"><dt>报价版本</dt><dd>{!! $mixedText($version->version_code) !!}</dd></div>
|
||
<div class="meta__item"><dt>执行期间</dt><dd>{!! $mixedText($version->periodLabel()) !!}</dd></div>
|
||
<div class="meta__item"><dt>审核日期</dt><dd>{!! $mixedText($change?->approved_at?->format('Y-m-d H:i') ?? $version->created_at?->format('Y-m-d H:i')) !!}</dd></div>
|
||
</dl>
|
||
|
||
<table class="details">
|
||
<tbody>
|
||
<tr>
|
||
<th>甲方</th><td>{!! $mixedText($partyA) !!}</td>
|
||
<th>乙方</th><td>{!! $mixedText($version->carrier_name) !!}</td>
|
||
<th>报价类型</th><td>{!! $mixedText($version->quote_type) !!}</td>
|
||
</tr>
|
||
<tr>
|
||
<th>执行期间</th><td>{!! $mixedText($version->periodLabel()) !!}</td>
|
||
<th>{!! $mixedText('区间截止 / 有效期') !!}</th><td>{!! $mixedText($version->isTemporary() ? '以左侧各区间为准,区间外恢复原报价' : $expiryDate) !!}</td>
|
||
<th>报价编号</th><td>{!! $mixedText($version->version_code) !!}</td>
|
||
</tr>
|
||
<tr>
|
||
<th>面单费</th><td>{!! $mixedText($faceFee) !!}</td>
|
||
<th>计泡系数</th><td>{!! $mixedText($bubbleCoefficient) !!}</td>
|
||
<th>签署要求</th><td>仅乙方(快递方)签章</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
@if(! empty($temporaryNote))
|
||
<div class="notice">{!! $mixedText($temporaryNote) !!}</div>
|
||
@endif
|
||
<div class="notice">本文件由财务系统根据已审核报价版本自动生成。乙方签章后文件与完成证书将按本版本单独归档;后续变价须生成新版本并重新签章,旧确认单不会被覆盖。</div>
|
||
|
||
<h2>报价明细(执行价格)</h2>
|
||
@if(! empty($billingRules))<p class="summary">{!! $mixedText($billingRules) !!}</p>@endif
|
||
@php
|
||
// 价格表保留原有横向公斤段;其他计费条件合入备注,随确认单一起盖章。
|
||
$quoteLayout = \App\Http\Controllers\Business\CourierQuoteSignatures::quoteTableWithNotes(\App\Http\Controllers\Business\CourierQuoteSignatures::quoteLayout($values));
|
||
@endphp
|
||
<table class="matrix">
|
||
@if($quoteLayout['rows'] !== [])
|
||
@foreach($quoteLayout['rows'] as $rowIndex => $row)
|
||
@php($rowKey = $quoteLayout['row_keys'][$rowIndex] ?? null)
|
||
@php($lastColumn = count($row) - 1)
|
||
@if($rowIndex === 0)<thead>@endif
|
||
@if($rowIndex === 1)<tbody>@endif
|
||
<tr>
|
||
@foreach($row as $columnIndex => $cell)
|
||
@php($formula = $rowKey !== null && $columnIndex < $lastColumn ? ($formulas[$rowKey][$columnIndex] ?? null) : null)
|
||
<{{ $rowIndex === 0 ? 'th' : 'td' }} @if($columnIndex === $lastColumn)class="matrix__note"@endif>
|
||
{!! $mixedText($rowIndex > 0 && $columnIndex > 0 && $columnIndex < $lastColumn && is_numeric($cell) ? number_format((float) $cell, 2, '.', '') : (is_bool($cell) ? ($cell ? '是' : '否') : ($cell ?? ''))) !!}
|
||
@if(is_string($formula) && trim($formula) !== '')<div class="formula">公式:{!! $mixedText($formula) !!}</div>@endif
|
||
</{{ $rowIndex === 0 ? 'th' : 'td' }}>
|
||
@endforeach
|
||
</tr>
|
||
@if($rowIndex === 0)</thead>@endif
|
||
@endforeach
|
||
@if(count($quoteLayout['rows']) > 1)</tbody>@endif
|
||
@else
|
||
<tbody>
|
||
@forelse($values as $rowIndex => $row)
|
||
<tr>
|
||
@foreach($row as $columnIndex => $cell)
|
||
@php($formula = $formulas[$rowIndex][$columnIndex] ?? null)
|
||
<{{ $rowIndex === 0 ? 'th' : 'td' }}>
|
||
{!! $mixedText(is_bool($cell) ? ($cell ? '是' : '否') : ($cell ?? '')) !!}
|
||
@if(is_string($formula) && trim($formula) !== '')<div class="formula">公式:{!! $mixedText($formula) !!}</div>@endif
|
||
</{{ $rowIndex === 0 ? 'th' : 'td' }}>
|
||
@endforeach
|
||
</tr>
|
||
@empty
|
||
<tr><td>该版本未保存可展示的报价矩阵。</td></tr>
|
||
@endforelse
|
||
</tbody>
|
||
@endif
|
||
</table>
|
||
|
||
<section class="signature">
|
||
<h2>签署确认</h2>
|
||
<div class="signature__meta">报价版本:{!! $mixedText($version->version_code) !!} 快递公司:{!! $mixedText($version->carrier_name) !!} 执行期间:{!! $mixedText($version->periodLabel()) !!}</div>
|
||
<div class="signature__box"><div>乙方(快递方)签章:{!! $mixedText($version->carrier_name) !!}</div><div class="signature__blank"></div><div>签署日期:{!! $mixedText($signatureDate) !!}</div></div>
|
||
<div class="document-control">生成时间:{!! $mixedText($generatedAt->format('Y-m-d H:i:s')) !!} <span class="latin">·</span> 版本 {!! $mixedText($version->version_code) !!}</div>
|
||
</section>
|
||
</body>
|
||
</html>
|