")
+
End If
If NombreArchivoBancomer.Length > 0 Or NombreArchivoInterbancario.Length > 0 Then
- Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
+
+ DVDescargaPagos.Visible = False
+ LnkDescargaCuentas1.Text = NombreArchivoBancomer
+ LnkDescargaCuentas2.Text = NombreArchivoInterbancario
+ RegistraScript("$('#ModalDescarga').modal({ backdrop: 'static', keyboard: false});")
+
+ UpModalDescarga.Update()
+
+ 'Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
+
+
End If
CargaDatos()
@@ -2170,214 +1737,7 @@ Partial Class Bancos_PagoElectronicoGrupos
UpProveedores.Update()
End Sub
- 'Private Sub GeneraAltaFyE()
- ' Dim DtTemp As DataTable = Nothing
- ' 'REINICIA PROPIEDAS
- ' HeaderTexto = ""
- ' DetalleTexto = ""
- ' TrailerTexto = ""
- ' TotalAcumulado = 0
- ' CreaDtAlta()
-
- ' DtTemp = DTFyE
-
- ' ''VALIDA CUENTAS DEPOSITOS
- ' Dim ErrorCuenta = False
- ' Dim FyEError As StringBuilder = New StringBuilder
- ' FyEError.AppendFormat("
| Personal | Cuenta | Error |
")
-
- ' Dim TotalDetalles As Integer = 0
- ' Dim EsBancomer = False
- ' For Each gvr As DataRow In DtTemp.Rows
- ' If gvr("CvePersonal").ToString <> "" AndAlso gvr("EstatusPagoElectronico").ToString <> "True" AndAlso gvr("AltaCuenta").ToString = "1" Then
- ' DTPendienteActual = DtTemp.FiltraParametros(String.Format("CveCuentaDeposito = {0}", gvr("CveCuentaDeposito").ToString))
- ' ErrorCuenta = False
- ' EsBancomer = False
-
- ' If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Or (DTPendienteActual(0)("CLABE").ToString.Length = 18 AndAlso DTPendienteActual(0)("CLABE").ToString.Substring(0, 3) = "012") Then
- ' EsBancomer = True
- ' End If
-
- ' 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
- ' If Not ErrorCuenta Then
- ' If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 And DTPendienteActual(0)("CLABE").ToString.Trim.Length = 0 And Not EsBancomer Then
- ' FyEError.AppendFormat("| {0} | {1} | CLABE ES OBLIGATORIA |
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
- ' ErrorCuenta = True
- ' End If
- ' End If
-
- ' 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
- ' If Not ErrorCuenta Then
- ' If DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("Cuenta").ToString.Trim.Length <> 10 AndAlso EsBancomer Then
- ' FyEError.AppendFormat("| {0} | {1} | NUMERO DE CUENTA CON FORMATO INCORRECTO |
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
- ' ErrorCuenta = True
- ' End If
- ' End If
-
- ' 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
- ' If Not ErrorCuenta Then
- ' If DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 0 AndAlso DTPendienteActual(0)("CLABE").ToString.Trim.Length <> 18 Then
- ' FyEError.AppendFormat("| {0} | {1} | CLABE CON FORMATO INCORRECTO |
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
- ' ErrorCuenta = True
- ' End If
- ' End If
-
- ' 'SI CIE TIENE ALGO DEBE TENER REFERENCIA OBLIGATORIA
- ' If Not ErrorCuenta Then
- ' If DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0 And DTPendienteActual(0)("Referencia").ToString.Trim.Length < 3 Then
- ' FyEError.AppendFormat("| {0} | {1} | CIE CON FORMATO INCORRECTO |
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
- ' ErrorCuenta = True
- ' End If
- ' End If
-
- ' 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
- ' If Not ErrorCuenta Then
- ' If EsBancomer AndAlso Not (DTPendienteActual(0)("Cuenta").ToString.Trim.Length = 10 Or DTPendienteActual(0)("CIE").ToString.Trim.Length <> 0) Then
- ' FyEError.AppendFormat("| {0} | {1} | CUENTA BANCOMER SIN CUENTA O CIE |
", DTPendienteActual(0)("RazonSocial").ToString, DTPendienteActual(0)("BancoNombre").ToString)
- ' ErrorCuenta = True
- ' End If
- ' End If
-
- ' If Not ErrorCuenta Then
- ' If TotalDetalles > 0 Then
- ' DetalleTexto &= vbCrLf
- ' End If
- ' GeneraAltaDetalleFyE()
- ' TotalDetalles += 1
- ' End If
-
- ' End If
- ' Next
- ' FyEError.AppendFormat("
")
-
-
- ' If TotalDetalles > 0 Then
- ' FormarTextoAltaFyE(TotalDetalles)
- ' CreaArchivo(2)
-
- ' Dim Descargas As New StringBuilder()
- ' Descargas.AppendFormat("
TXT", NombreArchivo)
- ' 'Descargas.AppendFormat("
Reporte", NombreArchivo)
- ' Descargas.AppendFormat("
Descargar Reporte", NombreArchivo)
-
-
- ' Dim TextoErrorProveedores = ""
- ' If FyEError.Length > 160 Then TextoErrorProveedores = String.Format("
Proveedores con Error:
------------------------------------------------------------------
{0}
", FyEError.ToString)
-
- ' Alert(String.Format("
El Layout fue creado satisfactoriamente.{1}
Descargas:
", Descargas, TextoErrorProveedores), TipoMensaje.MsgInformacion)
-
- ' 'NombreArchivo = "LayoutAltaProveedores"
- ' 'DescargarArchivo()
- ' Else
- ' Alert("No hay proveedores que dar de alta", TipoMensaje.MsgInformacion)
- ' End If
-
-
- 'End Sub
-
- 'Private Sub GeneraAltaDetalleFyE()
- ' Dim Resultado = True
- ' Dim CuentaDeposito As String = ""
- ' Dim TipoCuentaDeposito As String = ""
- ' Dim TipoCuenta As String = ""
-
- ' ''''' LLENADO DE DETALLE
- ' 'Campos #1-4 del Detalle
- ' DetalleTexto &= String.Format("DA{0}N ", DTPendienteActual(0)("CveCuentaDeposito").ToString.ToUpper.PadLeft(30, PadCeros))
-
- ' 'Banco BBVA
- ' If DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BBVA") Or DTPendienteActual(0)("BancoNombre").ToString.ToUpper.Contains("BANCOMER") Then
- ' 'Llenamos datos de BBVA
- ' 'Campo #5-7 del detalle
-
- ' 'Busca que cuenta sera la asignada para el proveedor
- ' If DTPendienteActual(0)("CIE").ToString <> "" Then
- ' CuentaDeposito = String.Format("02{0}", DTPendienteActual(0)("CIE").ToString.PadLeft(8, PadCeros))
- ' TipoCuenta = "50"
- ' TipoCuentaDeposito = "CIE"
- ' ElseIf DTPendienteActual(0)("Cuenta").ToString.Length = 10 Then
- ' CuentaDeposito = DTPendienteActual(0)("Cuenta").ToString
- ' TipoCuenta = "99"
- ' TipoCuentaDeposito = "Cuenta"
- ' ElseIf DTPendienteActual(0)("CLABE").ToString.Length = 18 Then
- ' CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
- ' TipoCuenta = "40"
- ' TipoCuentaDeposito = "CLABE"
- ' End If
-
-
- ' DetalleTexto &= String.Format("{0}{1}{2}", DTPendienteActual(0)("Abreviatura").ToString, TipoCuenta, CuentaDeposito.PadLeft(35, PadCeros))
-
- ' 'Llenamos en blanco datos de otros bancos
- ' 'Campos 8-17 del detalle --- 64 de otros bancos y 45 para FILLER --- Fecha de Alta
- ' DetalleTexto &= String.Format("{0}{1}", Vacio.PadLeft(109), DateTime.Now().ToString("yyyy-MM-dd"))
-
-
- ' 'Otros Bancos NACIONAL!!
- ' Else
-
- ' CuentaDeposito = DTPendienteActual(0)("CLABE").ToString
- ' TipoCuentaDeposito = "CLABE"
-
- ' 'Llenamos en blanco datos de BBVA
- ' DetalleTexto &= Vacio.PadRight(40)
-
- ' 'Llenamos datos de otros bancos
- ' 'Campos 8- 17 del detalle --- 44 de otros bancos --- 20 de internacional --- 45 Filler -- Fecha de Alta
- ' DetalleTexto &= String.Format("{0}40{1}{2}{3}{4}{5}", DTPendienteActual(0)("Abreviatura").ToString, DTPendienteActual(0)("CLABE").ToString.PadLeft(35, PadCeros), DTPendienteActual(0)("CLABE").ToString.Substring(0, 3).PadLeft(4, PadCeros), Vacio.PadRight(20), Vacio.PadRight(45), DateTime.Now().ToString("yyyy-MM-dd"))
- ' End If
-
- ' 'Llenamos datos de Tipo de Persona - Fisica
- ' ' nombres Primer apellido Segundo apellido
- ' DetalleTexto &= String.Format("F{0}{1}{2}{3}", Vacio.PadRight(70), DTPendienteActual(0)("Nombres").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("APaterno").ToString.PadRight(20).Substring(0, 20), DTPendienteActual(0)("AMaterno").ToString.PadRight(20).Substring(0, 20))
-
- ' 'Campo 25-26 del detalle -- Fecha Nacimiento -- RFC
- ' DetalleTexto &= String.Format("{0}{1}", DTPendienteActual(0)("FechaNacimiento").ToString.ToDate.ToString("yyyy-MM-dd"), DTPendienteActual(0)("RFC").ToString.ToUpper.PadRight(14))
-
- ' 'Campos 27-32 --- Fillers --- datos de otros bancos (internacional)
- ' DetalleTexto &= Vacio.PadLeft(153)
-
- ' 'Campos 33-36 --- Datos de confirmacion
- ' DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), CorreoNotificacionesEmpresa.ToUpper.PadRight(50))
-
- ' 'If DTPendienteActual(0)("ContactoMail").ToString.Length > 0 Then
- ' ' 'DetalleTexto &= String.Format("{0}02{1}", Vacio.PadRight(40), DTPendienteActual(0)("ContactoMail").ToString.ToUpper.PadRight(50))
- ' 'ElseIf DTPendienteActual(0)("ContactoMail").ToString.Length <= 0 Then
- ' ' DetalleTexto &= String.Format("{0}00{1}", Vacio.PadRight(40), Vacio.PadRight(50))
- ' 'End If
-
- ' 'Campos 37-39 -- FILLER
- ' DetalleTexto &= String.Format("00{0}", Vacio.PadRight(38))
-
-
- ' ''LLENA DT PARA REPORTE
- ' Dim Row = DtAlta.NewRow()
- ' Row("Proveedor") = DTPendienteActual(0)("RazonSocial").ToString
- ' Row("Banco") = DTPendienteActual(0)("BancoNombre").ToString
- ' Row("TipoCuenta") = TipoCuentaDeposito
- ' Row("Cuenta") = String.Format("{0}", CuentaDeposito)
- ' DtAlta.Rows.Add(Row)
- 'End Sub
-
- 'Protected Sub FormarTextoAltaFyE(Registros As Integer)
- ' '''''' LLENADO HEADER
- ' Dim convenio As String = DTPendienteActual(0)("ConvenioPagoElectronico").ToString
- ' 'Campos #1-4 del Header
- ' HeaderTexto = String.Format("H{0}{1}GRUPO01 ", convenio.PadLeft(9, PadCeros), DateTime.Now().ToString("yyyy-MM-dd"))
- ' 'Campo #5 del Header
- ' HeaderTexto &= String.Format("{0}{1}", UsuarioActual.CveUsuario, DateTime.Now().ToString("yyyyMMdd")).PadRight(20)
- ' 'Campos #6-8 del Header
- ' HeaderTexto &= String.Format("00").PadRight(586)
- ' Dim HeaderLength = HeaderTexto.Length
-
- ' ''''' LLENADO DE TRAILER
- ' TrailerTexto = String.Format("T{0}{1}{2}", Registros.ToString.PadLeft(10, PadCeros), Vacio.PadRight(50, PadCeros), Vacio.PadRight(575))
-
- ' ''''' ARMADO DEL TEXTO COMPLETO
- ' TextoCompleto = String.Format("{1}{0}{2}{0}{3}{0}", vbCrLf, HeaderTexto, DetalleTexto, TrailerTexto)
- ' 'TxtAltas.Text = TextoCompleto
- 'End Sub
#End Region
@@ -2496,15 +1856,10 @@ Partial Class Bancos_PagoElectronicoGrupos
Dim Mail As New ClsSisMail()
Dim Para As String = Parametros(0)
Dim Asunto As String = Parametros(1)
- Dim Body As String = Parametros(2)
-
- 'NO SE OCUPAN
- 'Dim CveIE As Integer = Parametros(3).ToEntero
- 'Dim CveTipoTransaccion As Integer = Parametros(4).ToEntero
- 'Dim Estatus As Integer = If(CveTipoTransaccion = 2, 2, 1) ' cuando es transferencia, no lo pasa por entregar
-
- ' Mail.MandaCorreo(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
+ Dim Body As String = Parametros(2)
+
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
+
End Sub
Private Function GeneraCorreo(CveIE As Integer, objIE As ClsBancos) As String
@@ -2656,6 +2011,7 @@ Partial Class Bancos_PagoElectronicoGrupos
Return strBody.ToString
End Function
+
#End Region
#Region " GENERA CORREO 2"
@@ -3146,6 +2502,470 @@ Partial Class Bancos_PagoElectronicoGrupos
End Sub
+ Protected Sub BtnConsultaEnviados_Click(sender As Object, e As EventArgs)
+ CargaEnviados()
+ End Sub
+
+ Private Sub CargaEnviados()
+
+ Dim ObjBancos As New ClsBancos
+ Dim FechaI = If(IsDate(txtFechaIEnviados.Text.Trim()), txtFechaIEnviados.Text.Trim(), "-1")
+ Dim FechaF = If(IsDate(txtFechaFEnviados.Text.Trim()), txtFechaFEnviados.Text.Trim(), "-1")
+
+ If ObjBancos.GetLayoutPagosEnviados(DdlCuentaEnviados.SelectedValue.ToEntero, DdlEstatusEnviados.SelectedValue.ToEntero, "-1", FechaI, FechaF, PorGrupos:=True) Then
+ DTEnviadas = ObjBancos.DtResultados
+ Else
+ DTEnviadas = Nothing
+ End If
+
+ ObjBancos.Dispose()
+
+ 'Carga GvEnviadas
+ If DTEnviadas IsNot Nothing AndAlso DTEnviadas.Rows.Count > 0 Then
+ GvEnviadas.DataSource = DTEnviadas
+ End If
+
+ GvEnviadas.DataBind()
+ UpEnviados.Update()
+
+ End Sub
+
+ Property CveIEPagoActual As Integer
+ Get
+ If ViewState("CveIEPagoActual") Is Nothing Then
+ Return -1
+ Else
+ Return ViewState("CveIEPagoActual").ToString.ToEntero
+ End If
+ End Get
+ Set(value As Integer)
+ ViewState("CveIEPagoActual") = value
+ End Set
+ End Property
+
+ Property CveLayoutEnvioDetalleActual As Integer
+ Get
+ If ViewState("CveLayoutEnvioDetalleActual") Is Nothing Then
+ Return -1
+ Else
+ Return ViewState("CveLayoutEnvioDetalleActual").ToString.ToEntero
+ End If
+ End Get
+ Set(value As Integer)
+ ViewState("CveLayoutEnvioDetalleActual") = value
+ End Set
+ End Property
+
+ Property GvIndexActual As Integer
+ Get
+ If ViewState("GvIndexActual") Is Nothing Then
+ Return -1
+ Else
+ Return ViewState("GvIndexActual").ToString.ToEntero
+ End If
+ End Get
+ Set(value As Integer)
+ ViewState("GvIndexActual") = value
+ End Set
+ End Property
+
+
+ Protected Sub ImgUpload_Click(sender As Object, e As EventArgs)
+
+ Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
+ CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
+
+ ' HFComprobanteActual = GvRow.FCHiddenField("HFComprobante")
+
+ GvIndexActual = GvRow.RowIndex
+
+
+ RegistraScript("$('#ModalUploadComprobante').modal({ backdrop: 'static', keyboard: false});")
+
+ End Sub
+
+ Protected Sub btnUploadFileComprobante_Click(sender As Object, e As EventArgs)
+
+ Dim FileExtension As String = "-1"
+ Dim Filesgral As List(Of Archivo) = TxtFileComprobante.getfiles().Archivos
+ Dim Filename As String = ""
+ Dim ErrorProceso As Boolean = False
+
+
+ For Each fileItem As Archivo In Filesgral
+
+ Try
+
+ FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
+ Dim tempArray() As String
+ tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
+
+
+ If Not ErrorProceso Then
+
+ Dim DirectorioDestino As String = UsuarioActual.Empresa.Ruta & $"..\Temp\"
+ Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & $"..\Temp\{CveIEPagoActual}.{FileExtension}"
+
+
+ If Not Directory.Exists(DirectorioDestino) Then
+ Directory.CreateDirectory(DirectorioDestino)
+ End If
+
+ Try
+
+ If System.IO.File.Exists(rutaDestino) Then
+ System.IO.File.Delete(rutaDestino)
+ End If
+
+ GvEnviadas.Rows(GvIndexActual).FCTextBox("TxtComprobante").Text = $"{CveIEPagoActual}.{FileExtension}"
+
+
+ System.IO.File.Move(fileItem.FileUrl, rutaDestino)
+
+ Catch ex As Exception
+ Alert("Error al cargar al", TipoMensaje.MsgAdvertencia)
+ GuardaLog($"Error al gaurdar documento (moviendo archivo digital) --> Error{ ex.StackTrace}")
+ ErrorProceso = True
+ End Try
+ End If
+
+
+ TxtFileComprobante.Text = ""
+
+
+
+
+ UPModalUploadComprobante.Update()
+
+ Catch ex As Exception
+ OnError("Error al cargar archivo", ex)
+ End Try
+
+ Next
+
+ If Not ErrorProceso Then
+ RegistraScript("$('#ModalUploadComprobante').modal('hide')", "hidemodal3")
+ UpEnviados.Update()
+ End If
+
+
+
+
+
+ End Sub
+
+
+ Protected Sub LnkGvConfirmar_Click(sender As Object, e As EventArgs)
+
+ Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
+ CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
+ Dim Comprobante As String = If(GvRow.FCTextBox("TxtComprobante").Text.Trim = "", "-1", GvRow.FCTextBox("TxtComprobante").Text.Trim)
+ Dim NuevoFolio As String = If(GvRow.FCTextBox("TxtFolio").Text.Trim = "", "-1", GvRow.FCTextBox("TxtFolio").Text.Trim)
+
+ Dim ErrorProceso As Boolean = False
+ Dim ObjBanco As New ClsBancos
+ 'ObjBanco.IniciaTransacSQL()
+
+ Dim CveLayoutEnvioDetalle As Integer = GvRow.DataKey("CveLayoutEnvioDetalle").ToEntero
+ Dim CveLayoutEnvio As Integer = GvRow.DataKey("CveLayoutEnvio").ToEntero
+ Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero
+ Dim CveProveedor As Integer = GvRow.DataKey("CveProveedor").ToEntero
+
+
+ If Not ObjBanco.UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle, CveLayoutEnvio, CveIE, CveProveedor, 2, "", True) Then
+ ErrorProceso = True
+ End If
+
+
+ If NuevoFolio <> "-1" Or Comprobante <> "-1" And Not ErrorProceso Then
+ If Not ObjBanco.UpdateBancos_IEFolio(CveIE, NuevoFolio, Comprobante) Then
+ ErrorProceso = True
+ End If
+ End If
+
+
+ If Comprobante <> "-1" And Not ErrorProceso Then
+
+ Try
+
+ Dim FOrigen As String = $"{UsuarioActual.Empresa.Ruta}..\Temp\{Comprobante}"
+ Dim FDestino As String = $"{UsuarioActual.Empresa.Ruta}\IE\{Comprobante}"
+
+ If File.Exists(FDestino) Then
+ File.Delete(FDestino)
+ End If
+
+ File.Move(FOrigen, FDestino)
+
+ Catch ex As Exception
+ ErrorProceso = True
+ Alert("Error al guardar comprobante.", TipoMensaje.MsgError)
+ End Try
+
+ End If
+
+
+
+ If ErrorProceso Then
+ ObjBanco.RollBack()
+ Else
+ ObjBanco.Commit()
+ Alert("Confirmado Correctamente")
+ End If
+
+
+ ObjBanco.Dispose()
+
+ End Sub
+
+
+
+
+ Protected Sub LnkGvCancelar_Click(sender As Object, e As EventArgs)
+
+ Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
+ CveIEPagoActual = GvRow.DataKey("CveIE").ToEntero
+
+
+ Dim ErrorProceso As Boolean = False
+ Dim ObjBanco As New ClsBancos
+
+
+ Dim CveLayoutEnvioDetalle As Integer = GvRow.DataKey("CveLayoutEnvioDetalle").ToEntero
+ Dim CveLayoutEnvio As Integer = GvRow.DataKey("CveLayoutEnvio").ToEntero
+ Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero
+ Dim CveProveedor As Integer = GvRow.DataKey("CveProveedor").ToEntero
+ Dim IDPoliza As Integer = -1
+ Dim CvePrePoliza As Integer
+ Dim FechaDocumento As Date
+
+ If Not ObjBanco.UpdateLayoutEnviosDetalle(CveLayoutEnvioDetalle, CveLayoutEnvio, CveIE, CveProveedor, 3, "", False) Then '3 es cancelacion
+ ErrorProceso = False
+ End If
+
+ 'Dim NumComplementos As Integer
+ 'Dim Conciliado As Integer
+
+ If ObjBanco.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) And Not ErrorProceso Then
+
+
+ If ObjBanco.DtResultados(0)("NumComplementos").ToString.ToEntero > 0 Then
+ ErrorProceso = True
+ Alert("El Moviento tiene Complementos", TipoMensaje.MsgAdvertencia)
+ End If
+
+ If ObjBanco.FueConciliado Then
+ ErrorProceso = True
+ Alert("El Moviento Esta conciliado", TipoMensaje.MsgAdvertencia)
+ End If
+
+
+ IDPoliza = ObjBanco.IDPoliza
+ CvePrePoliza = ObjBanco.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero
+ FechaDocumento = ObjBanco.FechaDocumento
+
+ End If
+ ObjBanco.Dispose()
+
+
+ If Not ErrorProceso Then
+
+
+
+ Dim Banc As New ClsBancos
+ Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
+
+ Dim ObjAC As ClsContPAQi = Nothing
+ If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
+ ObjAC = New ClsContPAQi(UsuarioActual.Empresa)
+ ObjAC.IniciaTransacSQL()
+ End If
+
+ Dim FechaCancelacion As Date = Now
+
+ Dim ErrorCancelar = False
+ Dim MensajeError = ""
+ Dim IdPolizaNueva = -1
+ Dim FolioPolizaNueva = -1
+
+ If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1")) Then
+
+ If ObjAC Is Nothing Then
+ ErrorCancelar = True
+ End If
+
+ If Not ErrorCancelar Then
+ Dim dt As DataTable
+
+ If ObjAC.GetPoliza(IDPoliza, -1, -1, -1, -1) AndAlso ObjAC.DtResultados.Rows.Count > 0 Then
+ dt = ObjAC.DtResultados
+
+ ' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS)
+ If dt.Rows(0)("FechaPol").ToString.ToDate < FechaCancelacion.FirstDayOfMonth Then 'dt.Rows(0)("FechaPol").ToString.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or dt.Rows(0)("FechaPol").ToString.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
+ IdPolizaNueva = ObjAC.AddPoliza(dt.Rows(0)("CodigoTipoPoliza").ToString.ToEntero, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, FechaCancelacion)
+ If IdPolizaNueva > 0 Then
+ FolioPolizaNueva = ObjAC.Folio
+
+ 'CREA POLIZA NEGATIVA
+ For Each dr As DataRow In dt.Rows
+ If Not ObjAC.AddMovimiento(IdPolizaNueva, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "True", dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), dr("IdSegNeg").ToString.ToEntero, FechaCancelacion, "") Then
+ ErrorCancelar = True
+ MensajeError = "Error al crear poliza negativa"
+ Exit For
+ End If
+ Next
+
+ 'AJUSTA POLIZA
+ If Not ErrorCancelar Then
+ If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then
+ ErrorCancelar = True
+ MensajeError = "Error al ajustar poliza negativa"
+ End If
+ End If
+
+ 'CANCELA IE
+ If Not ErrorCancelar Then
+ If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
+ ErrorCancelar = True
+ MensajeError = "Error al cancelar IE"
+ End If
+ End If
+
+ Else
+ ErrorCancelar = True
+ End If
+
+ Else
+
+ If ObjAC.RemovePoliza(IDPoliza) Then
+ If Not ObjConta.DesvincularPrePolizaContabilizada(IDPoliza, UsuarioActual.CveEmpresa) Then
+ ErrorCancelar = True
+ MensajeError = "Error al desvincular poliza."
+ End If
+ Else
+ ErrorCancelar = True
+ MensajeError = "Error al eliminar poliza."
+ End If
+
+ If Not ErrorCancelar Then
+ If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ ErrorCancelar = True
+ MensajeError = "Error al desbloquear prepoliza."
+ End If
+ End If
+
+ 'CANCELA IE
+ If Not ErrorCancelar Then
+ If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
+ ErrorCancelar = True
+ MensajeError = "Error al cancelar IE"
+ End If
+ End If
+
+ If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
+ ErrorCancelar = True
+ MensajeError = "Error al contabilizar poliza"
+ End If
+
+ End If
+ Else
+ ErrorCancelar = True
+ MensajeError = "Error al obtener la poliza"
+ End If
+ End If
+
+ Else
+
+ ' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
+ If FechaDocumento < FechaCancelacion.FirstDayOfMonth Then
+ 'CANCELA IE MES ANTERIOR
+ If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
+ ErrorCancelar = True
+ MensajeError = "Error al cancelar IE MES ANTERIOR"
+ End If
+ Else
+ 'CANCELA IE MES ACTUAL
+ If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, FechaCancelacion) Then
+ ErrorCancelar = True
+ MensajeError = "Error al cancelar IE MES ACTUAL"
+ End If
+ End If
+ End If
+
+
+
+ If Not ErrorCancelar Then
+
+
+
+ If ObjAC IsNot Nothing Then ObjAC.Commit()
+ Banc.Commit()
+ Dim Msg As New StringBuilder
+
+ If IdPolizaNueva > 0 Then
+ Msg.AppendFormat("
Ver Póliza de cancelación", IdPolizaNueva)
+ Else
+ Msg.Append("Pago Cancelado Correctamente.")
+ End If
+
+ Alert(Msg.ToString, TipoMensaje.MsgInformacion)
+
+ Else
+
+ If ObjAC IsNot Nothing Then ObjAC.RollBack()
+ Banc.RollBack()
+ Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
+ GuardaLog(MensajeError + " | CANCELAR IE")
+
+ End If
+
+ If ObjAC IsNot Nothing Then ObjAC.Dispose()
+ Banc.Dispose()
+ ObjConta.Dispose()
+
+
+ End If
+
+ End Sub
+
+
+
+
+
+
+
+
+ Protected Sub LnkDescarga_Click(sender As Object, e As EventArgs)
+
+ Dim FileName As String = NombreArchivo
+ Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivo}"
+ Response.Clear()
+ Response.ContentType = "application/octet-stream"
+ Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
+ Response.TransmitFile(FilePath)
+ Response.End()
+
+ End Sub
+
+
+ Protected Sub LnkDescargaCuentas1_Click(sender As Object, e As EventArgs)
+ Dim FileName As String = NombreArchivoBancomer
+ Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivoBancomer}"
+ Response.Clear()
+ Response.ContentType = "application/octet-stream"
+ Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
+ Response.TransmitFile(FilePath)
+ Response.End()
+ End Sub
+ Protected Sub LnkDescargaCuentas2_Click(sender As Object, e As EventArgs)
+ Dim FileName As String = NombreArchivo
+ Dim FilePath As String = $"{UsuarioActual.Empresa.Ruta}Layout\{NombreArchivo}"
+ Response.Clear()
+ Response.ContentType = "application/octet-stream"
+ Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName)
+ Response.TransmitFile(FilePath)
+ Response.End()
+ End Sub
End Class
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 552b2f736..be19367d4 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -2162,9 +2162,9 @@ Partial Class Compras_Compras
DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4"))
- If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
- DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5"))
- End If
+ 'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
+ DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5"))
+ 'End If
End If
@@ -2313,23 +2313,23 @@ Partial Class Compras_Compras
'ASIGNA VALORES ORIGINALES PARA GUARDAR
AsignaValoresOriginales(SubtotalTemp, Subtotal2Temp, IVATemp, RetIVATemp, RetISRTemp, Total)
- If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
+ 'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
- If RetencionIVA = 0 And IVAOriginal > 0 Then
- For Each dRow As DataRow In TmpDT.Rows
- If dRow("CveTipoPS").ToString.ToEntero = 1 Then
+ ' If RetencionIVA = 0 And IVAOriginal > 0 Then
+ ' For Each dRow As DataRow In TmpDT.Rows
+ ' If dRow("CveTipoPS").ToString.ToEntero = 1 Then
- 'comentado para reubicar el boton
- 'tdIVA6.Visible = True
+ ' 'comentado para reubicar el boton
+ ' 'tdIVA6.Visible = True
- Exit For
- End If
- Next
- End If
+ ' Exit For
+ ' End If
+ ' Next
+ ' End If
- End If
+ 'End If
End Sub
@@ -6043,7 +6043,12 @@ Partial Class Compras_Compras
End If
- If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
+ 'Codigo anterior
+ 'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
+ ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
+ 'End If
+
+ If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
End If
@@ -8853,11 +8858,14 @@ Partial Class Compras_Compras
End If
- If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
+ 'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
+ ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
+ 'End If
+
+ If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
End If
-
End If
End If
@@ -15254,6 +15262,9 @@ Partial Class Compras_Compras
If Math.Abs(SubTotalGV - SubTotalCompra) < DiferenciaPermitida Then
LbSubTotalDif.Visible = False
Vinculacion()
+ ElseIf Math.Abs(SubTotalGV - SubTotalCompra) > DiferenciaPermitida And LblAmortizacion.Text.ToDecimal > 0 Then '2020-06-08 Oscar Permitir vincular cuando hay amortizacion de NC
+ LbSubTotalDif.Visible = False
+ Vinculacion()
ElseIf Math.Abs(SubTotalGV - (SubTotalCompra - LbAnticiposOC2.Text.ToDecimal)) < DiferenciaPermitida Then
LbSubTotalDif.Visible = False
Vinculacion()
@@ -17521,23 +17532,23 @@ Partial Class Compras_Compras
GuardaAC()
End If
- If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
+ 'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
- 'If UsuarioActual.CveRol = 1 Then
- ' Alert($"Ok funcionalidad 577 RetencionIVA { RetencionIVA} IVAOriginal {IVAOriginal}")
- 'End If
+ ' 'If UsuarioActual.CveRol = 1 Then
+ ' ' Alert($"Ok funcionalidad 577 RetencionIVA { RetencionIVA} IVAOriginal {IVAOriginal}")
+ ' 'End If
- If RetencionIVA = 0 And IVAOriginal > 0 Then
- For Each dRow As DataRow In TmpDT.Rows
- If dRow("CveTipoPS").ToString.ToEntero = 1 Then
- 'Comnetado para reubicar el boton
- 'tdIVA6.Visible = True
- Exit For
- End If
- Next
- End If
+ ' If RetencionIVA = 0 And IVAOriginal > 0 Then
+ ' For Each dRow As DataRow In TmpDT.Rows
+ ' If dRow("CveTipoPS").ToString.ToEntero = 1 Then
+ ' 'Comnetado para reubicar el boton
+ ' 'tdIVA6.Visible = True
+ ' Exit For
+ ' End If
+ ' Next
+ ' End If
- End If
+ 'End If