public function downloadPDF($id, Request $request)
 {
     $invoice = Invoice::find($id);
     if (is_null($invoice)) {
         return response()->view('errors.404', [], 404);
     }
     $items = json_decode($invoice->list_items);
     $pdf = \PDF::loadView('invoice.pdf', compact(['invoice', 'items']));
     return $pdf->download();
 }
Beispiel #2
0
 public function post(Request $req)
 {
     $ids = $req->invoice;
     foreach ($ids as $id) {
         $invoice = Invoice::find($id);
         $invoice->status = "confirm";
         $invoice->save();
         $orders = $invoice->Cart->Product;
         foreach ($orders as $order) {
             $product = Product::find($order->pro_id);
             $product->quanlity -= $order->quanlity;
             $product->save();
         }
     }
     return redirect('admin/checkpayment');
 }
Beispiel #3
0
 public function invoice($id)
 {
     $Invoice = Invoice::find($id);
     $img_logo = public_path() . '\\assets\\img\\logo_cotizacion.jpg';
     $route_css = public_path() . '\\assets\\css\\style.css';
     /*
     $img_logo = url() .'/assets/img/logo_cotizacion.jpg';
     $route_css = url() .'/assets/css/style.css';
     */
     //$data = $this->getData();
     //$date = date('Y-m-d');
     //$invoice = "2222";
     //$view =  \View::make('report.invoice', compact('data', 'date', 'invoice'))->render();
     $view = \View::make('report.invoice', compact('Invoice', 'img_logo', 'route_css'))->render();
     $pdf = \App::make('dompdf.wrapper');
     $pdf->loadHTML($view);
     return $pdf->stream();
     return $view;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $invoice = new Invoice();
     $invoice->event_id = 1;
     $invoice->school_id = 1;
     $invoice->payment_method = 'card';
     $invoice->advisor_id = 1;
     $invoice->total = 15;
     $invoice->save();
     Invoice::find(1)->makeKey();
     $invoice = new Invoice();
     $invoice->event_id = 1;
     $invoice->school_id = 1;
     $invoice->payment_method = 'card';
     $invoice->advisor_id = 2;
     $invoice->total = 15;
     $invoice->save();
     Invoice::find(2)->makeKey();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $detalle = Invoice::find($id)->details();
     $detalle->delete();
     Invoice::findOrFail($id)->delete();
     //Invoice::findOrFail($id)->delete();
     Flash::error('Factura eliminada.');
     return redirect()->route('facturas.index');
 }
 public function postComment(Request $request)
 {
     $insertcomment = Input::get();
     $this->saveComment($insertcomment['comment'], $insertcomment['date1'], $insertcomment['invoiceid']);
     if (!empty($insertcomment['nextduedate'])) {
         $invoice = Invoice::find($insertcomment['invoiceid']);
         $invoice->NxtDuedate = $insertcomment['nextduedate'];
         //Invoice::where('Id','=',$insertcomment['invoiceid'])->update(array('NxtDuedate'=>$insertcomment['nextduedate']));
         //$invoice->NxtDuedate = $insertcomment['nextduedate'];
         $invoice->save();
     }
     $request->session()->flash('alert-success', 'Comment inserted Successfully');
     return redirect('collection/payment/' . $insertcomment['invoiceid'] . '');
     //dd($insertPayment);
 }
Beispiel #7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $invoice = Invoice::find($id);
     $items = Item::where("invoice_id", "=", $invoice->id)->get();
     foreach ($items as $item) {
         $item->delete();
     }
     $invoice->delete();
     return Redirect::route("invoices.index");
 }
Beispiel #8
0
 public function create_item($id)
 {
     $invoice = Invoice::find($id);
     return view("create_item", compact("invoice"));
     //return view("create_item");
 }
 public function edit($InvoiceID, $ReturnTo = '')
 {
     $objInvoice = \App\Invoice::find($InvoiceID);
     if (!$this->objLoggedInUser->HasPermission("View/{$objInvoice->type}")) {
         abort('404');
     }
     $tInvoiceItems = $objInvoice->InvoiceItems->filter(function ($objItem) {
         return $objItem->status == \App\InvoiceItem::STATUS_ACTIVE || $objItem->status == \App\InvoiceITem::STATUS_MODIFIED;
     });
     $tNonClientUsers = \App\User::nonclient()->permusers($this->objLoggedInUser)->nonclient()->get();
     View::share('objInvoice', $objInvoice);
     View::share('tInvoiceItems', $tInvoiceItems);
     View::share('tNonClientUsers', $tNonClientUsers);
     View::share('ReturnTo', $ReturnTo);
     return view('admin.invoices.edit');
 }