回筐、账单完成
This commit is contained in:
@@ -8,7 +8,7 @@ return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* 对账管理(D1-D10):财务对账、门店对账单、结算表
|
||||
* 财务管理(D1-D10):财务对账、结算表(门店对账单已下线,由采购单账单 bill 表替代)
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
@@ -58,48 +58,6 @@ return new class extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
// 门店对账单表(门店在小程序端自助生成,回款周期快照决定应结算日期)
|
||||
if (! Schema::hasTable('statement')) {
|
||||
Schema::create('statement', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('对账单ID');
|
||||
$table->string('statement_no', 32)->unique()->comment('对账单编号');
|
||||
$table->integer('store_id')->comment('门店ID');
|
||||
$table->date('period_start')->comment('对账周期开始');
|
||||
$table->date('period_end')->comment('对账周期结束');
|
||||
$table->decimal('total_amount', 10, 2)->default(0)->comment('对账总金额');
|
||||
$table->integer('payment_cycle_days')->default(0)->comment('回款周期(天),生成时从门店快照');
|
||||
$table->date('settlement_date')->nullable()->comment('应结算日期(按回款周期计算)');
|
||||
$table->integer('status')->default(0)->comment('状态(0未对账 1已对账 2已结算)');
|
||||
$table->timestamp('reconciled_at')->nullable()->comment('对账完成时间');
|
||||
$table->timestamp('settled_at')->nullable()->comment('结算时间');
|
||||
$table->string('remark', 255)->default('')->comment('备注');
|
||||
$table->timestamps();
|
||||
$table->index(['store_id', 'period_start'], 'statement_store_period_index');
|
||||
$table->comment('门店对账单表');
|
||||
});
|
||||
}
|
||||
|
||||
// 门店对账单明细表(每个单品/订单的对账状态标识)
|
||||
if (! Schema::hasTable('statement_item')) {
|
||||
Schema::create('statement_item', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('明细ID');
|
||||
$table->integer('statement_id')->comment('对账单ID');
|
||||
$table->integer('order_id')->comment('订单ID');
|
||||
$table->integer('order_item_id')->comment('订货明细ID');
|
||||
$table->integer('product_id')->comment('商品ID');
|
||||
$table->string('product_name', 100)->comment('品名(快照)');
|
||||
$table->decimal('price', 10, 2)->default(0)->comment('单价');
|
||||
$table->decimal('quantity', 10, 2)->default(0)->comment('订货量');
|
||||
$table->decimal('weight', 10, 3)->default(0)->comment('重量');
|
||||
$table->decimal('amount', 10, 2)->default(0)->comment('单品金额');
|
||||
$table->integer('is_reconciled')->default(0)->comment('对账状态(1已对账 0未对账)');
|
||||
$table->string('store_remark', 255)->default('')->comment('门店备注');
|
||||
$table->timestamps();
|
||||
$table->index(['statement_id'], 'statement_item_statement_index');
|
||||
$table->comment('门店对账单明细表');
|
||||
});
|
||||
}
|
||||
|
||||
// 结算表(D9 对账结束后生成结算表/回框统计表,D10 下载存档)
|
||||
if (! Schema::hasTable('settlement')) {
|
||||
Schema::create('settlement', function (Blueprint $table) {
|
||||
@@ -131,8 +89,6 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('reconciliation');
|
||||
Schema::dropIfExists('reconciliation_item');
|
||||
Schema::dropIfExists('statement');
|
||||
Schema::dropIfExists('statement_item');
|
||||
Schema::dropIfExists('settlement');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user