diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index db77a2884..da3261896 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -48,6 +48,8 @@ Public Class CalendarEvent Public Property CveVenta As Integer Public Property SerieFolioVenta As String Public Property CveActivoFijo As Integer + Public Property CveTipoAF As Integer + Public Property AFCodigo As String Public Property CveMovimiento As Integer Public Property MovimientoFolio As String @@ -58,5 +60,6 @@ Public Class CalendarEvent Public Property Anticipo As Double Public Property CantidadPasajeros As String Public Property NumeroContrato As String + Public Property Observaciones As String End Class diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 8f973e376..176ed8ac9 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1159,10 +1159,7 @@ Public Class ClsBancos End If End If Mensaje = ObjTimbrado.MensajeErrorCFDI - - GuardaLog(ObjTimbrado.MensajeErrorCFDI) Timbre = Nothing - Else GuardaLog(Mensaje) End If diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index a2491dbad..4a59454ca 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -1630,7 +1630,7 @@ Public Class ClsCompras #Region "N O T A S - C R E D I T O" - Public Function GetNotasCreditoRep(CveProveedor As Integer, Opcion As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer, Optional TipoReporte As Integer = 1) As Boolean + Public Function GetNotasCreditoRep(CveProveedor As Integer, Opcion As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer, Optional TipoReporte As Integer = 1, Optional CveComprasAmortizadas As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -1643,6 +1643,8 @@ Public Class ClsCompras .Add("@FechaF", SqlDbType.VarChar).Value = FechaF .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@TipoReporte", SqlDbType.Int).Value = TipoReporte + .Add("@CveComprasAmortizadas", SqlDbType.VarChar).Value = CveComprasAmortizadas + End With @@ -1776,27 +1778,105 @@ Public Class ClsCompras End Function - Public Function AddFactura(Serie As String, Folio As String, FechaFactura As DateTime, NombreProveedor As String, RFCDe As String, SubTotal As Double, - IVA As Double, Total As Double, UUID As String, RFCPara As String, XML As String, PDF As String, - VersionCFD As String, Descuento As Double, Moneda As String, TipodeComprobante As String, TipoCambio As Double, FueValidado As Integer, - CveEmpresa As Integer, PreFijo As String) As Integer - Dim Retorno As Integer = -1 + Public Function AddBitacoraFactura(ByVal Serie As String, ByVal Folio As String, ByVal RFCDe As String, ByVal Observacion As String, ByVal Estatus As Integer, ByVal CveUsuario As Integer, ByVal CveEmpresa As Integer, ByVal Correo As String, ByVal Proveedor As String, ByVal Importe As Decimal, ByVal TipoDeComprobante As String) As Boolean - Dim StrSQL As StringBuilder = New StringBuilder() - StrSQL.Append(" BEGIN ") - StrSQL.Append(" DECLARE @tTotal INT; ") - StrSQL.Append(" ") - StrSQL.Append(" SELECT @tTotal = ISNULL(MAX(CveFactura),0) FROM Comp_Facturas WHERE UUID = @UUID;") - StrSQL.Append(" IF @tTotal = 0 ") - StrSQL.Append(" BEGIN ") - StrSQL.Append(" INSERT INTO Comp_Facturas (Serie, Folio, FechaFactura, NombreProveedor, RFCDe, Total, UUID, RFCPara, XML, PDF, FueValidado, CveEmpresa, TipoFactura,Version, TipoComprobante) ") - StrSQL.Append(" VALUES (@Serie, @Folio, @FechaFactura, @NombreProveedor, @RFCDe, @Total, @UUID, @RFCPara, @XML, @PDF, @FueValidado, @CveEmpresa, @PreFijo, @Version,@TipodeComprobante); ") - StrSQL.Append(" SET @Retorno = 1; ") - StrSQL.Append(" SET @CveFactura = SCOPE_IDENTITY(); ") - StrSQL.Append(" UPDATE Comp_Facturas SET XML = CONCAT(@CveFactura,'.xml'), PDF = CONCAT(@CveFactura ,'.pdf') WHERE CveFactura = @CveFactura; ") - StrSQL.Append(" END ") - StrSQL.Append(" ELSE BEGIN SET @CveFactura = @tTotal; END ") - StrSQL.Append(" END ") + Dim Retorno As Boolean = False + + + DataAdapter("PA_Comp_FacturasBitacoraAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@RFCDE", SqlDbType.VarChar).Value = If(RFCDe Is Nothing, "", RFCDe) + .Add("@Observacion", SqlDbType.VarChar).Value = Observacion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Correo", SqlDbType.VarChar).Value = Correo + .Add("@Proveedor", SqlDbType.VarChar).Value = Proveedor + .Add("@Importe", SqlDbType.Decimal).Value = Importe + .Add("@TipoDeComprobante", SqlDbType.VarChar).Value = TipoDeComprobante + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al intentar Guardar la bitácora.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + + + + 'Public Function AddFactura(Serie As String, Folio As String, FechaFactura As DateTime, NombreProveedor As String, RFCDe As String, SubTotal As Double, + 'IVA As Double, Total As Double, UUID As String, RFCPara As String, XML As String, PDF As String, + 'VersionCFD As String, Descuento As Double, Moneda As String, TipodeComprobante As String, TipoCambio As Double, FueValidado As Integer, + 'CveEmpresa As Integer, PreFijo As String) As Integer + ' Dim Retorno As Integer = -1 + + ' Dim StrSQL As StringBuilder = New StringBuilder() + ' StrSQL.Append(" BEGIN ") + ' StrSQL.Append(" DECLARE @tTotal INT; ") + ' StrSQL.Append(" ") + ' StrSQL.Append(" SELECT @tTotal = ISNULL(MAX(CveFactura),0) FROM Comp_Facturas WHERE UUID = @UUID;") + ' StrSQL.Append(" IF @tTotal = 0 ") + ' StrSQL.Append(" BEGIN ") + ' StrSQL.Append(" INSERT INTO Comp_Facturas (Serie, Folio, FechaFactura, NombreProveedor, RFCDe, Total, UUID, RFCPara, XML, PDF, FueValidado, CveEmpresa, TipoFactura,Version, TipoComprobante,) ") + ' StrSQL.Append(" VALUES (@Serie, @Folio, @FechaFactura, @NombreProveedor, @RFCDe, @Total, @UUID, @RFCPara, @XML, @PDF, @FueValidado, @CveEmpresa, @PreFijo, @Version,@TipodeComprobante); ") + ' StrSQL.Append(" SET @Retorno = 1; ") + ' StrSQL.Append(" SET @CveFactura = SCOPE_IDENTITY(); ") + ' StrSQL.Append(" UPDATE Comp_Facturas SET XML = CONCAT(@CveFactura,'.xml'), PDF = CONCAT(@CveFactura ,'.pdf') WHERE CveFactura = @CveFactura; ") + ' StrSQL.Append(" END ") + ' StrSQL.Append(" ELSE BEGIN SET @CveFactura = @tTotal; END ") + ' StrSQL.Append(" END ") + + ' If PreFijo.ToLower() = "cfdi" Then + ' PreFijo = "CFDi" + ' ElseIf PreFijo.ToLower() = "cfd" Then + ' PreFijo = "CFD" + ' End If + + ' DataAdapter(StrSQL.ToString(), CommandType.Text) + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@Serie", SqlDbType.VarChar).Value = Serie + ' .Add("@Folio", SqlDbType.VarChar).Value = Folio + ' .Add("@FechaFactura", SqlDbType.[Date]).Value = FechaFactura + ' .Add("@NombreProveedor", SqlDbType.VarChar).Value = NombreProveedor + ' .Add("@RFCDe", SqlDbType.VarChar).Value = RFCDe + ' .Add("@Total", SqlDbType.Money).Value = Total + ' .Add("@UUID", SqlDbType.VarChar).Value = UUID + ' .Add("@RFCPara", SqlDbType.VarChar).Value = RFCPara + ' .Add("@XML", SqlDbType.VarChar).Value = XML + ' .Add("@PDF", SqlDbType.VarChar).Value = PDF + ' .Add("@Version", SqlDbType.VarChar).Value = VersionCFD + ' .Add("@FueValidado", SqlDbType.Int).Value = FueValidado + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@PreFijo", SqlDbType.VarChar).Value = PreFijo + ' .Add("@TipodeComprobante", SqlDbType.VarChar).Value = TipodeComprobante.ToUpper + ' .Add("@CveFactura", SqlDbType.Int).Direction = ParameterDirection.Output + ' .Add("@Retorno", SqlDbType.Int).Direction = ParameterDirection.Output + ' End With + + + ' Try + ' SqlAdapter.Fill(Data) + + ' Retorno = SqlAdapter.SelectCommand.Parameters("@Retorno").Value.ToString().ToEntero() + + ' CveFactura = SqlAdapter.SelectCommand.Parameters("@CveFactura").Value.ToString().ToEntero() + ' Catch ex As Exception + ' ModExtensiones.OnError(Me, "Ocurrió un error al intentar Guardar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + + + Public Function AddFactura(Serie As String, Folio As String, FechaFactura As DateTime, NombreProveedor As String, RFCDe As String, SubTotal As Decimal, IVA As Decimal, Total As Decimal, UUID As String, RFCPara As String, XML As String, PDF As String, VersionCFD As String, Descuento As Decimal, TipoCambio As Decimal, FueValidado As Integer, CveEmpresa As Integer, PreFijo As String, TipoComprobante As String, MONEDA As String, METODODEPAGO As String, Optional TipoRecepcion As Integer = 0, Optional Version As String = "3.3", Optional IEPS As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0) As Integer + Dim Retorno As Integer = -1 If PreFijo.ToLower() = "cfdi" Then PreFijo = "CFDi" @@ -1804,40 +1884,50 @@ Public Class ClsCompras PreFijo = "CFD" End If - DataAdapter(StrSQL.ToString(), CommandType.Text) - With SqlAdapter.SelectCommand.Parameters - .Add("@Serie", SqlDbType.VarChar).Value = Serie - .Add("@Folio", SqlDbType.VarChar).Value = Folio - .Add("@FechaFactura", SqlDbType.[Date]).Value = FechaFactura - .Add("@NombreProveedor", SqlDbType.VarChar).Value = NombreProveedor - .Add("@RFCDe", SqlDbType.VarChar).Value = RFCDe - .Add("@Total", SqlDbType.Money).Value = Total - .Add("@UUID", SqlDbType.VarChar).Value = UUID - .Add("@RFCPara", SqlDbType.VarChar).Value = RFCPara - .Add("@XML", SqlDbType.VarChar).Value = XML - .Add("@PDF", SqlDbType.VarChar).Value = PDF - .Add("@Version", SqlDbType.VarChar).Value = VersionCFD - .Add("@FueValidado", SqlDbType.Int).Value = FueValidado - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@PreFijo", SqlDbType.VarChar).Value = PreFijo - .Add("@TipodeComprobante", SqlDbType.VarChar).Value = TipodeComprobante.ToUpper - .Add("@CveFactura", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@Retorno", SqlDbType.Int).Direction = ParameterDirection.Output - End With + DataAdapter("PA_eFacturas_FacturasAdd", CommandType.StoredProcedure) + SqlAdapter.SelectCommand.Parameters.Add("@Serie", SqlDbType.VarChar).Value = Serie + SqlAdapter.SelectCommand.Parameters.Add("@Folio", SqlDbType.VarChar).Value = Folio + SqlAdapter.SelectCommand.Parameters.Add("@FechaFactura", SqlDbType.Date).Value = FechaFactura + SqlAdapter.SelectCommand.Parameters.Add("@NombreProveedor", SqlDbType.VarChar).Value = NombreProveedor + SqlAdapter.SelectCommand.Parameters.Add("@RFCDe", SqlDbType.VarChar).Value = RFCDe + SqlAdapter.SelectCommand.Parameters.Add("@TipoComprobante", SqlDbType.VarChar).Value = TipoComprobante + SqlAdapter.SelectCommand.Parameters.Add("@Total", SqlDbType.Money).Value = Total + SqlAdapter.SelectCommand.Parameters.Add("@UUID", SqlDbType.VarChar).Value = UUID + SqlAdapter.SelectCommand.Parameters.Add("@RFCPara", SqlDbType.VarChar).Value = RFCPara + SqlAdapter.SelectCommand.Parameters.Add("@XML", SqlDbType.VarChar).Value = XML + SqlAdapter.SelectCommand.Parameters.Add("@PDF", SqlDbType.VarChar).Value = PDF + SqlAdapter.SelectCommand.Parameters.Add("@Version", SqlDbType.VarChar).Value = VersionCFD + SqlAdapter.SelectCommand.Parameters.Add("@FueValidado", SqlDbType.Int).Value = FueValidado + SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + SqlAdapter.SelectCommand.Parameters.Add("@PreFijo", SqlDbType.VarChar).Value = PreFijo + SqlAdapter.SelectCommand.Parameters.Add("@TipoRecepcion", SqlDbType.Int).Value = TipoRecepcion + SqlAdapter.SelectCommand.Parameters.Add("@CveFactura", SqlDbType.Int).Direction = ParameterDirection.Output + SqlAdapter.SelectCommand.Parameters.Add("@Retorno", SqlDbType.Int).Direction = ParameterDirection.Output + SqlAdapter.SelectCommand.Parameters.Add("@MONEDA", SqlDbType.VarChar).Value = MONEDA + SqlAdapter.SelectCommand.Parameters.Add("@METODODEPAGO", SqlDbType.VarChar).Value = METODODEPAGO + + SqlAdapter.SelectCommand.Parameters.Add("@TipoCambio", SqlDbType.SmallMoney).Value = TipoCambio + SqlAdapter.SelectCommand.Parameters.Add("@SubTotal", SqlDbType.Money).Value = SubTotal + SqlAdapter.SelectCommand.Parameters.Add("@IVA", SqlDbType.Money).Value = IVA + SqlAdapter.SelectCommand.Parameters.Add("@IEPS", SqlDbType.Money).Value = IEPS + SqlAdapter.SelectCommand.Parameters.Add("@RetIVA", SqlDbType.Money).Value = RetIVA + SqlAdapter.SelectCommand.Parameters.Add("@RetISR", SqlDbType.Money).Value = RetISR + SqlAdapter.SelectCommand.Parameters.Add("@Descuento", SqlDbType.Money).Value = Descuento Try SqlAdapter.Fill(Data) - Retorno = SqlAdapter.SelectCommand.Parameters("@Retorno").Value.ToString().ToEntero() + Retorno = Convert.ToInt32(SqlAdapter.SelectCommand.Parameters("@Retorno").Value) + CveFactura = Convert.ToInt32(SqlAdapter.SelectCommand.Parameters("@CveFactura").Value) - CveFactura = SqlAdapter.SelectCommand.Parameters("@CveFactura").Value.ToString().ToEntero() Catch ex As Exception ModExtensiones.OnError(Me, "Ocurrió un error al intentar Guardar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno End Function + Public Function UpdateArchivo(CveFactura As Integer, Columna As String) As Boolean Dim Retorno As Boolean = False Dim Str As String = "" @@ -1851,9 +1941,12 @@ Public Class ClsCompras DataAdapter(Str, CommandType.Text) Try SqlAdapter.Fill(Data) + + SqlAdapter.SelectCommand.Parameters.Add("@CveFactura", SqlDbType.Int).Value = CveFactura + Retorno = True Catch ex As Exception - ModExtensiones.OnError(Me, "Ocurrió un error al agregar el Tipo de Cambio", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ModExtensiones.OnError(Me, "Ocurrió un error al actualizar la factura", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno End Function diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 12007823c..1964dcf3a 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -6330,6 +6330,71 @@ Public Class ClsContabilidad Return Retorno End Function + +#End Region + +#Region "B L O Q U E O -- D I A R I O" + Public Function GetBloqueoDiario(CveBloqueoDiario As Integer, FechaI As DateTime, FechaF As DateTime, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_BloqueoDiarioGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBloqueoDiario", SqlDbType.Int).Value = CveBloqueoDiario + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el periodo de bloqueo diario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddUpdateBloqueoDiario(CveBloqueoDiario As Integer, Fecha As DateTime, Bloqueado As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_BloqueoDiarioAddUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBloqueoDiario", SqlDbType.Int).Value = CveBloqueoDiario + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@Bloqueado", SqlDbType.Bit).Value = Bloqueado + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al actulizar el periodo de bloqueo diario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveBloqueoDiario(CveBloqueoDiario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_BloqueoDiarioRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBloqueoDiario", SqlDbType.Int).Value = CveBloqueoDiario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el periodo de bloqueo diario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #End Region #Region "ESTADO RESULTADOS HORIZONTAL" @@ -6455,6 +6520,35 @@ Public Class ClsContabilidad Return Retorno End Function + + Public Function GetEstadosProyectoHorizontal(FechaI As Date, FechaF As Date, CveProyecto As Integer, Divisor As Integer, CveEmpresa As Integer, CveUsuario As Integer, Optional Tipo As Integer = 1, Optional VistaPorcentaje As Integer = 1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_EstadoResultadosProyectoHorizontal") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@Divisor", SqlDbType.Int).Value = Divisor + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@VistaPorcentaje", SqlDbType.Int).Value = VistaPorcentaje + End With + + SqlAdapter.SelectCommand.CommandTimeout = 0 + + Try + SqlAdapter.Fill(DSet) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el Estado de resultados Proyectos horizontal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #End Region Public Function UpdateTraspasoPrepoliza(CveEmpresa As Integer, CveCuenta As Integer, CveCuentaNueva As Integer) As Boolean diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4ebbbfb54..f3365603a 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4988,7 +4988,7 @@ Public Class ClsPaginas ObjUsuario.Dispose() Return Retorno End Function - Public Sub CargarCentrosDeCosto(DdlProyecto As ListControl, DdlSubProyecto As ListControl, LblProyecto As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListControl = Nothing, Optional divProyecto As HtmlControl = Nothing) + Public Sub CargarCentrosDeCosto(DdlProyecto As ListControl, DdlSubProyecto As ListControl, LblProyecto As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListControl = Nothing, Optional divProyecto As HtmlControl = Nothing, Optional VisualizacionReporte As Integer = -1) Select Case UsuarioActual.Empresa.Tipo_CentroCosto Case 1 @@ -5001,6 +5001,14 @@ Public Class ClsPaginas If LblProyecto IsNot Nothing Then LblProyecto.Visible = False If divProyecto IsNot Nothing Then divProyecto.Visible = False If LblSubProyecto IsNot Nothing Then LblSubProyecto.Text = "Sucursal" + If VisualizacionReporte = 1 Then + If UsuarioActual.Empresa.Funcionalidad(307) <> "" Then + If DdlProyecto IsNot Nothing Then DdlProyecto.Visible = True + If LblProyecto IsNot Nothing Then LblProyecto.Visible = True + If divProyecto IsNot Nothing Then divProyecto.Visible = True + If LblProyecto IsNot Nothing Then LblProyecto.Text = UsuarioActual.Empresa.Funcionalidad(307) + End If + End If Case 3 If DdlProyecto IsNot Nothing Then DdlProyecto.Visible = False If LblProyecto IsNot Nothing Then LblProyecto.Visible = False @@ -6175,7 +6183,9 @@ Public Class ClsPaginas namespaces.AddNamespace("cartaporte", "http://www.sat.gob.mx/CartaPorte") namespaces.AddNamespace("cartaporte20", "http://www.sat.gob.mx/CartaPorte20") namespaces.AddNamespace("cartaporte30", "http://www.sat.gob.mx/CartaPorte30") + namespaces.AddNamespace("cartaporte31", "http://www.sat.gob.mx/CartaPorte31") + Dim Nodos31 As XmlNode = XMLDoc.SelectSingleNode("//cartaporte31:CartaPorte", namespaces) Dim Nodos30 As XmlNode = XMLDoc.SelectSingleNode("//cartaporte30:CartaPorte", namespaces) Dim Nodos20 As XmlNode = XMLDoc.SelectSingleNode("//cartaporte20:CartaPorte", namespaces) @@ -6189,6 +6199,11 @@ Public Class ClsPaginas PrefijoCCP = "cartaporte20" End If + If Nodos31 IsNot Nothing Then + VersionCCP = "3.1" + PrefijoCCP = "cartaporte31" + End If + params.Add(New ReportParameter("CartaPorteVersion", VersionCCP)) Dim nodeComprobante As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", Prefijo), namespaces) @@ -7761,7 +7776,7 @@ Public Class ClsPaginas If CveSubProyectoEntrega > 0 Then - Dim DTSubProyectoEntrega As DataTable = GlobalDTSubProyectos(-1, CveSubProyectoEntrega) + Dim DTSubProyectoEntrega As DataTable = GlobalDTSubProyectos(-1, CveSubProyectoEntrega, UsuarioActual.CveEmpresa) params.Add(New ReportParameter("SubProyectoEntrega", DTSubProyectoEntrega(0)("SubProyecto").ToString)) @@ -10123,6 +10138,7 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad/CatContaEjercicios.aspx".ToUpper(), 725) PaginaDict.Add("/Contabilidad/RepEstadoResultadosHorizontal.aspx".ToUpper(), 420) PaginaDict.Add("/Contabilidad/RepAnexoCatalogoMensualHorizontal.aspx".ToUpper(), -1) + PaginaDict.Add("/Contabilidad/CatBloqueoDiario.aspx".ToUpper(), 680) #End Region #Region "Contratos" '--------------------- C O N T R A T O S - P R E S U P U E S T O S --------------------- @@ -10672,8 +10688,8 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepCotizaciones.aspx".ToUpper(), 430) PaginaDict.Add("/Ventas/RepCotizacionesDetalle.aspx".ToUpper(), 430) PaginaDict.Add("/Ventas/RepVentasPV.aspx".ToUpper(), 9) - PaginaDict.Add("/Ventas/RepVentaDetalle.aspx".ToUpper(), 9) - PaginaDict.Add("/Ventas/RepVentaDetalle.aspx?Menu=1".ToUpper(), 785) + PaginaDict.Add("/Ventas/RepVentasDetalle.aspx".ToUpper(), 9) + PaginaDict.Add("/Ventas/RepVentasDetalle.aspx?Menu=1".ToUpper(), 785) PaginaDict.Add("/Ventas/CatClasificaciones.aspx".ToUpper(), 12) PaginaDict.Add("/Ventas/CatClasificaciones2.aspx".ToUpper(), 396) PaginaDict.Add("/Ventas/CatClasificacionesDetalle.aspx".ToUpper(), 12) @@ -10767,7 +10783,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546) PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347) PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146) - + PaginaDict.Add("/Ventas/CatMotivosDevoluciones.aspx".ToUpper(), 786) #End Region @@ -10931,3 +10947,4 @@ Public Class ClsPaginas #End Region End Class + diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 7d26e4509..4323620af 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -454,7 +454,7 @@ Public Class ClsVentas Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1", Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False, Optional CveLineaAdicional As Integer = -1, Optional DescripcionVenta As String = "", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional CveTipoVenta As Integer = -1, Optional RequiereOS As Boolean = False, - Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional EsFacturaGlobal As Boolean = False, Optional CveSATPeriodicidad As Integer = -1, Optional CveSATMes As Integer = -1, Optional SATAnio As Integer = -1) As Boolean + Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional EsFacturaGlobal As Boolean = False, Optional CveSATPeriodicidad As Integer = -1, Optional CveSATMes As Integer = -1, Optional SATAnio As Integer = -1, Optional CveMotivoDevolucion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasAdd") @@ -568,6 +568,7 @@ Public Class ClsVentas .Add("@CveSATMes", SqlDbType.Int).Value = CveSATMes .Add("@SATAnio", SqlDbType.Int).Value = SATAnio .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue + .Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion End With 'SqlTypes.SqlDateTime.Null Try @@ -2757,6 +2758,87 @@ Public Class ClsVentas +#End Region + +#Region " M O T I V O S -- D E V O L U C I O N" + + Public Function AddMotivoDevolucion(Motivo As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasMotivosDevolucionAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Motivo", SqlDbType.VarChar).Value = Motivo + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al tratar de agregar el motivo de devolucion. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + + Public Function UpdateMotivoDevolucion(CveMotivoDevolucion As Integer, Motivo As String, Estatus As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasMotivosDevolucionUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion + .Add("@Motivo", SqlDbType.VarChar).Value = Motivo + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al tratar de actualizar el motivo de devolución. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function GetMotivoDevolucion(CveMotivoDevolucion As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasMotivosDevolucionGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al tratar de obtener el motivo de devolución. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function RemoveMotivoDevolucion(CveMotivoDevolucion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasMotivosDevolucionRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al tratar de obtener el motivo de devolución. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function #End Region Public Function GetPrecios(CveClasificacion As Integer, CvePS As Integer, CveEmpresa As Integer, CveSubProyecto As Integer) As Boolean diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 087ed3309..3084bd295 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -895,10 +895,10 @@ Public Class Timbrado Equivalencia = 1 'condiciones especiales para el pago en pesos, facturas en moneda extranjera ElseIf MonedaPago = "MXN" AndAlso VentaAbreviaturaSAT <> "MXN" Then - VentaTipoCambio = Math.Round(VentaTipoCambio, 6) + VentaTipoCambio = Math.Round(VentaTipoCambio, 10) Equivalencia = Math.Round((1 / VentaTipoCambio), 10) ElseIf MonedaPago = "USD" AndAlso VentaAbreviaturaSAT <> "USD" Then - VentaTipoCambio = Math.Round(VentaTipoCambio, 6) + VentaTipoCambio = Math.Round(VentaTipoCambio, 10) Equivalencia = VentaTipoCambio End If @@ -924,8 +924,8 @@ Public Class Timbrado .TasaOCuota = drp("PorcentajeImpuesto").ToString().ToDecimal, .Impuesto = drp("TipoImpuesto").ToString, .Importe = drp("Importe").ToString().ToDecimal.RoundSQL, - .BaseMN = (drp("Base").ToString.ToDecimal / Equivalencia).RoundSQL(6), - .ImporteMN = (drp("Importe").ToString.ToDecimal / Equivalencia).RoundSQL(6) + .BaseMN = (drp("Base").ToString.ToDecimal / Equivalencia).RoundSQL(2), + .ImporteMN = (drp("Importe").ToString.ToDecimal / Equivalencia).RoundSQL(2) } ) @@ -1050,7 +1050,7 @@ Public Class Timbrado If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then + If Not ClsPaginas.EsProduccion AndAlso (Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then AmbienteProductivo = False Clave = "12345678a" EmisorRFC = "EKU9003173C9" @@ -2553,30 +2553,29 @@ concep.DescripcionesEspecificas.NumeroSerie) Dim Carta As CFDICartaPorte = ObjCFDITimbre.Complementos.CartaPorte ''DATOS GENERALES - cfdi.CartaPorte30("", Carta.TranspInternac, Carta.RegimenAduanero, Carta.EntradaSalidaMercancia, Carta.PaisOrigenDestino, Carta.ViaEntradaSalida, Carta.TotalDistanciaRecorrida, Carta.RegistroISTMO, Carta.UbicacionPoloOrigen, Carta.UbicacionPoloDestino) - + cfdi.CartaPorte31("", Carta.TranspInternac, Carta.EntradaSalidaMercancia, Carta.PaisOrigenDestino, Carta.ViaEntradaSalida, Carta.TotalDistanciaRecorrida, Carta.RegistroISTMO, Carta.UbicacionPoloOrigen, Carta.UbicacionPoloDestino) 'UBICACIONES If Carta.Ubicaciones IsNot Nothing AndAlso Carta.Ubicaciones.Count > 0 Then - For Each ubica As CFDICartaPorteUbicacion In Carta.Ubicaciones - 'origen - cfdi.CartaPorte30Ubicacion(ubica.TipoUbicacion, ubica.IDUbicacion, ubica.RFCRemitenteDestinatario, ubica.NombreRemitenteDestinatario, ubica.NumRegIdTrib, ubica.ResidenciaFiscal, ubica.NumEstacion, ubica.NombreEstacion, ubica.NavegacionTrafico, ubica.FechaHoraSalidaLlegada, ubica.TipoEstacion, ubica.DistanciaRecorrida) - 'cfdi.CartaPorteOrigen(ubica.Origen.IDOrigen, ubica.Origen.RFCRemitente, ubica.Origen.NombreRemitente, ubica.NumRegIdTrib, ubica.Origen.ResidenciaFiscal, ubica.Origen.NumEstacion, ubica.Origen.NombreEstacion, ubica.Origen.NavegacionTrafico, ubica.Origen.FechaHoraSalida) - cfdi.CartaPorte30Domicilio(ubica.Domicilio.Calle, ubica.Domicilio.NumeroExterior, ubica.Domicilio.NumeroInterior, ubica.Domicilio.Colonia, ubica.Domicilio.Localidad, ubica.Domicilio.Referencia, ubica.Domicilio.Municipio, ubica.Domicilio.Estado, ubica.Domicilio.Pais, ubica.Domicilio.CP) - Next - End If + For Each ubica As CFDICartaPorteUbicacion In Carta.Ubicaciones + 'origen + cfdi.CartaPorte31Ubicacion(ubica.TipoUbicacion, ubica.IDUbicacion, ubica.RFCRemitenteDestinatario, ubica.NombreRemitenteDestinatario, ubica.NumRegIdTrib, ubica.ResidenciaFiscal, ubica.NumEstacion, ubica.NombreEstacion, ubica.NavegacionTrafico, ubica.FechaHoraSalidaLlegada, ubica.TipoEstacion, ubica.DistanciaRecorrida) + 'cfdi.CartaPorteOrigen(ubica.Origen.IDOrigen, ubica.Origen.RFCRemitente, ubica.Origen.NombreRemitente, ubica.NumRegIdTrib, ubica.Origen.ResidenciaFiscal, ubica.Origen.NumEstacion, ubica.Origen.NombreEstacion, ubica.Origen.NavegacionTrafico, ubica.Origen.FechaHoraSalida) + cfdi.CartaPorte31Domicilio(ubica.Domicilio.Calle, ubica.Domicilio.NumeroExterior, ubica.Domicilio.NumeroInterior, ubica.Domicilio.Colonia, ubica.Domicilio.Localidad, ubica.Domicilio.Referencia, ubica.Domicilio.Municipio, ubica.Domicilio.Estado, ubica.Domicilio.Pais, ubica.Domicilio.CP) + Next + End If 'MERCANCIAS If Carta.Mercancias IsNot Nothing Then - cfdi.CartaPorte30Mercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion, Carta.Mercancias.LogisticaInversaRecoleccionDevolucion) + cfdi.CartaPorte31Mercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion, Carta.Mercancias.LogisticaInversaRecoleccionDevolucion) If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias If concep.ValorMercancia <= 0 Then concep.Moneda = "" - cfdi.CartaPorte30Mercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), + cfdi.CartaPorte31Mercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), concep.SectorCOFEPRIS, concep.NombreIngredienteActivo, concep.NomQuimico, concep.DenominacionGenericaProd, concep.DenominacionDistintivaProd, concep.Fabricante, concep.FechaCaducidad, concep.LoteMedicamento, concep.FormaFarmaceutica, concep.CondicionesEspTransp, concep.RegistroSanitarioFolioAutorizacion, If(Carta.TranspInternac <> "No", concep.PermisoImportacion, ""), If(Carta.TranspInternac <> "No", concep.FolioImpoVUCEM, ""), concep.NumCAS, If(Carta.TranspInternac <> "No", concep.RazonSocialEmpImp, ""), concep.NumRegSanPlagCOFEPRIS, concep.DatosFabricante, concep.DatosFormulador, concep.DatosMaquilador, concep.UsoAutorizado, concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt, concep.TipoMateria, If(concep.TipoMateria = "05", concep.TipoMateriaDescripcion, "")) For Each transp As CFDICartaPorteMercanciaTransporta In concep.MercanciasCantidadTransporta - cfdi.CartaPorte30CantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) + cfdi.CartaPorte31CantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) Next Next End If @@ -2586,40 +2585,38 @@ concep.DescripcionesEspecificas.NumeroSerie) If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then - cfdi.CartaPorte30Autotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT) + cfdi.CartaPorte31Autotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT) - cfdi.CartaPorte30IdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PesoBrutoVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM) + cfdi.CartaPorte31IdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PesoBrutoVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM) If Carta.Mercancias.Mercancias.Max(Function(x) x.MaterialPeligroso) = "" Then 'si no hay material peligro se limpian los valores Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente = "" Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente = "" End If - cfdi.CartaPorte30Seguros(Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil, + cfdi.CartaPorte31Seguros(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.CartaPorte30Remolque(concep.SubTipoRemolque, concep.Placa) + cfdi.CartaPorte31Remolque(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.CartaPorte30TiposFigura(concep.TipoFigura, concep.RFCFigura, concep.NumLicencia, concep.NombreFigura, concep.NumRegidTribFigura, If(concep.ResidenciaFiscalFigura <> "MEX", concep.ResidenciaFiscalFigura, "")) + cfdi.CartaPorte31TiposFigura(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.CartaPorte30PartesTransporte("PT01") - cfdi.CartaPorte30PartesTransporteDomicilio(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) + cfdi.CartaPorte31PartesTransporte("PT01") + cfdi.CartaPorte31PartesTransporteDomicilio(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 End If - - #End Region #Region "C O M P L E M E N T O D E P A G O" @@ -2868,8 +2865,7 @@ concep.DescripcionesEspecificas.NumeroSerie) UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL" - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then - + If Not ClsPaginas.EsProduccion AndAlso (Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then EmisorRFC = "EKU9003173C9" UsuarioActual.Empresa.Empresa = "ESCUELA KEMPER URGATE" ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}\1\Certificados\EKU9003173C9.key" @@ -3098,9 +3094,7 @@ concep.DescripcionesEspecificas.NumeroSerie) Dim TimbraProduccion As Boolean = True If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo) - - If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 OrElse Not ClsPaginas.EsProduccion Then - + If Not ClsPaginas.EsProduccion AndAlso (Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then EmisorRFC = "EKU9003173C9" UsuarioActual.Empresa.Empresa = "ESCUELA KEMPER URGATE" ArchivoLLave = $"{Extensiones.ModExtensiones.DirectorioEmpresas}\1\Certificados\EKU9003173C9.key" diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index e3cf0a3af..10d354956 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -450,8 +450,8 @@ Namespace Extensiones ToastInformacion = 5 'succes ToastInformacionB = 6 'info ToastError = 7 'error - ToastAdventencia = 8 'Warning - + ToastAdventencia = 8 'Warning + End Enum Public Sub Alert(Obj As Object, Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "", Optional TextoConfirmacion As String = "Aceptar", Optional TextoCancelacion As String = "Cancelar", Optional TimeoutToast As Integer = 5, Optional ShowCloseButton As Boolean = True, Optional TextoSegundoBoton As String = "", Optional JSBtn2 As String = "") @@ -622,6 +622,45 @@ Namespace Extensiones Return String.Format("
  • {0}{3}
  • ", Time, Tipo, Ico, Mensaje, Link, If(tonewpage, "target=""_blank""", "")) End Function + Public Function EnviarNotificacionWhatsApp(NumeroTelefono As String, Mensaje As String) As Boolean + Dim RetornoObj As String = "{}" + Dim Retorno As Boolean = False + Try + Dim TokenAutorizacion As String = "Bearer EAAVcZB36KfEEBO0OlN5ZAUPhNAUZCsHuMbpeVrrxZCJZAacLgBMOXXXcyA6aLEbbANMjbeTuJbsZC4IAvsZBwEALCYqc7oZCrnHF67sc0RYMBru9R0YKBFhi8gFjZAhJgoCJauBdZA30R9YPXZA2ZByQZAKclRCL20VLu74HEtw3YKu1MiG1vEsZANWJZAHhcJCUANUs3zIMFvoC6dBoJgQsABEZAYYZD" + Using httpClient = New HttpClient() + Using request = New HttpRequestMessage(HttpMethod.Post, New Uri("https://graph.facebook.com/v20.0/263533173499868/messages")) + + request.Headers.Add("Authorization", TokenAutorizacion) + Dim json = New Newtonsoft.Json.Linq.JObject() + json.Add(New Newtonsoft.Json.Linq.JProperty("messaging_product", "whatsapp")) + json.Add(New Newtonsoft.Json.Linq.JProperty("to", NumeroTelefono)) + json.Add(New Newtonsoft.Json.Linq.JProperty("type", "text")) + Dim msgtexto As New Newtonsoft.Json.Linq.JObject( + New Newtonsoft.Json.Linq.JProperty("preview_url", "true"), + New Newtonsoft.Json.Linq.JProperty("body", Mensaje.Replace("
    ", "\n")) + ) + json.Add(New Newtonsoft.Json.Linq.JProperty("text", msgtexto)) + + Using content = New StringContent(json.ToString, Encoding.UTF8, "application/json") + request.Content = content + Dim response = httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result + + If response.StatusCode = Net.HttpStatusCode.OK Then + RetornoObj = response.Content.ReadAsStringAsync().Result + Retorno = True + End If + End Using + + End Using + + End Using + Catch ex As Exception + RetornoObj = New Newtonsoft.Json.Linq.JObject(New Newtonsoft.Json.Linq.JProperty("Error", ex.ToString())).ToString() + GuardaLog("Ocurrió un error al enviar la informacion por whatsapp" & ex.Message) + End Try + Return Retorno + End Function + #End Region #Region "files dropzone" @@ -1978,6 +2017,12 @@ Namespace Extensiones End Sub + + Public Function CopyToDataTable(Of T)(ByVal source As IEnumerable(Of T), ByVal flag As Boolean) As DataTable + Return New ObjectShredder(Of T)().Shred(source, Nothing, Nothing) + End Function + + Public Sub ExportToExcel2(GridView As GridView, NombreArchivoXLSX As String) diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index ed78666f4..d5dbda671 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -1,4 +1,4 @@ -<%@ WebHandler Language="VB" Class="CargaEventos" %> +<%@ WebHandler Language="VB" Class="CargaEventos" %> Option Explicit Off Option Strict On @@ -78,18 +78,19 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.CveOS = dr("CveOS").ToString.ToEntero cevent.allDay = False If dr("EstatusOSGral").ToString.Contiene("Levantamiento") Then - cevent.backgroundColor = "#006699" + cevent.backgroundColor = "#3598dc" ElseIf dr("EstatusOSGral").ToString.Contiene("Surtido") Then cevent.backgroundColor = "#002699" ElseIf dr("EstatusOSGral").ToString.Contiene("Asignado") Then - cevent.backgroundColor = "#025716" + cevent.backgroundColor = "#8E44AD" ElseIf dr("EstatusOSGral").ToString.Contiene("Finalizado") Then - cevent.backgroundColor = "#730505" + cevent.backgroundColor = "#26C281" ElseIf dr("EstatusOSGral").ToString.Contiene("Facturado") Then - cevent.backgroundColor = "#006699" + cevent.backgroundColor = "#4B77BE" ElseIf dr("EstatusOSGral").ToString.Contiene("Cobrado") Then - cevent.backgroundColor = "#007699" + cevent.backgroundColor = "#29b4b6" ElseIf dr("EstatusOSGral").ToString.Contiene("Cancelado") Then + cevent.backgroundColor = "#e43a45" End If events.Add(cevent) Next @@ -488,7 +489,13 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState DT_SubProyectos.Columns.Add("backgroundColor") DT_EstatusOS.Columns.Add("", GetType(Integer)) - If ObjContratos.GetContratos(-1, usuarioActual_.CveEmpresa, TipoContrato:=34) Then + Dim cveContrato As Integer = -1 + + If context.Request("cveContrato") IsNot Nothing Then + cveContrato = context.Request("cveContrato").ToEntero() + End If + + If ObjContratos.GetContratos(cveContrato, usuarioActual_.CveEmpresa, TipoContrato:=34) Then If ObjContratos.DtResultados.Rows.Count > 0 Then @@ -511,10 +518,12 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.Dolares = dr("Importe").ToString.ToDecimal cevent.Pesos = dr("ImporteMax").ToString.ToDecimal cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal - cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero + cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero + cevent.CveTipoAF = dr("CveTipoAF").ToString.ToEntero cevent.backgroundColor = dr("BackgroundColor").ToString cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString cevent.NumeroContrato = dr("NumeroContrato").ToString + cevent.Observaciones = dr("Observaciones").ToString If Not cevent.recurrenciatipo > 0 Then @@ -573,6 +582,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.CveCliente = dr("CveCliente").ToString.ToEntero cevent.NombreComercial = dr("NombreComercial").ToString cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.CvePersonal = dr("CveChofer").ToString.ToEntero @@ -599,6 +609,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.allDay = False diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index cee2a6026..994c995bb 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -373,6 +373,7 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Dim Mail As String = "-1" Dim DtSucursales As DataTable = Nothing + Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Using ObjClientes As New ClsClientes If ObjClientes.GetListaSucursales(RFC, CveEmpresa) Then @@ -1764,6 +1765,7 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Dim Retorno As Boolean = True Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios @@ -1796,6 +1798,8 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Dim Retorno As Boolean = False Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios 'OBTERNER PRECIOS DE PUBLICO GENERAL @@ -1889,7 +1893,7 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Dim payload = New JObject() Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 - + Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios 'OBTERNER PRECIOS DE PUBLICO GENERAL @@ -1966,6 +1970,7 @@ Public Class E141 : Implements IHttpHandler, System.Web.SessionState.IRequiresSe Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + Dim DtPS As DataTable = Nothing Using ObjPS As New ClsProductosServicios 'OBTERNER PRECIOS DE PUBLICO GENERAL diff --git a/Bancos/ConciliacionesBancarias.aspx.vb b/Bancos/ConciliacionesBancarias.aspx.vb index 3b372de36..8394d6218 100644 --- a/Bancos/ConciliacionesBancarias.aspx.vb +++ b/Bancos/ConciliacionesBancarias.aspx.vb @@ -571,7 +571,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx Dim Dt1 As New DataTable Dt1 = DtDatos.FiltraParametros($"FueConciliado = 0 And Tipo = 'Abono'") - Dim TotalDt1 As Double = Dt1.SUM("Importe") + Dim TotalDt1 As Decimal = Dt1.SUMD("Importe") Dim Row1 As DataRow = Dt1.NewRow Row1("Importe") = TotalDt1 @@ -581,7 +581,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx Dim Dt2 As New DataTable Dt2 = DtDatosEdoCuenta.FiltraParametros($"FueConciliado = 0 And Tipo = 'Abono'") - Dim TotalDt2 As Double = Dt2.SUM("Importe") + Dim TotalDt2 As Decimal = Dt2.SUMD("Importe") Dim Row2 As DataRow = Dt2.NewRow Row2("Importe") = TotalDt2 @@ -591,7 +591,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx Dim Dt3 As New DataTable Dt3 = DtDatos.FiltraParametros($"FueConciliado = 0 And Tipo = 'Cargo'") - Dim TotalDt3 As Double = Dt3.SUM("Importe") + Dim TotalDt3 As Decimal = Dt3.SUMD("Importe") Dim Row3 As DataRow = Dt3.NewRow Row3("Importe") = TotalDt3 @@ -601,7 +601,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx Dim Dt4 As New DataTable Dt4 = DtDatosEdoCuenta.FiltraParametros($"FueConciliado = 0 And Tipo = 'Cargo'") - Dim TotalDt4 As Double = Dt4.SUM("Importe") + Dim TotalDt4 As Decimal = Dt4.SUMD("Importe") Dim Row4 As DataRow = Dt4.NewRow Row4("Importe") = TotalDt4 @@ -628,7 +628,7 @@ Partial Class Bancos_ConciliacionesBancariasaspx lrds.Add(rds4) params.Add(New ReportParameter("SaldoFinalEstadoCuenta", (TxtSaldoFinal.Text.FormatoNumero))) - Dim SaldoFinalLibros As Double = (TxtSaldoFinal.Text.ToDouble - TotalDt1 + TotalDt2 + TotalDt3 - TotalDt4) + Dim SaldoFinalLibros As Decimal = (TxtSaldoFinal.Text.ToDecimal - TotalDt1 + TotalDt2 + TotalDt3 - TotalDt4) params.Add(New ReportParameter("SaldoFinalLibros", SaldoFinalLibros.FormatoNumero)) Dim SaldoFinalContabilidad As Double = 0 diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index f5244df41..0338bb999 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -52,7 +52,7 @@ Partial Class Bancos_DepositosCaja DdlCajaChica.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) DdlCajaChica.DataBind() 'código temporal, para claudia y toñita, monge, anadelia, alba,patricia - If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then + If UsuarioActual.TienePermisoProceso(383) Then 'UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then DdlCajaChica.Items.Add(New ListItem("Todas", "-1")) DdlCuentaDeposito.Items.Add(New ListItem("Cuadre Solidaridad", "7850")) DdlCuentaDeposito.Items.Add(New ListItem("Cuadre Obregón", "7853")) @@ -312,7 +312,7 @@ Partial Class Bancos_DepositosCaja 'End If 'código temporal, para claudia y toñita, monge, anadelia, alba,patricia - If UsuarioActual.CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then + If UsuarioActual.TienePermisoProceso(383) Then 'CveUsuario.Contiene(1937, 2452, 3358, 3033, 2897, 2560) Then FolioIE = TxtFolio.Text.ToEntero End If diff --git a/Bancos/PagoAcreedor.aspx b/Bancos/PagoAcreedor.aspx index 704c2ed38..56deee488 100644 --- a/Bancos/PagoAcreedor.aspx +++ b/Bancos/PagoAcreedor.aspx @@ -272,7 +272,8 @@
    - + +
    @@ -284,7 +285,7 @@
    - +
    @@ -637,7 +638,21 @@ txt.value = ""; } - $get('TxtImporte').value = FormatoNumero(SumaValores(CveMonedaPago), 2); + let Suma = SumaValores(CveMonedaPago); + let TxtDDImporte; + if ($('#TxtDDImporte').length > 0) { + TxtDDImporte = parseFloat($('#TxtDDImporte').val().replace(/,/g, '')); + } else { + TxtDDImporte = 0; // Asigna un valor por defecto si el elemento no existe + } + + //let TxtDDImporte = parseFloat($('#TxtDDImporte').val().replace(/,/g, '')); + + if (!isNaN(TxtDDImporte)) { + Suma = Suma + TxtDDImporte; + } + + $get('TxtImporte').value = FormatoNumero(Suma, 2); } function FnCambia(chk, txt, saldo, op, text, CveMonedaPago) { @@ -653,7 +668,21 @@ txt.value = saldo; alert(text); } - var Suma = SumaValores(CveMonedaPago); + + let Suma = SumaValores(CveMonedaPago); + + //let TxtDDImporte = parseFloat($('#TxtDDImporte').val().replace(/,/g, '')); + let TxtDDImporte; + if ($('#TxtDDImporte').length > 0) { + TxtDDImporte = parseFloat($('#TxtDDImporte').val().replace(/,/g, '')); + } else { + TxtDDImporte = 0; // Asigna un valor por defecto si el elemento no existe + } + + if (!isNaN(TxtDDImporte) ) { + Suma = Suma + TxtDDImporte; + } + $get('TxtImporte').value = FormatoNumero(Suma, 2); if ($get('TxtTotal') != null) { @@ -720,6 +749,28 @@ return Importe } } + + + function validaDeudoresDiversos(CveMoneda) { + + $get('TxtImporte').value = FormatoNumero(SumaValores(CveMoneda), 2) + + let TxtImporte = parseFloat($get('TxtImporte').value.replace(/,/g, '')); + let TxtDDImporte = parseFloat($get('TxtDDImporte').value.replace(/,/g, '')); + + + + if (isNaN(TxtImporte) || isNaN(TxtDDImporte)) { + return; + } + let resultado = TxtImporte + TxtDDImporte; + + $get('TxtImporte').value = resultado.toFixed(2); + // $('#TxtDDImporte').val(TxtDDImporte.toFixed(2)); + + + } + diff --git a/Bancos/PagoAcreedor.aspx.cs b/Bancos/PagoAcreedor.aspx.cs index d72929c9c..dbae5d93f 100644 --- a/Bancos/PagoAcreedor.aspx.cs +++ b/Bancos/PagoAcreedor.aspx.cs @@ -6,6 +6,7 @@ using System.Text; using System.Web; using System.Web.UI.WebControls; using static Extensiones.ModExtensiones; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; public partial class Bancos_PagoAcreedor : ClsPaginas { @@ -140,6 +141,10 @@ public partial class Bancos_PagoAcreedor : ClsPaginas Folio = bancos.GetNextFolio(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero()); bancos.Dispose(); TxtFolio.Text = Folio.ToString(); + + + TxtDDImporte.Attributes.Add("onblur",$"validaDeudoresDiversos({CveMonedaCuentaPago});FormatoMoneda(this);"); + UpDatos.Update(); } protected void DdlProveedores_selectedindexchange(object sender, EventArgs e) @@ -345,12 +350,13 @@ public partial class Bancos_PagoAcreedor : ClsPaginas MsgError = "No se pudo insertar concepto de diferencia cambiaria"; } - if (ImporteComision != 0 && MsgError == "") + if (ImporteComision != 0 && MsgError == "" && DdlOtrosPagos.SelectedValue == "2" ) { + ImporteComisionMN = (ImporteComision * TCPago).RoundSQL(); int tTipoConceptoOtro = 255; - if (DdlOtrosPagos.SelectedValue == "3") tTipoConceptoOtro = 43; //deudores diversos + //if (DdlOtrosPagos.SelectedValue == "3") tTipoConceptoOtro = 43; //deudores diversos if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoComision, ImporteComision, ImporteComisionMN, tTipoConceptoOtro, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(),CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) { MsgError = "No se pudo insertar concepto de pago acreedor"; @@ -360,6 +366,39 @@ public partial class Bancos_PagoAcreedor : ClsPaginas } } + if (TxtDDImporte.Text.ToDecimal() != 0 && MsgError == "" && DdlOtrosPagos.SelectedValue == "3") + { + ImporteComision = TxtDDImporte.Text.ToDecimal(); + ImporteComisionMN = ImporteComision; + + if (TxtDDImporte.Text.ToDecimal() < 0) + { + TipoMovtoComision = true; + ImporteComision = ImporteComision * -1; + ImporteComisionMN = ImporteComisionMN * -1; + } + else + { + TipoMovtoComision = false; + } + + //Decimal TC = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToDecimal(); + //int tCveMoneda = get_GlobalDTBancosCuentas(-1, DdlCuenta.SelectedValue.ToEntero()).FiltroPrimeroValor("CveMoneda").ToEntero(); + //CveMonedaPago + + ImporteComision = ImporteComision.RoundSQL(); + ImporteComisionMN = (ImporteComision * TCPago).RoundSQL() ; + + ImporteComisionMN = (ImporteComision * TCPago).RoundSQL(); + + + int tTipoConceptoOtro = 43; //deudores diversos + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoComision, ImporteComision, ImporteComisionMN, tTipoConceptoOtro, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) + { + MsgError = "No se pudo insertar concepto de pago acreedor"; + } + } + if (CveMonedaPago != 1) { ImporteComplementaria = (ImporteBanco * TCPago - ImporteBanco).RoundSQL(); @@ -767,7 +806,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas divDD.Visible = false; if (DdlOtrosPagos.SelectedValue == "2") { - TxtOtrosImportes.Visible = true; + TxtOtrosImportes.Visible = true; TxtTotal.Visible = true; GvMovAcreedor.Columns[8].Visible = true; TxtOtrosImportes.Text = ""; diff --git a/Bancos/RepCxCCliente.aspx.vb b/Bancos/RepCxCCliente.aspx.vb index 87d5a678c..e11bc10ef 100644 --- a/Bancos/RepCxCCliente.aspx.vb +++ b/Bancos/RepCxCCliente.aspx.vb @@ -7,6 +7,10 @@ Partial Class Bancos_RepCxCCliente Private Property DtDatos As DataTable Get + If ViewState("DtDatos") Is Nothing Then + ViewState("DtDatos") = New DataTable + End If + Return CType(ViewState("DtDatos"), DataTable) End Get Set(value As DataTable) @@ -51,6 +55,7 @@ Partial Class Bancos_RepCxCCliente CargaDatos() End Sub Private Sub CargaDatos() + DtDatos = New DataTable Dim Mov As New ClsMovimientos Dim FechaI, FechaF As String Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1) @@ -63,6 +68,7 @@ Partial Class Bancos_RepCxCCliente If Mov.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveUsuario, Cuenta:=Cuenta, EstatusFactura:=DdlEstatusFactura.SelectedValue.ToEntero) Then GvCxC.DataSource = Mov.DtResultados + DtDatos = Mov.DtResultados End If UsuarioActual.Sesion("CobroCliente-Sucursal") = DdlSubProyecto.SelectedValue @@ -137,7 +143,7 @@ Partial Class Bancos_RepCxCCliente 'OBTENEMOS LOS DATOS Dim ObjMovtos As New ClsMovimientos() - Dim DTpp As DataTable + Dim FI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) Dim FF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) Dim FechaI, FechaF As String @@ -146,13 +152,14 @@ Partial Class Bancos_RepCxCCliente If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" Dim CveCliente = If(DdlClientesWS.SelectedValue.ToEntero > 0, DdlClientesWS.SelectedValue.ToEntero, -1) - If ObjMovtos.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, Cuenta:=TxtCuenta.Text) Then - DTpp = ObjMovtos.DtResultados - Else - DTpp = Nothing - End If - If DTpp.Rows.Count > 0 Then - Dim dr As DataRow = DTpp.Rows(0) + 'If ObjMovtos.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, Cuenta:=TxtCuenta.Text) Then + ' DTpp = ObjMovtos.DtResultados + 'Else + ' DTpp = Nothing + 'End If + + If DtDatos.Rows.Count > 0 Then + Dim dr As DataRow = DtDatos.Rows(0) Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("FechaInicio", FI)) @@ -161,7 +168,7 @@ Partial Class Bancos_RepCxCCliente params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToString)) params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) - ImprimirPDF("Empresas/Grales/Formatos/RepPagoClientes.rdlc", DTpp, params, "ReportePagoClientes") + ImprimirPDF("Empresas/Grales/Formatos/RepPagoClientes.rdlc", DtDatos, params, "ReportePagoClientes") Else Alert("No se tienen registrados movimientos", TipoMensaje.MsgAdvertencia) End If diff --git a/Bin/GoCfdi.dll b/Bin/GoCfdi.dll index 5ef366436..2f89b7c04 100644 Binary files a/Bin/GoCfdi.dll and b/Bin/GoCfdi.dll differ diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 32c51a0c3..60aa183be 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -540,15 +540,15 @@ -
    + <%--
    Remisión Nota de Crédito
    - + - - <%----%> +
    -
    + +
    --%> @@ -875,6 +875,7 @@
    + @@ -954,6 +955,51 @@ + + +
    + + + + + + + + + Factura + + + + + + Fecha + + + + + + Saldo + + + + + + + Moneda + +   + + + + +
    + + + +
    +
    diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 46dc9e0b8..8485f0651 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -12,6 +12,7 @@ Imports Extensiones Imports MoreLinq Imports System.Data.SqlClient Imports ClsPaginas +Imports System.Activities.Expressions Partial Class Compras_Compras Inherits ClsPaginas @@ -1192,17 +1193,7 @@ Partial Class Compras_Compras End Set End Property - Private Property ImporteRNCSaldar As Decimal - Get - If ViewState("ImporteRNCSaldar") Is Nothing Then - ViewState("ImporteRNCSaldar") = 0D - End If - Return ViewState("ImporteRNCSaldar").ToString.ToDecimal - End Get - Set(value As Decimal) - ViewState("ImporteRNCSaldar") = value - End Set - End Property + Private Property DTRemisionesNotaDeCredito As DataTable Get @@ -1220,53 +1211,10 @@ Partial Class Compras_Compras End Property - Private Property SerieFolioProntoPago As String - Get - If ViewState("SerieFolioProntoPago") Is Nothing Then - ViewState("SerieFolioProntoPago") = "" - End If - Return ViewState("SerieFolioProntoPago").ToString - End Get - Set(value As String) - ViewState("SerieFolioProntoPago") = value - End Set - End Property - Private Property TipoCambioProntoPago As Decimal - Get - If ViewState("TipoCambioProntoPago") Is Nothing Then - ViewState("TipoCambioProntoPago") = 0D - End If - Return ViewState("TipoCambioProntoPago").ToString.ToDecimal - End Get - Set(value As Decimal) - ViewState("TipoCambioProntoPago") = value - End Set - End Property - Private Property FechaProntoPago As Date - Get - If ViewState("FechaProntoPago") Is Nothing Then - ViewState("FechaProntoPago") = MinFecha - End If - Return ViewState("FechaProntoPago").ToString.ToDate - End Get - Set(value As Date) - ViewState("FechaProntoPago") = value - End Set - End Property - Private Property CveMonedaProntoPago As Integer - Get - If ViewState("CveMonedaProntoPago") Is Nothing Then - ViewState("CveMonedaProntoPago") = 0D - End If - Return ViewState("CveMonedaProntoPago").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveMonedaProntoPago") = value - End Set - End Property + 'ImporteRNCSaldar = 0 'SerieFolioProntoPago = "" @@ -1278,6 +1226,17 @@ Partial Class Compras_Compras #End Region + 'Public Property ListaFacturasRealcionadasRNC As List(Of String) + ' Get + ' If ViewState("ListaFacturasRealcionadasRNC") Is Nothing Then + ' ViewState("ListaFacturasRealcionadasRNC") = New List(Of String) + ' End If + ' Return DirectCast(ViewState("ListaFacturasRealcionadasRNC"), List(Of String)) + ' End Get + ' Set(value As List(Of String)) + ' ViewState("ListaFacturasRealcionadasRNC") = value + ' End Set + 'End Property @@ -1687,6 +1646,18 @@ Partial Class Compras_Compras DdlTipoComprobante.Items.Add(New ListItem("Devolución", "DEV")) DdlTipoComprobante.SelectedValueExist("DEV") End If + + + + If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 AndAlso DdlTipoComprobante.SelectedValue = "NC" Then + + + + ConfiguraseleccionRemisionNotaCredito() + + + End If + End If 'SE OCUPAN AFUERA DEL POSTBACK ?? @@ -1719,6 +1690,56 @@ Partial Class Compras_Compras End Sub + Private Sub ConfiguraseleccionRemisionNotaCredito() + + Dim AutoSelRNC As Boolean = False + DdlTipoComprobante_SelectedIndexChanged(Nothing, Nothing) + DdlTipoCompra.SelectedValueExist(15) + DdlTipoCompra_SelectedIndexChanged(Nothing, Nothing) + + + 'For Each gvRow As GridViewRow In GvFacturaNC.Rows + ' If gvRow.DataKey("CveCompra").ToEntero > 0 AndAlso gvRow.FCCheckBox("ChkFacturaNC").Checked Then + ' Dim SerieFolioFacura As String = ObtenerUltimaParte(gvRow.DataKey("SerieFolio")) + ' Dim seleccion As String = "" + + ' For Each item As ListItem In DdlRemisionNotaCredito.Items + ' Dim serieFolioItem As String = ObtenerUltimaParte(item.Text) + ' If SerieFolioFacura = serieFolioItem Then + ' 'seleccion = item.Value + ' AutoSelRNC = True + ' DdlRemisionNotaCredito.SelectedValueExist(item.Value) + ' Exit For + ' End If + + ' Next + + ' If AutoSelRNC Then + ' Exit For + ' End If + + ' End If + 'Next + + If AutoSelRNC Then + 'DdlRemisionNotaCredito_SelectedIndexChanged(Nothing, Nothing) + End If + + HLAplicaNCFact.Visible = True + UpPS.Update() + UpEstatus.Update() + + End Sub + + Public Function ObtenerUltimaParte(SerieFolioFactura As String) As String + Dim posicionUltimoGuion As Integer = SerieFolioFactura.LastIndexOf("-") + If posicionUltimoGuion <> -1 Then + Return SerieFolioFactura.Substring(posicionUltimoGuion + 1) + Else + Return SerieFolioFactura + End If + End Function + #Region "C A R G A S" Private Sub MostrarOcultarColumnaIEPS() @@ -7046,26 +7067,44 @@ Partial Class Compras_Compras End If End If Next + If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then - If DdlRemisionNotaCredito.SelectedValue.ToEntero > 0 AndAlso ImporteRNCSaldar > 0 Then - If Not ErrorPrepoliza Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteRNCSaldar, ImporteRNCSaldar, 373, Referencia, Concepto, CveCompra:=DdlRemisionNotaCredito.SelectedValue.ToEntero, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio, - CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then - ErrorPrepoliza = True - End If + + For Each gvRow As GridViewRow In GVRemisionesNotaDeCredito.Rows + + If gvRow.FCCheckBox("Chk").Checked Then + + Dim ImporteRNCSaldar As Decimal = gvRow.DataKey("Saldo").ToDecimal + Dim CveCompraRNC As Integer = gvRow.DataKey("CveCompra").ToEntero If Not ErrorPrepoliza Then - Dim ConPrePNC As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(15, CompraActual.CveMoneda, True, CompraActual.CveTipoConceptoProveedor) - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteRNCSaldar, ImporteRNCSaldar, ConPrePNC.CveConcepto, Referencia, Concepto, CveCompra:=CompraActual.CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio, + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteRNCSaldar, ImporteRNCSaldar, 373, Referencia, Concepto, CveCompra:=CveCompraRNC, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio, CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then ErrorPrepoliza = True + Exit For + End If + + If Not ErrorPrepoliza Then + Dim ConPrePNC As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(15, CompraActual.CveMoneda, True, CompraActual.CveTipoConceptoProveedor) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteRNCSaldar, ImporteRNCSaldar, ConPrePNC.CveConcepto, Referencia, Concepto, CveCompra:=CompraActual.CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio, + CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then + ErrorPrepoliza = True + Exit For + End If End If End If End If - End If + + + Next + + + + + If ErrorPrepoliza Then ErrorMovtosCxP = True @@ -8557,6 +8596,8 @@ Partial Class Compras_Compras Protected Sub BtnActualizar_Click(sender As Object, e As EventArgs) Handles BtnActualizar.Click + Dim SeActualizoDetalle As Boolean = False + Dim CveSubProyectoPrincipal As Integer = AsignarSubProyectoPrincipal() If Not CveSubProyectoPrincipal > 0 Then Alert("Falta asignar Proyecto a la compra", TipoMensaje.MsgAdvertencia) @@ -8654,7 +8695,7 @@ Partial Class Compras_Compras CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, NoDeducible:=tNoDeducible, CveRetIVAConcepto:=TmpCveRetIVAConcepto, CveRetISRConcepto:=TmpCveRetISRConcepto, CveSubProyecto:=CveSubProyectoPrincipal, CveFolioGarantia:=DdlFolioGarantia.SelectedValue.ToEntero) Then If Not ComparaDatatables() Then - + SeActualizoDetalle = True 'Regeneramos el concepto 6 de PrePolizas 'If UsuarioActual.Empresa.Funcionalidad(207) = "1" Then ' If Not RegenerarPrePoliza(ObjContabilidad, ObjContaAC, 6, False, MultiplicadorNC) Then @@ -9010,7 +9051,7 @@ Partial Class Compras_Compras End If End If - If Not ObjCompra.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF, + If ObjCompra.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal, Row("IVA").ToString.ToDecimal, Row("Total").ToString.ToDecimal, Row("Descuento").ToString.ToDecimal, Row("Obs").ToString, Row("CveOrdenCompraDetalle").ToString.ToEntero, TipoRecepcion, Row("CveContrato").ToString.ToEntero, Row("CvePresupuestoEgreso").ToString.ToEntero, AplicaCostoIndirecto:=Row("AplicaCostoIndirecto").ToString.ToEntero, EstatusAlmacen:=Row("EntregaDirecta").ToString.ToEntero, CvePersonal:=CvePersonal, @@ -9019,7 +9060,17 @@ Partial Class Compras_Compras IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDecimal, IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDecimal, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False), CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then + Dim objGeneral As New ClsGenerales(ObjCompra.IniciaTransacSQL) + Dim NuevoDetalle As String = $"Cantidad: {Row("Cantidad").ToString} Producto: {Row("CodigoPS").ToString}, PU: {Row("PU").ToString.ToDecimal}, Total: {Row("Total").ToString.ToDecimal}" + + If Not objGeneral.AddHistorialBitacora(441, -1, -1, -1, -1, -1, CveCompra, -1, NuevoDetalle, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "") Then + Retorno = False + Exit For + End If + + + Else Retorno = False Exit For End If @@ -9143,6 +9194,7 @@ Partial Class Compras_Compras ObjCompra.RollBack() If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + Finally If Retorno Then If ObjContabilidad.MensajePolizaDescuadre IsNot Nothing AndAlso ObjContabilidad.MensajePolizaDescuadre.ToString <> "" Then @@ -9161,6 +9213,7 @@ Partial Class Compras_Compras ObjCompra.RollBack() If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() Alert("Ocurrió un error al actualizar la compra, por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) + SeActualizoDetalle = False End If If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose() @@ -9176,6 +9229,80 @@ Partial Class Compras_Compras CargaGvBitacora() UpBitacora.Update() + + + If SeActualizoDetalle AndAlso UsuarioActual.CveEmpresa = 119 Then + MandaCorreoActualizacionDetalle() + End If + + End Sub + + Private Sub MandaCorreoActualizacionDetalle() + + + + Dim DTCorreos As New DataTable + Dim DTMovimientos As New DataTable + Dim strBody As New StringBuilder + Dim Asunto, Para, ArrayCC, Body As String + 'Para = GlobalDTUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("Correo") + Para = "fernanda.romo@agrojam.com.mx" + + If Para.ToString = "" AndAlso UsuarioActual.CveRol = 1 Then + Para = Para & ";oscar.irigoyen@adssistemas.mx;rene.molina@adssistemas.mx" + End If + + Dim uri As Uri = HttpContext.Current.Request.Url + Dim URlCompleta As String = uri.AbsoluteUri + + Dim SerieFolioCompra As String = $"{TxtSerie.Text}{If(TxtSerie.Text.Trim.Length > 0, "-", "")}{TxtFolio.Text.Trim}" + + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append(" ") + strBody.Append("") + strBody.Append($"

    Se realizo una actualización en los detalles de la compra {SerieFolioCompra} del proveedor {HplProveedor.Text}

    ") + strBody.Append("") + + strBody.Append("") + + + '' ENVIO DEL CORREO + Asunto = $"Actualizacion de Compra: {SerieFolioCompra} Proveedor: {HplProveedor.Text}" + ArrayCC = "" + Body = strBody.ToString + Dim Mail As New ClsSisMail() + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, ArrayCC) + + + End Sub Private Function ComparaDatatables() As Boolean @@ -15600,7 +15727,7 @@ Partial Class Compras_Compras Protected Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) CargarFacturas() If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then - CargaDdlRemisionNotaCredito() + CargaGVRemisionNotaCredito() End If End Sub @@ -16134,7 +16261,7 @@ Partial Class Compras_Compras End If Next - UpINV.Update() + UpInv.Update() UpSerie.Update() TxtSerieLote.Focus() RegistraScript(String.Format("$('#DivSerie').on('shown.bs.modal', function () {{$('#DivSerie').focus(); $('#{0}').trigger(jQuery.Event('keypress', {{which: 13}})); }});$('#DivSerie').modal('show'); ", TxtSerieLote.ClientID)) @@ -18561,7 +18688,7 @@ Partial Class Compras_Compras GvInvMov.Visible = True ObjVentas.Dispose() - UpINV.Update() + UpInv.Update() End Sub Private Sub GvInvMov_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInvMov.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -19631,12 +19758,11 @@ Partial Class Compras_Compras If DdlTipoCompra.SelectedValue = "15" Then 'Remisión de nota de crédito If DdlTipoComprobante.SelectedValue = "NC" Then - CargaDdlRemisionNotaCredito() - 'bloquear la vinculación a la compra + CargaGVRemisionNotaCredito() HLAplicaNCFact.Visible = False Else Alert("Para elegir Remisión de Nota de Crédito el tipo de documento debe de ser Nota de Crédito.", TipoMensaje.MsgAdvertencia) - DdlRemisionNotaCredito.SelectedValueExist(-1) + 'DdlRemisionNotaCredito.SelectedValueExist(-1) DdlTipoCompra.SelectedValueExist(-1) End If End If @@ -20299,6 +20425,7 @@ Partial Class Compras_Compras End Function Private Sub NCSeleccionFacturasRelacionadas(UUIDSListRelacionados As List(Of String)) + 'ListaFacturasRealcionadasRNC.Clear() If UUIDSListRelacionados.Count > 0 Then Dim SaldoNota As Decimal = TxtTotal.Text.ToDecimal @@ -20334,17 +20461,20 @@ Partial Class Compras_Compras SaldoNotaPorAplicar = SaldoNotaPorAplicar - SaldoFactura GvRow.FCTextBox("TxtImporte").Text = SaldoFactura.FormatoNumero GvRow.FCCheckBox("ChkFacturaNC").Checked = True + 'ListaFacturasRealcionadasRNC.Add(GvRow.DataKey("CveCompra")) Else If SaldoFactura >= SaldoNotaPorAplicar Then GvRow.FCTextBox("TxtImporte").Text = SaldoNotaPorAplicar.FormatoNumero GvRow.FCCheckBox("ChkFacturaNC").Checked = True + 'ListaFacturasRealcionadasRNC.Add(GvRow.DataKey("CveCompra")) SaldoNotaPorAplicar = 0 TeminarAmortizacion = True Else GvRow.FCTextBox("TxtImporte").Text = SaldoFactura.FormatoNumero GvRow.FCCheckBox("ChkFacturaNC").Checked = True + 'ListaFacturasRealcionadasRNC.Add(GvRow.DataKey("CveCompra")) SaldoNotaPorAplicar = SaldoNotaPorAplicar - SaldoFactura TeminarAmortizacion = True @@ -21052,51 +21182,59 @@ Partial Class Compras_Compras End Sub - Private Sub CargaDdlRemisionNotaCredito() - DvDdlRemisionNotaCredito.Visible = True + Private Sub CargaGVRemisionNotaCredito() + 'DvDdlRemisionNotaCredito.Visible = True DTRemisionesNotaDeCredito = New DataTable + GVRemisionesNotaDeCredito.DataSource = Nothing + GVRemisionesNotaDeCredito.Visible = False + + Dim CveComprasAmortizadas As New List(Of String) + + For Each gvRow As GridViewRow In GvFacturaNC.Rows + If gvRow.DataKey("CveCompra").ToEntero > 0 AndAlso gvRow.FCCheckBox("ChkFacturaNC").Checked Then + CveComprasAmortizadas.Add(gvRow.DataKey("CveCompra")) + gvRow.FCCheckBox("ChkFacturaNC").Checked = False + End If + Next Dim ObjCompras As New ClsCompras - If ObjCompras.GetNotasCreditoRep(DdlProveedor.SelectedValue.ToEntero, 0, "-1", "-1", UsuarioActual.CveEmpresa, 2) Then - DdlRemisionNotaCredito.DataSource = ObjCompras.DtResultados + If ObjCompras.GetNotasCreditoRep(DdlProveedor.SelectedValue.ToEntero, 0, "-1", "-1", UsuarioActual.CveEmpresa, 2, String.Join(",", CveComprasAmortizadas)) Then + 'DdlRemisionNotaCredito.DataSource = ObjCompras.DtResultados DTRemisionesNotaDeCredito = ObjCompras.DtResultados + GVRemisionesNotaDeCredito.DataSource = DTRemisionesNotaDeCredito + GVRemisionesNotaDeCredito.Visible = True End If ObjCompras.Dispose() - DdlRemisionNotaCredito.DataBind() - DdlRemisionNotaCredito.Items.Insert(0, New ListItem("-", "-1")) + + GVRemisionesNotaDeCredito.DataBind() + + 'DdlRemisionNotaCredito.DataBind() + 'DdlRemisionNotaCredito.Items.Insert(0, New ListItem("-", "-1")) + UpPS.Update() UpEstatus.Update() End Sub - Protected Sub DdlRemisionNotaCredito_SelectedIndexChanged(sender As Object, e As EventArgs) + 'Protected Sub DdlRemisionNotaCredito_SelectedIndexChanged(sender As Object, e As EventArgs) - ImporteRNCSaldar = 0 - SerieFolioProntoPago = "" - TipoCambioProntoPago = 1 - FechaProntoPago = MinFecha - CveMonedaProntoPago = 1 + ' ImporteRNCSaldar = 0 + ' SerieFolioProntoPago = "" + ' TipoCambioProntoPago = 1 + ' FechaProntoPago = MinFecha + ' CveMonedaProntoPago = 1 - If DdlRemisionNotaCredito.SelectedValue.ToEntero > 0 Then - ImporteRNCSaldar = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal - SerieFolioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("SerieFolio", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ") - TipoCambioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("TipoCambio", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal - FechaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Fecha", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToString.ToDate - CveMonedaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("CveMoneda", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToEntero - End If - - ''Alert(ImporteRNCSaldar.ToString) - 'CompraPago.SerieFolio = Gvr.DataKey("SerieFolio") - 'CompraPago.TC = Gvr.DataKey("TipoCambio").ToDecimal - 'CompraPago.Fecha = Gvr.DataKey("Fecha").ToDate - 'CompraPago.CveMoneda = Gvr.DataKey("CveMoneda").ToEntero - - 'CompraPago.Total = Gvr.DataKey("Total").ToDecimal - 'CompraPago.CveTipoConceptoProveedor = CveTipoConcepto + ' If DdlRemisionNotaCredito.SelectedValue.ToEntero > 0 Then + ' ImporteRNCSaldar = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal + ' SerieFolioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("SerieFolio", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ") + ' TipoCambioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("TipoCambio", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal + ' FechaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Fecha", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToString.ToDate + ' CveMonedaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("CveMoneda", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToEntero + ' End If - End Sub + 'End Sub #End Region diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 0fcf524a0..386792d7a 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -2714,6 +2714,7 @@ Partial Class PopUpVerFactura Dim NombreEntrego As String = ObjInventarios.DtResultados.FiltroPrimeroValor("Entrego") Dim CveAlmacen As Integer = ObjInventarios.CveAlmacen Dim Recibio As String = ObjInventarios.Recibio + Dim Guia As String = ObjInventarios.Guia Dim PuestoRecibio As String = ObjInventarios.PuestoRecibio Dim PuestoEnrego As String = ObjInventarios.PuestoEntrego Dim ResponsableCarga As String = ObjInventarios.ResponsableCarga @@ -2912,7 +2913,7 @@ Partial Class PopUpVerFactura PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio, NombreCliente, CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados, CveTipoAlmacen:=CveTipoAlmacen, NombreEntrego:=NombreEntrego, CveConceptoMovRelacionado:=CveConceptoMovtoRelacionado, FolioRelacionado:=FolioRelacionado, UsuarioRegistro:=UsuarioCapturo, - Ruta:=Ruta, Supervisor:=Supervisor, Consola:=Consola) + Ruta:=Ruta, Supervisor:=Supervisor, Guia:=Guia, Consola:=Consola) End Sub Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera @@ -2931,7 +2932,7 @@ Partial Class PopUpVerFactura EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String, RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0, Optional CveTipoAlmacen As Integer = -1, Optional NombreEntrego As String = "", Optional CveConceptoMovRelacionado As Integer = -1, Optional FolioRelacionado As String = "", Optional UsuarioRegistro As String = "", - Optional Ruta As String = Nothing, Optional Supervisor As String = Nothing, Optional Consola As String = "-1") + Optional Ruta As String = Nothing, Optional Supervisor As String = Nothing, Optional Guia As String = "", Optional Consola As String = "-1") Select Case CveConcepto @@ -3617,22 +3618,20 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Accion", "RECIBE")) 'Antes Trasladó params.Add(New ReportParameter("Observaciones", Observaciones)) - Dim DTCliente As New DataTable Dim SBDireccionO As New StringBuilder() Dim SBDireccionD As New StringBuilder() Dim CveCliente As Integer = 0 Dim CveDireccionEnvio As Integer = 0 Dim ClienteNombre As String = "", EnvioContacto As String = "", EnvioDireccion As String = "", EnvioColonia As String = "", EnvioCiudad As String = "", EnvioEstado As String = "", ClientePais As String = "", EnvioCP As String = "", Contrato As String = "", - Paqueteria As String = "", NumContrato As String = "", Guia As String = "", Documentacion As String = "" + Paqueteria As String = "", NumContrato As String = "", Documentacion As String = "" Dim CveContrato As Integer = 0 If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then CveContrato = DtMovimientos.FiltroPrimeroValor("CveContrato").ToEntero End If - - If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then CveCliente = DtMovimientos.FiltroPrimeroValor("CveCliente").ToEntero DTCliente = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros($"CveCliente = {CveCliente}") @@ -3644,12 +3643,11 @@ Partial Class PopUpVerFactura If Consola <> "-1" And Consola.Trim.Length > 0 Then RutaFormato = "{0}Formatos\Consola.rdlc" params.Add(New ReportParameter("Consola", Consola)) + params.Add(New ReportParameter("SerieConsola", Guia)) + params.Add(New ReportParameter("SeriePedal", Recibio)) End If - - Dim CveVentaConsulta As Integer = DtMovimientos.FiltroPrimeroValor("CveVenta").ToEntero - params.Add(New ReportParameter("Documentacion", DTCliente.FiltroPrimeroValor("Documentacion"))) Dim ObjVentas As New ClsVentas() @@ -3670,18 +3668,9 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("ClienteMunicipio", dtVentas.Rows(0)("SucClienteCiudad").ToString)) params.Add(New ReportParameter("ClienteCP", dtVentas.Rows(0)("CPCliente").ToString)) - - - - - End If ObjVentas.Dispose() - - - - End If If CveContrato > 0 Then diff --git a/Compras/RepCompras.aspx b/Compras/RepCompras.aspx index c2c3b08bd..0eea249dd 100644 --- a/Compras/RepCompras.aspx +++ b/Compras/RepCompras.aspx @@ -174,43 +174,14 @@ --%>
    -
    F. I. Captura
    -
    -
    - - - - - - - - - - -
    -
    -
    F. F. Captura:
    -
    -
    - - - - - - - - - - -
    -
    +
    Moneda:
    -
    Tipo de Proveedor:
    +
    Tipo de Prov:
    @@ -219,14 +190,18 @@
    - -
    -
    Capturó:
    -
    - +
    Tipo Docto:
    +
    + + + + +
    +
    +
    Responsable:
    @@ -239,17 +214,45 @@ --%> -
    -
    Tipo Docto:
    -
    - - - - - - - -
    +
    +
    +
    +
    Capturó:
    +
    + + + +
    +
    F. I. Captura
    +
    +
    + + + + + + + + + + +
    +
    +
    F. F. Captura:
    +
    +
    + + + + + + + + + + +
    +
    diff --git a/Compras/RepCompras.aspx.vb b/Compras/RepCompras.aspx.vb index 9e5844ce5..6c08d50d5 100644 --- a/Compras/RepCompras.aspx.vb +++ b/Compras/RepCompras.aspx.vb @@ -68,7 +68,9 @@ Partial Class Compras_RepCompras DdlGrupo.Items.Insert(6, New ListItem("Tipo Documento", "6")) DdlGrupo.Items.Insert(7, New ListItem("Clasificación Prov.", "7")) DdlGrupo.Items.Insert(8, New ListItem("Responsable", "8")) - DdlGrupo.Items.Insert(9, New ListItem("Remesa", "10")) + DdlGrupo.Items.Insert(9, New ListItem("Remesa", "10")) + If UsuarioActual.Empresa.Funcionalidad(307) <> "" Then DdlGrupo.Items.Insert(10, New ListItem(UsuarioActual.Empresa.Funcionalidad(307), "13")) + DdlGrupo.DataBind() DdlGrupo.SelectedValueExist("3") End Sub @@ -77,7 +79,7 @@ Partial Class Compras_RepCompras txtFechaI.Text = $"01/01/{NowADS().Year}" 'Carga Tipo Centro de Costo - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) 'CargaProveedores DdlProveedores.setEsWebService(True) diff --git a/Compras/RepComprasDetalle.aspx b/Compras/RepComprasDetalle.aspx index df26c2813..4765f5ede 100644 --- a/Compras/RepComprasDetalle.aspx +++ b/Compras/RepComprasDetalle.aspx @@ -217,37 +217,8 @@ --%> -
    F. I. Captura
    -
    -
    - - - - - - - - - - -
    -
    -
    F. F. Captura:
    -
    -
    - - - - - - - - - - -
    -
    -
    Tipo de Proveedor:
    + +
    Tipo Prov.:
    @@ -256,14 +227,19 @@
    - -
    -
    Capturó:
    -
    - +
    Tipo Docto:
    +
    + + + + +
    +
    +
    +
    Responsable:
    @@ -277,16 +253,45 @@ --%>
    -
    Tipo Docto:
    -
    - + +
    +
    +
    Capturó:
    +
    + - - - -
    +
    F. I. Captura
    +
    +
    + + + + + + + + + + +
    +
    +
    F. F. Captura:
    +
    +
    + + + + + + + + + + +
    +
    diff --git a/Compras/RepComprasDetalle.aspx.vb b/Compras/RepComprasDetalle.aspx.vb index 669e79f5a..c6be3b353 100644 --- a/Compras/RepComprasDetalle.aspx.vb +++ b/Compras/RepComprasDetalle.aspx.vb @@ -114,14 +114,8 @@ Partial Class Compras_RepComprasDetalle If IfNull(Request("TipoCambio"), "1").ToString <> "1" Then RblTipoCambio.SelectedValue = IfNull(Request("TipoCambio"), "1").ToString - End If - - - 'txtFechaI.Text = If(Anio <> "-1", String.Format("01/01/{0}", Anio), txtFechaI.Text) - 'txtFechaI.Text = If(Mes <> "-1", String.Format("01/{0}/0001", Mes), txtFechaI.Text) - 'txtFechaI.Text = If(AnioMes <> "-1", String.Format("01/{0}/{1}", AnioMes.Substring(5, 2).PadLeft(2, "0"c), AnioMes.Substring(0, 4)), txtFechaI.Text) - - + End If + If Fecha <> "-1" Then txtFechaI.Text = Fecha txtFechaF.Text = Fecha @@ -130,7 +124,6 @@ Partial Class Compras_RepComprasDetalle If FechaF <> "-1" Then txtFechaF.Text = FechaF End If - If FechaCaptura <> "-1" Then TxtFechaICaptura.Text = FechaCaptura TxtFechaFCaptura.Text = FechaCaptura @@ -145,6 +138,8 @@ Partial Class Compras_RepComprasDetalle DdlProyecto.SelectedValueExist(CveProyecto) + If CveProyecto.ToEntero > 0 Then CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") + 'CARGA LISTBOXs DdlSubProyecto.SelectedValuesIfExistM(SubProyecto) DdlTipoGasto.SelectedValuesIfExistM(TipoGasto) @@ -189,7 +184,7 @@ Partial Class Compras_RepComprasDetalle Private Sub CargaCombos() 'Carga Tipo Centro de Costo - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) 'Carga Tipo de Gasto DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) diff --git a/Compras/RepProductosServicios.aspx.vb b/Compras/RepProductosServicios.aspx.vb index c663aa5a3..4c09f6965 100644 --- a/Compras/RepProductosServicios.aspx.vb +++ b/Compras/RepProductosServicios.aspx.vb @@ -114,7 +114,7 @@ Partial Class Compras_RepProductosServicios CargaGrupo() 'Carga Tipo Centro de Costo - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then lblCultivo.Visible = True @@ -123,36 +123,7 @@ Partial Class Compras_RepProductosServicios lblCultivo.Visible = False DivCultivo.Visible = False DdlSubProyecto.AutoPostBack = False - End If - - - 'CARGA COSTOS - If UsuarioActual.CveEmpresa = 66 Then - - Dim NumItems As Integer = DdlGrupo.Items.Count - - 'COSTOS PROYECTO - DdlGrupo.Items.Insert(NumItems, New ListItem("Costos", "13")) - RowCostos.Visible = True - - 'Carga Familias - DdlFamilia.DataSource = GlobalDTFamilias(66) - DdlFamilia.DataBind() - - 'Carga SubFamilias - DdlSubFamilia.DataSource = GlobalDTSubFamilias(66) - DdlSubFamilia.DataBind() - - 'COSTOS AF - DdlGrupo.Items.Insert(NumItems + 1, New ListItem("Costos por Activo Fijo", "14")) - - 'Carga AF - 'DdlAF.DataSource = GlobalDTActivoFijos().FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)) - 'DdlAF.DataBind() - - End If - RowActivoFijo.Visible = True 'Carga Fechas @@ -175,6 +146,7 @@ Partial Class Compras_RepProductosServicios DdlGrupo.Items.Insert(7, New ListItem("Proveedor", "10")) DdlGrupo.Items.Insert(8, New ListItem("Usuario", "11")) DdlGrupo.Items.Insert(9, New ListItem("Estatus Fact.", "12")) + If UsuarioActual.Empresa.Funcionalidad(307) <> "" Then DdlGrupo.Items.Insert(10, New ListItem(UsuarioActual.Empresa.Funcionalidad(307), "1")) 'Agrega el grupo si es una empresa Agricola If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then @@ -330,7 +302,7 @@ Partial Class Compras_RepProductosServicios #Region " SELECTED INDEX CHANGED" Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue) + CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") End Sub Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubProyecto.SelectedIndexChanged diff --git a/Compras/RepProductosServiciosDetalle.aspx b/Compras/RepProductosServiciosDetalle.aspx index 1107a2db1..1869066d7 100644 --- a/Compras/RepProductosServiciosDetalle.aspx +++ b/Compras/RepProductosServiciosDetalle.aspx @@ -261,19 +261,19 @@ - - + - - + - - + + + + diff --git a/Compras/RepProductosServiciosDetalle.aspx.vb b/Compras/RepProductosServiciosDetalle.aspx.vb index b15d64676..9c3f6065f 100644 --- a/Compras/RepProductosServiciosDetalle.aspx.vb +++ b/Compras/RepProductosServiciosDetalle.aspx.vb @@ -130,7 +130,8 @@ Partial Class Compras_RepProductosServiciosDetalle End If End If DdlProyecto.SelectedValueExist(Proyecto) - 'CARGA LISTBOXs + 'CARGA + If Proyecto.ToEntero > 0 Then CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") DdlSubProyecto.SelectedValuesIfExistM(SubProyecto) DdlTipoGasto.SelectedValuesIfExistM(TipoGasto) DdlCategoria.SelectedValuesIfExistM(Categoria) @@ -181,7 +182,7 @@ Partial Class Compras_RepProductosServiciosDetalle Private Sub SetValues() 'Carga Tipo Centro de Costo - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) 'Carga Tipos de Gasto DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) @@ -233,33 +234,6 @@ Partial Class Compras_RepProductosServiciosDetalle 'Carga Grupos CargaGrupo() - - 'CARGA COSTOS - If UsuarioActual.CveEmpresa = 66 Then - - Dim NumItems As Integer = DdlGrupo.Items.Count - - 'COSTOS PROYECTO - DdlGrupo.Items.Insert(NumItems, New ListItem("Costos", "13")) - RowCostos.Visible = True - - 'Carga Familias - DdlFamilia.DataSource = GlobalDTFamilias(66) - DdlFamilia.DataBind() - - 'Carga SubFamilias - DdlSubFamilia.DataSource = GlobalDTSubFamilias(66) - DdlSubFamilia.DataBind() - - 'COSTOS AF - DdlGrupo.Items.Insert(NumItems + 1, New ListItem("Costos por Activo Fijo", "14")) - - 'Carga AF - 'DdlAF.DataSource = GlobalDTActivoFijos().FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)) - 'DdlAF.DataBind() - - End If - RowActivoFijo.Visible = True 'Carga Fechas @@ -365,7 +339,7 @@ Partial Class Compras_RepProductosServiciosDetalle #Region "SELECT INDEX CHANGED" Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue) + CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") End Sub Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSubProyecto.SelectedIndexChanged CargaCultivo() diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 061e4ba57..1081e1dde 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -1047,7 +1047,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + --%> + + +
    + + + +
    + +
    +
    + + + + + + + + + + +
    +
    + +
    +
    + + + + + + + + + + +
    +
    + +
    + +
    + + + +
    + +
    + +
    + + +
    + + + + + +
    + + +
    + + + + + +
    + +
    +
    + +
    + +
    + +
    + + + + + +
    + +
    + + +
    + + Servicio Domicilio: +
    + + Todos + Si + No + +
    + Factura Global: +
    + + Todos + Solo Globales + Sin Globales + +
    + +
    + + + + + + + + + <%-- 0--%> + + + + + + + <%-- 1--%> + + + + + + + <%-- 2--%> + + + + + + <%-- 3--%> + + + + + + <%-- 4--%> + + + + + + <%-- 5--%> + + + + + + <%-- 6--%> + + + + + + <%-- 7--%> + + + + + + <%-- 8--%> + + + + + + <%-- 9--%> + + + + + + <%-- 10--%> + + + + + + <%-- 11--%> + + + + + + <%-- 12--%> + + + + + + <%-- 13--%> + + + + + + <%-- 14--%> + + + + + + <%-- 15--%> + + + + + + <%-- 16--%> + + + + + + <%-- 17--%> + + + + + + <%-- 18--%> + + + + + + <%-- 19--%> + + + + + + <%-- 20--%> + + + + + + <%-- 21--%> + + + + + + <%-- 22--%> + + + + + + <%-- 23--%> + + + + + + <%-- 24--%> + + + + + + <%-- 25--%> + + + + + + <%-- 26--%> + + + + + + <%-- 27--%> + + + + + + <%-- 28--%> + + + + + + <%-- 29--%> + + + + + + <%-- 30--%> + + + + + + <%-- 31--%> + + + + + + <%-- 32--%> + + + + + + <%-- 33--%> + + + + + + + <%-- 34--%> + + + + + + <%-- 35--%> + + + + + + + + + <%-- 36--%> + + + + + + <%-- 37--%> + + + + + + <%-- 38--%> + + + + + + <%-- 39--%> + + + + + + <%-- 40--%> + + + + + + <%-- 41--%> + + + + + + <%-- 42--%> + + + + + + <%-- 43--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + - + + diff --git a/Ventas/RepVentaDetalle.aspx.vb b/Ventas/RepVentasDetalle.aspx.vb similarity index 99% rename from Ventas/RepVentaDetalle.aspx.vb rename to Ventas/RepVentasDetalle.aspx.vb index 41430dc83..727b45648 100644 --- a/Ventas/RepVentaDetalle.aspx.vb +++ b/Ventas/RepVentasDetalle.aspx.vb @@ -6,7 +6,7 @@ Imports Extensiones Imports Microsoft.Reporting.WebForms Imports System.Net.Http -Partial Class RepVentaDetalle +Partial Class RepVentasDetalle Inherits ClsPaginas #Region "P R O P I E D A D E S" Private Property CveProyecto As Integer @@ -204,6 +204,7 @@ Partial Class RepVentaDetalle DdlProyecto.SelectedValueExist(CveProyecto) 'If DivProyecto.Visible Then CargaSubProyecto() + If CveProyecto.ToEntero > 0 Then CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") DdlSubProyecto.SelectedValuesIfExistM(CveSubProyecto) DdlSubProyectoEjecucion.SelectedValueExist(CveSubProyectoEjecucion) DdlVendedor.SelectedValuesIfExistM(CveVendedor) @@ -317,7 +318,7 @@ Partial Class RepVentaDetalle End Sub Private Sub CargaCombos() - CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto) + CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto, VisualizacionReporte:=1) CargaClientes() @@ -371,7 +372,7 @@ Partial Class RepVentaDetalle End Sub Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue) + CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue, AplicaTodos:="Todos") End Sub Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -432,6 +433,7 @@ Partial Class RepVentaDetalle Dim ModalidadContable As Boolean = CBool(If(Request("ModalidadContable") IsNot Nothing, Request("ModalidadContable").ToEntero(), 0)) ChkLecturaAdmin.Checked = Not ModalidadContable + CveProyecto = DdlProyecto.SelectedValue.ToEntero Dim ObjVentas As New ClsVentas() 'FechaI, FechaF, -1, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero @@ -1209,16 +1211,12 @@ Partial Class RepVentaDetalle Vendedor = If(DdlVendedor.GetSelectedText = "", "", $" Vendedor: {DdlVendedor.GetSelectedText}") CveUsuario = If(DdlUsuario.SelectedValue = "-1", "", $" Usuario: {DdlUsuario.SelectedItem.Text}") CveEstatusFactura = If(DdlEstatus.GetSelectedText = "", "", $" Estatus: {DdlEstatus.GetSelectedText}") - CondicionesPago = If(DdlCondicionesPago.selectedValue = "-1", "", String.Format(" Condiciones Pago: {0}", DdlCondicionesPago.SelectedItem.Text)) - + CondicionesPago = If(DdlCondicionesPago.SelectedValue = "-1", "", String.Format(" Condiciones Pago: {0}", DdlCondicionesPago.SelectedItem.Text)) Dim RutaFormato As String = String.Format("{0}Formatos\RepVentaDetalle.rdlc", UsuarioActual.Empresa.Ruta) - Dim Archivo As New System.IO.FileInfo(RutaFormato) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - Dim logouri As String = String.Format("file://{0}", Imagen.FullName) - Dim dt As DataTable = DtVentas.FiltraParametros("(GPO IS NULL AND Cantidad IS NOT NULL) OR (GPO IS NOT NULL AND Cantidad IS NOT NULL)") Dim params As New List(Of ReportParameter) @@ -1229,11 +1227,8 @@ Partial Class RepVentaDetalle params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString)) params.Add(New ReportParameter("TipoDocto", TipoDocto)) params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Grupo} {TipoDocto} {FechaIn} {FechaFn} {FechaIEjec} {FechaFEjec} {CveCliente} {CveSucursal} {CveSucursalEjec} {Vendedor} {CveUsuario} {CveEstatusFactura} {CondicionesPago} ")) - params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) - - If Not Archivo.Exists Then RutaFormato = "Empresas/Grales/Formatos/RepVentaDetalle.rdlc" End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 59e0d4f5f..967500655 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -968,6 +968,11 @@ + + Motivo de devolución:  + + + @@ -1253,9 +1258,11 @@ <%--1--%> -
    -
    +
    + +
    +
    @@ -1671,7 +1678,7 @@ Amort. Ant.: -   +   @@ -4929,7 +4936,7 @@     - + Sucursal: @@ -7609,6 +7616,16 @@
    +
    +
    + +
    +
    + + + +
    +
    " style="display: inline-block; margin-right: -20px; width: 150px;" /> @@ -7970,9 +7987,9 @@
    -
    +
    - +
    @@ -8590,6 +8607,7 @@
    +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c9326985c..34ce29ff4 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5284,6 +5284,8 @@ Partial Class Ventas Trsaldo.Visible = True HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) + TrMotivoDev.Visible = True + lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString() Case "Ped" DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped")) CvePedido = CveVenta @@ -5527,6 +5529,7 @@ Partial Class Ventas TxtObsFact.Text = DbRowVenta("Observaciones").ToString() LblUsuario.Text = DbRowVenta("Nombre").ToString().SubStringADS(30) LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString + LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString() LblMail.Text = DbRowVenta("EnvioMail").ToString() TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString() @@ -8423,7 +8426,7 @@ Partial Class Ventas ObjClientes.Dispose() Me.ObjFacturaNC = Nothing - Me.ObjFacturaNC = New Modelos.Factura(UsuarioActual, pCveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, EsCancelacion:=False) + Me.ObjFacturaNC = New Modelos.Factura(UsuarioActual, pCveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, EsCancelacion:=False, VerificaAlmacen:=False) DdlNCFactura.DataSource = DTFacNC DdlNCFactura.DataBind() @@ -8881,11 +8884,20 @@ Partial Class Ventas Dim DatarowPS As DataRow = Nothing DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1 + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + If DdlTipoComprobante.SelectedValue = "Cot" Then + If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then + Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If - If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then - If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then - Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) - Exit Sub + If DdlTipoComprobante.SelectedValue = "Ant" Then + Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString + If PSCodigoSAT <> "84111506" Then + Alert($"El producto y/o servicio no es valido para generar anticipos", TipoMensaje.MsgAdvertencia) + Exit Sub + End If End If End If @@ -8915,8 +8927,18 @@ Partial Class Ventas End If If CveUM <> CveUMInicial Then ValidaExistencia = True + 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS - If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then + Dim ValidaExistenciasCosto As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) + + 'VALIDA COSTO PARA LAS COTIZACIONES + If Not ValidaExistenciasCosto Then + If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso (UsuarioActual.Empresa.Funcionalidad(382) = "1" OrElse UsuarioActual.CveEmpresa = 1) Then + ValidaExistenciasCosto = True + End If + End If + + If ValidaExistenciasCosto Then Dim ObjInventarios As New ClsInventarios Dim Existencia As Decimal If ValidaExistencia Then @@ -8947,7 +8969,7 @@ Partial Class Ventas If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then 'VALIDA EXISTENCIA - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then + If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197}) Then 'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT If CveVenta <= 0 Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then @@ -9746,9 +9768,9 @@ Partial Class Ventas Dim RowAutorizacion As DataRow = Nothing 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO If TieneDiasVencidos Then - RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='{"Ing"}'", Orderby:="Importe DESC") Else - RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{"Ing"}'", Orderby:="Importe DESC") End If If RowAutorizacion IsNot Nothing Then @@ -9796,14 +9818,6 @@ Partial Class Ventas End If - 'If TipoAutorizacion = 2 Then - ' If DiasVencidosCliente > DiasVencidosAutorizacion Then - ' CveAutorizacion = -1 - ' Alert($"El crédito no esta autorizado. Los días vencidos del cliente son mayores a lo autorizado", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - 'End If - 'SI NO SE ENCONTRO NINGUA AUTORIZACION If TipoAutorizacion = 0 Then If TieneDiasVencidos Then @@ -9814,21 +9828,57 @@ Partial Class Ventas End If End If - 'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then - ' CveAutorizacion = -1 - ' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If + End If - 'If TipoDocumentoAutorizacion = "Egs" Then - ' If TipoAutorizacion = 1 Then - ' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then - ' CveAutorizacion = -1 - ' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - ' End If - 'End If + 'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs") Then + PermiteAutorizacion = False + 'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION + If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then + PermiteAutorizacion = True + End If + + If PermiteAutorizacion Then + + Dim ImporteAutorizacion As Decimal = 0 + Dim TipoAutorizacion As Integer = 0 + + Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero() + + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Egs", CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="Importe DESC") + + If RowAutorizacion IsNot Nothing Then + ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal() + CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() + TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero() + End If + + End If + + ObjVentas.Dispose() + + If TipoAutorizacion = 1 Then + If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then + Dim BloquearCredito As Boolean = True + CveAutorizacion = -1 + + If BloquearCredito Then + Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + Else + CveAutorizacion = -1 + Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If End If 'VALIDAR LINEAS ADICIONALES @@ -12229,7 +12279,7 @@ Partial Class Ventas ObjFactura.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim ObjFactura.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim ObjFactura.Det_ContraRecibo = TxtDet_ContraRecibo.Text.Trim - ObjFactura.MonedaAbreviatura = "" + ObjFactura.MonedaAbreviatura = DdlMoneda.SelectedItem.Text If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso DvModalRequiereOSFecha.Visible Then ObjFactura.FechaEjecucion = TxtFechaOS.Text.Trim.ToDateTime @@ -13998,6 +14048,11 @@ Partial Class Ventas 'CveAlmacenTraspasoDestino End If + Dim CveMotivoDevolucion As Integer = -1 + If DdlMotivoDevolucion.SelectedValue.ToEntero() > 0 Then + CveMotivoDevolucion = DdlMotivoDevolucion.SelectedValue.ToEntero() + End If + If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC, factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC, @@ -14017,7 +14072,7 @@ Partial Class Ventas FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible, CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta, CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir, - Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text) Then + Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then @@ -16103,7 +16158,7 @@ Partial Class Ventas If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, TmpDTDetalle) Then OcurrioError = True ErrorList.Add("Ocurrió un error al verificar inventario de remisiones.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") - ModExtensiones.GuardaLog("Ocurrió un error al verificar inventario de remisiones.Revise su factura y cualquier detalle comuníquese a Soporte Técnico") + ModExtensiones.GuardaLog("Ocurrió un error al verificar inventario de remisiones.Revise su factura y cualquier detalle comuníquese a Soporte Técnico: CveVenta:" & CveRemision & " ") Exit For End If Next @@ -16692,6 +16747,13 @@ Partial Class Ventas HdnTieneAnticipos.Value = "0" If CveCliente > 0 Then + 'QUE NO SE PUEDA REALIZAR AMORTIZACIÓN DE ANTICIPO POR DESCUENTO + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") IsNot Nothing Then + DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1")) + End If + End If + HdnIVACalculado.Value = "0" 'SI ES REFACTURACION NO LIMPIAR EL FOLIO FISCAL If NuevaFactura <> 1 Then @@ -18098,7 +18160,7 @@ Partial Class Ventas End Sub Protected Sub DdlNCFactura_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlNCFactura.SelectedIndexChanged Dim objcompras As New ClsCompras - If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then + If objcompras.GetCompraDetalleAlmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then GvInvNC.DataSource = objcompras.DtResultados If objcompras.DtResultados.Rows.Count > 0 Then Tab.ActiveTabIndex = 1 @@ -18792,13 +18854,24 @@ Partial Class Ventas Return False End If - If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DatarowPS IsNot Nothing Then - If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then - Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) - Return False + If DdlTipoComprobante.SelectedValue = "Cot" Then + If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then + Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) + Return False + End If End If + + If DdlTipoComprobante.SelectedValue = "Ant" Then + Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString + If PSCodigoSAT <> "84111506" Then + Alert($"El producto y/o servicio '{DatarowPS("CodigoPS").ToString}' no es valido para generar anticipos", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + End If End If @@ -18839,33 +18912,24 @@ Partial Class Ventas ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR If Not UsuarioActual.TienePermisoProceso(169) AndAlso RBLTipoVenta.SelectedValue.ToEntero <> 5 Then 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS - If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ped") And UsuarioActual.CveEmpresa.Contiene(186)))) Then + Dim ValidaExistenciasCosto As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ped") And UsuarioActual.CveEmpresa.Contiene(186)))) + + 'VALIDA COSTO PARA LAS COTIZACIONES + If Not ValidaExistenciasCosto Then + If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso (UsuarioActual.Empresa.Funcionalidad(382) = "1" OrElse UsuarioActual.CveEmpresa = 1) Then + ValidaExistenciasCosto = True + End If + End If + + If ValidaExistenciasCosto Then Dim ObjInventarios As New ClsInventarios - Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False) - - - Dim Existencia As Decimal = 0D - - If RBLTipoVenta.SelectedValue.ToEntero = 6 Then - Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1, - CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1, - RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) - Else - Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), - CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, - RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) - End If - - - - Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) - 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal If Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) ObjInventarios.Dispose() + Dim PrecioMinimo As Decimal = 0 'RMF. condicion temporal, para reubicación, precio mínimo If UsuarioActual.CveEmpresa = 119 Then @@ -18881,12 +18945,51 @@ Partial Class Ventas End If - If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 + + If ValidaExistencia Then + 'VALIDA EXISTENCIA - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190}) Then + If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197}) Then + + Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False) + + Dim Existencia As Decimal = 0D + + Using ObjInv2 As New ClsInventarios + If RBLTipoVenta.SelectedValue.ToEntero = 6 Then + Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1, + CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1, + RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) + Else + + Dim CveAlmacenConsulta As Integer = -1 + + If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then + CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero() + End If + + Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenConsulta, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), + CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, + RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) + End If + End Using + If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then - Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia) + + Dim CveAlmacenConsulta As Integer = -1 + Dim StrAlmacen As New StringBuilder + + If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then + CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero() + If CveAlmacenConsulta > 0 Then + Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenConsulta).FiltroPrimeroValor("Almacen") + StrAlmacen.AppendFormat("
    Almacén: {0}", Almacen) + End If + End If + + Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia) Return False End If Else @@ -24026,9 +24129,9 @@ Partial Class Ventas Dim AmortizacionNC As Decimal = 0 'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2", "4") Then For Each gvr As GridViewRow In GVAnticipos.Rows - If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3, 12) Then AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal End If Next @@ -25346,6 +25449,8 @@ Partial Class Ventas End If Else PermiteCancelar = False + 'si hay error para obtener información que no continue. + Exit Sub End If End Using @@ -37366,6 +37471,22 @@ Partial Class Ventas End If If PuedeAplicarDevolucion Then + + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + DivMotivoDevolucion.Visible = True + + Using ObjVenta As New ClsVentas + If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then + DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy() + End If + DdlMotivoDevolucion.DataBind() + DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Using + + UpDevolucion.Update() + End If + + RegistraScript("$('#DivAplicaDevolucion').modal('show');") End If @@ -38382,9 +38503,12 @@ Partial Class Ventas DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("2")) End If Else - If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then - DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1")) + If Not (UsuarioActual.Empresa.Funcionalidad(382) = "1") Then + If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then + DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1")) + End If End If + If DdlTipoAmortizacionAnticipo.Items.FindByValue("2") Is Nothing Then DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo con nota de crédito", "2")) End If