
PK 
<?php
ob_start();
error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
include '../includes/settings/constant.php';
//include '../includes/settings/db.php';
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId']) && empty($_SESSION['admin_role_id'])) {
header("Location: ../index.php");
exit();
}
$stateListdata = $function->getStateList($id=NULL,$isActive=1);
$ipaddress = $function->getRealIpAddr();
//print_r($member_id);
//print_r($_POST); exit;
if(isset($_POST['payBtn'])){
//print_r($_POST); exit;
$payBtn = !empty($_POST['payBtn'])?trim($_POST['payBtn']):"";
$entrytype = !empty($_POST['entrytype'])?trim($_POST['entrytype']):"";
$particular = !empty($_POST['particular'])?trim($_POST['particular']):"";
$uid = !empty($_POST['uid'])?trim($_POST['uid']):"";
$amount = !empty($_POST['amount'])?trim($_POST['amount']):"";
$username = !empty($_POST['username'])?trim($_POST['username']):"";
$mobileno = !empty($_POST['mobileno'])?trim($_POST['mobileno']):"";
$invoiceNo = !empty($_POST['invoiceNo'])?trim($_POST['invoiceNo']):"";
$orderId = !empty($_POST['orderId'])?trim($_POST['orderId']):"";
$invoiceId = !empty($_POST['invoiceId'])?trim($_POST['invoiceId']):"";
$_SESSION['uid']=$uid;
$_SESSION['username'] = $username;
$_SESSION['mobileno'] = $mobileno;
$_SESSION['entrytype'] = $entrytype;
$pdodb = PDODB::getInstance();
$date = date('Y-m-d H:i:s');
if ($payBtn=='Debit') {
$adjustmentEntry = "(Cancel Invoice)";
$sql2 = "INSERT INTO `tn_accounts` SET uid='".$uid."', particular='".$particular.$adjustmentEntry."', orderid='".$orderId."', debit='".$amount."', txndate='".$date."',ipaddress='".$ipaddress."', againstBy='".$invoiceNo."', is_adjustment='2'";
$result2 = $pdodb->query($sql2);
$sqlupt = "UPDATE `tn_invoice` SET isActive=0 WHERE id = '".$invoiceId."'";
$resultupt = $pdodb->query($sqlupt);
$adjustmentEntry2 = "(Refund Payment)";
$sql3 = "INSERT INTO `tn_accounts` SET uid='".$uid."', particular='".$particular.$adjustmentEntry2."',credit='".$amount."',txndate='".$date."',ipaddress='".$ipaddress."', is_adjustment='2'";
$result2 = $pdodb->query($sql3);
//print_r($result2); exit;
header("Location: adjustment-entry-list.php");
} else{
$adjustmentEntry = "(Adjustment Entry)";
$sql2 = "INSERT INTO `tn_accounts` SET uid='".$uid."', particular='".$particular.$adjustmentEntry."', orderid='".$orderId."', credit='".$amount."',txndate='".$date."',ipaddress='".$ipaddress."', againstBy='".$invoiceNo."', is_adjustment='2'";
//exit;
$result2 = $pdodb->query($sql2);
//print_r($result2); exit;
$sqlupt = "UPDATE `tn_invoice` SET isActive=0 WHERE id = '".$invoiceId."'";
$resultupt = $pdodb->query($sqlupt);
}
//print_r($_SESSION['uid']); exit;
}
$sql = "SELECT * FROM `tn_order` WHERE `id` = '".$orderId."'";
$result = $pdodb->query($sql);
//print_r($result); exit;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | Basic Form</title>
<link rel="stylesheet" type="text/css" href="../../css/noida40.css">
<?php include_once '../layout/style.php'; ?>
</head>
<body>
<div id="wrapper">
<?php $currentPage = 'adjustment-entry'; include_once '../layout/side-bar.php'; ?>
<div id="page-wrapper" class="gray-bg">
<?php include_once '../layout/header.php'; ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-8">
<h2>New Invoice generate</h2>
</div>
<div class="col-lg-4">
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="ibox float-e-margins">
<!-- <div class="ibox-title">
<h5>All form elements <small>With custom checbox and radion elements.</small></h5>
</div> -->
<div class="ibox-content">
<form method="POST" action="invoicereverse.php" class="form-horizontal" id="addNewInvoicefrm">
<div class="form-group">
<label class="col-lg-4 control-label">Student Name :</label>
<div class="col-lg-8">
<p class="form-control-static"><?=$username;?></p>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-lg-4 control-label">Mobile No :</label>
<div class="col-lg-8">
<p class="form-control-static"><?=$mobileno;?></p>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Amount :</label>
<div class="col-lg-8">
<p class="form-control-static"><?=$amount;?></p>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Do you need GST invoice? :</label>
<div class="col-lg-8">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" checked name="gstinvoice" value="no" onclick="gst1();">
<label class="form-check-label">No</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="gstinvoice" value="yes" onclick="gst2();">
<label class="form-check-label">Yes</label>
</div>
</div>
</div>
<div class="hide" id="gstdiv">
<?php if (!empty($result[0]['gstNo'])){
$gstNo = $result[0]['gstNo'];
$companyName = $result[0]['companyName'];
$companyAddress = $result[0]['companyAddress'];
$companyState = $result[0]['companyState'];
$stateListdata = $function->getStateList($id=$companyState,$isActive=1);
$statename = $stateListdata[0]['state'];
$stateid = $stateListdata[0]['id'];
?>
<div class="form-group">
<label class="col-lg-4 control-label">GST Number :<span>*</span></label>
<div class="col-lg-8">
<input type="text" disabled id="gstNo" name="gstNo" class="form-control" value="<?=$gstNo;?>">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company Name :<span>*</span></label>
<div class="col-lg-8">
<input disabled type="text" id="companyName" name="companyName" class="form-control" value="<?=$companyName;?>">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company Address :<span>*</span></label>
<div class="col-lg-8">
<textarea disabled name="companyAddress" id="companyAddress" rows="3" class="form-control"><?=$companyAddress;?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company States :<span>*</span></label>
<div class="col-lg-8">
<select class="form-control" name="companyState" id="companyState" disabled>
<option selected value="<?=$stateid;?>"><?=$statename;?></option>
</select>
</div>
</div>
<?php }else { ?>
<div class="form-group">
<label class="col-lg-4 control-label">GST Number :<span>*</span></label>
<div class="col-lg-8">
<input type="text" id="gstNo" name="gstNo" class="form-control" required="">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company Name :<span>*</span></label>
<div class="col-lg-8">
<input type="text" id="companyName" name="companyName" class="form-control" required="">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company Address :<span>*</span></label>
<div class="col-lg-8">
<textarea name="companyAddress" id="companyAddress" rows="3" class="form-control" required=""></textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Company States :<span>*</span></label>
<div class="col-lg-8">
<select class="form-control" name="companyState" id="companyState">
<option value="">---Choose Options---</option>
<?php for($i=0;$i<count($stateListdata);$i++){ ?>
<option value="<?=$stateListdata[$i]['id'];?>"><?=$stateListdata[$i]['state'];?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Narration :</label>
<div class="col-lg-8">
<textarea name="particular" rows="3" class="form-control" required=""></textarea>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<input type="hidden" name="amount" value="<?=$amount;?>">
<input type="hidden" name="uId" value="<?=$uid;?>">
<input type="hidden" name="orderId" value="<?=$orderId;?>">
<button class="btn btn-primary" name="newInvoiceBtn" id="newInvoiceBtn" type="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<script>
function tossterMsgAlert(msg='Welcome',title='') {
toastr.options = {
closeButton: true,
//debug: false,
newestOnTop: false,
//progressBar: false,
positionClass: 'toast-top-center',
preventDuplicates: true,
//onclick: null,
//showDuration: 300,
//hideDuration: 1000,
timeOut: 2000,
//extendedTimeOut: 1000,
//showEasing: 'swing',
//hideEasing: 'linear',
//showMethod: 'fadeIn',
hideMethod: 'fadeOut'
};
toastr.warning(title,msg);
}
</script>
<script type="text/javascript">
function gst1(){
document.getElementById("gstdiv").classList.add('hide');
document.getElementById("gstdiv").classList.remove('show');
//document.getElementById('gstdiv').style.display ='none';
}
function gst2(){
document.getElementById("gstdiv").classList.add('show');
document.getElementById("gstdiv").classList.remove('hide');
//document.getElementById('gstdiv').style.display = 'block';
}
</script>
<script type="text/javascript">
$("#addNewInvoicefrm").validate({
rules: {
gstNo: {
required: true,
minlength: 14,
maxlength: 15
},
companyName: {
required: true,
},
companyAddress: {
required: true,
},
companyState: {
required: true,
}
},
messages: {
gstNo: {
required: "Please enter GST number",
minlength: "GST No Must Contain at least 14 digit",
maxlength: "GST No Must Not Exceed 15 digit"
},
companyName: {
required: "Please enter Company Name"
},
companyAddress: {
required: "Please enter Company Address"
},
companyState: {
required: "Please select state name"
}
},
submitHandler: function(form) {
form.submit();
}
});
</script>
</body>
</html>


PK 99