riainvoice/application/modules/invoices_1/views/partial_item_table.php
2023-05-27 19:26:12 +05:30

869 lines
34 KiB
PHP

<?
$Secondary='';
$State='';
//print_r($inv_status);
$inv_st='';
foreach($inv_status as $st)
{
$inv_st= $st->invoice_status_id;
}
//echo $inv_st;
if(!empty($GetSecondary))
{
foreach ($GetSecondary as $GetSec)
{
$Secondary = $GetSec->Secondary;
}
}
//echo $Secondary;
if(!empty($GetState))
{
foreach ($GetState as $GetState)
{
$State = $GetState->client_state;
}
}
// print_r($statecode);
$primarystatecode='';
foreach ($GetClientPrimaryStateCode as $primary)
{
$primarystatecode=$primary->client_custom_fieldvalue;
}
$secondarystatecode='';
foreach ($GetClientSecondaryStateCode as $secondary)
{
$secondarystatecode=$secondary->client_custom_fieldvalue;
}
// echo $secondarystatecode;
//echo $primarystatecode;
//echo $product;
?>
<script>
$(function () {
// Select2 for all select inputs
$(".simple-select").select2();
});
</script>
<div class="table-responsive">
<table id="item_table" class="items table table-condensed table-bordered no-margin">
<thead>
<tr>
<th></th>
<th><?php _trans('item'); ?></th>
<th><?php _trans('description'); ?></th>
<th><?php _trans('UOM'); ?></th>
<th><?php _trans('quantity'); ?></th>
<th><?php _trans('price'); ?></th>
<th><?php _trans('Item Discount'); ?></th>
<th><?php _trans('CGST'); ?></th>
<th><?php _trans('SGST'); ?></th>
<th><?php _trans('IGST'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="new_row" style="display: none;">
<tr>
<td class="td-icon"><i class="fa fa-arrows cursor-move"></i></td>
<td class="td-text">
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
<input type="hidden" name="item_id" value="">
<input type="hidden" name="item_product_id" value="">
<input type="hidden" name="item_task_id" class="item-task-id" value="">
<input type="text" name="item_name" class="input-sm form-control" id="productname" value="">
</td>
<?php if ($invoice->sumex_id == ""): ?>
<!-- <td class="td-textarea">
<div class="input-group">
<textarea name="item_description" class="input-sm form-control"></textarea>
</div>
</td> -->
<td class="td-text">
<select id="description" name="item_description" tabindex="2" onchange="changeItemDesc(this)" required autofocus class="simple-select">
<?php foreach($products as $product):
for($i = $product->product_id; $i <= $product->product_id; $i++): ?>
<option value="<?php echo $product->product_description; ?>" name="<?php echo $product->product_description ?>" id="<?php echo $product->product_id ?>"><?php echo $product->product_description ?></option>
<?php endfor;
endforeach;
?>
</select>
</td>
<?php else: ?>
<td class="td-date">
<div class="input-group">
<input type="text" name="item_date" class="input-sm form-control datepicker"
value="<?php echo format_date(@$item->item_date); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<?php endif; ?>
<td class="td-amount">
<div class="input-group">
<select name="item_product_unit_id" id="item_product_unit_id" class="form-control input-sm">
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($units as $unit) { ?>
<option value="<?php echo $unit->unit_id; ?>">
<?php echo $unit->unit_name . "/" . $unit->unit_name_plrl; ?>
</option>
<?php } ?>
</select>
<!-- <div class="input-group">
<input type="text" name="item_product_unit_id" id="item_product_unit_id" class="input-sm form-control amount" >
</div> -->
</div>
</td>
<td class="td-amount td-quantity">
<div class="input-group">
<input type="text" name="item_quantity" class="input-sm form-control amount" value="" onkeypress="return isNumberKey(event)";>
</div>
</td>
<td class="td-amount">
<div class="input-group">
<input type="text" name="item_price" id="item_price" class="input-sm form-control amount" >
</div>
</td>
<td class="td-amount">
<div class="input-group">
<input type="text" name="item_discount_amount" class="input-sm form-control amount"
value="" data-toggle="tooltip" data-placement="bottom"
title="<?php echo get_setting('currency_symbol') . ' ' . trans('per_item'); ?>">
</div>
</td>
<td>
<div class="input-group">
<select name="Cgst_item_tax_rate_id" id="Cgst_item_tax_rate_id" class="form-control input-sm">
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select(get_setting('default_item_tax_rate'), $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent). '% - ' . $tax_rate->tax_rate_name;; ?>
</option>
<?php } ?>
</select>
<!-- <input type="text" name="Cgst_item_tax_rate_id" id="Cgst_item_tax_rate_id" class="input-sm form-control amount" > -->
</div>
</td>
<td>
<div class="input-group">
<select name="Sgst_item_tax_rate_id" id="Sgst_item_tax_rate_id" class="form-control input-sm">
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select(get_setting('default_item_tax_rate'), $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
</option>
<?php } ?>
</select>
</div>
</td>
<td>
<div class="input-group" id="input-group">
<select name="Igst_item_tax_rate_id" id="Igst_item_tax_rate_id" class="form-control input-sm">
<option value="-1"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select(get_setting('default_item_tax_rate'), $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
</option>
<?php } ?>
</select>
</div>
</td>
<td class="td-icon text-right td-vert-middle"></td>
</tr>
</tbody>
<!-- <?php print_r($items);?> -->
<?php foreach ($items as $item) { ?>
<tbody class="item">
<tr>
<td rowspan="2" class="td-icon"><i class="fa fa-arrows cursor-move"></i></td>
<td class="td-text">
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
<input type="hidden" name="item_id" value="<?php echo $item->item_id; ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<input type="hidden" name="item_task_id" class="item-task-id"
value="<?php if ($item->item_task_id) {
echo $item->item_task_id;
} ?>">
<input type="hidden" name="item_product_id" value="<?php echo $item->item_product_id; ?>">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('item'); ?></span>-->
<input type="text" name="item_name" class="input-sm form-control"
value="<?php _htmlsc($item->item_name); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<?php if ($invoice->sumex_id == ""): ?>
<td class="td-textarea">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('description'); ?></span>
<textarea name="item_description"
class="input-sm form-control"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>><?php echo htmlsc($item->item_description); ?></textarea> -->
<!-- <input type="text" name="item_description" value="<?php echo $item->item_description; ?>">
-->
<!-- <?php print_r($products);?> -->
<select id="description" name="item_description" tabindex="2" onchange="changeItemDesc(this)" required autofocus class="simple-select">
<!-- <?php foreach ($products as $product) { ?>
for($i = $product->product_id; $i <= $product->product_id; $i++): ?>
<option value="<?php echo $unit->unit_id; ?>" name="<?php echo $product->product_description ?>" id="<?php echo $product->product_id ?>"<?php echo $product->product_description ?>
<?php check_select($item->item_description, $product->product_description); ?>>
<?php echo htmlsc($product->product_description); ?>
</option>
<?php } ?> -->
<?php foreach($products as $product):
for($i = $product->product_id; $i <= $product->product_id; $i++): ?>
<option value="<?php echo $product->product_description; ?>" name="<?php echo $product->product_description ?>" id="<?php echo $product->product_description ?>"
<?php check_select($item->product_description, $product->product_description); ?>>
<?php echo htmlsc($product->product_description); ?>
</option>
<?php endfor;
endforeach;
?>
</select>
</div>
</td>
<?php else: ?>
<td class="td-date">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('date'); ?></span> -->
<input type="text" name="item_date" class="input-sm form-control datepicker"
value="<?php echo format_date($item->item_date); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<?php endif; ?>
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('product_unit'); ?></span> -->
<select name="item_product_unit_id" id="item_product_unit_id" class="form-control input-sm">
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($units as $unit) { ?>
<option value="<?php echo $unit->unit_id; ?>"
<?php check_select($item->item_product_unit_id, $unit->unit_id); ?>>
<?php echo htmlsc($unit->unit_name) . "/" . htmlsc($unit->unit_name_plrl); ?>
</option>
<?php } ?>
</select>
<!-- <input type="text" name="item_product_unit_id" id="item_product_unit_id" class="input-sm form-control amount" value="<?php echo $item->item_product_unit?>"> -->
</div>
</td>
<td class="td-amount td-quantity">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('quantity'); ?></span>-->
<input type="text" name="item_quantity" class="input-sm form-control amount"
value="<?php echo format_amount($item->item_quantity); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('price'); ?></span> -->
<input type="text" name="item_price" class="input-sm form-control amount"
value="<?php echo format_amount($item->item_price); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('item_discount'); ?></span> -->
<input type="text" name="item_discount_amount" class="input-sm form-control amount"
value="<?php echo format_amount($item->item_discount_amount); ?>"
data-toggle="tooltip" data-placement="bottom"
title="<?php echo get_setting('currency_symbol') . ' ' . trans('per_item'); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
</div>
</td>
<!-- <select id="description" name="item_description" tabindex="2" onchange="changeItemDesc(this)" required autofocus class="simple-select">
<?php foreach($products as $product):
for($i = $product->product_id; $i <= $product->product_id; $i++): ?>
<option value="<?php echo $product->product_description; ?>" name="<?php echo $product->product_name ?>" id="<?php echo $product->product_description ?>"
<?php check_select($item->item_description, $product->product_description); ?>>
<?php echo htmlsc($product->product_description); ?>
</option>
<?php endfor;
endforeach;
?>
</select> -->
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('CGST'); ?></span> -->
<select name="Cgst_item_tax_rate_id" id="Cgst_item_tax_rate_id" class="form-control input-sm">
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select($item->Cgst_item_tax_rate_id, $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
</option>
<?php } ?>
</select>
</div>
</td>
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('SGST'); ?></span> -->
<select name="Sgst_item_tax_rate_id" id="Sgst_item_tax_rate_id" class="form-control input-sm"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select($item->Sgst_item_tax_rate_id, $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
</option>
<?php } ?>
</select>
</div>
</td>
<td class="td-amount">
<div class="input-group">
<!-- <span class="input-group-addon"><?php _trans('IGST'); ?></span> -->
<select name="Igst_item_tax_rate_id" id="Igst_item_tax_rate_id" class="form-control input-sm"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<option value="0"><?php _trans('none'); ?></option>
<?php foreach ($tax_rates as $tax_rate) { ?>
<option value="<?php echo $tax_rate->tax_rate_id; ?>"
<?php check_select($item->Igst_item_tax_rate_id, $tax_rate->tax_rate_id); ?>>
<?php echo format_amount($tax_rate->tax_rate_percent) ?>
</option>
<?php } ?>
</select>
</div>
</td>
<td class="td-icon text-right td-vert-middle">
<?php if ($invoice->is_read_only != 1): ?>
<a href="<?php echo site_url('invoices/delete_item/' . $invoice->invoice_id . '/' . $item->item_id); ?>"
title="<?php _trans('delete'); ?>">
<i class="fa fa-trash-o text-danger"></i>
</a>
<?php endif; ?>
</td>
</tr>
<!-- <tr>
<td class="td-amount td-vert-middle">
<span><?php _trans('subtotal'); ?></span><br/>
<span name="subtotal" class="amount">
<?php echo format_currency($item->item_subtotal); ?>
</span>
</td>
<td class="td-amount td-vert-middle">
<span><?php _trans('discount'); ?></span><br/>
<span name="item_discount_total" class="amount">
<?php echo format_currency($item->item_discount); ?>
</span>
</td>
<td class="td-amount td-vert-middle">
<span><?php _trans('tax'); ?></span><br/>
<span name="item_tax_total" class="amount">
<?php echo format_currency($item->item_tax_total); ?>
</span>
</td>
<td class="td-amount td-vert-middle">
<span><?php _trans('total'); ?></span><br/>
<span name="item_total" class="amount">
<?php echo format_currency($item->item_total); ?>
</span>
</td>
</tr> -->
</tbody>
<?php } ?>
</table>
</div>
<br>
<div class="row">
<!-- <?php if ($invoice->is_read_only != 1) { ?>
<a href="#" class="btn_add_row btn btn-sm btn-default">
<i class="fa fa-plus"></i> <?php _trans('add_new_row'); ?>
</a>
<?php } ?> -->
<div class="col-xs-12 col-md-4" style="display:none;">
<div class="btn-group">
<?php if ($invoice->is_read_only != 1) { ?>
<a href="#" class="btn_add_row btn btn-sm btn-default">
<i class="fa fa-plus"></i> <?php _trans('add_new_row'); ?>
</a>
<a href="#" class="btn_add_product btn btn-sm btn-default">
<i class="fa fa-database"></i>
<?php _trans('add_product'); ?>
</a>
<a href="#" class="btn_add_task btn btn-sm btn-default">
<i class="fa fa-database"></i> <?php _trans('add_task'); ?>
</a>
<?php } ?>
</div>
</div>
<div class="col-xs-12 visible-xs visible-sm"><br></div>
<div class="col-xs-6 col-lg-6 col-md-6">
<?php $this->layout->load_view('upload/dropzone-invoice-html'); ?>
<?php $this->layout->load_view('upload/dropzone-invoice-scripts'); ?>
</div>
<div class="col-xs-6 col-md-4 col-md-offset-2 col-lg-4 col-lg-offset-2">
<table class="table table-bordered text-right">
<tr>
<th><?php _trans('subtotal'); ?></th>
<th><?php _trans('item_tax'); ?></th>
<th><?php _trans('invoice_tax'); ?></th>
<th><?php _trans('total'); ?></th>
</tr>
<tr>
<td class="amount" id="subtotal"><?php echo format_currency($invoice->invoice_item_subtotal); ?></td>
<td class="amount" id="item_tax"><?php echo format_currency($invoice->invoice_item_tax_total); ?></td>
<td>
<?php if ($invoice_tax_rates) {
foreach ($invoice_tax_rates as $invoice_tax_rate) {
?>
<form>
<button type="button" class="btn btn-xs btn-link"
onclick="deletetcs();">
<i class="fa fa-trash-o"></i>
</button>
<span class="text-muted" id="tcspercentage">
<?php echo htmlsc($invoice_tax_rate->invoice_tax_rate_name) . ' ' .($invoice_tax_rate->invoice_tax_rate_percent) . '%' ?>
</span>
<span class="amount" id="tcs">
<?php echo format_currency($invoice_tax_rate->invoice_tax_rate_amount); ?>
</span>
</form>
<?php
}
} else {
echo format_currency('0');
} ?>
</td>
<td class="amount" id="total"><b><?php echo format_currency($invoice->invoice_total); ?></b></td>
</tr>
<tr style="display:none;">
<td class="td-vert-middle"><?php _trans('discount'); ?></td>
<td class="clearfix">
<div class="discount-field">
<div class="input-group input-group-sm">
<input id="invoice_discount_amount" name="invoice_discount_amount"
class="discount-option form-control input-sm amount"
value="<?php echo format_amount($invoice->invoice_discount_amount != 0 ? $invoice->invoice_discount_amount : ''); ?>"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<div class="input-group-addon"><?php echo get_setting('currency_symbol'); ?></div>
</div>
</div>
<div class="discount-field">
<div class="input-group input-group-sm">
<input id="invoice_discount_percent" name="invoice_discount_percent"
value="<?php echo format_amount($invoice->invoice_discount_percent != 0 ? $invoice->invoice_discount_percent : ''); ?>"
class="discount-option form-control input-sm amount"
<?php if ($invoice->is_read_only == 1) {
echo 'disabled="disabled"';
} ?>>
<div class="input-group-addon">&percnt;</div>
</div>
</div>
</td>
</tr>
<!-- paid field disabled
<tr>
<td><?php _trans('paid'); ?></td>
<td class="amount"><b><?php echo format_currency($invoice->invoice_paid); ?></b></td>
</tr>
<tr>
<td><b><?php _trans('balance'); ?></b></td>
<td class="amount"><b><?php echo format_currency($invoice->invoice_balance); ?></b></td>
</tr>-->
</table>
</div>
</div>
<script>
function deletetcs()
{
//alert('a');
//$('#deletestatus').text('1');
//$("#inv_hs").show();
totalinvoice=$('#total').text();
subtotalinvoice=$('#subtotal').text();
itemtax=$('#item_tax').text();
tcsamount=$('#tcs').text();
// alert(totalinvoice);
// alert(subtotalinvoice);
// alert(itemtax);
// alert(tcsamount);
// return false;
totalinvoice= Number(totalinvoice.replace(/[^0-9\.]+/g,""));
subtotalinvoice= Number(subtotalinvoice.replace(/[^0-9\.]+/g,""));
itemtax= Number(itemtax.replace(/[^0-9\.]+/g,""));
tcsamount= Number(tcsamount.replace(/[^0-9\.]+/g,""));
result = (totalinvoice - tcsamount).toFixed(2);
invoice_balance=(subtotalinvoice + itemtax).toFixed(2);
console.log(result);
console.log(invoice_balance);
//return false;
$('#tcs').text('0.00');
$('#tcspercentage').text('0.00');
var invoice_id = <?php echo json_encode($invoice_id)?>;
//alert(invoice_id);
//return false;
$('#total').text(result);
//return false;
$.ajax(
{
data:{inv_id:invoice_id,tcs:tcsamount,invoiceamount:result,inv_balance:invoice_balance},
//alert(data);
type:"POST",
url:"<?php echo base_url() ?>index.php/invoices/delete_invoice_tax",
success:function(res)
{
alert('invoice tax deleted successfully');
}
});
}
</script>
<script>
var inv_status = <?php echo json_encode($inv_st, JSON_PRETTY_PRINT) ?>;
if(inv_status == '4')
{
$("#Igst_item_tax_rate_id option").attr("disabled", "disabled");
$("#Cgst_item_tax_rate_id option").attr("disabled", "disabled");
$("#Sgst_item_tax_rate_id option").attr("disabled", "disabled");item_product_unit_id
$("#item_product_unit_id option").attr("disabled", "disabled");
$("#description option").attr("disabled","disabled");
$('input[type="text"], textarea').attr('readonly','readonly');
}
function changeItemDesc(s){
var jsarray = <?php echo json_encode($products);?>;
//var inv_status= <?php echo json_encode($inv_st);?>;
//alert(jsarray)
var taxrate = <?php echo json_encode($producttax);?>;
var primarystate= <?php echo json_encode($primarystatecode);?>
//console.log(primarystate);
var pname ='';
var pprice ='';
var pid='';
var adID = s[s.selectedIndex].value; // get ID
var adVALUE = s[s.selectedIndex].id; // get value
$.each(jsarray,function(key,value)
{
if(adID == value.product_description)
{
pname = value.product_name;
pprice = value.product_price;
pid=value.product_id;
puom=value.unit_name;
pcgst=value.cgst;
psgst=value.sgst;
pigst=value.igst;
gst = "% - GST";
//console.log(pigst);
// console.log(pcgst);
// console.log(psgst);
var CGST=pcgst+gst;
var last_item_row = $('#item_table tbody:last');
last_item_row.find('input[name=item_price]').val(value.product_price);
last_item_row.find('input[name=item_name]').val(pname);
last_item_row.find('input[name= item_product_id]').val(pid);
var dropdown = document.getElementById('item_product_unit_id');
var length=dropdown.length;
for(var i=0;i<=length;i++)
{
var opt=document.getElementById("item_product_unit_id").options[i].text;
var opta = opt.substr(0,opt.indexOf('/'));
var optval=document.getElementById("item_product_unit_id").options[i].value;
if(puom==opta)
{
// if(i==1)
// {
// $('[name=item_product_unit_id]').val(4);
// }
// else
// {
// $('[name=item_product_unit_id]').val(i-1);
// }
$('[name=item_product_unit_id]').val(optval);
break;
}
}
if(primarystate=='33')
{
var dropdowncgst = document.getElementById('Cgst_item_tax_rate_id');
var cgstlength=dropdowncgst.length;
for(var i=0;i<cgstlength;i++)
{
var cgst=document.getElementById("Cgst_item_tax_rate_id").options[i].text;
var optcgst=document.getElementById("Cgst_item_tax_rate_id").options[i].text;
var optacgst = optcgst.substr(0,optcgst.indexOf('%'));
var optcgstval=document.getElementById("Cgst_item_tax_rate_id").options[i].value;
if(pcgst==optacgst)
{
$('[name=Cgst_item_tax_rate_id]').val(optcgstval);
break;
}
}
var dropdownsgst=document.getElementById('Sgst_item_tax_rate_id');
var sgstlength=dropdownsgst.length;
for(var i=0;i<sgstlength;i++)
{
var sgst=document.getElementById("Sgst_item_tax_rate_id").options[i].text;
var optsgst=document.getElementById("Sgst_item_tax_rate_id").options[i].text;
var optasgst = optsgst.substr(0,optsgst.indexOf('%'));
var optsgstval=document.getElementById("Sgst_item_tax_rate_id").options[i].value;
if(psgst==optasgst)
{
$('[name=Sgst_item_tax_rate_id]').val(optsgstval);
break;
}
}
}
else
{
//alert();
var dropdownigst=document.getElementById('Igst_item_tax_rate_id');
//console.log(dropdownigst);
var igstlength=dropdownigst.length;
for(var i=0;i<igstlength;i++)
{
var igst=document.getElementById("Igst_item_tax_rate_id").options[i].text;
var optigst=document.getElementById("Igst_item_tax_rate_id").options[i].text;
var optaigst = optigst.substr(0,optigst.indexOf('%'));
var optigstval=document.getElementById("Igst_item_tax_rate_id").options[i].value;
//console.log(igst);
if(pigst==optaigst)
{ //console.log(optaigst);
$('[name=Igst_item_tax_rate_id]').val(optigstval);
break;
}
}
}
// var statename= <?php echo json_encode($State);?>;
// if(statename=='Tamilnadu'||statename=='tamilnadu'||statename=='TAMILNADU'||statename=='TAMIL NADU'||statename=='tamil nadu'||statename=='Tamil nadu'||statename=='Tamil Nadu')
// {
// $('[name=Igst_item_tax_rate_id]').val(-1);
// //$("#Igst_item_tax_rate_id option").attr("disabled", "disabled");
// }
// else
// {
// $('[name=Sgst_item_tax_rate_id]').val(0);
// $('[name=Cgst_item_tax_rate_id]').val(0);
// }
// $("select#Igst_item_tax_rate_id").val('').attr('selected', true);
// $("#Igst_item_tax_rate_id option").attr("disabled", "disabled");
}
});
//alert(pname+':'+pprice+':'+pid);
}
function myFun1(a)
{
// var as=document.getElementById(a).value;
// console.log(as);
var statename= <?php echo json_encode($State);?>;
if(statename=='Tamilnadu')
{
}
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
// Added to allow decimal, period, or delete
if (charCode == 110 || charCode == 190 || charCode == 46)
return true;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>