Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Lab01 - Implementando Una Primera Aplicacion
Lab01 - Implementando Una Primera Aplicacion
Objetivos
De momento en esta primera versión hemos encontrado como funciones del sistema:
Atender Ventas
o Preparar Pedidos
Gestionar Cobranzas
o Realizar Pagos
o Generar Cronograma
RealizarPagos
Asistente
Comercial
<<extend>>
PrepararPedidos
Caja
GenerarCronograma
Prototipo Propuesto
Preparando la
Interfaz de
Usuario
Diagrama de
Secuencia
Checked = True
TextBox Name =TxtDocumento
MaxLength = 9
ComboBox Name =CboFormaPago
CommandButton Name = CmdGenerar
Text = Generar
Imports System.Data.SqlClient
Public Class ControlCronograma
End Class
Public Function VerificaDocumento(ByVal idDoc As String, ByVal idTipo As String, ByVal cn As SqlConnection) As Boolean
Dim vsql As String
Dim bExiste As Boolean
vsql = " SELECT estado FROM documento WHERE Documento='" & idDoc & _
"' AND tipodoc = '" & idTipo & "'"
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
End Function
Public Function GeneraCronograma(ByVal idDoc As String, ByVal idTipo As String, ByVal iCuotas As Integer, ByVal cn As SqlConnection) As DataTable
Dim vsql As String
vsql = " EXEC GeneraCrono @documento ='" & idDoc & "', @tipodoc ='" & _
idTipo & "', @NroCuotas =" & iCuotas.ToString '"
Dim dtCrono As New DataTable
Dim daCronograma As New SqlDataAdapter(vsql, cn)
Try
daCronograma.Fill(dtCrono)
Return dtCrono
Catch ex As Exception
Return dtCrono
End Try
End Function
Imports System.Data.SqlClient
Public Class GenerarCronograma
Dim cn As New SqlConnection("DataSource=(local);Database=Tenebrosa;User Id=sa;Password=")
En el Load
============
Private Sub Form1_Load()
Me.LlenaCombos()
End Sub
CboCuotas.DataSource = dtCuotas
CboCuotas.DisplayMember = dtCuotas.Columns(1).ToString
CboCuotas.ValueMember = dtCuotas.Columns(0).ToString
End Sub
En el CmdGenerar.Click
============
End Try
End Sub
2. Proceda asi:
SET @cuenta = 0
WHILE @cuenta < @NroCuotas
BEGIN
SET @cuenta = @cuenta + 1
SET @TotCuota = @deuda / @NroCuotas
INSERT cronograma (NroCuota, Documento ,TipoDoc, Importe, Interes , IgvInteres , feVence )
VALUES (@cuenta, @documento, @tipodoc, @TotCuota, @TotCuota * @Tasa, @TotCuota * @Tasa * @igv,
DATEADD(mm, @cuenta, @fecha))
END
SELECT NroCuota, Importe, Interes, IgvInteres, Importe + Interes + IgvInteres AS ValorCuota, FeVence
FROM cronograma WHERE documento = @documento AND tipodoc = @tipodoc
GO
NroCuotas 5
Monto 2000
interes 2%
igv 18%
Vencimieno Capital Interes IGV Cuota
1 04/06/2019 400 8 1.44 409.44
2 04/07/2019 400 8 1.44 409.44
3 03/08/2019 400 8 1.44 409.44
4 02/09/2019 400 8 1.44 409.44
5 02/10/2019 400 8 1.44 409.44