/**
  * Run the database seed for account "Compte joint".
  *
  * @return void
  */
 public function runAccount1()
 {
     Revenue::create(['account_id' => 1, 'name' => 'Salaire Simon', 'amount' => 1551.24, 'date' => Carbon::create(2015, 8, 3, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Indemnité Delphine', 'amount' => 1146.38, 'date' => Carbon::create(2015, 8, 4, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Prestations CAF', 'amount' => 446.1, 'date' => Carbon::create(2015, 8, 5, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Remboursement Bébé au naturel', 'amount' => 13.94, 'date' => Carbon::create(2015, 8, 6, 0)]);
 }
Пример #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $revenue = Revenue::find($id);
     Revenue::destroy($id);
     Session::flash('message', 'Revenue successfully deleted!');
     return redirect(route('project.show', $revenue->project_id));
 }
 public function index(Request $re)
 {
     $reports = Report::ReportHome();
     $mains = Report::ReportMain();
     $revenues = Revenue::revenue();
     $reve = Report::revenue_ecpm();
     return view('admin.home', compact('reports', 'mains', 'revenues', 'reve'));
 }
 /**
  * Run the database seed for account "Compte joint".
  *
  * @return void
  */
 public function runAccount1()
 {
     Revenue::create(['account_id' => 1, 'name' => 'Salaire Simon', 'amount' => 1551.24, 'date' => Carbon::create(2015, 7, 2, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Indemnité Delphine', 'amount' => 1108.2, 'date' => Carbon::create(2015, 7, 1, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Prestations CAF', 'amount' => 446.1, 'date' => Carbon::create(2015, 7, 6, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Facturation Concordia', 'amount' => 225, 'date' => Carbon::create(2015, 7, 13, 0)]);
     Revenue::create(['account_id' => 1, 'name' => 'Prime pour l\'emploi', 'amount' => 404, 'date' => Carbon::create(2015, 7, 24, 0)]);
 }
Пример #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 100;
     for ($i = 0; $i < $limit; $i++) {
         Revenue::create(['contract_id' => rand(1, 15), 'amount_paid' => rand(100, 300), 'currency' => 'GBP']);
     }
 }
Пример #6
0
 public function api_delete($id)
 {
     Revenue::destroy($id);
     return response("Deleted");
 }
Пример #7
0
 public function newRevenue(AdminRevenueRequest $request)
 {
     $total_revenue = $request->input('revenue_total_diario');
     $revenue = new Revenue();
     $revenue->revenue_total_diario = $total_revenue;
     $revenue->fecha = Carbon::parse($request->input('fecha'))->addMinutes(1);
     $reports = DB::table('reports')->where('reports.fecha', '=', Carbon::parse($request->input('fecha'))->addMinutes(1))->get();
     $impresiones = 0;
     foreach ($reports as $report) {
         $impresiones += $report->impresiones;
     }
     $revenue->ecpm_total = $total_revenue * 1000 / $impresiones;
     $revenue->save();
     foreach ($reports as $report) {
         $reporte_a_guardar = Report::find($report->id);
         $reporte_a_guardar->revenue = $revenue->ecpm_total * $reporte_a_guardar->impresiones / 1000;
         $reporte_a_guardar->save();
         if ($reporte_a_guardar->impresiones == 0) {
             $reporte_a_guardar->ecpm = 0;
             $reporte_a_guardar->save();
         } else {
             $reporte_a_guardar->ecpm = $reporte_a_guardar->revenue * 1000 / $reporte_a_guardar->impresiones;
             $reporte_a_guardar->save();
         }
     }
     notify()->flash('Revenue created correclty', 'success', ['timer' => 3000, 'text' => '']);
     return redirect()->to('admin/home');
 }
Пример #8
0
 /**
  * Save request inputs into account's revenue
  * @param  \Illuminate\Http\Request $request
  * @param  \App\Account $account Account
  * @param  \App\Operation|null $operation Operation
  * @return void
  */
 public function saveRevenue(Request $request, Account $account, $operation)
 {
     if (is_null($operation)) {
         $operation = new Revenue();
     }
     $operation->fill(['account_id' => $account->id, 'envelope_id' => $request->get('envelope_id') ?: null, 'name' => $request->get('name'), 'amount' => $request->get('amount'), 'date' => Carbon::createFromFormat('d/m/Y', $request->get('date'))->startOfDay()])->save();
 }
Пример #9
0
 /**
  * Run the database seed for account "Vacances en Écosse".
  *
  * @return void
  */
 public function runAccount2()
 {
     Revenue::create(['account_id' => 2, 'name' => 'Enveloppe vacances', 'amount' => 600, 'date' => Carbon::create(2015, 10, 1, 0)]);
     Revenue::create(['account_id' => 2, 'name' => 'Enveloppe nourriture', 'amount' => 200, 'date' => Carbon::create(2015, 10, 1, 0)]);
 }
Пример #10
0
 /**
  * Save request inputs into envelope's revenue
  * @param  \Illuminate\Http\Request $request
  * @param  \App\Envelope $envelope Envelope
  * @param  \App\Operation|null $operation Operation
  * @return void
  */
 private function saveRevenue(Request $request, Envelope $envelope, $operation = null)
 {
     if (is_null($operation)) {
         $operation = new Revenue();
     }
     $operation->fill(['envelope_id' => $request->get('envelope_id'), 'account_id' => $envelope->account->id, 'name' => $request->get('name'), 'amount' => $request->get('amount'), 'date' => Carbon::createFromFormat('d/m/Y', $request->get('date'))->startOfDay()])->save();
 }