Ir para conteúdo
Fórum Script Brasil
  • 0

Gerar Parcelas


Guest Visitante

Pergunta

Guest Visitante

Pessoal Boa Tarde

Estou iniciante em Asp e gostaria de colocar no meu sistema um esquema q faça parcelamento eu vou usar os seguinte campos:

NOME

DATA VENCIMENTO

VALOR

Q PARCELAS

Tem como eu apos colocar o valor total e a qtdade de parcelas ele gerar automaticamente pra mim tdas a parcelas com seus vencimentos??

[]ços

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Para o valor sem juros, faça um loop pelo numeros de parcelas imprimindo o valor divido pelo numeros de parcelas, no caso da data, dentro do mesmo loop das parcelas, você vai adicionando 30 dias a data de vencimento original, em cada loop.

Mais ou menos isso.

Link para o comentário
Compartilhar em outros sites

  • 0

Mais ou menos assim:

<%
Option Explicit

Dim vlrTotal, vlrParcela, numParcelas, datVencimento, intAux

vlrTotal = 500
numParcelas = 5
vlrParcela = vlrTotal / numParcelas
datVencimento = #04/02/2008#

For intAux = 1 To numParcelas Step 1
    Response.Write "Parcela: " & intAux & " | Valor: " & vlrParcela & " | Vencimento: " & DateAdd("m", intAux - 1, datVencimento) & "<br />"
Next
%>

Link para o comentário
Compartilhar em outros sites

  • 0

Segue meu codigo , gostaria de quando clicar no botao GERAR PARCELAS ele aparece-sse na mesma tela....

body bgcolor="#E4E4E4">

<center>

<TITLE>:. FGCOM ADMIN - Controle de Associaddos v1.0 :. </TITLE>

<script language="JavaScript">

<!--

window.defaultStatus=":: ACISC - Associação Comercial e Industrial de Siqueira Campos - PR ::"

// -->

</script>

<TABLE cellSpacing=0 cellPadding=0 width=774 align=center background="../Sites/etiq/VPSA%20TECNOLOGIA%20E%20INFORMÁTICA%20LTDA_arquivos/back_temp.gif" border=0 height="58">

<TR>

<TD align=middle valign="top" bgcolor="#FFFFFF" height="97" style="font-family: VPSA online system">

<TABLE cellSpacing=0 cellPadding=0 width=774 align=center background="../Sites/etiq/VPSA%20TECNOLOGIA%20E%20INFORMÁTICA%20LTDA_arquivos/back_temp.gif" border=0 height="1">

<TR>

<TD align=middle valign="top" bgcolor="#FFFFFF" height="97" style="font-family: VPSA online system">

<map name="FPMap0">

<area href="java script:pop1()" shape="rect" coords="11, 105, 63, 155" alt="Cadastro de Associados">

<area alt="Consulta" coords="132, 108, 181, 149" shape="rect" href="java script:pop2()">

<area alt="Mensalidades" coords="78, 111, 118, 146" shape="rect" href="mensalidades.asp">

<area alt="Incluir Cliente" href="inclusao_juridico.asp" shape="rect" coords="195, 110, 233, 151">

<area alt="Cadastro Cliente" coords="246, 112, 287, 150" shape="rect" href="cadastro_devedor.asp">

<area href="acisc.asp" shape="rect" coords="724, 125, 782, 141">

<area href="consulta_mensalidades.asp" shape="rect" coords="319, 107, 371, 157">

<area href="consulta_inclusao.asp" shape="rect" coords="385, 109, 426, 156">

</map>

<img border="0" src="topo2.jpg" usemap="#FPMap0" width="808" height="160">

</TD>

</TR>

<TR>

<TD align=middle bgcolor="#F7F7F7" height="22" style="font-family: VPSA online system"> </TD>

</TR>

<tr>

<TD align=middle bgcolor="#F7F7F7" height="39" style="font-family: VPSA online system" valign="middle">

