diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index d517fbe4e..47bb3a961 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -269,7 +269,39 @@ Public Class ClsGenerales SqlAdapter.Fill(Data) retorno = True Catch ex As Exception - OnError("Ocurrió un error al obtener los mptivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al obtener los motivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function GetMotivosCancelacionEmpresa(CveEmpresa As Integer, Optional CveMotivoCancelacion As Integer = -1, Optional CveSATMotivoCancelacion As Integer = -1) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_MotivosCancelacionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion + .Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los motivos de cancelación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + Public Function GenerarMotivosCancelacionEmpresaDefault(CveEmpresa As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Gral_MotivosCancelacionDefaultAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los motivos de cancelacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno End Function diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 02b791de4..209735f2c 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1730,7 +1730,7 @@ Public Class ClsInventarios Public Function RepMovimientos(CveEmpresa As Integer, CveMoneda As Integer, FechaI As String, FechaF As String, CveConcepto As Integer, CveProveedor As Integer, Almacenes As String, - CveFamilia As Integer, CveSubFamilia As Integer, CvePS As Integer, CveClasificacion As Integer, Tipo As Integer, Optional CveMarca As Integer = -1, Optional CvePersonal As Integer = -1, + CveCategoria As Integer, CveClasificacion As Integer, CvePS As Integer, Tipo As Integer, Optional CveMarca As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion2 As Integer = -1, Optional CveTipoAlmacen As String = "-1", Optional Modalidad As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1745,8 +1745,8 @@ Public Class ClsInventarios .Add("@CveConcepto", SqlDbType.Int).Value = CveConcepto .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@Almacenes", SqlDbType.VarChar).Value = Almacenes - .Add("@CveFamilia", SqlDbType.Int).Value = CveFamilia - .Add("@CveSubFamilia", SqlDbType.Int).Value = CveSubFamilia + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + ' .Add("@CveSubFamilia", SqlDbType.Int).Value = CveSubFamilia .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 156c363ff..480f0dcaf 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1141,7 +1141,7 @@ Public Class ClsPaginas End Set End Property - Public Shared Property GlobalDTSATMotivosCancelacion(Optional CveMotivoCancelacion As Integer = -1, Optional CodigoSAT As String = "-1") As DataTable + Public Shared Property GlobalDTSATMotivosCancelacion(Optional CveSATMotivoCancelacion As Integer = -1, Optional CodigoSAT As String = "-1") As DataTable Get If HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") Is Nothing Then Using ObjGral As New ClsGenerales @@ -1151,13 +1151,13 @@ Public Class ClsPaginas End Using End If - If CveMotivoCancelacion <> -1 OrElse CodigoSAT <> "-1" Then + If CveSATMotivoCancelacion <> -1 OrElse CodigoSAT <> "-1" Then Dim StrSQL As New StringBuilder StrSQL.Append("1=1") - If CveMotivoCancelacion <> -1 Then StrSQL.AppendFormat(" AND CveMotivoCancelacion = {0}", CveMotivoCancelacion) + If CveSATMotivoCancelacion <> -1 Then StrSQL.AppendFormat(" AND CveSATMotivoCancelacion = {0}", CveSATMotivoCancelacion) If CodigoSAT <> "-1" Then StrSQL.AppendFormat(" AND CodigoSAT = '{0}'", CodigoSAT) - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSATMotivosCancelacion"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), " CveMotivoCancelacion", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTSATMotivosCancelacion"), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), " CveSATMotivoCancelacion", DataViewRowState.CurrentRows) GlobalDTSATMotivosCancelacion = Dv.ToTable Dv.Dispose() Else @@ -1169,6 +1169,47 @@ Public Class ClsPaginas HttpContext.Current.Application("GlobalDTSATMotivosCancelacion") = value End Set End Property + + Public Shared Property GlobalDTMotivosCancelacionEmpresa(CveEmpresa As Integer, Optional CveMotivoCancelacion As Integer = -1, Optional CveSATMotivoCancelacion As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTMotivosCancelacionEmpresa-{0}", CveEmpresa) + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjGral As New ClsGenerales() + If ObjGral.GetMotivosCancelacionEmpresa(CveEmpresa) Then + 'SI NO TIENE, GENERA LOS MOTIVOS + If ObjGral.DtResultados.Rows.Count = 0 Then + If ObjGral.GenerarMotivosCancelacionEmpresaDefault(CveEmpresa) Then + If ObjGral.GetMotivosCancelacionEmpresa(CveEmpresa) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then + HttpContext.Current.Application(AppNombre) = ObjGral.DtResultados + End If + End If + Else + HttpContext.Current.Application(AppNombre) = ObjGral.DtResultados + End If + End If + ObjGral.Dispose() + End If + + If HttpContext.Current.Application(AppNombre) IsNot Nothing Then + Dim Str As New StringBuilder + Str.AppendFormat(" 1 = 1 ") + If CveMotivoCancelacion > 0 Then Str.AppendFormat(" AND CveMotivoCancelacion = {0}", CveMotivoCancelacion) + If CveSATMotivoCancelacion > 0 Then Str.AppendFormat(" AND CveSATMotivoCancelacion = {0}", CveSATMotivoCancelacion) + + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTMotivosCancelacionEmpresa = Dv.ToTable + Dv.Dispose() + Else + GlobalDTMotivosCancelacionEmpresa = Nothing + End If + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTMotivosCancelacionEmpresa-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + End Set + End Property Property GlobalDTEstatusOrdenCompra() As DataTable Get GlobalDTEstatusOrdenCompra = DirectCast(Application("GlobalDTEstatusOrdenCompra"), DataTable) @@ -2511,19 +2552,29 @@ Public Class ClsPaginas #Region "***********************************************************************DT GENERALES**************************************************************************************" Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTGralCategorias"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralCategorias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralCategorias = DirectCast(Application("GlobalDTGralCategorias"), DataTable) + Dim AppNombre As String = String.Format("GlobalDTGralCategorias-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetCategorias(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados Else Application(AppNombre) = Nothing + ObjGenerales.Dispose() End If + + Dim filtro As New StringBuilder + 'If CveMarca > 0 Then + ' filtro.AppendFormat(" CveMarca={0} ", CveMarca) + 'End If + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTGralCategorias = Dv.ToTable + Dv.Dispose() End Get Set(value As DataTable) - Application("GlobalDTGralCategorias") = value + Dim AppNombre As String = String.Format("GlobalDTGralCategorias-{0}", CveEmpresa) + Application(AppNombre) = value End Set + End Property Property GlobalDTGralCategorias2(CveEmpresa As Integer) As DataTable diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index ece017883..2c95cc3fd 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -241,6 +241,26 @@ Public Class ClsVentas Return Retorno End Function + + Public Function GetVentasPendientesCancelacion(CveEmpresa As Integer, CveUsuarioConsulta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_VentasPendientesCancelacionGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las Ventas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function GetVentaComplementos() As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ComplementosGet") @@ -2735,9 +2755,9 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetRepRemisionesSinFacturar(FechaI As String, FechaF As String, FechaV As String, CveSubProyecto As String, CveCliente As Integer, CveContrato As Integer, CveVendedor As String, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1) As Boolean + Public Function GetRepRemisionesSinFacturar(FechaI As String, FechaF As String, FechaV As String, CveSubProyecto As String, CveCliente As Integer, CveContrato As Integer, CveVendedor As String, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1, Optional ConsultaInventario As Boolean = False) As Boolean Dim Retorno As Boolean = False - DataAdapter("Vta_RepRemisionesGet") + DataAdapter("PA_Vta_RepRemisionesGet") With SqlAdapter.SelectCommand.Parameters .Add("@FechaI", SqlDbType.VarChar).Value = FechaI @@ -2749,6 +2769,7 @@ Public Class ClsVentas .Add("@CveVendedor", SqlDbType.VarChar).Value = CveVendedor .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@ConsultaInventario", SqlDbType.Bit).Value = ConsultaInventario End With Try @@ -2760,9 +2781,9 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetRepRemisionesSinFacturarDetalle(FechaI As String, FechaF As String, FechaV As String, CveCliente As Integer, CveContrato As Integer, CveVenta As Integer, CveEmpresa As Integer, CveSubProyecto As String, Optional CveUsuarioConsulta As Integer = -1) As Boolean + Public Function GetRepRemisionesSinFacturarDetalle(FechaI As String, FechaF As String, FechaV As String, CveCliente As Integer, CveContrato As Integer, CveVenta As Integer, CveEmpresa As Integer, CveSubProyecto As String, Optional CveUsuarioConsulta As Integer = -1, Optional ConsultaInventario As Boolean = False) As Boolean Dim Retorno As Boolean = False - DataAdapter("Vta_RepRemisionesDetalleGet") + DataAdapter("PA_Vta_RepRemisionesDetalleGet") With SqlAdapter.SelectCommand.Parameters .Add("@FechaI", SqlDbType.VarChar).Value = FechaI @@ -2774,6 +2795,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta + .Add("@ConsultaInventario", SqlDbType.Bit).Value = ConsultaInventario End With Try @@ -2848,7 +2870,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReporteVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean + Public Function GetReporteVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUtilidadGet") @@ -2860,6 +2882,7 @@ Public Class ClsVentas .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With @@ -2876,7 +2899,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReporteVentasUtilidadDetalle(CveVendedor As String, CveVenta As Integer, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean + Public Function GetReporteVentasUtilidadDetalle(CveVendedor As String, CveVenta As Integer, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUtilidadDetalleGet") With SqlAdapter.SelectCommand.Parameters @@ -2888,6 +2911,7 @@ Public Class ClsVentas .Add("@CveSubProyecto", SqlDbType.VarChar).Value = CveSubProyecto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With @@ -2907,7 +2931,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean + Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer, CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepVentasUtilidadGet") @@ -2920,6 +2944,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Gpo", SqlDbType.Int).Value = Gpo .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With @@ -3036,6 +3061,24 @@ Public Class ClsVentas Return OnError End Function + Public Function GetFacturasRelacionadasPorFolioFiscal(FoliosFiscales As String, CveEmpresa As Integer) As Boolean + Dim OnError As Boolean = False + DataAdapter("PA_Vta_FacturasRelacionadasPorFolioFiscalGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@FoliosFiscales", SqlDbType.VarChar).Value = FoliosFiscales + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + OnError = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener las facturas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return OnError + End Function + Public Function GetFacturasCanceladasPendientesWS(RFC As String, CveEmpresa As Integer, Optional showalert As Boolean = True) As Boolean Dim retorno As Boolean = False Try @@ -3075,6 +3118,8 @@ Public Class ClsVentas Return retorno End Function + + Public Function UpdateVentaFacturas(CveFactura As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean Dim OnError As Boolean = False diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index ea8833527..233100246 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4585,7 +4585,7 @@ Namespace Modelos End If ObjVentas.Dispose() - Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion) + Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion, CveMotivoCancelacion:=Me.CveMotivoCancelacion, MotivoCancelacion:=Me.MotivoCancelacion) End Function ''' ''' Cancela la factura para poder realizar la refacturacion @@ -4600,9 +4600,9 @@ Namespace Modelos ''' ''' ''' - Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional Motivo As String = "") As MCancelacionVentaMensaje + Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "") As MCancelacionVentaMensaje 'Comprobante emitido con errores sin relación - Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=2, MotivoCancelacion:=Motivo) + Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo) End Function Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False, @@ -4785,6 +4785,15 @@ Namespace Modelos Dim RequiereAceptacion As Boolean = False Dim Mensaje As String = "" + Dim CveSATMotivoCancelacion As Integer = -1 + + If CveMotivoCancelacion > 0 Then + Dim Row As DataRow = ClsPaginas.GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveMotivoCancelacion:=CveMotivoCancelacion).FiltroPrimero("") + If Row IsNot Nothing Then + CveSATMotivoCancelacion = Row("CveSATMotivoCancelacion").ToString().ToEntero() + End If + End If + 'SI YA ESTA TIMBRADA, NUEVO PROCESO REFACTURACION, ASIGNA LA CANCELACION PENDIENTE If EsRefacturacion AndAlso Me.CveEstatusFactura = 3 AndAlso CveMotivoCancelacion > 0 Then CveEstatusFacturaAsignado = 23 @@ -4792,7 +4801,7 @@ Namespace Modelos If CveEstatusFacturaAsignado <= 0 Then Try - If ObjFactura.FolioFiscal <> "" AndAlso UsuarioActual.Empresa.FacturaProduccion Then + If ObjFactura.FolioFiscal <> "" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then 'VERIFICA SI DEBE VALIDAR ANTE EL SAT @@ -4872,7 +4881,7 @@ Namespace Modelos If Not ObtenerAcuse Then If ContinuarCancelacion Then - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveMotivoCancelacion:=CveMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then + If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, TotalT, RFCReceptor, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion, FolioSustitucion:=FolioSustitucion) Then 'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN If RequiereAceptacion Then CancelacionFecha = Now.Date diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index e6c93b891..d9fc2d0e9 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -9,7 +9,7 @@ Imports System.Xml Imports System.Data Imports System.Xml.Serialization Imports System.Net -Imports ProfactCartaPorte = Profact.TimbraCFDI33.Complementos.CartaPorte10 +Imports ProfactCartaPorte = Profact.TimbraCFDI33.Complementos.CartaPorte20 Public Class Timbrado @@ -29,20 +29,42 @@ Public Class Timbrado Public Property EstatusCancelacion As String End Class + Public Class RelacionadosPadre + Public Property Uuid As String + Public Property RfcEmisor As String + Public Property RfcReceptor As String + End Class + + Public Class RelacionadosHijo + Public Property Uuid As String + Public Property RfcEmisor As String + Public Property RfcReceptor As String + End Class + + Public Class MRespUUIDRelacionados + Public Property Codigo As Integer + Public Property Mensaje As String + Public Property Resultado As String + Public Property RelacionadosPadre As List(Of RelacionadosPadre) + Public Property RelacionadosHijo As List(Of RelacionadosHijo) + End Class + #End Region Public Shared Function VerificarVigenciaSAT(uuid As String, emisor As String, receptor As String, total As String, produccion As Boolean) As AcuseCancelacionSAT Dim Retorno As AcuseCancelacionSAT = Nothing - Dim resp As Cancelacion.AcuseSat = New Cancelacion.AcuseSat() - Using ws As Cancelacion.CancelacionSoapClient = New Cancelacion.CancelacionSoapClient + Dim resp As Cancelacion2022.AcuseSat = New Cancelacion2022.AcuseSat() + Using ws As Cancelacion2022.CancelacionSoapClient = New Cancelacion2022.CancelacionSoapClient Try If Not produccion Then - Dim PACUsuario As String = "rene.molina@adsistemas.mx" - Dim PACContrasenia As String = "rene2018" + Dim PACUsuario As String = "UserTest" + Dim PACContrasenia As String = "1234567890" resp = ws.ConsultaVigenciaTest(emisor, PACUsuario, PACContrasenia, uuid, receptor, total) Retorno = New AcuseCancelacionSAT() Else - resp = ws.ConsultaVigencia(emisor, "UserTest", "1234567890", uuid, receptor, total) + Dim PACUsuario As String = "rene.molina@adsistemas.mx" + Dim PACContrasenia As String = "rene2018" + resp = ws.ConsultaVigencia(emisor, PACUsuario, PACContrasenia, uuid, receptor, total) Retorno = New AcuseCancelacionSAT() End If Catch ex As Exception @@ -61,7 +83,53 @@ Public Class Timbrado End Using Return Retorno End Function - Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True, Optional CveMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As Boolean + + Public Shared Function ConsultarUUIDRelacionados(Empresa As Empresa, FolioFiscal As String, Optional Produccion As Boolean = True) As MRespUUIDRelacionados + Dim Retorno = New MRespUUIDRelacionados() + Dim resp As Cancelacion2022.StructRelations = New Cancelacion2022.StructRelations() + + Using ws As Cancelacion2022.CancelacionSoapClient = New Cancelacion2022.CancelacionSoapClient + Try + Dim ArchivoLLave As String = $"{Empresa.Ruta}Certificados\{Empresa.ArchivoKey}" + Dim ArchivoCertificado As String = $"{Empresa.Ruta}Certificados\{Empresa.ArchivoCer}" + Dim Key As String = Empresa.ContraseñaKey + + Dim llaveByte As Byte(), certByte As Byte() + Dim llaveBase64 As String = "", certBase64 As String = "" + + llaveByte = System.IO.File.ReadAllBytes(ArchivoLLave) + llaveBase64 = Convert.ToBase64String(llaveByte) + + certByte = System.IO.File.ReadAllBytes(ArchivoCertificado) + certBase64 = Convert.ToBase64String(certByte) + + If Not Produccion Then + Dim PACUsuario As String = "UserTest" + Dim PACContrasenia As String = "1234567890" + resp = ws.ObtieneRelacionadosTest(Empresa.RFC, PACUsuario, PACContrasenia, certBase64, llaveBase64, Key, FolioFiscal) + Else + Dim PACUsuario As String = "rene.molina@adsistemas.mx" + Dim PACContrasenia As String = "rene2018" + resp = ws.ObtieneRelacionados(Empresa.RFC, PACUsuario, PACContrasenia, certBase64, llaveBase64, Key, FolioFiscal) + End If + + Catch ex As Exception + Dim Strr As String = String.Format("Error al verificar estatus de cancelacion:{0}", ex.Message) + Strr.GuardaLog() + Return Nothing + End Try + End Using + + Dim Json As String = Newtonsoft.Json.JsonConvert.SerializeObject(resp) + + If Not String.IsNullOrEmpty(Json) Then + Retorno = Newtonsoft.Json.JsonConvert.DeserializeObject(Of MRespUUIDRelacionados)(Json) + End If + + Return Retorno + End Function + + Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True, Optional CveSATMotivoCancelacion As Integer = -1, Optional FolioSustitucion As String = "") As Boolean Dim Retorno As Boolean = False Dim MsgCancelacion As New StringBuilder @@ -80,9 +148,9 @@ Public Class Timbrado Dim CodigoSATMotivoCancelacion As String = "" - If CveMotivoCancelacion > 0 Then - If ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion) IsNot Nothing AndAlso ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion).Rows.Count > 0 Then - CodigoSATMotivoCancelacion = ClsPaginas.GlobalDTSATMotivosCancelacion(CveMotivoCancelacion).Rows(0)("CodigoSAT").ToString() + If CveSATMotivoCancelacion > 0 Then + If ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion) IsNot Nothing AndAlso ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion).Rows.Count > 0 Then + CodigoSATMotivoCancelacion = ClsPaginas.GlobalDTSATMotivosCancelacion(CveSATMotivoCancelacion).Rows(0)("CodigoSAT").ToString() End If End If @@ -423,12 +491,12 @@ Public Class Timbrado UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno If Not Empresa.FacturaProduccion Then - ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_AAA010101AAA.key" - ArchivoCertificado = $"{Empresa.Ruta}Certificados\CSD01_AAA010101AAA.cer" + ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key" + ArchivoCertificado = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer" UsuarioServicio = "UserTest" ClaveServicio = "1234567890" - UrlServicio = "http://juancalderon-001-site6.ftempurl.com/cancelacion.asmx?WSDL" + 'UrlServicio = "http://juancalderon-001-site6.ftempurl.com/cancelacion.asmx?WSDL" End If @@ -3249,7 +3317,7 @@ Public Class Timbrado ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key" ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer" - UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" '"http://108.60.211.43/rvltimbrado/service1.asmx" + UrlServicio = "https://pruebas.timbracfdi33.mx/Timbrado.asmx" End If @@ -3821,49 +3889,46 @@ Public Class Timbrado If ObjCFDITimbre.Complementos.CartaPorte IsNot Nothing Then - Dim Carta As CFDICartaPorte = ObjCFDITimbre.Complementos.CartaPorte - ''DATOS GENERALES + Dim Carta As CFDICartaPorte = ObjCFDITimbre.Complementos.CartaPorte Dim ComCartaPorte = New ProfactCartaPorte.CartaPorte() ComCartaPorte.TranspInternac = CType([Enum].Parse(GetType(ProfactCartaPorte.CartaPorteTranspInternac), Carta.TranspInternac), ProfactCartaPorte.CartaPorteTranspInternac) ComCartaPorte.EntradaSalidaMercSpecified = False - ComCartaPorte.ViaEntradaSalidaSpecified = False - ComCartaPorte.TotalDistRecSpecified = False + ComCartaPorte.ViaEntradaSalidaSpecified = False + ComCartaPorte.TotalDistRecSpecified = False 'UBICACIONES If Carta.Ubicaciones IsNot Nothing AndAlso Carta.Ubicaciones.Count > 0 Then + Dim i As Integer = 0 ComCartaPorte.Ubicaciones = New ProfactCartaPorte.CartaPorteUbicacion(Carta.Ubicaciones.Count - 1) {} For Each ubica As CFDICartaPorteUbicacion In Carta.Ubicaciones 'origen + ComCartaPorte.Ubicaciones(i) = New ProfactCartaPorte.CartaPorteUbicacion + ComCartaPorte.Ubicaciones(i).TipoUbicacion = CType([Enum].Parse(GetType(ProfactCartaPorte.CartaPorteUbicacionTipoUbicacion), ubica.TipoUbicacion), ProfactCartaPorte.CartaPorteUbicacionTipoUbicacion) ComCartaPorte.Ubicaciones(i).TipoEstacionSpecified = False + ComCartaPorte.Ubicaciones(i).IDUbicacion = ubica.IDUbicacion + ComCartaPorte.Ubicaciones(i).RFCRemitenteDestinatario = ubica.RFCRemitenteDestinatario + ComCartaPorte.Ubicaciones(i).NombreRemitenteDestinatario = ubica.NombreRemitenteDestinatario + ComCartaPorte.Ubicaciones(i).NumRegIdTrib = ubica.NumRegIdTrib + 'ComCartaPorte.Ubicaciones(i).ResidenciaFiscal = ubica.ResidenciaFiscal + 'ComCartaPorte.Ubicaciones(i).NumEstacion = ubica.NumEstacion + 'ComCartaPorte.Ubicaciones(i).NavegacionTrafico = ubica.NavegacionTrafico + ComCartaPorte.Ubicaciones(i).FechaHoraSalidaLlegada = ubica.FechaHoraSalidaLlegada.ToDate ComCartaPorte.Ubicaciones(i).DistanciaRecorrida = ubica.DistanciaRecorrida - 'ComCartaPorte.Ubicaciones(i).Origen = New ProfactCartaPorte.CartaPorteUbicacion With {.IDOrigen = ubica.IDOrigen, - ' .RFCRemitente = ubica.RFCRemitenteDestinatario, - ' .NombreRemitente = ubica.NombreRemitenteDestinatario, - ' .FechaHoraSalida = ubica.FechaHoraSalida.ToDate} - 'ComCartaPorte.Ubicaciones(i).Domicilio = New ProfactCartaPorte.CartaPorteUbicacionDomicilio With {.Calle = ubica.Domicilio.Calle, - ' .NumeroExterior = ubica.Domicilio.NumeroExterior, - ' .NumeroInterior = ubica.Domicilio.NumeroInterior, - ' .Colonia = ubica.Domicilio.Colonia, - ' .Localidad = ubica.Domicilio.Localidad, - ' .Referencia = ubica.Domicilio.Referencia, - ' .Municipio = ubica.Domicilio.Municipio, - ' .Estado = ubica.Domicilio.Estado, - ' .CodigoPostal = ubica.Domicilio.CP} - ''falta pais + ComCartaPorte.Ubicaciones(i).Domicilio = New ProfactCartaPorte.CartaPorteUbicacionDomicilio With {.Calle = ubica.Domicilio.Calle, + .NumeroExterior = ubica.Domicilio.NumeroExterior, + .NumeroInterior = ubica.Domicilio.NumeroInterior, + .Colonia = ubica.Domicilio.Colonia, + .Localidad = ubica.Domicilio.Localidad, + .Referencia = ubica.Domicilio.Referencia, + .Municipio = ubica.Domicilio.Municipio, + .Estado = ubica.Domicilio.Estado, + .CodigoPostal = ubica.Domicilio.CP, + .Pais = CType([Enum].Parse(GetType(ProfactCartaPorte.c_Pais), ubica.Domicilio.Pais), ProfactCartaPorte.c_Pais)} - - - 'cfdi.CartaPorteUbicacion(ubica.TipoEstacion, ubica.DistanciaRecorrida) - 'cfdi.CartaPorteOrigen(ubica.Origen.IDOrigen, ubica.Origen.RFCRemitente, ubica.Origen.NombreRemitente, ubica.Origen.NumRegIdTrib, ubica.Origen.ResidenciaFiscal, ubica.Origen.NumEstacion, ubica.Origen.NombreEstacion, ubica.Origen.NavegacionTrafico, ubica.Origen.FechaHoraSalida) - 'cfdi.CartaPorteDomicilio(ubica.Origen.Domicilio.Calle, ubica.Origen.Domicilio.NumeroExterior, ubica.Origen.Domicilio.NumeroInterior, ubica.Origen.Domicilio.Colonia, ubica.Origen.Domicilio.Localidad, ubica.Origen.Domicilio.Referencia, ubica.Origen.Domicilio.Municipio, ubica.Origen.Domicilio.Estado, ubica.Origen.Domicilio.Pais, ubica.Origen.Domicilio.CP) - 'destino - 'cfdi.CartaPorteUbicacion(ubica.TipoEstacion, ubica.DistanciaRecorrida) - 'cfdi.CartaPorteDestino(ubica.Destino.IDDestino, ubica.Destino.RFCDestinatario, ubica.Destino.NombreDestinatario, ubica.Destino.NumRegIdTrib, ubica.Destino.ResidenciaFiscal, ubica.Destino.NumEstacion, ubica.Destino.NombreEstacion, ubica.Destino.NavegacionTrafico, ubica.Destino.FechaHoraProgLlegada) - 'cfdi.CartaPorteDomicilio(ubica.Destino.Domicilio.Calle, ubica.Destino.Domicilio.NumeroExterior, ubica.Destino.Domicilio.NumeroInterior, ubica.Destino.Domicilio.Colonia, ubica.Destino.Domicilio.Localidad, ubica.Destino.Domicilio.Referencia, ubica.Destino.Domicilio.Municipio, ubica.Destino.Domicilio.Estado, ubica.Destino.Domicilio.Pais, ubica.Destino.Domicilio.CP) Next End If @@ -3885,16 +3950,10 @@ Public Class Timbrado If concep.BienesTransp <> "" Then ComCartaPorte.Mercancias.Mercancia(i).BienesTransp = CType([Enum].Parse(GetType(ProfactCartaPorte.c_ClaveProdServCP), "Item" & concep.BienesTransp), ProfactCartaPorte.c_ClaveProdServCP) - ComCartaPorte.Mercancias.Mercancia(i).BienesTranspSpecified = True - End If - If concep.ClaveSTCC <> "" Then - ComCartaPorte.Mercancias.Mercancia(i).ClaveSTCCSpecified = True - ComCartaPorte.Mercancias.Mercancia(i).ClaveSTCC = CType([Enum].Parse(GetType(ProfactCartaPorte.c_ClaveProdSTCC), "Item" & concep.ClaveSTCC), ProfactCartaPorte.c_ClaveProdSTCC) End If ComCartaPorte.Mercancias.Mercancia(i).Descripcion = concep.Descripción ComCartaPorte.Mercancias.Mercancia(i).Cantidad = concep.Cantidad - ComCartaPorte.Mercancias.Mercancia(i).ClaveUnidadSpecified = False ComCartaPorte.Mercancias.Mercancia(i).Unidad = concep.Unidad ComCartaPorte.Mercancias.Mercancia(i).Dimensiones = concep.Dimensiones If concep.ClaveMaterialPeligroso <> "" Then @@ -3906,48 +3965,108 @@ Public Class Timbrado End If - ComCartaPorte.Mercancias.Mercancia(i).DescripEmbalaje = concep.DescripEmbalaje ComCartaPorte.Mercancias.Mercancia(i).PesoEnKg = concep.PesoenKg ComCartaPorte.Mercancias.Mercancia(i).ValorMercanciaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).MonedaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).FraccionArancelariaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).UUIDComercioExt = concep.UUIDComercioExt + + Dim j As Integer = 0 + ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta(Carta.Mercancias.Mercancias.Count - 1) {} + For Each transp In concep.MercanciasCantidadTransporta + ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta(j) = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta + ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta(j).Cantidad = transp.Cantidad + ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta(j).IDOrigen = transp.IDOrigen + ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta(j).IDDestino = transp.IDDestino + 'ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta(1).CvesTransporte = transp.CvesTransportes + Next + i += 1 Next End If End If + + + + + 'If Carta.FiguraTransporte IsNot Nothing Then + + ' If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then + + ' cfdi.CartaPorteAutotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT) + + ' cfdi.CartaPorteIdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM) + + ' cfdi.CartaPorteSeguros(Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil, + ' Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente, + ' Carta.FiguraTransporte.AutoTransporte.NombreSeguroCarga, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroCarga, + ' Carta.FiguraTransporte.AutoTransporte.PrimaSeguro) + + ' If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then + ' For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporte.Remolques + ' cfdi.CartaPorteRemolque(concep.SubTipoRemolque, concep.Placa) + ' Next + + ' End If + ' End If + + ' If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then + ' For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores + ' cfdi.CartaPorteTiposFigura(concep.TipoFigura, concep.RFCFigura, concep.NumLicencia, concep.NombreFigura, concep.NumRegidTribFigura, If(concep.ResidenciaFiscalFigura <> "MEX", concep.ResidenciaFiscalFigura, "")) + ' If concep.TipoFigura.Contiene("02", "03") Then ' “02”- Propietario o “03” -Arrendador + ' cfdi.CartaPortePartesTransporte("PT01") + ' cfdi.CartaPortePartesTransporteDomicilio(concep.Domicilio.Calle, concep.Domicilio.NumeroExterior, concep.Domicilio.NumeroInterior, concep.Domicilio.Colonia, concep.Domicilio.Localidad, concep.Domicilio.Referencia, concep.Domicilio.Municipio, concep.Domicilio.Estado, concep.Domicilio.Pais, concep.Domicilio.CP) + ' End If + ' Next + ' End If + + 'End If + ' If Carta.FiguraTransporte IsNot Nothing Then If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then - ComCartaPorte.FiguraTransporte = New ProfactCartaPorte.CartaPorteFiguraTransporte - ComCartaPorte.FiguraTransporte.CveTransporte = ProfactCartaPorte.c_CveTransporte.Item02 - ComCartaPorte.Mercancias.AutotransporteFederal = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteFederal + + 'ComCartaPorte.FiguraTransporte(1). = ProfactCartaPorte.c_CveTransporte.Item02 + ComCartaPorte.Mercancias.Autotransporte = New ProfactCartaPorte.CartaPorteMercanciasAutotransporte If Carta.FiguraTransporte.AutoTransporte.PermisoSCT <> "" Then - ComCartaPorte.Mercancias.AutotransporteFederal.PermSCT = CType([Enum].Parse(GetType(ProfactCartaPorte.c_TipoPermiso), Carta.FiguraTransporte.AutoTransporte.PermisoSCT), ProfactCartaPorte.c_TipoPermiso) + ComCartaPorte.Mercancias.Autotransporte.PermSCT = CType([Enum].Parse(GetType(ProfactCartaPorte.c_TipoPermiso), Carta.FiguraTransporte.AutoTransporte.PermisoSCT), ProfactCartaPorte.c_TipoPermiso) End If - ComCartaPorte.Mercancias.AutotransporteFederal.NumPermisoSCT = Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT + ComCartaPorte.Mercancias.Autotransporte.NumPermisoSCT = Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT 'pendiente RMF 'ComCartaPorte.Mercancias.AutotransporteFederal.NombreAseg = Carta.FiguraTransporte.AutoTransporte.NombreAseg 'ComCartaPorte.Mercancias.AutotransporteFederal.NumPolizaSeguro = Carta.FiguraTransporte.AutoTransporte.NumPolizaSeguro - Dim ConfigVehicular As New ProfactCartaPorte.CartaPorteMercanciasAutotransporteFederalIdentificacionVehicular + Dim ConfigVehicular As New ProfactCartaPorte.CartaPorteMercanciasAutotransporteIdentificacionVehicular ConfigVehicular.ConfigVehicular = CType([Enum].Parse(GetType(ProfactCartaPorte.c_ConfigAutotransporte), Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular), ProfactCartaPorte.c_ConfigAutotransporte) ConfigVehicular.AnioModeloVM = Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM ConfigVehicular.PlacaVM = Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM - ComCartaPorte.Mercancias.AutotransporteFederal.IdentificacionVehicular = ConfigVehicular + ComCartaPorte.Mercancias.Autotransporte.IdentificacionVehicular = ConfigVehicular + + Dim ConfigVehicularSeguros As New ProfactCartaPorte.CartaPorteMercanciasAutotransporteSeguros + ConfigVehicularSeguros.AseguraRespCivil = Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil + ConfigVehicularSeguros.PolizaRespCivil = Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil + ConfigVehicularSeguros.AseguraMedAmbiente = Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente + ConfigVehicularSeguros.PolizaMedAmbiente = Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente + ConfigVehicularSeguros.AseguraCarga = Carta.FiguraTransporte.AutoTransporte.NombreSeguroCarga + ConfigVehicularSeguros.PolizaCarga = Carta.FiguraTransporte.AutoTransporte.PolizaSeguroCarga + + If Carta.FiguraTransporte.AutoTransporte.PrimaSeguro > 0 Then + ConfigVehicularSeguros.PrimaSeguro = Carta.FiguraTransporte.AutoTransporte.PrimaSeguro + ConfigVehicularSeguros.PrimaSeguroSpecified = True + End If If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then Dim i As Integer = 0 - ComCartaPorte.Mercancias.AutotransporteFederal.Remolques = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteFederalRemolque(Carta.FiguraTransporte.AutoTransporte.Remolques.Count - 1) {} + ComCartaPorte.Mercancias.Autotransporte.Remolques = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteRemolque(Carta.FiguraTransporte.AutoTransporte.Remolques.Count - 1) {} For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporte.Remolques - ComCartaPorte.Mercancias.AutotransporteFederal.Remolques(i) = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteFederalRemolque - ComCartaPorte.Mercancias.AutotransporteFederal.Remolques(i).SubTipoRem = CType([Enum].Parse(GetType(ProfactCartaPorte.c_SubTipoRem), concep.SubTipoRemolque), ProfactCartaPorte.c_SubTipoRem) - ComCartaPorte.Mercancias.AutotransporteFederal.Remolques(i).Placa = concep.Placa + ComCartaPorte.Mercancias.Autotransporte.Remolques(i) = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteRemolque + ComCartaPorte.Mercancias.Autotransporte.Remolques(i).SubTipoRem = CType([Enum].Parse(GetType(ProfactCartaPorte.c_SubTipoRem), concep.SubTipoRemolque), ProfactCartaPorte.c_SubTipoRem) + ComCartaPorte.Mercancias.Autotransporte.Remolques(i).Placa = concep.Placa i += 1 Next ' @@ -3956,25 +4075,25 @@ Public Class Timbrado If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then Dim i As Integer = 0 - ComCartaPorte.FiguraTransporte.Operadores = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperador(Carta.FiguraTransporte.Operadores.Count - 1) {} + ComCartaPorte.FiguraTransporte = New ProfactCartaPorte.CartaPorteTiposFigura(Carta.FiguraTransporte.Operadores.Count - 1) {} For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores - ComCartaPorte.FiguraTransporte.Operadores(i) = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperador - ComCartaPorte.FiguraTransporte.Operadores(i).RFCOperador = concep.RFCFigura - ComCartaPorte.FiguraTransporte.Operadores(i).NumLicencia = concep.NumLicencia - ComCartaPorte.FiguraTransporte.Operadores(i).NombreOperador = concep.NombreFigura - ComCartaPorte.FiguraTransporte.Operadores(i).NumRegIdTribOperador = concep.NumRegidTribFigura + + ComCartaPorte.FiguraTransporte(i) = New ProfactCartaPorte.CartaPorteTiposFigura + ComCartaPorte.FiguraTransporte(i).RFCFigura = concep.RFCFigura + ComCartaPorte.FiguraTransporte(i).NumLicencia = concep.NumLicencia + ComCartaPorte.FiguraTransporte(i).NombreFigura = concep.NombreFigura + ComCartaPorte.FiguraTransporte(i).NumRegIdTribFigura = concep.NumRegidTribFigura 'OComCartaPorte.FiguraTransporte.Operadores(i)(0) = concep.ResidenciaFiscalOperador 'falta - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio = New ProfactCartaPorte.CartaPorteFiguraTransporteOperadoresOperadorDomicilio() - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Calle = concep.Domicilio.Calle - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.CodigoPostal = "25350" 'concep.Domicilio.CP - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Colonia = "0347" - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Estado = "COA" - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Localidad = "23" - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Municipio = "004" - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.NumeroExterior = "728" - ComCartaPorte.FiguraTransporte.Operadores(i).Domicilio.Pais = ProfactCartaPorte.c_Pais.MEX - + ComCartaPorte.FiguraTransporte(i).Domicilio = New ProfactCartaPorte.CartaPorteTiposFiguraDomicilio() + ComCartaPorte.FiguraTransporte(i).Domicilio.Calle = concep.Domicilio.Calle + ComCartaPorte.FiguraTransporte(i).Domicilio.CodigoPostal = concep.Domicilio.CP + ComCartaPorte.FiguraTransporte(i).Domicilio.Colonia = concep.Domicilio.Colonia + ComCartaPorte.FiguraTransporte(i).Domicilio.Estado = concep.Domicilio.Estado + ComCartaPorte.FiguraTransporte(i).Domicilio.Localidad = concep.Domicilio.Localidad + ComCartaPorte.FiguraTransporte(i).Domicilio.Municipio = concep.Domicilio.Municipio + ComCartaPorte.FiguraTransporte(i).Domicilio.NumeroExterior = concep.Domicilio.NumeroExterior + ComCartaPorte.FiguraTransporte(i).Domicilio.Pais = ProfactCartaPorte.c_Pais.MEX i += 1 Next diff --git a/App_WebReferences/Cancelacion2022/Cancelacion.disco b/App_WebReferences/Cancelacion2022/Cancelacion.disco new file mode 100644 index 000000000..4ddc38db6 --- /dev/null +++ b/App_WebReferences/Cancelacion2022/Cancelacion.disco @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App_WebReferences/Cancelacion2022/Cancelacion.wsdl b/App_WebReferences/Cancelacion2022/Cancelacion.wsdl new file mode 100644 index 000000000..b11d5443c --- /dev/null +++ b/App_WebReferences/Cancelacion2022/Cancelacion.wsdl @@ -0,0 +1,496 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cancela un Cfdi en pruebas + + + + + Obtiene el estatus de un Cfdi en producción + + + + + Obtiene el estatus de un Cfdi en pruebas + + + + + Obtiene los Uuid pendientes de aceptar/rechazar de un Receptor (Producción) + + + + + Obtiene los Uuid pendientes de aceptar/rechazar de un Receptor (Pruebas) + + + + + Acepta/Rechaza una solicitud pendiente de cancelación (Producción) + + + + + Acepta/Rechaza una solicitud pendiente de cancelación (Pruebas) + + + + + Obtiene el/los Cfdi(s) relacionado(s) de un UUID de un RFC (Pruebas) + + + + + Obtiene el/los Cfdi(s) relacionado(s) de un UUID de un RFC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/Cancelacion2022/Reference.svcmap b/App_WebReferences/Cancelacion2022/Reference.svcmap new file mode 100644 index 000000000..c8a95a14c --- /dev/null +++ b/App_WebReferences/Cancelacion2022/Reference.svcmap @@ -0,0 +1,31 @@ + + + + false + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/Cancelacion2022/configuration.svcinfo b/App_WebReferences/Cancelacion2022/configuration.svcinfo new file mode 100644 index 000000000..513fc18cd --- /dev/null +++ b/App_WebReferences/Cancelacion2022/configuration.svcinfo @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/Cancelacion2022/configuration91.svcinfo b/App_WebReferences/Cancelacion2022/configuration91.svcinfo new file mode 100644 index 000000000..b03c6a068 --- /dev/null +++ b/App_WebReferences/Cancelacion2022/configuration91.svcinfo @@ -0,0 +1,310 @@ + + + + + + + CancelacionSoap4 + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + Transport + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + CancelacionSoap5 + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + https://cancel.gofac.com.mx/Cancelacion.asmx + + + + + + basicHttpBinding + + + CancelacionSoap4 + + + Cancelacion2022.CancelacionSoap + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + CancelacionSoap2 + + + + + + + + + + + \ No newline at end of file diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 0a09a646e..b80072e76 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -1285,15 +1285,15 @@ Partial Class Bancos_IE End If - RecargaGlobalCuentasBancarias() - ObjIE.Dispose() - ObjIE2.Dispose() - UPPP.Update() - End Sub - Private Sub CargaGvRH() - GvRH.DataSource = DtGvRH - GvRH.DataBind() - UpGvRH.Update() + RecargaGlobalCuentasBancarias() + ObjIE.Dispose() + ObjIE2.Dispose() + UPPP.Update() + End Sub + Private Sub CargaGvRH() + GvRH.DataSource = DtGvRH + GvRH.DataBind() + UpGvRH.Update() End Sub Private Sub CargaCorteCaja(CveCuenta As Integer) 'Checar si hay un Turno Abierto @@ -1307,93 +1307,93 @@ Partial Class Bancos_IE ObjPVenta.Dispose() End Sub -#Region " CARGA PROVEEDOR " - Protected Sub DdlProveedores_selectedindexchange(sender As Object, e As EventArgs) - HdnCveProveedor.Value = DdlProveedores.SelectedValue - HdnCvePersonal.Value = "-1" - ViewState("CveProveedor") = HdnCveProveedor.Value.ToEntero - ViewState("CvePersonal") = "-1" - ViewState("CveCliente") = "-1" - - CargaProveedor(HdnCveProveedor.Value.ToEntero, "-1") - End Sub - - Private Sub CargaProveedor(ByVal CveProveedor As Integer, RFC As String) - Dim ObjProveedor As New ClsCompProveedores() - - If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - If ObjProveedor.DtResultados.Rows.Count > 0 Then - TxtNotificarA.Text = ObjProveedor.NotificarA.Trim - TxtParaMail.Text = ObjProveedor.CorreoCobranza - TxtCC.Text = ObjProveedor.NotificarA.Trim - RazonSocial = ObjProveedor.DtResultados(0)("RazonSocial").ToString - HdnProvPorIVA.Value = ObjProveedor.IVA.ToString - HdnProvPorRetIVA.Value = ObjProveedor.RetIVA.ToString - HdnProvPorRetISR.Value = ObjProveedor.RetISR.ToString - Dim EsDevolucion As Boolean = False - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" Then - CveIE = -1 - EsDevolucion = True - RBL.SelectedValue = "P" - RBL.Enabled = False - DdlProveedores.Visible = True - DdlProveedores.Enabled = True - - IDCtaBeneficiarioComplementaria = ObjProveedor.IdCtaContProveedoresComplementaria - - DdlProveedores.SelectedText = ObjProveedor.NombreComercial - DdlProveedores.SelectedValue = ObjProveedor.CveProveedor.ToString +#Region " CARGA PROVEEDOR " + Protected Sub DdlProveedores_selectedindexchange(sender As Object, e As EventArgs) + HdnCveProveedor.Value = DdlProveedores.SelectedValue + HdnCvePersonal.Value = "-1" + ViewState("CveProveedor") = HdnCveProveedor.Value.ToEntero + ViewState("CvePersonal") = "-1" + ViewState("CveCliente") = "-1" + + CargaProveedor(HdnCveProveedor.Value.ToEntero, "-1") + End Sub + + Private Sub CargaProveedor(ByVal CveProveedor As Integer, RFC As String) + Dim ObjProveedor As New ClsCompProveedores() + + If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, CveProveedor, "-1", "-1", "-1", "-1", RFC, "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + If ObjProveedor.DtResultados.Rows.Count > 0 Then + TxtNotificarA.Text = ObjProveedor.NotificarA.Trim + TxtParaMail.Text = ObjProveedor.CorreoCobranza + TxtCC.Text = ObjProveedor.NotificarA.Trim + RazonSocial = ObjProveedor.DtResultados(0)("RazonSocial").ToString + HdnProvPorIVA.Value = ObjProveedor.IVA.ToString + HdnProvPorRetIVA.Value = ObjProveedor.RetIVA.ToString + HdnProvPorRetISR.Value = ObjProveedor.RetISR.ToString + Dim EsDevolucion As Boolean = False + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinC" Then + CveIE = -1 + EsDevolucion = True + RBL.SelectedValue = "P" + RBL.Enabled = False + DdlProveedores.Visible = True + DdlProveedores.Enabled = True + + IDCtaBeneficiarioComplementaria = ObjProveedor.IdCtaContProveedoresComplementaria + + DdlProveedores.SelectedText = ObjProveedor.NombreComercial + DdlProveedores.SelectedValue = ObjProveedor.CveProveedor.ToString DivOtrosIngresosEgresos.Visible = True - End If - - Select Case RBL.SelectedValue - Case "P" + End If + + Select Case RBL.SelectedValue + Case "P" IDCtaBeneficiario = ObjProveedor.IdCtaContAnticipos - IdCtaAnticipoExtranjera = ObjProveedor.IdCtaContAnticiposExtranjera : IdCtaAnticipoComplementaria = ObjProveedor.IdCtaContAnticiposComplementaria - If EsDevolucion Then + IdCtaAnticipoExtranjera = ObjProveedor.IdCtaContAnticiposExtranjera : IdCtaAnticipoComplementaria = ObjProveedor.IdCtaContAnticiposComplementaria + If EsDevolucion Then IDCtaBeneficiario = ObjProveedor.IdCtaContProveedores - End If + End If Case "DD" : IDCtaBeneficiario = ObjProveedor.IdCtaContDeudor Case "AC" : IDCtaBeneficiario = ObjProveedor.IdCtaContAcreedor Case "DP" : IDCtaBeneficiario = ObjProveedor.IdCtaContDocsXPagar - Case Else - IDCtaBeneficiario = ObjProveedor.IdCtaContProveedores - End Select - - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then - - IDCtaBeneficiario = ObjProveedor.IdCtaContAcreedor - - If Not IDCtaBeneficiario > 0 Then - Alert("No se pudo cargar IDCtaBeneficiario", TipoMensaje.MsgAdvertencia) - End If - - End If - - - If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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 - Else - BtnGuardar.Enabled = True - End If - UpGuardar.Update() - End If - - CargaCuentasDepositos() - Else - Alert("El Proveedor solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) - End If - End If - ObjProveedor.Dispose() + Case Else + IDCtaBeneficiario = ObjProveedor.IdCtaContProveedores + End Select + + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then + + IDCtaBeneficiario = ObjProveedor.IdCtaContAcreedor + + If Not IDCtaBeneficiario > 0 Then + Alert("No se pudo cargar IDCtaBeneficiario", TipoMensaje.MsgAdvertencia) + End If + + End If + + + If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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 + Else + BtnGuardar.Enabled = True + End If + UpGuardar.Update() + End If + + CargaCuentasDepositos() + Else + Alert("El Proveedor solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) + End If + End If + ObjProveedor.Dispose() End Sub -#End Region +#End Region @@ -1467,136 +1467,136 @@ Partial Class Bancos_IE -#Region " CARGA CLIENTE " - Protected Sub DdlCliente_selectedindexchange(sender As Object, e As EventArgs) - HdnCveCliente.Value = DdlCliente.SelectedValue - HdnCveProveedor.Value = "-1" - ViewState("CveCliente") = HdnCveCliente.Value.ToEntero - ViewState("CveProveedor") = -1 - ViewState("CvePersonal") = -1 - CargaCliente(HdnCveCliente.Value.ToEntero) - End Sub - - Private Sub CargaCliente(ByVal CveCliente As Integer) - Dim ObjCliente As New ClsClientes - - If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - If ObjCliente.DtResultados.Rows.Count > 0 Then - - HdnProvPorIVA.Value = "0" 'ObjProveedor.IVA.ToString - HdnProvPorRetIVA.Value = "0" 'ObjProveedor.RetIVA.ToString - HdnProvPorRetISR.Value = "0" 'ObjProveedor.RetISR.ToString - IDCtaBeneficiario = ObjCliente.IdCtaContAnticipos - IDCtaBeneficiarioComplementaria = ObjCliente.IdCtaContCompAnticipos - CorreoCobranzaCliente = ObjCliente.CobranzaCorreo - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinV" Then - IDCtaBeneficiario = ObjCliente.IdCtaContClientes - IDCtaBeneficiarioComplementaria = ObjCliente.IdCtaContCompClientes - DdlCliente.SelectedText = ObjCliente.NombreComercial - DdlCliente.SelectedValue = ObjCliente.CveCliente.ToString - DivOtrosIngresosEgresos.Visible = True - End If - - If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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) +#Region " CARGA CLIENTE " + Protected Sub DdlCliente_selectedindexchange(sender As Object, e As EventArgs) + HdnCveCliente.Value = DdlCliente.SelectedValue + HdnCveProveedor.Value = "-1" + ViewState("CveCliente") = HdnCveCliente.Value.ToEntero + ViewState("CveProveedor") = -1 + ViewState("CvePersonal") = -1 + CargaCliente(HdnCveCliente.Value.ToEntero) + End Sub + + Private Sub CargaCliente(ByVal CveCliente As Integer) + Dim ObjCliente As New ClsClientes + + If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + + HdnProvPorIVA.Value = "0" 'ObjProveedor.IVA.ToString + HdnProvPorRetIVA.Value = "0" 'ObjProveedor.RetIVA.ToString + HdnProvPorRetISR.Value = "0" 'ObjProveedor.RetISR.ToString + IDCtaBeneficiario = ObjCliente.IdCtaContAnticipos + IDCtaBeneficiarioComplementaria = ObjCliente.IdCtaContCompAnticipos + CorreoCobranzaCliente = ObjCliente.CobranzaCorreo + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion") = "DevDinV" Then + IDCtaBeneficiario = ObjCliente.IdCtaContClientes + IDCtaBeneficiarioComplementaria = ObjCliente.IdCtaContCompClientes + DdlCliente.SelectedText = ObjCliente.NombreComercial + DdlCliente.SelectedValue = ObjCliente.CveCliente.ToString + DivOtrosIngresosEgresos.Visible = True + End If + + If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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 - Else - BtnGuardar.Enabled = True - End If - UpGuardar.Update() - End If - - CargaCuentasDepositos() - - Else - Alert("El Cliente solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) - End If - End If - ObjCliente.Dispose() - End Sub -#End Region + Else + BtnGuardar.Enabled = True + End If + UpGuardar.Update() + End If -#Region " CARGA PERSONAL " - Protected Sub CargaDDLPersonal() - Dim ObjPersonal As New ClsRH - If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then - If ObjPersonal.DtResultados.Rows.Count > 0 Then - DdlPersonal.DataSource = ObjPersonal.DtResultados - DdlPersonal.DataBind() - DdlPersonal.Items.Insert(0, New ListItem("Seleccione Personal", "-1")) - End If - End If - ObjPersonal.Dispose() - End Sub - - Protected Sub DdlPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) - HdnCveProveedor.Value = "-1" - HdnCvePersonal.Value = DdlPersonal.SelectedValue - - ViewState("CveProveedor") = "-1" - ViewState("CvePersonal") = HdnCvePersonal.Value - ViewState("CveCliente") = "-1" - - PersonalIndexChange(HdnCvePersonal.Value.ToEntero) - End Sub - - Private Sub PersonalIndexChange(ByVal CvePersonal As Integer) - Dim ObjPersonal As New ClsRH - - If ObjPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) Then - If ObjPersonal.DtResultados.Rows.Count > 0 Then - DdlPersonal.SelectedValue = CvePersonal.ToString - - HdnProvPorIVA.Value = "0" 'ObjProveedor.IVA.ToString - HdnProvPorRetIVA.Value = "0" 'ObjProveedor.RetIVA.ToString - HdnProvPorRetISR.Value = "0" 'ObjProveedor.RetISR.ToString - IDCtaBeneficiario = ObjPersonal.IdCtaContPersonal - - If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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 - Else - BtnGuardar.Enabled = True - End If - UpGuardar.Update() - End If - - CargaCuentasDepositos() - Else - Alert("El Personal solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) - End If - End If - ObjPersonal.Dispose() + CargaCuentasDepositos() + + Else + Alert("El Cliente solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) + End If + End If + ObjCliente.Dispose() End Sub -#End Region +#End Region + +#Region " CARGA PERSONAL " + Protected Sub CargaDDLPersonal() + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa) Then + If ObjPersonal.DtResultados.Rows.Count > 0 Then + DdlPersonal.DataSource = ObjPersonal.DtResultados + DdlPersonal.DataBind() + DdlPersonal.Items.Insert(0, New ListItem("Seleccione Personal", "-1")) + End If + End If + ObjPersonal.Dispose() + End Sub + + Protected Sub DdlPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) + HdnCveProveedor.Value = "-1" + HdnCvePersonal.Value = DdlPersonal.SelectedValue + + ViewState("CveProveedor") = "-1" + ViewState("CvePersonal") = HdnCvePersonal.Value + ViewState("CveCliente") = "-1" + + PersonalIndexChange(HdnCvePersonal.Value.ToEntero) + End Sub + + Private Sub PersonalIndexChange(ByVal CvePersonal As Integer) + Dim ObjPersonal As New ClsRH + + If ObjPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) Then + If ObjPersonal.DtResultados.Rows.Count > 0 Then + DdlPersonal.SelectedValue = CvePersonal.ToString + + HdnProvPorIVA.Value = "0" 'ObjProveedor.IVA.ToString + HdnProvPorRetIVA.Value = "0" 'ObjProveedor.RetIVA.ToString + HdnProvPorRetISR.Value = "0" 'ObjProveedor.RetISR.ToString + IDCtaBeneficiario = ObjPersonal.IdCtaContPersonal + + If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" 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 + Else + BtnGuardar.Enabled = True + End If + UpGuardar.Update() + End If + + CargaCuentasDepositos() + Else + Alert("El Personal solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) + End If + End If + ObjPersonal.Dispose() + 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 + 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 + + Select Case valor + Case 1 + LblPagueseA.Text = "Páguese a" + Case 2 + LblPagueseA.Text = "Beneficiario" + End Select + + 'RecargaCuentas + CargaCuenta(CveMoneda) + RecargaCuentasDepositos() + + UpDatos.Update() + BtnGuardar.Enabled = True + End Sub -#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 - 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 - - Select Case valor - Case 1 - LblPagueseA.Text = "Páguese a" - Case 2 - LblPagueseA.Text = "Beneficiario" - End Select - - 'RecargaCuentas - CargaCuenta(CveMoneda) - RecargaCuentasDepositos() - - UpDatos.Update() - BtnGuardar.Enabled = True - End Sub - Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged 'si solo es de egreso el movimiento debe de generar el siguiente folio. @@ -1605,14 +1605,14 @@ Partial Class Bancos_IE If (Not ExistenComplementosVigentes) And UsuarioActual.TienePermisoProceso(99) And BtnActualizar.Visible = True Then ActualizaCuenta = True - End If - - If HdnTipoTransaccion.Value = "Egs" AndAlso UsuarioActual.Empresa.Funcionalidad(505) <> "1" Or Opcion = "DevDinC" Or ActualizaCuenta Then - - Dim Folio As Long - Dim Banco As New ClsBancos - Folio = Banco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero) - Banco.Dispose() + End If + + If HdnTipoTransaccion.Value = "Egs" AndAlso UsuarioActual.Empresa.Funcionalidad(505) <> "1" Or Opcion = "DevDinC" Or ActualizaCuenta Then + + Dim Folio As Long + Dim Banco As New ClsBancos + Folio = Banco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero) + Banco.Dispose() TxtFolio.Text = Folio.ToString Dim drI As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue)) @@ -1624,392 +1624,392 @@ Partial Class Bancos_IE End If - Else - TxtFolio.Text = "" - End If - - Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue)) - If dr IsNot Nothing Then - - - DdlMoneda.SelectedValue = dr("CveMoneda").ToString - IDCtaContable = dr("IdCtaContable").ToString.ToEntero + Else + TxtFolio.Text = "" + End If + + Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuenta.SelectedValue)) + If dr IsNot Nothing Then + + + DdlMoneda.SelectedValue = dr("CveMoneda").ToString + IDCtaContable = dr("IdCtaContable").ToString.ToEntero IDCtaContableComplementaria = dr("IDCtaContableComplementaria").ToString.ToEntero - CambiaTipoMoneda() - - If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") Then - If dr("CveTipoCuenta").ToString.ToEntero = 1 Then - Dim ObjMovtos As New ClsMovimientos - If DdlCuenta.SelectedValue.ToEntero > 0 Then - ObjMovtos.GetCajaChicaDetalle(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) - - If ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha").Rows.Count > 0 Then - DDlCheques.DataSource = ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha") - DDlCheques.DataBind() - DDlCheques.Items.Insert(0, New ListItem("-", "-1")) - DivCheques.Visible = True - End If - End If - ObjMovtos.Dispose() - Else - DivCheques.Visible = False - End If - + CambiaTipoMoneda() + + If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") Then + If dr("CveTipoCuenta").ToString.ToEntero = 1 Then + Dim ObjMovtos As New ClsMovimientos + If DdlCuenta.SelectedValue.ToEntero > 0 Then + ObjMovtos.GetCajaChicaDetalle(DdlCuenta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) + + If ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha").Rows.Count > 0 Then + DDlCheques.DataSource = ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha") + DDlCheques.DataBind() + DDlCheques.Items.Insert(0, New ListItem("-", "-1")) + DivCheques.Visible = True + End If + End If + ObjMovtos.Dispose() + Else + DivCheques.Visible = False + End If + End If 'PAGAR NC CON C.CH DEBE DESCONTAR EN EL CORTE If Opcion IsNot Nothing AndAlso Opcion = "DevDinV" AndAlso dr("CveTipoCuenta").ToString.ToEntero = 1 Then CargaCorteCaja(DdlCuenta.SelectedValue.ToEntero) - End If - - If dr("UsaTarjeta").ToString = "True" Then - CargaGridTarjetas() - Else - DivTarjeta.Visible = False - End If - - 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 - - End If - - If trIEDevolucion.Visible And RBL.SelectedValue <> "C" Then - CargaIEDevoluciones() - End If + End If + + If dr("UsaTarjeta").ToString = "True" Then + CargaGridTarjetas() + Else + DivTarjeta.Visible = False + End If + + 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 + + End If + + If trIEDevolucion.Visible And RBL.SelectedValue <> "C" Then + CargaIEDevoluciones() + End If End Sub -#End Region +#End Region + +#Region " CARGA CREDITOS - DETALLE " + Protected Sub DdlFinanciera_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFinanciera.SelectedIndexChanged + CargaCreditos(DdlFinanciera.SelectedValue.ToEntero) -#Region " CARGA CREDITOS - DETALLE " - Protected Sub DdlFinanciera_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFinanciera.SelectedIndexChanged - CargaCreditos(DdlFinanciera.SelectedValue.ToEntero) - - End Sub - - Private Sub CargaCreditos(CveProveedor As Integer) - If CveProveedor < 1 Then Exit Sub - - Dim Cred As New ClsBancos - Dim dt As DataTable = Nothing - - If Cred.GetCreditos(-1, -1, -1, CveProveedor, -1, UsuarioActual.CveEmpresa) Then - CveProveedor = Cred.CveProveedor - DdlCredito.DataSource = Cred.DtResultados.FiltraParametros(String.Format("CveProveedor = {0} AND EstatusNum in (1,2,101,102)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito") - DdlCredito.DataBind() - DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1")) - - - End If - - Cred.Dispose() - - DdlCreditoDetalle.Items.Clear() - DdlCreditoDetalle.DataSource = Nothing - DdlCreditoDetalle.DataBind() - - - - End Sub - - Protected Sub DdlCredito_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCredito.SelectedIndexChanged - CargaCreditosDetalle() - End Sub - - Protected Sub DdlCreditoDetalle_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaCreditosDetalle(DdlCreditoDetalle.SelectedValue.ToEntero) - End Sub - - Private Sub CargaCreditosDetalle(Optional CveCreditoDetalle As Integer = -1) - Dim Cred As New ClsBancos - Dim dt As DataTable = Nothing - Dim dt2 As DataTable = Nothing - - If DdlCredito.SelectedValue.ToEntero > 0 AndAlso Cred.GetCreditos(DdlCredito.SelectedValue.ToEntero, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - CveProveedor = Cred.CveProveedor - HdnCveTipoCredito.Value = Cred.CveTipoCredito.ToString - - If Cred.GetCreditosDetalle(DdlCredito.SelectedValue.ToEntero, -1) Then - dt = Cred.DtResultados.FiltraParametros("Estatus IN (1,101,102)") - - Dim Importe As Decimal = 0 - If CveCreditoDetalle > 0 Then - Dim drt As DataRow = Cred.DtResultados.FiltroPrimero(String.Format("CveCreditoDetalle = {0}", CveCreditoDetalle)) - If drt IsNot Nothing Then - 'verifico si es credito está activo - If Not drt("Estatus").ToString.Contiene("1", "101", "102") Then - Alert("La Mensualidad no está vigente para pago", TipoMensaje.MsgError) - End If - Importe = dt.FiltroPrimeroValor("Mensualidad", String.Format("CveCreditoDetalle = {0}", CveCreditoDetalle)).ToDecimal - End If - - - End If - - - TxtImporte.Text = Importe.ToString - HdnImporteCredito.Value = Importe.ToString - RegistraScript(String.Format("$get('TxtImporte').value = '{0}';", Importe.FormatoNumero)) - TxtImporte.Attributes.Remove("onkeyup") - TxtImporte.Attributes.Add("onkeyup", String.Format("ValidaCantidad({0},{1});", TxtImporte.ClientID, Importe)) - - End If - - End If - - Cred.Dispose() - - DdlCreditoDetalle.Items.Clear() - - If dt IsNot Nothing Then - DdlCreditoDetalle.DataSource = dt - End If - DdlCreditoDetalle.DataBind() - - If CveCreditoDetalle = -1 Then - DdlCreditoDetalle.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlCreditoDetalle.SelectedValue = "-1" - Else - DdlCreditoDetalle.SelectedValueExist(CveCreditoDetalle.ToString) - Try - TxtObservaciones.Text = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) - Catch ex As Exception - - End Try - - End If - - - UpDatos.Update() End Sub -#End Region -#End Region -#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE" + Private Sub CargaCreditos(CveProveedor As Integer) + If CveProveedor < 1 Then Exit Sub + + Dim Cred As New ClsBancos + Dim dt As DataTable = Nothing + + If Cred.GetCreditos(-1, -1, -1, CveProveedor, -1, UsuarioActual.CveEmpresa) Then + CveProveedor = Cred.CveProveedor + DdlCredito.DataSource = Cred.DtResultados.FiltraParametros(String.Format("CveProveedor = {0} AND EstatusNum in (1,2,101,102)", DdlFinanciera.SelectedValue), DistinctColumns:={"CveCredito", "ReferenciaCredito"}, Orderby:="ReferenciaCredito") + DdlCredito.DataBind() + DdlCredito.Items.Insert(0, New ListItem("Seleccione", "-1")) + + + End If + + Cred.Dispose() + + DdlCreditoDetalle.Items.Clear() + DdlCreditoDetalle.DataSource = Nothing + DdlCreditoDetalle.DataBind() + + - Private Sub CargaCuenta(Optional pCveMoneda As Integer = -1) - DdlCuenta.Items.Clear() - Dim dt As DataTable - - If UsuarioActual.Empresa.Funcionalidad(127) = "1" Then - dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) - Else - dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas - End If - - - If pCveMoneda > 0 Then - dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", pCveMoneda)) - End If - - 'cuando es layout - If DdlTipoTransaccion.SelectedValue.ToEntero = 9 Then - dt = dt.FiltraParametros("UsaLayout = 1") - End If - - DdlCuenta.DataSource = dt - DdlCuenta.DataBind() - DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub - - Private Sub CargaTipoTransaccion() - Dim dt As DataTable - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSSINFACT", "EGSCREDITO") Then - dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") - LtlTitulo.Text = "Egreso Por Comprobar" - - RBL.Items.Remove(RBL.Items.FindByValue("C")) - ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then - dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") - LtlTitulo.Text = If(Request("Opcion").ToString = "INGPC", "Ingreso por comprobar", "Devolución") - LblPagueseA.Text = "Recibido de:" - RBL.SelectedValue = "C" - Anexo.Visible = True - ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then - dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") - LtlTitulo.Text = If(Request("Opcion").ToString = "INGPC", "Ingreso por comprobar", "Devolución") - LblPagueseA.Text = "Recibido de:" - RBL.SelectedValue = "C" - Anexo.Visible = True - - RBL.Items.Remove(RBL.Items.FindByValue("P")) - RBL.Items.Remove(RBL.Items.FindByValue("FE")) - - ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then - dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") - LtlTitulo.Text = "Anticipo de Cliente" - LblPagueseA.Text = "Recibido de:" - Anexo.Visible = True - RBL.Items.Remove(RBL.Items.FindByValue("P")) : RBL.Items.Remove(RBL.Items.FindByValue("FE")) : RBL.Items.Remove(RBL.Items.FindByValue("DD")) : RBL.Items.Remove(RBL.Items.FindByValue("AC")) : RBL.Items.Remove(RBL.Items.FindByValue("DP")) - ElseIf Opcion = "DevDinV" Then ' DEVOLUCION DINERO NC-VENTAS - dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") - LtlTitulo.Text = "Devolución dinero" - RBL.SelectedValue = "C" - RBL.Enabled = False - Else - dt = GlobalDTTipoTransacciones - End If - - - - If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Or Opcion = "DevDinC" AndAlso Masivonotas Then - DdlTipoTransaccion.DataSource = dt.FiltraParametros("Tipo = 'Ing' ") - Else - DdlTipoTransaccion.DataSource = dt - End If - - - DdlTipoTransaccion.DataBind() - DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) - RBL_SelectedIndexChanged(RBL, Nothing) - - End Sub - - Private Sub CargaMoneda() - DdlMoneda.DataSource = GlobalDTMonedas - DdlMoneda.DataBind() End Sub -#End Region -#Region "VIATICOS" + Protected Sub DdlCredito_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCredito.SelectedIndexChanged + CargaCreditosDetalle() + End Sub - Private Function TimbrarNomina12(CvePersonal As Integer) As String - - Dim Retorno As String = "" - UsuarioActual.Empresa.CvePAC = 2 - Dim sw As New Diagnostics.Stopwatch - sw.Start() - Select Case UsuarioActual.Empresa.CvePAC - Case 1 - 'Retorno = TimbrarBIInformNomina12(CveNomina, CvePersonal, CvePeriodo) - Case 2, 4 - Dim cfdi As CFDITimbre = PreTimbrar(CvePersonal) - If cfdi Is Nothing Then - sw.Stop() - Return "No tiene asignado un folio de viaticos" - End If - If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then - Dim ObjTimbrado As New Timbrado - Dim ObjFactura As New Modelos.Factura - ObjFactura.TipoDocto = "Viaticos" - ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero - ObjFactura.Serie = cfdi.Comprobante.Serie - ObjFactura.Timbre = cfdi - If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then - Retorno = ObjTimbrado.MensajeErrorCFDI - End If - - 'Retorno = TimbrarFacturaRealVirtual(cfdi, UsuarioActual) - If Retorno <> "" Then - Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}" - Else - 'Genero la addenda Ford - ' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo) - End If - Else - Retorno = $"No se pudo generar el pretimbre:
{cfdi.Mensaje}" - End If - End Select - sw.Stop() - GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC, "Nomina") - - Return Retorno - - End Function - - - - - Private Function PreTimbrar(CvePersonal As Integer) As CFDITimbre - Dim cfdi As New CFDITimbre - 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 - Else - ObjFolio.Dispose() - Return Nothing - End If - End If - ObjFolio.Dispose() - - Dim objPersonal As New ClsRH - objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) - - Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero - - cfdi.Nomina = New CFDINomina - cfdi.Nomina.Version = "1.2" - cfdi.Nomina.TipoNomina = "E" - cfdi.Nomina.FechaPago = TxtFechaDocumento.Text.ToDate - cfdi.Nomina.FechaInicio = TxtFechaDocumento.Text - cfdi.Nomina.FechaFin = TxtFechaDocumento.Text - cfdi.Nomina.NumDiasPagados = 1 - cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa - cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC - cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal - cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal - - 'aplica persona fisica debe de tener CURP - If cfdi.Emisor.RegimenFiscal.Contiene("605", "606", "608", "611", "612", "614", "616", "621", "622", "629", "630", "615") Then - cfdi.Emisor.CURP = UsuarioActual.Empresa.CURP - End If - - - cfdi.Receptor.UsoCFDI = "P01" - cfdi.Receptor.RFC = objPersonal.RFC - cfdi.Receptor.Nombre = objPersonal.NombreCompleto - - Dim ObjOtrosPagos As New List(Of CFDINominaOtrosPagos) - ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "003", - .Clave = "003", - .Concepto = "Viáticos (entregados al trabajador).", - .Importe = TxtImporte.Text.ToString.ToDecimal - } - ) - If ObjOtrosPagos IsNot Nothing AndAlso ObjOtrosPagos.Count > 0 Then cfdi.Nomina.OtrosPagos = ObjOtrosPagos - - cfdi.Comprobante.Version = "3.3" - cfdi.Comprobante.Serie = "VIA" - cfdi.Comprobante.Folio = Folio - cfdi.Comprobante.Fecha = Now - cfdi.Comprobante.Subtotal = TxtImporte.Text.ToDecimal - cfdi.Comprobante.Descuentos = 0 - cfdi.Comprobante.Total = TxtImporte.Text.ToDecimal - cfdi.Comprobante.MotivoDescuento = "" - cfdi.Comprobante.Moneda = "MXN" - cfdi.Comprobante.TipoComprobante = "N" - cfdi.Comprobante.TipoDocto = "Egs" - cfdi.Comprobante.MetodoPago = "PUE" - cfdi.Comprobante.CondicionesdePago = "" - cfdi.Comprobante.FormadePago = "99" - cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString - cfdi.Comprobante.NumCuentaPago = "" - - - cfdi.Nomina.Receptor.CURP = objPersonal.CURP - cfdi.Nomina.Receptor.NSS = objPersonal.NumeroSS - cfdi.Nomina.Receptor.FechaInicioContrato = objPersonal.FechaInicioContrato.ToShortDateString - cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W" - cfdi.Nomina.Receptor.TipoContrato = objPersonal.CodigoTipoContrato - cfdi.Nomina.Receptor.CodigoTipoJornada = objPersonal.ClaveTipoJornada - cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(objPersonal.CveRegimenContratacion = "", "99", objPersonal.CveRegimenContratacion) - cfdi.Nomina.Receptor.CodigoEmpleado = objPersonal.Codigo - cfdi.Nomina.Receptor.Departamento = objPersonal.Departamento - cfdi.Nomina.Receptor.Puesto = objPersonal.Puesto - cfdi.Nomina.Receptor.CodigoRiesgoPuesto = If(objPersonal.CveSATRiesgoPuesto.ToString = "0", "99", objPersonal.CveSATRiesgoPuesto.ToString) - cfdi.Nomina.Receptor.TipoPeriodo = objPersonal.TipoPeriodoPago - cfdi.Nomina.Receptor.CodigoBanco = objPersonal.ClaveBanco - cfdi.Nomina.Receptor.NumeroCuenta = objPersonal.BancoNumCuenta - cfdi.Nomina.Receptor.SDI = objPersonal.SDI - cfdi.Nomina.Receptor.SBC = objPersonal.SDI - cfdi.Nomina.Receptor.Sindicalizado = "" - cfdi.Nomina.Receptor.CodigoEntidadFederativa = objPersonal.ClaveEstado - - - cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Comprobante.Subtotal, .Importe = cfdi.Comprobante.Subtotal, .Descuento = cfdi.Nomina.TotalDeducciones.ToDecimal}) - - objPersonal.Dispose() - Return cfdi + Protected Sub DdlCreditoDetalle_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaCreditosDetalle(DdlCreditoDetalle.SelectedValue.ToEntero) + End Sub + + Private Sub CargaCreditosDetalle(Optional CveCreditoDetalle As Integer = -1) + Dim Cred As New ClsBancos + Dim dt As DataTable = Nothing + Dim dt2 As DataTable = Nothing + + If DdlCredito.SelectedValue.ToEntero > 0 AndAlso Cred.GetCreditos(DdlCredito.SelectedValue.ToEntero, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + CveProveedor = Cred.CveProveedor + HdnCveTipoCredito.Value = Cred.CveTipoCredito.ToString + + If Cred.GetCreditosDetalle(DdlCredito.SelectedValue.ToEntero, -1) Then + dt = Cred.DtResultados.FiltraParametros("Estatus IN (1,101,102)") + + Dim Importe As Decimal = 0 + If CveCreditoDetalle > 0 Then + Dim drt As DataRow = Cred.DtResultados.FiltroPrimero(String.Format("CveCreditoDetalle = {0}", CveCreditoDetalle)) + If drt IsNot Nothing Then + 'verifico si es credito está activo + If Not drt("Estatus").ToString.Contiene("1", "101", "102") Then + Alert("La Mensualidad no está vigente para pago", TipoMensaje.MsgError) + End If + Importe = dt.FiltroPrimeroValor("Mensualidad", String.Format("CveCreditoDetalle = {0}", CveCreditoDetalle)).ToDecimal + End If + + + End If + + + TxtImporte.Text = Importe.ToString + HdnImporteCredito.Value = Importe.ToString + RegistraScript(String.Format("$get('TxtImporte').value = '{0}';", Importe.FormatoNumero)) + TxtImporte.Attributes.Remove("onkeyup") + TxtImporte.Attributes.Add("onkeyup", String.Format("ValidaCantidad({0},{1});", TxtImporte.ClientID, Importe)) + + End If + + End If + + Cred.Dispose() + + DdlCreditoDetalle.Items.Clear() + + If dt IsNot Nothing Then + DdlCreditoDetalle.DataSource = dt + End If + DdlCreditoDetalle.DataBind() + + If CveCreditoDetalle = -1 Then + DdlCreditoDetalle.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlCreditoDetalle.SelectedValue = "-1" + Else + DdlCreditoDetalle.SelectedValueExist(CveCreditoDetalle.ToString) + Try + TxtObservaciones.Text = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) + Catch ex As Exception + + End Try + + End If + + + UpDatos.Update() + 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 + + If UsuarioActual.Empresa.Funcionalidad(127) = "1" Then + dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) + Else + dt = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas + End If + + + If pCveMoneda > 0 Then + dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", pCveMoneda)) + End If + + 'cuando es layout + If DdlTipoTransaccion.SelectedValue.ToEntero = 9 Then + dt = dt.FiltraParametros("UsaLayout = 1") + End If + + DdlCuenta.DataSource = dt + DdlCuenta.DataBind() + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + + Private Sub CargaTipoTransaccion() + Dim dt As DataTable + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSSINFACT", "EGSCREDITO") Then + dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") + LtlTitulo.Text = "Egreso Por Comprobar" + + RBL.Items.Remove(RBL.Items.FindByValue("C")) + ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then + dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + LtlTitulo.Text = If(Request("Opcion").ToString = "INGPC", "Ingreso por comprobar", "Devolución") + LblPagueseA.Text = "Recibido de:" + RBL.SelectedValue = "C" + Anexo.Visible = True + ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then + dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + LtlTitulo.Text = If(Request("Opcion").ToString = "INGPC", "Ingreso por comprobar", "Devolución") + LblPagueseA.Text = "Recibido de:" + RBL.SelectedValue = "C" + Anexo.Visible = True + + RBL.Items.Remove(RBL.Items.FindByValue("P")) + RBL.Items.Remove(RBL.Items.FindByValue("FE")) + + ElseIf Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then + dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + LtlTitulo.Text = "Anticipo de Cliente" + LblPagueseA.Text = "Recibido de:" + Anexo.Visible = True + RBL.Items.Remove(RBL.Items.FindByValue("P")) : RBL.Items.Remove(RBL.Items.FindByValue("FE")) : RBL.Items.Remove(RBL.Items.FindByValue("DD")) : RBL.Items.Remove(RBL.Items.FindByValue("AC")) : RBL.Items.Remove(RBL.Items.FindByValue("DP")) + ElseIf Opcion = "DevDinV" Then ' DEVOLUCION DINERO NC-VENTAS + dt = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs'") + LtlTitulo.Text = "Devolución dinero" + RBL.SelectedValue = "C" + RBL.Enabled = False + Else + dt = GlobalDTTipoTransacciones + End If + + + + If Opcion = "DevDinC" AndAlso Request("P") IsNot Nothing AndAlso Request("P").Length > 0 Or Opcion = "DevDinC" AndAlso Masivonotas Then + DdlTipoTransaccion.DataSource = dt.FiltraParametros("Tipo = 'Ing' ") + Else + DdlTipoTransaccion.DataSource = dt + End If + + + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + RBL_SelectedIndexChanged(RBL, Nothing) + + End Sub + + Private Sub CargaMoneda() + DdlMoneda.DataSource = GlobalDTMonedas + DdlMoneda.DataBind() + End Sub +#End Region + +#Region "VIATICOS" + + Private Function TimbrarNomina12(CvePersonal As Integer) As String + + Dim Retorno As String = "" + UsuarioActual.Empresa.CvePAC = 2 + Dim sw As New Diagnostics.Stopwatch + sw.Start() + Select Case UsuarioActual.Empresa.CvePAC + Case 1 + 'Retorno = TimbrarBIInformNomina12(CveNomina, CvePersonal, CvePeriodo) + Case 2, 4 + Dim cfdi As CFDITimbre = PreTimbrar(CvePersonal) + If cfdi Is Nothing Then + sw.Stop() + Return "No tiene asignado un folio de viaticos" + End If + If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then + Dim ObjTimbrado As New Timbrado + Dim ObjFactura As New Modelos.Factura + ObjFactura.TipoDocto = "Viaticos" + ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero + ObjFactura.Serie = cfdi.Comprobante.Serie + ObjFactura.Timbre = cfdi + If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then + Retorno = ObjTimbrado.MensajeErrorCFDI + End If + + 'Retorno = TimbrarFacturaRealVirtual(cfdi, UsuarioActual) + If Retorno <> "" Then + Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}" + Else + 'Genero la addenda Ford + ' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo) + End If + Else + Retorno = $"No se pudo generar el pretimbre:
{cfdi.Mensaje}" + End If + End Select + sw.Stop() + GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC, "Nomina") + + Return Retorno + + End Function + + + + + Private Function PreTimbrar(CvePersonal As Integer) As CFDITimbre + Dim cfdi As New CFDITimbre + 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 + Else + ObjFolio.Dispose() + Return Nothing + End If + End If + ObjFolio.Dispose() + + Dim objPersonal As New ClsRH + objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) + + Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero + + cfdi.Nomina = New CFDINomina + cfdi.Nomina.Version = "1.2" + cfdi.Nomina.TipoNomina = "E" + cfdi.Nomina.FechaPago = TxtFechaDocumento.Text.ToDate + cfdi.Nomina.FechaInicio = TxtFechaDocumento.Text + cfdi.Nomina.FechaFin = TxtFechaDocumento.Text + cfdi.Nomina.NumDiasPagados = 1 + cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa + cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC + cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal + cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal + + 'aplica persona fisica debe de tener CURP + If cfdi.Emisor.RegimenFiscal.Contiene("605", "606", "608", "611", "612", "614", "616", "621", "622", "629", "630", "615") Then + cfdi.Emisor.CURP = UsuarioActual.Empresa.CURP + End If + + + cfdi.Receptor.UsoCFDI = "P01" + cfdi.Receptor.RFC = objPersonal.RFC + cfdi.Receptor.Nombre = objPersonal.NombreCompleto + + Dim ObjOtrosPagos As New List(Of CFDINominaOtrosPagos) + ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "003", + .Clave = "003", + .Concepto = "Viáticos (entregados al trabajador).", + .Importe = TxtImporte.Text.ToString.ToDecimal + } + ) + If ObjOtrosPagos IsNot Nothing AndAlso ObjOtrosPagos.Count > 0 Then cfdi.Nomina.OtrosPagos = ObjOtrosPagos + + cfdi.Comprobante.Version = "3.3" + cfdi.Comprobante.Serie = "VIA" + cfdi.Comprobante.Folio = Folio + cfdi.Comprobante.Fecha = Now + cfdi.Comprobante.Subtotal = TxtImporte.Text.ToDecimal + cfdi.Comprobante.Descuentos = 0 + cfdi.Comprobante.Total = TxtImporte.Text.ToDecimal + cfdi.Comprobante.MotivoDescuento = "" + cfdi.Comprobante.Moneda = "MXN" + cfdi.Comprobante.TipoComprobante = "N" + cfdi.Comprobante.TipoDocto = "Egs" + cfdi.Comprobante.MetodoPago = "PUE" + cfdi.Comprobante.CondicionesdePago = "" + cfdi.Comprobante.FormadePago = "99" + cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString + cfdi.Comprobante.NumCuentaPago = "" + + + cfdi.Nomina.Receptor.CURP = objPersonal.CURP + cfdi.Nomina.Receptor.NSS = objPersonal.NumeroSS + cfdi.Nomina.Receptor.FechaInicioContrato = objPersonal.FechaInicioContrato.ToShortDateString + cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W" + cfdi.Nomina.Receptor.TipoContrato = objPersonal.CodigoTipoContrato + cfdi.Nomina.Receptor.CodigoTipoJornada = objPersonal.ClaveTipoJornada + cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(objPersonal.CveRegimenContratacion = "", "99", objPersonal.CveRegimenContratacion) + cfdi.Nomina.Receptor.CodigoEmpleado = objPersonal.Codigo + cfdi.Nomina.Receptor.Departamento = objPersonal.Departamento + cfdi.Nomina.Receptor.Puesto = objPersonal.Puesto + cfdi.Nomina.Receptor.CodigoRiesgoPuesto = If(objPersonal.CveSATRiesgoPuesto.ToString = "0", "99", objPersonal.CveSATRiesgoPuesto.ToString) + cfdi.Nomina.Receptor.TipoPeriodo = objPersonal.TipoPeriodoPago + cfdi.Nomina.Receptor.CodigoBanco = objPersonal.ClaveBanco + cfdi.Nomina.Receptor.NumeroCuenta = objPersonal.BancoNumCuenta + cfdi.Nomina.Receptor.SDI = objPersonal.SDI + cfdi.Nomina.Receptor.SBC = objPersonal.SDI + cfdi.Nomina.Receptor.Sindicalizado = "" + cfdi.Nomina.Receptor.CodigoEntidadFederativa = objPersonal.ClaveEstado + + + cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Comprobante.Subtotal, .Importe = cfdi.Comprobante.Subtotal, .Descuento = cfdi.Nomina.TotalDeducciones.ToDecimal}) + + objPersonal.Dispose() + Return cfdi End Function 'Private Function TimbrarBIInformNomina12(CveNomina As Integer, CvePersonal As Integer, CvePeriodo As Integer) As String @@ -2448,49 +2448,49 @@ Partial Class Bancos_IE 'End Function -#End Region +#End Region -#Region " GUARDAR - ACTUALIZAR " - Private Function ValidaGuardar() As Boolean - Dim EsValido = True - Dim PagueseA = "" - If HdnCveCliente.Value.ToEntero > 0 Then - PagueseA = DdlCliente.SelectedText.ToString() - ElseIf HdnCveProveedor.Value.ToEntero > 0 Then - PagueseA = DdlProveedores.SelectedText.ToString() - ElseIf HdnCvePersonal.Value.ToEntero > 0 Then - PagueseA = DdlPersonal.SelectedItem.ToString - End If - - If DdlEstatusIE.SelectedValue = "2" AndAlso TxtImporte.Text.ToDouble > 0 Then - Alert("Un movimiento Cancelado debe tener importe = 0", TipoMensaje.MsgAdvertencia) - EsValido = False - End If - - If DdlEstatusIE.SelectedValue <> "2" AndAlso TxtImporte.Text.ToDouble <= 0 Then - Alert("Debe ingresar un importe", TipoMensaje.MsgAdvertencia) - EsValido = False - End If - - 'cuando sea activo es requerido proveedor o personal - If DdlEstatusIE.SelectedValue = "1" AndAlso (CveProveedor <= 0 And CvePersonal <= 0) AndAlso HdnTipoTransaccion.Value = "Egs" And RBL.SelectedValue <> "C" Then - Alert("Debe de seleccionar un Proveedor o un Funcionario Empleado", TipoMensaje.MsgAdvertencia) - EsValido = False - End If - - If DdlEstatusIE.SelectedValue = "1" AndAlso PagueseA = "" AndAlso Not Opcion = "EGSCREDITO" Then - Alert("Ingrese Beneficiario", TipoMensaje.MsgAdvertencia) - EsValido = False - End If - - Dim Dep As New ClsGenerales - If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor) Then - Dim Row = Dep.DtResultados.FiltroPrimero(String.Format("CveCuentaDeposito = {0}", DdlCuentaDeposito.SelectedValue.ToEntero)) - If Row IsNot Nothing AndAlso Row("Estatus").ToString = "False" Then - Alert("La cuenta depósito del proveedor esta inactiva.", TipoMensaje.MsgAdvertencia) - EsValido = False - End If - End If +#Region " GUARDAR - ACTUALIZAR " + Private Function ValidaGuardar() As Boolean + Dim EsValido = True + Dim PagueseA = "" + If HdnCveCliente.Value.ToEntero > 0 Then + PagueseA = DdlCliente.SelectedText.ToString() + ElseIf HdnCveProveedor.Value.ToEntero > 0 Then + PagueseA = DdlProveedores.SelectedText.ToString() + ElseIf HdnCvePersonal.Value.ToEntero > 0 Then + PagueseA = DdlPersonal.SelectedItem.ToString + End If + + If DdlEstatusIE.SelectedValue = "2" AndAlso TxtImporte.Text.ToDouble > 0 Then + Alert("Un movimiento Cancelado debe tener importe = 0", TipoMensaje.MsgAdvertencia) + EsValido = False + End If + + If DdlEstatusIE.SelectedValue <> "2" AndAlso TxtImporte.Text.ToDouble <= 0 Then + Alert("Debe ingresar un importe", TipoMensaje.MsgAdvertencia) + EsValido = False + End If + + 'cuando sea activo es requerido proveedor o personal + If DdlEstatusIE.SelectedValue = "1" AndAlso (CveProveedor <= 0 And CvePersonal <= 0) AndAlso HdnTipoTransaccion.Value = "Egs" And RBL.SelectedValue <> "C" Then + Alert("Debe de seleccionar un Proveedor o un Funcionario Empleado", TipoMensaje.MsgAdvertencia) + EsValido = False + End If + + If DdlEstatusIE.SelectedValue = "1" AndAlso PagueseA = "" AndAlso Not Opcion = "EGSCREDITO" Then + Alert("Ingrese Beneficiario", TipoMensaje.MsgAdvertencia) + EsValido = False + End If + + Dim Dep As New ClsGenerales + If Dep.GetCuentasDepositos(CveProveedor:=CveProveedor) Then + Dim Row = Dep.DtResultados.FiltroPrimero(String.Format("CveCuentaDeposito = {0}", DdlCuentaDeposito.SelectedValue.ToEntero)) + If Row IsNot Nothing AndAlso Row("Estatus").ToString = "False" Then + Alert("La cuenta depósito del proveedor esta inactiva.", TipoMensaje.MsgAdvertencia) + EsValido = False + End If + End If Dep.Dispose() @@ -2521,226 +2521,226 @@ Partial Class Bancos_IE Alert($"El importe del movimiento es mayor al saldo de la orden de compra importe movmiento {TxtImporte.Text.FormatoNumero } saldo orden de compra: {SaldoOCAnticipo.ToString.FormatoNumero}", TipoMensaje.MsgAdvertencia) End If - End If - - Return EsValido - + End If + + Return EsValido + End Function - Protected Sub BtnCambiaTipoMoneda_Click(sender As Object, e As EventArgs) - CambiaTipoMoneda() - End Sub - - - Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click - - If Not ValidaGuardar() Then - Exit Sub - End If - - Dim ObjIE As New ClsBancos() - Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) - Dim ObjOC As New ClsOC(ObjIE.IniciaTransacSQL) - - ' Dim ObjContabilidad As New ClsContabilidad(ObjIE.IniciaTransacSQL) - - Dim MsgError As String = "" - Dim CveConceptoContable As Integer = 30 - Dim CveConceptoCompra As Integer = 10 - Dim CveCreditoDetalle As Integer = -1 - Dim CIF As Decimal = 0 - Dim CvePlantillaPoliza As Integer = 3 - Dim CvePrePoliza As Integer = 0 - Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" - Dim Msg As New StringBuilder - + Protected Sub BtnCambiaTipoMoneda_Click(sender As Object, e As EventArgs) + CambiaTipoMoneda() + End Sub + + + Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click + + If Not ValidaGuardar() Then + Exit Sub + End If + + Dim ObjIE As New ClsBancos() + Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) + Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) + Dim ObjOC As New ClsOC(ObjIE.IniciaTransacSQL) + + ' Dim ObjContabilidad As New ClsContabilidad(ObjIE.IniciaTransacSQL) + + Dim MsgError As String = "" + Dim CveConceptoContable As Integer = 30 + Dim CveConceptoCompra As Integer = 10 + Dim CveCreditoDetalle As Integer = -1 + Dim CIF As Decimal = 0 + Dim CvePlantillaPoliza As Integer = 3 + Dim CvePrePoliza As Integer = 0 + Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" + Dim Msg As New StringBuilder + If CveIE = -1 Then - Dim CveCuentaDeposito As Integer = 0 - If DdlCuentaDeposito.Items.Count > 0 Then - CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero - End If - - 'OBTIENE COMPROBANTE!! - ComprobanteIE = "" - Dim Comprobante As String = "" - Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos - Dim filemove As String = "" - For Each fileItem As Archivo In filesgral - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.filename - Next - - - '*****-_- INICIA: CONFIGURACION REGISTRO -_-***** - If CvePersonal > 0 Then - If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") And DDlCheques.SelectedValue.ToEntero > 0 Then - CveConceptoCompra = 29 'Comprobación Personal - Else - CveConceptoCompra = 28 'Prestamo Personal - End If - CveConceptoContable = 30 'Banco - CvePlantillaPoliza = 8 - End If - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then - If CvePersonal > 0 Then - CveConceptoCompra = 29 'Comprobacion Personal - CveConceptoContable = 30 'Bancos - CvePlantillaPoliza = 9 - ElseIf CveProveedor > 0 Then - CveConceptoCompra = 21 'Pago a Proveedor/CAncelacion Anticipos - CveConceptoContable = 30 'Bancos + Dim CveCuentaDeposito As Integer = 0 + If DdlCuentaDeposito.Items.Count > 0 Then + CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero + End If + + 'OBTIENE COMPROBANTE!! + ComprobanteIE = "" + Dim Comprobante As String = "" + Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim filemove As String = "" + For Each fileItem As Archivo In filesgral + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.filename + Next + + + '*****-_- INICIA: CONFIGURACION REGISTRO -_-***** + If CvePersonal > 0 Then + If Opcion IsNot Nothing AndAlso Opcion.Contiene("EGSSINFACT") And DDlCheques.SelectedValue.ToEntero > 0 Then + CveConceptoCompra = 29 'Comprobación Personal + Else + CveConceptoCompra = 28 'Prestamo Personal + End If + CveConceptoContable = 30 'Banco + CvePlantillaPoliza = 8 + End If + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "DEV" Then + If CvePersonal > 0 Then + CveConceptoCompra = 29 'Comprobacion Personal + CveConceptoContable = 30 'Bancos + CvePlantillaPoliza = 9 + ElseIf CveProveedor > 0 Then + CveConceptoCompra = 21 'Pago a Proveedor/CAncelacion Anticipos + CveConceptoContable = 30 'Bancos CvePlantillaPoliza = 7 ElseIf CveCliente > 0 Then - CvePlantillaPoliza = 11 - End If - End If - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then - If CveCliente > 0 Then - CveConceptoCompra = 3 'Clientes - CveConceptoContable = 30 'Bancos - CvePlantillaPoliza = 12 - End If + CvePlantillaPoliza = 11 + End If + End If + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "ANTC" Then + If CveCliente > 0 Then + CveConceptoCompra = 3 'Clientes + CveConceptoContable = 30 'Bancos + CvePlantillaPoliza = 12 + End If End If If Opcion = "DevDinC" Then CvePlantillaPoliza = 2 - End If - - 'Cuando es Egreso sin factura, se registra una compra tipo anticipo - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSCREDITO" Then - CveConceptoCompra = 48 'Anticipo Acreedores - CveConceptoContable = 30 'Bancos - CveCreditoDetalle = DdlCreditoDetalle.SelectedValue.ToEntero - Dim Estatus As Integer = 2 - If HdnCveTipoCredito.Value = "1" Then - Estatus = 103 - 'cuando es crediproveedores es, pago a documentos por pagar - CveConceptoCompra = 57 - End If - ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle) - - If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then - CIF = TxtImporte.Text.ToDecimal - HdnImporteCredito.Value.ToDecimal - Else - CIF = 0 - End If - - CvePlantillaPoliza = 92 - - End If - Dim AgregaPolizaSaldoInicial As Boolean = False - 'Cuando es Egreso sin factura, se registra una compra tipo anticipo - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then - Select Case RBL.SelectedValue - Case "P" 'Proveedores - If CveProveedor > 0 Then - CveConceptoCompra = 10 'Anticipo a proveedor - CveConceptoContable = 30 'Pago a Proveedor - CvePlantillaPoliza = 3 - End If - Case "DD" ' Deudores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 43 'Prestamo a deudor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 6 - End If - Case "AC" ' Acreedores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 42 'Prestamo a acreedor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 21 - End If - Case "DP" ' Documentos por pagar - If CveProveedor > 0 Then - CveConceptoCompra = 50 'Anticipo doc por pagar - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 22 - End If - Case "FE" - AgregaPolizaSaldoInicial = True - End Select - End If - - 'Nuevo Formato Charlie - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 6 - Select Case RBL.SelectedValue - Case "DD" ' Deudores Diversos - If CveProveedor > 0 Then - CveConceptoCompra = 37 'Prestamo a deudor diverso - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - CvePlantillaPoliza = 45 - End If - Case "C" ' Clientes - If CveCliente > 0 Then - CveConceptoCompra = 66 'Anticipo doc por pagar - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - End If - Case "AC" ' Acreedores Diversos - If CveCliente > 0 Then - CveConceptoCompra = 41 - CveConceptoContable = 30 'Bancos - 'limpio el iva - HdnProvPorIVA.Value = "0" - End If - End Select - End If - - '*****-_- TERMINA: CONFIGURACION REGISTRO -_-***** - - - Dim FolioFijo As Integer = 0 - Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero - Dim tImporteMonedaExtranjera As Decimal = TxtImporte.Text.ToDecimal - If tCveMoneda <> 1 Then tImporteMonedaExtranjera = (TxtImporte.Text.ToDecimal * GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString.ToDecimal).RoundSQL - Dim PagueseA = "" - - If HdnCveCliente.Value.ToEntero > 0 Then - PagueseA = DdlCliente.SelectedText.ToString() - ElseIf HdnCveProveedor.Value.ToEntero > 0 Then - PagueseA = DdlProveedores.SelectedText.ToString() - ElseIf HdnCvePersonal.Value.ToEntero > 0 Then - PagueseA = DdlPersonal.SelectedItem.ToString - ElseIf DdlCreditoDetalle.SelectedValue.ToEntero > 0 Then - PagueseA = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) - End If - - If AgregaPolizaSaldoInicial Then - If AgregarSaldoInicial(TxtImporte.Text.ToDouble(), TxtFechaDocumento.Text.ToDateTime(), DdlMoneda.SelectedValue.ToEntero(), ObjMov) <= 0 Then - MsgError = "No se pudo insertar la póliza de saldo inicial." - End If - End If + End If + + 'Cuando es Egreso sin factura, se registra una compra tipo anticipo + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSCREDITO" Then + CveConceptoCompra = 48 'Anticipo Acreedores + CveConceptoContable = 30 'Bancos + CveCreditoDetalle = DdlCreditoDetalle.SelectedValue.ToEntero + Dim Estatus As Integer = 2 + If HdnCveTipoCredito.Value = "1" Then + Estatus = 103 + 'cuando es crediproveedores es, pago a documentos por pagar + CveConceptoCompra = 57 + End If + ObjIE.UpdateCreditosDetalle(Estatus, CveCreditoDetalle) + + If HdnImporteCredito.Value.ToDouble > 0 AndAlso TxtImporte.Text.ToDouble > HdnImporteCredito.Value.ToDouble Then + CIF = TxtImporte.Text.ToDecimal - HdnImporteCredito.Value.ToDecimal + Else + CIF = 0 + End If + + CvePlantillaPoliza = 92 + + End If + Dim AgregaPolizaSaldoInicial As Boolean = False + 'Cuando es Egreso sin factura, se registra una compra tipo anticipo + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "EGSSINFACT" Then + Select Case RBL.SelectedValue + Case "P" 'Proveedores + If CveProveedor > 0 Then + CveConceptoCompra = 10 'Anticipo a proveedor + CveConceptoContable = 30 'Pago a Proveedor + CvePlantillaPoliza = 3 + End If + Case "DD" ' Deudores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 43 'Prestamo a deudor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 6 + End If + Case "AC" ' Acreedores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 42 'Prestamo a acreedor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 21 + End If + Case "DP" ' Documentos por pagar + If CveProveedor > 0 Then + CveConceptoCompra = 50 'Anticipo doc por pagar + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 22 + End If + Case "FE" + AgregaPolizaSaldoInicial = True + End Select + End If + + 'Nuevo Formato Charlie + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString = "INGPC" Then + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 6 + Select Case RBL.SelectedValue + Case "DD" ' Deudores Diversos + If CveProveedor > 0 Then + CveConceptoCompra = 37 'Prestamo a deudor diverso + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + CvePlantillaPoliza = 45 + End If + Case "C" ' Clientes + If CveCliente > 0 Then + CveConceptoCompra = 66 'Anticipo doc por pagar + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + End If + Case "AC" ' Acreedores Diversos + If CveCliente > 0 Then + CveConceptoCompra = 41 + CveConceptoContable = 30 'Bancos + 'limpio el iva + HdnProvPorIVA.Value = "0" + End If + End Select + End If + + '*****-_- TERMINA: CONFIGURACION REGISTRO -_-***** + + + Dim FolioFijo As Integer = 0 + Dim tCveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero + Dim tImporteMonedaExtranjera As Decimal = TxtImporte.Text.ToDecimal + If tCveMoneda <> 1 Then tImporteMonedaExtranjera = (TxtImporte.Text.ToDecimal * GlobalTipoCambio(TxtFechaDocumento.Text.Trim.ToDate).ToString.ToDecimal).RoundSQL + Dim PagueseA = "" + + If HdnCveCliente.Value.ToEntero > 0 Then + PagueseA = DdlCliente.SelectedText.ToString() + ElseIf HdnCveProveedor.Value.ToEntero > 0 Then + PagueseA = DdlProveedores.SelectedText.ToString() + ElseIf HdnCvePersonal.Value.ToEntero > 0 Then + PagueseA = DdlPersonal.SelectedItem.ToString + ElseIf DdlCreditoDetalle.SelectedValue.ToEntero > 0 Then + PagueseA = String.Format("{0} {1} {2}", DdlFinanciera.SelectedItem.Text, DdlCredito.SelectedItem.Text, DdlCreditoDetalle.SelectedItem.Text) + End If + + If AgregaPolizaSaldoInicial Then + If AgregarSaldoInicial(TxtImporte.Text.ToDouble(), TxtFechaDocumento.Text.ToDateTime(), DdlMoneda.SelectedValue.ToEntero(), ObjMov) <= 0 Then + MsgError = "No se pudo insertar la póliza de saldo inicial." + End If + End If Dim UsaComplementariaBancos As Boolean = False - UsaComplementariaBancos = True - - If MsgError = "" Then - - - - CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, PagueseA, TxtImporte.Text.Trim.ToDouble, DdlMoneda.SelectedValue.ToEntero, + UsaComplementariaBancos = True + + If MsgError = "" Then + + + + CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, PagueseA, TxtImporte.Text.Trim.ToDouble, DdlMoneda.SelectedValue.ToEntero, TxtTipoCambio.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, TxtNotificarA.Text.Trim, ChkAbonoCuenta.Checked, ChkAplicaImpuestos.Checked, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=DdlEstatusIE.SelectedValue.ToString.ToEntero, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), - ConceptoCIE:=If(TxtConceptoCIE.Text.Trim.Length > 0, TxtConceptoCIE.Text, "-1"), CveCorte:=Me.CveCorte, CveOCAnticipo:=CveOCSolicitudAnticipo) - - If CveIE > 0 Then - - - + CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=DdlEstatusIE.SelectedValue.ToString.ToEntero, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), + ConceptoCIE:=If(TxtConceptoCIE.Text.Trim.Length > 0, TxtConceptoCIE.Text, "-1"), CveCorte:=Me.CveCorte, CveOCAnticipo:=CveOCSolicitudAnticipo) + + If CveIE > 0 Then + + + If DdlCuentaDeposito.SelectedValue.ToEntero > 0 And DdlTipoTransaccion.SelectedValue = "17" Then If TxtReferenciaCIE.Text <> OriReferenciaCIE Or TxtConceptoCIE.Text <> OriConceptoCIE Then @@ -2754,232 +2754,232 @@ Partial Class Bancos_IE End If - End If - - If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = ObjIE.Folio.ToEntero 'cheque - CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE " + If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "") + " " + RBL.SelectedValue, CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa)) - - 'valida prepoliza - If CvePrePoliza > 0 Then - - If Not ObjIE.UpdateIEPrePoliza(MinFecha, "", -1, CvePrePoliza, CveIE, -1) Then - MsgError = "Ocurrio un error al agregar la prepoliza al IE." - End If - - Dim Conc As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) - Dim Ref As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) - - If Comprobante <> "" Then - ComprobanteIE = $"{CveIE}.{Comprobante}" - End If - - 'GUARDA COMPROBANTE - If filemove <> "" Then - filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) - End If - - 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs - Select Case Opcion - Case "DEV" - Dim CveIEOtro As Integer = If(CveProveedor > 0 Or CvePersonal > 0, DdlIEDevolucion.SelectedValue.ToEntero, CveIE) - - If CveCliente > 0 AndAlso Not DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDouble = 0 Then - 'RMF- CASO DONDE HAY UNA DEVOLUCION Y TENGO QUE AFECTAR LAS FACTURAS QUE SE HABIAN MARCADO COMO PAGADAS TENGO QUE REGRESARLAS A PENDIENTES - Dim Mov As New ClsMovimientos - If Mov.GetMovimientosIE(2, DdlIEDevolucion.SelectedValue.ToEntero, -1, Now, Now, 1, 0, UsuarioActual.CveEmpresa) Then - Dim DtIE As DataTable = Mov.DtResultados - For Each dr As DataRow In DtIE.Rows - - If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, If(dr("TipoMovto").ToString.ToEntero = 1, False, True), If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, dr("Importe").ToString.ToDecimal), "", dr("CveConceptoContable").ToString.ToEntero, "", Now, IDCtaBeneficiario, -1, CveIE, CveCliente:=dr("CveCliente").ToString.ToEntero, CveVenta:=dr("CveVenta").ToString.ToEntero, ImporteMX:=If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, -dr("Importe").ToString.ToDecimal), ImporteME:=tImporteMonedaExtranjera) Then - MsgError = "no se pudo insertar el detalle de la póliza 2" - End If - Next - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) - - End If - Mov.Dispose() - - 'Devolucion de INGxC Formato Charlie - ElseIf CveCliente > 0 AndAlso DivIvaIxC.Visible Then - - Dim Mov As New ClsMovimientos - 'INGxC - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), Ref, 66, Conc, Now, IDCtaContable, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), ImporteME:=tImporteMonedaExtranjera) - - If TxtIvaIxC.Text.ToDouble > 0 Then - Dim PorcentajeIVA = (TxtIvaIxC.Text.ToDecimal() / (TxtImporte.Text.ToDecimal() - TxtIvaIxC.Text.ToDecimal())).RoundSQL(2) - 'Iva - ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -TxtIvaIxC.Text.ToDecimal, Ref, 61, Conc, Now, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, PorcentajeImpuesto:=If(PorcentajeIVA.ToString().Contiene("0.08", "0.16"), PorcentajeIVA, 0)) - End If - - 'Bancos - ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -TxtImporte.Text.ToDecimal, Ref, 30, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) - Mov.Dispose() - - Else - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE:=If(CveIEOtro < 0, CveIE, CveIEOtro), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=tImporteMonedaExtranjera, ImporteME:=tImporteMonedaExtranjera) Then - MsgError = "no se pudo insertar el detalle de la póliza 2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - - End If - - - Case "INGPC" - Dim ConceptoContable As Integer - Dim TipoMovimiento As Boolean - Dim importeMovimiento As Decimal - Dim FechaMovimiento As Date = Now - Dim Concepto As String = "" - Dim Referencia As String = PagueseA - - Dim importeMX As Decimal - Dim Multiplicador As Integer - - If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then - - For Each Row As DataRow In ObjMov.DtResultados.Rows - - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) - importeMovimiento = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) - Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) - - Select Case ConceptoContable - - Case 10 - If RBL.SelectedValue = "P" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 28 - If RBL.SelectedValue = "FE" AndAlso CvePersonal > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 37 - If RBL.SelectedValue = "DD" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 41 - If RBL.SelectedValue = "AC" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 46 - - If TxtInteresMoratorio.Text.ToDecimal > 0 Then - importeMovimiento = TxtInteresMoratorio.Text.ToDecimal - importeMX = importeMovimiento - Else - importeMovimiento = 0 - importeMX = 0 - End If - - - Case 50 - If RBL.SelectedValue = "DP" AndAlso CveProveedor > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - End If - - Case 66 - If RBL.SelectedValue = "C" AndAlso CveCliente > 0 Then - importeMovimiento = TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal - importeMX = importeMovimiento - - 'Agregamos el IVA - If DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDecimal <> 0 Then - Dim CveConIVA As Integer = 61 - If UsuarioActual.CveEmpresa = 70 Then CveConIVA = 299 - Dim PorcentajeIVA = (TxtIvaIxC.Text.ToDecimal() / (TxtImporte.Text.ToDecimal() - TxtIvaIxC.Text.ToDecimal())).RoundSQL(2) - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, CveConIVA, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, PorcentajeImpuesto:=PorcentajeIVA) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - If tCveMoneda > 1 Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - - End If - - End If - - Case 30 - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - - If tCveMoneda > 1 AndAlso UsaComplementariaBancos Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + + If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = ObjIE.Folio.ToEntero 'cheque + CvePrePoliza = ObjMov.AddPrePolizas("Bancos/IE " + If(Request("Opcion") IsNot Nothing, Request("Opcion").ToString, "") + " " + RBL.SelectedValue, CvePlantillaPoliza, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa)) + + 'valida prepoliza + If CvePrePoliza > 0 Then + + If Not ObjIE.UpdateIEPrePoliza(MinFecha, "", -1, CvePrePoliza, CveIE, -1) Then + MsgError = "Ocurrio un error al agregar la prepoliza al IE." + End If + + Dim Conc As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) + Dim Ref As String = If(TxtObservaciones.Text = "", ObjIE.Folio, TxtObservaciones.Text) + + If Comprobante <> "" Then + ComprobanteIE = $"{CveIE}.{Comprobante}" + End If + + 'GUARDA COMPROBANTE + If filemove <> "" Then + filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + End If + + 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs + Select Case Opcion + Case "DEV" + Dim CveIEOtro As Integer = If(CveProveedor > 0 Or CvePersonal > 0, DdlIEDevolucion.SelectedValue.ToEntero, CveIE) + + If CveCliente > 0 AndAlso Not DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDouble = 0 Then + 'RMF- CASO DONDE HAY UNA DEVOLUCION Y TENGO QUE AFECTAR LAS FACTURAS QUE SE HABIAN MARCADO COMO PAGADAS TENGO QUE REGRESARLAS A PENDIENTES + Dim Mov As New ClsMovimientos + If Mov.GetMovimientosIE(2, DdlIEDevolucion.SelectedValue.ToEntero, -1, Now, Now, 1, 0, UsuarioActual.CveEmpresa) Then + Dim DtIE As DataTable = Mov.DtResultados + For Each dr As DataRow In DtIE.Rows + + If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, If(dr("TipoMovto").ToString.ToEntero = 1, False, True), If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, dr("Importe").ToString.ToDecimal), "", dr("CveConceptoContable").ToString.ToEntero, "", Now, IDCtaBeneficiario, -1, CveIE, CveCliente:=dr("CveCliente").ToString.ToEntero, CveVenta:=dr("CveVenta").ToString.ToEntero, ImporteMX:=If(dr("CveConceptoContable").ToString.ToEntero.Contiene(66), -TxtImporte.Text.ToDecimal, -dr("Importe").ToString.ToDecimal), ImporteME:=tImporteMonedaExtranjera) Then + MsgError = "no se pudo insertar el detalle de la póliza 2" + End If + Next + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) + + End If + Mov.Dispose() + + 'Devolucion de INGxC Formato Charlie + ElseIf CveCliente > 0 AndAlso DivIvaIxC.Visible Then + + Dim Mov As New ClsMovimientos + 'INGxC + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), Ref, 66, Conc, Now, IDCtaContable, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-(TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal), ImporteME:=tImporteMonedaExtranjera) + + If TxtIvaIxC.Text.ToDouble > 0 Then + Dim PorcentajeIVA = (TxtIvaIxC.Text.ToDecimal() / (TxtImporte.Text.ToDecimal() - TxtIvaIxC.Text.ToDecimal())).RoundSQL(2) + 'Iva + ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -TxtIvaIxC.Text.ToDecimal, Ref, 61, Conc, Now, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, PorcentajeImpuesto:=If(PorcentajeIVA.ToString().Contiene("0.08", "0.16"), PorcentajeIVA, 0)) + End If + + 'Bancos + ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -TxtImporte.Text.ToDecimal, Ref, 30, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveIEDevolucion:=DdlIEDevolucion.SelectedValue.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=-TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) + Mov.Dispose() + + Else + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE:=If(CveIEOtro < 0, CveIE, CveIEOtro), CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=tImporteMonedaExtranjera, ImporteME:=tImporteMonedaExtranjera) Then + MsgError = "no se pudo insertar el detalle de la póliza 2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + + End If + + + Case "INGPC" + Dim ConceptoContable As Integer + Dim TipoMovimiento As Boolean + Dim importeMovimiento As Decimal + Dim FechaMovimiento As Date = Now + Dim Concepto As String = "" + Dim Referencia As String = PagueseA + + Dim importeMX As Decimal + Dim Multiplicador As Integer + + If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then + + For Each Row As DataRow In ObjMov.DtResultados.Rows + + ConceptoContable = Row("CveConcepto").ToString.ToEntero + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + importeMovimiento = 0 + Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) + + Select Case ConceptoContable + + Case 10 + If RBL.SelectedValue = "P" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 28 + If RBL.SelectedValue = "FE" AndAlso CvePersonal > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 37 + If RBL.SelectedValue = "DD" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 41 + If RBL.SelectedValue = "AC" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 46 + + If TxtInteresMoratorio.Text.ToDecimal > 0 Then + importeMovimiento = TxtInteresMoratorio.Text.ToDecimal + importeMX = importeMovimiento + Else + importeMovimiento = 0 + importeMX = 0 + End If + + + Case 50 + If RBL.SelectedValue = "DP" AndAlso CveProveedor > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + End If + + Case 66 + If RBL.SelectedValue = "C" AndAlso CveCliente > 0 Then + importeMovimiento = TxtImporte.Text.ToDecimal - TxtIvaIxC.Text.ToDecimal + importeMX = importeMovimiento + + 'Agregamos el IVA + If DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDecimal <> 0 Then + Dim CveConIVA As Integer = 61 + If UsuarioActual.CveEmpresa = 70 Then CveConIVA = 299 + Dim PorcentajeIVA = (TxtIvaIxC.Text.ToDecimal() / (TxtImporte.Text.ToDecimal() - TxtIvaIxC.Text.ToDecimal())).RoundSQL(2) + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, CveConIVA, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, PorcentajeImpuesto:=PorcentajeIVA) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + If tCveMoneda > 1 Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + + End If + + End If + + Case 30 + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + + If tCveMoneda > 1 AndAlso UsaComplementariaBancos Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If Else If tCveMoneda > 1 Then Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal importeMX = (importeMovimiento * TC).RoundSQL - End If - End If - - End Select - - If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - - Next - - End If - - - Case "DevDinV" - Dim IdCtaContableAplicar = -1 - Dim ImporteAplicar = 0.0D - Dim ImporteAplicarMN = 0.0D - Dim ImporteAplicarME = 0.0D - Dim ReferenciaAplicar = ObjIE.Folio - Dim ConceptoAplicar = $"Devolución al cliente {PagueseA} {TxtImporte.Text} NC:{SerieFolioDevDin}" - - ImporteAplicar = TxtImporte.Text.ToDecimal - ImporteAplicarME = ImporteAplicar - - 'CONSIDERA COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 Then - ImporteAplicarMN = ImporteAplicar - Else - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - End If - - 'BANCOS - IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" - Exit Select - End If - - 'BANCOS COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 Then - ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)) - ImporteAplicar).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If + End If + End If + + End Select + + If importeMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + + Next + + End If + + + Case "DevDinV" + Dim IdCtaContableAplicar = -1 + Dim ImporteAplicar = 0.0D + Dim ImporteAplicarMN = 0.0D + Dim ImporteAplicarME = 0.0D + Dim ReferenciaAplicar = ObjIE.Folio + Dim ConceptoAplicar = $"Devolución al cliente {PagueseA} {TxtImporte.Text} NC:{SerieFolioDevDin}" + + ImporteAplicar = TxtImporte.Text.ToDecimal + ImporteAplicarME = ImporteAplicar + + 'CONSIDERA COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 Then + ImporteAplicarMN = ImporteAplicar + Else + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + End If + + 'BANCOS + IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" + Exit Select + End If + + 'BANCOS COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 Then + ImporteAplicarMN = ((ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)) - ImporteAplicar).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ReferenciaAplicar, 204, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If End If 'OTROS INGRESOS/EGRESOS @@ -3003,87 +3003,87 @@ Partial Class Bancos_IE MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" Exit Select End If - End If - - 'CANCELA NC - IdCtaContableAplicar = IDCtaBeneficiario - ImporteAplicar = ImporteAplicar + Impo - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 12, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=-(ImporteAplicarMN), ImporteME:=ImporteAplicarME) Then - MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" - Exit Select + End If + + 'CANCELA NC + IdCtaContableAplicar = IDCtaBeneficiario + ImporteAplicar = ImporteAplicar + Impo + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -(ImporteAplicar), ReferenciaAplicar, 12, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=-(ImporteAplicarMN), ImporteME:=ImporteAplicarME) Then + MsgError = "Ocurrió un error al registrar el asiento de pago de devolución" + Exit Select End If 'IMPUESTOS - If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin, UsuarioActual.CveEmpresa) Then - Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) - Dim CveConceptoContableAplciar = -1 - Dim TipoMovtoAplicar = False - - For Each Dr As DataRow In ObjMov.DtResultados.FiltraParametros("CveConceptoContable IN (13,8,9,38)").Rows - Dim PorcentajeImpuesto As Decimal = Dr("PorcentajeImpuesto").ToString.ToDecimal() - CveConceptoContableAplciar = Dr("CveConceptoContable").ToString.ToEntero - TipoMovtoAplicar = Not CBool(Dr("TipoMovto").ToString) - ImporteAplicar = (Dr("Importe").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - ImporteAplicarMN = (Dr("ImporteMN").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - ImporteAplicarME = (Dr("ImporteME").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() - IdCtaContableAplicar = Dr("IdCtaContable").ToString.ToEntero - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then - Select Case CveConceptoContableAplciar - Case 13 - CveConceptoContableAplciar = 61 - Case 8 - CveConceptoContableAplciar = 62 - Case 9 - CveConceptoContableAplciar = 63 - Case 38 - CveConceptoContableAplciar = 39 - End Select - TipoMovtoAplicar = Not TipoMovtoAplicar - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - Exit Select - End If - Else - MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" - Exit Select - End If - - Next - End If - - Case "DevDinC" - 'asdasdasd - 'asdasdasdasd - Dim IdCtaContableAplicar = -1 - Dim ImporteAplicar = 0.0D - Dim ImporteAplicarMN = 0.0D - Dim ImporteAplicarME = 0.0D - Dim ReferenciaAplicar = ObjIE.Folio - - Dim ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {TxtImporte.Text} NC:{SerieFolioDeCDin}" - - ImporteAplicar = TxtImporte.Text.ToDecimal - ImporteAplicarME = ImporteAplicar - - - 'CONSIDERA COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 Then - ImporteAplicarMN = ImporteAplicar - Else - ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() - End If - - Dim TCCompra As Decimal = 1 + If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin, UsuarioActual.CveEmpresa) Then + Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) + Dim CveConceptoContableAplciar = -1 + Dim TipoMovtoAplicar = False + + For Each Dr As DataRow In ObjMov.DtResultados.FiltraParametros("CveConceptoContable IN (13,8,9,38)").Rows + Dim PorcentajeImpuesto As Decimal = Dr("PorcentajeImpuesto").ToString.ToDecimal() + CveConceptoContableAplciar = Dr("CveConceptoContable").ToString.ToEntero + TipoMovtoAplicar = Not CBool(Dr("TipoMovto").ToString) + ImporteAplicar = (Dr("Importe").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + ImporteAplicarMN = (Dr("ImporteMN").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + ImporteAplicarME = (Dr("ImporteME").ToString.ToDecimal * PorcentajePagoDevDin).RoundSQL() + IdCtaContableAplicar = Dr("IdCtaContable").ToString.ToEntero + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then + Select Case CveConceptoContableAplciar + Case 13 + CveConceptoContableAplciar = 61 + Case 8 + CveConceptoContableAplciar = 62 + Case 9 + CveConceptoContableAplciar = 63 + Case 38 + CveConceptoContableAplciar = 39 + End Select + TipoMovtoAplicar = Not TipoMovtoAplicar + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAplicar, ImporteAplicar, ReferenciaAplicar, CveConceptoContableAplciar, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveVenta:=CveVentaDevDin, CveCliente:=CveCliente, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=PorcentajeImpuesto) Then + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + Exit Select + End If + Else + MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" + Exit Select + End If + + Next + End If + + Case "DevDinC" + 'asdasdasd + 'asdasdasdasd + Dim IdCtaContableAplicar = -1 + Dim ImporteAplicar = 0.0D + Dim ImporteAplicarMN = 0.0D + Dim ImporteAplicarME = 0.0D + Dim ReferenciaAplicar = ObjIE.Folio + + Dim ConceptoAplicar = $"Devolución de Proveedor {PagueseA} {TxtImporte.Text} NC:{SerieFolioDeCDin}" + + ImporteAplicar = TxtImporte.Text.ToDecimal + ImporteAplicarME = ImporteAplicar + + + 'CONSIDERA COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 Then + ImporteAplicarMN = ImporteAplicar + Else + ImporteAplicarMN = (ImporteAplicar * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)).RoundSQL() + End If + + Dim TCCompra As Decimal = 1 Dim TCDocumento As Decimal = 1 'BANCOS - IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, TipoCambio:=TCDocumento) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" - Exit Select + IdCtaContableAplicar = If(IDCtaContable > 0, IDCtaContable, 0) + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, ReferenciaAplicar, 30, ConceptoAplicar, Now, IdCtaContableAplicar, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicarME, TipoCambio:=TCDocumento) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución" + Exit Select End If @@ -3575,218 +3575,218 @@ Partial Class Bancos_IE '''''''''''''''''''''''''''''''''''''''''''''' - Case "EGSCREDITO" - - Dim ConceptoContable As Integer - Dim TipoMovimiento As Boolean - Dim importeMovimiento As Decimal - Dim FechaMovimiento As Date = Now - Dim Concepto As String = "" - Dim Referencia As String = PagueseA - - Dim importeMX As Decimal - Dim Multiplicador As Integer - - If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then - - For Each Row As DataRow In ObjMov.DtResultados.Rows - - ConceptoContable = Row("CveConcepto").ToString.ToEntero - TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) - importeMovimiento = 0 - Multiplicador = (Row("Multiplicador").ToString.ToEntero) - Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) - - Select Case ConceptoContable - - Case 30 - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - If tCveMoneda > 1 Then - 'Agregamos complementaria - Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - Case 42 - - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento + Case "EGSCREDITO" + + Dim ConceptoContable As Integer + Dim TipoMovimiento As Boolean + Dim importeMovimiento As Decimal + Dim FechaMovimiento As Date = Now + Dim Concepto As String = "" + Dim Referencia As String = PagueseA + + Dim importeMX As Decimal + Dim Multiplicador As Integer + + If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then + + For Each Row As DataRow In ObjMov.DtResultados.Rows + + ConceptoContable = Row("CveConcepto").ToString.ToEntero + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + importeMovimiento = 0 + Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) + + Select Case ConceptoContable + + Case 30 + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + If tCveMoneda > 1 Then + 'Agregamos complementaria + Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + Case 42 + + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento If tCveMoneda > 1 Then importeMovimiento = TxtImporte.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal importeMX = importeMovimiento - End If - - - Case 46 - If TxtInteresMoratorio.Text.ToDecimal > 0 Then - importeMovimiento = TxtInteresMoratorio.Text.ToDecimal - importeMX = importeMovimiento - Else - importeMovimiento = 0 - importeMX = 0 - End If - Case 48 - - importeMovimiento = TxtImporte.Text.ToDecimal - importeMX = importeMovimiento - - End Select - - If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento del ingreso." - End If - End If - - Next - End If - - Case Else - Dim TipoMovimiento As Boolean = True - - If Opcion.Contiene("ANTC") Then - TipoMovimiento = False - End If - - If CveConceptoCompra = 10 AndAlso DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsaComplementariaBancos Then + End If + + + Case 46 + If TxtInteresMoratorio.Text.ToDecimal > 0 Then + importeMovimiento = TxtInteresMoratorio.Text.ToDecimal + importeMX = importeMovimiento + Else + importeMovimiento = 0 + importeMX = 0 + End If + Case 48 + + importeMovimiento = TxtImporte.Text.ToDecimal + importeMX = importeMovimiento + + End Select + + If importeMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, IDCtaContable, IDCtaBeneficiario), -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + + Next + End If + + Case Else + Dim TipoMovimiento As Boolean = True + + If Opcion.Contiene("ANTC") Then + TipoMovimiento = False + End If + + If CveConceptoCompra = 10 AndAlso DdlMoneda.SelectedValue.ToEntero > 1 AndAlso UsaComplementariaBancos Then IDCtaBeneficiario = IdCtaAnticipoExtranjera - End If - - 'MOVIMIENTOS EGRESOS - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, TxtImporte.Text.ToDecimal - IVA - CIF, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=If(UsaComplementariaBancos, TxtImporte.Text.ToDecimal, tImporteMonedaExtranjera), ImporteME:=TxtImporte.Text.ToDecimal, CveIEDevolucion:=DdlIEAcreedor.SelectedValue.ToEntero) Then - If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Ref, 19, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - MsgError = "Detalle" - End If - 'intereses pagados - If CIF > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, CIF, Ref, 46, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=CIF, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - MsgError = "Detalle" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - - 'BANCOS COMPLEMENTARIA - If DdlMoneda.SelectedValue.ToEntero > 1 Then - Dim ImporteAplicar As Decimal = TxtImporte.Text.ToDecimal - Dim ImporteAplicarMN = (ImporteAplicar * TxtTipoCambio.Text.ToDecimal - ImporteAplicar).RoundSQL() - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAplicar, Ref, 204, Conc, Now, IDCtaContableComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - - If CveConceptoCompra = 10 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, ImporteAplicar, Ref, 266, Conc, Now, IdCtaAnticipoComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then - MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" - End If - End If - End If - - If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then - If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then - MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." - End If - End If - + End If + + 'MOVIMIENTOS EGRESOS + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, TxtImporte.Text.ToDecimal - IVA - CIF, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=If(UsaComplementariaBancos, TxtImporte.Text.ToDecimal, tImporteMonedaExtranjera), ImporteME:=TxtImporte.Text.ToDecimal, CveIEDevolucion:=DdlIEAcreedor.SelectedValue.ToEntero) Then + If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Ref, 19, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + MsgError = "Detalle" + End If + 'intereses pagados + If CIF > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, CIF, Ref, 46, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=CIF, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + MsgError = "Detalle" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + + 'BANCOS COMPLEMENTARIA + If DdlMoneda.SelectedValue.ToEntero > 1 Then + Dim ImporteAplicar As Decimal = TxtImporte.Text.ToDecimal + Dim ImporteAplicarMN = (ImporteAplicar * TxtTipoCambio.Text.ToDecimal - ImporteAplicar).RoundSQL() + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAplicar, Ref, 204, Conc, Now, IDCtaContableComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + + If CveConceptoCompra = 10 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, ImporteAplicar, Ref, 266, Conc, Now, IdCtaAnticipoComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then + MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución" + End If + End If + End If + + If Opcion.Contiene("EGSSINFACT") AndAlso CveSolicitudViatico > 0 AndAlso MsgError = "" Then + If Not ObjIE.UpdateSolicitudesViaticosIE(CveSolicitudViatico, CveIE) Then + MsgError = "Ocurrió un error al vincular el egreso con la solicitud de viatico." + End If + End If + End Select - - - If UsuarioActual.Empresa.UsaAC Then - Dim ConceptoRenglon, Referencia As String - Dim FolioPoliza As Integer - Dim Fecha As Date = TxtFechaDocumento.Text.ToDate - Dim TipoChq As String = "" - Dim Total As Double = TxtImporte.Text.ToDouble - - Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) - Conta.IniciaTransacSQL() - - If DdlTipoTransaccion.SelectedValue = "1" Then TipoChq = "CHQ" - ConceptoRenglon = String.Format("Anticipo {0}", PagueseA) - - IDPoliza = Conta.AddPoliza(2, ConceptoRenglon, Total, Total, UsuarioActual.CveUsuario, Fecha, ObjIE.Folio, TipoChq) - - If IDPoliza > 0 Then - FolioPoliza = Conta.Folio - Referencia = ObjIE.Folio - ConceptoRenglon = String.Format("Anticipo {0} {1}", PagueseA, TxtObservaciones.Text) - - Total = TxtImporte.Text.ToDouble - - If Not Conta.AddMovimiento(IDPoliza, IDCtaContable, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" - - If Not Conta.AddMovimiento(IDPoliza, IDCtaBeneficiario, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" - - Else - MsgError = "No se insertó el encabezado" - End If - - If MsgError = "" Then - Conta.Commit() - - Conta.AjustaPoliza(IDPoliza) - 'actualizar la conta del IE - ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0) - Else - Conta.RollBack() - IDPoliza = 0 - End If - - Conta.Dispose() - End If - - 'Notificación de Pago - If TxtNotificarA.Text.Trim <> "" And MsgError = "" Then - 'NotificacionPago(CveIE, TxtNotificarA.Text.Trim) - EnviarCorreoNotificacion(CveIE, TxtNotificarA.Text.Trim, "", UsuarioActual, False) - End If - - Else - MsgError = "No se pudo insertar la póliza" - End If - - Else - MsgError = "No se insertó el encabezado" - End If - - End If - - Else - Msg.Append("El Documento se guardó correctamente.") - - End If - - 'SOLICITUD DE ANTICIPO OC - If MsgError = "" Then - MsgError = GuardaSolicitudAnticipoOC(ObjOC) - End If - - If MsgError = "" Then - 'VIATICOS - If ChkAplicaViatico.Checked Then - Dim Retorno As String = TimbrarNomina12(CvePersonal) - If Retorno <> "" Then MsgError = $"{MsgError} {Retorno}" : Msg.Clear() : CveIE = -1 - If Retorno <> "" Then - Alert(Retorno, TipoMensaje.MsgError) - End If - End If - End If - - If MsgError = "" Then - If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then - If ObjMov.ValorPolizaDescuadre > 0 Then - ' MsgError = ObjMov.MensajePolizaDescuadre - GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - End If - Else - MsgError = "No se pudo validar la prepoliza de cuadre." - End If + + + If UsuarioActual.Empresa.UsaAC Then + Dim ConceptoRenglon, Referencia As String + Dim FolioPoliza As Integer + Dim Fecha As Date = TxtFechaDocumento.Text.ToDate + Dim TipoChq As String = "" + Dim Total As Double = TxtImporte.Text.ToDouble + + Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) + Conta.IniciaTransacSQL() + + If DdlTipoTransaccion.SelectedValue = "1" Then TipoChq = "CHQ" + ConceptoRenglon = String.Format("Anticipo {0}", PagueseA) + + IDPoliza = Conta.AddPoliza(2, ConceptoRenglon, Total, Total, UsuarioActual.CveUsuario, Fecha, ObjIE.Folio, TipoChq) + + If IDPoliza > 0 Then + FolioPoliza = Conta.Folio + Referencia = ObjIE.Folio + ConceptoRenglon = String.Format("Anticipo {0} {1}", PagueseA, TxtObservaciones.Text) + + Total = TxtImporte.Text.ToDouble + + If Not Conta.AddMovimiento(IDPoliza, IDCtaContable, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + If Not Conta.AddMovimiento(IDPoliza, IDCtaBeneficiario, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + Else + MsgError = "No se insertó el encabezado" + End If + + If MsgError = "" Then + Conta.Commit() + + Conta.AjustaPoliza(IDPoliza) + 'actualizar la conta del IE + ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0) + Else + Conta.RollBack() + IDPoliza = 0 + End If + + Conta.Dispose() + End If + + 'Notificación de Pago + If TxtNotificarA.Text.Trim <> "" And MsgError = "" Then + 'NotificacionPago(CveIE, TxtNotificarA.Text.Trim) + EnviarCorreoNotificacion(CveIE, TxtNotificarA.Text.Trim, "", UsuarioActual, False) + End If + + Else + MsgError = "No se pudo insertar la póliza" + End If + + Else + MsgError = "No se insertó el encabezado" + End If + + End If + + Else + Msg.Append("El Documento se guardó correctamente.") + + End If + + 'SOLICITUD DE ANTICIPO OC + If MsgError = "" Then + MsgError = GuardaSolicitudAnticipoOC(ObjOC) + End If + + If MsgError = "" Then + 'VIATICOS + If ChkAplicaViatico.Checked Then + Dim Retorno As String = TimbrarNomina12(CvePersonal) + If Retorno <> "" Then MsgError = $"{MsgError} {Retorno}" : Msg.Clear() : CveIE = -1 + If Retorno <> "" Then + Alert(Retorno, TipoMensaje.MsgError) + End If + End If + End If + + If MsgError = "" Then + If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + ' MsgError = ObjMov.MensajePolizaDescuadre + GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + MsgError = "No se pudo validar la prepoliza de cuadre." + End If End If @@ -3810,97 +3810,97 @@ Partial Class Bancos_IE Alert("No se puede contabilizar la Prepoliza debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) End If End If - End If - - If MsgError = "" Then - 'IMPRIME CHEQUE - 'GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) - If Msg.ToString = "" Then - Msg.Append("El Documento se guardo correctamente") - End If - Dim Archivo As System.IO.FileInfo = Nothing - 'VERIFICA SI EXISTE EL FORMATO - If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) - ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) - If Not Archivo.Exists Then - Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)) - End If - ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then - Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) - End If - - If Archivo IsNot Nothing Then - If Archivo.Exists Then - Msg.AppendFormat("

