increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->decimal('real_shipping_performance', 15, 2)->default(0)->comment('公司真实发货业绩'); $table->decimal('planting_performance', 15, 2)->default(0)->comment('公司种菜业绩'); $table->decimal('refund_amount', 15, 2)->default(0)->comment('退款金额'); $table->decimal('net_performance_income', 15, 2)->default(0)->comment('业绩净收入'); $table->decimal('tax_performance', 15, 2)->default(0)->comment('税务业绩'); $table->decimal('tax_refund', 15, 2)->default(0)->comment('税务退款'); $table->decimal('tax_net_income', 15, 2)->default(0)->comment('税务净收入'); $table->decimal('performance_difference', 15, 2)->default(0)->comment('业绩差额'); $table->decimal('final_tax_performance', 15, 2)->default(0)->comment('最终报税业绩'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 2. 公司店铺数据 Schema::create('business_company_store_data', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->string('store_name')->comment('店铺名称'); $table->decimal('store_performance', 15, 2)->default(0)->comment('店铺业绩'); $table->decimal('company_performance', 15, 2)->default(0)->comment('公司业绩'); $table->boolean('trigger_store_change')->default(false)->comment('是否触发店铺变更流程'); $table->boolean('trigger_company_registration')->default(false)->comment('是否触发公司注册流程'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 3. 店铺变更统计表 Schema::create('business_store_change_logs', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('store_entity')->comment('店铺主体'); $table->date('change_date')->comment('变更时间'); $table->string('receiving_account_info')->nullable()->comment('收款账户信息'); $table->string('historical_entity')->nullable()->comment('历史主体'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 4. 店铺收款账户信息 Schema::create('business_store_receiving_accounts', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_platform')->comment('店铺平台'); $table->string('store_name')->comment('店铺名称'); $table->string('wallet_number')->nullable()->comment('钱包号'); $table->string('store_entity_name')->comment('店铺主体名称'); $table->string('login_account')->nullable()->comment('登录账号'); $table->string('login_password')->nullable()->comment('登录密码'); $table->string('receiving_method')->default('银行卡')->comment('收款方式'); $table->string('receiving_account_name')->nullable()->comment('收款账户名称'); $table->string('alipay_or_bank_account')->nullable()->comment('支付宝账号/银行账号'); $table->string('opening_bank')->nullable()->comment('开户银行'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 5. 银行账户信息 Schema::create('business_bank_accounts', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('account_name')->comment('账户名称'); $table->string('account_type')->default('基本户')->comment('账户类型'); $table->string('bank_account_number')->nullable()->comment('银行账号'); $table->string('opening_bank')->nullable()->comment('开户行'); $table->string('ukey_password_maker')->nullable()->comment('ukey密码(制单)'); $table->string('login_password_maker')->nullable()->comment('登录密码(制单)'); $table->string('ukey_password_reviewer')->nullable()->comment('ukey密码(审核)'); $table->string('login_password_reviewer')->nullable()->comment('登录密码(审核)'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 6. 快递收款系统 Schema::create('business_courier_collections', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('courier_name')->comment('快递名称'); $table->string('collection_type')->comment('收款类型'); $table->string('collection_name')->nullable()->comment('收款名称'); $table->string('collection_account')->nullable()->comment('收款账号'); $table->string('opening_bank')->nullable()->comment('开户行'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 7. 发票基础信息 Schema::create('business_invoice_basic_info', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('store_entity')->comment('店铺主体'); $table->string('invoice_officer')->nullable()->comment('开票员'); $table->decimal('invoice_quota', 15, 2)->default(0)->comment('开票额度'); $table->decimal('output_amount', 15, 2)->default(0)->comment('销项金额'); $table->decimal('input_amount', 15, 2)->default(0)->comment('进项金额'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 8. 店铺后台开票 Schema::create('business_store_invoicing', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺'); $table->string('seller_name')->comment('销售方名称'); $table->string('seller_tax_number')->comment('销售方税号'); $table->string('buyer_name')->nullable()->comment('购买方名称'); $table->string('buyer_tax_number')->nullable()->comment('购买方税号'); $table->decimal('invoice_amount', 15, 2)->default(0)->comment('开票金额'); $table->string('category')->nullable()->comment('类目'); $table->string('invoice_type')->default('普票')->comment('开票类型'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 9. 财务SW规划表 Schema::create('business_sw_planning', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->decimal('final_tax_performance', 15, 2)->default(0)->comment('最终报税业绩'); $table->decimal('product_cost', 15, 2)->default(0)->comment('商品成本'); $table->decimal('logistics_cost', 15, 2)->default(0)->comment('物流成本'); $table->decimal('platform_invoice', 15, 2)->default(0)->comment('平台来票'); $table->decimal('labor_cost', 15, 2)->default(0)->comment('人工'); $table->decimal('other_expenses', 15, 2)->default(0)->comment('其他报销'); $table->decimal('profit', 15, 2)->default(0)->comment('利润'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 10. 实际SW统计表 Schema::create('business_sw_actual_statistics', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('region')->nullable()->comment('区域'); $table->string('company_type')->nullable()->comment('公司类型'); $table->string('contact_person')->nullable()->comment('对接人'); $table->string('bookkeeping_company')->nullable()->comment('代账公司'); $table->string('period')->nullable()->comment('期间'); $table->string('company_name')->comment('公司名称'); $table->decimal('provided_performance', 15, 2)->default(0)->comment('提供业绩'); $table->decimal('actual_declared_performance', 15, 2)->default(0)->comment('实际申报业绩'); // 商品收入(13%) $table->decimal('goods_special_invoice_amount', 15, 2)->default(0)->comment('商品专票金额'); $table->decimal('goods_special_invoice_tax', 15, 2)->default(0)->comment('商品专票税额'); $table->decimal('goods_general_invoice_amount', 15, 2)->default(0)->comment('商品普票金额'); $table->decimal('goods_general_invoice_tax', 15, 2)->default(0)->comment('商品普票税额'); $table->decimal('goods_uninvoiced_amount', 15, 2)->default(0)->comment('商品未开票金额'); $table->decimal('goods_uninvoiced_tax', 15, 2)->default(0)->comment('商品未开票税额'); $table->decimal('goods_income_subtotal', 15, 2)->default(0)->comment('商品收入小计'); $table->decimal('goods_tax_subtotal', 15, 2)->default(0)->comment('商品税金小计'); // 服务收入(6%) $table->decimal('service_special_invoice_amount', 15, 2)->default(0)->comment('服务专票金额'); $table->decimal('service_special_invoice_tax', 15, 2)->default(0)->comment('服务专票税额'); $table->decimal('service_general_invoice_amount', 15, 2)->default(0)->comment('服务普票金额'); $table->decimal('service_general_invoice_tax', 15, 2)->default(0)->comment('服务普票税额'); $table->decimal('service_uninvoiced_amount', 15, 2)->default(0)->comment('服务未开票金额'); $table->decimal('service_uninvoiced_tax', 15, 2)->default(0)->comment('服务未开票税额'); $table->decimal('service_income_subtotal', 15, 2)->default(0)->comment('服务收入小计'); $table->decimal('service_tax_subtotal', 15, 2)->default(0)->comment('服务税金小计'); // 合计 $table->decimal('total_income', 15, 2)->default(0)->comment('合计收入'); $table->decimal('total_tax', 15, 2)->default(0)->comment('合计税金'); // 进项发票 $table->decimal('input_goods_amount', 15, 2)->default(0)->comment('进项商品金额'); $table->decimal('input_goods_tax', 15, 2)->default(0)->comment('进项商品税额'); $table->decimal('input_service_amount', 15, 2)->default(0)->comment('进项服务费金额'); $table->decimal('input_service_tax', 15, 2)->default(0)->comment('进项服务费税额'); $table->decimal('input_other_amount', 15, 2)->default(0)->comment('进项其他金额'); $table->decimal('input_other_tax', 15, 2)->default(0)->comment('进项其他税额'); $table->decimal('input_total_amount', 15, 2)->default(0)->comment('进项金额合计'); $table->decimal('input_total_tax', 15, 2)->default(0)->comment('进项税额合计'); // 其他抵减 $table->decimal('additional_deduction', 15, 2)->default(0)->comment('加计抵减'); $table->decimal('retained_tax', 15, 2)->default(0)->comment('留抵税金'); // 实缴税金 $table->decimal('monthly_vat', 15, 2)->default(0)->comment('本月应交增值税'); $table->decimal('urban_maintenance_tax', 15, 2)->default(0)->comment('城建税金'); $table->decimal('education_surcharge', 15, 2)->default(0)->comment('教育费附加'); $table->decimal('local_education_surcharge', 15, 2)->default(0)->comment('地方教育费附加'); $table->decimal('stamp_tax', 15, 2)->default(0)->comment('印花税'); $table->decimal('union_fund', 15, 2)->default(0)->comment('工会经费'); $table->decimal('personal_income_tax', 15, 2)->default(0)->comment('个税'); $table->decimal('corporate_income_tax', 15, 2)->default(0)->comment('所得税'); $table->decimal('garbage_fee', 15, 2)->default(0)->comment('垃圾处理费'); $table->decimal('other_late_fee', 15, 2)->default(0)->comment('其他(滞纳金)'); $table->decimal('total_paid_tax', 15, 2)->default(0)->comment('税金合计'); $table->decimal('tax_burden', 8, 4)->default(0)->comment('税负'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 11. 资金预测表 Schema::create('business_fund_forecast', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('budget_month')->nullable()->comment('预算填报月份'); $table->string('actual_month')->nullable()->comment('实际填报月份'); $table->decimal('store_balance_budget', 15, 2)->default(0)->comment('店铺余额-预算'); $table->decimal('store_balance_actual', 15, 2)->default(0)->comment('店铺余额-实际'); $table->decimal('bank_balance_budget', 15, 2)->default(0)->comment('银行余额-预算'); $table->decimal('bank_balance_actual', 15, 2)->default(0)->comment('银行余额-实际'); $table->decimal('other_balance_budget', 15, 2)->default(0)->comment('其他账户余额-预算'); $table->decimal('other_balance_actual', 15, 2)->default(0)->comment('其他账户余额-实际'); $table->decimal('expected_monthly_return_budget', 15, 2)->default(0)->comment('预计本月回款-预算'); $table->decimal('expected_monthly_return_actual', 15, 2)->default(0)->comment('预计本月回款-实际'); $table->decimal('income_total_budget', 15, 2)->default(0)->comment('收入合计-预算'); $table->decimal('income_total_actual', 15, 2)->default(0)->comment('收入合计-实际'); // 支出明细 $table->decimal('prior_unpaid_budget', 15, 2)->default(0)->comment('往期未付-预算'); $table->decimal('prior_unpaid_actual', 15, 2)->default(0)->comment('往期未付-实际'); $table->decimal('advance_budget', 15, 2)->default(0)->comment('借支-预算'); $table->decimal('advance_actual', 15, 2)->default(0)->comment('借支-实际'); $table->decimal('supplier_budget', 15, 2)->default(0)->comment('供应商-预算'); $table->decimal('supplier_actual', 15, 2)->default(0)->comment('供应商-实际'); $table->decimal('spot_settlement_budget', 15, 2)->default(0)->comment('现结-预算'); $table->decimal('spot_settlement_actual', 15, 2)->default(0)->comment('现结-实际'); $table->decimal('courier_budget', 15, 2)->default(0)->comment('快递-预算'); $table->decimal('courier_actual', 15, 2)->default(0)->comment('快递-实际'); $table->decimal('paper_factory_budget', 15, 2)->default(0)->comment('纸厂压贴-预算'); $table->decimal('paper_factory_actual', 15, 2)->default(0)->comment('纸厂压贴-实际'); $table->decimal('edge_band_budget', 15, 2)->default(0)->comment('封边条-预算'); $table->decimal('edge_band_actual', 15, 2)->default(0)->comment('封边条-实际'); $table->decimal('board_budget', 15, 2)->default(0)->comment('板材、三合板-预算'); $table->decimal('board_actual', 15, 2)->default(0)->comment('板材、三合板-实际'); $table->decimal('salary_budget', 15, 2)->default(0)->comment('工资-预算'); $table->decimal('salary_actual', 15, 2)->default(0)->comment('工资-实际'); $table->decimal('daily_expense_budget', 15, 2)->default(0)->comment('日常费用-预算'); $table->decimal('daily_expense_actual', 15, 2)->default(0)->comment('日常费用-实际'); $table->decimal('planting_budget', 15, 2)->default(0)->comment('种菜-预算'); $table->decimal('planting_actual', 15, 2)->default(0)->comment('种菜-实际'); $table->decimal('red_packet_budget', 15, 2)->default(0)->comment('红包-预算'); $table->decimal('red_packet_actual', 15, 2)->default(0)->comment('红包-实际'); $table->decimal('corporate_deduction_budget', 15, 2)->default(0)->comment('对公扣款-预算'); $table->decimal('corporate_deduction_actual', 15, 2)->default(0)->comment('对公扣款-实际'); $table->decimal('expense_total_budget', 15, 2)->default(0)->comment('支出合计-预算'); $table->decimal('expense_total_actual', 15, 2)->default(0)->comment('支出合计-实际'); $table->decimal('bank_reservation', 15, 2)->default(0)->comment('银行账户店铺预留'); $table->decimal('net_balance_budget', 15, 2)->default(0)->comment('本月净结余-预算'); $table->decimal('net_balance_actual', 15, 2)->default(0)->comment('本月净结余-实际'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 12. 公司注册 Schema::create('business_company_registrations', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->string('registration_type')->nullable()->comment('注册类型'); $table->string('registration_status')->default('进行中')->comment('注册状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 13. 公司变更 Schema::create('business_company_changes', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->string('change_type')->nullable()->comment('变更类型'); $table->string('change_status')->default('进行中')->comment('变更状态'); $table->date('change_date')->nullable()->comment('变更日期'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 14. 公司注销 Schema::create('business_company_cancellations', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->string('cancellation_status')->default('进行中')->comment('注销状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 15. 商标信息 Schema::create('business_trademarks', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('trademark_name')->comment('商标名称'); $table->string('trademark_type')->nullable()->comment('商标类型'); $table->string('trademark_status')->default('有效')->comment('商标状态'); $table->date('registration_date')->nullable()->comment('注册日期'); $table->date('expiry_date')->nullable()->comment('到期日期'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 16. 开店流程 Schema::create('business_store_openings', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('store_platform')->comment('店铺平台'); $table->string('opening_status')->default('进行中')->comment('开店状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 17. 店铺变更 Schema::create('business_store_changes', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('change_type')->nullable()->comment('变更类型'); $table->string('change_status')->default('进行中')->comment('变更状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 18. 关店流程 Schema::create('business_store_closings', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('closing_status')->default('进行中')->comment('关店状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 19. 公司公用账户信息 Schema::create('business_company_shared_accounts', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('account_name')->comment('账户名称'); $table->string('account_type')->default('基本户')->comment('账户类型'); $table->string('bank_account_number')->nullable()->comment('银行账号'); $table->string('opening_bank')->nullable()->comment('开户行'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 20. 自动开票 Schema::create('business_auto_invoicing', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('store_name')->comment('店铺名称'); $table->string('auto_invoice_status')->default('已开启')->comment('自动开票状态'); $table->text('notes')->nullable()->comment('备注'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 21. 进项报表 Schema::create('business_input_invoice_reports', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->decimal('input_goods_amount', 15, 2)->default(0)->comment('进项商品金额'); $table->decimal('input_goods_tax', 15, 2)->default(0)->comment('进项商品税额'); $table->decimal('input_service_amount', 15, 2)->default(0)->comment('进项服务费金额'); $table->decimal('input_service_tax', 15, 2)->default(0)->comment('进项服务费税额'); $table->decimal('input_total_amount', 15, 2)->default(0)->comment('进项金额合计'); $table->decimal('input_total_tax', 15, 2)->default(0)->comment('进项税额合计'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 22. 销项报表 Schema::create('business_output_invoice_reports', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->decimal('output_goods_amount', 15, 2)->default(0)->comment('销项商品金额'); $table->decimal('output_goods_tax', 15, 2)->default(0)->comment('销项商品税额'); $table->decimal('output_service_amount', 15, 2)->default(0)->comment('销项服务费金额'); $table->decimal('output_service_tax', 15, 2)->default(0)->comment('销项服务费税额'); $table->decimal('output_total_amount', 15, 2)->default(0)->comment('销项金额合计'); $table->decimal('output_total_tax', 15, 2)->default(0)->comment('销项税额合计'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 23. 财务经营分析报表 Schema::create('business_financial_analysis', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('company_name')->comment('公司名称'); $table->string('period')->nullable()->comment('期间'); $table->decimal('revenue', 15, 2)->default(0)->comment('收入'); $table->decimal('total_cost', 15, 2)->default(0)->comment('总成本'); $table->decimal('gross_profit', 15, 2)->default(0)->comment('毛利'); $table->decimal('net_profit', 15, 2)->default(0)->comment('净利润'); $table->decimal('profit_margin', 8, 4)->default(0)->comment('利润率'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 24. 业务流程统计表 Schema::create('business_process_statistics', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('process_name')->comment('流程名称'); $table->integer('total_count')->default(0)->comment('总数量'); $table->integer('completed_count')->default(0)->comment('已完成'); $table->integer('pending_count')->default(0)->comment('待处理'); $table->string('period')->nullable()->comment('期间'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 25. 付款流程统计表 Schema::create('business_payment_statistics', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('payment_type')->comment('付款类型'); $table->integer('total_count')->default(0)->comment('总数量'); $table->integer('completed_count')->default(0)->comment('已完成'); $table->integer('pending_count')->default(0)->comment('待处理'); $table->decimal('total_amount', 15, 2)->default(0)->comment('总金额'); $table->string('period')->nullable()->comment('期间'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); // 26. 待办事项 Schema::create('business_todos', function (Blueprint $table) { $table->increments('id'); $table->integer('company_id')->default(1); $table->string('title')->comment('标题'); $table->string('category')->nullable()->comment('分类'); $table->string('priority')->default('普通')->comment('优先级'); $table->string('status')->default('待处理')->comment('状态'); $table->date('due_date')->nullable()->comment('截止日期'); $table->text('description')->nullable()->comment('描述'); $table->timestamps(); $table->softDeletes(); $table->index('company_id'); }); } public function down() { Schema::dropIfExists('business_tax_data'); Schema::dropIfExists('business_company_store_data'); Schema::dropIfExists('business_store_change_logs'); Schema::dropIfExists('business_store_receiving_accounts'); Schema::dropIfExists('business_bank_accounts'); Schema::dropIfExists('business_courier_collections'); Schema::dropIfExists('business_invoice_basic_info'); Schema::dropIfExists('business_store_invoicing'); Schema::dropIfExists('business_sw_planning'); Schema::dropIfExists('business_sw_actual_statistics'); Schema::dropIfExists('business_fund_forecast'); Schema::dropIfExists('business_company_registrations'); Schema::dropIfExists('business_company_changes'); Schema::dropIfExists('business_company_cancellations'); Schema::dropIfExists('business_trademarks'); Schema::dropIfExists('business_store_openings'); Schema::dropIfExists('business_store_changes'); Schema::dropIfExists('business_store_closings'); Schema::dropIfExists('business_company_shared_accounts'); Schema::dropIfExists('business_auto_invoicing'); Schema::dropIfExists('business_input_invoice_reports'); Schema::dropIfExists('business_output_invoice_reports'); Schema::dropIfExists('business_financial_analysis'); Schema::dropIfExists('business_process_statistics'); Schema::dropIfExists('business_payment_statistics'); Schema::dropIfExists('business_todos'); } };