账期欠款添加统计
This commit is contained in:
parent
36016871da
commit
a70d3f7dbf
@ -49,4 +49,10 @@ class AccountsReceivableController extends BaseAdminController
|
|||||||
return $this->dataLists(new AccountsReceivableInfoLists());
|
return $this->dataLists(new AccountsReceivableInfoLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function statistics()
|
||||||
|
{
|
||||||
|
$result = AccountsReceivableLogic::statistics();
|
||||||
|
return $this->data($result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ namespace app\admin\logic;
|
|||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\finance\AccountsReceivable;
|
use app\common\model\finance\AccountsReceivable;
|
||||||
use app\common\model\finance\AccountsReceivableInfo;
|
use app\common\model\finance\AccountsReceivableInfo;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
@ -72,4 +73,18 @@ class AccountsReceivableLogic extends BaseLogic
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function statistics()
|
||||||
|
{
|
||||||
|
$query = AccountsReceivable::field('store_id,sum(total_debt) as total_debt,sum(pay_debt) as pay_debt,sum(surplus_debt) as surplus_debt')->group('store_id');
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->select()->toArray();
|
||||||
|
foreach ($list as &$item) {
|
||||||
|
$item['store_name'] = SystemStore::where('id', $item['store_id'])->value('name');
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'list' => $list,
|
||||||
|
'count' => $count
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user