Пример #1
0
 /**
  * Tests the update function in the PaymentController
  * @param  void
  * @return void
  */
 public function testUpdate()
 {
     $this->withoutMiddleware();
     $this->call('POST', '/payment', $this->paymentData);
     // Update the Payment
     $paymentStored = Payment::orderBy('id', 'desc')->first();
     $this->withoutMiddleware();
     $this->call('PUT', '/payment/1', $this->paymentUpdate);
     $paymentUpdated = Payment::find('1');
     $this->assertEquals($paymentUpdated->patient_id, $this->paymentUpdate['patient_id']);
     $this->assertEquals($paymentUpdated->charge_id, $this->paymentUpdate['charge_id']);
     $this->assertEquals($paymentUpdated->full_amount, $this->paymentUpdate['full_amount']);
     $this->assertEquals($paymentUpdated->amount_paid, $this->paymentUpdate['amount_paid']);
 }
Пример #2
0
 /**
  * report generation functions DTR
  */
 public function getPaymentsCount()
 {
     $year = date("Y");
     $current_month = (int) date("m");
     $months = [];
     $j = $current_month;
     for ($i = 0; $i < $j; $i++) {
         $month = $current_month;
         $monthly = Payment::find()->where('MONTH(date) =  :month AND YEAR(date) = :year', [':month' => $month, ':year' => $year])->count();
         array_push($months, $monthly);
         $current_month--;
     }
     $before = array_map('intval', array_reverse($months));
     return json_encode($before);
 }
Пример #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Payment::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'amount' => $this->amount, 'status' => $this->status, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'customer_id', $this->customer_id])->andFilterWhere(['like', 'subcription_id', $this->subcription_id])->andFilterWhere(['like', 'ip_address', $this->ip_address])->andFilterWhere(['>=', 'date', $this->start_date])->andFilterWhere(['<=', 'date', $this->end_date]);
     return $dataProvider;
 }
Пример #4
0
 /**
  * Display user dashboard
  */
 public function actionDashboard()
 {
     //$model = Yii::$app->user->identity;
     $journals = new ActiveDataProvider(['query' => Journal::find()->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
     $events = new ActiveDataProvider(['query' => \app\models\Event::find()->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
     $photos = \app\models\Photos::find()->orderBy(['id' => SORT_DESC])->limit(5)->all();
     $wishlists = new ActiveDataProvider(['query' => \app\models\Wishlist::find()->where(['status' => 0])->orderBy('id')->limit(5), 'pagination' => false]);
     $DataProvider = new ActiveDataProvider(['query' => User::find()->where('level !=0 AND parent_id=0')->orderBy('id')]);
     $RegisteredMembers = count(User::find()->where('level > :level', [':level' => 3])->orWhere('level > :level', [':level' => 2])->orWhere('level > :level', [':level' => 1])->all());
     $famillies = User::find()->where(['level' => '1'])->count();
     $orders = count(\app\models\Payment::find()->all());
     $payments = Payment::getPaymentsCount();
     $months = Payment::getMonths();
     $epercent = Payment::earningPercentage();
     $earning = Payment::getMonthlyEarning();
     $revenue = Payment::totalRevenue();
     $rpercent = payment::revenuePercentage();
     $mearning = Payment::getPaymentsMonth();
     return $this->render('dashboard', ['dataProvider' => $DataProvider, 'events' => $events, 'journals' => $journals, 'photos' => $photos, 'wishlists' => $wishlists, 'RegisteredMembers' => $RegisteredMembers, 'orders' => $orders, 'payments' => $payments, 'months' => $months, 'epercent' => $epercent, 'earning' => $earning, 'revenue' => $revenue, 'rpercent' => $rpercent, 'mearning' => $mearning, 'famillies' => $famillies]);
 }
Пример #5
0
 /**
  * Remove the specified payment from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $payment = Payment::find($id);
     $url = session('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('terms.record-successfully-deleted'));
 }
Пример #6
0
 public function getPaymentList()
 {
     return Payment::find()->asArray()->all();
 }