Sub calculaGastoMensalTotalRede_Nivel0 dim strQtdeTotalIndic_Nivel0 dim strGastoMensalPorIndicado_Nivel0 dim strGastoMensalTotalRede_Nivel0 dim strQtdeMegaBonus_Nivel0 dim strValorCreditoReceber_Nivel0 ' Inicializa Variaveis strQtdeTotalIndic_Nivel0 = 0 strGastoMensalPorIndicado_Nivel0 = 0 strGastoMensalTotalRede_Nivel0 = 0 strQtdeMegaBonus_Nivel0 = 0 strValorCreditoReceber_Nivel0 = 0 ' Carrega as variaveis strQtdeTotalIndic_Nivel0 = document.getElementById("idQtdeTotalIndic_Nivel0").innerText strGastoMensalPorIndicado_Nivel0 = document.getElementById("idGastoMens0").value ' Valida se o valor está entre 0,00(Mínimo) e 25.000,00(Máximo) dim strGastoMensalPorIndicado_Nivel0_AUX strGastoMensalPorIndicado_Nivel0_AUX = replace(replace(strGastoMensalPorIndicado_Nivel0, ",", ""), ".", "") if strGastoMensalPorIndicado_Nivel0_AUX <> "" then if not ((cLng(strGastoMensalPorIndicado_Nivel0_AUX) >= 0) and (cLng(strGastoMensalPorIndicado_Nivel0_AUX) <= 2500000)) then msgbox "O Gasto mensal total da rede deve estar entre R$ 0,00 e R$ 25.000,00." document.getElementById("idGastoMens0").select() document.getElementById("idGastoMens0").focus() Exit Sub end if else document.getElementById("idGastoTotalRede_Nivel0").innerHTML = "" document.getElementById("idQtdeMegaBonus_Nivel0").innerHTML = "" document.getElementById("idValorCreditoReceber_Nivel0").innerHTML = "" end if strGastoMensalTotalRede_Nivel0 = ((strGastoMensalPorIndicado_Nivel0/100) * strQtdeTotalIndic_Nivel0) * 100 ' Atualiza valor Gasto mensal total da rede document.getElementById("idGastoTotalRede_Nivel0").innerHTML = FormatCurrency(strGastoMensalTotalRede_Nivel0) 'Calcula a Quantidade de MegaBonus 'Para nível 0 a porcentagem é 1% strQtdeMegaBonus_Nivel0 = strGastoMensalTotalRede_Nivel0 * 0.01 ' Atualiza a Quantidade de MegaBonus document.getElementById("idQtdeMegaBonus_Nivel0").innerHTML = FormatNumber(strQtdeMegaBonus_Nivel0, 0) ' Atualiza o Total da Qtde de Megabonus atualizaTotalQtdeMegabonus() ' Calcula o Valor do Crédito a receber strValorCreditoReceber_Nivel0 = strQtdeMegaBonus_Nivel0 * 0.1 ' Atualiza o Valor do Crédito a Receber document.getElementById("idValorCreditoReceber_Nivel0").innerHTML = FormatCurrency(strValorCreditoReceber_Nivel0) 'Atualiza o Total do Valor do Crédito a Receber atualizaValorTotalCreditoReceber() end Sub Sub calculaGastoMensalTotalRede_Nivel1 dim strQtdeTotalIndic_Nivel1 dim strGastoMensalPorIndicado_Nivel1 dim strGastoMensalTotalRede_Nivel1 dim strQtdeMegaBonus_Nivel1 dim strValorCreditoReceber_Nivel1 ' Inicializa Variaveis strQtdeTotalIndic_Nivel1 = 0 strGastoMensalPorIndicado_Nivel1 = 0 strGastoMensalTotalRede_Nivel1 = 0 strQtdeMegaBonus_Nivel1 = 0 strValorCreditoReceber_Nivel1 = 0 ' Carrega as variaveis strQtdeTotalIndic_Nivel1 = document.getElementById("idQtdeTotalIndic_Nivel1").innerText strGastoMensalPorIndicado_Nivel1 = document.getElementById("idGastoMens1").value ' Valida se o valor está entre 0,00(Mínimo) e 25.000,00(Máximo) dim strGastoMensalPorIndicado_Nivel1_AUX strGastoMensalPorIndicado_Nivel1_AUX = replace(replace(strGastoMensalPorIndicado_Nivel1, ",", ""), ".", "") if strGastoMensalPorIndicado_Nivel1_AUX <> "" then if not ((cLng(strGastoMensalPorIndicado_Nivel1_AUX) >= 0) and (cLng(strGastoMensalPorIndicado_Nivel1_AUX) <= 2500000)) then msgbox "O Gasto mensal total da rede deve estar entre R$ 0,00 e R$ 25.000,00." document.getElementById("idGastoMens1").select() document.getElementById("idGastoMens1").focus() Exit Sub end if else document.getElementById("idGastoTotalRede_Nivel1").innerHTML = "" document.getElementById("idQtdeMegaBonus_Nivel1").innerHTML = "" document.getElementById("idValorCreditoReceber_Nivel1").innerHTML = "" end if strGastoMensalTotalRede_Nivel1 = ((strGastoMensalPorIndicado_Nivel1/100) * strQtdeTotalIndic_Nivel1) * 100 ' Atualiza valor Gasto mensal total da rede document.getElementById("idGastoTotalRede_Nivel1").innerHTML = FormatCurrency(strGastoMensalTotalRede_Nivel1) 'Calcula a Quantidade de MegaBonus 'Para nível 1 a porcentagem é 1% strQtdeMegaBonus_Nivel1 = strGastoMensalTotalRede_Nivel1 * 0.01 ' Atualiza a Quantidade de MegaBonus document.getElementById("idQtdeMegaBonus_Nivel1").innerHTML = FormatNumber(strQtdeMegaBonus_Nivel1, 0) ' Atualiza o Total da Qtde de Megabonus atualizaTotalQtdeMegabonus() ' Calcula o Valor do Crédito a receber strValorCreditoReceber_Nivel1 = strQtdeMegaBonus_Nivel1 * 0.1 ' Atualiza o Valor do Crédito a Receber document.getElementById("idValorCreditoReceber_Nivel1").innerHTML = FormatCurrency(strValorCreditoReceber_Nivel1) 'Atualiza o Total do Valor do Crédito a Receber atualizaValorTotalCreditoReceber() end Sub Sub calculaGastoMensalTotalRede_Nivel2 dim strQtdeTotalIndic_Nivel2 dim strGastoMensalPorIndicado_Nivel2 dim strGastoMensalTotalRede_Nivel2 dim strQtdeMegaBonus_Nivel2 dim strValorCreditoReceber_Nivel2 ' Inicializa Variaveis strQtdeTotalIndic_Nivel2 = 0 strGastoMensalPorIndicado_Nivel2 = 0 strGastoMensalTotalRede_Nivel2 = 0 strQtdeMegaBonus_Nivel2 = 0 strValorCreditoReceber_Nivel2 = 0 ' Carrega as variaveis strQtdeTotalIndic_Nivel2 = document.getElementById("idQtdeTotalIndic_Nivel2").innerText strGastoMensalPorIndicado_Nivel2 = document.getElementById("idGastoMens2").value ' Valida se o valor está entre 0,00(Mínimo) e 25.000,00(Máximo) dim strGastoMensalPorIndicado_Nivel2_AUX strGastoMensalPorIndicado_Nivel2_AUX = replace(replace(strGastoMensalPorIndicado_Nivel2, ",", ""), ".", "") if strGastoMensalPorIndicado_Nivel2_AUX <> "" then if not ((cLng(strGastoMensalPorIndicado_Nivel2_AUX) >= 0) and (cLng(strGastoMensalPorIndicado_Nivel2_AUX) <= 2500000)) then msgbox "O Gasto mensal total da rede deve estar entre R$ 0,00 e R$ 25.000,00." document.getElementById("idGastoMens2").select() document.getElementById("idGastoMens2").focus() Exit Sub end if else document.getElementById("idGastoTotalRede_Nivel2").innerHTML = "" document.getElementById("idQtdeMegaBonus_Nivel2").innerHTML = "" document.getElementById("idValorCreditoReceber_Nivel2").innerHTML = "" end if strGastoMensalTotalRede_Nivel2 = ((strGastoMensalPorIndicado_Nivel2/100) * strQtdeTotalIndic_Nivel2) * 100 ' Atualiza valor Gasto mensal total da rede document.getElementById("idGastoTotalRede_Nivel2").innerHTML = FormatCurrency(strGastoMensalTotalRede_Nivel2) 'Calcula a Quantidade de MegaBonus 'Para nível 2 a porcentagem é 2% strQtdeMegaBonus_Nivel2 = strGastoMensalTotalRede_Nivel2 * 0.02 ' Atualiza a Quantidade de MegaBonus document.getElementById("idQtdeMegaBonus_Nivel2").innerHTML = FormatNumber(strQtdeMegaBonus_Nivel2, 0) ' Atualiza o Total da Qtde de Megabonus atualizaTotalQtdeMegabonus() ' Calcula o Valor do Crédito a receber strValorCreditoReceber_Nivel2 = strQtdeMegaBonus_Nivel2 * 0.1 ' Atualiza o Valor do Crédito a Receber document.getElementById("idValorCreditoReceber_Nivel2").innerHTML = FormatCurrency(strValorCreditoReceber_Nivel2) 'Atualiza o Total do Valor do Crédito a Receber atualizaValorTotalCreditoReceber() end Sub Sub calculaGastoMensalTotalRede_Nivel3 dim strQtdeTotalIndic_Nivel3 dim strGastoMensalPorIndicado_Nivel3 dim strGastoMensalTotalRede_Nivel3 dim strQtdeMegaBonus_Nivel3 dim strValorCreditoReceber_Nivel3 ' Inicializa Variaveis strQtdeTotalIndic_Nivel3 = 0 strGastoMensalPorIndicado_Nivel3 = 0 strGastoMensalTotalRede_Nivel3 = 0 strQtdeMegaBonus_Nivel3 = 0 strValorCreditoReceber_Nivel3 = 0 ' Carrega as variaveis strQtdeTotalIndic_Nivel3 = document.getElementById("idQtdeTotalIndic_Nivel3").innerText strGastoMensalPorIndicado_Nivel3 = document.getElementById("idGastoMens3").value ' Valida se o valor está entre 0,00(Mínimo) e 25.000,00(Máximo) dim strGastoMensalPorIndicado_Nivel3_AUX strGastoMensalPorIndicado_Nivel3_AUX = replace(replace(strGastoMensalPorIndicado_Nivel3, ",", ""), ".", "") if strGastoMensalPorIndicado_Nivel3_AUX <> "" then if not ((cLng(strGastoMensalPorIndicado_Nivel3_AUX) >= 0) and (cLng(strGastoMensalPorIndicado_Nivel3_AUX) <= 2500000)) then msgbox "O Gasto mensal total da rede deve estar entre R$ 0,00 e R$ 25.000,00." document.getElementById("idGastoMens3").select() document.getElementById("idGastoMens3").focus() Exit Sub end if else document.getElementById("idGastoTotalRede_Nivel3").innerHTML = "" document.getElementById("idQtdeMegaBonus_Nivel3").innerHTML = "" document.getElementById("idValorCreditoReceber_Nivel3").innerHTML = "" end if strGastoMensalTotalRede_Nivel3 = ((strGastoMensalPorIndicado_Nivel3/100) * strQtdeTotalIndic_Nivel3) * 100 ' Atualiza valor Gasto mensal total da rede document.getElementById("idGastoTotalRede_Nivel3").innerHTML = FormatCurrency(strGastoMensalTotalRede_Nivel3) 'Calcula a Quantidade de MegaBonus 'Para nível 3 a porcentagem é 4% strQtdeMegaBonus_Nivel3 = strGastoMensalTotalRede_Nivel3 * 0.04 ' Atualiza a Quantidade de MegaBonus document.getElementById("idQtdeMegaBonus_Nivel3").innerHTML = FormatNumber(strQtdeMegaBonus_Nivel3, 0) ' Atualiza o Total da Qtde de Megabonus atualizaTotalQtdeMegabonus() ' Calcula o Valor do Crédito a receber strValorCreditoReceber_Nivel3 = strQtdeMegaBonus_Nivel3 * 0.1 ' Atualiza o Valor do Crédito a Receber document.getElementById("idValorCreditoReceber_Nivel3").innerHTML = FormatCurrency(strValorCreditoReceber_Nivel3) 'Atualiza o Total do Valor do Crédito a Receber atualizaValorTotalCreditoReceber() end Sub Sub atualizaTotalQtdeMegabonus dim strQtdeTotalMB dim strQtdeTotalMB_Nivel0 dim strQtdeTotalMB_Nivel1 dim strQtdeTotalMB_Nivel2 dim strQtdeTotalMB_Nivel3 ' Inicializa Variaveis strQtdeTotalMB = 0 strQtdeTotalMB_Nivel0 = 0 strQtdeTotalMB_Nivel1 = 0 strQtdeTotalMB_Nivel2 = 0 strQtdeTotalMB_Nivel3 = 0 ' Carrega as variaveis strQtdeTotalMB_Nivel0 = document.getElementById("idQtdeMegaBonus_Nivel0").innerText strQtdeTotalMB_Nivel1 = document.getElementById("idQtdeMegaBonus_Nivel1").innerText strQtdeTotalMB_Nivel2 = document.getElementById("idQtdeMegaBonus_Nivel2").innerText strQtdeTotalMB_Nivel3 = document.getElementById("idQtdeMegaBonus_Nivel3").innerText ' Valida se não está vazio para não dar erro if strQtdeTotalMB_Nivel0 = "" then strQtdeTotalMB_Nivel0 = 0 if strQtdeTotalMB_Nivel1 = "" then strQtdeTotalMB_Nivel1 = 0 if strQtdeTotalMB_Nivel2 = "" then strQtdeTotalMB_Nivel2 = 0 if strQtdeTotalMB_Nivel3 = "" then strQtdeTotalMB_Nivel3 = 0 ' Atualiza Totalizador Quantidade total strQtdeTotalMB = cDbl(strQtdeTotalMB_Nivel0) + cDbl(strQtdeTotalMB_Nivel1) + cDbl(strQtdeTotalMB_Nivel2) + cDbl(strQtdeTotalMB_Nivel3) document.getElementById("idQtdeTotalMegaBonus").innerHTML = FormatNumber(strQtdeTotalMB, 0) end Sub Sub atualizaValorTotalCreditoReceber dim strTotalValorCreditoReceber dim strValorCreditoReceber_Nivel0 dim strValorCreditoReceber_Nivel1 dim strValorCreditoReceber_Nivel2 dim strValorCreditoReceber_Nivel3 ' Inicializa Variaveis strTotalValorCreditoReceber = 0 strValorCreditoReceber_Nivel0 = 0 strValorCreditoReceber_Nivel1 = 0 strValorCreditoReceber_Nivel2 = 0 strValorCreditoReceber_Nivel3 = 0 ' Carrega as variaveis strValorCreditoReceber_Nivel0 = document.getElementById("idValorCreditoReceber_Nivel0").innerText strValorCreditoReceber_Nivel1 = document.getElementById("idValorCreditoReceber_Nivel1").innerText strValorCreditoReceber_Nivel2 = document.getElementById("idValorCreditoReceber_Nivel2").innerText strValorCreditoReceber_Nivel3 = document.getElementById("idValorCreditoReceber_Nivel3").innerText ' Valida se não está vazio para não dar erro if strValorCreditoReceber_Nivel0 = "" then strValorCreditoReceber_Nivel0 = 0 if strValorCreditoReceber_Nivel1 = "" then strValorCreditoReceber_Nivel1 = 0 if strValorCreditoReceber_Nivel2 = "" then strValorCreditoReceber_Nivel2 = 0 if strValorCreditoReceber_Nivel3 = "" then strValorCreditoReceber_Nivel3 = 0 ' Atualiza Totalizador Quantidade total strTotalValorCreditoReceber = ((strValorCreditoReceber_Nivel0/100) + (strValorCreditoReceber_Nivel1/100) + (strValorCreditoReceber_Nivel2/100) + (strValorCreditoReceber_Nivel3/100)) * 100 document.getElementById("idValorTotalCreditoReceber").innerHTML = FormatCurrency(strTotalValorCreditoReceber) & "
para você!*" end Sub Sub atualizaNivel1 dim strSemiTotNivel1 dim strQtdeTotalIndic_Nivel0 dim strNivel1 ' Inicializa Variaveis strSemiTotNivel1 = 0 strQtdeTotalIndic_Nivel0 = 0 strNivel1 = 0 ' Carrega as variaveis strNivel1 = document.getElementById("idNivel1").value if strNivel1 = "" then document.getElementById("idNivel1").value = "0" strNivel1 = 0 end if ' Valida se a Quantidade de indicados por nível está entre 0(Mínimo) e 2.700(Máximo) if strNivel1 <> "" then if not ((cLng(strNivel1) >= 0) and (cLng(strNivel1) <= 2700)) then msgbox "A Quantidade de indicados por nível deve estar entre 0 e 2.700." document.getElementById("idNivel1").select() document.getElementById("idNivel1").focus() Exit Sub end if end if strQtdeTotalIndic_Nivel0 = document.getElementById("idQtdeTotalIndic_Nivel0").innerText strSemiTotNivel1 = strNivel1 * strQtdeTotalIndic_Nivel0 ' Atualiza valor Quantidade total de indicados Nivel 1 document.getElementById("idQtdeTotalIndic_Nivel1").innerHTML = FormatNumber(strSemiTotNivel1, 0) ' Atualiza Totalizador Quantidade total de indicados Nivel 1 atualizaTotalIndicados() end Sub Sub atualizaNivel2 dim strSemiTotNivel2 dim strQtdeTotalIndic_Nivel1 dim strNivel1 dim strNivel2 ' Inicializa Variaveis strSemiTotNivel2 = 0 strQtdeTotalIndic_Nivel1 = 0 strNivel1 = 0 strNivel2 = 0 ' Carrega as variaveis strNivel1 = document.getElementById("idNivel1").value strNivel2 = document.getElementById("idNivel2").value if strNivel1 = "" and strNivel2 = "" then document.getElementById("idNivel1").value = "0" document.getElementById("idQtdeTotalIndic_Nivel1").innerText = "0" strNivel1 = 0 strQtdeTotalIndic_Nivel1 = 0 document.getElementById("idNivel2").value = "0" document.getElementById("idQtdeTotalIndic_Nivel2").innerText = "0" strNivel2 = 0 strQtdeTotalIndic_Nivel2 = 0 elseif strNivel1 = "" and strNivel2 <> "" then document.getElementById("idNivel1").value = "0" document.getElementById("idQtdeTotalIndic_Nivel1").innerText = "0" strNivel1 = 0 strQtdeTotalIndic_Nivel1 = 0 elseif strNivel1 <> "" and strNivel2 = "" then document.getElementById("idNivel2").value = "0" document.getElementById("idQtdeTotalIndic_Nivel2").innerText = "0" strNivel2 = 0 strQtdeTotalIndic_Nivel2 = 0 end if ' Valida se a Quantidade de indicados por nível está entre 0(Mínimo) e 2.700(Máximo) if strNivel2 <> "" then if not ((cLng(strNivel2) >= 0) and (cLng(strNivel2) <= 2700)) then msgbox "A Quantidade de indicados por nível deve estar entre 0 e 2.700." document.getElementById("idNivel2").select() document.getElementById("idNivel2").focus() Exit Sub end if end if strQtdeTotalIndic_Nivel1 = document.getElementById("idQtdeTotalIndic_Nivel1").innerText strSemiTotNivel2 = strNivel2 * strQtdeTotalIndic_Nivel1 ' Atualiza valor Quantidade total de indicados Nivel 2 document.getElementById("idQtdeTotalIndic_Nivel2").innerHTML = FormatNumber(strSemiTotNivel2, 0) ' Atualiza Totalizador Quantidade total de indicados Nivel 2 atualizaTotalIndicados() end Sub Sub atualizaNivel3 dim strSemiTotNivel3 dim strQtdeTotalIndic_Nivel2 dim strNivel1 dim strNivel2 dim strNivel3 ' Inicializa Variaveis strSemiTotNivel3 = 0 strQtdeTotalIndic_Nivel2 = 0 strNivel1 = 0 strNivel2 = 0 strNivel3 = 0 ' Carrega as variaveis strNivel1 = document.getElementById("idNivel1").value strNivel2 = document.getElementById("idNivel2").value strNivel3 = document.getElementById("idNivel3").value if strNivel1 = "" and strNivel2 = "" and strNivel3 = "" then document.getElementById("idNivel1").value = "0" document.getElementById("idQtdeTotalIndic_Nivel1").innerText = "0" strNivel1 = 0 strQtdeTotalIndic_Nivel1 = 0 document.getElementById("idNivel2").value = "0" document.getElementById("idQtdeTotalIndic_Nivel2").innerText = "0" strNivel2 = 0 strQtdeTotalIndic_Nivel2 = 0 document.getElementById("idNivel3").value = "0" document.getElementById("idQtdeTotalIndic_Nivel3").innerText = "0" strNivel3 = 0 strQtdeTotalIndic_Nivel3 = 0 elseif strNivel1 = "" and strNivel2 = "" and strNivel3 <> "" then document.getElementById("idNivel1").value = "0" document.getElementById("idQtdeTotalIndic_Nivel1").innerText = "0" strNivel1 = 0 strQtdeTotalIndic_Nivel1 = 0 document.getElementById("idNivel2").value = "0" document.getElementById("idQtdeTotalIndic_Nivel2").innerText = "0" strNivel2 = 0 strQtdeTotalIndic_Nivel2 = 0 elseif strNivel1 <> "" and strNivel2 <> "" and strNivel3 = "" then document.getElementById("idNivel3").value = "0" document.getElementById("idQtdeTotalIndic_Nivel3").innerText = "0" strNivel3 = 0 strQtdeTotalIndic_Nivel3 = 0 end if ' Valida se a Quantidade de indicados por nível está entre 0(Mínimo) e 2.700(Máximo) if strNivel3 <> "" then if not ((cLng(strNivel3) >= 0) and (cLng(strNivel3) <= 2700)) then msgbox "A Quantidade de indicados por nível deve estar entre 0 e 2.700." document.getElementById("idNivel3").select() document.getElementById("idNivel3").focus() Exit Sub end if end if strQtdeTotalIndic_Nivel2 = document.getElementById("idQtdeTotalIndic_Nivel2").innerText strSemiTotNivel3 = strNivel3 * strQtdeTotalIndic_Nivel2 ' Atualiza valor Quantidade total de indicados Nivel 3 document.getElementById("idQtdeTotalIndic_Nivel3").innerHTML = FormatNumber(strSemiTotNivel3, 0) ' Atualiza Totalizador Quantidade total de indicados Nivel 3 atualizaTotalIndicados() end Sub Sub atualizaTotalIndicados dim strQtdeTotalIndic dim strQtdeTotalIndic_Nivel1 dim strQtdeTotalIndic_Nivel2 dim strQtdeTotalIndic_Nivel3 ' Inicializa Variaveis strQtdeTotalIndic = 0 strQtdeTotalIndic_Nivel1 = 0 strQtdeTotalIndic_Nivel2 = 0 strQtdeTotalIndic_Nivel3 = 0 ' Carrega as variaveis strQtdeTotalIndic_Nivel1 = document.getElementById("idQtdeTotalIndic_Nivel1").innerText strQtdeTotalIndic_Nivel2 = document.getElementById("idQtdeTotalIndic_Nivel2").innerText strQtdeTotalIndic_Nivel3 = document.getElementById("idQtdeTotalIndic_Nivel3").innerText ' Valida se não está vazio para não dar erro if strQtdeTotalIndic_Nivel1 = "" then strQtdeTotalIndic_Nivel1 = 0 if strQtdeTotalIndic_Nivel2 = "" then strQtdeTotalIndic_Nivel2 = 0 if strQtdeTotalIndic_Nivel3 = "" then strQtdeTotalIndic_Nivel3 = 0 ' Atualiza Totalizador Quantidade total strQtdeTotalIndic = cDbl(strQtdeTotalIndic_Nivel1) + cDbl(strQtdeTotalIndic_Nivel2) + cDbl(strQtdeTotalIndic_Nivel3) document.getElementById("idVlrTotal").innerHTML = FormatNumber(strQtdeTotalIndic, 0) end Sub