I have a function that is called here:
$("#valorPrimeiroPedido").focusout(function () {
var valor = $("#valorPrimeiroPedido").val();
calcularValorMercadoria(valor);
});
$("#valorPrimeiroPedido").val()
already brings me the formatted value (ex: R $: 1,500,56) . When it loses focus it calls the function below, passing the formatted value. There is the error. I can not calculate the IPI and display in HTML .
function calcularValorMercadoria(valor) {
var _valorPedido = CurrencyFormat(valor);
var _valorPedidoComIPI = _valorPedido * 1.1;
console.log(_valorPedido);
$("#ipi").html("Valor do pedido com IPI: R$ " + CurrencyFormat(_valorPedidoComIPI));
}
Erro: Uncaught ReferenceError: *CurrencyFormat is not defined*.
When I take the mask CurrencyFormat
, the value returned is: R$ NaN
I'm using some libraries:
<script src="~/Content/modalAjax/jquery-3.3.1.min.js"></script>
<script src="~/Content/modalAjax/bootstrap.min.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Areas/Representantes/Script/cliente/cadastro.js"></script>
<script src="~/Areas/Representantes/Script/cliente/abas.js"></script>
<link href="~/Areas/Representantes/Script/cliente/ClienteEstilo.css" rel="stylesheet" />
<script src="~/Content/modalAjax/bootstrapcdn.min.js"></script>
<script src="~/Content/modalAjax/ajaxmodaldeconfirmacaobootbox.min.js"></script>
<script src="https://cdn.rawgit.com/plentz/jquery-maskmoney/master/dist/jquery.maskMoney.min.js"></script>
Summary: I need to get the value in the Real format, calculate the IPI and also show the calculation in the Real format and then save in the float format (in SQL).