Server IP : 2a02:4780:3:1378:0:3736:a38e:10 / Your IP : 3.135.185.223 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/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?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['user'])) { // If they are not, we redirect them to the login page. header("Location: login.php"); // Remember that this die statement is absolutely critical. Without it, // people can view your members-only content without logging in. die("Redirecting to login.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. include './config/config.php'; $key=$_GET['key']; //echo "$key"; $flag_c=mysqli_query($con,"SELECT * FROM `paid_fees` WHERE `Fees_id`='$key'"); $flag1=mysqli_fetch_array($flag_c); //print_r($flag1); $f1=$flag1['Subhead_Ids']; $f2=$flag1['Sub_Amounts']; $sid=$flag1['Stud_Id']; $q=explode('/',$f1); $Subhead_Amounts=explode('/',$f2); $i=1; //print_r($Subhead_Amounts); foreach ($q as $subhead ) { $Paid=0; $Balance=0; //echo "$subhead / $sid<br>"; if($subhead != "") { $today=date("Y-m-d"); $sub_res=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$subhead' and `Stud_Id` = '$sid'"); $sub=mysqli_fetch_array($sub_res); /* echo $Subhead_Amounts[$i];*/ $Paid=$sub['Paid']; /* echo "<br>Paid Before : $Paid<br>";*/ $Balance=$sub['Balance']; /* echo " Balance Before : $Balance<br>";*/ $Paid=$Paid+$Subhead_Amounts[$i]; $Balance=$Balance-$Subhead_Amounts[$i]; /* echo "Paid After : $Paid<br>"; echo "Bal After : $Balance<br>";*/ if(!mysqli_query($con,"UPDATE `stud_basic2` SET `Paid`='$Paid',`Balance` = '$Balance' WHERE `Subhead_Id` = '$subhead' and `Stud_Id`='$sid'")) { echo("Error description: " . mysqli_error($con)); } $BankGet_res=mysqli_query($con,"SELECT * from `head` where `Head_Id` = '$sub[Head_Id]' "); $BankGet_Details=mysqli_fetch_array($BankGet_res); $Bank_res=mysqli_query($con,"SELECT * from `bankaccounts` where `Id` = '$BankGet_Details[Bank_Code]' "); $Bank_Details=mysqli_fetch_array($Bank_res); $AccountNumber_RightFour=substr($Bank_Details['Account_Number'], -4); $Dr_Ledger_Name="$Bank_Details[Bank_Name]"."-"."$AccountNumber_RightFour"; // echo "DR Type=$Dr_Ledger_Name"; // Accounts Vochers Pass Start $subn_res=mysqli_query($con,"select `Name` from `sub_head` where `Sub_Id` = '$subhead'"); $subn=mysqli_fetch_array($subn_res); $ExitsOrNot_res=mysqli_query($con,"SELECT * FROM `vochers` where `Date` = '$today' and `Cr_Ledger` = '$subn[0]' and `Dr_Ledger` = '$Dr_Ledger_Name' "); $ExitsOrNot=mysqli_num_rows($ExitsOrNot_res); $ExistedAmount=mysqli_fetch_array($ExitsOrNot_res); // $subn[0] - Subhead Name if($ExitsOrNot > 0 ) // Update { $ExistedAmount['Cr_Amount']+=$Subhead_Amounts[$i]; if(!mysqli_query($con,"UPDATE `vochers` SET `Cr_Amount` = '$ExistedAmount[Cr_Amount]', `Dr_Amount` = '$ExistedAmount[Cr_Amount]' WHERE `V_Id` = '$ExistedAmount[V_Id]'")); { echo("Error description: " . mysqli_error($con)); } } else // Insert { if(!$v_counter_res=mysqli_query($con,"select MAX(`v_counter`) from `vochers` where `Type` = 'Recipt'")) { echo("Error description: " . mysqli_error($con)); } $rep_code=mysqli_fetch_array($v_counter_res); $v_counter=$rep_code['0']+1; if(!mysqli_query($con,"INSERT INTO `vochers` (`Date`, `v_counter`, `Type`, `Cr_Ledger`, `Dr_Ledger`, `Cr_Ledger_Type`, `Dr_Ledger_Type`, `Cr_Amount`, `Dr_Amount`, `Nrtn`) VALUES ('$today','$v_counter','Recipt','$subn[0]', '$Dr_Ledger_Name','Income/Revenue','Current Assets','$Subhead_Amounts[$i]','$Subhead_Amounts[$i]','Fees Collected')")) { echo("Error description: " . mysqli_error($con)); } } //Accounts Vocher End $i++; } } if(!mysqli_query($con,"UPDATE `paid_fees` SET `Flag`='1' WHERE `Fees_id` = '$key'" )) { echo("Error description: " . mysqli_error($con)); } ?> <script> alert("Challan Cleared Successfully"); document.location="challan_approve.php"; </script>