public function destroy($id) { $issues = Issue::where('registration_id', '=', $id)->delete(); $placements = Placement::where('registration_id', '=', $id)->delete(); $receivables = Receivable::where('registration_id', '=', $id)->get(); foreach ($receivables as $receivable) { $installments = Installment::where('receivable_id', '=', $receivable->id)->get(); foreach ($installments as $installment) { $earnings = Earning::where('earnable_type', '=', 'Installment')->where('earnable_id', '=', $installment->id)->get(); foreach ($earnings as $earning) { $earning->delete(); } $installment->delete(); } $earnings = Earning::where('earnable_type', '=', 'Receivable')->where('earnable_id', '=', $receivable->id)->delete(); $reductions = Reduction::where('receivable_id', '=', $receivable->id)->delete(); $receivable->delete(); } Registration::destroy($id); Session::flash('message', 'Sukses membatalkan Pendaftaran!, Semua Data terkait pendaftaran ini telah dihapus!'); }
public function makeCash($id) { $receivable = Receivable::find($id); $receivable->payment = 'Cash'; $receivable->save(); $installments = Installment::where('receivable_id', '=', $receivable->id)->get(); foreach ($installments as $installment) { $installment->delete(); } Session::flash('message', 'Pembayaran Tagihan menjadi Tunai (Tanpa Angsuran)!'); }
<?php require_once './classes/Installment.php'; $installment = new Installment(); $list = $installment->get_installment_page(); $total = $installment->get_subs_num(); echo $list; ?> <script type="text/javascript"> $(document).ready(function () { $(function () { $('#pagination').pagination({ items: <?php echo $total; ?> , itemsOnPage: <?php echo $installment->limit; ?> , cssStyle: 'light-theme' }); }); $("#pagination").click(function () { var page = $('#pagination').pagination('getCurrentPage'); console.log('Page: ' + page); var url = "/lms/custom/installment/get_installment_item.php";
<?php require_once './classes/Installment.php'; $id = $_POST['id']; $invoice = new Installment(); $list = $invoice->get_course_by_category($id); echo $list;
<?php require_once './classes/Installment.php'; $id = $_POST['id']; $invoice = new Installment(); $list = $invoice->get_course_users($id); echo $list;
<?php require_once './classes/Installment.php'; $installment = new Installment(); $num = $_POST['num']; $userid = $_POST['userid']; $courseid = $_POST['courseid']; $list = $installment->add_installment_user($courseid, $userid, $num); echo $list;
public function destroy($code) { $earnings = Earning::where('code', '=', $code)->get(); foreach ($earnings as $earning) { switch ($earning->earnable_type) { case 'Receivable': $receivable = Receivable::find($earning->earnable_id); $receivable->balance += $receivable->balance + $earning->payment; $receivable->save(); $earning->delete(); break; case 'Installment': $installment = Installment::find($earning->earnable_id); $installment->balance += $installment->balance + $earning->payment; $installment->paid = 0; $installment->save(); $earning->delete(); break; case 'Registration': $registration = Registration::find($earning->earnable_id); $registration->cost_is_paid = 0; $registration->save(); $earning->delete(); break; case 'Movement': $movement = Movement::find($earning->earnable_id); $movement->paid = 0; $movement->save(); $earning->delete(); break; case 'Punishment': $punishment = Punishment::find($earning->earnable_id); $punishment->paid = 0; $punishment->save(); $earning->delete(); break; case 'Resign': $resign = Resign::find($earning->earnable_id); $resign->is_earned = 0; $resign->save(); $earning->delete(); break; default: $earning->delete(); break; } } }
<?php require_once './classes/Installment.php'; $i = new Installment(); $item = $_POST['item']; $list = $i->search_subs($item); echo $list;
<?php require_once './classes/Installment.php'; $inst = new Installment(); $subs = $_POST['subs']; $list = $inst->create_subscription(json_decode($subs)); echo $list;
<?php require_once './classes/Installment.php'; $i = new Installment(); $subsID = $_POST['subsID']; $list = $i->cancel_subs($subsID); echo $list;
public function purchase($id) { $payment = Input::get('payment'); $payment = str_replace(",", ".", $payment); $payment = str_replace(".", "", $payment); $payment = substr($payment, 0, -2); $fines = Input::get('fines'); $fines = str_replace(",", ".", $fines); $fines = str_replace(".", "", $fines); $fines = substr($fines, 0, -2); $installment = Installment::find($id); $installment->balance = $installment->balance - $payment; if ($installment->balance > 0) { $installment->paid = 0; } else { $installment->paid = 1; } $installment->save(); $earning_code = $this->generateCode(); $signature = Hash::make(date('Y-m-d H:i:s')); $earning = new Earning(); $earning->project_id = Auth::user()->curr_project_id; $earning->location_id = Auth::user()->location_id; $earning->issue_id = $installment->receivable->issue_id; $earning->employee_id = Input::get('employee_id'); $earning->earning_date = Input::get('earning_date'); $earning->earnable_type = 'Installment'; $earning->earnable_id = $installment->id; $earning->code = $earning_code; $earning->signature = $signature; $earning->payment = $payment; $earning->save(); if ($fines > 0) { $punishment = new Punishment(); $punishment->project_id = Auth::user()->curr_project_id; $punishment->location_id = Auth::user()->location_id; $punishment->issue_id = $installment->receivable->issue_id; $punishment->installment_id = $installment->id; $punishment->release_date = Input::get('earning_date'); $punishment->fines = $fines; $punishment->paid = 1; $punishment->save(); $earning = new Earning(); $earning->project_id = Auth::user()->curr_project_id; $earning->location_id = Auth::user()->location_id; $earning->issue_id = $installment->receivable->issue_id; $earning->employee_id = Input::get('employee_id'); $earning->earning_date = Input::get('earning_date'); $earning->earnable_type = 'Punishment'; $earning->earnable_id = $punishment->id; $earning->code = $earning_code; $earning->signature = $signature; $earning->payment = $fines; $earning->save(); } $receivable = Receivable::find($installment->receivable_id); $receivable->balance = $receivable->balance - $payment; $receivable->save(); return Response::json(array('status' => 'Succeed', 'earning' => $earning->code)); }
<?php require_once './classes/Installment.php'; $installment = new Installment(); $page = $_POST['id']; $list = $installment->get_installment_item($page); $total = $installment->get_subs_num(); echo $list;
public function latesFilter($month, $year) { $curr_month = $month; $curr_year = $year; $installments = Installment::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('year(schedule)'), '=', $curr_year)->where(DB::raw('month(schedule)'), '=', $curr_month)->where('paid', '=', 0)->get(); $menu = 'report'; return View::make('reports.lates', compact('installments', 'curr_year', 'curr_month', 'menu')); }
<?php require_once '/home/cnausa/public_html/lms/custom/installment/classes/Installment.php'; $installment = new Installment(); $list = $installment->verify_installment_users(); echo $list;