| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226 |
- Public Class frmReporto
- Dim oDAOGeneral As New DAOGeneral
- Dim Aniobase As Integer = 365
- Const PorcentajeComisionCasa As Double = 0.2825
- Const PorcentajeComisionBolsa As Double = 0.2825
- Const PorcentajeComisionIOF As Double = 0.25
- Dim PorcentajeISR As Double = 10
- Dim oCEReporto As ReportosCE
- Dim oDAOReportos As ReportosDAO
- Dim Reporto As New ReportosCE
- Dim ReportoConsula As New ReportosDAO
- Private CodigoInversion As String
- Dim Estado As String = String.Empty
- Dim CargarUnaVez As Boolean = True
- Dim Operaciones As New Operaciones
- Dim NombreTitulo As New Dictionary(Of String, String)
- Dim Modificado As Boolean = False
- Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
- Dim CodigoRotar As Integer = 0
- Private _Modo As String
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private Cargado As Boolean = False
- Private Procesado As Boolean = False
- Private Tabla As String = String.Empty
- Private Base As Integer = 0
- Private IOFEstado As Integer = 0
- Private RentaEstado As Integer = 0
- Private TipoOperacionRepo As String = String.Empty
- Private CodigoRepo As String = String.Empty
- Private CodigoProveniente As String = String.Empty
- Dim CodigoCheque As String = String.Empty
- 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 Property Modo As String
- Get
- Return _Modo
- End Get
- Set(value As String)
- _Modo = 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
- Sub AgregarCamposRepoVenta()
- Dim Correlativo, Base, Dias, Casa2, Nombre, FCompra, ComisionBolsa, ComisionCasa, codigo, FechaVenta, Monto, FechaVen, CostoFinanciero, Interes, Casa, Bolsa, TotalPagar As New DataGridViewTextBoxColumn
- Correlativo.Name = "Correlativo"
- codigo.Name = "codigo"
- codigo.Visible = False
- Monto.Name = "Monto"
- FechaVen.Name = "Fecha de Vencimiento"
- CostoFinanciero.Name = "Costos Financieros"
- Interes.Name = "Intereses"
- Casa.Name = "Casa"
- Bolsa.Name = "Bolsa"
- TotalPagar.Name = "Total a Pagar"
- dgvReportos.Columns.Add(Correlativo)
- dgvReportos.Columns.Add(Monto)
- dgvReportos.Columns.Add(FechaVen)
- dgvReportos.Columns.Add(CostoFinanciero)
- dgvReportos.Columns.Add(Interes)
- dgvReportos.Columns.Add(Casa)
- dgvReportos.Columns.Add(Bolsa)
- dgvReportos.Columns.Add(TotalPagar)
- Nombre.Name = "Nombre"
- FCompra.Name = "FCompra"
- ComisionCasa.Name = "ComisionCasa"
- ComisionBolsa.Name = "ComisionBolsa"
- Casa2.Name = "Casa2"
- Dias.Name = "Dias"
- Base.Name = "Base"
- Nombre.Visible = False
- FCompra.Visible = False
- ComisionCasa.Visible = False
- ComisionBolsa.Visible = False
- Casa2.Visible = False
- Base.Visible = False
- dgvReportos.Columns.Add(Nombre)
- dgvReportos.Columns.Add(FCompra)
- dgvReportos.Columns.Add(ComisionCasa)
- dgvReportos.Columns.Add(ComisionBolsa)
- dgvReportos.Columns.Add(Casa2)
- dgvReportos.Columns.Add(Dias)
- dgvReportos.Columns.Add(codigo)
- dgvReportos.Columns.Add(Base)
- End Sub
- Sub AgregarCampos(ByVal Tipo As Integer)
- Dim ValTrans, Dias, FVen, Rend, IOF, ComisionCB, CB, OtrosCostos, TotCostos, MontoLiq, InterGen, codigo As New DataGridViewTextBoxColumn
- Dim CostoTransfv, Correlativo, RendNetoAntImp, ValReCompra, ImpLiquidacion, IngrNeto, ValNeto, RendNetoDespImp As New DataGridViewTextBoxColumn
- Dim Nombre, FCompra, ComisionCasa, ComisionBolsa, Casa, Base, EstadoIOF, EstadoRenta As New DataGridViewTextBoxColumn
- Dim Cantidad As Integer = dgvReportos.ColumnCount
- If Cantidad = 0 Then
- Correlativo.Name = "Correlativo"
- codigo.Name = "Codigo"
- codigo.Visible = False
- ValTrans.Name = "Valor Trasado"
- Dias.Name = "Dias"
- FVen.Name = "Fecha de Vencimiento"
- Rend.Name = "Rendimiento"
- IOF.Name = "IOF"
- ComisionCB.Name = "Comision CB"
- CB.Name = "Comision Bolsa"
- OtrosCostos.Name = "Otros Costos"
- TotCostos.Name = "Total Costos"
- MontoLiq.Name = "Monto a Liquidar"
- InterGen.Name = "Interes a Genrerar"
- CostoTransfv.Name = "Costo de Transferencia"
- RendNetoAntImp.Name = "R% Neto (Antes de Impuesto)"
- ValReCompra.Name = "Valor de ReCompra"
- ImpLiquidacion.Name = "Impuesto de Liquidacion"
- IngrNeto.Name = "Ingreso Neto"
- ValNeto.Name = "Valor Neto"
- RendNetoDespImp.Name = "R% Neto (Despues de Impuesto)"
- Nombre.Name = "Nombre"
- FCompra.Name = "FCompra"
- ComisionCasa.Name = "ComisionCasa"
- ComisionBolsa.Name = "ComisionBolsa"
- Casa.Name = "Casa"
- Base.Name = "Base"
- EstadoIOF.Name = "EstadoIOF"
- EstadoRenta.Name = "EstadoRenta"
- Nombre.Visible = False
- FCompra.Visible = False
- ComisionCasa.Visible = False
- ComisionBolsa.Visible = False
- Casa.Visible = False
- Base.Visible = False
- EstadoIOF.Visible = False
- EstadoRenta.Visible = False
- Dim cod As String = Variables.Codigo
- If cod.IndexOf("REPOVENTA") > -1 Then
- RendNetoAntImp.HeaderText = "Costo Financiero (Antes de Impuesto)"
- RendNetoDespImp.HeaderText = "Costo Financiero (Despues de Impuesto)"
- Rend.HeaderText = "Costo Financiero"
- TotCostos.HeaderText = "Total a Pagar"
- Else
- RendNetoAntImp.HeaderText = "R% Neto (Antes de Impuesto)"
- RendNetoDespImp.HeaderText = "R% Neto (Despues de Impuesto)"
- Rend.HeaderText = "Rendimiento"
- TotCostos.HeaderText = "Total Costos"
- End If
- dgvReportos.Columns.Add(Correlativo)
- dgvReportos.Columns.Add(ValTrans)
- dgvReportos.Columns.Add(Dias)
- dgvReportos.Columns.Add(FVen)
- dgvReportos.Columns.Add(Rend)
- dgvReportos.Columns.Add(ComisionCB)
- dgvReportos.Columns.Add(CB)
- dgvReportos.Columns.Add(IOF)
- dgvReportos.Columns.Add(OtrosCostos)
- dgvReportos.Columns.Add(TotCostos)
- dgvReportos.Columns.Add(MontoLiq)
- dgvReportos.Columns.Add(InterGen)
- dgvReportos.Columns.Add(CostoTransfv)
- dgvReportos.Columns.Add(RendNetoAntImp)
- dgvReportos.Columns.Add(ValReCompra)
- dgvReportos.Columns.Add(ImpLiquidacion)
- dgvReportos.Columns.Add(IngrNeto)
- dgvReportos.Columns.Add(ValNeto)
- dgvReportos.Columns.Add(RendNetoDespImp)
- dgvReportos.Columns.Add(Nombre)
- dgvReportos.Columns.Add(FCompra)
- dgvReportos.Columns.Add(ComisionCasa)
- dgvReportos.Columns.Add(ComisionBolsa)
- dgvReportos.Columns.Add(Casa)
- dgvReportos.Columns.Add(codigo)
- dgvReportos.Columns.Add(Base)
- dgvReportos.Columns.Add(EstadoIOF)
- dgvReportos.Columns.Add(EstadoRenta)
- Dim CodImp, code As New DataGridViewTextBoxColumn
- CodImp.Name = "CodImp"
- code.Name = "codigo"
- ' dgvImpuestoAgregado.Columns.Add(CodImp)
- ' dgvImpuestoAgregado.Columns.Add(code)
- End If
- End Sub
- Sub LlenarBase()
- Dim Index As Integer = dgvReportos.Rows.Count - 2
- Base = cboAnioBase.SelectedIndex
- Dim i As Integer = 0
- While i <= Index
- dgvReportos.Rows(i).Cells("Base").Value = Base
- i += 1
- End While
- End Sub
- Sub IngresarDatos()
- If Cargado Then
- If Procesado Then
- If Not dgvReportos.CurrentRow Is Nothing Then
- Dim Index As Integer = dgvReportos.CurrentRow.Index
- dgvReportos.Rows(Index).Cells("Nombre").Value = txtCodigoTitulo.Text
- dgvReportos.Rows(Index).Cells("FCompra").Value = dtpFechaCompra.Value
- If txtComisionCasa.Text.ToString.Trim("%") = 0 Then
- dgvReportos.Rows(Index).Cells("ComisionCasa").Value = "0.0"
- Else
- dgvReportos.Rows(Index).Cells("ComisionCasa").Value = CDec(txtComisionCasa.Text.ToString.Trim("%")) / 100
- End If
- If txtComisionBolsa.Text.ToString.Trim("%") = 0 Then
- dgvReportos.Rows(Index).Cells("ComisionBolsa").Value = "0.0"
- Else
- dgvReportos.Rows(Index).Cells("ComisionBolsa").Value = CDec(txtComisionBolsa.Text.ToString.Trim("%")) / 100
- End If
- 'If ChkIOF.Checked Then
- ' dgvReportos.Rows(Index).Cells("EstadoIOF").Value = 1
- 'Else
- ' dgvReportos.Rows(Index).Cells("EstadoIOF").Value = 0
- 'End If
- 'If ChkRenta.Checked Then
- ' dgvReportos.Rows(Index).Cells("EstadoRenta").Value = 1
- 'Else
- ' dgvReportos.Rows(Index).Cells("EstadoRenta").Value = 0
- 'End If
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- dgvReportos.Rows(Index).Cells("Casa").Value = cboCasaCorredora.SelectedValue
- 'Else
- ' dgvReportos.Rows(Index).Cells("Casa2").Value = cboCasaCorredora.SelectedValue
- ' dgvReportos.Rows(Index).Cells("Dias").Value = txtDias.Text
- End If
- End If
- End If
- End If
- End Sub
- Sub IngresarDatosReves()
- Procesado = False
- If Cargado Then
- If Not dgvReportos.CurrentRow Is Nothing Then
- Dim Index As Integer = dgvReportos.CurrentRow.Index
- Dim Nombre = dgvReportos.Rows(Index).Cells("Nombre").Value
- Dim FCompra = dgvReportos.Rows(Index).Cells("FCompra").Value
- Dim ComisionCasa = dgvReportos.Rows(Index).Cells("ComisionCasa").Value
- Dim ComisionBolsa = dgvReportos.Rows(Index).Cells("ComisionBolsa").Value
- Dim EstadoIOF = dgvReportos.Rows(Index).Cells("EstadoIOF").Value
- Dim EstadoRenta = dgvReportos.Rows(Index).Cells("EstadoRenta").Value
- Dim Casa = dgvReportos.Rows(Index).Cells("Casa").Value
- If Not Nombre Is DBNull.Value Then
- If Not Nombre Is Nothing Then
- If Not String.IsNullOrEmpty(Nombre) Then
- txtCodigoTitulo.Text = Nombre
- Else
- txtCodigoTitulo.Text = String.Empty
- End If
- Else
- txtCodigoTitulo.Text = String.Empty
- End If
- Else
- txtCodigoTitulo.Text = String.Empty
- End If
- If Not FCompra Is DBNull.Value Then
- If Not FCompra Is Nothing Then
- If Not String.IsNullOrEmpty(FCompra) Then
- dtpFechaCompra.Value = FCompra
- Else
- dtpFechaCompra.Value = Date.Now.Date
- End If
- Else
- dtpFechaCompra.Value = Date.Now.Date
- End If
- Else
- dtpFechaCompra.Value = Date.Now.Date
- End If
- If Not ComisionCasa Is DBNull.Value Then
- If Not ComisionCasa Is Nothing Then
- If Not String.IsNullOrEmpty(ComisionCasa.ToString.Trim("%")) Then
- txtComisionCasa.Text = ComisionCasa.ToString.Trim("%") * 100
- Else
- txtComisionCasa.Text = "0.2825%"
- End If
- Else
- txtComisionCasa.Text = "0.2825%"
- End If
- Else
- txtComisionCasa.Text = "0.2825%"
- End If
- If Not ComisionBolsa Is DBNull.Value Then
- If Not ComisionBolsa Is Nothing Then
- If Not String.IsNullOrEmpty(ComisionBolsa.ToString.Trim("%")) Then
- txtComisionBolsa.Text = ComisionBolsa.ToString.Trim("%") * 100
- Else
- txtComisionBolsa.Text = "0.2825%"
- End If
- Else
- txtComisionBolsa.Text = "0.2825%"
- End If
- Else
- txtComisionBolsa.Text = "0.2825%"
- End If
- If Not EstadoIOF Is DBNull.Value Then
- If Not EstadoIOF Is Nothing Then
- If Not String.IsNullOrEmpty(EstadoIOF) Then
- If Index = 0 Then
- If EstadoIOF = 1 Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- Else
- Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
- If EstadoIOFAnt = 1 Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
- If EstadoIOFAnt = 1 Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
- If EstadoIOFAnt = 1 Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
- If EstadoIOFAnt = 1 Then
- ChkIOF.Checked = True
- Else
- ChkIOF.Checked = False
- End If
- End If
- End If
- If Not EstadoRenta Is DBNull.Value Then
- If Not EstadoRenta Is Nothing Then
- If Not String.IsNullOrEmpty(EstadoRenta) Then
- If Index = 0 Then
- If EstadoRenta = 1 Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- Else
- Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
- If EstadoRentaAnt = 1 Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
- If EstadoRentaAnt = 1 Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
- If EstadoRentaAnt = 1 Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- End If
- End If
- Else
- If Not Index = 0 Then
- Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
- If EstadoRentaAnt = 1 Then
- ChkRenta.Checked = True
- Else
- ChkRenta.Checked = False
- End If
- End If
- End If
- 'If (InStr(Variables.Codigo, "REPO") > 0) Or (InStr(Variables.Codigo, "REPOVENTA") > 0) Then
- If Not Casa Is DBNull.Value Then
- If Not Casa Is Nothing Then
- If Not String.IsNullOrEmpty(Casa) Then
- cboCasaCorredora.SelectedValue = Casa
- Else
- cboCasaCorredora.SelectedIndex = -1
- End If
- Else
- cboCasaCorredora.SelectedIndex = -1
- End If
- Else
- cboCasaCorredora.SelectedIndex = -1
- End If
- End If
- End If
- Procesado = True
- End Sub
- Sub ComisionCasa(ByVal ComisionCasa As Double, ByVal Index As Integer)
- Dim ValorTrasado As Double = 0.0
- Dim Dias As Integer = 0
- Dim por As Double = 0
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- por = ComisionCasa
- Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("Comision CB").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString)
- End Sub
- Function ComisionCasaCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim Dias As Integer = 0
- Dim por As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%"))) Then
- txtComisionCasa.Text = "0.2825%"
- Else
- por = CDec(txtComisionCasa.Text.ToString.Trim("%")) / 100
- End If
- Dim Fecha1 As Date = dgvReportos.Rows(Index).Cells("FCompra").Value
- Dim Fecha2 As Date = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- Dim Com = Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base)
- dgvReportos.Rows(Index).Cells("Comision CB").Value = Com
- Return Com
- End Function
- Sub ComisionBolsa(ByVal ComisionBolsa As Double, ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim Dias As Integer = 0
- Dim por As Double = 0
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- por = ComisionBolsa
- Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("Comision Bolsa").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString)
- End Sub
- Function ComisionBolsaCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim Dias As Integer = 0
- Dim por As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- If Not String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.ToString.Trim("%")) Then
- por = txtComisionBolsa.Text.ToString.Trim("%")
- End If
- Dim Fecha1 As Date = dgvReportos.Rows(Index).Cells("FCompra").Value
- Dim Fecha2 As Date = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- Dim Com = Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base)
- dgvReportos.Rows(Index).Cells("Comision Bolsa").Value = Com
- Return Com
- End Function
- Sub IOF(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim ComisionCasa As Double = 0
- Dim ComisionBolsa As Double = 0
- Dim dias As Integer = 0
- Dim Porcentaje As Double = 0.0025
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- If ChkIOF.Checked Then
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString)
- ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString)
- dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("IOF").Value = Operaciones.ConvertirDecimal(Reporto.IOF(ValorTrasado, ComisionCasa, ComisionBolsa, dias, Porcentaje, Fecha1, Fecha2, Base).ToString)
- Else
- dgvReportos.Rows(Index).Cells("IOF").Value = 0
- End If
- End Sub
- ' Sub IOF()
- ' Dim Index As Integer = dgvReportos.CurrentRow.Index
- ' Dim ValorTrasado As Double = dgvReportos.Rows(Index).Cells(0).Value
- ' Dim CantidadRegistrosImpuestos = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim CodeReg = dgvReportos.Rows(Index).Cells(18).Value
- 'Dim ComisionCasa As Double = dgvReportos.Rows(Index).Cells(4).Value
- 'Dim ComisionBolsa As Double = dgvReportos.Rows(Index).Cells(5).Value
- 'Dim dias As Integer = dgvReportos.Rows(Index).Cells(1).Value
- 'Dim Porcentaje As Double = 0.0
- 'For i As Integer = 0 To CantidadRegistrosImpuestos
- 'For j As Integer = 0 To CantidadRegistrosImpuestos
- 'If (dgvImpuestoAgregado.Rows(j).Cells(0).Value = "IOF" And dgvImpuestoAgregado.Rows(j).Cells(1).Value = CodeReg) Then
- ' Porcentaje = 0.0025
- 'Exit For
- 'Else
- ' Porcentaje = 0
- ' End If
- 'Next
- 'Next
- ' dgvReportos.Rows(Index).Cells(6).Value = Reporto.IOF(ValorTrasado, ComisionCasa, ComisionBolsa, dias, Porcentaje)
- ' End Sub
- 'Sub IOFCargar(ByVal Index As Integer)
- 'Dim ValorTrasado As Double = dgvReportos.Rows(Index).Cells(0).Value
- 'Dim CantidadRegistrosImpuestos = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim CodeReg = dgvReportos.Rows(Index).Cells(18).Value
- 'Dim ComisionCasa As Double = dgvReportos.Rows(Index).Cells(4).Value
- 'Dim ComisionBolsa As Double = dgvReportos.Rows(Index).Cells(5).Value
- 'Dim dias As Integer = dgvReportos.Rows(Index).Cells(1).Value
- 'Dim Porcentaje As Double = 0.0
- 'For i As Integer = 0 To CantidadRegistrosImpuestos
- 'For j As Integer = 0 To CantidadRegistrosImpuestos
- 'If (dgvImpuestoAgregado.Rows(j).Cells(0).Value = "IOF" And dgvImpuestoAgregado.Rows(j).Cells(1).Value = CodeReg) Then
- ' Porcentaje = 0.0025
- 'Exit For
- 'Else
- ' Porcentaje = 0
- 'End If
- 'Next
- 'Next
- ' dgvReportos.Rows(Index).Cells(6).Value = Reporto.IOF(ValorTrasado, ComisionCasa, ComisionBolsa, dias, Porcentaje)
- 'End Sub
- Sub TotalCostos(ByVal Index As Integer)
- Dim ComisionCasa As Double = 0
- Dim ComisionBolsa As Double = 0
- Dim IOF As Double = 0
- Dim OC As Double = 0
- Dim ValorTransado As Double = 0
- Dim Instrumento As String = String.Empty
- If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Instrumento = "REPOVENTA"
- Else
- Instrumento = "REPO"
- End If
- ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString)
- ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString)
- IOF = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value.ToString)
- OC = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value.ToString)
- ValorTransado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- dgvReportos.Rows(Index).Cells("Total Costos").Value = Operaciones.ConvertirDecimal(Reporto.TotCostos(ComisionCasa, ComisionBolsa, IOF, OC, ValorTransado, Instrumento).ToString)
- End Sub
- Function TotalCostosCargar(ByVal Index As Integer)
- Dim ComisionCasa As Double = 0
- Dim ComisionBolsa As Double = 0
- Dim IOF As Double = 0
- Dim OC As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Comision CB").Value) Then
- ComisionCasa = dgvReportos.Rows(Index).Cells("Comision CB").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value) Then
- ComisionBolsa = dgvReportos.Rows(Index).Cells("Comision Bolsa").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("IOF").Value) Then
- IOF = dgvReportos.Rows(Index).Cells("IOF").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Otros Costos").Value) Then
- OC = dgvReportos.Rows(Index).Cells("Otros Costos").Value
- End If
- 'Dim Costos = Reporto.TotCostos(ComisionCasa, ComisionBolsa, IOF, OC)
- 'dgvReportos.Rows(Index).Cells("Total Costos").Value = Costos
- 'Return Costos
- End Function
- Sub MontoLiquidacion(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim TotalCosto As Double = 0
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
- dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value = Operaciones.ConvertirDecimal(Reporto.MontoLiquidacion(ValorTrasado, TotalCosto).ToString)
- End Sub
- Function MontoLiquidacionCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim TotalCosto As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Total Costos").Value) Then
- TotalCosto = dgvReportos.Rows(Index).Cells("Total Costos").Value
- End If
- Dim MontoLiq = Reporto.MontoLiquidacion(ValorTrasado, TotalCosto)
- dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value = MontoLiq
- Return MontoLiq
- End Function
- Sub InteresGenerar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim rendimiento As Double = 0
- Dim dias As Integer = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- rendimiento = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value.ToString)
- dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value = Operaciones.ConvertirDecimal(Reporto.InteresGenerar(ValorTrasado, rendimiento, dias, Fecha1, Fecha2, Base).ToString)
- End Sub
- Function InteresGenerarCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim rendimiento As Double = 0
- Dim dias As Integer = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Rendimiento").Value) Then
- rendimiento = dgvReportos.Rows(Index).Cells("Rendimiento").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- Dim Interes = Reporto.InteresGenerar(ValorTrasado, rendimiento, dias, Fecha1, Fecha2, Base)
- dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value = Interes
- Return Interes
- End Function
- Sub RendimientoAntes(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim dias As Integer = 0
- Dim InteresGenerar As Double = 0
- Dim Totcosto As Double = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
- Totcosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
- Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoAntes(InteresGenerar, Totcosto, ValorTrasado, dias, Fecha1, Fecha2, Base, Tabla).ToString)
- End Sub
- Function RendimientoAntesCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim dias As Integer = 0
- Dim InteresGenerar As Double = 0
- Dim Totcosto As Double = 0
- Dim Rendimiento As Double = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value) Then
- InteresGenerar = dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Total Costos").Value) Then
- Totcosto = dgvReportos.Rows(Index).Cells("Total Costos").Value
- End If
- Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- Rendimiento = Reporto.RendimientoAntes(InteresGenerar, Totcosto, ValorTrasado, dias, Fecha1, Fecha2, Base, Tabla)
- dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value = Rendimiento
- Return Rendimiento
- End Function
- Sub ValorRecompra(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim InteresGenerar As Double = 0
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
- dgvReportos.Rows(Index).Cells("Valor de ReCompra").Value = Operaciones.ConvertirDecimal(Reporto.ValorRecompras(ValorTrasado, InteresGenerar).ToString)
- End Sub
- Function ValorRecompraCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim InteresGenerar As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value) Then
- InteresGenerar = dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value
- End If
- Dim ReCompra = Reporto.ValorRecompras(ValorTrasado, InteresGenerar)
- dgvReportos.Rows(Index).Cells("Valor de ReCompra").Value = ReCompra
- Return ReCompra
- End Function
- Sub Renta(ByVal Index As String)
- Dim InteresGenerar As Double = 0
- If ChkRenta.Checked Then
- InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
- dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = (InteresGenerar * 0.1)
- Else
- dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0
- End If
- End Sub
- ' Sub Renta()
- 'Dim Index = dgvReportos.CurrentRow.Index
- 'Dim InteresGenerar As Double = dgvReportos.Rows(Index).Cells(10).Value
- 'Dim CantidadRegistrosImpuestos = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim CodeReg = dgvReportos.Rows(Index).Cells(18).Value
- 'Dim Porcentaje = 0.0
- 'For i As Integer = 0 To CantidadRegistrosImpuestos
- 'For j As Integer = 0 To CantidadRegistrosImpuestos
- 'If (dgvImpuestoAgregado.Rows(j).Cells(0).Value = "ISR" And dgvImpuestoAgregado.Rows(j).Cells(1).Value = CodeReg) Then
- ' Porcentaje = 0.1
- 'Exit For
- 'Else
- ' Porcentaje = 0
- 'End If
- 'Next
- 'Next
- ' dgvReportos.Rows(Index).Cells(14).Value = Reporto.Renta(InteresGenerar, Porcentaje)
- 'End Sub
- ' Sub RentaCargar(ByVal Index As Integer)
- 'Dim InteresGenerar As Double = dgvReportos.Rows(Index).Cells(10).Value
- 'Dim CantidadRegistrosImpuestos = dgvImpuestoAgregado.Rows.Count - 1
- 'Dim CodeReg = dgvReportos.Rows(Index).Cells(18).Value
- 'Dim Porcentaje = 0.0
- 'For i As Integer = 0 To CantidadRegistrosImpuestos
- 'For j As Integer = 0 To CantidadRegistrosImpuestos
- ' If (dgvImpuestoAgregado.Rows(j).Cells(0).Value = "ISR" And dgvImpuestoAgregado.Rows(j).Cells(1).Value = CodeReg) Then
- ' Porcentaje = 0.1
- 'Exit For
- 'Else
- ' Porcentaje = 0
- 'End If
- 'Next
- 'Next
- ' dgvReportos.Rows(Index).Cells(14).Value = Reporto.Renta(InteresGenerar, Porcentaje)
- 'End Sub
- Sub IngresoNeto(ByVal Index As Integer)
- Dim InteresGenerar As Double = 0
- Dim Renta As Double = 0
- InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
- Renta = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value.ToString)
- dgvReportos.Rows(Index).Cells("Ingreso Neto").Value = Operaciones.ConvertirDecimal(Reporto.IngresoNet(InteresGenerar, Renta).ToString)
- End Sub
- Function IngresoNetoCargar(ByVal Index As Integer)
- Dim Renta As Double = 0
- Dim InteresGenerar As Double = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value) Then
- InteresGenerar = dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value)) Then
- dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0
- Renta = 0
- Else
- Renta = dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value
- End If
- Dim ING = Reporto.IngresoNet(InteresGenerar, Renta)
- dgvReportos.Rows(Index).Cells("Ingreso Neto").Value = ING
- Return ING
- End Function
- Sub ValorNeto(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim IngresoNeto As Double = 0
- Dim CostoTrans As Double = 0
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
- CostoTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value.ToString)
- dgvReportos.Rows(Index).Cells("Valor Neto").Value = Operaciones.ConvertirDecimal(Reporto.ValorNet(ValorTrasado, IngresoNeto, CostoTrans).ToString)
- End Sub
- Function ValorNetoCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim IngresoNeto As Double = 0
- Dim CostoTrans As Double = 0
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value)) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value)) Then
- dgvReportos.Rows(Index).Cells("Ingreso Neto").Value = 0
- Else
- IngresoNeto = dgvReportos.Rows(Index).Cells("Ingreso Neto").Value
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value)) Then
- dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value = 0
- Else
- CostoTrans = dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value
- End If
- Dim VN = Reporto.ValorNet(ValorTrasado, IngresoNeto, CostoTrans)
- dgvReportos.Rows(Index).Cells("Valor Neto").Value = VN
- Return VN
- End Function
- Sub RendimientoDespues(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim IngresoNeto As Double = 0
- Dim TotalCosto As Double = 0
- Dim dias As Integer = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
- IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
- TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
- dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
- dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoDespues(IngresoNeto, TotalCosto, ValorTrasado, dias, Fecha1, Fecha2, Base).ToString)
- End Sub
- Function RendimientoDespuesCargar(ByVal Index As Integer)
- Dim ValorTrasado As Double = 0
- Dim IngresoNeto As Double = 0
- Dim TotalCosto As Double = 0
- Dim dias As Integer = 0
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
- ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value) Then
- IngresoNeto = dgvReportos.Rows(Index).Cells("Ingreso Neto").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Total Costos").Value) Then
- TotalCosto = dgvReportos.Rows(Index).Cells("Total Costos").Value
- End If
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- Dim Rend = Reporto.RendimientoDespues(IngresoNeto, TotalCosto, ValorTrasado, dias, Fecha1, Fecha2, Base)
- dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value = Rend
- Return Rend
- End Function
- Sub CargarFecha()
- Dim Index As Integer = dgvReportos.CurrentRow.Index
- Dim Fecha As Date = dtpFechaCompra.Value
- Dim Fecha2 As Date = Date.Now.Date
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value) Then
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- End If
- End Sub
- Private Sub CargarCasaCorredora()
- If cboCasaCorredora.Items.Count = 0 Or cboCasaCorredora.Items.Count = 1 Then
- Me.cboCasaCorredora.DataSource = oDAOGeneral.ListaTiposImpuesto
- Me.cboCasaCorredora.DisplayMember = "Descripcion"
- Me.cboCasaCorredora.ValueMember = "Codigo"
- Me.cboCasaCorredora.SelectedIndex = 0
- End If
- End Sub
- 'Private Sub PrepararTablaImpuestos()
- ' Dim cboColumna, cboCodigoInv 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)
- ' cboCodigoInv = New DataGridViewComboBoxColumn
- ' cboCodigoInv.Name = "Codigo"
- ' cboCodigoInv.HeaderText = "Codigo"
- 'cboCodigoInv.DataSource = oDAOGeneral.ListaInversion(Variables.Codigo)
- ' cboCodigoInv.DisplayMember = "Descripcion"
- ' cboCodigoInv.DataPropertyName = "Codigo"
- ' cboCodigoInv.DisplayIndex = 2
- 'Me.dgvImpuestos.Columns.Add(cboCodigoInv)
- 'End Sub
- Sub CargarBase()
- If cboAnioBase.Items.Count = 0 Or cboAnioBase.Items.Count = 1 Then
- Me.cboAnioBase.DataSource = oDAOGeneral.ListaBase
- Me.cboAnioBase.DisplayMember = "Descripcion"
- Me.cboAnioBase.ValueMember = "Codigo"
- Me.cboAnioBase.SelectedIndex = 0
- End If
- End Sub
- Private Sub frmReporto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Titulo.TabPages.Remove(TbImpuestos)
- Dim CantidadFilas As Integer = dgvReportos.Rows.Count
- CargarCasaCorredora()
- CargarBase()
- If Variables.Codigo.IndexOf("REPO") > -1 And Not Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Tabla = "REP0"
- lblReporto.Text = "Reporto de Compra"
- Variables.Inicio = True
- 'Call CargarRegistroBD
- txtComisionCasa.Text = PorcentajeComisionCasa
- txtComisionBolsa.Text = PorcentajeComisionBolsa
- ' txtIOF.Text = PorcentajeComisionIOF
- If CantidadFilas <= 1 Then
- AgregarCampos(1)
- ' PrepararTablaImpuestos()
- CargarReporto(Tabla)
- End If
- Calculos()
- Variables.Inicio = False
- 'AgregarCheckbox()
- 'CalcularCheckbox()
- Calculos()
- CargarUnaVez = False
- CodigoRotar = 0
- ElseIf Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- OcultarValoresImp()
- Tabla = "REP0VENTA"
- lblReporto.Text = "Reporto de Venta"
- lblFechaCompra.Text = "Fecha de Venta"
- lblCodigoInstrumento.Visible = True
- txtCodigoInstrumento.Visible = True
- If Not String.IsNullOrEmpty(CodigoProveniente) Then
- txtCodigoInstrumento.Text = CodigoProveniente
- End If
- If CantidadFilas <= 1 Then
- AgregarCampos(2)
- ' PrepararTablaImpuestos()
- CargarReporto(Tabla)
- End If
- CodigoRotar = 0
- Calculos()
- CargarMontoRepoVenta()
- End If
- Cargado = True
- CorrelativoSinBD()
- ExisteInversion()
- ValidarExistencia()
- Formato()
- CargarTransladoNuevo()
- End Sub
- Sub CargarMontoRepoVenta()
- If Operaciones.ConvertirDecimal(txtMonto.Text.ToString) > 0 Then
- If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then
- dgvReportos.Rows(0).Cells("Valor Trasado").Value = txtMonto.Text
- txtMonto.Text = 0
- End If
- End If
- End Sub
- Sub OcultarValoresImp()
- ChkIOF.Checked = False
- ChkRenta.Checked = False
- ChkRenta.Visible = False
- ChkIOF.Visible = False
- End Sub
- Function ExisteInversion()
- Dim Codigo As String = Variables.Codigo
- Dim TablaINV As String = "INV0"
- Dim TablaPINV As String = "PIN0"
- Dim General As New DAOGeneral
- Dim InvPro = Variables.InvPro
- If InvPro = "I" Then
- Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
- If INV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- If InvPro = "P" Then
- Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
- If PINV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- Return False
- End Function
- Sub Formato()
- If (String.IsNullOrEmpty(txtDias.Text.ToString)) Then
- txtDias.Text = 0
- End If
- If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%"))) Then
- txtComisionCasa.Text = "0.2825%"
- End If
- If (String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%"))) Then
- txtComisionBolsa.Text = "0.2825%"
- End If
- If txtComisionBolsa.Text.ToString.IndexOf("%") = -1 Then
- txtComisionBolsa.Text = txtComisionBolsa.Text.ToString + "%"
- End If
- If txtComisionCasa.Text.ToString.IndexOf("%") = -1 Then
- txtComisionCasa.Text = txtComisionCasa.Text.ToString + "%"
- End If
- If cboCasaCorredora.SelectedIndex = -1 Then
- Try
- cboCasaCorredora.SelectedIndex = 0
- Catch ex As Exception
- End Try
- End If
- End Sub
- Sub IOFRentaEstado()
- Dim CantidadRegistro As Integer = dgvReportos.Rows.Count - 2
- Dim EstadoImpIOF As Integer = 0
- Dim EstadoImpRenta As Integer = 0
- 'Dim Index As Integer = dgvReportos.CurrentRow.Index
- 'If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("EstadoIOF").Value) Then
- ' EstadoImpIOF = dgvReportos.Rows(Index).Cells("EstadoIOF").Value
- 'End If
- 'If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("EstadoRenta").Value) Then
- ' EstadoImpRenta = dgvReportos.Rows(Index).Cells("EstadoRenta").Value
- 'End If
- If ChkIOF.Checked Then
- EstadoImpIOF = 1
- Else
- EstadoImpIOF = 0
- End If
- If ChkRenta.Checked Then
- EstadoImpRenta = 1
- Else
- EstadoImpRenta = 0
- End If
- Dim i As Integer = 0
- While i <= CantidadRegistro
- dgvReportos.Rows(i).Cells("EstadoIOF").Value = EstadoImpIOF
- dgvReportos.Rows(i).Cells("EstadoRenta").Value = EstadoImpRenta
- i += 1
- End While
- End Sub
- Sub AgregarCheckbox()
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Dim Cantidad As Integer = dgvReportos.Rows.Count - 2
- For i As Integer = 0 To Cantidad
- Dim IOF As New CheckBox
- Dim Renta As New CheckBox
- Dim Existe As Boolean = False
- Dim Codigo = dgvReportos.Rows(i).Cells("Codigo").Value
- For Each item As CheckBox In FlpIOF.Controls
- If item.Text.ToString = Codigo.ToString Then
- Existe = True
- End If
- Next
- If Not Existe Then
- If (Not dgvReportos.Rows(i).Cells("IOF").Value = 0) Then
- IOF.Name = Codigo.ToString + "ffeaeae8"
- IOF.Checked = True
- IOF.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- IOF.Checked = False
- End If
- If (Not dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value = 0) Then
- Renta.Name = CStr(Codigo) + "ffeaeae8"
- Renta.Checked = True
- Renta.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- Renta.Checked = False
- End If
- IOF.Text = Codigo
- Renta.Text = Codigo
- AddHandler IOF.CheckedChanged, AddressOf eventoIOF
- AddHandler Renta.CheckedChanged, AddressOf eventoRenta
- FlpIOF.Controls.Add(IOF)
- FlpRenta.Controls.Add(Renta)
- End If
- Existe = False
- Next
- End If
- End Sub
- Sub eventoIOF(sender As Object, e As EventArgs)
- If (sender.checked) Then
- sender.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- sender.BackColor = ColorTranslator.FromHtml("Transparent")
- End If
- CalcularCheckbox()
- Calculos()
- End Sub
- Sub eventoRenta(sender As Object, e As EventArgs)
- If (sender.checked) Then
- sender.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- sender.BackColor = ColorTranslator.FromHtml("Transparent")
- End If
- CalcularCheckbox()
- Calculos()
- End Sub
- Sub CalcularCheckbox()
- Dim xCheckBox As New Control
- For Each xCheckBox In Me.FlpIOF.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim Index = xCheckBox.TabIndex
- Try
- Dim codigo = dgvReportos.Rows(Index).Cells("Codigo").Value
- If Not String.IsNullOrEmpty(codigo) Then
- Dim ColorCodigo = CStr(codigo) + xCheckBox.BackColor.Name.ToString
- If (ColorCodigo = (codigo + "ffeaeae8")) Then
- Dim codigoText = xCheckBox.Text
- If (codigo = codigoText) Then
- IOF(Index)
- End If
- Else
- dgvReportos.Rows(Index).Cells("IOF").Value = 0
- End If
- End If
- Catch ex As Exception
- End Try
- End If
- Next
- Dim xCheckBo As New Control
- For Each xCheckBo In Me.FlpRenta.Controls
- If TypeOf xCheckBo Is CheckBox Then
- Dim Index = xCheckBo.TabIndex
- Try
- Dim codigo = dgvReportos.Rows(Index).Cells("Codigo").Value
- If Not String.IsNullOrEmpty(codigo) Then
- Dim ColorCodigo = CStr(codigo) + xCheckBo.BackColor.Name.ToString
- If (ColorCodigo = (codigo + "ffeaeae8")) Then
- Dim codigoText = xCheckBo.Text
- If (codigo = codigoText) Then
- Renta(Index)
- End If
- Else
- dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0
- End If
- End If
- Catch ex As Exception
- End Try
- End If
- Next
- End Sub
- Sub ActualizarImpuestos(ByVal Valor As Integer)
- CargarReporto(Tabla)
- End Sub
- Sub RotarValores(ByVal Codigo As String)
- End Sub
- Sub CalculosRepoVentas(ByVal Index As Integer)
- End Sub
- Sub PrepararRepoVentas()
- Dim Cantidad As Integer = dgvReportos.Rows.Count - 2
- Dim Index As Integer = 0
- While Index <= Cantidad
- Dim IndexAnterior As Integer = 0
- DefinirCorrelativo(Index)
- dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = CalcularFechaVencimiento(Index)
- PrepararMonto(Index)
- PrepararCostosFinancieros(Index)
- dgvReportos.Rows(Index).Cells("Intereses").Value = CalcularInteres(Index, Base)
- dgvReportos.Rows(Index).Cells("Casa").Value = CalcularComisionCasa(Index, Base)
- dgvReportos.Rows(Index).Cells("Bolsa").Value = CalcularComisionBolsa(Index, Base)
- dgvReportos.Rows(Index).Cells("Total a Pagar").Value = TotalPagarSumaComisiones(Index)
- Index += 1
- End While
- End Sub
- Sub DefinirCorrelativo(ByVal Index As Integer)
- 'Dim CorrelavivoAnterior As Integer = 0
- 'If (Index = 0) Then
- ' If (dgvReportos.Rows(Index).Cells("Correlativo").Value Is Nothing) Then
- ' dgvReportos.Rows(Index).Cells("Correlativo").Value = 1
- ' End If
- 'Else
- ' CorrelavivoAnterior = dgvReportos.Rows(Index - 1).Cells("Correlativo").Value
- ' dgvReportos.Rows(Index).Cells("Correlativo").Value = CorrelavivoAnterior + 1
- 'End If
- End Sub
- Function TotalPagarSumaComisiones(ByVal Index As Integer)
- Dim ComisionCasa = 0.0, ComisionBolsa = 0.0, SumaComisiones = 0.0
- If (Not dgvReportos.Rows(Index).Cells("Casa").Value Is Nothing) Then
- ComisionCasa = dgvReportos.Rows(Index).Cells("Casa").Value
- End If
- If (Not dgvReportos.Rows(Index).Cells("Bolsa").Value Is Nothing) Then
- ComisionBolsa = dgvReportos.Rows(Index).Cells("Bolsa").Value
- End If
- SumaComisiones = ComisionCasa + ComisionBolsa
- Return SumaComisiones
- End Function
- Function CalcularComisionBolsa(ByVal Index As Integer, ByVal IndexBase As Integer)
- Dim Monto = 0.0, Porcentaje = 0.0, Dias = 0, Comision = 0.0, Fecha1 = Date.Now.Date, Fecha2 = Date.Now.Date
- If (Not dgvReportos.Rows(Index).Cells("Monto").Value Is Nothing) Then
- Monto = dgvReportos.Rows(Index).Cells("Monto").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value)) Then
- Porcentaje = dgvReportos.Rows(Index).Cells("ComisionBolsa").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value)) Then
- If String.IsNullOrEmpty(txtDias.Text) Then
- Dias = 0
- Else
- Dias = txtDias.Text
- End If
- End If
- Dim Valor As Double = 0
- Valor = (Monto * Porcentaje) * Dias / 365
- Return Valor
- 'If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("FCompra").Value)) Then
- ' Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- 'End If
- 'If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)) Then
- ' Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- 'End If
- 'Dim Valor As Double = 0
- 'If (IndexBase = 0) Then
- ' Valor = (Monto * Porcentaje) * Dias / 360
- ' Return Valor
- 'ElseIf (IndexBase = 1) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'ElseIf (IndexBase = 2) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'Else
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 360
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 360
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 360
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 360
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'End If
- 'Return Valor
- End Function
- Function CalcularComisionCasa(ByVal Index As Integer, ByVal IndexBase As Integer)
- Dim Monto = 0.0, Porcentaje = 0.0, Dias = 0, Comision = 0.0, Fecha1 = Date.Now.Date, Fecha2 = Date.Now.Date
- If (Not dgvReportos.Rows(Index).Cells("Monto").Value Is Nothing) Then
- Monto = dgvReportos.Rows(Index).Cells("Monto").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("ComisionCasa").Value)) Then
- Porcentaje = dgvReportos.Rows(Index).Cells("ComisionCasa").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value)) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("FCompra").Value)) Then
- Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)) Then
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- End If
- ''''''''''''''''''''''''''''''''''''''''
- Dim Valor As Double = 0
- Valor = (Monto * Porcentaje) * Dias / 365
- 'If (IndexBase = 0) Then
- ' Valor = (Monto * Porcentaje) * Dias / 360
- ' Return Valor
- 'ElseIf (IndexBase = 1) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'ElseIf (IndexBase = 2) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 365
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'Else
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * Porcentaje) * DiasPrimeraFecha / 360
- ' PrOpc2 = (Monto * Porcentaje) * DiasSegundaFecha / 360
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasSegundaFecha / 360
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * Porcentaje) * DiasPrimeraFecha / 360
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'End If
- Return Valor
- End Function
- Function CalcularInteres(ByVal Index As Integer, ByVal IndexBase As Integer)
- Dim Monto = 0.0, CostoFinanciero = 0.0, Dias = 0, Interes = 0.0, Fecha1 = Date.Now.Date, Fecha2 = Date.Now.Date
- If (Not dgvReportos.Rows(Index).Cells("Monto").Value Is Nothing) Then
- Monto = dgvReportos.Rows(Index).Cells("Monto").Value
- End If
- If (Not dgvReportos.Rows(Index).Cells("Costos Financieros").Value Is Nothing) Then
- CostoFinanciero = dgvReportos.Rows(Index).Cells("Costos Financieros").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value)) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("FCompra").Value)) Then
- Fecha1 = dgvReportos.Rows(Index).Cells("FCompra").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)) Then
- Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
- End If
- ''''''''''''''''''''''''''''''''''''''''''''''''
- Dim Valor As Double = 0
- Valor = (Monto * CostoFinanciero) * Dias / 365
- Return Valor
- 'If (IndexBase = 0) Then
- ' Valor = (Monto * CostoFinanciero) * Dias / 360
- ' Return Valor
- 'ElseIf (IndexBase = 1) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * CostoFinanciero) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * CostoFinanciero) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasSegundaFecha / 365
- ' MsgBox(Monto)
- ' MsgBox(CostoFinanciero)
- ' MsgBox(DiasSegundaFecha)
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'ElseIf (IndexBase = 2) Then
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * CostoFinanciero) * DiasPrimeraFecha / 366
- ' PrOpc2 = (Monto * CostoFinanciero) * DiasSegundaFecha / 365
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasSegundaFecha / 365
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasPrimeraFecha / 366
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'Else
- ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' PrOpc1 = (Monto * CostoFinanciero) * DiasPrimeraFecha / 360
- ' PrOpc2 = (Monto * CostoFinanciero) * DiasSegundaFecha / 360
- ' Valor = PrOpc1 + PrOpc2
- ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasSegundaFecha / 360
- ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- ' Valor = (Monto * CostoFinanciero) * DiasPrimeraFecha / 360
- ' Else
- ' Valor = 0
- ' End If
- ' Return Valor
- 'End If
- 'Return Valor
- End Function
- Sub PrepararCostosFinancieros(ByVal Index As Integer)
- If (dgvReportos.Rows(Index).Cells("Costos Financieros").Value Is Nothing) Then
- dgvReportos.Rows(Index).Cells("Costos Financieros").Value = 0
- End If
- End Sub
- Sub PrepararMonto(ByVal Index As Integer)
- If (dgvReportos.Rows(Index).Cells("Monto").Value Is Nothing) Then
- dgvReportos.Rows(Index).Cells("Monto").Value = 0
- Else
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Monto").Value.ToString)) Then
- dgvReportos.Rows(Index).Cells("Monto").Value = 0
- End If
- End If
- End Sub
- Sub RellenarTxt()
- 'If (InStr(Variables.Codigo, "REPOVENTA") > 0) Then
- ' If (String.IsNullOrEmpty(txtDias.Text.ToString)) Then
- ' txtDias.Text = "0"
- ' End If
- 'End If
- End Sub
- Sub RellenarDatos()
- Dim Index = dgvReportos.CurrentRow.Index
- 'If (Not dgvReportos.Rows(Index).IsNewRow) Then
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Monto").Value)) Then
- dgvReportos.Rows(Index).Cells("Monto").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)) Then
- dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = Date.Now.Date
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Costos Financieros").Value)) Then
- dgvReportos.Rows(Index).Cells("Costos Financieros").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Intereses").Value)) Then
- dgvReportos.Rows(Index).Cells("Intereses").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Casa").Value)) Then
- dgvReportos.Rows(Index).Cells("Casa").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Bolsa").Value)) Then
- dgvReportos.Rows(Index).Cells("Bolsa").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Total a Pagar").Value)) Then
- dgvReportos.Rows(Index).Cells("Total a Pagar").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Codigo").Value)) Then
- dgvReportos.Rows(Index).Cells("Codigo").Value = Correlativo()
- End If
- 'End If
- End Sub
- Function CalcularFechaVencimiento(ByVal Index As Integer)
- Dim Dias = 0, FechaVenta = Date.Now.Date, FechaVencimiento = Date.Now.Date
- IngresarDatos()
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("FCompra").Value)) Then
- FechaVenta = dgvReportos.Rows(Index).Cells("FCompra").Value
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value)) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- FechaVencimiento = FechaVenta.AddDays(Dias)
-
- Return FechaVencimiento
- End Function
- Function CalcularFechaVenta(ByVal Index As Integer, ByVal IndexAnterior As Integer)
- Dim FechaVenta As Date
- If (Not Index = 0) Then
- IndexAnterior = Index - 1
- Dim FVencimiento = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString
- If (String.IsNullOrEmpty(FVencimiento)) Then
- FechaVenta = Date.Now.Date
- Else
- FechaVenta = FVencimiento
- End If
- Else
- FechaVenta = Date.Now.Date
- End If
- Return FechaVenta
- End Function
- Sub Calculos()
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Dim Cantidad As Integer = dgvReportos.Rows.Count - 2
- Dim Index As Integer = 0
- While Index <= Cantidad
- Dim FCompra As Date
- Dim VComisionCasa As Double = 0
- Dim VComisionBolsa As Double = 0
- FCompra = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
- VComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value.ToString)
- VComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value.ToString)
- FechaVen(FCompra, Index)
- ComisionCasa(VComisionCasa, Index)
- ComisionBolsa(VComisionBolsa, Index)
- IOF(Index)
- TotalCostos(Index)
- MontoLiquidacion(Index)
- InteresGenerar(Index)
- RendimientoAntes(Index)
- ValorRecompra(Index)
- Renta(Index)
- IngresoNeto(Index)
- ValorNeto(Index)
- RendimientoDespues(Index)
- Index += 1
- End While
- Else
- 'PrepararRepoVentas()
- End If
- End Sub
- Sub NuevaFila()
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Dim i As Integer = dgvReportos.CurrentRow.Index
- Dim IndexAnterior As Integer = dgvReportos.CurrentRow.Index - 1
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Codigo").Value)) Then
- dgvReportos.Rows(i).Cells("Codigo").Value = Correlativo()
- End If
- If Not i = 0 Then
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value)) Then
- dgvReportos.Rows(i).Cells("EstadoIOF").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value
- Else
- dgvReportos.Rows(i).Cells("EstadoIOF").Value = 0
- End If
- If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value)) Then
- dgvReportos.Rows(i).Cells("EstadoRenta").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value
- Else
- dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value = 0
- End If
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Trasado").Value)) Then
- dgvReportos.Rows(i).Cells("Valor Trasado").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Dias").Value)) Then
- dgvReportos.Rows(i).Cells("Dias").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value)) Then
- Dim FechaVenc As String = Format(Date.Now.Date, "dd/MM/yyyy")
- dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value = FechaVenc
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Rendimiento").Value)) Then
- dgvReportos.Rows(i).Cells("Rendimiento").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("IOF").Value)) Then
- dgvReportos.Rows(i).Cells("IOF").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision CB").Value)) Then
- dgvReportos.Rows(i).Cells("Comision CB").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision Bolsa").Value)) Then
- dgvReportos.Rows(i).Cells("Comision Bolsa").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Otros Costos").Value)) Then
- dgvReportos.Rows(i).Cells("Otros Costos").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Total Costos").Value)) Then
- dgvReportos.Rows(i).Cells("Total Costos").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Monto a Liquidar").Value)) Then
- dgvReportos.Rows(i).Cells("Monto a Liquidar").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Interes a Genrerar").Value)) Then
- dgvReportos.Rows(i).Cells("Interes a Genrerar").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Costo de Transferencia").Value)) Then
- dgvReportos.Rows(i).Cells("Costo de Transferencia").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value)) Then
- dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor de ReCompra").Value)) Then
- dgvReportos.Rows(i).Cells("Valor de ReCompra").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value)) Then
- dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Ingreso Neto").Value)) Then
- dgvReportos.Rows(i).Cells("Ingreso Neto").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Neto").Value)) Then
- dgvReportos.Rows(i).Cells("Valor Neto").Value = 0
- End If
- If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value)) Then
- dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value = 0
- End If
- End If
- 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 = dgvReportos.CurrentRow.Cells("codigo").Value
- If result = MsgBoxResult.Ok Then
- Try
- dgvReportos.Rows.Remove(dgvReportos.CurrentRow)
- ReportoConsula.Eliminar(codigo, Numero, Tabla)
- Catch ex As Exception
- MsgBox("No ha seleccionado una fila")
- End Try
- End If
- End Sub
- Sub FechaVen(ByVal FCompra As Date, ByVal Index As Integer)
- Dim FechaCompra As Date = FCompra
- Dim Dias As Integer = 0
- Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
- dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = CStr(Format(Reporto.FechaDeVencimiento(FechaCompra, Dias), "dd/MM/yyyy"))
- End Sub
- Function FechaVenCargar(ByVal Index As Integer)
- Dim FechaCompra As Date = dtpFechaCompra.Value
- Dim Dias As Integer = 0
- If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
- Dias = dgvReportos.Rows(Index).Cells("Dias").Value
- End If
- Dim FechaVencimiento = CStr(Format(Reporto.FechaDeVencimiento(FechaCompra, Dias), "dd/MM/yyyy"))
- dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = FechaVencimiento
- Return FechaVencimiento
- End Function
- Sub CorrelativoSinBD()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- dgvReportos.Rows(Index).Cells("Correlativo").Value = Index + 1
- Index += 1
- End While
- End Sub
- Function Correlativo()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- Dim Numero As Integer = dgvReportos.Rows(Index).Cells("codigo").Value
- If Numero > NumeroMayor Then
- NumeroMayor = Numero
- End If
- Index += 1
- End While
- Return NumeroMayor + 1
- End Function
- Sub CargarReporto(ByVal Tabla As String)
- Dim ConvertirString As String
- Dim Activo = 0.0, ActivoRenta = 0.0
- Dim EstadoIOF, EstadoRenta
- Dim dr = ReportoConsula.CargarReporto(Codigo, Tabla)
- If Tabla = "REP0" Or Tabla = "REP0VENTA" Then
- If (Not dr Is Nothing) Then
- While dr.Read
- If dr("EstadoIOF") Then
- EstadoIOF = 1
- ChkIOF.Checked = True
- Else
- EstadoIOF = 0
- ChkIOF.Checked = False
- End If
- If dr("EstadoRenta") Then
- EstadoRenta = 1
- ChkRenta.Checked = True
- Else
- EstadoRenta = 0
- ChkRenta.Checked = False
- End If
- Dim FechaVencimiento As Date = dr("FCompra")
- Dim Dias As Integer = dr("Dias")
- FechaVencimiento = FechaVencimiento.AddDays(Dias)
- ConvertirString = Format(FechaVencimiento, "dd/MM/yyyy")
- dtpFechaCompra.Value = dr("FCompra")
- If (dr("IOF")) Then
- Activo = 1
- Else
- Activo = 0
- End If
- If (dr("Renta")) Then
- ActivoRenta = 1
- Else
- ActivoRenta = 0
- End If
- Dim ComisionCasa As Double = 0
- Dim ComisionBolsa As Double = 0
- If Not String.IsNullOrEmpty(dr("ComisionCasa").ToString) Then
- ComisionCasa = dr("ComisionCasa")
- End If
- If Not String.IsNullOrEmpty(dr("ComisionBolsa").ToString) Then
- ComisionBolsa = dr("ComisionBolsa")
- End If
- If Tabla = "REP0VENTA" Then
- dgvReportos.Rows.Add("", dr("ValTrans"), dr("Dias"), ConvertirString, (dr("Rend")), 0, 0, 0, 0, 0, 0, 0, 0, 0, dr("CostoTransfr"), ActivoRenta, "", "", "", dr("Nombre"), dr("FCompra"), ComisionCasa, ComisionBolsa, dr("Casa"), dr("codigo"), "", EstadoIOF, EstadoRenta)
- End If
- End While
- End If
- Else
- 'If (Not dr Is Nothing) Then
- ' While dr.Read
- ' Dim Monto As Double = 0
- ' Dim FVenc As Date = Date.Now.Date
- ' Dim CostFinanciero As Double = 0
- ' Dim Nombre As String = String.Empty
- ' Dim FCompra As Date = Date.Now.Date
- ' Dim ComisionCasa As Double = 0
- ' Dim ComisionBolsa As Double = 0
- ' Dim Dias As Integer =0
- ' Dim codigo As Integer = 0
- ' Dim Casa2 As String = String.Empty
- ' If (Not String.IsNullOrEmpty(dr("Monto").ToString)) Then
- ' Monto = dr("Monto")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("FVenc").ToString)) Then
- ' FVenc = dr("FVenc")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("CostoFinanciero").ToString)) Then
- ' CostFinanciero = dr("CostoFinanciero")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("Nombre").ToString)) Then
- ' Nombre = dr("Nombre")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("FCompra").ToString)) Then
- ' FCompra = dr("FCompra")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("ComisionCasa").ToString)) Then
- ' ComisionCasa = dr("ComisionCasa")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("ComisionBolsa").ToString)) Then
- ' ComisionBolsa = dr("ComisionBolsa")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("Dias").ToString)) Then
- ' Dias = dr("Dias")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("codigo").ToString)) Then
- ' codigo = dr("codigo")
- ' End If
- ' If (Not String.IsNullOrEmpty(dr("Casa2").ToString)) Then
- ' Casa2 = dr("Casa2")
- ' End If
- ' 'cboAnioBase.SelectedIndex = dr("Base")
- ' Dim FechaVenFiltro As String = Format(FVenc, "dd/MM/yyyy")
- ' dgvReportos.Rows.Add("", Monto, FechaVenFiltro, CostFinanciero, 0, 0, 0, 0, Nombre, FCompra, ComisionCasa, ComisionBolsa, Casa2, Dias, codigo)
- ' End While
- 'End If
- End If
- End Sub
- Function ObtenerDatos(ByVal Index As Integer)
- Dim coleccion As New Collection
- Dim Renta, IOF, Nombre, FCompra, ValTrans, Dias, FVenc, Rend, CostoTransfr, codigo, ComisionCasa, ComisionBolsa, Casa, Casa2
- Dim EstadoIOF, EstadoRenta
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Dim ComisionCasaValor, ComisionBolsaValor, IOFValor, OtrosCostos, TotalCostos, MontoLiq
- Dim IntGenerar, RendAntImp, RendDesImp, ImpLiq, IngrNet, ValorNet
- ValorNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Neto").Value.ToString)
- IngrNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
- ImpLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value)
- RendDesImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value)
- RendAntImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value)
- IntGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value)
- MontoLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value)
- TotalCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value)
- OtrosCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value)
- IOFValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value)
- ComisionBolsaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value)
- ComisionCasaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value)
- Nombre = dgvReportos.Rows(Index).Cells("Nombre").Value.ToString
- FCompra = Operaciones.ConvertirFechaBaseDatos(dgvReportos.Rows(Index).Cells("FCompra").Value)
- ValTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value)
- Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value)
- FVenc = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)
- Rend = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value)
- CostoTransfr = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value)
- codigo = dgvReportos.Rows(Index).Cells("Codigo").Value.ToString
- ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value)
- ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value)
- Casa = dgvReportos.Rows(Index).Cells("Casa").Value.ToString
- If (Not dgvReportos.Rows(Index).Cells("IOF").Value = 0) Then
- IOF = 1
- Else
- IOF = 0
- End If
- If (Not dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0) Then
- Renta = 1
- Else
- Renta = 0
- End If
- If (dgvReportos.Rows(Index).Cells("EstadoIOF").Value = 1) Then
- EstadoIOF = 1
- Else
- EstadoIOF = 0
- End If
- If (dgvReportos.Rows(Index).Cells("EstadoRenta").Value = 1) Then
- EstadoRenta = 1
- Else
- EstadoRenta = 0
- End If
- coleccion.Add(Nombre)
- coleccion.Add(CDate(FCompra))
- coleccion.Add(CDec(ValTrans))
- coleccion.Add(CInt(Dias))
- coleccion.Add(CDate(FVenc))
- coleccion.Add(CDec(Rend))
- coleccion.Add(CDec(CostoTransfr))
- coleccion.Add(codigo)
- coleccion.Add(ComisionCasa)
- coleccion.Add(ComisionBolsa)
- coleccion.Add(Casa)
- coleccion.Add(IOF)
- coleccion.Add(Renta)
- coleccion.Add(Base)
- coleccion.Add(ComisionCasaValor)
- coleccion.Add(ComisionBolsaValor)
- coleccion.Add(IOFValor)
- coleccion.Add(OtrosCostos)
- coleccion.Add(TotalCostos)
- coleccion.Add(MontoLiq)
- coleccion.Add(IntGenerar)
- coleccion.Add(RendAntImp)
- coleccion.Add(RendDesImp)
- coleccion.Add(ImpLiq)
- coleccion.Add(IngrNet)
- coleccion.Add(ValorNet)
- coleccion.Add(EstadoIOF)
- coleccion.Add(EstadoRenta)
- End If
- Return coleccion
- End Function
- 'GETS
- Function GetFechaCompra() As Date
- Dim valor As Date
- valor = dtpFechaCompra.Value
- Return valor
- End Function
- Private Sub dgvReportos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellEndEdit
- 'If (InStr(Variables.Codigo, "REPOVENTA") > 0) Then
- ' RellenarDatos()
- 'End If
- CorrelativoSinBD()
- Correlativo()
- Calculos()
- End Sub
- Private Sub dtpFechaCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaCompra.ValueChanged
- Formato()
- IngresarDatos()
- If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- End If
- Modificado = True
- Calculos()
- End Sub
- Private Sub dgvReportos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellClick
- IOFRentaEstado()
- IngresarDatosReves()
- NuevaFila()
- If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Dim Index = dgvReportos.CurrentRow.Cells("codigo").Value
- CargarFecha()
- RotarValores(Index)
- Calculos()
- 'AgregarCheckbox()
- 'CalcularCheckbox()
- 'ElseIf (InStr(Variables.Codigo, "REPOVENTA") > 0) Then
- ' RellenarDatos()
- ' PrepararRepoVentas()
- End If
- Formato()
- End Sub
- Private Sub dgvReportos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellContentClick
- End Sub
- Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
- End Sub
- Private Sub txtCodigoTitulo_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoTitulo.TextChanged
- Modificado = True
- End Sub
- Private Sub txtIOF_TextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- btnAccion.Text = "Modificar"
- 'btnAgregarImpuesto.Text = "Modificar"
- Estado = "M"
- End Sub
- Sub NuevoIngreso(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer, ByVal Tabla As String)
- Dim i As Integer = 0
- Dim Index = dgvReportos.Rows.Count - 2
- i = Cantidad
- While i <= Index
- Dim coleccion = ObtenerDatos(i)
- If ReportoConsula.Nuevo(coleccion, Codigo, Tabla) Is Nothing Then
- Exit Sub
- End If
- i += 1
- End While
- MsgBox("Reportos actualizados")
- End Sub
- Function NuevoIngresoColeccion()
- Dim i As Integer = 0
- Dim Index = dgvReportos.Rows.Count - 2
- Dim diccionario As New Dictionary(Of String, Collection)
- While i <= Index
- Dim coleccion = ObtenerDatos(i)
- diccionario.Add(i, coleccion)
- i += 1
- End While
- Return diccionario
- End Function
- Function CanRegistros(ByVal Tabla As String)
- Dim Codigo = Variables.Codigo
- Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
- Return Cantidad
- End Function
- Sub ModificarIngreso()
- Dim i As Integer = 0
- Dim CantidadRegistrosDB = CanRegistros(Tabla)
- While i < CantidadRegistrosDB
- Dim coleccion = ObtenerDatos(i)
- If ReportoConsula.Modificar(coleccion, Codigo, Tabla) Is Nothing Then
- Exit Sub
- End If
- i += 1
- End While
- NuevoIngreso(True, CantidadRegistrosDB, Tabla)
- End Sub
- Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
- LlenarBase()
- Dim Codigo = Variables.Codigo
- Dim diccionario As Dictionary(Of String, Collection) = NuevoIngresoColeccion()
- If (Estado = "N") Then
- ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla)
- 'ModificarIngreso()
- ValidarExistencia()
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionREPO = diccionario
- Me.Close()
- ElseIf (Estado = "M") Then
- 'ModificarIngreso()
- ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla)
- ValidarExistencia()
- ElseIf (Estado = "B") Then
- QuitarFila()
- ValidarExistencia()
- End If
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- btnAccion.Text = "Agregar"
- 'btnAgregarImpuesto.Text = "Agregar"
- Estado = "N"
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- btnAccion.Text = "Eliminar"
- ' btnAgregarImpuesto.Text = "Eliminar"
- Estado = "B"
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- End Sub
- Sub GuardarImpuesto()
- ' Dim Impuesto = dgvImpuestos.CurrentRow.Cells(0).Value
- ' Dim CodigoInv = Variables.Codigo
- ' Dim codigo = dgvImpuestos.CurrentRow.Cells(1).Value
- ' Dim ValorImpuesto = ReportoConsula.TraerImpuesto(Impuesto)
- ' Dim Valor = ReportoConsula.AgregarImpuesto(CodigoInv, codigo, Impuesto, 0)
- ' ActualizarImpuestos(Valor)
- End Sub
- Private Sub btnAgregarImpuesto_Click(sender As Object, e As EventArgs)
- GuardarImpuesto()
- End Sub
- Private Sub dgvImpuestos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub TabPage3_Click(sender As Object, e As EventArgs) Handles TbImpuestos.Click
- End Sub
- Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub btnQuitar_Click(sender As Object, e As EventArgs)
- ModificarImpuestos()
- 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
- 'Dim Codigo
- 'Cadena = dgvImpuestoAgregado.CurrentRow.Cells(0).Value
- 'Codigo = dgvImpuestoAgregado.CurrentRow.Cells(1).Value
- 'If (String.IsNullOrEmpty(Cadena) Or String.IsNullOrEmpty(Codigo)) Then
- 'MsgBox("No se puede quitar una cadena vacía")
- 'Else
- 'ModificarImpu(Cadena, Codigo)
- 'End If
- End Sub
- Sub ModificarImpu(ByVal Impuesto As String, ByVal Codigo As Integer)
- Dim CodigoInv = Variables.Codigo
- 'Dim ValorImpuesto = ReportoConsula.TraerImpuesto(Impuesto)
- Dim Valor = ReportoConsula.AgregarImpuesto(CodigoInv, Codigo, Impuesto, 1)
- ActualizarImpuestos(Valor)
- 'ActualizarImpuestos(Valor)
- 'RefrescarValorControles()
- End Sub
- Private Sub FlpIOF_Click(sender As Object, e As EventArgs) Handles FlpIOF.Click
- End Sub
- Private Sub FlpIOF_MouseClick(sender As Object, e As MouseEventArgs) Handles FlpIOF.MouseClick
- End Sub
- Private Sub FlpIOF_ChangeUICues(sender As Object, e As UICuesEventArgs) Handles FlpIOF.ChangeUICues
- End Sub
- Private Sub FlpIOF_Paint(sender As Object, e As PaintEventArgs) Handles FlpIOF.Paint
- End Sub
- Private Sub txtComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionCasa.KeyPress
- If String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%")) Then
- If e.KeyChar = "." Then
- txtComisionCasa.Text = "0.0%"
- Exit Sub
- End If
- End If
- If (Not txtComisionCasa.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 txtComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionBolsa.KeyPress
- If String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%")) Then
- If e.KeyChar = "." Then
- txtComisionBolsa.Text = "0.2825%"
- Exit Sub
- End If
- End If
- If (Not txtComisionBolsa.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 BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
- End Sub
- Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
- IngresarDatos()
- Modificado = True
- Calculos()
- End Sub
- Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
- IngresarDatos()
- If (InstrumentoFinanciero = "REPOVENTA") Then
- End If
- Modificado = True
- Calculos()
- End Sub
- Private Sub txtDias_TextChanged(sender As Object, e As EventArgs) Handles txtDias.TextChanged
- IngresarDatos()
- If (InstrumentoFinanciero = "REPOVENTA") Then
- End If
- Modificado = True
- Calculos()
- End Sub
- Private Sub cboCasaCorredora_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasaCorredora.SelectedIndexChanged
- Modificado = True
- IngresarDatos()
- End Sub
- Private Sub txtCodigoTitulo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCodigoTitulo.KeyPress
- End Sub
- Private Sub txtDias_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDias.KeyPress
- If String.IsNullOrEmpty(txtDias.Text) Then
- If e.KeyChar = "." Then
- txtDias.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtDias.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 txtCodigoTitulo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCodigoTitulo.KeyUp
- IngresarDatos()
- End Sub
- Private Sub txtComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionCasa.KeyUp
- If txtComisionCasa.Text = "." Then
- txtComisionCasa.Text = ".0%"
- End If
- IngresarDatos()
- Calculos()
- End Sub
- Private Sub txtComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionBolsa.KeyUp
- If txtComisionBolsa.Text = "." Then
- txtComisionBolsa.Text = ".0%"
- End If
- IngresarDatos()
- Calculos()
- End Sub
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Tabla = "REP0VENTA"
- ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then
- Tabla = "REP0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If (Existe) Then
- navNuevo.Enabled = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- Else
- navNuevo.Enabled = True
- navModificar.Enabled = False
- navEliminar.Enabled = False
- End If
- Estado = String.Empty
- btnAccion.Text = "Aceptar"
- End Sub
- Function ExisteValidacion()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
- Tabla = "REP0VENTA"
- ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then
- Tabla = "REP0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Private Sub btnGuardar_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvReportos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvReportos.CellBeginEdit
- CorrelativoSinBD()
- Correlativo()
- End Sub
- Private Sub txtDias_KeyUp(sender As Object, e As KeyEventArgs) Handles txtDias.KeyUp
- If txtDias.Text = "." Then
- txtDias.Text = ".0"
- End If
- IngresarDatos()
- Calculos()
- End Sub
- Private Sub cboAnioBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBase.SelectedIndexChanged
- LlenarBase()
- IngresarDatos()
- If (InstrumentoFinanciero = "REPOVENTA") Then
- End If
- Modificado = True
- Calculos()
- End Sub
- Private Sub txtDias_Leave(sender As Object, e As EventArgs) Handles txtDias.Leave
- RellenarTxt()
- Formato()
- End Sub
- Private Sub txtComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionCasa.Leave
- Formato()
- End Sub
- Private Sub txtComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtComisionBolsa.Leave
- Formato()
- End Sub
- Private Sub frmReporto_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
- dgvReportos.Width = Me.Width - 10
- dgvReportos.Height = Me.Height - 290
- End Sub
- Private Sub ChkIOF_CheckedChanged(sender As Object, e As EventArgs) Handles ChkIOF.CheckedChanged
- IOFRentaEstado()
- Modificado = True
- IngresarDatos()
- Calculos()
- End Sub
- Private Sub ChkRenta_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRenta.CheckedChanged
- IOFRentaEstado()
- Modificado = True
- IngresarDatos()
- Calculos()
- End Sub
- Private Sub txtCodigoInstrumento_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoInstrumento.TextChanged
- IngresarDatos()
- Modificado = True
- Calculos()
- End Sub
- Sub SeleccionarInstrumento()
- Dim frmInstrumentos As New frmSeleccionTitulosReportos
- frmInstrumentos.Show()
- End Sub
- Private Sub btnSaldoDisponible_Click(sender As Object, e As EventArgs)
- SeleccionarInstrumento()
- End Sub
- Private Sub btnRequisicion_Click(sender As Object, e As EventArgs)
- End Sub
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If Not RetCodigoInversionExiste And Not Existe Then
- If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then
- dgvReportos.Rows(0).Cells("Valor Trasado").Value = Variables.RetMonto
- End If
- End If
- End Sub
- End Class
|