278 lines
15 KiB
PHP
278 lines
15 KiB
PHP
@php
|
||
$simpleHeaders = static fn (array $labels): array => array_map(
|
||
static fn (string $label): array => ['label' => $label, 'code' => ''],
|
||
$labels,
|
||
);
|
||
$pairedHeaders = static function (array $labels, array $codes): array {
|
||
return array_map(
|
||
static function (string $label, int $index) use ($codes): array {
|
||
$code = trim((string) ($codes[$index] ?? ''));
|
||
|
||
return [
|
||
'label' => $label,
|
||
'code' => $code === $label ? '' : $code,
|
||
];
|
||
},
|
||
$labels,
|
||
array_keys($labels),
|
||
);
|
||
};
|
||
$tabs = [
|
||
[
|
||
'slug' => 'posting-data',
|
||
'title' => '顾家过账数据',
|
||
'icon' => 'dataset',
|
||
'description' => '按过账标签为“是”的发货明细,按物料编号汇总采购数量和供应商金额。',
|
||
'source_sheet' => '顾家过账数据',
|
||
'numeric_columns' => [4, 5, 6],
|
||
'money_columns' => [5, 6],
|
||
'headers' => $simpleHeaders([
|
||
'年份', '月份', '物料编号', '物料描述', '采购数量', '单价', '供货商金额',
|
||
]),
|
||
],
|
||
[
|
||
'slug' => 'toc-orders',
|
||
'title' => 'TOC订单',
|
||
'icon' => 'shopping_cart',
|
||
'description' => '已按工作簿4“TOC订单”子表放入表头,订单明细待接入。',
|
||
'source_sheet' => 'TOC订单',
|
||
'numeric_columns' => [5],
|
||
'headers' => $simpleHeaders([
|
||
'年份', '月份', '订单号', '物料编号', '型号', '发货数量',
|
||
]),
|
||
],
|
||
[
|
||
'slug' => 'lingshan-virtual-posting',
|
||
'title' => '灵珊虚拟过账',
|
||
'icon' => 'swap_horiz',
|
||
'description' => '按顾家料号透视,汇总采购数量与金额后生成联动模板。',
|
||
'source_sheet' => '灵珊虚拟过账',
|
||
'numeric_columns' => [0, 1, 2, 5, 6, 7, 8, 9],
|
||
'money_columns' => [6, 7, 8, 9],
|
||
'headers' => $simpleHeaders([
|
||
'年份', '月份', '序号', '顾家料号', '品名', '采购数量', '单价', '供货商金额',
|
||
'销售单价', '销售金额', '供货商', '供应商编码', '淘宝单号', 'N单号', '装载号',
|
||
'导入时间',
|
||
]),
|
||
],
|
||
[
|
||
'slug' => 'erp-product-import',
|
||
'title' => '顾家ERP商品导入',
|
||
'icon' => 'inventory_2',
|
||
'description' => '按灵珊虚拟过账生成,收货人字段循环使用工作簿5数据。',
|
||
'source_sheet' => '顾家ERP商品导入',
|
||
'numeric_columns' => [5, 8, 9, 10, 27],
|
||
'money_columns' => [8, 9, 10, 27],
|
||
'headers' => $pairedHeaders(
|
||
[
|
||
'年份', '月份', '网店编号(必填)', '商城单号(必填)', '商城SKU编号(必填)',
|
||
'商品数量(必填)', '商城明细单号', '销售类型(必填)(0-销售,1-赠品)',
|
||
'成交单价(必填)', '金额(必填)', '实付金额', '下单时间(必填)', '付款时间(必填)',
|
||
'交期时间(必填)', '商品标题', '商品规格', '收货人(必填)', '收货人电话',
|
||
'收货人手机(必填)', '买家备注', '邮编', '收货人的所在省份(必填)',
|
||
'收货人的所在城市(必填)', '收货人的所在区(县)(必填)', '收货人街道',
|
||
'收货地址(必填)', '快递公司', '运费(必填)', '商城状态', '卖家备注',
|
||
'订单备注', '买家昵称(必填)', '实际下单店铺', '国补主体',
|
||
],
|
||
[
|
||
'', '', 'depotId', 'billsPlatformId', 'clothingId', 'billsNums',
|
||
'billsPlatformSubId', 'saleType', 'accSprice', 'accSums', 'payment',
|
||
'billsCreateDate', 'billsPayDate', 'plannedDeliveryDate', 'clothTitle',
|
||
'clothSpecs', 'clientName', 'clientTel', 'clientMobile', 'billsClientRemark',
|
||
'clientPostCode', 'clientProvince', 'clientCity', 'clientArea', 'clientStreet',
|
||
'clientAddress', 'logisticsId', 'freight', 'billsPlatformState',
|
||
'billsSellerRemark', 'billsRemark', 'buyerNick', 'setdepotId',
|
||
'nationalSubsidySubject',
|
||
],
|
||
),
|
||
],
|
||
[
|
||
'slug' => 'invoice-entry-template',
|
||
'title' => '开票填写模板-货物-灵珊',
|
||
'icon' => 'description',
|
||
'description' => '按灵珊虚拟过账生成开票货物模板。',
|
||
'source_sheet' => '开票填写模板-货物-灵珊',
|
||
'numeric_columns' => [9, 10, 11],
|
||
'money_columns' => [10],
|
||
'headers' => $simpleHeaders([
|
||
'年份', '月份', '开票公司', '单据号(订单号)', '备注(没有就空着)', '货物名称',
|
||
'规格型号', '税收分类', '单位', '开票数量', '开票金额(含税,两位小数)', '税率',
|
||
'开票抬头', '开票税号', '开票地址', '开票电话', '开户银行', '开户账号',
|
||
'提交人邮箱', '提交人电话(手机)',
|
||
]),
|
||
],
|
||
[
|
||
'slug' => 'inventory-management-template',
|
||
'title' => '库存管理模板',
|
||
'icon' => 'warehouse',
|
||
'description' => '按灵珊虚拟过账生成库存管理模板,仅填写指定库存字段。',
|
||
'source_sheet' => '库存管理模版',
|
||
'numeric_columns' => [7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 26, 27],
|
||
'headers' => $pairedHeaders(
|
||
[
|
||
'年份', '月份', '供应商ELS账号', 'SAP编码', '供应商ELS名称', '物料编号(*)',
|
||
'物料描述', '库存数量', '可用库存数量(含预生产)', '半成品库存', '3个月内库存',
|
||
'6个月以上库存', '3-6个月库存', '在制数量', '入库数量', '出库数量', '物料名称',
|
||
'物料规格', '货号', '品名', '库存属性', '采购员', '业务员', '经营部',
|
||
'物料批次', '最后修改时间', '预生产数量', '实际可用库存数量',
|
||
],
|
||
[
|
||
'年份', '月份', 'fbk6', 'toElsAccount', 'toElsAccountName', 'materialNumber',
|
||
'materialDesc', 'stockQuantity', 'availableStockQuantity', 'fbk2', 'fbk3',
|
||
'fbk5', 'fbk4', 'fbk8', 'stockInQuantity', 'stockOutQuantity',
|
||
'materialName', 'materialSpecifications', 'fbk9', 'fbk10', 'fbk1', 'fbk15',
|
||
'fbk14', 'fbk16', 'fbk7', 'lastUpdateDate', 'fbk18', 'fbk19',
|
||
],
|
||
),
|
||
],
|
||
[
|
||
'slug' => 'lingshan-statement',
|
||
'title' => '灵珊对账单',
|
||
'icon' => 'receipt_long',
|
||
'description' => '按表二格式生成灵珊月度对账单,可直接打印。',
|
||
],
|
||
[
|
||
'slug' => 'oberna-statement',
|
||
'title' => '欧伯娜对账单',
|
||
'icon' => 'fact_check',
|
||
'description' => '欧伯娜对账单页面已建立,待接入对账数据。',
|
||
],
|
||
];
|
||
$validSubmenus = array_column($tabs, 'slug');
|
||
$requestedSubmenu = (string) request()->query('reconciliation_view', '');
|
||
$activeView = in_array($requestedSubmenu, $validSubmenus, true)
|
||
? $requestedSubmenu
|
||
: 'posting-data';
|
||
$placeholder = 'business.pages.posting-data.partials.kuka-posting-placeholder';
|
||
$sourceTable = 'business.pages.posting-data.partials.kuka-reconciliation-source-table';
|
||
@endphp
|
||
|
||
<div class="kuka-reconciliation-page">
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-tabs', [
|
||
'tabs' => $tabs,
|
||
'activeView' => $activeView,
|
||
])
|
||
|
||
@if (! empty($kukaReconciliation['error']))
|
||
<div class="kuka-reconciliation-alert">{{ $kukaReconciliation['error'] }}</div>
|
||
@endif
|
||
|
||
<div class="kuka-reconciliation-content" data-kuka-reconciliation-content>
|
||
@foreach ($tabs as $tab)
|
||
@php
|
||
$viewData = $kukaReconciliation['views'][$tab['slug']] ?? [
|
||
'rows' => [],
|
||
'total' => 0,
|
||
'page' => 1,
|
||
'per_page' => 100,
|
||
'last_page' => 1,
|
||
'from' => 0,
|
||
'to' => 0,
|
||
];
|
||
@endphp
|
||
<section
|
||
id="kuka-reconciliation-panel-{{ $tab['slug'] }}"
|
||
data-kuka-reconciliation-panel="{{ $tab['slug'] }}"
|
||
role="tabpanel"
|
||
aria-labelledby="kuka-reconciliation-tab-{{ $tab['slug'] }}"
|
||
@if ($activeView !== $tab['slug']) hidden @endif
|
||
>
|
||
@if ($tab['slug'] === 'posting-data' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-posting-summary', [
|
||
'quantityTotal' => $kukaReconciliation['summary']['posting_quantity_total'] ?? '0',
|
||
'supplierAmountTotal' => $kukaReconciliation['summary']['posting_supplier_amount_total'] ?? '0.00',
|
||
'exportUrl' => route('business.kuka-reconciliation.posting-data.export', [
|
||
'period' => $kukaReconciliation['period'],
|
||
]),
|
||
])
|
||
@endif
|
||
@if ($tab['slug'] === 'toc-orders' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-toc-summary', [
|
||
'quantityTotal' => $kukaReconciliation['summary']['toc_quantity_total'] ?? '0',
|
||
])
|
||
@endif
|
||
@if ($tab['slug'] === 'lingshan-virtual-posting' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-virtual-summary', [
|
||
'quantityTotal' => $kukaReconciliation['summary']['posting_quantity_total'] ?? '0',
|
||
'supplierAmountTotal' => $kukaReconciliation['summary']['posting_supplier_amount_total'] ?? '0.00',
|
||
'salesAmountTotal' => $kukaReconciliation['summary']['posting_sales_amount_total'] ?? '0.00',
|
||
])
|
||
@endif
|
||
@if ($tab['slug'] === 'erp-product-import' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-erp-summary', [
|
||
'quantityTotal' => $kukaReconciliation['summary']['erp_quantity_total'] ?? '0',
|
||
'amountTotal' => $kukaReconciliation['summary']['erp_amount_total'] ?? '0.00',
|
||
'paidAmountTotal' => $kukaReconciliation['summary']['erp_paid_amount_total'] ?? '0.00',
|
||
'detailAmountTotal' => $kukaReconciliation['summary']['erp_detail_amount_total'] ?? '0.00',
|
||
'roundingAdjustment' => $kukaReconciliation['summary']['erp_amount_rounding_adjustment'] ?? '0.00',
|
||
])
|
||
@endif
|
||
@if ($tab['slug'] === 'invoice-entry-template' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-reconciliation-invoice-summary', [
|
||
'quantityTotal' => $kukaReconciliation['summary']['invoice_quantity_total'] ?? '0',
|
||
'amountTotal' => $kukaReconciliation['summary']['invoice_amount_total'] ?? '0.00',
|
||
])
|
||
@endif
|
||
@if ($tab['slug'] === 'lingshan-statement' && empty($kukaReconciliation['error']))
|
||
@include('business.pages.posting-data.partials.kuka-lingshan-statement-tab', [
|
||
'statement' => $kukaReconciliation['statement']['lingshan'] ?? [],
|
||
'printUrl' => route('business.kuka-reconciliation.lingshan-statement.print', [
|
||
'period' => $kukaReconciliation['period'],
|
||
]),
|
||
])
|
||
@elseif (! empty($tab['headers']))
|
||
@include($sourceTable, [
|
||
'title' => $tab['title'],
|
||
'description' => $tab['description'],
|
||
'icon' => $tab['icon'],
|
||
'sourceSheet' => $tab['source_sheet'],
|
||
'headers' => $tab['headers'],
|
||
'rows' => $viewData['rows'],
|
||
'pagination' => $viewData,
|
||
'numericColumns' => $tab['numeric_columns'],
|
||
'moneyColumns' => $tab['money_columns'] ?? [],
|
||
'salesRoundingAdjustment' => $tab['slug'] === 'lingshan-virtual-posting'
|
||
? ($kukaReconciliation['summary']['virtual_sales_rounding_adjustment'] ?? '0.00')
|
||
: null,
|
||
'salesRoundingAdjustmentColumn' => $tab['slug'] === 'lingshan-virtual-posting'
|
||
? 9
|
||
: null,
|
||
'viewSlug' => $tab['slug'],
|
||
'notice' => $tab['slug'] === 'erp-product-import'
|
||
? ($kukaReconciliation['notices']['erp'] ?? null)
|
||
: null,
|
||
'showHeader' => ! in_array($tab['slug'], ['posting-data', 'toc-orders', 'lingshan-virtual-posting', 'erp-product-import', 'invoice-entry-template'], true),
|
||
'emptyMessage' => '当前账期没有可生成的过账数据。',
|
||
])
|
||
@else
|
||
@include($placeholder, [
|
||
'title' => $tab['title'],
|
||
'description' => $tab['description'],
|
||
'icon' => $tab['icon'],
|
||
])
|
||
@endif
|
||
</section>
|
||
@endforeach
|
||
</div>
|
||
</div>
|
||
|
||
<style>
|
||
.kuka-reconciliation-page,
|
||
.kuka-reconciliation-content {
|
||
display: grid;
|
||
min-width: 0;
|
||
gap: 12px;
|
||
}
|
||
.kuka-reconciliation-content > [data-kuka-reconciliation-panel][hidden] {
|
||
display: none !important;
|
||
}
|
||
.kuka-reconciliation-alert {
|
||
padding: 9px 12px;
|
||
border: 1px solid #e3c5c5;
|
||
border-radius: 8px;
|
||
background: #fff7f7;
|
||
color: var(--vip-danger, #b80000);
|
||
font-size: 12px;
|
||
}
|
||
</style>
|