本文整理匯總了PHP中app\Order::ReportByDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Order::ReportByDate方法的具體用法?PHP Order::ReportByDate怎麽用?PHP Order::ReportByDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Order
的用法示例。
在下文中一共展示了Order::ReportByDate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _pertanggal
protected function _pertanggal(Request $request)
{
$tanggal = $request->get('tanggal') ? $request->get('tanggal') : date('Y-m-d');
$reports = Order::ReportByDate($tanggal);
$reports = ConvertRawQueryToArray($reports);
return ['tanggal' => Carbon::parse($tanggal), 'reports' => $reports];
}
示例2: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//Log::info("In Handle ".$this->tanggal);
$tanggal = $this->tanggal;
$reports = Order::ReportByDate($tanggal);
$reports = collect($reports)->groupBy('_type_bayar');
$totalCash = isset($reports['tunai']) ? collect($reports['tunai'])->sum('jumlah') : 0;
$mergeDebitCcard = [];
$mergeDebitCcard = isset($reports['debit']) ? array_merge($mergeDebitCcard, $reports['debit']->toArray()) : array_merge($mergeDebitCcard, []);
$mergeDebitCcard = isset($reports['credit_card']) ? array_merge($mergeDebitCcard, $reports['credit_card']->toArray()) : array_merge($mergeDebitCcard, []);
$bayarBank = collect($mergeDebitCcard)->groupBy('_bank_id');
$accountSaldo = AccountSaldo::join('accounts', 'account_saldos.account_id', '=', 'accounts.id')->leftJoin('banks', 'account_saldos.relation_id', '=', 'banks.id')->where('tanggal', $tanggal)->where('account_id', 2)->select(['account_saldos.*', DB::raw('IFNULL(account_saldos.relation_id, "cash")_relation_id')])->get()->groupBy("_relation_id");
$totals = [];
if ($totalCash > 0) {
$totals['cash'] = $totalCash;
}
foreach ($bayarBank as $key => $val) {
$totals[$key] = $val->sum('jumlah') - $val->sum('pajak_pembayaran');
}
$actions = [];
$totalKeys = array_keys($totals);
foreach ($totalKeys as $bank_id) {
$nominal = $totals[$bank_id];
if (!isset($accountSaldo[$bank_id])) {
// create new
$inputs = ['tanggal' => $tanggal, 'account_id' => 2, 'nominal' => $nominal];
if ($bank_id != 'cash') {
$inputs += ['type' => 'kredit', 'relation_id' => $bank_id];
} else {
$inputs += ['type' => 'debet'];
}
AccountSaldo::create($inputs);
//$actions[$bank_id] = $inputs;
} else {
// update value
$row = $accountSaldo[$bank_id][0];
$row = AccountSaldo::find($row['id']);
$row->update(['nominal' => $nominal]);
//$actions[$bank_id] = $row;
}
}
//return $actions;
//Log::info('Queue End @'.Carbon::now('Asia/Jakarta'));
}