コード例 #1
0
 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));
 }