Example #1
0
 static function addReminderDates($inputs)
 {
     $PaymentReminder = new PaymentReminders();
     if (isset($inputs['seasonId'])) {
         $PaymentReminder->season_id = $inputs['seasonId'];
     }
     if (isset($inputs['classId']) && isset($inputs['batchId']) && isset($inputs['reminder_date'])) {
         $PaymentReminder->customer_id = $inputs['customerId'];
         $PaymentReminder->student_id = $inputs['studentId'];
         $PaymentReminder->season_id = $inputs['seasonId'];
         $PaymentReminder->enrolled_class_id = $inputs['classId'];
         $PaymentReminder->enrolled_batch_id = $inputs['batchId'];
         $PaymentReminder->reminder_date = $inputs['reminder_date'];
     } else {
         if (isset($inputs['birthday_party_date']) && isset($inputs['id'])) {
             $PaymentReminder->customer_id = $inputs['customer_id'];
             $PaymentReminder->student_id = $inputs['student_id'];
             $PaymentReminder->reminder_date = $inputs['birthday_party_date'];
         }
     }
     $PaymentReminder->created_by = Session::get('userId');
     $PaymentReminder->created_at = date("Y-m-d H:i:s");
     $PaymentReminder->save();
 }
Example #2
0
 public function addbirthdayParty()
 {
     $inputs = Input::all();
     $taxAmtapplied = $inputs['taxAmount'];
     if ($inputs['membershipType'] != "" && $inputs['membershipPriceBday'] != 0) {
         $membershipInput['customer_id'] = $inputs['customerId'];
         $membershipInput['membership_type_id'] = $inputs['membershipType'];
         $customerMembershipData = CustomerMembership::addMembership($membershipInput);
         if ($customerMembershipData->membership_type_id == 1) {
             $followupMembershipData = Comments::addFollowupForMembership($customerMembershipData);
         }
     }
     $addBirthday = BirthdayParties::addbirthdayParty($inputs);
     if ($inputs['remainingAmount'] != 0) {
         if (isset($customerMembershipData)) {
             $addBirthday['membership_id'] = $customerMembershipData->id;
             $membership_data = MembershipTypes::find($customerMembershipData->membership_type_id);
             $addBirthday['membership_amount'] = $membership_data->fee_amount;
         }
         $firstpayment = PaymentDues::createBirthdaypaymentFirstdues($addBirthday);
         $addPaymentDues = PaymentDues::createBirthdaypaymentdues($addBirthday);
     }
     if (isset($addPaymentDues)) {
         $addBirthdayOrder = Orders::createBOrder($addBirthday, $firstpayment, $taxAmtapplied, $inputs);
     } else {
         $addBirthdayOrder = Orders::createBOrderwithoutPaymentDue($addBirthday, $addPaymentDues, $taxAmtapplied);
     }
     $addPaymentremainder = PaymentReminders::addReminderDates($addBirthday);
     $input['customerId'] = $addBirthday->customer_id;
     $input['birthday_id'] = $addBirthday->id;
     $input['student_id'] = $addBirthday->student_id;
     $input['commentType'] = 'ACTION_LOG';
     $student_data = Students::find($addBirthday->student_id);
     $input['commentText'] = "Birthday celebration added for kid " . $student_data['student_name'];
     $input['commentStatus'] = 'ACTIVE/SCHEDULED';
     Comments::addComments($input);
     $input['followupType'] = 'PAYMENT';
     $input['commentStatus'] = 'REMINDER_CALL';
     $input['commentType'] = 'VERYINTERESTED';
     $input['commentText'] = "Call for Birthday celebration for kid " . $student_data['student_name'];
     $celebration_date = Carbon::createFromFormat('d M Y', $inputs['birthdayCelebrationDate']);
     if ($celebration_date->eq(carbon::now())) {
         Comments::addComments($input);
     } else {
         $celebration_date->subDay();
         $input['reminderDate'] = $celebration_date->toDateString();
         Comments::addComments($input);
     }
     if (isset($inputs['invoicePrintOption']) && $inputs['invoicePrintOption'] == 'yes') {
         $printUrl = url() . '/orders/Bprint/' . Crypt::encrypt($addBirthdayOrder);
         //$printUrl = url().'/orders/Bprint/'.$addBirthdayOrder;
     } else {
         $printUrl = "";
     }
     //header('Access-Control-Allow-Origin: *');
     if ($addBirthdayOrder) {
         return Response::json(array("status" => "success", "printUrl" => $printUrl));
     }
     return Response::json(array("status" => "failed"));
 }