账单生成

This commit is contained in:
liu
2026-08-14 00:15:28 +08:00
parent 61a70319a0
commit e35c951a59
19 changed files with 728 additions and 631 deletions
@@ -19,15 +19,11 @@ return new class extends Migration
$table->string('order_no', 32)->unique()->comment('订单编号');
$table->integer('store_id')->comment('门店ID');
$table->integer('purchase_id')->nullable()->comment('关联采购单ID');
$table->integer('statement_id')->nullable()->comment('关联账单ID');
$table->integer('bill_id')->nullable()->comment('关联账单ID');
$table->date('order_date')->comment('订货日期');
$table->integer('total_quantity')->default(0)->comment('订货总量');
$table->decimal('total_weight', 10, 3)->default(0)->comment('总重量');
$table->decimal('total_amount', 10, 2)->default(0)->comment('订单总金额');
$table->decimal('product_amount', 10, 2)->default(0)->comment('商品总金额');
$table->decimal('added_amount', 10, 2)->default(0)->comment('附加金额');
$table->decimal('box_num', 10, 2)->default(0)->comment('周转框数量');
$table->decimal('tray_num', 10, 2)->default(0)->comment('周转托盘数量');
$table->integer('status')->default(0)->comment('订单状态(0待接单 1已接单 2采购中 3配送中 4已完成 9已取消)');
$table->string('remark', 255)->default('')->comment('订单备注');
$table->softDeletes();
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
* 门店账单:采购单完成后按门店生成;周转筐/托盘与附加金额从门店订单迁入账单
* store_order 的列变动已按约定折进 2026_07_23_030610 原迁移文件,本文件仅建账单表)
*/
public function up(): void
{
// 门店账单表(每个客户单独一张,商品金额由订单汇总不可修改)
if (! Schema::hasTable('bill')) {
Schema::create('bill', function (Blueprint $table) {
$table->increments('id')->comment('账单ID');
$table->string('bill_no', 32)->unique()->comment('账单编号');
$table->integer('purchase_id')->comment('关联采购单ID');
$table->integer('store_id')->comment('门店ID');
$table->date('bill_date')->comment('账单日期');
$table->decimal('product_amount', 10, 2)->default(0)->comment('商品金额(订单商品金额汇总,不可修改)');
$table->decimal('delivery_fee', 10, 2)->default(0)->comment('配送费(生成账单时填写)');
$table->integer('box_num')->default(0)->comment('周转筐数量');
$table->integer('tray_num')->default(0)->comment('周转托盘数量');
$table->decimal('box_price', 10, 2)->default(0)->comment('周转筐单价(生成时快照)');
$table->decimal('tray_price', 10, 2)->default(0)->comment('周转托盘单价(生成时快照)');
$table->decimal('added_amount', 10, 2)->default(0)->comment('附加金额(周转筐/托盘金额)');
$table->decimal('total_amount', 10, 2)->default(0)->comment('账单总金额 = 商品金额 + 配送费 + 附加金额');
$table->integer('operator_id')->default(0)->comment('生成人(后台系统用户ID');
$table->string('remark', 255)->default('')->comment('备注');
$table->timestamps();
$table->unique(['purchase_id', 'store_id'], 'bill_purchase_store_unique');
$table->index(['store_id', 'bill_date'], 'bill_store_date_index');
$table->comment('门店账单表(采购单完成后按门店生成)');
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bill');
}
};
+1
View File
@@ -193,6 +193,7 @@ class PermissionSeeder extends Seeder
['type' => 'rule', 'key' => 'purchase.order.query', 'name' => '查询'],
['type' => 'rule', 'key' => 'purchase.order.update', 'name' => '修改'],
['type' => 'rule', 'key' => 'purchase.order.generate', 'name' => '生成采购单'],
['type' => 'rule', 'key' => 'purchase.order.bill', 'name' => '生成账单'],
['type' => 'rule', 'key' => 'purchase.order.export', 'name' => '导出'],
],
],