| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376 |
- Public Class frmCertificadosDeInversion
- Dim oCEPrincipal As New CertificadoDeInversionCE
- Dim oDAOPrincipal As New CertificadosDeInversionDAO
- Dim oDAOGeneral As New DAOGeneral
- Dim Bonos As New BonosCE
- Dim TotalValorCupones As Double
- Dim Index
- Dim BonoCalculo As New FormulasBonoCE
- Dim Cargar As Boolean = True
- Dim BonosConsulta As New BonosDAO
- Dim Operaciones As New Operaciones
- Dim ModificarRenta As Boolean = True
- Dim Tipo As Integer = 0
- Dim IndexBaseC As Integer = 0
- Dim IndexBaseV As Integer = 0
- Dim PeriodoC As Integer = 0
- Dim PeriodoV As Integer = 0
- 'Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
- 'Private _Modo As String
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private _CodigoInversion As String
- Private _TipoTransaccion As String 'N=Nuevo, A=Actualizar, C=Consulta
- Private TipoPeriodicidad As Integer = 0
- Public InstanciaAmortizacion As New DataGridView
- Public InstanciaIngresos As New DataGridView
- Private TipoOperacion As String
- Public Sub New()
- InitializeComponent()
- End Sub
- Public Sub New(TipoOper As String)
- Me.New
- TipoOperacion = TipoOper
- End Sub
- Sub CargarBase()
- If cboAnioBaseC.Items.Count = 0 Or cboAnioBaseC.Items.Count = 1 Then
- Me.cboAnioBaseC.DataSource = oDAOGeneral.ListaBase
- Me.cboAnioBaseC.DisplayMember = "Descripcion"
- Me.cboAnioBaseC.ValueMember = "Codigo"
- Me.cboAnioBaseC.SelectedIndex = 0
- End If
- If cboAnioBaseV.Items.Count = 0 Or cboAnioBaseV.Items.Count = 1 Then
- Me.cboAnioBaseV.DataSource = oDAOGeneral.ListaBase
- Me.cboAnioBaseV.DisplayMember = "Descripcion"
- Me.cboAnioBaseV.ValueMember = "Codigo"
- Me.cboAnioBaseV.SelectedIndex = 0
- End If
- End Sub
- Public Property TipoTransaccion As String
- Get
- Return _TipoTransaccion
- End Get
- Set(value As String)
- _TipoTransaccion = value
- End Set
- End Property
- Private Property IdDocumento As Integer
- Get
- Return _IdDocumento
- End Get
- Set(value As Integer)
- _IdDocumento = value
- End Set
- End Property
- Private Property TipoDocumento As String
- Get
- Return _TipoDocumento
- End Get
- Set(value As String)
- _TipoDocumento = value
- End Set
- End Property
- Private Property CodigoInversion As String
- Get
- Return _CodigoInversion
- End Get
- Set(value As String)
- _CodigoInversion = value
- End Set
- End Property
- Function FechaCupon(ByVal liquidacion As Date, ByVal Vencimiento As Date, ByVal frecuencia As Integer)
- Dim periodos As Integer = 0
- If frecuencia = 1 Then
- periodos = -12
- ElseIf frecuencia = 2 Then
- periodos = -6
- ElseIf frecuencia = 4 Then
- periodos = -3
- ElseIf frecuencia = 12 Then
- periodos = -1
- End If
- If (Not periodos = 0) Then
- While Vencimiento > liquidacion
- Vencimiento = Vencimiento.AddMonths(periodos)
- End While
- Else
- Return liquidacion
- End If
- Return Vencimiento
- End Function
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Dim Ins As String = Instrumento()
- If (Ins = "TIT") Then
- Tabla = "TIT"
- ElseIf (Ins = "EURB") Then
- Tabla = "EURB0"
- ElseIf (Ins = "BONO") Then
- Tabla = "BON0"
- ElseIf (Ins = "CINV") Then
- Tabla = "CIN0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If Tabla = "TIT" Then
- If (Existe) Then
- navNuevo.Enabled = False
- 'TbIngresos.rea = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- btnIngresos.Enabled = True
- Else
- navNuevo.Enabled = True
- 'TbIngresos.Enabled = False
- navModificar.Enabled = False
- navEliminar.Enabled = False
- btnIngresos.Enabled = False
- End If
- Else
- If (Existe) Then
- navNuevo.Enabled = False
- 'TbIngresos.Enabled = True
- navModificar.Enabled = True
- navEliminar.Enabled = True
- btnIngresos.Enabled = True
- Else
- navNuevo.Enabled = True
- 'TbIngresos.Enabled = False
- navModificar.Enabled = False
- navEliminar.Enabled = False
- btnIngresos.Enabled = False
- End If
- End If
- TipoTransaccion = String.Empty
- btnAceptar.Text = "Aceptar"
- End Sub
- Function ExisteValidacion()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Dim Ins As String = Instrumento()
- If (Ins = "TIT") Then
- Tabla = "TIT"
- ElseIf (Ins = "EURB") Then
- Tabla = "EURB0"
- ElseIf (Ins = "BONO") Then
- Tabla = "BON0"
- ElseIf (Ins = "CINV") Then
- Tabla = "CIN0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Private Sub frmBonos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim VExisteInversion As Boolean = False
- If Variables.TipoOperacionCMVTA = "C" Then
- GrpVenta.Enabled = False
- GrpCompra.Enabled = True
- Else
- GrpVenta.Enabled = True
- GrpCompra.Enabled = False
- End If
- VExisteInversion = ExisteInversion()
- ValidarExistencia()
- Dim Ins As String = Instrumento()
- CargarBase()
- AsignacionPeriodicidad()
- If (Not Ins = "TIT") Then
- btnIngresos.Visible = False
- 'TbIngresos.Enabled = False
- End If
- If (Ins = "TIT") Then
- btnIngresos.Visible = True
- lblBono.Text = "Titularizacion"
- ConfTitularizacion()
- ElseIf (Ins = "EURB") Then
- lblBono.Text = "Euro Bonos"
- ElseIf (Ins = "BONO") Then
- lblBono.Text = "Bonos"
- End If
- Bono()
- Tipo = 1
- Call CargarPeriodos()
- 'PrepararTablaImpuestosYComisiones()
- PrepararTablaIngresos()
- If Me.TipoTransaccion Is Nothing Then
- Me.TipoTransaccion = "N"
- End If
- If Me.TipoTransaccion = "C" Then
- ' Call CargarRegistroBD()
- End If
- CargarIngresos()
- ' CargarComisiones()
- RefrescarValorControles()
- Cargar = False
- 'Calculos()
- 'Formato()
- 'ValidacionErrores()
- BotonQuitar()
- CamposTiempo()
- CargarTransladoNuevo()
- ConfiguracionCMVTA(VExisteInversion)
- End Sub
- Sub ConfiguracionCMVTA(ByRef VExisteInversion As Boolean)
- Dim Codigo As String = Variables.Codigo
- Dim ExisteCMVTA As Boolean = oDAOGeneral.ExisteCMVTA(Codigo)
- If Not ExisteCMVTA And Variables.InvocadorProInv = "frmINV" Then
- btnVenderTitulo.Visible = True
- End If
- If CantFormAbierto = False And Not VExisteInversion Then
- If Not Variables.TrasladarCMVTA Is Nothing Then
- cboAnioBaseC.SelectedIndex = Variables.TrasladarCMVTA.BaseCINV
- txtPorcentajeCuponCompra.Text = Variables.TrasladarCMVTA.CuponCINV
- dtpFechaLiquidacionCompra.Value = Variables.TrasladarCMVTA.FechaLiquidacionCINV
- dtpFechaVencimientoCompra.Value = Variables.TrasladarCMVTA.FechaVencimientoCINV
- cboPeriodosC.SelectedValue = Variables.TrasladarCMVTA.PeriodicidadCINV
- txtComisionPorBolsaCompra.Text = Variables.TrasladarCMVTA.PorcentajeComisionBolsaCINV
- txtComisionPorCompraCasa.Text = Variables.TrasladarCMVTA.PorcentajeComisionCasaCINV
- txtPrecioCompra.Text = Variables.TrasladarCMVTA.PrecioCompraCINV
- txtPrecioAlVencimientoCompra.Text = Variables.TrasladarCMVTA.PrecioVencimientoCINV
- dtpUltimaFechaCuponCompra.Value = Variables.TrasladarCMVTA.UltimaFechaCuponCINV
- txtValorNominalCompra.Text = Variables.TrasladarCMVTA.ValorNominalCINV
- txtYTMAlVencimientoCompra.Text = Variables.TrasladarCMVTA.YTMVencimientoCINV
- End If
- End If
- End Sub
- Function ExisteVenta()
- Dim Ventas As Boolean = False
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Ventas = General.ExisteVenta(Codigo)
- Return Ventas
- End Function
- Sub CamposTiempo()
- If Not TypeOf cboPeriodosC.SelectedValue Is DataRowView Then
- Variables.PeriodicidadTIT = cboPeriodosC.SelectedValue
- End If
- Variables.BaseTIT = cboAnioBaseC.SelectedIndex
- End Sub
- Sub ConfTitularizacion()
- dgvIngresos.Dispose()
- TbIngresos.Parent = Nothing
- Dim TbAmortizacion As New TabPage
- Dim frmTitularizacion As New frmResultadoTitularizacion()
- TbAmortizacion.Name = "tbAmortizacion"
- TbAmortizacion.Text = "Amortizacion"
- If TabCampos.TabCount = 2 Then
- frmTitularizacion.Dock = DockStyle.Fill
- frmTitularizacion.TopLevel = False
- frmTitularizacion.Parent = TbAmortizacion
- TabCampos.Controls.Add(TbAmortizacion)
- frmTitularizacion.Show()
- End If
- End Sub
- Function ExisteInversion()
- Dim Codigo As String = Variables.Codigo
- Dim TablaINV As String = "INV0"
- Dim TablaPINV As String = "PIN0"
- Dim General As New DAOGeneral
- Dim InvPro = Variables.InvPro
- If InvPro = "I" Then
- Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
- If INV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- If InvPro = "P" Then
- Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
- If PINV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- Return False
- End Function
- Sub Bono()
- dtpSiguienteFechaCuponCompra.Enabled = False
- dtpSiguienteFechaCuponVenta.Enabled = False
- dtpUltimaFechaCuponCompra.Enabled = True
- dtpUltimaFechaCuponVenta.Enabled = True
- End Sub
- Private Function Parametros()
- Dim Coleccion As New Collection
- Dim PeriodoCompra = cboPeriodosC.SelectedValue
- Dim ValorNominalCompra = txtValorNominalCompra.Text
- Dim UltCuponCompra = dtpUltimaFechaCuponCompra.Value
- Dim SigFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
- Dim FechaLiqCompra = dtpFechaLiquidacionCompra.Value
- Dim FechaVenCompra = dtpFechaVencimientoCompra.Value
- Dim PorcentajeCuponCompra = txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100
- Dim PrecioVenciCompra = txtPrecioAlVencimientoCompra.Text
- Dim PrecioCompra = txtPrecioCompra.Text
- Dim DiasBase = IndexBaseC
- Dim CostoTransCompra = txtCostoTransferenciaCompra.Text
- Dim PorcCupC = txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100
- Dim PeriodoVenta = cboPeriodosV.SelectedValue
- Dim ValorNominalVenta = txtValorNominalVenta.Text
- Dim UltCuponVenta = dtpUltimaFechaCuponVenta.Value
- Dim SigFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
- Dim FechaLiqVenta = dtpFechaLiquidacionVenta.Value
- Dim FechaVenVenta = dtpFechaVencimientoVenta.Value
- Dim PorcentajeCuponVenta = txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100
- Dim PrecioVenciVenta = txtPrecioAlVencimientoVenta.Text
- Dim PrecioVenta = txtPrecioVenta.Text
- Dim DiasBaseV = IndexBaseV
- Dim CostoTransVenta = txtCuponesRecibidos.Text
- Dim PorcCupV = txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100
- Dim ComisionPorCompraCasa = txtComisionPorCompraCasa.Text.TrimEnd("%") / 100
- Dim ComisionPorCompraBolsa = txtComisionPorBolsaCompra.Text.TrimEnd("%") / 100
- Dim ComisionPorVentaCasa = txtComisionPorVentaCasa.Text.TrimEnd("%") / 100
- Dim ComisionPorVentaBolsa = txtComisionPorBolsaVenta.Text.TrimEnd("%") / 100
- Dim YTMCompra = txtYTMAlVencimientoComisionCompra.Text.TrimEnd("%") / 100
- Dim YTMVenta = txtYTMAlVencimientoComisionVenta.Text.TrimEnd("%") / 100
- Dim DiasVenC, DiasVenV, DiasAcuC, DiasAcuV, YTMVenC, YTMVenV, IntAcuC, IntAcuV, IntPorAcuC, IntPorAcuV, PrecSucioC, PrecSucioV
- Dim ComisionCasaC, ComisionCasaV, ComisionBolsaC, ComisionBolsaV, ValTransC, ValTransV, MontoPagar, MontoRecibir, CostTrans, CupRecibidos
- DiasVenC = txtDiasAlVencimientoCompra.Text
- DiasVenV = txtDiasAlVencimientoVenta.Text
- DiasAcuC = txtDiasAcumuladosCompra.Text
- DiasAcuV = txtDiasAcumuladosVenta.Text
- YTMVenC = txtYTMAlVencimientoCompra.Text.ToString.Trim("%") / 100
- YTMVenV = txtYTMAlVencimientoVenta.Text.ToString.Trim("%") / 100
- IntAcuC = txtInteresAcumuladoCompra.Text
- IntAcuV = txtInteresAcumuladoVenta.Text
- IntPorAcuC = txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%") / 100
- IntPorAcuV = txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%") / 100
- PrecSucioC = txtPrecioSucioCompra.Text.ToString.Trim("%") / 100
- PrecSucioV = txtPrecioSucioVenta.Text.ToString.Trim("%") / 100
- ComisionCasaC = txtComisionCompraCasa.Text
- ComisionCasaV = txtComisionVentaCasa.Text
- ComisionBolsaC = txtComisionCompraBolsa.Text
- ComisionBolsaV = txtComisionVentaBolsa.Text
- ValTransC = txtValorTransadoCompra.Text
- ValTransV = txtValorTransadoVenta.Text
- MontoPagar = txtMontoAPagar.Text
- MontoRecibir = txtMontoARecibir.Text
- CostTrans = txtCostoTransferenciaCompra.Text
- CupRecibidos = txtCuponesRecibidos.Text
- Dim Codigo = Variables.Codigo
- Coleccion.Add(PeriodoCompra)
- Coleccion.Add(ValorNominalCompra)
- Coleccion.Add(UltCuponCompra)
- Coleccion.Add(SigFechaCuponCompra)
- Coleccion.Add(FechaLiqCompra)
- Coleccion.Add(FechaVenCompra)
- Coleccion.Add(PorcentajeCuponCompra)
- Coleccion.Add(PrecioVenciCompra)
- Coleccion.Add(PrecioCompra)
- Coleccion.Add(DiasBase)
- Coleccion.Add(CostoTransCompra)
- Coleccion.Add(PeriodoVenta)
- Coleccion.Add(ValorNominalVenta)
- Coleccion.Add(UltCuponVenta)
- Coleccion.Add(SigFechaCuponVenta)
- Coleccion.Add(FechaLiqVenta)
- Coleccion.Add(FechaVenVenta)
- Coleccion.Add(PorcentajeCuponVenta)
- Coleccion.Add(PrecioVenciVenta)
- Coleccion.Add(PrecioVenta)
- Coleccion.Add(DiasBaseV)
- Coleccion.Add(CostoTransVenta)
- Coleccion.Add(Codigo)
- Coleccion.Add(PorcCupC)
- Coleccion.Add(PorcCupV)
- Coleccion.Add(ComisionPorCompraCasa)
- Coleccion.Add(ComisionPorCompraBolsa)
- Coleccion.Add(ComisionPorVentaCasa)
- Coleccion.Add(ComisionPorVentaBolsa)
- Coleccion.Add(YTMCompra)
- Coleccion.Add(YTMVenta)
- Coleccion.Add(CInt(DiasVenC))
- Coleccion.Add(CInt(DiasVenV))
- Coleccion.Add(CInt(DiasAcuC))
- Coleccion.Add(CInt(DiasAcuV))
- Coleccion.Add(CDec(YTMVenC))
- Coleccion.Add(CDec(YTMVenV))
- Coleccion.Add(CDec(IntAcuC))
- Coleccion.Add(CDec(IntAcuV))
- Coleccion.Add(CDec(IntPorAcuC))
- Coleccion.Add(CDec(IntPorAcuV))
- Coleccion.Add(CDec(PrecSucioC))
- Coleccion.Add(CDec(PrecSucioV))
- Coleccion.Add(CDec(ComisionCasaC))
- Coleccion.Add(CDec(ComisionCasaV))
- Coleccion.Add(CDec(ComisionBolsaC))
- Coleccion.Add(CDec(ComisionBolsaV))
- Coleccion.Add(CDec(ValTransC))
- Coleccion.Add(CDec(ValTransV))
- Coleccion.Add(CDec(MontoPagar))
- Coleccion.Add(CDec(MontoRecibir))
- Coleccion.Add(CDec(CostTrans))
- Coleccion.Add(CDec(CupRecibidos))
- Return Coleccion
- End Function
- Private Sub LimpiarElementos()
- Dim Fecha = DateTime.Today
- dgvIngresos.Rows.Clear()
- cboPeriodosC.SelectedIndex = -1
- txtValorNominalCompra.Text = String.Empty
- dtpUltimaFechaCuponCompra.Value = Fecha
- dtpSiguienteFechaCuponCompra.Value = Fecha
- dtpFechaLiquidacionCompra.Value = Fecha
- dtpFechaVencimientoCompra.Value = Fecha
- txtPorcentajeCuponCompra.Text = String.Empty
- txtPrecioAlVencimientoCompra.Text = String.Empty
- txtPrecioCompra.Text = String.Empty
- cboAnioBaseC.SelectedIndex = 0
- txtCostoTransferenciaCompra.Text = String.Empty
- txtYTMAlVencimientoCompra.Text = String.Empty
- txtYTMAlVencimientoComisionCompra.Text = String.Empty
- txtComisionCompraCasa.Text = String.Empty
- txtComisionCompraBolsa.Text = String.Empty
- cboPeriodosV.SelectedIndex = -1
- txtValorNominalVenta.Text = String.Empty
- dtpUltimaFechaCuponVenta.Value = Fecha
- dtpSiguienteFechaCuponVenta.Value = Fecha
- dtpFechaLiquidacionVenta.Value = Fecha
- dtpFechaVencimientoVenta.Value = Fecha
- txtPorcentajeCuponVenta.Text = String.Empty
- txtPrecioAlVencimientoVenta.Text = String.Empty
- txtPrecioVenta.Text = String.Empty
- cboAnioBaseV.SelectedIndex = 0
- txtCuponesRecibidos.Text = String.Empty
- txtYTMAlVencimientoVenta.Text = String.Empty
- txtYTMAlVencimientoComisionVenta.Text = String.Empty
- txtComisionVentaCasa.Text = String.Empty
- txtComisionVentaBolsa.Text = String.Empty
- End Sub
- Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
- Dim Codigo = Variables.Codigo
- If TipoTransaccion = "N" Then
- oDAOPrincipal.Nuevo(Parametros, Instrumento)
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionCINV = Parametros()
- Me.Close()
- End If
- If TipoTransaccion = "M" Then
- Dim Diccionario As New Dictionary(Of Integer, Collection)
- Diccionario = ModificarIngreso()
- oDAOPrincipal.ProcesoDatos(Parametros, Diccionario, Instrumento)
- End If
- If TipoTransaccion = "B" Then
- oDAOPrincipal.
- Eliminar(Codigo, Instrumento)
- 'EliminarIngreso()
- LimpiarElementos()
- End If
- ValidarExistencia()
- End Sub
- Function RetornarObjeto()
- Return oCEPrincipal
- End Function
- Public Sub CargarRegistro(vId As Integer, vTipo As String)
- TipoTransaccion = "C"
- IdDocumento = vId
- TipoDocumento = vTipo
- End Sub
- Public Sub CargarRegistro(ByVal CodInversion As String)
- TipoTransaccion = "C"
- CodigoInversion = CodInversion
- End Sub
- Private Sub CargarRegistroBD()
- oCEPrincipal = Nothing
- ' oCEPrincipal = oDAOPrincipal.CargarRegistro(Me.CodigoInversion)
- TipoTransaccion = "C"
- RefrescarValorControles()
- End Sub
- Private Sub dtpUltimaFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponCompra.ValueChanged
- 'ActivarEdicion()
- ' ControlUltimaFechaCuponCompra()
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpSiguienteFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponCompra.ValueChanged
- 'ActivarEdicion()
- ' ControlSiguienteFechaCuponCompra()
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionCompra.ValueChanged
- 'ActivarEdicion()
- ' ControlFechaLiquidacionCompra()
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaVencimientoCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
- 'ActivarEdicion()
- ' ControlFechaVencimientoCompra()
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeCuponCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.TextChanged
- 'ActivarEdicion()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra.TextChanged
- 'ActivarEdicion()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.TextChanged
- 'ActivarEdicion()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtCostoTransferenciaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.TextChanged
- 'RefrescarMontoAPagarCompra()
- 'ActivarEdicion()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaVencimientoVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- 'ActivarEdicion()
- ' ControlFechaVencimientoVenta()
- End Sub
- Private Sub ControlFechaVencimientoVenta()
- Dim valor As Date
- valor = dtpFechaVencimientoVenta.Value.Date
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- oCEPrincipal.FechaVencimientoVenta = valor
- End If
- End Sub
- Private Sub cboAnioBaseC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseC.SelectedIndexChanged
- 'ActivarEdicion()
- ' ControlAnioBaseCompra()
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub cboAnioBaseV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseV.SelectedIndexChanged
- 'RefrescarInteresAcumuladoVenta()
- 'RefrescarDiasAlVencimientoVenta()
- 'RefrescarDiasAcumuladosVenta()
- ' ControlAnioBaseVenta()
- 'ActivarEdicion()
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub ControlAnioBaseVenta()
- Dim valor As Integer
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- If cboAnioBaseV.SelectedIndex > -1 Then
- oCEPrincipal.DiasBaseVenta = cboAnioBaseV.SelectedItem
- Else
- oCEPrincipal.DiasBaseVenta = 365
- End If
- End If
- End Sub
- Sub CargarPeriodos()
- If cboPeriodosC.Items.Count = 0 Or cboPeriodosC.Items.Count = 1 Then
- Me.cboPeriodosC.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosC.ValueMember = "Codigo"
- Me.cboPeriodosC.DisplayMember = "Descripcion"
- Me.cboPeriodosC.SelectedIndex = 0
- End If
- If cboPeriodosV.Items.Count = 0 Or cboPeriodosV.Items.Count = 1 Then
- Me.cboPeriodosV.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosV.ValueMember = "Codigo"
- Me.cboPeriodosV.DisplayMember = "Descripcion"
- Me.cboPeriodosV.SelectedIndex = 0
- End If
- End Sub
- Private Sub cboPeriodosC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosC.SelectedIndexChanged
- Formato()
- Calculos()
- ControlPeriodosCompra()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub cboPeriodosV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosV.SelectedIndexChanged
- 'ActivarEdicion()
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- 'Sub RefrescarTablaIngresos()
- ' 'Me.dgvIngresos.DataSource = CalcularCupones()
- 'End Sub
- Private Sub RefrescarValorControles()
- Dim codigo = Variables.Codigo
- Dim coleccion = oDAOPrincipal.CargarRegistro(codigo, Instrumento)
- If (Not coleccion.Count = 1) Then
- Dim Operaciones As New Operaciones
- If coleccion(10) = 0 Then
- IndexBaseC = 0
- ElseIf coleccion(10) = 1 Then
- IndexBaseC = 1
- ElseIf coleccion(10) = 2 Then
- IndexBaseC = 2
- Else
- IndexBaseC = 3
- End If
- If coleccion(21) = 0 Then
- IndexBaseV = 0
- ElseIf coleccion(21) = 1 Then
- IndexBaseV = 1
- ElseIf coleccion(21) = 2 Then
- IndexBaseV = 2
- Else
- IndexBaseV = 3
- End If
- cboPeriodosC.SelectedValue = coleccion(1).ToString
- If (String.IsNullOrEmpty(coleccion(2).ToString)) Then
- txtValorNominalCompra.Text = 0
- Else
- txtValorNominalCompra.Text = coleccion(2).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(3).ToString)) Then
- dtpUltimaFechaCuponCompra.Value = Date.Now.Date
- Else
- dtpUltimaFechaCuponCompra.Value = coleccion(3).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(4).ToString)) Then
- dtpSiguienteFechaCuponCompra.Value = Date.Now.Date
- Else
- dtpSiguienteFechaCuponCompra.Value = coleccion(4).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(5).ToString)) Then
- dtpFechaLiquidacionCompra.Value = Date.Now.Date
- Else
- dtpFechaLiquidacionCompra.Value = coleccion(5).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(6).ToString)) Then
- dtpFechaVencimientoCompra.Value = Date.Now.Date
- Else
- dtpFechaVencimientoCompra.Value = coleccion(6).ToString
- End If
- ' txtPorcentajeCuponCompra.Text = coleccion(7)
- If (String.IsNullOrEmpty(coleccion(8).ToString)) Then
- txtPrecioAlVencimientoCompra.Text = 0
- Else
- txtPrecioAlVencimientoCompra.Text = coleccion(8).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(9).ToString)) Then
- Else
- txtPrecioCompra.Text = coleccion(9).ToString
- End If
- cboAnioBaseC.SelectedIndex = IndexBaseC
- If (String.IsNullOrEmpty(coleccion(11).ToString)) Then
- txtCostoTransferenciaCompra.Text = 0
- Else
- txtCostoTransferenciaCompra.Text = coleccion(11).ToString
- End If
- txtPorcentajeInteresAcumuladoCompra.Text = String.Empty
- If (String.IsNullOrEmpty(coleccion(23).ToString)) Then
- txtPorcentajeCuponCompra.Text = 0
- Else
- txtPorcentajeCuponCompra.Text = (CDec(coleccion(23) * 100).ToString)
- End If
- 'txtDiasAlVencimientoCompra.Text = BonoCalculo.DiasVencimiento(dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
- 'txtDiasAcumuladosCompra.Text = Operaciones.DiasAcumulados(dtpUltimaFechaCuponCompra.Value, dtpFechaLiquidacionCompra.Value, IndexBaseC).ToString
- 'txtInteresAcumuladoCompra.Text = Operaciones.InteresAcumulado(txtValorNominalCompra.Text, txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100, txtDiasAcumuladosCompra.Text, IndexBaseC).ToString
- 'txtPorcentajeInteresAcumuladoCompra.Text = Operaciones.InteresAcumuladoPor(txtInteresAcumuladoCompra.Text, txtValorNominalCompra.Text) * 100
- 'txtPrecioSucioCompra.Text = Operaciones.PrecioSucio(txtPrecioCompra.Text, txtPorcentajeInteresAcumuladoCompra.Text / 100).ToString
- 'txtValorTransadoCompra.Text = Operaciones.ValorTrasado(txtPrecioCompra.Text, txtValorNominalCompra.Text).ToString
- If (String.IsNullOrEmpty(txtComisionPorCompraCasa.Text)) Then
- txtComisionPorCompraCasa.Text = 0
- End If
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- txtValorTransadoCompra.Text = 0
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text)) Then
- txtComisionPorBolsaCompra.Text = 0
- End If
- txtComisionCompraCasa.Text = Operaciones.Comisiones(CDec(txtComisionPorCompraCasa.Text.TrimEnd("%") / 100), CDec(txtValorTransadoCompra.Text)).ToString
- txtComisionCompraBolsa.Text = Operaciones.Comisiones(CDec(txtComisionPorBolsaCompra.Text.TrimEnd("%") / 100), CDec(txtValorTransadoCompra.Text)).ToString
- If (String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text.ToString)) Then
- txtYTMAlVencimientoCompra.Text = 0
- End If
- 'txtYTMAlVencimientoComisionCompra.Text = Bonos.CalcularYTMComision(CDec(txtYTMAlVencimientoCompra.Text.TrimEnd("%") / 100), CDec(txtComisionPorCompraCasa.Text.ToString.Trim("%")), CDec(txtDiasAlVencimientoCompra.Text), CDec(txtComisionPorBolsaCompra.Text.ToString.Trim("%")), dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
- 'txtMontoAPagar.Text = Operaciones.MontoPagar(CDec(txtValorTransadoCompra.Text), CDec(txtComisionCompraBolsa.Text), CDec(txtComisionCompraCasa.Text), CDec(txtInteresAcumuladoCompra.Text), CDec(txtCostoTransferenciaCompra.Text)).ToString
- If (String.IsNullOrEmpty(coleccion(12).ToString)) Then
- cboPeriodosV.SelectedValue = 0
- Else
- cboPeriodosV.SelectedValue = coleccion(12).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(13).ToString)) Then
- txtValorNominalVenta.Text = 0
- Else
- txtValorNominalVenta.Text = coleccion(13).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(14).ToString)) Then
- dtpUltimaFechaCuponVenta.Value = Date.Now.Date
- Else
- dtpUltimaFechaCuponVenta.Value = coleccion(14).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(15).ToString)) Then
- dtpSiguienteFechaCuponVenta.Value = Date.Now.Date
- Else
- dtpSiguienteFechaCuponVenta.Value = coleccion(15).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(16).ToString)) Then
- dtpFechaLiquidacionVenta.Value = Date.Now.Date
- Else
- dtpFechaLiquidacionVenta.Value = coleccion(16).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(17).ToString)) Then
- dtpFechaVencimientoVenta.Value = Date.Now.Date
- Else
- dtpFechaVencimientoVenta.Value = coleccion(17).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(24).ToString)) Then
- txtPorcentajeCuponVenta.Text = 0
- Else
- txtPorcentajeCuponVenta.Text = CDec(coleccion(24) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(19).ToString)) Then
- txtPrecioAlVencimientoVenta.Text = 0
- Else
- txtPrecioAlVencimientoVenta.Text = coleccion(19).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(20).ToString)) Then
- txtPrecioVenta.Text = 0
- Else
- txtPrecioVenta.Text = coleccion(20).ToString
- End If
- cboAnioBaseV.SelectedIndex = IndexBaseV
- If (String.IsNullOrEmpty(coleccion(22).ToString)) Then
- txtCuponesRecibidos.Text = 0
- Else
- txtCuponesRecibidos.Text = coleccion(22).ToString
- End If
- 'txtDiasAlVencimientoVenta.Text = BonoCalculo.DiasVencimiento(dtpFechaLiquidacionVenta.Value, dtpFechaVencimientoVenta.Value, IndexBaseV).ToString
- 'txtDiasAcumuladosVenta.Text = Operaciones.DiasAcumulados(dtpUltimaFechaCuponVenta.Value, dtpFechaLiquidacionVenta.Value, IndexBaseV).ToString
- 'txtInteresAcumuladoVenta.Text = Operaciones.InteresAcumulado(txtValorNominalVenta.Text, txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100, txtDiasAcumuladosVenta.Text, IndexBaseV).ToString
- 'txtPorcentajeInteresAcumuladoVenta.Text = Operaciones.InteresAcumuladoPor(txtInteresAcumuladoVenta.Text, txtValorNominalVenta.Text) * 100
- 'txtPrecioSucioVenta.Text = Operaciones.PrecioSucio(txtPrecioVenta.Text, txtPorcentajeInteresAcumuladoVenta.Text / 100).ToString
- 'txtValorTransadoVenta.Text = Operaciones.ValorTrasado(txtPrecioVenta.Text, txtValorNominalCompra.Text).ToString
- If (String.IsNullOrEmpty(txtComisionPorVentaCasa.Text)) Then
- txtComisionPorVentaCasa.Text = 0
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text)) Then
- txtComisionPorBolsaVenta.Text = 0
- End If
- 'txtComisionVentaCasa.Text = Operaciones.Comisiones(CDec(txtComisionPorVentaCasa.Text.TrimEnd("%") / 100), CDec(txtValorTransadoVenta.Text)).ToString
- 'txtComisionVentaBolsa.Text = Operaciones.Comisiones(CDec(txtComisionPorBolsaVenta.Text.TrimEnd("%") / 100), CDec(txtValorTransadoVenta.Text)).ToString
- If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text.ToString) Then
- txtYTMAlVencimientoVenta.Text = 0
- End If
- 'txtYTMAlVencimientoComisionVenta.Text = Bonos.CalcularYTMComision(CDec(txtYTMAlVencimientoCompra.Text.TrimEnd("%") / 100), CDec(txtComisionPorCompraCasa.Text.ToString.Trim("%")), CDec(txtDiasAlVencimientoCompra.Text), CDec(txtComisionPorBolsaCompra.Text.ToString.Trim("%")), dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
- 'txtMontoARecibir.Text = Operaciones.MontoRecibir(txtValorTransadoVenta.Text, txtComisionVentaBolsa.Text, txtComisionVentaCasa.Text, txtInteresAcumuladoVenta.Text).ToString
- 'txtCuponesRecibidos.Text = Recibido().ToString
- If (String.IsNullOrEmpty(coleccion(25).ToString)) Then
- txtComisionPorCompraCasa.Text = 0
- Else
- txtComisionPorCompraCasa.Text = (CDec(coleccion(25)) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(26).ToString)) Then
- txtComisionPorBolsaCompra.Text = 0
- Else
- txtComisionPorBolsaCompra.Text = (CDec(coleccion(26)) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(27).ToString)) Then
- txtComisionPorVentaCasa.Text = 0
- Else
- txtComisionPorVentaCasa.Text = (CDec(coleccion(27)) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(28).ToString)) Then
- txtComisionPorBolsaVenta.Text = 0
- Else
- txtComisionPorBolsaVenta.Text = (CDec(coleccion(28)) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(29).ToString)) Then
- txtYTMAlVencimientoComisionCompra.Text = 0
- Else
- txtYTMAlVencimientoComisionCompra.Text = (CDec(coleccion(29)) * 100).ToString
- End If
- If (String.IsNullOrEmpty(coleccion(30).ToString)) Then
- txtYTMAlVencimientoComisionVenta.Text = 0
- Else
- txtYTMAlVencimientoComisionVenta.Text = (CDec(coleccion(30)) * 100).ToString
- End If
- 'Campos Extras'
- If Not String.IsNullOrEmpty(coleccion(31).ToString) Then
- txtDiasAlVencimientoCompra.Text = coleccion(31).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(32).ToString) Then
- txtDiasAlVencimientoVenta.Text = coleccion(32).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(33).ToString) Then
- txtDiasAcumuladosCompra.Text = coleccion(33).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(34).ToString) Then
- txtDiasAcumuladosVenta.Text = coleccion(34).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(35).ToString) Then
- txtYTMAlVencimientoCompra.Text = (coleccion(35) * 100).ToString + "%"
- End If
- If Not String.IsNullOrEmpty(coleccion(36).ToString) Then
- txtYTMAlVencimientoVenta.Text = (coleccion(36) * 100).ToString + "%"
- End If
- If Not String.IsNullOrEmpty(coleccion(37).ToString) Then
- txtPorcentajeInteresAcumuladoCompra.Text = (coleccion(37) * 100).ToString + "%"
- End If
- If Not String.IsNullOrEmpty(coleccion(38).ToString) Then
- txtPorcentajeInteresAcumuladoVenta.Text = (coleccion(38) * 100).ToString + "%"
- End If
- If Not String.IsNullOrEmpty(coleccion(39).ToString) Then
- txtInteresAcumuladoCompra.Text = coleccion(39).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(40).ToString) Then
- txtInteresAcumuladoVenta.Text = coleccion(40).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(41).ToString) Then
- txtPrecioSucioCompra.Text = (coleccion(41) * 100).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(42).ToString) Then
- txtPrecioSucioVenta.Text = (coleccion(42) * 100).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(43).ToString) Then
- txtComisionCompraCasa.Text = coleccion(43).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(44).ToString) Then
- txtComisionVentaCasa.Text = coleccion(44).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(45).ToString) Then
- txtComisionCompraBolsa.Text = coleccion(45).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(46).ToString) Then
- txtComisionVentaBolsa.Text = coleccion(46).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(47).ToString) Then
- txtValorTransadoCompra.Text = coleccion(47).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(48).ToString) Then
- txtValorTransadoVenta.Text = coleccion(48).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(49).ToString) Then
- txtMontoAPagar.Text = coleccion(49).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(50).ToString) Then
- txtMontoARecibir.Text = coleccion(50).ToString
- End If
- If Not String.IsNullOrEmpty(coleccion(51).ToString) Then
- txtCuponesRecibidos.Text = coleccion(51).ToString
- End If
- End If
- End Sub
- Sub Formato()
- If cboPeriodosC.SelectedIndex = -1 Then
- If cboPeriodosC.Items.Count > 0 Then
- cboPeriodosC.SelectedIndex = 0
- End If
- End If
- If cboPeriodosV.SelectedIndex = -1 Then
- If cboPeriodosV.Items.Count > 0 Then
- cboPeriodosV.SelectedIndex = 0
- End If
- End If
- If cboAnioBaseC.SelectedIndex = -1 Then
- If cboAnioBaseC.Items.Count > 0 Then
- cboAnioBaseC.SelectedIndex = 0
- End If
- End If
- If cboAnioBaseV.SelectedIndex = -1 Then
- If cboAnioBaseV.Items.Count > 0 Then
- cboAnioBaseV.SelectedIndex = 0
- End If
- End If
- If IsNumeric(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- End If
- If (String.IsNullOrEmpty(txtValorNominalCompra.Text.ToString)) Then
- txtValorNominalCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAlVencimientoCompra.Text)) Then
- txtDiasAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAcumuladosCompra.Text)) Then
- txtDiasAcumuladosCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text)) Then
- txtPorcentajeCuponCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionCompra.Text)) Then
- txtYTMAlVencimientoComisionCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text)) Then
- txtYTMAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text)) Then
- txtPrecioAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioCompra.Text)) Then
- txtPrecioCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtInteresAcumuladoCompra.Text)) Then
- txtInteresAcumuladoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text)) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioSucioCompra.Text)) Then
- txtPrecioSucioCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorCompraCasa.Text)) Then
- txtComisionPorCompraCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionCompraCasa.Text)) Then
- txtComisionCompraCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text)) Then
- txtComisionPorBolsaCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionCompraBolsa.Text)) Then
- txtComisionCompraBolsa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- txtValorTransadoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtMontoAPagar.Text)) Then
- txtMontoAPagar.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text)) Then
- txtCostoTransferenciaCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorNominalVenta.Text)) Then
- txtValorNominalVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAlVencimientoVenta.Text)) Then
- txtDiasAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAcumuladosVenta.Text)) Then
- txtDiasAcumuladosVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text)) Then
- txtPorcentajeCuponVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionVenta.Text)) Then
- txtYTMAlVencimientoComisionVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text)) Then
- txtYTMAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text)) Then
- txtPrecioAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioVenta.Text)) Then
- txtPrecioVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtInteresAcumuladoVenta.Text)) Then
- txtInteresAcumuladoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text)) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioSucioVenta.Text)) Then
- txtPrecioSucioVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorVentaCasa.Text)) Then
- txtComisionPorVentaCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionVentaCasa.Text)) Then
- txtComisionVentaCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text)) Then
- txtComisionPorBolsaVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionVentaBolsa.Text)) Then
- txtComisionVentaBolsa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
- txtValorTransadoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtMontoARecibir.Text)) Then
- txtMontoARecibir.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtCuponesRecibidos.Text)) Then
- txtCuponesRecibidos.Text = "0.0"
- End If
- If (txtPorcentajeCuponCompra.ToString.IndexOf("%") = -1) Then
- txtPorcentajeCuponCompra.Text += "%"
- End If
- If (txtYTMAlVencimientoCompra.ToString.IndexOf("%") = -1) Then
- txtYTMAlVencimientoCompra.Text += "%"
- End If
- If (txtPorcentajeCuponVenta.ToString.IndexOf("%") = -1) Then
- txtPorcentajeCuponVenta.Text += "%"
- End If
- If (txtYTMAlVencimientoVenta.ToString.IndexOf("%") = -1) Then
- txtYTMAlVencimientoVenta.Text += "%"
- End If
- If (txtComisionPorCompraCasa.ToString.IndexOf("%") = -1) Then
- txtComisionPorCompraCasa.Text += "%"
- End If
- If (txtComisionPorBolsaCompra.ToString.IndexOf("%") = -1) Then
- txtComisionPorBolsaCompra.Text += "%"
- End If
- If (txtComisionPorVentaCasa.ToString.IndexOf("%") = -1) Then
- txtComisionPorVentaCasa.Text += "%"
- End If
- If (txtComisionPorBolsaVenta.ToString.IndexOf("%") = -1) Then
- txtComisionPorBolsaVenta.Text += "%"
- End If
- End Sub
- Sub Calculos()
- If (Not Cargar) Then
- Dim V_dtpSiguienteFechaCuponCompra = Date.Now.Date, V_dtpFechaVencimientoCompra = Date.Now.Date, V_dtpFechaLiquidacionCompra = Date.Now.Date, V_dtpUltimaFechaCuponCompra = Date.Now.Date
- Dim V_txtValorNominalCompra = 0.0, V_txtPorcentajeCuponCompra = 0.0, V_txtDiasAcumuladosCompra = 0, V_txtInteresAcumuladoCompra = 0.0
- Dim V_txtPorcentajeInteresAcumuladoCompra = 0.0, V_txtComisionPorCompraCasa = 0.0, V_txtValorTransadoCompra = 0.0
- Dim V_txtComisionPorBolsaCompra = 0.0, V_txtComisionCompraCasa = 0.0, V_txtComisionCompraBolsa = 0.0
- Dim V_txtYTMAlVencimientoCompra = 0.0, V_txtYTMAlVencimientoComisionCompra = 0.0, V_txtMontoAPagar = 0.0, V_txtPrecioCompra = 0.0
- Dim V_txtPrecioAlVencimientoCompra = 0.0, V_txtCostoTransferenciaCompra = 0.0, V_txtPrecioSucioCompra = 0.0
- Dim V_txtDiasAlVencimientoCompra = 0
- Dim TipoPeriodoCompra As Integer = 0
- Dim V_dtpSiguienteFechaCuponVenta = Date.Now.Date, V_dtpFechaVencimientoVenta = Date.Now.Date, V_dtpFechaLiquidacionVenta = Date.Now.Date, V_dtpUltimaFechaCuponVenta = Date.Now.Date
- Dim V_txtValorNominalVenta = 0.0, V_txtPorcentajeCuponVenta = 0.0, V_txtDiasAcumuladosVenta = 0, V_txtInteresAcumuladoVenta = 0.0
- Dim V_txtPorcentajeInteresAcumuladoVenta = 0.0, V_txtComisionPorVentaCasa = 0.0, V_txtValorTransadoVenta = 0.0
- Dim V_txtComisionPorBolsaVenta = 0.0, V_txtComisionVentaCasa = 0.0, V_txtComisionVentaBolsa = 0.0
- Dim V_txtYTMAlVencimientoVenta = 0.0, V_txtYTMAlVencimientoComisionVenta = 0.0, V_txtPrecioVenta = 0.0
- Dim V_txtPrecioAlVencimientoVenta = 0.0, V_txtCostoTransferenciaVenta = 0.0, V_txtPrecioSucioVenta = 0.0
- Dim V_txtDiasAlVencimientoVenta = 0.0, V_txtMontoARecibir = 0.0, V_txtCuponesRecibidos = 0.0
- Dim TipoPeriodoVenta As Integer = 0
- V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
- V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
- V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
- V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
- V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
- V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
- V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
- V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
- If String.IsNullOrEmpty(txtValorNominalCompra.Text) Then
- V_txtValorNominalCompra = 0
- Else
- V_txtValorNominalCompra = txtValorNominalCompra.Text
- End If
- If String.IsNullOrEmpty(txtValorNominalVenta.Text) Then
- V_txtValorNominalVenta = 0
- Else
- V_txtValorNominalVenta = txtValorNominalVenta.Text
- End If
- If String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text.Trim("%")) Then
- V_txtPorcentajeCuponCompra = 0
- Else
- V_txtPorcentajeCuponCompra = CDec(txtPorcentajeCuponCompra.Text.Trim("%") / 100)
- End If
- If String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text.Trim("%")) Then
- V_txtPorcentajeCuponVenta = 0
- Else
- V_txtPorcentajeCuponVenta = CDec(txtPorcentajeCuponVenta.Text.Trim("%") / 100)
- End If
- If String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text.Trim("%")) Then
- V_txtYTMAlVencimientoCompra = 0
- Else
- V_txtYTMAlVencimientoCompra = CDec(txtYTMAlVencimientoCompra.Text.Trim("%") / 100)
- End If
- If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text.Trim("%")) Then
- V_txtYTMAlVencimientoVenta = 0
- Else
- V_txtYTMAlVencimientoVenta = CDec(txtYTMAlVencimientoVenta.Text.Trim("%") / 100)
- End If
- If String.IsNullOrEmpty(txtPrecioCompra.Text) Then
- V_txtPrecioCompra = 0
- Else
- V_txtPrecioCompra = txtPrecioCompra.Text
- End If
- If String.IsNullOrEmpty(txtPrecioVenta.Text) Then
- V_txtPrecioVenta = 0
- Else
- V_txtPrecioVenta = txtPrecioVenta.Text
- End If
- If String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text) Then
- V_txtPrecioAlVencimientoCompra = 0
- Else
- V_txtPrecioAlVencimientoCompra = txtPrecioAlVencimientoCompra.Text
- End If
- If String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text) Then
- V_txtPrecioAlVencimientoVenta = 0
- Else
- V_txtPrecioAlVencimientoVenta = txtPrecioAlVencimientoVenta.Text
- End If
- If String.IsNullOrEmpty(txtComisionPorCompraCasa.Text.Trim("%")) Then
- V_txtComisionPorCompraCasa = 0
- Else
- V_txtComisionPorCompraCasa = CDec(txtComisionPorCompraCasa.Text.Trim("%")) / 100
- End If
- If String.IsNullOrEmpty(txtComisionPorVentaCasa.Text.Trim("%")) Then
- V_txtComisionPorVentaCasa = 0
- Else
- V_txtComisionPorVentaCasa = CDec(txtComisionPorVentaCasa.Text.Trim("%")) / 100
- End If
- If String.IsNullOrEmpty(txtComisionCompraCasa.Text) Then
- V_txtComisionCompraCasa = 0
- Else
- V_txtComisionCompraCasa = txtComisionCompraCasa.Text
- End If
- If String.IsNullOrEmpty(txtComisionVentaCasa.Text) Then
- V_txtComisionVentaCasa = 0
- Else
- V_txtComisionVentaCasa = txtComisionVentaCasa.Text
- End If
- If String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text.Trim("%")) Then
- V_txtComisionPorBolsaCompra = 0
- Else
- V_txtComisionPorBolsaCompra = CDec(txtComisionPorBolsaCompra.Text.Trim("%")) / 100
- End If
- If String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text.Trim("%")) Then
- V_txtComisionPorBolsaVenta = 0
- Else
- V_txtComisionPorBolsaVenta = CDec(txtComisionPorBolsaVenta.Text.Trim("%")) / 100
- End If
- If String.IsNullOrEmpty(txtComisionCompraBolsa.Text) Then
- V_txtComisionCompraBolsa = 0
- Else
- V_txtComisionCompraBolsa = txtComisionCompraBolsa.Text
- End If
- If String.IsNullOrEmpty(txtComisionVentaBolsa.Text) Then
- V_txtComisionVentaBolsa = 0
- Else
- V_txtComisionVentaBolsa = txtComisionVentaBolsa.Text
- End If
- If String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text) Then
- V_txtCostoTransferenciaCompra = 0
- Else
- V_txtCostoTransferenciaCompra = txtCostoTransferenciaCompra.Text
- End If
- If (cboPeriodosC.SelectedValue = "M") Then
- TipoPeriodoCompra = 12
- PeriodoC = 1
- ElseIf (cboPeriodosC.SelectedValue = "T") Then
- TipoPeriodoCompra = 4
- PeriodoC = 3
- ElseIf (cboPeriodosC.SelectedValue = "S") Then
- TipoPeriodoCompra = 2
- PeriodoC = 6
- ElseIf (cboPeriodosC.SelectedValue = "A") Then
- TipoPeriodoCompra = 1
- PeriodoC = 12
- End If
- If (cboPeriodosV.SelectedValue = "M") Then
- TipoPeriodoVenta = 12
- PeriodoV = 1
- ElseIf (cboPeriodosV.SelectedValue = "T") Then
- TipoPeriodoVenta = 4
- PeriodoV = 3
- ElseIf (cboPeriodosV.SelectedValue = "S") Then
- TipoPeriodoVenta = 2
- PeriodoV = 6
- ElseIf (cboPeriodosV.SelectedValue = "A") Then
- TipoPeriodoVenta = 1
- PeriodoV = 12
- End If
- If cboAnioBaseC.SelectedIndex = 0 Then
- IndexBaseC = 0
- ElseIf cboAnioBaseC.SelectedIndex = 1 Then
- IndexBaseC = 1
- ElseIf cboAnioBaseC.SelectedIndex = 2 Then
- IndexBaseC = 2
- Else
- IndexBaseC = 3
- End If
- If cboAnioBaseV.SelectedIndex = 0 Then
- IndexBaseV = 0
- ElseIf cboAnioBaseV.SelectedIndex = 1 Then
- IndexBaseV = 1
- ElseIf cboAnioBaseV.SelectedIndex = 2 Then
- IndexBaseV = 2
- Else
- IndexBaseV = 3
- End If
- If (Tipo = 0) Then
- dtpUltimaFechaCuponCompra.Value = FechaCupon(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, TipoPeriodoCompra)
- dtpUltimaFechaCuponVenta.Value = FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
- Else
- dtpSiguienteFechaCuponCompra.Value = FechaTipo(V_dtpUltimaFechaCuponCompra, TipoPeriodoCompra)
- dtpSiguienteFechaCuponVenta.Value = FechaTipo(V_dtpUltimaFechaCuponVenta, TipoPeriodoVenta)
- End If
- V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
- V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
- V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
- V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
- V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
- V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
- V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
- V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
- 'Valores de Compra
- V_txtDiasAlVencimientoCompra = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
- V_txtDiasAcumuladosCompra = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, IndexBaseC)
- V_txtInteresAcumuladoCompra = BonoCalculo.InteresAcumulado(V_txtValorNominalCompra, V_txtPorcentajeCuponCompra, V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, V_txtDiasAcumuladosCompra, IndexBaseC)
- V_txtPorcentajeInteresAcumuladoCompra = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoCompra, V_txtValorNominalCompra, PeriodoC, IndexBaseC) * 100
- V_txtPrecioSucioCompra = BonoCalculo.PrecioSucio(V_txtPrecioCompra, V_txtPorcentajeInteresAcumuladoCompra / 100)
- V_txtValorTransadoCompra = BonoCalculo.ValorTrasado(V_txtPrecioCompra, V_txtValorNominalCompra)
- 'V_txtComisionCompraCasa = BonoCalculo.Comisiones(CDec(V_txtComisionPorCompraCasa), CDec(V_txtValorTransadoCompra))
- ' V_txtComisionCompraBolsa = BonoCalculo.Comisiones(CDec(V_txtComisionPorBolsaCompra), CDec(V_txtValorTransadoCompra))
- V_txtComisionCompraCasa = CalcularComision(V_txtComisionPorCompraCasa, V_txtValorTransadoCompra)
- V_txtComisionCompraBolsa = CalcularComision(V_txtComisionPorBolsaCompra, V_txtValorTransadoCompra)
- V_txtYTMAlVencimientoComisionCompra = Bonos.CalcularYTMComision(CDec(V_txtYTMAlVencimientoCompra), CDec(V_txtComisionPorCompraCasa), V_txtDiasAlVencimientoCompra, CDec(V_txtComisionPorBolsaCompra), V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
- V_txtMontoAPagar = BonoCalculo.MontoPagar(V_txtValorTransadoCompra, V_txtComisionCompraBolsa, V_txtComisionCompraCasa, V_txtInteresAcumuladoCompra, V_txtCostoTransferenciaCompra)
- 'Valores de Venta
- V_txtDiasAlVencimientoVenta = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
- V_txtDiasAcumuladosVenta = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, IndexBaseV)
- V_txtInteresAcumuladoVenta = BonoCalculo.InteresAcumulado(V_txtValorNominalVenta, V_txtPorcentajeCuponVenta, V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, V_txtDiasAcumuladosVenta, IndexBaseV)
- V_txtPorcentajeInteresAcumuladoVenta = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoVenta, V_txtValorNominalVenta, PeriodoV, IndexBaseV) * 100
- V_txtPrecioSucioVenta = BonoCalculo.PrecioSucio(V_txtPrecioVenta, V_txtPorcentajeInteresAcumuladoVenta / 100)
- V_txtValorTransadoVenta = BonoCalculo.ValorTrasado(V_txtPrecioVenta, V_txtValorNominalVenta)
- 'V_txtComisionVentaCasa = BonoCalculo.Comisiones(CDec(V_txtComisionPorVentaCasa), CDec(V_txtValorTransadoVenta))
- ' V_txtComisionVentaBolsa = BonoCalculo.Comisiones(CDec(V_txtComisionPorBolsaVenta), CDec(V_txtValorTransadoVenta))
- V_txtComisionVentaCasa = CalcularComision(V_txtComisionPorVentaCasa, V_txtValorTransadoVenta)
- V_txtComisionVentaBolsa = CalcularComision(V_txtComisionPorBolsaVenta, V_txtValorTransadoVenta)
- V_txtYTMAlVencimientoComisionVenta = Bonos.CalcularYTMComision(V_txtYTMAlVencimientoVenta, V_txtComisionPorVentaCasa, V_txtDiasAlVencimientoVenta, V_txtComisionPorBolsaVenta, V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
- V_txtMontoARecibir = BonoCalculo.MontoRecibir(V_txtValorTransadoVenta, V_txtComisionVentaBolsa, V_txtComisionVentaCasa, V_txtInteresAcumuladoVenta)
- V_txtCuponesRecibidos = Recibido()
- 'Valores de Compra
- txtDiasAlVencimientoCompra.Text = Format(V_txtDiasAlVencimientoCompra, "0.0000")
- txtDiasAcumuladosCompra.Text = Format(V_txtDiasAcumuladosCompra, "0.0000")
- txtInteresAcumuladoCompra.Text = Format(V_txtInteresAcumuladoCompra, "0.0000")
- txtPorcentajeInteresAcumuladoCompra.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoCompra, "0.000")) + "%"
- txtPrecioSucioCompra.Text = Format(V_txtPrecioSucioCompra, "0.0000")
- txtValorTransadoCompra.Text = Format(V_txtValorTransadoCompra, "0.0000")
- txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
- txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
- txtYTMAlVencimientoComisionCompra.Text = CStr(Format(V_txtYTMAlVencimientoComisionCompra, "0.0000") * 100) + "%"
- txtMontoAPagar.Text = Format(V_txtMontoAPagar, "0.0000")
- txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
- txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
- 'Valores de Venta
- FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
- txtDiasAlVencimientoVenta.Text = Format(V_txtDiasAlVencimientoVenta, "0.0000")
- txtDiasAcumuladosVenta.Text = Format(V_txtDiasAcumuladosVenta, "0.0000")
- txtInteresAcumuladoVenta.Text = Format(V_txtInteresAcumuladoVenta, "0.0000")
- txtPorcentajeInteresAcumuladoVenta.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoVenta, "0.0000")) + "%"
- txtPrecioSucioVenta.Text = Format(V_txtPrecioSucioVenta, "0.0000")
- txtValorTransadoVenta.Text = Format(V_txtValorTransadoVenta, "0.0000")
- txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
- txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
- txtYTMAlVencimientoComisionVenta.Text = CStr(Format(V_txtYTMAlVencimientoComisionVenta, "0.0000") * 100) + "%"
- txtMontoARecibir.Text = Format(V_txtMontoARecibir, "0.0000")
- txtCuponesRecibidos.Text = Format(V_txtCuponesRecibidos, "0.0000")
- txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
- txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
- End If
- CorrelativoSinBD()
- End Sub
- Function CalcularComision(ByVal Porcentaje As Double, ByVal VTransado As Double)
- Return Porcentaje * VTransado
- End Function
- Private Sub RefrescarClaseEntidad()
- ControlValorNominalCompra()
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlPorcentajeCuponCompra()
- 'ControlYTMAlVencimientoCompra()
- ControlPrecioAlVencimientoCompra()
- ControlPrecioCompra()
- ControlAnioBaseCompra()
- ControlCostosDeTransferencia()
- 'ControlValorNominalv
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlPorcentajeCuponCompra()
- 'ControlYTMAlVencimientoCompra()
- ControlPrecioAlVencimientoCompra()
- ControlPrecioCompra()
- ControlAnioBaseCompra()
- ControlCostosDeTransferencia()
- End Sub
- Private Sub GuardarNuevoRegistro()
- Dim res As Integer
- RefrescarClaseEntidad()
- res = oDAOPrincipal.Nuevo(oCEPrincipal)
- If res = 1 Then
- MsgBox("Registro Guardado")
- Else
- MsgBox("Algo no salio bien.")
- End If
- End Sub
- Private Sub ActualizarRegistro()
- Dim res As Integer
- RefrescarClaseEntidad()
- ' res = oDAOPrincipal.Actualizar(oCEPrincipal)
- If res = 1 Then
- MsgBox("Registro Guardado")
- Else
- MsgBox("Algo no salio bien.")
- End If
- End Sub
- 'Private Sub ActivarEdicion()
- ' If TipoTransaccion = "C" Then
- ' Me.TipoTransaccion = "A"
- ' Me.btnAceptar.Text = "Guardar"
- ' End If
- 'End Sub
- Private Sub ControlPeriodosCompra()
- Dim valor As String
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- If Me.cboPeriodosC.SelectedIndex = -1 Then
- valor = ""
- Else
- If (String.IsNullOrEmpty(Me.cboPeriodosC.SelectedValue)) Then
- valor = String.Empty
- Else
- valor = Me.cboPeriodosC.SelectedValue
- End If
- End If
- oCEPrincipal.PeriodicidadCompra = valor
- End If
- End Sub
- Function FechaTipo(ByVal ultimafecha As DateTime, ByVal frecuencia As Integer)
- Dim periodos As Integer = 0
- Dim Fecha As Date
- If frecuencia = 1 Then
- periodos = 12
- ElseIf frecuencia = 2 Then
- periodos = 6
- ElseIf frecuencia = 4 Then
- periodos = 3
- ElseIf frecuencia = 12 Then
- periodos = 1
- End If
- Fecha = ultimafecha.AddMonths(periodos)
- Return Fecha
- End Function
- Private Sub ControlValorNominalCompra()
- End Sub
- Private Sub ControlUltimaFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.UltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value.Date
- End If
- End Sub
- Private Sub ControlSiguienteFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.SiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value.Date
- End If
- End Sub
- Private Sub ControlFechaLiquidacionCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.FechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value.Date
- End If
- End Sub
- Private Sub ControlFechaVencimientoCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.FechaVencimientoCompra = dtpFechaVencimientoCompra.Value.Date
- End If
- End Sub
- Private Sub ControlPorcentajeCuponCompra()
- End Sub
- Private Sub ControlAnioBaseCompra()
- Dim valor As Integer
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- valor = cboAnioBaseC.SelectedItem
- Me.oCEPrincipal.DiasBaseCompra = valor
- End If
- End Sub
- Private Sub txtValorNominalCompra_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalCompra.LostFocus
- ' ControlValorNominalCompra()
- End Sub
- Private Sub ControlPrecioAlVencimientoCompra()
- End Sub
- Private Sub ControlPrecioCompra()
- End Sub
- Private Sub ControlCostosDeTransferencia()
- End Sub
- Private Sub txtPorcentajeCuponCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.LostFocus
- ControlPorcentajeCuponCompra()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.LostFocus
- ControlPrecioAlVencimientoCompra()
- End Sub
- Private Sub txtPrecioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioCompra.LostFocus
- ControlPrecioCompra()
- End Sub
- Private Sub txtCostoTransferenciaCompra_LostFocus(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.LostFocus
- ControlCostosDeTransferencia()
- End Sub
- Private Sub dtpSiguienteFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponVenta.ValueChanged
- 'ActivarEdicion()
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtCostoTransferenciaVenta_TextChanged(sender As Object, e As EventArgs)
- 'ActivarEdicion()
- End Sub
- 'Private Sub PrepararTablaImpuestosYComisiones()
- ' Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
- ' Dim oDataGridViewComboBoxColumn As DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn.Name = "CodImp"
- ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Impuesto"
- ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTiposImpuesto
- ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
- ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
- ' oDataGridViewComboBoxColumn.DataPropertyName = "CodImp"
- ' oDataGridViewComboBoxColumn.DisplayIndex = 0
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
- ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
- ' oDataGridViewComboBoxColumn.Name = "TipoOper"
- ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Operación"
- ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTipoOperacion
- ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
- ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
- ' oDataGridViewComboBoxColumn.DataPropertyName = "TipoOper"
- ' oDataGridViewComboBoxColumn.DisplayIndex = 1
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "PorcImp"
- ' oDataGridViewTextBoxColumn.HeaderText = "Porcentaje"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "PorcImp"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje
- ' oDataGridViewTextBoxColumn.DisplayIndex = 2
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "MontoSujeto"
- ' oDataGridViewTextBoxColumn.HeaderText = "Monto Sujeto"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoSujeto"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- ' oDataGridViewTextBoxColumn.ReadOnly = True
- ' oDataGridViewTextBoxColumn.DisplayIndex = 3
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "MontoImp"
- ' oDataGridViewTextBoxColumn.HeaderText = "Monto Impuesto"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoImp"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- ' oDataGridViewTextBoxColumn.DisplayIndex = 4
- ' oDataGridViewTextBoxColumn.ReadOnly = True
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- ' oDataGridViewTextBoxColumn.Name = "CodInv"
- ' oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
- ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- ' oDataGridViewTextBoxColumn.Visible = False
- ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
- ' Me.dgvImpuestosYComisiones.DataSource = oCEPrincipal.ImpuestosYComisiones
- 'End Sub
- 'Private Sub PrepararImpuestosYComisiones(ByVal IdFila As Integer)
- ' Dim vFila As DataGridViewRow = dgvImpuestosYComisiones.Rows(IdFila)
- ' If vFila.IsNewRow Then
- ' vFila.Cells("TipoOper").Value = "V"
- ' vFila.Cells("PorcImp").Value = 0
- ' vFila.Cells("MontoSujeto").Value = oCEPrincipal.ValorTransadoVenta
- ' vFila.Cells("MontoImp").Value = 0.00
- ' End If
- 'End Sub
- Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
- 'ActivarEdicion()
- 'PrepararImpuestosYComisiones(e.RowIndex)
- End Sub
- Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellContentClick
- Formato()
- End Sub
- Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
- 'ActivarEdicion()
- oCEPrincipal.ImpuestosYComisiones.AcceptChanges()
- End Sub
- Private Sub PrepararTablaIngresos()
- Dim CantidadColumnas As Integer = dgvIngresos.ColumnCount
- If CantidadColumnas = 0 Then
- Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "CodInv"
- oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
- oDataGridViewTextBoxColumn.HeaderText = "Código Inversión"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "NumCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "NumCupon"
- oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Correlativo"
- oDataGridViewTextBoxColumn.DataPropertyName = "Correlativo"
- oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "FechaCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "FechaCupon"
- oDataGridViewTextBoxColumn.HeaderText = "Fecha Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Date)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Dias"
- oDataGridViewTextBoxColumn.DataPropertyName = "Dias"
- oDataGridViewTextBoxColumn.HeaderText = "Dias "
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Ingreso"
- oDataGridViewTextBoxColumn.DataPropertyName = "Ingreso"
- oDataGridViewTextBoxColumn.HeaderText = "Ingreso"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "PorcentajeImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "PorcImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "% Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "MontoImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "MontoImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Liquido"
- oDataGridViewTextBoxColumn.DataPropertyName = "Liquido"
- oDataGridViewTextBoxColumn.HeaderText = "Liquido"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- End If
- End Sub
- Private Sub txtValorNominalVenta_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalVenta.LostFocus
- ControlValorNominalVenta()
- End Sub
- Private Sub ControlValorNominalVenta()
- End Sub
- Private Sub txtPorcentajeCuponVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.LostFocus
- ControlPorcentajeCuponVenta()
- End Sub
- Private Sub ControlPorcentajeCuponVenta()
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.LostFocus
- ControlPrecioAlVencimientoVenta()
- End Sub
- Private Sub ControlPrecioAlVencimientoVenta()
- End Sub
- Private Sub txtPrecioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioVenta.LostFocus
- ControlPrecioVenta()
- End Sub
- Private Sub ControlPrecioVenta()
- End Sub
- Private Sub dgvIngresos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub dgvIngresos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvIngresos.CellBeginEdit
- 'ActivarEdicion()
- End Sub
- Private Sub dgvIngresos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellEndEdit
- Dim Tabla As String = Instrumento()
- If Not Tabla = "TIT" Then
- CalculoIngresosBONO()
- End If
- 'Calculos()
- End Sub
- Private Sub dgvIngresos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvIngresos.UserDeletedRow
- 'ActivarEdicion()
- oCEPrincipal.Ingresos.AcceptChanges()
- End Sub
- Private Sub txtValorNominal_Op_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal_Op.TextChanged
- End Sub
- Private Sub LLenarResultadosOperacion()
- Dim FechaCompra = dtpFechaLiquidacionCompra.Value
- Dim FechaVenta = dtpFechaLiquidacionVenta.Value
- Dim Dias As Integer = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
- txtValorNominal_Op.Text = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- txtPlazo_Op.Text = Operaciones.ConvertirDecimal(PlazoOperacion().ToString)
- txtPrecioCompra_Op.Text = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- txtPrecioVenta_Op.Text = Operaciones.ConvertirDecimal(txtPrecioVenta.Text.ToString)
- txtGananciaPerdidaCapital_Op.Text = Operaciones.ConvertirDecimal(GananciaPerdida().ToString)
- txtIngresosPorIntereses_Op.Text = Operaciones.ConvertirDecimal(IngresosInteres().ToString)
- txtCostosTotales_Op.Text = Operaciones.ConvertirDecimal(CostosTotales().ToString)
- txtGananciaPerdidaTotal_Op.Text = Operaciones.ConvertirDecimal(MontoGananciaPerdida().ToString)
- txtRendimientoGananciaPerdida_Op.Text = Operaciones.ConvertirDecimal(RendimientoGananciaPerdida(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoIntereses_Op.Text = Operaciones.ConvertirDecimal(RendimientoInteres(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoAntesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNeto(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoDespuesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNetoDespues(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- End Sub
- Private Function PlazoOperacion()
- Dim FechaVenta As Date = dtpFechaLiquidacionVenta.Value
- Dim FechaCompra As Date = dtpFechaLiquidacionCompra.Value
- Dim Dias = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
- Return Dias
- End Function
- Private Function GananciaPerdida()
- Dim ValorTrasadoVenta = txtValorTransadoVenta.Text
- Dim ValorTrasadoCompra = txtValorTransadoCompra.Text
- Dim Total = ValorTrasadoVenta - ValorTrasadoCompra
- Return Total
- End Function
- Private Function IngresosInteres()
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 2
- For i As Integer = 0 To Registros
- Suma = Suma + Double.Parse(dgvIngresos.Item(4, i).Value)
- Next
- Dim InteresAcumulado = txtInteresAcumuladoVenta.Text
- Return (Suma + InteresAcumulado)
- End Function
- Private Function CostosTotales()
- Dim ComisionCompraCasa = txtComisionCompraCasa.Text
- Dim ComisionVentaCasa = txtComisionVentaCasa.Text
- Dim ComisionCompraBolsa = txtComisionCompraBolsa.Text
- Dim ComisionVentaBolsa = txtComisionVentaBolsa.Text
- Dim CostoTransferenciaCompra = txtCostoTransferenciaCompra.Text
- If (Double.TryParse(ComisionCompraCasa, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(CostoTransferenciaCompra, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(ComisionVentaBolsa, Nothing)) Then
- Dim Total = (CDec(ComisionCompraCasa) + CDec(ComisionCompraBolsa) + CDec(CostoTransferenciaCompra) + CDec(ComisionVentaCasa) + CDec(ComisionVentaBolsa)) * -1
- Return Total
- End If
- Return "0"
- End Function
- Private Function MontoGananciaPerdida()
- Dim GananciaPerdida = txtGananciaPerdidaCapital_Op.Text
- Dim CostosTotales = txtCostosTotales_Op.Text
- Dim IngresoInteres = txtIngresosPorIntereses_Op.Text
- Dim Total = CDec(GananciaPerdida) + CDec(CostosTotales) + txtIngresosPorIntereses_Op.Text
- Return Total
- End Function
- Private Function RendimientoGananciaPerdida(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim GananciaCapital = txtGananciaPerdidaCapital_Op.Text
- Dim ValorNominal = txtValorNominal_Op.Text
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- Return (Valor * 100).ToString() + "%"
- End Function
- Private Function RendimientoInteres(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim IngresosInteres = txtIngresosPorIntereses_Op.Text
- Dim ValorNominal = txtValorNominal_Op.Text
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Function RendimientoNeto(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim MontoGananciaPerdidaTotal = txtGananciaPerdidaTotal_Op.Text
- Dim ValorNominal = txtValorNominal_Op.Text
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Function Recibido()
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 1
- For i As Integer = 0 To Registros
- If (Not String.IsNullOrEmpty(dgvIngresos.Rows(i).Cells("Ingreso").Value)) Then
- Suma = Suma + Double.Parse(dgvIngresos.Rows(i).Cells("Ingreso").Value)
- End If
- Next
- Return Suma
- End Function
- Private Function RendimientoNetoDespues(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 1
- For i As Integer = 0 To Registros
- If (Not String.IsNullOrEmpty(dgvIngresos.Rows(i).Cells("MontoImpuesto").Value)) Then
- Suma = Suma + Double.Parse(dgvIngresos.Rows(i).Cells("MontoImpuesto").Value)
- End If
- Next
- Dim MontoGananciaTotal = txtGananciaPerdidaTotal_Op.Text
- Dim Impuesto = Suma
- Dim ValorNominal = txtValorNominal_Op.Text
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Sub TabPage4_Click(sender As Object, e As EventArgs) Handles TabPage4.Click
- End Sub
- Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click
- End Sub
- Private Function CalcularIngreso(ByVal ValorNominal As Double, ByVal Cupon As Double, ByVal Dias As Integer)
- Dim Base As Integer = 365
- Dim Calculo = ValorNominal * Cupon * Dias / Base
- Return Calculo
- End Function
- Private Sub TabPage2_Click(sender As Object, e As EventArgs) Handles TbIngresos.Click
- If (dgvIngresos.Rows.Count > 1) Then
- End If
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- TipoTransaccion = "M"
- btnAceptar.Text = "Modificar"
- 'btnAccionComisiones.Text = "Modificar"
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- TipoTransaccion = "N"
- btnAceptar.Text = "Nuevo"
- 'btnAccionComisiones.Text = "Nuevo"
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- TipoTransaccion = "B"
- btnAceptar.Text = "Eliminar"
- 'btnAccionComisiones.Text = "Eliminar"
- End Sub
- Private Sub txtYTMAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeInteresAcumuladoVenta_TextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtYTMAlVencimientoComisionCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoComisionCompra.TextChanged
- End Sub
- Private Sub txtValorNominalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeCuponVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtValorNominalCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioSucioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioCompra.TextChanged
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- RefrescarValorControles()
- End Sub
- Private Sub txtPrecioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub btnAccionIngreso_Click(sender As Object, e As EventArgs)
- 'If (TipoTransaccion = "N") Then
- ' NuevoIngreso(False, 0)
- 'ElseIf (TipoTransaccion = "M") Then
- ' ModificarIngreso()
- 'ElseIf (TipoTransaccion = "B") Then
- ' EliminarIngreso()
- 'End If
- End Sub
- Private Sub TabControl1_TabIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.TabIndexChanged
- Formato()
- Formato()
- End Sub
- Private Sub dgvIngresos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellClick
- Index = e.RowIndex
- PrepararCalculos()
- Formato()
- End Sub
- Private Sub txtDiasAcumuladosCompra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosCompra.TextChanged
- End Sub
- Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.SelectedIndexChanged
- ValidacionErrores()
- BotonQuitar()
- If (dgvIngresos.Rows.Count < 2) Then
- End If
- If (TabCampos.SelectedIndex = 2) Or (TabCampos.SelectedIndex = 1) Then
- LLenarResultadosOperacion()
- End If
- End Sub
- Private Sub dtpUltimaFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtYTMAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub btnAmortizacion_Click(sender As Object, e As EventArgs)
- frmResultadoTitularizacion.Show()
- End Sub
- 'Function ColecccionComisiones()
- ' Dim coleccion As New Collection
- ' Dim TipoImp, TipOp, CodImp, PorcImp, MontoImp As String
- ' TipoImp = dgvImpuestosYComisiones.CurrentRow.Cells("NumCupon").Value
- ' TipOp = dgvImpuestosYComisiones.CurrentRow.Cells(1).Value
- ' CodImp = dgvImpuestosYComisiones.CurrentRow.Cells(2).Value
- ' PorcImp = CDec(dgvImpuestosYComisiones.CurrentRow.Cells(3).Value.ToString.TrimEnd("%") / 100)
- ' MontoImp = dgvImpuestosYComisiones.CurrentRow.Cells(4).Value.ToString.TrimEnd("%")
- ' coleccion.Add(TipoImp)
- ' coleccion.Add(TipOp)
- ' coleccion.Add(CodImp)
- ' coleccion.Add(PorcImp)
- ' coleccion.Add(MontoImp)
- ' Return coleccion
- 'End Function
- Function ColeccionIngresos(ByRef index As Integer)
- Dim coleccion As New Collection
- Dim NoCupon, Fecha, Ingreso, PorcImpuesto, Impuesto, Dias, Liquido As String
- NoCupon = dgvIngresos.Rows(index).Cells("NumCupon").Value
- Fecha = dgvIngresos.Rows(index).Cells("FechaCupon").Value
- Dias = dgvIngresos.Rows(index).Cells("Dias").Value
- Ingreso = dgvIngresos.Rows(index).Cells("Ingreso").Value
- PorcImpuesto = dgvIngresos.Rows(index).Cells("PorcentajeImpuesto").Value
- If Not PorcImpuesto Is Nothing Then
- PorcImpuesto = CDec((PorcImpuesto.ToString().Trim("%")) / 100)
- End If
- Impuesto = dgvIngresos.Rows(index).Cells("MontoImpuesto").Value
- Liquido = dgvIngresos.Rows(index).Cells("Liquido").Value
- coleccion.Add(NoCupon)
- coleccion.Add(Fecha)
- coleccion.Add(Dias)
- coleccion.Add(Ingreso)
- coleccion.Add(PorcImpuesto)
- coleccion.Add(Impuesto)
- coleccion.Add(Liquido)
- Return coleccion
- End Function
- 'Sub NuevaComision()
- ' Dim coleccion = ColecccionComisiones()
- ' BonosConsulta.NuevoImpuesto(coleccion, Codigo)
- 'End Sub
- Sub NuevoIngreso(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer)
- Dim i As Integer = 0
- Dim Index = dgvIngresos.Rows.Count - 2
- i = Cantidad
- While i <= Index
- Dim coleccion = ColeccionIngresos(i)
- If (BonosConsulta.NuevoIngreso(coleccion, Codigo, Instrumento) Is Nothing) Then
- Exit Sub
- End If
- i += 1
- End While
- MsgBox("Registro de ingresos actualizados")
- End Sub
- 'Sub ModificarComision()
- ' Dim coleccion = ColecccionComisiones()
- ' BonosConsulta.ModificarImpuesto(coleccion, Codigo)
- 'End Sub
- Function Instrumento()
- Dim codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If codigo.IndexOf("TIT") > -1 Then
- Tabla = "TIT"
- ElseIf codigo.IndexOf("EURB") > -1 Then
- Tabla = "EURB"
- ElseIf codigo.IndexOf("BONO") > -1 Then
- Tabla = "BONO"
- ElseIf codigo.IndexOf("CINV") > -1 Then
- Tabla = "CINV"
- End If
- Return Tabla
- End Function
- Function CanRegistros()
- Dim Tabla As String = String.Empty
- Dim Ins As String = Instrumento()
- If (Ins = "TIT") Then
- Tabla = "TIT0_0"
- ElseIf (Ins = "EURB") Then
- Tabla = "EURB1"
- ElseIf (Ins = "BONO") Then
- Tabla = "BON1"
- ElseIf (Ins = "CINV") Then
- Tabla = "CIN1"
- End If
- Dim Codigo = Variables.Codigo
- Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
- Return Cantidad
- End Function
- Function ModificarIngreso()
- Dim i As Integer = 0
- Dim Cantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim Diccionario As New Dictionary(Of Integer, Collection)
- While i <= Cantidad
- Dim coleccion = ColeccionIngresos(i)
- Diccionario.Add(i, coleccion)
- i += 1
- End While
- Return Diccionario
- End Function
- Sub EliminarComision()
- BonosConsulta.EliminarImpuesto(Codigo)
- End Sub
- Sub EliminarIngreso()
- BonosConsulta.EliminarIngresoCompleto(Codigo, Instrumento)
- End Sub
- 'Private Sub btnAccionComisiones_Click(sender As Object, e As EventArgs)
- ' 'If (TipoTransaccion = "N") Then
- ' ' NuevaComision()
- ' 'ElseIf (TipoTransaccion = "M") Then
- ' ' ModificarComision()
- ' ElseIf (TipoTransaccion = "B") Then
- ' EliminarComision()
- ' End If
- 'End Sub
- 'Sub CargarComisiones()
- ' Dim codigo As String = Variables.Codigo
- ' Dim dr = BonosConsulta.CargarImpuestos(codigo)
- ' While dr.Read
- ' dgvImpuestosYComisiones.Rows.Add(dr("TipoImp"), dr("TipoOp"), dr("CodImp"), dr("PorcImp"), dr("MontoImp"))
- ' End While
- 'End Sub
- Sub CargarIngresos()
- Dim codigo As String = Variables.Codigo
- Dim dr = BonosConsulta.CargarIngreso(codigo, Instrumento)
- While dr.Read
- Dim Porc = dr("PorcImpuesto")
- If String.IsNullOrEmpty(Porc.ToString) Then
- Porc = "0.0%"
- Else
- Porc = (Porc * 100).ToString + "%"
- End If
- dgvIngresos.Rows.Add("", dr("NumCupon"), "", dr("FechaCupon"), dr("Dias"), dr("Ingreso"), Porc, dr("MontoImpuesto"), dr("Liquido"))
- End While
- End Sub
- Private Sub txtComisionPorCompraCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorVentaCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtMontoARecibir_TextChanged(sender As Object, e As EventArgs) Handles txtMontoARecibir.TextChanged
- Calculos()
- End Sub
- Private Sub txtCostosTotales_Op_TextChanged(sender As Object, e As EventArgs) Handles txtCostosTotales_Op.TextChanged
- End Sub
- Private Sub txtRendimientoDespuesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoDespuesISR_Op.TextChanged
- End Sub
- Private Sub txtPrecioSucioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioVenta.TextChanged
- End Sub
- Private Sub txtGananciaPerdidaCapital_Op_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaPerdidaCapital_Op.TextChanged
- End Sub
- Private Sub txtValorNominalCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalCompra.KeyPress
- If String.IsNullOrEmpty(txtValorNominalCompra.Text) Then
- If e.KeyChar = "." Then
- txtValorNominalCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtValorNominalCompra.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 txtValorNominalVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalVenta.KeyPress
- If String.IsNullOrEmpty(txtValorNominalVenta.Text) Then
- If e.KeyChar = "." Then
- txtValorNominalVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtValorNominalVenta.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 txtPorcentajeCuponCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponCompra.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeCuponCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeCuponCompra.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 txtPorcentajeCuponVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponVenta.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeCuponVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeCuponVenta.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 txtYTMAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoCompra.KeyPress
- If String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text) Then
- If e.KeyChar = "." Then
- txtYTMAlVencimientoCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtYTMAlVencimientoCompra.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 txtYTMAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoVenta.KeyPress
- If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text) Then
- If e.KeyChar = "." Then
- txtYTMAlVencimientoVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtYTMAlVencimientoVenta.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 txtPrecioAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoCompra.KeyPress
- If String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text) Then
- If e.KeyChar = "." Then
- txtPrecioAlVencimientoCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioAlVencimientoCompra.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 txtPrecioAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoVenta.KeyPress
- If String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text) Then
- If e.KeyChar = "." Then
- txtPrecioAlVencimientoVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioAlVencimientoVenta.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 txtPrecioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioCompra.KeyPress
- If String.IsNullOrEmpty(txtPrecioCompra.Text) Then
- If e.KeyChar = "." Then
- txtPrecioCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioCompra.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 txtPrecioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioVenta.KeyPress
- If String.IsNullOrEmpty(txtPrecioVenta.Text) Then
- If e.KeyChar = "." Then
- txtPrecioVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioVenta.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 txtComisionPorCompraCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorCompraCasa.KeyPress
- If String.IsNullOrEmpty(txtComisionPorCompraCasa.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorCompraCasa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorCompraCasa.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 txtComisionPorVentaCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorVentaCasa.KeyPress
- If String.IsNullOrEmpty(txtComisionPorVentaCasa.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorVentaCasa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorVentaCasa.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 txtComisionPorBolsaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaCompra.KeyPress
- If String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorBolsaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorBolsaCompra.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 txtComisionPorBolsaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaVenta.KeyPress
- If String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorBolsaVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorBolsaVenta.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 txtCostoTransferenciaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCostoTransferenciaCompra.KeyPress
- If String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text) Then
- If e.KeyChar = "." Then
- txtCostoTransferenciaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtCostoTransferenciaCompra.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 txtMontoARecibir_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMontoARecibir.KeyPress
- If String.IsNullOrEmpty(txtMontoARecibir.Text) Then
- If e.KeyChar = "." Then
- txtMontoARecibir.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtMontoARecibir.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 txtPrecioCompra_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra_Op.TextChanged
- End Sub
- Private Sub txtPrecioVenta_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta_Op.TextChanged
- End Sub
- Private Sub txtInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumuladoCompra.TextChanged
- End Sub
- Sub AsignacionPeriodicidad()
- Dim Periodicidad As String = cboPeriodosC.SelectedValue
- If (Periodicidad = "M") Then
- TipoPeriodicidad = 1
- ElseIf (Periodicidad = "T") Then
- TipoPeriodicidad = 3
- ElseIf (Periodicidad = "S") Then
- TipoPeriodicidad = 6
- ElseIf (Periodicidad = "A") Then
- TipoPeriodicidad = 12
- End If
- End Sub
- Sub PrepararCalculos()
- AsignacionPeriodicidad()
- Dim Index = dgvIngresos.CurrentRow.Index
- Dim IndexAnterior = Index - 1
- Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
- Dim FechaSig = CDate(Respaldo)
- Dim Fechaliq = dtpFechaLiquidacionCompra.Value
- Dim FechaCupon, Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido
- FechaCupon = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
- Dias = dgvIngresos.Rows(Index).Cells("Dias").Value
- Ingreso = dgvIngresos.Rows(Index).Cells("Ingreso").Value
- PorcentajeImpuesto = dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value
- If (Not PorcentajeImpuesto Is Nothing) Then
- PorcentajeImpuesto = CDec(PorcentajeImpuesto.ToString.Trim("%")) / 100
- Else
- PorcentajeImpuesto = "0.0%"
- End If
- MontoImpuesto = dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value
- Liquido = dgvIngresos.Rows(Index).Cells("Liquido").Value
- If (String.IsNullOrEmpty(FechaCupon)) Then
- If (Index = 0) Then
- FechaCupon = FechaSig
- Else
- Dim FechaAnterior As Date = dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value
- FechaCupon = Operaciones.Meses(TipoPeriodicidad, FechaAnterior, FechaSig)
- End If
- dgvIngresos.Rows(Index).Cells("FechaCupon").Value = FechaCupon
- End If
- If (String.IsNullOrEmpty(Dias)) Then
- Dim Dia As Integer = 0
- If (Index = 0) Then
- Dia = Operaciones.DiasAcumulados(Fechaliq, FechaSig, IndexBaseC)
- Else
- Dim DiaAnterior As Date = dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value
- Dim DiaActual = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
- Dia = Operaciones.DiasAcumulados(DiaAnterior, DiaActual, IndexBaseC)
- End If
- dgvIngresos.Rows(Index).Cells("Dias").Value = Dia
- End If
- If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("NumCupon").Value)) Then
- dgvIngresos.Rows(Index).Cells("NumCupon").Value = Correlativo()
- End If
- If (String.IsNullOrEmpty(Ingreso)) Then
- dgvIngresos.Rows(Index).Cells("Ingreso").Value = 0
- End If
- If (Index = 0) Then
- If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value)) Then
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = "0.0%"
- End If
- Else
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value
- End If
- If dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.IndexOf("%") = -1 Then
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString + "%"
- End If
- If (String.IsNullOrEmpty(MontoImpuesto)) Then
- dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value = 0
- End If
- If (String.IsNullOrEmpty(Liquido)) Then
- dgvIngresos.Rows(Index).Cells("Liquido").Value = 0
- End If
- CorrelativoSinBD()
- End Sub
- Function Correlativo()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- Dim Numero As Integer = dgvIngresos.Rows(Index).Cells("NumCupon").Value
- If Numero > NumeroMayor Then
- NumeroMayor = Numero
- End If
- Index += 1
- End While
- Return NumeroMayor + 1
- End Function
- Sub CorrelativoSinBD()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- dgvIngresos.Rows(Index).Cells("Correlativo").Value = Index + 1
- Index += 1
- End While
- End Sub
- Function PeriodoGracia()
- Dim FechaEmision As Date = Variables.FechaEmisionTIT
- Dim FechaPeriodoGracia As Date = FechaEmision
- Dim CantidadPeriodoGracia As Integer = 0
- Dim TipoPeriodoGracia As String = Variables.TipoPeriodoGracia
- Dim CantidadPeriodo As String = Variables.CantidadPeriodo
- If String.IsNullOrEmpty(CantidadPeriodo) Or CantidadPeriodo = "0" Then
- Return False
- Else
- CantidadPeriodoGracia = CantidadPeriodo
- End If
- If TipoPeriodoGracia = "D" Or TipoPeriodoGracia = "M" Or TipoPeriodoGracia = "A" Then
- If TipoPeriodoGracia = "D" Then
- FechaPeriodoGracia = FechaEmision.AddDays(CantidadPeriodoGracia)
- ElseIf TipoPeriodoGracia = "M" Then
- FechaPeriodoGracia = FechaEmision.AddMonths(CantidadPeriodoGracia)
- Else
- FechaPeriodoGracia = FechaEmision.AddYears(CantidadPeriodoGracia)
- End If
- Return FechaPeriodoGracia
- Else
- Return False
- End If
- End Function
- Function IngresosIntereses(ByVal ValorNominal As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal Fecha1 As Date, Fecha2 As Date, ByVal IndexBase As Integer)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 360
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 360
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
- Else
- Valor = 0
- End If
- Return Valor
- End If
- Return Valor
- End Function
- Function IngresosInteresesTIT(ByVal ValorSaldo As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal PrimerosDias As Integer, ByVal RestantesDias As Integer, ByVal IndexBase As Integer)
- Dim Valor As Double = 0
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- DiasPrimeraFecha = PrimerosDias
- DiasSegundaFecha = RestantesDias
- If (IndexBase = 0) Then
- Valor = ValorSaldo * PorcCupon * Dias / 360
- Return Valor
- ElseIf (IndexBase = 1) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- Else
- Valor = 0
- End If
- Return Valor
- ElseIf (IndexBase = 2) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- Else
- Valor = 0
- End If
- Return Valor
- Else
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
- Else
- Valor = 0
- End If
- Return Valor
- End If
- Return Valor
- End Function
- Function Impuestos(ByVal Ingresos As Double, PorcentajeRenta As Double)
- Dim Total As Double
- Total = Ingresos * PorcentajeRenta
- Return Total
- End Function
- Function Liquido(ByVal Ingreso As Double, ByVal Renta As Double)
- Dim Total As Double
- Total = Ingreso - Renta
- Return Total
- End Function
- Sub CalculoIngresosBONO()
- Dim Ingreso As Double = 0
- Dim ValorNominal = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
- Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
- ValorNominal = CDec(txtValorNominalCompra.Text)
- PorcCupon = CDec(txtPorcentajeCuponCompra.Text.ToString.Trim("%")) / 100
- Dim Index As Integer = dgvIngresos.CurrentRow.Index
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim Dias As Integer = dgvIngresos.Rows(Index).Cells("Dias").Value
- If (Index = 0) Then
- Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
- Fecha1 = RespaldoFecha
- Fecha2 = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
- Else
- Fecha1 = dgvIngresos.Rows(Index - 1).Cells("FechaCupon").Value
- Fecha2 = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
- End If
- If (Not dgvIngresos.CurrentRow.Cells("PorcentajeImpuesto").Value Is Nothing) Then
- PorcentajeRenta = CDec(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.Trim("%")) / 100
- Else
- PorcentajeRenta = 0
- End If
- IngresosInt = IngresosIntereses(ValorNominal, PorcCupon, Dias, Fecha1, Fecha2, IndexBaseC)
- Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
- Liquido = Me.Liquido(IngresosInt, Ingresos)
- dgvIngresos.CurrentRow.Cells("Ingreso").Value = IngresosInt
- dgvIngresos.CurrentRow.Cells("MontoImpuesto").Value = Ingresos
- dgvIngresos.CurrentRow.Cells("Liquido").Value = Liquido
- End Sub
- Sub PrepararIngresosTIT(ByVal Index As Integer, ByRef Amortizacion As DataGridView)
- AsignacionPeriodicidad()
- Dim IndexAnterior = Index - 1
- Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
- Dim Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido, PorcentajeImpuestoAnterior
- Dias = dgvIngresos.Rows(Index).Cells("Dias").Value
- Ingreso = dgvIngresos.Rows(Index).Cells("Ingreso").Value
- PorcentajeImpuesto = 10
- If (Not PorcentajeImpuesto Is Nothing) Then
- PorcentajeImpuesto = CDec(PorcentajeImpuesto.ToString.Trim("%")) / 100
- Else
- PorcentajeImpuesto = "0.0%"
- End If
- MontoImpuesto = 0
- Liquido = 0
- 'If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("NumCupon").Value)) Then
- ' dgvIngresos.Rows(Index).Cells("NumCupon").Value = Correlativo()
- 'End If
- If (Index = 0) Then
- PorcentajeImpuestoAnterior = "10.0%"
- Else
- PorcentajeImpuestoAnterior = dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value
- End If
- Dim Dia As Integer = 0
- If Not String.IsNullOrEmpty(Amortizacion.Rows(Index).Cells("Dias").Value) Then
- Dia = Amortizacion.Rows(Index).Cells("Dias").Value
- End If
- Dim Fecha As Date = Date.Now.Date
- If Not String.IsNullOrEmpty(Amortizacion.Rows(Index).Cells("Fecha").Value) Then
- Fecha = Amortizacion.Rows(Index).Cells("Fecha").Value
- End If
- dgvIngresos.Rows.Add(0, 0, 0, Fecha, Dia, 0, PorcentajeImpuestoAnterior, 0, 0)
- End Sub
- Sub CalculoIngresosTIT()
- Dim FechaPeriodoGracia = PeriodoGracia()
- Dim CantidadAmortizacion As Integer = Variables.dgvAmortizacion.Rows.Count - 1
- Dim Amortizacion = Variables.dgvAmortizacion
- Dim Index As Integer = 0
- Dim j As Integer = 0
- While Index <= CantidadAmortizacion
- PrepararIngresosTIT(Index, Amortizacion)
- Index += 1
- End While
- While j <= CantidadAmortizacion
- Dim PrimerosDias As Double = Amortizacion.Rows(j).Cells("PrimerosDias").Value
- Dim RestantesDias As Double = Amortizacion.Rows(j).Cells("RestantesDias").Value
- Dim FechaActualCupon = dgvIngresos.Rows(j).Cells("FechaCupon").Value
- Dim Ingreso As Double = 0
- Dim ValorSaldo = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
- Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
- Dim SaldoPendiente As Double = 0
- 'If TypeOf FechaPeriodoGracia Is Boolean Then
- If j = 0 Then
- ValorSaldo = Variables.MontoCompraTIT
- Else
- ValorSaldo = Amortizacion.Rows(j - 1).Cells("Saldos").Value
- End If
- 'Else
- ' If FechaPeriodoGracia < FechaActualCupon Then
- ' ValorSaldo = Amortizacion.Rows(j - 1).Cells("Saldos").Value
- ' Else
- ' ValorSaldo = Variables.MontoCompraTIT
- ' End If
- 'End If
- PorcCupon = CDec(txtPorcentajeCuponCompra.Text.ToString.Trim("%")) / 100
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim Dias As Integer = dgvIngresos.Rows(j).Cells("Dias").Value
- If (j = 0) Then
- Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
- Fecha1 = RespaldoFecha
- Fecha2 = dgvIngresos.Rows(j).Cells("FechaCupon").Value
- Else
- Fecha1 = dgvIngresos.Rows(j - 1).Cells("FechaCupon").Value
- Fecha2 = dgvIngresos.Rows(j).Cells("FechaCupon").Value
- End If
- If (Not dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value Is Nothing) Then
- PorcentajeRenta = CDec(dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value.ToString.Trim("%")) / 100
- Else
- PorcentajeRenta = 0
- End If
- IngresosInt = IngresosInteresesTIT(ValorSaldo, PorcCupon, Dias, PrimerosDias, RestantesDias, IndexBaseC)
- Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
- Liquido = Me.Liquido(IngresosInt, Ingresos)
- dgvIngresos.Rows(j).Cells("Ingreso").Value = IngresosInt
- dgvIngresos.Rows(j).Cells("MontoImpuesto").Value = Ingresos
- dgvIngresos.Rows(j).Cells("Liquido").Value = Liquido
- j += 1
- End While
- End Sub
- Private Sub txtPorcentajeInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeInteresAcumuladoCompra.TextChanged
- End Sub
- Private Sub btnQuitar_Click(sender As Object, e As EventArgs) Handles btnQuitar.Click
- QuitarFila()
- Calculos()
- End Sub
- Sub QuitarFila()
- Dim CantidadFilas As Integer = dgvIngresos.Rows.Count - 1
- If CantidadFilas > 0 Then
- 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 = dgvIngresos.CurrentRow.Cells("NumCupon").Value
- If result = MsgBoxResult.Ok Then
- Try
- dgvIngresos.Rows.Remove(dgvIngresos.CurrentRow)
- BonosConsulta.EliminarIngreso(codigo, Numero, Instrumento)
- Catch ex As Exception
- MsgBox("No ha seleccionado una fila")
- End Try
- End If
- Else
- MsgBox("Actualmente no tiene registros")
- End If
- End Sub
- Private Sub txtCuponesRecibidos_TextChanged(sender As Object, e As EventArgs) Handles txtCuponesRecibidos.TextChanged
- End Sub
- Private Sub txtIngresosPorIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtIngresosPorIntereses_Op.TextChanged
- End Sub
- Private Sub txtRendimientoGananciaPerdida_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoGananciaPerdida_Op.TextChanged
- End Sub
- Private Sub txtRendimientoIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoIntereses_Op.TextChanged
- End Sub
- Private Sub txtRendimientoAntesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoAntesISR_Op.TextChanged
- End Sub
- Private Sub txtPlazo_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPlazo_Op.TextChanged
- End Sub
- Private Sub txtDiasAcumuladosVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosVenta.TextChanged
- End Sub
- Private Sub pnlPie_Paint(sender As Object, e As PaintEventArgs) Handles pnlPie.Paint
- End Sub
- Private Sub txtValorNominalCompra_Leave(sender As Object, e As EventArgs) Handles txtValorNominalCompra.Leave
- Formato()
- End Sub
- Private Sub txtPorcentajeCuponCompra_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.Leave
- Formato()
- End Sub
- Private Sub txtYTMAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.Leave
- Formato()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.Leave
- Formato()
- End Sub
- Private Sub txtPrecioCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioCompra.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorCompraCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorBolsaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.Leave
- Formato()
- End Sub
- Private Sub txtCostoTransferenciaCompra_Leave(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.Leave
- Formato()
- End Sub
- Private Sub txtValorNominalVenta_Leave(sender As Object, e As EventArgs) Handles txtValorNominalVenta.Leave
- Formato()
- End Sub
- Private Sub txtPorcentajeCuponVenta_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.Leave
- Formato()
- End Sub
- Private Sub txtYTMAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.Leave
- Formato()
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.Leave
- Formato()
- End Sub
- Private Sub txtPrecioVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioVenta.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorVentaCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorBolsaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.Leave
- Formato()
- End Sub
- Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles btnIngresos.Click
- CalculoIngresosTIT()
- End Sub
- Private Sub txtValorNominalCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalCompra.KeyUp
- If txtValorNominalCompra.Text = "." Then
- txtValorNominalCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeCuponCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponCompra.KeyUp
- If txtPorcentajeCuponCompra.Text = "." Then
- txtPorcentajeCuponCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtYTMAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoCompra.KeyUp
- If txtYTMAlVencimientoCompra.Text = "." Then
- txtYTMAlVencimientoCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoCompra.KeyUp
- If txtPrecioAlVencimientoCompra.Text = "." Then
- txtPrecioAlVencimientoCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioCompra.KeyUp
- If txtPrecioCompra.Text = "." Then
- txtPrecioCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorCompraCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorCompraCasa.KeyUp
- If txtComisionPorCompraCasa.Text = "." Then
- txtComisionPorCompraCasa.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorBolsaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaCompra.KeyUp
- If txtComisionPorBolsaCompra.Text = "." Then
- txtComisionPorBolsaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtCostoTransferenciaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCostoTransferenciaCompra.KeyUp
- If txtCostoTransferenciaCompra.Text = "." Then
- txtCostoTransferenciaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtValorNominalVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalVenta.KeyUp
- If txtValorNominalVenta.Text = "." Then
- txtValorNominalVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeCuponVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponVenta.KeyUp
- If txtPorcentajeCuponVenta.Text = "." Then
- txtPorcentajeCuponVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtYTMAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoVenta.KeyUp
- If txtYTMAlVencimientoVenta.Text = "." Then
- txtYTMAlVencimientoVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoVenta.KeyUp
- If txtPrecioAlVencimientoVenta.Text = "." Then
- txtPrecioAlVencimientoVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioVenta.KeyUp
- If txtPrecioVenta.Text = "." Then
- txtPrecioVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorVentaCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorVentaCasa.KeyUp
- If txtComisionPorVentaCasa.Text = "." Then
- txtComisionPorVentaCasa.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorBolsaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaVenta.KeyUp
- If txtComisionPorBolsaVenta.Text = "." Then
- txtComisionPorBolsaVenta.Text = ".0"
- End If
- End Sub
- Private Sub dgvIngresos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles dgvIngresos.KeyPress
- Formato()
- End Sub
- Private Sub dgvIngresos_Leave(sender As Object, e As EventArgs) Handles dgvIngresos.Leave
- End Sub
- Private Sub dgvIngresos_Click(sender As Object, e As EventArgs) Handles dgvIngresos.Click
- Formato()
- End Sub
- Private Sub dgvIngresos_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellLeave
- Formato()
- End Sub
- Sub ValidacionErrores()
- If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- End If
- End Sub
- Sub BotonQuitar()
- If TabCampos.SelectedIndex = 1 Then
- btnQuitar.Visible = True
- btnQuitar.Enabled = True
- Else
- btnQuitar.Visible = False
- btnQuitar.Enabled = False
- End If
- End Sub
- Private Sub lblRedencion_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
- End Sub
- Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
- End Sub
- Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
- End Sub
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If CantFormAbierto = False Then
- If Not RetCodigoInversionExiste And Not Existe Then
- Dim TipoTransaccionCompraVenta As String = Variables.TipoTransaccionCompraVenta
- If TipoTransaccionCompraVenta = "C" Then
- txtValorNominalCompra.Text = Variables.RetMonto
- txtPrecioCompra.Text = Variables.RetPrecio
- txtPorcentajeCuponCompra.Text = Variables.RetRendimiento
- ElseIf TipoTransaccionCompraVenta = "V" Then
- txtValorNominalVenta.Text = Variables.RetMonto
- txtPrecioVenta.Text = Variables.RetPrecio
- txtPorcentajeCuponVenta.Text = Variables.RetRendimiento
- End If
- End If
- End If
- End Sub
- Private Sub btnVenderTitulo_Click(sender As Object, e As EventArgs) Handles btnVenderTitulo.Click
- If Variables.InvocadorProInv = "frmINV" Then
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- Dim General As New DAOGeneral
- Dim Codigo = Variables.Codigo
- Dim Tabla As String = "INV0"
- TrasladarDatos = RellenarDatosCMVTA()
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If Existe Then
- Dim CodigoInversion As String = Variables.Codigo
- Dim frmPINVCMVTA As New frmPIN("V", CodigoInversion, TrasladarDatos)
- frmINV.Close()
- Me.Close()
- frmPINVCMVTA.ShowDialog()
- End If
- End If
- End Sub
- Function RellenarDatosCMVTA()
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- TrasladarDatos.BaseCINV = Operaciones.ConvertirEntero(cboAnioBaseC.SelectedIndex.ToString)
- TrasladarDatos.CuponCINV = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString)
- TrasladarDatos.FechaLiquidacionCINV = Operaciones.ConvertirFecha(dtpFechaLiquidacionCompra.Value.ToString)
- TrasladarDatos.FechaVencimientoCINV = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
- TrasladarDatos.PeriodicidadCINV = cboPeriodosC.SelectedValue.ToString
- TrasladarDatos.PorcentajeComisionBolsaCINV = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString)
- TrasladarDatos.PorcentajeComisionCasaCINV = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString)
- TrasladarDatos.PrecioCompraCINV = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- TrasladarDatos.PrecioVencimientoCINV = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoCompra.Text.ToString)
- TrasladarDatos.UltimaFechaCuponCINV = Operaciones.ConvertirFecha(dtpUltimaFechaCuponCompra.Value)
- TrasladarDatos.ValorNominalCINV = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- TrasladarDatos.YTMVencimientoCINV = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString)
- TrasladarDatos.NombreInstrumento = "CINV"
- TrasladarDatos.AgregarCMVTA = True
- Return TrasladarDatos
- End Function
- End Class
|