
PK 
<?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);
include '../includes/settings/constant.php';
//include '../includes/settings/db.php';
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId']) && empty($_SESSION['admin_role_id'])) {
header("Location: ../index.php");
exit();
}
$ipaddress = $function->getRealIpAddr();
//print_r($member_id);
//print_r($_POST); exit;
if(isset($_POST['payBtn']) && !empty($_POST)){
//print_r($_POST); exit;
$uid = !empty($_POST['uid'])?trim($_POST['uid']):"";
$amount = !empty($_POST['amount'])?trim($_POST['amount']):"";
$owner_name = !empty($_POST['owner_name'])?trim($_POST['owner_name']):"";
$mobile = !empty($_POST['mobile'])?trim($_POST['mobile']):"";
$house_no = !empty($_POST['house_no'])?trim($_POST['house_no']):"";
$payment_mode = !empty($_POST['payment_mode'])?trim($_POST['payment_mode']):"";
$bankname = !empty($_POST['bankname'])?trim($_POST['bankname']):"";
$chequeno = !empty($_POST['chequeno'])?trim($_POST['chequeno']):"";
$days = !empty($_POST['days'])?trim($_POST['days']):"";
$days2 = !empty($_POST['days2'])?trim($_POST['days2']):"";
$_SESSION['uid']=$uid;
$_SESSION['owner_name'] = $owner_name;
$_SESSION['mobile'] = $mobile;
$_SESSION['house_no'] = $house_no;
if ($_POST['payBtn']=='cheque') {
$_SESSION['chequeno'] = $chequeno;
}
$pdodb = PDODB::getInstance();
$date = date('Y-m-d H:i:s');
//$date = "2020-03-31 00:00:00";
$account = $function->getAccountDetails($uid,NULL);
$bal = 0;
for($i=0;$i<count($account);$i++){
$bal += (float)$account[$i]['debit']-(float)$account[$i]['credit'];
}
$bal = $bal - 500;
//print_r($days2); exit;
if ($days<=$days2 && $amount==$bal) {
//echo "april 30"; exit;
$dic_amt = 500;
$dis_particular = "Discount";
$sql = "INSERT INTO payment_loger SET uid='".$uid."',amount='".$amount."',ipaddress='".$ipaddress."',publishdate='".$date."',txndate='".$date."'";
$result = $pdodb->query($sql);
$LASTID = $pdodb->lastInsertId();
$ORDER_ID = "RWA" .$uid.'-'.$LASTID;
$RESPMSG = "Pay from admin panel";
$sql1 = "INSERT INTO transaction SET uid='".$uid."',orderid='".$ORDER_ID."',txnamount='".$amount."',paymentmode='".$payment_mode."',txndate='".$date."',respmsg='".$RESPMSG."',bankname='".$bankname."',ipaddress='".$ipaddress."'";
$result1 = $pdodb->query($sql1);
$sql2 = "INSERT INTO accounts SET uid='".$uid."',orderid='".$ORDER_ID."',transaction_id='".$TXNID."',credit='".$amount."',paymentmode='".$payment_mode."',bankname='".$bankname."',chequeno='".$chequeno."',txndate='".$date."',ipaddress='".$ipaddress."'";
$result2 = $pdodb->query($sql2);
$sql3 = "INSERT INTO accounts SET uid='".$uid."',credit='".$dic_amt."',particular='".$dis_particular."', txndate='".$date."',ipaddress='".$ipaddress."'";
$result3 = $pdodb->query($sql3);
$_SESSION['orderid'] = $ORDER_ID;
header("Location: ../../invoice-ad.php");
} else{
//echo "string"; exit;
$sql = "INSERT INTO payment_loger SET uid='".$uid."',amount='".$amount."',ipaddress='".$ipaddress."',publishdate='".$date."',txndate='".$date."'";
$result = $pdodb->query($sql);
$LASTID = $pdodb->lastInsertId();
$ORDER_ID = "RWA" .$uid.'-'.$LASTID;
$RESPMSG = "Pay from admin panel";
//print_r($LASTID); exit;
$sql1 = "INSERT INTO transaction SET uid='".$uid."',orderid='".$ORDER_ID."',txnamount='".$amount."',paymentmode='".$payment_mode."',txndate='".$date."',respmsg='".$RESPMSG."',bankname='".$bankname."',ipaddress='".$ipaddress."'";
$result1 = $pdodb->query($sql1);
$sql2 = "INSERT INTO accounts SET uid='".$uid."',orderid='".$ORDER_ID."',transaction_id='".$TXNID."',credit='".$amount."',paymentmode='".$payment_mode."',bankname='".$bankname."',chequeno='".$chequeno."',txndate='".$date."',ipaddress='".$ipaddress."'";
$result2 = $pdodb->query($sql2);
//print_r($result2); exit;
$_SESSION['orderid'] = $ORDER_ID;
header("Location: ../../invoice-a.php");
}
//print_r($_SESSION['uid']); exit;
PDODB::closeInstance();
}else{ ?>
<script type="text/javascript">location.replace("index.php");</script>
<?php }
?>


PK 99