{1} ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) - End If - End If - - If IDPoliza > 0 Then - Msg.AppendFormat("

Ver Póliza", IDPoliza) - End If - - 'AUTO DESCARGAR PDF PARA COMPU - If UsuarioActual.CveEmpresa.Contiene(72, 1, 2) And CveSolicitudViatico > 0 Then - If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1, 2, 6, 8, 9) Then - RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))}'", String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) - End If - End If - ObjIE.Commit() - - Else - ObjIE.RollBack() - Alert(MsgError, TipoMensaje.MsgAdvertencia) + End If + + If MsgError = "" Then + 'IMPRIME CHEQUE + 'GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) + If Msg.ToString = "" Then + Msg.Append("El Documento se guardo correctamente") + End If + Dim Archivo As System.IO.FileInfo = Nothing + 'VERIFICA SI EXISTE EL FORMATO + If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) + ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + If Not Archivo.Exists Then + Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)) + End If + ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then + Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + End If + + If Archivo IsNot Nothing Then + If Archivo.Exists Then + Msg.AppendFormat("

{1} ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) + End If + End If + + If IDPoliza > 0 Then + Msg.AppendFormat("

Ver Póliza", IDPoliza) + End If + + 'AUTO DESCARGAR PDF PARA COMPU + If UsuarioActual.CveEmpresa.Contiene(72, 1, 2) And CveSolicitudViatico > 0 Then + If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1, 2, 6, 8, 9) Then + RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=IE&CVEIE={0}", CveIE))}'", String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem)) + End If + End If + ObjIE.Commit() + + Else + ObjIE.RollBack() + Alert(MsgError, TipoMensaje.MsgAdvertencia) If Opcion = "INGPC" Then CveIE = -1 - End If - End If - - If Msg.ToString <> "" Then - If CveOCSolicitudAnticipo > 0 Then - Alert("El Documento se guardo correctamente", TipoMensaje.MsgInformacion, "document.location.href=""../Inicio.aspx""") - Else - If ChkAplicaViatico.Checked Then - Dim SerieFolio = $"VIA-{Folio}" - Msg.Clear() - Msg.AppendFormat("", Encripta(String.Format("OP=DesXmlVIA&SERIEFOLIO={0}&TIPO={1}", SerieFolio, "Viaticos"))) - End If - - Dim AccionJS = "" - - If Opcion = "DevDinV" Then - AccionJS = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";" - - AccionJS = String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.AbsolutePath) - Else - AccionJS = String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery) - End If - - - If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then - AccionJS = $"document.location.href=""/Bancos/Creditos.aspx?CveCredito={Request("CveCredito")}"";" - Alert(Msg.ToString, TipoMensaje.MsgInformacion, AccionJS) - Else - Alert(Msg.ToString, TipoMensaje.MsgInformacion, String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery)) - End If - - - - - End If - End If - - Msg.Clear() - RecargaGlobalCuentasBancarias() - ObjIE.Dispose() - ObjMov.Dispose() - If ObjComp IsNot Nothing Then ObjComp.Dispose() - - + End If + End If + + If Msg.ToString <> "" Then + If CveOCSolicitudAnticipo > 0 Then + Alert("El Documento se guardo correctamente", TipoMensaje.MsgInformacion, "document.location.href=""../Inicio.aspx""") + Else + If ChkAplicaViatico.Checked Then + Dim SerieFolio = $"VIA-{Folio}" + Msg.Clear() + Msg.AppendFormat("", Encripta(String.Format("OP=DesXmlVIA&SERIEFOLIO={0}&TIPO={1}", SerieFolio, "Viaticos"))) + End If + + Dim AccionJS = "" + + If Opcion = "DevDinV" Then + AccionJS = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";" + + AccionJS = String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.AbsolutePath) + Else + AccionJS = String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery) + End If + + + If Request("Opcion") IsNot Nothing AndAlso Request("Opcion").ToString.Contiene("EGSCREDITO") Then + AccionJS = $"document.location.href=""/Bancos/Creditos.aspx?CveCredito={Request("CveCredito")}"";" + Alert(Msg.ToString, TipoMensaje.MsgInformacion, AccionJS) + Else + Alert(Msg.ToString, TipoMensaje.MsgInformacion, String.Format("document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery)) + End If + + + + + End If + End If + + Msg.Clear() + RecargaGlobalCuentasBancarias() + ObjIE.Dispose() + ObjMov.Dispose() + If ObjComp IsNot Nothing Then ObjComp.Dispose() + + End Sub -#Region " NOTIFICACION PAGO " +#Region " NOTIFICACION PAGO " @@ -6622,8 +6622,9 @@ Partial Class Bancos_IE End If Else + Dim CveSATMotivoCancelacion As Integer = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa, CveSATMotivoCancelacion:=2).FiltroPrimeroValor("CveSATMotivoCancelacion").ToEntero() - If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then + If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index 654746115..66ef491bf 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -611,7 +611,7 @@ Partial Class Bancos_PopIECompras If UsuarioActual.Empresa.UsaAC Then RegistraScript("if (confirm('La factura está cancelada ante el SAT., ¿Desea eliminar la compra?')) { $get('BtnEliminarCompra').click();}") Else - Alert("La factura está cancelada ante el SAT.") + Alert("La factura está cancelada ante el SAT.", TipoMensaje.MsgError) End If Else @@ -624,47 +624,45 @@ Partial Class Bancos_PopIECompras Valida.Dispose() Else Validada = True - End If + End If + 'CargaProveedor + CveProveedor = dr("CveProveedor").ToString.ToEntero + HdnCveProveedor.Value = CveProveedor.ToString + CargaProveedor(CveProveedor, "-1") + CveMoneda = dr("CveMoneda").ToString.ToEntero + CveTipoConcepto = dr("CveTipoConcepto").ToString.ToEntero + CveMonedaCompra = dr("CveMoneda").ToString.ToEntero + CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero + SerieFolio = dr("SerieFolio").ToString + TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDecimal + NombreProveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RazonSocial", String.Format("CveProveedor = {0}", CveProveedor)) + CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero + LtlTitulo.Text = "Cuentas por Pagar" + LtlTipo2.Text = "Folio" + LtlTipo3.Text = "Fecha" + LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString() + LtlFolio.Text = dr("SerieFolio").ToString + LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}") + + 'Configuración de Modalidad Update + MovimientoPagar = New IEMovimiento + MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal + MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal + MovimientoPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL + MovimientoPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL + MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal + MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal + MovimientoPagar.Total = dr("Total").ToString.ToDecimal + MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal + MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal + MovimientoPagar.ConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero + MovimientoPagar.ConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero + MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal + MovimientoPagar.IVAPorPagar = dr("IVAPorPagar").ToString.ToDecimal + If Validada Then - 'CargaProveedor - CveProveedor = dr("CveProveedor").ToString.ToEntero - HdnCveProveedor.Value = CveProveedor.ToString - CargaProveedor(CveProveedor, "-1") - CveMoneda = dr("CveMoneda").ToString.ToEntero - CveTipoConcepto = dr("CveTipoConcepto").ToString.ToEntero - CveMonedaCompra = dr("CveMoneda").ToString.ToEntero - CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero - SerieFolio = dr("SerieFolio").ToString - TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDecimal - NombreProveedor = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RazonSocial", String.Format("CveProveedor = {0}", CveProveedor)) - - CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero - - LtlTitulo.Text = "Cuentas por Pagar" - LtlTipo2.Text = "Folio de la Compra" - LtlTipo3.Text = "Fecha de la Compra" - LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString() - LtlFolio.Text = dr("SerieFolio").ToString - LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}") - - 'Configuración de Modalidad Update - MovimientoPagar = New IEMovimiento - MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal - MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal - MovimientoPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL - MovimientoPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL - MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal - MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal - MovimientoPagar.Total = dr("Total").ToString.ToDecimal - MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal - MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal - MovimientoPagar.ConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero - MovimientoPagar.ConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero - MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal - MovimientoPagar.IVAPorPagar = dr("IVAPorPagar").ToString.ToDecimal - TxtFolio.Enabled = True TxtFechaDocumento.Enabled = True Calendario.Enabled = True diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index f3e2ed114..a1d01875f 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -1063,7 +1063,7 @@ Partial Class Compras_eFacturas e.Row.FCHyperLink("HplProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) - If e.Row.DBCampo("CveCompra") = "" AndAlso (e.Row.DBCampo("FueValidado") = "1") Then ' OrElse UsuarioActual.CveEmpresa = 66 + If e.Row.DBCampo("CveCompra") = "" AndAlso (e.Row.DBCampo("FueValidado") = "1" OrElse UsuarioActual.Empresa.Funcionalidad(529) = "1") Then ' OrElse UsuarioActual.CveEmpresa = 66 If e.Row.DBCampo("TipoComprobante") = "P" Then e.Row.FCHyperLink("HplAgregar").Visible = False diff --git a/Global.asax b/Global.asax index 904c3caac..50d62c751 100644 --- a/Global.asax +++ b/Global.asax @@ -235,7 +235,7 @@ 'If ObjGenerales.GetGralMunicipios Then Application("GlobalDTGralMunicipios") = ObjGenerales.DtResultados Else Application("GlobalDTGralMunicipios") = Nothing 'If ObjGenerales.GetGralPoblaciones Then Application("GlobalDTGralPoblaciones") = ObjGenerales.DtResultados Else Application("GlobalDTGralPoblaciones") = Nothing If ObjGenerales.GetEscolaridades Then Application("GlobalDTGralEscolaridades") = ObjGenerales.DtResultados Else Application("GlobalDTGralEscolaridades") = Nothing - If ObjGenerales.GetCategorias Then Application("GlobalDTGralCategorias") = ObjGenerales.DtResultados Else Application("GlobalDTGralCategorias") = Nothing + 'If ObjGenerales.GetCategorias Then Application("GlobalDTGralCategorias") = ObjGenerales.DtResultados Else Application("GlobalDTGralCategorias") = Nothing If ObjGenerales.GetCategorias(-1, 2) Then Application("GlobalDTFamilias") = ObjGenerales.DtResultados Else Application("GlobalDTFamilias") = Nothing If ObjGenerales.GetCategorias(-1, 3) Then Application("GlobalDTCategoriasPresupuestos") = ObjGenerales.DtResultados Else Application("GlobalDTCategoriasPresupuestos") = Nothing If ObjGenerales.GetCategorias(-1, 4) Then Application("GlobalDTCategorias2") = ObjGenerales.DtResultados Else Application("GlobalDTCategorias2") = Nothing diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 36eb12d5f..6d146dde9 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -932,11 +932,8 @@ Partial Class Inventarios_EntregaAlmacen If e.Row.RowType = DataControlRowType.DataRow Then 'código temporal - Dim AplicaSerie As Boolean = CBool(e.Row.DBCampo("AplicaSerie")) - If UsuarioActual.CveEmpresa = 140 AndAlso Not CveSubProyecto.Contiene(11791, 11793, 11993, 11994, 11794, 11797, 11795, 12010, 12011) Then - AplicaSerie = False - End If - + Dim AplicaSerie As Boolean = CBool(e.Row.DBCampo("AplicaSerie")) + If AplicaSerie Then e.Row.FCButton("BtnSerie").Visible = True e.Row.FCButton("BtnSerie").Text = "Serie" diff --git a/Inventarios/RepEntradasSalidas.aspx b/Inventarios/RepEntradasSalidas.aspx index e56681097..b2553c302 100644 --- a/Inventarios/RepEntradasSalidas.aspx +++ b/Inventarios/RepEntradasSalidas.aspx @@ -105,9 +105,9 @@
-
Solo con Movimientos
+
Opción
- + @@ -121,17 +121,24 @@
+
Categoría
+
+ +
Clasificación
-
PS
+
+
+ +
Producto
<%----%>
-
Marca
+
Marca
@@ -164,10 +171,7 @@
@@ -116,10 +116,17 @@ + + - + + + + + + diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index 63d67104c..b8dfdb1f9 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -41,7 +41,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } var ObjVentas = new ClsVentas(); - if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) + //if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) + //{ + + // if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0) + // { + // DtVentas = ObjVentas.DtResultados.FiltraParametros($"CveVenta={Request["CveVenta"].ToString().ToEntero()}"); + // } + // else + // { + // DtVentas = ObjVentas.DtResultados.Copy(); + // } + //} + if (ObjVentas.GetVentasPendientesCancelacion(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)) { if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0) @@ -55,7 +67,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } ObjVentas.Dispose(); - GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura IN(20,23) AND CveEstatusRefacturacion = 0"); + GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) @@ -89,13 +101,13 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total); if (resp.EnviarAcuse) { - Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();",TextoConfirmacion:"Enviar",TextoSegundoBoton:"Cancelar"); + Alert(resp.Mensaje, TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion();", TextoConfirmacion: "Enviar", TextoSegundoBoton: "Cancelar"); } else { Alert(resp.Mensaje); } - + } CargaDatos(); } @@ -115,22 +127,22 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas string Folio = GvRow.DataKey("Folio"); string TipoDocto = GvRow.DataKey("TipoDocto"); string Nombre = GvRow.DataKey("Nombre"); - + string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion"); if (CveVenta > 0 && Uuid != "") { - var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true); + var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true, FolioSustitucion); CargaDatos(); - if (respuesta.CveEstatus.Contiene(4,5)) + if (respuesta.CveEstatus.Contiene(4, 5)) { HdnLigaRefacturar.Value = respuesta.LigaRefacturacion; Alert(respuesta.Mensaje, JSBtnAceptar: $"RefacturarDocumento();"); } else { - Alert(respuesta.Mensaje,TipoMensaje.MsgAdvertencia); + Alert(respuesta.Mensaje, TipoMensaje.MsgAdvertencia); } - + //if (respuesta.IrARefacturar) //{ // Server.Transfer(respuesta.LigaRefacturacion); @@ -142,9 +154,78 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas //} } UPDatos.Update(); - + } - private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) + + protected void BtnCancelarDocumento_Click(object sender, EventArgs e) + { + this.HdnLigaRefacturar.Value = ""; + this.CveVenta = -1; + + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + string Total = GvRow.DataKey("Total"); + string SubTotal = GvRow.DataKey("SubTotal"); + string Uuid = GvRow.DataKey("FolioFiscal"); + string RFCCliente = GvRow.DataKey("RFCCliente"); + string Folio = GvRow.DataKey("Folio"); + string TipoDocto = GvRow.DataKey("TipoDocto"); + string Nombre = GvRow.DataKey("Nombre"); + string FolioSustitucion = GvRow.DataKey("FolioFiscalSustitucion"); + + if (CveVenta > 0 && Uuid != "") + { + var respCancelacion = CancelarDocumento(CveVenta, -1, CveCliente, Folio, Uuid, "", DateTime.Now, TipoDocto, Total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: true, FolioSustitucion: FolioSustitucion, CveEstatusRefacturacion: 2); + + if (!respCancelacion.HuboError) + { + var sb = new StringBuilder(); + var EnviarAcuse = false; + if (respCancelacion.CveEstatus > 0) + { + EnviarAcuse = true; + var CveEstatus = respCancelacion.CveEstatus; + var ObjVentas = new ClsVentas(); + if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa)) + { + sb.Append("El estatus de la factura fue cambiado a 'Cancelada'."); + } + else + { + sb.Append("Ocurrió un error al cambiar el estatus de la factura."); + } + ObjVentas.Dispose(); + sb.Append("El documento se canceló correctamente."); + sb.Append($"
Imprimir Acuse"); + sb.Append("

