public function create() { //帐户余额 $amount = UserFinance::findOrNew($this->agent->getKey())->money; //查找当前用户冻结金额 取出7天奖金 $freeze_money = Bill::whereRaw("uid = ? and is_dealt = ? and created_at>='?' and event in( 'commission' , 'income')", array($this->agent->getKey(), 1, date("Y-m-d 00:00:00", strtotime('-7 days'))))->sum('value') ?: 0; //可取资金 $usable_money = intval(($amount - $freeze_money) / ($this->site['withdraw_counter_percent'] + 1)); $this->_user_money = compact('amount', 'freeze_money', 'usable_money'); //查找银行卡信息 $this->_bank_cards = (new UserBankcard())->with('bank_name')->newQuery()->where('uid', $this->agent->getKey())->get(); $keys = 'money,card_id'; $this->_data = []; $this->_validates = $this->getScriptValidate('withdraw.store', $keys); return $this->view('agent-backend.withdraw.create'); }
public function edit($id) { $withdraw = Withdraw::find($id); //帐户余额 $amount = UserFinance::findOrNew($withdraw->uid)->money; //查找当前用户冻结金额 $freeze_money = Bill::whereRaw("uid = ? and is_dealt = ? and created_at>='?' and event in( 'commission' , 'income')", array($withdraw->uid, 1, date("Y-m-d 00:00:00", strtotime('-7 days'))))->sum('value') ?: 0; //可取资金 $usable_money = intval(($amount - $freeze_money) / ($this->site['withdraw_counter_percent'] + 1)); $this->_user_money = compact('amount', 'freeze_money', 'usable_money'); $withdraw = Withdraw::with(['bankcards'])->find($id); if (empty($withdraw)) { return $this->failure_noexists(); } $keys = 'audit,note'; $this->_validates = $this->getScriptValidate('withdraw.audit', $keys); $this->_data = $withdraw; return $this->view('admin.withdraw.edit'); }
public function statusindex() { if (\Request::ajax()) { $month = \Input::get('month'); $year = \Input::get('year'); $status = \Input::get('status'); if ($status == 0) { $bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('status', 0)->where('user_id', \Auth::user()->id)->get(); foreach ($bills as $bill) { if ($bill->child->photo) { $photo = asset('uploads/' . $bill->child->photo); } else { $photo = asset('images/' . 'avatar4.jpg'); } echo ' <tr> <!--<td><div class="minimal single-row"> <div class="checkbox_liste "> <input value="' . $bill->id . '" type="checkbox" name="select[]"> </div> </div></td>--> <td> ' . $bill->id . '</td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $bill->child->nom_enfant . '</td> <td> ' . $bill->start->format('d-m-Y') . ' </td> <td> ' . $bill->somme . ' Dhs</td> <td><span class="label label-danger label-mini"> Non réglée </span> </td> <!-- <td> <a href="' . '#' . '" class="actions_icons delete-bill"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-bill" href="' . '#' . '"><i class="fa fa-archive liste_icons"></i> </a> </td>--> <td><a href="' . action('BillsController@details', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } else { $bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('status', 1)->where('user_id', \Auth::user()->id)->get(); foreach ($bills as $bill) { if ($bill->child->photo) { $photo = asset('uploads/' . $bill->child->photo); } else { $photo = asset('images/no_avatar.jpg'); } echo ' <tr> <!-- <td><div class="minimal single-row"> <div class="checkbox_liste "> <input value="' . $bill->id . '" type="checkbox" name="select[]"> </div> </div></td>--> <td> ' . $bill->id . '</td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $bill->child->nom_enfant . '</td> <td> ' . $bill->start->format('d-m-Y') . ' </td> <td> ' . $bill->somme . ' Dhs</td> <td><span class="label label-success label-mini"> réglée </span> </td> <!-- <td> <a href="' . '#' . '" class="actions_icons delete-bill"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-bill" href="' . '#' . '"><i class="fa fa-archive liste_icons"></i> </a> </td>--> <td><a href="' . action('BillsController@details', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } } }
public function monthindex() { if (\Request::ajax()) { $mois = \Input::get('month'); $bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$mois])->where('user_id', \Auth::user()->id)->get(); foreach ($bills as $bill) { if ($bill->status == 0) { $class = "label-danger"; $message = "Non réglée"; } else { $class = "label-success"; $message = "réglée"; } $photo = asset('uploads/' . $bill->child->photo); echo ' <tr> <td> ' . $bill->id . '</td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $bill->child->nom_enfant . '</td> <td> ' . $bill->start->format('d-m-Y') . ' </td> <td> ' . $bill->somme . ' Dhs</td> <td><span class="label ' . $class . ' label-mini"> ' . $message . ' </span> </td> <td> <a href="' . action('BillsController@delete', [$bill->id]) . '" class="actions_icons delete-bill"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-bill" href="' . action('BillsController@archive', [$bill->id]) . '"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('BillsController@details', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } }
public function filterByMonthef() { if (\Request::ajax()) { $month = \Input::get('month'); $bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->where('f_id', \Auth::user()->id)->get(); foreach ($bills as $bill) { if ($bill->status == 0) { $class = "label-danger"; $message = "Non réglée"; } else { $class = "label-success"; $message = "réglée"; } if ($bill->child->photo) { $photo = asset('uploads/' . $bill->child->photo); } else { $photo = asset('images/no_avatar.jpg'); } echo ' <tr> <td><div class="minimal single-row"> </div></td> <td>' . $bill->id . '</td> <td>' . $bill->start->format('d-m-Y') . '</td> <td>' . $bill->somme . ' Dhs</td> <td><span class="label ' . $class . ' label-mini"> ' . $message . ' </span> </td> <td> ' . $bill->child->nom_enfant . '</td> <td><a href="' . action('BillsController@detailsef', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } }