hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
u932676976
/
domains
/
goldeninfradeveloper.com
/
public_html
/
manager
/
Upload FileeE
HOME
<?php include 'db.php'; date_default_timezone_set('Asia/Kolkata'); $date=date('Y-m-d H:i:s'); $dt=date('Y-m-d'); if(isset($_POST['pmage_manager'])){ $usercode=$_POST['usercode']; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); move_uploaded_file($_FILES['image']['tmp_name'], $target); $aaa="update user set image='$image' where usercode='$usercode'"; mysqli_query($con,$aaa); header('location:dashboard.php'); } if(isset($_POST['pmage'])){ $usercode=$_POST['usercode']; $imgg=$_POST['image']; $msg = ""; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); move_uploaded_file($_FILES['image']['tmp_name'], $target); $img=$_FILES['image']['tmp_name']; echo $usercode; $aaa="update user set image='$image' where usercode='$usercode'"; mysqli_query($con,$aaa); header('location:dashboard.php'); } if(isset($_POST['donevisit'])){ $sitevisitid=$_POST['sitevisitid']; $aaa="update sitevisit set status='done' where sitevisit='$sitevisitid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:dashboard.php'); } } if(isset($_POST['newvisit'])){ $usercode=$_POST['usercode']; $name=$_POST['name']; $address=$_POST['address']; $gender=$_POST['gender']; $contact=$_POST['contact']; $sitename=$_POST['sitename']; $sitearea=$_POST['sitearea']; $datee=$_POST['date']; $referal=$_POST['referal']; $status=$_POST['status']; $aaa="INSERT INTO `sitevisit`(`sitevisit`, `date`, `dt`, `status`, `usercode`, `referal`, `requestdate`, `name`, `gender`, `address`, `contact`, `sitearea`, `sitename`) VALUES ('','$date','$datee','$status','','$referal','$datee','$name','$gender','$address','$contact','$sitearea','$sitename')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:newvisit.php'); } } if(isset($_POST['delvisit'])){ $sitevisitid=$_POST['sitevisitid']; $aaa="update sitevisit set status='cancelled' where sitevisit='$sitevisitid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:dashboard.php'); } } if(isset($_POST['addbnk'])){ $usercode=$_POST['usercode']; $bank=$_POST['bank']; $ifsc=$_POST['ifsc']; $accountno=$_POST['accountno']; $aaa="INSERT INTO `bank`(`bankid`, `date`, `dt`, `status`, `usercode`, `bank`, `ifsc`, `accountno`) VALUES ('','$date','$dt','active','$usercode','$bank','$ifsc','$accountno')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:banking.php'); } } function cutoption(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; $contact=$a['contact']; echo "<option value='$usercode'>$name-$contact</option>"; } } if(isset($_POST['delbank'])){ $bankid=$_POST['bankid']; $aaa="delete from bank where bankid='$bankid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:banking.php'); } } if(isset($_POST['givepayout'])){ $usercode=$_POST['usercode']; $amount=$_POST['amount']; $narration=$_POST['narration']; $datee=$_POST['date']; $orcfrom=$_POST['orcfrom']; $orcto=$_POST['orcto']; $advance=$_POST['advance']; $aaa="INSERT INTO `payout`(`payoutid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `befrom`, `beto`, `business`, `advance`, `btype`) VALUES ('','$date','$dt','active','$usercode','$amount','$narration','','$orcfrom','$orcto','','$advance','orc')"; $bbb="INSERT INTO `advance`(`advanceid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `approvedby`) VALUES ('','$date','$dt','active','$usercode','-$advance','advance received from orc commission between date $orcfrom and $orcto','','manager')"; $bb=mysqli_query($con,$bbb); $aa=mysqli_query($con,$aaa); if($aa){ header('location:payout.php'); } } if(isset($_POST['delpayout'])){ $payoutid=$_POST['payoutid']; $aaa="delete from payout where payoutid='$payoutid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:payoutlist.php'); } } if(isset($_POST['updpayout2'])){ $payoutid=$_POST['payoutid']; $amount=$_POST['amount']; $narration=$_POST['narration']; $aaa="update payout set amount='$amount', narration='$narration' where payoutid='$payoutid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:payoutlist.php'); } } if(isset($_POST['delete_pending_asso'])){ $usercode=$_POST['usercode']; $aaa="delete from user where usercode='$usercode' and status='inactive' and usertype='associate'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:dashboard.php'); } } if(isset($_POST['approve_newassociate'])){ $plan=$_POST['plan']; $rank=$_POST['rank']; $usercode=$_POST['usercode']; $aaa="update user set plancode='$plan', rank='$rank', status='active' where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:dashboard.php'); } } if(isset($_POST['upd_adm'])){ $name=$_POST['name']; $usercode=$_POST['usercode']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $email=$_POST['email']; $aaa="update user set name='$name', gender='$gender', age='$age', father='$father', address='$address', city='$city', state='$state', pincode='$pincode', aadhar='$aadhar', pan='$pan' where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:profile.php'); } } if(isset($_POST['upd_company'])){ $cid=$_POST['cid']; $name=$_POST['name']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $gstin=$_POST['gstin']; $email=$_POST['email']; $aaa="update company set name='$name', address='$address', city='$city', state='$state', pincode='$pincode', contact='$contact', whatsapp='$whatsapp', gstin='$gstin', email='$email' where companyid='$cid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:profile.php'); } } if(isset($_POST['adpas'])){ $pass=$_POST['password']; $newpass=$_POST['newpassword']; $usercode=$_POST['usercode']; $aaa="update user set password='$newpass' where usercode='$usercode' and password='$pass'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:profile.php'); } } if(isset($_POST['bookplot'])){ $usercode=$_POST['usercode']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $referal=$b['referal']; $plotcode=$_POST['plotcode']; $tenure=$_POST['tenure']; $term=$_POST['term']; $voucherno=rand(111111,999999); $aaa="INSERT INTO `tenure`(`tenureid`, `date`, `dt`, `status`, `usercode`, `referal`, `plotcode`, `tenure`, `term`, `voucherno`) VALUES ('','$date','$dt','active','$usercode','$referal','$plotcode','$tenure','$term','$voucherno')"; $cc="update plot set availability='3' where availability='0' and plotcode='$plotcode'"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$cc); header('location:bookplot.php'); } } if(isset($_POST['cancelholdplot'])){ $usercode=$_POST['usercode']; $plotcode=$_POST['plotcode']; $aaa="delete from tenure where usercode='$usercode' and plotcode='$plotcode'"; $bb="update plot set availability='0' where plotcode='$plotcode'"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$bb); header('location:dashboard.php'); } } if(isset($_POST['registrylist'])){ $registryid=$_POST['registryid']; $plotcode=$_POST['plotcode']; $aaa="delete from registry where registryid='$registryid'"; $bb="update plot set registrystatus='0' where plotcode='$plotcode'"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$bb); header('location:registrylist.php'); } } if(isset($_POST['registry'])){ $usercode=$_POST['usercode']; $bbb="select * from tenure where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $plotcode=$b['plotcode']; $date=$_POST['date']; $aaa="INSERT INTO `registry`(`registryid`, `date`, `dt`, `status`, `usercode`, `plotno`, `regdt`) VALUES ('','$date','$dt','active','$usercode','$plotcode','$date')"; $aa=mysqli_query($con,$aaa); $ccc="update plot set availability='1', registrystatus='1' where plotcode='$plotcode'"; if($aa){ mysqli_query($con,$ccc); } } if(isset($_POST['bzup'])){ $bid=$_POST['businessid']; $date=$_POST['date']; $amount=$_POST['amount']; $usr=$_POST['usercode']; $dt=date('Y-m-d',strtotime($date)); $introducer=$_POST['introducer']; $aaa="update business set dt='$dt', amount='$amount', usercode='$usr', referal='$introducer' where businessid='$bid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:businesslist.php'); } } if(isset($_POST['bdel'])){ $bid=$_POST['businessid']; $aaa="delete from business where businessid='$bid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:businesslist.php'); } } if(isset($_POST['emideposit'])){ $usercode=$_POST['name']; $emidate=$_POST['date']; $ccc="select * from tenure where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plotcode=$c['plotcode']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $ref=$b['referal']; $amount=$_POST['amount']; $type=$_POST['type']; $narration=$_POST['narration']; $odpa=$_POST['odpa']; $mode=$_POST['mode']; $voucherno=rand(111111,999999); $aaa="INSERT INTO `business`(`businessid`, `date`, `dt`, `status`, `usercode`, `referal`, `amount`, `mode`, `narration`, `businesstype`, `pmttype`, `voucherno`, `plancode`, `plotno`) VALUES ('','$date','$emidate','active','$usercode','$ref','$amount','$mode','$narration','$type','income','$voucherno','','$plotcode')"; $penalty="INSERT INTO `business`(`businessid`, `date`, `dt`, `status`, `usercode`, `referal`, `amount`, `mode`, `narration`, `businesstype`, `pmttype`, `voucherno`, `plancode`, `plotno`) VALUES ('','$date','$emidate','active','$usercode','$ref','$odpa','$mode','overdue penalty amount','$type','income','$voucherno','','$plotcode')"; mysqli_query($con,$penalty); if($type=="new business"){ $ddd="update plot set availability='1' where plotcode='$plotcode'"; refco($usercode,$type,$voucherno,$amount); }else{ $ddd="update plot set availability='1' where plotcode='$plotcode'"; refco($usercode,$type,$voucherno,$amount); } $aa=mysqli_query($con,$aaa); //header('location:emideposit.php'); if($aa){ mysqli_query($con,$ddd); header('location:emideposit.php'); } } if(isset($_POST['del_staff'])){ $userid=$_POST['userid']; $aaa="delete from user where userid='$userid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:staff.php'); } } if(isset($_POST['submit_staff'])){ $name=$_POST['name']; $gender=$_POST['gender']; $account=$_POST['account']; $joining=$_POST['joining']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $designation=$_POST['designation']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $msg = ""; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } $aaa="INSERT INTO `user`(`userid`, `date`, `dt`, `joiningdate`, `status`, `usercode`, `username`, `password`, `referal`, `rank`, `usertype`, `side`, `name`, `gender`, `age`, `father`, `address`, `contact`, `whatsapp`, `email`, `city`, `state`, `country`, `pincode`, `plancode`, `image`, `accountno`, `aadhar`, `pan`) VALUES ('','$date','$dt','$joining','active','','','','','$designation','staff','','$name','$gender','$age','$father','$address','$contact','$whatsapp','$email','$city','$state','india','$pincode','','$image','$account','$aadhar','$pan')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:staff.php'); } } if(isset($_POST['del_dg'])){ $dg=$_POST['dg']; $aaa="delete from designation where designationid='$dg'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:designation.php'); } } if(isset($_POST['submit_dg'])){ $name=$_POST['designation']; $dgcode=rand(1111,9999); $aaa="INSERT INTO `designation`(`designation`, `date`, `dt`, `status`, `usercode`, `dgcode`, `name`) VALUES ('','$date','$dt','active','admin','$dgcode','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:designation.php'); } } if(isset($_POST['upd_plot'])){ $plotno=$_POST['plotno']; $plotid=$_POST['plotid']; $plotsize=$_POST['plotsize']; $width=$_POST['width']; $lenth=$_POST['lenth']; $plotprice=$_POST['plotprice']; $phase=$_POST['phase']; $arazi=$_POST['arazi']; $unit=$_POST['unit']; $sitename=$_POST['sitename']; $sitearea=$_POST['sitearea']; $plotstatus=$_POST['plotstatus']; $aaa="update plot set plotno='$plotno', plotsize='$plotsize', plotprice='$plotprice', sitename='$sitename', sitearea='$sitearea', arazi='$arazi', phase='$phase', width='$width', lenth='$lenth', unit='$unit', availability='$plotstatus' where plotid='$plotid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:plotlist.php'); } } if(isset($_POST['delete_terms'])){ $termsid=$_POST['termsid']; $aaa="delete from terms where termsid='$termsid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:terms.php'); } } if(isset($_POST['submit_terms'])){ $terms=$_POST['terms']; $aaa="INSERT INTO `terms`(`termsid`, `date`, `dt`, `status`, `terms`, `approvedby`) VALUES ('','$date','$dt','active','$terms','admin')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:terms.php'); } } if(isset($_POST['delete_advance'])){ $usercode=$_POST['usercode']; $bzid=$_POST['businessid']; $aaa="delete from business where usercode='$usercode' and businessid='$bzid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:advance.php'); } } if(isset($_POST['submit_advance'])){ $usercode=$_POST['usercode']; $amount=$_POST['amount']; $dtt2=$_POST['date']; $dtt=date('Y-m-d',strtotime($dtt2)); $mode=$_POST['mode']; $narration=$_POST['narration']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $referal=$b['referal']; $voucherno=rand(111111,999999); $aaa="INSERT INTO `advance`(`advanceid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `approvedby`) VALUES ('','$date','$dtt','active','$usercode','$amount','$narration','','$mode')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:advance.php'); } } if(isset($_POST['customer_delete'])){ $userid=$_POST['userid']; $bbb="select * from user where userid='$userid'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $usercode=$b['usercode']; $ccc="select * from tenure where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plotcode=$c['plotcode']; $aaa="delete from user where userid='$userid' and usertype='customer'"; $zzz="delete from tenure where usercode='$usercode' and plotcode='$plotcode'"; $yyy="update plot set availability='0' where plotcode='$plotcode'"; $xxx="delete from business where usercode='$usercode'"; $www="delete from bank where usercode='$usercode'"; $vvv="delete from nominee where usercode='$usercode'"; $uuu="delete from registry where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$zzz); mysqli_query($con,$yyy); mysqli_query($con,$xxx); mysqli_query($con,$www); mysqli_query($con,$vvv); mysqli_query($con,$uuu); header('location:customerlist.php'); } } if(isset($_POST['customer_upd'])){ $userid=$_POST['userid']; $usrcode=$_POST['usercode']; $name=$_POST['name']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $referal=$_POST['referal']; //$rank=$_POST['rank']; $joiningdate=$_POST['joiningdate']; //$plancode=$_POST['plancode']; $image=$_POST['image']; $username=$_POST['username']; $password=$_POST['password']; $accountno=$_POST['accountno']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $nomineename=$_POST['nomineename']; $nomineeage=$_POST['nomineeage']; $relation=$_POST['relation']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $aaa="update user set name='$name', gender='$gender', age='$age', father='$father', contact='$contact', whatsapp='$whatsapp', email='$email', address='$address', city='$city', state='$state', pincode='$pincode', referal='$referal', joiningdate='$joiningdate', image='$image', username='$username', password='$password', accountno='$accountno', aadhar='$aadhar', pan='$pan' where userid='$userid'"; $bb="update kyc set aadhar='$aadhar', pan='$pan' where usercode='$usrcode'"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$bb); header('location:customerlist.php'); } } if(isset($_POST['associate_upd'])){ $userid=$_POST['userid']; $name=$_POST['name']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $referal=$_POST['referal']; $rank=$_POST['rank']; $joiningdate=$_POST['joiningdate']; $plancode=$_POST['plancode']; $image=$_POST['image']; $username=$_POST['username']; $password=$_POST['password']; $accountno=$_POST['accountno']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $aaa="update user set name='$name', gender='$gender', age='$age', father='$father', contact='$contact', whatsapp='$whatsapp', email='$email', address='$address', city='$city', state='$state', pincode='$pincode', referal='$referal', rank='$rank', joiningdate='$joiningdate', plancode='$plancode', image='$image', username='$username', password='$password', accountno='$accountno', aadhar='$aadhar', pan='$pan' where userid='$userid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:associatelist.php'); } } if(isset($_POST['associate_delete'])){ $userid=$_POST['userid']; $aaa="delete from user where userid='$userid' and usertype='associate'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:associatelist.php'); } } if(isset($_POST['submit_associate'])){ $usercode=rand(111111,999999); $name=$_POST['name']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $referal=$_POST['referal']; $rank=$_POST['rank']; $joiningdate=$_POST['joiningdate']; $plancode=$_POST['plancode']; $username=$_POST['username']; $password=$_POST['password']; $accountno=$_POST['accountno']; $bnk=$_POST['bnk']; $acn=$_POST['acn']; $ifsc=$_POST['ifsc']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $msg = ""; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } $aaa="INSERT INTO `user`(`userid`, `date`, `dt`, `joiningdate`, `status`, `usercode`, `username`, `password`, `referal`, `rank`, `usertype`, `side`, `name`, `gender`, `age`, `father`, `address`, `contact`, `whatsapp`, `email`, `city`, `state`, `country`, `pincode`, `plancode`, `image`, `accountno`) VALUES ('','$date','$dt','$joiningdate','active','$usercode','$username','$password','$referal','$rank','associate','','$name','$gender','$age','$father','$address','$contact','$whatsapp','$email','$city','$state','India','$pincode','$plancode','$image','$accountno')"; $bb="INSERT INTO `bank`(`bankid`, `date`, `dt`, `status`, `usercode`, `bank`, `ifsc`, `accountno`) VALUES ('','$date','$dt','active','$usercode','$bnk','$ifsc','$acn')"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$bb); header('location:associate.php'); } } if(isset($_POST['submit_customer'])){ $usercode=rand(111111,999999); $voucherno=rand(1111111111,9999999999); $name=$_POST['name']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $referal=$_POST['referal']; $amount=$_POST['amount']; $aadhar=$_POST['aadhar']; $pan=$_POST['pan']; $nominee=$_POST['nomineename']; $relation=$_POST['relation']; $nomineeage=$_POST['nomineeage']; //$rank=$_POST['rank']; $joiningdate=$_POST['joiningdate']; $plotcode=$_POST['plotid']; $username=$_POST['username']; $password=$_POST['password']; $accountno=$_POST['accountno']; $amount=$_POST['amount']; $tenure=$_POST['tenure']; $term=$_POST['term']; $narration=$_POST['narration']; $msg = ""; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } $aaa="INSERT INTO `user`(`userid`, `date`, `dt`, `joiningdate`, `status`, `usercode`, `username`, `password`, `referal`, `rank`, `usertype`, `side`, `name`, `gender`, `age`, `father`, `address`, `contact`, `whatsapp`, `email`, `city`, `state`, `country`, `pincode`, `plancode`, `image`, `accountno`, `aadhar`, `pan`) VALUES ('','$date','$dt','$joiningdate','active','$usercode','$username','$password','$referal','','customer','','$name','$gender','$age','$father','$address','$contact','$whatsapp','$email','$city','$state','India','$pincode','$plotcode','$image','$accountno','$aadhar','$pan')"; $bbb="update plot set availability='3' where plotcode='$plotcode'"; $ccc="INSERT INTO `business`(`businessid`, `date`, `dt`, `status`, `usercode`, `referal`, `amount`, `mode`, `narration`, `businesstype`, `pmttype`, `voucherno`, `plancode`, `plotno`) VALUES ('','$date','$dt','active','$usercode','$referal','$amount','$tenure','$narration','new nusiness','income','$voucherno','','$plotcode')"; $tntr="INSERT INTO `tenure`(`tenureid`, `date`, `dt`, `status`, `usercode`, `referal`, `plotcode`, `tenure`, `term`, `voucherno`) VALUES ('','$date','$dt','active','$usercode','$referal','$plotcode','$tenure','$term','$voucherno')"; $nnn1="INSERT INTO `commission`(`commissionid`, `date`, `dt`, `status`, `usercode`, `amount`, `voucherno`, `businesstype`, `commissiondate`) VALUES ('','$date','$dt','active','$referal','','$voucherno','new business','$joiningdate')"; $oo="INSERT INTO `nominee`(`nomineeid`, `date`, `dt`, `status`, `usercode`, `nominee`, `age`, `relation`, `percentage`) VALUES ('','$date','$dt','active','$usercode','$nominee','$nomineeage','$relation','100')"; $aa=mysqli_query($con,$aaa); if($aa){ mysqli_query($con,$bbb); mysqli_query($con,$oo); mysqli_query($con,$tntr); header('location:customer.php'); } } if(isset($_POST['submit_plan'])){ $plan=$_POST['name']; $product=$_POST['product']; $validity=$_POST['validity']; $price=$_POST['price']; $plancode=rand(1111,9999); $msg = ""; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } $aaa="INSERT INTO `plan`(`planid`, `date`, `dt`, `status`, `plancode`, `name`, `price`, `products`, `validity`, `image`) VALUES ('','$date','$dt','active','$plancode','$plan','$price','$product','$validity','$image')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:plan.php'); } } if(isset($_POST['submit_relation'])){ $name=$_POST['name']; $aaa="INSERT INTO `relation`(`relationid`, `date`, `dt`, `status`, `name`) VALUES ('','$date','$dt','active','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:relation.php'); }else{ echo '<script>window.alert("Operation Failed");window.location.href="relation.php";</script>';} } if(isset($_POST['delete_relation'])){ $relationid=$_POST['relationid']; $aaa="delete from relation where relationid='$relationid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:relation.php'); } } if(isset($_POST['submit_rank'])){ $name=$_POST['name']; $rankcode=$_POST['rankcode']; $commission=$_POST['commission']; $quota=$_POST['quota']; $symbol=$_POST['symbol']; $aaa="INSERT INTO `rank`(`rankid`, `date`, `dt`, `status`, `name`, `rankcode`, `commission`, `quota`, `symbol`) VALUES ('','$date','$dt','active','$name','$rankcode','$commission','$quota','$symbol')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:rank.php'); }else{ echo '<script>window.alert("Operation Failed");window.location.href="admindashboard.php";</script>';} } if(isset($_POST['update_rank2'])){ $commission=$_POST['commission']; $rankname=$_POST['name']; $quota=$_POST['quota']; $symbol=$_POST['symbol']; $rankid=$_POST['rankid']; echo $rankid; $aaa="update rank set commission='$commission', quota='$quota', symbol='$symbol', name='$rankname' where rankid='$rankid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:rank.php'); } } if(isset($_POST['submit_sitearea'])){ $name=$_POST['name']; $city=$_POST['city']; $state=$_POST['state']; $aaa="INSERT INTO `sitearea`(`siteareaid`, `date`, `dt`, `status`, `name`, `city`, `state`) VALUES ('','$date','$dt','active','$name','$city','$state')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:sitearea.php'); } } if(isset($_POST['sitearea_update2'])){ $siteareaid=$_POST['siteareaid']; $name=$_POST['name']; $city=$_POST['city']; $state=$_POST['state']; $aaa="update sitearea set name='$name', city='$city', state='$state' where siteareaid='$siteareaid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:sitearea.php'); } } if(isset($_POST['submit_site'])){ $name=$_POST['name']; $siti=$_POST['siteareaid']; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } $aaa="INSERT INTO `site`(`siteid`, `date`, `dt`, `status`, `name`, `siteareaid`, `image`) VALUES ('','$date','$dt','active','$name','$siti','$image')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:site.php'); } } if(isset($_POST['update_site'])){ $name=$_POST['name']; $siteareaid=$_POST['siteareaid']; $siteid=$_POST['siteid']; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); move_uploaded_file($_FILES['image']['tmp_name'], $target); $aaa="update site set name='$name', siteareaid='$siteareaid', image='$image' where siteid='$siteid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:site.php'); } } if(isset($_POST['submit_phase'])){ $name=$_POST['name']; $aaa="INSERT INTO `phase`(`phaseid`, `date`, `dt`, `status`, `name`) VALUES ('','$date','$dt','active','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:phase.php'); } } if(isset($_POST['phase_delete'])){ $phaseid=$_POST['phaseid']; $aaa="delete from phase where phaseid='$phaseid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:phase.php'); } } if(isset($_POST['submit_arazi'])){ $arazino=$_POST['arazino']; $sitename=$_POST['sitename']; $sitearea=$_POST['sitearea']; $arazicode=rand(1111,9999); $aaa="INSERT INTO `arazi`(`araziid`, `date`, `dt`, `status`, `arazicode`, `arazino`, `sitename`, `sitearea`) VALUES ('','$date','$dt','active','$arazicode','$arazino','$sitename','$sitearea')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:arazi.php'); } } if(isset($_POST['arazi_delete'])){ $araziid=$_POST['araziid']; $aaa="delete from arazi where araziid='$araziid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:arazi.php'); } } if(isset($_POST['submit_type'])){ $name=$_POST['name']; $aaa="INSERT INTO `plottype`(`plottypeid`, `date`, `dt`, `status`, `name`) VALUES ('','$date','$dt','active','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:type.php'); } } if(isset($_POST['type_delete'])){ $plottypeid=$_POST['plottypeid']; $aaa="delete from plottype where plottypeid='$plottypeid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:type.php'); } } if(isset($_POST['submit_state'])){ $name=$_POST['name']; $aaa="INSERT INTO `state`(`stateid`, `name`, `countryid`) VALUES ('','$name','0')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:state.php'); } } if(isset($_POST['state_delete'])){ $stateid=$_POST['stateid']; $aaa="delete from state where stateid='$stateid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:state.php'); } } if(isset($_POST['submit_city'])){ $name=$_POST['name']; $stateid=$_POST['stateid']; $aaa="INSERT INTO `city`(`cityid`, `name`, `stateid`) VALUES ('','$name','$stateid')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:city.php'); } } if(isset($_POST['city_delete'])){ $cityid=$_POST['cityid']; $aaa="delete from city where cityid='$cityid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:city.php'); } } if(isset($_POST['submit_expense'])){ $name=$_POST['name']; $aaa="INSERT INTO `expense`(`expenseid`, `date`, `dt`, `status`, `name`) VALUES ('','$date','$dt','active','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:expense.php'); } } if(isset($_POST['expense_delete'])){ $expenseid=$_POST['expenseid']; $aaa="delete from expense where expenseid='$expenseid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:expense.php'); } } if(isset($_POST['submit_income'])){ $name=$_POST['name']; $aaa="INSERT INTO `income`(`incomeid`, `date`, `dt`, `status`, `name`) VALUES ('','$date','$dt','active','$name')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:income.php'); } } if(isset($_POST['income_delete'])){ $incomeid=$_POST['incomeid']; $aaa="delete from income where incomeid='$incomeid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:income.php'); } } if(isset($_POST['submit_plot'])){ $plotno=$_POST['plotno']; $plotsize=$_POST['plotsize']; $plotprice=$_POST['plotprice']; $phase=$_POST['phase']; $arazi=$_POST['arazi']; $site=$_POST['sitename']; $width=$_POST['width']; $lenth=$_POST['lenth']; $sitearea=$_POST['sitearea']; $plotcode=rand(111111,999999); $aaa="INSERT INTO `plot`(`plotid`, `date`, `dt`, `status`, `plotcode`, `plotno`, `plotsize`, `plotprice`, `sitename`, `sitearea`, `unit`, `image`, `arazi`, `phase`, `availability`, `registrystatus`, `width`, `lenth`) VALUES ('','$date','$dt','active','$plotcode','$plotno','$plotsize','$plotprice','$site','$sitearea','sqft','','$arazi','$phase','0','0','$width','$lenth')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:plot.php'); } } if(isset($_POST['plot_delete'])){ $plotid=$_POST['plotid']; $aaa="delete from plot where plotid='$plotid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:plotlist.php'); } } if(isset($_POST['submit_associate'])){ $name=$_POST['name']; $gender=$_POST['gender']; $age=$_POST['age']; $father=$_POST['father']; $contact=$_POST['contact']; $whatsapp=$_POST['whatsapp']; $email=$_POST['email']; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $pincode=$_POST['pincode']; $referal=$_POST['referal']; $rank=$_POST['rank']; $joiningdate=$_POST['joiningdate']; $plancode=$_POST['plancode']; } function customercount(){ include 'db.php'; $aaa="select count(userid) as dd from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; if($count){ $count=$count; }else{ $count="0"; } echo $count; } function agentcount(){ include 'db.php'; $aaa="select count(userid) as dd from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; if($count){ $count=$count; }else{ $count="0"; } echo $count; } function plotcount(){ include 'db.php'; $aaa="select count(plotid) as dd from plot"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; if($count){ $count=$count; }else{ $count="0"; } echo $count; } function cname(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $name=$a['name']; echo $name; } function cimages(){ global $con; $aaa = "SELECT image FROM company LIMIT 1"; $aa = mysqli_query($con, $aaa); if($aa && mysqli_num_rows($aa) > 0){ $a = mysqli_fetch_assoc($aa); $image = htmlspecialchars($a['image']); echo "https://www.goldeninfradeveloper.com/admin/uploads/$image"; } else { echo "No image found"; } } function caddress(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $address=$a['address']; echo $address; } function ccity(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $city=$a['city']; echo $city; } function cstate(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $state=$a['state']; echo $state; } function cpincode(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $pincode=$a['pincode']; echo $pincode; } function ccontact(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $contact=$a['contact']; echo $contact; } function cwhatsapp(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $whatsapp=$a['whatsapp']; echo $whatsapp; } function cemail(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $email=$a['email']; echo $email; } function cgstin(){ include 'db.php'; $aaa="select * from company"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $gstin=$a['gstin']; echo $gstin; } function admin_name(){ include 'db.php'; $aaa="select * from user where usertype='manager'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $name=$a['name']; echo $name; } function admin_contact(){ include 'db.php'; $aaa="select * from user where usertype='manager'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $contact=$a['contact']; echo $contact; } function admin_email(){ include 'db.php'; $aaa="select * from user where usertype='manager'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $email=$a['email']; echo $email; } function admin_address(){ include 'db.php'; $aaa="select * from user where usertype='manager'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $address=$a['address']; $city=$a['city']; $state=$a['state']; $pin=$a['pincode']; echo $address; echo " ".$city; echo " ".$state; echo " ".$pin; } function admin_add(){ include 'db.php'; $aaa="select * from user where usertype='manager'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $address=$a['address']; echo $address; } function relation(){ include 'db.php'; $aaa="select * from relation"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name'];$status=$a['status']; $relationid=$a['relationid']; echo "<tr><td>$name</td><td>$status</td><td><form method='post' action='function.php'><input type='hidden' name='relationid' value='$relationid'><input type='submit' name='delete_relation' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function advancelist(){ include 'db.php'; $aaa="select * from business where usercode='$usercode' and pmttype='debit'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $date=$a['dt']; $amount=$a['amount']; $usercode=$a['usercode']; $sr>='0';$sr++; $bbb="select * from user where usercode='$usercode' and usertype='associate'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; echo "<tr><td>$sr</td><td>$date</td><td>$name</td><td>$amount</td></tr>"; } } function advance(){ include 'db.php'; $aaa="select * from advance"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $sr>='0';$sr++; $dt2=$a['dt']; $dt=date('d-m-Y',strtotime($dt2)); $amount=$a['amount'];$mode=$a['mode']; $usrcd=$a['usercode']; $aid=$a['advanceid']; $bbb="select * from user where usercode='$usrcd'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; if($amount){ $amount=$amount; }else{ $amount="0"; } echo "<tr><td>$sr</td><td>$dt</td><td>$name</td><td>$amount</td><td>$mode</td><td><form method='post' action='function.php'><input type='hidden' name='advid' value='$aid'><input type='submit' name='deladv' value='Delete'></form></td></tr>"; } } if(isset($_POST['deladv'])){ $aid=$_POST['advid']; $aaa="delete from advance where advanceid='$aid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:advance.php'); } } function agentwiseadvance(){ include 'db.php'; $aaa="select * from advance group by usercode"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $sr>='0';$sr++; $dt2=$a['dt']; $dt=date('d-m-Y',strtotime($dt2)); $amount=$a['amount'];$mode=$a['mode']; $usrcd=$a['usercode']; $bzid=$a['businessid']; $bbb="select * from user where usercode='$usrcd'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; if($amount){ $amount=$amount; }else{ $amount="0"; } $ccc="select sum(amount) as dd from advance where usercode='$usrcd'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $newamt=$c['dd']; echo "<tr><td>$sr</td><td>$name</td><td>$newamt</td><td><form method='POST' action='advanceprint.php'><input type='hidden' name='usercode' value='$usrcd'><input type='submit' name='print_advance' value='Print'></form></td></tr>"; } } function padv($usercode){ include 'db.php'; $aaa="select * from advance where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $mode=$a['approvedby']; $narration=$a['narration']; $dt=$a['dt']; $dtt=date('d-m-Y',strtotime($dt)); $sr>='0'; $sr++; echo "<tr><td>$sr</td><td>$dtt</td><td>$amount</td><td>$mode</td><td>$narration</td></tr>"; } } function advancecount(){ include 'db.php'; $aaa="select sum(amount) as dd from business where pmttype='debit'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $total=$a['dd']; if($total){ $total=$total; }else{ $total="0"; } echo $total; } function terms(){ include 'db.php'; $aaa="select * from terms order by termsid desc"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $termsid=$a['termsid']; $terms=$a['terms']; $sr>='0'; $sr++; echo "<tr><td>$sr</td><td>$terms</td><td><form method='POST' action='function.php'><input type='hidden' name='termsid' value='$termsid'><input type='submit' name='delete_terms' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function pendingasso(){ include 'db.php'; $aaa="select * from user where usertype='associate' and status='inactive'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $contact=$a['contact']; $referal=$a['referal']; $sr>='0';$sr++; $usercode=$a['usercode']; $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; $refcon=$b['contact']; echo "<tr><td>$sr</td><td>$name</td><td>$contact</td><td>$refname</td><td><form method='post' action='review_associate.php'><input type='hidden' name='usercode' value='$usercode'><input type='submit' name='review_associate' value='Review'></form></td><td><form method='POST' action='function.php'><input type='hidden' name='usercode' value='$usercode'><input type='submit' name='delete_pending_asso' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function citylist(){ include 'db.php'; $aaa="select * from city"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $cityid=$a['cityid']; $name=$a['name']; echo "<option value='$cityid'>$name</option>"; } } function statelist(){ include 'db.php'; $aaa="select * from state"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $stateid=$a['sstateid']; $name=$a['name']; echo "<option value='$stateid'>$name</option>"; } } function designationlist(){ include 'db.php'; $aaa="select * from designation"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $dg=$a['name']; $dgi=$a['designation']; $sr>='0';$sr++; echo "<tr><td>$sr</td><td>$dg</td><td><form method='POST' action='function.php'><input type='hidden' name='dgi' value='$dgi'><input type='button' name='del_dg' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function stafflist(){ include 'db.php'; $aaa="select * from user where usertype='staff'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $dg=$a['rank']; $sr>='0';$sr++; $dt=$a['joiningdate']; $userid=$a['userid']; echo "<tr><td>$sr</td><td>$dt</td><td>$name</td><td>$dg</td><td><form method='POST' action='function.php'><input type='hidden' name='userid' value='$userid'><input type='submit' name='del_staff' value='Delete'></form></td></tr>"; } } function businesslist(){ include 'db.php'; $aaa="select * from business where narration!='overdue penalty amount' order by businessid desc"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $customer=$b['name']; $amount=$a['amount']; $dt=$a['dt']; $date=date('d-m-Y',strtotime($dt)); $mode=$a['mode']; $type=$a['businesstype']; $narration=$a['narration']; $sr>='0';$sr++; $businessid=$a['businessid']; $referal=$a['referal']; $ggg="select * from user where usercode='$referal'"; $gg=mysqli_query($con,$ggg); $g=mysqli_fetch_assoc($gg); $names=$g['name']; $ccc="select * from tenure where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plotcode=$c['plotcode']; $ddd="select * from plot where plotcode='$plotcode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $plotno=$d['plotno']; echo "<tr><td>$sr</td><td>$date</td><td>$customer</td><td>$names</td><td>$plotno</td><td>$amount</td><td>$type</td><td><form method='POST' action='businesslist_update.php'><input type='hidden' name='businessid' value='$businessid'><input type='submit' name='businesslist_u' value='Update'></form></td><td><form method='POST' action='function.php'><input type='hidden' name='businessid' value='$businessid'><input type='submit' name='bdel' value='Delete'></form></td></tr>"; } } function newbiz(){ include 'db.php'; $aaa="select sum(amount) as dd from business where businesstype='new business'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $amount=$a['dd']; echo $amount; } function emicount(){ include 'db.php'; $aaa="select sum(amount) as dd from business where businesstype='emi'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $amount=$a['dd']; if($amount){ $amount=$amount; }else{ $amount="0"; } echo $amount; } function totalbusiness(){ include 'db.php'; $aaa="select sum(amount) as dd from business where businesstype='new business'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $new=$a['dd']; $bbb="select sum(amount) as dd from business where businesstype='emi'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $emi=$b['dd']; $tb=$new+$emi; echo $tb; } function associatelist(){ include 'db.php'; $aaa="select * from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } function customerselect(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } function customerselectwithplot(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $bbb="select * from tenure where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $plotcode=$b['plotcode']; $ccc="select * from plot where plotcode='$plotcode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plotno=$c['plotno']; $name=$a['name']; echo "<option value='$usercode'>$name-$plotno</option>"; } } function bookedplotcount(){ include 'db.php'; $aaa="select count(plotid) as dd from plot where availability='1'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; echo $count; } function awaitingplotcount(){ include 'db.php'; $aaa="select count(plotid) as dd from plot where availability='0'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; echo $count; } function registrylist(){ include 'db.php'; $aaa="select * from registry"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $plotcode=$a['plotno']; $registryid=$a['registryid']; $regdt=$a['regdt']; $dt=date('d-m-Y',strtotime($regdt)); $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $sr>='0';$sr++; $ccc="select * from plot where plotcode='$plotcode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plot=$c['plotno']; echo "<tr><td>$sr</td><td>$dt</td><td>$name</td><td>$plot</td><td><form method='POST' action='function.php'><input type='hidden' name='registryid' value='$registryid'><input type='hidden' name='plotcode' value='$plotcode'><input type='submit' name='registrylist' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function registrycount(){ include 'db.php'; $aaa="select count(registryid) as dd from registry"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; echo $count; } function holdplots(){ include 'db.php'; $aaa="select * from plot where availability='3'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $sr>='0';$sr++; $plotcode=$a['plotcode']; $plotno=$a['plotno']; $bbb="select * from tenure where plotcode='$plotcode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $usercode=$b['usercode']; $dt=$b['dt']; $date=date('d-m-Y',strtotime($dt)); $dtt=date('Y-m-d'); $diff=strtotime($dtt)-strtotime($dt); $days=$diff/86400; $ccc="select * from user where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $name=$c['name']; echo "<tr><td>$plotno</td><td>$date</td><td>$name</td><td>$days</td><td><form method='POST' action='function.php'><input type='hidden' name='usercode' value='$usercode'><input type='hidden' name='plotcode' value='$plotcode'><input type='submit' name='cancelholdplot' value='Cancel' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function custol(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } function selectrelation(){ include 'db.php'; $aaa="select * from relation"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; echo "<option value='$name'>$name</option>"; } } function holdplotcount(){ include 'db.php'; $aaa="select count(plotid) as dd from plot where availability='3'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $count=$a['dd']; echo $count; } function getselfteam($usercode){ include 'db.php'; $aaa="select * from user where referal='$usercode' and usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $ucode=$a['usercode']; $sr>='0';$sr++; $bbb="select count(usercode) as dd from user where referal='$ucode' and usertype='associate'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $count=$b['dd']; $ccc="select count(usercode) as dd from user where referal='$ucode' and usertype='customer'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $ccount=$c['dd']; $name=$a['name']; $ddd="select sum(amount) as dd from business where referal='$ucode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $deposit=$d['dd']; echo "<tr><td>$sr</td><td>$name</td><td>$ccount</td><td>$count</td><td>$deposit</td></tr>"; } } function getselfteam2($usercode){ include 'db.php'; $aaa="select * from user where referal='$usercode' and usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $ucode=$a['usercode']; $sr>='0';$sr++; $contact=$a['contact']; $add=$a['address']; $rankk=$a['rank']; $bbb="select count(usercode) as dd from user where referal='$ucode' and usertype='associate'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $count=$b['dd']; $ccc="select count(usercode) as dd from user where referal='$ucode' and usertype='customer'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $ccount=$c['dd']; $name=$a['name']; $ddd="select sum(amount) as dd from business where referal='$ucode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $deposit=$d['dd']; echo "<tr><td>$sr</td><td><b>$name</b><br><span style='font-size:10px;'>$add</span></td><td>$contact</td><td>$rankk</td><td>$deposit</td></tr>"; } } function customerfull(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $userid=$a['userid']; $usercode=$a['usercode']; $ddd="select * from tenure where usercode='$usercode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $plotcode=$d['plotcode']; $eee="select * from plot where plotcode='$plotcode'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $plotno=$e['plotno']; $joiningd=$a['joiningdate']; $name=$a['name'];$gender=$a['gender'];$age=$a['age'];$father=$a['father'];$address=$a['address']; $cityid=$a['city']; $joining=date('d-m-Y', strtotime($joiningd)); $bbb="select * from city where cityid='$cityid'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $city=$b['name']; $stateid=$a['state']; $ccc="select * from state where stateid='$stateid'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $state=$c['name']; $pincode=$a['pincode'];$contact=$a['contact'];$whatsapp=$a['whatsapp'];$email=$a['email'];$plancode=$a['plancode'];$referal=$a['referal']; $username=$a['username'];$password=$a['password']; $fff="select * from user where usercode='$referal'"; $ff=mysqli_query($con,$fff); $f=mysqli_fetch_assoc($ff); $refname=$f['name']; $sr>='0';$sr++; echo "<tr style='font-size:12px;'><td>$sr</td><td>$name($age)<br>$joining</td><td>$father</td><td>$address $city $state $pincode</td><td>$contact</td><td>$refname</td><td>$plotno</td></tr>"; } } function associatefull(){ include 'db.php'; $aaa="select * from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $userid=$a['userid']; $usercode=$a['usercode']; $ddd="select * from tenure where usercode='$usercode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $plotcode=$d['plotcode']; $eee="select * from plot where plotcode='$plotcode'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $plotno=$e['plotno']; $joiningd=$a['joiningdate']; $name=$a['name'];$rank=$a['rank'];$age=$a['age'];$father=$a['father'];$address=$a['address']; $cityid=$a['city']; $joining=date('d-m-Y', strtotime($joiningd)); $bbb="select * from city where cityid='$cityid'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $city=$b['name']; $stateid=$a['state']; $ccc="select * from state where stateid='$stateid'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $state=$c['name']; $pincode=$a['pincode'];$contact=$a['contact'];$whatsapp=$a['whatsapp'];$email=$a['email'];$plancode=$a['plancode'];$referal=$a['referal']; $username=$a['username'];$password=$a['password']; $fff="select * from user where usercode='$referal'"; $ff=mysqli_query($con,$fff); $f=mysqli_fetch_assoc($ff); $refname=$f['name']; $sr>='0';$sr++; echo "<tr style='font-size:12px;'><td>$sr</td><td>$name($age)<br>$joining</td><td>$father</td><td>$address $city $state $pincode</td><td>$contact</td><td>$refname</td><td>$rank</td></tr>"; } } function visits(){ include 'db.php'; $aaa="select * from sitevisit where status='pending'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $usercode=$a['usercode']; $contact=$a['contact']; $address=$a['address']; $rd=$a['requestdate']; $sitearea=$a['sitearea']; $sitename=$a['sitenme']; $status=$a['status']; $rd=date('d-m-Y',strtotime($rd)); $sitevisitid=$a['sitevisit']; echo " $name<br>$contact<br>$address<br> <b>$rd</b><br> $sitename $sitearea<br> <span style='color:red;'>$status</span><br> <div style='float:left;margin:3px;'><form method='POST' action='function.php'><input type='hidden' name='sitevisitid' value='$sitevisitid'><input type='submit' name='donevisit' value='Done' style='border:1px solid green;color:green;border-radius:5px;background-color:white;font-size:10px;'></form></div><div style='float:left;margin:3px;'><form method='POST' action='function.php'><input type='hidden' name='sitevisitid' value='$sitevisitid'><input type='submit' name='delvisit' value='Cancel' style='border:1px solid red;color:red;border-radius:5px;background-color:white;font-size:10px;'></form></div> <br> <hr> "; } } function allcommission(){ include 'db.php'; $aaa="select sum(amount) as dd from business where businesstype='New Business'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $newbiz=$a['dd']; $aaa="select sum(amount) as dd from business where businesstype='emi'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $emibiz=$a['dd']; $ttl=$newbiz+$emibiz; $com=$ttl*17/100; echo $com; } function teambusiness($usercode){ include 'db.php'; $aaa=""; } function commissionledger(){ include 'db.php'; $aaa="select * from business group by referal"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['referal']; $businessid=$a['businessid']; $bbb="select sum(amount) as dd from business where businesstype='new business' and referal='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $newbiz=$b['dd']; $bbb="select sum(amount) as dd from business where businesstype='emi' and referal='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $emi=$b['dd']; $ttl=$newbiz+$emi; $ccc="select * from user where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $rank=$c['rank']; $name=$c['name']; $ucode=$c['usercode']; $reff=$c['referal']; $userid=$c['userid']; $ddd="select * from rank where rankcode='$rank'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $comp=$d['commission']; $eee="select sum(amount) as dd from payout where usercode='$ucode'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $paid=$e['dd']; if($paid){ $paid=$paid; }else{ $paid="0"; } $fff="select sum(amount) as dd from advance where usercode='$usercode'"; $ff=mysqli_query($con,$fff); $f=mysqli_fetch_assoc($ff); $advance=$f['dd']; $cma=$ttl*$comp/100; echo "<tr><td></td><td><a href='breport.php?usercode=$usercode'>$name</a><br><span style='font-size:8px;color:brown;'>Rank : $rank Commission : $comp <br> Advance : $advance</span></td><td>$ttl</td><td><a href='comrcpt.php?usercode=$usercode'>$cma</a></td><td>$paid</td><td><form method='POST' action='paycommission.php'><input type='hidden' name='userid' value='$userid'><input type='hidden' name='name' value='$name'><input type='hidden' name='comp' value='$cma'><input type='hidden' name='advanc' value='$advance'><input type='submit' name='commissionpay' value='Pay'></form></td></tr>"; } } function payoutlist(){ include 'db.php'; $aaa="select * from payout"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $amount=$a['amount']; $narration=$a['narration']; $dt=$a['dt']; $dt=date('d-m-Y',strtotime($dt)); $payoutid=$a['payoutid']; echo "<tr><td>$dt</td><td>$name</td><td>$amount</td><td>$narration</td><td><form method='post' action='updatepayout.php'><input type='hidden' name='payoutid' value='$payoutid'><input type='submit' name='updpayout' value='Update'></form></td><td><form method='post' action='function.php'><input type='hidden' name='payoutid' value='$payoutid'><input type='submit' name='delpayout' value='Delete'></form></td></tr>"; } } function printpayoutt(){ include 'db.php'; $aaa="select * from payout group by usercode"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $amount=$a['amount']; $narration=$a['narration']; $dt=$a['dt']; $dt=date('d-m-Y',strtotime($dt)); $payoutid=$a['payoutid']; $sr>='0'; $sr++; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $contact=$b['contact']; $referal=$b['referal']; $ccc="select * from user where referal='$referal'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $refname=$c['name']; $refcon=$c['contact']; $ddd="select sum(amount) as dd from payout where usercode='$usercode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $sum=$d['dd']; echo "<tr><td>$sr</td><td><b>$name</b><br>$contact</td><td>$refname<br>$refcon</td><td>$sum</td></tr>"; } } function payoutcount(){ include 'db.php'; $aaa="select sum(amount) as dd from payout"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); $sum=$a['dd']; echo $sum; } function bankkyclist(){ include 'db.php'; $aaa="select * from bank"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $bank=$a['bank']; $ifsc=$a['ifsc']; $acc=$a['accountno']; $bankid=$a['bankid']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $type=$b['usertype']; echo "<tr><td>$name</td><td>$type</td><td>$bank</td><td>$ifsc</td><td>$acc</td><td><form method='POST' action='function.php'><input type='hidden' name='bankid' value='$bankid'><input type='submit' name='delbank' value='Delete' style='border:1px solid red;color:red;border-radius:5px;background-color:white;'></form></td></tr>"; } } function user_action($userid){ include 'db.php'; $aaa="select * from user where userid='$userid'"; $aa=mysqli_query($con,$aaa); $a=mysqli_fetch_assoc($aa); } function sitevisitlist(){ include 'db.php'; $aaa="select * from sitevisit"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $contact=$a['contact']; $referal=$a['referal'];$status=$a['status'];$sid=$a['sitevisit']; $sitearea=$a['sitearea']; $sitename=$a['sitename']; $dt=$a['dt']; $dt=date('d-m-Y',strtotime($dt)); $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; $refcon=$b['contact']; echo "<tr><td>$dt</td><td>$name<br>$contact</td><td>$refname<br>$refcon</td><td>$sitename $sitearea</td><td>$status</td><td><div style='float:left;margin:2px;'><form method='POST' action='sitevisitupdate.php'><input type='hidden' name='sitevisitid' value='$sid'><input type='submit' name='update_sitevisit' value='Update' style='background-color:white;color:green;border:1px solid green;border-radius:4px;font-size:10px;'></form></div><div style='float:left;margin:2px;'><form method='POST' action='function.php'><input type='hidden' name='sitevisitid' value='$sid'><input type='submit' name='delete_sitevisit' value='Delete' style='background-color:white;color:red;border:1px solid red;border-radius:4px;font-size:10px;'></form></div></td></tr>"; } } if(isset($_POST['delete_sitevisit'])){ $sitevisitid=$_POST['sitevisitid']; $aaa="delete from sitevisit where sitevisit='$sitevisitid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:sitevisitlist.php'); } } if(isset($_POST['updvisit'])){ $sid=$_POST['sitevisit']; $name=$_POST['name']; $gender=$_POST['gender']; $address=$_POST['address']; $contact=$_POST['contact']; $sitearea=$_POST['sitearea']; $sitename=$_POST['sitename']; $date=$_POST['date']; $referal=$_POST['referal']; $status=$_POST['status']; $aaa="update sitevisit set name='$name', contact='$contact', requestdate='$date', gender='$gender', address='$address', sitearea='$sitearea', sitename='$sitename', referal='$referal', status='$status' where sitevisit='$sid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:sitevisitlist.php'); } } function associatechain($usercode){ include 'db.php'; $aaa="select * from user where referal='$usercode' and usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $date=$a['date'];$date=date('d-m-Y H:i',strtotime($date)); $usercode=$a['usercode'];$name=$a['name']; $con=$a['contact']; $father=$a['father'];$add=$a['address']; $rank=$a['rank']; echo "<tr><td>$name</td><td>$father</td><td>$con</td><td>$add</td><td>$rank</td></tr>"; associatechain($usercode); } } function breport($usr){ include 'db.php'; $aaa="select * from business where referal='$usr'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $uco=$a['usercode']; $amt=$a['amount']; $bid=$a['businessid']; $dt=$a['dt']; $dt=date('d-m-Y',strtotime($dt)); $mode=$a['mode']; $nr=$a['narration']; $bbb="select * from user where usercode='$uco'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $cust=$b['name']; echo "<tr><td>$dt</td><td>$cust</td><td>$amt</td><td>$nr</td><td>$mode</td><td><form method='post' action='function.php'><input type='hidden' name='bid' value='$bid'><input type='submit' name='delbu' value='Delete'></form></td></tr>"; } } if(isset($_POST['delbu'])){ $bid=$_POST['bid']; $aaa="delete from business where businessid='$bid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:commissionlist.php'); } } function customerlistshow(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $userid=$a['userid']; $usercode=$a['usercode']; $ddd="select * from tenure where usercode='$usercode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $plotcode=$d['plotcode']; $eee="select * from plot where plotcode='$plotcode'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $plotno=$e['plotno']; $joiningd=$a['joiningdate']; $name=$a['name'];$gender=$a['gender'];$age=$a['age'];$father=$a['father'];$address=$a['address']; $cityid=$a['city']; $joining=date('d-m-Y', strtotime($joiningd)); $bbb="select * from city where cityid='$cityid'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $city=$b['name']; $stateid=$a['state']; $ccc="select * from state where stateid='$stateid'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $state=$c['name']; $pincode=$a['pincode'];$contact=$a['contact'];$whatsapp=$a['whatsapp'];$email=$a['email'];$plancode=$a['plancode'];$referal=$a['referal']; $username=$a['username'];$password=$a['password']; $fff="select * from user where usercode='$referal'"; $ff=mysqli_query($con,$fff); $f=mysqli_fetch_assoc($ff); $refname=$f['name']; echo "<tr><td>$joining</td><td>$name</td><td>$refname</td><td>$plotno</td></tr>"; } } function associatelistshow(){ include 'db.php'; $aaa="select * from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $userid=$a['userid']; $joining=$a['joiningdate']; $joining=date('d-m-Y',strtotime($joining)); $name=$a['name'];$gender=$a['gender'];$age=$a['age'];$father=$a['father'];$address=$a['address']; $city=$a['city'];$state=$a['state'];$pincode=$a['pincode'];$contact=$a['contact'];$whatsapp=$a['whatsapp'];$email=$a['email'];$rank=$a['rank'];$referal=$a['referal'];$usercode=$a['usercode']; $username=$a['username'];$password=$a['password']; $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; echo "<tr><td>$joining</td><td>$name</td><td>$contact</td><td>$refname</td></tr>"; } } function refco($usercode,$type,$voucherno,$amount){ include 'db.php'; date_default_timezone_set('Asia/Kolkata'); $date=date('Y-m-d H:i:s'); $dt=date('Y-m-d'); $aaa1="select * from user where usercode='$usercode'"; $aa1=mysqli_query($con,$aaa1); $a1=mysqli_fetch_assoc($aa1); $ref1=$a1['referal']; $aaa2="select * from user where usercode='$ref1'"; $aa2=mysqli_query($con,$aaa2); $a2=mysqli_fetch_assoc($aa2); $ref2=$a2['referal']; $aaa3="select * from user where usercode='$ref2'"; $aa3=mysqli_query($con,$aaa3); $a3=mysqli_fetch_assoc($aa3); $ref3=$a3['referal']; $aaa4="select * from user where usercode='$ref3'"; $aa4=mysqli_query($con,$aaa4); $a4=mysqli_fetch_assoc($aa4); $ref4=$a4['referal']; $aaa5="select * from user where usercode='$ref4'"; $aa5=mysqli_query($con,$aaa5); $a5=mysqli_fetch_assoc($aa5); $ref5=$a5['referal']; $aaa6="select * from user where usercode='$ref5'"; $aa6=mysqli_query($con,$aaa6); $a6=mysqli_fetch_assoc($aa6); $ref6=$a6['referal']; $aaa7="select * from user where usercode='$ref6'"; $aa7=mysqli_query($con,$aaa7); $a7=mysqli_fetch_assoc($aa7); $ref7=$a7['referal']; $aaa8="select * from user where usercode='$ref7'"; $aa8=mysqli_query($con,$aaa8); $a8=mysqli_fetch_assoc($aa8); $ref8=$a8['referal']; $aaa9="select * from user where usercode='$ref8'"; $aa9=mysqli_query($con,$aaa9); $a9=mysqli_fetch_assoc($aa9); $ref9=$a9['referal']; $aaa10="select * from user where usercode='$ref9'"; $aa10=mysqli_query($con,$aaa10); $a10=mysqli_fetch_assoc($aa10); $ref10=$a10['referal']; $aaa11="select * from user where usercode='$ref10'"; $aa11=mysqli_query($con,$aaa11); $a11=mysqli_fetch_assoc($aa11); $ref11=$a11['referal']; $aaa12="select * from user where usercode='$ref11'"; $aa12=mysqli_query($con,$aaa12); $a12=mysqli_fetch_assoc($aa12); $ref12=$a12['referal']; $aaa13="select * from user where usercode='$ref12'"; $aa13=mysqli_query($con,$aaa13); $a13=mysqli_fetch_assoc($aa13); $ref13=$a13['referal']; $aaa14="select * from user where usercode='$ref13'"; $aa14=mysqli_query($con,$aaa14); $a14=mysqli_fetch_assoc($aa14); $ref14=$a14['referal']; $aaa15="select * from user where usercode='$ref14'"; $aa15=mysqli_query($con,$aaa15); $a15=mysqli_fetch_assoc($aa15); $ref15=$a15['referal']; $aaa16="select * from user where usercode='$ref15'"; $aa16=mysqli_query($con,$aaa16); $a16=mysqli_fetch_assoc($aa16); $ref16=$a16['referal']; $aaa17="select * from user where usercode='$ref16'"; $aa17=mysqli_query($con,$aaa17); $a17=mysqli_fetch_assoc($aa17); $ref17=$a17['referal']; $aaa18="select * from user where usercode='$ref17'"; $aa18=mysqli_query($con,$aaa18); $a18=mysqli_fetch_assoc($aa18); $ref18=$a18['referal']; $aaa19="select * from user where usercode='$ref18'"; $aa19=mysqli_query($con,$aaa19); $a19=mysqli_fetch_assoc($aa19); $ref19=$a19['referal']; $aaa20="select * from user where usercode='$ref19'"; $aa20=mysqli_query($con,$aaa20); $a20=mysqli_fetch_assoc($aa20); $ref20=$a20['referal']; $aaa21="select * from user where usercode='$ref20'"; $aa21=mysqli_query($con,$aaa21); $a21=mysqli_fetch_assoc($aa21); $ref21=$a21['referal']; //echo $ref1; echo "<br>"; //echo $ref2; echo "<br>"; //echo $ref3; echo "<br>"; //echo $ref4; echo "<br>"; //echo $ref5; echo "<br>"; //echo $ref6; echo "<br>"; //echo $ref7; echo "<br>"; //echo $ref8; echo "<br>"; //echo $ref9; echo "<br>"; //echo $ref10; echo "<br>"; //echo $ref11; echo "<br>"; //echo $ref12; echo "<br>"; //echo $ref13; echo "<br>"; //echo $ref14; echo "<br>"; //echo $ref15; echo "<br>"; //echo $ref16; echo "<br>"; //echo $ref17; echo "<br>"; //echo $ref18; echo "<br>"; //echo $ref19; echo "<br>"; //echo $ref20; echo "<br>"; //echo $ref21; echo "<br>"; $b1="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref1','$usercode','$amount','$type','$voucherno','$usercode')"; $b2="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref2','$ref1','$amount','$type','$voucherno','$usercode')"; $b3="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref3','$ref2','$amount','$type','$voucherno','$usercode')"; $b4="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref4','$ref3','$amount','$type','$voucherno','$usercode')"; $b5="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref5','$ref4','$amount','$type','$voucherno','$usercode')"; $b6="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref6','$ref5','$amount','$type','$voucherno','$usercode')"; $b7="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref7','$ref6','$amount','$type','$voucherno','$usercode')"; $b8="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref8','$ref7','$amount','$type','$voucherno','$usercode')"; $b9="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref9','$ref8','$amount','$type','$voucherno','$usercode')"; $b10="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref10','$ref9','$amount','$type','$voucherno','$usercode')"; $b11="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref11','$ref10','$amount','$type','$voucherno','$usercode')"; $b12="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref12','$ref11','$amount','$type','$voucherno','$usercode')"; $b13="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref13','$ref12','$amount','$type','$voucherno','$usercode')"; $b14="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref14','$ref13','$amount','$type','$voucherno','$usercode')"; $b15="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref15','$ref14','$amount','$type','$voucherno','$usercode')"; $b16="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref16','$ref15','$amount','$type','$voucherno','$usercode')"; $b17="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref17','$ref16','$amount','$type','$voucherno','$usercode')"; $b18="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref18','$ref17','$amount','$type','$voucherno','$usercode')"; $b19="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref19','$ref18','$amount','$type','$voucherno','$usercode')"; $b20="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$dt','active','$ref20','$ref19','$amount','$type','$voucherno','$usercode')"; if($ref1){ mysqli_query($con,$b1); }else{ } if($ref2){ mysqli_query($con,$b2); }else{ } if($ref3){ mysqli_query($con,$b3); }else{ } if($ref4){ mysqli_query($con,$b4); }else{ } if($ref5){ mysqli_query($con,$b5); }else{ } if($ref6){ mysqli_query($con,$b6); }else{ } if($ref7){ mysqli_query($con,$b7); }else{ } if($ref8){ mysqli_query($con,$b8); }else{ } if($ref9){ mysqli_query($con,$b9); }else{ } if($ref10){ mysqli_query($con,$b10); }else{ } if($ref11){ mysqli_query($con,$b11); }else{ } if($ref12){ mysqli_query($con,$b12); }else{ } if($ref13){ mysqli_query($con,$b13); }else{ } if($ref14){ mysqli_query($con,$b14); }else{ } if($ref15){ mysqli_query($con,$b15); }else{ } if($ref16){ mysqli_query($con,$b16); }else{ } if($ref17){ mysqli_query($con,$b17); }else{ } if($ref18){ mysqli_query($con,$b18); }else{ } if($ref19){ mysqli_query($con,$b19); }else{ } if($ref20){ mysqli_query($con,$b20); }else{ } } function assop($from,$to){ include 'db.php'; $sub_sql= " where dt >= '$from' && dt <= '$to' "; $aaa="select * from business $sub_sql group by referal"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $referal=$a['referal']; $bbb="select sum(amount) as dd from business $sub_sql and referal='$referal' and pmttype='income'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $sum=$b['dd']; $ccc="select * from user where usercode='$referal'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $name=$c['name']; $contact=$c['contact']; $rank=$c['rank']; $ddd="select * from rank where rankcode='$rank'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $cp=$d['commission']; $commission=$sum*$cp/100; $eee="select sum(amount) as dd from advance where usercode='$referal' and type='dr'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $advance_dr=$e['dd']; $ggg="select sum(amount) as dd from advance where usercode='$referal' and type='cr'"; $gg=mysqli_query($con,$ggg); $g=mysqli_fetch_assoc($gg); $advance_cr=$g['dd']; $advance=$advance_dr; $fff="select sum(amount) as dd from payout where usercode='$referal'"; $ff=mysqli_query($con,$fff); $f=mysqli_fetch_assoc($ff); $payout=$f['dd']; $admn=$commission*5/100; $toto=$advance+$payout+$admn; $balance=$commission-$toto; $newbalance=$balance; if($name){ if($sum){ echo "<tr><td>$name<br>$contact<br>Commission $cp</td><td>$sum</td><td>$advance</td><td>$payout</td><td>$admn</td><td>$commission</td><td>$newbalance</td><td><form method='POST' action='payout2.php'><input type='hidden' name='usercode' value='$referal'><input type='hidden' name='advance' value='$advance'><input type='hidden' name='payout' value='$payout'><input type='hidden' name='sum' value='$sum'><input type='hidden' name='amount' value='$newbalance'><input type='hidden' name='from' value='$from'><input type='hidden' name='to' value='$to'><input type='submit' name='payamount' value='Pay'></form></td></tr>"; } } } } function busida_new($from,$to){ include 'db.php'; $from=$_POST['from']; $to=$_POST['to']; $sub_sql= " where dt >= '$from' && dt <= '$to' "; $aaa="select * from business $sub_sql and businesstype='new business'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amt=$a['amount']; $btype=$a['businesstype']; $usercode=$a['usercode']; $date=$a['dt']; $dt=date('d-m-Y',strtotime($date)); $vch=$a['voucherno']; $vco=$a['voucherno']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $cont=$b['contact']; $refcode=$b['referal']; $ccc="select * from user where usercode='$refcode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $refname=$c['name']; $refcon=$c['contact']; echo "<tr><td>$dt<br>$vco</td><td>$amt</td><td>$btype</td><td>$name<br>$cont</td><td>$refname<br>$refcon</td><td><a href='orccheck.php?vch=$vch'>ORC Check</a></td></tr>"; } } if(isset($_POST['agentspotpayout'])){ $usercode=$_POST['usercode']; $amount=$_POST['amount']; $from=$_POST['from']; $to=$_POST['to']; $narration=$_POST['narration']; $advance=$_POST['advance']; if($advance){ $advance=$advance; }else{ $advance="0"; } $total=$_POST['total']; $totall=$amount-$advance; $aaa="INSERT INTO `payout`(`payoutid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `befrom`, `beto`, `business`, `advance`, `btype`) VALUES ('','$date','$dt','active','$usercode','$amount','$narration','','$from','$to','$totall','$advance','spot')"; $bbb="INSERT INTO `advance`(`advanceid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `approvedby`, `type`) VALUES ('','$date','$dt','active','$usercode','-$advance','$narration','','','cr')"; $bb=mysqli_query($con,$bbb); $aa=mysqli_query($con,$aaa); if($aa){ header('location:payout2.php'); } } function tpayout($usercode){ include 'db.php'; $aaa="select * from payout where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $narration=$a['narration']; $from=$a['befrom']; $to=$a['beto']; $dt=$a['dt']; $payoutid=$a['payoutid']; $userco=$a['usercode']; $advance=$a['advance']; $business=$a['business']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $contact=$b['contact']; echo "<tr><td>$amount</td><td>$narration</td><td>$from</td><td>$from</td><td><div><form method='POST' action='printpayout.php'><input type='hidden' name='usercode' value='$userco'><input type='hidden' name='advance' value='$advance'><input type='hidden' name='business' value='$business'><input type='hidden' name='amount' value='$amount'><input type='hidden' name='narration' value='$narration'><input type='hidden' name='from' value='$from'><input type='hidden' name='to' value='$to'><input type='hidden' name='name' value='$name'><input type='hidden' name='contact' value='$contact'><input type='submit' name='printrcpt' value='Print' style='background-color:green;color:white;border:1px solid green;border-radius:4px;font-size:10px;'></form></div></td></tr>"; } } function n2w($number){ $no = floor($number); $point = round($number - $no, 2) * 100; $hundred = null; $digits_1 = strlen($no); $i = 0; $str = array(); $words = array('0' => '', '1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six', '7' => 'seven', '8' => 'eight', '9' => 'nine', '10' => 'ten', '11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty', '30' => 'thirty', '40' => 'forty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety'); $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); while ($i < $digits_1) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 9) ? 's' : null; $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : $words[floor($number / 10) * 10] . " " . $words[$number % 10] . " " . $digits[$counter] . $plural . " " . $hundred; } else $str[] = null; } $str = array_reverse($str); $result = implode('', $str); $points = ($point) ? "." . $words[$point / 10] . " " . $words[$point = $point % 10] : ''; echo $result . "Rupees " . $points . " "; } function orcstatement($usercode,$from,$to){ include 'db.php'; $sub_sql= " where dt >= '$from' && dt <= '$to' "; $aaa="select * from bfinder $sub_sql and usercode='$usercode'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $sender=$a['sender']; $amount=$a['amount']; $dtt=$a['dt']; $dt=date('d-m-Y',strtotime($dtt)); $ddd="select * from user where usercode='$usercode'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $urank=$d['rank']; $eee="select * from rank where rankcode='$urank'"; $ee=mysqli_query($con,$eee); $e=mysqli_fetch_assoc($ee); $urn=$e['commission']; $ccc="select * from user where usercode='$sender'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $sender_name=$c['name']; $sender_contact=$c['contact']; $sender_rank=$c['rank']; $sendertype=$c['usertype']; $bbb="select * from rank where rankcode='$sender_rank'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $senderrank=$b['name']; $sendercom=$b['commission']; $comper=$urn-$sendercom; if($sendertype=='customer'){ $comper="0"; }else{ $comper=$comper; } $ca=$amount*$comper/100; //$cat=array_sum($ca); $newca=$ca*95/100; $admn=$ca*5/100; echo "<tr><td>$dt</td><td>$amount</td><td>$sender_name<br>$sender_contact<br>Rank : $sender_rank<br>Commission : $sendercom</td><td>$comper</td><td>$ca</td><td>$admn</td><td class='price-cell'>$newca</td></tr>"; } } if(isset($_POST['orcconfirm'])){ $usercode=$_POST['usercode']; $from=$_POST['from']; $to=$_POST['to']; $amount=$_POST['amount']; $ca=$_POST['ca']; $narration=$_POST['narration']; $aaa="INSERT INTO `payout`(`payoutid`, `date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `befrom`, `beto`, `business`, `advance`, `btype`) VALUES ('','$date','$dt','active','$usercode','$ca','$narration','','$from','$to','$amount','','orc')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:orc2.php'); } } function plotnoshow(){ include 'db.php'; $aaa="select * from plot where availability='0'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $plotcode=$a['plotcode']; $plotno=$a['plotno']; $sitenamecode=$a['sitename']; $siteareacode=$a['sitearea']; $price=$a['plotsize']; $unit=$a['unit']; $bbb="select * from site where siteid='$sitenamecode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $sitename=$b['name']; $ccc="select * from sitearea where siteareaid='$siteareacode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $sitearea=$c['name']; echo "<option value='$plotcode'>$plotno - $sitename - $sitearea - Size : $price-$unit</option>"; } } function alldatebusiness(){ include 'db.php'; $aaa="select * from business group by dt"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $dt=$a['dt']; $dtt=date('d-m-Y',strtotime($dt)); $bbb="select sum(amount) as dd from business where businesstype='new business' and dt='$dt'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $usercode=$b['usercode']; $newsum=$b['dd']; if($newsum){ $newsum=$newsum; }else{ $newsum="0"; } $ccc="select sum(amount) as dd from business where businesstype='emi' and dt='$dt'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $emisum=$c['dd']; if($emisum){ $emisum=$emisum; }else{ $emisum="0"; } echo "<tr><td><a href='datewisebusi.php?dt=$dt'>$dtt</a></td><td><a href='datewisenewbusi.php?dt=$dt'>$newsum</a></td><td><a href='datewiseemi.php?dt=$dt'>$emisum</a></td></tr>"; } } function datewisebusi($dt){ include 'db.php'; $aaa="select * from business where dt='$dt'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $mode=$a['mode']; $narration=$a['narration']; $usercode=$a['usercode']; $referal=$a['referal']; $voucher=$a['voucherno']; $ccc="select * from user where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $name=$c['name']; $contact=$c['contact']; $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; $refcon=$b['contact']; echo "<tr><td><b>$name</b><br>$contact</td><td>$refname<br>$refcon</td><td>$amount</td><td>$narration</td><td>$mode</td><td>$voucher</td></tr>"; } } function datewiseemi($dt){ include 'db.php'; $aaa="select * from business where businesstype='emi' and dt='$dt'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $mode=$a['mode']; $narration=$a['narration']; $usercode=$a['usercode']; $referal=$a['referal']; $voucher=$a['voucherno']; $ccc="select * from user where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $name=$c['name']; $contact=$c['contact']; $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; $refcon=$b['contact']; echo "<tr><td><b>$name</b><br>$contact</td><td>$refname<br>$refcon</td><td>$amount</td><td>$narration</td><td>$mode</td><td>$voucher</td></tr>"; } } function datewisenewbusi($dt){ include 'db.php'; $aaa="select * from business where businesstype='new business' and dt='$dt'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $mode=$a['mode']; $narration=$a['narration']; $usercode=$a['usercode']; $referal=$a['referal']; $voucher=$a['voucherno']; $ccc="select * from user where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $name=$c['name']; $contact=$c['contact']; $bbb="select * from user where usercode='$referal'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $refname=$b['name']; $refcon=$b['contact']; echo "<tr><td><b>$name</b><br>$contact</td><td>$refname<br>$refcon</td><td>$amount</td><td>$narration</td><td>$mode</td><td>$voucher</td></tr>"; } } function bfindersender(){ include 'db.php'; $aaa="select * from user"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } function bfinderreceiver(){ include 'db.php'; $aaa="select * from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } if(isset($_POST['submit_finder'])){ $voucher=$_POST['voucher']; $btype=$_POST['btype']; $amount=$_POST['amount']; $sender=$_POST['sender']; $datee=$_POST['date']; $narration=$_POST['narration']; $receiver=$_POST['receiver']; $bdate=$_POST['date']; $aaa="INSERT INTO `bfinder`(`bfinderid`, `date`, `dt`, `status`, `usercode`, `sender`, `amount`, `btype`, `voucher`, `narration`) VALUES ('','$date','$bdate','active','$receiver','$sender','$amount','$btype','$voucher','$narration')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:orcfinder.php'); } } function bfinderlist(){ include 'db.php'; $aaa="select * from bfinder"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $sender=$a['sender']; $amount=$a['amount']; $mode=$a['mode']; $narration=$a['narration']; $btype=$a['btype']; $pmttype=$a['ptttype']; $bfinderid=$a['bfinderid']; $voucher=$a['voucher']; $dt=$a['dt']; $dtt=date('d-m-Y',strtotime($dt)); $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $contact=$b['contact']; $ccc="select * from user where usercode='$sender'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $sname=$c['name']; $scontact=$c['contact']; $ddd="select * from user where usercode='$narration'"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $dname=$d['name']; $dcontact=$d['contact']; echo "<tr><td>$voucher</td><td>$dtt</td><td>$name<br>$contact</td><td>$sname<br>$scontact</td><td>$amount</td><td>$dname<br>$dcontact</td><td>$mode</td><td><div style='margin:2px;float:left;'><form method='POST' action='bfinderupd.php'><input type='hidden' name='bfinderid' value='$bfinderid'><input type='hidden' name='btype' value='$btype'><input type='hidden' name='amount' value='$amount'><input type='hidden' name='name' value='$name'><input type='hidden' name='sname' value='$sname'><input type='hidden' name='narration' value='$narration'><input type='submit' name='bfinder_upd' value='Update'></form></div><div style='margin:2px;float:left;'><form method='POST' action='function.php'><input type='hidden' name='bfinderid' value='$bfinderid'><input type='submit' name='bfinder_del' value='Delete'></form></div></td></tr>"; } } if(isset($_POST['bfinder_del'])){ $bfinderid=$_POST['bfinderid']; $aaa="delete from bfinder where bfinderid='$bfinderid'"; mysqli_query($con,$aaa); header('location:orcfinder.php'); } function customerfinder(){ include 'db.php'; $aaa="select * from user where usertype='customer'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $name=$a['name']; echo "<option value='$usercode'>$name</option>"; } } function expenseoption(){ include 'db.php'; $aaa="select * from expense"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $expenseid=$a['expenseid']; echo "<option value='$expenseid'>$name</option>"; } } if(isset($_POST['payexpense'])){ $name=$_POST['name']; $amount=$_POST['amount']; $narration=$_POST['narration']; $contact=$_POST['contact']; $mydt=$_POST['mydt']; $bbb="select * from expense where expenseid='$name'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $namee=$b['name']; $aaa="INSERT INTO `expr`(`exprid`, `date`, `dt`, `status`, `expid`, `name`, `contact`, `amount`, `narration`, `mydt`) VALUES ('','$date','$dt','active','$name','$namee','$contact','$amount','$narration','$mydt')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:payexpense.php'); } } function payexpenselist(){ include 'db.php'; $aaa="select * from expr order by exprid desc"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $contact=$a['contact']; $amount=$a['amount']; $narration=$a['narration']; $exprid=$a['exprid']; $mydt=$a['mydt']; $dt=date('d-m-Y',strtotime($mydt)); echo "<tr><td>$dt</td><td>$name</td><td>$amount</td><td>$contact</td><td>$narration</td><td><form method='POST' action='function.php'><input type='hidden' name='exprid' value='$exprid'><input type='submit' name='expr_del' value='Delete'></form></td></tr>"; } } if(isset($_POST['expr_del'])){ $exprid=$_POST['exprid']; $aaa="delete from expr where exprid='$exprid'"; mysqli_query($con,$aaa); header('location:payexpenselist.php'); } function agtb($usercode,$from,$to){ include 'db.php'; $aaa="select * from business where referal='$usercode' and businesstype='new business' and dt >= '$from' && dt <= '$to' "; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $dt=$a['dt']; $dt=date('d-m-Y',strtotime($dt)); $amount=$a['amount']; $bt=$a['businesstype']; echo "<tr><td>$dt</td><td>$amount</td><td>$bt</td></tr>"; } $bbb="select * from business where referal='$usercode' and businesstype='emi' and dt >= '$from' && dt <= '$to' "; $bb=mysqli_query($con,$bbb); while($b=mysqli_fetch_assoc($bb)){ $dt_e=$b['dt']; $dt_e=date('d-m-Y',strtotime($dt_e)); $amount_e=$b['amount']; $bt_e=$b['businesstype']; echo "<tr><td>$dt_e</td><td>$amount_e</td><td>$bt_e</td></tr>"; } } function emireminder(){ include 'db.php'; $aaa="select * from tenure where tenure='installment'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $usercode=$a['usercode']; $plotcode=$a['plotcode']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $cnt=$b['contact']; $ccc="select * from plot where plotcode='$plotcode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $plotno=$c['plotno']; $ddd="select * from business where usercode='$usercode' order by businessid desc limit 1"; $dd=mysqli_query($con,$ddd); $d=mysqli_fetch_assoc($dd); $depod=$d['dt']; $amount=$d['amount']; $newDate = date('Y-m-d', strtotime($depod . ' +30 days')); $cdd=date('Y-m-d'); $newdepod=date('d-m-Y', strtotime($depod)); $newDatee=date('d-m-Y',strtotime($newDate)); if($cdd>$newDate){ echo "<tr><td>$name<br>$cnt<br>$newdepod</td><td>$plotno</td><td>$amount</td><td>$newDatee</td></tr>"; }else{ } } } if(isset($_POST['hero_add'])){ $from=$_POST['from']; $to=$_POST['to']; $fees=$_POST['fees']; $usercode=$_POST['usercode']; $image = $_FILES['image']['name']; $target = "uploads/".basename($image); move_uploaded_file($_FILES['image']['tmp_name'], $target); $aaa="INSERT INTO `hero`(`heroid`, `date`, `dt`, `status`, `usercode`, `from`, `to`, `fees`, `image`) VALUES ('','$date','$dt','active','$usercode','$from','$to','$fees','$image')"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:hero.php'); } } function heroimage(){ include 'db.php'; $aaa="select * from hero"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $from=$a['from']; $froms=date('d-M-Y', strtotime($from)); $to=$a['to']; $tos=date('d-M-Y', strtotime($to)); $usercode=$a['usercode']; $fees=$a['fees']; $image=$a['image']; $heroid=$a['heroid']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; echo "<tr><td>$froms / $tos</td><td>$name</td><td>$fees</td><td><a href='uploads/$image'><img src='uploads/$image' style='width:60px'></a></td><td><form method='POST' action='function.php'><input type='hidden' name='heroid' value='$heroid'><input type='submit' name='hero_dell' value='Delete'></form></td></tr>"; } } if(isset($_POST['hero_dell'])){ $heroid=$_POST['heroid']; echo $heroid; $aaa="delete from hero where heroid='$heroid'"; mysqli_query($con,$aaa); header('location:hero.php'); } function associatelistpy(){ include 'db.php'; $aaa="select * from user where usertype='associate'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $contact=$a['contact']; $referal=$a['referal']; $usercode=$a['usercode']; $ccc="select sum(amount) as dd from payout where usercode='$usercode'"; $cc=mysqli_query($con,$ccc); $c=mysqli_fetch_assoc($cc); $amount=$c['dd']; $bbb="select sum(amount) as dd from advance where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $advance=$b['dd']; echo "<tr><td>$name<br>$contact</td><td>$amount</td><td>$advance</td><td><form method='POST' action='pyagentwiselist.php'><input type='hidden' name='usercode' value='$usercode'><input type='submit' name='py_view' value='View'></form></td></tr>"; } } function aspylist($usercode){ include 'db.php'; $aaa="select * from payout where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $payoutid=$a['payoutid']; $dt=$a['dt']; $dtt=date('d-m-Y', strtotime($dt)); $narration=$a['narration']; $bfrom=$a['befrom']; $beto=$a['beto']; $business=$a['business']; $advance=$a['advance']; $btype=$a['btype']; echo "<tr><td>$dtt</td><td>$amount</td><td>$narration</td><td><form method='POST' action='pyage_upd.php'><input type='hidden' name='payoutid' value='$payoutid'><input type='hidden' name='amount' value='$amount'><input type='hidden' name='narration' value='$narration'><input type='hidden' name='business' value='$business'><input type='hidden' name='befrom' value='$bfrom'><input type='hidden' name='beto' value='$beto'><input type='hidden' name='advance' value='$advance'><input type='hidden' name='dt' value='$dt'><input type='hidden' name='btype' value='$btype'><input type='submit' name='py_upd' value='Update'></form></td></tr>"; } } if(isset($_POST['Pyassoc_upd'])){ $payoutid=$_POST['payoutid']; $amount=$_POST['amount']; $date=$_POST['date']; $narration=$_POST['narration']; $befrom=$_POST['befrom']; $beto=$_POST['beto']; $advance=$_POST['advance']; $business=$_POST['business']; $btype=$_POST['btype']; $aaa="update payout set amount='$amount', dt='$date', narration='$narration', befrom='$befrom', beto='$beto', business='$business', advance='$advance', btype='$btype' where payoutid='$payoutid'"; $aa=mysqli_query($con,$aaa); if($aa){ header('location:pyagentwiselist.php'); } } function orctpayout($usercode){ include 'db.php'; $aaa="select * from payout where usercode='$usercode'"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $amount=$a['amount']; $narration=$a['narration']; $from=$a['befrom']; $to=$a['beto']; $dt=$a['dt']; $payoutid=$a['payoutid']; $userco=$a['usercode']; $advance=$a['advance']; $business=$a['business']; $bbb="select * from user where usercode='$usercode'"; $bb=mysqli_query($con,$bbb); $b=mysqli_fetch_assoc($bb); $name=$b['name']; $contact=$b['contact']; echo "<tr><td>$amount</td><td>$narration</td><td>$advance</td><td>$business</td><td>$from</td><td>$from</td><td><div><form method='POST' action='orcprintpayout.php'><input type='hidden' name='usercode' value='$userco'><input type='hidden' name='advance' value='$advance'><input type='hidden' name='business' value='$business'><input type='hidden' name='amount' value='$amount'><input type='hidden' name='narration' value='$narration'><input type='hidden' name='from' value='$from'><input type='hidden' name='to' value='$to'><input type='hidden' name='name' value='$name'><input type='hidden' name='contact' value='$contact'><input type='submit' name='printrcpt' value='Print' style='background-color:green;color:white;border:1px solid green;border-radius:4px;font-size:10px;'></form></div></td></tr>"; } } function inquirylogs(){ include 'db.php'; $aaa="select * from inquiry order by inquiryid desc"; $aa=mysqli_query($con,$aaa); while($a=mysqli_fetch_assoc($aa)){ $name=$a['name']; $contact=$a['contact']; $email=$a['email']; $sitename=$a['sitename']; $size=$a['size']; $dt=$a['dt']; $dtt=date('d-m-Y', strtotime($dt)); echo "<tr><td>$dtt</td><td>$name</td><td>$contact</td><td>$email</td><td>$sitename</td><td>$size</td></tr>"; } } if (isset($_POST['submit_orcpay'])) { $usercode = mysqli_real_escape_string($con, $_POST['usercode']); $befrom = mysqli_real_escape_string($con, $_POST['from_date']); $beto = mysqli_real_escape_string($con, $_POST['to_date']); $business = mysqli_real_escape_string($con, $_POST['total_business']); $commission = (float)$_POST['commission']; $tds = (float)$_POST['tds']; // form mein minus (-) mein aata hai $admin_charge = (float)$_POST['admin_charge']; // form mein minus (-) mein aata hai $advance_neg = (float)$_POST['advance']; // form mein minus (-) mein aata hai $advance = abs($advance_neg); // Net Payable amount jo payout.amount mein save hoga $net_payable = round($commission + $tds + $admin_charge + $advance_neg, 2); $mode = mysqli_real_escape_string($con, $_POST['mode']); $narration = mysqli_real_escape_string($con, $_POST['narration']); $status = 'active'; $image = ''; $btype = 'orc'; $sql_payout = "INSERT INTO `payout` (`date`, `dt`, `status`, `usercode`, `amount`, `narration`, `image`, `befrom`, `beto`, `business`, `advance`, `btype`, `mode`) VALUES ('$date', '$dt', '$status', '$usercode', '$net_payable', '$narration', '$image', '$befrom', '$beto', '$business', '$advance', '$btype', '$mode')"; $run_payout = mysqli_query($con, $sql_payout); if ($run_payout) { echo "<script>alert('ORC Payment Saved'); window.location.href='orcpay.php';</script>"; } else { echo "<script>alert('Error: " . mysqli_error($con) . "'); window.history.back();</script>"; } } ?>