/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getIndex($order_id) { $id = $order_id; $invoicedata = Invoice::where('Id', $id)->get(); $html22 = View('viewinvoice')->with(array('invoicedata' => $invoicedata))->render(); 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); $html2pdf->Output('Invoice.pdf'); }
public function getInvoice($id) { // Get invoice if authorized $invoice = Invoice::where('invoice_number', '=', $id)->first(); $invoiceData = unserialize($invoice->invoice_data); return view('settings.invoice', ['invoiceData' => $invoiceData, 'date' => $invoice->created_at]); }
public function postRejectinvoice(Request $request) { $approve_id = Input::get('invoice_reject_id'); $post = Input::get(); $i = Invoice::where('Id', $approve_id)->update(array('RejectedwithComments' => $post['reject_comment'], 'Status' => $post['reject_status'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('home2'); } }
public function index() { if (\Auth::check()) { $userId = \Auth::user()->id; $invoices = Invoice::where('user_id', $userId)->get(); return view('invoice.index', compact('invoices')); } else { abort(404); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $mNumero = Invoice::where('numero', 'REGEXP', '^[0-9]+$')->max('numero'); $mNumero += 1; $mNumero = str_pad($mNumero, 4, '0', STR_PAD_LEFT); $Clients = CLient::orderBy('nombre', 'ASC')->lists('nombre', 'id'); return view('invoice.create_modal')->with('Clients', $Clients)->with('mNumero', $mNumero); /* return view('invoice.create') ->with('Clients', $Clients); */ }
/** * Processes the invoice and charges the advisor's card. */ public function processPayment(Request $request, $event_slug, $key) { try { // get invoice $invoice = Invoice::where('key', $key)->first(); // load stripe $stripe = new StripeBilling(); // charge account $response = $stripe->charge(['email' => $request->input('stripeEmail'), 'token' => $request->input('stripeToken'), 'amount' => $invoice->total, 'receipt_email' => $request->input('stripeEmail')]); // update invoice $invoice->update(['stripeToken' => $request->input('stripeToken'), 'stripeEmail' => $request->input('stripeEmail'), 'received_at' => \Carbon\Carbon::now()->toDateTimeString()]); } catch (\Exception $e) { throw new Exception("Error Processing Payment"); } return redirect('/event/' . $event_slug . '/invoice/' . $key . '/payment/received'); }
public function postEditinvoice(Request $request) { $updateinvoice = Input::get('updateinvoice'); $purpose = Input::get('purpose'); if ($purpose == 'annual') { $post = Input::get(); $i = Invoice::where('Id', $updateinvoice)->update(array('Particulars' => $post['purpose'], 'CientAddress' => $post['client_address'], 'ClientName' => $post['client_name'], 'ClientEmail' => $post['client_email'], 'RepresentativeNo' => $post['rep_id'], 'InvoiceDate' => $post['invoice_date'], 'DueDate' => $post['due_date'], 'AnnualSerialNo' => $post['s_no_anuual1'], 'AnnualText' => $post['anuual_text'], 'AnnualCurrencyType' => $post['annual_currency1'], 'AnnualAmount' => $post['annual_amount1'], 'SerialNo' => $post['s_no'], 'EventName' => $post['event_name'], 'CurrencyType' => $post['currency_type'], 'Amount' => $post['amount'], 'GrandTotal' => $post['grand_total'], 'AmountInWords' => $post['amount_in_words'], 'PaymentTerms' => $post['payment_interms'], 'ServiceTax' => $post['service_tax'], 'Invoice_status' => 'Attended with Modification', 'ServiceTaxAmount' => $post['service_tax_amount'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('home1'); } } if ($purpose == 'single') { $post = Input::get(); $i = Invoice::where('Id', $updateinvoice)->update(array('Particulars' => $post['purpose'], 'CientAddress' => $post['client_address'], 'ClientName' => $post['client_name'], 'ClientEmail' => $post['client_email'], 'RepresentativeNo' => $post['rep_id'], 'InvoiceDate' => $post['invoice_date'], 'DueDate' => $post['due_date'], 'SerialNo' => $post['s_no'], 'EventName' => $post['event_name'], 'CurrencyType' => $post['currency_type'], 'Amount' => $post['amount'], 'ServiceTax' => $post['service_tax'], 'ServiceTaxAmount' => $post['service_tax_amount'], 'GrandTotal' => $post['grand_total'], 'AmountInWords' => $post['amount_in_words'], 'Invoice_status' => 'Attended with Modification', 'PaymentTerms' => $post['payment_interms'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('home1'); } } }
/** * Display list of Invoice from storage * @return \Illuminate\View\View */ public function index() { $title = 'INVOICE'; if (Input::has('invoiceNumber')) { $invoiceNumber = Input::get('invoiceNumber'); $invoices = Invoice::where('invoiceNumber', 'like', '%' . $invoiceNumber . '%')->orderBy('date', 'desc')->paginate(10); } elseif (Input::has('client')) { $client = Input::get('client'); $invoices = Invoice::where('client', 'like', '%' . $client . '%')->orderBy('date', 'desc')->paginate(10); } elseif (Input::has('startDate') && Input::has('endDate')) { $startDate = Input::get('startDate'); $endDate = Input::get('endDate'); $invoices = Invoice::whereBetween('date', [$startDate, $endDate])->orderBy('date', 'desc')->paginate(10); } elseif (Input::has('startDate')) { $startDate = Input::get('startDate'); $invoices = Invoice::where('date', $startDate)->orderBy('date', 'desc')->paginate(10); } elseif (Input::has('endDate')) { $endDate = Input::get('endDate'); $invoices = Invoice::where('date', $endDate)->orderBy('date', 'desc')->paginate(10); } else { $invoices = DB::table('invoices')->join('vehicles', 'invoices.vehicle', '=', 'vehicles.registration')->select('invoices.*', 'vehicles.brand', 'vehicles.model', 'vehicles.seat', 'vehicles.remarks')->orderBy('date', 'desc')->paginate(10); } return view('invoice.index', compact('title', 'invoices')); }
public function getHome() { $empid = Auth::user()->empid; $invoice = Invoice::where('Status', '=', 1)->orderBy('Id', 'desc')->get(); return View('collectionmodule/home')->with(array('invoices' => $invoice)); }
public function postEditinvoice(Request $request) { $evname = Input::get('event_name'); $result = explode('|', $evname, 2); $evcode = trim($result[0]); $eventname = trim($result[1]); $repnamecode = Input::get('rep_id'); $result = explode('|', $repnamecode, 2); $empid = trim($result[0]); $empname = trim($result[1]); $updateinvoice = Input::get('updateinvoice'); $purpose = Input::get('purpose'); if ($purpose == 'annual') { $post = Input::get(); $i = Invoice::where('Id', $updateinvoice)->update(array('Particulars' => $post['purpose'], 'CientAddress' => $post['client_address'], 'ClientName' => $post['client_name'], 'ClientEmail' => $post['client_email'], 'Companyname' => $post['companyname'], 'RepresentativeNo' => $empid, 'Repname' => $empname, 'InvoiceDate' => $post['invoice_date'], 'DueDate' => $post['due_date'], 'AnnualSerialNo' => $post['s_no_anuual1'], 'AnnualText' => $post['anuual_text'], 'AnnualCurrencyType' => $post['annual_currency1'], 'AnnualAmount' => $post['annual_amount1'], 'SerialNo' => $post['s_no'], 'Eventcode' => $evcode, 'EventName' => $eventname, 'CurrencyType' => $post['currency_type'], 'Amount' => $post['amount'], 'GrandTotal' => $post['grand_total'], 'AmountInWords' => $post['amount_in_words'], 'PaymentTerms' => $post['payment_interms'], 'ServiceTax' => $post['service_tax'], 'swachtax' => $post['swachtax'], 'swachtaxamount' => $post['swachtaxamount'], 'subtotalb' => $post['subtotalb'], 'Invoice_status' => 'Attended with Modification', 'Status' => 'NULL', 'ServiceTaxAmount' => $post['service_tax_amount'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('executor/home'); } } if ($purpose == 'single') { $post = Input::get(); $i = Invoice::where('Id', $updateinvoice)->update(array('Particulars' => $post['purpose'], 'CientAddress' => $post['client_address'], 'ClientName' => $post['client_name'], 'ClientEmail' => $post['client_email'], 'Companyname' => $post['companyname'], 'RepresentativeNo' => $empid, 'Repname' => $empname, 'InvoiceDate' => $post['invoice_date'], 'DueDate' => $post['due_date'], 'SerialNo' => $post['s_no'], 'Eventcode' => $evcode, 'EventName' => $eventname, 'CurrencyType' => $post['currency_type'], 'Amount' => $post['amount'], 'ServiceTax' => $post['service_tax'], 'ServiceTaxAmount' => $post['service_tax_amount'], 'GrandTotal' => $post['grand_total'], 'swachtax' => $post['swachtax'], 'swachtaxamount' => $post['swachtaxamount'], 'subtotalb' => $post['subtotalb'], 'AmountInWords' => $post['amount_in_words'], 'Invoice_status' => 'Attended with Modification', 'Status' => 'NULL', 'PaymentTerms' => $post['payment_interms'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('executor/home'); } } }
public function pay_invoice(Request $request) { // dd($request->all()); $data['title'] = 'Pay School Fees'; $data['fees'] = 1; $class_id = $request->class_id; $student_id = $request->student_id; $fee_schedule_code = strval($class_id) . session()->get('current_session') . strval(session()->get('current_term')); $session = session()->get('current_session'); $term = session()->get('current_term'); $data['transaction_modes'] = TransactionMode::lists('transaction_mode', 'id')->prepend('Please Select'); //current session invoice table $table = 'invoices_' . $session . '_' . $term; $data['student_fee_elements'] = []; //==============get previous sessions fees not yet paid+++++++++++++ $sessions = CurrentTerm::orderBy('created_at', 'desc')->where('session', '!=', session()->get('current_session'))->orWhere('term', '!=', session()->get('current_term'))->take(9)->groupby('session')->get(); // dd($sessions); $outstandings = []; $invoices_amt = 0; $payment_amt = 0; // foreach ($sessions as $session) { $invoices = Invoice::where('session', '!=', session()->get('current_session'))->orWhere('term', '!=', session()->get('current_term'))->get(); // dd($invoices); //get all payments associated with an invoice foreach ($invoices as $invoice) { $payment_amt = 0; $student_invoice = DB::table($invoice->table_name)->where(['student_id' => $student_id])->first(); //for every invoice, get payment associated with that invoice if ($student_invoice !== null) { $sch_fee_payment = SchoolFeesPayment::where(['session' => $invoice->session, 'term' => $invoice->term])->first(); $paid_amt = DB::table($sch_fee_payment->table_name)->where(['student_id' => $student_id])->sum('amount'); //get class id from fee schedule code $outstanding_class_id = substr($student_invoice->fee_schedule_code, 0, 1); //get oustanding amount $outstanding_balance = $student_invoice->total - $paid_amt; //if outstanding amt is not greater than zero then student has paid fully for that invoice therefore dont show on page if ($outstanding_balance > 0) { $session_fees = ['session' => $invoice->session, 'term' => $invoice->term, 'outstanding_balance' => $outstanding_balance, 'sch_fee_payment_table_name' => $sch_fee_payment->table_name, 'outstanding_fee_schedule_code' => $student_invoice->fee_schedule_code, 'outstanding_class_id' => $outstanding_class_id]; array_push($outstandings, $session_fees); } } } // } if ($outstandings == []) { $outstandings = null; } $data['outstandings'] = $outstandings; //===========GET THIS SESSIONS FEES++++++++++++++++++ //get fee schedule elements for current session $fee_sch_table = 'fee_sch_' . session()->get('current_session') . '_' . session()->get('current_term'); //get student invoice including exmepted fee elements $data['student_invoice'] = \DB::table($table)->where(['student_id' => $student_id, 'fee_schedule_code' => $fee_schedule_code])->first(); // dd($data['student_invoice'] ); // //check if invoice has been generated for this student if ($data['student_invoice'] !== null) { $already_paid = []; $paid_amount = 0; $data['exempted_elements'] = json_decode($data['student_invoice']->exempted_fee_elements); if ($data['exempted_elements'] == null) { $data['exempted_elements'] = []; } $sch_fee_payment = SchoolFeesPayment::where(['session' => session()->get('current_session'), 'term' => session()->get('current_term')])->first(); $payment_histories = DB::table($sch_fee_payment->table_name)->where(['student_id' => $student_id])->get(); // dd($payment_histories); foreach ($payment_histories as $payment_history) { $already_paid[] = json_decode($payment_history->elements_paid_for); $paid_amount += $payment_history->amount; } $already_paid = array_flatten($already_paid); // dd($already_paid); if ($already_paid !== null) { $data['already_paid'] = $already_paid; } else { $data['already_paid'] = []; } //get oustanding amount $outstanding_balance = $data['student_invoice']->total - $paid_amount; if ($outstanding_balance > 0) { $data['student_fee_elements'] = DB::table($fee_sch_table)->where(['fee_schedule_code' => $fee_schedule_code])->join('fee_elements', 'fee_elements.id', '=', $fee_sch_table . '.fee_element_id')->get(); } } else { session()->flash('flash_message', 'An invoice has not been generated for this term for this student.'); } if ($data['outstandings'] !== null || $data['student_invoice'] !== null) { $sch_fee_payments = SchoolFeesPayment::all(); foreach ($sch_fee_payments as $sch_fee_payment) { $term_payments = DB::table($sch_fee_payment->table_name)->where('student_id', $student_id)->orderBy('created_at', 'desc')->get(); $payments[] = $term_payments; } // dd(array_flatten($payments)); $data['payments'] = array_flatten($payments); $data['student_info'] = Student::find($student_id); $data['classes'] = studentClass::lists('name', 'id')->prepend('Please Select'); $data['students'] = Student::all(); return view('payments.payments', $data); } else { session()->flash('flash_message', 'An invoice has not been generated for this student.'); return redirect()->route('accounts.payments.index'); } }
public function individualReportPrint($name) { $printview = Invoice::where('institute_code', '=', Auth::user()->institute_id)->where('student_name', '=', $name)->first(); $paidtotal = Invoice::where('institute_code', '=', Auth::user()->institute_id)->where('student_name', '=', $name)->sum('payment_ammount'); $duetotal = Invoice::where('institute_code', '=', Auth::user()->institute_id)->where('student_name', '=', $name)->sum('due_amount'); $totalamount = Invoice::where('institute_code', '=', Auth::user()->institute_id)->where('student_name', '=', $name)->sum('total_amount'); //return $duetotal; $institute = Institute::where('institute_code', '=', Auth::user()->institute_id)->first(); $balance = Invoice::where('institute_code', '=', Auth::user()->institute_id)->where('student_name', '=', $name)->get(); //return $balance; return view('admin.individualreportprint', ['balance' => $balance, 'print' => $printview, 'iis' => $institute, 'paid' => $paidtotal, 'due' => $duetotal, 'total' => $totalamount]); }
public function postUpdateinvoice(Request $request) { $evnid = Input::get('view_invoice'); $inv_status = Input::get('invoice_status'); if ($inv_status == 'Attended with Modification') { $invoice_data = Invoice::where('Id', $evnid)->get(); $cate = Event::all(); $employee = Employee::all(); return view('invoice_edit')->with(array('invoice_data' => $invoice_data, 'cate' => $cate, 'employee' => $employee)); } if ($inv_status == 'Attended without modification') { // $post = Input::get(); $i = Invoice::where('Id', $evnid)->update(array('Invoice_status' => $inv_status)); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('home1'); } } if ($inv_status == 'Not Attended') { // $post = Input::get(); $i = Invoice::where('Id', $evnid)->update(array('Invoice_status' => $inv_status)); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('home1'); } } if ($inv_status == 'Entitlement') { } }
public function __construct(Invoice $invoice) { $this->invoice = $invoice->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account')); }
<?php use App\Invoice; $lastId = Invoice::get()->last(); $lastinvoice = Invoice::where('Id', $lastId->Id)->get(); ?> @foreach($lastinvoice as $inv) <p>Invoice Id : {{$inv['InvoiceCode']}} generated for {{$inv['GrandTotal']}} of {{ $inv['ClientName'] }} - {{$inv['EventName']}} </p> @endforeach
/** * Display Payment Received notification page. */ public function received($event_slug, $key) { $invoice = Invoice::where('key', $key)->first(); return view('payment.received'); }
public function search($type, $value) { return Invoice::where($type, '=', $value)->first(); }
public function postRejectinvoice(Request $request) { $rules = array('reject_comment' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator); } else { $approve_id = Input::get('invoice_reject_id'); $post = Input::get(); $i = Invoice::where('Id', $approve_id)->update(array('RejectedwithComments' => $post['reject_comment'], 'Status' => $post['reject_status'])); if ($i > 0) { $request->session()->flash('alert-success', 'Updated Success!'); return redirect('reviewer/home'); } } }