Lançamentos entradas e saidas

by thvinic

HTML

<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Controle de Lançamentos</title>
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
</head>
<body>
    <h1>Controle de Lançamentos</h1>
    
    <label for="data">Escolha uma data:</label>
    <input type="text" id="data" class="datefield">
    <br><br>
    <label for="valor">Valor da Diaria:</label>
    <input type="number" id="valor" placeholder="Digite o valor">
    <br><br>
    <label for="valor-recebido">Valores Pix recebidos:</label>
    <input type="number" id="valor-recebido" placeholder="Digite o valor já recebido">
    <br><br> 
    <label for="nota">quem depositou?</label>
    <input type="text" id="nota" placeholder="nome cliente ou instituição">

    <button id="adicionar">Adicionar Lançamento</button>
    
    <h2>Recebidos durante a semana:</h2>
    <div id="resultado"></div>

    <h3>Lançamentos:</h3>
    <ul id="lista-lancamentos"></ul>

    <button id="exportar-pdf">Exportar para PDF</button>
    <button id="limpar-dados">Limpar Todos os Dados</button>

    <script>
        $(function() {
            $("#data").datepicker({
                dateFormat: "dd/mm/yy"
            });
            atualizarResultado();
            listarLancamentos();
        });

        $("#adicionar").click(function() {
            let data = $("#data").val();
            let valor = parseFloat($("#valor").val());
            let valorRecebido = parseFloat($("#valor-recebido").val());
            let nota = $("#nota").val(); // Captura a nota
            
            if (data && !isNaN(valor)) {
                let lancamentos =...