feat: 修改财务转账相关代码以优化查询效率和用户体验
This commit is contained in:
parent
20e3347b56
commit
3db2bda607
@ -10,7 +10,7 @@ use app\admin\validate\financial_transfers\FinancialTransfersValidate;
|
||||
|
||||
|
||||
/**
|
||||
* FinancialTransfers控制器
|
||||
* 财务转账控制器
|
||||
* Class FinancialTransfersController
|
||||
* @package app\admin\controller\financial_transfers
|
||||
*/
|
||||
@ -64,13 +64,6 @@ class FinancialTransfersController extends BaseAdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
|
@ -6,10 +6,10 @@ namespace app\admin\lists\financial_transfers;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\financial_transfers\FinancialTransfers;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
|
||||
|
||||
/**
|
||||
* FinancialTransfers列表
|
||||
* 财务转账列表
|
||||
* Class FinancialTransfersLists
|
||||
* @package app\admin\listsfinancial_transfers
|
||||
*/
|
||||
@ -50,6 +50,9 @@ class FinancialTransfersLists extends BaseAdminDataLists implements ListsSearchI
|
||||
->toArray();
|
||||
foreach ($data as &$value){
|
||||
if($value['initiation_time']){
|
||||
$time=strtotime('-1 month',$value['initiation_time']);
|
||||
$date=date('Y-m-d',$time);//获取一个月前的日期
|
||||
$value['receivable']=StoreCashFinanceFlow::whereMonth('create_time',$date)->where('status',0)->sum('receivable');
|
||||
$value['initiation_time'] = date('Y-m-d H:i:s',$value['initiation_time']);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class StoreCashFinanceFlowLists extends BaseAdminDataLists implements ListsSearc
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id'],
|
||||
'=' => ['store_id','status'],
|
||||
"between_time" => 'create_time'
|
||||
];
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace app\admin\logic\financial_transfers;
|
||||
|
||||
use app\common\model\financial_transfers\FinancialTransfers;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -127,13 +128,18 @@ class FinancialTransfersLogic extends BaseLogic
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function dealchange($params, $id)
|
||||
{
|
||||
$find = FinancialTransfers::where('id', $id)->find();
|
||||
$time = strtotime('-1 month', $find['initiation_time']);
|
||||
$date = date('Y-m-d', $time); //获取一个月前的日期
|
||||
$receivable = StoreCashFinanceFlow::whereMonth('create_time', $date)->where('status', 0)->sum('receivable');
|
||||
if($receivable==0){
|
||||
self::setError('暂无法确认,还有未收取的现金');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
FinancialTransfers::where('id', $id)
|
||||
@ -148,9 +154,5 @@ class FinancialTransfersLogic extends BaseLogic
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -20,6 +20,7 @@ class CashFlowLogic extends BaseLogic
|
||||
$model->store_id = $storeId;
|
||||
$model->cash_price = $amount;
|
||||
$model->receivable = $amount;
|
||||
$model->remark = '银行转账请备注:'.mt_rand(1000, 9999);
|
||||
$model->status = YesNoEnum::NO; //收银台收了默认算完成了
|
||||
$model->save();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user