Created
October 6, 2015 19:24
-
-
Save fchevitarese/252f4534741df1251e7a to your computer and use it in GitHub Desktop.
moment_calc.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#datetimepicker2').change(function(){ | |
var total_parcelas = $('#num_parcela').val(); | |
var quant_parcela = $('#quant').val(); | |
var total = parseFloat(produto.preco) * quant_parcela; | |
subtotal = total; | |
total = total.toFixed(2); | |
var valor_parcela = parseFloat(subtotal) / total_parcelas; | |
valor_parcela = valor_parcela.toFixed(2) | |
var data_venc = moment($('#data_vencimento').val()); | |
console.log() | |
var i = 0; | |
console.log(total_parcelas) | |
while (i < parseInt(total_parcelas)){ | |
var nosso_num = Math.floor(Math.random() * 34567890) + 1 | |
var dados_boleto = "<tr>"+ | |
"<td><b>" + nosso_num + "</b></td>"+ | |
"<td><b>" + produto.codigo + "</b></td>"+ | |
if i == 0 { | |
"<td>" + data_venc +" </td>"+ | |
} | |
else { | |
"<td>" + data_venc.add(30, 'days'); +" </td>"+ | |
} | |
"<td>R$ " + valor_parcela + " </td>"+ | |
"</tr>" | |
$('#gerar_boletos').append(dados_boleto); | |
i++; | |
console.log(i); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment