diff --git a/Acumuladores/CatGarantiasMeses.aspx.vb b/Acumuladores/CatGarantiasMeses.aspx.vb index b4023f7e4..3e71a5f47 100644 --- a/Acumuladores/CatGarantiasMeses.aspx.vb +++ b/Acumuladores/CatGarantiasMeses.aspx.vb @@ -97,8 +97,9 @@ Partial Class Acumuladores_CatFoliosGarantia If DdlMarca.SelectedValue <> -1 Then DdlMarcaM.SelectedValueExist(DdlMarca.SelectedValue.ToEntero) If DdlTipoUso.SelectedValue <> -1 Then DdlTipoUsoM.SelectedValueExist(DdlTipoUso.SelectedValue.ToEntero) - TxtMes.Text = "" + TxtMes.Text = TxtMes.Text.ToEntero + 1 TxtValor.Text = "" + TxtMes.Focus() Actualizar = False UpGral.Update() @@ -129,8 +130,9 @@ Partial Class Acumuladores_CatFoliosGarantia If Not Actualizar Then If ObjAcum.GarantiasMesesAdd(DdlMarcaM.SelectedValue.ToEntero, DdlTipoUsoM.SelectedValue.ToEntero, TxtMes.Text.ToEntero, TxtValor.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - TxtMes.Text = "" + TxtMes.Text = TxtMes.Text.ToEntero + 1 TxtValor.Text = "" + TxtMes.Focus() CargadatosGvFolioGarantia() diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index dfda922b1..a7f69b063 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -2886,8 +2886,8 @@ Public Class ClsCompras OnError("Ocurrió un error al obtener el reporte de anticipos - nc - exc detalle .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - + End Function + #End Region Public Function GetCxPProgramado(CveCompra As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -2903,9 +2903,43 @@ Public Class ClsCompras OnError("Ocurrió un error al obtener la información de la compra programada.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function + End Function + + Public Function GetCancelarNC(CveCompra As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_CancelarNCGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos para cancelar la nc.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function UpdateFechaVencimientoCompra(CveCompra As Integer, FechaVencimiento As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_ComprasFechaVencimientoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@FechaVencimiento", SqlDbType.Date).Value = FechaVencimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la fecha de vencimiento de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + #Region "REPORTE PUE SIN PAGO" - + Public Function GetPUESinPago(FI As DateTime, FF As DateTime, CveProveedor As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional CveUsuario As Integer = -1) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Comp_PUESinPagoGet", CommandType.StoredProcedure) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 4ab57dfa8..2b556565a 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -228,9 +228,9 @@ Public Class ClsContabilidad - Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Boolean + Public Function AddPrePolizasNegativa(CvePrePoliza As Integer, CveUsuario As Integer, Concepto As String, CveEmpresa As Integer, Fecha As Date) As Integer - Dim Retorno As Boolean = False + Dim Retorno As Integer = -1 DataAdapter("PA_Conta_PrePolizasNegativaAdd") @@ -240,11 +240,12 @@ Public Class ClsContabilidad .Add("@Concepto", SqlDbType.VarChar).Value = Concepto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CvePrePolizaNueva", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@CvePrePolizaNueva").Value.ToString.ToEntero Catch ex As Exception OnError("Ocurrió un error al Guardar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 04ad93303..a643b79af 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1355,12 +1355,12 @@ Public Class ClsPaginas Application("GlobalDTTipoTransacciones") = value End Set End Property - Property GlobalDTEstatusIE() As DataTable + Property GlobalDTBancosEstatusIE() As DataTable Get - GlobalDTEstatusIE = DirectCast(Application("GlobalDTEstatusIE"), DataTable) + GlobalDTBancosEstatusIE = DirectCast(Application("GlobalDTBancosEstatusIE"), DataTable) End Get Set(value As DataTable) - Application("GlobalDTEstatusIE") = value + Application("GlobalDTBancosEstatusIE") = value End Set End Property Property GlobalDTBancosIE() As DataTable diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 3269c0f62..7ee9d6b94 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -1805,7 +1805,7 @@ Namespace Modelos CvePlantilaPoliza = 4 ElseIf ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then CvePlantilaPoliza = 7 - ElseIf ObjFactura.TipoDocto = "Rem" Then + ElseIf ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then CvePlantilaPoliza = 4 End If @@ -1871,35 +1871,34 @@ Namespace Modelos Select Case ConceptoContable - Case 1 'Cliente - If Not ObjFactura.TipoDocto.Contiene("Egs", "Rem") Then - importeMovimiento = (ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador - importeMX = importeMovimiento * tipoCambio * Multiplicador - FechaMovimiento = ObjFactura.FechaPago - CveSubProyectoContabilizar = CveSubProyectoVenta - - If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" - - If tipoCambio = 1 Then - IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes - Else - IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria - CveCuenta = 0 - - If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementariaClientes) Then - importeMX = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If - End If - - IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera - End If - - IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta + Case 1 'Cliente + If Not ObjFactura.TipoDocto.Contiene("Egs", "Rem", "RNC") Then + importeMovimiento = ((ObjFactura.Total - ObjFactura.TotalOtrosConceptos) * ValorMultiplicador) + importeMX = (importeMovimiento * tipoCambio * Multiplicador) + FechaMovimiento = ObjFactura.FechaPago + CveSubProyectoContabilizar = CveSubProyectoVenta + If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + + If tipoCambio = 1 Then + IdCtaContable = ObjFactura.Cliente.IdCtaContClientes + CveCuenta = ObjFactura.Cliente.CveCuentaClientes + Else + IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria + CveCuenta = ObjFactura.Cliente.CveCuentaComplementaria + If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsuarioActual.CveEmpresa = 119) Then + importeMX = importeMovimiento + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, + CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), + TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + End If + + IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera + CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera + End If + IdCtaContableCliente = IdCtaContable + CveCuentaCliente = CveCuenta End If Case 3 'Cliente @@ -1945,6 +1944,37 @@ Namespace Modelos importeMovimiento = 0 ObjFactura.SeGuardoPrePoliza = True End If + Case 277 'Remisión del cliente + + If ObjFactura.TipoDocto = "RNC" Then + importeMovimiento = ((ObjFactura.Total - TotalOtrosConceptos) * ValorMultiplicador) + importeMX = importeMovimiento * tipoCambio * Multiplicador + FechaMovimiento = ObjFactura.FechaPago + CveSubProyectoContabilizar = CveSubProyectoVenta + If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + + If tipoCambio = 1 Then + IdCtaContable = ObjFactura.Cliente.IdCtaContClientes + CveCuenta = ObjFactura.Cliente.CveCuentaClientes + Else + IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera + CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera + End If + IdCtaContableCliente = IdCtaContable + CveCuentaCliente = CveCuenta + + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + Else + ErrorPrepoliza = True + End If + + importeMovimiento = 0 + ObjFactura.SeGuardoPrePoliza = True + End If + Case 12 'Nota de Credito If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then @@ -2344,7 +2374,7 @@ Namespace Modelos importeMovimiento = 0 Case 4 'Venta Clasificacion - If Not ObjFactura.TipoDocto.Contiene("Rem", "Ant", "Egs", "Dev") Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "Ant", "Egs", "Dev", "RNC") Then Dim ConceptoContableAplicar = 4 Dim CveVentaAplicar = ObjFactura.CveVenta @@ -2499,7 +2529,7 @@ Namespace Modelos importeMovimiento = 0 Case 103 'Descuento - If Not ObjFactura.TipoDocto.Contiene("Rem") AndAlso ObjFactura.CveTipoAmortizacionAnticipo = -1 Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoAmortizacionAnticipo = -1 Then importeMovimiento = (ObjFactura.Descuento * ValorMultiplicador) importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador @@ -2537,7 +2567,7 @@ Namespace Modelos End If Case 8 'Ret IVA por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem") Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then importeMovimiento = (ObjFactura.RetIVA * ValorMultiplicador) importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago @@ -2568,7 +2598,7 @@ Namespace Modelos End If Case 9 'Ret ISR por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem") Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then importeMovimiento = (ObjFactura.RetISR * ValorMultiplicador) importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago @@ -2598,7 +2628,7 @@ Namespace Modelos End If End If Case 13 'Iva por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem") Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then importeMovimiento = (ObjFactura.IVA * ValorMultiplicador) importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) FechaMovimiento = ObjFactura.FechaPago @@ -2611,7 +2641,7 @@ Namespace Modelos Case 38 'IEPS por Trasladar - If Not ObjFactura.TipoDocto.Contiene("Rem") Then + If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then importeMovimiento = (ObjFactura.IEPS * ValorMultiplicador) importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) FechaMovimiento = ObjFactura.Fecha @@ -2809,7 +2839,7 @@ Namespace Modelos End If 'ContPAQ El movimiento 1 es el de Venta - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And UsuarioActual.Empresa.UsaContabilidad = True And Not ErrorPrepoliza Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso Not ErrorPrepoliza Then If idCuentaContabilizacion > 0 Then If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=objContPaqi) Then Else diff --git a/Bancos/CatBancosEstatusIE.aspx.vb b/Bancos/CatBancosEstatusIE.aspx.vb index e1fc26f75..c82dab5bd 100644 --- a/Bancos/CatBancosEstatusIE.aspx.vb +++ b/Bancos/CatBancosEstatusIE.aspx.vb @@ -25,8 +25,8 @@ Partial Class Bancos_CatBancosEstatusIE Dim ObjEstatusIE As New ClsBancos If ObjEstatusIE.GetBancos_EstatusIE() Then ViewState("DTEstatusIE") = ObjEstatusIE.DtResultados - GlobalDTEstatusIE = ObjEstatusIE.DtResultados - Else + GlobalDTBancosEstatusIE = ObjEstatusIE.DtResultados + Else Me.GvDatos.DataSource = Nothing End If @@ -47,9 +47,9 @@ Partial Class Bancos_CatBancosEstatusIE Alert("El nuevo Estatus de Ingresos y Egresos se guardó correctamente.", TipoMensaje.MsgInformacion) UpTitulos.Update() ViewState("DTEstatusIE") = ObjEstatusIE.DtResultados - GlobalDTEstatusIE = ObjEstatusIE.DtResultados + GlobalDTBancosEstatusIE = ObjEstatusIE.DtResultados - If ViewState("Orden").ToString() <> String.Empty Then + If ViewState("Orden").ToString() <> String.Empty Then CargaGrid(ViewState("Orden").ToString()) Else CargaGrid("") @@ -145,8 +145,8 @@ Partial Class Bancos_CatBancosEstatusIE TxtCveEstatusIE.Text = "" GvDatos.EditIndex = -1 ViewState("DTEstatusIE") = ObjEstatusIE.DtResultados - GlobalDTEstatusIE = ObjEstatusIE.DtResultados - Alert("El Estatus de Ingresos y Egresos se eliminó correctamente.", TipoMensaje.MsgInformacion) + GlobalDTBancosEstatusIE = ObjEstatusIE.DtResultados + Alert("El Estatus de Ingresos y Egresos se eliminó correctamente.", TipoMensaje.MsgInformacion) End If ObjEstatusIE.Dispose() @@ -178,8 +178,8 @@ Partial Class Bancos_CatBancosEstatusIE If ObjEstatusIE.UpdateBancos_EstatusIE(EstatusIE, Estatus, CveEstatusIE) Then GvDatos.EditIndex = -1 ViewState("DTEstatusIE") = ObjEstatusIE.DtResultados - GlobalDTEstatusIE = ObjEstatusIE.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + GlobalDTBancosEstatusIE = ObjEstatusIE.DtResultados + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) End If ObjEstatusIE.Dispose() diff --git a/Bancos/CatEstatusIE.aspx.vb b/Bancos/CatEstatusIE.aspx.vb index d639e2a0a..9950ba678 100644 --- a/Bancos/CatEstatusIE.aspx.vb +++ b/Bancos/CatEstatusIE.aspx.vb @@ -42,8 +42,8 @@ Partial Class Bancos_CatEstatusIE Dim ObjEstatusIE As New ClsBancos If ObjEstatusIE.GetBancos_EstatusIE() Then ViewState("DTEstatusIE") = ObjEstatusIE.DtResultados - GlobalDTEstatusIE = ObjEstatusIE.DtResultados - GvDatos.DataSource = GlobalDTEstatusIE + GlobalDTBancosEstatusIE = ObjEstatusIE.DtResultados + GvDatos.DataSource = GlobalDTBancosEstatusIE Else GvDatos.DataSource = Nothing End If diff --git a/Bancos/CuentasBancariasDetalle.aspx.vb b/Bancos/CuentasBancariasDetalle.aspx.vb index beab9c9ec..aa6c11579 100644 --- a/Bancos/CuentasBancariasDetalle.aspx.vb +++ b/Bancos/CuentasBancariasDetalle.aspx.vb @@ -36,8 +36,6 @@ Partial Class Bancos_CuentasBancariasDetalle DdlUsuarios.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("", "Nombre") DdlUsuarios.DataBind() - - If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then ViewState("CveCuenta") = Request("CveCuenta") diff --git a/Bancos/Devoluciones.aspx.cs b/Bancos/Devoluciones.aspx.cs index 6d93ef6e8..451c90e33 100644 --- a/Bancos/Devoluciones.aspx.cs +++ b/Bancos/Devoluciones.aspx.cs @@ -467,7 +467,7 @@ public partial class Bancos_Devoluciones : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { if (IDCtaContableDevolucion > 0 && IDCtaContableBancos > 0) { diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index e83e9f36d..57d76e13f 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -1,413 +1,413 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports Extensiones -Imports System.Web.Services -Imports System.IO -Imports Microsoft.Reporting.WebForms - -Partial Class Bancos_IE - Inherits ClsPaginas - -#Region "Propiedades" - - 'Configuración - Private Property CveIE As Integer - Get - Return ViewState("CveIE").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveIE") = value - End Set - End Property - Private Property CveIEDeposito As Integer - Get - Return ViewState("CveIEDeposito").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveIEDeposito") = value - End Set - End Property - Private Property CveIEDeposito2 As Integer - Get - Return ViewState("CveIEDeposito2").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveIEDeposito2") = value - End Set - End Property - Private Property Cuenta As String - Get - Return ViewState("Cuenta").ToString - End Get - Set(value As String) - ViewState("Cuenta") = value - End Set - End Property - Private Property Folio As String - Get - Return ViewState("Folio").ToString - End Get - Set(value As String) - ViewState("Folio") = value - End Set - End Property - Private Property CuentaDepositoPadre As String - Get - Return ViewState("CuentaDepositoPadre").ToString - End Get - Set(value As String) - ViewState("CuentaDepositoPadre") = value - End Set - End Property - Private Property CveCuenta As Integer - Get - Return ViewState("CveCuenta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCuenta") = value - End Set - End Property - Private Property CveCompra As Integer - Get - Return If(IsNothing(ViewState("CveCompra")), -1, ViewState("CveCompra").ToString.ToEntero) - End Get - Set(value As Integer) - ViewState("CveCompra") = value - End Set - End Property - Private Property CveProveedor As Integer - Get - Return If(IsNothing(ViewState("CveProveedor")), -1, ViewState("CveProveedor").ToString.ToEntero) - End Get - Set(value As Integer) - ViewState("CveProveedor") = value - End Set - End Property - Private Property CveOrdenCompra As Integer - Get - Return If(IsNothing(ViewState("CveOrdenCompra")), -1, ViewState("CveOrdenCompra").ToString.ToEntero) - End Get - Set(value As Integer) - ViewState("CveOrdenCompra") = value - End Set - End Property - Private Property CvePersonal As Integer - Get - Return If(IsNothing(ViewState("CvePersonal")), -1, ViewState("CvePersonal").ToString.ToEntero) - End Get - Set(value As Integer) - ViewState("CvePersonal") = value - End Set - End Property - Private Property CveCliente As Integer - Get - Return If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1) - End Get - Set(value As Integer) - ViewState("CveCliente") = value - End Set - End Property - - - Private Property CveVentaDevDin As Integer - Get - Return ViewState("CveVentaDevDin").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveVentaDevDin") = value - End Set - End Property - Private Property SerieFolioDevDin As String - Get - Return ViewState("SerieFolioDevDin").ToString - End Get - Set(value As String) - ViewState("SerieFolioDevDin") = value - End Set - End Property - Private Property CvePrePolizaDevDin As Integer - Get - Return ViewState("CvePrePolizaDevDin").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CvePrePolizaDevDin") = value - End Set - End Property - - - - Private Property CveCompraDeCDin As Integer - Get - Return ViewState("CveCompraDeCDin").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCompraDeCDin") = value - End Set - End Property - Private Property SerieFolioDeCDin As String - Get - Return ViewState("SerieFolioDeCDin").ToString - End Get - Set(value As String) - ViewState("SerieFolioDeCDin") = value - End Set - End Property - Private Property CvePrePolizaDeCDin As Integer - Get - Return ViewState("CvePrePolizaDeCDin").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CvePrePolizaDeCDin") = value - End Set - End Property - - - Private Property FechaCompra As Date - Get - Return ViewState("FechaCompra").ToString.ToDate - End Get - Set(value As Date) - ViewState("FechaCompra") = value - End Set - End Property - - - - - - Private Property ImporteOriginalDevDin As Decimal - Get - Return ViewState("ImporteOriginalDevDin").ToString.ToDecimal - End Get - Set(value As Decimal) - ViewState("ImporteOriginalDevDin") = value - End Set - End Property - Private Property IDPoliza As Integer - Get - Return ViewState("IDPoliza").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IDPoliza") = value - End Set - End Property - Private Property Opcion As String - Get - Return ViewState("Opcion").ToString - End Get - Set(value As String) - ViewState("Opcion") = value - End Set - End Property - Private Property IDCtaContable As Integer - Get - Return ViewState("IDCtaContable").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IDCtaContable") = value - End Set - End Property - Private Property IDCtaContableComplementaria As Integer - Get - Return ViewState("IDCtaContableComplementaria").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IDCtaContableComplementaria") = value - End Set - End Property - Private Property IDCtaBeneficiario As Integer - Get - Return ViewState("IDCtaBeneficiario").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IDCtaBeneficiario") = value - End Set - End Property - Private Property IDCtaBeneficiarioComplementaria As Integer - Get - Return ViewState("IDCtaBeneficiarioComplementaria").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IDCtaBeneficiarioComplementaria") = value - End Set - End Property - Private Property CveCuentaConta As Integer - Get - Return ViewState("CveCuentaConta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCuentaConta") = value - End Set - End Property - Private Property CveCuentaBeneficiario As Integer - Get - Return ViewState("CveCuentaBeneficiario").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCuentaBeneficiario") = value - End Set - End Property - Private Property CvePrePoliza As Integer - Get - Return ViewState("CvePrePoliza").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CvePrePoliza") = value - End Set - End Property - Private Property DtIEDevolucion As DataTable - Get - DtIEDevolucion = DirectCast(ViewState("DtIEDevolucion"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtIEDevolucion") = value - End Set - End Property - Private Property Borrar As Boolean - Get - Return CBool(ViewState("Borrar")) - End Get - Set(value As Boolean) - ViewState("Borrar") = value - End Set - End Property - Private Property CveMoneda As Integer - Get - Return ViewState("CveMoneda").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveMoneda") = value - End Set - End Property - Private Property CveOCSolicitudAnticipo As Integer - Get - Return ViewState("CveOCSolicitudAnticipo").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveOCSolicitudAnticipo") = value - End Set - End Property - Private Property EstaContabilizado As Boolean - Get - Return CBool(ViewState("EstaContabilizado")) - End Get - Set(value As Boolean) - ViewState("EstaContabilizado") = value - End Set - End Property - Private Property CveSolicitudViatico As Integer - Get - Return ViewState("CveSolicitudViatico").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveSolicitudViatico") = value - End Set - End Property - Private Property CFDIRelacionadoSustitucion As String - Get - If ViewState("CFDIRelacionadoSustitucion") Is Nothing Then - Return "-1" - Else - Return ViewState("CFDIRelacionadoSustitucion").ToString - End If - End Get - Set(value As String) - ViewState("CFDIRelacionadoSustitucion") = value - End Set - End Property - Private Property ComplementoSerieFolio As String - Get - Return ViewState("ComplementoSerieFolio").ToString - End Get - Set(value As String) - ViewState("ComplementoSerieFolio") = value - End Set - End Property - Private Property CorreoCobranzaCliente As String - Get - If ViewState("CorreoCobranzaCliente") Is Nothing Then - Return "" - Else - Return ViewState("CorreoCobranzaCliente").ToString - End If - - End Get - Set(value As String) - ViewState("CorreoCobranzaCliente") = value - End Set - End Property - - Private Property Tipo As String - Get - If ViewState("Tipo") Is Nothing Then - Return "" - Else - Return ViewState("Tipo").ToString - End If - - End Get - Set(value As String) - ViewState("Tipo") = value - End Set - End Property - Private Property RazonSocial As String - Get - If ViewState("RazonSocial") Is Nothing Then - Return "" - Else - Return ViewState("RazonSocial").ToString - End If - - End Get - Set(value As String) - ViewState("RazonSocial") = value - End Set - End Property - Private Property DtGvRH As DataTable - Get - DtGvRH = DirectCast(ViewState("DtGvRH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtGvRH") = value - End Set - End Property - Private Property ComprobanteIE As String - Get - Return ViewState("ComprobanteIE").ToString - End Get - Set(value As String) - ViewState("ComprobanteIE") = value - End Set - End Property - - - Private Property PorcentajeCompraDevDinC As Decimal - Get - Return ViewState("PorcentajeCompraDevDinC").ToString.ToDecimal - End Get - Set(value As Decimal) - ViewState("PorcentajeCompraDevDinC") = value - End Set - End Property - Private Property IdCtaAnticipoComplementaria As Integer - Get - Return ViewState("IdCtaAnticipoComplementaria").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IdCtaAnticipoComplementaria") = value - End Set - End Property - Private Property IdCtaAnticipoExtranjera As Integer - Get - Return ViewState("IdCtaAnticipoExtranjera").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("IdCtaAnticipoExtranjera") = value - End Set +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports System.Web.Services +Imports System.IO +Imports Microsoft.Reporting.WebForms + +Partial Class Bancos_IE + Inherits ClsPaginas + +#Region "Propiedades" + + 'Configuración + Private Property CveIE As Integer + Get + Return ViewState("CveIE").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveIE") = value + End Set + End Property + Private Property CveIEDeposito As Integer + Get + Return ViewState("CveIEDeposito").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveIEDeposito") = value + End Set + End Property + Private Property CveIEDeposito2 As Integer + Get + Return ViewState("CveIEDeposito2").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveIEDeposito2") = value + End Set + End Property + Private Property Cuenta As String + Get + Return ViewState("Cuenta").ToString + End Get + Set(value As String) + ViewState("Cuenta") = value + End Set + End Property + Private Property Folio As String + Get + Return ViewState("Folio").ToString + End Get + Set(value As String) + ViewState("Folio") = value + End Set + End Property + Private Property CuentaDepositoPadre As String + Get + Return ViewState("CuentaDepositoPadre").ToString + End Get + Set(value As String) + ViewState("CuentaDepositoPadre") = value + End Set + End Property + Private Property CveCuenta As Integer + Get + Return ViewState("CveCuenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuenta") = value + End Set + End Property + Private Property CveCompra As Integer + Get + Return If(IsNothing(ViewState("CveCompra")), -1, ViewState("CveCompra").ToString.ToEntero) + End Get + Set(value As Integer) + ViewState("CveCompra") = value + End Set + End Property + Private Property CveProveedor As Integer + Get + Return If(IsNothing(ViewState("CveProveedor")), -1, ViewState("CveProveedor").ToString.ToEntero) + End Get + Set(value As Integer) + ViewState("CveProveedor") = value + End Set + End Property + Private Property CveOrdenCompra As Integer + Get + Return If(IsNothing(ViewState("CveOrdenCompra")), -1, ViewState("CveOrdenCompra").ToString.ToEntero) + End Get + Set(value As Integer) + ViewState("CveOrdenCompra") = value + End Set + End Property + Private Property CvePersonal As Integer + Get + Return If(IsNothing(ViewState("CvePersonal")), -1, ViewState("CvePersonal").ToString.ToEntero) + End Get + Set(value As Integer) + ViewState("CvePersonal") = value + End Set + End Property + Private Property CveCliente As Integer + Get + Return If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1) + End Get + Set(value As Integer) + ViewState("CveCliente") = value + End Set + End Property + + + Private Property CveVentaDevDin As Integer + Get + Return ViewState("CveVentaDevDin").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVentaDevDin") = value + End Set + End Property + Private Property SerieFolioDevDin As String + Get + Return ViewState("SerieFolioDevDin").ToString + End Get + Set(value As String) + ViewState("SerieFolioDevDin") = value + End Set + End Property + Private Property CvePrePolizaDevDin As Integer + Get + Return ViewState("CvePrePolizaDevDin").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CvePrePolizaDevDin") = value + End Set + End Property + + + + Private Property CveCompraDeCDin As Integer + Get + Return ViewState("CveCompraDeCDin").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCompraDeCDin") = value + End Set + End Property + Private Property SerieFolioDeCDin As String + Get + Return ViewState("SerieFolioDeCDin").ToString + End Get + Set(value As String) + ViewState("SerieFolioDeCDin") = value + End Set + End Property + Private Property CvePrePolizaDeCDin As Integer + Get + Return ViewState("CvePrePolizaDeCDin").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CvePrePolizaDeCDin") = value + End Set + End Property + + + Private Property FechaCompra As Date + Get + Return ViewState("FechaCompra").ToString.ToDate + End Get + Set(value As Date) + ViewState("FechaCompra") = value + End Set + End Property + + + + + + Private Property ImporteOriginalDevDin As Decimal + Get + Return ViewState("ImporteOriginalDevDin").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("ImporteOriginalDevDin") = value + End Set + End Property + Private Property IDPoliza As Integer + Get + Return ViewState("IDPoliza").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IDPoliza") = value + End Set + End Property + Private Property Opcion As String + Get + Return ViewState("Opcion").ToString + End Get + Set(value As String) + ViewState("Opcion") = value + End Set + End Property + Private Property IDCtaContable As Integer + Get + Return ViewState("IDCtaContable").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IDCtaContable") = value + End Set + End Property + Private Property IDCtaContableComplementaria As Integer + Get + Return ViewState("IDCtaContableComplementaria").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IDCtaContableComplementaria") = value + End Set + End Property + Private Property IDCtaBeneficiario As Integer + Get + Return ViewState("IDCtaBeneficiario").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IDCtaBeneficiario") = value + End Set + End Property + Private Property IDCtaBeneficiarioComplementaria As Integer + Get + Return ViewState("IDCtaBeneficiarioComplementaria").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IDCtaBeneficiarioComplementaria") = value + End Set + End Property + Private Property CveCuentaConta As Integer + Get + Return ViewState("CveCuentaConta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuentaConta") = value + End Set + End Property + Private Property CveCuentaBeneficiario As Integer + Get + Return ViewState("CveCuentaBeneficiario").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuentaBeneficiario") = value + End Set + End Property + Private Property CvePrePoliza As Integer + Get + Return ViewState("CvePrePoliza").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CvePrePoliza") = value + End Set + End Property + Private Property DtIEDevolucion As DataTable + Get + DtIEDevolucion = DirectCast(ViewState("DtIEDevolucion"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtIEDevolucion") = value + End Set + End Property + Private Property Borrar As Boolean + Get + Return CBool(ViewState("Borrar")) + End Get + Set(value As Boolean) + ViewState("Borrar") = value + End Set + End Property + Private Property CveMoneda As Integer + Get + Return ViewState("CveMoneda").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMoneda") = value + End Set + End Property + Private Property CveOCSolicitudAnticipo As Integer + Get + Return ViewState("CveOCSolicitudAnticipo").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveOCSolicitudAnticipo") = value + End Set + End Property + Private Property EstaContabilizado As Boolean + Get + Return CBool(ViewState("EstaContabilizado")) + End Get + Set(value As Boolean) + ViewState("EstaContabilizado") = value + End Set + End Property + Private Property CveSolicitudViatico As Integer + Get + Return ViewState("CveSolicitudViatico").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveSolicitudViatico") = value + End Set + End Property + Private Property CFDIRelacionadoSustitucion As String + Get + If ViewState("CFDIRelacionadoSustitucion") Is Nothing Then + Return "-1" + Else + Return ViewState("CFDIRelacionadoSustitucion").ToString + End If + End Get + Set(value As String) + ViewState("CFDIRelacionadoSustitucion") = value + End Set + End Property + Private Property ComplementoSerieFolio As String + Get + Return ViewState("ComplementoSerieFolio").ToString + End Get + Set(value As String) + ViewState("ComplementoSerieFolio") = value + End Set + End Property + Private Property CorreoCobranzaCliente As String + Get + If ViewState("CorreoCobranzaCliente") Is Nothing Then + Return "" + Else + Return ViewState("CorreoCobranzaCliente").ToString + End If + + End Get + Set(value As String) + ViewState("CorreoCobranzaCliente") = value + End Set + End Property + + Private Property Tipo As String + Get + If ViewState("Tipo") Is Nothing Then + Return "" + Else + Return ViewState("Tipo").ToString + End If + + End Get + Set(value As String) + ViewState("Tipo") = value + End Set + End Property + Private Property RazonSocial As String + Get + If ViewState("RazonSocial") Is Nothing Then + Return "" + Else + Return ViewState("RazonSocial").ToString + End If + + End Get + Set(value As String) + ViewState("RazonSocial") = value + End Set + End Property + Private Property DtGvRH As DataTable + Get + DtGvRH = DirectCast(ViewState("DtGvRH"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtGvRH") = value + End Set + End Property + Private Property ComprobanteIE As String + Get + Return ViewState("ComprobanteIE").ToString + End Get + Set(value As String) + ViewState("ComprobanteIE") = value + End Set + End Property + + + Private Property PorcentajeCompraDevDinC As Decimal + Get + Return ViewState("PorcentajeCompraDevDinC").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("PorcentajeCompraDevDinC") = value + End Set + End Property + Private Property IdCtaAnticipoComplementaria As Integer + Get + Return ViewState("IdCtaAnticipoComplementaria").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IdCtaAnticipoComplementaria") = value + End Set + End Property + Private Property IdCtaAnticipoExtranjera As Integer + Get + Return ViewState("IdCtaAnticipoExtranjera").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("IdCtaAnticipoExtranjera") = value + End Set End Property Private Property CveEstatusIE As Integer @@ -423,691 +423,714 @@ Partial Class Bancos_IE End Set End Property - - - -#Region "CANCELACIÓN COMPLEMENTO MODAL V2" - - Property CveComplementoPagoCancelar As Integer - Get - If ViewState("CveComplementoPagoCancelar") Is Nothing Then - Return -1 - Else - Return ViewState("CveComplementoPagoCancelar").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveComplementoPagoCancelar") = value - End Set - End Property - - Property FolioFiscalCancelar As String - Get - If ViewState("FolioFiscalCancelar") Is Nothing Then - Return "" - Else - Return ViewState("FolioFiscalCancelar").ToString - End If - End Get - Set(value As String) - ViewState("FolioFiscalCancelar") = value - End Set - End Property - - - Property RFCReceptorCancelar As String - Get - If ViewState("RFCReceptorCancelar") Is Nothing Then - Return "" - Else - Return ViewState("RFCReceptorCancelar").ToString - End If - End Get - Set(value As String) - ViewState("RFCReceptorCancelar") = value - End Set - End Property - - Property CvePACCancelacion As Integer - Get - If ViewState("CvePACCancelacion") Is Nothing Then - Return -1 - Else - Return ViewState("CvePACCancelacion").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CvePACCancelacion") = value - End Set - End Property - -#End Region - - - - -#End Region - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - - Folio = "" - IDCtaBeneficiario = 0 - IDCtaBeneficiarioComplementaria = 0 - IDCtaContable = 0 - IdCtaAnticipoComplementaria = 0 - IdCtaAnticipoExtranjera = 0 - CveCuentaBeneficiario = 0 - CveCuentaConta = 0 - DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True - TxtImporte.Attributes.Add("onblur", "upIE(this);FncImporteCuenta(this);") - 'Calendario.StartDate = Now.AddMonths(-2).FirstDayOfMonth() - ViewState("IDPoliza") = "-1" - CveIEDeposito = -1 - CveIEDeposito2 = -1 - CveOCSolicitudAnticipo = -1 - CveMoneda = -1 'SOLO SE UTILIZA PARA SOLICITUD DE ANTICIPO DE OC - CUANDO SE USE PARA ALGO MAS, INDIQUENLO AQUI - CvePrePoliza = -1 - CveSolicitudViatico = -1 - ComplementoSerieFolio = "" - TxtFechaDevuelto.Text = Now.ToShortDateString - TxtFechaCancelacion.Text = Now.ToShortDateString - CveCompraDeCDin = -1 - 'If UsuarioActual.CveEmpresa.Contiene(66) Then trNotificar.Visible = True - - 'Guarda el modo actual de la pagina - Opcion = If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "-1") - - Session("FileUpload") = "" - TRCveIE.Visible = False - - CargaTipoTransaccion() - CargaMoneda() - CargaCuenta() - CargaDDLPersonal() - - DdlProveedores.setEsWebService(True) - DdlProveedores.Attributes.Add("data-metodo", "getproveedores") - - DdlCliente.setEsWebService(True) - DdlCliente.Attributes.Add("data-metodo", "getcliente") - - Dim ObjIE As New ClsBancos - 'Carga Estatus IE - If ObjIE.GetBancos_EstatusIE() Then - DdlEstatusIE.DataSource = ObjIE.DtResultados - DdlEstatusIE.DataBind() - End If - ObjIE.Dispose() - - If Request("CveOrdenCompra") IsNot Nothing AndAlso IsNumeric(Request("CveOrdenCompra")) AndAlso Request("CveOrdenCompra").ToEntero > 0 Then - CveOrdenCompra = Request("CveOrdenCompra").ToEntero - End If - - If Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then - CveProveedor = Request("CveProveedor").ToEntero - - CargaProveedor(CveProveedor, "-1") - End If - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then - LblPagueseA.Text = "" - LblPagueseA.Visible = False - Dim Dt As DataTable = Nothing - Dim Banc As New ClsBancos - Dim CveCredito As Integer = -1 - Dim CveCreditoDetalle As Integer = -1 - CveCredito = IfNull(Request("CveCredito"), "-1").ToString.ToEntero - CveCreditoDetalle = IfNull(Request("CveCreditoDetalle"), "-1").ToString.ToEntero - LtlTitulo.Text = "Pago de Créditos" - - DVInteresMoratorio.Visible = True - - If Banc.GetCreditos(CveCredito, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - Dt = Banc.DtResultados - - End If - - Banc.Dispose() - PnlFyE.Visible = False - - PnlCredito.Visible = True - - DdlFinanciera.DataSource = Dt.FiltraParametros("", DistinctColumns:={"CveProveedor", "Proveedor"}, Orderby:="Proveedor") - DdlFinanciera.DataBind() - - If DdlFinanciera.SelectedValue.ToEntero > 0 Then - CargaProveedor(DdlFinanciera.SelectedValue.ToEntero, "-1") - Else - Alert("No se pudieron cargar los datos del proveedor", TipoMensaje.MsgAdvertencia) - End If - - - If DdlFinanciera.SelectedValue.ToEntero > 0 Then - DdlCredito.DataSource = Dt.FiltraParametros(String.Format("CveProveedor = {0} And EstatusNum In (1,2,101,102)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito") - DdlCredito.DataBind() - End If - DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1")) - - If CveCredito > 0 Then - 'le asigno el valor - DdlCredito.SelectedValue = CveCredito.ToString - If CveCreditoDetalle > 0 Then - - CargaCreditosDetalle(CveCreditoDetalle) - - End If - End If - - End If - - If Request("CveIE") IsNot Nothing AndAlso IsNumeric(Request("CveIE")) AndAlso Request("CveIE").ToEntero > 0 Then - ViewState("CveIE") = Request("CveIE") - 'Configuración de Modalidad Update - TxtFolio.Enabled = False - TxtFechaDocumento.Enabled = False - Calendario.Enabled = False - TxtImporte.Enabled = False - TxtImporteLetra.Enabled = False - DdlMoneda.Enabled = False - TxtTipoCambio.Enabled = False - DdlCuenta.Enabled = False - 'DdlTipo.Enabled = False - DdlTipoTransaccion.Enabled = False - TxtObservaciones.Enabled = False - ChkAplicaImpuestos.Enabled = False - ChkAbonoCuenta.Enabled = False - Anexo.Visible = False - DdlCliente.Enabled = False - DdlProveedores.Enabled = False - DdlPersonal.Visible = False - - - CargaDatos() - - BtnGuardar.Visible = False - LtlTitulo.Text = "Consulta del Ingreso/Egreso:" - 'ImgAddObs.Attributes.Add("onclick", "javascript:PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ") - HlEvento.Visible = True - HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveIE=" & CveIE & "&TB_iframe=true&height=370&width=600;" - - Else - 'Configuración de Modalidad Insert - ImgAddObs.Visible = False - CveIE = -1 - TxtFechaDocumento.Text = Now.ToShortDateString - ImgUpdateCuentaDeposito.Visible = False - End If - - InicializaSolicitudAnticipoOC() - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSSINFACT") AndAlso UsuarioActual.CveEmpresa = 119 Then - RBL.Items.Add(New ListItem("Acreedores Diversos", "AC")) - End If - - '08/05/2018 - Se deshabilita opcion Eliminar IE si tiene un complemento de pago relacionado - If CveIE = -1 Or (CveIE > 0 AndAlso VerificaComplementos(False)) Then - LnkEliminar.Visible = False - If CveIE > 0 Then - LnkCancelar.Visible = False - - If UsuarioActual.TienePermisoProceso(85) Then - LnkCancelarComplemento.Visible = True - LnkCancelarComplementoImporte.Visible = True - End If - 'LnkEliminarComplemento.NavigateUrl = String.Format("/Ventas/ClientesAbonar.aspx?CveIESustitucion={0}&CveCliente={1}", CveIE, CveCliente) - End If - Else - LnkEliminar.Visible = True - LnkCancelarComplemento.Visible = False - LnkCancelarComplementoImporte.Visible = False - End If - - If TabCancelacion.Visible Then - LnkCancelar.Visible = False - LnkCancelarComplemento.Visible = False - LnkEliminar.Visible = False - LnkCancelarComplementoImporte.Visible = False - End If - - UppEliminarIE.Update() - - InicializaActualizarTC() - - '22/06/2018 - VIATICOS - If Request("CveSolicitudViatico") IsNot Nothing AndAlso IsNumeric(Request("CveSolicitudViatico")) AndAlso Request("CveSolicitudViatico").ToEntero > 0 Then - CargaDatosViaticos() - End If - - '14/08/2018- PERMISO PARA EDITAR FOLIO - If UsuarioActual.TienePermisoProceso(246) Then - TxtFolio.Enabled = True - End If - - InicializaDevolverDinero() - - If UsuarioActual.TienePermisoProceso(275) And CveIE > 0 Then - LnkAjustarMovimiento.Visible = True - End If - - If Not VerificaComplementos(True) Then - - LnkCancelarComplemento.Visible = False - LnkCancelarComplementoImporte.Visible = False - - - UppEliminarIE.Update() - - - End If - - End If - End Sub - -#Region " CARGA DATOS " - Private Sub CargaDatos() - Dim ObjIE As New ClsBancos() - Dim ObjIE2 As New ClsBancos() - If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then - If ObjIE.DtResultados.Rows.Count > 0 Then - - Try - Tipo = ObjIE.DtResultados.Rows(0)("Tipo").ToString - Catch ex As Exception - - End Try - - CveIEDeposito = ObjIE.DtResultados(0)("CveIEDepositoPadre").ToString.ToEntero - CuentaDepositoPadre = ObjIE.DtResultados(0)("CuentaDepositoPadre").ToString - Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString - - CveIEDeposito2 = ObjIE.DtResultados(0)("CveIEDeposito2").ToString.ToEntero - - If UsuarioActual.TienePermisoProceso(99) Then - 'BtnActualizar.Visible = True - TxtFechaDocumento.Enabled = True - Calendario.Enabled = True - End If - - If ObjIE.CveEstatusNotificacion > 0 Then - trNotificacion.Visible = True - LtNotificacion.Text = If(ObjIE.CveEstatusNotificacion = 1, "Notificado", String.Format("Entregado el {0} - {1}", ObjIE.FechaEntrega, ObjIE.ObservacionEntrega)) - End If - - 'Pestaña Datos Generales - TxtCveIE.Text = ObjIE.CveIE.ToString - CveCuenta = ObjIE.CveCuenta - RBL.Visible = False - RegistraScript("if($get('imgBuscarProveedor')) $get('imgBuscarProveedor').style.display='none';") - 'DdlBanco.SelectedValue = ObjIE.CveBanco.ToString - - DdlTipoTransaccion.SelectedValue = ObjIE.CveTipoTransaccion.ToString - - - DdlCuenta.SelectedValueExist(ObjIE.CveCuenta.ToString) - DdlCuenta.Visible = False - - If ObjIE.DtResultados.Rows(0)("CveCuentaTarjeta").ToString.ToEntero > 0 Then - DivTarjetaCredito.Visible = True - LblInfoTarjeta.Text = ObjIE.DtResultados.Rows(0)("NumeroTarjeta").ToString - LblInfoTarjeta.Font.Bold = True - - UpInfoTarjeta.Update() - End If - - LblCuenta.Text = ObjIE.BancoNumCuentaMoneda - ViewState("CvePrePoliza") = ObjIE.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero - TxtFechaDocumento.Text = ObjIE.FechaDocumento.ToShortDateString - TxtFolio.Text = ObjIE.Folio - LblBeneficiario.Text = ObjIE.PagueseA - TxtImporte.Text = ObjIE.Importe.FormatoNumero - TxtImporteLetra.Text = ObjIE.Importe.Texto2Letras(ObjIE.CveMoneda) - DdlMoneda.SelectedValue = ObjIE.CveMoneda.ToString - If ObjIE.TipoCambio > 0 Then - TrTipoCambio.Visible = True - Else - TrTipoCambio.Visible = False - End If - TxtTipoCambio.Text = ObjIE.TipoCambio.ToString - TxtObservaciones.Text = ObjIE.Observaciones - If Year(ObjIE.FechaAplicado) > 1 Then TxtFechaAplicado.Text = ObjIE.FechaAplicado.ToShortDateString - - ChkAbonoCuenta.Checked = ObjIE.EsAbonoEnCuenta - 'ChkAplicaImpuestos.Checked = ObjIE.AplicaImpuestos - 'ChkImpreso.Checked = ObjIE.FueImpreso - ChkConciliado.Checked = ObjIE.FueConciliado - - DdlEstatusIE.SelectedValue = ObjIE.CveEstatusIE.ToString - DdlEstatusIE.Visible = False - LblEstatusIE.Visible = True - LblEstatusIE.Text = ObjIE.EstatusIE.ToString - - If ObjIE.CveTipoTransaccion.Contiene(3, 4) Then 'cuando es cheque recibido - LnkChqDevuelto.Visible = True - End If - - 'saco el tipo de transaccion - Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", ObjIE.CveTipoTransaccion)) 'Egs o Ing - If dr IsNot Nothing Then - If dr("Tipo").ToString = "Egs" Then - LblPagueseA.Text = "Beneficiario" - Else - LblPagueseA.Text = "Pagador" - End If - - 'Detectamos a quien se le hizo el cobro (Cliente, proveedor, Funcionario/Empleado, etc.) - If ObjIE2.GetPrePolizasDetalle(-1, CveIE) Then - If ObjIE2.DtResultados.Rows.Count > 0 Then - - Dim CveConceptoContable As Integer = ObjIE2.DtResultados.FiltroPrimeroValor("CveConceptoContable", "CveConceptoContable <> 30 and CveConceptoContable <> 61").ToEntero - CveCliente = ObjIE2.DtResultados.Rows(0)("CveCliente").ToString.ToEntero - CvePersonal = ObjIE2.DtResultados.Rows(0)("CvePersonal").ToString.ToEntero - CveProveedor = ObjIE2.DtResultados.Rows(0)("CveProveedor").ToString.ToEntero - - Select Case CveConceptoContable - Case 66 - If ObjIE2.DtResultados.FiltraParametros("CveConceptoContable <> 30 and CveConceptoContable <> 60").Rows(0)("CveCliente").ToString.ToEntero > 0 Then - LblRecibidoPorNombre.Text = "Clientes" - PnlRecibidoPor.Visible = True - End If - Case 37 - '' ElseIf ObjIE2.DtResultados.FiltraParametros("CveConceptoContable <> 30 and CveConceptoContable <> 60").Item(0)("CveProveedor").ToString.ToEntero > 0 Then - LblRecibidoPorNombre.Text = "Deudores Diversos" - PnlRecibidoPor.Visible = True - - End Select - End If - End If - End If - - If CveCliente > 0 Then - DdlCliente.SelectedText = ObjIE.PagueseA - DdlCliente.SelectedValue = CveCliente.ToString - - DdlCliente.Visible = False - DdlCliente.Enabled = False - - LblPagarA.Visible = True - LblPagarA.Text = ObjIE.PagueseA - - ' LnkEmitirComplemento.Visible = True - ElseIf CveProveedor > 0 Then - DdlProveedores.SelectedText = ObjIE.PagueseA - DdlProveedores.SelectedValue = CveProveedor.ToString - DdlProveedores.Visible = False - DdlProveedores.Enabled = False - - LblPagarA.Visible = True - LblPagarA.Text = ObjIE.PagueseA - - - 'Se prepara para la generacion del envio de correo con notificacion de pago - LnkEnviarMailPago.Attributes.Add("onclick", "$('#ModalDivMail').modal();") - LnkEnviarMailPago.Visible = True - CargaProveedor(CveProveedor, "-1") - ElseIf CvePersonal > 0 Then - PersonalIndexChange(CvePersonal) - DdlPersonal.Visible = True - DdlPersonal.Enabled = False - End If - - IDPoliza = ObjIE.IDPoliza - IDCtaContable = ObjIE.IdCtaContable - CveCuentaConta = ObjIE.CveCuentaConta - - - If ObjIE.IDPoliza > 0 Then - - If UsuarioActual.TienePermisoProceso(107) Then - BtnDescontabilizar.Visible = True - End If - BtnContabilizar.Visible = False - HplIrPoliza.Visible = True - HplIrPoliza.NavigateUrl = String.Format("/Contabilidad/RegPoliza.aspx?IdPoliza={0}", ObjIE.IDPoliza) - 'ImgEliminarMovimiento.OnClientClick = "return confirm('Esta seguro de eliminar el documento y su póliza?');" - LnkEliminar.OnClientClick = "return confirm('¿Está seguro de eliminar el documento y su póliza?');" - - EstaContabilizado = True - Else - BtnContabilizar.Visible = True - BtnDescontabilizar.Visible = False - HplIrPoliza.Visible = False - - EstaContabilizado = False - End If - UPPDesContabilizar.Update() - - 'ImgImprimir.Visible = True - LblRegistroFecha.Text = ObjIE.FechaIng.ToShortDateString - LblRegistroUsuario.Text = ObjIE.Usuario - - CveEstatusIE = ObjIE.CveEstatusIE - - Select Case ObjIE.CveEstatusIE - Case 1 - If Not ObjIE.FueConciliado Then - 'If UsuarioActual.TienePermisoProceso(85) Then ImgCancelarMovimiento.Visible = True - If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True - - 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True - - 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then - LnkEliminar.Visible = True - End If - End If - - ''COMENTAR - solo para pruebas - 'If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True - 'If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True - - ImprimirIEPDF(ObjIE.CveTipoTransaccion) - - Case 2 - LblEstatus.Text = ObjIE.EstatusIE - LblEstatus.ForeColor = Drawing.Color.Red - - 'ELIMINAR IE SIN VALIDACIONES - If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True - - 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO - If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then - LnkEliminar.Visible = True - End If - - If UsuarioActual.CveUsuario = 100 Then - ImprimirIEPDF(ObjIE.CveTipoTransaccion) - End If - 'FALTA AFECTAR POLIZA NEGATIVA - 'If UsuarioActual.TienePermisoProceso(136) Then LnkEliminar.Visible = True - End Select - - 'Mostramos seccion cargar comprobante si no tiene estatus cancelado - If ObjIE.CveEstatusIE <> 2 Then - DivCargaComprobante.Visible = True - If ObjIE.Comprobante <> "" Then - TdNotaComprobante.Visible = True - End If - End If - - If ObjIE.Comprobante <> "" Then - HplComprobante.Visible = True - HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}", UsuarioActual.CveEmpresa, ObjIE.Comprobante) - End If - - If CveIEDeposito > 0 Then - Dim SbMensaje As New StringBuilder() - Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIE}&CuentaCaja={CuentaDepositoPadre}&CuentaDepo={Cuenta}") - HplListaProveedores.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncript}" - - Else - HplListaProveedores.NavigateUrl = String.Format("/Bancos/Reportes.aspx?Opcion=ImprimeMov&CveIE={0}", ObjIE.CveIE) - End If - If CveIEDeposito2 > 0 Then - divDepositado.Visible = True - HplDepositado.NavigateUrl = $"/Bancos/IE.aspx?CveIE={CveIEDeposito2}" - End If - - - CargaEventoBitacora() - CargaGvBitacora() - 'Carga Cuenta Deposito o activa para seleccionar una - If ObjIE.CuentaDepositado <> "" Then - TrCuentaDepositado.Visible = True - LitDepositado.Text = ObjIE.CuentaDepositado - Else - - If DdlTipoTransaccion.SelectedValue = "9" Then - Dim Dep As New ClsGenerales - If Dep.GetCuentasDepositos(CveProveedor:=ObjIE.CveProveedor) Then - DdlCuentaDeposito.DataSource = Dep.DtResultados - If Dep.DtResultados.Rows.Count > 0 Then - trCuentaDeposito.Visible = True - DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) - 'ElseIf Dep.DtResultados.Rows.Count = 1 Then - ' TrCuentaDepositado.Visible = True - ' LitTextoDepositado.Text = "Cuenta Depósito" - ' LitDepositado.Text = Dep.DtResultados.Rows(0)("CuentaDeposito").ToString - 'End If - End If - End If - Dep.Dispose() - DdlCuentaDeposito.DataBind() - UpCuentaDeposito.Update() - End If - - End If - - LnkComplementoPago.Visible = True - - - - If ObjIE.CveEstatusIE = 1 AndAlso ObjIE.CveIECancelado > 0 Then - 'cuando es cheque devuelto - TabCancelacion.Visible = True - LbUsuarioCancelacion.Text = ObjIE.UsuarioCancelacion - LbFechaCancelacion.Text = If(ObjIE.FechaCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaCancelacion.ToShortDateString) - LbFechaIngCancelacion.Text = "" ' If(ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaIngCancelacion.ToShortDateString) - - TrIECancelacion.Visible = True - LbMovimientoCancelado.Text = "Movimiento:" - HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelado) - HLIECancelacion.Text = ObjIE.FolioIECancelado - LnkCancelar.Visible = False - - End If - - - 'DATOS DE CANCELACION - If ObjIE.CveEstatusIE = 2 Then - TabCancelacion.Visible = True - LbUsuarioCancelacion.Text = ObjIE.UsuarioCancelacion - LbFechaCancelacion.Text = ObjIE.FechaCancelacion.ToShortDateString - LbFechaIngCancelacion.Text = If(ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaIngCancelacion.ToShortDateString) - - 'MOVIMIENTO CANCELACION - If ObjIE.CveIECancelacion > 0 Then - TrIECancelacion.Visible = True - LbMovimientoCancelado.Text = "Movimiento de Cancelación:" - HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelacion) - HLIECancelacion.Text = ObjIE.FolioIECancelacion - End If - - 'MOVIMIENTO CANCELADO - If ObjIE.CveIECancelado > 0 Then - TrIECancelacion.Visible = True - LbMovimientoCancelado.Text = "Movimiento Cancelado:" - HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelado) - HLIECancelacion.Text = ObjIE.FolioIECancelado - End If - - 'Esconde datos que no tenemos - If ObjIE.UsuarioCancelacion = "" Then TrUsuarioCancelacion.Visible = False - If ObjIE.FechaCancelacion.ToShortDateString = "01/01/0001" Then TrFechaCancelacion.Visible = False - If ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001" Then TrFechaIngCancelacion.Visible = False - - End If - UpCancelacion.Update() - - 'OTROS DATOS - DATOS COMPLEMENTO SUSTITUCION - Dim CveIESustitucion As Integer = ObjIE.DtResultados(0)("CveIESustitucion").ToString.ToEntero - If CveIESustitucion > 0 Then - TRComplementoSustitucion.Visible = True - - If ObjIE.GetBancosIE(CveIESustitucion, UsuarioActual.CveEmpresa) And ObjIE.DtResultados.Rows.Count > 0 Then - ARefIESustitucion.HRef = String.Format("/Bancos/IE.aspx?CveIE={0}", CveIESustitucion) - ARefIESustitucion.InnerText = ObjIE.Folio - End If - - End If - - - 'DETALLES - MOVIMIENTOS - If ObjIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then - GvM.DataSource = ObjIE.DtResultados - - If UsuarioActual.TienePermisoProceso(277) AndAlso Not TabCancelacion.Visible Then - GvM.Columns(8).Visible = True - End If - - If ObjIE.DtResultados.FiltraParametros("TCPago > 1").Rows.Count.ToEntero() > 0 Then - GvM.Columns(7).Visible = True - End If - - If ObjIE.DtResultados.FiltraParametros("CveMonedaIE <> CveMoneda").Rows.Count.ToEntero > 0 Then - GvM.Columns(5).Visible = True - GvM.Columns(6).Visible = True - End If - - GvM.DataBind() - - End If - - 'Movimientos Relacionados Padre - If ObjIE.GetBancosIEMovimientosPadre(CveIE, UsuarioActual.CveEmpresa) Then - If ObjIE.DtResultados.FiltraParametros("TCPago > 1").Rows.Count.ToEntero() > 0 Then - GvRP.Columns(5).Visible = True - End If - - GvRP.DataSource = ObjIE.DtResultados - GvRP.DataBind() - End If - - 'Movimientos Relacionados Hijo - If ObjIE.GetBancosIEMovimientosHijo(CveIE, UsuarioActual.CveEmpresa) Then - DtGvRH = ObjIE.DtResultados - CargaGvRH() - If UsuarioActual.TienePermisoProceso(80) Then GvRH.Columns(5).Visible = True - End If - + Private Property PermisoComplementoVigente As Boolean + Get + If ViewState("PermisoComplementoVigente") Is Nothing Then + Return False Else - Alert("El Documento solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - - - If Not ChkConciliado.Checked Then + Return CBool(ViewState("PermisoComplementoVigente")) + End If + End Get + Set(value As Boolean) + ViewState("PermisoComplementoVigente") = value + End Set + + End Property + + +#Region "CANCELACIÓN COMPLEMENTO MODAL V2" + + Property CveComplementoPagoCancelar As Integer + Get + If ViewState("CveComplementoPagoCancelar") Is Nothing Then + Return -1 + Else + Return ViewState("CveComplementoPagoCancelar").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveComplementoPagoCancelar") = value + End Set + End Property + + Property FolioFiscalCancelar As String + Get + If ViewState("FolioFiscalCancelar") Is Nothing Then + Return "" + Else + Return ViewState("FolioFiscalCancelar").ToString + End If + End Get + Set(value As String) + ViewState("FolioFiscalCancelar") = value + End Set + End Property + + + Property RFCReceptorCancelar As String + Get + If ViewState("RFCReceptorCancelar") Is Nothing Then + Return "" + Else + Return ViewState("RFCReceptorCancelar").ToString + End If + End Get + Set(value As String) + ViewState("RFCReceptorCancelar") = value + End Set + End Property + + Property CvePACCancelacion As Integer + Get + If ViewState("CvePACCancelacion") Is Nothing Then + Return -1 + Else + Return ViewState("CvePACCancelacion").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CvePACCancelacion") = value + End Set + End Property + +#End Region + + + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + + Folio = "" + IDCtaBeneficiario = 0 + IDCtaBeneficiarioComplementaria = 0 + IDCtaContable = 0 + IdCtaAnticipoComplementaria = 0 + IdCtaAnticipoExtranjera = 0 + CveCuentaBeneficiario = 0 + CveCuentaConta = 0 + DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True + TxtImporte.Attributes.Add("onblur", "upIE(this);FncImporteCuenta(this);") + 'Calendario.StartDate = Now.AddMonths(-2).FirstDayOfMonth() + ViewState("IDPoliza") = "-1" + CveIEDeposito = -1 + CveIEDeposito2 = -1 + CveOCSolicitudAnticipo = -1 + CveMoneda = -1 'SOLO SE UTILIZA PARA SOLICITUD DE ANTICIPO DE OC - CUANDO SE USE PARA ALGO MAS, INDIQUENLO AQUI + CvePrePoliza = -1 + CveSolicitudViatico = -1 + ComplementoSerieFolio = "" + TxtFechaDevuelto.Text = Now.ToShortDateString + TxtFechaCancelacion.Text = Now.ToShortDateString + CveCompraDeCDin = -1 + 'If UsuarioActual.CveEmpresa.Contiene(66) Then trNotificar.Visible = True + + 'Guarda el modo actual de la pagina + Opcion = If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "-1") + + Session("FileUpload") = "" + TRCveIE.Visible = False + + CargaTipoTransaccion() + CargaMoneda() + CargaCuenta() + CargaDDLPersonal() + + DdlProveedores.setEsWebService(True) + DdlProveedores.Attributes.Add("data-metodo", "getproveedores") + + DdlCliente.setEsWebService(True) + DdlCliente.Attributes.Add("data-metodo", "getcliente") + + Dim ObjIE As New ClsBancos + 'Carga Estatus IE + If ObjIE.GetBancos_EstatusIE() Then + DdlEstatusIE.DataSource = ObjIE.DtResultados + DdlEstatusIE.DataBind() + End If + ObjIE.Dispose() + + If Request("CveOrdenCompra") IsNot Nothing AndAlso IsNumeric(Request("CveOrdenCompra")) AndAlso Request("CveOrdenCompra").ToEntero > 0 Then + CveOrdenCompra = Request("CveOrdenCompra").ToEntero + End If + + If Request("CveProveedor") IsNot Nothing AndAlso IsNumeric(Request("CveProveedor")) AndAlso Request("CveProveedor").ToEntero > 0 Then + CveProveedor = Request("CveProveedor").ToEntero + + CargaProveedor(CveProveedor, "-1") + End If + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then + LblPagueseA.Text = "" + LblPagueseA.Visible = False + Dim Dt As DataTable = Nothing + Dim Banc As New ClsBancos + Dim CveCredito As Integer = -1 + Dim CveCreditoDetalle As Integer = -1 + CveCredito = IfNull(Request("CveCredito"), "-1").ToString.ToEntero + CveCreditoDetalle = IfNull(Request("CveCreditoDetalle"), "-1").ToString.ToEntero + LtlTitulo.Text = "Pago de Créditos" + + DVInteresMoratorio.Visible = True + + If Banc.GetCreditos(CveCredito, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + Dt = Banc.DtResultados - If (Not VerificaComplementos(True)) And UsuarioActual.TienePermisoProceso(99) And ObjIE.CveEstatusIE <> 2 Then - BtnEditar.Visible = True End If - UpGuardar.Update() + Banc.Dispose() + PnlFyE.Visible = False + + PnlCredito.Visible = True + + DdlFinanciera.DataSource = Dt.FiltraParametros("", DistinctColumns:={"CveProveedor", "Proveedor"}, Orderby:="Proveedor") + DdlFinanciera.DataBind() + + If DdlFinanciera.SelectedValue.ToEntero > 0 Then + CargaProveedor(DdlFinanciera.SelectedValue.ToEntero, "-1") + Else + Alert("No se pudieron cargar los datos del proveedor", TipoMensaje.MsgAdvertencia) + End If + + + If DdlFinanciera.SelectedValue.ToEntero > 0 Then + DdlCredito.DataSource = Dt.FiltraParametros(String.Format("CveProveedor = {0} And EstatusNum In (1,2,101,102)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito") + DdlCredito.DataBind() + End If + DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1")) + + If CveCredito > 0 Then + 'le asigno el valor + DdlCredito.SelectedValue = CveCredito.ToString + If CveCreditoDetalle > 0 Then + + CargaCreditosDetalle(CveCreditoDetalle) + + End If + End If End If + If Request("CveIE") IsNot Nothing AndAlso IsNumeric(Request("CveIE")) AndAlso Request("CveIE").ToEntero > 0 Then + ViewState("CveIE") = Request("CveIE") + 'Configuración de Modalidad Update + TxtFolio.Enabled = False + TxtFechaDocumento.Enabled = False + Calendario.Enabled = False + TxtImporte.Enabled = False + TxtImporteLetra.Enabled = False + DdlMoneda.Enabled = False + TxtTipoCambio.Enabled = False + DdlCuenta.Enabled = False + 'DdlTipo.Enabled = False + DdlTipoTransaccion.Enabled = False + TxtObservaciones.Enabled = False + ChkAplicaImpuestos.Enabled = False + ChkAbonoCuenta.Enabled = False + Anexo.Visible = False + DdlCliente.Enabled = False + DdlProveedores.Enabled = False + DdlPersonal.Visible = False + + + CargaDatos() + + BtnGuardar.Visible = False + LtlTitulo.Text = "Consulta del Ingreso/Egreso:" + 'ImgAddObs.Attributes.Add("onclick", "javascript:PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ") + HlEvento.Visible = True + HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveIE=" & CveIE & "&TB_iframe=true&height=370&width=600;" + + Else + 'Configuración de Modalidad Insert + ImgAddObs.Visible = False + CveIE = -1 + TxtFechaDocumento.Text = Now.ToShortDateString + ImgUpdateCuentaDeposito.Visible = False + End If + + InicializaSolicitudAnticipoOC() + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSSINFACT") AndAlso UsuarioActual.CveEmpresa = 119 Then + RBL.Items.Add(New ListItem("Acreedores Diversos", "AC")) + End If + + + + If TabCancelacion.Visible Then + LnkCancelar.Visible = False + LnkCancelarComplemento.Visible = False + LnkEliminar.Visible = False + LnkCancelarComplementoImporte.Visible = False + End If + + UppEliminarIE.Update() + + InicializaActualizarTC() + + '22/06/2018 - VIATICOS + If Request("CveSolicitudViatico") IsNot Nothing AndAlso IsNumeric(Request("CveSolicitudViatico")) AndAlso Request("CveSolicitudViatico").ToEntero > 0 Then + CargaDatosViaticos() + End If + + '14/08/2018- PERMISO PARA EDITAR FOLIO + If UsuarioActual.TienePermisoProceso(246) Then + TxtFolio.Enabled = True + End If + + InicializaDevolverDinero() + + If UsuarioActual.TienePermisoProceso(275) And CveIE > 0 Then + LnkAjustarMovimiento.Visible = True + End If + + 'If Not VerificaComplementos(True) Then + + ' LnkCancelarComplemento.Visible = False + ' LnkCancelarComplementoImporte.Visible = False + + + ' UppEliminarIE.Update() + + + 'End If + + End If + End Sub + +#Region " CARGA DATOS " + Private Sub CargaDatos() + Dim ObjIE As New ClsBancos() + Dim ObjIE2 As New ClsBancos() + If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + If ObjIE.DtResultados.Rows.Count > 0 Then + + Try + Tipo = ObjIE.DtResultados.Rows(0)("Tipo").ToString + Catch ex As Exception + + End Try + + CveIEDeposito = ObjIE.DtResultados(0)("CveIEDepositoPadre").ToString.ToEntero + CuentaDepositoPadre = ObjIE.DtResultados(0)("CuentaDepositoPadre").ToString + Cuenta = ObjIE.DtResultados(0)("NumCuenta").ToString + + CveIEDeposito2 = ObjIE.DtResultados(0)("CveIEDeposito2").ToString.ToEntero + + If UsuarioActual.TienePermisoProceso(99) Then + 'BtnActualizar.Visible = True + TxtFechaDocumento.Enabled = True + Calendario.Enabled = True + End If + + If ObjIE.CveEstatusNotificacion > 0 Then + trNotificacion.Visible = True + LtNotificacion.Text = If(ObjIE.CveEstatusNotificacion = 1, "Notificado", String.Format("Entregado el {0} - {1}", ObjIE.FechaEntrega, ObjIE.ObservacionEntrega)) + End If + + 'Pestaña Datos Generales + TxtCveIE.Text = ObjIE.CveIE.ToString + CveCuenta = ObjIE.CveCuenta + RBL.Visible = False + RegistraScript("if($get('imgBuscarProveedor')) $get('imgBuscarProveedor').style.display='none';") + 'DdlBanco.SelectedValue = ObjIE.CveBanco.ToString + + DdlTipoTransaccion.SelectedValue = ObjIE.CveTipoTransaccion.ToString + + + DdlCuenta.SelectedValueExist(ObjIE.CveCuenta.ToString) + DdlCuenta.Visible = False + + If ObjIE.DtResultados.Rows(0)("CveCuentaTarjeta").ToString.ToEntero > 0 Then + DivTarjetaCredito.Visible = True + LblInfoTarjeta.Text = ObjIE.DtResultados.Rows(0)("NumeroTarjeta").ToString + LblInfoTarjeta.Font.Bold = True + + UpInfoTarjeta.Update() + End If + + LblCuenta.Text = ObjIE.BancoNumCuentaMoneda + ViewState("CvePrePoliza") = ObjIE.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero + TxtFechaDocumento.Text = ObjIE.FechaDocumento.ToShortDateString + TxtFolio.Text = ObjIE.Folio + LblBeneficiario.Text = ObjIE.PagueseA + TxtImporte.Text = ObjIE.Importe.FormatoNumero + TxtImporteLetra.Text = ObjIE.Importe.Texto2Letras(ObjIE.CveMoneda) + DdlMoneda.SelectedValue = ObjIE.CveMoneda.ToString + If ObjIE.TipoCambio > 0 Then + TrTipoCambio.Visible = True + Else + TrTipoCambio.Visible = False + End If + TxtTipoCambio.Text = ObjIE.TipoCambio.ToString + TxtObservaciones.Text = ObjIE.Observaciones + If Year(ObjIE.FechaAplicado) > 1 Then TxtFechaAplicado.Text = ObjIE.FechaAplicado.ToShortDateString + + ChkAbonoCuenta.Checked = ObjIE.EsAbonoEnCuenta + 'ChkAplicaImpuestos.Checked = ObjIE.AplicaImpuestos + 'ChkImpreso.Checked = ObjIE.FueImpreso + ChkConciliado.Checked = ObjIE.FueConciliado + + DdlEstatusIE.SelectedValue = ObjIE.CveEstatusIE.ToString + DdlEstatusIE.Visible = False + LblEstatusIE.Visible = True + LblEstatusIE.Text = ObjIE.EstatusIE.ToString + + If ObjIE.CveTipoTransaccion.Contiene(3, 4) Then 'cuando es cheque recibido + LnkChqDevuelto.Visible = True + End If + + 'saco el tipo de transaccion + Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", ObjIE.CveTipoTransaccion)) 'Egs o Ing + If dr IsNot Nothing Then + If dr("Tipo").ToString = "Egs" Then + LblPagueseA.Text = "Beneficiario" + Else + LblPagueseA.Text = "Pagador" + End If + + 'Detectamos a quien se le hizo el cobro (Cliente, proveedor, Funcionario/Empleado, etc.) + If ObjIE2.GetPrePolizasDetalle(-1, CveIE) Then + If ObjIE2.DtResultados.Rows.Count > 0 Then + + Dim CveConceptoContable As Integer = ObjIE2.DtResultados.FiltroPrimeroValor("CveConceptoContable", "CveConceptoContable <> 30 and CveConceptoContable <> 61").ToEntero + CveCliente = ObjIE2.DtResultados.Rows(0)("CveCliente").ToString.ToEntero + CvePersonal = ObjIE2.DtResultados.Rows(0)("CvePersonal").ToString.ToEntero + CveProveedor = ObjIE2.DtResultados.Rows(0)("CveProveedor").ToString.ToEntero + + Select Case CveConceptoContable + Case 66 + If ObjIE2.DtResultados.FiltraParametros("CveConceptoContable <> 30 and CveConceptoContable <> 60").Rows(0)("CveCliente").ToString.ToEntero > 0 Then + LblRecibidoPorNombre.Text = "Clientes" + PnlRecibidoPor.Visible = True + End If + Case 37 + '' ElseIf ObjIE2.DtResultados.FiltraParametros("CveConceptoContable <> 30 and CveConceptoContable <> 60").Item(0)("CveProveedor").ToString.ToEntero > 0 Then + LblRecibidoPorNombre.Text = "Deudores Diversos" + PnlRecibidoPor.Visible = True + + End Select + End If + End If + End If + + If CveCliente > 0 Then + DdlCliente.SelectedText = ObjIE.PagueseA + DdlCliente.SelectedValue = CveCliente.ToString + + DdlCliente.Visible = False + DdlCliente.Enabled = False + + LblPagarA.Visible = True + LblPagarA.Text = ObjIE.PagueseA + + ' LnkEmitirComplemento.Visible = True + ElseIf CveProveedor > 0 Then + DdlProveedores.SelectedText = ObjIE.PagueseA + DdlProveedores.SelectedValue = CveProveedor.ToString + DdlProveedores.Visible = False + DdlProveedores.Enabled = False + + LblPagarA.Visible = True + LblPagarA.Text = ObjIE.PagueseA + + + 'Se prepara para la generacion del envio de correo con notificacion de pago + LnkEnviarMailPago.Attributes.Add("onclick", "$('#ModalDivMail').modal();") + LnkEnviarMailPago.Visible = True + CargaProveedor(CveProveedor, "-1") + ElseIf CvePersonal > 0 Then + PersonalIndexChange(CvePersonal) + DdlPersonal.Visible = True + DdlPersonal.Enabled = False + End If + + IDPoliza = ObjIE.IDPoliza + IDCtaContable = ObjIE.IdCtaContable + CveCuentaConta = ObjIE.CveCuentaConta + + + If ObjIE.IDPoliza > 0 Then + + If UsuarioActual.TienePermisoProceso(107) Then + BtnDescontabilizar.Visible = True + End If + BtnContabilizar.Visible = False + HplIrPoliza.Visible = True + HplIrPoliza.NavigateUrl = String.Format("/Contabilidad/RegPoliza.aspx?IdPoliza={0}", ObjIE.IDPoliza) + 'ImgEliminarMovimiento.OnClientClick = "return confirm('Esta seguro de eliminar el documento y su póliza?');" + LnkEliminar.OnClientClick = "return confirm('¿Está seguro de eliminar el documento y su póliza?');" + + EstaContabilizado = True + Else + BtnContabilizar.Visible = True + BtnDescontabilizar.Visible = False + HplIrPoliza.Visible = False + + EstaContabilizado = False + End If + UPPDesContabilizar.Update() + + 'ImgImprimir.Visible = True + LblRegistroFecha.Text = ObjIE.FechaIng.ToShortDateString + LblRegistroUsuario.Text = ObjIE.Usuario + + CveEstatusIE = ObjIE.CveEstatusIE + + Select Case ObjIE.CveEstatusIE + Case 1 + If Not ObjIE.FueConciliado Then + 'If UsuarioActual.TienePermisoProceso(85) Then ImgCancelarMovimiento.Visible = True + If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True + + 'ELIMINAR IE SIN VALIDACIONES + If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + + 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + LnkEliminar.Visible = True + End If + End If + + ''COMENTAR - solo para pruebas + 'If UsuarioActual.TienePermisoProceso(85) Then LnkCancelar.Visible = True + 'If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + + ImprimirIEPDF(ObjIE.CveTipoTransaccion) + + Case 2 + LblEstatus.Text = ObjIE.EstatusIE + LblEstatus.ForeColor = Drawing.Color.Red + + 'ELIMINAR IE SIN VALIDACIONES + If UsuarioActual.TienePermisoProceso(80) Then LnkEliminar.Visible = True + + 'ELIMINA IE CUANDO ES EL MISMO USUARIO QUE LO CREO Y QUE NO ESTE CONTABILIZADO NI CONCILIADO + If UsuarioActual.TienePermisoProceso(154) AndAlso ObjIE.CveUsuario = UsuarioActual.CveUsuario And Not ObjIE.IDPoliza > 0 Then + LnkEliminar.Visible = True + End If + + If UsuarioActual.CveUsuario = 100 Then + ImprimirIEPDF(ObjIE.CveTipoTransaccion) + End If + 'FALTA AFECTAR POLIZA NEGATIVA + 'If UsuarioActual.TienePermisoProceso(136) Then LnkEliminar.Visible = True + End Select + + 'Mostramos seccion cargar comprobante si no tiene estatus cancelado + If ObjIE.CveEstatusIE <> 2 Then + DivCargaComprobante.Visible = True + If ObjIE.Comprobante <> "" Then + TdNotaComprobante.Visible = True + End If + End If + + If ObjIE.Comprobante <> "" Then + HplComprobante.Visible = True + HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}", UsuarioActual.CveEmpresa, ObjIE.Comprobante) + End If + + If CveIEDeposito > 0 Then + Dim SbMensaje As New StringBuilder() + Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIE}&CuentaCaja={CuentaDepositoPadre}&CuentaDepo={Cuenta}") + HplListaProveedores.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncript}" + + Else + HplListaProveedores.NavigateUrl = String.Format("/Bancos/Reportes.aspx?Opcion=ImprimeMov&CveIE={0}", ObjIE.CveIE) + End If + If CveIEDeposito2 > 0 Then + divDepositado.Visible = True + HplDepositado.NavigateUrl = $"/Bancos/IE.aspx?CveIE={CveIEDeposito2}" + End If + + LnkCancelarComplemento.Visible = False + LnkCancelarComplementoImporte.Visible = False + UppEliminarIE.Update() + + + CargaEventoBitacora() + CargaGvBitacora() + 'Carga Cuenta Deposito o activa para seleccionar una + If ObjIE.CuentaDepositado <> "" Then + TrCuentaDepositado.Visible = True + LitDepositado.Text = ObjIE.CuentaDepositado + Else + + If DdlTipoTransaccion.SelectedValue = "9" Then + Dim Dep As New ClsGenerales + If Dep.GetCuentasDepositos(CveProveedor:=ObjIE.CveProveedor) Then + DdlCuentaDeposito.DataSource = Dep.DtResultados + If Dep.DtResultados.Rows.Count > 0 Then + trCuentaDeposito.Visible = True + DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + 'ElseIf Dep.DtResultados.Rows.Count = 1 Then + ' TrCuentaDepositado.Visible = True + ' LitTextoDepositado.Text = "Cuenta Depósito" + ' LitDepositado.Text = Dep.DtResultados.Rows(0)("CuentaDeposito").ToString + 'End If + End If + End If + Dep.Dispose() + DdlCuentaDeposito.DataBind() + UpCuentaDeposito.Update() + End If + + End If + + LnkComplementoPago.Visible = True + + + + If ObjIE.CveEstatusIE = 1 AndAlso ObjIE.CveIECancelado > 0 Then + 'cuando es cheque devuelto + TabCancelacion.Visible = True + LbUsuarioCancelacion.Text = ObjIE.UsuarioCancelacion + LbFechaCancelacion.Text = If(ObjIE.FechaCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaCancelacion.ToShortDateString) + LbFechaIngCancelacion.Text = "" ' If(ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaIngCancelacion.ToShortDateString) + + TrIECancelacion.Visible = True + LbMovimientoCancelado.Text = "Movimiento:" + HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelado) + HLIECancelacion.Text = ObjIE.FolioIECancelado + LnkCancelar.Visible = False + + End If + + + 'DATOS DE CANCELACION + If ObjIE.CveEstatusIE = 2 Then + TabCancelacion.Visible = True + LbUsuarioCancelacion.Text = ObjIE.UsuarioCancelacion + LbFechaCancelacion.Text = ObjIE.FechaCancelacion.ToShortDateString + LbFechaIngCancelacion.Text = If(ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001", "", ObjIE.FechaIngCancelacion.ToShortDateString) + + 'MOVIMIENTO CANCELACION + If ObjIE.CveIECancelacion > 0 Then + TrIECancelacion.Visible = True + LbMovimientoCancelado.Text = "Movimiento de Cancelación:" + HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelacion) + HLIECancelacion.Text = ObjIE.FolioIECancelacion + End If + + 'MOVIMIENTO CANCELADO + If ObjIE.CveIECancelado > 0 Then + TrIECancelacion.Visible = True + LbMovimientoCancelado.Text = "Movimiento Cancelado:" + HLIECancelacion.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", ObjIE.CveIECancelado) + HLIECancelacion.Text = ObjIE.FolioIECancelado + End If + + 'Esconde datos que no tenemos + If ObjIE.UsuarioCancelacion = "" Then TrUsuarioCancelacion.Visible = False + If ObjIE.FechaCancelacion.ToShortDateString = "01/01/0001" Then TrFechaCancelacion.Visible = False + If ObjIE.FechaIngCancelacion.ToShortDateString = "01/01/0001" Then TrFechaIngCancelacion.Visible = False + + End If + UpCancelacion.Update() + + 'OTROS DATOS - DATOS COMPLEMENTO SUSTITUCION + Dim CveIESustitucion As Integer = ObjIE.DtResultados(0)("CveIESustitucion").ToString.ToEntero + If CveIESustitucion > 0 Then + TRComplementoSustitucion.Visible = True + + If ObjIE.GetBancosIE(CveIESustitucion, UsuarioActual.CveEmpresa) And ObjIE.DtResultados.Rows.Count > 0 Then + ARefIESustitucion.HRef = String.Format("/Bancos/IE.aspx?CveIE={0}", CveIESustitucion) + ARefIESustitucion.InnerText = ObjIE.Folio + End If + + End If + + + 'DETALLES - MOVIMIENTOS + If ObjIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then + GvM.DataSource = ObjIE.DtResultados + + If UsuarioActual.TienePermisoProceso(277) AndAlso Not TabCancelacion.Visible Then + GvM.Columns(8).Visible = True + End If + + If ObjIE.DtResultados.FiltraParametros("TCPago > 1").Rows.Count.ToEntero() > 0 Then + GvM.Columns(7).Visible = True + End If + + If ObjIE.DtResultados.FiltraParametros("CveMonedaIE <> CveMoneda").Rows.Count.ToEntero > 0 Then + GvM.Columns(5).Visible = True + GvM.Columns(6).Visible = True + End If + + GvM.DataBind() + + End If + + 'Movimientos Relacionados Padre + If ObjIE.GetBancosIEMovimientosPadre(CveIE, UsuarioActual.CveEmpresa) Then + If ObjIE.DtResultados.FiltraParametros("TCPago > 1").Rows.Count.ToEntero() > 0 Then + GvRP.Columns(5).Visible = True + End If + + GvRP.DataSource = ObjIE.DtResultados + GvRP.DataBind() + End If + + 'Movimientos Relacionados Hijo + If ObjIE.GetBancosIEMovimientosHijo(CveIE, UsuarioActual.CveEmpresa) Then + DtGvRH = ObjIE.DtResultados + CargaGvRH() + If UsuarioActual.TienePermisoProceso(80) Then GvRH.Columns(5).Visible = True + End If + + Else + Alert("El Documento solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnGuardar.Enabled = False + End If + + '2019-08-28 unificados vista de controles complemento (Cancelado, conciliciado, Con complemento vigente, sin complemento vigente) + Dim ExistenComplementosVigentes As Boolean = VerificaComplementos(True) + Dim ExistenComplementos As Boolean = VerificaComplementos(False) + + If Not ChkConciliado.Checked And ObjIE.CveEstatusIE <> 2 Then + + If (Not ExistenComplementosVigentes) Then + + If UsuarioActual.TienePermisoProceso(99) Then ' Proceso 99 Editar IE + BtnEditar.Visible = True + PermisoComplementoVigente = True + End If + DVGenerarComplementoModal.Visible = True + BtnEditar.Visible = True + + Else + + If UsuarioActual.TienePermisoProceso(99) Then + BtnEditar.Visible = True + PermisoComplementoVigente = True + Else + BtnEditar.Visible = False + End If + + LnkEliminar.Visible = False + LnkCancelar.Visible = False + + LnkCancelarComplemento.Visible = True + LnkCancelarComplementoImporte.Visible = True + + End If + + + Else + BtnEditar.Visible = False + LnkEliminar.Visible = False + LnkCancelarComplemento.Visible = False + LnkCancelarComplementoImporte.Visible = False + DVGenerarComplementoModal.Visible = False + End If + + UpGuardar.Update() + + End If + - End If - - 'If CveIE > 0 Then - ' DdlProveedores.Visible = False - ' LblBeneficiario.Visible = True - ' LblBeneficiario.Text = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {CveProveedor}")(0)("RazonSocial").ToString - 'End If - - - - RecargaGlobalCuentasBancarias() ObjIE.Dispose() ObjIE2.Dispose() @@ -1117,8 +1140,8 @@ Partial Class Bancos_IE GvRH.DataSource = DtGvRH GvRH.DataBind() UpGvRH.Update() - End Sub - + End Sub + #Region " CARGA PROVEEDOR " Protected Sub DdlProveedores_selectedindexchange(sender As Object, e As EventArgs) HdnCveProveedor.Value = DdlProveedores.SelectedValue @@ -1187,10 +1210,10 @@ Partial Class Bancos_IE If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If IDCtaBeneficiario = 0 And UsuarioActual.Empresa.UsaContabilidad Then + If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" Then Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False - ElseIf CveCuentaBeneficiario = 0 And UsuarioActual.Empresa.UsaContabilidadSIG Then + ElseIf CveCuentaBeneficiario = 0 AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then Alert("El Beneficiario no tiene cuenta contable vinculada en SIG. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False Else @@ -1205,9 +1228,9 @@ Partial Class Bancos_IE End If End If ObjProveedor.Dispose() - End Sub + End Sub #End Region - + #Region " CARGA CLIENTE " Protected Sub DdlCliente_selectedindexchange(sender As Object, e As EventArgs) HdnCveCliente.Value = DdlCliente.SelectedValue @@ -1240,7 +1263,7 @@ Partial Class Bancos_IE End If If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False ElseIf CveCuentaBeneficiario = 0 AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then @@ -1259,9 +1282,9 @@ Partial Class Bancos_IE End If End If ObjCliente.Dispose() - End Sub + End Sub #End Region - + #Region " CARGA PERSONAL " Protected Sub CargaDDLPersonal() Dim ObjPersonal As New ClsRH @@ -1300,7 +1323,7 @@ Partial Class Bancos_IE CveCuentaBeneficiario = ObjPersonal.CveCuentaPersonal If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False ElseIf CveCuentaBeneficiario = 0 AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then @@ -1318,9 +1341,9 @@ Partial Class Bancos_IE End If End If ObjPersonal.Dispose() - End Sub + End Sub #End Region - + #Region " CARGA CUENTAS DEPOSITOS " Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged Dim valor As Integer = DirectCast(sender, DropDownList).SelectedValue.ToEntero @@ -1399,7 +1422,7 @@ Partial Class Bancos_IE DivTarjeta.Visible = False End If - If Not IDCtaContable > 0 AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If Not IDCtaContable > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then Alert("La Cuenta Bancaria no tiene asignada una cuenta contable", TipoMensaje.MsgAdvertencia) End If @@ -1411,9 +1434,9 @@ Partial Class Bancos_IE If trIEDevolucion.Visible And RBL.SelectedValue <> "C" Then CargaIEDevoluciones() End If - End Sub + End Sub #End Region - + #Region " CARGA CREDITOS - DETALLE " Protected Sub DdlFinanciera_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFinanciera.SelectedIndexChanged CargaCreditos(DdlFinanciera.SelectedValue.ToEntero) @@ -1514,12 +1537,12 @@ Partial Class Bancos_IE UpDatos.Update() - End Sub + End Sub #End Region #End Region - + #Region "PESTAÑA INFORMACION GENERAL DE BANCO IE" - + Private Sub CargaCuenta(Optional pCveMoneda As Integer = -1) DdlCuenta.Items.Clear() Dim dt As DataTable @@ -1601,11 +1624,11 @@ Partial Class Bancos_IE Private Sub CargaMoneda() DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataBind() - End Sub + End Sub #End Region - + #Region "VIATICOS" - + Private Function TimbrarNomina12(CvePersonal As Integer) As String Dim Retorno As String = "" @@ -1744,446 +1767,446 @@ Partial Class Bancos_IE objPersonal.Dispose() Return cfdi - End Function - - 'Private Function TimbrarBIInformNomina12(CveNomina As Integer, CvePersonal As Integer, CvePeriodo As Integer) As String - - ' If UsuarioActual.CveEmpresa = 8 Then - ' UsuarioActual.Empresa.FacturaProduccion = True - ' End If - ' 'UsuarioActual.Empresa.FacturaProduccion = False - - ' Dim MsgError As String = String.Empty - - ' Dim CFDi As New ClbNegBICFDv3_2.ClsNegEDI - ' CFDi.ObjCompNomina12 = New ClbNegBICFDv3_2.ClsNegComplementoNomina12() - ' 'CFDi.ObjCompNomina = New ClbNegBICFDv3_2.ClsNegCompNomina - - ' Dim objPersonal As New ClsRH - ' 'Dim objNomina As New ClsNominas - ' objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) - ' 'objNomina.GetNom_Nominas(CveNomina, CvePersonal, CvePeriodo, -1, UsuarioActual.CveEmpresa) - - - ' Dim Total As Decimal = 0 - ' Dim SubTotal As Decimal = 0 - ' Dim Descuentos As Decimal = 0 - ' Dim RetISR As Decimal = 0 - ' Dim TotalExcento As Decimal = 0 - ' Dim TotalGravado As Decimal = 0 - ' Dim TotalPercepciones As Decimal = 0 - ' Dim TotalDeducciones As Decimal = 0 - ' Dim TotalOtrosPagos As Decimal = 0 - - ' Dim Serie As String = "" - ' Dim Folio As String = "" - ' Dim NominaFolio As String = Serie & "-" & Folio - ' Dim RFC As String = objPersonal.RFC.Trim - ' Dim Nombre As String = objPersonal.NombreCompleto.Trim - ' Dim Direccion As String = String.Format("{0} {1} {2}", objPersonal.Calle.Trim, objPersonal.NumExt.Trim, objPersonal.NumInt.Trim).Trim - ' Dim Ciudad As String = objPersonal.Ciudad.Trim - ' Dim Estado As String = objPersonal.Estado.Trim - ' Dim CP As String = objPersonal.CP.Trim - - - - ' 'Dim TipoContrato As String = GlobalDTTiposContrato.FiltraParametros("CveTipoContrato = " + objPersonal.CveTipoContrato.ToString)(0)("TipoContrato").ToString - ' 'Dim TipoPeriodo As String = GlobalDTTipoPeriodo.FiltraParametros("CveTipoPeriodo = " + objPersonal.CveTipoPeriodo.ToString)(0)("TipoPeriodo").ToString - ' Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero - ' Dim FormatoReciboCFDi As String = objPersonal.FormatoReciboCFDi - - ' Dim FechaInicio, FechaFin, FechaPago As Date - ' Dim DiasPagados As Integer = 0 - ' Dim Msg As String = String.Empty - ' Dim DiasIncapacitados As Integer = 0 - ' Dim DrPeriodo As DataRow = Nothing - - ' Dim ObjFolio As New ClsGralFolios - ' If ObjFolio.GetFolios("VIA", UsuarioActual.CveEmpresa) Then - ' If ObjFolio.DtResultados.Rows.Count > 0 Then - ' Folio = ObjFolio.DtResultados.Rows(0)("FActual").ToString - ' End If - ' End If - - - ' 'If objNomina.GetPeriodos(-1, -1, -1, -1, CvePeriodo) Then - ' ' If objNomina.DtResultados.Rows().Count > 0 Then - ' ' DrPeriodo = objNomina.DtResultados.Rows(0) - ' ' End If - ' 'End If - ' 'Dim DrPeriodo As DataRow = GlobalDTNominasPeriodos(-1, CvePeriodo, -1).FiltroPrimero("") - ' If DrPeriodo IsNot Nothing Then - ' FechaInicio = DrPeriodo("FechaInicio").ToString.ToDate - ' FechaFin = DrPeriodo("FechaFin").ToString.ToDate - ' FechaPago = DrPeriodo("FechaPago").ToString.ToDate - ' If objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then - - ' Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero - ' Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero - ' DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero - ' DiasPagados = Asistencias - Vacaciones - ' If DiasPagados < 0 Then DiasPagados = 0 - - ' End If - - ' End If - - ' Dim DtPercepciones As Data.DataTable = Nothing - ' Dim DtDeducciones As Data.DataTable = Nothing - ' Dim DtOtrosPagos As Data.DataTable = Nothing - ' 'If objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then - ' ' If objNomina.DtResultados.Rows.Count > 0 Then - ' ' DtPercepciones = objNomina.DtResultados.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ") - ' ' DtDeducciones = objNomina.DtResultados.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ") - ' ' TotalPercepciones = DtPercepciones.SUM("Importe") - ' ' TotalDeducciones = DtDeducciones.SUM("Importe") - ' ' Total = CType((Total + DtPercepciones.SUM("Importe")), Decimal) - ' ' End If - ' 'End If - - ' 'Tipo Nomina O de Ordinaria o E de extraordinaria - ' 'Dim FechaPago As Date = Now - ' Dim TotalSueldos As Decimal = 0 - ' Dim TotalIndemnizacion As Decimal = 0 - ' Dim TotalJubilacion As Decimal = 0 - ' Msg = CFDi.ObjCompNomina12.Cargar("O", FechaPago, FechaInicio, FechaFin, DiasPagados, TotalPercepciones, TotalDeducciones, 0) - - - - ' If Msg = String.Empty Then - ' If DtPercepciones IsNot Nothing Then - ' If DtPercepciones.Rows.Count > 0 Then - ' TotalSueldos = DtPercepciones.SUM("Importe", "SATCveConcepto = '001'") - ' TotalIndemnizacion = DtPercepciones.SUM("Importe", "SATCveConcepto IN ('022','023','025')") ' https://www.ccpm.org.mx/avisos/nuevo-complemento-de-nomina-version-1.2-puntos-finos-diciembre-2016.pdf - ' TotalJubilacion = DtPercepciones.SUM("Importe", "SATCveConcepto IN ('039','044')") 'https://www.ccpm.org.mx/avisos/nuevo-complemento-de-nomina-version-1.2-puntos-finos-diciembre-2016.pdf - ' Msg = CFDi.ObjCompNomina12.CargarPercepciones(TotalSueldos, TotalIndemnizacion, TotalJubilacion, DtPercepciones.SUM("ImporteGravado").ToDecimal, DtPercepciones.SUM("ImporteExento").ToDecimal) - ' End If - ' For Each Row As DataRow In DtPercepciones.Rows - ' If Row("Importe").ToString.ToDecimal > 0 Then - ' If Row("CveSATConcepto").ToString = "" Then - ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) - ' Else - ' Msg = CFDi.ObjCompNomina12.AgregarPercepcion(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, Row("ImporteGravado").ToString.ToDecimal, Row("ImporteExento").ToString.ToDecimal) - ' TotalExcento = TotalExcento + Row("ImporteExento").ToString.ToDecimal - ' TotalGravado = TotalGravado + Row("ImporteGravado").ToString.ToDecimal - ' SubTotal = SubTotal + Row("Importe").ToString.ToDecimal - ' End If - - ' If Msg <> String.Empty Then - ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Percepcion", New Exception) - ' Exit For - ' End If - ' End If - ' 'RMF, falta poner el numero de horas pagadas - ' If Row("CveSATConcepto").ToString.ToEntero = 19 Then 'cuando son horas extras - - ' 'Obtengo el desglose de horas extras - - ' If objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then - - ' Dim dr As DataRow = objNomina.DtResultados.FiltroPrimero("") - ' If dr IsNot Nothing Then - - ' If dr("HorasDobles").ToString.ToDouble > 0 Then CFDi.ObjCompNomina12.AgregarHorasExtra(dr("DiasHorasDobles").ToString.ToEntero, ClbNegBICFDv3_2.TipoHoras.Dobles, dr("HorasDobles").ToString.ToEntero, Row("Importe").ToString.ToDecimal) - ' If dr("HorasTriples").ToString.ToDouble > 0 Then CFDi.ObjCompNomina12.AgregarHorasExtra(dr("DiasHorasTriples").ToString.ToEntero, ClbNegBICFDv3_2.TipoHoras.Triples, dr("HorasTriples").ToString.ToEntero, Row("Importe").ToString.ToDecimal) - - - ' End If - - - ' End If - - ' End If - ' Next - ' If Msg = "" Then - ' CFDi.ObjCompNomina12.ObjPercepciones.TotalExento = TotalExcento - ' CFDi.ObjCompNomina12.ObjPercepciones.TotalGravado = TotalGravado - ' End If - - ' End If - - ' 'cargo las incapacidades - ' If DiasIncapacitados > 0 Then - - ' If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then - - ' CFDi.ObjCompNomina12.CargarIncapacidades() - ' For Each dr As DataRow In objNomina.DtResultados.Rows - ' CFDi.ObjCompNomina12.AgregarIncapacidad(dr("Dias").ToString.ToDecimal, dr("ClaveTipoIncapacidad").ToString.ToEntero, dr("Descuento").ToString.ToDecimal) - ' Next - - ' End If - - ' End If - - - - ' TotalExcento = 0 - ' TotalGravado = 0 - - ' If Msg = String.Empty Then - ' If DtDeducciones IsNot Nothing Then - ' If DtDeducciones.Rows.Count > 0 Then - ' Total = CType((Total - DtDeducciones.SUM("Importe")), Decimal) - ' CFDi.ObjCompNomina12.CargarDeducciones(CType(DtDeducciones.SUM("ImporteGravado"), Decimal), CType(DtDeducciones.SUM("ImporteExento"), Decimal)) - ' End If - ' For Each Row As DataRow In DtDeducciones.Rows - - ' If Row("Importe").ToString.ToDecimal > 0 Then - ' If Row("CveSATConcepto").ToString = "" Then - ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) - ' Else - - ' Msg = CFDi.ObjCompNomina12.AgregarDeduccion(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, 0) - ' TotalExcento = TotalExcento + Row("ImporteExento").ToString.ToDecimal - ' TotalGravado = TotalGravado + Row("ImporteGravado").ToString.ToDecimal - - ' If Row("CveSATConcepto").ToString.ToEntero = 3 Then - ' RetISR = RetISR + Row("Importe").ToString.ToDecimal - ' Else - ' Descuentos = Descuentos + Row("Importe").ToString.ToDecimal - ' End If - ' End If - - ' If Msg <> String.Empty Then - ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Deduccion", New Exception) - ' Exit For - ' End If - ' End If - ' Next - ' If Msg = "" Then - ' If CFDi.ObjCompNomina12.ObjDeducciones IsNot Nothing Then - ' CFDi.ObjCompNomina12.ObjDeducciones.TotalOtrasDeducciones = Descuentos - ' CFDi.ObjCompNomina12.ObjDeducciones.TotalImpuestosRetenidos = RetISR - ' End If - - ' End If - ' End If - - ' If Msg = String.Empty Then - ' If DtOtrosPagos IsNot Nothing Then - ' If DtOtrosPagos.Rows.Count > 0 Then - ' Total = CType((Total - DtOtrosPagos.SUM("Importe")), Decimal) - ' CFDi.ObjCompNomina12.CargarOtrosPagos() - ' End If - - ' For Each Row As DataRow In DtOtrosPagos.Rows - ' If Row("Importe").ToString.ToDecimal > 0 Then - ' If Row("CveSATConcepto").ToString = "" Then - ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) - ' Else - ' Msg = CFDi.ObjCompNomina12.AgregarOtroPago(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, 0) - ' 'Msg = CFDi.ObjCompNomina12.CargarSubsidioAlEmpleo(0) - ' 'Msg = CFDi.ObjCompNomina12.CargarCompensacionSaldosAFavor(0, 0, 0) - ' End If - - ' If Msg <> String.Empty Then - ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Otros Pagos", New Exception) - ' Exit For - ' End If - ' End If - ' Next - - ' End If - - ' If Msg = String.Empty Then - ' Dim x As Integer = 0 - - ' Dim Moneda As String = "MXN" - ' Dim LugarExp As String = String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8} ", SucCalle, SucNoExt, SucNoInt, SucColonia, SucLocalidad, SucMunicipio, SucEstado, SucPais, SucCP) - ' Dim FechaFactura As DateTime = Now - ' 'Nodo Comprobante - - ' Dim TipoComprobante As ClbNegBICFDv3_2.TipoDeComprobante = ClbNegBICFDv3_2.TipoDeComprobante.egreso - ' Msg = CFDi.comprobantecfd(0, 0, Serie, Folio, FechaFactura, "PAGO EN UNA SOLA EXHIBICION", "CONTADO", SubTotal, Descuentos, "Deducciones nómina", "1", Moneda, Total, objPersonal.MetodoPagoSAT, ClbNegBICFDv3_2.TipoDeComprobante.egreso, LugarExp, "", "", "", New Date(1900, 1, 1), 0) - - ' If Msg = String.Empty Then - ' 'Nodo emisor - ' Msg = CFDi.ObjCompNomina12.CargarEmisor("", UsuarioActual.Empresa.RegistroPatronal, UsuarioActual.Empresa.RFC) - ' 'If Msg = String.Empty Then Msg = CFDi.EmisorRegimen(UsuarioActual.Empresa.CodigoRegimenFiscal) - ' If Msg = String.Empty Then - ' 'Nodo Entidad SNCF - ' If 1 = 2 Then 'cuando es gobierno - ' Msg = CFDi.ObjCompNomina12.CargarEntidadSNCF("", 0) - ' End If - - ' If Msg = String.Empty Then - ' 'Nodo Receptor - ' Msg = CFDi.ObjCompNomina12.CargarReceptor(objPersonal.CURP, objPersonal.NumeroSS, objPersonal.FechaInicioContrato, AntiguedadSemanas, objPersonal.TipoContrato, "", objPersonal.ClaveTipoJornada, objPersonal.CveRegimenContratacion, objPersonal.Codigo.ToString, - ' objPersonal.Departamento, objPersonal.Puesto, objPersonal.CveRiesgoPuesto, objPersonal.TipoPeriodo, objPersonal.ClaveBanco, objPersonal.BancoNumCuenta, Total, objPersonal.SDI.ToString.ToDecimal, objPersonal.ClaveEstado) - ' If Msg = String.Empty Then - ' 'Nodo SubContratacion - ' If 1 = 2 Then Msg = CFDi.ObjCompNomina12.AgregarSubContratacion("", 0) - ' If Msg = String.Empty Then - - ' CFDi.LstCompNomina12.Add(CFDi.ObjCompNomina12) - - ' Dim HasErrorConceptos As Boolean = False - ' 'Dim Importe As Decimal = 0 - - - ' Msg = CFDi.ConceptosCfd(1, "ACT", "", "Pago de nómina", SubTotal, SubTotal) - - ' 'Timbrado - - ' 'Web Services de producción: http://biinform.com.mx/srvCFDi/service1.asmx - ' 'Web Services de pruebasd: http://biinform.com.mx/srvCFDiPrueba/service1.asmx - - - ' Dim WS As String = String.Empty - ' If UsuarioActual.Empresa.FacturaProduccion Then - ' WS = "http://portalbiinform.com.mx/srvCFDiPrueba/service1.asmx" - ' Else - ' WS = "http://portalbiinform.com.mx/srvCFDiPrueba/service1.asmx" - ' End If - - ' If Not System.IO.Directory.Exists(Ruta & "XML\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\") - ' If Not System.IO.Directory.Exists(Ruta & "XML\Nomina\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\Nomina\") - - ' 'Generar Timbre - ' 'If UsuarioActual.Empresa.FacturaProduccion Then - ' If 1 = 2 Then - ' CFDi.Generar(String.Format("{0}Certificados\{1}", Ruta, UsuarioActual.Empresa.ArchivoPfx), - ' UsuarioActual.Empresa.ContraseñaKey, - ' String.Format("{0}Certificados\{1}", Ruta, UsuarioActual.Empresa.ArchivoCer), - ' String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), - ' String.Format("{0}Certificados\", Ruta), - ' UsuarioActual.Empresa.BIUsuario, - ' UsuarioActual.Empresa.BIContraseña, - ' WS, - ' True) - ' Else - ' If Not System.IO.Directory.Exists(Ruta & "XML\Nomina\Demo\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\Nomina\Demo\") - ' 'RutaPruebas & "XML\Demo\" & NominaFolio & ".xml", - ' CFDi.Generar(String.Format("{0}Certificados\aaa010101aaa__csd_01.pfx", RutaPruebas), - ' "12345678a", - ' String.Format("{0}Certificados\aaa010101aaa__csd_01.cer", RutaPruebas), - ' String.Format("{0}XML\Nomina\Demo\{1}.xml", Ruta, NominaFolio), - ' String.Format("{0}Certificados\", RutaPruebas), - ' "prueba", - ' "123", - ' WS, - ' True) - ' End If - - - ' If CFDi.MsgError <> String.Empty Then - - ' 'OnError("Ocurrió un error al generar el timbre: " & CFDi.MsgError, New Exception) - - ' Dim params As New ActualizaTimbre - ' params.Estatus = False - ' params.CveNomina = CveNomina - ' params.CvePAC = 1 - - ' 'Dim Hilo As New System.Threading.Thread(AddressOf ActualizaTimbrado) - ' 'Hilo.Start(params) - ' BtnAutorizar.Enabled = False - ' MsgError = "Nombre: " & Nombre & ". Error: " & CFDi.MsgError - ' Else - ' 'Actualiza Estatus Timbrado - ' Dim params As New ActualizaTimbre - ' params.Estatus = True - ' params.CveNomina = CveNomina - ' params.CvePAC = 1 - - ' 'Dim Hilo As New System.Threading.Thread(AddressOf ActualizaTimbrado) - ' 'Hilo.Start(params) - - ' Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - ' Dim FechaCertificacion As DateTime - ' Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String - - ' FolioFiscal = CFDi.Timbrado.UUDI 'XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText - ' NoSerieCertificado = CFDi.Timbrado.NoCertificadoSAT - ' FechaCertificacion = CFDi.Timbrado.FechaTimbrado - ' SelloCFDi = CFDi.Timbrado.SelloCFD - ' SelloSAT = CFDi.Timbrado.SelloSAT - ' NoSerieCertificadoContribuyente = CFDi.Timbrado.NoCertificado - ' ViewState("FolioFiscal") = FolioFiscal - - ' 'Actualiza Estatus Factura - ' CveNominaT = CveNomina - - ' Dim Rastro As String = String.Format("Nomina: CvePeriodo:{0}, CvePersonal:{1}, UUID: {2}, RFC:{3}", CvePeriodo, CvePersonal, FolioFiscal, objPersonal.RFC) - ' Rastro.GuardaLog() - - ' If FolioFiscal <> "" Then - - ' 'If UsuarioActual.Empresa.FacturaProduccion Then - ' ' Dim ObjNomina2 As New ClsNominas() - ' ' ObjNomina2.UpdateEstatusNomNominas(3, UsuarioActual.Empresa.CvePAC, FolioFiscal, "", ("01/01/2000").ToDate, CveNomina, SubTotal, Descuentos, RetISR, Total, DiasPagados) - ' ' ObjNomina2.Dispose() - ' 'End If - ' Rastro = "--Estatus" & Rastro - ' Rastro.GuardaLog() - ' 'Dim Hilo1 As New System.Threading.Thread(AddressOf ActualizaEstatus) - ' 'Hilo1.Start(3) - ' End If - - - ' Dim RutaCBB As String = String.Empty - ' If Not System.IO.Directory.Exists(Ruta & "CBB\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\") - ' If Not System.IO.Directory.Exists(Ruta & "CBB\Nomina\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\Nomina\") - - ' If UsuarioActual.Empresa.FacturaProduccion Then - ' RutaCBB = Ruta & "CBB\Nomina\" & NominaFolio & ".jpg" - ' Else - ' If Not System.IO.Directory.Exists(Ruta & "CBB\Nomina\Demo\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\Nomina\Demo\") - ' RutaCBB = Ruta & "CBB\Nomina\Demo\" & NominaFolio & ".jpg" - ' End If - ' CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFC, Total, FolioFiscal, RutaCBB) - - - ' 'GeneraPDF(FechaFactura, FolioFiscal, NoSerieCertificado, FechaCertificacion, NoSerieCertificadoContribuyente, TmpDT, SelloCFDi, SelloSAT, RutaCBB, VentaFolio, Ruta & "XML\" & VentaFolio & ".xml", False, CFDi.CadenaOriginal) - ' 'GeneraPDF(CveNomina, CvePersonal, CvePeriodo, FechaFactura, FolioFiscal, NoSerieCertificado, FechaCertificacion, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT, RutaCBB, Ruta & "Nomina\XML\" & NominaFolio & ".xml", False, CFDi.Timbrado.CadenaOriginal, FormatoReciboCFDi) - ' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorRegimen", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorRegimen", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioExpedidoEn", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioExpedidoEn", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioFiscalCfd", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioFiscalCfd", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorCfd", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorCfd", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) - ' End If - ' Else - ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) - ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) - ' End If - ' objPersonal.Dispose() - ' objNomina.Dispose() - - ' Return MsgError - 'End Function - - + End Function + + 'Private Function TimbrarBIInformNomina12(CveNomina As Integer, CvePersonal As Integer, CvePeriodo As Integer) As String + + ' If UsuarioActual.CveEmpresa = 8 Then + ' UsuarioActual.Empresa.FacturaProduccion = True + ' End If + ' 'UsuarioActual.Empresa.FacturaProduccion = False + + ' Dim MsgError As String = String.Empty + + ' Dim CFDi As New ClbNegBICFDv3_2.ClsNegEDI + ' CFDi.ObjCompNomina12 = New ClbNegBICFDv3_2.ClsNegComplementoNomina12() + ' 'CFDi.ObjCompNomina = New ClbNegBICFDv3_2.ClsNegCompNomina + + ' Dim objPersonal As New ClsRH + ' 'Dim objNomina As New ClsNominas + ' objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) + ' 'objNomina.GetNom_Nominas(CveNomina, CvePersonal, CvePeriodo, -1, UsuarioActual.CveEmpresa) + + + ' Dim Total As Decimal = 0 + ' Dim SubTotal As Decimal = 0 + ' Dim Descuentos As Decimal = 0 + ' Dim RetISR As Decimal = 0 + ' Dim TotalExcento As Decimal = 0 + ' Dim TotalGravado As Decimal = 0 + ' Dim TotalPercepciones As Decimal = 0 + ' Dim TotalDeducciones As Decimal = 0 + ' Dim TotalOtrosPagos As Decimal = 0 + + ' Dim Serie As String = "" + ' Dim Folio As String = "" + ' Dim NominaFolio As String = Serie & "-" & Folio + ' Dim RFC As String = objPersonal.RFC.Trim + ' Dim Nombre As String = objPersonal.NombreCompleto.Trim + ' Dim Direccion As String = String.Format("{0} {1} {2}", objPersonal.Calle.Trim, objPersonal.NumExt.Trim, objPersonal.NumInt.Trim).Trim + ' Dim Ciudad As String = objPersonal.Ciudad.Trim + ' Dim Estado As String = objPersonal.Estado.Trim + ' Dim CP As String = objPersonal.CP.Trim + + + + ' 'Dim TipoContrato As String = GlobalDTTiposContrato.FiltraParametros("CveTipoContrato = " + objPersonal.CveTipoContrato.ToString)(0)("TipoContrato").ToString + ' 'Dim TipoPeriodo As String = GlobalDTTipoPeriodo.FiltraParametros("CveTipoPeriodo = " + objPersonal.CveTipoPeriodo.ToString)(0)("TipoPeriodo").ToString + ' Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero + ' Dim FormatoReciboCFDi As String = objPersonal.FormatoReciboCFDi + + ' Dim FechaInicio, FechaFin, FechaPago As Date + ' Dim DiasPagados As Integer = 0 + ' Dim Msg As String = String.Empty + ' Dim DiasIncapacitados As Integer = 0 + ' Dim DrPeriodo As DataRow = Nothing + + ' Dim ObjFolio As New ClsGralFolios + ' If ObjFolio.GetFolios("VIA", UsuarioActual.CveEmpresa) Then + ' If ObjFolio.DtResultados.Rows.Count > 0 Then + ' Folio = ObjFolio.DtResultados.Rows(0)("FActual").ToString + ' End If + ' End If + + + ' 'If objNomina.GetPeriodos(-1, -1, -1, -1, CvePeriodo) Then + ' ' If objNomina.DtResultados.Rows().Count > 0 Then + ' ' DrPeriodo = objNomina.DtResultados.Rows(0) + ' ' End If + ' 'End If + ' 'Dim DrPeriodo As DataRow = GlobalDTNominasPeriodos(-1, CvePeriodo, -1).FiltroPrimero("") + ' If DrPeriodo IsNot Nothing Then + ' FechaInicio = DrPeriodo("FechaInicio").ToString.ToDate + ' FechaFin = DrPeriodo("FechaFin").ToString.ToDate + ' FechaPago = DrPeriodo("FechaPago").ToString.ToDate + ' If objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then + + ' Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero + ' Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero + ' DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero + ' DiasPagados = Asistencias - Vacaciones + ' If DiasPagados < 0 Then DiasPagados = 0 + + ' End If + + ' End If + + ' Dim DtPercepciones As Data.DataTable = Nothing + ' Dim DtDeducciones As Data.DataTable = Nothing + ' Dim DtOtrosPagos As Data.DataTable = Nothing + ' 'If objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then + ' ' If objNomina.DtResultados.Rows.Count > 0 Then + ' ' DtPercepciones = objNomina.DtResultados.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ") + ' ' DtDeducciones = objNomina.DtResultados.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ") + ' ' TotalPercepciones = DtPercepciones.SUM("Importe") + ' ' TotalDeducciones = DtDeducciones.SUM("Importe") + ' ' Total = CType((Total + DtPercepciones.SUM("Importe")), Decimal) + ' ' End If + ' 'End If + + ' 'Tipo Nomina O de Ordinaria o E de extraordinaria + ' 'Dim FechaPago As Date = Now + ' Dim TotalSueldos As Decimal = 0 + ' Dim TotalIndemnizacion As Decimal = 0 + ' Dim TotalJubilacion As Decimal = 0 + ' Msg = CFDi.ObjCompNomina12.Cargar("O", FechaPago, FechaInicio, FechaFin, DiasPagados, TotalPercepciones, TotalDeducciones, 0) + + + + ' If Msg = String.Empty Then + ' If DtPercepciones IsNot Nothing Then + ' If DtPercepciones.Rows.Count > 0 Then + ' TotalSueldos = DtPercepciones.SUM("Importe", "SATCveConcepto = '001'") + ' TotalIndemnizacion = DtPercepciones.SUM("Importe", "SATCveConcepto IN ('022','023','025')") ' https://www.ccpm.org.mx/avisos/nuevo-complemento-de-nomina-version-1.2-puntos-finos-diciembre-2016.pdf + ' TotalJubilacion = DtPercepciones.SUM("Importe", "SATCveConcepto IN ('039','044')") 'https://www.ccpm.org.mx/avisos/nuevo-complemento-de-nomina-version-1.2-puntos-finos-diciembre-2016.pdf + ' Msg = CFDi.ObjCompNomina12.CargarPercepciones(TotalSueldos, TotalIndemnizacion, TotalJubilacion, DtPercepciones.SUM("ImporteGravado").ToDecimal, DtPercepciones.SUM("ImporteExento").ToDecimal) + ' End If + ' For Each Row As DataRow In DtPercepciones.Rows + ' If Row("Importe").ToString.ToDecimal > 0 Then + ' If Row("CveSATConcepto").ToString = "" Then + ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) + ' Else + ' Msg = CFDi.ObjCompNomina12.AgregarPercepcion(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, Row("ImporteGravado").ToString.ToDecimal, Row("ImporteExento").ToString.ToDecimal) + ' TotalExcento = TotalExcento + Row("ImporteExento").ToString.ToDecimal + ' TotalGravado = TotalGravado + Row("ImporteGravado").ToString.ToDecimal + ' SubTotal = SubTotal + Row("Importe").ToString.ToDecimal + ' End If + + ' If Msg <> String.Empty Then + ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Percepcion", New Exception) + ' Exit For + ' End If + ' End If + ' 'RMF, falta poner el numero de horas pagadas + ' If Row("CveSATConcepto").ToString.ToEntero = 19 Then 'cuando son horas extras + + ' 'Obtengo el desglose de horas extras + + ' If objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then + + ' Dim dr As DataRow = objNomina.DtResultados.FiltroPrimero("") + ' If dr IsNot Nothing Then + + ' If dr("HorasDobles").ToString.ToDouble > 0 Then CFDi.ObjCompNomina12.AgregarHorasExtra(dr("DiasHorasDobles").ToString.ToEntero, ClbNegBICFDv3_2.TipoHoras.Dobles, dr("HorasDobles").ToString.ToEntero, Row("Importe").ToString.ToDecimal) + ' If dr("HorasTriples").ToString.ToDouble > 0 Then CFDi.ObjCompNomina12.AgregarHorasExtra(dr("DiasHorasTriples").ToString.ToEntero, ClbNegBICFDv3_2.TipoHoras.Triples, dr("HorasTriples").ToString.ToEntero, Row("Importe").ToString.ToDecimal) + + + ' End If + + + ' End If + + ' End If + ' Next + ' If Msg = "" Then + ' CFDi.ObjCompNomina12.ObjPercepciones.TotalExento = TotalExcento + ' CFDi.ObjCompNomina12.ObjPercepciones.TotalGravado = TotalGravado + ' End If + + ' End If + + ' 'cargo las incapacidades + ' If DiasIncapacitados > 0 Then + + ' If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then + + ' CFDi.ObjCompNomina12.CargarIncapacidades() + ' For Each dr As DataRow In objNomina.DtResultados.Rows + ' CFDi.ObjCompNomina12.AgregarIncapacidad(dr("Dias").ToString.ToDecimal, dr("ClaveTipoIncapacidad").ToString.ToEntero, dr("Descuento").ToString.ToDecimal) + ' Next + + ' End If + + ' End If + + + + ' TotalExcento = 0 + ' TotalGravado = 0 + + ' If Msg = String.Empty Then + ' If DtDeducciones IsNot Nothing Then + ' If DtDeducciones.Rows.Count > 0 Then + ' Total = CType((Total - DtDeducciones.SUM("Importe")), Decimal) + ' CFDi.ObjCompNomina12.CargarDeducciones(CType(DtDeducciones.SUM("ImporteGravado"), Decimal), CType(DtDeducciones.SUM("ImporteExento"), Decimal)) + ' End If + ' For Each Row As DataRow In DtDeducciones.Rows + + ' If Row("Importe").ToString.ToDecimal > 0 Then + ' If Row("CveSATConcepto").ToString = "" Then + ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) + ' Else + + ' Msg = CFDi.ObjCompNomina12.AgregarDeduccion(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, 0) + ' TotalExcento = TotalExcento + Row("ImporteExento").ToString.ToDecimal + ' TotalGravado = TotalGravado + Row("ImporteGravado").ToString.ToDecimal + + ' If Row("CveSATConcepto").ToString.ToEntero = 3 Then + ' RetISR = RetISR + Row("Importe").ToString.ToDecimal + ' Else + ' Descuentos = Descuentos + Row("Importe").ToString.ToDecimal + ' End If + ' End If + + ' If Msg <> String.Empty Then + ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Deduccion", New Exception) + ' Exit For + ' End If + ' End If + ' Next + ' If Msg = "" Then + ' If CFDi.ObjCompNomina12.ObjDeducciones IsNot Nothing Then + ' CFDi.ObjCompNomina12.ObjDeducciones.TotalOtrasDeducciones = Descuentos + ' CFDi.ObjCompNomina12.ObjDeducciones.TotalImpuestosRetenidos = RetISR + ' End If + + ' End If + ' End If + + ' If Msg = String.Empty Then + ' If DtOtrosPagos IsNot Nothing Then + ' If DtOtrosPagos.Rows.Count > 0 Then + ' Total = CType((Total - DtOtrosPagos.SUM("Importe")), Decimal) + ' CFDi.ObjCompNomina12.CargarOtrosPagos() + ' End If + + ' For Each Row As DataRow In DtOtrosPagos.Rows + ' If Row("Importe").ToString.ToDecimal > 0 Then + ' If Row("CveSATConcepto").ToString = "" Then + ' Msg = String.Format("Concepto No registrado ({0})", Row("Concepto").ToString) + ' Else + ' Msg = CFDi.ObjCompNomina12.AgregarOtroPago(Row("SATCveConcepto").ToString, Row("Codigo").ToString, Row("Concepto").ToString, 0) + ' 'Msg = CFDi.ObjCompNomina12.CargarSubsidioAlEmpleo(0) + ' 'Msg = CFDi.ObjCompNomina12.CargarCompensacionSaldosAFavor(0, 0, 0) + ' End If + + ' If Msg <> String.Empty Then + ' Me.OnError("El SAT regresó el siguiente mensaje: " & Msg & ". Objeto: Otros Pagos", New Exception) + ' Exit For + ' End If + ' End If + ' Next + + ' End If + + ' If Msg = String.Empty Then + ' Dim x As Integer = 0 + + ' Dim Moneda As String = "MXN" + ' Dim LugarExp As String = String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8} ", SucCalle, SucNoExt, SucNoInt, SucColonia, SucLocalidad, SucMunicipio, SucEstado, SucPais, SucCP) + ' Dim FechaFactura As DateTime = Now + ' 'Nodo Comprobante + + ' Dim TipoComprobante As ClbNegBICFDv3_2.TipoDeComprobante = ClbNegBICFDv3_2.TipoDeComprobante.egreso + ' Msg = CFDi.comprobantecfd(0, 0, Serie, Folio, FechaFactura, "PAGO EN UNA SOLA EXHIBICION", "CONTADO", SubTotal, Descuentos, "Deducciones nómina", "1", Moneda, Total, objPersonal.MetodoPagoSAT, ClbNegBICFDv3_2.TipoDeComprobante.egreso, LugarExp, "", "", "", New Date(1900, 1, 1), 0) + + ' If Msg = String.Empty Then + ' 'Nodo emisor + ' Msg = CFDi.ObjCompNomina12.CargarEmisor("", UsuarioActual.Empresa.RegistroPatronal, UsuarioActual.Empresa.RFC) + ' 'If Msg = String.Empty Then Msg = CFDi.EmisorRegimen(UsuarioActual.Empresa.CodigoRegimenFiscal) + ' If Msg = String.Empty Then + ' 'Nodo Entidad SNCF + ' If 1 = 2 Then 'cuando es gobierno + ' Msg = CFDi.ObjCompNomina12.CargarEntidadSNCF("", 0) + ' End If + + ' If Msg = String.Empty Then + ' 'Nodo Receptor + ' Msg = CFDi.ObjCompNomina12.CargarReceptor(objPersonal.CURP, objPersonal.NumeroSS, objPersonal.FechaInicioContrato, AntiguedadSemanas, objPersonal.TipoContrato, "", objPersonal.ClaveTipoJornada, objPersonal.CveRegimenContratacion, objPersonal.Codigo.ToString, + ' objPersonal.Departamento, objPersonal.Puesto, objPersonal.CveRiesgoPuesto, objPersonal.TipoPeriodo, objPersonal.ClaveBanco, objPersonal.BancoNumCuenta, Total, objPersonal.SDI.ToString.ToDecimal, objPersonal.ClaveEstado) + ' If Msg = String.Empty Then + ' 'Nodo SubContratacion + ' If 1 = 2 Then Msg = CFDi.ObjCompNomina12.AgregarSubContratacion("", 0) + ' If Msg = String.Empty Then + + ' CFDi.LstCompNomina12.Add(CFDi.ObjCompNomina12) + + ' Dim HasErrorConceptos As Boolean = False + ' 'Dim Importe As Decimal = 0 + + + ' Msg = CFDi.ConceptosCfd(1, "ACT", "", "Pago de nómina", SubTotal, SubTotal) + + ' 'Timbrado + + ' 'Web Services de producción: http://biinform.com.mx/srvCFDi/service1.asmx + ' 'Web Services de pruebasd: http://biinform.com.mx/srvCFDiPrueba/service1.asmx + + + ' Dim WS As String = String.Empty + ' If UsuarioActual.Empresa.FacturaProduccion Then + ' WS = "http://portalbiinform.com.mx/srvCFDiPrueba/service1.asmx" + ' Else + ' WS = "http://portalbiinform.com.mx/srvCFDiPrueba/service1.asmx" + ' End If + + ' If Not System.IO.Directory.Exists(Ruta & "XML\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\") + ' If Not System.IO.Directory.Exists(Ruta & "XML\Nomina\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\Nomina\") + + ' 'Generar Timbre + ' 'If UsuarioActual.Empresa.FacturaProduccion Then + ' If 1 = 2 Then + ' CFDi.Generar(String.Format("{0}Certificados\{1}", Ruta, UsuarioActual.Empresa.ArchivoPfx), + ' UsuarioActual.Empresa.ContraseñaKey, + ' String.Format("{0}Certificados\{1}", Ruta, UsuarioActual.Empresa.ArchivoCer), + ' String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), + ' String.Format("{0}Certificados\", Ruta), + ' UsuarioActual.Empresa.BIUsuario, + ' UsuarioActual.Empresa.BIContraseña, + ' WS, + ' True) + ' Else + ' If Not System.IO.Directory.Exists(Ruta & "XML\Nomina\Demo\") Then System.IO.Directory.CreateDirectory(Ruta & "XML\Nomina\Demo\") + ' 'RutaPruebas & "XML\Demo\" & NominaFolio & ".xml", + ' CFDi.Generar(String.Format("{0}Certificados\aaa010101aaa__csd_01.pfx", RutaPruebas), + ' "12345678a", + ' String.Format("{0}Certificados\aaa010101aaa__csd_01.cer", RutaPruebas), + ' String.Format("{0}XML\Nomina\Demo\{1}.xml", Ruta, NominaFolio), + ' String.Format("{0}Certificados\", RutaPruebas), + ' "prueba", + ' "123", + ' WS, + ' True) + ' End If + + + ' If CFDi.MsgError <> String.Empty Then + + ' 'OnError("Ocurrió un error al generar el timbre: " & CFDi.MsgError, New Exception) + + ' Dim params As New ActualizaTimbre + ' params.Estatus = False + ' params.CveNomina = CveNomina + ' params.CvePAC = 1 + + ' 'Dim Hilo As New System.Threading.Thread(AddressOf ActualizaTimbrado) + ' 'Hilo.Start(params) + ' BtnAutorizar.Enabled = False + ' MsgError = "Nombre: " & Nombre & ". Error: " & CFDi.MsgError + ' Else + ' 'Actualiza Estatus Timbrado + ' Dim params As New ActualizaTimbre + ' params.Estatus = True + ' params.CveNomina = CveNomina + ' params.CvePAC = 1 + + ' 'Dim Hilo As New System.Threading.Thread(AddressOf ActualizaTimbrado) + ' 'Hilo.Start(params) + + ' Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + ' Dim FechaCertificacion As DateTime + ' Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String + + ' FolioFiscal = CFDi.Timbrado.UUDI 'XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText + ' NoSerieCertificado = CFDi.Timbrado.NoCertificadoSAT + ' FechaCertificacion = CFDi.Timbrado.FechaTimbrado + ' SelloCFDi = CFDi.Timbrado.SelloCFD + ' SelloSAT = CFDi.Timbrado.SelloSAT + ' NoSerieCertificadoContribuyente = CFDi.Timbrado.NoCertificado + ' ViewState("FolioFiscal") = FolioFiscal + + ' 'Actualiza Estatus Factura + ' CveNominaT = CveNomina + + ' Dim Rastro As String = String.Format("Nomina: CvePeriodo:{0}, CvePersonal:{1}, UUID: {2}, RFC:{3}", CvePeriodo, CvePersonal, FolioFiscal, objPersonal.RFC) + ' Rastro.GuardaLog() + + ' If FolioFiscal <> "" Then + + ' 'If UsuarioActual.Empresa.FacturaProduccion Then + ' ' Dim ObjNomina2 As New ClsNominas() + ' ' ObjNomina2.UpdateEstatusNomNominas(3, UsuarioActual.Empresa.CvePAC, FolioFiscal, "", ("01/01/2000").ToDate, CveNomina, SubTotal, Descuentos, RetISR, Total, DiasPagados) + ' ' ObjNomina2.Dispose() + ' 'End If + ' Rastro = "--Estatus" & Rastro + ' Rastro.GuardaLog() + ' 'Dim Hilo1 As New System.Threading.Thread(AddressOf ActualizaEstatus) + ' 'Hilo1.Start(3) + ' End If + + + ' Dim RutaCBB As String = String.Empty + ' If Not System.IO.Directory.Exists(Ruta & "CBB\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\") + ' If Not System.IO.Directory.Exists(Ruta & "CBB\Nomina\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\Nomina\") + + ' If UsuarioActual.Empresa.FacturaProduccion Then + ' RutaCBB = Ruta & "CBB\Nomina\" & NominaFolio & ".jpg" + ' Else + ' If Not System.IO.Directory.Exists(Ruta & "CBB\Nomina\Demo\") Then System.IO.Directory.CreateDirectory(Ruta & "CBB\Nomina\Demo\") + ' RutaCBB = Ruta & "CBB\Nomina\Demo\" & NominaFolio & ".jpg" + ' End If + ' CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFC, Total, FolioFiscal, RutaCBB) + + + ' 'GeneraPDF(FechaFactura, FolioFiscal, NoSerieCertificado, FechaCertificacion, NoSerieCertificadoContribuyente, TmpDT, SelloCFDi, SelloSAT, RutaCBB, VentaFolio, Ruta & "XML\" & VentaFolio & ".xml", False, CFDi.CadenaOriginal) + ' 'GeneraPDF(CveNomina, CvePersonal, CvePeriodo, FechaFactura, FolioFiscal, NoSerieCertificado, FechaCertificacion, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT, RutaCBB, Ruta & "Nomina\XML\" & NominaFolio & ".xml", False, CFDi.Timbrado.CadenaOriginal, FormatoReciboCFDi) + ' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorRegimen", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorRegimen", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioExpedidoEn", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioExpedidoEn", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioFiscalCfd", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorDomicilioFiscalCfd", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorCfd", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: EmisorCfd", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) + ' End If + ' Else + ' 'Me.OnError(String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre), New Exception) + ' MsgError = String.Format("El SAT regresó el siguiente mensaje: {0} Nombre: {1}. Objeto: Comprobante", Msg, Nombre) + ' End If + ' objPersonal.Dispose() + ' objNomina.Dispose() + + ' Return MsgError + 'End Function + + #End Region - + #Region " GUARDAR - ACTUALIZAR " Private Function ValidaGuardar() As Boolean Dim EsValido = True @@ -3049,7 +3072,7 @@ Partial Class Bancos_IE 'El movimiento 1 es el de Venta 'Conta SIG - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" And UsuarioActual.Empresa.UsaContabilidadSIG Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then If CveCuentaBeneficiario > 0 And CveCuentaConta > 0 Then If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then IDPoliza = ObjMov.ContaIdPoliza @@ -3067,7 +3090,7 @@ Partial Class Bancos_IE End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" And UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then IDPoliza = ObjMov.ContaIdPoliza @@ -3257,8 +3280,8 @@ Partial Class Bancos_IE If ObjComp IsNot Nothing Then ObjComp.Dispose() - End Sub - + End Sub + #Region " NOTIFICACION PAGO " Private Sub NotificacionPago(CveIE As Integer, CorreoNotificarA As String) Dim Param As New List(Of String) @@ -3503,7 +3526,7 @@ Partial Class Bancos_IE -#End Region +#End Region ''[IPP] IFs REEMPLAZADOS - MIRAS DE ELIMINAR 2018/08/15 'If Not Opcion.Contiene("DEV", "INGPC", "DevDinV") AndAlso MsgError = "" Then @@ -3692,16 +3715,16 @@ Partial Class Bancos_IE Protected Sub BtnActualizar_Click(sender As Object, e As EventArgs) Handles BtnActualizar.Click - Dim IE As New ClsBancos - IE.IniciaTransacSQL() + Dim IE As New ClsBancos + IE.IniciaTransacSQL() Dim FechaAplicado As DateTime? = Nothing Dim OcurrioError As Boolean = False Dim CveCuentaDepositoUpdate As Integer = If(DdlCuentaDeposito.SelectedValue.ToEntero.ToEntero = 0, -1, DdlCuentaDeposito.SelectedValue.ToEntero.ToEntero) - If Not IE.UpdateBancos_IE(TxtFechaDocumento.Text.ToDate, FechaAplicado, CveIE, TxtFolio.Text, CveCuentaDeposito:=CveCuentaDepositoUpdate, CveCuenta:=DdlCuenta.SelectedValue.ToEntero, - Observaciones:=TxtObservaciones.Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - OcurrioError = True + If Not IE.UpdateBancos_IE(TxtFechaDocumento.Text.ToDate, FechaAplicado, CveIE, TxtFolio.Text, CveCuentaDeposito:=CveCuentaDepositoUpdate, CveCuenta:=DdlCuenta.SelectedValue.ToEntero, + Observaciones:=TxtObservaciones.Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + OcurrioError = True End If If OcurrioError Then @@ -3711,1832 +3734,1859 @@ Partial Class Bancos_IE Alert("La Actualización del documento se realizó correctamente", TipoMensaje.MsgInformacion, $"document.location.href=""IE.aspx?CveIE={CveIE}""") End If IE.Dispose() - End Sub - - Protected Sub ImgUpdateCuentaDeposito_Click(sender As Object, e As ImageClickEventArgs) - Dim IE As New ClsBancos - - If IE.UpdateBancos_IECuentaDeposito(DdlCuentaDeposito.SelectedValue.ToEntero, CveIE) Then - Alert("Se vinculó con exito la cuenta deposito", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un Error al vincular la cuenta deposito al IE", TipoMensaje.MsgError) - End If - - IE.Dispose() - End Sub - -#End Region - -#Region " ELIMINAR/CANCELAR - MOVIMIENTO " - - Protected Sub BtnCancelarIE_Click(sender As Object, e As EventArgs) - RegistraScript("$('#DivCancelarIE').modal('hide');") - - CancelarIE() - End Sub - - Private Sub CancelarIE(Optional CancelarComplemento As Boolean = False) - - If Not IsDate(TxtFechaCancelacion.Text.ToDate) Then - Alert("El campo fecha cancelación es incorrecto. Por favor verifique y vuelva a intentar") - Exit Sub - End If - - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim Banc As New ClsBancos - Banc.IniciaTransacSQL() - - Dim ObjAC As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - End If - - - Dim ErrorCancelar = False - Dim MensajeError = "" - Dim IdPolizaNueva = -1 - Dim FolioPolizaNueva = -1 - - If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad)) 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 < TxtFechaCancelacion.Text.ToDate.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, TxtFechaCancelacion.Text.ToDate) - - 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, TxtFechaCancelacion.Text.ToDate, "") 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, TxtFechaCancelacion.Text.ToDate) Then - ErrorCancelar = True - MensajeError = "Error al cancelar IE" - End If - End If - - Else - ErrorCancelar = True - End If - - Else - - 'LIMPIA POLIZA PONIENDO IMPORTE EN CEROS - For Each dr As DataRow In dt.Rows - If Not ObjAC.UpdateMovimiento(dr("Id").ToString.ToEntero, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "1", 0, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegNeg").ToString.ToEntero, dr("Fecha").ToString.ToDate) Then - ErrorCancelar = True - MensajeError = "Error al actualizar Movimientos con importe 0" - Exit For - End If - Next - - 'AJUSTA POLIZA - If Not ErrorCancelar Then - If Not ObjAC.AjustaPoliza(IDPoliza) 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, False, IdPolizaNueva, TxtFechaCancelacion.Text.ToDate) Then - ErrorCancelar = True - MensajeError = "Error al cancelar IE" - End If - End If - - End If - - 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 TxtFechaDocumento.Text.ToDate < TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then - 'CANCELA IE MES ANTERIOR - If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaCancelacion.Text.ToDate) 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, TxtFechaCancelacion.Text.ToDate) Then - ErrorCancelar = True - MensajeError = "Error al cancelar IE MES ACTUAL" - End If - End If - End If - - If Not ErrorCancelar Then - If Banc.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then - If Banc.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}).Rows.Count > 0 Then - If Not Banc.GetFoliosCancelados(UsuarioActual.CveEmpresa) Then - ErrorCancelar = True - MensajeError = "Error al cancelar complemento de pago" - Else - Dim FolioCancelado = $"{TxtFolio.Text}_C_{Banc.DtResultados(0)("Cantidad").ToString().ToEntero + 1}" - If Not Banc.UpdateFolioCancelado(CveIE.ToEntero, Folio:=FolioCancelado) Then - ErrorCancelar = True - MensajeError = "Error al actualizar complemento de pago" - End If - End If - End If - End If - End If - - If Not ErrorCancelar Then - - Dim ErrorCancelarComplemento As Boolean = True - - If CancelarComplemento Then - Dim ObjCancelacion As New Timbrado - 'Dim ObjBanco As New ClsBancos - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then - - If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then - CargaComplementosPago() - RegistraScript("$('#ModalCancelarComplemetno').modal('hide');") - ErrorCancelarComplemento = False - Alert("El complemento se cancelo correctamente.") - End If - - Else - Alert("Se presento un error al cancelar el complemento.") - End If - Else - ErrorCancelarComplemento = False - End If - - - If Not ErrorCancelarComplemento Then - - If ObjAC IsNot Nothing Then ObjAC.Commit() - Banc.Commit() - Dim Msg As New StringBuilder - - If CancelarComplemento Then - Msg.Append("El movimiento bancario y su complemento quedaron cancelados exitosamente.") - Else - Msg.Append("El movimiento bancario quedó cancelado exitosamente.") - End If - - - If IdPolizaNueva > 0 Then Msg.AppendFormat("

Ver Póliza de cancelación", IdPolizaNueva) - Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") - - 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 - - - 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() - End Sub - - Protected Sub BtnDevueltoIE_Click(sender As Object, e As EventArgs) - RegistraScript("$('#DivChqDevueltoIE').modal('hide');") - - ChequeDevuelto() - - - End Sub - - Private Sub ChequeDevuelto() - If Not IsDate(TxtFechaDevuelto.Text.ToDate) Then - Alert("El campo fecha cancelación es incorrecto. Por favor verifique y vuelva a intentar") - Exit Sub - End If - - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - - Dim Banc As New ClsBancos - Banc.IniciaTransacSQL() - Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL) - - Dim ObjAC As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - End If - - - Dim ErrorCancelar = False - Dim IdPolizaNueva = -1 - Dim FolioPolizaNueva = -1 - - If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad)) 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) - - IdPolizaNueva = ObjAC.AddPoliza(1, String.Format("Cheque Devuelto: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, TxtFechaDevuelto.Text.ToDate) - - 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, TxtFechaDevuelto.Text.ToDate, "") Then - ErrorCancelar = True : Exit For - End If - Next - - 'AJUSTA POLIZA - If Not ErrorCancelar Then - If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then - ErrorCancelar = True - End If - End If - - 'genera nuevo IE contrario - If Not ErrorCancelar Then - If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2) Then - ErrorCancelar = True - End If - End If - - Else - ErrorCancelar = True - End If - - - End If - End If - - Else - - 'siempre se hace una cancelación - If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2) Then - ErrorCancelar = True - End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - - IDPoliza = ObjConta.ContaIdPoliza - Else - ErrorCancelar = True - Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia) - End If - End If - - End If - - - If Not ErrorCancelar Then - If ObjAC IsNot Nothing Then ObjAC.Commit() - Banc.Commit() - Dim Msg As New StringBuilder - Msg.Append("El movimiento bancario quedó devuelto exitosamente.") - - If IdPolizaNueva > 0 Then Msg.AppendFormat("

Ver Póliza de cancelación", IdPolizaNueva) - Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") - Else - If ObjAC IsNot Nothing Then ObjAC.RollBack() - Banc.RollBack() - Alert("El movimiento bancario no se pudo registrar. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - - If ObjAC IsNot Nothing Then ObjAC.Dispose() - Banc.Dispose() - - End Sub - - Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Handles LnkEliminar.Click - RegistraScript(String.Format("$('#{0}').modal('show');", "divDescripcion")) - End Sub -#End Region - - - Protected Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlMoneda.SelectedIndexChanged - CambiaTipoMoneda() - End Sub - - Private Sub CambiaTipoMoneda() - If DdlMoneda.SelectedValue.ToEntero > 1 Then - TrTipoCambio.Visible = True - TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString - Else - TrTipoCambio.Visible = False - End If - UpTipoCambio.Update() - End Sub - - - Public Shared Function wsImporteLetra(ByVal contextKey As System.String, ByVal tCveMoneda As Integer) As System.String - Dim Retorno As String = "" - - If contextKey.ToDouble >= 0 Then - Retorno = String.Format("---{0}---", contextKey.ToDouble.Texto2Letras(tCveMoneda)) - End If - - Return Retorno - End Function - - Protected Sub RBL_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBL.SelectedIndexChanged - ChkAplicaViatico.Visible = False - If RBL.SelectedValue = "FE" Then - If UsuarioActual.CveRol = 1 Then ChkAplicaViatico.Visible = True - - DdlPersonal.Visible = True - DdlProveedores.Visible = False - DdlCliente.Visible = False - ElseIf RBL.SelectedValue = "P" Then - DdlPersonal.Visible = False - DdlProveedores.Visible = True - DdlCliente.Visible = False - ElseIf RBL.SelectedValue = "C" Then - DdlPersonal.Visible = False - DdlProveedores.Visible = False - DdlCliente.Visible = True - ElseIf RBL.SelectedValue = "AC" Then - DdlPersonal.Visible = False - DdlProveedores.Visible = True - DdlCliente.Visible = False - Else - - End If - - If RBL.SelectedValue = "C" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then - DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - ElseIf RBL.SelectedValue = "P" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then - DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones() - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - ElseIf RBL.SelectedValue = "DD" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then - DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones() - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then - - DdlTipoTransaccion.Items.Clear() - DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - End If - - 'Apartado Nueva Modalidad de INGPC Charlie - If RBL.SelectedValue = "C" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("INGPC", "DEV") Then - DivIvaIxC.Visible = True - End If - - UpDatos.Update() - - End Sub - -#Region " IMPRIMIR " - Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click - If CveIE > 0 Then GeneraChequePDF(CveIE, UsuarioActual.Empresa) - End Sub -#End Region - -#Region "E V E N T O - B I T A C O R A" - Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(200) - e.Row.Cells(1).Width = Unit.Pixel(200) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(500) - End If - - If e.Row.DBCampo("Archivo").ToString <> "" Then - e.Row.FCLinkButton("LinkArchivo").Visible = True - e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) - ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione - End If - - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left - End If - End Sub - Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click - Dim ObjEventoBitacora As New ClsOIEventos - - Dim FileExtension As String = "" 'Anteriormente -1 - Dim filesgral As List(Of Archivo) = Anexo2.getfiles().Archivos - Dim filemove As String = "" - - For Each fileItem As Archivo In filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.filename - Next - - If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then - If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) - End If - - GvEB.DataSource = ObjEventoBitacora.DtResultados - TxtEventoDescripcion.Text = "" - Anexo2.Text = "[]" - Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) - RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() - - UPEventoBitacora.Update() - CargaEventoBitacora() - UPAddEventoBitacora.Update() - End Sub - Private Sub CargaEventoBitacora() - - Dim ObjEventoBitacora As New ClsOIEventos() - If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then - 'GVEventoBitacora.DataSource = ObjEventoBitacora.DtResultados - GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") - Else - GvEB.DataSource = Nothing - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() - End Sub - - Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) - Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) - If IO.File.Exists(filePath) Then - Dim Archivo As New System.IO.FileInfo(filePath) - - HttpContext.Current.Response.Clear() - HttpContext.Current.Response.ClearContent() - HttpContext.Current.Response.ContentType = "application/octet-stream" - HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) - HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) - HttpContext.Current.Response.TransmitFile(filePath) - HttpContext.Current.Response.Flush() - HttpContext.Current.Response.End() - - Archivo = Nothing - End If - - End Sub -#End Region - -#Region " C O N T A B I L I D A D DESASOCIAR POLIZA " - Protected Sub BtnContabilizar_Click(sender As Object, e As EventArgs) - - Dim ObjMov As New ClsContabilidad - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" - - - If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Alert(alertaContabilizacion & ObjMov.AlertaMensaje, ModExtensiones.TipoMensaje.MsgInformacion) - Else - Alert(String.Format("Ocurrio un error al contabilizar {0}", ObjMov.AlertaMensaje)) - End If - - ObjMov.Dispose() - - End Sub - Protected Sub BtnDescontabilizar_Click(sender As Object, e As EventArgs) - Dim ObjConta As New ClsContabilidad - Dim Movimientos = ObjConta.GetMovimientosPoliza(IDPoliza, UsuarioActual.CveEmpresa) - - 'Verifica que solo exista 1 compra asociada - If Movimientos = 1 Then - EliminaPoliza() - Else - RegistraScript("ConfirmEliminarPoliza();") - End If - - ObjConta.Dispose() - End Sub - 'Protected Sub BtnEliminarMov_Click(sender As Object, e As EventArgs) Handles BtnEliminarMov.Click - - ' Dim ObjBancos As New ClsBancos - ' ObjBancos.IniciaTransacSQL() - - ' If ObjBancos.EliminarBancos_IEComprobacion(UsuarioActual.CveUsuario, CveIE) Then - - ' Alert("Los Movimientos Bancarios se eliminaron correctamente.", TipoMensaje.MsgInformacion) - ' GvRH.Visible = False - ' DivEliminar.Visible = False - ' ObjBancos.Commit() - ' Else - ' ObjBancos.RollBack() - ' End If - - ' ObjBancos.Dispose() - - 'End Sub - Protected Sub BtnEliminarPoliza_Click(sender As Object, e As EventArgs) - EliminaPoliza() - End Sub - Private Sub EliminaPoliza() - Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - - Dim ErrorCompra = False - - 'Elimina la poliza - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IDPoliza > 0 Then - If Not ObjAC.RemovePoliza(IDPoliza) Then - ErrorCompra = True - End If - End If - - 'Desasocia la poliza - If Not ErrorCompra Then - If Not ObjConta.DesasociarPoliza(IDPoliza, UsuarioActual.CveEmpresa) Then - ErrorCompra = True - End If - End If - + End Sub + + Protected Sub ImgUpdateCuentaDeposito_Click(sender As Object, e As ImageClickEventArgs) + Dim IE As New ClsBancos + + If IE.UpdateBancos_IECuentaDeposito(DdlCuentaDeposito.SelectedValue.ToEntero, CveIE) Then + Alert("Se vinculó con exito la cuenta deposito", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un Error al vincular la cuenta deposito al IE", TipoMensaje.MsgError) + End If + + IE.Dispose() + End Sub + +#End Region + +#Region " ELIMINAR/CANCELAR - MOVIMIENTO " + + Protected Sub BtnCancelarIE_Click(sender As Object, e As EventArgs) + RegistraScript("$('#DivCancelarIE').modal('hide');") + + CancelarIE() + End Sub + + Private Sub CancelarIE(Optional CancelarComplemento As Boolean = False) + + If Not IsDate(TxtFechaCancelacion.Text.ToDate) Then + Alert("El campo fecha cancelación es incorrecto. Por favor verifique y vuelva a intentar") + Exit Sub + End If + + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + + 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 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 < TxtFechaCancelacion.Text.ToDate.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, TxtFechaCancelacion.Text.ToDate) + + 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, TxtFechaCancelacion.Text.ToDate, "") 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, TxtFechaCancelacion.Text.ToDate) Then + ErrorCancelar = True + MensajeError = "Error al cancelar IE" + End If + End If + + Else + ErrorCancelar = True + End If + + Else + + 'SE COMENTO PARA PODER DESBLOQUEAR LA PREPOLIZA Y CREAR UNA NUEVA POLIZA + ''LIMPIA POLIZA PONIENDO IMPORTE EN CEROS + 'For Each dr As DataRow In dt.Rows + ' If Not ObjAC.UpdateMovimiento(dr("Id").ToString.ToEntero, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "1", 0, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegNeg").ToString.ToEntero, dr("Fecha").ToString.ToDate) Then + ' ErrorCancelar = True + ' MensajeError = "Error al actualizar Movimientos con importe 0" + ' Exit For + ' End If + 'Next + + ''AJUSTA POLIZA + 'If Not ErrorCancelar Then + ' If Not ObjAC.AjustaPoliza(IDPoliza) Then + ' ErrorCancelar = True + ' MensajeError = "Error al ajustar poliza negativa" + ' End If + 'End If + + 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, TxtFechaCancelacion.Text.ToDate) Then + ErrorCancelar = True + MensajeError = "Error al cancelar IE" + End If + End If + + If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + ErrorCancelar = True + MensajeError = "Error al contabilizar poliza" + End If + + End If + + 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 TxtFechaDocumento.Text.ToDate < TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then + 'CANCELA IE MES ANTERIOR + If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaCancelacion.Text.ToDate) 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, TxtFechaCancelacion.Text.ToDate) Then + ErrorCancelar = True + MensajeError = "Error al cancelar IE MES ACTUAL" + End If + End If + End If + + If Not ErrorCancelar Then + If Banc.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then + If Banc.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}).Rows.Count > 0 Then + If Not Banc.GetFoliosCancelados(UsuarioActual.CveEmpresa) Then + ErrorCancelar = True + MensajeError = "Error al cancelar complemento de pago" + Else + Dim FolioCancelado = $"{TxtFolio.Text}_C_{Banc.DtResultados(0)("Cantidad").ToString().ToEntero + 1}" + If Not Banc.UpdateFolioCancelado(CveIE.ToEntero, Folio:=FolioCancelado) Then + ErrorCancelar = True + MensajeError = "Error al actualizar complemento de pago" + End If + End If + End If + End If + End If + + If Not ErrorCancelar Then + + Dim ErrorCancelarComplemento As Boolean = True + + If CancelarComplemento Then + Dim ObjCancelacion As New Timbrado + 'Dim ObjBanco As New ClsBancos + If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then + + If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then + CargaComplementosPago() + RegistraScript("$('#ModalCancelarComplemetno').modal('hide');") + ErrorCancelarComplemento = False + Alert("El complemento se cancelo correctamente.") + End If + + Else + Alert("Se presento un error al cancelar el complemento.") + End If + Else + ErrorCancelarComplemento = False + End If + + + If Not ErrorCancelarComplemento Then + + If ObjAC IsNot Nothing Then ObjAC.Commit() + Banc.Commit() + Dim Msg As New StringBuilder + + If CancelarComplemento Then + Msg.Append("El movimiento bancario y su complemento quedaron cancelados exitosamente.") + Else + Msg.Append("El movimiento bancario quedó cancelado exitosamente.") + End If + + + If IdPolizaNueva > 0 Then Msg.AppendFormat("

