public function printBdayOrder($oid) { $orderid = Crypt::decrypt($oid); $order_data = Orders::where('orders.id', '=', $orderid)->get(); $customer_data = Customers::where('id', '=', $order_data[0]['customer_id'])->get(); $birthday_data = BirthdayParties::where('id', '=', $order_data[0]['birthday_id'])->get(); $student_data = Students::where('id', '=', $order_data[0]['student_id'])->get(); $order_data = $order_data[0]; if (isset($order_data['payment_dues_id'])) { $payment_due_data = PaymentDues::where('id', '=', $order_data['payment_dues_id'])->get(); $payment_due_data = $payment_due_data[0]; if (isset($payment_due_data->membership_id)) { $membershipData = CustomerMembership::find($payment_due_data->membership_id); $membershipTypeData = MembershipTypes::getMembershipTypeByID($membershipData->membership_type_id); $payment_due_data->description = $membershipTypeData->description; } } $customer_data = $customer_data[0]; $birthday_data = $birthday_data[0]; $student_data = $student_data[0]; $data = array('order_data', 'customer_data', 'birthday_data', 'student_data', 'payment_due_data'); // print_r($data); return View::make('pages.orders.bdayprintorder', compact($data)); }
public function modifyBirthdayPendingOrder() { $inputs = Input::all(); //payment_due_table $payment_data = PaymentDues::find($inputs['pending_id']); $payment_data->payment_due_amount = $inputs['amountpending']; $payment_data->updated_by = Session::get('userId'); $payment_data->save(); $payment_data = PaymentDues::where('id', '=', $inputs['pending_id'])->get(); $payment_data = $payment_data[0]; //birthday_table $birthday_data = BirthdayParties::find($payment_data['birthday_id']); $birthday_data->remaining_due_amount = $inputs["amountpending"]; $birthday_data->additional_number_of_guests = $inputs['additionalguestNo']; $birthday_data->additional_half_hours = $inputs['additionalhalfhours']; $birthday_data->additional_guest_price = $inputs['additionalguesAmount']; $birthday_data->additional_halfhour_price = $inputs['additionalhalfhourscost']; $birthday_data->updated_by = Session::get('userId'); $birthday_data->save(); $birthday_data = BirthdayParties::where('id', '=', $payment_data['birthday_id'])->get(); $birthday_data = $birthday_data[0]; $b = BirthdayParties::find($birthday_data->id); $b->grand_total = $birthday_data['default_birthday_cost'] + $birthday_data['additional_guest_price'] + $birthday_data['additional_halfhour_price']; $b->save(); // create order for payment order in payemnt due $payment_data = PaymentDues::where('id', '=', $inputs['pending_id'])->get(); $taxamount = $inputs['taxamount']; $createPendingorder = Orders::createPendingorder($payment_data, $taxamount, $inputs); $changingpendingstatus = PaymentDues::changeStatustopaid($inputs['pending_id'], 0); $print_url = url() . '/orders/Bprint/' . Crypt::encrypt($createPendingorder->id); $paymentpending = PaymentDues::where('id', '=', $inputs['pending_id'])->get(); $input['customerId'] = $paymentpending[0]['customer_id']; $input['birthday_id'] = $paymentpending[0]['birthday_id']; $input['student_id'] = $paymentpending[0]['student_id']; $input['commentType'] = 'ACTION_LOG'; $student_data = Students::find($input['student_id']); $input['commentText'] = "Birthday celebration Completed for kid " . $student_data['student_name']; Comments::addComments($input); //header('Access-Control-Allow-Origin: *'); return Response::json(array("status" => "success", "printurl" => $print_url)); }
static function getAllPaymentsMade($student_id) { return PaymentDues::where('student_id', '=', $student_id)->where('payment_due_for', '=', 'enrollment')->where('payment_status', '=', 'paid')->where('student_class_id', '!=', '0')->get(); }