180 lines
7.6 KiB
VB.net
180 lines
7.6 KiB
VB.net
Public Class FRAlarmasKYC
|
||
|
||
Private Sub FRAlarmasKYC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||
'llena combos
|
||
|
||
Dim SQLProm As String
|
||
Dim clCmj1 As clsComplejo
|
||
|
||
Try
|
||
|
||
Me.CMBTipoReporte.Items.Clear()
|
||
Me.CMBTipoReporte.Items.Add("REBASO EL MONTO DECLARADO")
|
||
CMBTipoReporte.Items.Add("REBASO EL NUMERO DE OPERACIONES DECLARADO")
|
||
|
||
'Me.CMBTipoReporte.Items.Add("REBASO EL NUMERO DE TRANSACCIONES ESTABLECIDO")
|
||
'Me.CMBTipoReporte.Items.Add("OPERO EN UN PRODUCTO NO ESTABLECIDO")
|
||
|
||
Me.CMBTipoReporte.SelectedIndex = -1
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
|
||
End Sub
|
||
|
||
|
||
Public Function GetLastDayOfMonth(ByVal intMonth, ByVal intYear) As Date
|
||
|
||
GetLastDayOfMonth = DateSerial(intYear, intMonth + 1, 0)
|
||
|
||
End Function
|
||
|
||
|
||
|
||
Private Sub BTEjecutar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTEjecutar.Click
|
||
|
||
Dim sFecha As String
|
||
Dim dFecha As Date
|
||
Dim Classcom As New clsComplejo
|
||
Dim SQL As String
|
||
Dim bCondicion As Boolean
|
||
|
||
Dim nParidad As Double
|
||
Dim iFechaProcesoDay As Integer
|
||
|
||
|
||
Try
|
||
|
||
bCondicion = False
|
||
|
||
|
||
dFecha = DTPPerfilT.Value
|
||
sFecha = Classcom.ObtenFecha(dFecha, "dd/mm/yyyy")
|
||
'sFecha = Classcom.ObtenFecha(dFecha, "dd/mm/yyyy")
|
||
SQL = "select day(max(FechaCambio)) as noDIA from Cat_TipoDeCambio where year(FechaCambio) = YEAR(convert(datetime,'" & sFecha & "',103))" & " and month(FechaCambio) = month(convert(datetime,'" & sFecha & "',103)) and IdMoneda = 2 "
|
||
|
||
|
||
|
||
Dim clcmj1 As New clsComplejo
|
||
Dim clcmj2 As New clsComplejo
|
||
Dim Fila As DataRow
|
||
|
||
clcmj1.fdtDataSet(SQL)
|
||
If IsDBNull(clcmj1.ds.Tables(0).Rows(0)("noDIA")) = True Then
|
||
MessageBox.Show("No existe ningun tipo de cambio, para el MES " & Mid(sFecha, 4, 2) & " DE " & Mid(sFecha, 7, 4) & ". Por favor definir los tipos de cambio del dolar en el mes que esta solicitando. ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Exit Sub
|
||
End If
|
||
|
||
If clcmj1.ds.Tables(0).Rows.Count <> 0 Then
|
||
Fila = clcmj1.ds.Tables(0).Rows(0)
|
||
|
||
iFechaProcesoDay = Fila("noDIA")
|
||
|
||
SQL = "select DivisaBX from Cat_TipoDeCambio where year(FechaCambio) = YEAR(convert(datetime,'" & sFecha & "',103))" & " and month(FechaCambio) = month(convert(datetime,'" & sFecha & "',103))" & " and day(FechaCambio) = " & iFechaProcesoDay
|
||
clcmj2.fdtDataSet(SQL)
|
||
|
||
If clcmj2.ds.Tables(0).Rows.Count <> 0 Then
|
||
Fila = clcmj2.ds.Tables(0).Rows(0)
|
||
nParidad = Fila("DivisaBX")
|
||
Else
|
||
nParidad = 0
|
||
End If
|
||
End If
|
||
|
||
|
||
'SQL = "select a.alarma as [Alarma], " _
|
||
' & " t.Nombre + ' ' + isnull(t.ApellidoPaterno, '') + ' ' + isnull(t.ApellidoMaterno, '') as [Nombre o Raz<61>n Social], " _
|
||
' & " a.No_Cuenta as [Numero de Cuenta], " _
|
||
' & " k.FechaRegistro as [Inicio de Relaci<63>n], " _
|
||
' & " a.fechaproceso as [Fecha de Proceso], " _
|
||
' & " case " _
|
||
' & " when c.IdMoneda = 1 then a.LimiteOptInf " _
|
||
' & " when c.IdMoneda = 2 then a.LimiteOptInf * " & nParidad _
|
||
' & " else 0 " _
|
||
' & " End " _
|
||
' & " [Monto Declarado], " _
|
||
' & " a.montoMBmensual as [Monto Operado] " _
|
||
' & " FROM alarmasKYC a " _
|
||
' & " inner join cuenta c on c.numCuenta = a.No_Cuenta " _
|
||
' & " inner join cliente t on t.IdCliente = c.IdCliente " _
|
||
' & " inner join kyc_datosgenerales k on k.IdCliente = c.IdCliente "
|
||
|
||
|
||
'If Me.CMBTipoReporte.SelectedIndex > -1 Then
|
||
' If Not bCondicion Then SQL = SQL & " where a.alarma = '" & CMBTipoReporte.Text.Trim & "'" Else SQL = SQL & " and a.alarma = '" & CMBTipoReporte.Text.Trim & "'"
|
||
' bCondicion = True
|
||
'End If
|
||
'If Not bCondicion Then SQL = SQL & " where year(a.fechaproceso) = " & Year(dFecha) & " and month(a.fechaproceso) = " & Month(dFecha) Else SQL = SQL & " and year(a.fechaproceso) = " & Year(dFecha) & " and month(a.fechaproceso) = " & Month(dFecha)
|
||
|
||
SQL = "sp_ConsultarAlarmasPerfilT " & IIf(CMBTipoReporte.Text <> "", "'" & CMBTipoReporte.Text & "'", "NULL") & "," & DTPPerfilT.Value.ToString("yyyy") & "," & DTPPerfilT.Value.ToString("MM")
|
||
|
||
Classcom.fdtDataSetTabla(SQL)
|
||
|
||
clsVaribles.strSQL = SQL
|
||
Me.GRDMasterRep.SetDataBinding(Classcom.ds, "Tabla")
|
||
Me.GRDMasterRep.Columns(5).NumberFormat = "###,###,##0.00"
|
||
Me.GRDMasterRep.Columns(6).NumberFormat = "###,###,##0.00"
|
||
|
||
GRDMasterRep.Visible = True
|
||
|
||
''Auditoria
|
||
Dim ClassAud As New ClassMyUtils
|
||
Dim sTextoAud As String
|
||
sTextoAud = "Perfil transaccional, mes y A<>o: " & DTPPerfilT.Value.ToString("MMMM/yyyy")
|
||
If CMBTipoReporte.Text <> "" Then
|
||
sTextoAud = sTextoAud & ", Alarma:" & CMBTipoReporte.Text
|
||
End If
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 118, 1, sTextoAud)
|
||
''Fin de auditoria
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
|
||
End Sub
|
||
|
||
Private Sub BTExportar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTExportar.Click
|
||
Dim Clcmp As New clsComplejo
|
||
|
||
Try
|
||
If GRDMasterRep.DataSource Is Nothing Then
|
||
MessageBox.Show("No hay datos para exportar ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
|
||
Clcmp.fdtDataSetTabla(clsVaribles.strSQL)
|
||
|
||
If Clcmp.ds.Tables.Count = 0 Then
|
||
MessageBox.Show("Realiza una consulta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Else
|
||
If Clcmp.ds.Tables(0).Rows.Count = 0 Then
|
||
MessageBox.Show("No hay datos para exportar ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Else
|
||
Dim Resul As DialogResult
|
||
Resul = MessageBox.Show("Este proceso puede tardar varios minutos, <20>Deseas continuar? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If Resul = DialogResult.Yes Then
|
||
'Creamos una copia del dataset
|
||
Dim copyDS As DataSet = Clcmp.ds.Copy()
|
||
'Quitamos las siguientes columnas para no exportarlas
|
||
|
||
'copyDS.Tables(0).Columns.Remove("Id_Transaccion")
|
||
'copyDS.Tables(0).Columns.Remove("Id_Producto")
|
||
|
||
'Creo una instancia de la clase aExcel
|
||
Dim clsExcel As aExcel = New aExcel
|
||
'Obtenemos el nombre o el titulo del form
|
||
clsExcel.Titulo = Me.Text
|
||
'Utilizo la funcion ExportDataset de la clase aExcel
|
||
clsExcel.ExportDataset(copyDS) 'Asigno el dataset a exportar
|
||
End If
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
|
||
End Sub
|
||
End Class |