¿Desea enviar el Acuse de Cancelación al Cliente?"); + } + else + { + sb.Append(respCancelacion.Mensaje); + } + + if (EnviarAcuse) + { + Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, "BtnEnviarMailCancelacion();", TextoConfirmacion: "Enviar", TextoSegundoBoton: "Cancelar"); + } + else + { + Alert(sb.ToString()); + } + } + else + { + Alert(respCancelacion.Mensaje, TipoMensaje.MsgError); + } + + CargaDatos(); + } + UPDatos.Update(); + + } + private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false, string FolioSustitucion = "") { HdnLigaRefacturar.Value = ""; @@ -183,20 +264,20 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test"))) { - var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion); + var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion, FolioSustitucion: FolioSustitucion); //sb.AppendFormat("{0}
", respCancelacion.Mensaje); if (!respCancelacion.HuboError) { CveEstatus = respCancelacion.CveEstatus; retorno.EnviarAcuse = true; - + sb.Append("El documento se canceló correctamente."); sb.Append($"
Imprimir Acuse"); if (!EsRefacturacion) { sb.Append("

¿Desea enviar el Acuse de Cancelación al Cliente?"); - } + } } if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion) @@ -218,7 +299,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas { CveEstatus = 5; - var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion); + var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion, FolioSustitucion: FolioSustitucion); //sb.AppendFormat("{0}
", respCancelacion.Mensaje); if (!respCancelacion.HuboError) @@ -308,13 +389,17 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas retorno.Mensaje = sb.ToString(); return retorno; } - private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) + private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false, string FolioSustitucion = "", int CveEstatusRefacturacion = -1) { Modelos.Factura.MCancelacionVentaMensaje retorno = null; - var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true); + var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion: true); if (EsRefacturacion) { - retorno = factura.CancelarPorRefacturacion(1,""); + if (CveEstatusRefacturacion > 0) + { + factura.CveEstatusRefacturacion = CveEstatusRefacturacion; + } + retorno = factura.CancelarPorRefacturacion(factura.CveMotivoCancelacion, factura.MotivoCancelacion, FolioSustitucion: FolioSustitucion); } else { @@ -323,7 +408,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas return retorno; } - + private string DecodeBase64(string strXMLCodificado) { try @@ -372,7 +457,18 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas { if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) { - e.Row.Cells[10].Text = ""; + e.Row.Cells[14].Text = ""; + } + + if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23) + { + e.Row.FCLinkButton("LnkValidarRefac").Visible = false; + } + + if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0) + { + e.Row.FCLinkButton("LnkCancelar").Visible = true; + e.Row.FCLinkButton("LnkValidarRefac").Visible = false; } } } @@ -419,7 +515,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas byte[] ObjetoPDF = StreamPDF(@"Empresas\Grales\Formatos\AcuseCancelacion.rdlc", DtDatos, parametros, "AcuseCancelacion" + CveVenta); - + List LSRutasMail = new List(); string Asunto = string.Empty; string Cuerpo = string.Empty; @@ -485,11 +581,11 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } else { - Alert("El acuse de cancelación no pudo ser enviado.",TipoMensaje.MsgError); + Alert("El acuse de cancelación no pudo ser enviado.", TipoMensaje.MsgError); } } - + } } public class MRespuestaSAT diff --git a/Ventas/RepRemisiones.aspx.vb b/Ventas/RepRemisiones.aspx.vb index 48a87762a..2d67f4de7 100644 --- a/Ventas/RepRemisiones.aspx.vb +++ b/Ventas/RepRemisiones.aspx.vb @@ -91,7 +91,7 @@ Partial Class RepRemisiones Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString Dim ObjVentas As New ClsVentas - If ObjVentas.GetRepRemisionesSinFacturar(FechaI, FechaF, FechaV, Sucursales, CveCliente, CveContrato, Vendedores, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + If ObjVentas.GetRepRemisionesSinFacturar(FechaI, FechaF, FechaV, Sucursales, CveCliente, CveContrato, Vendedores, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, ConsultaInventario:=UsuarioActual.TienePermisoProceso(201)) Then DtVentas = ObjVentas.DtResultados.Copy() GvDatos.DataSource = DtVentas End If diff --git a/Ventas/RepRemisionesDetalle.aspx.vb b/Ventas/RepRemisionesDetalle.aspx.vb index 43fcb6801..9863874e9 100644 --- a/Ventas/RepRemisionesDetalle.aspx.vb +++ b/Ventas/RepRemisionesDetalle.aspx.vb @@ -158,7 +158,7 @@ Partial Class RepRemisionesDetalle CveContrato = If(DdlContrato.SelectedValue.ToEntero > 0, DdlContrato.SelectedValue.ToEntero, -1) CveSubProyecto = IIf(DdlSubProyectos.GetSelectedValuesM = "", "-1", DdlSubProyectos.GetSelectedValuesM).ToString - If ObjVentas.GetRepRemisionesSinFacturarDetalle(FechaI, FechaF, FechaV, CveCliente, CveContrato, CveVenta, UsuarioActual.CveEmpresa, CveSubProyecto, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + If ObjVentas.GetRepRemisionesSinFacturarDetalle(FechaI, FechaF, FechaV, CveCliente, CveContrato, CveVenta, UsuarioActual.CveEmpresa, CveSubProyecto, CveUsuarioConsulta:=UsuarioActual.CveUsuario, ConsultaInventario:=UsuarioActual.TienePermisoProceso(201)) Then If CveMoneda = 1 Or CveMoneda = 2 Then DtVentas = ObjVentas.DtResultados.FiltraParametros($"CveMoneda = {CveMoneda}") Else diff --git a/Ventas/RepVentasUtilidad.aspx b/Ventas/RepVentasUtilidad.aspx index fe815a36f..1f1d3c39f 100644 --- a/Ventas/RepVentasUtilidad.aspx +++ b/Ventas/RepVentasUtilidad.aspx @@ -177,6 +177,10 @@ --%>
+
Categoría
+
+ +
Clasificación:
diff --git a/Ventas/RepVentasUtilidad.aspx.vb b/Ventas/RepVentasUtilidad.aspx.vb index 966302f92..57b725bae 100644 --- a/Ventas/RepVentasUtilidad.aspx.vb +++ b/Ventas/RepVentasUtilidad.aspx.vb @@ -38,7 +38,7 @@ Partial Class Ventas_RepVentasUtilidad txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString 'Carga Clientes - Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + Dim EsWS As Boolean = True If EsWS Then DdlClientes.setEsWebService(True) DdlClientes.SelectedValue = "-1" @@ -63,6 +63,11 @@ Partial Class Ventas_RepVentasUtilidad DdlVendedor.Enabled = False End If + 'Cargo categorias + DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) + DdlCategoria.DataBind() + + 'Cargo Clasificaciones DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) DdlClasificacion.DataBind() @@ -133,6 +138,14 @@ Partial Class Ventas_RepVentasUtilidad txtFechaF.Text = CveGpo End Select End Sub + + + Protected Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs) + DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveCategoria:=DdlCategoria.SelectedValue.ToEntero) + DdlClasificacion.DataBind() + DdlClasificacion.Items.Insert(0, New ListItem("Todas", "-1")) + End Sub + #End Region #Region " CARGA DATOS " @@ -151,7 +164,7 @@ Partial Class Ventas_RepVentasUtilidad Dim Sucursales As String = IIf(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM).ToString Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString - If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlMarcas.SelectedValue.ToEntero) Then + If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlMarcas.SelectedValue.ToEntero) Then DtVentas = ObjVentas.DtResultados GvDatos.DataSource = ObjVentas.DtResultados GvDatos.DataBind() @@ -302,7 +315,7 @@ Partial Class Ventas_RepVentasUtilidad Dim Sucursales As String = IIf(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM).ToString Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString - If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlMarcas.SelectedValue.ToEntero) Then + If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlMarcas.SelectedValue.ToEntero) Then Dim FechaInicio As String = txtFechaI.Text Dim FechaFin As String = txtFechaF.Text diff --git a/Ventas/RepVentasUtilidadPadre.aspx b/Ventas/RepVentasUtilidadPadre.aspx index 63723e3ea..9c211461f 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx +++ b/Ventas/RepVentasUtilidadPadre.aspx @@ -79,24 +79,16 @@
-
Grupo:
-
- - - - - - - - - - - -
+
+ Sucursal: +
+
+ +
Fecha Inicio:
-
+
@@ -113,7 +105,7 @@
Fecha Fin:
-
+
@@ -127,17 +119,27 @@
+ +
Grupo:
+
+ + + + + + + + + + + +
+ +
+
+
+
+ Facturas Padre +
+
+
+
+ + + + + + + +
+
+ +
+
+
+
+ Facturas Hijo +
+
+
+
+ + + + + + + +
+
+ +
+
+
+
+
+ +
+
+ + + +
+
+
+
+ +
+
+ + +
+
@@ -7095,7 +7156,7 @@
-
+
@@ -7104,8 +7165,8 @@ @@ -7721,7 +7782,7 @@