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

Parcelamento


Fabio AVILA

Pergunta

Ola Amigos ,

estou com um problema num script de parcelamento e não consigo resolver peço a ajuda de vocês nisso ... são questões 1 localmente ele mostra normalmente todos os campos e quando coloca no site ele o mostra os BOTÕES CADASTRAR E LIMPRAR a 2 é que ele não ta enviando para o BD os dados das parcelas ..

Abaixo o codigo completo

<!--#include file="config2.asp"-->
<% 
If request.form("enviado") = "sim" Then
Cadastrado =False
set Dicionario = CreateObject("scripting.dictionary")
i = 0

Vet = Dicionario.items
if Dicionario.Count<>0 then
Response.Write "<b><center><font face=verdana size=1>"
Response.Write "O(s) seguintes dado(s) est�(�o) incorreto(s)<BR><br>"
for i = 0 to Dicionario.Count - 1
Response.Write vet(i) & "<BR><br>"
next
response.write "<BR><br>"

Else
    cont = 1
        geral =  Request.Form("parcelas")
    for cont = 0 to geral step 1
           v1 = Request.Form("npar" & cont) 'aqui da parcela
           data = Request.Form("vencimento" & cont) 'aqui a data da parcela
           valor = Request.Form("valor" & cont) 'aqui o valor de cada parcela
           if v1 <> "" then
                      Sql = "INSERT INTO vendas (vencimento, valor, npar,cliente) "
          Sql = Sql & "VALUES('" & vencimento & "', '" & valor & "', , '" & npar & "','" & Request.Form("cliente") & "')" 
          
   end if      
  
    next

      
           
        response.Write(sql)

   Cadastrado = True
End If
If Cadastrado = False Then 
Else
    set rs=nothing

%>
<body bgcolor="#E4E4E4">

<center>

<TITLE>:. :. </TITLE>




<TABLE cellSpacing=0 cellPadding=0 width=774 align=center background="back_temp.gif" border=0 height="58">
    <TR>
        <TD align=middle valign="top" bgcolor="#EFEFEF" height="97" >
            <div align="center">
              <center>
            <TABLE cellSpacing=0 cellPadding=0 width=207 border=0 height="1" style="border-collapse: collapse" bordercolor="#111111">
                    <tr>
                        <TD align=middle bgcolor="#EFEFEF" height="39"  valign="middle" bordercolor="#EFEFEF" width="3419" colspan="6">
                            <b><font face="Tahoma">Cadastro de Mensalidades</font></b></TD>
                    </tr>
                    <tr>
                        <td width="576" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            &nbsp;</td>
                        <td width="550" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            &nbsp;</td>
                        <td width="515" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            &nbsp;</td>
                        <td width="434" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            &nbsp;</td>
                        <td width="310" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            &nbsp;</td>
                        <td width="1034" bgcolor="#EFEFEF" height="1" style="border-style:none; border-width:medium; " valign="top" bordercolor="#EFEFEF">
                            <form method="POST" name="frmparcelas">
