| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492 |
-
- 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 PorcentajeComisionBolsa_Compra As Double = 0.070625
- Dim PorcentajeComisionBolsa_Venta As Double = 0.0353125
- Dim Cargar As Boolean = True
- Dim PorcentajeComisionCasa_Compra As Double = 0.45
- Dim PorcentajeComisionCasa_Venta As Double = 0.4
- Dim Agregar As Boolean = False
- Dim PorcentajeLIOF As Double = 0.25
- 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 EditarDividendos As Boolean = False
- Dim EditarISR As Boolean = False
- Dim CambioCalculo = False
- Dim HabilitarBoton As Boolean = False
- Dim DobleClick As Boolean = False
- Dim Operaciones As New Operaciones
- Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
- 'Dim oAccionesNEG As New AccionesNEG
- Dim Cargado As Boolean = False
- Dim Cierre As Boolean = False
- Dim DatosCargados As Boolean = False
- 'Dim dtImpuestosYComisiones As DataTable
- 'Dim dtDividendos As DataTable
- Private _Modo As String
- 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, RetAnBrC, 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, RetornoNeto
- Dim ComisionCompraCasaValor, ComisionCompraBolsaValor, ComisionVentaCasaValor, ComisionVentaBolsaValor As Double
- PrecioLimpioC = txtPrecioLimpioCompra.Text.Trim("%")
- FOperC = dtpFechaOperacionCompra.Value
- FLiqC = dtpFechaVencimientoCompra.Value
- DiasTC = txtDiasDeTenenciaCompra.Text.Trim("%")
- GCapTotC = txtGananciaCapitalTotalCompra.Text.Trim("%")
- GCapUnC = txtGananciaCapitalUnitarioCompra.Text.Trim("%")
- RetAnNetC = txtRetornoAnualNetoCompra.Text.Trim("%")
- UnC = txtUnidadesCompra.Text.Trim("%")
- ValTransC = txtValorTransadoCompra.Text.Trim("%")
- MontoNetoC = txtMontoNetoCompra.Text.Trim("%")
- PrecSucioC = txtPrecioSucioCompra.Text.Trim("%")
- PrecioLimpioV = txtPrecioLimpioVenta.Text.Trim("%")
- FOperV = dtpFechaOperacionVenta.Value
- FLiqV = dtpFechaVencimientoVenta.Value
- DiasTV = txtDiasDeTenenciaVenta.Text.Trim("%")
- GCapTotV = txtGananciaCapitalTotalVenta.Text.Trim("%")
- GCapUnV = txtGananciaCapitalUnitarioVenta.Text.Trim("%")
- RetAnBrV = txtRetornoAnualBrutoVenta.Text.Trim("%")
- RetAnNetV = txtRetornoAnualNetoVenta.Text.Trim("%")
- UnV = txtUnidadesVenta.Text.Trim("%")
- ValTransV = txtValorTransadoVenta.Text.Trim("%")
- MontoNetoV = txtMontoNetoVenta.Text.Trim("%")
- PrecSucioV = txtPrecioSucioVenta.Text.Trim("%")
- ComisionCompraCasa = txtComisionPorcentajeCasaCompra.Text.Trim("%") / 100
- ComisionCompraBolsa = txtComisionPorcentajeBolsaCompra.Text.Trim("%") / 100
- ComisionVentaCasa = txtComisionPorcentajeCasaVenta.Text.Trim("%") / 100
- ComisionVentaBolsa = txtComisionPorcentajeBolsaVenta.Text.Trim("%") / 100
- ComisionCompraCasaValor = txtComisionCasaCompra.Text
- ComisionCompraBolsaValor = txtComisionBolsaCompra.Text
- ComisionVentaCasaValor = txtComisionCasaVenta.Text
- ComisionVentaBolsaValor = txtComisionBolsaVenta.Text
- If (Not String.IsNullOrEmpty(txtRetornoAnualBrutoCompra.Text.ToString.ToString.Trim("%"))) Then
- RetornoBruto = txtRetornoAnualBrutoCompra.Text.Trim("%") / 100
- Else
- RetornoBruto = 0
- End If
- 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 = CDate(dgvDividendos.Rows(Index).Cells("Fecha").Value)
- Dividendo = dgvDividendos.Rows(Index).Cells("Dividendo").Value.ToString.Trim("%")
- If (Tipo = "Porcentaje") Then
- Dividendo /= 100
- End If
- CantidadBase = dgvDividendos.Rows(Index).Cells("CantidadBase").Value.ToString.TrimEnd("%")
- IngresoBruto = dgvDividendos.Rows(Index).Cells("IngresoBruto").Value.ToString.TrimEnd("%")
- PorcISR = dgvDividendos.Rows(Index).Cells("PorcISR").Value.ToString.TrimEnd("%")
- ISR = dgvDividendos.Rows(Index).Cells("ISR").Value.ToString.TrimEnd("%")
- IngresoNeto = dgvDividendos.Rows(Index).Cells("IngresoNeto").Value.ToString.TrimEnd("%")
- Estado = "A"
- Correlativo = dgvDividendos.Rows(Index).Cells("NumDiv").Value.ToString.TrimEnd("%")
- FechaInicio = dgvDividendos.Rows(Index).Cells("FechaInicio").Value
- FechaCorte = dgvDividendos.Rows(Index).Cells("FechaCorte").Value
- If (Tipo = "Porcentaje") Then
- If FechaInicio Is DBNull.Value Or FechaCorte Is DBNull.Value Then
- MsgBox("Verifique las fechas")
- Exit Function
- Else
- If (String.IsNullOrEmpty(FechaInicio) Or String.IsNullOrEmpty(FechaCorte)) Then
- MsgBox("Verifique las fechas")
- Exit Function
- End If
- End If
- End If
- coleccion.Add(Fecha)
- coleccion.Add(CDec(Dividendo))
- coleccion.Add(CDec(CantidadBase))
- coleccion.Add(CDec(IngresoBruto))
- coleccion.Add(CDec(PorcISR))
- coleccion.Add(CDec(ISR))
- coleccion.Add(CDec(IngresoNeto))
- coleccion.Add(Estado)
- coleccion.Add(CInt(Correlativo))
- coleccion.Add(FechaInicio)
- coleccion.Add(FechaCorte)
- Return coleccion
- End Function
- Sub NuevoElementoAccion(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer)
- Dim Codigo As String = Variables.Codigo
- Dim i As Integer = 0
- Dim Index = dgvDividendos.Rows.Count - 2
- i = Cantidad
- While i <= Index
- Dim coleccion = ColeccionesElementos(i)
- If (oAccionesDAO.NuevoElementoAccion(Codigo, coleccion) Is Nothing) Then
- Exit Sub
- End If
- i += 1
- End While
- MsgBox("Registro de ingresos actualizados")
- End Sub
- Function CanRegistros()
- Dim Tabla As String = String.Empty
- Tabla = "ACC1"
- Dim Codigo = Variables.Codigo
- Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
- Return Cantidad
- End Function
- Sub ModificarElementoAccion()
- Dim i As Integer = 0
- Dim CantidadRegistrosDB = CanRegistros()
- While i < CantidadRegistrosDB
- Dim coleccion = ColeccionesElementos(i)
- If oAccionesDAO.ModificarElementoAccion(Codigo, coleccion) Is Nothing Then
- Exit Sub
- End If
- i += 1
- End While
- NuevoElementoAccion(True, CantidadRegistrosDB)
- End Sub
- 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()
- 'Dim Codigo = Variables.Codigo
- 'oAccionesDAO.NuevaAccion(Codigo, Coleccion)
- Return Coleccion
- End Function
- Public Function NuevaAccionConsulta()
- Dim Coleccion = ColeccionDatos()
- Dim Codigo = Variables.Codigo
- oAccionesDAO.NuevaAccion(Codigo, Coleccion)
- Return Coleccion
- End Function
- Sub ModificarAccion()
- Dim Coleccion = ColeccionDatos()
- Dim Codigo = Variables.Codigo
- oAccionesDAO.ModificarAccion(Codigo, Coleccion)
- End Sub
- Sub Eliminar()
- Dim Codigo = Variables.Codigo
- oAccionesDAO.Eliminar(Codigo)
- End Sub
- 'Sub EliminrElementoAccion()
- ' Dim Codigo = Variables.Codigo
- ' 'oAccionesDAO.EliminarElemeno(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
- CargarTransladoNuevo()
- 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 = Variables.TrasladarCMVTA.FechaOperacionACC
- dtpFechaVencimientoCompra.Value = Variables.TrasladarCMVTA.FechaVencimientoACC
- txtPrecioLimpioCompra.Text = Variables.TrasladarCMVTA.PrecioLimpioACC
- txtUnidadesCompra.Text = Variables.TrasladarCMVTA.UnidadesACC
- txtComisionPorcentajeCasaCompra.Text = Variables.TrasladarCMVTA.PorcentajeCasaACC
- txtComisionPorcentajeBolsaCompra.Text = Variables.TrasladarCMVTA.PorcentajeBolsaACC
- 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
- Function ExisteVenta()
- Dim Ventas As Boolean = False
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Ventas = General.ExisteVenta(Codigo)
- Return Ventas
- 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
- 'LOAD
- 'Sub ActualizarDividendos()
- 'Dim vFactorDeDividendo = oAccionesCE.FactorDeDividendo
- 'Dim vFechaInicial = oAccionesCE.FechaLiquidacionCompra
- 'Dim vFechaLiquidacionVenta = oAccionesCE.FechaLiquidacionVenta
- 'Dim vUnidadesVenta = oAccionesCE.CantidadVenta
- 'Dim vAccionPreferente = oAccionesCE.AccionPreferente
- 'Dim vValorTransadoCompra = oAccionesCE.ValorTransadoCompra
- 'Dim Periodos As Integer
- 'Dim Periodicidad As String = "A"
- 'Dim Filas As DataRow
- 'Dim FactorDidivendo As Double = vFactorDeDividendo
- 'Dim FechaInicial As Date = vFechaInicial
- 'Dim PorcentajeRenta As Double = 0.05
- 'Dim IngresoBruto As Double
- 'Dim Renta As Double
- 'Dim IngresoNeto As Double
- 'Dim SumaImgresoBruto As Double
- 'Dim SumaImgresoNeto As Double
- 'Dim Suma As Object
- 'If Periodicidad = "A" Then
- ' Periodos = DateDiff(DateInterval.Year, vFechaInicial, vFechaLiquidacionVenta)
- 'End If
- 'For i As Integer = 1 To Periodos
- 'If Periodicidad = "A" Then
- ' FechaInicial = FechaInicial.AddYears(1)
- 'End If
- ' IngresoBruto = FactorDidivendo * vUnidadesVenta
- 'If vAccionPreferente = "S" Then
- ' IngresoBruto = vValorTransadoCompra * FactorDidivendo
- 'End If
- ' Renta = IngresoBruto * PorcentajeRenta
- ' IngresoNeto = IngresoBruto - Renta
- ' Filas = dtDividendos.NewRow()
- ' Filas("Fecha") = FechaInicial
- ' Filas("Dividendo") = FactorDidivendo
- ' Filas("IngresoBruto") = IngresoBruto
- ' Filas("Renta") = Renta
- 'Filas("IngresoNeto") = IngresoNeto
- 'dtDividendos.Rows.Add(Filas)
- 'Next
- ' SumaImgresoBruto = Dividendos.Compute("SUM(IngresoBruto)", "").ToString
- ' Suma = dtDividendos.Compute("SUM(IngresoBruto)", "")
- 'If Suma IsNot DBNull.Value Then
- ' SumaImgresoBruto = Convert.ToDouble(Suma)
- 'End If
- ' SumaImgresoNeto = Dividendos.Compute("SUM(IngresoNeto)", "").ToString
- ' Suma = dtDividendos.Compute("SUM(IngresoNeto)", "")
- 'If Suma IsNot DBNull.Value Then
- ' SumaImgresoNeto = Convert.ToDouble(Suma)
- 'End If
- 'Me.txtIngresoBrutoDividendos_Venta.Text = SumaImgresoBruto.ToString
- 'Me.txtIngresoNetoDividendos_Venta.Text = SumaImgresoNeto.ToString
- 'Me.dgvDividendos.DataSource = dtDividendos
- ' RefrescarRetornoAnualBruto_Venta()
- ' RefrescarRetornoAnualNeto_Venta()
- 'End Sub
- Private Sub chkAccionPreferente_CheckedChanged(sender As Object, e As EventArgs)
- ControlChkAccionPreferente()
- 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)
- ''RefrescarClaseEntidad()
- 'ModificarElementoAccion()
- 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")
- 'ActualizarRegistro()
- 'ModificarAccion()
- 'ModificarElementoAccion()
- End If
- If Estado = "B" Then
- 'ActualizarRegistro()
- 'EliminarAccion()
- 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
- Private Sub RefrescarValores()
- 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
- Private Sub ControlChkBolsa()
- 'ActivarEdicion()
- End Sub
- Private Sub ControlChkAccionPreferente()
- 'ActivarEdicion()
- End Sub
- '********** FIN CONTROL DE VALORES **********
- '********** EVENTOS DE CONTROLES **********
- 'COMPRA
- Private Sub txtPrecioLimpioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.TextChanged
- 'ControlPrecioLimpioCompra()
- 'ActivarEdicion()
- 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
- 'ActivarEdicion()
- If DatosCargados Then
- ControlFechaOperacionCompra()
- RefrescarValorControles()
- Formato()
- End If
- End Sub
- Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
- 'ActivarEdicion()
- If DatosCargados Then
- ControlFechaLiquidacionCompra()
- RefrescarValorControles()
- Formato()
- End If
- End Sub
- Private Sub txtUnidadesCompra_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesCompra.TextChanged
- 'ActivarEdicion()
- 'ControlCantidadCompra()
- 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
- 'ActivarEdicion()
- 'ControlPrecioLimpioVenta()
- 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
- 'ActivarEdicion()
- If DatosCargados Then
- ControlFechaOperacionVenta()
- RefrescarValorControles()
- End If
- End Sub
- Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
- 'ActivarEdicion()
- If DatosCargados Then
- ControlFechaLiquidacionVenta()
- RefrescarValorControles()
- End If
- End Sub
- Private Sub txtUnidadesVenta_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesVenta.TextChanged
- 'ActivarEdicion()
- 'ControlCantidadVenta()
- 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 (CDec(UnidadesVenta) > CDec(UnidadesCompra)) 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)
- ControlChkBolsa()
- End Sub
- '********** FIN EVENTOS DE CONTROLES **********
- '********** FUNCIONES **********
- Private Sub RefrescarClaseEntidad()
- ControlChkBolsa()
- ControlPrecioLimpioCompra()
- ControlFechaOperacionCompra()
- ControlFechaLiquidacionCompra()
- ControlCantidadCompra()
- ControlPrecioLimpioVenta()
- ControlFechaOperacionVenta()
- ControlFechaLiquidacionVenta()
- ControlCantidadVenta()
- 'RefrescarValorControles()
- End Sub
- Private Sub Formato()
- If DatosCargados Then
- If (String.IsNullOrEmpty(Me.txtRetornoAnualBrutoCompra.Text.ToString.Trim("%"))) Then
- Me.txtRetornoAnualBrutoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaCompra.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeCasaCompra.Text = "0.0%"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeBolsaCompra.Text = "0.0%"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaVenta.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeCasaVenta.Text = "0.0%"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeBolsaVenta.Text = "0.0%"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeBolsaCompra.Text = "0.0%"
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.Trim("%"))) Then
- Me.txtComisionPorcentajeBolsaVenta.Text = "0.0%"
- End If
- If String.IsNullOrEmpty(txtRetornoAnualBrutoVenta.Text.ToString) Then
- txtRetornoAnualBrutoVenta.Text = 0
- End If
- If String.IsNullOrEmpty(txtPrecioLimpioCompra.Text.ToString) Then
- txtPrecioLimpioCompra.Text = 0
- End If
- If String.IsNullOrEmpty(txtPrecioLimpioVenta.Text.ToString) Then
- txtPrecioLimpioVenta.Text = 0
- End If
- If String.IsNullOrEmpty(txtUnidadesCompra.Text.ToString) Then
- txtUnidadesCompra.Text = 0
- End If
- If String.IsNullOrEmpty(txtUnidadesVenta.Text.ToString) Then
- txtUnidadesVenta.Text = 0
- End If
- 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()
- ' ImpuestosCalculoCompra = CalcularComisionImpuestos(CDec(CalcularImpuesto()), CDec(txtValorTransadoCompra.Text))
- 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
- ' ImpuestosCalculoVenta = CalcularComisionImpuestos(CDec(CalcularImpuesto()), CDec(txtValorTransadoVenta.Text))
- 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
- If (String.IsNullOrEmpty(oAccionesCE.RetornoBruto.ToString())) Then
- Else
- Me.txtRetornoAnualBrutoCompra.Text = oAccionesCE.RetornoBruto * 100
- End If
- If String.IsNullOrEmpty(txtGananciaCapitalUnitarioVenta.Text) Then
- txtGananciaCapitalUnitarioVenta.Text = 0
- End If
- If String.IsNullOrEmpty(txtRetornoAnualNetoVenta.Text) Then
- txtRetornoAnualNetoVenta.Text = 0
- End If
- 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
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaCompra.Text.TrimEnd("%"))) Then
- If (String.IsNullOrEmpty(oAccionesCE.ComisionCompraCasa)) Then
- Else
- If Not oAccionesCE.ComisionCompraCasa = "0" Then
- Me.txtComisionPorcentajeCasaCompra.Text = CStr(oAccionesCE.ComisionCompraCasa * 100) + "%"
- End If
- End If
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%"))) Then
- If (String.IsNullOrEmpty(oAccionesCE.ComisionCompraBolsa)) Then
- Else
- If Not oAccionesCE.ComisionCompraBolsa = "0" Then
- Me.txtComisionPorcentajeBolsaCompra.Text = CStr(oAccionesCE.ComisionCompraBolsa * 100) + "%"
- End If
- End If
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaVenta.Text.TrimEnd("%"))) Then
- If (String.IsNullOrEmpty(oAccionesCE.ComisionVentaCasa)) Then
- End If
- If Not oAccionesCE.ComisionVentaCasa = "0" Then
- Me.txtComisionPorcentajeCasaVenta.Text = CStr(oAccionesCE.ComisionVentaCasa * 100) + "%"
- End If
- End If
- If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%"))) Then
- If (String.IsNullOrEmpty(oAccionesCE.ComisionVentaBolsa)) Then
- Else
- If Not oAccionesCE.ComisionVentaBolsa = "0" Then
- Me.txtComisionPorcentajeBolsaVenta.Text = CStr(oAccionesCE.ComisionVentaBolsa * 100) + "%"
- End If
- End If
- 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 (String.IsNullOrEmpty(oAccionesCE.PrecioLimpioCompra.ToString())) Then
- Else
- 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 (String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaCompra.ToString)) Then
- Else
- Me.txtDiasDeTenenciaCompra.Text = oAccionesCE.DiasDeTenenciaCompra.ToString
- End If
- If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalCompra.ToString)) Then
- Else
- Me.txtGananciaCapitalTotalCompra.Text = oAccionesCE.GananciaDeCapitalTotalCompra.ToString
- End If
- If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString)) Then
- Else
- Me.txtGananciaCapitalUnitarioCompra.Text = oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString
- End If
- If (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoCompra.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Else
- Me.txtRetornoAnualNetoCompra.Text = oAccionesCE.RetornoAnualizadoNetoCompra.ToString()
- End If
- If (String.IsNullOrEmpty(oAccionesCE.CantidadCompra.ToString)) Then
- Else
- If Not oAccionesCE.CantidadCompra.ToString = "0" Then
- Me.txtUnidadesCompra.Text = oAccionesCE.CantidadCompra.ToString
- End If
- End If
- If (String.IsNullOrEmpty(oAccionesCE.ValorTransadoCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Else
- Me.txtValorTransadoCompra.Text = oAccionesCE.ValorTransadoCompra.ToString()
- End If
- Dim ComisionCasaCompra As Double = 0
- Dim ComisionBolsaCompra As Double = 0
- Dim ValorTransadoCompra As Double = 0
- If String.IsNullOrEmpty(txtComisionPorcentajeCasaCompra.Text.TrimEnd("%")) Then
- ComisionCasaCompra = 0
- Else
- ComisionCasaCompra = txtComisionPorcentajeCasaCompra.Text.TrimEnd("%") / 100
- End If
- If String.IsNullOrEmpty(txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%")) Then
- ComisionBolsaCompra = 0
- Else
- ComisionBolsaCompra = txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%") / 100
- End If
- If Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) Then
- ValorTransadoCompra = txtValorTransadoCompra.Text
- End If
- Me.txtComisionCasaCompra.Text = CalcularComisionImpuestos(ComisionCasaCompra, txtValorTransadoCompra.Text)
- Me.txtComisionBolsaCompra.Text = CalcularComisionImpuestos(ComisionBolsaCompra, txtValorTransadoCompra.Text)
- ' ImpuestosCalculoCompra = CalcularComisionImpuestos(CDec(CalcularImpuesto()), CDec(txtValorTransadoCompra.Text))
- If (String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Else
- 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 (String.IsNullOrEmpty(oAccionesCE.PrecioSucioCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
- Else
- Me.txtPrecioSucioCompra.Text = oAccionesCE.PrecioSucioCompra.ToString()
- End If
- 'VENTA
- If (String.IsNullOrEmpty(oAccionesCE.PrecioLimpioVenta.ToString())) Then
- Else
- If Not oAccionesCE.PrecioLimpioVenta = 0 Then
- Me.txtPrecioLimpioVenta.Text = oAccionesCE.PrecioLimpioVenta.ToString()
- End If
- End If
- If (String.IsNullOrEmpty(oAccionesCE.FechaOperacionVenta)) Then
- Me.dtpFechaOperacionVenta.Value = Date.Now.Date
- Else
- Me.dtpFechaOperacionVenta.Value = oAccionesCE.FechaOperacionVenta
- End If
- If (String.IsNullOrEmpty(oAccionesCE.FechaVencimientoVenta)) Then
- Me.dtpFechaVencimientoVenta.Value = Date.Now.Date
- Else
- Me.dtpFechaVencimientoVenta.Value = oAccionesCE.FechaVencimientoVenta
- End If
- If (String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaVenta.ToString)) Then
- Else
- Me.txtDiasDeTenenciaVenta.Text = oAccionesCE.DiasDeTenenciaVenta.ToString
- End If
- If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalVenta.ToString(Configuraciones.CodigoTXTMontos))) Then
- Else
- Me.txtGananciaCapitalTotalVenta.Text = oAccionesCE.GananciaDeCapitalTotalVenta.ToString()
- End If
- If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString)) Then
- Else
- If Double.IsNaN(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString) Then
- Else
- 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 (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoBrutoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Else
- 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 (String.IsNullOrEmpty(Valor)) Then
- Else
- Me.txtRetornoAnualBrutoVenta.Text = CStr((CDec(Valor.ToString.Trim("%")) * 100)) + "%"
- End If
- End If
- End If
- End If
- If (rdbEfectivo.Checked) Then
- If (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
- Else
- 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 (String.IsNullOrEmpty(Valor)) Then
- Else
- Me.txtRetornoAnualNetoVenta.Text = CStr(CDec(txtRetornoAnualBrutoVenta.Text.Trim("%")) * (1 - Valor)) + "%"
- End If
- End If
- End If
- If (String.IsNullOrEmpty(oAccionesCE.CantidadVenta.ToString)) Then
- Else
- If Not oAccionesCE.CantidadVenta = 0 Then
- Me.txtUnidadesVenta.Text = oAccionesCE.CantidadVenta.ToString
- End If
- End If
- If (String.IsNullOrEmpty(oAccionesCE.ValorTransadoVenta.ToString())) Then
- Else
- Me.txtValorTransadoVenta.Text = oAccionesCE.ValorTransadoVenta.ToString()
- End If
- If (String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesVenta.ToString())) Then
- Else
- Me.txtImpuestosYComisionesVenta.Text = oAccionesCE.SumaImpuestosYComisionesVenta.ToString()
- End If
- Dim ComisionCasaVenta As Double = 0
- Dim ComisionBolsaVenta As Double = 0
- Dim ValorTransadoVenta As Double = 0
- If Not String.IsNullOrEmpty(txtComisionPorcentajeCasaVenta.Text.TrimEnd("%")) Then
- ComisionCasaVenta = txtComisionPorcentajeCasaVenta.Text.TrimEnd("%") / 100
- End If
- If Not String.IsNullOrEmpty(txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%")) Then
- ComisionBolsaVenta = txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%") / 100
- End If
- If Not String.IsNullOrEmpty(txtValorTransadoVenta.Text) Then
- ValorTransadoVenta = txtValorTransadoVenta.Text
- End If
- Me.txtComisionCasaVenta.Text = CalcularComisionImpuestos(ComisionCasaVenta, ValorTransadoVenta)
- Me.txtComisionBolsaVenta.Text = CalcularComisionImpuestos(ComisionBolsaVenta, ValorTransadoVenta)
- ' ImpuestosCalculoVenta = CalcularComisionImpuestos(CDec(CalcularImpuesto()), CDec(txtValorTransadoVenta.Text))
- 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
- If (String.IsNullOrEmpty(oAccionesCE.MontoNetoVenta.ToString())) Then
- Else
- Me.txtMontoNetoVenta.Text = CDec(oAccionesCE.MontoNetoVenta.ToString()) - CDec(txtComisionBolsaVenta.Text) - CDec(txtComisionCasaVenta.Text) - ValorIOFVenta - ValorRentaVenta
- End If
- If (String.IsNullOrEmpty(CDec(oAccionesCE.MontoNetoCompra.ToString(Configuraciones.CodigoTXTMontos)))) Or String.IsNullOrEmpty((CDec(txtComisionBolsaCompra.Text)) Or String.IsNullOrEmpty(CDec(txtComisionCasaCompra.Text)) Or String.IsNullOrEmpty(ValorIOFCompra) Or String.IsNullOrEmpty(ValorRentaCompra)) Then
- Else
- Me.txtMontoNetoCompra.Text = (CDec(oAccionesCE.MontoNetoCompra.ToString())) + (CDec(txtComisionBolsaCompra.Text) + CDec(txtComisionCasaCompra.Text) + ValorIOFCompra + ValorRentaCompra)
- End If
- 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 = CDate(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
- If (FechaActual >= FechaPrograma) Then
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoBruto").Value.ToString)) Then
- ContadorIngreso += CDec(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 = CDate(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
- If (FechaActual >= FechaPrograma) Then
- If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoNeto").Value.ToString)) Then
- ContadorIngreso += CDec(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 = txtComisionCasaVenta.Text
- Dim ComisionBolsaVenta As Double = txtComisionBolsaVenta.Text
- 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 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 = oAccionesCE.ImpuestosYComisiones
- End Sub
- 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 Sub GuardarRegistro()
- End Sub
- Private Sub ActualizarRegistro()
- Dim res As Integer
- RefrescarClaseEntidad()
- res = oAccionesDAO.Actualizar(oAccionesCE)
- If res > 0 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 Function FechaDividendo()
- Dim Index = dgvDividendos.CurrentRow.Index
- Dim IndexAnterior = Index - 1
- Dim FechaInicial = dtpFechaOperacionCompra.Value
- Dim FechaActual = 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 = dgvDividendos.Rows(IndexAnterior).Cells("Fecha").Value
- 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
- If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
- vFila.Cells("CantidadBase").Value = 0.0
- Else
- vFila.Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
- End If
- Else
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- vFila.Cells("CantidadBase").Value = 0.0
- Else
- vFila.Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
- End If
- 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
- If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
- vFila.Cells("CantidadBase").Value = 0.0
- Else
- vFila.Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
- End If
- Else
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- vFila.Cells("CantidadBase").Value = 0.0
- Else
- vFila.Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
- End If
- 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 = Variables.FechaInicialCorte
- dgvDividendos.CurrentRow.Cells("FechaCorte").Value = Variables.FechaCorteCorte
- 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
- Function RangoDias(ByVal Fecha As Date, ByVal FechaVen As Date)
- Dim Dias As Integer = DateDiff(DateInterval.Day, Fecha, FechaVen)
- Return Dias
- End Function
- Function CantidadDiasUtimo(ByVal Fecha As Date)
- Dim Año As Integer = Fecha.Year
- Dim FechaCorte As Date = CDate("31/12/" + Año.ToString)
- Dim Dias As Integer = DateDiff(DateInterval.Day, Fecha, FechaCorte)
- Return Dias
- End Function
- 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 = oAccionesCE.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 = oAccionesCE.ValorTransadoCompra
- ' vFila.Cells("MontoSujeto").Value = oAccionesCE.ValorTransadoCompra
- 'ElseIf vTipoOperacion = "V" Then
- ' vMontoSujeto = oAccionesCE.ValorTransadoVenta
- ' vFila.Cells("MontoSujeto").Value = oAccionesCE.ValorTransadoVenta
- 'Else
- ' vMontoSujeto = 0
- 'End If
- ' vMontoImpuesto = vMontoSujeto * vPorcentajeImpuesto
- ' vFila.Cells("MontoImp").Value = vMontoImpuesto
- 'End If
- ' RefrescarClaseEntidad()
- ' RefrescarValorControles()
- 'End Sub
- Private Sub dgvDividendos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvDividendos.CellBeginEdit
- 'ActivarEdicion()
- PrepararCalculoDividendos(e.RowIndex)
- End Sub
- Private Sub dgvDividendos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellEndEdit
- ' If (Not dgvDividendos.Rows(0).IsNewRow) Then
- ' If (DobleClick) Then
- ' DobleClick = False
- ' rdbEfectivo.Enabled = True
- ' rdbPorcentaje.Enabled = True
- ' TabControl1.TabPages.Insert(0, TabPage1)
- ' End If
- ' End If
- CalcularDividendos()
- RefrescarValorControles()
- End Sub
- Private Sub dgvDividendos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvDividendos.UserDeletedRow
- 'ActivarEdicion()
- ' oAccionesCE.Dividendos.AcceptChanges()
- End Sub
- 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()
- 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
- 'RefrescarClaseEntidad()
- NuevaAccion()
- End If
- If Estado = "M" Then
- 'ActualizarRegistro()
- 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 = 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 = CDate("1/1/" + año.ToString)
- ElseIf (dgvDividendos.Rows(Index).Cells("FechaInicio").Value Is DBNull.Value) Then
- PrimeraFecha = CDate("1/1/" + año.ToString)
- Else
- PrimeraFecha = dgvDividendos.Rows(Index).Cells("FechaInicio").Value
- End If
- If (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is Nothing) Then
- SegundaFecha = CDate("31/12/" + año.ToString)
- ElseIf (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is DBNull.Value) Then
- SegundaFecha = CDate("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)
- ' GuardarImpuesto()
- End Sub
- 'Private Sub PrepararTablaImpuestos()
- ' Dim cboColumna As DataGridViewComboBoxColumn
- ' cboColumna = New DataGridViewComboBoxColumn
- ' cboColumna.Name = "Valor"
- ' cboColumna.HeaderText = "CodImp"
- ' cboColumna.DataSource = oDAOGeneral.ListaImpuesto
- 'cboColumna.ValueMember = "CodImp"
- 'cboColumna.DisplayMember = "Descripcion"
- ' cboColumna.DataPropertyName = "CodImp"
- ' cboColumna.DisplayIndex = 1
- ' Me.dgvImpuestos.Columns.Add(cboColumna)
- 'End Sub
- 'Sub GuardarImpuesto()
- 'Dim Impuesto = dgvImpuestos.CurrentRow.Cells(0).Value
- 'Dim CodigoInv = Variables.Codigo
- ' Dim ValorImpuesto = ReportoConsula.TraerImpuesto(Impuesto)
- ' Dim Valor = oDAOGeneral.AgregarImpuesto(CodigoInv, "ACC0", Impuesto, 0)
- ' ActualizarImpuestos(Valor)
- ' RefrescarValorControles()
- 'End Sub
- ' Sub ModificarImpu(ByVal Impuesto As String)
- ' Dim CodigoInv = Variables.Codigo
- ' Dim ValorImpuesto = ReportoConsula.TraerImpuesto(Impuesto)
- ' Dim Valor = oDAOGeneral.AgregarImpuesto(CodigoInv, "ACC0", Impuesto, 1)
- ' ActualizarImpuestos(Valor)
- ' RefrescarValorControles()
- ' End Sub
- ' Sub ActualizarImpuestos(ByVal Valor As Integer)
- 'If (Valor = 1) Then
- ' dgvImpuestoAgregado.Rows.Clear()
- ' CargarImpuestos()
- 'End If
- 'End Sub
- Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- 'Sub CargarImpuestos()
- 'Try
- 'Dim codigo As String = Variables.Codigo
- 'Dim ListaImpuestos As String()
- 'Dim ClaveImpuesto
- 'Dim dr = oDAOGeneral.CargarImpuesto(codigo, "ACC0")
- 'While dr.Read
- 'If (Not String.IsNullOrEmpty(dr("Impuestos").ToString)) Then
- ' ClaveImpuesto = dr("Impuestos")
- ' ListaImpuestos = ClaveImpuesto.split("-")
- 'Else
- ' ClaveImpuesto = String.Empty
- 'End If
- 'End While
- 'For Each i As String In ListaImpuestos
- ' dgvImpuestoAgregado.Rows.Add(i)
- 'Next
- 'Catch ex As Exception
- 'End Try
- 'End Sub
- ' Sub ModificarImpuestos()
- 'Dim Index As Integer = dgvImpuestoAgregado.CurrentRow.Index
- 'Dim Cantidad As Integer = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim Cadena As String = String.Empty
- 'Dim IsNothing As Boolean = False
- ' Cadena = dgvImpuestoAgregado.CurrentRow.Cells(0).Value
- 'If (String.IsNullOrEmpty(Cadena)) Then
- ' MsgBox("No se puede quitar una cadena vacía")
- 'Else
- ' ModificarImpu(Cadena)
- 'End If
- 'End Sub
- Function ObtenerCodigosImpuestos()
- Dim codigo As String = Variables.Codigo
- Dim ListaImpuestos As String()
- Dim ClaveImpuesto
- Dim coleccion As New Collection
- Dim dr = oDAOGeneral.CargarImpuesto(codigo, "ACC0")
- While dr.Read
- If (Not String.IsNullOrEmpty(dr("Impuestos").ToString)) Then
- ClaveImpuesto = dr("Impuestos")
- ListaImpuestos = ClaveImpuesto.split("-")
- Else
- ClaveImpuesto = String.Empty
- End If
- End While
- For Each i As String In ListaImpuestos
- coleccion.Add(i)
- Next
- Return coleccion
- End Function
- ' Sub AgregarCamposImpuestos()
- ' Dim CodImp, code As New DataGridViewTextBoxColumn
- ' CodImp.Name = "CodImp"
- 'dgvImpuestoAgregado.Columns.Add(CodImp)
- ' End Sub
- '********** FIN FUNCIONES **********
- ' Function CalcularImpuesto()
- 'Dim Cargar As New Collection
- 'Dim CantidadFilas = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim Val As String
- 'For i As Integer = 0 To CantidadFilas
- ' Val = dgvImpuestoAgregado.Rows(i).Cells(0).Value
- ' Cargar.Add(Val)
- 'Next
- 'Dim Cantidad As Double = 0
- 'Dim Impuestos As Dictionary(Of String, String) = oDAOGeneral.ObtenerImpuesto()
- 'For Each i In Cargar
- 'For Each valor In Impuestos
- 'If (valor.Key.ToString = i) Then
- ' Cantidad = Cantidad + valor.Value
- 'End If
- 'Next
- 'Next
- 'Return Cantidad
- 'End Function
- Private Sub btnQuitar_Click(sender As Object, e As EventArgs)
- ' ModificarImpuestos()
- 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
- If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = 0.0
- Else
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
- End If
- Else
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = 0.0
- Else
- dgvDividendos.Rows(i).Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
- End If
- 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
- 'If (dgvDividendos.Rows.Count = 1) Then
- ' If (dgvDividendos.Rows(0).IsNewRow) Then
- ' DobleClick = True
- ' rdbEfectivo.Enabled = False
- ' rdbPorcentaje.Enabled = False
- ' TabPage1.Parent = Nothing
- ' End If
- 'End If
- 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
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If CantFormAbierto = False Then
- If Not RetCodigoInversionExiste And Not Existe Then
- Dim TipoTransaccionCompraVenta As String = Variables.TipoTransaccionCompraVenta
- If TipoTransaccionCompraVenta = "C" Then
- txtPrecioLimpioCompra.Text = Variables.RetPrecio
- txtUnidadesCompra.Text = Variables.RetUnidadesAcciones
- ElseIf TipoTransaccionCompraVenta = "V" Then
- txtPrecioLimpioVenta.Text = Variables.RetPrecio
- txtUnidadesVenta.Text = Variables.RetUnidadesAcciones
- End If
- End If
- End If
- 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
|