frmPIN_Temporal.vb 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. Public Class frmPIN_Temporal
  2. Dim oPropuestaInversionCE As CEPropuestaInversion = New CEPropuestaInversion
  3. Dim oDAOGeneral As DAOGeneral = New DAOGeneral
  4. Dim oDAOLETES As LETESDAO = New LETESDAO
  5. Dim oDAOPropuestasDeInversion As DAOPropuestaInversion = New DAOPropuestaInversion
  6. Dim oCEAcciones As AccionesCE
  7. Dim oCEBonos As BonosCE
  8. Dim oCEDAP As DepositosAPlazoCE
  9. Dim oCELetes As LETESCE
  10. Dim oCEReportos As ReportosCE
  11. Dim TipoTransaccion As String
  12. Dim InstrumentoFinanciero As Object
  13. Dim ResultadoMsgBox As Integer
  14. Dim IdPIN As Integer
  15. Dim IdIF As String
  16. Dim Operaciones As New Operaciones
  17. Dim oInversionDAO As New InversionDAO
  18. Private _PlazosFactor As String
  19. Private Sub frmPIN_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  20. Dim TipoTransaccionTMP As String = TipoTransaccion
  21. TipoTransaccion = "X"
  22. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.PAIS' Puede moverla o quitarla según sea necesario.
  23. Me.PAISTableAdapter.Fill(Me.InversionesDataSet1.PAIS)
  24. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.ECALRI' Puede moverla o quitarla según sea necesario.
  25. Me.ECALRITableAdapter.Fill(Me.InversionesDataSet1.ECALRI)
  26. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.CALRI' Puede moverla o quitarla según sea necesario.
  27. Me.CALRITableAdapter.Fill(Me.InversionesDataSet1.CALRI)
  28. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.EMIS' Puede moverla o quitarla según sea necesario.
  29. Me.EMISTableAdapter.Fill(Me.InversionesDataSet1.EMIS)
  30. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.INFI' Puede moverla o quitarla según sea necesario.
  31. Me.INFITableAdapter.Fill(Me.InversionesDataSet1.INFI)
  32. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.EMPR' Puede moverla o quitarla según sea necesario.
  33. Me.EMPRTableAdapter.Fill(Me.InversionesDataSet1.EMPR)
  34. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet1.PIN0' Puede moverla o quitarla según sea necesario.
  35. Me.PIN0TableAdapter1.Fill(Me.InversionesDataSet1.PIN0)
  36. 'TODO: esta línea de código carga datos en la tabla 'InversionesDataSet.PIN0' Puede moverla o quitarla según sea necesario.
  37. Call CargarEstadosDocumento()
  38. Call CargarEstadosAutorizacion()
  39. Call CargarOrigenDeFondos()
  40. Call CargarTipoOperacion()
  41. Call CargarTiposMercado()
  42. Call CargarTipoRenta()
  43. Call CargarTipoTasa()
  44. Call CargarPlazos()
  45. Call CargarPeriodicidades()
  46. 'Call CargarRegistro(0)
  47. TipoTransaccion = TipoTransaccionTMP
  48. If TipoTransaccion Is Nothing Then
  49. TipoTransaccion = "N"
  50. End If
  51. If TipoTransaccion = "N" Then
  52. Call NuevaPropuesta()
  53. ElseIf TipoTransaccion = "B" Then
  54. 'Call CargarPropuesta()
  55. End If
  56. 'Me.PIN0TableAdapter1.Fill(Me.InversionesDataSet1.PIN0)
  57. 'PIN0BindingSource.SuspendBinding()
  58. 'PIN0BindingSource.ResumeBinding()
  59. 'gpbInversión.Visible = False
  60. 'NuevaPropuesta()
  61. txtCodigoInversion.Text = String.Empty
  62. End Sub
  63. Private Sub CargarRegistro(posicion As Integer)
  64. Dim cargar As New DataTable
  65. cargar = oInversionDAO.ListaCodigosPropuesta()
  66. cbxEmpresas.SelectedValue = cargar.Rows(posicion)(1).ToString
  67. txtAsunto.Text = cargar.Rows(posicion)(2).ToString
  68. cbxInstrumentosFinancieros.SelectedValue = cargar.Rows(posicion)(3).ToString
  69. txtMontoInversion.Text = cargar.Rows(posicion)(4).ToString
  70. txtPrecio.Text = cargar.Rows(posicion)(5).ToString
  71. txtRendimiento.Text = cargar.Rows(posicion)(6).ToString
  72. txtPlazoNumero.Text = cargar.Rows(posicion)(7).ToString
  73. cbxPlazosFactor.SelectedValue = cargar.Rows(posicion)(8).ToString
  74. txtIngresos.Text = cargar.Rows(posicion)(9).ToString
  75. cbxOrigenDeFondos.SelectedValue = cargar.Rows(posicion)(10).ToString
  76. cbxEmisores.SelectedValue = cargar.Rows(posicion)(11).ToString
  77. cbxCalificacionDeRiesgo.SelectedValue = cargar.Rows(posicion)(12).ToString
  78. cbxCalificadoraDeRiesgo.SelectedValue = cargar.Rows(posicion)(13).ToString
  79. cbxPaises.SelectedValue = cargar.Rows(posicion)(14).ToString
  80. cbxTipoMercado.SelectedValue = cargar.Rows(posicion)(15).ToString
  81. txtCodigoInversion.Text = cargar.Rows(posicion)(16).ToString
  82. cbxEstadoDocumento.SelectedValue = cargar.Rows(posicion)(17).ToString
  83. cbxTipoOperacion.SelectedValue = cargar.Rows(posicion)(18).ToString
  84. dtpFechaDocumento.Value = cargar.Rows(posicion)(19)
  85. cbxAutorizacion.SelectedValue = cargar.Rows(posicion)(20).ToString
  86. End Sub
  87. Private Sub UsuarioPrivilegio()
  88. If chkUsuario.Checked = False Then
  89. gpbInversión.Visible = False
  90. Else
  91. gpbInversión.Visible = True
  92. End If
  93. End Sub
  94. Private Sub CargarEstadosDocumento()
  95. Dim vTipoTransaccion As String = TipoTransaccion
  96. TipoTransaccion = "X"
  97. Me.cbxEstadoDocumento.DataSource = oDAOPropuestasDeInversion.ListaEstadoDocumento.Tables("EstadosDocumento")
  98. Me.cbxEstadoDocumento.DisplayMember = "Descripcion"
  99. Me.cbxEstadoDocumento.ValueMember = "Codigo"
  100. Me.cbxEstadoDocumento.SelectedIndex = -1
  101. TipoTransaccion = vTipoTransaccion
  102. End Sub
  103. Private Sub CargarEstadosAutorizacion()
  104. Dim vTipoTransaccion As String = TipoTransaccion
  105. TipoTransaccion = "X"
  106. Me.cbxAutorizacion.DataSource = oDAOGeneral.ListaEstadoAutorizacion
  107. Me.cbxAutorizacion.DisplayMember = "Descripcion"
  108. Me.cbxAutorizacion.ValueMember = "Codigo"
  109. Me.cbxAutorizacion.SelectedIndex = -1
  110. TipoTransaccion = vTipoTransaccion
  111. End Sub
  112. Private Sub CargarEmpresas()
  113. Dim vTipoTransaccion As String = TipoTransaccion
  114. TipoTransaccion = "X"
  115. Me.cbxEmpresas.DataSource = oDAOGeneral.ListaEmpresas
  116. Me.cbxEmpresas.DisplayMember = "Descripcion"
  117. Me.cbxEmpresas.ValueMember = "Codigo"
  118. Me.cbxEmpresas.SelectedIndex = -1
  119. TipoTransaccion = vTipoTransaccion
  120. End Sub
  121. Private Sub CargarInstrumentosFinancieros()
  122. Dim vTipoTransaccion As String = TipoTransaccion
  123. TipoTransaccion = "X"
  124. Me.cbxInstrumentosFinancieros.DataSource = oDAOGeneral.ListaInstrumentos
  125. Me.cbxInstrumentosFinancieros.DisplayMember = "Descripcion"
  126. Me.cbxInstrumentosFinancieros.ValueMember = "Codigo"
  127. Me.cbxInstrumentosFinancieros.SelectedIndex = -1
  128. TipoTransaccion = vTipoTransaccion
  129. End Sub
  130. Private Sub CargarEmisores()
  131. Dim vTipoTransaccion As String = TipoTransaccion
  132. TipoTransaccion = "X"
  133. Me.cbxEmisores.DataSource = oDAOGeneral.ListaEmisores
  134. Me.cbxEmisores.DisplayMember = "Descripcion"
  135. Me.cbxEmisores.ValueMember = "Codigo"
  136. Me.cbxEmisores.SelectedIndex = -1
  137. TipoTransaccion = vTipoTransaccion
  138. End Sub
  139. Private Sub CargarCalificacionDeRiesgo()
  140. Dim vTipoTransaccion As String = TipoTransaccion
  141. TipoTransaccion = "X"
  142. Me.cbxCalificacionDeRiesgo.DataSource = oDAOGeneral.ListaCalificacionesDeRiesgo
  143. Me.cbxCalificacionDeRiesgo.DisplayMember = "Descripcion"
  144. Me.cbxCalificacionDeRiesgo.ValueMember = "Codigo"
  145. Me.cbxCalificacionDeRiesgo.SelectedIndex = -1
  146. TipoTransaccion = vTipoTransaccion
  147. End Sub
  148. Private Sub CargarCalificadoraDeRiesgo()
  149. Dim vTipoTransaccion As String = TipoTransaccion
  150. TipoTransaccion = "X"
  151. Me.cbxCalificadoraDeRiesgo.DataSource = oDAOGeneral.ListaEmpresasCalificadoras
  152. Me.cbxCalificadoraDeRiesgo.DisplayMember = "Descripcion"
  153. Me.cbxCalificadoraDeRiesgo.ValueMember = "Codigo"
  154. Me.cbxCalificadoraDeRiesgo.SelectedIndex = -1
  155. TipoTransaccion = vTipoTransaccion
  156. End Sub
  157. Private Sub CargarOrigenDeFondos()
  158. Dim vTipoTransaccion As String = TipoTransaccion
  159. TipoTransaccion = "X"
  160. Me.cbxOrigenDeFondos.DataSource = oDAOGeneral.ListaOrigenDeFondos
  161. Me.cbxOrigenDeFondos.DisplayMember = "Descripcion"
  162. Me.cbxOrigenDeFondos.ValueMember = "Codigo"
  163. Me.cbxOrigenDeFondos.SelectedIndex = -1
  164. TipoTransaccion = vTipoTransaccion
  165. End Sub
  166. Private Sub CargarPlazos()
  167. Dim vTipoTransaccion As String = TipoTransaccion
  168. TipoTransaccion = "X"
  169. Me.cbxPlazosFactor.DataSource = oDAOGeneral.ListaPlazosFactor
  170. Me.cbxPlazosFactor.DisplayMember = "Descripcion"
  171. Me.cbxPlazosFactor.ValueMember = "Codigo"
  172. Me.cbxPlazosFactor.SelectedIndex = -1
  173. TipoTransaccion = vTipoTransaccion
  174. End Sub
  175. Private Sub CargarTipoOperacion()
  176. Dim vTipoTransaccion As String = TipoTransaccion
  177. TipoTransaccion = "X"
  178. Me.cbxTipoOperacion.DataSource = oDAOGeneral.ListaTipoOperacion
  179. Me.cbxTipoOperacion.DisplayMember = "Descripcion"
  180. Me.cbxTipoOperacion.ValueMember = "Codigo"
  181. Me.cbxTipoOperacion.SelectedIndex = -1
  182. TipoTransaccion = vTipoTransaccion
  183. End Sub
  184. Private Sub CargarPaises()
  185. Dim vTipoTransaccion As String = TipoTransaccion
  186. TipoTransaccion = "X"
  187. Me.cbxPaises.DataSource = oDAOGeneral.ListaPaisesRelevanteInversion
  188. Me.cbxPaises.DisplayMember = "Descripcion"
  189. Me.cbxPaises.ValueMember = "Codigo"
  190. Me.cbxPaises.SelectedIndex = -1
  191. TipoTransaccion = vTipoTransaccion
  192. End Sub
  193. Private Sub CargarTiposMercado()
  194. Dim vTipoTransaccion As String = TipoTransaccion
  195. TipoTransaccion = "X"
  196. Me.cbxTipoMercado.DataSource = oDAOGeneral.ListaTiposMercado
  197. Me.cbxTipoMercado.DisplayMember = "Descripcion"
  198. Me.cbxTipoMercado.ValueMember = "Codigo"
  199. Me.cbxTipoMercado.SelectedIndex = -1
  200. TipoTransaccion = vTipoTransaccion
  201. End Sub
  202. Private Sub NuevaPropuesta()
  203. If oPropuestaInversionCE Is Nothing Then
  204. oPropuestaInversionCE = New CEPropuestaInversion
  205. End If
  206. HabilitarControles()
  207. LimpiarControles()
  208. Me.cbxEstadoDocumento.SelectedValue = "A"
  209. Me.cbxAutorizacion.SelectedValue = "P"
  210. Me.btnAccion.Text = "Guardar"
  211. Me.txtCodigoInversion.ReadOnly = True
  212. End Sub
  213. Private Sub GuardarPropuesta()
  214. RefrescarValoresControles()
  215. If ValoresValidos() Then
  216. If InstrumentoFinanciero Is Nothing Then
  217. ResultadoMsgBox = MessageBox.Show("No se ha ingresado detalles del Instrumento." & vbCrLf & "Desea continuar sin detalles?", "Sin Detalles", MessageBoxButtons.YesNo)
  218. If ResultadoMsgBox = DialogResult.Yes Then
  219. 'oDAOPropuestasDeInversion.NuevaPropuesta(oPropuestaInversionCE, InstrumentoFinanciero, False)
  220. 'Me.Dispose()
  221. End If
  222. Else
  223. 'oDAOPropuestasDeInversion.NuevaPropuesta(oPropuestaInversionCE, InstrumentoFinanciero)
  224. 'Me.Dispose()
  225. End If
  226. Else
  227. MessageBox.Show("Campos Imcompletos", "Error")
  228. End If
  229. End Sub
  230. Sub GuardarInstrumentoFinanciero()
  231. Dim vRetorno As Integer
  232. Dim vCodigoInversion As String = oPropuestaInversionCE.CodigoInversion
  233. If Not InstrumentoFinanciero Is Nothing Then
  234. Dim oAccionesCE As AccionesCE
  235. If InstrumentoFinanciero.GetType.ToString = oAccionesCE.GetType.ToString Then
  236. Dim oDAOAcciones As AccionesDAO = New AccionesDAO
  237. vRetorno = oDAOAcciones.Nuevo(InstrumentoFinanciero, 1, "P")
  238. End If
  239. If InstrumentoFinanciero.GetType.ToString = "Inversiones.CEBonos" Then
  240. Dim oDAOBonos As BonosDAO = New BonosDAO
  241. vRetorno = oDAOBonos.Nuevo(InstrumentoFinanciero, 1, "P")
  242. End If
  243. If InstrumentoFinanciero.GetType.ToString = "Inversiones.CEDAP" Then
  244. Dim oDAODAP As DepositosAPlazoDAO = New DepositosAPlazoDAO
  245. vRetorno = oDAODAP.Nuevo(InstrumentoFinanciero, 1, "P")
  246. End If
  247. If InstrumentoFinanciero.GetType.ToString = "Inversiones.CELetes" Then
  248. Dim oDAOLetes As LETESDAO = New LETESDAO
  249. vRetorno = oDAOLetes.Nuevo(InstrumentoFinanciero, vCodigoInversion)
  250. End If
  251. If InstrumentoFinanciero.GetType.ToString = "Inversiones.CEReportos" Then
  252. Dim oDAOReportos As ReportosDAO = New ReportosDAO
  253. vRetorno = oDAOReportos.Nuevo(InstrumentoFinanciero, 1, "P")
  254. End If
  255. End If
  256. End Sub
  257. Private Sub EliminarPropuesta()
  258. End Sub
  259. Private Sub ActualizarPropuesta(ByVal parametro As String)
  260. Dim retorno As Integer
  261. RefrescarValoresControles()
  262. retorno = oDAOPropuestasDeInversion.Actualizar(oPropuestaInversionCE, parametro, "")
  263. If retorno = 0 Then
  264. MsgBox("Registro Actualizado", MsgBoxStyle.Information)
  265. CargarPropuesta(IdPIN)
  266. 'TipoTransaccion = "C"
  267. 'btnAccion.Text = "Aceptar"
  268. 'DeshabilitarControles()
  269. End If
  270. End Sub
  271. Private Sub cboEmpresas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxEmpresas.SelectedIndexChanged
  272. ControlEmpresa()
  273. End Sub
  274. Private Sub txtAsunto_TextChanged(sender As Object, e As EventArgs) Handles txtAsunto.TextChanged
  275. End Sub
  276. Private Sub txtAsunto_LostFocus(sender As Object, e As EventArgs) Handles txtAsunto.LostFocus
  277. ControlAsunto()
  278. End Sub
  279. Private Sub cboInstrumentosFinancieros_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxInstrumentosFinancieros.SelectedIndexChanged
  280. ControlInstrumento()
  281. End Sub
  282. Private Sub txtMontoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtMontoInversion.TextChanged
  283. Dim vParse As Boolean
  284. Dim valor As Double
  285. vParse = Double.TryParse(Me.txtMontoInversion.Text, valor)
  286. If Not vParse Then
  287. Me.lblMontoInversionErr.Visible = True
  288. Else
  289. Me.lblMontoInversionErr.Visible = False
  290. End If
  291. End Sub
  292. Private Sub txtMontoInversion_LostFocus(sender As Object, e As EventArgs) Handles txtMontoInversion.LostFocus
  293. ControlMontoInversion()
  294. End Sub
  295. Private Sub txtPrecio_TextChanged(sender As Object, e As EventArgs) Handles txtPrecio.TextChanged
  296. Dim vParse As Boolean
  297. Dim valor As Double
  298. vParse = Double.TryParse(Me.txtPrecio.Text, valor)
  299. If Not vParse Then
  300. lblPrecioErr.Visible = True
  301. Else
  302. lblPrecioErr.Visible = False
  303. End If
  304. End Sub
  305. Private Sub txtPrecio_LostFocus(sender As Object, e As EventArgs) Handles txtPrecio.LostFocus
  306. ControlPrecio()
  307. End Sub
  308. Private Sub txtRendimiento_TextChanged(sender As Object, e As EventArgs) Handles txtRendimiento.TextChanged
  309. Dim vParse As Boolean
  310. Dim valor As Double
  311. vParse = Double.TryParse(txtRendimiento.Text.Replace("%", ""), valor)
  312. If Not vParse Then
  313. Me.lblRendimientoErr.Visible = True
  314. Else
  315. Me.lblRendimientoErr.Visible = False
  316. End If
  317. End Sub
  318. Private Sub txtRendimiento_LostFocus(sender As Object, e As EventArgs) Handles txtRendimiento.LostFocus
  319. ControlRendimiento()
  320. End Sub
  321. Private Sub cboPlazos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxPlazosFactor.SelectedIndexChanged
  322. ControlPlazoFactor()
  323. End Sub
  324. Private Sub txtPlazoNumero_TextChanged(sender As Object, e As EventArgs) Handles txtPlazoNumero.TextChanged
  325. If TipoTransaccion = "N" Then
  326. Dim vParse As Boolean = True
  327. Dim valor As Integer = 0
  328. If Me.txtPlazoNumero.Text.Length > 0 Then
  329. vParse = Integer.TryParse(Me.txtPlazoNumero.Text, valor)
  330. End If
  331. If Not vParse Then
  332. Me.lblPlazoErrr.Visible = True
  333. Else
  334. Me.lblPlazoErrr.Visible = False
  335. End If
  336. End If
  337. End Sub
  338. Private Sub txtPlazoNumero_LostFocus(sender As Object, e As EventArgs) Handles txtPlazoNumero.LostFocus
  339. ControlPlazoNumero()
  340. End Sub
  341. Private Sub txtIngresos_TextChanged(sender As Object, e As EventArgs) Handles txtIngresos.TextChanged
  342. Dim vParse As Boolean
  343. Dim valor As Double
  344. vParse = Double.TryParse(Me.txtIngresos.Text, valor)
  345. If Not vParse Then
  346. Me.lblingresosErr.Visible = True
  347. Else
  348. Me.lblingresosErr.Visible = False
  349. End If
  350. End Sub
  351. Private Sub cboOrigenDeFodos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxOrigenDeFondos.SelectedIndexChanged
  352. ControlOrigenDeFondos()
  353. End Sub
  354. Private Sub cboEmisores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxEmisores.SelectedIndexChanged
  355. ControlEmisores()
  356. End Sub
  357. Private Sub cboCalificacionDeRiesgo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxCalificacionDeRiesgo.SelectedIndexChanged
  358. ControlCalificacionesDeRiesgo()
  359. End Sub
  360. Private Sub cboCalificadoraDeRiesgo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxCalificadoraDeRiesgo.SelectedIndexChanged
  361. ControlCalificadoraDeRiesgo()
  362. End Sub
  363. Private Sub txtJustificacion_TextChanged(sender As Object, e As EventArgs) Handles txtJustificacion.TextChanged
  364. End Sub
  365. Private Sub txtJustificacion_LostFocus(sender As Object, e As EventArgs) Handles txtJustificacion.LostFocus
  366. ControlJustificacion()
  367. End Sub
  368. Private Sub txtComentarios_TextChanged(sender As Object, e As EventArgs) Handles txtComentarios.TextChanged
  369. End Sub
  370. Private Sub txtComentarios_LostFocus(sender As Object, e As EventArgs) Handles txtComentarios.LostFocus
  371. ControlComentarios()
  372. End Sub
  373. Private Sub cboEstadoDocumento_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxEstadoDocumento.SelectedIndexChanged
  374. ControlEstadoDocumento()
  375. End Sub
  376. Private Sub dtpFechaDocumento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaDocumento.ValueChanged
  377. ControlFechaDocumento()
  378. End Sub
  379. Private Sub txtIngresos_LostFocus(sender As Object, e As EventArgs) Handles txtIngresos.LostFocus
  380. ControlIngresos()
  381. End Sub
  382. Private Sub PrepararBusqueda()
  383. TipoTransaccion = "B"
  384. oPropuestaInversionCE = Nothing
  385. oPropuestaInversionCE = New CEPropuestaInversion
  386. LimpiarControles()
  387. HabilitarControles()
  388. PrepararControlesParaBusqueda()
  389. End Sub
  390. Private Sub CargarPropuesta(pId As Integer)
  391. oPropuestaInversionCE = Nothing
  392. 'oPropuestaInversionCE = oDAOPropuestasDeInversion.CargarPropuesta(pId)
  393. Dim vCodigoEmpresa As String = oPropuestaInversionCE.CodigoEmpresa
  394. If vCodigoEmpresa.Length = 0 Then
  395. Me.cbxEmpresas.SelectedIndex = -1
  396. Else
  397. Me.cbxEmpresas.SelectedValue = vCodigoEmpresa
  398. End If
  399. Me.txtAsunto.Text = oPropuestaInversionCE.Asunto
  400. Dim vCodigoInstrumentoFinanciero As String = oPropuestaInversionCE.CodigoInstrumentoFinanciero
  401. If vCodigoInstrumentoFinanciero.Length = 0 Then
  402. Me.cbxInstrumentosFinancieros.SelectedIndex = -1
  403. Else
  404. Me.cbxInstrumentosFinancieros.SelectedValue = vCodigoInstrumentoFinanciero
  405. End If
  406. Me.txtMontoInversion.Text = oPropuestaInversionCE.MontoInversion.ToString(Configuraciones.CodigoTXTMontos)
  407. Me.txtPrecio.Text = oPropuestaInversionCE.Precio.ToString(Configuraciones.CodigoTXTMontos)
  408. Me.txtRendimiento.Text = oPropuestaInversionCE.Rendimiento.ToString(Configuraciones.CodigoTXTPorcentaje)
  409. Me.txtPlazoNumero.Text = oPropuestaInversionCE.PlazoNumero
  410. Dim vPlazoFactor As String = oPropuestaInversionCE.PlazoFactor
  411. If vPlazoFactor.Length = 0 Then
  412. Me.cbxPlazosFactor.SelectedIndex = -1
  413. Else
  414. Me.cbxPlazosFactor.SelectedValue = vPlazoFactor
  415. End If
  416. Me.txtIngresos.Text = oPropuestaInversionCE.Ingresos.ToString(Configuraciones.CodigoTXTMontos)
  417. Dim vOrigenDeFondos As String = oPropuestaInversionCE.OrigenDeFondos
  418. If vOrigenDeFondos.Length = 0 Then
  419. Me.cbxOrigenDeFondos.SelectedIndex = -1
  420. Else
  421. Me.cbxOrigenDeFondos.SelectedValue = vOrigenDeFondos
  422. End If
  423. Dim vCodigoEmisor As String = oPropuestaInversionCE.CodigoEmisor
  424. If vCodigoEmisor = 0 Then
  425. Me.cbxEmisores.SelectedIndex = -1
  426. Else
  427. Me.cbxEmisores.SelectedValue = vCodigoEmisor
  428. End If
  429. Dim vCodigoCalificacionDeRiesgo As String = oPropuestaInversionCE.CodigoCalificacionDeRiesgo
  430. If vCodigoCalificacionDeRiesgo.Length = 0 Then
  431. Me.cbxCalificacionDeRiesgo.SelectedIndex = -1
  432. Else
  433. Me.cbxCalificacionDeRiesgo.SelectedValue = vCodigoCalificacionDeRiesgo
  434. End If
  435. Dim vCodigoEmpresaCalificadora As String = oPropuestaInversionCE.CodigoEmpresaCalificadora
  436. If vCodigoEmpresaCalificadora.Length = 0 Then
  437. Me.cbxCalificadoraDeRiesgo.SelectedIndex = -1
  438. Else
  439. Me.cbxCalificadoraDeRiesgo.SelectedValue = vCodigoEmpresaCalificadora
  440. End If
  441. Me.txtJustificacion.Text = oPropuestaInversionCE.Justificacion
  442. Me.txtComentarios.Text = oPropuestaInversionCE.Comentarios
  443. Me.txtCodigoInversion.Text = oPropuestaInversionCE.CodigoInversion
  444. Me.txtCodigoInversion.ReadOnly = True
  445. Dim vEstadoDocumento As String = oPropuestaInversionCE.EstadoDocumento
  446. If vEstadoDocumento.Length = 0 Then
  447. Me.cbxEstadoDocumento.SelectedIndex = -1
  448. Else
  449. Me.cbxEstadoDocumento.SelectedValue = vEstadoDocumento
  450. End If
  451. Dim vFechaDocumento As Date
  452. If Not Date.TryParse(oPropuestaInversionCE.FechaDocumento, vFechaDocumento) Then
  453. vFechaDocumento = Date.MinValue.Date
  454. End If
  455. Me.dtpFechaDocumento.Value = vFechaDocumento
  456. Dim vTipoOperacion As String = oPropuestaInversionCE.TipoOperacion
  457. If String.IsNullOrEmpty(vTipoOperacion) Then
  458. Me.cbxTipoOperacion.SelectedIndex = -1
  459. Else
  460. Me.cbxTipoOperacion.SelectedValue = vTipoOperacion
  461. End If
  462. Dim vEstadoAut As String = oPropuestaInversionCE.EstadoAutorizacion
  463. If vEstadoAut.Length = 0 Then
  464. Me.cbxAutorizacion.SelectedIndex = -1
  465. Else
  466. Me.cbxAutorizacion.SelectedValue = vEstadoAut
  467. End If
  468. Dim vTipoMercado As String = oPropuestaInversionCE.TipoMercado
  469. If String.IsNullOrEmpty(vTipoMercado) Then
  470. cbxTipoMercado.SelectedIndex = -1
  471. Else
  472. Me.cbxTipoMercado.SelectedValue = vTipoMercado
  473. End If
  474. Dim vPais As String = oPropuestaInversionCE.Pais
  475. If String.IsNullOrEmpty(vPais) Then
  476. cbxPaises.SelectedIndex = -1
  477. Else
  478. cbxPaises.SelectedValue = vPais
  479. End If
  480. TipoTransaccion = "C"
  481. IdPIN = pId
  482. IdIF = vCodigoInstrumentoFinanciero
  483. Me.btnAccion.Text = "Aceptar"
  484. RefrescarControles()
  485. End Sub
  486. 'NAVEGACION
  487. Sub PrimerRegistro()
  488. End Sub
  489. Sub RegistroAnterior()
  490. End Sub
  491. Sub SiguienteRegistro()
  492. End Sub
  493. Sub UltimoRegistro()
  494. End Sub
  495. Private Sub BloquearEmpresaInstrumento()
  496. cbxEmpresas.Enabled = False
  497. cbxInstrumentosFinancieros.Enabled = False
  498. End Sub
  499. '***FIN NAVEGACION
  500. Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
  501. 'cboEstadoDocumento.SelectedIndexChanged()
  502. 'cboEstadoDocumento_SelectedIndexChanged()
  503. If TipoTransaccion = "B" Then
  504. LanzarBusqueda()
  505. ElseIf TipoTransaccion = "N" Then
  506. GuardarPropuesta()
  507. GuardarInstrumentoFinanciero()
  508. LimpiarControles()
  509. txtCodigoInversion.ReadOnly = True
  510. 'Me.PIN0TableAdapter1.Fill(Me.InversionesDataSet1.PIN0)
  511. Refrescar()
  512. 'PIN0BindingSource.SuspendBinding()
  513. ElseIf TipoTransaccion = "A" Then
  514. Dim posicion = PIN0BindingSource.Position
  515. ActualizarPropuesta(txtCodigoInversion.Text)
  516. Me.PIN0TableAdapter1.Fill(Me.InversionesDataSet1.PIN0)
  517. Refrescar()
  518. PIN0BindingSource.Position = posicion
  519. 'PIN0BindingSource.SuspendBinding()
  520. DeshabilitarControles()
  521. End If
  522. End Sub
  523. Private Sub LanzarBusqueda()
  524. Dim frmBuscar As New frmBuscarDeLista
  525. 'frmBuscar.DatosPropuesta = oPropuestaInversionCE
  526. If frmBuscar.ShowDialog = DialogResult.OK Then
  527. If Not frmBuscar.CodigoPrincipal = Nothing Then
  528. CargarPropuesta(frmBuscar.CodigoPrincipal)
  529. End If
  530. End If
  531. End Sub
  532. Private Sub navPrimerRegistro_Click(sender As Object, e As EventArgs)
  533. PrimerRegistro()
  534. End Sub
  535. Private Sub navRegistroAnterior_Click(sender As Object, e As EventArgs)
  536. RegistroAnterior()
  537. End Sub
  538. Private Sub navSiguienteRegistro_Click(sender As Object, e As EventArgs)
  539. SiguienteRegistro()
  540. End Sub
  541. Private Sub navUltimoRegistro_Click(sender As Object, e As EventArgs)
  542. UltimoRegistro()
  543. End Sub
  544. Private Sub navNuevoRegistro_Click(sender As Object, e As EventArgs)
  545. NuevaPropuesta()
  546. End Sub
  547. Private Sub navEliminarRegistro_Click(sender As Object, e As EventArgs)
  548. EliminarPropuesta()
  549. End Sub
  550. Private Sub navBuscar_Click(sender As Object, e As EventArgs)
  551. PrepararBusqueda()
  552. End Sub
  553. Private Sub cboEmpresas_LostFocus(sender As Object, e As EventArgs) Handles cbxEmpresas.LostFocus
  554. End Sub
  555. Sub GenerarCodigoDeInversion()
  556. Dim vEmpresa As String
  557. Dim vCodigoIF As String
  558. Dim oCodigo As String
  559. vEmpresa = oPropuestaInversionCE.CodigoEmpresa
  560. vCodigoIF = oPropuestaInversionCE.CodigoInstrumentoFinanciero
  561. oCodigo = SeriesDAO.SiguienteCodigoInversion(vEmpresa, vCodigoIF)
  562. Me.txtCodigoInversion.Text = oCodigo
  563. End Sub
  564. Private Sub txtCodigoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoInversion.TextChanged
  565. ControlCodigoInversion()
  566. End Sub
  567. Private Sub ControlEmpresa()
  568. If TipoTransaccion = "N" Then
  569. oPropuestaInversionCE.CodigoEmpresa = Me.cbxEmpresas.SelectedValue
  570. GenerarCodigoDeInversion()
  571. End If
  572. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  573. oPropuestaInversionCE.CodigoEmpresa = Me.cbxEmpresas.SelectedValue
  574. End If
  575. End Sub
  576. Private Sub ControlAsunto()
  577. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  578. oPropuestaInversionCE.Asunto = Me.txtAsunto.Text
  579. End If
  580. End Sub
  581. Private Sub ControlInstrumento()
  582. If TipoTransaccion = "N" Then
  583. oPropuestaInversionCE.CodigoInstrumentoFinanciero = Me.cbxInstrumentosFinancieros.SelectedValue
  584. GenerarCodigoDeInversion()
  585. End If
  586. If TipoTransaccion = "N" Or TipoTransaccion = "B" Then
  587. oPropuestaInversionCE.CodigoInstrumentoFinanciero = Me.cbxInstrumentosFinancieros.SelectedValue
  588. End If
  589. End Sub
  590. Private Sub ControlMontoInversion()
  591. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  592. Dim vParse As Boolean
  593. Dim valor As Double
  594. vParse = Double.TryParse(Me.txtMontoInversion.Text, valor)
  595. If Not vParse Then
  596. lblMontoInversionErr.Visible = True
  597. Else
  598. oPropuestaInversionCE.MontoInversion = valor
  599. Me.txtMontoInversion.Text = oPropuestaInversionCE.MontoInversion.ToString(Configuraciones.CodigoTXTMontos)
  600. lblMontoInversionErr.Visible = False
  601. End If
  602. End If
  603. End Sub
  604. Private Sub ControlPrecio()
  605. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  606. Dim vParse As Boolean
  607. Dim valor As Double
  608. vParse = Double.TryParse(Me.txtPrecio.Text, valor)
  609. If Not vParse Then
  610. lblPrecioErr.Visible = True
  611. Else
  612. oPropuestaInversionCE.Precio = valor
  613. Me.txtPrecio.Text = oPropuestaInversionCE.Precio.ToString(Configuraciones.CodigoTXTMontos)
  614. lblPrecioErr.Visible = False
  615. End If
  616. End If
  617. End Sub
  618. Private Sub ControlRendimiento()
  619. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  620. Dim vParse As Boolean
  621. Dim valor As Double
  622. vParse = Double.TryParse(txtRendimiento.Text.Replace("%", ""), valor)
  623. If Not vParse Then
  624. Me.lblRendimientoErr.Visible = True
  625. Else
  626. oPropuestaInversionCE.Rendimiento = valor / 100
  627. txtRendimiento.Text = oPropuestaInversionCE.Rendimiento.ToString(Configuraciones.CodigoTXTPorcentaje)
  628. Me.lblRendimientoErr.Visible = False
  629. End If
  630. End If
  631. End Sub
  632. Private Sub ControlPlazoNumero()
  633. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  634. Dim vParse As Boolean = True
  635. Dim valor As Integer = 0
  636. If Me.txtPlazoNumero.Text.Length > 0 Then
  637. vParse = Integer.TryParse(Me.txtPlazoNumero.Text, valor)
  638. End If
  639. If Not vParse Then
  640. Me.lblPlazoErrr.Visible = True
  641. Else
  642. oPropuestaInversionCE.PlazoNumero = valor
  643. Me.lblPlazoErrr.Visible = False
  644. End If
  645. End If
  646. End Sub
  647. Private Sub ControlPlazoFactor()
  648. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  649. oPropuestaInversionCE.PlazoFactor = Me.cbxPlazosFactor.SelectedValue
  650. End If
  651. End Sub
  652. Private Sub ControlIngresos()
  653. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  654. Dim vParse As Boolean
  655. Dim valor As Double
  656. vParse = Double.TryParse(Me.txtIngresos.Text, valor)
  657. If Not vParse Then
  658. Me.lblingresosErr.Visible = True
  659. Else
  660. oPropuestaInversionCE.Ingresos = valor
  661. Me.txtIngresos.Text = oPropuestaInversionCE.Ingresos.ToString(Configuraciones.CodigoTXTMontos)
  662. Me.lblingresosErr.Visible = False
  663. End If
  664. End If
  665. End Sub
  666. Private Sub ControlOrigenDeFondos()
  667. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  668. oPropuestaInversionCE.OrigenDeFondos = Me.cbxOrigenDeFondos.SelectedValue
  669. End If
  670. End Sub
  671. Private Sub ControlEmisores()
  672. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  673. oPropuestaInversionCE.CodigoEmisor = Me.cbxEmisores.SelectedValue
  674. End If
  675. End Sub
  676. Private Sub ControlCalificacionesDeRiesgo()
  677. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  678. oPropuestaInversionCE.CodigoCalificacionDeRiesgo = Me.cbxCalificacionDeRiesgo.SelectedValue
  679. End If
  680. End Sub
  681. Private Sub ControlCalificadoraDeRiesgo()
  682. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  683. oPropuestaInversionCE.CodigoEmpresaCalificadora = Me.cbxCalificadoraDeRiesgo.SelectedValue
  684. End If
  685. End Sub
  686. Private Sub ControlTipoMercado()
  687. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  688. oPropuestaInversionCE.TipoMercado = Me.cbxTipoMercado.SelectedValue
  689. End If
  690. End Sub
  691. Private Sub ControlPais()
  692. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  693. oPropuestaInversionCE.Pais = Me.cbxPaises.SelectedValue
  694. End If
  695. End Sub
  696. Private Sub ControlJustificacion()
  697. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  698. oPropuestaInversionCE.Justificacion = Me.txtJustificacion.Text
  699. End If
  700. End Sub
  701. Private Sub ControlComentarios()
  702. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  703. oPropuestaInversionCE.Comentarios = Me.txtComentarios.Text
  704. End If
  705. End Sub
  706. Private Sub ControlCodigoInversion()
  707. If TipoTransaccion = "N" Or TipoTransaccion = "B" Then
  708. oPropuestaInversionCE.CodigoInversion = txtCodigoInversion.Text
  709. End If
  710. End Sub
  711. Private Sub ControlEstadoDocumento()
  712. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  713. oPropuestaInversionCE.EstadoDocumento = Me.cbxEstadoDocumento.SelectedValue
  714. End If
  715. End Sub
  716. Private Sub ControlEstadoAutorizacion()
  717. If TipoTransaccion = "N" Or TipoTransaccion = "B" Or TipoTransaccion = "A" Then
  718. oPropuestaInversionCE.EstadoAutorizacion = Me.cbxAutorizacion.SelectedValue
  719. End If
  720. End Sub
  721. Private Sub ControlFechaDocumento()
  722. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  723. oPropuestaInversionCE.FechaDocumento = Me.dtpFechaDocumento.Value.Date
  724. End If
  725. End Sub
  726. Private Sub ControlTipoOperacion()
  727. If TipoTransaccion = "N" Or TipoTransaccion = "A" Then
  728. oPropuestaInversionCE.TipoOperacion = Me.cbxTipoOperacion.SelectedValue
  729. End If
  730. End Sub
  731. Private Sub LimpiarControles()
  732. Dim vCero As Double = 0
  733. Dim vCerotxt As String = vCero.ToString(Configuraciones.CodigoTXTMontos)
  734. Me.cbxEmpresas.SelectedIndex = -1
  735. Me.txtAsunto.Text = String.Empty
  736. Me.cbxInstrumentosFinancieros.SelectedIndex = -1
  737. Me.txtMontoInversion.Text = vCerotxt
  738. Me.txtPrecio.Text = vCerotxt
  739. Me.txtRendimiento.Text = vCerotxt
  740. Me.txtPlazoNumero.Text = String.Empty
  741. Me.cbxPlazosFactor.SelectedIndex = -1
  742. Me.txtIngresos.Text = vCerotxt
  743. Me.cbxOrigenDeFondos.SelectedIndex = -1
  744. Me.cbxEmisores.SelectedIndex = -1
  745. Me.cbxCalificacionDeRiesgo.SelectedIndex = -1
  746. Me.cbxCalificadoraDeRiesgo.SelectedIndex = -1
  747. Me.txtJustificacion.Text = String.Empty
  748. Me.txtComentarios.Text = String.Empty
  749. Me.txtCodigoInversion.Text = String.Empty
  750. Me.txtCodigoInversion.ReadOnly = False
  751. Me.cbxEstadoDocumento.SelectedIndex = -1
  752. Me.cbxAutorizacion.SelectedIndex = -1
  753. Me.dtpFechaDocumento.Value = Date.Now.Date
  754. Me.cbxTipoOperacion.SelectedIndex = -1
  755. Me.cbxTipoMercado.SelectedIndex = -1
  756. Me.cbxPaises.SelectedIndex = -1
  757. End Sub
  758. Private Sub RefrescarValoresControles()
  759. ControlEmpresa()
  760. ControlAsunto()
  761. ControlInstrumento()
  762. ControlMontoInversion()
  763. ControlPrecio()
  764. ControlRendimiento()
  765. ControlPlazoNumero()
  766. ControlPlazoFactor()
  767. ControlIngresos()
  768. ControlOrigenDeFondos()
  769. ControlEmisores()
  770. ControlCalificacionesDeRiesgo()
  771. ControlCalificadoraDeRiesgo()
  772. ControlJustificacion()
  773. ControlComentarios()
  774. ControlCodigoInversion()
  775. ControlEstadoDocumento()
  776. ControlEstadoAutorizacion()
  777. ControlFechaDocumento()
  778. ControlTipoOperacion()
  779. ControlTipoMercado()
  780. ControlPais()
  781. End Sub
  782. Private Function ValoresValidos() As Boolean
  783. Dim retorno As Boolean = True
  784. If TipoTransaccion = "N" Then
  785. If oPropuestaInversionCE.CodigoEmpresa.Length = 0 Then retorno = False
  786. If oPropuestaInversionCE.CodigoInstrumentoFinanciero.Length = 0 Then retorno = False
  787. If oPropuestaInversionCE.CodigoInstrumentoFinanciero.Length = 0 Then retorno = False
  788. If oPropuestaInversionCE.EstadoDocumento.Length = 0 Then retorno = False
  789. If oPropuestaInversionCE.EstadoAutorizacion.Length = 0 Then retorno = False
  790. If (String.IsNullOrEmpty(oPropuestaInversionCE.TipoOperacion)) Then
  791. retorno = False
  792. Else
  793. If oPropuestaInversionCE.TipoOperacion.Length = 0 Then retorno = False
  794. End If
  795. End If
  796. Return retorno
  797. End Function
  798. Private Sub cboTipoOperacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxTipoOperacion.SelectedIndexChanged
  799. ControlTipoOperacion()
  800. End Sub
  801. Private Sub btnDetalleIF_Click(sender As Object, e As EventArgs) Handles btnDetalleIF.Click
  802. Variables.Codigo = txtCodigoInversion.Text
  803. 'If Not oDAOGeneral.PropuestaTieneInstrumentoAsociado(oPropuestaInversionCE.CodigoInversion, oPropuestaInversionCE.TipoInstrumentoFinanciero) Then
  804. ' MsgBox("Esta Propuesta no tiene un detalle asociado.", MsgBoxStyle.Critical)
  805. ' GoTo Salida
  806. 'End If
  807. If oPropuestaInversionCE.TipoInstrumentoFinanciero = "FINV" Then
  808. frmFOIN.Show()
  809. End If
  810. If oPropuestaInversionCE.TipoInstrumentoFinanciero = "FUTU" Or oPropuestaInversionCE.TipoInstrumentoFinanciero = "OPC" Then
  811. frmFuturos.Show()
  812. End If
  813. If Not oPropuestaInversionCE Is Nothing Then
  814. If oPropuestaInversionCE.TipoInstrumentoFinanciero = "ACC" Then
  815. Dim oFormulario As New frmAcciones
  816. If TipoTransaccion = "C" Then
  817. oFormulario.CargarRegistro(oPropuestaInversionCE.CodigoInversion)
  818. oFormulario.ShowDialog()
  819. End If
  820. If TipoTransaccion = "N" Then
  821. oFormulario.TipoTransaccion = "N"
  822. If oFormulario.ShowDialog = DialogResult.OK Then
  823. Me.oCEAcciones = New AccionesCE
  824. Me.oCEAcciones = oFormulario.RetornarObjeto
  825. InstrumentoFinanciero = Me.oCEAcciones
  826. oFormulario.Dispose()
  827. End If
  828. End If
  829. End If
  830. If oPropuestaInversionCE.CodigoInstrumentoFinanciero = "LETE" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "CETE" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "PBUR" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "VCN" Then
  831. Dim oFormulario As New frmLetes
  832. If TipoTransaccion = "C" Then
  833. Dim vValidar As Integer
  834. Dim vCodigoInversion As String = oPropuestaInversionCE.CodigoInversion
  835. vValidar = oDAOLETES.Comprobar(vCodigoInversion)
  836. If vValidar > 0 Then
  837. 'MsgBox("Se encuentran detalles.")
  838. oFormulario.CargarRegistro(vCodigoInversion)
  839. oFormulario.ShowDialog()
  840. Else
  841. MsgBox("No se encuentran detalles del instrumento.")
  842. End If
  843. 'oFormulario.CargarRegistro(IdPIN, "P")
  844. 'oFormulario.ShowDialog()
  845. End If
  846. If TipoTransaccion = "N" Then
  847. oFormulario.Modo = "N"
  848. If oFormulario.ShowDialog = DialogResult.OK Then
  849. Me.oCELetes = New LETESCE
  850. Me.oCELetes = oFormulario.RetornarObjeto
  851. InstrumentoFinanciero = Me.oCELetes
  852. oFormulario.Dispose()
  853. End If
  854. End If
  855. End If
  856. If oPropuestaInversionCE.CodigoInstrumentoFinanciero = "BONO" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "CINV" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "TIT" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "EURB" Then
  857. Dim oFormulario As New frmCertificadosDeInversion
  858. If oPropuestaInversionCE.CodigoInstrumentoFinanciero = "CINV" Then
  859. If TipoTransaccion = "C" Then
  860. oFormulario.CargarRegistro(oPropuestaInversionCE.CodigoInversion)
  861. oFormulario.ShowDialog()
  862. End If
  863. If TipoTransaccion = "N" Then
  864. oFormulario.TipoTransaccion = "N"
  865. If oFormulario.ShowDialog = DialogResult.OK Then
  866. Dim oCE As New CertificadoDeInversionCE
  867. oCE = oFormulario.RetornarObjeto
  868. InstrumentoFinanciero = oCE
  869. oFormulario.Dispose()
  870. End If
  871. End If
  872. ElseIf oPropuestaInversionCE.CodigoInstrumentoFinanciero = "CINV" Then
  873. oFormulario.ShowDialog()
  874. ElseIf oPropuestaInversionCE.CodigoInstrumentoFinanciero = "BONO" Or oPropuestaInversionCE.CodigoInstrumentoFinanciero = "EURB" Then
  875. oFormulario.ShowDialog()
  876. End If
  877. End If
  878. If oPropuestaInversionCE.CodigoInstrumentoFinanciero = "DAP" Then
  879. Dim oFormulario As New frmDepositosAPlazo
  880. If TipoTransaccion = "C" Then
  881. oFormulario.CargarRegistro(IdPIN, "P")
  882. oFormulario.ShowDialog()
  883. End If
  884. If TipoTransaccion = "N" Then
  885. 'oFormulario.Modo = "N"
  886. If oFormulario.ShowDialog = DialogResult.OK Then
  887. Me.oCEDAP = New DepositosAPlazoCE
  888. Me.oCEDAP = oFormulario.RetornarObjeto
  889. InstrumentoFinanciero = Me.oCEDAP
  890. oFormulario.Dispose()
  891. End If
  892. End If
  893. End If
  894. If oPropuestaInversionCE.CodigoInstrumentoFinanciero = "REPO" Then
  895. Dim oFormulario As New frmReporto
  896. If TipoTransaccion = "C" Then
  897. oFormulario.ShowDialog()
  898. End If
  899. If TipoTransaccion = "N" Then
  900. oFormulario.Modo = "N"
  901. If oFormulario.ShowDialog = DialogResult.OK Then
  902. Me.oCEReportos = New ReportosCE
  903. InstrumentoFinanciero = oCEReportos
  904. oFormulario.Dispose()
  905. End If
  906. End If
  907. End If
  908. End If
  909. Salida:
  910. End Sub
  911. Private Sub navNuevo_Click(sender As Object, e As EventArgs)
  912. NuevaPropuesta()
  913. End Sub
  914. Private Sub DeshabilitarControles()
  915. cbxEmpresas.Enabled = False
  916. txtAsunto.ReadOnly = True
  917. cbxInstrumentosFinancieros.Enabled = False
  918. txtMontoInversion.ReadOnly = True
  919. txtPrecio.ReadOnly = True
  920. txtRendimiento.ReadOnly = True
  921. txtPlazoNumero.ReadOnly = True
  922. cbxPlazosFactor.Enabled = False
  923. txtIngresos.ReadOnly = True
  924. cbxOrigenDeFondos.Enabled = False
  925. cbxEmisores.Enabled = False
  926. cbxCalificacionDeRiesgo.Enabled = False
  927. cbxCalificadoraDeRiesgo.Enabled = False
  928. txtJustificacion.ReadOnly = True
  929. txtComentarios.ReadOnly = True
  930. cbxTipoOperacion.Enabled = False
  931. cbxEstadoDocumento.Enabled = False
  932. cbxAutorizacion.Enabled = False
  933. dtpFechaDocumento.Enabled = False
  934. cbxTipoMercado.Enabled = False
  935. cbxPaises.Enabled = False
  936. txtCodigoInversion.ReadOnly = True
  937. End Sub
  938. Private Sub HabilitarControles()
  939. cbxEmpresas.Enabled = True
  940. txtAsunto.ReadOnly = False
  941. cbxInstrumentosFinancieros.Enabled = True
  942. txtMontoInversion.ReadOnly = False
  943. txtPrecio.ReadOnly = False
  944. txtRendimiento.ReadOnly = False
  945. txtPlazoNumero.ReadOnly = False
  946. cbxPlazosFactor.Enabled = True
  947. txtIngresos.ReadOnly = False
  948. cbxOrigenDeFondos.Enabled = True
  949. cbxEmisores.Enabled = True
  950. cbxCalificacionDeRiesgo.Enabled = True
  951. cbxCalificadoraDeRiesgo.Enabled = True
  952. txtJustificacion.ReadOnly = False
  953. txtComentarios.ReadOnly = False
  954. cbxTipoOperacion.Enabled = True
  955. cbxAutorizacion.Enabled = True
  956. dtpFechaDocumento.Enabled = True
  957. cbxTipoMercado.Enabled = True
  958. cbxPaises.Enabled = True
  959. cbxEstadoDocumento.Enabled = True
  960. End Sub
  961. Private Sub PrepararModificacion()
  962. If oPropuestaInversionCE.EstadoDocumento = "A" Then
  963. HabilitarControles()
  964. TipoTransaccion = "A"
  965. RefrescarControles()
  966. Me.btnAccion.Text = "Actualizar"
  967. End If
  968. End Sub
  969. Private Sub cboAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxAutorizacion.SelectedIndexChanged
  970. ControlEstadoAutorizacion()
  971. End Sub
  972. Private Sub btnActivar_Click(sender As Object, e As EventArgs) Handles btnActivar.Click
  973. Variables.Plazo = txtPlazoNumero.Text
  974. If (cbxPlazosFactor.SelectedValue = Nothing) Then
  975. Variables.PlazoFact = ""
  976. Else
  977. Variables.PlazoFact = cbxPlazosFactor.SelectedValue.ToString()
  978. End If
  979. ' If TipoTransaccion = "C" Then
  980. If oPropuestaInversionCE.EstadoDocumento <> "C" Then
  981. 'SI NO ESTA CERRADA
  982. If oPropuestaInversionCE.EstadoAutorizacion <> "A" Then
  983. 'SI NO ESTA AUTORIZADA
  984. Else
  985. 'ESTA AUTORIZADA
  986. Dim Id = oDAOPropuestasDeInversion.IdRegistro(txtCodigoInversion.Text)
  987. ConvertirEnInversion(Id)
  988. End If
  989. Else
  990. 'SI NO ESTA CERRADA
  991. End If
  992. 'End If
  993. End Sub
  994. Private Sub cboPaises_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxPaises.SelectedIndexChanged
  995. ControlPais()
  996. End Sub
  997. Private Sub cboTipoMercado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxTipoMercado.SelectedIndexChanged
  998. ControlTipoMercado()
  999. End Sub
  1000. Private Sub ConvertirEnInversion(Id As Integer)
  1001. If Not oPropuestaInversionCE Is Nothing Then
  1002. Dim vConversion As Integer
  1003. Dim vIdPropuesta As Integer
  1004. If (oPropuestaInversionCE.IdDeDocumento = 0) Then
  1005. vIdPropuesta = Id
  1006. Else
  1007. vIdPropuesta = oPropuestaInversionCE.IdDeDocumento
  1008. End If
  1009. 'vConversion = oDAOPropuestasDeInversion.ConvertirEnInversion(vIdPropuesta)
  1010. If vConversion = 1 Then
  1011. MsgBox("Completo")
  1012. CargarPropuesta(vIdPropuesta)
  1013. Else
  1014. MsgBox("Error")
  1015. End If
  1016. End If
  1017. End Sub
  1018. Private Sub RefrescarControles()
  1019. If TipoTransaccion = "C" Then
  1020. RestaurarControlesDeBusqueda()
  1021. DeshabilitarControles()
  1022. End If
  1023. If TipoTransaccion = "B" Then
  1024. HabilitarControles()
  1025. End If
  1026. If TipoTransaccion = "A" Then
  1027. HabilitarControles()
  1028. cbxEstadoDocumento.Enabled = False
  1029. End If
  1030. End Sub
  1031. Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
  1032. Me.Close()
  1033. End Sub
  1034. Private Sub CargarPeriodicidades()
  1035. If (String.IsNullOrEmpty(cbxPeriodicidad.SelectedValue)) Then
  1036. Me.cbxPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
  1037. Me.cbxPeriodicidad.DisplayMember = "Descripcion"
  1038. Me.cbxPeriodicidad.ValueMember = "Codigo"
  1039. Me.cbxPeriodicidad.SelectedIndex = -1
  1040. End If
  1041. End Sub
  1042. Private Sub CargarTipoRenta()
  1043. Me.cbxRenta.DataSource = oDAOGeneral.ListaTipoRenta
  1044. Me.cbxRenta.DisplayMember = "Descripcion"
  1045. Me.cbxRenta.ValueMember = "Codigo"
  1046. Me.cbxRenta.SelectedIndex = -1
  1047. End Sub
  1048. Private Sub CargarTipoTasa()
  1049. Me.cbxTasa.DataSource = oDAOGeneral.ListaTipoTasa
  1050. Me.cbxTasa.DisplayMember = "Descripcion"
  1051. Me.cbxTasa.ValueMember = "Codigo"
  1052. Me.cbxTasa.SelectedIndex = -1
  1053. End Sub
  1054. Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxPeriodicidad.SelectedIndexChanged
  1055. End Sub
  1056. Private Sub cboTasa_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxTasa.SelectedIndexChanged
  1057. End Sub
  1058. Private Sub navEliminar_Click(sender As Object, e As EventArgs)
  1059. If (Borrar() = 0) Then
  1060. LimpiarControles()
  1061. End If
  1062. ' CargarNavegador()
  1063. Refrescar()
  1064. btnAccion.Text = "Buscar"
  1065. PrepararBusqueda()
  1066. End Sub
  1067. Public Sub Refrescar()
  1068. Me.Refresh()
  1069. End Sub
  1070. Public Function Borrar()
  1071. Dim mensaje = MsgBox("¿Deseas Eliminar este registro?", vbOKCancel, "Eliminar")
  1072. If (mensaje = vbOK) Then
  1073. Dim eliminar As New InversionDAO
  1074. Dim valor = eliminar.EliminarPropuesta(txtCodigoInversion.Text)
  1075. If (valor = 1) Then
  1076. MsgBox("Error al Eliminar")
  1077. Return valor
  1078. Else
  1079. MsgBox("Registro Eliminado")
  1080. Return valor
  1081. End If
  1082. End If
  1083. End Function
  1084. Private Sub Navegador_RefreshItems(sender As Object, e As EventArgs)
  1085. End Sub
  1086. Private Sub navNuevo_Click_1(sender As Object, e As EventArgs) Handles navNuevo.Click
  1087. 'gpbInversión.Visible = False
  1088. NuevaPropuesta()
  1089. PIN0BindingSource.SuspendBinding()
  1090. Refrescar()
  1091. TipoTransaccion = "N"
  1092. End Sub
  1093. Private Sub DeshabilitarBotonesBusqueda()
  1094. 'cboEmpresas.Enabled =
  1095. 'txtAsunto.ReadOnly =
  1096. 'cboInstrumentosFinancieros.Enabled =
  1097. txtMontoInversion.ReadOnly = True
  1098. txtPrecio.ReadOnly = True
  1099. txtRendimiento.ReadOnly = True
  1100. txtPlazoNumero.ReadOnly = True
  1101. cbxPlazosFactor.Enabled = False
  1102. txtIngresos.ReadOnly = True
  1103. cbxOrigenDeFondos.Enabled = False
  1104. ' cboEmisores.Enabled =
  1105. cbxCalificacionDeRiesgo.Enabled =
  1106. cbxCalificadoraDeRiesgo.Enabled = False
  1107. txtJustificacion.ReadOnly = True
  1108. txtComentarios.ReadOnly = True
  1109. cbxTipoOperacion.Enabled = False
  1110. ' cboEstadoDocumento.Enabled =
  1111. cbxAutorizacion.Enabled = False
  1112. dtpFechaDocumento.Enabled = False
  1113. cbxTipoMercado.Enabled = False
  1114. cbxPaises.Enabled = False
  1115. End Sub
  1116. Private Sub navBuscar_Click_1(sender As Object, e As EventArgs) Handles navBuscar.Click
  1117. 'HabilitarControles()
  1118. 'DeshabilitarBotonesBusqueda()
  1119. 'gpbInversión.Visible = False
  1120. PrepararBusqueda()
  1121. ''PIN0BindingSource.SuspendBinding()
  1122. TipoTransaccion = "B"
  1123. End Sub
  1124. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  1125. btnAccion.Text = "Actualizar"
  1126. HabilitarControles()
  1127. TipoTransaccion = "M"
  1128. Operaciones.TipoOperacion = "M"
  1129. UsuarioPrivilegio()
  1130. PrepararModificacion()
  1131. Refrescar()
  1132. BloquearEmpresaInstrumento()
  1133. TipoTransaccion = "A"
  1134. 'PIN0BindingSource.SuspendBinding()
  1135. End Sub
  1136. Private Sub BindingNavigatorPositionItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorPositionItem.Click
  1137. End Sub
  1138. Private Sub chkUsuario_CheckedChanged(sender As Object, e As EventArgs) Handles chkUsuario.CheckedChanged
  1139. If (Operaciones.TipoOperacion = "M") Then
  1140. UsuarioPrivilegio()
  1141. Else
  1142. End If
  1143. End Sub
  1144. Private Sub BindingNavigatorCountItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorCountItem.Click
  1145. End Sub
  1146. 'Friend WithEvents vBindingSource As BindingSource
  1147. Private Sub navEliminar_Click_1(sender As Object, e As EventArgs) Handles navEliminar.Click
  1148. If (BorrarPropuesta() = 0) Then
  1149. LimpiarControles()
  1150. End If
  1151. PIN0BindingSource.SuspendBinding()
  1152. Refrescar()
  1153. btnAccion.Text = "Buscar"
  1154. HabilitarControles()
  1155. DeshabilitarBotonesBusqueda()
  1156. PrepararBusqueda()
  1157. End Sub
  1158. Public Function BorrarPropuesta()
  1159. Dim mensaje = MsgBox("¿Deseas Eliminar este registro?", vbOKCancel, "Eliminar")
  1160. If (mensaje = vbOK) Then
  1161. Dim eliminar As New InversionDAO
  1162. Dim valor = eliminar.EliminarPropuesta(txtCodigoInversion.Text)
  1163. If (valor = 1) Then
  1164. MsgBox("Error al Eliminar")
  1165. Return valor
  1166. Else
  1167. MsgBox("Registro Eliminado")
  1168. Return valor
  1169. End If
  1170. Else
  1171. Return 1
  1172. End If
  1173. End Function
  1174. Private Sub Navegador_RefreshItems_1(sender As Object, e As EventArgs) Handles oBindingNavigator.RefreshItems
  1175. End Sub
  1176. Private Sub PIN0BindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles PIN0BindingSource.CurrentChanged
  1177. End Sub
  1178. Private Sub navRegistroAnterior_Click_1(sender As Object, e As EventArgs) Handles navRegistroAnterior.Click
  1179. 'btnAccion.Text = "Aceptar"
  1180. 'DeshabilitarControles()
  1181. End Sub
  1182. Private Sub navPrimerRegistro_Click_1(sender As Object, e As EventArgs) Handles navPrimerRegistro.Click
  1183. btnAccion.Text = "Aceptar"
  1184. DeshabilitarControles()
  1185. End Sub
  1186. Private Sub navUltimoRegistro_Click_1(sender As Object, e As EventArgs) Handles navUltimoRegistro.Click
  1187. btnAccion.Text = "Aceptar"
  1188. DeshabilitarControles()
  1189. End Sub
  1190. Private Sub PrepararControlesParaBusqueda()
  1191. cbxEmpresas.BackColor = Configuraciones.ColorFondoBusqueda
  1192. txtAsunto.BackColor = Configuraciones.ColorFondoBusqueda
  1193. cbxInstrumentosFinancieros.BackColor = Configuraciones.ColorFondoBusqueda
  1194. txtCodigoInversion.BackColor = Configuraciones.ColorFondoBusqueda
  1195. btnAccion.Text = "Buscar"
  1196. End Sub
  1197. Private Sub RestaurarControlesDeBusqueda()
  1198. cbxEmpresas.BackColor = Color.White
  1199. txtAsunto.BackColor = Color.White
  1200. cbxInstrumentosFinancieros.BackColor = Color.White
  1201. txtCodigoInversion.BackColor = Color.White
  1202. End Sub
  1203. Private Sub btnVistaPreliminar_Click(sender As Object, e As EventArgs) Handles navVistaPreliminar.Click
  1204. Impresion(True)
  1205. End Sub
  1206. Private Sub btnImprimir_Click(sender As Object, e As EventArgs) Handles navImprimir.Click
  1207. Impresion(False)
  1208. End Sub
  1209. Private Sub Impresion(ByVal pVistaPreliminar As Boolean)
  1210. If Not IdPIN = Nothing Then
  1211. Dim oImprimir As New frmImprimir
  1212. oImprimir.NombreRPT = "PrintPropuestaDeInversion.rpt"
  1213. oImprimir.IdDocumento = IdPIN
  1214. If pVistaPreliminar = True Then
  1215. oImprimir.ShowDialog()
  1216. Else
  1217. oImprimir.VistaPrevia = False
  1218. oImprimir.CargarRPT()
  1219. End If
  1220. End If
  1221. End Sub
  1222. Private Sub btnRequisicionDePago_Click(sender As Object, e As EventArgs) Handles btnRequisicionDePago.Click
  1223. 'Dim oRequisicionDePago As New frmReqPago
  1224. 'oRequisicionDePago.CodigoInversion = oPropuestaInversionCE.CodigoInversion
  1225. 'oRequisicionDePago.CodigoEmpresa = oPropuestaInversionCE.CodigoEmpresa
  1226. 'oRequisicionDePago.ShowDialog()
  1227. End Sub
  1228. End Class