Finalizando Formulário de Relatório de Estoque no Google Planilhas - Aula 05

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии • 1

  • @sgpgooglesheets
    @sgpgooglesheets  Год назад

    Códigos de Suporte: Aula 05:
    function GerarTabela(Dados){
    var CorpoTabela = document.getElementById("CorpoTabela");
    var EntradaQtd = 0;
    var EntradaRs = 0;
    var SaidaQtd = 0;
    var SaidaRs = 0;
    var SaldoQtd = 0;
    var SaldoRs = 0;
    Dados.forEach(function(r){
    var Coluna1 = document.createElement("td");
    Coluna1.textContent = r[0];
    var Coluna2 = document.createElement("td");
    Coluna2.textContent = r[1];
    var Coluna3 = document.createElement("td");
    Coluna3.textContent = r[2];
    var Coluna4 = document.createElement("td");
    Coluna4.textContent = parseFloat(r[3]).toLocaleString("pt-BR",{style: "decimal", decimal:"BRL"});
    var Coluna5 = document.createElement("td");
    Coluna5.textContent = parseFloat(r[4]).toLocaleString("pt-BR",{style: "decimal", decimal:"BRL"});
    var Coluna6 = document.createElement("td");
    Coluna6.textContent = parseFloat(r[5]).toLocaleString("pt-BR",{style: "decimal", decimal:"BRL"});
    var Coluna7 = document.createElement("td");
    Coluna7.textContent = parseFloat(r[6]).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna8 = document.createElement("td");
    Coluna8.textContent = parseFloat(r[7]).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna9 = document.createElement("td");
    Coluna9.textContent = parseFloat(r[8]).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Linha = document.createElement("tr");
    Linha.appendChild(Coluna1);
    Linha.appendChild(Coluna2);
    Linha.appendChild(Coluna3);
    Linha.appendChild(Coluna4);
    Linha.appendChild(Coluna5);
    Linha.appendChild(Coluna6);
    Linha.appendChild(Coluna7);
    Linha.appendChild(Coluna8);
    Linha.appendChild(Coluna9);

    CorpoTabela.appendChild(Linha);
    EntradaQtd = parseFloat(EntradaQtd) + parseFloat(r[3]);
    EntradaRs = parseFloat(EntradaRs) + parseFloat(r[4]);
    SaidaQtd = parseFloat(SaidaQtd) + parseFloat(r[5]);
    SaidaRs = parseFloat(SaidaRs) + parseFloat(r[6]);
    SaldoQtd = parseFloat(SaldoQtd) + parseFloat(r[7]);
    SaldoRs = parseFloat(SaldoRs) + parseFloat(r[8]);
    });
    var Coluna1 = document.createElement("td");
    Coluna1.textContent = "TOTAL";
    var Coluna2 = document.createElement("td");
    Coluna2.textContent = "_";
    var Coluna3 = document.createElement("td");
    Coluna3.textContent = "_";
    var Coluna4 = document.createElement("td");
    Coluna4.textContent = parseFloat(EntradaQtd).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna5 = document.createElement("td");
    Coluna5.textContent = parseFloat(EntradaRs).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna6 = document.createElement("td");
    Coluna6.textContent = parseFloat(SaidaQtd).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna7 = document.createElement("td");
    Coluna7.textContent = parseFloat(SaidaRs).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna8 = document.createElement("td");
    Coluna8.textContent = parseFloat(SaldoQtd).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Coluna9 = document.createElement("td");
    Coluna9.textContent = parseFloat(SaldoRs).toLocaleString("pt-BR",{style:"decimal", decimal:"BRL"});
    var Linha = document.createElement("tr");
    Linha.appendChild(Coluna1);
    Linha.appendChild(Coluna2);
    Linha.appendChild(Coluna3);
    Linha.appendChild(Coluna4);
    Linha.appendChild(Coluna5);
    Linha.appendChild(Coluna6);
    Linha.appendChild(Coluna7);
    Linha.appendChild(Coluna8);
    Linha.appendChild(Coluna9);

    CorpoTabela.appendChild(Linha);
    Dados.length = 0;
    }
    ✅Site SGP: Venda da Planilha Pronta + Coleção de Scripts para estudos: planilhascanalsgp.com.br/planilhasgoogle
    ==========================================
    Comprar via WhatsApp: (49)98915-4923 - Planilha Pronta