985 lines
28 KiB
PHP
Executable File
985 lines
28 KiB
PHP
Executable File
|
|
<?php //print_r($dropdownvalues);?>
|
|
<style>
|
|
|
|
/* Style the tab */
|
|
.tab {
|
|
overflow: hidden;
|
|
background-color:#A1887F;
|
|
|
|
}
|
|
|
|
/* Style the buttons inside the tab */
|
|
.tab button {
|
|
background-color: inherit;
|
|
float: left;
|
|
border: none;
|
|
outline: none;
|
|
cursor: pointer;
|
|
padding: 14px 16px;
|
|
transition: 0.3s;
|
|
font-size: 17px;
|
|
}
|
|
|
|
/* Change background color of buttons on hover */
|
|
.tab button:hover {
|
|
background-color: #ddd;
|
|
}
|
|
|
|
/* Create an active/current tablink class */
|
|
.tab button.active {
|
|
background-color: #ccc;
|
|
}
|
|
|
|
/* Style the tab content */
|
|
.tabcontent {
|
|
display: none;
|
|
/* padding: 6px 12px; */
|
|
/* border: 1px solid #ccc; */
|
|
/* border-top: none; */
|
|
}
|
|
</style>
|
|
|
|
<div class="content-wrapper" style="min-height: 537px;">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Add New Receipt and Payment</center>
|
|
</h1>
|
|
</section>
|
|
|
|
<section class="content">
|
|
<div style="text-align:right;">
|
|
<a href="<?php echo base_url() ?>cashbook/incomeExpenseList" class="btn btn-primary" value="Back"/>Back</a>
|
|
</div><br><br>
|
|
|
|
<div style="">
|
|
<div class="tab">
|
|
<button class="tablinks active" onclick="openEvent(event, 'Receipt')">Receipt</button>
|
|
<button class="tablinks" onclick="openEvent(event, 'Payment')">Payment</button>
|
|
</div>
|
|
</div><!-- tab -->
|
|
|
|
<div id="Receipt" class="tabcontent" style="display: block;">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Add New Receipt</h3>
|
|
</div>
|
|
|
|
<!-- <form role="form" id="addIncomeExpense" action="<?php echo base_url() ?>addIncomeExpense" enctype="multipart/form-data" method="post"> -->
|
|
<form role="form" id="addReceipt" action="<?php echo base_url() ?>cashbook/addReceipt" enctype="multipart/form-data" method="post">
|
|
|
|
<div class="box-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<!-- <div class="col-md-3">
|
|
<div class="form-group">
|
|
<b><span for="Accountcode">Select Account type:</span> </b> </br></br>
|
|
<input type="radio" onclick = loadAccountType(this.id); id="myradio1" name="myradio" value="1" checked>RECEIPT
|
|
<input type="radio" onclick = loadAccountType(this.id); id="myradio2" name="myradio" value="2" >PAYMENT
|
|
</div>
|
|
</div> -->
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="Accountname">Account Name Select:</span> </b><span style="color:red">*</span></br></br>
|
|
<select class="form-control required " required id="Recepitaccode" required name="accode">
|
|
<option value="-1">Account Name Select</option>
|
|
</select>
|
|
</div></div>
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="AccountDate">Date:</span></b><span style="color:red">*</span></br></br>
|
|
<input type="text" class="form-control required" id="Date" name="Date">
|
|
</div></div>
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="towhome" id="towhom">Received From:</span></b><span style="color:red">*</span></br></br>
|
|
<input type="text" class="form-control required" id="towhome" name="towhome">
|
|
</div></div>
|
|
</div><!--/ col-md -12-->
|
|
</div><!-- /row -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<input type="checkbox" id="gst" name="gsttoggle"> GST
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row" id="gstarea" style="border:1px dashed; margin-left:0px;margin-right:0px;display:none;">
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b><span for="Invoiceno">Invoice No:</span></b>
|
|
<input type="text" class="form-control required" id="Invoiceno" name="Invoiceno">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b><span for="Merchant">Merchant Name:</span></b>
|
|
<input type="text" class="form-control required" id="merchant" name="merchant">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="Merchantgst">Merchant GST No:</span></b>
|
|
<input id="merchantgst" name="Merchantgst" class="form-control">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="HSN/SAC Code">HSN/SAC Code:</span></b>
|
|
<input id="hsn" name="hsn" class="form-control" >
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="ValuebeforeGST">Value before GST(₹):</span></b>
|
|
<input id="valuebeforegST" name="valuebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)" onchange="calculateTotal()">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="SGST">SGST(₹):</span>
|
|
</b>
|
|
<input type="text" class="form-control" style="text-align:right;" onchange="GSTvalue(this.id)" id="SGST" name="SGST" onkeypress="return isNumberKey(event)">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="CGST">CGST(₹):</span>
|
|
</b>
|
|
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)" onchange="GSTvalue(this.id)">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<b>
|
|
<span for="IGST">IGST(₹):</span></b>
|
|
|
|
<input type="text" class="form-control" style="text-align:right;" onkeypress="return isNumberKey(event)" onchange = GSTvalue(this.id) id="IGST" name="IGST">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> <!-- /End of GST Area -->
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<b><span for="Total">Total Amount(₹):</span></b><!--<span style="color:red">*</span>-->
|
|
|
|
<input type="text" class="form-control" id="totalamount" name="totalamount" onkeypress="return isNumberKey(event)" style="text-align:right;">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<b><span for="Description">Description:</span></b>
|
|
|
|
<textarea class="form-control" id="description" name="description" >
|
|
</textarea>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<b><span for="Description">File Upload:</span></b>
|
|
<img id="receiptslip" alt="your image" style="width: 139px;"/><br/>
|
|
<input type='file' input accept=".JPG,.PNG,.PDF" onchange="readURL(this,this.id);" id="receiptfile" name="myfile" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
|
|
<div class="box-footer" style="text-align:right">
|
|
<input type="button" onclick="validate();"class="btn btn-primary" value="Submit" />
|
|
<input type="reset" class="btn btn-primary" value="Reset" />
|
|
</div>
|
|
|
|
</form>
|
|
</div><!-- box-primary div-->
|
|
</div><!-- col-md-12 div-->
|
|
</div><!-- row div-->
|
|
</div><!-- tabcontent-->
|
|
|
|
<!--- Payment tab content start -->
|
|
<div id="Payment" class="tabcontent">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Add New Payment</h3>
|
|
</div>
|
|
|
|
<form role="form" id="addPayment" action="<?php echo base_url() ?>cashbook/addPayment" enctype="multipart/form-data" method="post">
|
|
<div class="box-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="PaymentDate">Date:</span></b><span style="color:red">*</span></br></br>
|
|
<input type="text" class="form-control required" id="PaymentDate" name="PaymentDate" required>
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="PaymentPaidto" id="Paidto">Paid To</span></b><span style="color:red">*</span></br></br>
|
|
<input type="text" class="form-control required" id="PaymentPaidto" name="PaymentPaidto" required>
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="PaymentMerchant">Merchant Name:</span></b></br></br>
|
|
<input type="text" class="form-control required" id="Paymentmerchant" name="Paymentmerchant">
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="PaymentMerchantgst">Merchant GST No:</span></b></br></br>
|
|
<input id="Paymentmerchantgst" name="PaymentMerchantgst" class="form-control">
|
|
</div></div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="Paymentvoucher">Voucher Code</span></b><span style="color:red">*</span></br></br>
|
|
<input id="Paymentvouchercode" name="Paymentvouchercode" class="form-control" required onkeypress="return isNumberKey(event)" >
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="HSN/SAC Code">HSN/SAC Code:</span></b></br></br>
|
|
<input id="Paymenthsn" name="Paymenthsn" class="form-control" >
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="ValuebeforeGST">Value before GST(₹):</span></b><!--<span style="color:red">*</span>--></br></br>
|
|
<input id="PaymentvaluebeforegST" name="PaymentvaluebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)" value='0.00' readonly>
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="SGST">SGST(₹):</span></b></br></br>
|
|
<input type="text" class="form-control" style="text-align:right;" onchange="PaymentGSTvalue(this.id);" id="PaymentSGST" name="PaymentSGST" onkeypress="return isNumberKey(event)">
|
|
</div> </div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="CGST">CGST(₹):</span></b></br></br>
|
|
<input type="text" class="form-control" id="PaymentCGST" style="text-align:right;" name="PaymentCGST" onkeypress="return isNumberKey(event)" onchange="PaymentGSTvalue(this.id);">
|
|
</div></div>
|
|
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="IGST">IGST(₹):</span></b></br></br>
|
|
<input type="text" class="form-control" style="text-align:right;" onkeypress="return isNumberKey(event)" onchange = "PaymentGSTvalue(this.id);" id="PaymentIGST" name="PaymentIGST" >
|
|
</div></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row" style="border:1px dashed; margin-left:0px;margin-right:0px;">
|
|
<div class="col-md-12">
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="PaymentAccname">Account Name Select:</span><span style="color:red">*</span>
|
|
<select class="form-control required Pay" required id="Paymentaccode1" required name="mydata1[Paymentaccode1]" onchange="changevalue();">
|
|
<option value="-1">Account Name Select</option>
|
|
</select>
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<b><span for="Decription"><b>Account Description:</b></span>
|
|
<input type="text" class="form-control" style="text-align:right;" id="subdescription1" name="mydata1[subdescription1]" requried>
|
|
</div></div>
|
|
|
|
<div class="col-md-3"><div class="form-group">
|
|
<span for="amount"><b>Amount(₹):</b></span><span style="color:red">*</span>
|
|
<input type="text" class="form-control" required style="text-align:right;" id="Paymentamount1" name="mydata1[Paymentamount1]" onchange="paymenttotalamount();" onkeypress="return isNumberKey(event)" requried>
|
|
</div></div>
|
|
|
|
<!-- <div class="col-md-offset-10 col-md-2"> -->
|
|
<div class="col-md-offset-2 col-md-1" style="padding-top:15px;padding-left:0px"><div class="form-group">
|
|
<!-- <input type="button" class="btn btn-primary" id="addmore" value="+ Add More"/> -->
|
|
<input type="button" id ="addmorebutton" onclick="add_more();" value=" + ADD MORE">
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="newdiv"></div><!-- this div for add more section-->
|
|
|
|
<input type="hidden" name="hidecounter" id="hidecounter" value="1" />
|
|
<input type="hidden" name="hideconstant" id="hideconstant" value="1" />
|
|
|
|
<div class="row">
|
|
<div class="col-md-12"><div class="col-md-4">
|
|
<b><span for="Total">Total Amount(₹):</span></b><!--<span style="color:red">*</span>-->
|
|
<input type="text" class="form-control" id="Paymenttotalamount" name="Paymenttotalamount" onkeypress="return isNumberKey(event)" style="text-align:right;" value='0.00' readonly>
|
|
</div></div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-md-4">
|
|
<b><span for="Description">Description:</span></b>
|
|
<textarea class="form-control" id="Paymentdescription" name="Paymentdescription" >
|
|
</textarea>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
<!-- <b><span for="fileupload">File Upload:</span></b> -->
|
|
<b><span for="Description">File Upload:</span></b>
|
|
<img id="paymentslip" alt="your image" style="width: 139px;"/><br/>
|
|
<input type='file' input accept=".JPG,.PNG,.PDF" onchange="readURL(this,this.id);" id="paymentfile" name="myfile" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
|
|
<div class="box-footer" style="text-align:right">
|
|
<input type="button" onclick="valid()" class="btn btn-primary" value="Submit" />
|
|
<input type="reset" class="btn btn-primary" value="Reset" />
|
|
</div>
|
|
|
|
</form>
|
|
</div><!-- box-primary div-->
|
|
</div><!-- col-md-12 div-->
|
|
</div><!-- row div-->
|
|
</div><!-- tabcontent-->
|
|
</section><!-- content section -->
|
|
</div><!-- content-wrapper div-->
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var t = [];
|
|
var ex = [];
|
|
var inc = [];
|
|
$('#SGST').val('0.00');
|
|
$('#CGST').val('0.00');
|
|
$('#IGST').val('0.00');
|
|
$('#PaymentSGST').val('0.00');
|
|
$('#PaymentCGST').val('0.00');
|
|
$('#PaymentIGST').val('0.00');
|
|
|
|
t= <?php echo json_encode($dropdownvalues)?>;
|
|
|
|
var options = '';
|
|
|
|
// console.log(t);
|
|
|
|
$.each(t,function(i,ob){
|
|
if(ob.type == 'RECEIPT')
|
|
{
|
|
options += "<option value="+ob.code+">"+ob.name+"</option>";
|
|
}
|
|
});
|
|
|
|
$('#Recepitaccode').append(options);
|
|
|
|
$.each(t,function(i,item){
|
|
|
|
if(item.type == 'PAYMENT')
|
|
{
|
|
$("#Paymentaccode1").append( $('<option></option>').val(item.code).html(item.name));
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#gst').click(function(){
|
|
$('#gstarea').toggle();
|
|
});
|
|
// $('#paymentgst').click(function(){
|
|
// $('#paymentgstarea').toggle();
|
|
// });
|
|
$('#towhom').text('Received From:');
|
|
|
|
$("#Date").datepicker({
|
|
//minDate : new Date(year-SIAStartYear,1,1),
|
|
maxDate :'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
|
|
});
|
|
/* This is For payment account date */
|
|
$("#PaymentDate").datepicker({
|
|
maxDate :'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
|
|
});
|
|
|
|
});
|
|
|
|
function readURL(input,id) {
|
|
|
|
//alert(id);
|
|
if (input.files && input.files[0]) {
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
|
|
if(id == "receiptfile"){
|
|
$('#receiptslip')
|
|
.attr('src', e.target.result)
|
|
.width(100)
|
|
.height(100);
|
|
}
|
|
else{
|
|
$('#paymentslip')
|
|
.attr('src', e.target.result)
|
|
.width(100)
|
|
.height(100);
|
|
}
|
|
// alert(e.target.result);
|
|
};
|
|
|
|
reader.readAsDataURL(input.files[0]);
|
|
if(id == "receiptfile"){
|
|
$('#receiptslip').val(input.files[0]['name']);}
|
|
else{
|
|
$('#paymentslip').val(input.files[0]['name']);}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function isNumberKey(evt)
|
|
{
|
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
|
if (charCode != 46 && charCode > 31
|
|
&& (charCode < 48 || charCode > 57))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
function loadAccountType(id)
|
|
{
|
|
//alert('called'+id);
|
|
var id=id;
|
|
var t = [];
|
|
var ex = [];
|
|
var inc = [];
|
|
t= <?php echo json_encode($dropdownvalues)?>;
|
|
|
|
// if(id == 'myradio1')
|
|
// {
|
|
// // alert('INCOME clicked');
|
|
|
|
// $('#Recepitaccode').find('option').remove().end().append('<option value="-1">Select Account Name</option>').val('Select Account Code');
|
|
|
|
// $.each(t,function(i,item){
|
|
// if(item.type == 'RECEIPT')
|
|
// {
|
|
// $("#Recepitaccode").append( $('<option></option>').val(item.code).html(item.name));
|
|
// }
|
|
// });
|
|
|
|
|
|
// }
|
|
// if(id == 'myradio2')
|
|
// {
|
|
// //alert('expense clicked');
|
|
|
|
// $('#Recepitaccode').find('option').remove().end().append('<option value="-1">Select Account Name</option>').val('Select Account Code');
|
|
|
|
// $.each(t,function(i,item){
|
|
// if(item.type == 'PAYMENT')
|
|
// {
|
|
// $("#Recepitaccode").append( $('<option></option>').val(item.code).html(item.name));
|
|
// }
|
|
// });
|
|
|
|
// }
|
|
//alert('final alert');
|
|
}
|
|
|
|
|
|
// $("#accode").append( $('<option></option>').val(item.code).html(item.name));
|
|
|
|
// $('#pages').append(newOption);
|
|
</script>
|
|
|
|
<script>
|
|
var counter = 1;
|
|
var counterConstant = 1;
|
|
function openEvent(evt, cityName) {
|
|
var i, tabcontent, tablinks;
|
|
tabcontent = document.getElementsByClassName("tabcontent");
|
|
for (i = 0; i < tabcontent.length; i++) {
|
|
tabcontent[i].style.display = "none";
|
|
}
|
|
tablinks = document.getElementsByClassName("tablinks");
|
|
for (i = 0; i < tablinks.length; i++) {
|
|
tablinks[i].className = tablinks[i].className.replace("active", "");
|
|
}
|
|
document.getElementById(cityName).style.display = "block";
|
|
evt.currentTarget.className += " active";
|
|
}
|
|
|
|
|
|
function validate()
|
|
{
|
|
var Recepitaccode = $('#Recepitaccode').val();
|
|
var date = $('#Date').val();
|
|
var towhome = $('#towhome').val();
|
|
var gstcheck = document.getElementById("gst").checked;
|
|
var Invoiceno = $('#Invoiceno').val();
|
|
var merchant = $('#merchant').val();
|
|
var mergst = $('#merchantgst').val();
|
|
var beforegst = $('#valuebeforegST').val();
|
|
var sgst = $('#SGST').val();
|
|
var cgst = $('#CGST').val();
|
|
var igst = $('#IGST').val();
|
|
var total = $('#totalamount').val();
|
|
var errorflag = 0;
|
|
|
|
|
|
if(Recepitaccode < 0)
|
|
{
|
|
errorflag++;
|
|
}
|
|
|
|
if(date == '')
|
|
{
|
|
errorflag++;
|
|
}
|
|
|
|
if(total == '')
|
|
{
|
|
errorflag++;
|
|
}
|
|
|
|
if(towhome == '')
|
|
{
|
|
errorflag++;
|
|
}
|
|
|
|
if(gstcheck == true)
|
|
{
|
|
|
|
if((merchant == '') || (mergst == '') || (Invoiceno == '') || (beforegst == '') || (sgst == '') || (cgst == '') || (igst == ''))
|
|
{
|
|
errorflag++;
|
|
}
|
|
else
|
|
{
|
|
// calculation part
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(errorflag != 0)
|
|
{
|
|
alert("Please Provide All Details..!");
|
|
return false;
|
|
}
|
|
|
|
|
|
//$('#addIncomeExpense').submit();
|
|
$('#addReceipt').submit();
|
|
|
|
}
|
|
|
|
function GSTvalue(id)
|
|
{
|
|
|
|
var sgst = $('#SGST').val();
|
|
if(sgst == ''){
|
|
sgst = "0.00" ;
|
|
|
|
}else{
|
|
sgst = sgst;
|
|
}
|
|
var cgst = $('#CGST').val();
|
|
if(cgst == ''){
|
|
cgst = "0.00" ;
|
|
|
|
}else{
|
|
cgst = cgst;
|
|
}
|
|
var igst = $('#IGST').val();
|
|
if(igst == ''){
|
|
igst = "0.00" ;
|
|
}else{
|
|
igst = igst;
|
|
}
|
|
var beforegst = $('#valuebeforegST').val();
|
|
|
|
$('#valuebeforegST').val((parseFloat(beforegst).toFixed(2)));
|
|
if(id == 'SGST')
|
|
{
|
|
$('#CGST').val(parseFloat(sgst).toFixed(2));
|
|
$('#SGST').val(parseFloat(sgst).toFixed(2));
|
|
$('#IGST').val('0.00');
|
|
calculateTotal();
|
|
}
|
|
|
|
if(id == 'CGST')
|
|
{
|
|
$('#CGST').val(parseFloat(cgst).toFixed(2));
|
|
$('#SGST').val(parseFloat(cgst).toFixed(2));
|
|
$('#IGST').val('0.00');
|
|
calculateTotal();
|
|
}
|
|
|
|
if(id == 'IGST')
|
|
{
|
|
$('#CGST').val('0.00');
|
|
$('#SGST').val('0.00');
|
|
$('#IGST').val(parseFloat(igst).toFixed(2));
|
|
calculateTotal();
|
|
}
|
|
|
|
}
|
|
|
|
function calculateTotal()
|
|
{
|
|
var sgst = $('#SGST').val();
|
|
var cgst = $('#CGST').val();
|
|
var igst = $('#IGST').val();
|
|
var beforegst = $('#valuebeforegST').val();
|
|
|
|
var total = parseFloat(sgst)+parseFloat(cgst)+parseFloat(igst)+parseFloat(beforegst);
|
|
|
|
$('#totalamount').val((total.toFixed(2)));
|
|
}
|
|
|
|
// $('#myradio1').click(function(){
|
|
// $('#towhom').text('Received From:');
|
|
// });
|
|
// $('#myradio2').click(function(){
|
|
// $('#towhom').text('Paid To:');
|
|
// });
|
|
|
|
function PaymentGSTvalue(id)
|
|
{
|
|
|
|
var sgst = $('#PaymentSGST').val();
|
|
if(sgst == ''){
|
|
sgst = '0.00' ;
|
|
//alert('qwe'+sgst);
|
|
}else{
|
|
sgst = sgst;
|
|
}
|
|
|
|
var cgst = $('#PaymentCGST').val();
|
|
if(cgst == ''){
|
|
cgst = '0.00' ;
|
|
//alert('qwe'+sgst);
|
|
}else{
|
|
cgst = cgst;
|
|
}
|
|
|
|
var igst = $('#PaymentIGST').val();
|
|
if(igst == ''){
|
|
igst = '0.00' ;
|
|
//alert('qwe'+sgst);
|
|
}else{
|
|
igst = igst;
|
|
}
|
|
|
|
|
|
if(id == 'PaymentSGST')
|
|
{
|
|
$('#PaymentCGST').val(parseFloat(sgst).toFixed(2));
|
|
$('#PaymentSGST').val(parseFloat(sgst).toFixed(2));
|
|
$('#PaymentIGST').val('0.00');
|
|
paymenttotalamount()
|
|
}
|
|
|
|
if(id == 'PaymentCGST')
|
|
{
|
|
$('#PaymentCGST').val(parseFloat(cgst).toFixed(2));
|
|
$('#PaymentSGST').val(parseFloat(cgst).toFixed(2));
|
|
$('#PaymentIGST').val('0.00');
|
|
paymenttotalamount();
|
|
}
|
|
|
|
|
|
if(id == 'PaymentIGST')
|
|
{
|
|
$('#PaymentCGST').val('0.00');
|
|
$('#PaymentSGST').val('0.00');
|
|
$('#PaymentIGST').val(parseFloat(igst).toFixed(2));
|
|
paymenttotalamount()
|
|
}
|
|
|
|
}
|
|
|
|
//var temparray = [];
|
|
//var ddvalue = '';
|
|
function add_more()
|
|
{
|
|
if($("option:selected", $("#Paymentaccode1")).val() == '-1')
|
|
{
|
|
alert('Select/Choose account name');
|
|
$('#Paymentaccode1').focus();
|
|
return false;
|
|
}
|
|
// else if($('#subdescription1').val() == '')
|
|
// {
|
|
// alert("Provide Account description..!");
|
|
// $('#subdescription1').focus();
|
|
// return false;
|
|
// }
|
|
else if($('#Paymentamount1').val() == '')
|
|
{
|
|
alert("Provide Amount data..!");
|
|
$('#Paymentamount1').focus();
|
|
return false;
|
|
|
|
}
|
|
else
|
|
{
|
|
//if(Paymentaccode1 != -1 && subdescription1 !=" " && Paymentamount1 != " "){
|
|
counter++;
|
|
counterConstant++;
|
|
|
|
var div = document.createElement('div');
|
|
div.id = "divid"+counterConstant;
|
|
div.className="row";
|
|
div.style.cssText = "border:1px dashed; margin-left:0px;margin-right:0px;";
|
|
div.innerHTML='<div class="col-md-12"><div class="col-md-3"><div class="form-group"><b>'+
|
|
'<span for="name">Account Name Select:</span>'+
|
|
'<select class="form-control required Pay" required id="Paymentaccode'+counterConstant+'" required onchange="changevalue();" name="mydata'+counterConstant+'[Paymentaccode'+counterConstant+']">'+
|
|
'<option value="-1">Account Name Select</option>'+
|
|
'</select>'+
|
|
'</div></div>'+
|
|
'<div class="col-md-3"><div class="form-group">'+
|
|
'<span for="subDecription"><b>Account Description:</b></span> '+
|
|
'<input type="text" class="form-control required" style="text-align:right;" id="subdescription'+counterConstant+'" name="mydata'+counterConstant+'[subdescription'+counterConstant+']">'+
|
|
'</div></div>'+
|
|
'<div class="col-md-3"><div class="form-group">'+
|
|
'<span for="amount"><b>Amount(₹):</b></span> '+
|
|
'<input type="text" class="form-control required" style="text-align:right;" id="Paymentamount'+counterConstant+'" name="mydata'+counterConstant+'[Paymentamount'+counterConstant+']" onchange="paymenttotalamount();" onkeypress="return isNumberKey(event)">'+
|
|
'</div></div>'+
|
|
'<div class="col-md-offset-2 col-md-1" style="padding-top:15px;padding-left:0px"><div class="form-group">'+
|
|
'<input class="remove_this" type="button" id="removebtn'+counterConstant+'" value="REMOVE" onclick="removeRow(this.id)"></div>'+
|
|
'</div></div></div>';
|
|
$('#newdiv').append(div);
|
|
|
|
$('#hidecounter').val(counter);
|
|
$('#hideconstant').val(counterConstant);
|
|
// }
|
|
// else{
|
|
// alert("check");
|
|
// }
|
|
t= <?php echo json_encode($dropdownvalues) ?>;
|
|
|
|
var option = '';
|
|
|
|
// console.log(t);
|
|
|
|
$.each(t,function(i,obj){
|
|
if(obj.type == 'PAYMENT')
|
|
{
|
|
option += "<option value="+obj.code+">"+obj.name+"</option>";
|
|
}
|
|
});
|
|
|
|
// $('#select-group select option').each(function(){
|
|
// if($.inArray(this.value, values) > -1 && !this.selected)
|
|
// $(this).after('<optgroup label="'+this.value+'"></optgroup>').remove();
|
|
// });
|
|
$('#Paymentaccode'+counterConstant).append(option);
|
|
// var cc = counterConstant-1;
|
|
// var arr_no = counter-2;
|
|
// var ddvalue = $('#Paymentaccode'+cc+' option:selected').val();
|
|
|
|
|
|
// if(ddvalue != -1){ temparray[arr_no] = ddvalue; /*temparray.push(ddvalue);*/ }
|
|
|
|
// $.each(temparray,function(t,temp){
|
|
// $('#Paymentaccode'+counterConstant+' option[value='+temp+']').prop('disabled',true);
|
|
// });
|
|
|
|
}
|
|
}
|
|
|
|
function removeRow(input) {
|
|
|
|
var number = input.replace(/[^0-9]+/ig,"");
|
|
|
|
var lineitemamount = $("#Paymentamount"+number).val();
|
|
var total = $('#Paymenttotalamount').val();
|
|
var valueb4gst = $('#PaymentvaluebeforegST').val();
|
|
var subtracttotal = total - lineitemamount;
|
|
var valuebeforegst = valueb4gst - lineitemamount;
|
|
|
|
|
|
// var accode = $('#Paymentaccode'+number).val();
|
|
|
|
// temparray = jQuery.grep(temparray, function(value) {
|
|
|
|
// return value != accode;
|
|
|
|
// });
|
|
|
|
|
|
if(counter >= 1){
|
|
counter--;
|
|
//var r = $('#Paymentaccode'+number).val();
|
|
$("#divid"+number).remove();
|
|
$('#hidecounter').val(counter);
|
|
}
|
|
|
|
|
|
$('#Paymenttotalamount').val(subtracttotal);
|
|
$('#PaymentvaluebeforegST').val(valuebeforegst);
|
|
}
|
|
|
|
|
|
function paymenttotalamount(){
|
|
|
|
var total = 0;
|
|
var withtax = 0;
|
|
|
|
for(i=1;i<=counterConstant;i++){
|
|
var value = $('#Paymentamount'+i).val();
|
|
value = parseFloat(value);
|
|
|
|
if(isNaN(value)){
|
|
value = 0.00;
|
|
}
|
|
|
|
total = total + parseFloat(value);
|
|
}
|
|
|
|
var sgst = $('#PaymentSGST').val();
|
|
if(sgst == ''){
|
|
sgst = 0 ;
|
|
|
|
}else{
|
|
sgst = sgst;
|
|
}
|
|
|
|
var cgst = $('#PaymentCGST').val();
|
|
if(cgst == ''){
|
|
cgst = 0 ;
|
|
}else{
|
|
cgst = cgst;
|
|
|
|
}
|
|
|
|
var igst = $('#PaymentIGST').val();
|
|
if(igst == ''){
|
|
igst = 0 ;
|
|
}else{
|
|
igst = igst;
|
|
}
|
|
|
|
withtax = parseFloat(total)+parseFloat(sgst)+parseFloat(cgst)+parseFloat(igst);
|
|
//alert('sgst'+sgst+'cgst'+cgst+'igst'+igst);
|
|
$('#PaymentvaluebeforegST').val(parseFloat(total).toFixed(2));
|
|
$('#Paymenttotalamount').val(parseFloat(withtax).toFixed(2));
|
|
|
|
|
|
// $.each(temparray,function(t,temp){
|
|
// $('#Paymentaccode'+counterConstant+' option[value='+temp+']').remove();
|
|
// });
|
|
|
|
|
|
}
|
|
|
|
|
|
function valid(){
|
|
|
|
|
|
// var pay_date = $('#PaymentDate').val();
|
|
// var pay_paidto = $('#PaymentPaidto').val();
|
|
// var pay_voucher = $('#Paymentvouchercode').val();
|
|
// // var merchant = $('#merchant').val();
|
|
// // var mergst = $('#merchantgst').val();
|
|
// // var beforegst = $('#valuebeforegST').val();
|
|
// var pay_sgst = $('#PaymentSGST').val();
|
|
// var pay_cgst = $('#PaymentCGST').val();
|
|
// var pay_igst = $('#PaymentIGST').val();
|
|
// //var total = $('#totalamount').val();
|
|
// var pay_errorflag = 0;
|
|
|
|
|
|
// // if(Recepitaccode < 0)
|
|
// // {
|
|
// // errorflag++;
|
|
// // }
|
|
|
|
if($('#PaymentDate').val() == '')
|
|
{
|
|
alert("Please Provide Date..!");
|
|
$('#PaymentDate').focus();
|
|
return false;
|
|
//pay_errorflag++;
|
|
}
|
|
else if($('#PaymentPaidto').val() == '')
|
|
{
|
|
alert("Please Provide paid to Data..!");
|
|
$('#PaymentPaidto').focus();
|
|
return false;
|
|
}
|
|
else if($('#Paymentvouchercode').val() == '')
|
|
{
|
|
alert("Please Provide voucher code data..!");
|
|
$('#Paymentvouchercode').focus();
|
|
return false;
|
|
|
|
//pay_errorflag++;
|
|
}
|
|
else if($('#PaymentSGST').val() == '')
|
|
{
|
|
alert("Please Provide Sgst data..!");
|
|
$('#PaymentSGST').focus();
|
|
return false;
|
|
|
|
//pay_errorflag++;
|
|
}
|
|
else if($('#PaymentCGST').val() == '')
|
|
{
|
|
alert("Please Provide Cgst data..!");
|
|
$('#PaymentSGST').focus();
|
|
return false;
|
|
}
|
|
else if($("option:selected", $("#Paymentaccode1")).val() == '-1')
|
|
{
|
|
alert('Select/Choose account name');
|
|
$('#Paymentaccode1').focus();
|
|
return false;
|
|
}
|
|
else if($('#subdescription1').val() == '')
|
|
{
|
|
alert("Provide Account description..!");
|
|
$('#subdescription1').focus();
|
|
return false;
|
|
|
|
}
|
|
else if($('#Paymentamount1').val() == '')
|
|
{
|
|
alert("Provide Amount data..!");
|
|
$('#Paymentamount1').focus();
|
|
return false;
|
|
|
|
}
|
|
else
|
|
{
|
|
$('#addPayment').submit();
|
|
}
|
|
|
|
}
|
|
</script>
|