Imports System.IO
Imports Extensiones
Imports System.Data
Imports System.Data.SqlClient
Imports System.ComponentModel.Design
Partial Class Bancos_Transferencias
Inherits ClsPaginas
#Region "Propiedades"
Private Property DtCuentas As DataTable
Get
Return CType(ViewState("DtCuentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtCuentas") = value
End Set
End Property
Private Property Opcion As Integer
Get
Return ViewState("Opcion").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("Opcion") = value
End Set
End Property
Private Property tCveMonedaOrigen As Integer
Get
Return ViewState("tCveMonedaOrigen").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("tCveMonedaOrigen") = value
End Set
End Property
Private Property tCveMonedaDestino As Integer
Get
Return ViewState("tCveMonedaDestino").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("tCveMonedaDestino") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
tCveMonedaOrigen = 0
tCveMonedaDestino = 0
If Request("OPC") IsNot Nothing AndAlso IsNumeric(Request("OPC")) Then
Opcion = Request("OPC").ToEntero
Else
Opcion = -1
End If
DtCuentas = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
TxtFechaDocumento.Text = NowADS().ToShortDateString
If Opcion = 1 Then
LtlTitulo.Text = "Domicialización de tarjeta"
RBLOpcion.Visible = True
TrCuentaDestino.Visible = False
chkMovimientoTarjeta.Checked = True
chkMovimientoTarjeta.Enabled = False
CargaCuenta(-1, DdlCuentaOrigen)
chkMovimientoTarjeta_CheckedChanged(Nothing, Nothing)
'CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero)
Else
CargaCuenta(-1, DdlCuentaOrigen)
CargaCuenta(DdlCuentaOrigen.SelectedValue.ToEntero, DdlCuentaDestino)
CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero)
End If
DdlTipoMovto_SelectedIndexChanged(Nothing, Nothing)
End If
End Sub
Private Sub CargaCuenta(CveCuenta As Integer, Ddl As DropDownList)
Ddl.Items.Clear()
If UsuarioActual.CveEmpresa = 119 Then
Ddl.DataSource = DtCuentas
Else
Ddl.DataSource = DtCuentas.FiltraParametros(String.Format("CveCuenta <> {0}", CveCuenta))
End If
Ddl.DataBind()
'DdlCuentaDestino_SelectedIndexChanged(Nothing, Nothing)
If CveCuenta > 0 Then VerificaMonedas()
End Sub
Private Sub VerificaMonedas()
'si es la destino verifico si la moneda es la misma, sino pregunto por la paridad cambiaria
Dim drOrigen As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuentaOrigen.SelectedValue.ToEntero))
Dim drDestino As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuentaDestino.SelectedValue.ToEntero))
'Dim tCveMonedaOrigen, tCveMonedaDestino As Integer
If drOrigen IsNot Nothing AndAlso drDestino IsNot Nothing Then
tCveMonedaOrigen = drOrigen("CveMoneda").ToString.ToEntero
tCveMonedaDestino = drDestino("CveMoneda").ToString.ToEntero
End If
If drOrigen IsNot Nothing AndAlso drDestino IsNot Nothing AndAlso drOrigen("CveMoneda").ToString <> drDestino("CveMoneda").ToString Then
If tCveMonedaOrigen = 1 AndAlso tCveMonedaDestino <> 1 Then
'pesos a otra moneda se divide
TxtTipoCambio.Attributes.Add("onkeyup", "$get('HdnTC').value='2'; Calcula();")
RegistraScript("$get('TrTC').style.display=''; $get('HdnTC').value='2'; Calcula();")
ElseIf tCveMonedaOrigen <> 1 AndAlso tCveMonedaDestino = 1 Then
'de otra moneda a pesos se multiplica
TxtTipoCambio.Attributes.Add("onkeyup", "$get('HdnTC').value='1'; Calcula();")
RegistraScript("$get('TrTC').style.display=''; $get('HdnTC').value='1'; Calcula();")
End If
PnlTipoCambio.Visible = True
'RegistraScript("$get('TrTC').style.display='';")
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
Else
PnlTipoCambio.Visible = False
RegistraScript("$get('TrTC').style.display='none';")
TxtFechaDocumento.Attributes.Remove("onchange")
End If
If drOrigen IsNot Nothing AndAlso drDestino IsNot Nothing AndAlso tCveMonedaOrigen = 2 OrElse tCveMonedaDestino = 2 Then
PnlTipoCambio.Visible = True
RegistraScript("$get('TrTC').style.display='';")
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
End If
End Sub
Protected Sub DdlCuentaOrigen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaOrigen.SelectedIndexChanged
CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero)
CargaCuenta(DdlCuentaOrigen.SelectedValue.ToEntero, DdlCuentaDestino)
If DdlCuentaOrigen.SelectedValue.ToEntero() > 0 Then
If DtCuentas.FiltroPrimeroValor("CveTipoCuenta", String.Format("CveCuenta = {0}", DdlCuentaOrigen.SelectedValue)) = "1" Then
CargaMovimientosCajaChica()
TrCajaChica.Visible = True
Else
DdlCajaChica.DataSource = Nothing
DdlCajaChica.DataBind()
TrCajaChica.Visible = False
End If
End If
End Sub
Protected Sub DdlCuentaDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaDestino.SelectedIndexChanged
VerificaMonedas()
'If Opcion = 1 Then
' CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero)
'End If
'If chkMovimientoTarjeta.Checked AndAlso GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCuenta = {0} AND UsaTarjeta = 1", DdlCuentaDestino.SelectedValue.ToEntero)).Rows.Count > 0 Then
' CargaGridTarjetas()
'Else
' GvTC.Visible = False
'End If
End Sub
Private Sub CargaGridTarjetas()
Dim ObjCreditos As New ClsBancos
If ObjCreditos.GetTarjetasCreditos(DdlCuentaOrigen.SelectedValue.ToEntero) Then
If ObjCreditos.DtResultados.Rows.Count > 0 Then
GvTC.DataSource = ObjCreditos.DtResultados
GvTC.Visible = True
End If
UpGvTC.Update()
End If
ObjCreditos.Dispose()
GvTC.DataBind()
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
'VALIDACIONES
Dim SumaImportesTarjeta As Decimal = 0D
If GvTC.Visible AndAlso GvTC.Rows.Count > 0 Then
For Each row As GridViewRow In GvTC.Rows
SumaImportesTarjeta += row.FCTextBox("TxtAbono").Text.ToDecimal
Next
If TxtImporte.Text.ToDouble <> SumaImportesTarjeta Then
Alert("Las Cantidades a Abonar no Coinciden con el Importe a Transferir", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If DdlCuentaOrigen.SelectedValue = "" Then
Alert("Seleccione cuenta origen", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtImporte.Text.ToDouble <= 0 Then
Alert("Debe ingresar un importe", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtTipoCambio.Visible AndAlso TxtTipoCambio.Text.ToDouble <= 0 Then
Alert("Debe ingresar el tipo de cambio", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim MsgError As String = ""
Dim ImporteDestino As Decimal = TxtImporte.Text.Trim.ToDecimal
Dim ImporteMXOrigen As Decimal = TxtImporte.Text.Trim.ToDecimal
Dim ImporteMXDestino As Decimal = TxtImporte.Text.Trim.ToDecimal
Dim ObjIE As New ClsBancos()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
Dim TipoCambio As Double = If(TxtTipoCambio.Visible, TxtTipoCambio.Text.ToDecimal, 1)
Dim CveMonedaOrigen, CveMonedaDestino As Integer
Dim FolioOrigen As String = TxtFolio.Text.Trim
Dim FolioDestino As String = GetFolio(DdlCuentaDestino.SelectedValue.ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3))
Dim CveIE As Integer
Dim CveIEDestino As Integer
Dim CuentaDestino As String = ""
Dim Observaciones As String = ""
Dim dr As DataRow
Dim AlertaGlobal As New StringBuilder
'COMPROBANTE
Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
Dim filemove As String = ""
Dim Comprobante As String = ""
For Each fileItem As Archivo In filesgral
Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
filemove = fileItem.filename
Next
dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaOrigen.SelectedValue))
If dr IsNot Nothing Then CveMonedaOrigen = dr("CveMoneda").ToString.ToEntero
If Opcion = -1 Then
dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaDestino.SelectedValue))
If dr IsNot Nothing Then CveMonedaDestino = dr("CveMoneda").ToString.ToEntero
Else
CveMonedaDestino = CveMonedaOrigen
End If
If CveMonedaOrigen = 1 AndAlso CveMonedaDestino <> 1 Then
'pesos a otra moneda se divide
ImporteDestino = Math.Round(TxtImporte.Text.Trim.ToDecimal / TxtTipoCambio.Text.ToDecimal, 2)
ImporteMXDestino = TxtImporte.Text.Trim.ToDecimal
ElseIf CveMonedaOrigen <> 1 AndAlso CveMonedaDestino = 1 Then
'de otra moneda a pesos se multiplica
ImporteDestino = Math.Round(TxtImporte.Text.Trim.ToDecimal * TxtTipoCambio.Text.ToDecimal, 2)
ImporteMXDestino = Math.Round(TxtImporte.Text.Trim.ToDecimal * TxtTipoCambio.Text.ToDecimal, 2)
ImporteMXOrigen = Math.Round(TxtImporte.Text.Trim.ToDecimal * TxtTipoCambio.Text.ToDecimal, 2)
ElseIf CveMonedaOrigen <> 1 AndAlso CveMonedaDestino <> 1 Then
ImporteMXDestino = Math.Round(TxtImporte.Text.Trim.ToDecimal * TxtTipoCambio.Text.ToDecimal, 2)
ImporteMXOrigen = Math.Round(TxtImporte.Text.Trim.ToDecimal * TxtTipoCambio.Text.ToDecimal, 2)
End If
If CveMonedaOrigen = 2 AndAlso CveMonedaDestino = 2 Then
TipoCambio = TxtTipoCambio.Text.ToDouble 'GlobalTipoCambio(TxtFechaDocumento.Text.ToDate)
End If
Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Bancos/Transferencias", 13, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, CveMonedaOrigen, TxtFechaDocumento.Text.ToDate, $"Transferencia entre cuentas {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If UsuarioActual.CveEmpresa = 48 Then
CuentaDestino = "Alumbrado publico de Hermosillo S.A de C.V"
Observaciones = String.Format("{0} {1}", DdlCuentaDestino.SelectedItem.Text, TxtObservaciones.Text.Trim)
Else
CuentaDestino = String.Format("Transferencia Cta: {0}", If(DdlCuentaDestino.SelectedItem IsNot Nothing, DdlCuentaDestino.SelectedItem.Text, ""))
Observaciones = TxtObservaciones.Text.Trim
End If
If Opcion = 1 Then 'ESTO ES TRANSFERENCIA ENTRE
CveIE = ObjIE.AddBancos_IE(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, ImporteMXOrigen, CveMonedaOrigen, TipoCambio, Observaciones, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CveIEDestino = CveIE
Else
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
FolioDestino = TxtFolio.Text.Trim
If TxtPaguese.Text.Trim <> "" Then
CuentaDestino = TxtPaguese.Text.Trim
End If
Else
If DdlTipoMovto.SelectedValue.ToEntero = 1 Then
CuentaDestino = TxtPaguese.Text.Trim
End If
End If
CveIE = ObjIE.AddBancos_IE(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, TxtImporte.Text.Trim.ToDouble, CveMonedaOrigen, TipoCambio, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not chkMovimientoTarjeta.Checked Then
CveIEDestino = ObjIE.AddBancos_IE(DdlCuentaDestino.SelectedValue.ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TxtFechaDocumento.Text.Trim.ToDate, FolioDestino, String.Format("Transferencia Cta: {0}", DdlCuentaOrigen.SelectedItem.Text), ImporteDestino, CveMonedaDestino, TipoCambio, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
End If
End If
Dim CveIEDevolucion As Integer = -1
If DdlCajaChica.SelectedValue.ToEntero() > 0 AndAlso TrCajaChica.Visible Then
CveIEDevolucion = DdlCajaChica.SelectedValue.ToEntero()
End If
If (CveIE > 0 AndAlso CveIEDestino > 0 Or CveIE > 0 AndAlso chkMovimientoTarjeta.Checked AndAlso SumaImportesTarjeta <> 0) Then
'inserto los movimientos de la conta para abonar al saldo
If MsgError = "" Then
If CvePrePoliza > 0 Then
Dim TipoMovtoDetalle As Boolean = True
If RBLOpcion.SelectedValue = "2" Then TipoMovtoDetalle = False ' cuando sea un reembolso/devolución, es ingreso a bancos
Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoDetalle,
TxtImporte.Text.ToDecimal, If(Not UsuarioActual.CveEmpresa.Contiene(13, 83), TxtImporte.Text.ToDecimal, ImporteMXOrigen), 30,
$"Transferencia entre cuentas {TxtObservaciones.Text}", $"Transferencia entre cuentas {TxtObservaciones.Text}", CveIE:=CveIE,
ImporteME:=If(CveMonedaOrigen > 1, TxtImporte.Text.ToDecimal * TC, 0),
CveIEDevolucion:=CveIEDevolucion) Then
If CveMonedaOrigen > 1 AndAlso Not UsuarioActual.CveEmpresa.Contiene(13, 83) Then
'Agregamos complementaria
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoDetalle,
0, (TxtImporte.Text.ToDecimal * TC - TxtImporte.Text.ToDecimal).RoundSQL, 204,
$"Transferencia entre cuentas {TxtObservaciones.Text}", $"Transferencia entre cuentas {TxtObservaciones.Text}", CveIE:=CveIE,
ImporteME:=TxtImporte.Text.ToDecimal,
TipoCambio:=TC) Then
MsgError = "Ocurrió un error al registrar el asiento del ingreso."
End If
End If
'Agregamos los Movimientos de Acreedor cuando es tarjeta
If GvTC.Visible Then
AlertaGlobal.Append("
Recepción:
")
For Each row As GridViewRow In GvTC.Rows
If row.FCTextBox("TxtAbono").Text.ToDecimal > 0 Then
FolioDestino = GetFolio(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TransaccionSQL:=ObjIE.IniciaTransacSQL())
If FolioDestino.Trim.Length = 0 Then
MsgError = "Ocurrio un error al obtener el folio destino."
Exit For
End If
Dim PagueseA As String = $"Transferencia Cta: {If(DdlCuentaOrigen.SelectedItem Is Nothing, DdlCuentaDestino.SelectedItem.Text, DdlCuentaOrigen.SelectedItem.Text)}"
CveIEDestino = ObjIE.AddBancos_IE(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TxtFechaDocumento.Text.Trim.ToDate, FolioDestino, PagueseA, row.FCTextBox("TxtAbono").Text.ToDecimal, CveMonedaDestino, TipoCambio, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoDetalle, row.FCTextBox("TxtAbono").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal, 30,
$"Transferencia entre cuentas {TxtObservaciones.Text}", $"Transferencia entre cuentas {TxtObservaciones.Text}",
CveIE:=CveIEDestino) Then
MsgError = "Ocurrio un error al ingresar la prepoliza"
Exit For
Else
AlertaGlobal.AppendFormat("{1}
", CveIEDestino, FolioDestino)
End If
End If
Next
'Agregamos la contraria a bancos cuando es cuenta
Else
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoDetalle,
ImporteDestino, If(Not UsuarioActual.CveEmpresa.Contiene(13, 83), ImporteDestino, ImporteMXDestino),
30, $"Transferencia entre cuentas {TxtObservaciones.Text}", $"Transferencia entre cuentas {TxtObservaciones.Text}", CveIE:=CveIEDestino,
ImporteME:=If(CveMonedaDestino > 1, ImporteDestino, 0)) Then
MsgError = "Ocurrio un error al ingresar la prepoliza"
End If
If CveMonedaDestino > 1 AndAlso Not UsuarioActual.CveEmpresa.Contiene(13, 83) Then
'Agregamos complementaria
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovtoDetalle,
0, (ImporteMXDestino - ImporteDestino).RoundSQL, 204,
$"Transferencia entre cuentas {TxtObservaciones.Text}", $"Transferencia entre cuentas {TxtObservaciones.Text}", CveIE:=CveIEDestino,
ImporteME:=ImporteDestino, TipoCambio:=TC) Then
MsgError = "Ocurrió un error al registrar el asiento del ingreso."
End If
End If
End If
If MsgError = "" Then
If ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
MsgError = ObjMov.MensajePolizaDescuadre
GuardaLogAD($"Bancos/Transferencias | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If
Else
MsgError = "No se pudo validar la prepoliza de cuadre."
End If
End If
If MsgError = "" Then
If CveIE > 0 Then
AlertaGlobal.AppendFormat("
Movimiento: {1}", CveIE, FolioOrigen)
End If
If CveIEDestino > 0 AndAlso CveIE <> CveIEDestino Then
If Not chkMovimientoTarjeta.Checked Then
AlertaGlobal.AppendFormat("
Recepción: {1}", CveIEDestino, FolioDestino)
End If
End If
End If
Else
MsgError = "no se pudo insertar el detalle de la póliza"
End If
Else
MsgError = "No se pudo insertar la póliza"
End If
Else
MsgError = "No se insertó el encabezado"
End If
Else
MsgError = "Error al guardar"
End If
If MsgError = "" Then
ObjIE.Commit()
If filemove <> "" Then
filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
End If
Alert(String.Format("El Movimiento se realizo correctamente.
{0}", AlertaGlobal), TipoMensaje.MsgInformacion)
Anexo.Text = ""
'Enviar Correo a los usuarios que tienen acceso a las dos cuentas
If UsuarioActual.CveEmpresa = 13 Then EnviaCorreo(Comprobante)
'LIMPIA
CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero)
TxtImporte.Text = ""
TxtObservaciones.Text = ""
'GeneraChequePDF(CveIEDestino, UsuarioActual.Empresa)
Else
ObjIE.RollBack()
Alert(MsgError)
End If
ObjIE.Dispose()
ObjMov.Dispose()
End Sub
Private Sub EnviaCorreo(Comprobante As String)
Dim dtcorreo As DataTable = GlobalDTBancosCuentas(-1, DdlCuentaOrigen.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa)
dtcorreo.Merge(GlobalDTBancosCuentas(-1, DdlCuentaDestino.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa))
' Dim CorreosCCP As New List(Of String)
Dim StrCorreos As New StringBuilder
For Each Row As DataRow In dtcorreo.Rows
' CorreosCCP.Add(GlobalDTUsuarios(Row("CveUsuario").ToString.ToEntero)(0)("correo").ToString)
StrCorreos.AppendFormat("{0};", GlobalDTUsuarios(Row("CveUsuario").ToString.ToEntero, UsuarioActual.CveEmpresa)(0)("correo").ToString)
Next
Dim strBody As New StringBuilder
strBody.Append(" ")
strBody.Append("