function sum() {
var Total = 0;
;
var Discount = $("#txtDiscount").val() == "" ? "0" : $("#txtDiscount").val();
var Amt1 = $("#txtAmt1").val() == "" ? "0" : $("#txtAmt1").val();
var Amt2 = $("#txtAmt2").val() == "" ? "0" : $("#txtAmt2").val();
var Amt3 = $("#txtAmt3").val() == "" ? "0" : $("#txtAmt3").val();
var Amt4 = $("#txtAmt4").val() == "" ? "0" : $("#txtAmt4").val();
var Amt5 = $("#txtAmt5").val() == "" ? "0" : $("#txtAmt5").val();
//
debugger;
var Total = parseInt(Amt1) + parseInt(Amt2) + parseInt(Amt3) + parseInt(Amt4) + parseInt(Amt5);
document.getElementById("txtTotalBasic").value = Total;
var StateCode = $("#txtStateCode").val();
var CGSTAmt = 0.0, SGSTAmt = 0.0, IGSTAmt = 0.0;
var CGST_PER = 0.0, SGST_Per = 0.0, IGST_Per = 0.0;
if (parseInt(StateCode) == 27) //If state code = 27 then CGST and SGST applicable otherwise IGST applicable
{
CGST_PER = 9;
SGST_Per = 9;
CGSTAmt = (Total * CGST_PER) / 100;
SGSTAmt = (Total * SGST_Per) / 100;
}
else
{
IGST_Per = 18;
IGSTAmt = (Total * IGST_Per) / 100;
}
//Percentages
document.getElementById("txtCGSTPER").value = CGST_PER;
document.getElementById("txtSGSTPER").value = SGST_Per;
document.getElementById("txtIGST").value = IGST_Per;
// amount
document.getElementById("txtCGSTAmt").value = CGSTAmt;
document.getElementById("txtSGSTAmt").value = SGSTAmt;
document.getElementById("txtIGSTAmt").value = IGSTAmt;
var GrandTotal = 0.0;
GrandTotal = Total - Discount + CGSTAmt + SGSTAmt + IGSTAmt;
document.getElementById("txtGrandTotal").value = GrandTotal;
}
$("#ddlClient").on('change', function () {
;
var CustomerID = $("#ddlClient").val();
GetStateCode(CustomerID);
});
function GetStateCode(CustomerID) {
;
$.ajax({
//cache: false,
type: "POST",
url: "/Invoice/GetStateCode",
dataType: "json",
data: {
"CustomerID": CustomerID,
},
success: function (data) {
var StateID = $("#txtStateCode").val(data[0].stateCode);
hfstatecode(StateID);
},
error: function (xhr, ajaxOptions, thrownError) {
;
alert(thrownError);
$.unblockUI();
}
});
}
function hfstatecode(StateID) {
debugger;
//document.getElementById("txtStateCode").value;
$("#txtStateCode").val(StateID);
}