Я создаю счет-фактуру, в которой каждый элемент имеет свой собственный код HSN [уникальный идентификатор налога] и связанный с ним процент налога.
В счете-фактуре должна отображаться сводка налога Процент спредж и соответствующая ему сумма. Зацикливание всего налога на продукт
Например, например: , если налог на продукт составляет 18%, а ставка на продукт составляет 100 рупий.
Ниже приведена сводная информация
-----------------------------------------
| CGST : 9% - Amount - 9rs
|HSNCODE
| SGST : 9% - Amount - 9rs
-----------------------------------------
Я пытался добиться этого для всех продуктов, к сожалению, я не могу продолжать дальше
Каждый раз, когда я пытаюсь извлеките значение gst из .gst
, которое меня бросает "undefined"
// Estimate Calculation
function calc() {
$('#tab_logic tbody tr').each(function (i, element) {
var html = $(this).html();
if (html != '') {
var gst = $(this).find('.gst').val();
var qty = $(this).find('.qty').val();
var price = $(this).find('.product_rate').val();
var rowItemPrice = qty * price;
var rowGstPrice = rowItemPrice * gst / 100;
$(this).find('.gst_price').val(rowGstPrice);
var rowTotal = rowItemPrice + rowGstPrice;
$(this).find('.row_total_amount').val(rowTotal);
calc_total();
}
});
}
// function gstSplit(thisObj) {
// var gst = $(thisObj).find('.gst').val();
// console.log(gst);
// $(thisObj).find('.gst_split').text('12');
// }
// function gstSplit(gst) {
// console.log(gst);
// console.log(html);
// var gstSplit = gst / 2;
// console.log(gstSplit);
// $('.gst_split').html("<b>CGST: </b>" + gstSplit);
// }
function calc_total() {
subtotal = 0;
gst = 0;
qty = 0;
$('.product_rate').each(function () {
subtotal += parseInt($(this).val());
});
$('.gst_price').each(function () {
gst += parseInt($(this).val());
});
$('.qty').each(function () {
qty += parseInt($(this).val());
})
$('#total_qty').text("Total Quantity: " + qty);
$('#total_tax_amount').text("GST Amount: " + gst.toFixed(2));
$('#subtotal').text("Subtotal: " + subtotal.toFixed(2));
var total_amount = gst + subtotal;
$('#total_amount').text("Total: " + total_amount.toFixed(2));
amountInWords(total_amount);
}
function totalAmountClick() {
$('#tab_logic tbody').on('keyup change', function () {
calc();
});
}
// Display Seperate HSN Code GST
//Vendor Details Auto Complete
$(document).ready(function () {
totalAmountClick(); // The function
//Add Row
//Delete Row
$(function () {
var i = 1;
$("#add_row").on("click", function (e) {
e.preventDefault();
b = i - 1;
$("#addr" + i).html($("#addr" + b).html());
$(".tab_logic").append('<tr id="addr' + (i + 1) + '"></tr>');
i++;
totalAmountClick();//Calculate the Invoice Amount
});
$("#delete_row").click(function () {
if (i > 1) {
$("#addr" + (i - 1)).html("");
i--;
}
});
});
});//Document Ready
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="container-fluid">
<form action="" method="post">
<div class="row border z-depth-1">
<div class="col s12">
<p><b> Product Details</b></p>
<table class="tab_logic" id="tab_logic">
<thead>
<tr>
<th>
Product Name
</th>
<th>
HSN Code
</th>
<th class="center">
GST
</th>
<th>
Quantity
</th>
<th>
Rate(per Nos)
</th>
<th class="center">
Discount
</th>
<th>
Amount
</th>
</tr>
</thead>
<tbody>
<tr id='addr0' class="addr0">
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="text" class="product_name autocomplete"
placeholder="Product Name">
<input type="hidden" name="product_id[]" class="product_id">
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="text" class="hsn_code autocomplete" placeholder="HSN Code">
<input type="hidden" name="hsn_code_id[]" class="hsn_code_id">
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="text" class="gst autocomplete" placeholder="GST" name="gst[]"
>
<input type="hidden" class="gst_price">
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="number" name='product_qty[]' placeholder='Enter Qty'
class="form-control qty" step="0" min="0" required />
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="number" name='product_rate[]' placeholder='Enter Rate'
class="form-control product_rate" step="0" min="0" required />
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="number" name='discount_rate[]' placeholder='Enter Discount'
class="form-control discount_rate" step="0" min="0" />
</div>
</div>
</div>
</td>
<td>
<div class="col s12">
<div class="row">
<div class="input-field col s12">
<input type="number" name='total_amount[]' placeholder='Total Amount'
class="form-control row_total_amount" step="0" min="0" disabled />
</div>
<div class="col s12">
<span class="gst_split"></span>
<table>
<thead>
<tr>
</tr>
</thead>
</table>
</div>
</div>
</div>
</td>
</tr>
<tr id='addr1' class="addr1"></tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td id="total_tax_amount" class="total_tax_amount center"></td>
<td id="total_qty" class="total_qty center"></td>
<td id="subtotal" class="subtotal center"></td>
<td id="total_discount" class="total_discount center"></td>
<td id="total_amount" class="total_amount center"></td>
</tr>
</tfoot>
</table>
<div class="row">
<div class="col s12">
<table>
<thead>
<tr>
<th>
<th class="right">
<button class="btn z-depth-1" id="add_row"><i class="material-icons">add_box</i>
</button>
<button class="btn z-depth-1 red" id="delete_row"><i
class="material-icons">remove</i> </button>
</th>
</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="row border-warning ">
<div class="col s12">
<div class="row">
<div class="col s3">
<div class="col s12 border">
<p class="underline min-height-6">HSN Code</p>
</div>
<ul class="hsn_code_disp" id="hsn_code_disp">
<li>
<span>
HSN Code
</span>
</li>
</ul>
</div>
<div class="col s2">
<div class="col s12 border">
<p class="center underline min-height-6">Taxable Value</p>
</div>
<span class="tax_value_disp">
1234
</span>
</div>
<div class="col s3">
<div class="row">
<div class="col s12 border">
<p class="underline">Central Tax</p>
<div class="row">
<div class="col s6">
<p class="underline">Rate</p>
</div>
<div class="col s6">
<p class="underline">Amount</p>
</div>
</div>
</div>
</div>
</div>
<div class="col s3">
<div class="row">
<div class="col s12 border">
<p class="underline">State Tax</p>
<div class="row">
<div class="col s6">
<p class="underline">Rate</p>
</div>
<div class="col s6">
<p class="underline">Amount</p>
</div>
</div>
</div>
</div>
</div>
<div class="col s1">
<div class="col s12 border">
<p class="underline min-height-6">Amount</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
Jsfiddle