예제 #1
0
 public function action_index()
 {
     $this->template->title = "Remittance Payment";
     $this->template->sub = "Follow the steps below to pay";
     if (isset($this->user)) {
         $data["student"] = Model_User::find("first", ["where" => [["deleted_at", 0], ["id", $this->user->id]]]);
     }
     if (Input::post('action') == 'submit') {
         if (Input::post("pay-method", null) != null && Input::post("refno", null) != null) {
             $checkExist = Model_Payment::find("first", ["where" => [["student_id", Input::post("studentId")], ["paid", Input::post("quarter")], ["status", 0]]]);
             if ($checkExist == NULL) {
                 // save
                 $payment = Model_Payment::forge();
                 $payment->student_id = Input::post("studentId");
                 $payment->pay_method = Input::post("paymethod");
                 $payment->paid_at = Input::post("date");
                 $payment->status = 0;
                 $payment->method = Input::post("pay-method");
                 $payment->ref_no = Input::post("refno");
                 if (Input::post("pay-method") == 1) {
                     $payment->paid = "1111";
                 } else {
                     $payment->paid = Input::post("quarter");
                 }
                 $payment->save();
                 $data["user"] = Model_User::find("first", ["where" => [["id", Input::post("studentId")]]]);
                 $pay = Model_Payment::query()->where('status', 0);
                 $lastID = $pay->max('id');
                 $data["pay"] = Model_Payment::find("first", ["where" => [["id", $lastID]]]);
                 //sending mail
                 $body = View::forge("email/payment", $data);
                 $sendmail = Email::forge("JIS");
                 $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                 $sendmail->to("*****@*****.**");
                 //$sendmail->to("*****@*****.**");
                 $sendmail->subject("Payment / Game-bootcamp");
                 $sendmail->html_body("Dear Admin,<br><br>" . htmlspecialchars_decode($body));
                 $sendmail->send();
                 Response::redirect("/students/top/?success=2");
             } else {
                 Response::redirect("/coursefee/remit/?e=2&g=" . Input::post('paymethod', 0));
             }
         } else {
             Response::redirect("/coursefee/?e=4");
         }
     }
     if (isset($this->user)) {
         $view = View::forge("coursefee/remit", $data);
     } else {
         $view = View::forge("coursefee/remit");
     }
     $this->template->content = $view;
 }
예제 #2
0
 public function action_index()
 {
     $data['student'] = Model_User::find("all", ["where" => [["id", $this->user->id], ["deleted_at", 0]]]);
     if (Input::post('action') == 'submit') {
         // add
         if (Input::post("amount", null) != null) {
             if (is_uploaded_file($_FILES["photo"]["tmp_name"])) {
                 $filename = str_replace("/", "", $_FILES["photo"]["name"]);
                 $filepath = DOCROOT . "/contents/receipt/" . $filename;
                 if (move_uploaded_file($_FILES["photo"]["tmp_name"], $filepath)) {
                     chmod($filepath, 0644);
                     // save
                     $payment = Model_Payment::forge();
                     $payment->student_id = Input::post("studentId");
                     $payment->pay_method = Input::post("type");
                     $payment->amount = Input::post("amount");
                     $payment->paid_at = Input::post("date");
                     $payment->receipt = $filename;
                     $payment->status = 0;
                     $payment->method = Input::post("method");
                     $payment->paid = Input::post("quarter");
                     $payment->save();
                     Response::redirect("/students/top/?m=1");
                 } else {
                     Response::redirect("/students/payment/?e=1");
                 }
             } else {
                 Response::redirect("/students/payment/?e=2");
             }
         } else {
             Response::redirect("/students/payment/?e=3");
         }
     }
     $view = View::forge("students/payment/index", $data);
     $this->template->content = $view;
 }
예제 #3
0
 public function action_index()
 {
     $this->template->title = "Cash Payment";
     $this->template->sub = "Follow the steps below to pay";
     if (isset($this->user)) {
         $data["student"] = Model_User::find("first", ["where" => [["deleted_at", 0], ["id", $this->user->id]]]);
     }
     if (Input::post('action') == 'submit') {
         // add
         if (Input::post("studentId", null) != null) {
             if (is_uploaded_file($_FILES["photo"]["tmp_name"])) {
                 $filename = str_replace("/", "", $_FILES["photo"]["name"]);
                 $filepath = DOCROOT . "/contents/receipt/" . $filename;
                 $checkExist = Model_Payment::find("first", ["where" => [["student_id", Input::post("studentId")], ["paid", Input::post("quarter")], ["status", 0]]]);
                 if ($checkExist == NULL) {
                     if (move_uploaded_file($_FILES["photo"]["tmp_name"], $filepath)) {
                         chmod($filepath, 0644);
                         // save
                         $payment = Model_Payment::forge();
                         $payment->student_id = Input::post("studentId");
                         $payment->pay_method = Input::post("paymethod");
                         $payment->paid_at = Input::post("date");
                         $payment->receipt = $filename;
                         $payment->status = 0;
                         $payment->method = Input::post("method");
                         if (Input::post("method") == 1) {
                             $payment->paid = "1111";
                         } else {
                             $payment->paid = Input::post("quarter");
                         }
                         $payment->save();
                         $data["user"] = Model_User::find("first", ["where" => [["id", Input::post("studentId")]]]);
                         $pay = Model_Payment::query()->where('status', 0);
                         $lastID = $pay->max('id');
                         $data["pay"] = Model_Payment::find("first", ["where" => [["id", $lastID]]]);
                         //sending mail
                         $body = View::forge("email/payment", $data);
                         $sendmail = Email::forge("JIS");
                         $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name"));
                         //$sendmail->to("*****@*****.**");
                         $sendmail->to("*****@*****.**");
                         $sendmail->subject("Payment / Game-bootcamp");
                         $sendmail->html_body("Dear Admin,<br><br>" . htmlspecialchars_decode($body));
                         $rec = $data["pay"];
                         $receipt = Model_Payment::query()->where('id', $rec->id)->limit(1)->get_one();
                         $query = Model_Payment::find($receipt->id);
                         $sendmail->attach(DOCROOT . '/contents/receipt/' . $query->receipt);
                         $sendmail->send();
                         Response::redirect("/students/top/?success=1");
                     } else {
                         Response::redirect("/coursefee/?e=1");
                     }
                 } else {
                     Response::redirect("/coursefee/cash/?e=2&g=" . Input::post('g', 0));
                 }
             } else {
                 Response::redirect("/coursefee/?e=3");
             }
         } else {
             Response::redirect("/coursefee/?e=4");
         }
     }
     if (isset($this->user)) {
         $view = View::forge("coursefee/cash", $data);
     } else {
         $view = View::forge("coursefee/cash");
     }
     $this->template->content = $view;
 }