public function getIndex() { $categories = Event::all(); $employee = Employee::all(); $invoice = Invoice::all(); $invnull = Invoice::where('Status', '=', 'Null')->get(); return View('home2')->with(array('categories' => $categories, 'employee' => $employee, 'invoice' => $invoice, 'invnull' => $invnull)); }
static function getTotalSale() { $total = 0; $invoices = Invoice::all()->where("status", "confirm"); foreach ($invoices as $invoice) { $total += $invoice->total; } return $total; }
public function getHome() { $varr = Auth::user()->empid; $evarr = User::where('empid', $varr)->get(); $edetails = Employee::where('emp_ide_id', $varr)->get(); $categories = Event::all(); $employee = Employee::all(); $invoice = Invoice::all(); $invnull = Invoice::where('Status', '=', 'Null')->get(); return View('reviewer/home')->with(array('categories' => $categories, 'employee' => $employee, 'invoice' => $invoice, 'invnull' => $invnull, 'edetails' => $edetails)); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getIndex($dealid) { $id = $dealid; $invoicedata = Deal::where('Id', $id)->get(); // dd($invoicedata); foreach ($invoicedata as $dat) { # code... $evname = $dat['Eventname']; } $categories = Event::where('event', $evname)->get(); foreach ($categories as $category) { $EventDate = $category['date']; } $employee = Employee::all(); $invoice = Invoice::all(); return View('createinvoice')->with(array('categories' => $categories, 'employee' => $employee, 'invoice' => $invoice, 'invoicedata' => $invoicedata, 'EventDate' => $EventDate)); }
public function postInvoice(Request $request) { $dealid = Input::get('dealid'); $variable = Input::get('purpose'); $evname = Input::get('event_name'); $result = explode('|', $evname, 2); $evcode = trim($result[0]); $eventname = trim($result[1]); $inv = 'IDE'; $nameofinvoice = 'PROFORMA INVOICE'; $dateValue = date('d-m-Y'); $time = strtotime($dateValue); $year = date("Y", $time); $count = Invoice::all()->count(); $counti = str_pad($count, 3, '0', STR_PAD_LEFT); $invoicecode = $inv . '-' . '' . $evcode . '-' . '' . $year . $counti; $varr = 'NULL'; $st = 'Invoice Created'; $dealstatus = '0'; $repnamecode = Input::get('rep_id'); $result = explode('|', $repnamecode, 2); $empid = trim($result[0]); $empname = trim($result[1]); // dd($empname); $ydate = date('Y-m-d', strtotime("-1 days")); // dd($ydate); if (Input::get('currency_type') != 'INR') { $exchnagerate = $this->getExchangex(Input::get('amount'), Input::get('currency_type'), $ydate); } else { $exchnagerate = Input::get('amount'); } if ($variable == 'annual') { $c = new Invoice(); $c->Particulars = Input::get('purpose'); $c->CientAddress = Input::get('client_address'); $c->ClientName = Input::get('client_name'); $c->Companyname = Input::get('companyname'); $c->ClientEmail = Input::get('client_email'); $c->RepresentativeNo = $empid; $c->Repname = $empname; $c->InvoiceDate = Input::get('invoice_date'); $c->DueDate = Input::get('due_date'); $c->AnnualSerialNo = Input::get('s_no_anuual1'); $c->AnnualText = Input::get('anuual_text'); $c->AnnualCurrencyType = Input::get('annual_currency1'); $c->AnnualAmount = Input::get('annual_amount1'); $c->SerialNo = Input::get('s_no'); $c->Eventcode = Input::get('eventcode'); $c->EventName = $eventname; $c->CurrencyType = Input::get('currency_type'); $c->Amount = Input::get('amount'); $c->Rcvalue = $exchnagerate; $c->GrandTotal = Input::get('grand_total'); $c->Subtotal = Input::get('sub_total'); $c->AmountInWords = Input::get('amount_in_words'); $c->PaymentTerms = Input::get('payment_interms'); $c->ServiceTax = Input::get('service_tax'); $c->ServiceTaxAmount = Input::get('service_tax_amount'); $c->swachtax = Input::get('swachtax'); $c->swachtaxamount = Input::get('swachtaxamount'); $c->subtotalb = Input::get('subtotalb'); $c->Status = $varr; $c->InvoiceCode = $invoicecode; $c->Nameofinvoice = $nameofinvoice; $c->dealid = $dealid; $c->save(); // you had skipped the parenthesis in your code. $insertedId = $c->Id; $invoicedata = Invoice::where('Id', $insertedId)->get(); foreach ($invoicedata as $in) { $inv = $in->InvoiceCode; } $html22 = View('pdfgenerate')->with(array('invoicedata' => $invoicedata))->render(); $html1 = "<h1>adsfadsfasdf</h1>"; require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $htmltosend = $html2pdf->Output('', 'S'); $i = 'Invoice_'; $b = $inv; $h = '_Generated'; $subject = $i . $b . $h; Mail::send('emails.test', ['Invoice' => 'hgff'], function ($message) use($subject, $htmltosend) { // note: if you don't set this, it will use the defaults from config/mail.php $message->from('*****@*****.**', 'Jeevan'); $message->to('*****@*****.**', 'Harshitha')->subject($subject)->attachData($htmltosend, 'invoice.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment')); }); $request->session()->flash('alert-success', 'Invoice was successful added!'); return redirect('executor/dealsclosed'); } if ($variable == 'single') { $c = new Invoice(); $c->Particulars = Input::get('purpose'); $c->CientAddress = Input::get('client_address'); $c->ClientName = Input::get('client_name'); $c->Companyname = Input::get('companyname'); $c->ClientEmail = Input::get('client_email'); $c->RepresentativeNo = $empid; $c->Repname = $empname; $c->InvoiceDate = Input::get('invoice_date'); $c->DueDate = Input::get('due_date'); $c->SerialNo = Input::get('s_no'); $c->Eventcode = Input::get('eventcode'); $c->EventName = $eventname; $c->CurrencyType = Input::get('currency_type'); $c->Amount = Input::get('amount'); $c->Rcvalue = $exchnagerate; $c->ServiceTax = Input::get('service_tax'); $c->ServiceTaxAmount = Input::get('service_tax_amount'); $c->GrandTotal = Input::get('grand_total'); $c->Subtotal = Input::get('sub_total'); $c->AmountInWords = Input::get('amount_in_words'); $c->PaymentTerms = Input::get('payment_interms'); $c->swachtax = Input::get('swachtax'); $c->swachtaxamount = Input::get('swachtaxamount'); $c->subtotalb = Input::get('subtotalb'); $c->InvoiceCode = $invoicecode; $c->Nameofinvoice = $nameofinvoice; $c->dealid = $dealid; $c->Status = $varr; $c->save(); // you had skipped the parenthesis in your code. $insertedId = $c->Id; // dd($insertedId); $invoicedata = Invoice::where('Id', $insertedId)->get(); // dd($invoicedata->InvoiceCode); foreach ($invoicedata as $in) { $inv = $in->InvoiceCode; } // $inv=$invoicedata->InvoiceCode; // dd($inv); $i = Deal::where('Id', $dealid)->update(array('Status' => $dealstatus)); $html22 = View('pdfgenerate')->with(array('invoicedata' => $invoicedata))->render(); $html1 = "<h1>adsfadsfasdf</h1>"; require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $htmltosend = $html2pdf->Output('', 'S'); $i = 'Invoice_'; $b = $inv; $h = '_Generated'; $subject = $i . $b . $h; Mail::send('emails.test', ['Invoice' => 'hgff'], function ($message) use($subject, $htmltosend) { // note: if you don't set this, it will use the defaults from config/mail.php $message->from('*****@*****.**', 'Jeevan'); $message->to('*****@*****.**', 'Harshitha')->subject($subject)->attachData($htmltosend, 'invoice.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment')); }); $request->session()->flash('alert-success', 'Invoice was successful added!'); //return redirect()->route('/home'); return redirect('executor/dealsclosed'); } }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { $categories = Deal::where('Status', '=', 1)->get(); $in = Invoice::all(); return View('dealsclosed')->with(array('categories' => $categories, 'in' => $in)); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $invoices = Invoice::all(); $items = Item::all(); return view("index", compact("invoices")); }
/** * Display the specified resource. * * @param int $invoiceNumber * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function show($invoiceNumber) { $title = 'Invoice'; $invoiceCollection = DB::table('invoices')->where('invoiceNumber', $invoiceNumber)->join('vehicles', 'invoices.vehicle', '=', 'vehicles.registration')->select('invoices.*', 'vehicles.brand', 'vehicles.model', 'vehicles.seat', 'vehicles.remarks')->get(); $clients = DB::table('invoices')->where('invoiceNumber', '=', $invoiceNumber)->join('clients', 'invoices.client', '=', 'clients.name')->select('invoices.*', 'clients.address', 'clients.city', 'clients.country')->first(); $sum = Invoice::all()->where('invoiceNumber', $invoiceNumber); $repository = $this->repository; return view('invoice.show', compact('title', 'clients', 'invoiceCollection', 'sum', 'repository')); }