| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088 |
- Public Class frmBonos
- Dim oBonosCE As New BonosCE
- Dim oBonosDAO As New BonosDAO
- Dim oDAOGeneral As New DAOGeneral
- Dim TotalValorCupones As Double
- Dim codigo As String = Variables.Codigo
- Dim BonosConsulta As New BonosDAO
- Dim Estado As String = String.Empty
- Dim Operaciones As New Operaciones
- Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
- 'Private _Modo As String
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private _CodigoInversion As String
- Private _TipoTransaccion As String 'N=Nuevo, A=Actualizar, C=Consulta
- Public Property TipoTransaccion As String
- Get
- Return _TipoTransaccion
- End Get
- Set(value As String)
- _TipoTransaccion = value
- End Set
- End Property
- Private Property IdDocumento As Integer
- Get
- Return _IdDocumento
- End Get
- Set(value As Integer)
- _IdDocumento = value
- End Set
- End Property
- Private Property TipoDocumento As String
- Get
- Return _TipoDocumento
- End Get
- Set(value As String)
- _TipoDocumento = value
- End Set
- End Property
- Private Property CodigoInversion As String
- Get
- Return _CodigoInversion
- End Get
- Set(value As String)
- _CodigoInversion = value
- End Set
- End Property
- Private Sub frmBonos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Call CargarPeriodos()
- 'PrepararTablaImpuestosYComisiones()
- PrepararTablaIngresos()
- If Me.TipoTransaccion Is Nothing Then
- Me.TipoTransaccion = "N"
- End If
- If Me.TipoTransaccion = "C" Then
- Call CargarRegistroBD()
- End If
- CargarIngresos()
- 'CargarComisiones()
- End Sub
- Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
- If (TipoTransaccion = "N" Or TipoTransaccion = "A") Then
- RefrescarClaseEntidad()
- If TipoTransaccion = "N" Then
- GuardarNuevoRegistro()
- End If
- If TipoTransaccion = "A" Then
- ActualizarRegistro()
- End If
- Else
- Me.Close()
- End If
- End Sub
- Function RetornarObjeto()
- Return oBonosCE
- End Function
- Public Sub CargarRegistro(vId As Integer, vTipo As String)
- TipoTransaccion = "C"
- IdDocumento = vId
- TipoDocumento = vTipo
- End Sub
- Public Sub CargarRegistro(ByVal CodInversion As String)
- TipoTransaccion = "C"
- CodigoInversion = CodInversion
- End Sub
- Private Sub CargarRegistroBD()
- oBonosCE = Nothing
- oBonosCE = oBonosDAO.CargarRegistro(Me.CodigoInversion)
- TipoTransaccion = "C"
- RefrescarValorControles()
- End Sub
- Private Sub dtpUltimaFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponCompra.ValueChanged
- 'ActivarEdicion()
- ControlUltimaFechaCuponCompra()
- End Sub
- Private Sub dtpSiguienteFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponCompra.ValueChanged
- 'ActivarEdicion()
- ControlSiguienteFechaCuponCompra()
- End Sub
- Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionCompra.ValueChanged
- 'ActivarEdicion()
- ControlFechaLiquidacionCompra()
- End Sub
- Private Sub dtpFechaVencimientoCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
- 'ActivarEdicion()
- ControlFechaVencimientoCompra()
- End Sub
- Private Sub txtPorcentajeCuponCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.TextChanged
- 'ActivarEdicion()
- End Sub
- Private Sub txtPrecioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra.TextChanged
- 'ActivarEdicion()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.TextChanged
- 'ActivarEdicion()
- End Sub
- Private Sub txtCostoTransferenciaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.TextChanged
- 'RefrescarMontoAPagarCompra()
- 'ActivarEdicion()
- End Sub
- Private Sub dtpFechaVencimientoVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
- 'ActivarEdicion()
- ControlFechaVencimientoVenta()
- End Sub
- Private Sub ControlFechaVencimientoVenta()
- Dim valor As Date
- valor = dtpFechaVencimientoVenta.Value.Date
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oBonosCE.FechaVencimientoVenta = valor
- RefrescarValorControles()
- End If
- End Sub
- Private Sub cboAnioBaseC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseC.SelectedIndexChanged
- 'ActivarEdicion()
- ControlAnioBaseCompra()
- End Sub
- Private Sub cboAnioBaseV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseV.SelectedIndexChanged
- 'RefrescarInteresAcumuladoVenta()
- 'RefrescarDiasAlVencimientoVenta()
- 'RefrescarDiasAcumuladosVenta()
- ControlAnioBaseVenta()
- 'ActivarEdicion()
- End Sub
- Private Sub ControlAnioBaseVenta()
- Dim valor As Integer
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- If cboAnioBaseV.SelectedIndex > -1 Then
- oBonosCE.DiasBaseVenta = cboAnioBaseV.SelectedItem
- Else
- oBonosCE.DiasBaseVenta = 365
- End If
- End If
- End Sub
- Sub CargarPeriodos()
- Dim vTipoTransaccion As String = Me.TipoTransaccion
- TipoTransaccion = "X"
- Me.cboPeriodosC.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosC.ValueMember = "Codigo"
- Me.cboPeriodosC.DisplayMember = "Descripcion"
- Me.cboPeriodosC.SelectedIndex = -1
- Me.cboPeriodosV.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosV.ValueMember = "Codigo"
- Me.cboPeriodosV.DisplayMember = "Descripcion"
- Me.cboPeriodosV.SelectedIndex = -1
- TipoTransaccion = vTipoTransaccion
- End Sub
- Private Sub cboPeriodosC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosC.SelectedIndexChanged
- ControlPeriodosCompra()
- End Sub
- Private Sub cboPeriodosV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosV.SelectedIndexChanged
- 'ActivarEdicion()
- End Sub
- Function CalcularCupones() As DataTable
- Dim dtCupones As New DataTable
- Dim vFechaLiquidacionCompra As Date = oBonosCE.FechaLiquidacionCompra
- Dim vFechaLiquidacionVenta As Date = oBonosCE.FechaLiquidacionVenta
- Dim vSiguienteFechaCuponCompra As Date = oBonosCE.SiguienteFechaCuponCompra
- Dim vPeriodicidad As String = oBonosCE.PeriodicidadCompra
- Dim vValorNominalCompra As Double = oBonosCE.ValorNominalCompra
- Dim vPorcentajeCuponCompra As Double = oBonosCE.PorcentajeCuponCompra
- Dim vAnioBaseCompra As Integer = oBonosCE.DiasBaseCompra
- Dim vColumnas As DataColumn
- Dim vFilas As DataRow
- Dim vEstaFecha As Date
- Dim vSiguienteFecha As Date
- Dim vDias As Integer
- Dim vValor As Double
- 'CREAMOS COLUMNAS
- vColumnas = New DataColumn
- vColumnas.DataType = GetType(Date)
- vColumnas.ColumnName = "FechaCupon"
- vColumnas.Caption = "Fecha Cupon"
- vColumnas.AllowDBNull = False
- dtCupones.Columns.Add(vColumnas)
- vColumnas = New DataColumn
- vColumnas.DataType = GetType(Integer)
- vColumnas.ColumnName = "Dias"
- vColumnas.Caption = "Dias"
- vColumnas.AllowDBNull = False
- dtCupones.Columns.Add(vColumnas)
- vColumnas = New DataColumn
- vColumnas.DataType = GetType(Double)
- vColumnas.ColumnName = "Valor"
- vColumnas.Caption = "Valor Cupon"
- vColumnas.AllowDBNull = False
- dtCupones.Columns.Add(vColumnas)
- vSiguienteFecha = vSiguienteFechaCuponCompra
- vDias = DateDiff(DateInterval.Day, vFechaLiquidacionCompra, vSiguienteFechaCuponCompra)
- Dim ControlBucle As Integer = 1
- While vSiguienteFecha <= vFechaLiquidacionVenta
- vEstaFecha = vSiguienteFecha
- vFilas = dtCupones.NewRow
- vFilas("FechaCupon") = vSiguienteFecha
- vFilas("Dias") = vDias
- Try
- vValor = vValorNominalCompra * vPorcentajeCuponCompra * vDias / vAnioBaseCompra
- Catch ex As Exception
- vValor = 0
- End Try
- vFilas("Valor") = vValor
- dtCupones.Rows.Add(vFilas)
- If vPeriodicidad = "S" Then
- vSiguienteFecha = vSiguienteFecha.AddMonths(6)
- ElseIf vPeriodicidad = "M" Then
- vSiguienteFecha = vSiguienteFecha.AddMonths(1)
- Else
- Exit While
- End If
- If vAnioBaseCompra = 360 Then
- vDias = Utilidades.Days360(vEstaFecha, vSiguienteFecha)
- Else
- vDias = DateDiff(DateInterval.Day, vEstaFecha, vSiguienteFecha)
- End If
- End While
- Try
- TotalValorCupones = dtCupones.Compute("SUM(Valor)", "")
- Catch ex As Exception
- TotalValorCupones = 0
- End Try
- 'Me.txtTotalIngresoCupones.Text = TotalValorCupones.ToString
- Return dtCupones
- dtCupones.Dispose()
- End Function
- Private Sub CalcularIngresos(ByVal IdFila As Integer)
- Dim vFila As DataGridViewRow = dgvIngresos.Rows(IdFila)
- Dim IdFilaAnterior As Integer = IdFila - 1
- Dim vFilaAnterior As DataGridViewRow
- Dim vNumCupon As Integer
- Dim vFechaCupon As Date
- Dim vFechaAnteriorCupon As Date
- Dim vDias As Integer
- Dim vIngreso As Double
- Dim vImpuesto As Double
- Dim vLiquido As Double
- Dim vValorNominal As Double = oBonosCE.ValorNominalCompra
- Dim vPorcentajeCupon As Double = oBonosCE.PorcentajeCuponCompra
- Dim vDiasBase As Integer = oBonosCE.DiasBaseCompra
- If Not vFila.IsNewRow Then
- 'Date.TryParse(vFila.Cells("FechaCupon").Value.ToString, vFechaCupon)
- If (IdFila) > 0 Then
- vFilaAnterior = dgvIngresos.Rows(IdFilaAnterior)
- vNumCupon = vFilaAnterior.Cells("NumCupon").Value
- vNumCupon += 1
- vFechaCupon = vFila.Cells("FechaCupon").Value
- vFechaAnteriorCupon = vFilaAnterior.Cells("FechaCupon").Value
- vDias = DateDiff(DateInterval.Day, vFechaCupon, vFechaAnteriorCupon)
- vIngreso = vValorNominal * vPorcentajeCupon * vDias / vDiasBase
- vImpuesto = vIngreso * 0.1
- vLiquido = vIngreso - vImpuesto
- vFila.Cells("NumCupon").Value = vNumCupon
- vFila.Cells("Dias").Value = vDias
- vFila.Cells("Ingreso").Value = vIngreso
- vFila.Cells("MontoImpuesto").Value = vImpuesto
- vFila.Cells("Liquido").Value = vLiquido
- Else
- vFila.Cells("NumCupon").Value = 1
- vFila.Cells("Dias").Value = 0
- vFila.Cells("Ingreso").Value = 0
- vFila.Cells("MontoImpuesto").Value = 0
- vFila.Cells("Liquido").Value = 0
- End If
- End If
- End Sub
- 'Sub RefrescarTablaIngresos()
- ' 'Me.dgvIngresos.DataSource = CalcularCupones()
- 'End Sub
- Private Sub RefrescarValorControles()
- 'Me.cboCasa_C.SelectedValue = oBonosCE.CodigoCasaCompra.ToString
- Me.cboPeriodosC.SelectedValue = oBonosCE.PeriodicidadCompra.ToString
- Me.txtValorNominalCompra.Text = oBonosCE.ValorNominalCompra.ToString(Configuraciones.CodigoTXTMontos)
- Me.dtpUltimaFechaCuponCompra.Value = oBonosCE.UltimaFechaCuponCompra
- Me.dtpSiguienteFechaCuponCompra.Value = oBonosCE.SiguienteFechaCuponCompra
- Me.dtpFechaLiquidacionCompra.Value = oBonosCE.FechaLiquidacionCompra
- Me.dtpFechaVencimientoCompra.Value = oBonosCE.FechaVencimientoCompra
- Me.txtPorcentajeCuponCompra.Text = oBonosCE.PorcentajeCuponCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtYTMAlVencimientoCompra.Text = oBonosCE.YTMAlVencimientoCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtYTMAlVencimientoComisionCompra.Text = oBonosCE.YTMAlVencimientoComisionCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtPrecioAlVencimientoCompra.Text = oBonosCE.PrecioAlVencimientoCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtPrecioCompra.Text = oBonosCE.PrecioCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.cboAnioBaseC.SelectedItem = oBonosCE.DiasBaseCompra.ToString
- Me.txtDiasAcumuladosCompra.Text = oBonosCE.DiasAcumuladosCompra.ToString
- Me.txtDiasAlVencimientoCompra.Text = oBonosCE.DiasAlVencimientoCompra.ToString
- Me.txtPorcentajeInteresAcumuladoCompra.Text = oBonosCE.PorcentajeInteresAcumuladoCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtInteresAcumuladoCompra.Text = oBonosCE.InteresAcumuladoCompra.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtPrecioSucioCompra.Text = oBonosCE.PrecioSucioCompra.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtValorTransadoCompra.Text = oBonosCE.ValorTransadoCompra.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtMontoAPagar.Text = oBonosCE.MontoAPagarCompra.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtCostoTransferenciaCompra.Text = oBonosCE.CostoDeTransferenciaCompra.ToString(Configuraciones.CodigoTXTMontos)
- 'Me.cboCasa_V.SelectedValue = oBonosCE.CodigoCasaVenta.ToString
- Me.cboPeriodosV.SelectedValue = oBonosCE.PeriodicidadVenta.ToString
- Me.txtValorNominalVenta.Text = oBonosCE.ValorNominalVenta.ToString(Configuraciones.CodigoTXTMontos)
- Me.dtpUltimaFechaCuponVenta.Value = oBonosCE.UltimaFechaCuponVenta
- Me.dtpSiguienteFechaCuponVenta.Value = oBonosCE.SiguienteFechaCuponVenta
- Me.dtpFechaLiquidacionVenta.Value = oBonosCE.FechaLiquidacionVenta
- Me.dtpFechaVencimientoVenta.Value = oBonosCE.FechaVencimientoVenta
- Me.txtPorcentajeCuponVenta.Text = oBonosCE.PorcentajeCuponVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtYTMAlVencimientoComisionVenta.Text = oBonosCE.YTMAlVencimientoComisionVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtYTMAlVencimientoVenta.Text = oBonosCE.YTMAlVencimientoVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtPrecioAlVencimientoVenta.Text = oBonosCE.PrecioAlVencimientoVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtPrecioVenta.Text = oBonosCE.PrecioVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.cboAnioBaseV.SelectedItem = oBonosCE.DiasBaseVenta.ToString
- Me.txtDiasAcumuladosVenta.Text = oBonosCE.DiasAcumuladosVenta.ToString
- Me.txtDiasAlVencimientoVenta.Text = oBonosCE.DiasAlVencimientoVenta.ToString
- Me.txtPorcentajeInteresAcumuladoVenta.Text = oBonosCE.InteresAcumuladoPorcentajeVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtInteresAcumuladoVenta.Text = oBonosCE.InteresAcumuladoVenta.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtPrecioSucioVenta.Text = oBonosCE.PrecioSucioVenta.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtValorTransadoVenta.Text = oBonosCE.ValorTransadoVenta.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtMontoARecibir.Text = oBonosCE.MontoARecibirVenta.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtCostoTransferenciaVenta.Text = oBonosCE.CostoDeTransferenciaVenta.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtValorNominal_Op.Text = oBonosCE.ValorNominalRO.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtPlazo_Op.Text = oBonosCE.DiasPlazoRO.ToString
- Me.txtPrecioCompra_Op.Text = oBonosCE.PrecioCompraRO.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtPrecioVenta_Op.Text = oBonosCE.PrecioVentaRO.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtGananciaPerdidaCapital_Op.Text = oBonosCE.GananciaPerdidaDeCapital.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtIngresosPorIntereses_Op.Text = oBonosCE.IngresoPorInteres.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtCostosTotales_Op.Text = oBonosCE.CostosTotales.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtGananciaPerdidaTotal_Op.Text = oBonosCE.GananciaPerdidaTotal.ToString(Configuraciones.CodigoTXTMontos)
- Me.txtRendimientoGananciaPerdida_Op.Text = oBonosCE.RendimientoGananciaPerdida.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtRendimientoIntereses_Op.Text = oBonosCE.RendimientoDeIntereses.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtRendimientoAntesISR_Op.Text = oBonosCE.RendimientoAntesImpuestos.ToString(Configuraciones.CodigoTXTPorcentaje)
- Me.txtRendimientoDespuesISR_Op.Text = oBonosCE.RendimientoDespuesImpuestos.ToString(Configuraciones.CodigoTXTPorcentaje)
- If Me.TipoTransaccion = "N" Then Me.btnAceptar.Text = "Guardar"
- If Me.TipoTransaccion = "A" Then Me.btnAceptar.Text = "Guardar"
- If Me.TipoTransaccion = "C" Then Me.btnAceptar.Text = "Aceptar"
- End Sub
- Private Sub RefrescarClaseEntidad()
- ControlValorNominalCompra()
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlPorcentajeCuponCompra()
- 'ControlYTMAlVencimientoCompra()
- ControlPrecioAlVencimientoCompra()
- ControlPrecioCompra()
- ControlAnioBaseCompra()
- ControlCostosDeTransferencia()
- 'ControlValorNominalv
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlPorcentajeCuponCompra()
- 'ControlYTMAlVencimientoCompra()
- ControlPrecioAlVencimientoCompra()
- ControlPrecioCompra()
- ControlAnioBaseCompra()
- ControlCostosDeTransferencia()
- End Sub
- Private Sub GuardarNuevoRegistro()
- Dim res As Integer
- RefrescarClaseEntidad()
- res = oBonosDAO.Nuevo(oBonosCE)
- If res = 1 Then
- MsgBox("Registro Guardado")
- Else
- MsgBox("Algo no salio bien.")
- End If
- End Sub
- Private Sub ActualizarRegistro()
- Dim res As Integer
- RefrescarClaseEntidad()
- res = oBonosDAO.Actualizar(oBonosCE)
- If res = 1 Then
- MsgBox("Registro Guardado")
- Else
- MsgBox("Algo no salio bien.")
- End If
- End Sub
- 'Private Sub ActivarEdicion()
- ' If TipoTransaccion = "C" Then
- ' Me.TipoTransaccion = "A"
- ' Me.btnAceptar.Text = "Guardar"
- ' End If
- 'End Sub
- Private Sub ControlPeriodosCompra()
- Dim valor As String
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- If Me.cboPeriodosC.SelectedIndex = -1 Then
- valor = ""
- Else
- valor = Me.cboPeriodosC.SelectedValue
- End If
- oBonosCE.PeriodicidadCompra = valor
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlValorNominalCompra()
- Dim valor As Double
- If Not Double.TryParse(Me.txtValorNominalCompra.Text, valor) Then
- Me.txtValorNominalCompra.BackColor = Configuraciones.ColorFondoError
- Me.txtValorNominalCompra.Focus()
- Else
- Me.txtValorNominalCompra.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.ValorNominalCompra = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub ControlUltimaFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.UltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value.Date
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlSiguienteFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.SiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value.Date
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlFechaLiquidacionCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.FechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value.Date
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlFechaVencimientoCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.FechaVencimientoCompra = dtpFechaVencimientoCompra.Value.Date
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlPorcentajeCuponCompra()
- Dim valor As Double
- If Not Double.TryParse(txtPorcentajeCuponCompra.Text.Replace("%", ""), valor) Then
- Me.txtPorcentajeCuponCompra.BackColor = Configuraciones.ColorFondoError
- Me.txtPorcentajeCuponCompra.Focus()
- Else
- Me.txtPorcentajeCuponCompra.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.PorcentajeCuponCompra = valor / 100
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub ControlAnioBaseCompra()
- Dim valor As Integer
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- valor = cboAnioBaseC.SelectedItem
- Me.oBonosCE.DiasBaseCompra = valor
- RefrescarValorControles()
- End If
- End Sub
- Private Sub txtValorNominalCompra_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalCompra.LostFocus
- ControlValorNominalCompra()
- End Sub
- Private Sub ControlPrecioAlVencimientoCompra()
- Dim valor As Double
- If Not Double.TryParse(Me.txtPrecioAlVencimientoCompra.Text.Replace("%", String.Empty), valor) Then
- Me.txtPrecioAlVencimientoCompra.BackColor = Configuraciones.ColorFondoError
- Me.txtPrecioAlVencimientoCompra.Focus()
- Else
- Me.txtPrecioAlVencimientoCompra.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.PrecioAlVencimientoCompra = valor / 100
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub ControlPrecioCompra()
- Dim valor As Double
- If Not Double.TryParse(Me.txtPrecioCompra.Text.Replace("%", String.Empty), valor) Then
- Me.txtPrecioCompra.BackColor = Configuraciones.ColorFondoError
- Me.txtPrecioCompra.Focus()
- Else
- Me.txtPrecioCompra.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.PrecioCompra = valor / 100
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub ControlCostosDeTransferencia()
- Dim valor As Double
- If Not Double.TryParse(Me.txtCostoTransferenciaCompra.Text, valor) Then
- Me.txtCostoTransferenciaCompra.BackColor = Configuraciones.ColorFondoError
- Me.txtCostoTransferenciaCompra.Focus()
- Else
- Me.txtCostoTransferenciaCompra.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oBonosCE.CostoDeTransferenciaCompra = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub txtPorcentajeCuponCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.LostFocus
- ControlPorcentajeCuponCompra()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.LostFocus
- ControlPrecioAlVencimientoCompra()
- End Sub
- Private Sub txtPrecioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioCompra.LostFocus
- ControlPrecioCompra()
- End Sub
- Private Sub txtCostoTransferenciaCompra_LostFocus(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.LostFocus
- ControlCostosDeTransferencia()
- End Sub
- Private Sub dtpSiguienteFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponVenta.ValueChanged
- 'ActivarEdicion()
- End Sub
- Private Sub txtCostoTransferenciaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaVenta.TextChanged
- 'ActivarEdicion()
- End Sub
- 'Private Sub PrepararTablaImpuestosYComisiones()
- ' Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
- ' Dim oDataGridViewComboBoxColumn As DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn.Name = "CodImp"
- ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Impuesto"
- ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTiposImpuesto
- ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
- ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
- ' oDataGridViewComboBoxColumn.DataPropertyName = "CodImp"
- ' oDataGridViewComboBoxColumn.DisplayIndex = 0
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
- ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn.Name = "TipoOper"
- ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Operación"
- ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTipoOperacion
- ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
- ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
- ' oDataGridViewComboBoxColumn.DataPropertyName = "TipoOper"
- ' oDataGridViewComboBoxColumn.DisplayIndex = 1
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "PorcImp"
- ' oDataGridViewTextBoxColumn.HeaderText = "Porcentaje"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "PorcImp"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje
- ' oDataGridViewTextBoxColumn.DisplayIndex = 2
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "MontoSujeto"
- ' oDataGridViewTextBoxColumn.HeaderText = "Monto Sujeto"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoSujeto"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- ' oDataGridViewTextBoxColumn.ReadOnly = True
- ' oDataGridViewTextBoxColumn.DisplayIndex = 3
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "MontoImp"
- ' oDataGridViewTextBoxColumn.HeaderText = "Monto Impuesto"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoImp"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- ' oDataGridViewTextBoxColumn.DisplayIndex = 4
- ' oDataGridViewTextBoxColumn.ReadOnly = True
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "CodInv"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.Visible = False
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' Me.dgvImpuestosYComisiones.DataSource = oBonosCE.ImpuestosYComisiones
- 'End Sub
- 'Private Sub PrepararImpuestosYComisiones(ByVal IdFila As Integer)
- ' Dim vFila As DataGridViewRow = dgvImpuestosYComisiones.Rows(IdFila)
- ' If vFila.IsNewRow Then
- ' vFila.Cells("TipoOper").Value = "V"
- ' vFila.Cells("PorcImp").Value = 0
- ' vFila.Cells("MontoSujeto").Value = oBonosCE.ValorTransadoVenta
- ' vFila.Cells("MontoImp").Value = 0.00
- ' End If
- 'End Sub
- 'Private Sub CalcularImpuestosYComisiones(ByVal IdFila As Integer, ByVal IdCol As Integer)
- ' Dim vFila As DataGridViewRow = dgvImpuestosYComisiones.Rows(IdFila)
- ' Dim vTipoOperacion As String
- ' Dim vCodigoImpuesto As String
- ' Dim vPorcentajeImpuesto As Double
- ' Dim vMontoSujeto As Double
- ' Dim vMontoImpuesto As Double
- ' If Not vFila.IsNewRow Then
- ' vCodigoImpuesto = vFila.Cells("CodImp").Value.ToString
- ' vTipoOperacion = vFila.Cells("TipoOper").Value.ToString
- ' Double.TryParse(vFila.Cells("PorcImp").Value.ToString, vPorcentajeImpuesto)
- ' If IdCol = 3 Then
- ' vPorcentajeImpuesto = vPorcentajeImpuesto / 100
- ' vFila.Cells("PorcImp").Value = vPorcentajeImpuesto
- ' End If
- ' If vTipoOperacion = "C" Then
- ' vMontoSujeto = oBonosCE.ValorTransadoCompra
- ' vFila.Cells("MontoSujeto").Value = oBonosCE.ValorTransadoCompra
- ' ElseIf vTipoOperacion = "V" Then
- ' vMontoSujeto = oBonosCE.ValorTransadoVenta
- ' vFila.Cells("MontoSujeto").Value = oBonosCE.ValorTransadoVenta
- ' Else
- ' vMontoSujeto = 0
- ' End If
- ' vMontoImpuesto = vMontoSujeto * vPorcentajeImpuesto
- ' vFila.Cells("MontoImp").Value = vMontoImpuesto
- ' End If
- ' RefrescarClaseEntidad()
- ' RefrescarValorControles()
- 'End Sub
- 'Function CalcularComisiones(ByVal TipoImp As String, ByVal TipoOpe As String)
- ' Dim Cantidad = dgvImpuestosYComisiones.Rows.Count - 1
- ' Dim Comision
- ' For i As Integer = 0 To Cantidad
- ' Comision = dgvIngresos.Rows(i).Cells(3)
- ' Next
- 'End Function
- 'Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
- ' 'ActivarEdicion()
- ' PrepararImpuestosYComisiones(e.RowIndex)
- 'End Sub
- 'Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs)
- ' CalcularImpuestosYComisiones(e.RowIndex, e.ColumnIndex)
- 'End Sub
- Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
- 'ActivarEdicion()
- oBonosCE.ImpuestosYComisiones.AcceptChanges()
- End Sub
- Private Sub PrepararTablaIngresos()
- Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "CodInv"
- oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
- oDataGridViewTextBoxColumn.HeaderText = "Código Inversión"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "NumCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "NumCupon"
- oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "FechaCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "FechaCupon"
- oDataGridViewTextBoxColumn.HeaderText = "Fecha Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Date)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Dias"
- oDataGridViewTextBoxColumn.DataPropertyName = "Dias"
- oDataGridViewTextBoxColumn.HeaderText = "Dias "
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Ingreso"
- oDataGridViewTextBoxColumn.DataPropertyName = "Ingreso"
- oDataGridViewTextBoxColumn.HeaderText = "Ingreso"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "PorcentajeImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "PorcImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "% Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "MontoImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "MontoImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Liquido"
- oDataGridViewTextBoxColumn.DataPropertyName = "Liquido"
- oDataGridViewTextBoxColumn.HeaderText = "Liquido"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- End Sub
- Private Sub txtValorNominalVenta_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalVenta.LostFocus
- ControlValorNominalVenta()
- End Sub
- Private Sub ControlValorNominalVenta()
- Dim valor As Double
- If Not Double.TryParse(Me.txtValorNominalVenta.Text, valor) Then
- Me.txtValorNominalVenta.BackColor = Configuraciones.ColorFondoError
- Me.txtValorNominalVenta.Focus()
- Else
- Me.txtValorNominalVenta.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oBonosCE.ValorNominalVenta = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub txtPorcentajeCuponVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.LostFocus
- ControlPorcentajeCuponVenta()
- End Sub
- Private Sub ControlPorcentajeCuponVenta()
- Dim valor As Double
- If Not Double.TryParse(Me.txtPorcentajeCuponVenta.Text, valor) Then
- Me.txtPorcentajeCuponVenta.BackColor = Configuraciones.ColorFondoError
- Me.txtPorcentajeCuponVenta.Focus()
- Else
- Me.txtPorcentajeCuponVenta.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oBonosCE.PorcentajeCuponVenta = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.LostFocus
- ControlPrecioAlVencimientoVenta()
- End Sub
- Private Sub ControlPrecioAlVencimientoVenta()
- Dim valor As Double
- If Not Double.TryParse(Me.txtPrecioAlVencimientoVenta.Text, valor) Then
- Me.txtPrecioAlVencimientoVenta.BackColor = Configuraciones.ColorFondoError
- Me.txtPrecioAlVencimientoVenta.Focus()
- Else
- Me.txtPrecioAlVencimientoVenta.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oBonosCE.PrecioAlVencimientoVenta = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub txtPrecioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioVenta.LostFocus
- ControlPrecioVenta()
- End Sub
- Private Sub ControlPrecioVenta()
- Dim valor As Double
- If Not Double.TryParse(txtPrecioVenta.Text, valor) Then
- txtPrecioVenta.BackColor = Configuraciones.ColorFondoError
- txtPrecioVenta.Focus()
- Else
- txtPrecioVenta.BackColor = Configuraciones.ColorFondoPredefinido
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oBonosCE.PrecioVenta = valor
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub dgvIngresos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellContentClick
- End Sub
- Private Sub PrepararCalculoIngresos(ByVal IdFila As Integer)
- Dim vFila As DataGridViewRow = dgvIngresos.Rows(IdFila)
- Dim vFilaAnterior As DataGridViewRow
- Dim vNumCupon As Integer
- Dim vFechaCupon As Date
- Dim vFechaCuponAnterior As Date
- Dim vDias As Integer
- vFechaCupon = Date.Now.Date
- If IdFila > 0 Then
- vFilaAnterior = dgvIngresos.Rows(IdFila - 1)
- vNumCupon = vFilaAnterior.Cells("NumCupon").Value
- vNumCupon += 1
- vFechaCuponAnterior = vFilaAnterior.Cells("FechaCupon").Value
- 'vFechaCupon = oBonosCE.SiguienteFechaCuponCompra
- Else
- vNumCupon = 1
- vFechaCuponAnterior = oBonosCE.UltimaFechaCuponCompra
- End If
- vDias = DateDiff(DateInterval.Day, vFechaCuponAnterior, vFechaCupon)
- If vFila.IsNewRow Then
- vFila.Cells("NumCupon").Value = vNumCupon
- vFila.Cells("FechaCupon").Value = vFechaCupon
- vFila.Cells("Dias").Value = vDias
- vFila.Cells("Ingreso").Value = 0
- vFila.Cells("PorcentajeImpuesto").Value = 10
- vFila.Cells("MontoImpuesto").Value = 0
- vFila.Cells("Liquido").Value = 0.00
- End If
- End Sub
- Private Sub dgvIngresos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvIngresos.CellBeginEdit
- 'ActivarEdicion()
- PrepararCalculoIngresos(e.RowIndex)
- End Sub
- Private Sub dgvIngresos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellEndEdit
- CalcularIngresos(e.RowIndex)
- End Sub
- Private Sub dgvIngresos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvIngresos.UserDeletedRow
- 'ActivarEdicion()
- oBonosCE.Ingresos.AcceptChanges()
- End Sub
- Private Sub dgvImpuestosYComisiones_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub btnAccionComision_Click(sender As Object, e As EventArgs)
- If (Estado = "N") Then
- 'NuevaComision()
- ElseIf (Estado = "M") Then
- 'ModificarComision()
- ElseIf (Estado = "B") Then
- EliminarComision()
- End If
- End Sub
- 'Function ColecccionComisiones()
- ' Dim coleccion As New Collection
- ' Dim TipoImp, TipOp, MontoSuje, PorcImp, MontoImp As String
- ' TipoImp = dgvImpuestosYComisiones.CurrentRow.Cells(0).Value
- ' TipOp = dgvImpuestosYComisiones.CurrentRow.Cells(1).Value
- ' PorcImp = CDec(dgvImpuestosYComisiones.CurrentRow.Cells(2).Value.ToString.TrimEnd("%") / 100)
- ' MontoSuje = dgvImpuestosYComisiones.CurrentRow.Cells(3).Value
- ' MontoImp = dgvImpuestosYComisiones.CurrentRow.Cells(4).Value.ToString.TrimEnd("%")
- ' coleccion.Add(TipoImp)
- ' coleccion.Add(TipOp)
- ' coleccion.Add(PorcImp)
- ' coleccion.Add(MontoSuje)
- ' coleccion.Add(MontoImp)
- ' Return coleccion
- 'End Function
- Function ColeccionIngresos()
- Dim coleccion As New Collection
- Dim NoCupon, Fecha, Ingreso, PorcImpuesto, Impuesto, Dias As String
- NoCupon = dgvIngresos.CurrentRow.Cells(1).Value
- Fecha = dgvIngresos.CurrentRow.Cells(2).Value
- Dias = dgvIngresos.CurrentRow.Cells(3).Value
- Ingreso = dgvIngresos.CurrentRow.Cells(4).Value
- PorcImpuesto = dgvIngresos.CurrentRow.Cells(5).Value
- Impuesto = dgvIngresos.CurrentRow.Cells(6).Value
- coleccion.Add(NocUpon)
- coleccion.Add(Fecha)
- coleccion.Add(Dias)
- coleccion.Add(Ingreso)
- coleccion.Add(PorcImpuesto)
- coleccion.Add(Impuesto)
- Return coleccion
- End Function
- 'Sub NuevaComision()
- ' Dim coleccion = ColecccionComisiones()
- ' BonosConsulta.NuevoImpuesto(coleccion, codigo)
- 'End Sub
- Sub NuevoIngreso()
- Dim coleccion = ColeccionIngresos()
- ' BonosConsulta.NuevoIngreso(coleccion, codigo)
- End Sub
- 'Sub ModificarComision()
- ' Dim coleccion = ColecccionComisiones()
- ' BonosConsulta.ModificarImpuesto(coleccion, codigo)
- 'End Sub
- Sub ModificarIngreso()
- Dim coleccion = ColeccionIngresos()
- ' BonosConsulta.ModificarIngreso(coleccion, codigo)
- End Sub
- Sub EliminarComision()
- BonosConsulta.EliminarImpuesto(codigo)
- End Sub
- Sub EliminarIngreso()
- Dim NoCupon = dgvIngresos.CurrentRow.Cells(0).Value
- ' BonosConsulta.EliminarIngreso(codigo, NoCupon)
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- 'btnAccionComision.Text = "Modificar"
- btnAccionIngreso.Text = "Modificar"
- Estado = "M"
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- 'btnAccionComision.Text = "Nuevo"
- btnAccionIngreso.Text = "Nuevo"
- Estado = "N"
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- 'btnAccionComision.Text = "Eliminar"
- btnAccionIngreso.Text = "Eliminar"
- Estado = "B"
- End Sub
- 'Sub CargarComisiones()
- ' Dim codigo As String = Variables.Codigo
- ' Dim dr = BonosConsulta.CargarImpuestos(codigo)
- ' While dr.Read
- ' dgvImpuestosYComisiones.Rows.Add(dr("TipoImp"), dr("TipoOp"), ((dr("PorcImp") * 100.0).ToString + "%"), dr("MontoSuje"), dr("MontoImp"))
- ' End While
- 'End Sub
- Sub CargarIngresos()
- Dim codigo As String = Variables.Codigo
- Dim dr = BonosConsulta.CargarIngreso(codigo, InstrumentoFinanciero)
- While dr.Read
- dgvIngresos.Rows.Add("", dr("NoCupon"), dr("Fecha"), dr("Dias"), dr("Ingreso"), dr("PorcImpuesto"), dr("Impuesto"))
- End While
- End Sub
- Private Sub btnAccionIngreso_Click(sender As Object, e As EventArgs) Handles btnAccionIngreso.Click
- If (Estado = "N") Then
- NuevoIngreso()
- ElseIf (Estado = "M") Then
- ModificarIngreso()
- ElseIf (Estado = "B") Then
- EliminarIngreso()
- End If
- End Sub
- Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click
- End Sub
- Private Sub txtValorNominalCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalCompra.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtValorNominalVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalVenta.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPorcentajeCuponCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponCompra.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPorcentajeCuponVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponVenta.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoCompra.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoVenta.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPrecioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioCompra.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtPrecioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioVenta.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtCostoTransferenciaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCostoTransferenciaCompra.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- Private Sub txtCostoTransferenciaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCostoTransferenciaVenta.KeyPress
- 'Operaciones.ValidarEntrada(sender, e)
- End Sub
- End Class
|