科目映射表并入抖音大类并把票据0按不开票处理

固定大类清单新增售后费用/平台服务费/平台佣金(支出基准)与往来(收入基准),页面大类下拉与改大类时自动带基准的前端映射同步更新;导入时票据「0 / 0.00 / 0%」归一为「不开票」。现网 38 行抖音规则已由 0 改为不开票(逐条更新、写操作日志)。
This commit is contained in:
qiuxiang 2026-09-29 15:20:44 +08:00
parent c56109f81c
commit 46689d99d3
4 changed files with 48 additions and 3 deletions

View File

@ -42,12 +42,16 @@ class AccountMappingStore
/** 大类 → 预期方向基准(用于校验「基准与大类是否一致」) */
public const CATEGORY_BASIS = [
'费用' => self::BASIS_OUT,
'保证金' => self::BASIS_OUT,
'售后费用' => self::BASIS_OUT,
'平台服务费' => self::BASIS_OUT,
'平台佣金' => self::BASIS_OUT,
'推广' => self::BASIS_OUT,
'保证金' => self::BASIS_OUT,
'暂挂' => self::BASIS_OUT,
'营业外支出' => self::BASIS_OUT,
'提现' => self::BASIS_OUT,
'收入' => self::BASIS_IN,
'往来' => self::BASIS_IN,
'转账' => self::BASIS_IN,
];

View File

@ -33,6 +33,9 @@ class AccountMappingWorkbookImporter
];
private const INVOICE_MAP = [
'0' => '不开票',
'0.00' => '不开票',
'0%' => '不开票',
'0.06' => '0.06',
'6%' => '0.06',
'06' => '0.06',

View File

@ -374,8 +374,10 @@
// 大类 → 预期方向基准:改大类时顺手把基准带过去,避免两者打架
var CATEGORY_BASIS = {
'费用': '支出基准', '保证金': '支出基准', '推广': '支出基准', '暂挂': '支出基准',
'营业外支出': '支出基准', '提现': '支出基准', '收入': '收入基准', '转账': '收入基准'
'费用': '支出基准', '售后费用': '支出基准', '平台服务费': '支出基准', '平台佣金': '支出基准',
'推广': '支出基准', '保证金': '支出基准', '暂挂': '支出基准',
'营业外支出': '支出基准', '提现': '支出基准',
'收入': '收入基准', '往来': '收入基准', '转账': '收入基准'
};
var body = document.getElementById('amBody');

View File

@ -208,4 +208,40 @@ class AccountMappingPageTest extends FeatureTestCase
->assertStatus(422)
->assertJsonPath('errors.import.0', '只支持 xlsx、xls、csv 三种格式,当前是「txt」。');
}
/**
* 抖音账单带来的 5 个大类并入固定清单(往来=收入基准),票据「0」按不开票入库。
*/
public function test_douyin_categories_are_fixed_options_and_zero_invoice_means_no_invoice(): void
{
$this->grantAdminPermission();
$this->assertSame([
'售后费用' => '支出基准',
'平台服务费' => '支出基准',
'平台佣金' => '支出基准',
'往来' => '收入基准',
], array_intersect_key(AccountMappingStore::CATEGORY_BASIS, array_flip([
'售后费用', '平台服务费', '平台佣金', '往来',
])));
$categories = $this->loginAs()->getJson($this->rulesUrl())->assertOk()->json('options.categories');
foreach (['售后费用', '平台服务费', '平台佣金', '往来'] as $category) {
$this->assertContains($category, $categories);
}
$csv = "平台,账单项目,财务备注,票据,大类,借方科目,贷方科目,方向基准\n"
. "自测平台,自测项目丙,备注丙,0,售后费用,销售费用,其他货币资金,支出基准\n";
$this->loginAs()->post($this->actionUrl('import'), [
'import' => UploadedFile::fake()->createWithContent('rules.csv', $csv),
], ['Accept' => 'application/json'])
->assertOk()
->assertJsonPath('result.created', 1);
$rule = collect(app(AccountMappingStore::class)->all())->firstWhere('item', '自测项目丙');
$this->assertNotNull($rule);
$this->assertSame('不开票', $rule['invoice']);
$this->assertSame('支出基准', $rule['basis']);
}
}