
    function Unidades() {
        const capital = localStorage.getItem('capital');
        console.log(capital)
        localStorage.setItem( 'kapital', capital )
        const desembolso = localStorage.getItem('pagos_total');
        localStorage.setItem( 'pagos_total', desembolso )
        const fecha_vencimiento = localStorage.getItem('fecha_vencimiento');
        localStorage.setItem( 'f_vencimiento', fecha_vencimiento )
        const pago = localStorage.getItem('pago_parcial');
        localStorage.setItem( 'payment', pago )
        const comision = localStorage.getItem('comision');
        localStorage.setItem( 'com', comision )
        const periodicidad = localStorage.getItem('periodicidad');
        localStorage.setItem( 'per', periodicidad )
        const tasa = localStorage.getItem('tasa');
        localStorage.setItem( 'interest_rate', tasa )
        const n = localStorage.getItem('parcialidades');
        localStorage.setItem( 'n', n )
        
        const fecha_inicio = localStorage.getItem('fecha_inicio')
        //document.getElementById('fecha_inicio').textContent = fecha_inicio;
        localStorage.setItem( 'fecha_inicio2', fecha_inicio );
        console.log(fecha_inicio)
        // Get the form element
        const form = document.getElementById('myForm');
        
        // Define myData by selecting the HTML element you want to save
        const myData = document.getElementById('loancal');
    
        // Save the table data to localStorage
        const savedTable = localStorage.getItem('tabla');
        localStorage.setItem('tabla', savedTable);
        const formData = {};
        new FormData(form).forEach((value, key) => {
            formData[key] = value;
        });
        
        // Save the serialized form data to localStorage
        localStorage.setItem('formData', JSON.stringify(formData));
        
        
       // localStorage.setItem('myForm', myData.innerHTML);
    
        // Add a submit event listener to the form
        form.addEventListener('submit', function (event) {
            event.preventDefault(); // Prevent the default form submission behavior
    
            // Get the form data
            const formData = new FormData(form);
    
            // Now, you can navigate to the next HTML page (HTML contract)
            // You can use JavaScript to redirect to the next page, e.g., using window.location.href
            // Replace 'next_page.html' with the actual URL of your contract page
            window.location.href = 'contrato_credito.html';
        });
    }

