49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Support\CourierBills;
|
|
|
|
/** 账单行的对账分类。判断顺序见 CourierBillMatcher::categorize()。 */
|
|
final class Category
|
|
{
|
|
public const MATCH = 'match';
|
|
public const DIFF = 'diff';
|
|
public const UNCALCULATED = 'uncalculated';
|
|
public const PRIOR = 'prior';
|
|
public const LATER = 'later';
|
|
public const DUPLICATE = 'duplicate';
|
|
public const UNSHIPPED = 'unshipped';
|
|
public const UNMATCHED = 'unmatched';
|
|
public const MISMATCH = 'mismatch';
|
|
/** 不是账单行:发货数据有、账单里没有。 */
|
|
public const UNPROVIDED = 'unprovided';
|
|
|
|
public const LABELS = [
|
|
self::MATCH => '一致',
|
|
self::DIFF => '一致但运费有差',
|
|
self::UNCALCULATED => '一致(系统未核算)',
|
|
self::PRIOR => '前月补提供',
|
|
self::LATER => '跨月订单',
|
|
self::DUPLICATE => '重复',
|
|
self::UNSHIPPED => '未发出',
|
|
self::UNMATCHED => '匹配不到',
|
|
self::MISMATCH => '快递不符',
|
|
self::UNPROVIDED => '快递未提供',
|
|
];
|
|
|
|
/** 进「对账」子表、按核算运费结算的分类。 */
|
|
public const PAYABLE = [self::MATCH, self::DIFF, self::UNCALCULATED];
|
|
|
|
/** 处理结果。 */
|
|
public const RESOLUTIONS = ['agree' => '同意付款', 'exclude' => '已与快递确认剔除', 'defer' => '转下月'];
|
|
|
|
public static function label(string $category, ?string $month = null): string
|
|
{
|
|
$label = self::LABELS[$category] ?? $category;
|
|
if ($month !== null && in_array($category, [self::PRIOR, self::LATER], true)) {
|
|
return $label . '-' . (int) substr($month, 5, 2) . '月';
|
|
}
|
|
|
|
return $label;
|
|
}
|
|
}
|