| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Services;
- use App\Traits\ServiceAppAop;
- use App\OwnerSundryFeeDetail;
- use Illuminate\Contracts\Pagination\LengthAwarePaginator;
- use Illuminate\Database\Eloquent\Builder;
- class OwnerSundryFeeDetailService implements \App\Interfaces\SettlementBillReportInterface
- {
- use ServiceAppAop;
- use \App\Traits\SettlementBillServiceTrait;
- protected $modelClass = OwnerSundryFeeDetail::class;
- /** @var OwnerBillReportArchiveService $archiveService */
- private $archiveService;
- const TYPE = '杂项费';
- public function get(array $kvPairs): LengthAwarePaginator
- {
- return $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
- }
- public function getSql($owner_id, $counting_month): Builder
- {
- list($start, $end) = $this->getStartAndEnd($counting_month);
- return OwnerSundryFeeDetail::query()
- ->with(['owner', 'logistic'])
- ->where('owner_id', $owner_id)
- ->whereBetween('created_at', [$start, $end]);
- }
- public function switchType($type)
- {
- // TODO: Implement switchType() method.
- }
- public function buildExport($details): array
- {
- // TODO: Implement buildExport() method.
- }
- public function add(array $model)
- {
- // TODO: Implement add() method.
- }
- public function getTotalFee($owner_id, $counting_month)
- {
- list($start, $end) = $this->getStartAndEnd($counting_month);
- return OwnerSundryFeeDetail::query()
- ->selectRaw("type,sum(fee) as fee")
- ->where('owner_id', $owner_id)
- ->whereBetween('created_at', [$start, $end])
- ->groupBy('type')
- ->get();
- }
- public function recordReport($counting_month = null,array $ownerIds = [])
- {
- // TODO: Implement recordReport() method.
- }
- }
|