error fixed in cashbook

This commit is contained in:
venbatechnologies@gmail.com 2018-02-19 19:55:07 +05:30
parent d1395e14f8
commit bf461a5d7f
4 changed files with 214 additions and 133 deletions

View File

@ -146,7 +146,7 @@
<div class="form-group">
<b>
<span for="ValuebeforeGST">Value before GST(&#8377;):</span></b>
<input id="valuebeforegST" name="valuebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)">
<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">
@ -163,7 +163,7 @@
<b>
<span for="CGST">CGST(&#8377;):</span>
</b>
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)">
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)" onchange="GSTvalue(this.id)">
</div>
</div>
@ -280,7 +280,7 @@
<div class="col-md-12">
<div class="col-md-3"><div class="form-group">
<b><span for="CGST">CGST(&#8377;):</span></b></br></br>
<input type="text" class="form-control" id="PaymentCGST" style="text-align:right;" name="PaymentCGST" onkeypress="return isNumberKey(event)" onchange="paymenttotalamount();">
<input type="text" class="form-control" id="PaymentCGST" style="text-align:right;" name="PaymentCGST" onkeypress="return isNumberKey(event)" onchange="PaymentGSTvalue(this.id);">
</div></div>
@ -586,8 +586,25 @@ 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)));
@ -598,16 +615,22 @@ function GSTvalue(id)
$('#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();
}
}
}
@ -617,7 +640,7 @@ function calculateTotal()
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)));
@ -634,8 +657,29 @@ 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')
{
@ -644,6 +688,15 @@ function PaymentGSTvalue(id)
$('#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')
{
@ -750,11 +803,11 @@ function removeRow(input) {
var number = input.replace(/[^0-9]+/ig,"");
var subtracttotal = $("#Paymentamount"+number).val();
var lineitemamount = $("#Paymentamount"+number).val();
var total = $('#Paymenttotalamount').val();
var valuebeforegst = $('#PaymentvaluebeforegST').val();
subtracttotal = total - subtracttotal;
valuebeforegst = valuebeforegst - subtracttotal;
var valueb4gst = $('#PaymentvaluebeforegST').val();
var subtracttotal = total - lineitemamount;
var valuebeforegst = valueb4gst - lineitemamount;
// var accode = $('#Paymentaccode'+number).val();
@ -798,7 +851,7 @@ function paymenttotalamount(){
var sgst = $('#PaymentSGST').val();
if(sgst == ''){
sgst = 0 ;
//alert('qwe'+sgst);
}else{
sgst = sgst;
}
@ -808,7 +861,7 @@ function paymenttotalamount(){
cgst = 0 ;
}else{
cgst = cgst;
//alert('sda'+cgst)
}
var igst = $('#PaymentIGST').val();

View File

@ -23,8 +23,8 @@ $pic = base_url().'uploads/images/'.$company[0]->ProfilePic;
<td style="width: 89px; height: 25px; text-align: center;" colspan="6"><h3>CASH VOUCHER</h3></td>
</tr>
<tr style="height: 26px;">
<td style="width: 100px; height: 26px;">&nbsp;Voucher Number </td>
<td style="width: 89px; height: 26px;" colspan="3"><?php if(($data[0]->type) == 'EXPENSE'){echo $data[0]->invoice_no;}else{echo $data[0]->id;}?></td>
<td style="width: 100px; height: 26px;">&nbsp;<?php if(($data[0]->type) == 'PAYMENT'){echo 'Voucher Number';}else{echo 'Invoice Number';} ?> </td>
<td style="width: 89px; height: 26px;" colspan="3"><?php if(($data[0]->type) == 'PAYMENT'){echo $data[0]->invoice_no;}else{echo $data[0]->invoice_no;}?></td>
<hr>
<td style="width: 90px; height: 197px;text-align: center;" colspan="2" rowspan="5"><p> <h1>Rs <?php echo $data[0]->total;?></h1></p>Amount &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
@ -85,10 +85,9 @@ $pic = base_url().'uploads/images/'.$company[0]->ProfilePic;
<tr style="height: 26px;">
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 90px; height: 26px;">&nbsp;</td>
<td style="width: 89px; height: 26px;">&nbsp;</td>
<td style="width: 90px; height: 26px;">Prepared By &nbsp;</td>
<td style="width: 90px; height: 26px;"><?php echo $data[0]->FirstName.'&nbsp;'.$data[0]->LastName;?></td>
<td colspan="2" style="width: 90px; height: 26px;"><?php echo $data[0]->FirstName.'&nbsp;'.$data[0]->LastName;?></td>
<hr>
</tr>
<tr style="height: 26px;">
@ -109,9 +108,9 @@ $pic = base_url().'uploads/images/'.$company[0]->ProfilePic;
</td>
<td style="width: 90px; height: 90px;" colspan="3">
<p>&nbsp; &nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">Receiver's Signature</p>
<p>&nbsp;</p>
<p style="text-align:right;">Receiver's Signature</p>
</td>
</tr>

View File

@ -21,6 +21,7 @@ $id='';
$file1='';
$document = '';
$subdesc ='';
$checked = '';
if(!empty($RecepitPayment))
{
foreach ($RecepitPayment as $rd)
@ -38,6 +39,14 @@ if(!empty($RecepitPayment))
$MerchantGST1=$rd->merchant_gst;
$HSNSAC1=$rd->HSN;
$valuebeforegst1=$rd->value_before_gst;
if($valuebeforegst1 != '')
{
$checked = 'checked';
}
else
{
$checked = '';
}
$SGST1=$rd->sgst;
$CGST1=$rd->cgst;
$IGST1=$rd->igst;
@ -133,7 +142,7 @@ if(!empty($PaymentMultiple))
</div><!-- 12-md-->
<div class="row">
<div class="col-md-12"><div class="col-md-3">
<input type="checkbox" id="gst" name="gsttoggle"> GST
<input type="checkbox" id="gst" name="gsttoggle" <?php echo $checked;?> > GST
</div></div>
</div>
@ -165,7 +174,7 @@ if(!empty($PaymentMultiple))
<div class="col-md-3"><div class="form-group">
<b><span for="ValuebeforeGST">Value before GST(&#8377;):</span></b>
<input id="valuebeforegST" name="valuebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)" value="<?php echo $valuebeforegst1; ?>">
<input id="valuebeforegST" name="valuebeforegST" style="text-align:right;" class="form-control" onkeypress="return isNumberKey(event)" value="<?php echo $valuebeforegst1; ?>" onchange="calculateTotal()">
</div></div>
<div class="col-md-3"><div class="form-group">
<b><span for="SGST">SGST(&#8377;):</span></b>
@ -173,7 +182,7 @@ if(!empty($PaymentMultiple))
</div></div>
<div class="col-md-3"><div class="form-group">
<b><span for="CGST">CGST(&#8377;):</span></b>
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)" value="<?php echo $CGST1; ?>">
<input type="text" class="form-control" id="CGST" style="text-align:right;" name="CGST" onkeypress="return isNumberKey(event)" value="<?php echo $CGST1; ?>" onchange="GSTvalue(this.id)">
</div></div>
<div class="col-md-3"><div class="form-group">
@ -230,7 +239,7 @@ if(!empty($PaymentMultiple))
<div class="box-footer" style="text-align:right">
<input type="button" onclick="validate();"class="btn btn-primary" value="Update Recepit" />
<input type="reset" class="btn btn-primary" value="Reset" />
<input type="reset" id="resetReceipt" class="btn btn-primary" value="Reset" />
</div>
</form>
</div><!-- box-primary div-->
@ -301,7 +310,7 @@ if(!empty($PaymentMultiple))
<div class="col-md-12">
<div class="col-md-3"><div class="form-group">
<b><span for="CGST">CGST(&#8377;):</span><span style="color:red">*</span></b></br></br>
<input type="text" class="form-control" id="PaymentCGST" style="text-align:right;" name="PaymentCGST" onkeypress="return isNumberKey(event)" value="<?php echo $CGST1; ?>">
<input type="text" class="form-control" id="PaymentCGST" style="text-align:right;" name="PaymentCGST" onkeypress="return isNumberKey(event)" onchange="PaymentGSTvalue(this.id)" value="<?php echo $CGST1; ?>">
</div></div>
@ -368,7 +377,7 @@ if(!empty($PaymentMultiple))
if($dd->type == 'PAYMENT'){
$dropdowncode = $dd->code;
$dropdownname = $dd->name;
if(trim($dropdowncode) != trim($paydtl->Account_code))
{
if ($_POST['$paydtl->Account_code'] == $dropdowncode)
@ -461,7 +470,7 @@ if(!empty($PaymentMultiple))
<div class="box-footer" style="text-align:right">
<input type="button" onclick="valid()" class="btn btn-primary" value="Update Payment" />
<input type="reset" class="btn btn-primary" value="Reset" />
<input type="reset" id="paymentreset" class="btn btn-primary" value="Reset" />
</div>
</form>
@ -491,25 +500,8 @@ $(document).ready(function(){
$('#myradio2').attr('checked','true');
$('#towhom').text('Paid To:');
}
// var isChecked = $('#RECEIPT').prop('checked');
// //alert(isChecked);
// if(isChecked)
// {
// $('#towhom').text('Received From:');
// }
// //var isChecked2 = $('#PAYMENT').prop('checked');
// //if(isChecked2)
// else
// {
// $('#towhom').text('Paid To:');
// }
});
// var pay_ddvalue = [];
// var dbpay_ddvalue = [];
$(function() {
@ -524,7 +516,7 @@ $(function() {
}
});
$('#accode option[value="<?php echo $accountcode1?>"]').prop('selected', true);
$('#accode option[value="<?php echo $accountcode1?>"]').attr("selected", "selected");
if('<?php echo $accountcode1 ?>' != '999'){
@ -534,7 +526,7 @@ $(function() {
$("#Paymentaccode1").append( $('<option></option>').val(item.code).html(item.name));
}
});
$('#Paymentaccode1 option[value="<?php echo $accountcode1 ?>"]').prop('selected', true);
$('#Paymentaccode1 option[value="<?php echo $accountcode1 ?>"]').attr("selected", "selected");
$('#subdescription1').val("<?php echo $subdesc ?>");
$('#Paymentamount1').val(<?php echo $valuebeforegst1 ?>);
}
@ -544,44 +536,21 @@ $(function() {
if(item.type == 'PAYMENT')
{
$("#Paymentaccode1").append( $('<option></option>').val(item.code).html(item.name));
//var ddvalues = item.code;
//pay_ddvalue[i] = ddvalues;
//pay_ddvalue.push(pay_ddvalues);
}
});
}
//dbarray = <?php echo json_encode($PaymentDetails) ?>;//this part is db dropdown value
//$.each(dbarray,function(db,obj){
// dbacccode = obj.Account_code;
// dbpay_ddvalue[db] = dbacccode;
//});
// $.each(pay_ddvalue,function(i,obj){
// //console.log("pay"+obj);
// $.each(dbpay_ddvalue,function(j,ob){
// //console.log("db"+ob);
// if(ob == obj){
// $("#Paymentaccode1 option[value="+obj+"]").prop('disabled',true);}
// });
// });
$('#gst').click(function(){
$('#gstarea').toggle();
});
// $('#towhom').text('Received From:');
$("#Date").datepicker({
//minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
@ -590,6 +559,16 @@ $("#PaymentDate").datepicker({
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
var value = "<?php echo $valuebeforegst1;?>";
var type = "<?php echo $type1;?>";
if(type == "RECEIPT")
{
if(value != ''){
// $('#gstarea').attr('checked', true);
$('#gstarea').toggle();
}
}
});
@ -736,8 +715,26 @@ function validate()
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)));
@ -748,7 +745,13 @@ function GSTvalue(id)
$('#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');
@ -835,23 +838,50 @@ 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();
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();
paymenttotalamount();
}
}
@ -865,28 +895,28 @@ if(paydtl == ''){ var counterConstant = 1; }
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
{
// var paydtl = $('#hidepaydtl').val();
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
{// var paydtl = $('#hidepaydtl').val();
// alert(paydtl);
counter++;
@ -960,12 +990,14 @@ $('#Paymentaccode'+counterConstant).append(option);
function removeRow(input) {
var number = input.replace(/[^0-9]+/ig,"");
var subtracttotal = $("#Paymentamount"+number).val();
var lineitemamount = $("#Paymentamount"+number).val();
var total = $('#Paymenttotalamount').val();
subtracttotal = total - subtracttotal;
var accode = $('#Paymentaccode'+number).val();
var subtracttotal = total - lineitemamount;
var valueb4gst = $('#PaymentvaluebeforegST').val();
var valueb4 = valueb4gst - lineitemamount;
//alert(subtracttotal);
var accode = $('#Paymentaccode'+number).val();
//alert('remove');
//temparray = jQuery.grep(temparray, function(value) {
// return value != accode;});
//alert(temparray);
@ -993,6 +1025,7 @@ var accode = $('#Paymentaccode'+number).val();
}
$('#Paymenttotalamount').val(parseFloat(subtracttotal).toFixed(2));
$('#PaymentvaluebeforegST').val(parseFloat(valueb4).toFixed(2));
//parseFloat(subtracttotal).toFixed(2)
}
@ -1046,13 +1079,12 @@ function paymenttotalamount(){
function valid(){
//alert("now entered");
if($('#PaymentDate').val() == '')
{
alert("Please Provide Date..!");
$('#PaymentDate').focus();
return false;
}
else if($('#PaymentPaidto').val() == '')
{
@ -1065,39 +1097,36 @@ function valid(){
alert("Please Provide voucher code data..!");
$('#Paymentvouchercode').focus();
return false;
}
// else if($('#PaymentSGST').val() == '')
// {
// alert("Please Provide Sgst data..!");
// $('#PaymentSGST').focus();
// return false;
// }
else if($('#hidecounter').val() == 1){
if($("option:selected", $("#Paymentaccode1")).val() == '-1')
{
alert("Please Select Account Code..!");
$('#Paymentaccode1').focus();
return false;
}
else if($('#subdescription1').val() == '')
{
alert("Please Provide Account description..!");
$('#subdescription1').focus();
return false;
}
else if($('#Paymentamount1').val() == '')
{
alert("Please Provide Amount data..!");
$('#Paymentamount1').focus();
return false;
}
// alert('true');
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{
$('#updatePayment').submit();
}
}
else{
$('#updatePayment').submit();
}
}
</script>

View File

@ -69,7 +69,7 @@ if(!empty($data))
<?php if($flag == 1){?>
<td style="text-align:right;"><h5>Merchant GST No :</h5></td><td></td><td><?php if(!empty($data[0]->merchant_gst)){echo $data[0]->merchant_gst;}?></td>
</tr>
<tr> <td style="text-align:right;"><h5>Invoice No :</h5></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->invoice_no)){echo $data[0]->invoice_no;}?></td>
<tr> <td style="text-align:right;"><h5>Voucher No :</h5></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->invoice_no)){echo $data[0]->invoice_no;}?></td>
<td style="text-align:right;"><h5>HSN/SAC No :</h5></td><td>&nbsp;</td> <td><?php if(!empty($data[0]->HSN)){echo $data[0]->HSN;}?></td>
</tr>
<tr> <td style="text-align:right;"><h5>Value Before GST :</h5></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php if(!empty($data[0]->value_before_gst)){echo $data[0]->value_before_gst;}?></td>
@ -118,7 +118,7 @@ if(!empty($data))
<tr> <td style="text-align:right;"><h4>Date :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php if(!empty($data[0]->date)){echo date_format(date_create($data[0]->date),'d-m-Y');}?></td></tr>
<tr> <td style="text-align:right;"><h4><?php echo $label;?></h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php if(!empty($data[0]->towhom)){echo $data[0]->towhom;}?></td></tr>
<?php if($flag == 1){?>
<tr> <td style="text-align:right;"><h4>Invoice No :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->invoice_no)){echo $data[0]->invoice_no;}?></td></tr>
<tr> <td style="text-align:right;"><h4><?php if($extype = 'PAYMENT'){echo 'Voucher No';}else{echo 'Invoice No';}?> :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->invoice_no)){echo $data[0]->invoice_no;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Merchant Name :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->merchant)){echo $data[0]->merchant;}?></td></tr>
<tr> <td style="text-align:right;"><h4>Merchant GST No :</h4></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php if(!empty($data[0]->merchant_gst)){echo $data[0]->merchant_gst;}?></td></tr>
<tr> <td style="text-align:right;"><h4>HSN/SAC No :</h4></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><?php if(!empty($data[0]->HSN)){echo $data[0]->HSN;}?></td></tr>