PK

ADDRLIN : /home/questend/public_html/subdomain/devtrufflenation.questend.com/admin/student/
FLL :
Current File : /home/questend/public_html/subdomain/devtrufflenation.questend.com/admin/student/paynow.php

<?php
   ob_start();
   //error_reporting(E_ALL ^ E_NOTICE);
   @session_start();
   ini_set('allow_url_include',1);    
   date_default_timezone_set("Asia/Kolkata");
   set_time_limit(600);
   ini_set('max_execution_time',600);
   require_once '../includes/settings/PDODB.php';
   include '../includes/modules/functions.php';
   
   $function = new FUNCTIONS();

   if(empty($_SESSION['adminId'])){
    header("Location: ../index.php");
    exit();
   }

   if(isset($_POST['btnPay']) && !empty($_POST)){
      //print_r($_POST['courseName']); exit;
      $from_date1 = !empty($_POST['from_date'])?$_POST['from_date']:"";
      $from_date = date("Y-m-d", strtotime($from_date1));      

      $to_date1 = !empty($_POST['to_date'])?$_POST['to_date']:"";
      $to_date = date('Y-m-d', strtotime($to_date1));
      //print_r("<br> start date = ".$from_date." end date = ".$to_date); exit;

      //$applydate = !empty($_POST['applydate'])?trim($_POST['applydate']):"";

      $balanceFee = !empty($_POST['balanceFee'])?trim($_POST['balanceFee']):"";
      $totalPayableFee = !empty($_POST['totalPayableFee'])?trim($_POST['totalPayableFee']):"";
      $oneTimePayment = !empty($_POST['oneTimePayment'])?trim($_POST['oneTimePayment']):"";
      $particular = !empty($_POST['particular'])?trim($_POST['particular']):"";
      $isdiscount = !empty($_POST['isdiscount'])?trim($_POST['isdiscount']):"";
      $course_discount_rate = !empty($_POST['course_discount_rate'])?trim($_POST['course_discount_rate']):"";
      $exclude_gst_price = !empty($_POST['exclude_gst_price'])?trim($_POST['exclude_gst_price']):"";
      $include_gst_price = !empty($_POST['include_gst_price'])?trim($_POST['include_gst_price']):"";
      $paymentOptions = !empty($_POST['paymentOptions'])?trim($_POST['paymentOptions']):"";
      $batchTiming = !empty($_POST['batchTiming'])?trim($_POST['batchTiming']):"";
      $batchMonth = !empty($_POST['batchMonth'])?trim($_POST['batchMonth']):"";
      $batchYear = !empty($_POST['batchYear'])?trim($_POST['batchYear']):"";
      $installmentOptions = !empty($_POST['installmentOptions'])?trim($_POST['installmentOptions']):"";
      $paymentMode = !empty($_POST['paymentMode'])?trim($_POST['paymentMode']):"";
      $downPayment = !empty($_POST['downPayment'])?trim($_POST['downPayment']):""; 

      $transaction_id = !empty($_POST['transaction_id'])?trim($_POST['transaction_id']):"";   

      $bankname = !empty($_POST['bankname'])?trim($_POST['bankname']):"";   
      $chequeno = !empty($_POST['chequeno'])?trim($_POST['chequeno']):"";

      $studentid = !empty($_POST['studentid'])?trim($_POST['studentid']):"";
      $pastUid = !empty($_POST['pastUid'])?trim($_POST['pastUid']):"";


      $visitStudentdata = $function->getStudentVisit($id=$studentid,$isRegistation=2,$isActive=1,$orderBy='ASC',$centrename=$_SESSION['admin_centrename']);

      $username = !empty($visitStudentdata[0]['username'])?trim($visitStudentdata[0]['username']):"";
      $mobileno = !empty($visitStudentdata[0]['mobileno'])?trim($visitStudentdata[0]['mobileno']):"";
      $uemail = !empty($visitStudentdata[0]['uemail'])?trim($visitStudentdata[0]['uemail']):"";
      $dob = !empty($visitStudentdata[0]['dob'])?trim($visitStudentdata[0]['dob']):"";
      $studentAddress = !empty($visitStudentdata[0]['studentAddress'])?trim($visitStudentdata[0]['studentAddress']):"";
      $state = !empty($visitStudentdata[0]['state'])?trim($visitStudentdata[0]['state']):"";
      /*$courseName = !empty($visitStudentdata[0]['courseName'])?trim($visitStudentdata[0]['courseName']):"";*/
      $healthIssue = !empty($visitStudentdata[0]['healthIssue'])?trim($visitStudentdata[0]['healthIssue']):"";
      $emergencyPhoneNo = !empty($visitStudentdata[0]['emergencyPhoneNo'])?trim($visitStudentdata[0]['emergencyPhoneNo']):"";
      $relationWith = !empty($visitStudentdata[0]['relationWith'])?trim($visitStudentdata[0]['relationWith']):"";

      $currentPastStudent = !empty($visitStudentdata[0]['currentPastStudent'])?trim($visitStudentdata[0]['currentPastStudent']):"";
      $whichCourse = !empty($visitStudentdata[0]['whichCourse'])?trim($visitStudentdata[0]['whichCourse']):"";

      $gstNo = !empty($visitStudentdata[0]['gstNo'])?trim($visitStudentdata[0]['gstNo']):"";
      $companyName = !empty($visitStudentdata[0]['companyName'])?trim($visitStudentdata[0]['companyName']):"";
      $companyAddress = !empty($visitStudentdata[0]['companyAddress'])?trim($visitStudentdata[0]['companyAddress']):"";
      $companyState = !empty($visitStudentdata[0]['companyState'])?trim($visitStudentdata[0]['companyState']):"";
      $passportPhoto = !empty($visitStudentdata[0]['passportPhoto'])?trim($visitStudentdata[0]['passportPhoto']):"";
      $addressProof = !empty($visitStudentdata[0]['addressProof'])?trim($visitStudentdata[0]['addressProof']):"";
      $leavesOption = !empty($visitStudentdata[0]['leavesOption'])?trim($visitStudentdata[0]['leavesOption']):"";
      $internship = !empty($visitStudentdata[0]['internship'])?trim($visitStudentdata[0]['internship']):"";
      $error_msg = "";
      
      /*$coursedata = $function->getCourse($id=$courseName,$isActive=1,$orderBy='ASC');
      $coursename = $coursedata[0]['courseName'];*/

      $courseName = $_POST["courseName"];
      $count = count($courseName);
      $courseName = implode(",", $courseName);

      //print_r(count($courseName)); exit;

      $typebatch = !empty($_POST['typebatch'])?trim($_POST['typebatch']):"";
      /*if ($typebatch =='weekday') {
         $courseduration = $coursedata[0]['weekDuration'];
      } else {
         $courseduration = $coursedata[0]['weekendDuration'];
      }*/

      $pdodb = PDODB::getInstance();
      if (!empty($pastUid)) {
         $sql = "UPDATE `tn_student` SET username='".$username."', mobileno='".$mobileno."', uemail='".$uemail."', dob='".$dob."', studentAddress='".$studentAddress."', state='".$state."', courseName='".$courseName."', healthIssue='".$healthIssue."', emergencyPhoneNo='".$emergencyPhoneNo."', relationWith='".$relationWith."', currentPastStudent='".$currentPastStudent."', whichCourse='".$whichCourse."', passportPhoto='".$passportPhoto."', addressProof='".$addressProof."', leavesOption='".$leavesOption."', isActive=1 WHERE  `tn_student`.`id` = '".$pastUid."'";
         //exit;
         $result = $pdodb->query($sql);
         $insert_sid = $pastUid;
      }else {
         $sql = "INSERT INTO `tn_student` SET username='".$username."', mobileno='".$mobileno."', uemail='".$uemail."', dob='".$dob."', studentAddress='".$studentAddress."', state='".$state."', courseName='".$courseName."', healthIssue='".$healthIssue."', emergencyPhoneNo='".$emergencyPhoneNo."', relationWith='".$relationWith."', currentPastStudent='".$currentPastStudent."', whichCourse='".$whichCourse."', passportPhoto='".$passportPhoto."', addressProof='".$addressProof."', leavesOption='".$leavesOption."', centrename='".$_SESSION['admin_centrename']."'";
         //exit;
         $result = $pdodb->query($sql);
         $insert_sid = $pdodb->lastInsertId();
      }

      $sqlvisit = "UPDATE `tn_studentvisit`  SET isRegistation=1 WHERE id = '".$studentid."'";
      $resultvisit = $pdodb->query($sqlvisit);
      
      $todaydate = date('d-m-Y');
      if ($paymentMode=='Cash') {
         $mailmsg = " Cash, dated ".$todaydate;
      }elseif ($paymentMode=='Card') {
         $mailmsg = " Card, TXN Id ".$transaction_id." dated ".$todaydate;
      }elseif ($paymentMode=='Cheque') {
         $mailmsg = " Cheque No. ".$chequeno.", Bank Name. ".$bankname." dated ".$todaydate;
      }elseif ($paymentMode=='UPI') {
         $mailmsg = " UPI, TXN Id ".$transaction_id." dated ".$todaydate;
      }

      if (!empty($oneTimePayment)) {
         //echo "oneTimePayment "; exit;
         $amountinword = $function->numbertoWords($number=$oneTimePayment);
         $amount=$oneTimePayment;
         if (!empty($gstNo)) {
            //echo "with gst"; //exit;batchTiming
            $sql2 = "INSERT INTO `tn_order` SET studentId='".$insert_sid."',courseId='".$courseName."',totalFee='".$oneTimePayment."', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', batchMonth='".$batchMonth."', batchYear='".$batchYear."', batchTiming='".$batchTiming."', isdiscount='".$isdiscount."', course_discount_rate='".$course_discount_rate."', internship='".$internship."', count='".$count."', startDate='".$from_date."', endDate='".$to_date."', centrename='".$_SESSION['admin_centrename']."'";
            //echo $sql2; exit;
            $result2 = $pdodb->query($sql2);
            $insert_oid = $pdodb->lastInsertId();

            $sql3 = "INSERT INTO `tn_invoice` SET amount='".$oneTimePayment."', orderId='".$insert_oid."', gstNo='".$gstNo."', uId='".$insert_sid."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', isGst='1', centrename='".$_SESSION['admin_centrename']."'";
            $result3 = $pdodb->query($sql3);
            $insert_invoice = $pdodb->lastInsertId();
            $invoiceNo = "TFN/COM/2024/00".$insert_invoice;
            $Rcpt_id = "RCPT/COM/2024/00".$insert_invoice;

            $sqlupt = "UPDATE `tn_invoice`  SET invoiceNo='".$invoiceNo."', isPayment='2' WHERE id = '".$insert_invoice."'";
            $resultupt = $pdodb->query($sqlupt);

            $data = $_POST['courseName'];
            foreach ($data as $course) {  
                $coursedata = $function->getCourse($id=$course,$isActive=1,$orderBy='ASC');
                $cprice = $coursedata[0]['coursePrice'];

                // Apply discount based on discount type
                if ($isdiscount == 2) {
                    // Percentage discount
                    $discountedPrice = $cprice - ($cprice * ($course_discount_rate / 100));

                } elseif ($isdiscount == 3) {
                    // Flat discount
                    $discountedPrice = $cprice - ($course_discount_rate / $count);
                } else {
                    // No discount
                    $discountedPrice = $cprice;
                }

                // Calculate GST
                $gstAmount = $discountedPrice * 0.18;
                
                // Add GST to discounted price
                $finalPrice = $discountedPrice + $gstAmount;

                $sqlitem = "INSERT INTO `tn_orderitem` SET studentId='".$insert_sid."', courseid='".$course."', courseprice='".$finalPrice."', orderid='".$insert_oid."', centrename='".$_SESSION['admin_centrename']."'";
                $resultitem = $pdodb->query($sqlitem);
            }

            $array = explode(",", $courseName);

            $courselist = $function->getCourse($id=NULL,$isActive=1,$orderBy='ASC');
            $courseNames = array(); // Initialize an array to store course names
            for ($k = 0; $k < count($courselist); $k++) {
                 $courseid = $courselist[$k]['id'];
                 if (in_array($courseid, $array)) {
                     $courseNames[] = $courselist[$k]['courseName']; // Add course name to the array
                 }
            }
            $coursename = implode(', ', $courseNames); // Convert array to comma-separated string
            //echo $courseName;

            if ($result2 == true && $result3 == true && $resultupt == true) {
               $sql4 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', demand_id='".$insert_oid."', debit='".$oneTimePayment."', particular='Invoice generated',  gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result4 = $pdodb->query($sql4);

               $sql5 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."',orderid='".$insert_oid."',transaction_id='".$transaction_id."', credit='".$oneTimePayment."', particular='".$particular."', paymentMode='".$paymentMode."', bankname='".$bankname."', chequeno='".$chequeno."', invoice='".$invoiceNo."', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result5 = $pdodb->query($sql5);
               if ($result5 == true) {
                  $error_msg = "Registration Successfully Done";
                  //welcome email send
                  $to = $uemail;
                  $subject = "Registration Successfully Completed";
                  $messagebody = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                   <html xmlns='http://www.w3.org/1999/xhtml'>
                     <head>
                        <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                        <meta name='x-apple-disable-message-reformatting' />
                        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                        <meta name='color-scheme' content='light dark' />
                        <meta name='supported-color-schemes' content='light dark' />
                        <title></title>
                        <style type='text/css' rel='stylesheet' media='all'>
                           @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                           body {
                           width: 100% !important;
                           height: 100%;
                           margin: 0;
                           -webkit-text-size-adjust: none;
                           }
                           a {
                           color: #3869D4;
                           }
                           a img {
                           border: none;
                           }
                           td {
                           word-break: break-word;
                           }
                           .preheader {
                           display: none !important;
                           visibility: hidden;
                           mso-hide: all;
                           font-size: 1px;
                           line-height: 1px;
                           max-height: 0;
                           max-width: 0;
                           opacity: 0;
                           overflow: hidden;
                           }
                           body,
                           td,
                           th {
                           font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                           }
                           h1 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 22px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h2 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 16px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h3 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 14px;
                           font-weight: bold;
                           text-align: left;
                           }
                           td,
                           th {
                           font-size: 16px;
                           }
                           p,
                           ul,
                           ol,
                           blockquote {
                           margin: .4em 0 1.1875em;
                           font-size: 16px;
                           line-height: 1.625;
                           }
                           p.sub {
                           font-size: 13px;
                           }
                           .align-right {
                           text-align: right;
                           }
                           .align-left {
                           text-align: left;
                           }
                           .align-center {
                           text-align: center;
                           }
                           .u-margin-bottom-none {
                           margin-bottom: 0;
                           }
                           .button {
                           background-color: #3869D4;
                           border-top: 10px solid #3869D4;
                           border-right: 18px solid #3869D4;
                           border-bottom: 10px solid #3869D4;
                           border-left: 18px solid #3869D4;
                           display: inline-block;
                           color: #FFF;
                           text-decoration: none;
                           border-radius: 3px;
                           box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                           -webkit-text-size-adjust: none;
                           box-sizing: border-box;
                           }
                           .button--green {
                           background-color: #22BC66;
                           border-top: 10px solid #22BC66;
                           border-right: 18px solid #22BC66;
                           border-bottom: 10px solid #22BC66;
                           border-left: 18px solid #22BC66;
                           }
                           .button--red {
                           background-color: #FF6136;
                           border-top: 10px solid #FF6136;
                           border-right: 18px solid #FF6136;
                           border-bottom: 10px solid #FF6136;
                           border-left: 18px solid #FF6136;
                           }
                           @media only screen and (max-width: 500px) {
                           .button {
                           width: 100% !important;
                           text-align: center !important;
                           }
                           }
                           .attributes {
                           margin: 0 0 21px;
                           }
                           .attributes_content {
                           background-color: #F4F4F7;
                           padding: 16px;
                           }
                           .attributes_item {
                           padding: 0;
                           }
                           .related {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .related_item {
                           padding: 10px 0;
                           color: #CBCCCF;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .related_item-title {
                           display: block;
                           margin: .5em 0 0;
                           }
                           .related_item-thumb {
                           display: block;
                           padding-bottom: 10px;
                           }
                           .related_heading {
                           border-top: 1px solid #CBCCCF;
                           text-align: center;
                           padding: 25px 0 10px;
                           }
                           .discount {
                           width: 100%;
                           margin: 0;
                           padding: 24px;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F4F4F7;
                           border: 2px dashed #CBCCCF;
                           }
                           .discount_heading {
                           text-align: center;
                           }
                           .discount_body {
                           text-align: center;
                           font-size: 15px;
                           }
                           .social {
                           width: auto;
                           }
                           .social td {
                           padding: 0;
                           width: auto;
                           }
                           .social_icon {
                           height: 20px;
                           margin: 0 8px 10px 8px;
                           padding: 0;
                           }
                           .purchase {
                           width: 100%;
                           margin: 0;
                           padding: 35px 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_content {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_item {
                           padding: 10px 0;
                           color: #51545E;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .purchase_heading {
                           padding-bottom: 8px;
                           border-bottom: 1px solid #EAEAEC;
                           }
                           .purchase_heading p {
                           margin: 0;
                           color: #85878E;
                           font-size: 12px;
                           }
                           .purchase_footer {
                           padding-top: 15px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .purchase_total {
                           margin: 0;
                           text-align: right;
                           font-weight: bold;
                           color: #333333;
                           }
                           .purchase_total--label {
                           padding: 0 15px 0 0;
                           }
                           body {
                           background-color: #F2F4F6;
                           color: #51545E;
                           }
                           p {
                           color: #51545E;
                           }
                           .email-wrapper {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F2F4F6;
                           }
                           .email-content {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-masthead {
                           padding: 25px 0;
                           text-align: center;
                           }
                           .email-masthead_logo {
                           width: 94px;
                           }
                           .email-masthead_name {
                           font-size: 16px;
                           font-weight: bold;
                           color: #A8AAAF;
                           text-decoration: none;
                           text-shadow: 0 1px 0 white;
                           }
                           .email-body {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-body_inner {
                           width: 570px;
                           margin: 20px auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #FFFFFF;
                           }
                           .email-footer {
                           width: 570px;
                           margin: 0 auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .email-footer p {
                           color: #A8AAAF;
                           }
                           .body-action {
                           width: 100%;
                           margin: 30px auto;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .body-sub {
                           margin-top: 25px;
                           padding-top: 25px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .content-cell {
                           padding: 45px;
                           }
                           @media only screen and (max-width: 600px) {
                           .email-body_inner,
                           .email-footer {
                           width: 100% !important;
                           }
                           }
                           @media (prefers-color-scheme: dark) {
                           body,
                           .email-body,
                           .email-body_inner,
                           .email-content,
                           .email-wrapper,
                           .email-masthead,
                           .email-footer {
                           background-color: #333333 !important;
                           color: #FFF !important;
                           }
                           p,
                           ul,
                           ol,
                           blockquote,
                           h1,
                           h2,
                           h3,
                           span,
                           .purchase_item {
                           color: #FFF !important;
                           }
                           .attributes_content,
                           .discount {
                           background-color: #222 !important;
                           }
                           .email-masthead_name {
                           text-shadow: none !important;
                           }
                           }
                           :root {
                           color-scheme: light dark;
                           supported-color-schemes: light dark;
                           }
                        </style>
                     </head>
                     <body>                     
                        <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>                        
                           <tr>
                              <td align='center'>
                                 <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                    <tr>
                                       <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                          <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                             <tr>
                                                <td>
                                                   <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                       <div style='float: left;'>
                                                          <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                       </div>
                                                       <div style='float: right;'>
                                                          <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                       </div>
                                                    </div>
                                                </td>
                                             </tr>
                                             <tr>
                                                <td class='content-cell'>
                                                   <div class='f-fallback'>
                                                      <h1>Dear $username!,</h1>
                                                      <p>
                                                         Welcome aboard Bake Better, the premier baking school of India.<br>
                                                         You have been registered as a student with Bake Better.<br>
                                                         You can log into your student account with your registered email id as login id
                                                         and your registered mobile no as password.<br>
                                                         Together, let us turn your passion for baking into a career.
                                                      </p>
                                                      <table class='body-action' align='center' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                                        <tr>
                                                           <td align='center'>
                                                              <table width='100%' border='0' cellspacing='0' cellpadding='0' role='presentation'>
                                                                 <tr>
                                                                    <td align='center'>
                                                                       <a href='https://www.trufflenation.questend.com' class='f-fallback button' target='_blank'>Login</a>
                                                                    </td>
                                                                 </tr>
                                                              </table>
                                                           </td>
                                                        </tr>
                                                      </table>                                       
                                                      <table class='body-sub' role='presentation'>
                                                         <tr>
                                                            <td>
                                                               <p class='f-fallback'>Best Wishes,</p>
                                                               <p class='f-fallback'>Team Bake Better</p>
                                                            </td>
                                                         </tr>
                                                      </table>
                                                   </div>
                                                </td>
                                             </tr>
                                          </table>
                                       </td>
                                    </tr>
                                    
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </body>
                   </html>";
                  $mail = $function->sendMail2($to=$to,$subject=$subject,$messagebody=$messagebody);

                  //payment email
                  $subject2 = "Payment Successfully Completed";
                  $messagebody2 = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                      <html xmlns='http://www.w3.org/1999/xhtml'>
                        <head>
                           <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                           <meta name='x-apple-disable-message-reformatting' />
                           <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                           <meta name='color-scheme' content='light dark' />
                           <meta name='supported-color-schemes' content='light dark' />
                           <title></title>
                           <style type='text/css' rel='stylesheet' media='all'>
                              @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                              body {
                              width: 100% !important;
                              height: 100%;
                              margin: 0;
                              -webkit-text-size-adjust: none;
                              }
                              a {
                              color: #3869D4;
                              }
                              a img {
                              border: none;
                              }
                              td {
                              word-break: break-word;
                              }
                              .preheader {
                              display: none !important;
                              visibility: hidden;
                              mso-hide: all;
                              font-size: 1px;
                              line-height: 1px;
                              max-height: 0;
                              max-width: 0;
                              opacity: 0;
                              overflow: hidden;
                              }
                              body,
                              td,
                              th {
                              font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                              }
                              h1 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 22px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h2 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 16px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h3 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 14px;
                              font-weight: bold;
                              text-align: left;
                              }
                              td,
                              th {
                              font-size: 16px;
                              }
                              p,
                              ul,
                              ol,
                              blockquote {
                              margin: .4em 0 1.1875em;
                              font-size: 16px;
                              line-height: 1.625;
                              }
                              p.sub {
                              font-size: 13px;
                              }
                              .align-right {
                              text-align: right;
                              }
                              .align-left {
                              text-align: left;
                              }
                              .align-center {
                              text-align: center;
                              }
                              .u-margin-bottom-none {
                              margin-bottom: 0;
                              }
                              .button {
                              background-color: #3869D4;
                              border-top: 10px solid #3869D4;
                              border-right: 18px solid #3869D4;
                              border-bottom: 10px solid #3869D4;
                              border-left: 18px solid #3869D4;
                              display: inline-block;
                              color: #FFF;
                              text-decoration: none;
                              border-radius: 3px;
                              box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                              -webkit-text-size-adjust: none;
                              box-sizing: border-box;
                              }
                              .button--green {
                              background-color: #22BC66;
                              border-top: 10px solid #22BC66;
                              border-right: 18px solid #22BC66;
                              border-bottom: 10px solid #22BC66;
                              border-left: 18px solid #22BC66;
                              }
                              .button--red {
                              background-color: #FF6136;
                              border-top: 10px solid #FF6136;
                              border-right: 18px solid #FF6136;
                              border-bottom: 10px solid #FF6136;
                              border-left: 18px solid #FF6136;
                              }
                              @media only screen and (max-width: 500px) {
                              .button {
                              width: 100% !important;
                              text-align: center !important;
                              }
                              }
                              .attributes {
                              margin: 0 0 21px;
                              }
                              .attributes_content {
                              background-color: #F4F4F7;
                              padding: 16px;
                              }
                              .attributes_item {
                              padding: 0;
                              }
                              .related {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .related_item {
                              padding: 10px 0;
                              color: #CBCCCF;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .related_item-title {
                              display: block;
                              margin: .5em 0 0;
                              }
                              .related_item-thumb {
                              display: block;
                              padding-bottom: 10px;
                              }
                              .related_heading {
                              border-top: 1px solid #CBCCCF;
                              text-align: center;
                              padding: 25px 0 10px;
                              }
                              .discount {
                              width: 100%;
                              margin: 0;
                              padding: 24px;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F4F4F7;
                              border: 2px dashed #CBCCCF;
                              }
                              .discount_heading {
                              text-align: center;
                              }
                              .discount_body {
                              text-align: center;
                              font-size: 15px;
                              }
                              .social {
                              width: auto;
                              }
                              .social td {
                              padding: 0;
                              width: auto;
                              }
                              .social_icon {
                              height: 20px;
                              margin: 0 8px 10px 8px;
                              padding: 0;
                              }
                              .purchase {
                              width: 100%;
                              margin: 0;
                              padding: 35px 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_content {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_item {
                              padding: 10px 0;
                              color: #51545E;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .purchase_heading {
                              padding-bottom: 8px;
                              border-bottom: 1px solid #EAEAEC;
                              }
                              .purchase_heading p {
                              margin: 0;
                              color: #85878E;
                              font-size: 12px;
                              }
                              .purchase_footer {
                              padding-top: 15px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .purchase_total {
                              margin: 0;
                              text-align: right;
                              font-weight: bold;
                              color: #333333;
                              }
                              .purchase_total--label {
                              padding: 0 15px 0 0;
                              }
                              body {
                              background-color: #F2F4F6;
                              color: #51545E;
                              }
                              p {
                              color: #51545E;
                              }
                              .email-wrapper {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F2F4F6;
                              }
                              .email-content {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-masthead {
                              padding: 25px 0;
                              text-align: center;
                              }
                              .email-masthead_logo {
                              width: 94px;
                              }
                              .email-masthead_name {
                              font-size: 16px;
                              font-weight: bold;
                              color: #A8AAAF;
                              text-decoration: none;
                              text-shadow: 0 1px 0 white;
                              }
                              .email-body {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-body_inner {
                              width: 570px;
                              margin: 20px auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #FFFFFF;
                              }
                              .email-footer {
                              width: 570px;
                              margin: 0 auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .email-footer p {
                              color: #A8AAAF;
                              }
                              .body-action {
                              width: 100%;
                              margin: 30px auto;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .body-sub {
                              margin-top: 25px;
                              padding-top: 25px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .content-cell {
                              padding: 45px;
                              }
                              @media only screen and (max-width: 600px) {
                              .email-body_inner,
                              .email-footer {
                              width: 100% !important;
                              }
                              }
                              @media (prefers-color-scheme: dark) {
                              body,
                              .email-body,
                              .email-body_inner,
                              .email-content,
                              .email-wrapper,
                              .email-masthead,
                              .email-footer {
                              background-color: #333333 !important;
                              color: #FFF !important;
                              }
                              p,
                              ul,
                              ol,
                              blockquote,
                              h1,
                              h2,
                              h3,
                              span,
                              .purchase_item {
                              color: #FFF !important;
                              }
                              .attributes_content,
                              .discount {
                              background-color: #222 !important;
                              }
                              .email-masthead_name {
                              text-shadow: none !important;
                              }
                              }
                              :root {
                              color-scheme: light dark;
                              supported-color-schemes: light dark;
                              }
                           </style>
                        </head>
                        <body>
                           <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>                        
                              <tr>
                                 <td align='center'>
                                    <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                       <tr>
                                          <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                             <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                                <tr>
                                                   <td>
                                                      <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                          <div style='float: left;'>
                                                             <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                          </div>
                                                          <div style='float: right;'>
                                                             <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                          </div>
                                                       </div>
                                                   </td>
                                                </tr>
                                                <tr>
                                                   <td class='content-cell'>
                                                      <div class='f-fallback'>
                                                         <h1>Dear $username!,</h1>
                                                         <p>
                                                            Your payment of Rupees  $amountinword only (Rs. $amount/-) paid vide $mailmsg has been received towards payment for the Program <b>$coursename </b>
                                                         </p>                                                      
                                                         <table class='body-sub' role='presentation'>
                                                            <tr>
                                                               <td>
                                                                  <p class='f-fallback'>Best Wishes,</p>
                                                                  <p class='f-fallback'>Team Bake Better</p>
                                                               </td>
                                                            </tr>
                                                         </table>
                                                      </div>
                                                   </td>
                                                </tr>
                                             </table>
                                          </td>
                                       </tr>
                                       
                                    </table>
                                 </td>
                              </tr>
                           </table>
                        </body>
                      </html>";
                  $mail2 = $function->sendMail2($to=$to,$subject=$subject2,$messagebody=$messagebody2);
               }
            }
         } else { 
            //echo "without gst"; //exit;
            $sql2 = "INSERT INTO `tn_order` SET studentId='".$insert_sid."',courseId='".$courseName."',totalFee='".$oneTimePayment."', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', batchMonth='".$batchMonth."', batchYear='".$batchYear."', batchTiming='".$batchTiming."', isdiscount='".$isdiscount."', course_discount_rate='".$course_discount_rate."', count='".$count."', startDate='".$from_date."', endDate='".$to_date."', centrename='".$_SESSION['admin_centrename']."'";
            $result2 = $pdodb->query($sql2);
            $insert_oid = $pdodb->lastInsertId();

            $sql3 = "INSERT INTO `tn_invoice` SET amount='".$oneTimePayment."',  orderId='".$insert_oid."', studentName='".$username."', uId='".$insert_sid."', studentAddress='".$studentAddress."', studentState='".$state."', isGst='2', centrename='".$_SESSION['admin_centrename']."'";
            $result3 = $pdodb->query($sql3);
            $insert_invoice = $pdodb->lastInsertId();
            $invoiceNo = "TFN/COM/2024/00".$insert_invoice;
            $Rcpt_id = "RCPT/COM/2024/00".$insert_invoice;

            $sqlupt = "UPDATE `tn_invoice` SET invoiceNo='".$invoiceNo."', isPayment='2' WHERE id = '".$insert_invoice."'";
            $resultupt = $pdodb->query($sqlupt);

            $data = $_POST['courseName'];
            foreach ($data as $course) {               
                $coursedata = $function->getCourse($id=$course,$isActive=1,$orderBy='ASC');
                $cprice = $coursedata[0]['coursePrice'];

                // Apply discount based on discount type
                if ($isdiscount == 2) {
                    // Percentage discount
                    $discountedPrice = $cprice - ($cprice * ($course_discount_rate / 100));

                } elseif ($isdiscount == 3) {
                    // Flat discount
                    $discountedPrice = $cprice - ($course_discount_rate / $count);
                } else {
                    // No discount
                    $discountedPrice = $cprice;
                }

                // Calculate GST
                $gstAmount = $discountedPrice * 0.18;
                
                // Add GST to discounted price
                $finalPrice = $discountedPrice + $gstAmount;

                $sqlitem = "INSERT INTO `tn_orderitem` SET studentId='".$insert_sid."', courseid='".$course."', courseprice='".$finalPrice."', orderid='".$insert_oid."', centrename='".$_SESSION['admin_centrename']."'";
                $resultitem = $pdodb->query($sqlitem);
            }

            $array = explode(",", $courseName);

            $courselist = $function->getCourse($id=NULL,$isActive=1,$orderBy='ASC');
            $courseNames = array(); // Initialize an array to store course names
            for ($k = 0; $k < count($courselist); $k++) {
                 $courseid = $courselist[$k]['id'];
                 if (in_array($courseid, $array)) {
                     $courseNames[] = $courselist[$k]['courseName']; // Add course name to the array
                 }
            }
            $coursename = implode(', ', $courseNames); // Convert array to comma-separated string
            //echo $courseName;

            if ($result2 == true && $result3 == true && $resultupt == true) {
               $sql4 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', demand_id='".$insert_oid."', debit='".$oneTimePayment."', particular='Invoice generated', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result4 = $pdodb->query($sql4);

               $sql5 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."',orderid='".$insert_oid."',transaction_id='".$transaction_id."', credit='".$oneTimePayment."', particular='".$particular."', paymentMode='".$paymentMode."', bankname='".$bankname."', chequeno='".$chequeno."', invoice='".$invoiceNo."', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result5 = $pdodb->query($sql5);
               if ($result5 == true) {
                  $error_msg = "Registration Successfully Done";
                  //email send
                  $to = $uemail;
                  $subject = "Registration Successfully Completed ";
                  $messagebody = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                   <html xmlns='http://www.w3.org/1999/xhtml'>
                     <head>
                        <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                        <meta name='x-apple-disable-message-reformatting' />
                        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                        <meta name='color-scheme' content='light dark' />
                        <meta name='supported-color-schemes' content='light dark' />
                        <title></title>
                        <style type='text/css' rel='stylesheet' media='all'>
                           @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                           body {
                           width: 100% !important;
                           height: 100%;
                           margin: 0;
                           -webkit-text-size-adjust: none;
                           }
                           a {
                           color: #3869D4;
                           }
                           a img {
                           border: none;
                           }
                           td {
                           word-break: break-word;
                           }
                           .preheader {
                           display: none !important;
                           visibility: hidden;
                           mso-hide: all;
                           font-size: 1px;
                           line-height: 1px;
                           max-height: 0;
                           max-width: 0;
                           opacity: 0;
                           overflow: hidden;
                           }
                           body,
                           td,
                           th {
                           font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                           }
                           h1 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 22px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h2 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 16px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h3 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 14px;
                           font-weight: bold;
                           text-align: left;
                           }
                           td,
                           th {
                           font-size: 16px;
                           }
                           p,
                           ul,
                           ol,
                           blockquote {
                           margin: .4em 0 1.1875em;
                           font-size: 16px;
                           line-height: 1.625;
                           }
                           p.sub {
                           font-size: 13px;
                           }
                           .align-right {
                           text-align: right;
                           }
                           .align-left {
                           text-align: left;
                           }
                           .align-center {
                           text-align: center;
                           }
                           .u-margin-bottom-none {
                           margin-bottom: 0;
                           }
                           .button {
                           background-color: #3869D4;
                           border-top: 10px solid #3869D4;
                           border-right: 18px solid #3869D4;
                           border-bottom: 10px solid #3869D4;
                           border-left: 18px solid #3869D4;
                           display: inline-block;
                           color: #FFF;
                           text-decoration: none;
                           border-radius: 3px;
                           box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                           -webkit-text-size-adjust: none;
                           box-sizing: border-box;
                           }
                           .button--green {
                           background-color: #22BC66;
                           border-top: 10px solid #22BC66;
                           border-right: 18px solid #22BC66;
                           border-bottom: 10px solid #22BC66;
                           border-left: 18px solid #22BC66;
                           }
                           .button--red {
                           background-color: #FF6136;
                           border-top: 10px solid #FF6136;
                           border-right: 18px solid #FF6136;
                           border-bottom: 10px solid #FF6136;
                           border-left: 18px solid #FF6136;
                           }
                           @media only screen and (max-width: 500px) {
                           .button {
                           width: 100% !important;
                           text-align: center !important;
                           }
                           }
                           .attributes {
                           margin: 0 0 21px;
                           }
                           .attributes_content {
                           background-color: #F4F4F7;
                           padding: 16px;
                           }
                           .attributes_item {
                           padding: 0;
                           }
                           .related {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .related_item {
                           padding: 10px 0;
                           color: #CBCCCF;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .related_item-title {
                           display: block;
                           margin: .5em 0 0;
                           }
                           .related_item-thumb {
                           display: block;
                           padding-bottom: 10px;
                           }
                           .related_heading {
                           border-top: 1px solid #CBCCCF;
                           text-align: center;
                           padding: 25px 0 10px;
                           }
                           .discount {
                           width: 100%;
                           margin: 0;
                           padding: 24px;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F4F4F7;
                           border: 2px dashed #CBCCCF;
                           }
                           .discount_heading {
                           text-align: center;
                           }
                           .discount_body {
                           text-align: center;
                           font-size: 15px;
                           }
                           .social {
                           width: auto;
                           }
                           .social td {
                           padding: 0;
                           width: auto;
                           }
                           .social_icon {
                           height: 20px;
                           margin: 0 8px 10px 8px;
                           padding: 0;
                           }
                           .purchase {
                           width: 100%;
                           margin: 0;
                           padding: 35px 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_content {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_item {
                           padding: 10px 0;
                           color: #51545E;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .purchase_heading {
                           padding-bottom: 8px;
                           border-bottom: 1px solid #EAEAEC;
                           }
                           .purchase_heading p {
                           margin: 0;
                           color: #85878E;
                           font-size: 12px;
                           }
                           .purchase_footer {
                           padding-top: 15px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .purchase_total {
                           margin: 0;
                           text-align: right;
                           font-weight: bold;
                           color: #333333;
                           }
                           .purchase_total--label {
                           padding: 0 15px 0 0;
                           }
                           body {
                           background-color: #F2F4F6;
                           color: #51545E;
                           }
                           p {
                           color: #51545E;
                           }
                           .email-wrapper {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F2F4F6;
                           }
                           .email-content {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-masthead {
                           padding: 25px 0;
                           text-align: center;
                           }
                           .email-masthead_logo {
                           width: 94px;
                           }
                           .email-masthead_name {
                           font-size: 16px;
                           font-weight: bold;
                           color: #A8AAAF;
                           text-decoration: none;
                           text-shadow: 0 1px 0 white;
                           }
                           .email-body {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-body_inner {
                           width: 570px;
                           margin: 20px auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #FFFFFF;
                           }
                           .email-footer {
                           width: 570px;
                           margin: 0 auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .email-footer p {
                           color: #A8AAAF;
                           }
                           .body-action {
                           width: 100%;
                           margin: 30px auto;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .body-sub {
                           margin-top: 25px;
                           padding-top: 25px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .content-cell {
                           padding: 45px;
                           }
                           @media only screen and (max-width: 600px) {
                           .email-body_inner,
                           .email-footer {
                           width: 100% !important;
                           }
                           }
                           @media (prefers-color-scheme: dark) {
                           body,
                           .email-body,
                           .email-body_inner,
                           .email-content,
                           .email-wrapper,
                           .email-masthead,
                           .email-footer {
                           background-color: #333333 !important;
                           color: #FFF !important;
                           }
                           p,
                           ul,
                           ol,
                           blockquote,
                           h1,
                           h2,
                           h3,
                           span,
                           .purchase_item {
                           color: #FFF !important;
                           }
                           .attributes_content,
                           .discount {
                           background-color: #222 !important;
                           }
                           .email-masthead_name {
                           text-shadow: none !important;
                           }
                           }
                           :root {
                           color-scheme: light dark;
                           supported-color-schemes: light dark;
                           }
                        </style>
                     </head>
                     <body>
                        <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                           <tr>
                              <td align='center'>
                                 <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                    <tr>
                                       <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                          <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                             <tr>
                                                <td>
                                                   <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                       <div style='float: left;'>
                                                          <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                       </div>
                                                       <div style='float: right;'>
                                                          <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                       </div>
                                                    </div>
                                                </td>
                                             </tr>
                                             <tr>
                                                <td class='content-cell'>
                                                   <div class='f-fallback'>
                                                      <h1>Dear $username!,</h1>
                                                      <p>
                                                         Welcome aboard Bake Better, the premier baking school of India.<br>
                                                         You have been registered as a student with Bake Better.<br>
                                                         You can log into your student account with your registered email id as login id
                                                         and your registered mobile no as password.<br>
                                                         Together, let us turn your passion for baking into a career.
                                                      </p>
                                                      <table class='body-action' align='center' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                                        <tr>
                                                           <td align='center'>
                                                              <table width='100%' border='0' cellspacing='0' cellpadding='0' role='presentation'>
                                                                 <tr>
                                                                    <td align='center'>
                                                                       <a href='https://www.trufflenation.questend.com' class='f-fallback button' target='_blank'>Login</a>
                                                                    </td>
                                                                 </tr>
                                                              </table>
                                                           </td>
                                                        </tr>
                                                      </table> 
                                                      <table class='body-sub' role='presentation'>
                                                         <tr>
                                                            <td>
                                                               <p class='f-fallback'>Best Wishes,</p>
                                                               <p class='f-fallback'>Team Bake Better</p>
                                                            </td>
                                                         </tr>
                                                      </table>
                                                   </div>
                                                </td>
                                             </tr>
                                          </table>
                                       </td>
                                    </tr>
                                    
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </body>
                   </html>";
                  $mail = $function->sendMail2($to=$to,$subject=$subject,$messagebody=$messagebody);

                  //payment email
                  $subject2 = "Payment Successfully Completed";
                  $messagebody2 = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                      <html xmlns='http://www.w3.org/1999/xhtml'>
                        <head>
                           <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                           <meta name='x-apple-disable-message-reformatting' />
                           <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                           <meta name='color-scheme' content='light dark' />
                           <meta name='supported-color-schemes' content='light dark' />
                           <title></title>
                           <style type='text/css' rel='stylesheet' media='all'>
                              @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                              body {
                              width: 100% !important;
                              height: 100%;
                              margin: 0;
                              -webkit-text-size-adjust: none;
                              }
                              a {
                              color: #3869D4;
                              }
                              a img {
                              border: none;
                              }
                              td {
                              word-break: break-word;
                              }
                              .preheader {
                              display: none !important;
                              visibility: hidden;
                              mso-hide: all;
                              font-size: 1px;
                              line-height: 1px;
                              max-height: 0;
                              max-width: 0;
                              opacity: 0;
                              overflow: hidden;
                              }
                              body,
                              td,
                              th {
                              font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                              }
                              h1 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 22px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h2 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 16px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h3 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 14px;
                              font-weight: bold;
                              text-align: left;
                              }
                              td,
                              th {
                              font-size: 16px;
                              }
                              p,
                              ul,
                              ol,
                              blockquote {
                              margin: .4em 0 1.1875em;
                              font-size: 16px;
                              line-height: 1.625;
                              }
                              p.sub {
                              font-size: 13px;
                              }
                              .align-right {
                              text-align: right;
                              }
                              .align-left {
                              text-align: left;
                              }
                              .align-center {
                              text-align: center;
                              }
                              .u-margin-bottom-none {
                              margin-bottom: 0;
                              }
                              .button {
                              background-color: #3869D4;
                              border-top: 10px solid #3869D4;
                              border-right: 18px solid #3869D4;
                              border-bottom: 10px solid #3869D4;
                              border-left: 18px solid #3869D4;
                              display: inline-block;
                              color: #FFF;
                              text-decoration: none;
                              border-radius: 3px;
                              box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                              -webkit-text-size-adjust: none;
                              box-sizing: border-box;
                              }
                              .button--green {
                              background-color: #22BC66;
                              border-top: 10px solid #22BC66;
                              border-right: 18px solid #22BC66;
                              border-bottom: 10px solid #22BC66;
                              border-left: 18px solid #22BC66;
                              }
                              .button--red {
                              background-color: #FF6136;
                              border-top: 10px solid #FF6136;
                              border-right: 18px solid #FF6136;
                              border-bottom: 10px solid #FF6136;
                              border-left: 18px solid #FF6136;
                              }
                              @media only screen and (max-width: 500px) {
                              .button {
                              width: 100% !important;
                              text-align: center !important;
                              }
                              }
                              .attributes {
                              margin: 0 0 21px;
                              }
                              .attributes_content {
                              background-color: #F4F4F7;
                              padding: 16px;
                              }
                              .attributes_item {
                              padding: 0;
                              }
                              .related {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .related_item {
                              padding: 10px 0;
                              color: #CBCCCF;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .related_item-title {
                              display: block;
                              margin: .5em 0 0;
                              }
                              .related_item-thumb {
                              display: block;
                              padding-bottom: 10px;
                              }
                              .related_heading {
                              border-top: 1px solid #CBCCCF;
                              text-align: center;
                              padding: 25px 0 10px;
                              }
                              .discount {
                              width: 100%;
                              margin: 0;
                              padding: 24px;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F4F4F7;
                              border: 2px dashed #CBCCCF;
                              }
                              .discount_heading {
                              text-align: center;
                              }
                              .discount_body {
                              text-align: center;
                              font-size: 15px;
                              }
                              .social {
                              width: auto;
                              }
                              .social td {
                              padding: 0;
                              width: auto;
                              }
                              .social_icon {
                              height: 20px;
                              margin: 0 8px 10px 8px;
                              padding: 0;
                              }
                              .purchase {
                              width: 100%;
                              margin: 0;
                              padding: 35px 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_content {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_item {
                              padding: 10px 0;
                              color: #51545E;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .purchase_heading {
                              padding-bottom: 8px;
                              border-bottom: 1px solid #EAEAEC;
                              }
                              .purchase_heading p {
                              margin: 0;
                              color: #85878E;
                              font-size: 12px;
                              }
                              .purchase_footer {
                              padding-top: 15px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .purchase_total {
                              margin: 0;
                              text-align: right;
                              font-weight: bold;
                              color: #333333;
                              }
                              .purchase_total--label {
                              padding: 0 15px 0 0;
                              }
                              body {
                              background-color: #F2F4F6;
                              color: #51545E;
                              }
                              p {
                              color: #51545E;
                              }
                              .email-wrapper {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F2F4F6;
                              }
                              .email-content {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-masthead {
                              padding: 25px 0;
                              text-align: center;
                              }
                              .email-masthead_logo {
                              width: 94px;
                              }
                              .email-masthead_name {
                              font-size: 16px;
                              font-weight: bold;
                              color: #A8AAAF;
                              text-decoration: none;
                              text-shadow: 0 1px 0 white;
                              }
                              .email-body {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-body_inner {
                              width: 570px;
                              margin: 20px auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #FFFFFF;
                              }
                              .email-footer {
                              width: 570px;
                              margin: 0 auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .email-footer p {
                              color: #A8AAAF;
                              }
                              .body-action {
                              width: 100%;
                              margin: 30px auto;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .body-sub {
                              margin-top: 25px;
                              padding-top: 25px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .content-cell {
                              padding: 45px;
                              }
                              @media only screen and (max-width: 600px) {
                              .email-body_inner,
                              .email-footer {
                              width: 100% !important;
                              }
                              }
                              @media (prefers-color-scheme: dark) {
                              body,
                              .email-body,
                              .email-body_inner,
                              .email-content,
                              .email-wrapper,
                              .email-masthead,
                              .email-footer {
                              background-color: #333333 !important;
                              color: #FFF !important;
                              }
                              p,
                              ul,
                              ol,
                              blockquote,
                              h1,
                              h2,
                              h3,
                              span,
                              .purchase_item {
                              color: #FFF !important;
                              }
                              .attributes_content,
                              .discount {
                              background-color: #222 !important;
                              }
                              .email-masthead_name {
                              text-shadow: none !important;
                              }
                              }
                              :root {
                              color-scheme: light dark;
                              supported-color-schemes: light dark;
                              }
                           </style>
                        </head>
                        <body>
                           <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>                        
                              <tr>
                                 <td align='center'>
                                    <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                       <tr>
                                          <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                             <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                                <tr>
                                                   <td>
                                                      <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                          <div style='float: left;'>
                                                             <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                          </div>
                                                          <div style='float: right;'>
                                                             <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                          </div>
                                                       </div>
                                                   </td>
                                                </tr>
                                                <tr>
                                                   <td class='content-cell'>
                                                      <div class='f-fallback'>
                                                         <h1>Dear $username!,</h1>
                                                         <p>
                                                            Your payment of Rupees  $amountinword only (Rs. $amount/-) paid vide $mailmsg has been received towards payment for the Program <b>$coursename </b>
                                                         </p>                                                      
                                                         <table class='body-sub' role='presentation'>
                                                            <tr>
                                                               <td>
                                                                  <p class='f-fallback'>Best Wishes,</p>
                                                                  <p class='f-fallback'>Team Bake Better</p>
                                                               </td>
                                                            </tr>
                                                         </table>
                                                      </div>
                                                   </td>
                                                </tr>
                                             </table>
                                          </td>
                                       </tr>
                                       
                                    </table>
                                 </td>
                              </tr>
                           </table>
                        </body>
                      </html>";
                  $mail2 = $function->sendMail2($to=$to,$subject=$subject2,$messagebody=$messagebody2);
               }
            }
         }
      } elseif (!empty($downPayment)) {
         //echo "downPayment "; exit;
         $amount=$downPayment;
         $amountinword = $function->numbertoWords($number=$downPayment);
         if (!empty($gstNo)) {
            //echo "with gst"; exit;
            $sql2 = "INSERT INTO `tn_order` SET studentId='".$insert_sid."',courseId='".$courseName."', nosofInstallment='".$installmentOptions."', isInstallment='1',totalFee='".$totalPayableFee."',downPayment='".$downPayment."', balanceFee='".$balanceFee."', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', batchMonth='".$batchMonth."', batchYear='".$batchYear."', batchTiming='".$batchTiming."', isdiscount='".$isdiscount."', course_discount_rate='".$course_discount_rate."', count='".$count."', startDate='".$from_date."', endDate='".$to_date."', centrename='".$_SESSION['admin_centrename']."'";

            $result2 = $pdodb->query($sql2);
            $insert_oid = $pdodb->lastInsertId();

            $sql3 = "INSERT INTO `tn_invoice` SET amount='".$downPayment."', orderId='".$insert_oid."', gstNo='".$gstNo."', uId='".$insert_sid."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', isGst='1', centrename='".$_SESSION['admin_centrename']."'";
            $result3 = $pdodb->query($sql3);
            $insert_invoice = $pdodb->lastInsertId();
            $invoiceNo = "TFN/COM/2024/00".$insert_invoice;
            $Rcpt_id = "RCPT/COM/2024/00".$insert_invoice;

            $sqlupt = "UPDATE `tn_invoice`  SET invoiceNo='".$invoiceNo."', isPayment='2' WHERE id = '".$insert_invoice."'";
            $resultupt = $pdodb->query($sqlupt);

            if ($result2 == true && $result3 == true && $resultupt == true) {
               $sql4 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', demand_id='".$insert_oid."', debit='".$downPayment."', particular='Invoice generated', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result4 = $pdodb->query($sql4);

               $sql5 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."',orderid='".$insert_oid."',transaction_id='".$transaction_id."', credit='".$downPayment."', particular='".$particular."', paymentMode='".$paymentMode."', bankname='".$bankname."', chequeno='".$chequeno."', invoice='".$invoiceNo."', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result5 = $pdodb->query($sql5);

               $installmentOption =$_POST;

               if(!empty($installmentOption['installmentdate'])){
                   $j = 1;
                 for ($i=0; $i < sizeof($installmentOption['installmentdate']); $i++) { 
                   $installmentdate= $installmentOption['installmentdate'][$i];
                   $installmentamount= $installmentOption['installmentamount'][$i];
                  
                   $pdodb = PDODB::getInstance();
                   $sqlinstlmnt = "INSERT INTO `tn_installments` SET uId='".$insert_sid."',orderId='".$insert_oid."',amount='".$installmentamount."',dueDate='".$installmentdate."', centrename='".$_SESSION['admin_centrename']."'";
                   $resultinstlmnt = $pdodb->query($sqlinstlmnt);
                   $insert_instlmnt = $pdodb->lastInsertId();
                   //echo $result; exit;
                   
                   $sqlinstlmnt2 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', installmentId='".$insert_instlmnt."', demand_id='".$insert_oid."', debit='".$installmentamount."', particular='".$j." Installment', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', date='".$installmentdate."', centrename='".$_SESSION['admin_centrename']."'";
                   //echo $sql2; exit;
                   $resultinstlmnt2 = $pdodb->query($sqlinstlmnt2);
                   $j++;
                 }
               }

               $data = $_POST['courseName'];
               foreach ($data as $course) {               
                   $coursedata = $function->getCourse($id=$course,$isActive=1,$orderBy='ASC');
                   $cprice = $coursedata[0]['coursePrice'];

                   // Apply discount based on discount type
                   if ($isdiscount == 2) {
                       // Percentage discount
                       $discountedPrice = $cprice - ($cprice * ($course_discount_rate / 100));

                   } elseif ($isdiscount == 3) {
                       // Flat discount
                       $discountedPrice = $cprice - ($course_discount_rate / $count);
                   } else {
                       // No discount
                       $discountedPrice = $cprice;
                   }

                   // Calculate GST
                   $gstAmount = $discountedPrice * 0.18;
                   
                   // Add GST to discounted price
                   $finalPrice = $discountedPrice + $gstAmount;

                   $sqlitem = "INSERT INTO `tn_orderitem` SET studentId='".$insert_sid."', courseid='".$course."', courseprice='".$finalPrice."', orderid='".$insert_oid."', centrename='".$_SESSION['admin_centrename']."'";
                   $resultitem = $pdodb->query($sqlitem);
               }

               $array = explode(",", $courseName);

               $courselist = $function->getCourse($id=NULL,$isActive=1,$orderBy='ASC');
               $courseNames = array(); // Initialize an array to store course names
               for ($k = 0; $k < count($courselist); $k++) {
                    $courseid = $courselist[$k]['id'];
                    if (in_array($courseid, $array)) {
                        $courseNames[] = $courselist[$k]['courseName']; // Add course name to the array
                    }
               }
               $coursename = implode(', ', $courseNames); // Convert array to comma-separated string
               //echo $courseName;

               if ($result5 == true && $resultinstlmnt2 == true) {
                  $error_msg = "Registration Successfully Done";
                  //email send
                  $to = $uemail;
                  $subject = "Registration Successfully Completed ";
                  $messagebody = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                   <html xmlns='http://www.w3.org/1999/xhtml'>
                     <head>
                        <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                        <meta name='x-apple-disable-message-reformatting' />
                        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                        <meta name='color-scheme' content='light dark' />
                        <meta name='supported-color-schemes' content='light dark' />
                        <title></title>
                        <style type='text/css' rel='stylesheet' media='all'>
                           @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                           body {
                           width: 100% !important;
                           height: 100%;
                           margin: 0;
                           -webkit-text-size-adjust: none;
                           }
                           a {
                           color: #3869D4;
                           }
                           a img {
                           border: none;
                           }
                           td {
                           word-break: break-word;
                           }
                           .preheader {
                           display: none !important;
                           visibility: hidden;
                           mso-hide: all;
                           font-size: 1px;
                           line-height: 1px;
                           max-height: 0;
                           max-width: 0;
                           opacity: 0;
                           overflow: hidden;
                           }
                           body,
                           td,
                           th {
                           font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                           }
                           h1 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 22px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h2 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 16px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h3 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 14px;
                           font-weight: bold;
                           text-align: left;
                           }
                           td,
                           th {
                           font-size: 16px;
                           }
                           p,
                           ul,
                           ol,
                           blockquote {
                           margin: .4em 0 1.1875em;
                           font-size: 16px;
                           line-height: 1.625;
                           }
                           p.sub {
                           font-size: 13px;
                           }
                           .align-right {
                           text-align: right;
                           }
                           .align-left {
                           text-align: left;
                           }
                           .align-center {
                           text-align: center;
                           }
                           .u-margin-bottom-none {
                           margin-bottom: 0;
                           }
                           .button {
                           background-color: #3869D4;
                           border-top: 10px solid #3869D4;
                           border-right: 18px solid #3869D4;
                           border-bottom: 10px solid #3869D4;
                           border-left: 18px solid #3869D4;
                           display: inline-block;
                           color: #FFF;
                           text-decoration: none;
                           border-radius: 3px;
                           box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                           -webkit-text-size-adjust: none;
                           box-sizing: border-box;
                           }
                           .button--green {
                           background-color: #22BC66;
                           border-top: 10px solid #22BC66;
                           border-right: 18px solid #22BC66;
                           border-bottom: 10px solid #22BC66;
                           border-left: 18px solid #22BC66;
                           }
                           .button--red {
                           background-color: #FF6136;
                           border-top: 10px solid #FF6136;
                           border-right: 18px solid #FF6136;
                           border-bottom: 10px solid #FF6136;
                           border-left: 18px solid #FF6136;
                           }
                           @media only screen and (max-width: 500px) {
                           .button {
                           width: 100% !important;
                           text-align: center !important;
                           }
                           }
                           .attributes {
                           margin: 0 0 21px;
                           }
                           .attributes_content {
                           background-color: #F4F4F7;
                           padding: 16px;
                           }
                           .attributes_item {
                           padding: 0;
                           }
                           .related {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .related_item {
                           padding: 10px 0;
                           color: #CBCCCF;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .related_item-title {
                           display: block;
                           margin: .5em 0 0;
                           }
                           .related_item-thumb {
                           display: block;
                           padding-bottom: 10px;
                           }
                           .related_heading {
                           border-top: 1px solid #CBCCCF;
                           text-align: center;
                           padding: 25px 0 10px;
                           }
                           .discount {
                           width: 100%;
                           margin: 0;
                           padding: 24px;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F4F4F7;
                           border: 2px dashed #CBCCCF;
                           }
                           .discount_heading {
                           text-align: center;
                           }
                           .discount_body {
                           text-align: center;
                           font-size: 15px;
                           }
                           .social {
                           width: auto;
                           }
                           .social td {
                           padding: 0;
                           width: auto;
                           }
                           .social_icon {
                           height: 20px;
                           margin: 0 8px 10px 8px;
                           padding: 0;
                           }
                           .purchase {
                           width: 100%;
                           margin: 0;
                           padding: 35px 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_content {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_item {
                           padding: 10px 0;
                           color: #51545E;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .purchase_heading {
                           padding-bottom: 8px;
                           border-bottom: 1px solid #EAEAEC;
                           }
                           .purchase_heading p {
                           margin: 0;
                           color: #85878E;
                           font-size: 12px;
                           }
                           .purchase_footer {
                           padding-top: 15px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .purchase_total {
                           margin: 0;
                           text-align: right;
                           font-weight: bold;
                           color: #333333;
                           }
                           .purchase_total--label {
                           padding: 0 15px 0 0;
                           }
                           body {
                           background-color: #F2F4F6;
                           color: #51545E;
                           }
                           p {
                           color: #51545E;
                           }
                           .email-wrapper {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F2F4F6;
                           }
                           .email-content {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-masthead {
                           padding: 25px 0;
                           text-align: center;
                           }
                           .email-masthead_logo {
                           width: 94px;
                           }
                           .email-masthead_name {
                           font-size: 16px;
                           font-weight: bold;
                           color: #A8AAAF;
                           text-decoration: none;
                           text-shadow: 0 1px 0 white;
                           }
                           .email-body {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-body_inner {
                           width: 570px;
                           margin: 20px auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #FFFFFF;
                           }
                           .email-footer {
                           width: 570px;
                           margin: 0 auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .email-footer p {
                           color: #A8AAAF;
                           }
                           .body-action {
                           width: 100%;
                           margin: 30px auto;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .body-sub {
                           margin-top: 25px;
                           padding-top: 25px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .content-cell {
                           padding: 45px;
                           }
                           @media only screen and (max-width: 600px) {
                           .email-body_inner,
                           .email-footer {
                           width: 100% !important;
                           }
                           }
                           @media (prefers-color-scheme: dark) {
                           body,
                           .email-body,
                           .email-body_inner,
                           .email-content,
                           .email-wrapper,
                           .email-masthead,
                           .email-footer {
                           background-color: #333333 !important;
                           color: #FFF !important;
                           }
                           p,
                           ul,
                           ol,
                           blockquote,
                           h1,
                           h2,
                           h3,
                           span,
                           .purchase_item {
                           color: #FFF !important;
                           }
                           .attributes_content,
                           .discount {
                           background-color: #222 !important;
                           }
                           .email-masthead_name {
                           text-shadow: none !important;
                           }
                           }
                           :root {
                           color-scheme: light dark;
                           supported-color-schemes: light dark;
                           }
                        </style>
                     </head>
                     <body>
                        <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                           <tr>
                              <td align='center'>
                                 <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                    <tr>
                                       <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                          <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                             <tr>
                                                <td>
                                                   <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                       <div style='float: left;'>
                                                          <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                       </div>
                                                       <div style='float: right;'>
                                                          <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                       </div>
                                                    </div>
                                                </td>
                                             </tr>
                                             <tr>
                                                <td class='content-cell'>
                                                   <div class='f-fallback'>
                                                      <h1>Dear $username!,</h1>
                                                      <p>
                                                         Welcome aboard Bake Better, the premier baking school of India.<br>
                                                         You have been registered as a student with Bake Better.<br>
                                                         You can log into your student account with your registered email id as login id
                                                         and your registered mobile no as password.<br>
                                                         Together, let us turn your passion for baking into a career.
                                                      </p>
                                                      <table class='body-action' align='center' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                                        <tr>
                                                           <td align='center'>
                                                              <table width='100%' border='0' cellspacing='0' cellpadding='0' role='presentation'>
                                                                 <tr>
                                                                    <td align='center'>
                                                                       <a href='https://www.trufflenation.questend.com' class='f-fallback button' target='_blank'>Login</a>
                                                                    </td>
                                                                 </tr>
                                                              </table>
                                                           </td>
                                                        </tr>
                                                      </table> 
                                                      <table class='body-sub' role='presentation'>
                                                         <tr>
                                                            <td>
                                                               <p class='f-fallback'>Best Wishes,</p>
                                                               <p class='f-fallback'>Team Bake Better</p>
                                                            </td>
                                                         </tr>
                                                      </table>
                                                   </div>
                                                </td>
                                             </tr>
                                          </table>
                                       </td>
                                    </tr>
                                    <tr>
                                       <td>
                                          <table class='email-footer' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                             <tr>
                                                <td class='content-cell' align='center'>
                                                   <p class='f-fallback sub align-center'>
                                                      [Company Name, LLC]
                                                      <br>1234 Street Rd.
                                                      <br>Suite 1234
                                                   </p>
                                                </td>
                                             </tr>
                                          </table>
                                       </td>
                                    </tr>
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </body>
                   </html>";
                  $mail = $function->sendMail2($to=$to,$subject=$subject,$messagebody=$messagebody);

                  //payment email
                  $subject2 = "Payment Successfully Completed";
                  $messagebody2 = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                      <html xmlns='http://www.w3.org/1999/xhtml'>
                        <head>
                           <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                           <meta name='x-apple-disable-message-reformatting' />
                           <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                           <meta name='color-scheme' content='light dark' />
                           <meta name='supported-color-schemes' content='light dark' />
                           <title></title>
                           <style type='text/css' rel='stylesheet' media='all'>
                              @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                              body {
                              width: 100% !important;
                              height: 100%;
                              margin: 0;
                              -webkit-text-size-adjust: none;
                              }
                              a {
                              color: #3869D4;
                              }
                              a img {
                              border: none;
                              }
                              td {
                              word-break: break-word;
                              }
                              .preheader {
                              display: none !important;
                              visibility: hidden;
                              mso-hide: all;
                              font-size: 1px;
                              line-height: 1px;
                              max-height: 0;
                              max-width: 0;
                              opacity: 0;
                              overflow: hidden;
                              }
                              body,
                              td,
                              th {
                              font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                              }
                              h1 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 22px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h2 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 16px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h3 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 14px;
                              font-weight: bold;
                              text-align: left;
                              }
                              td,
                              th {
                              font-size: 16px;
                              }
                              p,
                              ul,
                              ol,
                              blockquote {
                              margin: .4em 0 1.1875em;
                              font-size: 16px;
                              line-height: 1.625;
                              }
                              p.sub {
                              font-size: 13px;
                              }
                              .align-right {
                              text-align: right;
                              }
                              .align-left {
                              text-align: left;
                              }
                              .align-center {
                              text-align: center;
                              }
                              .u-margin-bottom-none {
                              margin-bottom: 0;
                              }
                              .button {
                              background-color: #3869D4;
                              border-top: 10px solid #3869D4;
                              border-right: 18px solid #3869D4;
                              border-bottom: 10px solid #3869D4;
                              border-left: 18px solid #3869D4;
                              display: inline-block;
                              color: #FFF;
                              text-decoration: none;
                              border-radius: 3px;
                              box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                              -webkit-text-size-adjust: none;
                              box-sizing: border-box;
                              }
                              .button--green {
                              background-color: #22BC66;
                              border-top: 10px solid #22BC66;
                              border-right: 18px solid #22BC66;
                              border-bottom: 10px solid #22BC66;
                              border-left: 18px solid #22BC66;
                              }
                              .button--red {
                              background-color: #FF6136;
                              border-top: 10px solid #FF6136;
                              border-right: 18px solid #FF6136;
                              border-bottom: 10px solid #FF6136;
                              border-left: 18px solid #FF6136;
                              }
                              @media only screen and (max-width: 500px) {
                              .button {
                              width: 100% !important;
                              text-align: center !important;
                              }
                              }
                              .attributes {
                              margin: 0 0 21px;
                              }
                              .attributes_content {
                              background-color: #F4F4F7;
                              padding: 16px;
                              }
                              .attributes_item {
                              padding: 0;
                              }
                              .related {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .related_item {
                              padding: 10px 0;
                              color: #CBCCCF;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .related_item-title {
                              display: block;
                              margin: .5em 0 0;
                              }
                              .related_item-thumb {
                              display: block;
                              padding-bottom: 10px;
                              }
                              .related_heading {
                              border-top: 1px solid #CBCCCF;
                              text-align: center;
                              padding: 25px 0 10px;
                              }
                              .discount {
                              width: 100%;
                              margin: 0;
                              padding: 24px;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F4F4F7;
                              border: 2px dashed #CBCCCF;
                              }
                              .discount_heading {
                              text-align: center;
                              }
                              .discount_body {
                              text-align: center;
                              font-size: 15px;
                              }
                              .social {
                              width: auto;
                              }
                              .social td {
                              padding: 0;
                              width: auto;
                              }
                              .social_icon {
                              height: 20px;
                              margin: 0 8px 10px 8px;
                              padding: 0;
                              }
                              .purchase {
                              width: 100%;
                              margin: 0;
                              padding: 35px 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_content {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_item {
                              padding: 10px 0;
                              color: #51545E;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .purchase_heading {
                              padding-bottom: 8px;
                              border-bottom: 1px solid #EAEAEC;
                              }
                              .purchase_heading p {
                              margin: 0;
                              color: #85878E;
                              font-size: 12px;
                              }
                              .purchase_footer {
                              padding-top: 15px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .purchase_total {
                              margin: 0;
                              text-align: right;
                              font-weight: bold;
                              color: #333333;
                              }
                              .purchase_total--label {
                              padding: 0 15px 0 0;
                              }
                              body {
                              background-color: #F2F4F6;
                              color: #51545E;
                              }
                              p {
                              color: #51545E;
                              }
                              .email-wrapper {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F2F4F6;
                              }
                              .email-content {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-masthead {
                              padding: 25px 0;
                              text-align: center;
                              }
                              .email-masthead_logo {
                              width: 94px;
                              }
                              .email-masthead_name {
                              font-size: 16px;
                              font-weight: bold;
                              color: #A8AAAF;
                              text-decoration: none;
                              text-shadow: 0 1px 0 white;
                              }
                              .email-body {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-body_inner {
                              width: 570px;
                              margin: 20px auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #FFFFFF;
                              }
                              .email-footer {
                              width: 570px;
                              margin: 0 auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .email-footer p {
                              color: #A8AAAF;
                              }
                              .body-action {
                              width: 100%;
                              margin: 30px auto;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .body-sub {
                              margin-top: 25px;
                              padding-top: 25px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .content-cell {
                              padding: 45px;
                              }
                              @media only screen and (max-width: 600px) {
                              .email-body_inner,
                              .email-footer {
                              width: 100% !important;
                              }
                              }
                              @media (prefers-color-scheme: dark) {
                              body,
                              .email-body,
                              .email-body_inner,
                              .email-content,
                              .email-wrapper,
                              .email-masthead,
                              .email-footer {
                              background-color: #333333 !important;
                              color: #FFF !important;
                              }
                              p,
                              ul,
                              ol,
                              blockquote,
                              h1,
                              h2,
                              h3,
                              span,
                              .purchase_item {
                              color: #FFF !important;
                              }
                              .attributes_content,
                              .discount {
                              background-color: #222 !important;
                              }
                              .email-masthead_name {
                              text-shadow: none !important;
                              }
                              }
                              :root {
                              color-scheme: light dark;
                              supported-color-schemes: light dark;
                              }
                           </style>
                        </head>
                        <body>
                           <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>                        
                              <tr>
                                 <td align='center'>
                                    <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                       <tr>
                                          <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                             <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                                <tr>
                                                   <td>
                                                      <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                          <div style='float: left;'>
                                                             <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                          </div>
                                                          <div style='float: right;'>
                                                             <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                          </div>
                                                       </div>
                                                   </td>
                                                </tr>
                                                <tr>
                                                   <td class='content-cell'>
                                                      <div class='f-fallback'>
                                                         <h1>Dear $username!,</h1>
                                                         <p>
                                                            Your payment of Rupees  $amountinword only (Rs. $amount/-) paid vide $mailmsg has been received towards down payment for the Program <b>$coursename </b>
                                                         </p>                                                      
                                                         <table class='body-sub' role='presentation'>
                                                            <tr>
                                                               <td>
                                                                  <p class='f-fallback'>Best Wishes,</p>
                                                                  <p class='f-fallback'>Team Bake Better</p>
                                                               </td>
                                                            </tr>
                                                         </table>
                                                      </div>
                                                   </td>
                                                </tr>
                                             </table>
                                          </td>
                                       </tr>
                                       
                                    </table>
                                 </td>
                              </tr>
                           </table>
                        </body>
                      </html>";
                  $mail2 = $function->sendMail2($to=$to,$subject=$subject2,$messagebody=$messagebody2);
               }
            }
         } else { 
            //echo "without gst"; exit;
            $sql2 = "INSERT INTO `tn_order` SET studentId='".$insert_sid."',courseId='".$courseName."', nosofInstallment='".$installmentOptions."', isInstallment='1', totalFee='".$totalPayableFee."', downPayment='".$downPayment."', balanceFee='".$balanceFee."', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', batchMonth='".$batchMonth."', batchYear='".$batchYear."', batchTiming='".$batchTiming."', isdiscount='".$isdiscount."', course_discount_rate='".$course_discount_rate."', count='".$count."', startDate='".$from_date."', endDate='".$to_date."', centrename='".$_SESSION['admin_centrename']."'";
            $result2 = $pdodb->query($sql2);
            $insert_oid = $pdodb->lastInsertId();

            $sql3 = "INSERT INTO `tn_invoice` SET amount='".$downPayment."', orderId='".$insert_oid."', studentName='".$username."', uId='".$insert_sid."', studentAddress='".$studentAddress."', studentState='".$state."', isGst='2', centrename='".$_SESSION['admin_centrename']."'";
            $result3 = $pdodb->query($sql3);
            $insert_invoice = $pdodb->lastInsertId();            
            $invoiceNo = "TFN/COM/2024/00".$insert_invoice;
            $Rcpt_id = "RCPT/COM/2024/00".$insert_invoice;

            $sqlupt = "UPDATE `tn_invoice` SET invoiceNo='".$invoiceNo."', isPayment='2' WHERE id = '".$insert_invoice."'";
            $resultupt = $pdodb->query($sqlupt);

            /*for($i=1;$i<=$installmentOptions;$i++){
               $installmentAmt = round($balanceFee/$installmentOptions);
               $todaydate = date('d-m-Y');
               $dt = strtotime($todaydate);
               $dueDate = date("d-m-Y", strtotime("+".$i." month", $dt));
               
               $sqlinstlmnt = "INSERT INTO `tn_installments` SET uId='".$insert_sid."',orderId='".$insert_oid."',amount='".$installmentAmt."',dueDate='".$dueDate."'";
               $resultinstlmnt = $pdodb->query($sqlinstlmnt);
            }*/

            if ($result2 == true && $result3 == true && $resultupt == true) {
               $sql4 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', demand_id='".$insert_oid."', debit='".$downPayment."', particular='Invoice generated', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result4 = $pdodb->query($sql4);

               $sql5 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."',orderid='".$insert_oid."',transaction_id='".$transaction_id."', credit='".$downPayment."', particular='".$particular."', paymentMode='".$paymentMode."', bankname='".$bankname."', chequeno='".$chequeno."', invoice='".$invoiceNo."', studentName='".$username."', studentAddress='".$studentAddress."', studentState='".$state."', centrename='".$_SESSION['admin_centrename']."'";
               //echo $sql2; exit;
               $result5 = $pdodb->query($sql5);

               $installmentOption =$_POST;

               if(!empty($installmentOption['installmentdate'])){
                   $j = 1;
                 for ($i=0; $i < sizeof($installmentOption['installmentdate']); $i++) { 
                   $installmentdate= $installmentOption['installmentdate'][$i];
                   $installmentamount= $installmentOption['installmentamount'][$i];
                  
                   $pdodb = PDODB::getInstance();
                   $sqlinstlmnt = "INSERT INTO `tn_installments` SET uId='".$insert_sid."', orderId='".$insert_oid."', amount='".$installmentamount."',dueDate='".$installmentdate."', centrename='".$_SESSION['admin_centrename']."'";
                   $resultinstlmnt = $pdodb->query($sqlinstlmnt);
                   $insert_instlmnt = $pdodb->lastInsertId();
                   //echo $result; exit;

                   $sqlinstlmnt2 = "INSERT INTO `tn_accounts` SET uid='".$insert_sid."', installmentId='".$insert_instlmnt."', demand_id='".$insert_oid."', debit='".$installmentamount."', particular='".$j." Installment', gstNo='".$gstNo."', companyName='".$companyName."', companyAddress='".$companyAddress."', companyState='".$companyState."', date='".$installmentdate."', centrename='".$_SESSION['admin_centrename']."'";
                      //echo $sql2; exit;
                   $resultinstlmnt2 = $pdodb->query($sqlinstlmnt2);   
                   $j++;
                 }
               }
               $data = $_POST['courseName'];
               foreach ($data as $course) {               
                   $coursedata = $function->getCourse($id=$course,$isActive=1,$orderBy='ASC');
                   $cprice = $coursedata[0]['coursePrice'];

                   // Apply discount based on discount type
                   if ($isdiscount == 2) {
                       // Percentage discount
                       $discountedPrice = $cprice - ($cprice * ($course_discount_rate / 100));

                   } elseif ($isdiscount == 3) {
                       // Flat discount
                       $discountedPrice = $cprice - ($course_discount_rate / $count);
                   } else {
                       // No discount
                       $discountedPrice = $cprice;
                   }

                   // Calculate GST
                   $gstAmount = $discountedPrice * 0.18;
                   
                   // Add GST to discounted price
                   $finalPrice = $discountedPrice + $gstAmount;

                   $sqlitem = "INSERT INTO `tn_orderitem` SET studentId='".$insert_sid."', courseid='".$course."', courseprice='".$finalPrice."', orderid='".$insert_oid."', centrename='".$_SESSION['admin_centrename']."'";
                   $resultitem = $pdodb->query($sqlitem);
               }

               $array = explode(",", $courseName);
               $courselist = $function->getCourse($id=NULL,$isActive=1,$orderBy='ASC');
               $courseNames = array(); // Initialize an array to store course names
               for ($k = 0; $k < count($courselist); $k++) {
                    $courseid = $courselist[$k]['id'];
                    if (in_array($courseid, $array)) {
                        $courseNames[] = $courselist[$k]['courseName']; // Add course name to the array
                    }
               }
               $coursename = implode(', ', $courseNames); // Convert array to comma-separated string
               //echo $courseName;
               
               if ($result5 == true) {
                  $error_msg = "Registration Successfully Done";
                  //email send
                  $to = $uemail;
                  $subject = "Registration Successfully Completed ";
                  $messagebody = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                   <html xmlns='http://www.w3.org/1999/xhtml'>
                     <head>
                        <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                        <meta name='x-apple-disable-message-reformatting' />
                        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                        <meta name='color-scheme' content='light dark' />
                        <meta name='supported-color-schemes' content='light dark' />
                        <title></title>
                        <style type='text/css' rel='stylesheet' media='all'>
                           @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                           body {
                           width: 100% !important;
                           height: 100%;
                           margin: 0;
                           -webkit-text-size-adjust: none;
                           }
                           a {
                           color: #3869D4;
                           }
                           a img {
                           border: none;
                           }
                           td {
                           word-break: break-word;
                           }
                           .preheader {
                           display: none !important;
                           visibility: hidden;
                           mso-hide: all;
                           font-size: 1px;
                           line-height: 1px;
                           max-height: 0;
                           max-width: 0;
                           opacity: 0;
                           overflow: hidden;
                           }
                           body,
                           td,
                           th {
                           font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                           }
                           h1 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 22px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h2 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 16px;
                           font-weight: bold;
                           text-align: left;
                           }
                           h3 {
                           margin-top: 0;
                           color: #333333;
                           font-size: 14px;
                           font-weight: bold;
                           text-align: left;
                           }
                           td,
                           th {
                           font-size: 16px;
                           }
                           p,
                           ul,
                           ol,
                           blockquote {
                           margin: .4em 0 1.1875em;
                           font-size: 16px;
                           line-height: 1.625;
                           }
                           p.sub {
                           font-size: 13px;
                           }
                           .align-right {
                           text-align: right;
                           }
                           .align-left {
                           text-align: left;
                           }
                           .align-center {
                           text-align: center;
                           }
                           .u-margin-bottom-none {
                           margin-bottom: 0;
                           }
                           .button {
                           background-color: #3869D4;
                           border-top: 10px solid #3869D4;
                           border-right: 18px solid #3869D4;
                           border-bottom: 10px solid #3869D4;
                           border-left: 18px solid #3869D4;
                           display: inline-block;
                           color: #FFF;
                           text-decoration: none;
                           border-radius: 3px;
                           box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                           -webkit-text-size-adjust: none;
                           box-sizing: border-box;
                           }
                           .button--green {
                           background-color: #22BC66;
                           border-top: 10px solid #22BC66;
                           border-right: 18px solid #22BC66;
                           border-bottom: 10px solid #22BC66;
                           border-left: 18px solid #22BC66;
                           }
                           .button--red {
                           background-color: #FF6136;
                           border-top: 10px solid #FF6136;
                           border-right: 18px solid #FF6136;
                           border-bottom: 10px solid #FF6136;
                           border-left: 18px solid #FF6136;
                           }
                           @media only screen and (max-width: 500px) {
                           .button {
                           width: 100% !important;
                           text-align: center !important;
                           }
                           }
                           .attributes {
                           margin: 0 0 21px;
                           }
                           .attributes_content {
                           background-color: #F4F4F7;
                           padding: 16px;
                           }
                           .attributes_item {
                           padding: 0;
                           }
                           .related {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .related_item {
                           padding: 10px 0;
                           color: #CBCCCF;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .related_item-title {
                           display: block;
                           margin: .5em 0 0;
                           }
                           .related_item-thumb {
                           display: block;
                           padding-bottom: 10px;
                           }
                           .related_heading {
                           border-top: 1px solid #CBCCCF;
                           text-align: center;
                           padding: 25px 0 10px;
                           }
                           .discount {
                           width: 100%;
                           margin: 0;
                           padding: 24px;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F4F4F7;
                           border: 2px dashed #CBCCCF;
                           }
                           .discount_heading {
                           text-align: center;
                           }
                           .discount_body {
                           text-align: center;
                           font-size: 15px;
                           }
                           .social {
                           width: auto;
                           }
                           .social td {
                           padding: 0;
                           width: auto;
                           }
                           .social_icon {
                           height: 20px;
                           margin: 0 8px 10px 8px;
                           padding: 0;
                           }
                           .purchase {
                           width: 100%;
                           margin: 0;
                           padding: 35px 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_content {
                           width: 100%;
                           margin: 0;
                           padding: 25px 0 0 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .purchase_item {
                           padding: 10px 0;
                           color: #51545E;
                           font-size: 15px;
                           line-height: 18px;
                           }
                           .purchase_heading {
                           padding-bottom: 8px;
                           border-bottom: 1px solid #EAEAEC;
                           }
                           .purchase_heading p {
                           margin: 0;
                           color: #85878E;
                           font-size: 12px;
                           }
                           .purchase_footer {
                           padding-top: 15px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .purchase_total {
                           margin: 0;
                           text-align: right;
                           font-weight: bold;
                           color: #333333;
                           }
                           .purchase_total--label {
                           padding: 0 15px 0 0;
                           }
                           body {
                           background-color: #F2F4F6;
                           color: #51545E;
                           }
                           p {
                           color: #51545E;
                           }
                           .email-wrapper {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #F2F4F6;
                           }
                           .email-content {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-masthead {
                           padding: 25px 0;
                           text-align: center;
                           }
                           .email-masthead_logo {
                           width: 94px;
                           }
                           .email-masthead_name {
                           font-size: 16px;
                           font-weight: bold;
                           color: #A8AAAF;
                           text-decoration: none;
                           text-shadow: 0 1px 0 white;
                           }
                           .email-body {
                           width: 100%;
                           margin: 0;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           }
                           .email-body_inner {
                           width: 570px;
                           margin: 20px auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           background-color: #FFFFFF;
                           }
                           .email-footer {
                           width: 570px;
                           margin: 0 auto;
                           padding: 0;
                           -premailer-width: 570px;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .email-footer p {
                           color: #A8AAAF;
                           }
                           .body-action {
                           width: 100%;
                           margin: 30px auto;
                           padding: 0;
                           -premailer-width: 100%;
                           -premailer-cellpadding: 0;
                           -premailer-cellspacing: 0;
                           text-align: center;
                           }
                           .body-sub {
                           margin-top: 25px;
                           padding-top: 25px;
                           border-top: 1px solid #EAEAEC;
                           }
                           .content-cell {
                           padding: 45px;
                           }
                           @media only screen and (max-width: 600px) {
                           .email-body_inner,
                           .email-footer {
                           width: 100% !important;
                           }
                           }
                           @media (prefers-color-scheme: dark) {
                           body,
                           .email-body,
                           .email-body_inner,
                           .email-content,
                           .email-wrapper,
                           .email-masthead,
                           .email-footer {
                           background-color: #333333 !important;
                           color: #FFF !important;
                           }
                           p,
                           ul,
                           ol,
                           blockquote,
                           h1,
                           h2,
                           h3,
                           span,
                           .purchase_item {
                           color: #FFF !important;
                           }
                           .attributes_content,
                           .discount {
                           background-color: #222 !important;
                           }
                           .email-masthead_name {
                           text-shadow: none !important;
                           }
                           }
                           :root {
                           color-scheme: light dark;
                           supported-color-schemes: light dark;
                           }
                        </style>
                     </head>
                     <body>
                        <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                           <tr>
                              <td align='center'>
                                 <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                    <tr>
                                       <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                          <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                             <tr>
                                                <td>
                                                   <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                       <div style='float: left;'>
                                                          <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                       </div>
                                                       <div style='float: right;'>
                                                          <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                       </div>
                                                    </div>
                                                </td>
                                             </tr>
                                             <tr>
                                                <td class='content-cell'>
                                                   <div class='f-fallback'>
                                                      <h1>Dear $username!,</h1>
                                                      <p>
                                                         Welcome aboard Bake Better, the premier baking school of India.<br>
                                                         You have been registered as a student with Bake Better.<br>
                                                         You can log into your student account with your registered email id as login id
                                                         and your registered mobile no as password.<br>
                                                         Together, let us turn your passion for baking into a career.
                                                      </p>
                                                      <table class='body-action' align='center' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                                        <tr>
                                                           <td align='center'>
                                                              <table width='100%' border='0' cellspacing='0' cellpadding='0' role='presentation'>
                                                                 <tr>
                                                                    <td align='center'>
                                                                       <a href='https://www.trufflenation.questend.com' class='f-fallback button' target='_blank'>Login</a>
                                                                    </td>
                                                                 </tr>
                                                              </table>
                                                           </td>
                                                        </tr>
                                                      </table> 
                                                      <table class='body-sub' role='presentation'>
                                                         <tr>
                                                            <td>
                                                               <p class='f-fallback'>Best Wishes,</p>
                                                               <p class='f-fallback'>Team Bake Better</p>
                                                            </td>
                                                         </tr>
                                                      </table>
                                                   </div>
                                                </td>
                                             </tr>
                                          </table>
                                       </td>
                                    </tr>
                                    
                                 </table>
                              </td>
                           </tr>
                        </table>
                     </body>
                   </html>";
                  $mail = $function->sendMail2($to=$to,$subject=$subject,$messagebody=$messagebody);

                  //payment email
                  $subject2 = "Payment Successfully Completed";
                  $messagebody2 = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
                      <html xmlns='http://www.w3.org/1999/xhtml'>
                        <head>
                           <meta name='viewport' content='width=device-width, initial-scale=1.0' />
                           <meta name='x-apple-disable-message-reformatting' />
                           <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
                           <meta name='color-scheme' content='light dark' />
                           <meta name='supported-color-schemes' content='light dark' />
                           <title></title>
                           <style type='text/css' rel='stylesheet' media='all'>
                              @import url('https://fonts.googleapis.com/css?family=Nunito+Sans:400,700&display=swap');
                              body {
                              width: 100% !important;
                              height: 100%;
                              margin: 0;
                              -webkit-text-size-adjust: none;
                              }
                              a {
                              color: #3869D4;
                              }
                              a img {
                              border: none;
                              }
                              td {
                              word-break: break-word;
                              }
                              .preheader {
                              display: none !important;
                              visibility: hidden;
                              mso-hide: all;
                              font-size: 1px;
                              line-height: 1px;
                              max-height: 0;
                              max-width: 0;
                              opacity: 0;
                              overflow: hidden;
                              }
                              body,
                              td,
                              th {
                              font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
                              }
                              h1 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 22px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h2 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 16px;
                              font-weight: bold;
                              text-align: left;
                              }
                              h3 {
                              margin-top: 0;
                              color: #333333;
                              font-size: 14px;
                              font-weight: bold;
                              text-align: left;
                              }
                              td,
                              th {
                              font-size: 16px;
                              }
                              p,
                              ul,
                              ol,
                              blockquote {
                              margin: .4em 0 1.1875em;
                              font-size: 16px;
                              line-height: 1.625;
                              }
                              p.sub {
                              font-size: 13px;
                              }
                              .align-right {
                              text-align: right;
                              }
                              .align-left {
                              text-align: left;
                              }
                              .align-center {
                              text-align: center;
                              }
                              .u-margin-bottom-none {
                              margin-bottom: 0;
                              }
                              .button {
                              background-color: #3869D4;
                              border-top: 10px solid #3869D4;
                              border-right: 18px solid #3869D4;
                              border-bottom: 10px solid #3869D4;
                              border-left: 18px solid #3869D4;
                              display: inline-block;
                              color: #FFF;
                              text-decoration: none;
                              border-radius: 3px;
                              box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
                              -webkit-text-size-adjust: none;
                              box-sizing: border-box;
                              }
                              .button--green {
                              background-color: #22BC66;
                              border-top: 10px solid #22BC66;
                              border-right: 18px solid #22BC66;
                              border-bottom: 10px solid #22BC66;
                              border-left: 18px solid #22BC66;
                              }
                              .button--red {
                              background-color: #FF6136;
                              border-top: 10px solid #FF6136;
                              border-right: 18px solid #FF6136;
                              border-bottom: 10px solid #FF6136;
                              border-left: 18px solid #FF6136;
                              }
                              @media only screen and (max-width: 500px) {
                              .button {
                              width: 100% !important;
                              text-align: center !important;
                              }
                              }
                              .attributes {
                              margin: 0 0 21px;
                              }
                              .attributes_content {
                              background-color: #F4F4F7;
                              padding: 16px;
                              }
                              .attributes_item {
                              padding: 0;
                              }
                              .related {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .related_item {
                              padding: 10px 0;
                              color: #CBCCCF;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .related_item-title {
                              display: block;
                              margin: .5em 0 0;
                              }
                              .related_item-thumb {
                              display: block;
                              padding-bottom: 10px;
                              }
                              .related_heading {
                              border-top: 1px solid #CBCCCF;
                              text-align: center;
                              padding: 25px 0 10px;
                              }
                              .discount {
                              width: 100%;
                              margin: 0;
                              padding: 24px;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F4F4F7;
                              border: 2px dashed #CBCCCF;
                              }
                              .discount_heading {
                              text-align: center;
                              }
                              .discount_body {
                              text-align: center;
                              font-size: 15px;
                              }
                              .social {
                              width: auto;
                              }
                              .social td {
                              padding: 0;
                              width: auto;
                              }
                              .social_icon {
                              height: 20px;
                              margin: 0 8px 10px 8px;
                              padding: 0;
                              }
                              .purchase {
                              width: 100%;
                              margin: 0;
                              padding: 35px 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_content {
                              width: 100%;
                              margin: 0;
                              padding: 25px 0 0 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .purchase_item {
                              padding: 10px 0;
                              color: #51545E;
                              font-size: 15px;
                              line-height: 18px;
                              }
                              .purchase_heading {
                              padding-bottom: 8px;
                              border-bottom: 1px solid #EAEAEC;
                              }
                              .purchase_heading p {
                              margin: 0;
                              color: #85878E;
                              font-size: 12px;
                              }
                              .purchase_footer {
                              padding-top: 15px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .purchase_total {
                              margin: 0;
                              text-align: right;
                              font-weight: bold;
                              color: #333333;
                              }
                              .purchase_total--label {
                              padding: 0 15px 0 0;
                              }
                              body {
                              background-color: #F2F4F6;
                              color: #51545E;
                              }
                              p {
                              color: #51545E;
                              }
                              .email-wrapper {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #F2F4F6;
                              }
                              .email-content {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-masthead {
                              padding: 25px 0;
                              text-align: center;
                              }
                              .email-masthead_logo {
                              width: 94px;
                              }
                              .email-masthead_name {
                              font-size: 16px;
                              font-weight: bold;
                              color: #A8AAAF;
                              text-decoration: none;
                              text-shadow: 0 1px 0 white;
                              }
                              .email-body {
                              width: 100%;
                              margin: 0;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              }
                              .email-body_inner {
                              width: 570px;
                              margin: 20px auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              background-color: #FFFFFF;
                              }
                              .email-footer {
                              width: 570px;
                              margin: 0 auto;
                              padding: 0;
                              -premailer-width: 570px;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .email-footer p {
                              color: #A8AAAF;
                              }
                              .body-action {
                              width: 100%;
                              margin: 30px auto;
                              padding: 0;
                              -premailer-width: 100%;
                              -premailer-cellpadding: 0;
                              -premailer-cellspacing: 0;
                              text-align: center;
                              }
                              .body-sub {
                              margin-top: 25px;
                              padding-top: 25px;
                              border-top: 1px solid #EAEAEC;
                              }
                              .content-cell {
                              padding: 45px;
                              }
                              @media only screen and (max-width: 600px) {
                              .email-body_inner,
                              .email-footer {
                              width: 100% !important;
                              }
                              }
                              @media (prefers-color-scheme: dark) {
                              body,
                              .email-body,
                              .email-body_inner,
                              .email-content,
                              .email-wrapper,
                              .email-masthead,
                              .email-footer {
                              background-color: #333333 !important;
                              color: #FFF !important;
                              }
                              p,
                              ul,
                              ol,
                              blockquote,
                              h1,
                              h2,
                              h3,
                              span,
                              .purchase_item {
                              color: #FFF !important;
                              }
                              .attributes_content,
                              .discount {
                              background-color: #222 !important;
                              }
                              .email-masthead_name {
                              text-shadow: none !important;
                              }
                              }
                              :root {
                              color-scheme: light dark;
                              supported-color-schemes: light dark;
                              }
                           </style>
                        </head>
                        <body>
                           <table class='email-wrapper' width='100%' cellpadding='0' cellspacing='0' role='presentation'>                        
                              <tr>
                                 <td align='center'>
                                    <table class='email-content' width='100%' cellpadding='0' cellspacing='0' role='presentation'>
                                       <tr>
                                          <td class='email-body' width='570' cellpadding='0' cellspacing='0'>
                                             <table class='email-body_inner' align='center' width='570' cellpadding='0' cellspacing='0' role='presentation'>
                                                <tr>
                                                   <td>
                                                      <div style='width: 570px; margin: 0px auto; padding: 20px 30px;'>
                                                          <div style='float: left;'>
                                                             <img src='https://www.trufflenation.questend.com/images/truffle-nation-logo-1.png' width='120px;'>
                                                          </div>
                                                          <div style='float: right;'>
                                                             <img src='https://www.trufflenation.questend.com/images/bake-better-logo.png' width='100px;'>
                                                          </div>
                                                       </div>
                                                   </td>
                                                </tr>
                                                <tr>
                                                   <td class='content-cell'>
                                                      <div class='f-fallback'>
                                                         <h1>Dear $username!,</h1>
                                                         <p>
                                                            Your payment of Rupees  $amountinword only (Rs. $amount/-) paid vide $mailmsg has been received towards down payment for the Program <b>$coursename </b>
                                                         </p>                                                      
                                                         <table class='body-sub' role='presentation'>
                                                            <tr>
                                                               <td>
                                                                  <p class='f-fallback'>Best Wishes,</p>
                                                                  <p class='f-fallback'>Team Bake Better</p>
                                                               </td>
                                                            </tr>
                                                         </table>
                                                      </div>
                                                   </td>
                                                </tr>
                                             </table>
                                          </td>
                                       </tr>
                                      
                                    </table>
                                 </td>
                              </tr>
                           </table>
                        </body>
                      </html>";
                  $mail2 = $function->sendMail2($to=$to,$subject=$subject2,$messagebody=$messagebody2);
               }
            }
         }
      }
   } 
?>
<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>INSPINIA | Basic Form</title>
      <?php include_once '../layout/style.php'; ?>
      <style type="text/css">
          .control-label span { color: red; }
      </style>
   </head>
   <body>
      <div id="wrapper">
         <?php $currentPage = 'visit-student-list'; include_once '../layout/side-bar.php'; ?>
         <div id="page-wrapper" class="gray-bg">
            <?php include_once '../layout/header.php'; ?>
            <div class="row wrapper border-bottom white-bg page-heading">
               <div class="col-lg-8">
                  <h2><?=!empty($error_msg)?$error_msg:'';?></h2>
               </div>
            </div>           
            
         </div>         
      </div>
      <?php include_once '../layout/script.php'; ?>      
      
   </body>
</html>


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home