<b><font face="Tahoma" color="#6E9F4D">Movimentação de Mensalidades</font></b>

</TD>

</tr>

<tr>

<td width="100%" bgcolor="#F7F7F7" height="188" style="border-style:none; border-width:medium; " valign="top">

<form method="POST" action="oposto3.asp" name="frmparcelas">

<input type="hidden" name="enviado" value="sim">

<p> </p>

<div align="center">

<center>

<table border="0" cellpadding="0" width="546" height="1" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0">

<tr>

<td width="272" height="32" bgcolor="#6E9F4D">

</td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D"><br> </td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D">

<b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Promoção<br>

</font><font face="Tahoma" color="#FFFFFF">

<INPUT id=email3 maxLength=40 name=promocao style="BACKGROUND-COLOR: #F4FFF4; FONT-SIZE: 8pt" size="77"></font></b>

</td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D">

<b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Data Sorteio<br></font><font face="Tahoma" color="#FFFFFF">

<INPUT id=email2 maxLength=40 name=datasorteio style="BACKGROUND-COLOR: #F4FFF4; FONT-SIZE: 8pt" size="11"></font></b>

</td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Local<br></font><font face="Tahoma" color="#FFFFFF">

<INPUT id=email1 maxLength=40 name=local style="BACKGROUND-COLOR: #F4FFF4; FONT-SIZE: 8pt" size="61"></font></b>

</td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Premiação</font></b><br><font size="2" face="Verdana" style="font-size: 8pt" color="#FFFFFF">

<textarea cols="59" name="premiacao" rows="7" style="border:1px solid #000000; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-size:8 pt; font-family:Tahoma; color:#000000; background-color:#ECE9D8"></textarea></font>

</td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Nome do Associado</font></b><font face="Tahoma"><b><font color="#FFFFFF" style="font-size: 8pt"><br>

<%

'============================================================================

==

Set Conexao = Server.CreateObject("ADODB.Connection")

Conexao.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPAth("contato.mdb")

strQ = "SELECT * FROM contato ORDER BY nomefantasia ASC"

Set objRS = objCon.Execute(strQ)

Response.Write "<SELECT NAME='associado'>"

Response.Write "<OPTION VALUE='' SELECTED></OPTION> "

If Not objRS.EOF Then

While Not objRS.EOF

Response.Write "<OPTION VALUE='" & objRS("nomefantasia") & "'"

If Request("associado") = objRS("nomefantasia") Then Response.Write " selected"

Response.Write ">" & objRS("nomefantasia") & "</OPTION>"

objRS.MoveNext

Wend

End If

Response.Write "</SELECT>"

objCon.Close

Set objRS = Nothing

Set objCon = Nothing

===========================================================================

===

%>

</font></b></font>

</td>

</tr>

<tr>

<td width="272" height="32" bgcolor="#6E9F4D"> </td>

<td width="864" colspan="3" height="32" bgcolor="#6E9F4D">

<table width="303">

<tr>

<td width="82" align="center"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Valor</font></b></td>

<td width="52" align="center"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Parcelas</font></b></td>

<td align="left" colspan="2"><b><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">1° Vencimento</font></b></td>

</tr>

<tr>

<td><input type="text" name="valor" size="10" maxlength="10"></td>

<td><input type="text" name="parcelas" size="5" maxlength="5"></td>

<td width="63"><input type="text" name="vencimento" size="10" maxlength="10"></td>

<td width="86" align="right"><input style="BACKGROUND: #F4FFF4; BORDER-BOTTOM: 1px solid #000000; BORDER-LEFT: 0px solid #336699; BORDER-RIGHT: 1px solid #000000; BORDER-TOP: 0px solid #336699; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="submit" name="calcular" value="Calcular"></td>

</tr>

</table>

<%

'============================================================================

==

'Calcula as Parcelas

