| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621 |
-
- Imports System.Data.OleDb
- Imports System.IO
- Public Class frmAcciones
- Private TipoOperacion As String
- Public Sub New()
- ' Esta llamada es exigida por el diseñador.
- InitializeComponent()
- ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
- End Sub
- Public Sub New(ByVal ConsTOperacion As String)
- ' Esta llamada es exigida por el diseñador.
- InitializeComponent()
- TOperacion(ConsTOperacion)
- TipoOperacion = ConsTOperacion
- ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
- End Sub
- Dim Cargar As Boolean = True
- Dim oAccionesCE As AccionesCE = New AccionesCE
- Dim oAccionesDAO As New AccionesDAO
- Dim oDAOGeneral As New DAOGeneral
- Dim Estado As String = ""
- Dim MostrarMensaje As Boolean = False
- Dim CambioCalculo = False
- Dim Operaciones As New Operaciones
- Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
- Dim Cargado As Boolean = False
- Dim DatosCargados As Boolean = False
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private _CodigoInversion As String
- Private _TipoTransaccion As String
- 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
- Sub Instrumento()
- If (InstrumentoFinanciero = "ACCNC") Then
- lblTitulo.Text = "Acciones Nacionales Comunes"
- Me.Text = "Acciones Nacionales Comunes"
- ElseIf (InstrumentoFinanciero = "ACCNP") Then
- lblTitulo.Text = "Acciones Preferentes Nacionales"
- ModificacionesPreferentes()
- Me.Text = "Acciones Preferentes Nacionales"
- ElseIf (InstrumentoFinanciero = "ACCI") Then
- lblTitulo.Text = "Acciones Internacionales"
- Me.Text = "Acciones Internacionales"
- End If
- End Sub
- Function ColeccionDatos()
- Dim coleccion As New Collection
- Dim PrecioLimpioC, FOperC, FLiqC, DiasTC, GCapTotC, GCapUnC, RetAnNetC, UnC, ValTransC, MontoNetoC, PrecSucioC
- Dim PrecioLimpioV, FOperV, FLiqV, DiasTV, GCapTotV, GCapUnV, RetAnBrV, RetAnNetV, UnV, ValTransV, MontoNetoV, PrecSucioV
- Dim ComisionCompraCasa, ComisionCompraBolsa, ComisionVentaCasa, ComisionVentaBolsa As Double
- Dim IOF, Renta, Tipo, RetornoBruto
- Dim ComisionCompraCasaValor, ComisionCompraBolsaValor, ComisionVentaCasaValor, ComisionVentaBolsaValor As Double
- PrecioLimpioC = Operaciones.ConvertirDecimal(txtPrecioLimpioCompra.Text.ToString)
- FOperC = Operaciones.ConvertirFecha(dtpFechaOperacionCompra.Value.ToString)
- FLiqC = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
- DiasTC = Operaciones.ConvertirEntero(txtDiasDeTenenciaCompra.Text.ToString)
- GCapTotC = Operaciones.ConvertirDecimal(txtGananciaCapitalTotalCompra.Text.ToString)
- GCapUnC = Operaciones.ConvertirDecimal(txtGananciaCapitalUnitarioCompra.Text.ToString)
- RetAnNetC = Operaciones.ConvertirDecimal(txtRetornoAnualNetoCompra.Text.ToString)
- UnC = Operaciones.ConvertirEntero(txtUnidadesCompra.Text.ToString)
- ValTransC = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- MontoNetoC = Operaciones.ConvertirDecimal(txtMontoNetoCompra.Text.ToString)
- PrecSucioC = Operaciones.ConvertirDecimal(txtPrecioSucioCompra.Text.ToString)
- PrecioLimpioV = Operaciones.ConvertirDecimal(txtPrecioLimpioVenta.Text.ToString)
- FOperV = Operaciones.ConvertirFecha(dtpFechaOperacionVenta.Value.ToString)
- FLiqV = Operaciones.ConvertirFecha(dtpFechaVencimientoVenta.Value.ToString)
- DiasTV = Operaciones.ConvertirEntero(txtDiasDeTenenciaVenta.Text.ToString)
- GCapTotV = Operaciones.ConvertirDecimal(txtGananciaCapitalTotalVenta.Text.ToString)
- GCapUnV = Operaciones.ConvertirDecimal(txtGananciaCapitalUnitarioVenta.Text.ToString)
- RetAnBrV = Operaciones.ConvertirDecimal(txtRetornoAnualBrutoVenta.Text.ToString)
- RetAnNetV = Operaciones.ConvertirDecimal(txtRetornoAnualNetoVenta.Text.ToString)
- UnV = Operaciones.ConvertirEntero(txtUnidadesVenta.Text.ToString)
- ValTransV = Operaciones.ConvertirDecimal(txtValorTransadoVenta.Text.ToString)
- MontoNetoV = Operaciones.ConvertirDecimal(txtMontoNetoVenta.Text.ToString)
- PrecSucioV = Operaciones.ConvertirDecimal(txtPrecioSucioVenta.Text.ToString)
- ComisionCompraCasa = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaCompra.Text.ToString) / 100
- ComisionCompraBolsa = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaCompra.Text.ToString) / 100
- ComisionVentaCasa = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaVenta.Text.ToString) / 100
- ComisionVentaBolsa = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaVenta.Text.ToString) / 100
- ComisionCompraCasaValor = Operaciones.ConvertirDecimal(txtComisionCasaCompra.Text.ToString)
- ComisionCompraBolsaValor = Operaciones.ConvertirDecimal(txtComisionBolsaCompra.Text.ToString)
- ComisionVentaCasaValor = Operaciones.ConvertirDecimal(txtComisionCasaVenta.Text.ToString)
- ComisionVentaBolsaValor = Operaciones.ConvertirDecimal(txtComisionBolsaVenta.Text.ToString)
- RetornoBruto = Operaciones.ConvertirDecimal(txtRetornoAnualBrutoCompra.Text.ToString) / 100
- If (ChkIOF.Checked) Then
- IOF = 1
- Else
- IOF = 0
- End If
- If (ChkRenta.Checked) Then
- Renta = 1
- Else
- Renta = 0
- End If
- If rdbPorcentaje.Checked Then
- Tipo = "Porcentaje"
- Else
- Tipo = "Efectivo"
- End If
- coleccion.Add(PrecioLimpioC)
- coleccion.Add(FOperC)
- coleccion.Add(FLiqC)
- coleccion.Add(DiasTC)
- coleccion.Add(GCapTotC)
- coleccion.Add(GCapUnC)
- coleccion.Add(RetornoBruto)
- coleccion.Add(RetAnNetC)
- coleccion.Add(UnC)
- coleccion.Add(ValTransC)
- coleccion.Add(MontoNetoC)
- coleccion.Add(PrecSucioC)
- coleccion.Add(PrecioLimpioV)
- coleccion.Add(FOperV)
- coleccion.Add(FLiqV)
- coleccion.Add(DiasTV)
- coleccion.Add(GCapTotV)
- coleccion.Add(GCapUnV)
- coleccion.Add(RetAnBrV)
- coleccion.Add(RetAnNetV)
- coleccion.Add(UnV)
- coleccion.Add(ValTransV)
- coleccion.Add(MontoNetoV)
- coleccion.Add(PrecSucioV)
- coleccion.Add(ComisionCompraCasa)
- coleccion.Add(ComisionCompraBolsa)
- coleccion.Add(ComisionVentaCasa)
- coleccion.Add(ComisionVentaBolsa)
- coleccion.Add(IOF)
- coleccion.Add(Renta)
- coleccion.Add(Tipo)
- coleccion.Add(ComisionCompraCasaValor)
- coleccion.Add(ComisionCompraBolsaValor)
- coleccion.Add(ComisionVentaCasaValor)
- coleccion.Add(ComisionVentaBolsaValor)
- Return coleccion
- End Function
- Function Correlativo()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvDividendos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- Dim Numero As Integer = dgvDividendos.Rows(Index).Cells("NumDiv").Value
- If Numero > NumeroMayor Then
- NumeroMayor = Numero
- End If
- Index += 1
- End While
- Return NumeroMayor + 1
- End Function
- Sub CorrelativoSinBD()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvDividendos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- dgvDividendos.Rows(Index).Cells("Correlativo").Value = Index + 1
- Index += 1
- End While
- End Sub
- Function ColeccionesElementos(ByVal Index As Integer)
- Dim coleccion As New Collection
- Dim Fecha, Estado, Dividendo, CantidadBase, IngresoBruto, PorcISR, ISR, IngresoNeto, Correlativo, Tipo, FechaInicio, FechaCorte
- If rdbPorcentaje.Checked Then
- Tipo = "Porcentaje"
- Else
- Tipo = "Efectivo"
- End If
- Fecha = Operaciones.ConvertirFecha(dgvDividendos.Rows(Index).Cells("Fecha").Value.ToString)
- Dividendo = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("Dividendo").Value.ToString)
- If (Tipo = "Porcentaje") Then
- Dividendo /= 100
- End If
- CantidadBase = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("CantidadBase").Value.ToString)
- IngresoBruto = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("IngresoBruto").Value.ToString)
- PorcISR = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("PorcISR").Value.ToString)
- ISR = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("ISR").Value.ToString)
- IngresoNeto = Operaciones.ConvertirDecimal(dgvDividendos.Rows(Index).Cells("IngresoNeto").Value.ToString)
- Estado = "A"
- Correlativo = Operaciones.ConvertirEntero(dgvDividendos.Rows(Index).Cells("NumDiv").Value.ToString)
- FechaInicio = Operaciones.ConvertirFechaBaseDatos(dgvDividendos.Rows(Index).Cells("FechaInicio").Value.ToString)
- FechaCorte = Operaciones.ConvertirFechaBaseDatos(dgvDividendos.Rows(Index).Cells("FechaCorte").Value.ToString)
- If (Tipo = "Porcentaje") Then
- If FechaInicio Is DBNull.Value Or FechaCorte Is DBNull.Value Then
- MsgBox("Verifique las fechas")
- Return coleccion
- Else
- If (String.IsNullOrEmpty(FechaInicio) Or String.IsNullOrEmpty(FechaCorte)) Then
- MsgBox("Verifique las fechas")
- Return coleccion
- End If
- End If
- End If
- coleccion.Add(Fecha)
- coleccion.Add(Dividendo)
- coleccion.Add(CantidadBase)
- coleccion.Add(IngresoBruto)
- coleccion.Add(PorcISR)
- coleccion.Add(ISR)
- coleccion.Add(IngresoNeto)
- coleccion.Add(Estado)
- coleccion.Add(Correlativo)
- coleccion.Add(FechaInicio)
- coleccion.Add(FechaCorte)
- Return coleccion
- End Function
- Function ColeccionNuevo(ByVal codigo As String)
- Dim i As Integer = 0
- Dim diccionario As New Dictionary(Of String, Collection)
- Dim Index = dgvDividendos.Rows.Count - 2
- While i <= Index
- Dim coleccion = ColeccionesElementos(i)
- diccionario.Add(i, coleccion)
- i += 1
- End While
- Return diccionario
- End Function
- Public Function NuevaAccion()
- Dim Coleccion = ColeccionDatos()
- Return Coleccion
- End Function
- Sub Eliminar()
- Dim Codigo = Variables.Codigo
- oAccionesDAO.Eliminar(Codigo)
- End Sub
- Sub ModificacionesPreferentes()
- GrpVenta.Visible = False
- txtRetornoAnualBrutoCompra.Visible = True
- txtRetornoAnualBrutoCompra.ReadOnly = False
- txtRetornoAnualBrutoCompra.Text = "0.0"
- Label19.Visible = False
- End Sub
- Sub Redimencionar()
- dgvDividendos.Width = Me.Width - 10
- dgvDividendos.Height = Me.Height - 50
- End Sub
- Private Sub frmAcciones_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim VExisteInversion As Boolean = False
- VExisteInversion = ExisteInversion()
- If VExisteInversion Then
- TipoOperacion = "C"
- TipoTransaccion = "C"
- Else
- TipoOperacion = String.Empty
- TipoTransaccion = String.Empty
- End If
- If Variables.TipoOperacionCMVTA = "C" Then
- GrpVenta.Enabled = False
- GrpCompra.Enabled = True
- Else
- GrpVenta.Enabled = True
- GrpCompra.Enabled = False
- End If
- Call Instrumento()
- HabilitarBotones()
- PrepararTablaDividendos()
- If VExisteInversion Then
- TipoOperacion = "C"
- TipoTransaccion = "C"
- Else
- TipoOperacion = String.Empty
- TipoTransaccion = String.Empty
- End If
- If TipoTransaccion = "C" Then
- Call CargarRegistroBD()
- Formato()
- ValidarRentaIOF()
- CargarDividendos()
- End If
- ModificarDividendo()
- CalcularDividendos()
- Cargado = True
- ValidarExistencia()
- Formato()
- DatosCargados = True
- ConfiguracionCMVTA(VExisteInversion)
- End Sub
- Sub ConfiguracionCMVTA(ByRef VExisteInversion As Boolean)
- Dim Codigo As String = Variables.Codigo
- Dim ExisteCMVTA As Boolean = oDAOGeneral.ExisteCMVTA(Codigo)
- If Not ExisteCMVTA And Variables.InvocadorProInv = "frmINV" Then
- btnVenderTitulo.Visible = True
- End If
- If CantFormAbierto = False And Not VExisteInversion Then
- If Not Variables.TrasladarCMVTA Is Nothing Then
- dtpFechaOperacionCompra.Value = Operaciones.ConvertirFecha(Variables.TrasladarCMVTA.FechaOperacionACC.ToString)
- dtpFechaVencimientoCompra.Value = Operaciones.ConvertirFecha(Variables.TrasladarCMVTA.FechaVencimientoACC.ToString)
- txtPrecioLimpioCompra.Text = Operaciones.ConvertirDecimal(Variables.TrasladarCMVTA.PrecioLimpioACC.ToString)
- txtUnidadesCompra.Text = Operaciones.ConvertirEntero(Variables.TrasladarCMVTA.UnidadesACC.ToString)
- txtComisionPorcentajeCasaCompra.Text = Operaciones.ConvertirDecimal(Variables.TrasladarCMVTA.PorcentajeCasaACC.ToString)
- txtComisionPorcentajeBolsaCompra.Text = Operaciones.ConvertirDecimal(Variables.TrasladarCMVTA.PorcentajeBolsaACC.ToString)
- End If
- End If
- End Sub
- Function ExisteInversion()
- Dim Codigo As String = Variables.Codigo
- Dim TablaINV As String = "INV0"
- Dim TablaPINV As String = "PIN0"
- Dim General As New DAOGeneral
- Dim InvPro = Variables.InvPro
- If InvPro = "I" Then
- Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
- If INV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- If InvPro = "P" Then
- Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
- If PINV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- Return False
- End Function
- Sub ModificarDividendo()
- Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
- For i As Integer = 0 To Cantidad
- If rdbPorcentaje.Checked Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value *= 100
- End If
- Next
- End Sub
- Private Sub chkAccionPreferente_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
- Dim codigo As String = Variables.Codigo
- Dim Accion As Collection = NuevaAccion()
- Dim ElementosAccion As Dictionary(Of String, Collection) = ColeccionNuevo(codigo)
- If (Estado = "N") Then
- oAccionesDAO.ProcesoDatos(Accion, codigo, ElementosAccion, "Nuevo")
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionACC = NuevaAccion()
- Me.Close()
- End If
- If Estado = "M" Then
- oAccionesDAO.ProcesoDatos(Accion, codigo, ElementosAccion, "Modificar")
- End If
- If Estado = "B" Then
- Eliminar()
- End If
- ValidarExistencia()
- End Sub
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Tabla = "ACC0"
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If (Existe) Then
- navNuevo.Enabled = False
- TbDividendos.Enabled = True
- navModificar.Enabled = True
- navEliminar.Enabled = True
- Else
- navNuevo.Enabled = True
- TbDividendos.Enabled = False
- navModificar.Enabled = False
- navEliminar.Enabled = False
- DatosCargados = True
- End If
- TipoTransaccion = String.Empty
- btnAceptar.Text = "Aceptar"
- End Sub
- Function ExisteValidacion()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Tabla = "ACC0"
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Public Function RetornarObjeto()
- Return oAccionesCE
- End Function
- Private Sub CargarRegistroBD()
- oAccionesCE = Nothing
- CodigoInversion = Variables.Codigo
- oAccionesCE = oAccionesDAO.CargarRegistro(Me.CodigoInversion)
- TipoTransaccion = "C"
- RefrescarValorControlesInicial()
- End Sub
- Public Sub CargarRegistro(vId As Integer, vTipo As String)
- TipoTransaccion = "C"
- IdDocumento = vId
- TipoDocumento = vTipo
- End Sub
- Public Sub CargarRegistro(ByRef vCodigoInversion As String)
- TipoTransaccion = "C"
- Me.CodigoInversion = vCodigoInversion
- End Sub
- Private Sub txtDiasDeTenencia_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasDeTenenciaCompra.TextChanged
- End Sub
- Private Sub txtGananciaCapitalTotal_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalTotalCompra.TextChanged
- End Sub
- Private Sub txtGananciaCapitalUnitario_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalUnitarioCompra.TextChanged
- End Sub
- Private Sub txtRetornoAnualBruto_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualBrutoCompra.TextChanged
- If (txtRetornoAnualBrutoCompra.ToString.IndexOf("%") = -1) Then
- txtRetornoAnualBrutoCompra.Text += "%"
- End If
- If (String.IsNullOrEmpty(txtRetornoAnualBrutoCompra.Text.ToString.Trim("%"))) Then
- txtRetornoAnualBrutoCompra.Text = "0.0%"
- End If
- End Sub
- Private Sub txtRetornoAnualNeto_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualNetoCompra.TextChanged
- End Sub
- Private Sub cboCasa_C_SelectedIndexChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtPrecioSucio_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioCompra.TextChanged
- End Sub
- Private Sub txtGananciaCapitalUnitario_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalUnitarioVenta.TextChanged
- End Sub
- Private Sub txtRetornoAnualBruto_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualBrutoVenta.TextChanged
- End Sub
- Private Sub txtRetornoAnualNeto_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualNetoVenta.TextChanged
- End Sub
- Private Sub cboCasa_V_SelectedIndexChanged(sender As Object, e As EventArgs)
- End Sub
- '********** CONTROL DE VALORES **********
- 'COMPRA
- Private Sub ControlPrecioLimpioCompra()
- If DatosCargados Then
- Dim valor As Double = 0
- If Not Double.TryParse(Me.txtPrecioLimpioCompra.Text, valor) Then
- oAccionesCE.PrecioLimpioVenta = "0.0"
- Else
- oAccionesCE.PrecioLimpioCompra = valor
- Me.txtPrecioLimpioCompra.BackColor = Color.White
- If (Me.TipoTransaccion = "N") Then
- oAccionesCE.PrecioLimpioVenta = oAccionesCE.PrecioLimpioCompra
- End If
- RefrescarValorControles()
- End If
- End If
- End Sub
- Private Sub ControlFechaOperacionCompra()
- oAccionesCE.FechaOperacionCompra = Me.dtpFechaOperacionCompra.Value.Date
- RefrescarValorControles()
- End Sub
- Private Sub ControlFechaLiquidacionCompra()
- oAccionesCE.FechaVencimientoCompra = Me.dtpFechaVencimientoCompra.Value.Date
- RefrescarValorControles()
- End Sub
- Private Sub ControlCantidadCompra()
- Dim valor As Integer = 0
- If Not Integer.TryParse(Me.txtUnidadesCompra.Text, valor) Then
- oAccionesCE.CantidadCompra = "0"
- Else
- Me.txtUnidadesCompra.BackColor = Color.White
- oAccionesCE.CantidadCompra = valor
- If (Me.TipoTransaccion = "N" Or TipoTransaccion = "A") Then
- oAccionesCE.CantidadVenta = oAccionesCE.CantidadCompra
- End If
- RefrescarValorControles()
- End If
- End Sub
- 'VENTA
- Private Sub ControlPrecioLimpioVenta()
- If DatosCargados Then
- Dim valor As Double
- If Not Double.TryParse(Me.txtPrecioLimpioVenta.Text, valor) Then
- oAccionesCE.PrecioLimpioVenta = "0.0"
- Else
- Me.txtPrecioLimpioVenta.BackColor = Color.White
- oAccionesCE.PrecioLimpioVenta = valor
- End If
- RefrescarValorControles()
- End If
- End Sub
- Private Sub ControlFechaOperacionVenta()
- oAccionesCE.FechaOperacionVenta = dtpFechaOperacionVenta.Value.Date
- RefrescarValorControles()
- End Sub
- Private Sub ControlFechaLiquidacionVenta()
- oAccionesCE.FechaVencimientoVenta = dtpFechaVencimientoVenta.Value.Date
- RefrescarValorControles()
- End Sub
- Private Sub ControlCantidadVenta()
- Dim valor As Integer
- If Not Integer.TryParse(Me.txtUnidadesVenta.Text, valor) Then
- Me.txtUnidadesVenta.Text = "0"
- oAccionesCE.CantidadVenta = "0"
- Else
- Me.txtUnidadesVenta.BackColor = Color.White
- oAccionesCE.CantidadVenta = valor
- End If
- RefrescarValorControles()
- End Sub
- '********** FIN CONTROL DE VALORES **********
- '********** EVENTOS DE CONTROLES **********
- 'COMPRA
- Private Sub txtPrecioLimpioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.TextChanged
- ControlPrecioLimpioCompra()
- End Sub
- Private Sub txtPrecioLimpioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.LostFocus
- ControlPrecioLimpioCompra()
- End Sub
- Private Sub dtpFechaOperacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacionCompra.ValueChanged
- If DatosCargados Then
- ControlFechaOperacionCompra()
- RefrescarValorControles()
- Formato()
- End If
- End Sub
- Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
- If DatosCargados Then
- ControlFechaLiquidacionCompra()
- RefrescarValorControles()
- Formato()
- End If
- End Sub
- Private Sub txtUnidadesCompra_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesCompra.TextChanged
- If DatosCargados Then
- ControlCantidadCompra()
- CopiarDatos()
- End If
- End Sub
- Sub CopiarDatos()
- txtUnidadesVenta.Text = txtUnidadesCompra.Text
- End Sub
- Private Sub txtUnidadesCompra_LostFocus(sender As Object, e As EventArgs) Handles txtUnidadesCompra.LostFocus
- ControlCantidadCompra()
- End Sub
- 'VENTA
- Private Sub txtPrecioLimpioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.TextChanged
- ControlPrecioLimpioVenta()
- End Sub
- Private Sub txtPrecioLimpioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.LostFocus
- ControlPrecioLimpioVenta()
- End Sub
- Private Sub dtpFechaOperacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacionVenta.ValueChanged
- If DatosCargados Then
- ControlFechaOperacionVenta()
- RefrescarValorControles()
- End If
- End Sub
- Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
- If DatosCargados Then
- ControlFechaLiquidacionVenta()
- RefrescarValorControles()
- End If
- End Sub
- Private Sub txtUnidadesVenta_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesVenta.TextChanged
- If DatosCargados Then
- ControlCantidadVenta()
- MensajeAlerta()
- MostrarMensaje = True
- End If
- End Sub
- Sub MensajeAlerta()
- If (MostrarMensaje) Then
- Dim UnidadesVenta As Integer = 0
- Dim UnidadesCompra As Integer = 0
- If Not String.IsNullOrEmpty(txtUnidadesVenta.Text) Then
- UnidadesVenta = txtUnidadesVenta.Text
- End If
- If Not String.IsNullOrEmpty(txtUnidadesCompra.Text) Then
- UnidadesCompra = txtUnidadesCompra.Text
- End If
- If (Operaciones.ConvertirDecimal(UnidadesVenta.ToString) > Operaciones.ConvertirDecimal(UnidadesCompra.ToString)) Then
- MsgBox("Esta Tratando de Ingresar más acciones de las compradas, verifique los datos si ha cometido algún error.")
- End If
- End If
- End Sub
- Private Sub txtUnidadesVenta_LostFocus(sender As Object, e As EventArgs) Handles txtUnidadesVenta.LostFocus
- ControlCantidadVenta()
- End Sub
- Private Sub chkBolsa_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- '********** FIN EVENTOS DE CONTROLES **********
- '********** FUNCIONES **********
- Private Sub Formato()
- If DatosCargados Then
- Me.txtRetornoAnualBrutoCompra.Text = Operaciones.ConvertirDecimal(Me.txtRetornoAnualBrutoCompra.Text.ToString)
- Me.txtComisionPorcentajeCasaCompra.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeCasaCompra.Text.ToString).ToString + " %"
- Me.txtComisionPorcentajeBolsaCompra.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeBolsaCompra.Text.ToString).ToString + " %"
- Me.txtComisionPorcentajeCasaVenta.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeCasaVenta.Text.ToString).ToString + " %"
- Me.txtComisionPorcentajeBolsaVenta.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeBolsaVenta.Text.ToString).ToString + " %"
- Me.txtComisionPorcentajeBolsaCompra.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeBolsaCompra.Text.ToString).ToString + " %"
- Me.txtComisionPorcentajeBolsaVenta.Text = Operaciones.ConvertirDecimal(Me.txtComisionPorcentajeBolsaVenta.Text.ToString).ToString + " %"
- txtRetornoAnualBrutoVenta.Text = Operaciones.ConvertirDecimal(txtRetornoAnualBrutoVenta.Text.ToString)
- txtPrecioLimpioCompra.Text = Operaciones.ConvertirDecimal(txtPrecioLimpioCompra.Text.ToString)
- txtPrecioLimpioVenta.Text = Operaciones.ConvertirDecimal(txtPrecioLimpioVenta.Text.ToString)
- txtUnidadesCompra.Text = Operaciones.ConvertirEntero(txtUnidadesCompra.Text.ToString)
- txtUnidadesVenta.Text = Operaciones.ConvertirEntero(txtUnidadesVenta.Text.ToString)
- If (txtComisionPorcentajeCasaVenta.ToString.IndexOf("%") = -1) Then
- txtComisionPorcentajeCasaVenta.Text += "%"
- End If
- If (txtComisionPorcentajeBolsaVenta.ToString.IndexOf("%") = -1) Then
- txtComisionPorcentajeBolsaVenta.Text += "%"
- End If
- If String.IsNullOrEmpty(txtGananciaCapitalUnitarioVenta.Text) Then
- txtGananciaCapitalUnitarioVenta.Text = 0
- End If
- If String.IsNullOrEmpty(txtRetornoAnualNetoVenta.Text) Then
- txtRetornoAnualNetoVenta.Text = 0
- End If
- End If
- End Sub
- Sub RefrescarValorControlesInicial()
- Me.txtRetornoAnualBrutoCompra.Text = oAccionesCE.RetornoBruto * 100
- Dim IOF = oAccionesCE.IOF
- Dim Renta = oAccionesCE.Renta
- If (IOF) Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- If (Renta) Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- Me.txtComisionPorcentajeCasaCompra.Text = CStr(oAccionesCE.ComisionPorcentajeCompraCasa * 100) + "%"
- Me.txtComisionPorcentajeBolsaCompra.Text = CStr(oAccionesCE.ComisionPorcentajeCompraBolsa * 100) + "%"
- Me.txtComisionPorcentajeCasaVenta.Text = CStr(oAccionesCE.ComisionPorcentajeVentaCasa * 100) + "%"
- Me.txtComisionPorcentajeBolsaVenta.Text = CStr(oAccionesCE.ComisionPorcentajeVentaBolsa * 100) + "%"
- Me.txtComisionCasaCompra.Text = oAccionesCE.ComisionCompraCasa
- Me.txtComisionBolsaCompra.Text = oAccionesCE.ComisionCompraBolsa
- Me.txtComisionCasaVenta.Text = oAccionesCE.ComisionVentaCasa
- Me.txtComisionBolsaVenta.Text = oAccionesCE.ComisionVentaBolsa
- If (oAccionesCE.Tipo = "Porcentaje") Then
- rdbPorcentaje.Checked = True
- ElseIf (oAccionesCE.Tipo = "Efectivo") Then
- rdbEfectivo.Checked = True
- End If
- 'COMPRA
- Me.txtPrecioLimpioCompra.Text = oAccionesCE.PrecioLimpioCompra.ToString()
- dtpFechaOperacionCompra.Value = CDate(oAccionesCE.FechaOperacionCompra)
- dtpFechaVencimientoCompra.Value = CDate(oAccionesCE.FechaVencimientoCompra)
- Me.txtDiasDeTenenciaCompra.Text = oAccionesCE.DiasDeTenenciaCompra.ToString
- Me.txtGananciaCapitalTotalCompra.Text = oAccionesCE.GananciaDeCapitalTotalCompra.ToString
- Me.txtGananciaCapitalUnitarioCompra.Text = oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString
- Me.txtRetornoAnualNetoCompra.Text = oAccionesCE.RetornoAnualizadoNetoCompra.ToString()
- Me.txtUnidadesCompra.Text = oAccionesCE.CantidadCompra.ToString
- Me.txtValorTransadoCompra.Text = oAccionesCE.ValorTransadoCompra.ToString()
- Dim ValorIOFCompra = 0.0, ValorRentaCompra = 0.0
- Me.txtMontoNetoCompra.Text = oAccionesCE.MontoNetoComprasus
- Me.txtPrecioSucioCompra.Text = oAccionesCE.PrecioSucioCompra.ToString()
- 'VENTA
- Me.txtPrecioLimpioVenta.Text = oAccionesCE.PrecioLimpioVenta.ToString()
- Me.dtpFechaOperacionVenta.Value = oAccionesCE.FechaOperacionVenta
- Me.dtpFechaVencimientoVenta.Value = oAccionesCE.FechaVencimientoVenta
- Me.txtDiasDeTenenciaVenta.Text = oAccionesCE.DiasDeTenenciaVenta.ToString
- Me.txtGananciaCapitalTotalVenta.Text = oAccionesCE.GananciaDeCapitalTotalVentasus.ToString()
- Me.txtGananciaCapitalUnitarioVenta.Text = oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString
- txtRetornoAnualBrutoVenta.Text = oAccionesCE.RetornoAnualizadoBrutoVentasus.ToString
- Me.txtRetornoAnualNetoVenta.Text = oAccionesCE.RetornoAnualizadoNetoVenta.ToString()
- Me.txtUnidadesVenta.Text = oAccionesCE.CantidadVenta.ToString
- Me.txtValorTransadoVenta.Text = oAccionesCE.ValorTransadoVenta.ToString()
- Me.txtImpuestosYComisionesVenta.Text = oAccionesCE.SumaImpuestosYComisionesVenta.ToString()
- Dim ComisionCasaVenta As Double = 0
- Dim ComisionBolsaVenta As Double = 0
- Dim ValorTransadoVenta As Double = 0
- Dim ValorIOFVenta = 0.0, ValorRentaVenta = 0.0
- Me.txtMontoNetoVenta.Text = oAccionesCE.MontoNetoVentasus.ToString
- Me.txtPrecioSucioVenta.Text = oAccionesCE.PrecioSucioVentasus.ToString()
- End Sub
- Sub RefrescarValorControles()
- If DatosCargados Then
- If (Cargar) Then
- Me.txtRetornoAnualBrutoCompra.Text = Operaciones.ConvertirDecimal(oAccionesCE.RetornoBruto.ToString) * 100
- txtGananciaCapitalUnitarioVenta.Text = Operaciones.ConvertirDecimal(txtGananciaCapitalUnitarioVenta.Text.ToString)
- txtRetornoAnualNetoVenta.Text = Operaciones.ConvertirDecimal(txtRetornoAnualNetoVenta.Text.ToString)
- Dim IOF = oAccionesCE.IOF
- Dim Renta = oAccionesCE.Renta
- If (IOF) Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- If (Renta) Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- Else
- If (oAccionesCE.Tipo = "Porcentaje") Then
- rdbPorcentaje.Checked = True
- ElseIf (oAccionesCE.Tipo = "Efectivo") Then
- rdbEfectivo.Checked = True
- End If
- End If
- 'COMPRA
- If (Not String.IsNullOrEmpty(oAccionesCE.PrecioLimpioCompra.ToString())) Then
- If Not oAccionesCE.PrecioLimpioCompra.ToString() = "0" Then
- Me.txtPrecioLimpioCompra.Text = oAccionesCE.PrecioLimpioCompra.ToString()
- End If
- End If
- If (String.IsNullOrEmpty(oAccionesCE.FechaOperacionCompra)) Then
- Me.dtpFechaOperacionCompra.Value = Date.Now.Date
- Else
- Me.dtpFechaOperacionCompra.Value = oAccionesCE.FechaOperacionCompra
- End If
- If (String.IsNullOrEmpty(oAccionesCE.FechaVencimientoCompra)) Then
- Me.dtpFechaVencimientoCompra.Value = Date.Now.Date
- Else
- Me.dtpFechaVencimientoCompra.Value = oAccionesCE.FechaVencimientoCompra
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaCompra.ToString)) Then
- Me.txtDiasDeTenenciaCompra.Text = oAccionesCE.DiasDeTenenciaCompra.ToString
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalCompra.ToString)) Then
- Me.txtGananciaCapitalTotalCompra.Text = oAccionesCE.GananciaDeCapitalTotalCompra.ToString
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString)) Then
- Me.txtGananciaCapitalUnitarioCompra.Text = oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoCompra.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Me.txtRetornoAnualNetoCompra.Text = oAccionesCE.RetornoAnualizadoNetoCompra.ToString()
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.CantidadCompra.ToString)) Then
- If Not oAccionesCE.CantidadCompra.ToString = "0" Then
- Me.txtUnidadesCompra.Text = oAccionesCE.CantidadCompra.ToString
- End If
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.ValorTransadoCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Me.txtValorTransadoCompra.Text = oAccionesCE.ValorTransadoCompra.ToString()
- End If
- Dim ComisionCasaCompra As Double = 0
- Dim ComisionBolsaCompra As Double = 0
- Dim ValorTransadoCompra As Double = 0
- ComisionCasaCompra = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaCompra.Text.ToString) / 100
- ComisionBolsaCompra = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaCompra.Text.ToString) / 100
- ValorTransadoCompra = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- Me.txtComisionCasaCompra.Text = CalcularComisionImpuestos(ComisionCasaCompra, txtValorTransadoCompra.Text)
- Me.txtComisionBolsaCompra.Text = CalcularComisionImpuestos(ComisionBolsaCompra, txtValorTransadoCompra.Text)
- If (Not String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Me.txtImpuestosYComisionesCompra.Text = oAccionesCE.SumaImpuestosYComisionesCompra.ToString()
- End If
- Dim ValorIOFCompra = 0.0, ValorRentaCompra = 0.0
- If (Not String.IsNullOrEmpty(txtIOFCompra.Text.ToString)) Then
- ValorIOFCompra = txtIOFCompra.Text
- End If
- If (Not String.IsNullOrEmpty(txtRentaCompra.Text.ToString)) Then
- ValorRentaCompra = txtRentaCompra.Text
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.PrecioSucioCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Me.txtPrecioSucioCompra.Text = oAccionesCE.PrecioSucioCompra.ToString()
- End If
- 'VENTA
- If (Not String.IsNullOrEmpty(oAccionesCE.PrecioLimpioVenta.ToString())) Then
- If Not oAccionesCE.PrecioLimpioVenta = 0 Then
- Me.txtPrecioLimpioVenta.Text = oAccionesCE.PrecioLimpioVenta.ToString()
- End If
- End If
- Me.dtpFechaOperacionVenta.Value = Operaciones.ConvertirFecha(oAccionesCE.FechaOperacionVenta.ToString)
- Me.dtpFechaVencimientoVenta.Value = Operaciones.ConvertirFecha(oAccionesCE.FechaVencimientoVenta.ToString)
- If (Not String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaVenta.ToString)) Then
- Me.txtDiasDeTenenciaVenta.Text = oAccionesCE.DiasDeTenenciaVenta.ToString
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalVenta.ToString(Configuraciones.CodigoTXTMontos))) Then
- Me.txtGananciaCapitalTotalVenta.Text = oAccionesCE.GananciaDeCapitalTotalVenta.ToString()
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString)) Then
- If Not Double.IsNaN(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString) Then
- Me.txtGananciaCapitalUnitarioVenta.Text = oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString
- End If
- End If
- If String.IsNullOrEmpty(txtRetornoAnualBrutoVenta.Text.ToString) Then
- txtRetornoAnualBrutoVenta.Text = 0
- End If
- Variables.IngresoBruto = CalcularIngresoBruto()
- Variables.IngresoNeto = CalcularIngresoNeto()
- If (rdbEfectivo.Checked) Then
- If (Not String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoBrutoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Me.txtRetornoAnualBrutoVenta.Text = oAccionesCE.RetornoAnualizadoBrutoVenta.ToString()
- End If
- Else
- Dim Existe = dgvDividendos.Rows.Count
- If (Existe >= 1) Then
- If (Not dgvDividendos.Rows(0).Cells("Dividendo").Value Is Nothing) Then
- Dim Valor = dgvDividendos.Rows(0).Cells("Dividendo").Value.ToString.Trim("%")
- If (Not String.IsNullOrEmpty(Valor)) Then
- Me.txtRetornoAnualBrutoVenta.Text = CStr((CDec(Valor.ToString.Trim("%")) * 100)) + "%"
- End If
- End If
- End If
- End If
- If (rdbEfectivo.Checked) Then
- If (Not String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Me.txtRetornoAnualNetoVenta.Text = oAccionesCE.RetornoAnualizadoNetoVenta.ToString()
- End If
- Else
- Dim Existe = dgvDividendos.Rows.Count
- If (Existe >= 1) Then
- Dim Valor = dgvDividendos.Rows(0).Cells("PorcISR").Value
- If (Not String.IsNullOrEmpty(Valor)) Then
- Me.txtRetornoAnualNetoVenta.Text = CStr(CDec(txtRetornoAnualBrutoVenta.Text.Trim("%")) * (1 - Valor)) + "%"
- End If
- End If
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.CantidadVenta.ToString)) Then
- If Not oAccionesCE.CantidadVenta = 0 Then
- Me.txtUnidadesVenta.Text = oAccionesCE.CantidadVenta.ToString
- End If
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.ValorTransadoVenta.ToString())) Then
- Me.txtValorTransadoVenta.Text = oAccionesCE.ValorTransadoVenta.ToString()
- End If
- If (Not String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesVenta.ToString())) Then
- Me.txtImpuestosYComisionesVenta.Text = oAccionesCE.SumaImpuestosYComisionesVenta.ToString()
- End If
- Dim ComisionCasaVenta As Double = 0
- Dim ComisionBolsaVenta As Double = 0
- Dim ValorTransadoVenta As Double = 0
- ComisionCasaVenta = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaVenta.Text.ToString) / 100
- ComisionBolsaVenta = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaVenta.Text.ToString) / 100
- ValorTransadoVenta = Operaciones.ConvertirDecimal(txtValorTransadoVenta.Text.ToString)
- Me.txtComisionCasaVenta.Text = CalcularComisionImpuestos(ComisionCasaVenta, ValorTransadoVenta)
- Me.txtComisionBolsaVenta.Text = CalcularComisionImpuestos(ComisionBolsaVenta, ValorTransadoVenta)
- txtGananciaCapitalTotalVenta.Text += SumaComisiones()
- Dim ValorIOFVenta = 0.0, ValorRentaVenta = 0.0
- If (Not String.IsNullOrEmpty(txtIOFVenta.Text.ToString)) Then
- ValorIOFVenta = txtIOFVenta.Text
- End If
- If (Not String.IsNullOrEmpty(txtRentaVenta.Text.ToString)) Then
- ValorRentaVenta = txtRentaVenta.Text
- End If
- Me.txtMontoNetoVenta.Text = Operaciones.ConvertirDecimal(oAccionesCE.MontoNetoVenta.ToString()) - Operaciones.ConvertirDecimal(txtComisionBolsaVenta.Text) - Operaciones.ConvertirDecimal(txtComisionCasaVenta.Text) - ValorIOFVenta - ValorRentaVenta
- Me.txtMontoNetoCompra.Text = (Operaciones.ConvertirDecimal(oAccionesCE.MontoNetoCompra.ToString())) + (Operaciones.ConvertirDecimal(txtComisionBolsaCompra.Text) + Operaciones.ConvertirDecimal(txtComisionCasaCompra.Text) + ValorIOFCompra + ValorRentaCompra)
- If (String.IsNullOrEmpty(oAccionesCE.PrecioSucioVenta.ToString())) Then
- Me.txtPrecioSucioVenta.Text = "0.0"
- Else
- If Double.IsNaN(oAccionesCE.PrecioSucioVenta.ToString()) Then
- Me.txtPrecioSucioVenta.Text = "0.0"
- Else
- Me.txtPrecioSucioVenta.Text = oAccionesCE.PrecioSucioVenta.ToString()
- End If
- End If
- End If
- End Sub
- Function CalcularIngresoBruto()
- Dim Cantidad = dgvDividendos.Rows.Count - 1
- Dim FechaActual = Date.Now.Date
- Dim ContadorIngreso As Double = 0.0
- For i As Integer = 0 To Cantidad
- Try
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)) Then
- Dim FechaPrograma As Date = Operaciones.ConvertirFecha(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
- If (FechaActual >= FechaPrograma) Then
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoBruto").Value.ToString)) Then
- ContadorIngreso += Operaciones.ConvertirDecimal(dgvDividendos.Rows(i).Cells("IngresoBruto").Value.ToString)
- End If
- End If
- End If
- Catch ex As Exception
- End Try
- Next
- Return ContadorIngreso
- End Function
- Function CalcularIngresoNeto()
- Dim Cantidad = dgvDividendos.Rows.Count - 1
- Dim FechaActual = Date.Now.Date
- Dim ContadorIngreso As Double = 0.0
- For i As Integer = 0 To Cantidad
- Try
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)) Then
- Dim FechaPrograma As Date = Operaciones.ConvertirFecha(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
- If (FechaActual >= FechaPrograma) Then
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoNeto").Value.ToString)) Then
- ContadorIngreso += Operaciones.ConvertirDecimal(dgvDividendos.Rows(i).Cells("IngresoNeto").Value.ToString)
- End If
- End If
- End If
- Catch ex As Exception
- End Try
- Next
- Return ContadorIngreso
- End Function
- Function SumaComisiones()
- Dim ComisionCasaVenta As Double = Operaciones.ConvertirDecimal(txtComisionCasaVenta.Text.ToString)
- Dim ComisionBolsaVenta As Double = Operaciones.ConvertirDecimal(txtComisionBolsaVenta.Text.ToString)
- Dim Total As Double = 0.0
- Total = ComisionCasaVenta + ComisionBolsaVenta
- Return Total
- End Function
- Function CalcularComisionImpuestos(ByVal Comision As Double, ByVal ValorTransado As Double)
- Return Comision * ValorTransado
- End Function
- Private Sub PrepararTablaDividendos()
- 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.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Correlativo"
- oDataGridViewTextBoxColumn.DataPropertyName = "Correlativo"
- oDataGridViewTextBoxColumn.HeaderText = "Correlativo"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = True
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Fecha"
- oDataGridViewTextBoxColumn.DataPropertyName = "Fecha"
- oDataGridViewTextBoxColumn.HeaderText = "Fecha"
- oDataGridViewTextBoxColumn.Name = "Fecha"
- oDataGridViewTextBoxColumn.ValueType = GetType(Date)
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Name = "Dividendo"
- oDataGridViewTextBoxColumn.DataPropertyName = "Dividendo"
- oDataGridViewTextBoxColumn.HeaderText = "Dividendo"
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "CantidadBase"
- oDataGridViewTextBoxColumn.DataPropertyName = "CantidadBase"
- oDataGridViewTextBoxColumn.HeaderText = "Cantidad Base"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "IngresoBruto"
- oDataGridViewTextBoxColumn.DataPropertyName = "IngresoBruto"
- oDataGridViewTextBoxColumn.HeaderText = "Ingreso Bruto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- oDataGridViewTextBoxColumn.ReadOnly = True
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "PorcISR"
- oDataGridViewTextBoxColumn.DataPropertyName = "PorcISR"
- oDataGridViewTextBoxColumn.HeaderText = "% ISR"
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "ISR"
- oDataGridViewTextBoxColumn.DataPropertyName = "ISR"
- oDataGridViewTextBoxColumn.HeaderText = "ISR"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- oDataGridViewTextBoxColumn.ReadOnly = True
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "IngresoNeto"
- oDataGridViewTextBoxColumn.DataPropertyName = "IngresoNeto"
- oDataGridViewTextBoxColumn.HeaderText = "Ingreso Neto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- oDataGridViewTextBoxColumn.ReadOnly = True
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Estado"
- oDataGridViewTextBoxColumn.DataPropertyName = "Estado"
- oDataGridViewTextBoxColumn.HeaderText = "Estado"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "FechaInicio"
- oDataGridViewTextBoxColumn.DataPropertyName = "FechaInicio"
- oDataGridViewTextBoxColumn.HeaderText = "FechaInicio"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "FechaCorte"
- oDataGridViewTextBoxColumn.DataPropertyName = "FechaCorte"
- oDataGridViewTextBoxColumn.HeaderText = "FechaCorte"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "NumDiv"
- oDataGridViewTextBoxColumn.DataPropertyName = "NumDiv"
- oDataGridViewTextBoxColumn.HeaderText = "NuvDiv"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
- End Sub
- Private Function FechaDividendo()
- Dim Index = dgvDividendos.CurrentRow.Index
- Dim IndexAnterior = Index - 1
- Dim FechaInicial = dtpFechaOperacionCompra.Value
- Dim FechaActual = Operaciones.ConvertirFecha(dgvDividendos.Rows(Index).Cells("Fecha").Value)
- Dim FechaCalcul As Date = Date.Now.Date
- If (String.IsNullOrEmpty(FechaActual)) Then
- If (Index = 0) Then
- FechaCalcul = Operaciones.Meses(12, FechaInicial, FechaInicial)
- Else
- Dim Fecha = Operaciones.ConvertirFecha(dgvDividendos.Rows(IndexAnterior).Cells("Fecha").Value.ToString)
- FechaCalcul = Operaciones.Meses(12, Fecha, FechaInicial)
- End If
- Else
- FechaCalcul = FechaActual
- End If
- Return FechaCalcul
- End Function
- Private Sub PrepararCalculoDividendos(ByVal IdFila As Integer)
- Dim vFila As DataGridViewRow = dgvDividendos.Rows(IdFila)
- If (rdbEfectivo.Checked) Then
- If vFila.IsNewRow Then
- vFila.Cells("Fecha").Value = FechaDividendo()
- vFila.Cells("Dividendo").Value = oAccionesCE.FactorDeDividendo
- End If
- If rdbEfectivo.Checked Then
- vFila.Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtUnidadesCompra.Text.ToString)
- Else
- vFila.Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text)
- End If
- vFila.Cells("IngresoBruto").Value = 0.00
- vFila.Cells("PorcISR").Value = 0.05
- vFila.Cells("ISR").Value = 0.00
- vFila.Cells("IngresoNeto").Value = 0.00
- If dgvDividendos.Rows(IdFila).Cells("NumDiv").Value Is DBNull.Value Then
- dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
- Else
- If String.IsNullOrEmpty(dgvDividendos.Rows(IdFila).Cells("NumDiv").Value) Then
- dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
- End If
- End If
- Else
- If vFila.IsNewRow Then
- vFila.Cells("Fecha").Value = FechaDividendo()
- vFila.Cells("Dividendo").Value = oAccionesCE.FactorDeDividendo.ToString + "%"
- If (vFila.Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
- vFila.Cells("Dividendo").Value += "%"
- End If
- If rdbEfectivo.Checked Then
- vFila.Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtUnidadesCompra.Text.ToString)
- Else
- vFila.Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- End If
- vFila.Cells("IngresoBruto").Value = 0.00
- vFila.Cells("PorcISR").Value = 0.05
- vFila.Cells("ISR").Value = 0.00
- vFila.Cells("IngresoNeto").Value = 0.00
- If dgvDividendos.Rows(IdFila).Cells("NumDiv").Value Is DBNull.Value Then
- dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
- Else
- If String.IsNullOrEmpty(dgvDividendos.Rows(IdFila).Cells("NumDiv").Value) Then
- dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
- End If
- End If
- End If
- End If
- If (vFila.Cells("Fecha").Value Is DBNull.Value) Then
- vFila.Cells("Fecha").Value = FechaDividendo()
- Else
- If String.IsNullOrEmpty(vFila.Cells("Fecha").Value) Then
- vFila.Cells("Fecha").Value = FechaDividendo()
- End If
- End If
- RefrescarValorControles()
- End Sub
- Sub AgregarFechaCO()
- dgvDividendos.CurrentRow.Cells("FechaInicio").Value = Operaciones.ConvertirFechaBaseDatos(Variables.FechaInicialCorte.ToString)
- dgvDividendos.CurrentRow.Cells("FechaCorte").Value = Operaciones.ConvertirFechaBaseDatos(Variables.FechaCorteCorte.ToString)
- End Sub
- Function CalculoIngresoBrutoEfectivo(ByVal CantidadUnidades As Double, ByVal Dividendo As Double)
- Dim Total = CantidadUnidades * (Dividendo)
- Return Total
- End Function
- Function CalculoIngresoBrutoPorcentaje(ByVal ValorTransado As Double, ByVal Dividendo As Double, ByVal Dias As Integer, ByVal Fecha As Date)
- Dim Total As Double = 0
- If (Operaciones.AñoBisiesto(Fecha) = 364) Then
- Total = (ValorTransado * (Dividendo / 100) * Dias) / 365
- End If
- If (Operaciones.AñoBisiesto(Fecha) = 365) Then
- Total = (ValorTransado * (Dividendo / 100) * Dias) / 366
- End If
- Return Total
- End Function
- Private Sub dgvDividendos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvDividendos.CellBeginEdit
- PrepararCalculoDividendos(e.RowIndex)
- End Sub
- Private Sub dgvDividendos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellEndEdit
- CalcularDividendos()
- RefrescarValorControles()
- End Sub
- Private Sub dgvDividendos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvDividendos.UserDeletedRow
- End Sub
- Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
- End Sub
- Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
- oAccionesCE.ImpuestosYComisiones.AcceptChanges()
- End Sub
- Private Sub dgvImpuestosYComisiones_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub dgvDividendos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellContentClick
- End Sub
- Private Sub TabPage2_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtImpuestosYComisionesCompra_TextChanged(sender As Object, e As EventArgs) Handles txtImpuestosYComisionesCompra.TextChanged
- End Sub
- Private Sub TOperacion(ByVal TOperacion As String)
- If (TOperacion = "N") Then
- HabilitarBotones()
- ElseIf (TOperacion = "B") Then
- DeshabilitarBotones()
- End If
- End Sub
- Sub HabilitarBotones()
- txtUnidadesCompra.Enabled = True
- txtUnidadesVenta.Enabled = True
- End Sub
- Sub DeshabilitarBotones()
- txtDiasDeTenenciaCompra.Enabled = False
- txtDiasDeTenenciaVenta.Enabled = False
- txtGananciaCapitalTotalCompra.Enabled = False
- txtGananciaCapitalTotalVenta.Enabled = False
- txtGananciaCapitalUnitarioCompra.Enabled = False
- txtGananciaCapitalUnitarioVenta.Enabled = False
- txtRetornoAnualBrutoCompra.Enabled = False
- txtRetornoAnualBrutoVenta.Enabled = False
- txtRetornoAnualNetoCompra.Enabled = False
- txtRetornoAnualNetoVenta.Enabled = False
- txtUnidadesCompra.Enabled = False
- txtUnidadesVenta.Enabled = False
- txtValorTransadoCompra.Enabled = False
- txtValorTransadoVenta.Enabled = False
- txtImpuestosYComisionesCompra.Enabled = False
- txtImpuestosYComisionesVenta.Enabled = False
- txtMontoNetoCompra.Enabled = False
- txtMontoNetoVenta.Enabled = False
- txtPrecioSucioCompra.Enabled = False
- txtPrecioSucioVenta.Enabled = False
- End Sub
- Private Sub dtgcomisiones_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub TabPage4_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dtgcomisiones_CellContentClick_1(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- Estado = "N"
- btnAceptar.Text = "Nuevo"
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- Estado = "M"
- btnAceptar.Text = "Modificar"
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- If (Estado = "N") Then
- NuevaAccion()
- End If
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- Estado = "B"
- btnAceptar.Text = "Eliminar"
- End Sub
- Private Sub btnAgregar_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvDividendos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellClick
- ModificarFechaCorte()
- PrepararCalculoDividendos(e.RowIndex)
- End Sub
- Sub ModificarFechaCorte()
- If rdbPorcentaje.Checked Then
- Dim Index As Integer = dgvDividendos.CurrentRow.Index
- If dgvDividendos.Rows(Index).Cells("Fecha").ColumnIndex = dgvDividendos.CurrentCell.ColumnIndex Then
- Dim FechaReferencia = Operaciones.ConvertirFecha(dgvDividendos.Rows(Index).Cells("Fecha").Value)
- If (Not String.IsNullOrEmpty(FechaReferencia)) Then
- Dim año = FechaReferencia.Year
- Dim PrimeraFecha, SegundaFecha
- If (dgvDividendos.Rows(Index).Cells("FechaInicio").Value Is Nothing) Then
- PrimeraFecha = Operaciones.ConvertirFecha("1/1/" + año.ToString)
- ElseIf (dgvDividendos.Rows(Index).Cells("FechaInicio").Value Is DBNull.Value) Then
- PrimeraFecha = Operaciones.ConvertirFecha("1/1/" + año.ToString)
- Else
- PrimeraFecha = Operaciones.ConvertirFecha(dgvDividendos.Rows(Index).Cells("FechaInicio").Value)
- End If
- If (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is Nothing) Then
- SegundaFecha = Operaciones.ConvertirFecha("31/12/" + año.ToString)
- ElseIf (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is DBNull.Value) Then
- SegundaFecha = Operaciones.ConvertirFecha("31/12/" + año.ToString)
- Else
- SegundaFecha = dgvDividendos.Rows(Index).Cells("FechaCorte").Value
- End If
- Variables.FechaInicial = PrimeraFecha
- Variables.FechaCorte = SegundaFecha
- Variables.CorrelativoACC = dgvDividendos.Rows(Index).Cells("NumDiv").Value
- frmFechasAcciones.Show()
- End If
- Cierre = True
- End If
- End If
- End Sub
- Private Sub txtComisionPorcentajeCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaCompra.TextChanged
- RefrescarValorControles()
- End Sub
- Private Sub txtComisionPorcentajeBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaCompra.TextChanged
- RefrescarValorControles()
- End Sub
- Private Sub txtComisionPorcentajeCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaVenta.TextChanged
- RefrescarValorControles()
- End Sub
- Private Sub txtComisionPorcentajeBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaVenta.TextChanged
- RefrescarValorControles()
- End Sub
- Private Sub txtMontoNetoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtMontoNetoCompra.TextChanged
- End Sub
- Private Sub btnAgregarImpuesto_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub btnQuitar_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvImpuestoAgregado_CellClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
- End Sub
- Sub ValidarRentaIOF()
- If (ChkIOF.Checked) Then
- CalculosIOF()
- Else
- BloquearIOF()
- End If
- RefrescarValorControles()
- If (ChkRenta.Checked) Then
- CalculosRenta()
- Else
- BloquearRenta()
- End If
- RefrescarValorControles()
- End Sub
- Private Sub ChkIOF_CheckedChanged(sender As Object, e As EventArgs) Handles ChkIOF.CheckedChanged
- If (ChkIOF.Checked) Then
- oAccionesCE.IOF = 1
- CalculosIOF()
- Else
- oAccionesCE.IOF = 0
- BloquearIOF()
- End If
- RefrescarValorControles()
- End Sub
- Sub BloquearIOF()
- lblCompra1.Visible = False
- lblVenta1.Visible = False
- txtIOFCompra.Text = String.Empty
- txtIOFCompra.Visible = False
- txtIOFVenta.Text = String.Empty
- txtIOFVenta.Visible = False
- End Sub
- Sub CalculosIOF()
- If (Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) And Not String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
- lblCompra1.Visible = True
- lblVenta1.Visible = True
- txtIOFCompra.Visible = True
- txtIOFVenta.Visible = True
- Dim ValorTransadoCompra = txtValorTransadoCompra.Text
- Dim ValorTransadoVenta = txtValorTransadoVenta.Text
- txtIOFCompra.Text = CalculoImpuestos(ValorTransadoCompra, 0.0025)
- txtIOFVenta.Text = CalculoImpuestos(ValorTransadoVenta, 0.0025)
- End If
- End Sub
- Private Sub ChkRenta_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRenta.CheckedChanged
- If (ChkRenta.Checked) Then
- oAccionesCE.Renta = 1
- CalculosRenta()
- Else
- oAccionesCE.Renta = 0
- BloquearRenta()
- End If
- RefrescarValorControles()
- End Sub
- Sub CalculosRenta()
- If (Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) And Not String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
- lblCompra2.Visible = True
- lblVenta2.Visible = True
- txtRentaVenta.Visible = True
- txtRentaCompra.Visible = True
- Dim ValorTransadoCompra = txtValorTransadoCompra.Text
- Dim ValorTransadoVenta = txtValorTransadoVenta.Text
- txtRentaCompra.Text = CalculoImpuestos(ValorTransadoCompra, 0.1)
- txtRentaVenta.Text = CalculoImpuestos(ValorTransadoVenta, 0.1)
- End If
- End Sub
- Sub BloquearRenta()
- lblCompra2.Visible = False
- lblVenta2.Visible = False
- txtRentaCompra.Text = String.Empty
- txtRentaCompra.Visible = False
- txtRentaVenta.Text = String.Empty
- txtRentaVenta.Visible = False
- End Sub
- Function CalculoImpuestos(ByVal ValorTransado As Double, ByVal Impuesto As Double)
- Dim Valor = ValorTransado * Impuesto
- Return Valor
- End Function
- Private Sub rdbEfectivo_CheckedChanged(sender As Object, e As EventArgs) Handles rdbEfectivo.CheckedChanged
- If (rdbEfectivo.Checked) Then
- LimpiarDividendosCambios(1)
- Else
- LimpiarDividendosCambios(2)
- End If
- CambiarBase()
- CambioCalculo = True
- CambioCalculo = False
- If (Cargado) Then
- RefrescarValorControles()
- End If
- End Sub
- Private Sub rdbPorcentaje_CheckedChanged(sender As Object, e As EventArgs) Handles rdbPorcentaje.CheckedChanged
- If (rdbEfectivo.Checked) Then
- LimpiarDividendosCambios(1)
- Else
- LimpiarDividendosCambios(2)
- End If
- CambiarBase()
- CambioCalculo = True
- CambioCalculo = False
- If (Cargado) Then
- RefrescarValorControles()
- End If
- End Sub
- Sub CambiarBase()
- Dim Cantidad As Integer = dgvDividendos.Rows.Count - 1
- For i As Integer = 0 To Cantidad
- If (dgvDividendos.Rows(i).Cells("NumDiv").Value Is DBNull.Value) Then
- Exit For
- Else
- If String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("NumDiv").Value) Then
- Exit For
- End If
- End If
- If rdbEfectivo.Checked Then
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtUnidadesCompra.Text.ToString)
- Else
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- End If
- Next
- CalcularDividendos()
- End Sub
- Private Sub dgvDividendos_Click(sender As Object, e As EventArgs) Handles dgvDividendos.Click
- End Sub
- Sub ClonarDatos()
- If (String.IsNullOrEmpty(txtUnidadesVenta.Text.ToString)) Then
- txtUnidadesVenta.Text = txtUnidadesCompra.Text
- End If
- End Sub
- Private Sub txtUnidadesCompra_Leave(sender As Object, e As EventArgs) Handles txtUnidadesCompra.Leave
- ClonarDatos()
- Formato()
- End Sub
- Private Sub rdbEfectivo_Click(sender As Object, e As EventArgs) Handles rdbEfectivo.Click
- End Sub
- Private Sub dgvDividendos_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellDoubleClick
- End Sub
- Private Sub txtPrecioLimpioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioLimpioCompra.KeyPress
- If String.IsNullOrEmpty(txtPrecioLimpioCompra.Text) Then
- If e.KeyChar = "." Then
- txtPrecioLimpioCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioLimpioCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtPrecioLimpioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioLimpioVenta.KeyPress
- If String.IsNullOrEmpty(txtPrecioLimpioVenta.Text) Then
- If e.KeyChar = "." Then
- txtPrecioLimpioVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioLimpioVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtUnidadesCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtUnidadesCompra.KeyPress
- If String.IsNullOrEmpty(txtUnidadesCompra.Text) Then
- If e.KeyChar = "." Then
- txtUnidadesCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtUnidadesCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtUnidadesVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtUnidadesVenta.KeyPress
- If String.IsNullOrEmpty(txtUnidadesVenta.Text) Then
- If e.KeyChar = "." Then
- txtUnidadesVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtUnidadesVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtComisionPorcentajeCasaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeCasaCompra.KeyPress
- If String.IsNullOrEmpty(txtComisionPorcentajeCasaCompra.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorcentajeCasaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorcentajeCasaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtComisionPorcentajeBolsaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeBolsaCompra.KeyPress
- If String.IsNullOrEmpty(txtComisionPorcentajeBolsaCompra.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorcentajeBolsaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorcentajeBolsaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtComisionPorcentajeCasaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeCasaVenta.KeyPress
- If String.IsNullOrEmpty(txtComisionPorcentajeCasaVenta.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorcentajeCasaVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorcentajeCasaVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtComisionPorcentajeBolsaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeBolsaVenta.KeyPress
- If String.IsNullOrEmpty(txtComisionPorcentajeBolsaVenta.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorcentajeBolsaVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorcentajeBolsaVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
- End Sub
- Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
- End Sub
- Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TbOperacion.Click
- End Sub
- Private Sub txtGananciaCapitalTotalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalTotalVenta.TextChanged
- End Sub
- Private Sub txtDiasDeTenenciaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasDeTenenciaVenta.TextChanged
- End Sub
- Private Sub Label9_Click(sender As Object, e As EventArgs) Handles Label9.Click
- End Sub
- Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
- End Sub
- Private Sub txtIOFCompra_TextChanged(sender As Object, e As EventArgs) Handles txtIOFCompra.TextChanged
- End Sub
- Private Sub txtRentaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtRentaCompra.TextChanged
- End Sub
- Private Sub CalcularDividendos()
- Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
- For i As Integer = 0 To Cantidad
- If (String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Dividendo").Value)) Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value = 0
- End If
- If rdbEfectivo.Checked Then
- If (String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Dividendo").Value)) Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value = 0
- End If
- End If
- Dim Dividendos As Double = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.Trim("%")
- Dim Porcentaje As Double = dgvDividendos.Rows(i).Cells("PorcISR").Value
- Dim Valor = dgvDividendos.Rows(i).Cells("CantidadBase").Value
- If rdbEfectivo.Checked Then
- Dim CalculoIB = CalculoIngresoBrutoEfectivo(Valor, Dividendos)
- Dim CalculoRenta = CalculoIB * Porcentaje
- Dim CalculoIN = CalculoIB - CalculoRenta
- dgvDividendos.Rows(i).Cells("IngresoBruto").Value = CalculoIB
- dgvDividendos.Rows(i).Cells("ISR").Value = CalculoRenta
- dgvDividendos.Rows(i).Cells("IngresoNeto").Value = CalculoIN
- Else
- If (dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString + "%"
- End If
- Dim Dias As Integer = 0
- Dim FechaInicialCorte As Date = Date.Now.Date
- Dim FechaCorteCorte As Date = Date.Now.Date
- If (dgvDividendos.Rows(i).Cells("FechaInicio").Value IsNot DBNull.Value And dgvDividendos.Rows(i).Cells("FechaCorte").Value IsNot DBNull.Value) Then
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("FechaInicio").Value) And Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("FechaCorte").Value)) Then
- FechaInicialCorte = dgvDividendos.Rows(i).Cells("FechaInicio").Value
- FechaCorteCorte = dgvDividendos.Rows(i).Cells("FechaCorte").Value
- Dias = DateDiff(DateInterval.Day, FechaInicialCorte, FechaCorteCorte)
- Dias += 1
- Dim CalculoIBP = CalculoIngresoBrutoPorcentaje(Valor, Dividendos, Dias, FechaInicialCorte)
- Dim CalculoRenta = CalculoIBP * Porcentaje
- Dim CalculoIN = CalculoIBP - CalculoRenta
- dgvDividendos.Rows(i).Cells("IngresoBruto").Value = CalculoIBP
- dgvDividendos.Rows(i).Cells("ISR").Value = CalculoRenta
- dgvDividendos.Rows(i).Cells("IngresoNeto").Value = CalculoIN
- End If
- End If
- End If
- Next
- CorrelativoSinBD()
- End Sub
- Public Sub btnActualizar_Click(sender As Object, e As EventArgs) Handles btnActualizar.Click
- AgregarFechaCO()
- CalcularDividendos()
- End Sub
- Private Sub TabPage3_Click(sender As Object, e As EventArgs) Handles TbDividendos.Click
- End Sub
- Sub LimpiarDividendosCambios(ByVal Calculo As Integer)
- Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
- For i As Integer = 0 To Cantidad
- If (Calculo = 1) Then
- If (Not dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.ToString.Trim("%")
- End If
- Else
- If (dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
- dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString + "%"
- End If
- End If
- dgvDividendos.Rows(i).Cells("IngresoBruto").Value = 0
- dgvDividendos.Rows(i).Cells("ISR").Value = 0
- dgvDividendos.Rows(i).Cells("IngresoNeto").Value = 0
- Next
- End Sub
- Sub CargarDividendos()
- Dim Codigo As String = Variables.Codigo
- Dim dr = oAccionesDAO.CargarDividendo(Codigo)
- While dr.Read
- dgvDividendos.Rows.Add("", "", dr("Fecha"), dr("Dividendo"), dr("CantidadBase"), dr("IngresoBruto"), dr("PorcISR"), dr("ISR"), dr("IngresoNeto"), "", dr("FechaInicio"), dr("FechaCorte"), dr("NumDiv"))
- End While
- End Sub
- Private Sub btnGenerarAccion_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvDividendos_CellMouseMove(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvDividendos.CellMouseMove
- If Cierre Then
- AgregarFechaCO()
- CalcularDividendos()
- Cierre = False
- End If
- End Sub
- Private Sub dgvDividendos_MouseMove(sender As Object, e As MouseEventArgs) Handles dgvDividendos.MouseMove
- If Cierre Then
- AgregarFechaCO()
- CalcularDividendos()
- Cierre = False
- End If
- End Sub
- Private Sub btnQuitar_Click_1(sender As Object, e As EventArgs) Handles btnQuitar.Click
- QuitarFila()
- CorrelativoSinBD()
- End Sub
- Sub QuitarFila()
- Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
- ' Test result.
- Dim codigo As String = Variables.Codigo
- Dim Numero As Integer = dgvDividendos.CurrentRow.Cells("NumDiv").Value
- If result = MsgBoxResult.Ok Then
- Try
- dgvDividendos.Rows.Remove(dgvDividendos.CurrentRow)
- oAccionesDAO.EliminarElemenoInd(codigo, Numero)
- Catch ex As Exception
- MsgBox("No ha seleccionado una fila")
- End Try
- End If
- End Sub
- Private Sub txtPrecioSucioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioVenta.TextChanged
- End Sub
- Private Sub txtPrecioLimpioCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorcentajeCasaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaCompra.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorcentajeBolsaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaCompra.Leave
- Formato()
- End Sub
- Private Sub txtPrecioLimpioVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.Leave
- Formato()
- End Sub
- Private Sub txtUnidadesVenta_Leave(sender As Object, e As EventArgs) Handles txtUnidadesVenta.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorcentajeCasaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaVenta.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorcentajeBolsaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaVenta.Leave
- Formato()
- End Sub
- Private Sub frmAcciones_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
- Redimencionar()
- End Sub
- Private Sub txtPrecioLimpioCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioLimpioCompra.KeyUp
- If txtPrecioLimpioCompra.Text = "." Then
- txtPrecioLimpioCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtUnidadesCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtUnidadesCompra.KeyUp
- If txtUnidadesCompra.Text = "." Then
- txtUnidadesCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorcentajeCasaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeCasaCompra.KeyUp
- If txtComisionPorcentajeCasaCompra.Text = "." Then
- txtComisionPorcentajeCasaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorcentajeBolsaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeBolsaCompra.KeyUp
- If txtComisionPorcentajeBolsaCompra.Text = "." Then
- txtComisionPorcentajeBolsaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioLimpioVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioLimpioVenta.KeyUp
- If txtPrecioLimpioVenta.Text = "." Then
- txtPrecioLimpioVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtUnidadesVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtUnidadesVenta.KeyUp
- If txtUnidadesVenta.Text = "." Then
- txtUnidadesVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorcentajeCasaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeCasaVenta.KeyUp
- If txtComisionPorcentajeCasaVenta.Text = "." Then
- txtComisionPorcentajeCasaVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorcentajeBolsaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeBolsaVenta.KeyUp
- If txtComisionPorcentajeBolsaVenta.Text = "." Then
- txtComisionPorcentajeBolsaVenta.Text = ".0"
- End If
- End Sub
- Private Sub btnVenta_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtValorTransadoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoCompra.TextChanged
- End Sub
- Private Sub btnVenderTitulo_Click(sender As Object, e As EventArgs) Handles btnVenderTitulo.Click
- If Variables.InvocadorProInv = "frmINV" Then
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- Dim General As New DAOGeneral
- Dim Codigo = Variables.Codigo
- Dim Tabla As String = "INV0"
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- TrasladarDatos = RellenarDatosCMVTA()
- If Existe Then
- Dim CodigoInversion As String = Variables.Codigo
- Dim frmPINVCMVTA As New frmPIN("V", CodigoInversion, TrasladarDatos)
- frmINV.Close()
- Me.Close()
- frmPINVCMVTA.ShowDialog()
- End If
- End If
- End Sub
- Function RellenarDatosCMVTA()
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- TrasladarDatos.FechaOperacionACC = Operaciones.ConvertirFecha(dtpFechaOperacionCompra.Value.ToString)
- TrasladarDatos.FechaVencimientoACC = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
- TrasladarDatos.PrecioLimpioACC = Operaciones.ConvertirDecimal(txtPrecioLimpioCompra.Text.ToString)
- TrasladarDatos.UnidadesACC = Operaciones.ConvertirEntero(txtUnidadesCompra.Text.ToString)
- TrasladarDatos.PorcentajeBolsaACC = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaCompra.Text.ToString)
- TrasladarDatos.PorcentajeCasaACC = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaCompra.Text.ToString)
- TrasladarDatos.NombreInstrumento = "ACC"
- TrasladarDatos.AgregarCMVTA = True
- Return TrasladarDatos
- End Function
- Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
- End Sub
- Private Sub txtMontoNetoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtMontoNetoVenta.TextChanged
- End Sub
- Private Sub txtComisionCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaCompra.TextChanged
- End Sub
- Private Sub txtComisionCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaVenta.TextChanged
- End Sub
- End Class
|