Ver Póliza de cancelación", IdPolizaNueva) + Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") + + 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 + + + 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 Sub + + Protected Sub BtnDevueltoIE_Click(sender As Object, e As EventArgs) + RegistraScript("$('#DivChqDevueltoIE').modal('hide');") + + ChequeDevuelto() + + + End Sub + + Private Sub ChequeDevuelto() + If Not IsDate(TxtFechaDevuelto.Text.ToDate) Then + Alert("El campo fecha cancelación es incorrecto. Por favor verifique y vuelva a intentar") + Exit Sub + End If + + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + + Dim Banc As New ClsBancos + Banc.IniciaTransacSQL() + 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 ErrorCancelar = False + 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) + + IdPolizaNueva = ObjAC.AddPoliza(1, String.Format("Cheque Devuelto: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, TxtFechaDevuelto.Text.ToDate) + + 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, TxtFechaDevuelto.Text.ToDate, "") Then + ErrorCancelar = True : Exit For + End If + Next + + 'AJUSTA POLIZA + If Not ErrorCancelar Then + If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then + ErrorCancelar = True + End If + End If + + 'genera nuevo IE contrario + If Not ErrorCancelar Then + If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2) Then + ErrorCancelar = True + End If + End If + + Else + ErrorCancelar = True + End If + + + End If + End If + + Else + + 'siempre se hace una cancelación + If Not Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2) Then + ErrorCancelar = True + End If + + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + + IDPoliza = ObjConta.ContaIdPoliza + Else + ErrorCancelar = True + Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia) + End If + End If + + End If + + + If Not ErrorCancelar Then + If ObjAC IsNot Nothing Then ObjAC.Commit() + Banc.Commit() + Dim Msg As New StringBuilder + Msg.Append("El movimiento bancario quedó devuelto exitosamente.") + + If IdPolizaNueva > 0 Then Msg.AppendFormat("

Ver Póliza de cancelación", IdPolizaNueva) + Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") + Else + If ObjAC IsNot Nothing Then ObjAC.RollBack() + Banc.RollBack() + Alert("El movimiento bancario no se pudo registrar. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + If ObjAC IsNot Nothing Then ObjAC.Dispose() + Banc.Dispose() + + End Sub + + Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Handles LnkEliminar.Click + RegistraScript(String.Format("$('#{0}').modal('show');", "divDescripcion")) + End Sub +#End Region + + + Protected Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlMoneda.SelectedIndexChanged + CambiaTipoMoneda() + End Sub + + Private Sub CambiaTipoMoneda() + If DdlMoneda.SelectedValue.ToEntero > 1 Then + TrTipoCambio.Visible = True + TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString + Else + TrTipoCambio.Visible = False + End If + UpTipoCambio.Update() + End Sub + + + Public Shared Function wsImporteLetra(ByVal contextKey As System.String, ByVal tCveMoneda As Integer) As System.String + Dim Retorno As String = "" + + If contextKey.ToDouble >= 0 Then + Retorno = String.Format("---{0}---", contextKey.ToDouble.Texto2Letras(tCveMoneda)) + End If + + Return Retorno + End Function + + Protected Sub RBL_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBL.SelectedIndexChanged + ChkAplicaViatico.Visible = False + If RBL.SelectedValue = "FE" Then + If UsuarioActual.CveRol = 1 Then ChkAplicaViatico.Visible = True + + DdlPersonal.Visible = True + DdlProveedores.Visible = False + DdlCliente.Visible = False + ElseIf RBL.SelectedValue = "P" Then + DdlPersonal.Visible = False + DdlProveedores.Visible = True + DdlCliente.Visible = False + ElseIf RBL.SelectedValue = "C" Then + DdlPersonal.Visible = False + DdlProveedores.Visible = False + DdlCliente.Visible = True + ElseIf RBL.SelectedValue = "AC" Then + DdlPersonal.Visible = False + DdlProveedores.Visible = True + DdlCliente.Visible = False + Else + + End If + + If RBL.SelectedValue = "C" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + ElseIf RBL.SelectedValue = "P" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones() + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + ElseIf RBL.SelectedValue = "DD" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones() + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("DEV") Then + + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + End If + + 'Apartado Nueva Modalidad de INGPC Charlie + If RBL.SelectedValue = "C" AndAlso Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("INGPC", "DEV") Then + DivIvaIxC.Visible = True + End If + + UpDatos.Update() + + End Sub + +#Region " IMPRIMIR " + Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click + If CveIE > 0 Then GeneraChequePDF(CveIE, UsuarioActual.Empresa) + End Sub +#End Region + +#Region "E V E N T O - B I T A C O R A" + Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.Cells(0).Width = Unit.Pixel(200) + e.Row.Cells(1).Width = Unit.Pixel(200) + e.Row.Cells(2).Width = Unit.Pixel(100) + e.Row.Cells(3).Width = Unit.Pixel(500) + End If + + If e.Row.DBCampo("Archivo").ToString <> "" Then + e.Row.FCLinkButton("LinkArchivo").Visible = True + e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione + End If + + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left + End If + End Sub + Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click + Dim ObjEventoBitacora As New ClsOIEventos + + Dim FileExtension As String = "" 'Anteriormente -1 + Dim filesgral As List(Of Archivo) = Anexo2.getfiles().Archivos + Dim filemove As String = "" + + For Each fileItem As Archivo In filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.filename + Next + + If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then + If filemove <> "" Then + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + End If + + GvEB.DataSource = ObjEventoBitacora.DtResultados + TxtEventoDescripcion.Text = "" + Anexo2.Text = "[]" + Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) + RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + + UPEventoBitacora.Update() + CargaEventoBitacora() + UPAddEventoBitacora.Update() + End Sub + Private Sub CargaEventoBitacora() + + Dim ObjEventoBitacora As New ClsOIEventos() + If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then + 'GVEventoBitacora.DataSource = ObjEventoBitacora.DtResultados + GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") + Else + GvEB.DataSource = Nothing + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + End Sub + + Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) + Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) + If IO.File.Exists(filePath) Then + Dim Archivo As New System.IO.FileInfo(filePath) + + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = "application/octet-stream" + HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(filePath) + HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + + Archivo = Nothing + End If + + End Sub +#End Region + +#Region " C O N T A B I L I D A D DESASOCIAR POLIZA " + Protected Sub BtnContabilizar_Click(sender As Object, e As EventArgs) + + Dim ObjMov As New ClsContabilidad + Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" + + + If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Alert(alertaContabilizacion & ObjMov.AlertaMensaje, ModExtensiones.TipoMensaje.MsgInformacion) + Else + Alert(String.Format("Ocurrio un error al contabilizar {0}", ObjMov.AlertaMensaje)) + End If + + ObjMov.Dispose() + + End Sub + Protected Sub BtnDescontabilizar_Click(sender As Object, e As EventArgs) + Dim ObjConta As New ClsContabilidad + Dim Movimientos = ObjConta.GetMovimientosPoliza(IDPoliza, UsuarioActual.CveEmpresa) + + 'Verifica que solo exista 1 compra asociada + If Movimientos = 1 Then + EliminaPoliza() + Else + RegistraScript("ConfirmEliminarPoliza();") + End If + + ObjConta.Dispose() + End Sub + 'Protected Sub BtnEliminarMov_Click(sender As Object, e As EventArgs) Handles BtnEliminarMov.Click + + ' Dim ObjBancos As New ClsBancos + ' ObjBancos.IniciaTransacSQL() + + ' If ObjBancos.EliminarBancos_IEComprobacion(UsuarioActual.CveUsuario, CveIE) Then + + ' Alert("Los Movimientos Bancarios se eliminaron correctamente.", TipoMensaje.MsgInformacion) + ' GvRH.Visible = False + ' DivEliminar.Visible = False + ' ObjBancos.Commit() + ' Else + ' ObjBancos.RollBack() + ' End If + + ' ObjBancos.Dispose() + + 'End Sub + Protected Sub BtnEliminarPoliza_Click(sender As Object, e As EventArgs) + EliminaPoliza() + End Sub + Private Sub EliminaPoliza() + Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) + ObjAC.IniciaTransacSQL() + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + + Dim ErrorCompra = False + + 'Elimina la poliza + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IDPoliza > 0 Then + If Not ObjAC.RemovePoliza(IDPoliza) Then + ErrorCompra = True + End If + End If + + 'Desasocia la poliza + If Not ErrorCompra Then + If Not ObjConta.DesasociarPoliza(IDPoliza, UsuarioActual.CveEmpresa) Then + ErrorCompra = True + End If + End If + If Not ErrorCompra Then If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then ErrorCompra = True End If - End If - - If Not ErrorCompra Then - Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion) - ObjAC.Commit() - ObjConta.Commit() - Else - Alert("Ocurrió un error al desvincular y/o eliminar la poliza. Por favor intente de nuevo ", TipoMensaje.MsgError) - ObjAC.RollBack() - ObjConta.RollBack() - End If - - ObjAC.Dispose() - ObjConta.Dispose() - - If Not ErrorCompra Then - CargaDatos() - End If - End Sub -#End Region - -#Region " CARGAR - COMPROBANTE " - Protected Sub BtnConfirmaComprobante_Click(sender As Object, e As EventArgs) - Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa) - Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) - - If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ArchivoTemporal) Then - Dim Extension As String = Path.GetExtension(ArchivoTemporal) - - Dim ObjIE As New ClsBancos - ObjIE.IniciaTransacSQL() - Dim TieneError = False - - If ObjIE.UpdateComprobanteIE(Extension.Replace("."c, ""), CveIE) Then - If Not Directory.Exists(DirectorioGuardar) Then Directory.CreateDirectory(DirectorioGuardar) - - 'Si ya existe el archivo lo eliminamos, para evitar error - If File.Exists(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) Then - File.Delete(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) - End If - - File.Move(ArchivoTemporal, String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) - - If Not File.Exists(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) Then - TieneError = True - End If - Else - TieneError = True - End If - - If Not TieneError Then - ObjIE.Commit() - Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion) - - If HplComprobante.Visible = False Then - HplComprobante.Visible = True - HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}{2}", UsuarioActual.CveEmpresa, CveIE, Extension) - UpDatos.Update() - End If - Else - ObjIE.RollBack() - Alert("Ocurrió un error al guardar el comprobante. Por favor vuelta a intentar.", TipoMensaje.MsgError) - End If - - Session("FileUpload") = "" - ObjIE.Dispose() - End If - End Sub - - Protected Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click - Dim ObjIE As New ClsBancos - Dim Comprobante As String = "" - - Dim Filesgral As List(Of Archivo) = TxtCargarArchivo.getfiles().Archivos - If Filesgral.Count > 0 Then - Dim fileItem As Archivo = Filesgral(0) - Dim Path As String = HttpContext.Current.Request.ApplicationPath - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Path = HttpContext.Current.Request.MapPath(Path) - Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa) - If Not Directory.Exists(Path) Then - Directory.CreateDirectory(Path) - End If - Path += $"/{CveIE}.{Comprobante}" - If File.Exists(Path) Then - File.Delete(Path) - End If - My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path) - End If - TxtCargarArchivo.Text = "" - RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") - - If ObjIE.UpdateComprobanteIE(Comprobante.Replace("."c, ""), CveIE) Then - Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion) - End If - - ObjIE.Dispose() - - End Sub - -#End Region - -#Region " DEVOLUCIONES " - Private Sub CargaIEDevoluciones() - Dim ObjMov As New ClsMovimientos - - If HdnCveProveedor.Value.ToEntero > 0 Or HdnCvePersonal.Value.ToEntero > 0 Then - trIEDevolucion.Visible = True - - If ObjMov.GetEgresosSinComprobar("-1", "-1", HdnCveProveedor.Value.ToEntero, HdnCvePersonal.Value.ToEntero, -1, -1, -1, DdlMoneda.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then - DtIEDevolucion = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "", {"CveIE", "IEDevolucion", "Saldo"}) - - Else - Alert("Ocurrió un error al cargar los Egresos del Proveedor seleccionado. Por favor vuelva a intetar.", TipoMensaje.MsgError) - End If - - End If - ObjMov.Dispose() - - 'CARGAMOS LOS IE EN EL DLL - DdlIEDevolucion.Items.Clear() - DdlIEDevolucion.DataSource = DtIEDevolucion - DdlIEDevolucion.DataBind() - DdlIEDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) - UpIEDevolucion.Update() - - End Sub - - Private Sub CargaIEDevolucionesClientes() - Dim ObjMov As New ClsMovimientos - - If HdnCveCliente.Value.ToEntero > 0 Then - trIEDevolucion.Visible = True - - If ObjMov.GetMovimientosIE(1, HdnCveCliente.Value.ToEntero, DdlCuenta.SelectedValue.ToEntero, Now.AddMonths(-24), Now, DdlMoneda.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then - DtIEDevolucion = ObjMov.DtResultados.FiltraParametros("Saldo > 0 ") - Else - Alert("Ocurrió un error al cargar los Egresos del Proveedor seleccionado. Por favor vuelva a intetar.", TipoMensaje.MsgError) - End If - - End If - ObjMov.Dispose() - - 'CARGAMOS LOS IE EN EL DLL - DdlIEDevolucion.Items.Clear() - DdlIEDevolucion.DataSource = DtIEDevolucion - DdlIEDevolucion.DataBind() - DdlIEDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) - UpIEDevolucion.Update() - - End Sub - - Private Sub DdlIEDevolucion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIEDevolucion.SelectedIndexChanged - If DtIEDevolucion.Rows.Count > 0 Then - TxtImporte.Text = DtIEDevolucion.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIEDevolucion.SelectedValue.ToEntero)).FormatoNumero() - End If - UpDatos.Update() - End Sub - - Private Sub CargaGridTarjetas() - Dim ObjCreditos As New ClsBancos - ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero) - - DdlTarjeta.Items.Clear() - DdlTarjeta.DataSource = ObjCreditos.DtResultados - DdlTarjeta.DataBind() - DdlTarjeta.Items.Insert(0, New ListItem("Seleccione", "-1")) - - ObjCreditos.Dispose() - DivTarjeta.Visible = True - End Sub - -#End Region - -#Region "PAGO ACREEDORES" - Private Sub CargaIEIngresos() - Dim ObjMov As New ClsMovimientos - - - If HdnCveProveedor.Value.ToEntero > 0 Then - DivIEAcreedor.Visible = True - DdlIEDevolucion.Items.Clear() - - If ObjMov.GetIngresosAcreedorXSaldar(HdnCveProveedor.Value.ToEntero, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - DdlIEAcreedor.DataSource = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "", {"CveIE", "IEAcreedor", "Saldo"}) - DdlIEAcreedor.DataBind() - DdlIEAcreedor.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - End If - ObjMov.Dispose() - UpIEAcreedor.Update() - End Sub -#End Region - -#Region "I M P R I M E P D F - N U E V O -" - Private Sub ImprimirIEPDF(CveTipoTransaccion As Integer) - Dim Archivo As System.IO.FileInfo = Nothing - - 'VERIFICA SI EXISTE EL FORMATO - If CveTipoTransaccion.Contiene(2, 8, 9, 10) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) - ElseIf CveTipoTransaccion.Contiene(1) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, CveCuenta)) - End If - - ''PRUEBAS AD-TEAM - 'LnkImprimir.Visible = False - 'If UsuarioActual.CveUsuario = 100 Then - ' LnkImprimir.Visible = True - 'End If - - If Archivo IsNot Nothing AndAlso Archivo.Exists Then - HLImprimir.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))) - HLImprimir.Visible = True - Else - HLImprimir.Visible = False - End If - - End Sub -#End Region - -#Region " CUENTAS DEPOSITOS " - 'Si la cuenta no esta activa, no la muestra. - Private Sub CargaCuentasDepositos() - DdlCuentaDeposito.Items.Clear() - 'If DdlTipoTransaccion.SelectedValue.Contiene("2", "9") Then ' transferencias y layout - trCuentaDeposito.Visible = False - - - Dim Dep As New ClsGenerales - If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCliente:=CveCliente, CvePersonal:=CvePersonal) Then - - If DdlTipoTransaccion.SelectedValue = "9" Then - - DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'") - - If Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'").Rows.Count > 0 Then - trCuentaDeposito.Visible = True - DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) - Else - Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) - End If - - Else - DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'") - If Dep.DtResultados.Rows.Count > 0 Then - trCuentaDeposito.Visible = True - DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) - End If - End If - - - ''ANTIGUO - 'GVCuentasPago.DataSource = Dep.DtResultados - 'If Dep.DtResultados.Rows.Count > 1 Then - ' trCuentaDeposito.Visible = True - ' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) - - ' 'Si tiene seleccionado Tipo Mov: Layout y no tiene cuenta deposito - 'ElseIf DdlTipoTransaccion.SelectedValue = "9" AndAlso Not Dep.DtResultados.Rows.Count > 0 Then - ' trCuentaDeposito.Visible = True - ' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) - - ' BtnIEGuardar.Enabled = False - ' UpGuardar.Update() - ' Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) - 'End If - - End If - Dep.Dispose() - - 'If DdlTipoTransaccion.SelectedValue = "9" AndAlso DdlCuentaDeposito.Items.Count = 0 Then - ' BtnIEGuardar.Enabled = False - 'End If - - 'GVCuentasPago.DataBind() - DdlCuentaDeposito.DataBind() - - 'Else - ' trCuentaDeposito.Visible = False - ' DdlCuentaDeposito.Items.Clear() - 'End If - RecargaGlobalCuentasBancarias() - UpCuentaDeposito.Update() - UpDatos.Update() - End Sub + End If + + If Not ErrorCompra Then + Alert("La poliza ha sido desvinculada y eliminada con exito.", TipoMensaje.MsgInformacion) + ObjAC.Commit() + ObjConta.Commit() + Else + Alert("Ocurrió un error al desvincular y/o eliminar la poliza. Por favor intente de nuevo ", TipoMensaje.MsgError) + ObjAC.RollBack() + ObjConta.RollBack() + End If + + ObjAC.Dispose() + ObjConta.Dispose() + + If Not ErrorCompra Then + CargaDatos() + End If + End Sub +#End Region + +#Region " CARGAR - COMPROBANTE " + Protected Sub BtnConfirmaComprobante_Click(sender As Object, e As EventArgs) + Dim DirectorioGuardar = String.Format("{0}Empresas\{1}\IE", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa) + Dim ArchivoTemporal = String.Format("{0}Empresas\{1}\Temp\{2}", Request.PhysicalApplicationPath, UsuarioActual.CveEmpresa, Session("FileUpload").ToString) + + If Session("FileUpload").ToString <> String.Empty AndAlso File.Exists(ArchivoTemporal) Then + Dim Extension As String = Path.GetExtension(ArchivoTemporal) + + Dim ObjIE As New ClsBancos + ObjIE.IniciaTransacSQL() + Dim TieneError = False + + If ObjIE.UpdateComprobanteIE(Extension.Replace("."c, ""), CveIE) Then + If Not Directory.Exists(DirectorioGuardar) Then Directory.CreateDirectory(DirectorioGuardar) + + 'Si ya existe el archivo lo eliminamos, para evitar error + If File.Exists(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) Then + File.Delete(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) + End If + + File.Move(ArchivoTemporal, String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) + + If Not File.Exists(String.Format("{0}\{1}{2}", DirectorioGuardar, CveIE, Extension)) Then + TieneError = True + End If + Else + TieneError = True + End If + + If Not TieneError Then + ObjIE.Commit() + Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion) + + If HplComprobante.Visible = False Then + HplComprobante.Visible = True + HplComprobante.NavigateUrl = String.Format("/Empresas/{0}/IE/{1}{2}", UsuarioActual.CveEmpresa, CveIE, Extension) + UpDatos.Update() + End If + Else + ObjIE.RollBack() + Alert("Ocurrió un error al guardar el comprobante. Por favor vuelta a intentar.", TipoMensaje.MsgError) + End If + + Session("FileUpload") = "" + ObjIE.Dispose() + End If + End Sub + + Protected Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click + Dim ObjIE As New ClsBancos + Dim Comprobante As String = "" + + Dim Filesgral As List(Of Archivo) = TxtCargarArchivo.getfiles().Archivos + If Filesgral.Count > 0 Then + Dim fileItem As Archivo = Filesgral(0) + Dim Path As String = HttpContext.Current.Request.ApplicationPath + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Path = HttpContext.Current.Request.MapPath(Path) + Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa) + If Not Directory.Exists(Path) Then + Directory.CreateDirectory(Path) + End If + Path += $"/{CveIE}.{Comprobante}" + If File.Exists(Path) Then + File.Delete(Path) + End If + My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path) + End If + TxtCargarArchivo.Text = "" + RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") + + If ObjIE.UpdateComprobanteIE(Comprobante.Replace("."c, ""), CveIE) Then + Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion) + End If + + ObjIE.Dispose() + + End Sub + +#End Region + +#Region " DEVOLUCIONES " + Private Sub CargaIEDevoluciones() + Dim ObjMov As New ClsMovimientos + + If HdnCveProveedor.Value.ToEntero > 0 Or HdnCvePersonal.Value.ToEntero > 0 Then + trIEDevolucion.Visible = True + + If ObjMov.GetEgresosSinComprobar("-1", "-1", HdnCveProveedor.Value.ToEntero, HdnCvePersonal.Value.ToEntero, -1, -1, -1, DdlMoneda.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + DtIEDevolucion = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "", {"CveIE", "IEDevolucion", "Saldo"}) + + Else + Alert("Ocurrió un error al cargar los Egresos del Proveedor seleccionado. Por favor vuelva a intetar.", TipoMensaje.MsgError) + End If + + End If + ObjMov.Dispose() + + 'CARGAMOS LOS IE EN EL DLL + DdlIEDevolucion.Items.Clear() + DdlIEDevolucion.DataSource = DtIEDevolucion + DdlIEDevolucion.DataBind() + DdlIEDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) + UpIEDevolucion.Update() + + End Sub + + Private Sub CargaIEDevolucionesClientes() + Dim ObjMov As New ClsMovimientos + + If HdnCveCliente.Value.ToEntero > 0 Then + trIEDevolucion.Visible = True + + If ObjMov.GetMovimientosIE(1, HdnCveCliente.Value.ToEntero, DdlCuenta.SelectedValue.ToEntero, Now.AddMonths(-24), Now, DdlMoneda.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + DtIEDevolucion = ObjMov.DtResultados.FiltraParametros("Saldo > 0 ") + Else + Alert("Ocurrió un error al cargar los Egresos del Proveedor seleccionado. Por favor vuelva a intetar.", TipoMensaje.MsgError) + End If + + End If + ObjMov.Dispose() + + 'CARGAMOS LOS IE EN EL DLL + DdlIEDevolucion.Items.Clear() + DdlIEDevolucion.DataSource = DtIEDevolucion + DdlIEDevolucion.DataBind() + DdlIEDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) + UpIEDevolucion.Update() + + End Sub + + Private Sub DdlIEDevolucion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIEDevolucion.SelectedIndexChanged + If DtIEDevolucion.Rows.Count > 0 Then + TxtImporte.Text = DtIEDevolucion.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIEDevolucion.SelectedValue.ToEntero)).FormatoNumero() + End If + UpDatos.Update() + End Sub + + Private Sub CargaGridTarjetas() + Dim ObjCreditos As New ClsBancos + ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero) + + DdlTarjeta.Items.Clear() + DdlTarjeta.DataSource = ObjCreditos.DtResultados + DdlTarjeta.DataBind() + DdlTarjeta.Items.Insert(0, New ListItem("Seleccione", "-1")) + + ObjCreditos.Dispose() + DivTarjeta.Visible = True + End Sub + +#End Region + +#Region "PAGO ACREEDORES" + Private Sub CargaIEIngresos() + Dim ObjMov As New ClsMovimientos + + + If HdnCveProveedor.Value.ToEntero > 0 Then + DivIEAcreedor.Visible = True + DdlIEDevolucion.Items.Clear() + + If ObjMov.GetIngresosAcreedorXSaldar(HdnCveProveedor.Value.ToEntero, DdlMoneda.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + DdlIEAcreedor.DataSource = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "", {"CveIE", "IEAcreedor", "Saldo"}) + DdlIEAcreedor.DataBind() + DdlIEAcreedor.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + End If + ObjMov.Dispose() + UpIEAcreedor.Update() + End Sub +#End Region + +#Region "I M P R I M E P D F - N U E V O -" + Private Sub ImprimirIEPDF(CveTipoTransaccion As Integer) + Dim Archivo As System.IO.FileInfo = Nothing + + 'VERIFICA SI EXISTE EL FORMATO + If CveTipoTransaccion.Contiene(2, 8, 9, 10) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) + ElseIf CveTipoTransaccion.Contiene(1) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, CveCuenta)) + End If + + ''PRUEBAS AD-TEAM + 'LnkImprimir.Visible = False + 'If UsuarioActual.CveUsuario = 100 Then + ' LnkImprimir.Visible = True + 'End If + + If Archivo IsNot Nothing AndAlso Archivo.Exists Then + HLImprimir.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))) + HLImprimir.Visible = True + Else + HLImprimir.Visible = False + End If + + End Sub +#End Region + +#Region " CUENTAS DEPOSITOS " + 'Si la cuenta no esta activa, no la muestra. + Private Sub CargaCuentasDepositos() + DdlCuentaDeposito.Items.Clear() + 'If DdlTipoTransaccion.SelectedValue.Contiene("2", "9") Then ' transferencias y layout + trCuentaDeposito.Visible = False + + + Dim Dep As New ClsGenerales + If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCliente:=CveCliente, CvePersonal:=CvePersonal) Then + + If DdlTipoTransaccion.SelectedValue = "9" Then + + DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'") + + If Dep.DtResultados.FiltraParametros("EstatusPagoElectronico = 'True' AND Estatus ='True'").Rows.Count > 0 Then + trCuentaDeposito.Visible = True + DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + Else + Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) + End If + + Else + DdlCuentaDeposito.DataSource = Dep.DtResultados.FiltraParametros("Estatus ='True'") + If Dep.DtResultados.Rows.Count > 0 Then + trCuentaDeposito.Visible = True + DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + End If + End If + + + ''ANTIGUO + 'GVCuentasPago.DataSource = Dep.DtResultados + 'If Dep.DtResultados.Rows.Count > 1 Then + ' trCuentaDeposito.Visible = True + ' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + + ' 'Si tiene seleccionado Tipo Mov: Layout y no tiene cuenta deposito + 'ElseIf DdlTipoTransaccion.SelectedValue = "9" AndAlso Not Dep.DtResultados.Rows.Count > 0 Then + ' trCuentaDeposito.Visible = True + ' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + + ' BtnIEGuardar.Enabled = False + ' UpGuardar.Update() + ' Alert("El proveedor no tiene ninguna cuenta deposito registrada ante el sistema BBVA BANCOMER", TipoMensaje.MsgAdvertencia) + 'End If + + End If + Dep.Dispose() + + 'If DdlTipoTransaccion.SelectedValue = "9" AndAlso DdlCuentaDeposito.Items.Count = 0 Then + ' BtnIEGuardar.Enabled = False + 'End If + + 'GVCuentasPago.DataBind() + DdlCuentaDeposito.DataBind() + + 'Else + ' trCuentaDeposito.Visible = False + ' DdlCuentaDeposito.Items.Clear() + 'End If + RecargaGlobalCuentasBancarias() + UpCuentaDeposito.Update() + UpDatos.Update() + End Sub Private Sub RecargaCuentasDepositos() - If CveProveedor > 0 Then - - Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing - If dr IsNot Nothing Then - HdnTipoTransaccion.Value = dr("Tipo").ToString - End If - 'cuando es transferencia bancaria, debe de solicitar a que cuenta se va a depositar - CargaCuentasDepositos() - - End If - - + If CveProveedor > 0 Then + + Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing + If dr IsNot Nothing Then + HdnTipoTransaccion.Value = dr("Tipo").ToString + End If + 'cuando es transferencia bancaria, debe de solicitar a que cuenta se va a depositar + CargaCuentasDepositos() + + End If + + If CveCliente > 0 Then CargaCuentasDepositoClientes() - End If - - End Sub - - 'Recaga CuentasBancarias de Proveedor - Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1) - If CveProveedor > 0 Then - Dim ObjCuentasBancos As New ClsGenerales - - If ObjCuentasBancos.GetCuentasDepositos() Then - GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados - End If - ObjCuentasBancos.Dispose() - End If - End Sub - Protected Sub DdlCuentaDeposito_SelectedIndexChanged(sender As Object, e As EventArgs) - Dim Dep As New ClsGenerales - If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero) AndAlso Dep.DtResultados.Rows.Count = 1 Then - If Dep.DtResultados.Rows(0)("TieneCIE").ToString.ToEntero = 1 Then - TrReferenciaCIE.Visible = True - TxtReferenciaCIE.Text = Dep.DtResultados.Rows(0)("Referencia").ToString - Else - TrReferenciaCIE.Visible = False - End If - End If - Dep.Dispose() - UpCuentaDeposito.Update() - End Sub -#End Region - -#Region "Historial de Modificacion" - - Private Sub CargaGvBitacora() - Dim ObjGral As New ClsGenerales() - If ObjGral.GetHistorialBitacora(-1, -1, -1, -1, -1, -1, CveIE, UsuarioActual.CveEmpresa) Then - GvBitacora.DataSource = ObjGral.DtResultados - GvBitacora.DataBind() - End If - ObjGral.Dispose() - UpDatos.Update() - End Sub - - Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles BtnRemove.Click - If Not TxtDescripcion.Text = "" Then - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - Dim ObjGral As New ClsGenerales - If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Banco", TxtFolio.Text + " / " + Cuenta) Then - Borrar = True - End If - ObjGral.Dispose() - If Borrar = True Then - Dim ObjAC As ClsContPAQi = Nothing + End If + + End Sub + + 'Recaga CuentasBancarias de Proveedor + Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1) + If CveProveedor > 0 Then + Dim ObjCuentasBancos As New ClsGenerales + + If ObjCuentasBancos.GetCuentasDepositos() Then + GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados + End If + ObjCuentasBancos.Dispose() + End If + End Sub + Protected Sub DdlCuentaDeposito_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim Dep As New ClsGenerales + If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero) AndAlso Dep.DtResultados.Rows.Count = 1 Then + If Dep.DtResultados.Rows(0)("TieneCIE").ToString.ToEntero = 1 Then + TrReferenciaCIE.Visible = True + TxtReferenciaCIE.Text = Dep.DtResultados.Rows(0)("Referencia").ToString + Else + TrReferenciaCIE.Visible = False + End If + End If + Dep.Dispose() + UpCuentaDeposito.Update() + End Sub +#End Region + +#Region "Historial de Modificacion" + + Private Sub CargaGvBitacora() + Dim ObjGral As New ClsGenerales() + If ObjGral.GetHistorialBitacora(-1, -1, -1, -1, -1, -1, CveIE, UsuarioActual.CveEmpresa) Then + GvBitacora.DataSource = ObjGral.DtResultados + GvBitacora.DataBind() + End If + ObjGral.Dispose() + UpDatos.Update() + End Sub + + Private Sub BtnRemove_Click(sender As Object, e As EventArgs) Handles BtnRemove.Click + + + + If Not TxtDescripcion.Text = "" Then + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + Dim ObjGral As New ClsGenerales + If ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, TxtDescripcion.Text, "Banco", TxtFolio.Text + " / " + Cuenta) Then + Borrar = True + End If + ObjGral.Dispose() + If Borrar = True Then + Dim ObjAC As ClsContPAQi = Nothing Dim Banc As New ClsBancos - Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) - - Dim ErrorCompra = False - - 'VERIFICA SI EL IES ESTA VINCULADO A UNA SOLICITUD VIATICO - If Banc.GetSolicitudesViaticos(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) AndAlso Banc.DtResultados.Rows.Count > 0 Then - If Not Banc.UpdateSolicitudesViaticosIE(Banc.DtResultados.FiltroPrimeroValor("CveSolicitudViatico").ToEntero(), -1) Then - ErrorCompra = True - End If - End If - - If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IDPoliza > 0 Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - If Not ObjAC.RemovePoliza(IDPoliza) Then - ErrorCompra = True - End If - End If - + Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL()) + + Dim ErrorCompra = False + + 'VERIFICA SI EL IES ESTA VINCULADO A UNA SOLICITUD VIATICO + If Banc.GetSolicitudesViaticos(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) AndAlso Banc.DtResultados.Rows.Count > 0 Then + If Not Banc.UpdateSolicitudesViaticosIE(Banc.DtResultados.FiltroPrimeroValor("CveSolicitudViatico").ToEntero(), -1) Then + ErrorCompra = True + End If + End If + + If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IDPoliza > 0 Then + ObjAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjAC.IniciaTransacSQL() + If Not ObjAC.RemovePoliza(IDPoliza) Then + ErrorCompra = True + End If + End If + If Not ErrorCompra Then If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then ErrorCompra = True End If - End If - - - If Not ErrorCompra Then - If Not Banc.EliminarBancos_IE(UsuarioActual.CveUsuario, CveIE) Then - ErrorCompra = True - End If - End If - - If Not ErrorCompra Then - Alert("El documento bancario quedó eliminado.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") - If ObjAC IsNot Nothing Then ObjAC.Commit() - Banc.Commit() - Else - Alert("El documento no ha sido eliminado.", TipoMensaje.MsgAdvertencia) - If ObjAC IsNot Nothing Then ObjAC.RollBack() - Banc.RollBack() - End If - - If ObjAC IsNot Nothing Then ObjAC.Dispose() - Banc.Dispose() - ObjConta.Dispose() - End If - Else - Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion) - End If - End Sub -#End Region - -#Region " SOLICITUD DE ANTICIPO OC " - Private Sub InicializaSolicitudAnticipoOC() - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then - If Request("CveOC") IsNot Nothing AndAlso Request("CveOC").ToString.ToEntero > 0 Then - CveOCSolicitudAnticipo = Request("CveOC").ToString.ToEntero - End If - End If - - If CveOCSolicitudAnticipo > 0 Then - - Dim ObjOC As New ClsOC - If ObjOC.GetSolicitudAnticipo(CveOCSolicitudAnticipo, UsuarioActual.CveEmpresa) AndAlso ObjOC.DtResultados.Rows.Count > 0 Then - Dim DrOC = ObjOC.DtResultados.FiltroPrimero("") - If DrOC("TipoTermino").ToString.ToEntero.Contiene(0, 3) AndAlso DrOC("CveIEAnticipo").ToString = "" Then - TxtObservaciones.Text = DrOC("Descripcion").ToString - TxtImporte.Text = DrOC("ImporteAnticipo").ToString.FormatoNumero - TxtImporteLetra.Text = DrOC("ImporteAnticipo").ToString.ToDouble.Texto2Letras(DrOC("CveMoneda").ToString.ToEntero) - DdlMoneda.SelectedValue = DrOC("CveMoneda").ToString - CveMoneda = DrOC("CveMoneda").ToString.ToEntero - CargaCuenta(DrOC("CveMoneda").ToString.ToEntero) - UpCuentaDeposito.Update() - If DrOC("CveProveedor").ToString.ToEntero > 0 Then - HdnCveProveedor.Value = DrOC("CveProveedor").ToString - RBL.SelectedValue = "P" - RBL_SelectedIndexChanged(RBL, Nothing) - DdlProveedores.SelectedValue = HdnCveProveedor.Value - DdlProveedores_selectedindexchange(DdlProveedores, Nothing) - DdlProveedores.SelectedText = RazonSocial - ' BuscaCargaProveedor() - End If - CveOCSolicitudAnticipo = DrOC("CveOC").ToString.ToEntero - Else - If DrOC("CveIEAnticipo").ToString <> "" Then - Alert($"La {DrOC("Tipo")} #{DrOC("Folio")} ya se le ha generado un anticipo.", TipoMensaje.MsgError) - End If - If DrOC("TipoTermino").ToString = "3" Then ' cuando es tipo rechazado - Alert($"La {DrOC("Tipo")} #{DrOC("Folio")} ha sido cancelada.", TipoMensaje.MsgError) - End If - - CveOCSolicitudAnticipo = -1 - BtnGuardar.Enabled = False - End If - Else - Alert("Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar.", TipoMensaje.MsgError) - End If - ObjOC.Dispose() - - End If - End Sub - Private Function GuardaSolicitudAnticipoOC(ByRef ObjOC As ClsOC) As String - Dim ObjOI As New ClsOIEventos - Dim CveEvento As Integer = 0 - Dim CveEventoPrincipal As Integer = 0 - - If CveOCSolicitudAnticipo > 0 Then - If Not ObjOC.AddSolicitudAnticipoPago(CveOCSolicitudAnticipo, CveIE, UsuarioActual.CveEmpresa) Then - ObjOI.Dispose() - Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." - End If - - If ObjOI.GetEventos(-1, 6, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, CveOCSolicitudAnticipo, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - CveEvento = ObjOI.CveEvento - End If - - If ObjOI.GetEventos(-1, 1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, Request("CveOC").ToString.ToEntero, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - CveEventoPrincipal = ObjOI.CveEvento - End If - - If Not ObjOI.UpdateEstatusEvento(3, -1, CveEvento, UsuarioActual.CveUsuario) Then - ObjOI.Dispose() - Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." - End If - - If Request("CveOC").ToString.ToEntero > 0 Then - If Not ObjOI.UpdateEstatusEvento(3, -1, CveEventoPrincipal, UsuarioActual.CveUsuario) Then - ObjOI.Dispose() - Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." - End If - End If - End If - ObjOI.Dispose() - Return "" - End Function -#End Region + End If -#Region " COMPLEMENTOS PAGO " + + If Not ErrorCompra Then + If Not Banc.EliminarBancos_IE(UsuarioActual.CveUsuario, CveIE) Then + ErrorCompra = True + End If + End If + + If Not ErrorCompra Then + Alert("El documento bancario quedó eliminado.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") + If ObjAC IsNot Nothing Then ObjAC.Commit() + Banc.Commit() + Else + Alert("El documento no ha sido eliminado.", TipoMensaje.MsgAdvertencia) + If ObjAC IsNot Nothing Then ObjAC.RollBack() + Banc.RollBack() + End If + + If ObjAC IsNot Nothing Then ObjAC.Dispose() + Banc.Dispose() + ObjConta.Dispose() + End If + Else + Alert("Tiene que decir el motivo de su eliminacion.", TipoMensaje.MsgInformacion) + End If + End Sub +#End Region + +#Region " SOLICITUD DE ANTICIPO OC " + Private Sub InicializaSolicitudAnticipoOC() + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then + If Request("CveOC") IsNot Nothing AndAlso Request("CveOC").ToString.ToEntero > 0 Then + CveOCSolicitudAnticipo = Request("CveOC").ToString.ToEntero + End If + End If + + If CveOCSolicitudAnticipo > 0 Then + + Dim ObjOC As New ClsOC + If ObjOC.GetSolicitudAnticipo(CveOCSolicitudAnticipo, UsuarioActual.CveEmpresa) AndAlso ObjOC.DtResultados.Rows.Count > 0 Then + Dim DrOC = ObjOC.DtResultados.FiltroPrimero("") + If DrOC("TipoTermino").ToString.ToEntero.Contiene(0, 3) AndAlso DrOC("CveIEAnticipo").ToString = "" Then + TxtObservaciones.Text = DrOC("Descripcion").ToString + TxtImporte.Text = DrOC("ImporteAnticipo").ToString.FormatoNumero + TxtImporteLetra.Text = DrOC("ImporteAnticipo").ToString.ToDouble.Texto2Letras(DrOC("CveMoneda").ToString.ToEntero) + DdlMoneda.SelectedValue = DrOC("CveMoneda").ToString + CveMoneda = DrOC("CveMoneda").ToString.ToEntero + CargaCuenta(DrOC("CveMoneda").ToString.ToEntero) + UpCuentaDeposito.Update() + If DrOC("CveProveedor").ToString.ToEntero > 0 Then + HdnCveProveedor.Value = DrOC("CveProveedor").ToString + RBL.SelectedValue = "P" + RBL_SelectedIndexChanged(RBL, Nothing) + DdlProveedores.SelectedValue = HdnCveProveedor.Value + DdlProveedores_selectedindexchange(DdlProveedores, Nothing) + DdlProveedores.SelectedText = RazonSocial + ' BuscaCargaProveedor() + End If + CveOCSolicitudAnticipo = DrOC("CveOC").ToString.ToEntero + Else + If DrOC("CveIEAnticipo").ToString <> "" Then + Alert($"La {DrOC("Tipo")} #{DrOC("Folio")} ya se le ha generado un anticipo.", TipoMensaje.MsgError) + End If + If DrOC("TipoTermino").ToString = "3" Then ' cuando es tipo rechazado + Alert($"La {DrOC("Tipo")} #{DrOC("Folio")} ha sido cancelada.", TipoMensaje.MsgError) + End If + + CveOCSolicitudAnticipo = -1 + BtnGuardar.Enabled = False + End If + Else + Alert("Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar.", TipoMensaje.MsgError) + End If + ObjOC.Dispose() + + End If + End Sub + Private Function GuardaSolicitudAnticipoOC(ByRef ObjOC As ClsOC) As String + Dim ObjOI As New ClsOIEventos + Dim CveEvento As Integer = 0 + Dim CveEventoPrincipal As Integer = 0 + + If CveOCSolicitudAnticipo > 0 Then + If Not ObjOC.AddSolicitudAnticipoPago(CveOCSolicitudAnticipo, CveIE, UsuarioActual.CveEmpresa) Then + ObjOI.Dispose() + Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." + End If + + If ObjOI.GetEventos(-1, 6, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, CveOCSolicitudAnticipo, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + CveEvento = ObjOI.CveEvento + End If + + If ObjOI.GetEventos(-1, 1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, Request("CveOC").ToString.ToEntero, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + CveEventoPrincipal = ObjOI.CveEvento + End If + + If Not ObjOI.UpdateEstatusEvento(3, -1, CveEvento, UsuarioActual.CveUsuario) Then + ObjOI.Dispose() + Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." + End If + + If Request("CveOC").ToString.ToEntero > 0 Then + If Not ObjOI.UpdateEstatusEvento(3, -1, CveEventoPrincipal, UsuarioActual.CveUsuario) Then + ObjOI.Dispose() + Return "Ocurrió un error al actualizar el estatus de anticipo de la OC/REQ. Por favor actualice y vuelva a intentar." + End If + End If + End If + ObjOI.Dispose() + Return "" + End Function +#End Region + +#Region " COMPLEMENTOS PAGO " Private Sub CargaComplementosPago() - Dim ObjBancos As New ClsBancos - - If UsuarioActual.CveRol = 1 Then - GvComplementoPagos.Columns(7).Visible = True + Dim ObjBancos As New ClsBancos + + If UsuarioActual.CveRol = 1 Then + GvComplementoPagos.Columns(7).Visible = True End If - DVGenerarComplementoModal.Visible = False - - If ObjBancos.GetVincularPago(CveProveedor, CveCompra, 2, MinFecha, MaxFecha, UsuarioActual.CveEmpresa, CveIE) Then - + DVGenerarComplementoModal.Visible = False + + If ObjBancos.GetVincularPago(CveProveedor, CveCompra, 2, MinFecha, MaxFecha, UsuarioActual.CveEmpresa, CveIE) Then + GvComplementoPagos.DataSource = ObjBancos.DtResultados If ObjBancos.DtResultados.FiltraParametros(" Estatus IN (1,3) ").Rows.Count = 0 And Tipo.ToUpper = "CARGO" And CveCliente > 0 And UsuarioActual.CveRol = 1 And CveEstatusIE <> 2 Then DVGenerarComplementoModal.Visible = True - End If + End If Else - GvComplementoPagos.DataSource = Nothing - End If - - ObjBancos.Dispose() - GvComplementoPagos.DataBind() - UpComplementoPagos.Update() - - 'If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then - ' GvComplementoPagos.DataSource = ObjBancos.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}) - 'End If - - 'ObjBancos.Dispose() - 'GvComplementoPagos.DataBind() - 'UpComplementoPagos.Update() - End Sub - - Protected Sub GvComplementoPagos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvComplementoPagos.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) - e.Row.Cells(4).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) - - If e.Row.DataKey("Estatus").Contiene("1", "3") Then + GvComplementoPagos.DataSource = Nothing + End If + + ObjBancos.Dispose() + GvComplementoPagos.DataBind() + UpComplementoPagos.Update() + + 'If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then + ' GvComplementoPagos.DataSource = ObjBancos.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}) + 'End If + + 'ObjBancos.Dispose() + 'GvComplementoPagos.DataBind() + 'UpComplementoPagos.Update() + End Sub + + Protected Sub GvComplementoPagos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvComplementoPagos.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) + e.Row.Cells(4).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) + + If e.Row.DataKey("Estatus").Contiene("1", "3") Then e.Row.FCLinkButton("LnkCancelarComplemetno").Visible = True - Else + Else e.Row.FCLinkButton("LnkCancelarComplemetno").Visible = False - End If - - End If - - End Sub - - Private Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) Handles LnkComplementoPago.Click - CargaComplementosPago() - RegistraScript("$('#ModalComplementoPagos').modal('show');") - End Sub - - - Protected Sub imgRegenerar_Click(sender As Object, e As EventArgs) - Dim gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) - Dim FolioFiscalPadre As String = gvr.DataKey("FolioFiscal") - - If FolioFiscalPadre <> "" Then - Dim Str As New StringBuilder - Dim ObjBanco As New ClsBancos - ObjBanco.IniciaTransacSQL() - - If ObjBanco.GeneraTimbrePago(CveIE, -1, UsuarioActual, -1, FolioFiscalPadre, EsRegeneracion:=True) Then - ObjBanco.Commit() - Str.AppendFormat("Folio: {0}  ", ObjBanco.ComplementoSerieFolio) - Str.AppendFormat("XML    ", Encripta(String.Format("OP=Pag&EXT=xml&CveIE={0}&SerieFolio={1}", gvr.DataKey("CveIE").ToEntero, ObjBanco.ComplementoSerieFolio.Replace("&", "%26%")))) - Str.AppendFormat("PDF   ", Encripta(String.Format("OP=Pag&EXT=pdf&CveIE={0}&SerieFolio={1}", gvr.DataKey("CveIE").ToEntero, ObjBanco.ComplementoSerieFolio.Replace("&", "%26%")))) - 'Str.Append($"{gvr.DataKey("Folio")}   {gvr.DataKey("NombreCliente")}
") - PDFReciboDePagos(-1, gvr.DataKey("CveIE").ToEntero, ObjBanco.CveComplementoPago, False) - Alert(Str.ToString, TipoMensaje.MsgInformacion) - CargaComplementosPago() - Else - Str.AppendFormat("No se genero complemento del Folio {0} por el siguiente motivo: {1}", gvr.DataKey("Folio"), ObjBanco.Mensaje) - Alert(Str.ToString, TipoMensaje.MsgError) - ObjBanco.RollBack() - End If - - ObjBanco.Dispose() - Else - Alert("El complemento no tiene Folio Fiscal", TipoMensaje.MsgError) - End If - - End Sub - - - - - - Private Function VerificaComplementos(Validos As Boolean) As Boolean - Dim ObjBancos As New ClsBancos - Dim Retorno As Boolean = False - Dim Filtro As String = "" - - + End If + + End If + + End Sub + + Private Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) Handles LnkComplementoPago.Click + CargaComplementosPago() + RegistraScript("$('#ModalComplementoPagos').modal('show');") + End Sub + + + Protected Sub imgRegenerar_Click(sender As Object, e As EventArgs) + Dim gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + Dim FolioFiscalPadre As String = gvr.DataKey("FolioFiscal") + + If FolioFiscalPadre <> "" Then + Dim Str As New StringBuilder + Dim ObjBanco As New ClsBancos + ObjBanco.IniciaTransacSQL() + + If ObjBanco.GeneraTimbrePago(CveIE, -1, UsuarioActual, -1, FolioFiscalPadre, EsRegeneracion:=True) Then + ObjBanco.Commit() + Str.AppendFormat("Folio: {0}  ", ObjBanco.ComplementoSerieFolio) + Str.AppendFormat("XML    ", Encripta(String.Format("OP=Pag&EXT=xml&CveIE={0}&SerieFolio={1}", gvr.DataKey("CveIE").ToEntero, ObjBanco.ComplementoSerieFolio.Replace("&", "%26%")))) + Str.AppendFormat("PDF   ", Encripta(String.Format("OP=Pag&EXT=pdf&CveIE={0}&SerieFolio={1}", gvr.DataKey("CveIE").ToEntero, ObjBanco.ComplementoSerieFolio.Replace("&", "%26%")))) + 'Str.Append($"{gvr.DataKey("Folio")}   {gvr.DataKey("NombreCliente")}
") + PDFReciboDePagos(-1, gvr.DataKey("CveIE").ToEntero, ObjBanco.CveComplementoPago, False) + Alert(Str.ToString, TipoMensaje.MsgInformacion) + CargaComplementosPago() + Else + Str.AppendFormat("No se genero complemento del Folio {0} por el siguiente motivo: {1}", gvr.DataKey("Folio"), ObjBanco.Mensaje) + Alert(Str.ToString, TipoMensaje.MsgError) + ObjBanco.RollBack() + End If + + ObjBanco.Dispose() + Else + Alert("El complemento no tiene Folio Fiscal", TipoMensaje.MsgError) + End If + + End Sub + + + + + + Private Function VerificaComplementos(Validos As Boolean) As Boolean + Dim ObjBancos As New ClsBancos + Dim Retorno As Boolean = False + Dim Filtro As String = "" + + If Validos Then Filtro = " Estatus IN(1,3) " Else Filtro = "" - End If - - If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) And ObjBancos.DtResultados.FiltraParametros(Filtro).Rows.Count > 0 Then - Retorno = True - Else - Retorno = False - End If - - - ObjBancos.Dispose() - Return Retorno - End Function - - Protected Sub LnkCancelarComplemento_Click(sender As Object, e As EventArgs) - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - Confirmacion("¿Seguro que desea Cancelar el documento por Sustitución?", "", String.Format("document.location.href=""/Ventas/ClientesAbonar.aspx?CveIESustitucion={0}&CveCliente={1}&CveMoneda={2}""", CveIE, CveCliente, CveMoneda), "") + End If + + If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) And ObjBancos.DtResultados.FiltraParametros(Filtro).Rows.Count > 0 Then + Retorno = True + Else + Retorno = False + End If + + + ObjBancos.Dispose() + Return Retorno + End Function + + Protected Sub LnkCancelarComplemento_Click(sender As Object, e As EventArgs) + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + Confirmacion("¿Seguro que desea Cancelar el documento por Sustitución?", "", String.Format("document.location.href=""/Ventas/ClientesAbonar.aspx?CveIESustitucion={0}&CveCliente={1}&CveMoneda={2}""", CveIE, CveCliente, CveMoneda), "") End Sub -#End Region +#End Region + +#Region " ACTUALIZAR TIPO CAMBIO PREPOLIZA " + Private Sub InicializaActualizarTC() + If CveIE > 0 And DdlMoneda.SelectedValue.ToEntero = 2 And CvePrePoliza > 0 Then + TxtActualizarTC_TCActual.Text = TxtTipoCambio.Text + TxtActualizarTC_TCActualizar.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) + HLModalActualizarTC.Visible = True + End If + End Sub + Protected Sub BtnActualizarTC_Click(sender As Object, e As EventArgs) + Dim ObjContabilidad As New ClsContabilidad + Dim ObjBancos As New ClsBancos(ObjContabilidad.IniciaTransacSQL()) + Dim ObjEventos As New ClsOIEventos(ObjContabilidad.IniciaTransacSQL()) + Dim TieneError = False + Dim MensajeError = "" + + If ObjEventos.AddEventoBitacora($"Se actualizó el Tipo de Cambio de la compra. TC anterior: {TxtActualizarTC_TCActual.Text.FormatoNumero(4)} | TC actual: {TxtActualizarTC_TCActualizar.Text.FormatoNumero(4)}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then + If ObjBancos.UpdateBancos_IETipoCambio(TxtActualizarTC_TCActualizar.Text.ToDouble, CveIE, CvePrePoliza, UsuarioActual.CveEmpresa) Then + If Not ObjContabilidad.ReconstruirPP_PagoCompraVenta(CveIE) Then + TieneError = True + MensajeError = "Ocurrió un error al actualizar el asiento contable" + End If + Else + TieneError = True + MensajeError = "Ocurrió un error al actualizar el Tipo de Cambio al documento" + End If + Else + TieneError = True + MensajeError = "Ocurrió un error al guardar el historal al actualizar el Tipo de Cambio al documento" + End If + + If Not TieneError Then + ObjContabilidad.Commit() + Alert("Se actualizó correctamente el tipo de cambio del documento.", TipoMensaje.MsgInformacion) + RegistraScript("$('#ModalActualizarTC').modal('hide');") + Else + ObjContabilidad.RollBack() + Alert(MensajeError, TipoMensaje.MsgError) + End If + + ObjContabilidad.Dispose() + End Sub +#End Region + +#Region "SOLICITAR VIATICOS VIATICOS" + + Protected Sub CargaDatosViaticos() + ViewState("CveSolicitudViatico") = Request("CveSolicitudViatico") + RBL.SelectedValue = "FE" + If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero > 0 Then + ViewState("CvePersonal") = Request("CvePersonal") + PersonalIndexChange(CvePersonal) + + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetSolicitudesViaticos(CveSolicitudViatico, UsuarioActual.CveEmpresa) AndAlso ObjBancos.DtResultados.Rows.Count > 0 Then + TxtImporte.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Importe").ToString.FormatoNumero + TxtImporteLetra.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Importe").ToString.ToDouble.Texto2Letras() + TxtObservaciones.Text = $"SOLICITUD DE VIÁTICOS - FOLIO {ObjBancos.DtResultados.FiltroPrimeroValor("Folio").ToString()}: {ObjBancos.DtResultados.FiltroPrimeroValor("Asunto").ToString()}." + End If + ObjBancos.Dispose() + End If + End Sub +#End Region + +#Region " DEVOLVER DINERO ANT/NC " + Private Sub InicializaDevolverDinero() + + If Opcion = "DevDinV" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then + + Dim ParametrosTexto As String = Decripta(Request("P")) + + If ParametrosTexto <> "" Then + CargaParametros(ParametrosTexto) + + HdnCveCliente.Value = UrlParametros("CVECLIENTE").ToString + CveCliente = UrlParametros("CVECLIENTE").ToString.ToEntero + CveVentaDevDin = UrlParametros("CVEVENTA").ToString.ToEntero + + SerieFolioDevDin = UrlParametros("SERIEFOLIO").ToString + CvePrePolizaDevDin = UrlParametros("CVEPREPOLIZA").ToString.ToEntero + ImporteOriginalDevDin = UrlParametros("ORIGINAL").ToString.ToDecimal.RoundSQL(6) + TxtImporte.Text = UrlParametros("SALDO").ToString.FormatoNumero() + TxtImporte.Attributes.Add("onkeyup", $"FormatoMoneda(this);ValidarCantidad(this,{UrlParametros("SALDO").ToString});") + TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero) + CargaCliente(CveCliente) + 'BuscarCliente() + + DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString + CveMoneda = DdlMoneda.SelectedValue.ToEntero + CargaCuenta(DdlMoneda.SelectedValue.ToEntero) + CambiaTipoMoneda() + UpCuentaDeposito.Update() + + End If + End If + + If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then + + Dim ParametrosTexto As String = Decripta(Request("P")) + + + If ParametrosTexto <> "" Then + CargaParametros(ParametrosTexto) + + HdnCveProveedor.Value = UrlParametros("CVEPROVEEDOR").ToString + CveProveedor = UrlParametros("CVEPROVEEDOR").ToString.ToEntero + + CveCompraDeCDin = UrlParametros("CVECOMPRA").ToString.ToEntero + SerieFolioDeCDin = UrlParametros("SERIEFOLIO").ToString + CvePrePolizaDeCDin = UrlParametros("CVEPREPOLIZA").ToString.ToEntero + FechaCompra = UrlParametros("FECHACOMPRA").ToString.ToDate + + ImporteOriginalDevDin = UrlParametros("ORIGINAL").ToString.ToDecimal.RoundSQL(6) + TxtImporte.Text = UrlParametros("SALDO").ToString.FormatoNumero() + TxtImporte.Attributes.Add("onkeyup", $"FormatoMoneda(this);ValidarCantidad(this,{UrlParametros("SALDO").ToString});") + TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero) + + CargaProveedor(CveProveedor, "-1") + 'BuscarCliente() + + DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString + CveMoneda = DdlMoneda.SelectedValue.ToEntero + CargaCuenta(DdlMoneda.SelectedValue.ToEntero) + CambiaTipoMoneda() + UpCuentaDeposito.Update() + + + End If + + End If + + + End Sub +#End Region + + +#Region "S A L D O - I N I C I A L" + Private Function AgregarSaldoInicial(SaldoInicial As Double, Fecha As DateTime, CveMoneda As Integer, ObjMov As ClsContabilidad) As Integer + Return ObjMov.AddPrePolizas("Bancos/IE", 13, SaldoInicial, SaldoInicial, CveMoneda, Fecha, "Saldo Inicial", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + End Function +#End Region + + Protected Sub LnkChqDevuelto_Click(sender As Object, e As EventArgs) + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + RegistraScript("ShowDivDevueltoIE();") + End Sub + + Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) + If ChkConciliado.Checked Then + Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + Exit Sub + End If + RegistraScript("ShowDivCancelarIE();") + End Sub + + Private Sub LnkEmitirComplemento_Click(sender As Object, e As EventArgs) Handles LnkEmitirComplemento.Click + GeneraTimbre() + CargaComplementosPago() + End Sub + + Private Sub GeneraTimbre() + + Dim Str As New StringBuilder + + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + + + If Banco.GeneraTimbrePago(CveIE, -1, UsuarioActual) Then + If Banco.Mensaje = "" Then + Banco.Commit() + PDFReciboDePagos(-1, -1, Banco.CveComplementoPago, False) + Str.AppendFormat("Folio: {0}  ", Banco.ComplementoSerieFolio) + Str.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + Str.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + Str.AppendFormat("{1}   {2}
", CveIE, Folio, DdlCliente.SelectedText.ToString()) + MandaCorreo(Banco.ComplementoSerieFolio, CorreoCobranzaCliente) + End If + + Else + Str.AppendFormat("No se genero complemento del Folio {0} por el siguiente motivo: {1}", Folio, Banco.Mensaje) + Banco.RollBack() + End If + + + Banco.Dispose() + CargaDatos() + Alert(Str.ToString) + End Sub + + Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) + Try + Dim Msg As String = "" + If NombreArchivo <> "-1" Then ' + + Dim ObjMail As New ClsSisMail() + Dim RutaXML As String = String.Format("{0}\XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim RutaPDF As String = String.Format("{0}\PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, NombreArchivo) + + Dim Cuerpo As String = "Se hace entrega del comprobante de pago" + Dim Asunto As String = "Entrega de comprobante de pago" + + If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then + + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) + + If ObjMail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Cuerpo, "", LSRutasMail) Then + + If ConAlerta Then + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + End If + + Else + Msg = "No se pudo enviar el correo electrónico." + End If + + Else + Msg = "No se pudo adjuntar el correo electrónico." + End If + + End If + + If ConAlerta AndAlso Msg <> "" Then + Alert(Msg, TipoMensaje.MsgError) + End If + + + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + + End Try + End Sub + + + Protected Sub LnkEliminaMovComprobacion_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim TieneError = False + If GvRH.Rows(gvRow.RowIndex).DataKey("CveIE").ToEntero > 0 Then + Dim ObjBancos As New ClsBancos + ObjBancos.IniciaTransacSQL() + + If Not ObjBancos.EliminarBancos_IEComprobacion(UsuarioActual.CveUsuario, GvRH.Rows(gvRow.RowIndex).DataKey("CveIE").ToEntero) Then + TieneError = True + Alert("Ocurrió un error al eliminar los Movimientos Bancarios. Por favor intente de nuevo", TipoMensaje.MsgError) + ObjBancos.RollBack() + Else + Alert("Los Movimientos Bancarios se eliminaron correctamente.", TipoMensaje.MsgInformacion) + ObjBancos.Commit() + End If + ObjBancos.Dispose() + End If + + If Not TieneError Then + DtGvRH.Rows.RemoveAt(gvRow.RowIndex) + DtGvRH.AcceptChanges() + End If + + CargaGvRH() + End Sub + + Private Function GeneraCorreo(CveIE As Integer) As String + Dim strBody As New StringBuilder + Dim objIE As New ClsBancos + + If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" {0}", UsuarioActual.Empresa.Empresa) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Direccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Colonia) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", UsuarioActual.Empresa.RFC) + strBody.AppendFormat(" ") + strBody.AppendFormat("
{0}
Col. {0}
{0}, {1}, C.P.{2}
RFC {0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("


") + + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + If objIE.CveTipoTransaccion = 2 Then ' cuando es transf + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + End If + + strBody.Append(" ") + strBody.AppendFormat(" ") + strBody.Append(" ") + strBody.Append("
Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.
Notificación de transferencia de pago realizada.
 
") + strBody.AppendFormat("
") + strBody.Append("
") + + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Beneficiario:{0} ", objIE.PagueseA) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.TipoTransaccion) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Banco) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.NumCuenta) + strBody.AppendFormat(" ") + If objIE.CuentaDepositado.ToString <> "" Then + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.CuentaDepositado) + strBody.AppendFormat(" ") + End If + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.FechaDocumento.ToString("dd/MM/yyyy")) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Importe.FormatoNumero, objIE.Moneda) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", objIE.Observaciones) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
Movimiento:{0}
Banco:{0}
Cuenta:{0}
Cuenta Destino:{0}
Fecha:{0}
Importe:$ {0} {1}
Observaciones:{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + + + 'MOVIMIENTOS CHEQUE + If objIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then + Dim Textov33 As String = "" + If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then + Textov33 = "Favor de emitir complemento de pago de los siguientes documentos" + End If + + strBody.AppendFormat("
") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat(" Documentos abonados o pagados
{0}
", Textov33) + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + + + For Each dr As DataRow In objIE.DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows + strBody.AppendFormat(" ") + strBody.AppendFormat(" ", dr("Fecha").ToString.ToDate.ToShortDateString()) + strBody.AppendFormat(" ", dr("SerieFolio").ToString) + strBody.AppendFormat(" ", dr("Importe").ToString.FormatoNumero) + strBody.AppendFormat(" ", dr("FolioFiscal")) + strBody.AppendFormat(" ", dr("ImporteNC").ToString.FormatoNumero) + strBody.AppendFormat(" ") + Next + + + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat(" ") + strBody.AppendFormat("
FechaFacturaImporte ($)Folio FiscalNC Aplicadas
{0}{0}$ {0}{0}{0}
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + strBody.AppendFormat("
") + End If + + strBody.Append("
Favor de no responder a este correo.
") + + strBody.Append("") + End If + + objIE.Dispose() + Return strBody.ToString + End Function + + Private Sub BtnSendMail_Click(sender As Object, e As EventArgs) Handles BtnSendMail.Click + 'NotificacionPago(HdnCveIE.Value.ToEntero, Txt) + Dim ObjMail As New ClsSisMail() + Dim Body = GeneraCorreo(CveIE) + + Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail) + + Dim ObjIE As New ClsBancos() + If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then + If ObjIE.DtResultados.Rows.Count > 0 Then + If ObjIE.Comprobante <> "" Then + ComprobanteIE = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString) + + If IO.File.Exists(ComprobanteIE) Then + ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = ComprobanteIE.ToString}) + End If + End If + End If + End If + ObjIE.Dispose() + + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Notificaciones de pago", Body, TxtCC.Text.Trim, Displayname:="Notificaciones de pago", Archivos:=ListaArchivos) Then + 'ResultadoMail = 1 + TxtCC.Text = "" + 'TxtAdicional.Text = "" + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + Else + Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError) + End If + + End Sub + + Private Sub LnkAjustarMovimiento_Click(sender As Object, e As EventArgs) Handles LnkAjustarMovimiento.Click + RegistraScript("$('#ModalAjustarMovimiento').modal('show');") + End Sub + + Private Sub BtnAjustarMovimiento_Click(sender As Object, e As EventArgs) Handles BtnAjustarMovimiento.Click + + Dim ObjBanco As New ClsBancos + + If ObjBanco.UpdateAjustarMovimiento(CveIE, TxtAjustarMovimiento.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + RegistraScript("$('#ModalAjustarMovimiento').modal('hide');", "ALTR") + Alert("El ajuste se realizo correctamente.", TipoMensaje.MsgInformacion, $" document.location.href = ""./IE.aspx?CveIE={CveIE}"";") + End If + + ObjBanco.Dispose() + + End Sub + + + + + + Protected Sub LnkCancelaMovimiento_Click(sender As Object, e As EventArgs) + + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim ObjIE As New ClsBancos + If ObjIE.CancelarIEVenta(CveIE, gvRow.DataKey("CveVenta").ToString.ToEntero) Then + Alert("Movimiento cancelado correctamente") + CargaDatos() + End If + ObjIE.Dispose() + + End Sub + + + Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveVenta").ToString.ToEntero > 0 AndAlso e.Row.DBCampo("CveCliente").ToString.ToEntero > 0 AndAlso e.Row.DBCampo("ImporteMN").ToString.ToDecimal > 0 AndAlso e.Row.DBCampo("CveConceptoContable").ToString.ToEntero = 2 AndAlso e.Row.DBCampo("Saldo").ToString.ToDecimal = 0 Then + e.Row.FCLinkButton("LnkCancelaMovimiento").Visible = True + End If + End If + End Sub + + + Protected Sub LnkCancelarComplemetno_Click(sender As Object, e As EventArgs) -#Region " ACTUALIZAR TIPO CAMBIO PREPOLIZA " - Private Sub InicializaActualizarTC() - If CveIE > 0 And DdlMoneda.SelectedValue.ToEntero = 2 And CvePrePoliza > 0 Then - TxtActualizarTC_TCActual.Text = TxtTipoCambio.Text - TxtActualizarTC_TCActualizar.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4) - HLModalActualizarTC.Visible = True - End If - End Sub - Protected Sub BtnActualizarTC_Click(sender As Object, e As EventArgs) - Dim ObjContabilidad As New ClsContabilidad - Dim ObjBancos As New ClsBancos(ObjContabilidad.IniciaTransacSQL()) - Dim ObjEventos As New ClsOIEventos(ObjContabilidad.IniciaTransacSQL()) - Dim TieneError = False - Dim MensajeError = "" - - If ObjEventos.AddEventoBitacora($"Se actualizó el Tipo de Cambio de la compra. TC anterior: {TxtActualizarTC_TCActual.Text.FormatoNumero(4)} | TC actual: {TxtActualizarTC_TCActualizar.Text.FormatoNumero(4)}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then - If ObjBancos.UpdateBancos_IETipoCambio(TxtActualizarTC_TCActualizar.Text.ToDouble, CveIE, CvePrePoliza, UsuarioActual.CveEmpresa) Then - If Not ObjContabilidad.ReconstruirPP_PagoCompraVenta(CveIE) Then - TieneError = True - MensajeError = "Ocurrió un error al actualizar el asiento contable" - End If - Else - TieneError = True - MensajeError = "Ocurrió un error al actualizar el Tipo de Cambio al documento" - End If - Else - TieneError = True - MensajeError = "Ocurrió un error al guardar el historal al actualizar el Tipo de Cambio al documento" - End If - - If Not TieneError Then - ObjContabilidad.Commit() - Alert("Se actualizó correctamente el tipo de cambio del documento.", TipoMensaje.MsgInformacion) - RegistraScript("$('#ModalActualizarTC').modal('hide');") - Else - ObjContabilidad.RollBack() - Alert(MensajeError, TipoMensaje.MsgError) - End If - - ObjContabilidad.Dispose() - End Sub -#End Region - -#Region "SOLICITAR VIATICOS VIATICOS" - - Protected Sub CargaDatosViaticos() - ViewState("CveSolicitudViatico") = Request("CveSolicitudViatico") - RBL.SelectedValue = "FE" - If Request("CvePersonal") IsNot Nothing AndAlso IsNumeric(Request("CvePersonal")) AndAlso Request("CvePersonal").ToEntero > 0 Then - ViewState("CvePersonal") = Request("CvePersonal") - PersonalIndexChange(CvePersonal) - - Dim ObjBancos As New ClsBancos - - If ObjBancos.GetSolicitudesViaticos(CveSolicitudViatico, UsuarioActual.CveEmpresa) AndAlso ObjBancos.DtResultados.Rows.Count > 0 Then - TxtImporte.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Importe").ToString.FormatoNumero - TxtImporteLetra.Text = ObjBancos.DtResultados.FiltroPrimeroValor("Importe").ToString.ToDouble.Texto2Letras() - TxtObservaciones.Text = $"SOLICITUD DE VIÁTICOS - FOLIO {ObjBancos.DtResultados.FiltroPrimeroValor("Folio").ToString()}: {ObjBancos.DtResultados.FiltroPrimeroValor("Asunto").ToString()}." - End If - ObjBancos.Dispose() - End If - End Sub -#End Region - -#Region " DEVOLVER DINERO ANT/NC " - Private Sub InicializaDevolverDinero() - - If Opcion = "DevDinV" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then - - Dim ParametrosTexto As String = Decripta(Request("P")) - - If ParametrosTexto <> "" Then - CargaParametros(ParametrosTexto) - - HdnCveCliente.Value = UrlParametros("CVECLIENTE").ToString - CveCliente = UrlParametros("CVECLIENTE").ToString.ToEntero - CveVentaDevDin = UrlParametros("CVEVENTA").ToString.ToEntero - - SerieFolioDevDin = UrlParametros("SERIEFOLIO").ToString - CvePrePolizaDevDin = UrlParametros("CVEPREPOLIZA").ToString.ToEntero - ImporteOriginalDevDin = UrlParametros("ORIGINAL").ToString.ToDecimal.RoundSQL(6) - TxtImporte.Text = UrlParametros("SALDO").ToString.FormatoNumero() - TxtImporte.Attributes.Add("onkeyup", $"FormatoMoneda(this);ValidarCantidad(this,{UrlParametros("SALDO").ToString});") - TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero) - CargaCliente(CveCliente) - 'BuscarCliente() - - DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString - CveMoneda = DdlMoneda.SelectedValue.ToEntero - CargaCuenta(DdlMoneda.SelectedValue.ToEntero) - CambiaTipoMoneda() - UpCuentaDeposito.Update() - - End If - End If - - If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Then - - Dim ParametrosTexto As String = Decripta(Request("P")) - - - If ParametrosTexto <> "" Then - CargaParametros(ParametrosTexto) - - HdnCveProveedor.Value = UrlParametros("CVEPROVEEDOR").ToString - CveProveedor = UrlParametros("CVEPROVEEDOR").ToString.ToEntero - - CveCompraDeCDin = UrlParametros("CVECOMPRA").ToString.ToEntero - SerieFolioDeCDin = UrlParametros("SERIEFOLIO").ToString - CvePrePolizaDeCDin = UrlParametros("CVEPREPOLIZA").ToString.ToEntero - FechaCompra = UrlParametros("FECHACOMPRA").ToString.ToDate - - ImporteOriginalDevDin = UrlParametros("ORIGINAL").ToString.ToDecimal.RoundSQL(6) - TxtImporte.Text = UrlParametros("SALDO").ToString.FormatoNumero() - TxtImporte.Attributes.Add("onkeyup", $"FormatoMoneda(this);ValidarCantidad(this,{UrlParametros("SALDO").ToString});") - TxtImporteLetra.Text = UrlParametros("SALDO").ToString.ToDouble.Texto2Letras(UrlParametros("CVEMONEDA").ToString.ToEntero) - - CargaProveedor(CveProveedor, "-1") - 'BuscarCliente() - - DdlMoneda.SelectedValue = UrlParametros("CVEMONEDA").ToString - CveMoneda = DdlMoneda.SelectedValue.ToEntero - CargaCuenta(DdlMoneda.SelectedValue.ToEntero) - CambiaTipoMoneda() - UpCuentaDeposito.Update() - - - End If - - End If - - - End Sub -#End Region - - -#Region "S A L D O - I N I C I A L" - Private Function AgregarSaldoInicial(SaldoInicial As Double, Fecha As DateTime, CveMoneda As Integer, ObjMov As ClsContabilidad) As Integer - Return ObjMov.AddPrePolizas("Bancos/IE", 13, SaldoInicial, SaldoInicial, CveMoneda, Fecha, "Saldo Inicial", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - End Function -#End Region - - Protected Sub LnkChqDevuelto_Click(sender As Object, e As EventArgs) - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - RegistraScript("ShowDivDevueltoIE();") - End Sub - - Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) - Exit Sub - End If - RegistraScript("ShowDivCancelarIE();") - End Sub - - Private Sub LnkEmitirComplemento_Click(sender As Object, e As EventArgs) Handles LnkEmitirComplemento.Click - GeneraTimbre() - CargaComplementosPago() - End Sub - - Private Sub GeneraTimbre() - - Dim Str As New StringBuilder - - Dim Banco As New ClsBancos - Banco.IniciaTransacSQL() - - - If Banco.GeneraTimbrePago(CveIE, -1, UsuarioActual) Then - If Banco.Mensaje = "" Then - Banco.Commit() - PDFReciboDePagos(-1, -1, Banco.CveComplementoPago, False) - Str.AppendFormat("Folio: {0}  ", Banco.ComplementoSerieFolio) - Str.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) - Str.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) - Str.AppendFormat("{1}   {2}
", CveIE, Folio, DdlCliente.SelectedText.ToString()) - MandaCorreo(Banco.ComplementoSerieFolio, CorreoCobranzaCliente) - End If - - Else - Str.AppendFormat("No se genero complemento del Folio {0} por el siguiente motivo: {1}", Folio, Banco.Mensaje) - Banco.RollBack() - End If - - - Banco.Dispose() - CargaDatos() - Alert(Str.ToString) - End Sub - - Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) - Try - Dim Msg As String = "" - If NombreArchivo <> "-1" Then ' - - Dim ObjMail As New ClsSisMail() - Dim RutaXML As String = String.Format("{0}\XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, NombreArchivo) - Dim RutaPDF As String = String.Format("{0}\PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, NombreArchivo) - - Dim Cuerpo As String = "Se hace entrega del comprobante de pago" - Dim Asunto As String = "Entrega de comprobante de pago" - - If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then - - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) - - If ObjMail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Cuerpo, "", LSRutasMail) Then - - If ConAlerta Then - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - End If - - Else - Msg = "No se pudo enviar el correo electrónico." - End If - - Else - Msg = "No se pudo adjuntar el correo electrónico." - End If - - End If - - If ConAlerta AndAlso Msg <> "" Then - Alert(Msg, TipoMensaje.MsgError) - End If - - - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - - End Try - End Sub - - - Protected Sub LnkEliminaMovComprobacion_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim TieneError = False - If GvRH.Rows(gvRow.RowIndex).DataKey("CveIE").ToEntero > 0 Then - Dim ObjBancos As New ClsBancos - ObjBancos.IniciaTransacSQL() - - If Not ObjBancos.EliminarBancos_IEComprobacion(UsuarioActual.CveUsuario, GvRH.Rows(gvRow.RowIndex).DataKey("CveIE").ToEntero) Then - TieneError = True - Alert("Ocurrió un error al eliminar los Movimientos Bancarios. Por favor intente de nuevo", TipoMensaje.MsgError) - ObjBancos.RollBack() - Else - Alert("Los Movimientos Bancarios se eliminaron correctamente.", TipoMensaje.MsgInformacion) - ObjBancos.Commit() - End If - ObjBancos.Dispose() - End If - - If Not TieneError Then - DtGvRH.Rows.RemoveAt(gvRow.RowIndex) - DtGvRH.AcceptChanges() - End If - - CargaGvRH() - End Sub - - Private Function GeneraCorreo(CveIE As Integer) As String - Dim strBody As New StringBuilder - Dim objIE As New ClsBancos - - If objIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" {0}", UsuarioActual.Empresa.Empresa) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", UsuarioActual.Empresa.Direccion) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", UsuarioActual.Empresa.Colonia) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", UsuarioActual.Empresa.RFC) - strBody.AppendFormat(" ") - strBody.AppendFormat("
{0}
Col. {0}
{0}, {1}, C.P.{2}
RFC {0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("


") - - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - - If objIE.CveTipoTransaccion = 1 Then ' cuando es cheque - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - End If - - If objIE.CveTipoTransaccion = 2 Then ' cuando es transf - strBody.Append(" ") - strBody.Append(" ") - strBody.Append(" ") - End If - - strBody.Append(" ") - strBody.AppendFormat(" ") - strBody.Append(" ") - strBody.Append("
Favor de pasar a nuestras oficinas por el cheque con la siguientes instrucciones.
Notificación de transferencia de pago realizada.
 
") - strBody.AppendFormat("
") - strBody.Append("
") - - - strBody.AppendFormat("
") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Beneficiario:{0} ", objIE.PagueseA) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.TipoTransaccion) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.Banco) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.NumCuenta) - strBody.AppendFormat(" ") - If objIE.CuentaDepositado.ToString <> "" Then - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.CuentaDepositado) - strBody.AppendFormat(" ") - End If - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.FechaDocumento.ToString("dd/MM/yyyy")) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.Importe.FormatoNumero, objIE.Moneda) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", objIE.Observaciones) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat("
Movimiento:{0}
Banco:{0}
Cuenta:{0}
Cuenta Destino:{0}
Fecha:{0}
Importe:$ {0} {1}
Observaciones:{0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - - - 'MOVIMIENTOS CHEQUE - If objIE.GetBancosIEMovimientos(CveIE, UsuarioActual.CveEmpresa) Then - Dim Textov33 As String = "" - If UsuarioActual.Empresa.Funcionalidad(520) = "1" Then - Textov33 = "Favor de emitir complemento de pago de los siguientes documentos" - End If - - strBody.AppendFormat("
") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat(" Documentos abonados o pagados
{0}
", Textov33) - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - - - For Each dr As DataRow In objIE.DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows - strBody.AppendFormat(" ") - strBody.AppendFormat(" ", dr("Fecha").ToString.ToDate.ToShortDateString()) - strBody.AppendFormat(" ", dr("SerieFolio").ToString) - strBody.AppendFormat(" ", dr("Importe").ToString.FormatoNumero) - strBody.AppendFormat(" ", dr("FolioFiscal")) - strBody.AppendFormat(" ", dr("ImporteNC").ToString.FormatoNumero) - strBody.AppendFormat(" ") - Next - - - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat(" ") - strBody.AppendFormat("
FechaFacturaImporte ($)Folio FiscalNC Aplicadas
{0}{0}$ {0}{0}{0}
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - strBody.AppendFormat("
") - End If - - strBody.Append("
Favor de no responder a este correo.
") - - strBody.Append("") - End If - - objIE.Dispose() - Return strBody.ToString - End Function - - Private Sub BtnSendMail_Click(sender As Object, e As EventArgs) Handles BtnSendMail.Click - 'NotificacionPago(HdnCveIE.Value.ToEntero, Txt) - Dim ObjMail As New ClsSisMail() - Dim Body = GeneraCorreo(CveIE) - - Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail) - - Dim ObjIE As New ClsBancos() - If ObjIE.GetBancosIE(CveIE, UsuarioActual.CveEmpresa) Then - If ObjIE.DtResultados.Rows.Count > 0 Then - If ObjIE.Comprobante <> "" Then - ComprobanteIE = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString) - - If IO.File.Exists(ComprobanteIE) Then - ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = ComprobanteIE.ToString}) - End If - End If - End If - End If - ObjIE.Dispose() - - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Notificaciones de pago", Body, TxtCC.Text.Trim, Displayname:="Notificaciones de pago", Archivos:=ListaArchivos) Then - 'ResultadoMail = 1 - TxtCC.Text = "" - 'TxtAdicional.Text = "" - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - Else - Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError) - End If - - End Sub - - Private Sub LnkAjustarMovimiento_Click(sender As Object, e As EventArgs) Handles LnkAjustarMovimiento.Click - RegistraScript("$('#ModalAjustarMovimiento').modal('show');") - End Sub - - Private Sub BtnAjustarMovimiento_Click(sender As Object, e As EventArgs) Handles BtnAjustarMovimiento.Click - - Dim ObjBanco As New ClsBancos - - If ObjBanco.UpdateAjustarMovimiento(CveIE, TxtAjustarMovimiento.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - RegistraScript("$('#ModalAjustarMovimiento').modal('hide');", "ALTR") - Alert("El ajuste se realizo correctamente.", TipoMensaje.MsgInformacion, $" document.location.href = ""./IE.aspx?CveIE={CveIE}"";") - End If - - ObjBanco.Dispose() - - End Sub - - - - - - Protected Sub LnkCancelaMovimiento_Click(sender As Object, e As EventArgs) - - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim ObjIE As New ClsBancos - If ObjIE.CancelarIEVenta(CveIE, gvRow.DataKey("CveVenta").ToString.ToEntero) Then - Alert("Movimiento cancelado correctamente") - CargaDatos() - End If - ObjIE.Dispose() - - End Sub - - - Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveVenta").ToString.ToEntero > 0 AndAlso e.Row.DBCampo("CveCliente").ToString.ToEntero > 0 AndAlso e.Row.DBCampo("ImporteMN").ToString.ToDecimal > 0 AndAlso e.Row.DBCampo("CveConceptoContable").ToString.ToEntero = 2 AndAlso e.Row.DBCampo("Saldo").ToString.ToDecimal = 0 Then - e.Row.FCLinkButton("LnkCancelaMovimiento").Visible = True - End If - End If - End Sub - - - Protected Sub LnkCancelarComplemetno_Click(sender As Object, e As EventArgs) - If ChkConciliado.Checked Then Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgAdvertencia) Exit Sub - End If - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) - - - CveComplementoPagoCancelar = GvRow.DataKey("CveComplementoPago").ToEntero - FolioFiscalCancelar = GvRow.DataKey("FolioFiscal").ToString - '' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC - RFCReceptorCancelar = GvRow.DataKey("RFCReceptor") - CvePACCancelacion = GvRow.DataKey("CvePAC").ToEntero - - - Dim ObjCancelacion As New Timbrado - Dim ObjBanco As New ClsBancos - - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then - - If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then - CargaComplementosPago() - - ' RegistraScript("$('#ModalCancelarComplemetno').modal('hide');") - Alert("El complemento se cancelo correctamente.") - End If - - Else - Alert("Se presento un error al cancelar el complemento.") - End If - - ObjBanco.Dispose() - - - '' INICIO Version 2 - 'CveComplementoPagoCancelar = GvRow.DataKey("CveComplementoPago").ToEntero - 'FolioFiscalCancelar = GvRow.DataKey("FolioFiscal").ToString - '' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC - 'RFCReceptorCancelar = GvRow.DataKey("RFCReceptor") - 'CvePACCancelacion = GvRow.DataKey("CvePAC").ToEntero - - 'RegistraScript("$('#ModalCancelarComplemetno').modal('show');") - - 'RdlCancelarComplemento.SelectedValue = "1" - 'DivFechaCancelación.Visible = False - 'UpModalCancelarComplemetno.Update() - '' FIN Version 2 - - End Sub - + End If + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + + + CveComplementoPagoCancelar = GvRow.DataKey("CveComplementoPago").ToEntero + FolioFiscalCancelar = GvRow.DataKey("FolioFiscal").ToString + '' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC + RFCReceptorCancelar = GvRow.DataKey("RFCReceptor") + CvePACCancelacion = GvRow.DataKey("CvePAC").ToEntero + + + Dim ObjCancelacion As New Timbrado + Dim ObjBanco As New ClsBancos + + If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then + + If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then + CargaComplementosPago() + + ' RegistraScript("$('#ModalCancelarComplemetno').modal('hide');") + Alert("El complemento se cancelo correctamente.") + End If + + Else + Alert("Se presento un error al cancelar el complemento.") + End If + + ObjBanco.Dispose() + + + '' INICIO Version 2 + 'CveComplementoPagoCancelar = GvRow.DataKey("CveComplementoPago").ToEntero + 'FolioFiscalCancelar = GvRow.DataKey("FolioFiscal").ToString + '' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC + 'RFCReceptorCancelar = GvRow.DataKey("RFCReceptor") + 'CvePACCancelacion = GvRow.DataKey("CvePAC").ToEntero + + 'RegistraScript("$('#ModalCancelarComplemetno').modal('show');") + + 'RdlCancelarComplemento.SelectedValue = "1" + 'DivFechaCancelación.Visible = False + 'UpModalCancelarComplemetno.Update() + '' FIN Version 2 + + End Sub + Protected Sub BtnModalCancelarComplemento_Click(sender As Object, e As EventArgs) @@ -5558,14 +5608,14 @@ Partial Class Bancos_IE End If - Dim ObjBancos As New ClsBancos - Dim Respuesta As Boolean = False - Dim DTComplementos As New DataTable - + Dim ObjBancos As New ClsBancos + Dim Respuesta As Boolean = False + Dim DTComplementos As New DataTable + If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then DTComplementos = ObjBancos.DtResultados.FiltraParametros(" Estatus IN (1,3) ") - End If - + End If + ObjBancos.Dispose() If DTComplementos.Rows.Count = 1 Then @@ -5598,31 +5648,39 @@ Partial Class Bancos_IE BtnEditar.Visible = False UpGuardar.Update() - ControlesEdicion(True) + ControlesEdicion() End Sub - Private Sub ControlesEdicion(mostrar As Boolean) + Private Sub ControlesEdicion() + Dim ExistenComplementosVigentes As Boolean = VerificaComplementos(True) - If mostrar Then + If PermisoComplementoVigente Then + + If ExistenComplementosVigentes Then + TxtFolio.Enabled = True + TxtObservaciones.Enabled = True + Else + + DdlTipoTransaccion.Enabled = True + LblCuenta.Visible = False + DdlCuenta.Enabled = True + DdlCuenta.Visible = True + TxtFolio.Enabled = True + TxtObservaciones.Enabled = True + + End If - DdlTipoTransaccion.Enabled = True - LblCuenta.Visible = False - DdlCuenta.Enabled = True - DdlCuenta.Visible = True - TxtFolio.Enabled = True - TxtObservaciones.Enabled = True UpDatos.Update() CargaCuentasDepositoClientes() + Else + TxtFolio.Enabled = True + TxtObservaciones.Enabled = True - - - - - + UpDatos.Update() End If End Sub diff --git a/Bancos/PagoAcreedor.aspx.cs b/Bancos/PagoAcreedor.aspx.cs index ee352f560..874e91841 100644 --- a/Bancos/PagoAcreedor.aspx.cs +++ b/Bancos/PagoAcreedor.aspx.cs @@ -527,7 +527,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { if (IDCtaContableAcreedor > 0 && IDCtaContableBancos > 0) { @@ -801,7 +801,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") ) { if (IDCtaContableAcreedor > 0 && IDCtaContableBancos > 0) { diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index 73435bc66..661fd2abd 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -447,7 +447,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas bool AutoConta = UsuarioActual.Empresa.Funcionalidad(200).Equals("1"); if (UsuarioActual.CveEmpresa == 119) AutoConta = false; - if (AutoConta && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (AutoConta && MsgError.Equals("")) { //JJMQ:20190103: Cambio la siguiente linea porque esta validando siempre una complementaria aunque el movto sea dlls //if (IDCtaContableDeudorPrestamo > 0 && IDCtaContableBancosPrestamo > 0 && IDCtaContableBancosComplementariaPrestamo > 0 && IDCtaContableDeudorCompPrestamo > 0) @@ -838,7 +838,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas bool AutoConta = UsuarioActual.Empresa.Funcionalidad(200).Equals("1"); if (UsuarioActual.CveEmpresa == 119) AutoConta = false; - if (AutoConta && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (AutoConta && MsgError.Equals("")) { if (IDCtaContableDeudor > 0 && IDCtaContableBancos > 0) { diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index 683e35fd7..77d0c3498 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -3090,7 +3090,7 @@ Partial Class Bancos_PopIECompras End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If idCuentaContabilizacion > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then IdPoliza = ObjMov.ContaIdPoliza diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 9715941cf..c19aea954 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -3390,7 +3390,7 @@ Partial Class Bancos_PopIEVentas End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" Then If idCuentaContabilizacion > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then diff --git a/Bancos/PrestamoPersonal.aspx.cs b/Bancos/PrestamoPersonal.aspx.cs index 75491b8fa..60cd167ef 100644 --- a/Bancos/PrestamoPersonal.aspx.cs +++ b/Bancos/PrestamoPersonal.aspx.cs @@ -366,7 +366,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") ) { if (IDCtaContablePrestamo > 0 && IDCtaContableBancos > 0) { @@ -626,7 +626,7 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas } //CONTABILIZA - if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") && UsuarioActual.Empresa.UsaContabilidad) + if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("") ) { if (IDCtaContablePrestamo > 0 && IDCtaContableBancosPrestamo > 0) { diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 37a12c668..1f8d4b125 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -1823,7 +1823,7 @@ Partial Class Bancos_ProveedoresAbonar End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" And UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If idCuentaContabilizacion > 0 Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjConta) Then ' Alert(alertaContabilizacion, ModExtensiones.TipoMensaje.MsgInformacion) diff --git a/Bancos/RepIE.aspx.vb b/Bancos/RepIE.aspx.vb index 35516d24a..0f11dd4a5 100644 --- a/Bancos/RepIE.aspx.vb +++ b/Bancos/RepIE.aspx.vb @@ -423,7 +423,7 @@ Partial Class Bancos_RepIE DdlMoneda.Items.Insert(0, New ListItem("Todas", "-1")) End Sub Private Sub CargaEstatusIE() - DdlEstatusIE.DataSource = GlobalDTEstatusIE + DdlEstatusIE.DataSource = GlobalDTBancosEstatusIE DdlEstatusIE.DataBind() End Sub Private Sub CargaUsuarioConcilio() diff --git a/Bancos/Transferencias.aspx.vb b/Bancos/Transferencias.aspx.vb index bbb322d80..7ccdbb882 100644 --- a/Bancos/Transferencias.aspx.vb +++ b/Bancos/Transferencias.aspx.vb @@ -412,7 +412,7 @@ Partial Class Bancos_Transferencias End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" Then If (IdCtaContableOrigen > 0 AndAlso IdCtaContableDestino > 0) OrElse (IdCtaContableDestino > 0 AndAlso Opcion = 1) Then If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, Fecha:=TxtFechaDocumento.Text) Then diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 85648f022..3b9d4b659 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -654,23 +654,23 @@ <%-- 0 --%> - + <%-- 1 --%> - + <%-- 2 --%> - + <%-- 3 --%> - +
@@ -683,9 +683,9 @@ <%-- 4 --%> - + <%-- 5 --%> - + @@ -694,11 +694,11 @@ <%-- 6 --%> - + <%-- 7 --%> - + <%-- 8 --%> - + @@ -2228,7 +2228,7 @@ Fecha Pago: - +
@@ -2248,6 +2248,9 @@
+ + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index fea2e0d27..fb1ed92d5 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2634,6 +2634,7 @@ Partial Class Compras_Compras DdlPS.Enabled = True TxtObsPS.Enabled = True LbAgregar.Enabled = True + LnkUpdateFechaPago.Visible = True End If BtnGuardar.Visible = False @@ -2800,7 +2801,9 @@ Partial Class Compras_Compras 'TIENE AMORTIZACIÓN If GvAnticiposSel.Rows.Count > 0 Then BtnEliminarCompra.Visible = False - BtnCancelarCompra.Visible = False + If Not DdlTipoComprobante.SelectedValue.Contiene("NC") Then + BtnCancelarCompra.Visible = False + End If End If CargaComplementosPago() @@ -4158,8 +4161,10 @@ Partial Class Compras_Compras CvePrePoliza = ObjConta.AddPrePolizas("Compras/Registrar", If(EsContado And CvePlantillaPrePoliza = 1, 2, CvePlantillaPrePoliza), ImporteCompra, TxtTotal.Text.ToDouble, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjCompras.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjConta.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa)) - 'seria de contado, solo cuando no tenga vinculado ningun anticipo - If RBLPago.SelectedValue.ToEntero = 2 AndAlso ArrAnticipos.Count = 0 Then 'Contado + If CvePrePoliza > 0 Then + + 'seria de contado, solo cuando no tenga vinculado ningun anticipo + If RBLPago.SelectedValue.ToEntero = 2 AndAlso ArrAnticipos.Count = 0 Then 'Contado If RBLContado.SelectedValue = "1" Then 'se registra primero el movimiento en bancos para luego vincularlo en la compra @@ -4223,6 +4228,12 @@ Partial Class Compras_Compras Else CveConceptoContableAlmacen = 225 End If + + 'Condiciones para los casos de facturas que son en 0 pero que se utiliza el almacen + ElseIf OCVinculada AndAlso Not (CveImportacion > 0 Or CveFlete > 0) AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then + CveConceptoContableAlmacen = DdlOCVinculaInv.SelectedValue.ToEntero + ElseIf (CveImportacion > 0 Or CveFlete > 0) AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then + CveConceptoContableAlmacen = CveConceptoContableAlmacen End If End If @@ -6226,15 +6237,13 @@ Partial Class Compras_Compras If ContienePSNeteoBonif Then importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 ").ToString.ToDecimal importeMN = importeMovimiento * tipoCambioActual * Multiplicador - If importeMovimiento <> 0 Then - Dim IdCtaContableDescCompra As Integer = UsuarioActual.Empresa.Funcionalidad(405).ToEntero - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Referencia, 259, Concepto, FechaMovimiento, IdCtaContableDescCompra, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -importeMovimiento, Referencia, 259, Concepto, FechaMovimiento, IdCtaContableDescCompra, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=-importeMN, ImporteME:=If(tipoCambioActual = 1, 0, -importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If - Else + Dim IdCtaContableDescCompra As Integer = UsuarioActual.Empresa.Funcionalidad(405).ToEntero + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Referencia, 259, Concepto, FechaMovimiento, IdCtaContableDescCompra, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -importeMovimiento, Referencia, 259, Concepto, FechaMovimiento, IdCtaContableDescCompra, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=-importeMN, ImporteME:=If(tipoCambioActual = 1, 0, -importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If + Else + ErrorPrepoliza = True End If End If @@ -6242,7 +6251,7 @@ Partial Class Compras_Compras - If Not ChkNCInvNC.Checked Then + If Not ChkNCInvNC.Checked OrElse Not ListaDocumentos.Count > 0 Then 'GASTO If UsuarioActual.CveEmpresa = 119 Then DT = TmpDT @@ -7003,7 +7012,7 @@ Partial Class Compras_Compras End If 'Conta ContPAQ - If ObjContaAC IsNot Nothing AndAlso Not ErrorPrepoliza AndAlso Not ErrorPrepolizaDescuadre AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If ObjContaAC IsNot Nothing AndAlso Not ErrorPrepoliza AndAlso Not ErrorPrepolizaDescuadre AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then If idCuentaContabilizacion > 0 Then If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaAC) Then ' Alert(alertaContabilizacion, ModExtensiones.TipoMensaje.MsgInformacion) @@ -7709,6 +7718,7 @@ Partial Class Compras_Compras ObjCompras.RollBack() End If + End If Catch ex As Exception ObjCompras.RollBack() @@ -8569,7 +8579,7 @@ Partial Class Compras_Compras End If 'Conta ContPAQ - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And ErrorMovtosCxP = 0 And UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso ErrorMovtosCxP = 0 Then If idCuentaContabilizacion > 0 Then If ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then alertaContabilizacion.AppendFormat("{1}<\a>
", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) @@ -9735,18 +9745,21 @@ Partial Class Compras_Compras ReceptorRFC = ValorXML(node, "RFC") End If - node = XMLDoc.SelectSingleNode(String.Format("//{0}:CfdiRelacionados", Prefijo), namespaces) - If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then - If ValorXML(node, "TipoRelacion").ToString.Contiene("04", "07") Then - Dim nodeDocumentosRelacionados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:CfdiRelacionado", Prefijo), namespaces) - For Each documento As XmlNode In nodeDocumentosRelacionados - If documento.Attributes("UUID").Value <> "" Then - ListaDocumentos.Add(documento.Attributes("UUID").Value) - End If - Next + If UsuarioActual.CveEmpresa.Contiene(119) Then + node = XMLDoc.SelectSingleNode(String.Format("//{0}:CfdiRelacionados", Prefijo), namespaces) + If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then + If ValorXML(node, "TipoRelacion").ToString.Contiene("04", "07") Then + Dim nodeDocumentosRelacionados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:CfdiRelacionado", Prefijo), namespaces) + For Each documento As XmlNode In nodeDocumentosRelacionados + If documento.Attributes("UUID").Value <> "" Then + ListaDocumentos.Add(documento.Attributes("UUID").Value) + End If + Next + End If End If End If + node = XMLDoc.SelectSingleNode(String.Format("//{0}:Impuestos", Prefijo), namespaces) If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then Dim nodeRetenciones As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Impuestos/{0}:Retenciones/{0}:Retencion", Prefijo), namespaces) @@ -9935,18 +9948,18 @@ Partial Class Compras_Compras If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(15) - e.Row.Cells(1).Width = Unit.Pixel(45) - e.Row.Cells(2).Width = Unit.Pixel(70) - e.Row.Cells(3).Width = Unit.Pixel(230) - e.Row.Cells(4).Width = Unit.Pixel(202) - e.Row.Cells(5).Width = Unit.Pixel(155) - e.Row.Cells(6).Width = Unit.Pixel(155) - e.Row.Cells(7).Width = Unit.Pixel(50) - e.Row.Cells(8).Width = Unit.Pixel(80) - e.Row.Cells(9).Width = Unit.Pixel(80) - e.Row.Cells(10).Width = Unit.Pixel(43) - e.Row.Cells(11).Width = Unit.Pixel(43) + 'e.Row.Cells(0).Width = Unit.Pixel(15) + 'e.Row.Cells(1).Width = Unit.Pixel(45) + 'e.Row.Cells(2).Width = Unit.Pixel(70) + 'e.Row.Cells(3).Width = Unit.Pixel(230) + 'e.Row.Cells(4).Width = Unit.Pixel(202) + 'e.Row.Cells(5).Width = Unit.Pixel(155) + 'e.Row.Cells(6).Width = Unit.Pixel(155) + 'e.Row.Cells(7).Width = Unit.Pixel(50) + 'e.Row.Cells(8).Width = Unit.Pixel(80) + 'e.Row.Cells(9).Width = Unit.Pixel(80) + 'e.Row.Cells(10).Width = Unit.Pixel(43) + 'e.Row.Cells(11).Width = Unit.Pixel(43) If UsuarioActual.Empresa.UsaAC Then 'AndAlso (CveFactura > 0 Or CveCompra > 0) e.Row.Cells(12).Width = Unit.Pixel(150) @@ -13638,7 +13651,7 @@ Partial Class Compras_Compras RegistraScript("$('#DivCancelarCompra').modal('hide');") Dim ObjAC As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaAC Then + If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then ObjAC = New ClsContPAQi(UsuarioActual.Empresa) ObjAC.IniciaTransacSQL() End If @@ -13654,7 +13667,7 @@ Partial Class Compras_Compras ' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS) - If TxtFecha.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFecha.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then + If TxtFecha.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFecha.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Or DdlTipoComprobante.SelectedValue.Contiene("NC") Then 'CREA POLIZA NEGATIVA If IdPoliza > 0 AndAlso ObjAC IsNot Nothing Then @@ -13685,9 +13698,9 @@ Partial Class Compras_Compras End If 'CREA PRE-POLIZA NEGATIVA - If CvePrePoliza > 0 Then - If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza) Then - dt = ObjContabilidad.DtResultados + If DdlTipoComprobante.SelectedValue.Contiene("NC") Then + If ObjCompras.GetCancelarNC(CveCompra, UsuarioActual.CveEmpresa) Then + dt = ObjCompras.DtResultados CvePrePolizaNueva = ObjContabilidad.AddPrePolizas("Compras/Cancelar", dt.Rows(0)("CvePlantillaPoliza").ToString.ToEntero, dt.Rows(0)("Cargos").ToString.ToDouble * -1, dt.Rows(0)("Abonos").ToString.ToDouble * -1, dt.Rows(0)("CveMoneda").ToString.ToEntero, TxtFechaCancelacion.Text.ToDate, String.Format("Cancelación: {0}", dt.Rows(0)("Concepto").ToString), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If CvePrePolizaNueva > 0 Then @@ -13696,7 +13709,8 @@ Partial Class Compras_Compras dr("Concepto").ToString, TxtFechaCancelacion.Text.ToDate, dr("IdCtaContable").ToString.ToEntero, dr("IdSegmentoNegocio").ToString.ToEntero, dr("CveIE").ToString.ToEntero, dr("CveVenta").ToString.ToEntero, dr("CveCompra").ToString.ToEntero, dr("CveSubProyecto").ToString.ToEntero, dr("CveCliente").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, dr("CveMovimientoAlmacen").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("CveAcreedor").ToString.ToEntero, dr("CveColectiva").ToString.ToEntero, dr("CveCreditoDetalle").ToString.ToEntero, CveCuenta:=dr("CveCuenta").ToString.ToEntero, - ImporteMX:=dr("Importe").ToString.ToDecimal * -1, ImporteME:=dr("Importe").ToString.ToDecimal * -1, CveTipoGasto:=dr("CveTipoGasto").ToString.ToEntero, CveClasificacion:=dr("CveClasificacion").ToString.ToEntero, CveOCDetalle:=dr("CveOCDetalle").ToString.ToEntero) Then + ImporteMX:=dr("Importe").ToString.ToDecimal * -1, ImporteME:=dr("Importe").ToString.ToDecimal * -1, CveTipoGasto:=dr("CveTipoGasto").ToString.ToEntero, CveClasificacion:=dr("CveClasificacion").ToString.ToEntero, CveOCDetalle:=dr("CveOCDetalle").ToString.ToEntero, + CveCompraAmortizacion:=dr("CveCompraAmortizacion").ToString.ToEntero) Then ErrorCancelar = True Exit For End If @@ -13707,6 +13721,30 @@ Partial Class Compras_Compras Else ErrorCancelar = True End If + Else + If CvePrePoliza > 0 Then + If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza) Then + dt = ObjContabilidad.DtResultados + + CvePrePolizaNueva = ObjContabilidad.AddPrePolizas("Compras/Cancelar", dt.Rows(0)("CvePlantillaPoliza").ToString.ToEntero, dt.Rows(0)("Cargos").ToString.ToDouble * -1, dt.Rows(0)("Abonos").ToString.ToDouble * -1, dt.Rows(0)("CveMoneda").ToString.ToEntero, TxtFechaCancelacion.Text.ToDate, String.Format("Cancelación: {0}", dt.Rows(0)("Concepto").ToString), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaNueva > 0 Then + For Each dr As DataRow In dt.Rows + If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePolizaNueva, CBool(dr("TipoMovto").ToString), dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, dr("CveConceptoContable").ToString.ToEntero, + dr("Concepto").ToString, TxtFechaCancelacion.Text.ToDate, dr("IdCtaContable").ToString.ToEntero, dr("IdSegmentoNegocio").ToString.ToEntero, dr("CveIE").ToString.ToEntero, + dr("CveVenta").ToString.ToEntero, dr("CveCompra").ToString.ToEntero, dr("CveSubProyecto").ToString.ToEntero, dr("CveCliente").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, + dr("CveMovimientoAlmacen").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("CveAcreedor").ToString.ToEntero, dr("CveColectiva").ToString.ToEntero, dr("CveCreditoDetalle").ToString.ToEntero, CveCuenta:=dr("CveCuenta").ToString.ToEntero, + ImporteMX:=dr("Importe").ToString.ToDecimal * -1, ImporteME:=dr("Importe").ToString.ToDecimal * -1, CveTipoGasto:=dr("CveTipoGasto").ToString.ToEntero, CveClasificacion:=dr("CveClasificacion").ToString.ToEntero, CveOCDetalle:=dr("CveOCDetalle").ToString.ToEntero) Then + ErrorCancelar = True + Exit For + End If + Next + Else + ErrorCancelar = True + End If + Else + ErrorCancelar = True + End If + End If End If 'MES ACTUAL @@ -18779,4 +18817,26 @@ Partial Class Compras_Compras AddPS2(EsNoDeducible:=EsNoDeducible) End Sub + Protected Sub LnkUpdateFechaPago_Click(sender As Object, e As EventArgs) + Dim ObjComp As New ClsCompras + Dim FechaPagoAnterior As String = "" + + If ObjComp.GetCompras(CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + If ObjComp.DtResultados.Rows.Count > 0 Then + FechaPagoAnterior = ObjComp.DtResultados.Rows(0)("FechaVencimiento").ToString.ToDate.ToShortDateString + End If + End If + + If FechaPagoAnterior = TxtFechaPago.Text Then + Alert("La fecha de pago seleccionada es igual que la anterior.", TipoMensaje.MsgAdvertencia) + ObjComp.Dispose() + Exit Sub + End If + + If ObjComp.UpdateFechaVencimientoCompra(CveCompra, TxtFechaPago.Text.ToDate, UsuarioActual.CveEmpresa) Then + Alert("Fecha de pago actualizada correctamente.") + End If + + ObjComp.Dispose() + End Sub End Class \ No newline at end of file diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 06cf44aa7..085417382 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -1144,7 +1144,7 @@ Partial Class Compras_Proveedores 'VA POR EL CATALOGO DE CUENTAS If Ddl.Attributes("onclick") <> "" Then - CargaCuentasContables(If(UsuarioActual.Empresa.Funcionalidad(CveFuncionalidad).ToEntero > 0, UsuarioActual.Empresa.Funcionalidad(CveFuncionalidad).ToEntero, -1)) + CargaCuentasContables(If(UsuarioActual.Empresa.Funcionalidad(CveFuncionalidad).ToEntero > 0, UsuarioActual.Empresa.Funcionalidad(CveFuncionalidad).ToEntero, 1)) End If 'RECARGA EL DDL diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index a419f00fb..5f9f37585 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -1295,7 +1295,7 @@ Partial Class Compras_ReembolsosComprobaciones End If 'Conta ContPAQ AUTOMATICA - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError.Trim = "" AndAlso UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError.Trim = "" Then If CvePrePolizaIERegistrado > 0 Then If IdCtaPersonal > 0 Or DdlCajaChica.Visible Then If IdCtaProveedor > 0 Then diff --git a/Compras/RepCompras.aspx.vb b/Compras/RepCompras.aspx.vb index 7303258cc..3173f899a 100644 --- a/Compras/RepCompras.aspx.vb +++ b/Compras/RepCompras.aspx.vb @@ -285,12 +285,10 @@ Partial Class Compras_RepCompras If e.Row.DBCampo("Orden") = "" Then e.Row.FCLiteral("LtlGrupo").Text = e.Row.FCLiteral("LtlGrupo").Text - e.Row.FCLiteral("LtlCantidad").Text = e.Row.FCLiteral("LtlCantidad").Text Else e.Row.FCLiteral("LtlGrupo").Text = String.Format("
{2}", Css, Liga, e.Row.FCLiteral("LtlGrupo").Text) - e.Row.FCLiteral("LtlCantidad").Text = String.Format("{2}", Css, Liga, e.Row.FCLiteral("LtlCantidad").Text) End If - + e.Row.FCLiteral("LtlCantidad").Text = String.Format("{2}", Css, Liga, e.Row.FCLiteral("LtlCantidad").Text) If e.Row.DBCampo("SubTotal").ToDouble = 0 Then e.Row.FCLiteral("LtlSubTotal").Text = "" If e.Row.DBCampo("Descuento").ToDouble = 0 Then e.Row.FCLiteral("LtlDescuento").Text = "" @@ -399,7 +397,7 @@ Partial Class Compras_RepCompras params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToString)) - params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Proveedor}{Capturo}{Grupo}{Moneda}{FechaIn}{FechaFn}{Proyecto}{SubProyecto}{TipoGasto}{TipoProveedor}{FechaICaptura}{FechaFCaptura}{TipoDocto}")) + params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Grupo}{Proveedor}{Capturo}{Moneda}{FechaIn}{FechaFn}{Proyecto}{SubProyecto}{TipoGasto}{TipoProveedor}{FechaICaptura}{FechaFCaptura}{TipoDocto}")) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) Else diff --git a/Compras/RepComprasDetalle.aspx.vb b/Compras/RepComprasDetalle.aspx.vb index c0be4ca41..ada9dcb43 100644 --- a/Compras/RepComprasDetalle.aspx.vb +++ b/Compras/RepComprasDetalle.aspx.vb @@ -437,7 +437,7 @@ Partial Class Compras_RepComprasDetalle params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToString)) - params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Proveedor}{Capturo}{Grupo}{FechaIn}{FechaFn}{FechaCIn}{FechaCFn}{Proyecto}{SubProyecto}{TipoGasto}{TipoProveedor}{TipoDocto}")) + params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Grupo}{Proveedor}{Capturo}{FechaIn}{FechaFn}{FechaCIn}{FechaCFn}{Proyecto}{SubProyecto}{TipoGasto}{TipoProveedor}{TipoDocto}")) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) Else diff --git a/Compras/RepNotasCredito.aspx.vb b/Compras/RepNotasCredito.aspx.vb index 5605a94e5..c04fd2c3e 100644 --- a/Compras/RepNotasCredito.aspx.vb +++ b/Compras/RepNotasCredito.aspx.vb @@ -200,7 +200,7 @@ Partial Class Compras_RepNotasCredito End If End If - If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" And UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then If MensajeAlert.ToString = "" Then MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente:
") diff --git a/Compras/RepProductosServicios.aspx.vb b/Compras/RepProductosServicios.aspx.vb index d4ca7b2e6..7680c1dcc 100644 --- a/Compras/RepProductosServicios.aspx.vb +++ b/Compras/RepProductosServicios.aspx.vb @@ -309,23 +309,25 @@ Partial Class Compras_RepProductosServicios If DdlGrupo.SelectedValue = "6" Then ' cuando es Año '-1/01 - If e.Row.DBCampo("Anio") = "-1/01" Then - FechaI = $"01/01/{e.Row.DBCampo("Anio")}" + If e.Row.DBCampo("Anio") = "-1" Then + FechaI = "-1" + FechaF = "-1" Else - FechaI = $"01/01/{e.Row.DBCampo("Anio")}".ToDate.FirstDayOfMonth.ToShortDateString + FechaI = $"01/01/{e.Row.DBCampo("Anio")}" + FechaF = $"01/12/{e.Row.DBCampo("Anio")}".ToDate.LastDayOfMonth.ToShortDateString End If - FechaF = $"01/12/{e.Row.DBCampo("Anio")}".ToDate.LastDayOfMonth.ToShortDateString End If If DdlGrupo.SelectedValue = "8" Then ' cuando es Año/Mes - If e.Row.DBCampo("AnioMes") = "-1/01" Then - FechaI = $"{e.Row.DBCampo("AnioMes")}/01" + If e.Row.DBCampo("AnioMes") = "-1" Then + FechaI = "-1" + FechaF = "-1" Else - FechaI = $"{e.Row.DBCampo("AnioMes")}/01".ToDate.FirstDayOfMonth.ToShortDateString + FechaI = $"{e.Row.DBCampo("AnioMes")}/01".ToDate.ToShortDateString + FechaF = $"{e.Row.DBCampo("AnioMes")}/01".ToDate.LastDayOfMonth.ToShortDateString End If - FechaF = $"{e.Row.DBCampo("AnioMes")}/01".ToDate.LastDayOfMonth.ToShortDateString End If @@ -337,9 +339,8 @@ Partial Class Compras_RepProductosServicios If Not e.Row.DBCampo("GpoID") = "1" Then e.Row.Cells(0).Text = String.Format("{1}", Liga, If(e.Row.DBCampo("GpoID") = "1", e.Row.DBCampo("Moneda"), e.Row.DBCampo("GPO"))) - e.Row.Cells(1).Text = String.Format("{1}", Liga, e.Row.DBCampo("Cantidad").FormatoNumero) End If - + e.Row.Cells(1).Text = String.Format("{1}", Liga, e.Row.DBCampo("Cantidad").FormatoNumero) 'Si son igual a cero se limpia el campo If e.Row.DBCampo("SubTotal").ToDouble = 0 Then e.Row.Cells(2).Text = "" @@ -482,7 +483,7 @@ Partial Class Compras_RepProductosServicios params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString())) - params.Add(New ReportParameter("Filtros", $"{Proveedor}{FechaInicio}{FechaFin}{Grupo}{TipoGasto}{Categoria}{Clasificacion}{PS}{Proyecto}{Estatus}{Usuario}{TipoAF}{SubTipoAF}{AF}")) + params.Add(New ReportParameter("Filtros", $"{Grupo}{Proveedor}{FechaInicio}{FechaFin}{TipoGasto}{Categoria}{Clasificacion}{PS}{Proyecto}{Estatus}{Usuario}{TipoAF}{SubTipoAF}{AF}")) 'params.Add(New ReportParameter("Proveedor", DdlProveedor.SelectedItem.Text)) 'params.Add(New ReportParameter("FechaInicio", txtFechaI.Text)) 'params.Add(New ReportParameter("FechaFin", txtFechaF.Text)) diff --git a/Compras/RepRembolsoComprobaciones.aspx.vb b/Compras/RepRembolsoComprobaciones.aspx.vb index 86983e786..50fd8aed0 100644 --- a/Compras/RepRembolsoComprobaciones.aspx.vb +++ b/Compras/RepRembolsoComprobaciones.aspx.vb @@ -198,7 +198,7 @@ Partial Class Compras_RepRembolsoComprobaciones Msg.AppendFormat("Se unificaron todas las compras con éxito") End If - If UsuarioActual.Empresa.UsaContabilidad AndAlso Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" AndAlso Not TieneError Then If ObjAC Is Nothing Then TieneError = True End If diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index e283fc11f..115d1b7b7 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -1,371 +1,371 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Imports Microsoft.Reporting.WebForms -Imports System.Data - -Partial Class PopUpAuxiliar - Inherits ClsPaginas - - Private Property Tipo As String - Get - Return ViewState("Tipo").ToString - End Get - Set(value As String) - ViewState("Tipo") = value - End Set - End Property - - Private Property CveCliente As Integer - Get - Return ViewState("CveCliente").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCliente") = value - End Set - End Property - - Private Property CveVenta As Integer - Get - Return ViewState("CveVenta").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveVenta") = value - End Set - End Property - - Private Property CveProveedor As Integer - Get - Return ViewState("CveProveedor").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveProveedor") = value - End Set - End Property - - Private Property CveCompra As Integer - Get - Return ViewState("CveCompra").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCompra") = value - End Set - End Property - Private Property DTDatos As DataTable - Get - Return CType(ViewState("DTDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTDatos") = value - End Set - End Property - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - CType(Me.Master, BaseMasterPage).EsPopup = True - CType(Me.Master, BaseMasterPage).PopupWidth = 915 - RegistraScript("$get('tdContenido').style.height='1000'") - - Tipo = Request("Tipo") - CveCliente = 0 - CveProveedor = 0 - CargaDatos() - - End If - End Sub - - Private Sub CargaDatos() - GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94) +Option Explicit On +Option Strict On + +Imports Extensiones +Imports Microsoft.Reporting.WebForms +Imports System.Data + +Partial Class PopUpAuxiliar + Inherits ClsPaginas + + Private Property Tipo As String + Get + Return ViewState("Tipo").ToString + End Get + Set(value As String) + ViewState("Tipo") = value + End Set + End Property + + Private Property CveCliente As Integer + Get + Return ViewState("CveCliente").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCliente") = value + End Set + End Property + + Private Property CveVenta As Integer + Get + Return ViewState("CveVenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveVenta") = value + End Set + End Property + + Private Property CveProveedor As Integer + Get + Return ViewState("CveProveedor").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveProveedor") = value + End Set + End Property + + Private Property CveCompra As Integer + Get + Return ViewState("CveCompra").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCompra") = value + End Set + End Property + Private Property DTDatos As DataTable + Get + Return CType(ViewState("DTDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTDatos") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CType(Me.Master, BaseMasterPage).EsPopup = True + CType(Me.Master, BaseMasterPage).PopupWidth = 915 + RegistraScript("$get('tdContenido').style.height='1000'") + + Tipo = Request("Tipo") + CveCliente = 0 + CveProveedor = 0 + CargaDatos() + + End If + End Sub + + Private Sub CargaDatos() + GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94) 'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94) - GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94) - - Select Case Tipo - Case "CxCClientes" - CveCliente = Request("CveCliente").ToEntero - CveVenta = Request("CveVenta").ToEntero - CargaAuxiliarClienteCxC(CveCliente, CveVenta) - LtlTipo1.Text = "Cuentas por Cobrar" - LtlTipo2.Text = "Folio de la Venta" - LtlTipo3.Text = "Fecha de la Venta" - Case "AnticiposClientes" - CveCliente = Request("CveCliente").ToEntero - CveVenta = Request("CveVenta").ToEntero - CargaAuxiliarClienteAnticipos(CveCliente, CveVenta) - LtlTipo1.Text = "Anticipo de Clientes" - LtlTipo2.Text = "Folio de la Venta" - LtlTipo3.Text = "Fecha de la Venta" - Case "CxPProveedor" - CveProveedor = Request("CveProveedor").ToEntero - CveCompra = Request("CveCompra").ToEntero - CargaAuxiliarProveedor(CveProveedor, CveCompra) - LtlTipo1.Text = "Cuentas por Pagar" - LtlTipo2.Text = "Folio de la Compra" - LtlTipo3.Text = "Fecha de la Compra" - End Select - - - UpDatos.Update() - End Sub - - Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer) - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - - Private Sub CargaAuxiliarClienteAnticipos(CveCliente As Integer, CveVenta As Integer) - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposClienteAuxiliar(CveCliente, CveVenta) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - 'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - 'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - - Private Sub CargaAuxiliarProveedor(CveProveedor As Integer, CveCompra As Integer) - Dim ObjMovtos As New ClsContabilidad() - If ObjMovtos.GetProveedorAuxiliar(CveProveedor, CveCompra) Then - DTDatos = ObjMovtos.DtResultados - GVAuxiliar.DataSource = ObjMovtos.DtResultados - If ObjMovtos.DtResultados.Rows.Count > 0 Then - LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() - LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString - LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) - LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) - End If - Else - GVAuxiliar.DataSource = Nothing - End If - ObjMovtos.Dispose() - GVAuxiliar.DataBind() - End Sub - + GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94) + + Select Case Tipo + Case "CxCClientes" + CveCliente = Request("CveCliente").ToEntero + CveVenta = Request("CveVenta").ToEntero + CargaAuxiliarClienteCxC(CveCliente, CveVenta) + LtlTipo1.Text = "Cuentas por Cobrar" + LtlTipo2.Text = "Folio de la Venta" + LtlTipo3.Text = "Fecha de la Venta" + Case "AnticiposClientes" + CveCliente = Request("CveCliente").ToEntero + CveVenta = Request("CveVenta").ToEntero + CargaAuxiliarClienteAnticipos(CveCliente, CveVenta) + LtlTipo1.Text = "Anticipo de Clientes" + LtlTipo2.Text = "Folio de la Venta" + LtlTipo3.Text = "Fecha de la Venta" + Case "CxPProveedor" + CveProveedor = Request("CveProveedor").ToEntero + CveCompra = Request("CveCompra").ToEntero + CargaAuxiliarProveedor(CveProveedor, CveCompra) + LtlTipo1.Text = "Cuentas por Pagar" + LtlTipo2.Text = "Folio de la Compra" + LtlTipo3.Text = "Fecha de la Compra" + End Select + + + UpDatos.Update() + End Sub + + Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer) + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + + Private Sub CargaAuxiliarClienteAnticipos(CveCliente As Integer, CveVenta As Integer) + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposClienteAuxiliar(CveCliente, CveVenta) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + 'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + 'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + + Private Sub CargaAuxiliarProveedor(CveProveedor As Integer, CveCompra As Integer) + Dim ObjMovtos As New ClsContabilidad() + If ObjMovtos.GetProveedorAuxiliar(CveProveedor, CveCompra) Then + DTDatos = ObjMovtos.DtResultados + GVAuxiliar.DataSource = ObjMovtos.DtResultados + If ObjMovtos.DtResultados.Rows.Count > 0 Then + LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString() + LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString + LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2) + LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2) + End If + Else + GVAuxiliar.DataSource = Nothing + End If + ObjMovtos.Dispose() + GVAuxiliar.DataBind() + End Sub + Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.BackColor = Drawing.Color.LightGray - e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: " - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(0).ColumnSpan = 2 - e.Row.Cells(1).Visible = False - e.Row.Cells(4).ColumnSpan = 3 - e.Row.Cells(5).Visible = False - e.Row.Cells(6).Visible = False - e.Row.Cells(7).Visible = False - e.Row.Cells(8).Visible = False - e.Row.Cells(12).Visible = False - ElseIf e.Row.RowIndex = 1 Then - e.Row.Cells(0).Width = Unit.Pixel(95) - e.Row.Cells(1).Width = Unit.Pixel(180) - e.Row.Cells(2).Width = Unit.Pixel(80) - e.Row.Cells(3).Width = Unit.Pixel(80) - e.Row.Cells(4).Width = Unit.Pixel(83) - e.Row.Cells(5).Width = Unit.Pixel(93) - e.Row.Cells(6).Width = Unit.Pixel(85) - e.Row.Cells(7).Width = Unit.Pixel(95) - e.Row.Cells(8).Width = Unit.Pixel(70) - End If - - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left - - If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then - Dim Liga As String = String.Format("", e.Row.DBCampo("IdPoliza")) - e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("Poliza")) - End If - - If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then - Dim Liga As String = String.Format("", e.Row.DBCampo("CvePersonal")) - e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - End If - - If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}" - 'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then - ' e.Row.Cells(10).Text = "" - 'End If - ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then - Select Case Tipo - Case "CxCClientes" - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}" - Case "CxPProveedor" - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia").ToEntero}" - End Select - End If - - 'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then - ' Dim Liga As String = String.Format("", e.Row.DBCampo("CveCompraAmortizacion")) - ' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - 'End If - - If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then - e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}" - 'Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta")) - 'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) - - End If - - End If - End Sub - - Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GVAuxiliar.RowDeleting - - Dim ObjContPaq As ClsContPAQi = Nothing - Dim Conta As New ClsContabilidad() - Conta.IniciaTransacSQL() - - Dim ClavePrePoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("CvePrePolizaOriginal").ToEntero - Dim IdPoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("IdPoliza").ToEntero - - Dim TieneError = False - - If Not TieneError Then - If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then - TieneError = True - End If - End If - - If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then - TieneError = True - End If - - If Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then - If Conta.ValorPolizaDescuadre > 0 Then - TieneError = True - End If - End If - - If Not TieneError Then - If IdPoliza > 0 Then - If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then - ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) - ObjContPaq.IniciaTransacSQL() - - If Not ObjContPaq.RemovePoliza(IdPoliza) Then - TieneError = True - End If - - End If - End If - End If - - If Not TieneError Then - Alert("Movimiento Eliminado", TipoMensaje.MsgInformacion, "window.opener.location.reload(); window.close();") - If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() - Conta.Commit() - Else - If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() - Conta.RollBack() - End If - If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() - Conta.Dispose() - CargaDatos() - End Sub - - Private Sub GVAuxiliar_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVAuxiliar.RowUpdating - Dim CvePrePoliza As Integer - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim CvePlantillaPoliza As Integer = 0 - Dim Importe As Decimal - Dim MsgError As String = "" - - If GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal > GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal Then - Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal - Else - Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal - End If - - If CveCliente > 0 Then CvePlantillaPoliza = 11 - If CveProveedor > 0 Then CvePlantillaPoliza = 2 - - CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/PopUpAuxiliar", CvePlantillaPoliza, Importe, Importe, 1, Now, "Cancelacion de Pago", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If CvePlantillaPoliza = 2 Then - If Not ObjConta.CancelarPagoCompraConAnticipo(CvePrePoliza, CveCompra, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then - MsgError = "Ocurrió un error al cancelar el pago de la compra" - End If - End If - - If CvePlantillaPoliza = 11 Then - If Not ObjConta.CancelarPagoVentaConAnticipo(CvePrePoliza, CveVenta, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then - MsgError = "Ocurrió un error al cancelar el pago de la venta" - End If - End If - - If MsgError = "" Then - ObjConta.Commit() - Alert("El movimiento se canceló exitosamente.") - Else - ObjConta.RollBack() - Alert(MsgError, TipoMensaje.MsgError) - End If - - - ObjConta.Dispose() - End Sub - Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click - GenerarPDF("Excel") - End Sub - Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click - GenerarPDF() - End Sub - Private Sub GenerarPDF(Optional Formato As String = "PDF") - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - If DTDatos IsNot Nothing And DTDatos.Rows.Count > 0 Then - - Dim params As New List(Of ReportParameter) - - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("Tipo", LtlTipo1.Text)) - params.Add(New ReportParameter("Folio", LtlFolio.Text)) - params.Add(New ReportParameter("Fecha", LtlFechaVenta.Text)) - params.Add(New ReportParameter("Importe", LtlImporte.Text)) - params.Add(New ReportParameter("Saldo", LtlSaldo.Text)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - ImprimirPDF("Empresas\Grales\Formatos\RepAuxiliarContable.rdlc", DTDatos, params, "RepAuxiliarContable_" & LtlFolio.Text, Formato:=Formato) - - Else - Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia) - End If - + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.BackColor = Drawing.Color.LightGray + e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: " + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(0).ColumnSpan = 2 + e.Row.Cells(1).Visible = False + e.Row.Cells(4).ColumnSpan = 3 + e.Row.Cells(5).Visible = False + e.Row.Cells(6).Visible = False + e.Row.Cells(7).Visible = False + e.Row.Cells(8).Visible = False + e.Row.Cells(12).Visible = False + ElseIf e.Row.RowIndex = 1 Then + e.Row.Cells(0).Width = Unit.Pixel(95) + e.Row.Cells(1).Width = Unit.Pixel(180) + e.Row.Cells(2).Width = Unit.Pixel(80) + e.Row.Cells(3).Width = Unit.Pixel(80) + e.Row.Cells(4).Width = Unit.Pixel(83) + e.Row.Cells(5).Width = Unit.Pixel(93) + e.Row.Cells(6).Width = Unit.Pixel(85) + e.Row.Cells(7).Width = Unit.Pixel(95) + e.Row.Cells(8).Width = Unit.Pixel(70) + End If + + e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left + + If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then + Dim Liga As String = String.Format("", e.Row.DBCampo("IdPoliza")) + e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("Poliza")) + End If + + If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then + Dim Liga As String = String.Format("", e.Row.DBCampo("CvePersonal")) + e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + End If + + If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}" + 'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then + ' e.Row.Cells(10).Text = "" + 'End If + ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then + Select Case Tipo + Case "CxCClientes" + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}" + Case "CxPProveedor" + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia").ToEntero}" + End Select + End If + + 'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then + ' Dim Liga As String = String.Format("", e.Row.DBCampo("CveCompraAmortizacion")) + ' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + 'End If + + If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then + e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}" + 'Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta")) + 'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) + + End If + + End If + End Sub + + Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GVAuxiliar.RowDeleting + + Dim ObjContPaq As ClsContPAQi = Nothing + Dim Conta As New ClsContabilidad() + Conta.IniciaTransacSQL() + + Dim ClavePrePoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("CvePrePolizaOriginal").ToEntero + Dim IdPoliza = GVAuxiliar.Rows(e.RowIndex).DataKey("IdPoliza").ToEntero + + Dim TieneError = False + + If Not TieneError Then + If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then + TieneError = True + End If + End If + + If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + If Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then + If Conta.ValorPolizaDescuadre > 0 Then + TieneError = True + End If + End If + + If Not TieneError Then + If IdPoliza > 0 Then + If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then + ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) + ObjContPaq.IniciaTransacSQL() + + If Not ObjContPaq.RemovePoliza(IdPoliza) Then + TieneError = True + End If + + End If + End If + End If + + If Not TieneError Then + Alert("Movimiento Eliminado", TipoMensaje.MsgInformacion, "window.opener.location.reload(); window.close();") + If ObjContPaq IsNot Nothing Then ObjContPaq.Commit() + Conta.Commit() + Else + If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() + Conta.RollBack() + End If + If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose() + Conta.Dispose() + CargaDatos() + End Sub + + Private Sub GVAuxiliar_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVAuxiliar.RowUpdating + Dim CvePrePoliza As Integer + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim CvePlantillaPoliza As Integer = 0 + Dim Importe As Decimal + Dim MsgError As String = "" + + If GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal > GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal Then + Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal + Else + Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal + End If + + If CveCliente > 0 Then CvePlantillaPoliza = 11 + If CveProveedor > 0 Then CvePlantillaPoliza = 2 + + CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/PopUpAuxiliar", CvePlantillaPoliza, Importe, Importe, 1, Now, "Cancelacion de Pago", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePlantillaPoliza = 2 Then + If Not ObjConta.CancelarPagoCompraConAnticipo(CvePrePoliza, CveCompra, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then + MsgError = "Ocurrió un error al cancelar el pago de la compra" + End If + End If + + If CvePlantillaPoliza = 11 Then + If Not ObjConta.CancelarPagoVentaConAnticipo(CvePrePoliza, CveVenta, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then + MsgError = "Ocurrió un error al cancelar el pago de la venta" + End If + End If + + If MsgError = "" Then + ObjConta.Commit() + Alert("El movimiento se canceló exitosamente.") + Else + ObjConta.RollBack() + Alert(MsgError, TipoMensaje.MsgError) + End If + + + ObjConta.Dispose() + End Sub + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click + GenerarPDF("Excel") + End Sub + Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click + GenerarPDF() + End Sub + Private Sub GenerarPDF(Optional Formato As String = "PDF") + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + If DTDatos IsNot Nothing And DTDatos.Rows.Count > 0 Then + + Dim params As New List(Of ReportParameter) + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Tipo", LtlTipo1.Text)) + params.Add(New ReportParameter("Folio", LtlFolio.Text)) + params.Add(New ReportParameter("Fecha", LtlFechaVenta.Text)) + params.Add(New ReportParameter("Importe", LtlImporte.Text)) + params.Add(New ReportParameter("Saldo", LtlSaldo.Text)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + ImprimirPDF("Empresas\Grales\Formatos\RepAuxiliarContable.rdlc", DTDatos, params, "RepAuxiliarContable_" & LtlFolio.Text, Formato:=Formato) + + Else + Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia) + End If + End Sub Property CvePrePolizaNegativa As Integer @@ -390,23 +390,37 @@ Partial Class PopUpAuxiliar Dim TieneError As Boolean = False ObjContabilidad.IniciaTransacSQL() - If ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate) Then - Alert("Se agrego polzia negativa correctamente.") - Else + Dim CvePrePolizaNueva As Integer = ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate) + + If Not CvePrePolizaNueva > 0 Then + + TieneError = True End If - If TieneError Then - ObjContabilidad.RollBack() - Else + If Not TieneError Then + ObjContabilidad.Commit() + Dim Str As New StringBuilder + Str.Append("Se agrego la póliza de cancelación correctamente.
") RegistraScript(" $('#DivCancelar').modal('hide'); ") - CargaDatos() + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If ObjContabilidad.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Str.AppendFormat("Ver Poliza", ObjContabilidad.ContaIdPoliza) + + End If + End If + Alert(Str.ToString) + Else + ObjContabilidad.RollBack() + End If - ObjContabilidad.Dispose() + ObjContabilidad.Dispose() + CargaDatos() + End Sub @@ -424,4 +438,4 @@ Partial Class PopUpAuxiliar -End Class +End Class diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index c75646a73..31701ab12 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -3260,7 +3260,7 @@ Partial Class Contratos_Default Dim ProductoServicio As String = Row("Producto/Servicio").ToString.Trim.ToUpper Dim PrecioUnitario As Double = Row("Precio Unitario").ToString.ToDouble Dim CvePS As Integer = 0 - Dim CveUM As Integer = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString.ToEntero + Dim CveUM As Integer = 0 ' GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString.ToEntero Dim CodigoPS As Integer = 0 Dim Total As Double = (Cantidad * PrecioUnitario) diff --git a/CxC/RepCxC.aspx.vb b/CxC/RepCxC.aspx.vb index 73cac2e84..34a9b77b2 100644 --- a/CxC/RepCxC.aspx.vb +++ b/CxC/RepCxC.aspx.vb @@ -694,7 +694,7 @@ Partial Class RepCxC Dim Registro = If(DdlUsuario.SelectedValue = "-1", "", $" Registró: {DdlUsuario.SelectedItem.Text}") Dim Responsable = If(DdlResponsable.SelectedValue = "-1", "", $" Responsable: {DdlResponsable.SelectedItem.Text}") Dim EstatusCob = If(DdlCobranzaEstatus.SelectedValue = "-1", "", $" Estatus Cobranza: {DdlCobranzaEstatus.SelectedItem.Text}") - 'Dim CorteA As String = If(txtCorteA.Text = "31/12/2018", "", $" Corte A: {txtCorteA.Text}") + Dim CorteA As String = If(txtCorteA.Text = "31/12/2019", "", $" Corte A: {txtCorteA.Text}") Dim EstatusCli = If(DdlEstatusCliente.SelectedValue = "-1", "", $" Clientes: {DdlEstatusCliente.SelectedItem.Text}") Dim ClasificacionCli = If(DdlClienteClasificacion.SelectedValue = "-1", "", $" Clasificación Cliente: {DdlClienteClasificacion.SelectedItem.Text}") @@ -725,7 +725,7 @@ Partial Class RepCxC params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Grupo", DdlGrupo.SelectedItem.Text)) - params.Add(New ReportParameter("AgrupadoPor", $"{Cliente}{Sucursal}{Grupo}{Vendedor}{FechaIn}{FechaFn}{Registro}{Responsable}{TipoDocto}{EstatusCob}{FVI}{FVF}{EstatusCli}{ClasificacionCli}")) + params.Add(New ReportParameter("AgrupadoPor", $"{Cliente}{Sucursal}{Grupo}{Vendedor}{FechaIn}{FechaFn}{Registro}{Responsable}{TipoDocto}{EstatusCob}{FVI}{FVF}{EstatusCli}{ClasificacionCli}{CorteA}")) params.Add(New ReportParameter("TituloReporte", TituloReporte)) params.Add(New ReportParameter("CantColumnas", CantidadColumnas.ToString)) diff --git a/CxC/RepCxCDetalle.aspx.vb b/CxC/RepCxCDetalle.aspx.vb index 86922f5fa..d32b14256 100644 --- a/CxC/RepCxCDetalle.aspx.vb +++ b/CxC/RepCxCDetalle.aspx.vb @@ -833,7 +833,7 @@ Partial Class RepCxCDetalle Dim Registro = If(DdlUsuario.SelectedValue = "-1", "", $" Registró: {DdlUsuario.SelectedItem.Text}") Dim Responsable = If(DdlResponsable.SelectedValue = "-1", "", $" Responsable: {DdlResponsable.SelectedItem.Text}") Dim EstatusCob = If(DdlCobranzaEstatusFiltro.SelectedValue = "-1", "", $" Estatus Cobranza: {DdlCobranzaEstatusFiltro.SelectedItem.Text}") - 'Dim CorteA As String = If(txtCorteA.Text = "31/12/2018", "", $" Corte A: {txtCorteA.Text}") + Dim CorteA As String = If(txtCorteA.Text = "31/12/2019", "", $" Corte A: {txtCorteA.Text}") Dim ClasificacionCli = If(DdlClienteClasificacion.SelectedValue = "-1", "", $" Clasificación Cliente: {DdlClienteClasificacion.SelectedItem.Text}") Dim TituloReporte As String = "REPORTE DE CUENTAS POR COBRAR DEL CLIENTE CON DETALLE" @@ -850,7 +850,7 @@ Partial Class RepCxCDetalle params.Add(New ReportParameter("FechaFin", FechaF)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("AgrupadoPor", $"{Cliente}{Sucursal}{Grupo}{Vendedor}{FechaIn}{FechaFn}{Registro}{Responsable}{TipoDocto}{EstatusCob}{FVI}{FVF}{ClasificacionCli}")) + params.Add(New ReportParameter("AgrupadoPor", $"{Cliente}{Sucursal}{Grupo}{Vendedor}{FechaIn}{FechaFn}{Registro}{Responsable}{TipoDocto}{EstatusCob}{FVI}{FVF}{ClasificacionCli}{CorteA}")) params.Add(New ReportParameter("TituloReporte", TituloReporte)) If Imagen.Exists Then diff --git a/Empresas/119/Formatos/RepClientesCxC.rpt b/Empresas/119/Formatos/RepClientesCxC.rpt index 246d65950..f8e06f121 100644 Binary files a/Empresas/119/Formatos/RepClientesCxC.rpt and b/Empresas/119/Formatos/RepClientesCxC.rpt differ diff --git a/Empresas/137/Formatos/RepClientesCxC.rpt b/Empresas/137/Formatos/RepClientesCxC.rpt index 132388990..e73183a2d 100644 Binary files a/Empresas/137/Formatos/RepClientesCxC.rpt and b/Empresas/137/Formatos/RepClientesCxC.rpt differ diff --git a/Empresas/144/Formatos/Factura.rdlc b/Empresas/144/Formatos/Factura.rdlc index a8f6d9968..6f7296e9b 100644 --- a/Empresas/144/Formatos/Factura.rdlc +++ b/Empresas/144/Formatos/Factura.rdlc @@ -1209,7 +1209,7 @@ - ). Valor recibido a mi (nuestra) entera satisfacción. La falta de pago de éste documento a su vencimiento dará derecho a Soluciones en Telemedición JAR SA de CV o tenedor, desde el día siguiente a cobrar el 10% mensual de interes moratorios hasta su total liquidación y los gastos judiciales que se ocasionen. Lugar y Fecha de Suscripción: Hermosillo, Sonora a + ). Valor recibido a mi (nuestra) entera satisfacción. La falta de pago de éste documento a su vencimiento dará derecho a PAOLA CASTILLO VALENZUELA o tenedor, desde el día siguiente a cobrar el 10% mensual de interes moratorios hasta su total liquidación y los gastos judiciales que se ocasionen. Lugar y Fecha de Suscripción: Hermosillo, Sonora a - Moneda + SerieFolio1 @@ -301,14 +301,14 @@ - + true true - =Fields!SerieFolio.Value + =Fields!Moneda.Value - SerieFolio + Moneda @@ -457,7 +457,7 @@ - Moneda + Serie/Folio @@ -685,7 +685,7 @@ - Serie/Folio + Moneda diff --git a/Empresas/Grales/Formatos/RepProductosServiciosDetalle.rdlc b/Empresas/Grales/Formatos/RepProductosServiciosDetalle.rdlc index ce7fb0e14..c9bcd8e99 100644 --- a/Empresas/Grales/Formatos/RepProductosServiciosDetalle.rdlc +++ b/Empresas/Grales/Formatos/RepProductosServiciosDetalle.rdlc @@ -456,7 +456,7 @@ @@ -468,7 +468,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -490,7 +490,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") dd/MM/yyyy - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -504,7 +504,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -525,7 +525,7 @@ @@ -537,7 +537,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -555,11 +555,11 @@ - =Fields!Nombre.Value + =IIf(Fields!Nombre.Value = "", IIf(Fields!Gpo.Value = "", Fields!Moneda.Value, Fields!Gpo.Value), Fields!Nombre.Value) @@ -571,13 +571,14 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt 2pt + true @@ -592,7 +593,7 @@ @@ -606,7 +607,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -629,7 +630,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") f2 - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -641,7 +642,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -664,7 +665,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") #,0.00;- #,0.00;'-' - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -678,7 +679,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -701,7 +702,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") #,0.00;- #,0.00;'-' - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -715,7 +716,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -737,7 +738,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") #,0.00;-#,0.00;'-' - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -751,7 +752,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -773,7 +774,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") #,0.00;- #,0.00;'-' - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -787,7 +788,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -810,7 +811,7 @@ 8pt =iif(Fields!CveVenta.Value = "", "Bold", "Normal") #,0.00;-#,0.00;'-' - =iif(Fields!CveVenta.Value= "", "White", "Black") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black") @@ -824,7 +825,7 @@ - =iif(Fields!CveVenta.Value = "", "#67809F", "Transparent") + =iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent") 2pt 2pt 2pt @@ -896,14 +897,16 @@ - Textbox1 0.18521cm - 2.8349cm + 3.37444cm 0.6cm - 12.60299cm + 21.20747cm @@ -949,9 +952,9 @@ Textbox2 1.10271cm - 8.17404cm + 9.22743cm 0.52945cm - 10.36447cm + 10.12635cm 1 - 0.58209cm + 1.04773cm true true @@ -1140,9 +1143,9 @@ Textbox10 0.0829cm - 9.84544cm + 10.83183cm 0.38981cm - 2.92333cm + 2.91804cm 3 + + + + + + Textbox11 + 0.0829cm + 13.56466cm + 0.38981cm + 6.47703cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + IMPRESO EN SIG, Rep. Productos Servicios @@ -1272,6 +1309,14 @@ Nombre System.String + + Gpo + System.String + + + Moneda + System.String + Codigo System.String @@ -1331,6 +1376,7 @@ ReportParameter1 + es-MX Cm 40c94aad-a12a-44fb-ab0d-ea36a9656792 \ No newline at end of file diff --git a/Empresas/Grales/Formatos/RepProductosServiciosDetalleCompra.rdlc b/Empresas/Grales/Formatos/RepProductosServiciosDetalleCompra.rdlc index 25d996c63..e41a1122b 100644 --- a/Empresas/Grales/Formatos/RepProductosServiciosDetalleCompra.rdlc +++ b/Empresas/Grales/Formatos/RepProductosServiciosDetalleCompra.rdlc @@ -5,9 +5,6 @@ - - 1.60749cm - 1.70081cm @@ -15,73 +12,40 @@ 1.92431cm - 3.73987cm + 4.71883cm - 2.5cm + 1.41521cm - 4.74981cm + 2.95064cm - 1.3231cm + 1.69352cm - 2.88058cm + 1.84871cm - 1.70617cm + 1.65325cm 1.82697cm - 1.70625cm + 1.65333cm - 1.85343cm + 3.70551cm + + + 2.5cm 0.47879cm - - - - true - true - - - - - SerieFolio - - - - - - - Textbox4 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - @@ -163,7 +127,7 @@ - Proveedor + Producto/Servicio - - SerieFolio1 + Textbox4 + LightGrey + - =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") + Silver 2pt 2pt 2pt @@ -516,6 +478,11 @@ + + + + 0.42588cm + @@ -587,14 +554,14 @@ - + true true - =Fields!RazonSocial.Value + =IIf(Fields!CveCompra.Value <= 0, IIf(Fields!GPO.Value = "", Fields!SerieFolio.Value, Fields!GPO.Value),Fields!PS.Value) @@ -621,14 +588,14 @@ - + true true - =Fields!SubProyecto.Value + =Fields!CodigoAF.Value - - SubProyecto + CodigoAF1 @@ -655,14 +624,14 @@ - + true true - =Fields!PS.Value + =Fields!Clasificacion.Value @@ -690,81 +659,7 @@ - - true - true - - - - - =Fields!CodigoAF.Value - - - - - - - CodigoAF - - - =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Clasificacion.Value - - - - - - - Clasificacion - - - =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") - 2pt - 2pt - 2pt - 2pt - - - - - - - + true true @@ -775,7 +670,7 @@ @@ -785,7 +680,7 @@ - PU + PU1 @@ -801,7 +696,7 @@ - + true true @@ -812,7 +707,7 @@ @@ -822,7 +717,7 @@ - Cantidad + Cantidad1 @@ -838,7 +733,8 @@ - + + true true @@ -858,7 +754,7 @@ - SubTotal + SubTotal1 @@ -874,7 +770,8 @@ - + + true true @@ -884,7 +781,7 @@ @@ -894,7 +791,116 @@ - Total1 + Total + + + =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + =Fields!SerieFolio.Value + + + + + + + SubProyecto + + + =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + true + + + + + =Fields!RazonSocial.Value + + + + + + + RazonSocial1 + + + =iif(Fields!CveCompra.Value = "", "#67809F", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!SubProyecto.Value + + + + + + + SubProyecto1 @@ -942,7 +948,7 @@ 0.70583cm 0.06614cm 0.90467cm - 27.51879cm + 27.59109cm @@ -1372,6 +1378,10 @@ GPO System.String + + Moneda + System.String + DataSet diff --git a/Empresas/Grales/Formatos/RepVentasUtilidadPadre.rdlc b/Empresas/Grales/Formatos/RepVentasUtilidadPadre.rdlc index e2fb28945..5e314ec69 100644 --- a/Empresas/Grales/Formatos/RepVentasUtilidadPadre.rdlc +++ b/Empresas/Grales/Formatos/RepVentasUtilidadPadre.rdlc @@ -51,25 +51,37 @@ - 2.51027cm + 1.78756cm - 2.396cm + 1.7468cm - 1.01424cm + 1.87995cm - 2.3007cm + 1.75936cm - 0.96542cm + 1.99234cm - 2.21367cm + 0.7279cm - 0.90371cm + 2.03612cm + + + 0.67438cm + + + 1.94909cm + + + 0.5862cm + + + 1.38875cm @@ -112,6 +124,114 @@ + + + + true + true + + + + + =Fields!Descuento.Value + + + + + + + Descuento + + + =IIF(Fields!GPO.Value="", "CornflowerBlue", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Bonificacion.Value + + + + + + + Bonificacion + + + =IIF(Fields!GPO.Value="", "CornflowerBlue", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Costo.Value + + + + + + + Costo + + + =IIF(Fields!GPO.Value="", "CornflowerBlue", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + @@ -328,6 +448,42 @@ + + + + true + true + + + + + =Fields!Rentabilidad.Value + + + + + + + Rentabilidad + + + =IIF(Fields!GPO.Value="", "CornflowerBlue", "Transparent") + 2pt + 2pt + 2pt + 2pt + + + + @@ -373,6 +529,123 @@ + + + 0.46771cm + + + true + true + + + + + Descuento + + + + + + + Textbox25 + + + Gray + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.46771cm + + + true + true + + + + + Bonificacion + + + + + + + Textbox20 + + + Gray + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.46771cm + + + true + true + + + + + Costo + + + + + + + Textbox17 + + + Gray + 2pt + 2pt + 2pt + 2pt + + + + + 0.46771cm @@ -607,6 +880,45 @@ + + + 0.46771cm + + + true + true + + + + + % Rent. + + + + + + + Textbox21 + + + Gray + 2pt + 2pt + 2pt + 2pt + + + + + @@ -614,7 +926,7 @@ - 7.28314cm + 3.0587cm true @@ -725,7 +1037,7 @@ Textbox1 1.01452cm - 6.93622cm + 5.03122cm 1.73771cm 5.11444cm 2 @@ -763,7 +1075,7 @@ Textbox1 1.85236cm - 7.25372cm + 5.34872cm 0.58236cm 2.59949cm 3 @@ -800,7 +1112,7 @@ Textbox1 1.85236cm - 10.04757cm + 8.14257cm 0.58236cm 1.68559cm 4 @@ -814,11 +1126,86 @@ 2pt + + true + true + + + + + = "RENTABILIDAD" + HTML + + + + + + + Textbox1 + 1.01452cm + 10.71594cm + 1.73771cm + 5.11444cm + 5 + + + SeaGreen + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Rentabilidad.Value + HTML + + + + + + + Textbox1 + 1.85236cm + 12.93844cm + 0.58236cm + 2.59949cm + 6 + + + 2pt + 2pt + 2pt + 2pt + + 1.667in @@ -170,8 +172,9 @@ -
-
+
+
+
@@ -183,6 +186,18 @@
+ +
+
+
+
+
+
+
+
+
+

@@ -194,12 +209,16 @@ + + + + @@ -215,8 +234,20 @@