If Request.Form("calcular") <> "" then

'Pego os dados do Form

Parcelas = cInt(Request.Form("parcelas"))

ValorTotal = cSng(Request.Form("valor"))

DtVencimento = cDate(Request.Form("vencimento"))

'Declaro o array Dt e Calculo a parcela

Dim Dt() : Redim Dt(Parcelas)

ValorParcelas = (ValorTotal / Parcelas)

'Se for Decimal, calcula o resto da divisão

Resultado = FormatNumber(ValorParcelas) * Parcelas

Resto = FormatNumber(Resultado - ValorTotal,2)

'============================================================================

==

%>

<table>

<tr>

<td colspan="4"> </td>

</tr>

<tr>

<td align="center" bgcolor="#006633"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Parcela</font></span></td>

<td align="center" bgcolor="#006633"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Vencimentos</font></span></td>

<td align="center" colspan="2" bgcolor="#006633"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Valor das Parcelas</font></span></td>

</tr>

<%

For n = 0 to Parcelas - 1

Dt(n) = DateAdd("m", n, DtVencimento)

Parc = ValorParcelas

If Resto > 0 then

If n = (Parcelas - 1) Then

Parc = FormatNumber(ValorParcelas - Resto)

End if

Elseif Resto < 0 Then

If n = 0 Then

Parc = FormatNumber(ValorParcelas + (Resto*-1))

End if

End if

%>

<tr>

<td align="center"><span style="font-size: 10pt"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF"><%=n+1%></font></span></td>

<td align="center"><span style="font-size: 10pt"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF"><%=FormatDateTime(Dt(n),0)%></font></span></td>

<td colspan="2" align="center"><span style="font-size: 10pt"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF"><%=FormatCurrency(Parc)%></font></span></td>

</tr>

<%

Next

End if

%>

<tr>

<td align="center" bgcolor="#006633"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">Total</font></span></td>

<td colspan="3" align="center" bgcolor="#006633"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF"><%=FormatCurrency(ValorTotal)%></font></span></td>

</tr>

</table>

</td>

</tr>

<tr>

<td width="1" height="1"></td>

<td width="321" height="1"></td>

<td width="24" height="1"></td>

<td width="526" height="1"></td>

</tr>

<tr>

<td width="1" valign="top" height="1"></td>

<td width="345" valign="top" height="1" colspan="2"></td>

<td width="526" valign="top" height="1"></td>

</tr>

<tr>

<td align="center" width="377" height="1"></td>

<td align="center" width="969" colspan="3" height="1"></td>

</tr>

<tr>

<td align="center" width="1346" valign="bottom" colspan="4" height="50">

<font color="#008000" face="Tahoma" style="font-size: 8pt"><br><br>

<input style="BACKGROUND: #F4FFF4; BORDER-BOTTOM: 1px solid #000000; BORDER-LEFT: 0px solid #336699; BORDER-RIGHT: 1px solid #000000; BORDER-TOP: 0px solid #336699; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="submit" value="Cadastrar " name="Submit"> </font><span style="font-size: 8pt">

<font face="Tahoma" color="#008000">

<input style="BACKGROUND: #F4FFF4; BORDER-BOTTOM: 1px solid #000000; BORDER-LEFT: 0px solid #336699; BORDER-RIGHT: 1px solid #000000; BORDER-TOP: 0px solid #336699; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="reset" value="Limpar" name="Reset">

<br><br><br> </font></span>

</td>

</tr>

</table>

</center>

</div>

</form>

</td>

</tr>

<tr>

<TD align=middle bgcolor="#E3E0DB" height="39" style="font-family: VPSA online system" valign="bottom"> </TD>

</tr>

<TR>

<TD align=middle bgcolor="#E3E0DB" height="1" style="font-family: VPSA online system"></p></TD>

</TR>

</TABLE>

</TD>

</TR>

</TABLE>

</center>

[]ços

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...