Compare commits
No commits in common. "main" and "develop" have entirely different histories.
|
|
@ -29,7 +29,6 @@ class ConstFlowController extends AdminController
|
|||
amisMake()->TextControl('name', '姓名')->size('md'),
|
||||
amisMake()->TextControl('card_no', '身份证')->size('md'),
|
||||
amisMake()->TextControl('idsn', '单据编号')->size('md'),
|
||||
amisMake()->SelectControl('const_type', '缴费类型')->options(ConstFlow::typeMap())->size('md'),
|
||||
amis('button')->label(__('admin.reset'))->actionType('clear-and-submit'),
|
||||
amis('submit')->label(__('admin.search'))->level('primary'),
|
||||
])->actions([])
|
||||
|
|
@ -39,16 +38,10 @@ class ConstFlowController extends AdminController
|
|||
amisMake()->TableColumn('oldman.name', '客人'),
|
||||
amisMake()->TableColumn('const_type', '缴费类型')->type('mapping')->map(ConstFlow::typeMapLabel())->className('text-primary'),
|
||||
amisMake()->TableColumn('money', '金额'),
|
||||
amisMake()->TableColumn('start_at', '开始时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('end_at', '结束时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->showFlow(),
|
||||
]),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true, 'lg')->hiddenOn('this.const_type == 3'),
|
||||
$this->rowDeleteButton()->hiddenOn('this.const_type == 3')
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -57,10 +50,7 @@ class ConstFlowController extends AdminController
|
|||
public function form($isEdit = false): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
amisMake()->GroupControl()->body([
|
||||
amisMake()->DateControl('start_at', '开始时间')->format('YYYY-MM-DD 00:00:00')->required(true),
|
||||
amisMake()->DateControl('end_at', '结束时间')->format('YYYY-MM-DD 23:59:59')->required(true),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
use Slowlyo\OwlAdmin\Renderers\Form;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use App\Services\Admin\HydropowerFeeService;
|
||||
use App\Models\Oldmen;
|
||||
use Slowlyo\OwlAdmin\Renderers\TableColumn;
|
||||
use App\Admin\Components;
|
||||
|
||||
/**
|
||||
* 水电续费
|
||||
*
|
||||
* @property HydropowerFeeService $service
|
||||
*/
|
||||
class HydropowerFeeController extends AdminController
|
||||
{
|
||||
protected string $serviceName = HydropowerFeeService::class;
|
||||
|
||||
public function list(): Page
|
||||
{
|
||||
$crud = $this->baseCRUD()
|
||||
->filterTogglable(false)
|
||||
->headerToolbar([
|
||||
$this->createButton(true, 'lg'),
|
||||
...$this->baseHeaderToolBar()
|
||||
])
|
||||
->filter(
|
||||
$this->baseFilter()->body([
|
||||
amisMake()->TextControl('name', '姓名')->size('md'),
|
||||
amisMake()->TextControl('card_no', '身份证')->size('md'),
|
||||
amisMake()->TextControl('sn', '单据编号')->size('md'),
|
||||
amis('button')->label(__('admin.reset'))->actionType('clear-and-submit'),
|
||||
amis('submit')->label(__('admin.search'))->level('primary'),
|
||||
])->actions([])
|
||||
)
|
||||
->columns([
|
||||
amisMake()->TableColumn('sn', '单据编号')->sortable(),
|
||||
amisMake()->TableColumn('oldman.name', '客人'),
|
||||
amisMake()->TableColumn('start_at', '开始时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('end_at', '结束时间')->type('datetime')->sortable(true),
|
||||
amisMake()->TableColumn('money', '金额'),
|
||||
amisMake()->TableColumn('created_at', '办理时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
amisMake()->Button()->label('打印预览')->actionType('url')->blank(true)
|
||||
->url(url('/print-water-fee').'?id=${id}')->level('link'),
|
||||
$this->rowEditButton(true, 'lg'),
|
||||
$this->rowDeleteButton()
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
}
|
||||
|
||||
public function form($isEdit = false): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
amisMake()->PickerControl('oldman_id', '姓名')
|
||||
->valueField('id')
|
||||
->labelField('name')
|
||||
->joinValues(false)->extractValue(true)
|
||||
->size('md')
|
||||
->source([
|
||||
'method' => 'get',
|
||||
'url' => admin_url('oldmen?_action=getData&live_in='.Oldmen::STATUS_NORMAL),
|
||||
'data' => [
|
||||
'name'=>'${term}',
|
||||
]
|
||||
])
|
||||
->pickerSchema(
|
||||
[
|
||||
'mode' => 'table',
|
||||
'name' => 'monitor_list',
|
||||
'headerToolbar' => amisMake()->form()
|
||||
->wrapWithPanel(false)
|
||||
->className('text-right')
|
||||
->target('monitor_list')
|
||||
->mode('inline')
|
||||
->body([
|
||||
amisMake()->TextControl('term', '姓名/身份证号')->addOn(
|
||||
amis('submit')->label(__('admin.search'))->level('primary')
|
||||
)
|
||||
]),
|
||||
'columns' => [
|
||||
TableColumn::make()->name('name')->label('姓名'),
|
||||
TableColumn::make()->name('card_no')->label('身份证号码'),
|
||||
]
|
||||
]
|
||||
)->value(0)
|
||||
->required(true),
|
||||
amisMake()->GroupControl()->body([
|
||||
amisMake()->DateControl('start_at', '开始时间')->format('YYYY-MM-DD 00:00:00')->required(true),
|
||||
amisMake()->DateControl('end_at', '结束时间')->format('YYYY-MM-DD 23:59:59')->required(true),
|
||||
]),
|
||||
Components::make()->decimalControl('money', '金额')->required(true),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail(): Form
|
||||
{
|
||||
return $this->baseDetail()->body([
|
||||
amisMake()->TextControl('id', 'ID')->static(),
|
||||
amisMake()->TextControl('created_at', __('admin.created_at'))->static(),
|
||||
amisMake()->TextControl('updated_at', __('admin.updated_at'))->static()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ class LiveContinueController extends AdminController
|
|||
$crud = $this->baseCRUD()
|
||||
->filterTogglable(false)
|
||||
->headerToolbar([
|
||||
amis('button')->label('续住')->icon('fa fa-plus')->actionType('link')->level('primary')->link('live-continue-do'),
|
||||
amis('button')->label('续住')->icon('fa fa-plus')->actionType('link')->level('primary')->link('live-in-continue'),
|
||||
])
|
||||
->filter(
|
||||
$this->baseFilter()->body([
|
||||
|
|
|
|||
|
|
@ -44,9 +44,8 @@ class LiveInController extends AdminController
|
|||
TableColumn::make()->name('live_in_at')->label('入住时间')->type('datetime')->sortable(true),
|
||||
TableColumn::make()->name('avliable_at')->label('截至时间')->type('datetime')->sortable(true),
|
||||
amisMake()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(true, 'lg'),
|
||||
amisMake()->LinkAction()->label('续住')->icon('fa fa-plus')->link('live-continue-do?oldman_id=${id}')->level('link'),
|
||||
amisMake()->LinkAction()->label('结算')->icon('fa fa-external-link-alt')->link('live-exit-do?oldman_id=${id}')->level('link'),
|
||||
amisMake()->LinkAction()->label('结算')->icon('fa fa-external-link-alt')->link('live-exit-do?oldman_id=${id}')->level('link')
|
||||
]),
|
||||
]);
|
||||
|
||||
|
|
@ -55,10 +54,7 @@ class LiveInController extends AdminController
|
|||
public function form(): Form
|
||||
{
|
||||
return $this->baseForm()->body([
|
||||
amisMake()->GroupControl()->body([
|
||||
amisMake()->DateControl('live_in_at', '入住时间')->format('YYYY-MM-DD 00:00:00')->required(true),
|
||||
amisMake()->DateControl('avliable_at', '截至时间')->format('YYYY-MM-DD 23:59:59')->required(true),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -177,16 +173,16 @@ class LiveInController extends AdminController
|
|||
),
|
||||
]),
|
||||
|
||||
amisMake()->FieldSetControl()->className('mt-10')->title('附加项')->collapsable(true)->body([
|
||||
amisMake()->ComboControl('add_extends','收费项')->multiple(true)->items([
|
||||
amisMake()->TextControl('name', '名称'),
|
||||
Components::make()->decimalControl('fee', '金额')
|
||||
]),
|
||||
amisMake()->ComboControl('del_extends','抵扣项')->multiple(true)->items([
|
||||
amisMake()->TextControl('name', '名称'),
|
||||
Components::make()->decimalControl('fee', '金额')
|
||||
]),
|
||||
]),
|
||||
// amisMake()->FieldSetControl()->className('mt-10')->title('附加项')->collapsable(true)->body([
|
||||
// amisMake()->ComboControl('add_extends','收费项')->multiple(true)->items([
|
||||
// amisMake()->TextControl('name', '名称'),
|
||||
// Components::make()->decimalControl('fee', '金额')
|
||||
// ]),
|
||||
// amisMake()->ComboControl('del_extends','抵扣项')->multiple(true)->items([
|
||||
// amisMake()->TextControl('name', '名称'),
|
||||
// Components::make()->decimalControl('fee', '金额')
|
||||
// ]),
|
||||
// ]),
|
||||
])
|
||||
->actions([
|
||||
amis('button')->label("生成清单")->level('primary')
|
||||
|
|
@ -256,14 +252,12 @@ class LiveInController extends AdminController
|
|||
|
||||
$liveFee = $request->input('live_fee', []);
|
||||
$bondsFee = $request->input('bonds_fee', []);
|
||||
$addFee = $request->input('add_extends', []);
|
||||
$delFee = $request->input('del_extends', []);
|
||||
// $addFee = $request->input('add_extends', []);
|
||||
// $delFee = $request->input('del_extends', []);
|
||||
|
||||
$res = $this->service->do($oldManId, $startDay, $endDay, [
|
||||
'live_fee' => $liveFee,
|
||||
'bonds_fee' => $bondsFee,
|
||||
'add_fee' => $addFee,
|
||||
'del_fee' => $delFee,
|
||||
]);
|
||||
|
||||
return $this->autoResponse($res, '入住');
|
||||
|
|
|
|||
|
|
@ -55,11 +55,8 @@ class OldmenController extends AdminController
|
|||
amisMake()->TextControl('name', '姓名')->size('md'),
|
||||
amisMake()->TextControl('card_no', '身份证')->size('md'),
|
||||
amisMake()->TextControl('floor_name', '楼栋')->size('md'),
|
||||
amisMake()->SelectControl('nurse_lv', '护理等级')->options(Keyword::getByParentKey('nurse_lv')->pluck('name', 'value'))->size('md'),
|
||||
amisMake()->SelectControl('live_in', '入住状态')->options([
|
||||
"1"=>'已入住', '0'=>'未入住',
|
||||
])->size('md'),
|
||||
amis('button')->label(__('admin.reset'))->actionType('clear-and-submit'),
|
||||
amisMake()->SelectControl('nurse_lv', '护理等级')->options(Keyword::getByParentKey('nurse_lv')->pluck('name', 'value'))->checkAll(true)->multiple(true)->size('md'),
|
||||
amis('button')->label(__('admin.reset'))->actionType('clear-and-submit'),
|
||||
amis('submit')->label(__('admin.search'))->level('primary'),
|
||||
])->actions([])
|
||||
)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Route::group([
|
|||
$router->get('live-fee-form-data', '\App\Admin\Controllers\OldmenController@liveSchemaFormData');
|
||||
$router->get('live-const-flow', '\App\Admin\Controllers\OldmenController@liveConstFlow');
|
||||
//客人-入住
|
||||
$router->resource('live-in', \App\Admin\Controllers\LiveInController::class)->only(['index', 'edit', 'update']);
|
||||
$router->get('live-in', '\App\Admin\Controllers\LiveInController@index');
|
||||
$router->get('live-in-do', '\App\Admin\Controllers\LiveInController@doForm');
|
||||
$router->post('live-in-do', '\App\Admin\Controllers\LiveInController@do');
|
||||
//客人-续住
|
||||
|
|
@ -45,7 +45,7 @@ Route::group([
|
|||
$router->post('live-exit-do', '\App\Admin\Controllers\LiveExitController@do');
|
||||
|
||||
//费用设置
|
||||
$router->resource('consts', \App\Admin\Controllers\ConstFlowController::class)->only(['index', 'edit', 'update','show', 'destroy']);
|
||||
$router->resource('consts', \App\Admin\Controllers\ConstFlowController::class)->only(['index', 'show', 'destroy']);
|
||||
$router->post('flow-list-tabs', '\App\Admin\Controllers\ConstFlowController@flowExtendList');
|
||||
$router->get('const-setting', '\App\Admin\Controllers\SettingController@settingFeeConfig');
|
||||
$router->post('const-setting', '\App\Admin\Controllers\SettingController@settingFeeConfigStore');
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use Carbon\Carbon;
|
|||
use App\Models\Oldmen;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class VerifyNeedPayArrear extends Command
|
||||
class VerifyNeedPayContinue extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ class VerifyNeedPayContinue extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
Oldmen::where('live_in', Oldmen::STATUS_LIVE)
|
||||
->where('need_pay', Oldmen::PAY_NORMAL)
|
||||
->whereDate('avliable_at', Carbon::now()->addDays(settings()->get('live_continue_day', 0)))->update([
|
||||
->whereDate('avliable_at', Carbon::now()->subDays(settings()->get('live_continue_day', 0)))->update([
|
||||
'need_pay' => Oldmen::PAY_NOTICE
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filters\Admin;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class HydropowerFeeFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* oldman
|
||||
*/
|
||||
public function oldman($oldmanId){
|
||||
return $this->where('oldman_id', $oldmanId);
|
||||
}
|
||||
|
||||
public function sn($sn){
|
||||
return $this->where('sn', $sn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
public function name($name){
|
||||
return $this->whereHas('oldman', function($q) use ($name) {
|
||||
return $q->where('name', 'like', '%'.$name.'%');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
public function cardNo($cardNo){
|
||||
return $this->whereHas('oldman', function($q) use ($cardNo) {
|
||||
return $q->where('card_no', 'like', '%'.$cardNo.'%');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\{ConstFlow, HydropowerFee};
|
||||
use App\Models\ConstFlow;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\Admin\ConstFlowService;
|
||||
|
||||
|
|
@ -19,7 +19,6 @@ class PrintController extends Controller
|
|||
$bigTotal = '';
|
||||
$adminName = '';
|
||||
$timeZone = '';
|
||||
$idsn = '';
|
||||
|
||||
$flow = ConstFlow::find($request->input('id', 0));
|
||||
if($flow){
|
||||
|
|
@ -65,50 +64,6 @@ class PrintController extends Controller
|
|||
return view('print-const', compact('name', 'time', 'idsn', 'list', 'total', 'bigTotal', 'timeZone', 'adminName'));
|
||||
}
|
||||
|
||||
public function showWaterFee(Request $request){
|
||||
$name = '';
|
||||
$time = now()->format('Y-m-d H:i:s');
|
||||
$sn = '';
|
||||
//默认list最少N行,最多N行;
|
||||
$list = [];
|
||||
$total = 0;
|
||||
$bigTotal = '';
|
||||
$adminName = '';
|
||||
$timeZone = '';
|
||||
|
||||
$flow = HydropowerFee::find($request->input('id', 0));
|
||||
if($flow){
|
||||
$flow->load(['oldman', 'adminuser']);
|
||||
$name = $flow->oldman->name;
|
||||
$time = $flow->created_at->format('Y-m-d H:i:s');
|
||||
$sn = $flow->sn;
|
||||
$i = 1;
|
||||
$list[] = [
|
||||
'fee_name' => '水电缴费',
|
||||
'fee_value' => $flow->money,
|
||||
];
|
||||
for($i; $i<4; $i++){
|
||||
$list[] = [
|
||||
'fee_name' => '',
|
||||
'fee_value' => 0,
|
||||
];
|
||||
}
|
||||
if(count($list) > 0){
|
||||
$total = collect($list)->sum('fee_value');
|
||||
if($total > 0){
|
||||
$bigTotal = $this->num2chinese($total);
|
||||
}else{
|
||||
$bigTotal = '负'.$this->num2chinese(abs($total));
|
||||
}
|
||||
}
|
||||
|
||||
$adminName = $flow->adminuser->name;
|
||||
$timeZone = substr($flow->start_at, 0, 10).'至'.substr($flow->end_at, 0, 10);
|
||||
}
|
||||
|
||||
return view('print-water-fee', compact('name', 'time', 'list', 'total', 'bigTotal', 'timeZone', 'adminName', 'sn'));
|
||||
}
|
||||
|
||||
|
||||
private function num2chinese($num) {
|
||||
$cnNums = array(
|
||||
|
|
@ -119,7 +74,7 @@ class PrintController extends Controller
|
|||
$cnDecUnits = array("角", "分");
|
||||
$cnInteger = "整";
|
||||
|
||||
$intStr = (string)floor($num);
|
||||
$intStr = (string)$num;
|
||||
$len = strlen($intStr);
|
||||
if ($len > 15 || $num < 0) {
|
||||
return false; // 超出处理范围
|
||||
|
|
@ -131,7 +86,6 @@ class PrintController extends Controller
|
|||
|
||||
$zeroCount = 0;
|
||||
$outChinese = "";
|
||||
//处理整数部分
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$idx = $len - $i - 1;
|
||||
$thisNum = (int)$intStr[$idx];
|
||||
|
|
@ -143,21 +97,18 @@ class PrintController extends Controller
|
|||
$outChinese = "零" . $outChinese; // 处理零
|
||||
}
|
||||
$zeroCount = 0;
|
||||
if ($i > 0 && $i % 4 == 0) {
|
||||
$outChinese = $cnNums[$thisNum] .$cnIntRadice[$i / 4] . $outChinese;
|
||||
}else{
|
||||
$outChinese = $cnNums[$thisNum] . $cnIntUnits[$i % 4] . $outChinese;
|
||||
$outChinese = $cnNums[$thisNum] . $cnIntUnits[$i % 4] . $outChinese;
|
||||
if ($i % 4 == 0) {
|
||||
$outChinese = $cnIntRadice[$i / 4] . $outChinese;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($zeroCount > 0) {
|
||||
$outChinese = '零'.$outChinese; // 处理最后的零
|
||||
}else{
|
||||
$outChinese = rtrim($outChinese,'零'); // 处理最后的零
|
||||
$outChinese = "零" . $outChinese; // 处理最后的零
|
||||
}
|
||||
|
||||
$outChinese .= "元";
|
||||
|
||||
|
||||
// 处理小数部分
|
||||
if (strpos($num, '.') !== false) {
|
||||
$decPart = substr($num, strpos($num, '.') + 1);
|
||||
|
|
|
|||
|
|
@ -31,21 +31,14 @@ class Oldmen extends ImportBase
|
|||
|
||||
if(ModelsOldmen::where('card_no', $cardNo)->exists()){//如果已存在,则为更新
|
||||
$oldman = ModelsOldmen::where('card_no', $cardNo)->first();
|
||||
$newLv = Keyword::where(['type_key'=>'nurse_lv', 'name'=>$nurseLvName])->first();
|
||||
if(!$newLv) {
|
||||
throw new ImportException('未找到对应【'.$nurseLvName.'】护理等级');
|
||||
}
|
||||
if($oldman->nurse_lv !== $newLv->value && $oldman->live_in > 0){
|
||||
$newLv = Keyword::where(['type_key'=>'nurse_lv', 'name'=>$nurseLvName])->value('value');
|
||||
if($oldman->nurse_lv !== $newLv && $oldman->live_in > 0){
|
||||
throw new ImportException('当前入住状态无法直接变更护理等级');
|
||||
};
|
||||
}K;
|
||||
}else{
|
||||
$oldman = new ModelsOldmen();
|
||||
$oldman->card_no = $cardNo;
|
||||
$nurseLv = Keyword::where(['type_key'=>'nurse_lv', 'name'=>$nurseLvName])->first();
|
||||
if(!$nurseLv) {
|
||||
throw new ImportException('未找到对应【'.$nurseLvName.'】护理等级');
|
||||
}
|
||||
$oldman->nurse_lv = $nurseLv->value;
|
||||
$oldman->nurse_lv = Keyword::where(['type_key'=>'nurse_lv', 'name'=>$nurseLvName])->value('value');
|
||||
}
|
||||
$oldman->name = $name;
|
||||
$sexArr = [
|
||||
|
|
@ -53,9 +46,6 @@ class Oldmen extends ImportBase
|
|||
'男'=>1,
|
||||
'女'=>2
|
||||
];
|
||||
if(!isset($sexArr[$sex])){
|
||||
throw new ImportException('未填写性别');
|
||||
}
|
||||
$oldman->sex = $sexArr[$sex];
|
||||
$oldman->birthday = Carbon::parse($birthDate);
|
||||
$oldman->card_city_code = Zone::where(['name' => $cardArea, 'type'=>'area'])->value('code') ?? '';
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ class ConstFlow extends Model
|
|||
{
|
||||
parent::boot();
|
||||
// 监听 flow 创建事件,创建sn;
|
||||
static::creating(function ($constFlow) {
|
||||
$constFlow->sn = self::createSn();
|
||||
static::creating(function ($oldmen) {
|
||||
$oldmen->sn = self::createSn();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use EloquentFilter\Filterable;
|
||||
use Carbon\Carbon;
|
||||
use Slowlyo\OwlAdmin\OwlAdmin;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
|
||||
class HydropowerFee extends Model
|
||||
{
|
||||
use Filterable;
|
||||
|
||||
protected $fillable = [
|
||||
'oldman_id', 'money', 'extends', 'start_at', 'end_at', 'sn', 'adminuser_id',
|
||||
];
|
||||
|
||||
public function oldman(){
|
||||
return $this->belongsTo(Oldmen::class, 'oldman_id');
|
||||
}
|
||||
|
||||
public function adminuser(){
|
||||
return $this->belongsTo(AdminUser::class, 'adminuser_id');
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
// 监听 flow 创建事件,创建sn;
|
||||
static::creating(function ($hydropowerFee) {
|
||||
if(empty($hydropowerFee->sn)){
|
||||
$hydropowerFee->sn = self::createSn();
|
||||
}
|
||||
if(empty($hydropowerFee->adminuser_id)){
|
||||
$hydropowerFee->adminuser_id = OwlAdmin::user()->id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static function createSn()
|
||||
{
|
||||
return Carbon::now()->isoFormat('YYMMDDHHmmss').rand(1000, 9999);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,8 +5,6 @@ namespace App\Services\Admin;
|
|||
use App\Models\ConstFlow;
|
||||
use Slowlyo\OwlAdmin\Services\AdminService;
|
||||
use App\Filters\Admin\ConstFlowFilter;
|
||||
use App\Models\Oldmen;
|
||||
use PhpParser\Node\Stmt\Const_;
|
||||
|
||||
/**
|
||||
* 费用明细
|
||||
|
|
@ -30,32 +28,4 @@ class ConstFlowService extends BaseService
|
|||
'avliable_at' => $flow->end_at
|
||||
]));
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$id = collect(explode(',', $ids));
|
||||
// 所有ID
|
||||
foreach ($id as $value) {
|
||||
$_flow = ConstFlow::find($value);
|
||||
if($_flow->const_type == ConstFlow::TYPE_IN){
|
||||
$_oldman = Oldmen::find($_flow->oldman_id);
|
||||
//如果还有续费记录未删除,则提示先删除续费记录;
|
||||
if(ConstFlow::where('oldman_id', $_oldman->id)->where('const_type', '>', ConstFlow::TYPE_IN)->where('end_at', '<=', $_oldman->avliable_at)->exists()){
|
||||
return $this->setError('请先删除该用户续费记录');
|
||||
}
|
||||
//如果删除入住;则判断当前用户状态是否是入住,是,则变更为未入住;
|
||||
if($_oldman->live_in_at == $_flow->start_at && $_oldman->live_in == Oldmen::STATUS_LIVE){
|
||||
$_oldman->update([
|
||||
'live_in' => Oldmen::STATUS_NORMAL,
|
||||
'need_pay' => Oldmen::PAY_NORMAL,
|
||||
'live_in_at' => null,
|
||||
'avliable_at' => null,
|
||||
'bonds' => [],//保证金归零
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$id = $id->unique();
|
||||
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Admin;
|
||||
|
||||
use App\Models\HydropowerFee;
|
||||
use App\Filters\Admin\HydropowerFeeFilter;
|
||||
|
||||
/**
|
||||
* 水电续费
|
||||
*
|
||||
* @method HydropowerFee getModel()
|
||||
* @method HydropowerFee|\Illuminate\Database\Query\Builder query()
|
||||
*/
|
||||
class HydropowerFeeService extends BaseService
|
||||
{
|
||||
protected string $modelName = HydropowerFee::class;
|
||||
|
||||
protected string $modelFilterName = HydropowerFeeFilter::class;
|
||||
|
||||
protected array $withRelationships = ['oldman'];
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Services\Admin;
|
||||
|
||||
use App\Models\Oldmen;
|
||||
use App\Models\{ConstFlow, HydropowerFee};
|
||||
use App\Models\ConstFlow;
|
||||
use DB;
|
||||
use Throwable;
|
||||
use Carbon\Carbon;
|
||||
|
|
@ -76,17 +76,6 @@ class LiveContinueService extends OldmenService
|
|||
'avliable_at' => $endAt,
|
||||
'nurse_lv' => $newLv,
|
||||
]);
|
||||
//同步水电费
|
||||
if(isset($feeArr['live_fee']['water_fee']) && $feeArr['live_fee']['water_fee'] > 0){
|
||||
HydropowerFee::create([
|
||||
'oldman_id' => $flow->oldman_id,
|
||||
'start_at' => $flow->start_at,
|
||||
'end_at' => $flow->end_at,
|
||||
'sn' => str_pad($flow->id, 6, '0',STR_PAD_LEFT),
|
||||
'adminuser_id'=> $flow->adminuser_id,
|
||||
'money' => $feeArr['live_fee']['water_fee']
|
||||
]);
|
||||
}
|
||||
DB::commit();
|
||||
}catch(Throwable $th){
|
||||
DB::rollBack();
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class OldmenService extends BaseService
|
|||
$rows[] = [
|
||||
'ukey' => $item,
|
||||
'name' => $_fee->parent?->name ?? '',
|
||||
'fee_name' => $_fee->name ?? '其他项',
|
||||
'fee_name' => $_fee->name,
|
||||
'fee_value' => $vv,
|
||||
];
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ class OldmenService extends BaseService
|
|||
$rows[] = [
|
||||
'ukey' => $key,
|
||||
'name' => $_fee->parent?->name ?? '',
|
||||
'fee_name' => $_fee->name ?? '其他项',
|
||||
'fee_name' => $_fee->name,
|
||||
'fee_value' => $value,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('hydropower_fees', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('oldman_id');
|
||||
$table->string('sn')->comment('流水编号');
|
||||
$table->timestamp('start_at')->nullable()->comment('开始时间');
|
||||
$table->timestamp('end_at')->nullable()->comment('结束时间');
|
||||
$table->decimal('money', 10, 2)->default(0.00)->nullable()->comment('金额');
|
||||
$table->unsignedBigInteger('adminuser_id')->comment('操作人');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('hydropower_fees');
|
||||
}
|
||||
};
|
||||
|
|
@ -43,10 +43,10 @@ class KeywordSeeder extends Seeder
|
|||
]],
|
||||
['key' => 'nurse_lv', 'name' => '护理等级', 'value' => '', 'list' => [
|
||||
['key' => 'nurse_lv_1', 'name' => '自理', 'type_key' => 'nurse_lv', 'value' => 1],
|
||||
['key' => 'nurse_lv_2', 'name' => '介护一级', 'type_key' => 'nurse_lv', 'value' => 2],
|
||||
['key' => 'nurse_lv_3', 'name' => '介护二级', 'type_key' => 'nurse_lv', 'value' => 3],
|
||||
['key' => 'nurse_lv_4', 'name' => '介护三级', 'type_key' => 'nurse_lv', 'value' => 4],
|
||||
['key' => 'nurse_lv_5', 'name' => '介护四级', 'type_key' => 'nurse_lv', 'value' => 5],
|
||||
['key' => 'nurse_lv_1', 'name' => '介护一级', 'type_key' => 'nurse_lv', 'value' => 1],
|
||||
['key' => 'nurse_lv_2', 'name' => '介护二级', 'type_key' => 'nurse_lv', 'value' => 2],
|
||||
['key' => 'nurse_lv_3', 'name' => '介护三级', 'type_key' => 'nurse_lv', 'value' => 3],
|
||||
['key' => 'nurse_lv_1', 'name' => '介护四级', 'type_key' => 'nurse_lv', 'value' => 4],
|
||||
]],
|
||||
];
|
||||
|
||||
|
|
@ -65,7 +65,6 @@ class KeywordSeeder extends Seeder
|
|||
'type_key' => $parentType->key,
|
||||
'level' => ($parentType->level ?? 1) + 1,
|
||||
'parent_id' => $parentType->id,
|
||||
'value' => $item['value'],
|
||||
]);
|
||||
} else {
|
||||
$type = Keyword::create(Arr::except($item, 'list'));
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
<body>
|
||||
<button type="button" class="print-hide" onclick="this.style.display='none';window.print();this.style.display='inline';">打印</button>
|
||||
<div class="container" id="print-content">
|
||||
<p style="font-size:25px;margin-top: 10px">重庆金阳仁康养老服务有限公司收据</p>
|
||||
<p style="font-size:25px;margin-top: 10px">重庆市巴南区狮子山老年公寓收据</p>
|
||||
<p class="tag" style="font-size:20px;">
|
||||
<span class="left">客户姓名 :{{$name}}</span>
|
||||
<span class="middle">日期 :{{$time}}</span>
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>打印</title>
|
||||
<style>
|
||||
@media print {
|
||||
@page {
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
margin: 0.8cm;
|
||||
}
|
||||
}
|
||||
body {
|
||||
font-family: "宋体", sans-serif;
|
||||
}
|
||||
.container {
|
||||
/* width: 800px; */
|
||||
text-align: center;
|
||||
}
|
||||
.tag {
|
||||
overflow: hidden; /* 清除浮动 */
|
||||
}
|
||||
span{
|
||||
display: block;
|
||||
float: left;
|
||||
width: 33.333%;
|
||||
text-align: left;
|
||||
}
|
||||
span.left {
|
||||
text-align: left;
|
||||
}
|
||||
span.right {
|
||||
float: right;
|
||||
text-align: left;
|
||||
}
|
||||
table.print-table {
|
||||
width: 100%;
|
||||
border-collapse:collapse;
|
||||
border: 1px solid black;
|
||||
margin: 0 auto;
|
||||
table-layout: fixed;
|
||||
}
|
||||
td, th{
|
||||
line-height: 30px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button type="button" class="print-hide" onclick="this.style.display='none';window.print();this.style.display='inline';">打印</button>
|
||||
<div class="container" id="print-content">
|
||||
<p style="font-size:25px;margin-top: 10px">重庆市巴南区狮子山老年公寓收据</p>
|
||||
<p class="tag" style="font-size:20px;">
|
||||
<span class="left">客户姓名 :{{$name}}</span>
|
||||
<span class="middle">日期 :{{$time}}</span>
|
||||
<span class="right">单据编号 :{{$sn}}</span>
|
||||
</p>
|
||||
<table class="print-table">
|
||||
<tr>
|
||||
<th style="width: 5%;">序号</th>
|
||||
<th style="width: 25%;">费用类别</th>
|
||||
<th style="width: 30%;">起止日期</th>
|
||||
<th style="width: 15%;">金额(元)</th>
|
||||
<th style="width: 25%;">备注</th>
|
||||
</tr>
|
||||
@foreach($list as $item)
|
||||
<tr>
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td>@if(empty($item['fee_name']))-@else{{$item['fee_name']}}@endif</td>
|
||||
<td>@if(empty($item['fee_name']))-@else<input type="text" style="border:none" value="{{$timeZone}}">@endif</td>
|
||||
<td>{{$item['fee_value']}}</td>
|
||||
<td>
|
||||
<input type="text" style="border:none">
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<tr>
|
||||
<td colspan="3" style=" text-align: left;">合计大写:{{$bigTotal}}</td>
|
||||
<td >{{$total}}</td>
|
||||
<td ></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="tag" style="font-size:20px;">
|
||||
<span class="left">单位盖章 :</span>
|
||||
<span class="middle"> </span>
|
||||
<span class="right">收款人 :{{$adminName}}</span>
|
||||
</p>
|
||||
<p class="tag" style="font-size:20px;">
|
||||
<span class="left">白联:存根</span>
|
||||
<span class="middle">红联:客户</span>
|
||||
<span class="right">黄联:记账</span>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
|
@ -10,7 +10,7 @@ Route::group([
|
|||
'prefix' => config('admin.route.prefix'),
|
||||
'middleware' => config('admin.route.middleware'),
|
||||
], function (Router $router) {
|
||||
// 水电续费
|
||||
$router->resource('hydropower_fees', \App\Admin\Controllers\HydropowerFeeController::class);
|
||||
// 费用明细
|
||||
$router->resource('const_flows', \App\Admin\Controllers\ConstFlowController::class);
|
||||
|
||||
});
|
||||
|
|
@ -14,7 +14,8 @@ use Illuminate\Support\Facades\Route;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::redirect('/', '/admin', 302);
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::get('/print-const-flow', [PrintController::class, 'showConst']);
|
||||
Route::get('/print-water-fee', [PrintController::class, 'showWaterFee']);
|
||||
Route::get('/print-const-flow', [PrintController::class, 'showConst']);
|
||||
Loading…
Reference in New Issue