<font color="#FF0000">
<input type="hidden" name="enviado" value="sim">
<input type="hidden" name="opc" value="">                                </font>                                
                                <div align="center">
                                <center>
                                    <table border="0" cellpadding="0" width="546" height="47" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0">
                                        <tr>
                                            <td width="848" colspan="3" height="32" bgcolor="#EFEFEF"><br> </td>
                                        </tr>
                                        <tr>
                                            <td width="848" colspan="3" height="32" bgcolor="#EFEFEF">
                                                <font color="#FF0000">
                        <input type="text" name="cliente" size="56" maxlength="10" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #A1C094"></font></td>
                                        </tr>
                                        <tr>
                  <td width="1242" height="32" bgcolor="#EFEFEF"> 
                    <table width="303" height="38">
                      <tr> 
                        <td width="82" align="center" height="9"><b>
                        <font face="Tahoma" style="font-size: 8pt">
                        Valor</font></b></td>
                        <td width="52" align="center" height="9"><b>
                        <font face="Tahoma" style="font-size: 8pt">
                        Parcelas</font></b></td>
                        <td align="left" colspan="2" height="9"><b>
                        <font face="Tahoma" style="font-size: 8pt">
                        1� Vencimento</font></b></td>
                      </tr>
                      <tr> 
                        <td height="21"><font color="#FF0000">
                        <input type="text" name="valor" size="10" maxlength="10" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #A1C094"></font></td>
                        <td height="21">
                        <font color="#FF0000">
                        <input type="text" name="parcelas" size="5" maxlength="5" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #A1C094"></font></td>
                        <td width="63" height="21"><font color="#FF0000">
                        <input type="text" name="vencimento" size="10" maxlength="10" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #A1C094"></font></td>
                        <td width="86" align="right" height="21">
                        <font color="#FF0000">
                        <input style="padding:0; background:#A1C094; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="submit" name="calcular" value="Calcular"></font></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="#A1C094"><span style="font-weight: bold">
                        <font face="Tahoma" style="font-size: 8pt">
                        Parcela</font></span></td>
                        <td align="center" bgcolor="#A1C094"><span style="font-weight: bold">
                        <font face="Tahoma" style="font-size: 8pt">
                        Vencimentos</font></span></td>
                        <td align="center" colspan="2" bgcolor="#A1C094"><span style="font-weight: bold">
                        <font face="Tahoma" style="font-size: 8pt">
                        Valor das Parcelas</font></span></td>
                      </tr>
                      <font color="#FF0000">
                      <% i = 1
                                                    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    
                                %></font>
                      <tr> 
                        <td align="center" bgcolor="#A1C094"><span style="font-size: 10pt"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">
                          <%=n+1%></font></span></td>
                        <td align="center" bgcolor="#A1C094"><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" bgcolor="#A1C094"><span style="font-size: 10pt"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF">
                          <%=FormatCurrency(Parc)%></font></span></td>
                      </tr>
                      <%
                            i = i + 1
                                                        Next
                        end if
                                          %></font>
                      <tr> 
                        <td align="center" bgcolor="#A1C094">
                        <p align="left"><span style="font-weight: bold">
                        <font face="Tahoma" style="font-size: 8pt">
                        &nbsp;Total</font></span></td><%end if%> 
                        
                        <td colspan="3" align="center" bgcolor="#A1C094"><span style="font-weight: bold"><font face="Tahoma" style="font-size: 8pt" color="#FFFFFF"><%=FormatCurrency(ValorTotal)%></font></span></td><%end if%> 
                      </tr>
                      </table></td>
                                        </tr>
                                        <tr>
                                            <td width="1" height="1" bgcolor="#EFEFEF"></td>
                                            <td width="425" height="1" bgcolor="#EFEFEF"></td>
                                            <td width="8" height="1" bgcolor="#EFEFEF"></td>
                                            <td width="542" height="1" bgcolor="#EFEFEF"></td>
                                        </tr>
                                        <tr>
                                            <td width="1" valign="top" height="1" bgcolor="#EFEFEF"></td>
                                            <td width="433" valign="top" height="1" colspan="2" bgcolor="#EFEFEF"></td>
                                            <td width="542" valign="top" height="1" bgcolor="#EFEFEF"></td>
                                        </tr>
                                        <tr>
                                            <td align="center" width="273" height="1" bgcolor="#EFEFEF"></td>
                                            <td align="center" width="1073" colspan="3" height="1" bgcolor="#EFEFEF"></td>
                                        </tr>
                                        <tr>
                                            <td align="center" width="1346" valign="middle" colspan="4" height="47" bgcolor="#EFEFEF">
                                                <font color="#FF0000" face="Tahoma" style="font-size: 8pt">
                                                &nbsp;<input style="padding:0; background:#A1C094; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="submit" value="Cadastrar " name="Submit"></font><font face="Tahoma" style="font-size: 8pt">         </font><span style="font-size: 8pt">
                                                <font face="Tahoma" color="#FF0000">
                                                <input style="BACKGROUND: #A1C094; font-family:Tahoma; font-size:8 pt; font-weight:bold" type="reset" value="Limpar" name="Reset"></font><font face="Tahoma"> </font></span></td>
                                        </tr>
                                    </table>
                                </center>
                            </div>
                        </form>
                    </td>
                </tr> 
                </TABLE>
              </center>
            </div>
        </TD>
    </TR>
</TABLE>
</center>

Abraços

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
Bareta,

O Insert ta nessa linha ak

Sql = "INSERT INTO vendas (vencimento, valor, npar,cliente) "
          Sql = Sql & "VALUES('" & vencimento & "', '" & valor & "', , '" & npar & "','" & Request.Form("cliente") & "')"

vla

poe um conexao.execute(sql) lá

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
      152,3k
    • Posts
      652,5k
×
×
  • Criar Novo...