diff --git a/App_Code/ClsContPAQi.vb b/App_Code/ClsContPAQi.vb index cfcc0c792..e905fcd03 100644 --- a/App_Code/ClsContPAQi.vb +++ b/App_Code/ClsContPAQi.vb @@ -468,21 +468,9 @@ Public Class ClsContPAQi StrSQL.Append(" EjercicioAsignado, PeriodoAsignado, IETUDeducible, IETUModificado,IETUAcreditable, IdConceptoIETU,UUID)") StrSQL.Append(" VALUES (@IdDevIVA, @RowVersion, @IdPoliza, @IdCuenta, ISNULL ((SELECT MAX (NumDev) FROM DevolucionesIVA WHERE IdPoliza = @IdPoliza), 0) + 1, @IdProveedor, @PorIVA, @SubTotal + @IVA, @SubTotal, @IVA, CASE WHEN @IVA > 0 THEN 1 ELSE 0 END, CASE WHEN @IVA = 0 THEN 1 ELSE 0 END,") StrSQL.Append(" 0, @Serie, @Folio, @Referencia, 0, 0, @SubTotal + @IVA, @RetIVA, @RetISR, @SubTotal + @IVA - @RetIVA - @RetISR,") - StrSQL.Append(" YEAR(@FechaMov), MONTH(@FechaMov),@SubTotal, 0,0,1,@UUID);") + StrSQL.Append(" YEAR(@FechaMov), MONTH(@FechaMov),@SubTotal, 0,0,1,@UUID); ") - StrSQL.Append(" EXEC PA_UpdateId 'Id_DevolucionIVA';") - - StrSQL.Append(" SET @IdDevIVA = dbo.FNC_GetCounter ('Id_MovimientoImpuesto');") - StrSQL.Append(" INSERT INTO MovimientosImpuestos ") - StrSQL.Append(" (Id,RowVersion, IdPoliza, NumMovto, IdPersona, SistOrig, EjercicioAsignado,PeriodoAsignado, IdCuenta,,Captado,AplicaImpuesto,Modificado, ") - StrSQL.Append(" Serie, Folio, Referencia, UUID, Origen, OrigenMovto, Computable, TipoMovimiento, TipoFactor, Impuesto, ObjetoImpuesto, NombreImpuestoLocal, TasaOCuota, ImpBase, ") - StrSQL.Append(" ImpImpuesto, ImpTotal, Desglosado, IVANoAcred, AcumulaIETU, IdConceptoIETU, IETUDeducible, IETUModificado, IETUAcreditable, GuidMov, GuidMovPadre, Migrado,") - StrSQL.Append(" ConceptoIVA,SubconceptoIVA,ClasificadorIVA,ProporcionDIOT,DeducibleDIOT)") - StrSQL.Append(" VALUES (@IdDevIVA, @RowVersion, @IdPoliza, ISNULL ((SELECT MAX (NumMovto) FROM MovimientosImpuestos WHERE IdPoliza = @IdPoliza), 0) + 1, @IdPersona, 1,YEAR(@FechaMov), MONTH(@FechaMov), @IdCuenta, 0,1,0,") - StrSQL.Append(" @Serie, @Folio, @Referencia, @UUID,2, 0,0,0,1,2,0,'',0.16, @SubTotal, @IVA,@SubTotal + @IVA,0, @IVANoAcred,0,0,0,0,'','',0,1,1,1,1,0,0);") - StrSQL.Append(" ") - - StrSQL.Append(" EXEC PA_UpdateId 'Id_MovimientoImpuesto';") + StrSQL.Append(" EXEC PA_UpdateId 'Id_DevolucionIVA'; ") StrSQL.Append(" END TRY") @@ -526,6 +514,130 @@ Public Class ClsContPAQi Return Retorno End Function + Public Function AddMovimientoImpuesto(IdPoliza As Integer, IdCuenta As Integer, IdProveedor As Integer, TasaOCuotaIVA As Double, TasaOCuota As Double, SubTotal As Double, ImpImpuesto As Double, FechaMovto As Date, Referencia As String, Serie As String, Folio As Integer, UUID As String, + NoDeducible As Boolean, IVANoAcred As Double, GuidMov As String, GuidMovPadre As String, TipoMovimiento As Integer, Impuesto As Integer) As Boolean + + + Dim Retorno As Boolean = False + Dim ConceptoIVA As Integer = 0 + Dim SubconceptoIVA As Integer = 0 + Dim ProporcionDIOT As Integer = 100 + Dim DeducibleDIOT As Integer = 1 + + If IdPoliza <= 0 Or IdCuenta <= 0 Then + Return False + End If + + Select Case TasaOCuotaIVA + Case 16 + ConceptoIVA = 1 + SubconceptoIVA = If(SubTotal > 0, 2, 3) + Exit Select + Case 8 + ConceptoIVA = 4 + SubconceptoIVA = If(SubTotal > 0, 5, 6) + Exit Select + Case 0 + ConceptoIVA = 14 + SubconceptoIVA = If(SubTotal > 0, 15, 16) + Exit Select + Case Else + Return False + End Select + + + If NoDeducible Then + ProporcionDIOT = 0 + DeducibleDIOT = 2 + End If + + ' GuidMov, ConceptoIVA SubconceptoIVA ProporcionDIOT DeducibleDIOT + + StrSQL.Clear() + StrSQL.Append(" BEGIN") + + StrSQL.AppendLine(" DECLARE ") + StrSQL.AppendLine(" @Error NVARCHAR(300),") + StrSQL.AppendLine(" @IdMovDev INT;") + StrSQL.AppendLine(" SET NOCOUNT ON;") + + StrSQL.AppendLine(" BEGIN TRY") + + StrSQL.AppendLine(" DECLARE @IdPersona INT = (SELECT TOP 1 PER.Id FROM Proveedores PRO + INNER JOIN Personas PER ON PER.Codigo = PRO.CodigoPersona AND PER.EsProveedor = 1 + WHERE PRO.Id = @IdProveedor); + + IF @IdPersona IS NULL OR @IdPersona <= 0 + BEGIN + DECLARE @ErrorPersona NVARCHAR(300) = Concat('No se encontro el IdPersona del proveedor con id ',@IdProveedor ) + RAISERROR (@ErrorPersona, 16, 1); + END + ") + + StrSQL.AppendLine(" + SET @IdMovDev = dbo.FNC_GetCounter ('Id_MovimientoImpuesto'); + INSERT INTO MovimientosImpuestos + (Id,RowVersion, IdPoliza, NumMovto, IdPersona, SistOrig, EjercicioAsignado,PeriodoAsignado, IdCuenta,Captado,AplicaImpuesto,Modificado, + Serie, Folio, Referencia, UUID, Origen, OrigenMovto, Computable, TipoMovimiento, TipoFactor, Impuesto, ObjetoImpuesto, NombreImpLocal, TasaOCuota, ImpBase, + ImpImpuesto, ImpTotal, Desglosado, IVANoAcred, AcumulaIETU, IdConceptoIETU, IETUDeducible, IETUModificado, IETUAcreditable, GuidMov, GuidMovPadre, Migrado, + ConceptoIVA,SubconceptoIVA,ClasificadorIVA,ProporcionDIOT,DeducibleDIOT) + + VALUES (@IdMovDev, @RowVersion, @IdPoliza, ISNULL ((SELECT MAX (NumMovto) FROM MovimientosImpuestos WHERE IdPoliza = @IdPoliza), 0) + 1, @IdPersona, 0,YEAR(@FechaMov), MONTH(@FechaMov), @IdCuenta, 0, 1, 0, + @Serie, @Folio, @Referencia, @UUID, 2, 0, 1, @TipoMovimiento, 1, @Impuesto, 2,'', @TasaOCuota, @SubTotal, + @ImpImpuesto, (@ImpImpuesto + @SubTotal),0, @IVANoAcred, 0, 0, 0, 0, 0, @GuidMov, @GuidMovPadre, 0, + @ConceptoIVA, @SubconceptoIVA, 0, @ProporcionDIOT, @DeducibleDIOT); + + EXEC PA_UpdateId 'Id_MovimientoImpuesto'; + ") + + + StrSQL.AppendLine(" END TRY") + + StrSQL.AppendLine(" BEGIN CATCH") + StrSQL.AppendLine(" SET @Error = CONCAT('Número: ', ERROR_NUMBER(), '; Procedimiento: ', ERROR_PROCEDURE(), '; Linea: ', ERROR_LINE(), '; Detalle: ', ERROR_MESSAGE());") + StrSQL.AppendLine(" RAISERROR(@Error, 16, 1);") + StrSQL.AppendLine(" END CATCH") + + StrSQL.Append(" END; ") + + SqlDataAdapter(StrSQL.ToString, CommandType.Text) + 'SqlDataAdapter("PA_AddDevolucionIVA") + + With SqlAdapter.SelectCommand.Parameters + .Add("@RowVersion", SqlDbType.Int).Value = GlobalRowVersion + .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza + .Add("@IdCuenta", SqlDbType.Int).Value = IdCuenta + .Add("@IdProveedor", SqlDbType.Int).Value = IdProveedor + .Add("@TasaOCuota", SqlDbType.Float).Value = Math.Round(TasaOCuota, 2) + .Add("@SubTotal", SqlDbType.Float).Value = Math.Round(SubTotal, 2) + .Add("@ImpImpuesto", SqlDbType.Float).Value = Math.Round(ImpImpuesto, 2) + .Add("@IVANoAcred", SqlDbType.Float).Value = Math.Round(IVANoAcred, 2) + .Add("@FechaMov", SqlDbType.DateTime).Value = FechaMovto + .Add("@Referencia", SqlDbType.VarChar).Value = If(Referencia.Length > 30, Referencia.Substring(1, 30), Referencia) + .Add("@Serie", SqlDbType.VarChar).Value = If(Serie.Length > 15, Serie.Substring(1, 15), Serie) + .Add("@Folio", SqlDbType.Int).Value = If(Len(Folio.ToString) <= 8, Folio, Right(Folio.ToString, 8).ToEntero) ' se limita a 8 digitos, sino le cortan y se toman los ultimos 8, para que guarde e contpaqi + .Add("@UUID", SqlDbType.VarChar).Value = UUID + .Add("@ConceptoIVA", SqlDbType.Int).Value = ConceptoIVA + .Add("@SubconceptoIVA", SqlDbType.Int).Value = SubconceptoIVA + .Add("@ProporcionDIOT", SqlDbType.Int).Value = ProporcionDIOT + .Add("@DeducibleDIOT", SqlDbType.Int).Value = DeducibleDIOT + .Add("@GuidMov", SqlDbType.VarChar).Value = GuidMov + .Add("@GuidMovPadre", SqlDbType.VarChar).Value = GuidMovPadre + .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento + .Add("@Impuesto", SqlDbType.Int).Value = Impuesto + End With + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un Error al agregar el movimiento de impuesto de egresos en la póliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateDevolucionesIVA(Id As Integer, IdPoliza As Integer, IdCuenta As Integer, IdProveedor As Integer, PorIVA As Double, SubTotal As Double, IVA As Double, RetIVA As Double, RetISR As Double, FechaMovto As Date, Referencia As String, Serie As String, Folio As Integer) As Boolean Dim Retorno As Boolean = False @@ -2278,6 +2390,7 @@ Public Class ClsContPAQi StrSQL.AppendLine(" @NumMovto INT,") StrSQL.AppendLine(" @IdDiario INT,") StrSQL.AppendLine(" @SegNegMovtos INT,") + StrSQL.AppendLine(" @IdMoneda INT,") StrSQL.AppendLine(" @Fecha DATETIME,") StrSQL.AppendLine(" @IDEjercicio INT,") StrSQL.AppendLine(" @TimeStamp NVARCHAR (200);") @@ -2288,10 +2401,11 @@ Public Class ClsContPAQi StrSQL.AppendLine(" SET @Fecha = @FechaMov;") StrSQL.AppendLine(" SET @IdDiario = 0;") StrSQL.AppendLine(" SELECT @Ejercicio = P.Ejercicio, @Periodo = P.Periodo, @TipoPol = TipoPol, @Folio = P.Folio FROM Polizas P WHERE Id = @IdPoliza;") - StrSQL.AppendLine(" SELECT @SegNegMovtos = SegNegMovtos FROM Cuentas C WHERE Id = @IdCuenta;") + StrSQL.AppendLine(" SELECT @SegNegMovtos = SegNegMovtos, @IdMoneda = IdMoneda FROM Cuentas C WHERE Id = @IdCuenta;") StrSQL.AppendLine("") StrSQL.AppendLine(" BEGIN TRY") StrSQL.AppendLine(" ") + StrSQL.AppendLine(" IF (@IdMoneda = 1) SET @ImporteME = 0; ") ''DESCOMENTAR PARA CIERRE PERIODO 'StrSQL.AppendLine("DECLARE") diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 8f709f32e..944f482ba 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5867,7 +5867,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function AddCuentasGlobales(CveConceptoContable As Integer, CveCuenta As Integer, TipoGlobal As Integer, CveEmpresa As Integer) As Boolean + Public Function AddCuentasGlobales(CveConceptoContable As Integer, CveCuenta As Integer, TipoGlobal As Integer, CveEmpresa As Integer, PorcentajeImpuesto As Decimal, CveColectiva As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_CuentasGlobalesAdd") @@ -5877,6 +5877,8 @@ Public Class ClsContabilidad .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@TipoGlobal", SqlDbType.Int).Value = TipoGlobal .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto + .Add("@CveColectiva", SqlDbType.Int).Value = CveColectiva End With Try diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 7b7617049..5ce060b9a 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -386,26 +386,34 @@ Public Class ClsGenerales Return ds End Function - Public Function GetDashboardData(CveEmpresa As Integer) As DataSet - Dim ds As New DataSet - DataAdapter("PA_Gral_DashboardsGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@Opcion", SqlDbType.Int).Value = 1 - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@FechaInicio", SqlDbType.Date).Value = Date.Now.AddYears(-1) - .Add("@FechaFin", SqlDbType.Date).Value = Date.Now - End With + Public Sub GetDashboardData(Opcion As Integer, CveEmpresa As Integer, FechaInicio As Date, FechaFin As DateTime) - Try - SqlAdapter.Fill(ds) - ds.Tables(0).TableName = "Indicadores" - ds.Tables(1).TableName = "DetalleDia" - Return ds - Catch ex As Exception - ' Manejo de errores - Return Nothing - End Try - End Function + DataAdapter("PA_Gral_DashboardsGet") + SqlAdapter.SelectCommand.CommandTimeout = 0 + With SqlAdapter.SelectCommand.Parameters + .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + End With + + Try + SqlAdapter.Fill(DSet) + DSet.Tables(0).TableName = "Indicadores" + DSet.Tables(1).TableName = "DetalleDia" + DSet.Tables(2).TableName = "DetalleAnualesMes" + DSet.Tables(3).TableName = "VentasPorVendedor" + DSet.Tables(4).TableName = "VentasPorClasificacion" + DSet.Tables(5).TableName = "VentasPorMarca" + DSet.Tables(6).TableName = "VentasPorPS" + DSet.Tables(7).TableName = "VentasPorCliente" + DSet.Tables(8).TableName = "VentasPorProveedor" + + Catch ex As Exception + ' Manejo de errores + OnError("Ocurrió un error al obtener los datos del Dashboard.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + End Sub #End Region @@ -1649,7 +1657,7 @@ Public Class ClsGenerales Public Function AddCuentasDepositos(BancoNombre As String, Plaza As String, Sucursal As String, Cuenta As String, CLABE As String, CIE As String, SWIFT As String, Referencia As String, RefCrediProveedor As String, CveUsuario As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveColectiva As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional Correo As String = "", Optional BBVAAlias As String = "-1", Optional EstatusPagoElectronico As Boolean = False, Optional EstatusPagoElectronicoGrupos As Boolean = False, Optional CveSATBanco As Integer = -1, - Optional ConceptoCIE As String = "-1") As Boolean + Optional ConceptoCIE As String = "-1", Optional Estatus As Boolean = True) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_CuentasDepositosAdd") @@ -1678,6 +1686,7 @@ Public Class ClsGenerales .Add("@EstatusPagoElectronicoGrupos", SqlDbType.Bit).Value = EstatusPagoElectronicoGrupos .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco .Add("@ConceptoCIE", SqlDbType.VarChar).Value = ConceptoCIE + .Add("@Estatus", SqlDbType.VarChar).Value = Estatus End With diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index e70e86699..0b28c1fba 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -94,6 +94,8 @@ Public Class ClsInventarios Public Property CveOrdenCompra As Integer Public Property CveOrdenCompraLiga As Integer Public Property FolioOC As String + Public Property DescripcionOC As String + Public Property CvePS As Integer Public Property CveEntregaForanea As Integer Public Property CvePaqueteriaGuia As Integer @@ -852,6 +854,7 @@ Public Class ClsInventarios CveOrdenCompra = dr("CveOrdenCompra").ToString.ToEntero CveOrdenCompraLiga = dr("CveOrdenCompraLiga").ToString.ToEntero FolioOC = dr("FolioOC").ToString + DescripcionOC = dr("DescripcionOC").ToString FolioInterno = dr("VentaAnticipo").ToString CveCliente = If(dr("CveCliente").ToString.ToEntero > 0, dr("CveCliente").ToString.ToEntero, -1) CveClienteSucursal = If(dr("CveClienteSucursal").ToString.ToEntero > 0, dr("CveClienteSucursal").ToString.ToEntero, -1) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index eab32a2b1..0bc7b8015 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -11067,6 +11067,7 @@ Public Class ClsPaginas 'Reportes de Anticipos-NC-IXC PaginaDict.Add("/Ventas/RepAnticipo-NC-IXC.aspx".ToUpper(), 869) PaginaDict.Add("/Ventas/RepAnticipo-NC-IXCDetalle.aspx".ToUpper(), 869) + PaginaDict.Add("/Ventas/RepAnticipo-NC-IXCAplicados.aspx".ToUpper(), 877) PaginaDict.Add("/Ventas/CatAutorizacionDescuentos.aspx".ToUpper(), 1037) PaginaDict.Add("/Ventas/RepPUESinPago.aspx".ToUpper(), 672) PaginaDict.Add("/Ventas/RepVentasResumen.aspx".ToUpper(), 674) diff --git a/App_Code/ClsValidaCFDi.vb b/App_Code/ClsValidaCFDi.vb index 35248b76d..4b480d905 100644 --- a/App_Code/ClsValidaCFDi.vb +++ b/App_Code/ClsValidaCFDi.vb @@ -41,9 +41,9 @@ Public Class ClsValidaCFDi End Sub Public Sub New(FolioFiscal As String, RFCEmisor As String, RFCReceptor As String, Optional Importe As Decimal = 0) - Me.LFolioFiscal = HttpUtility.UrlEncode(FolioFiscal) - Me.LRFCEmisor = HttpUtility.UrlEncode(RFCEmisor) - Me.LRFCReceptor = HttpUtility.UrlEncode(RFCReceptor) + Me.LFolioFiscal = FolioFiscal + Me.LRFCEmisor = RFCEmisor + Me.LRFCReceptor = RFCReceptor Me.LImporte = Importe VerificaCFDI() End Sub diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 223f40d59..9250bda95 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4771,6 +4771,31 @@ Public Class ClsVentas Return Retorno End Function + Public Function GetRepAnticiposNCIXCAplicados(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1, Optional ConSaldo As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_RepAnt-NC-IXCAplicadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaICorte", SqlDbType.Date).Value = FechaICorte + .Add("@FechaFCorte", SqlDbType.Date).Value = FechaFCorte + .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio + .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de aplicaiones de anticipos - nc - ixc .", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function GetRepAnticiposNCIXCDetalle(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, ConSaldo As Integer, Tipo As Integer, CveMoneda As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1, Optional SaldoMayorA As Decimal = -999999999999, Optional SaldoMenorA As Decimal = 999999999999) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 42765c4be..e0251b3d1 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4334,7 +4334,7 @@ Namespace Modelos Next End If - If ObjConta.ValidacionesPrePoliza(ObjFactura.CvePrePoliza, UsuarioActual, Opcion:=2) Then + If Not ErrorPrepoliza AndAlso ObjConta.ValidacionesPrePoliza(ObjFactura.CvePrePoliza, UsuarioActual, Opcion:=2) Then If ObjConta.ValorPolizaDescuadre > 0 Then If ObjConta.ValorPolizaDescuadre = 2 Then ErrorList.Add(ObjConta.MensajePolizaDescuadre) @@ -5805,7 +5805,7 @@ Namespace Modelos End If 'CUANDO SE CANCELA, Y TIENE RELACIONADA UNA REMISIÓN, Y ESTA NO SE CANCELARÁ. DEBE DE HACER EN AUTOMÁTICO LOS MOVIMIENTOS AL ALMACEN DE ENTREGA POR ADELANTADO - Dim RevivirRemisiones As Boolean = Not EsRefacturacion AndAlso ((TieneRemisionesRelacionadas AndAlso ListaRemisionesCancelar Is Nothing) OrElse (DtRemisionesRelacionadas.Rows.Count > ListaRemisionesCancelar.Count)) + Dim RevivirRemisiones As Boolean = Not EsRefacturacion AndAlso ((TieneRemisionesRelacionadas AndAlso ListaRemisionesCancelar Is Nothing) OrElse (ListaRemisionesCancelar IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > ListaRemisionesCancelar.Count)) 'REMISION YA SE DEBE HACER POR EL PROCESO DE DEVOLUCION DE ALMACEN If Not EsRefacturacion AndAlso (ObjFactura.SaldoAlmacen <> 0 AndAlso ObjFactura.EsDevolucionVenta.Contiene(0, 1)) AndAlso Not (RealizarDevolucionAlmacen.Contiene(1, 2)) And RevivirRemisiones = False Then diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index 034a71d08..ec403c3e2 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -233,6 +233,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, CveEmpresa:=CveEmpresa) + HttpContext.Current.Session("UsuarioSIG") = UsuarioActual End If ObjUsuarios.Dispose() Return UsuarioActual diff --git a/Ashx/TareasProgramadas.ashx b/Ashx/TareasProgramadas.ashx index fb461e57e..8e79bea06 100644 --- a/Ashx/TareasProgramadas.ashx +++ b/Ashx/TareasProgramadas.ashx @@ -108,7 +108,9 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState context.Response.Write(retorno) Case "EstadosCuenta" 'CargaEstadosCuenta(context, 119, 227774) - CargaEstadosCuenta(context, 119, -1, FechaEnvio, FechaActual) + 'CargaEstadosCuenta(context, 119, -1, FechaEnvio, FechaActual) + Dim tCveEmpresa As Integer = context.Request("CveEmpresa").ToString.ToEntero + CargaEstadosCuenta(context, tCveEmpresa, -1, FechaEnvio, FechaActual) Case "ScoreCard" CargaScoreCard(context, 140, FechaEnvio) @@ -354,6 +356,9 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState #Region "E S T A D O S D E C U E N T A" Private Sub CargaEstadosCuenta(ByVal context As HttpContext, pCveEmpresa As Integer, pCveCliente As Integer, FechaEnvio As DateTime, FechaActual As DateTime) + + Dim Usuario As Usuario = ValidaUsuarioSistema(100, pCveEmpresa) + Dim Retorno As New JArray() Dim DtEmpresas As DataTable = Nothing Using ObjEmpresas As New ClsSisEmpresas() @@ -364,7 +369,7 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState If DtEmpresas IsNot Nothing Then For Each Row As DataRow In DtEmpresas.Rows - Dim Usuario As Usuario = ValidaUsuarioSistema(100, Row("CveEmpresa").ToString().ToEntero()) + 'Dim Usuario As Usuario = ValidaUsuarioSistema(100, Row("CveEmpresa").ToString().ToEntero()) Dim obj As JObject = EjecutarEnvioEstadoCuenta(Usuario, FechaEnvio, FechaActual, pCveCliente:=pCveCliente) Retorno.Add(obj) @@ -499,7 +504,9 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState Dim Envio As Boolean = False If Not String.IsNullOrEmpty(Correo) Then + 'Correo = "oscar.irigoyen@adssistemas.mx" Envio = EnviarEstadoCuenta(UsuarioActual, Correo, Cliente) + GuardaLog($"Log envio Estados Cuenta correo {If(Envio, "Enviado", "Error")} CveCliente {CveCliente} ") End If If Envio Then @@ -522,6 +529,7 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState New JProperty("Cliente", Cliente.Nombre) )) End If + End If Next End If @@ -857,7 +865,10 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState If sw.Elapsed.TotalSeconds > 10 Then GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ") End If - If MR IsNot Nothing Then MR.Dispose() + If MR IsNot Nothing Then + 'MR.Close() + MR.Dispose() + End If Return Bytes End Function diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 7f47b4731..4fd113f60 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -545,16 +545,7 @@ Partial Class Bancos_PopIEVentas FechaVenta = dr("Fecha").ToString.ToDate SaldoVenta = dr("Saldo").ToString.ToDouble - - 'Cortes de Caja - If UsuarioActual.TienePermisoProceso(160) Then - CargaCorteCaja() - End If - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" OrElse (dr("CveCorte").ToString.ToEntero > 0) Then 'toma como proridad el que viene de - CveCorte = dr("CveCorte").ToString.ToEntero - End If - + Me.CveCorte = CargaCorteCaja(pCveVenta, UsuarioActual) If RFCCliente.ToUpper <> "XAXX010101000" Then Dim CveProveedor As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa, RFC:=RFCCliente.ToUpper).FiltroPrimeroValor("CveProveedor").ToEntero @@ -581,18 +572,57 @@ Partial Class Bancos_PopIEVentas ObjVenta.Dispose() End Sub - Private Sub CargaCorteCaja() - 'Checar si hay un Turno Abierto - Dim ObjPVenta As New ClsPuntoVenta + Protected Function CargaCorteCaja(CveVenta As Integer, UsuarioActual As Usuario) As Integer + Dim CveCorte As Integer = -1 - If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then + Dim CveCorteVenta As Integer = -1 + Dim EsCredito As Boolean = False + Dim UsaCorteActual As Boolean = False - If ObjPVenta.DtResultados.Rows.Count > 0 Then - CveCorte = ObjPVenta.CveCorte + If CveVenta > 0 Then + Using ObjVentas As New ClsVentas + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then + EsCredito = If(ObjVentas.DtResultados.FiltroPrimeroValor("CondicionesPago").ToEntero() = 1, True, False) + CveCorteVenta = ObjVentas.DtResultados.FiltroPrimeroValor("CveCorte").ToEntero() + End If + End Using + + If UsuarioActual.TienePermisoProceso(160) OrElse UsuarioActual.TienePermisoProceso(371) Then + 'SI ES FACTURA A CREDITO + If EsCredito OrElse CveCorteVenta <= 0 Then + UsaCorteActual = True + End If + End If + + 'SI ES CONTADO TOMAR EL DE LA VENTA + If Not EsCredito Then + UsaCorteActual = False + End If + + 'EN BDH TOMAR EL DE LA VENTA + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + UsaCorteActual = False + End If + Else + If UsuarioActual.TienePermisoProceso(160) OrElse UsuarioActual.TienePermisoProceso(371) Then + UsaCorteActual = True End If End If - ObjPVenta.Dispose() - End Sub + + If UsaCorteActual Then + Dim ObjPVenta As New ClsPuntoVenta + If ObjPVenta.GetVta_Cortes("-1", "-1", UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, 0) Then + If ObjPVenta.DtResultados.Rows.Count > 0 Then + CveCorte = ObjPVenta.CveCorte + End If + End If + ObjPVenta.Dispose() + Else + CveCorte = CveCorteVenta + End If + + Return CveCorte + End Function Private Sub CargaCliente(ByVal CveCliente As Integer, RFC As String) Dim ObjCliente As New ClsClientes diff --git a/Bancos/RepCortes.aspx b/Bancos/RepCortes.aspx index 0f8f26f74..7c9ebeeb3 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -131,7 +131,7 @@ - + @@ -315,7 +315,7 @@ - <%----%> + @@ -448,6 +448,11 @@ + + + + + diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index 177d8cb61..75c14e827 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -90,6 +90,10 @@ Partial Class Bancos_RepCortes GvDatos.Columns(4).Visible = True End If + If UsuarioActual.CveRol = 1 Then + GvDatos.Columns(21).Visible = True 'COLUMNA DE CveCorte + End If + GvP.DataBind() GvDep.DataBind() GvPorIVA.DataBind() @@ -196,32 +200,7 @@ Partial Class Bancos_RepCortes Fecha = gvr.DataKey("FechaInicial") Nombre = gvr.DataKey("Nombre") - 'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then - ' DtCortesVentas = ObjPuntoVenta.DtResultados.Copy() - ' GvD.DataSource = DtCortesVentas - - ' divDetalle.Visible = True - 'End If - - 'If ObjVentas.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - ' GvP.DataSource = ObjVentas.DtResultados - ' DtCortesVentasResumen = ObjVentas.DtResultados - 'End If - - 'If UsuarioActual.CveEmpresa.Contiene(190, 192) Then - ' DivIVA.Visible = True - ' If ObjVentas.GetCortesDetalleVentasResumenIVA(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - ' GvPorIVA.DataSource = ObjVentas.DtResultados - ' End If - 'End If - Dim FechaConsulta = ModExtensiones.MaxFecha - - Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1" - - If ConsultaPorSucursal Then - CveCorte = -1 - FechaConsulta = gvr.DataKey("FechaInicial").ToDate() - End If + Dim FechaConsulta = gvr.DataKey("FechaInicial").ToDate() Dim ObjVentas As New ClsVentas If ObjVentas.GetVta_ReporteCortesDetalle(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Opcion:=2, ConsultaIVA:=UsuarioActual.CveEmpresa.Contiene(190, 192), FechaConsulta:=FechaConsulta) Then @@ -231,6 +210,10 @@ Partial Class Bancos_RepCortes DtCortesVentas = DsDatos.Tables(0) GvD.DataSource = DtCortesVentas + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + GvD.Columns(3).Visible = True + End If + divDetalle.Visible = True 'RESUMEN DtCortesVentasResumen = DsDatos.Tables(1) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 034b3d77b..889e34b70 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -716,6 +716,8 @@ P.U.  IVA  IEPS  + Ret. IVA  + Ret. ISR  Total 
¿No Deducible?  @@ -826,55 +828,69 @@ + <%-- 10 --%> + + +
+ +
+
+ <%-- 11 --%> + + +
+ +
+
- <%-- 10 --%> + <%-- 12 --%> - <%-- 11 --%> + <%-- 13 --%> - <%-- 12 --%> + <%-- 14 --%> - <%-- 13 --%> + <%-- 15 --%> - <%-- 14 --%> + <%-- 16 --%> - <%-- 15 --%> + <%-- 17 --%> - <%-- 16 --%> + <%-- 18 --%> - <%-- 17 --%> + <%-- 19 --%> - <%-- 18 --%> + <%-- 12 --%> diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6ed284990..45306e38b 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -978,6 +978,36 @@ Partial Class Compras_Compras End Set End Property + + + Private Property ProvRetIVA As Decimal + Get + If ViewState("ProvRetIVA") Is Nothing Then + ViewState("ProvRetIVA") = 0 + End If + + Return ViewState("ProvRetIVA").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("ProvRetIVA") = value + End Set + End Property + + Private Property ProvRetISR As Decimal + Get + If ViewState("ProvRetISR") Is Nothing Then + ViewState("ProvRetISR") = 0 + End If + + Return ViewState("ProvRetISR").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("ProvRetISR") = value + End Set + End Property + + + Private Property TotalOriginal As Decimal Get If ViewState("TotalOriginal") Is Nothing Then @@ -1332,6 +1362,8 @@ Partial Class Compras_Compras Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then 'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip") 'ImgBtnBuscarOC.Attributes.Add("data-placement", "top") @@ -1749,10 +1781,10 @@ Partial Class Compras_Compras DdlTipoComprobante.SelectedValueExist("DEV") End If - If Not CveCompra > 0 Then - LnkProrrateoGasolina.Visible = True - InicializaDTProrrateoGasolina() - End If + 'If Not CveCompra > 0 Or (CveCompra > 0 And UsuarioActual.CveEmpresa = 141) Then + LnkProrrateoGasolina.Visible = True + InicializaDTProrrateoGasolina() + 'End If 'If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then ' If Request("SaldarRNC") IsNot Nothing AndAlso Request("SaldarRNC").ToString.ToEntero = 1 Then @@ -1787,7 +1819,7 @@ Partial Class Compras_Compras End If - MostrarOcultarColumnaIEPS() + MostrarOcultarColumnaIEPSRetIVARetISR() End Sub @@ -1886,7 +1918,7 @@ Partial Class Compras_Compras #Region "C A R G A S" - Private Sub MostrarOcultarColumnaIEPS() + Private Sub MostrarOcultarColumnaIEPSRetIVARetISR() If TxtIEPS.Text.ToDecimal <> 0 And TmpDT.SUM("IEPSPS") <> 0 Then @@ -1896,6 +1928,25 @@ Partial Class Compras_Compras GvPS.Columns(9).Visible = False TD_Gvps_IEPS.Visible = False End If + + If TxtRetIVA.Text.ToDecimal <> 0 And TmpDT.SUM("RetIVA") <> 0 Then + GvPS.Columns(10).Visible = True + TdRetIVA.Visible = True + Else + GvPS.Columns(10).Visible = False + TdRetIVA.Visible = False + End If + + + If TxtRetISR.Text.ToDecimal <> 0 And TmpDT.SUM("RetISR") <> 0 Then + GvPS.Columns(11).Visible = True + TdRetISR.Visible = True + Else + GvPS.Columns(11).Visible = False + TdRetISR.Visible = False + End If + + UpPS.Update() End Sub @@ -2562,7 +2613,7 @@ Partial Class Compras_Compras DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) End If - If DIOTCveTipoOperacion.Contiene(0, 3) Then ' 85 - Otros + If DIOTCveTipoOperacion.Contiene(0, 3, 4) Then ' 85 - Otros If UsuarioActual.CveEmpresa <> 119 Then DdlRetIVAConcepto.Items.Insert(0, New ListItem("Honorarios/Serv. Prof.", "1")) DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) @@ -2585,7 +2636,7 @@ Partial Class Compras_Compras DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) End If - If DIOTCveTipoOperacion.Contiene(3) Then ' 85 - Otros + If DIOTCveTipoOperacion.Contiene(3, 4) Then ' 85 - Otros If UsuarioActual.CveEmpresa <> 119 Then DdlRetIVAConcepto.Items.Insert(0, New ListItem("Honorarios/Serv. Prof.", "1")) DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4")) @@ -2619,7 +2670,7 @@ Partial Class Compras_Compras DdlRetISRConcepto.Items.Insert(0, New ListItem("Arrendamiento", "2")) End If - If DIOTCveTipoOperacion.Contiene(3) Then ' 85 - Otros + If DIOTCveTipoOperacion.Contiene(3, 4) Then ' 85 - Otros If UsuarioActual.CveEmpresa <> 119 Then DdlRetISRConcepto.Items.Insert(0, New ListItem("Honorarios", "1")) DdlRetISRConcepto.Items.Insert(1, New ListItem("Arrendamiento", "2")) @@ -2954,6 +3005,11 @@ Partial Class Compras_Compras TxtIVA.Text = dr("IVA").ToString.FormatoNumero(2) TxtRetIVA.Text = dr("RetIVA").ToString.FormatoNumero(2) TxtRetISR.Text = dr("RetISR").ToString.FormatoNumero(2) + + RetIVAOriginal = dr("RetIVA").ToString.ToDecimal + RetISROriginal = dr("RetISR").ToString.ToDecimal + + TxtIEPS.Text = dr("IEPS").ToString.FormatoNumero(2) If dr("IEPS").ToString.ToDouble > 0 Then TrIEPS.Visible = True If dr("RetIVA").ToString.ToDouble > 0 Then TrRetIVA.Visible = True @@ -3777,6 +3833,9 @@ Partial Class Compras_Compras End If End If + ProvRetIVA = ObjProveedor.RetIVA.ToDecimal + ProvRetISR = ObjProveedor.RetISR.ToDecimal + If CveCompra <= 0 AndAlso CveFactura <= 0 Then 'si se está cargando una factura o compra no se carga 'LblRetIVA.Text = ObjProveedor.RetIVA.ToString.FormatoNumero(5) 'LblRetISR.Text = ObjProveedor.RetISR.ToString.FormatoNumero(5) @@ -7954,67 +8013,73 @@ Partial Class Compras_Compras AutoConta = False End If - If Not ErrorPrepoliza AndAlso Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=4, AutoConta:=AutoConta) Then - TieneError = True - If ObjConta.ValorPolizaDescuadre > 0 Then - Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError) - ErrorPrepolizaDescuadre = True - End If + Dim OpValidacion As Integer = 4 + + If UsuarioActual.CveEmpresa.Contiene(7, 11, 12, 122, 145) AndAlso RBLPago.SelectedValue.ToEntero = 3 AndAlso RBLContado.SelectedValue.ToEntero.Contiene(6, 2) Then + OpValidacion = 499 End If - If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 OrElse ImporteRNCProntoPago > 0) Then + If Not ErrorPrepoliza AndAlso Not ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=OpValidacion, AutoConta:=AutoConta) Then + TieneError = True + If ObjConta.ValorPolizaDescuadre > 0 Then + Alert($"{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia}", TipoMensaje.MsgError) + ErrorPrepolizaDescuadre = True + End If + End If - If ImporteRNC > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNC, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, + If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 OrElse ImporteRNCProntoPago > 0) Then + + If ImporteRNC > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNC, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, TxtSerie.Text, TxtFolio.Text) Then - TieneError = True - End If + TieneError = True + End If - If ImporteRNCProntoPago > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNCProntoPago, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, + If ImporteRNCProntoPago > 0 AndAlso Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", ImporteRNCProntoPago, DdlMoneda.SelectedValue.ToEntero, TxtTC.Text.ToDecimal, TxtSerie.Text, TxtFolio.Text, PrefijoSerie:="PP") Then - TieneError = True + TieneError = True + End If + + End If + + If Not TieneError Then + ObjCompras.Commit() + If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() + + Dim CveEvaluacionProveedor As Integer = -1 + + If Me.RequiereEvaluacion Then + Dim ObjPro As New ClsCompProveedores() + CveEvaluacionProveedor = ObjPro.AddEvaluacionProveedor(CveProveedor, CveCompra, NowADS(), "", Me.CveUsuarioEvaluador, "", "", UsuarioActual.CveEmpresa) + ObjPro.Dispose() + End If + + 'ENVIO DE CORREO NOTIFICACION A VENDEDORES DE OC + MandaCorreoOCVendedores(CveCompra) + If Not ErrorMovInv Then + For Each intMovimientoAlmacen As Integer In ListaMovimientosAlmacen + MandaCorreoOCVendedoresRecepcionAlmacen(CveCompra, intMovimientoAlmacen) + Next + End If + + If CveEvaluacionProveedor > 0 Then + Msg.Append("

El proveedor tiene evaluaciones pendientes
") + Msg.Append("¿Desea realizar una evaluación al proveedor?") + Msg.AppendFormat($"
Evaluar Proveedor.") + End If + + BtnGuardar.Enabled = False + UpFacturar.Update() + + Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) + Else + ObjCompras.RollBack() + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente.", TipoMensaje.MsgError) End If End If - If Not TieneError Then - ObjCompras.Commit() - If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() - - Dim CveEvaluacionProveedor As Integer = -1 - - If Me.RequiereEvaluacion Then - Dim ObjPro As New ClsCompProveedores() - CveEvaluacionProveedor = ObjPro.AddEvaluacionProveedor(CveProveedor, CveCompra, NowADS(), "", Me.CveUsuarioEvaluador, "", "", UsuarioActual.CveEmpresa) - ObjPro.Dispose() - End If - - 'ENVIO DE CORREO NOTIFICACION A VENDEDORES DE OC - MandaCorreoOCVendedores(CveCompra) - If Not ErrorMovInv Then - For Each intMovimientoAlmacen As Integer In ListaMovimientosAlmacen - MandaCorreoOCVendedoresRecepcionAlmacen(CveCompra, intMovimientoAlmacen) - Next - End If - - If CveEvaluacionProveedor > 0 Then - Msg.Append("

El proveedor tiene evaluaciones pendientes
") - Msg.Append("¿Desea realizar una evaluación al proveedor?") - Msg.AppendFormat($"
Evaluar Proveedor.") - End If - - BtnGuardar.Enabled = False - UpFacturar.Update() - - Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) Else - ObjCompras.RollBack() - If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() - Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente.", TipoMensaje.MsgError) - End If - - End If - - Else ObjCompras.RollBack() If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() Alert("Ocurrio un error al guardar la compra. Por favor intente nuevamente..", TipoMensaje.MsgError) @@ -10739,12 +10804,12 @@ Partial Class Compras_Compras If e.Row.RowIndex = 0 Then If UsuarioActual.Empresa.UsaAC Then 'AndAlso (CveFactura > 0 Or CveCompra > 0) - e.Row.Cells(13).Width = Unit.Pixel(150) - e.Row.Cells(14).Width = Unit.Pixel(150) e.Row.Cells(15).Width = Unit.Pixel(150) e.Row.Cells(16).Width = Unit.Pixel(150) e.Row.Cells(17).Width = Unit.Pixel(150) - e.Row.Cells(18).Width = Unit.Pixel(100) + e.Row.Cells(18).Width = Unit.Pixel(150) + e.Row.Cells(19).Width = Unit.Pixel(150) + e.Row.Cells(20).Width = Unit.Pixel(100) End If End If @@ -10847,11 +10912,11 @@ Partial Class Compras_Compras 'CargaPresupuestosEgresos If UsuarioActual.Empresa.UsaAC Then - e.Row.Cells(14).Visible = True - e.Row.Cells(15).Visible = True e.Row.Cells(16).Visible = True e.Row.Cells(17).Visible = True e.Row.Cells(18).Visible = True + e.Row.Cells(19).Visible = True + e.Row.Cells(20).Visible = True e.Row.FCDropDownList("DdlAC1").Items.Clear() e.Row.FCDropDownList("DdlAC1").DataSource = DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveProgramaOperativo", "ProgramaOperativo"}) @@ -10882,19 +10947,19 @@ Partial Class Compras_Compras 'SI EL PRESUPUESTO DE EGRESOS VIENE DESDE LA OC, SE BLOQUEA PE If e.Row.DBCampo("CveOrdenCompraDetalle").ToEntero > 0 AndAlso e.Row.DBCampo("CvePresupuestoEgreso").ToEntero > 0 Then - e.Row.Cells(14).Enabled = False - e.Row.Cells(15).Enabled = False e.Row.Cells(16).Enabled = False e.Row.Cells(17).Enabled = False e.Row.Cells(18).Enabled = False + e.Row.Cells(19).Enabled = False + e.Row.Cells(20).Enabled = False End If Else - e.Row.Cells(14).Visible = False - e.Row.Cells(15).Visible = False e.Row.Cells(16).Visible = False e.Row.Cells(17).Visible = False e.Row.Cells(18).Visible = False + e.Row.Cells(19).Visible = False + e.Row.Cells(20).Visible = False End If End If @@ -13049,12 +13114,12 @@ Partial Class Compras_Compras 'Seccion Grid GvPS.Width = 1760 - GvPS.Columns(13).Visible = True - GvPS.Columns(14).Visible = True GvPS.Columns(15).Visible = True GvPS.Columns(16).Visible = True GvPS.Columns(17).Visible = True GvPS.Columns(18).Visible = True + GvPS.Columns(19).Visible = True + GvPS.Columns(20).Visible = True 'Panel General UpPresupuestosAC.Visible = True @@ -17546,10 +17611,15 @@ Partial Class Compras_Compras If TxtDescuento.Text.ToDouble > 0 Then TrDescuento.Visible = True If ActualizaTotales And (UsuarioActual.CveEmpresa = 72 Or Not CveCompraFactura > 0) Then - TxtTotal.Text = Total.ToString.FormatoNumero() - If CveCompra > 0 AndAlso CveCompraFactura = 0 Then + + If Not (CveFactura > 0 And CveCompra <= 0) Then + TxtTotal.Text = Total.ToString.FormatoNumero() + ElseIf CveCompra > 0 AndAlso CveCompraFactura = 0 Then 'Compra manual que ya estaba registrada + TxtTotal.Text = Total.ToString.FormatoNumero() TxtIVA.Text = IVA.ToString.FormatoNumero() End If + + End If Else @@ -17600,7 +17670,7 @@ Partial Class Compras_Compras CargaRetISRConcepto() Dim NumNoDed As Integer = TmpDT.COUNT("CvePS", "NoDeducible = True ") - If NumNoDed > 0 Then GvPS.Columns(11).Visible = True 'visualiza columnas de nodeducibles + If NumNoDed > 0 Then GvPS.Columns(13).Visible = True 'visualiza columnas de nodeducibles 'If DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") And CveFactura <= 0 Then ' InicializaAplicaNCFact() @@ -18151,6 +18221,9 @@ Partial Class Compras_Compras HdnPS.Value = PS("PSCodigo").ToString LblUnidadMedida.Text = PS("UnidadMedida").ToString + Dim PsRetIVA As Decimal = PS("RetIVA").ToString.ToDecimal + Dim PsRetISR As Decimal = PS("RetISR").ToString.ToDecimal + ddlUM.Items.Clear() If UsuarioActual.Empresa.UsaInventarios Then ddlUM.DataSource = GlobalDTProductosServiciosEquivalencias(PS("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) @@ -18230,6 +18303,19 @@ Partial Class Compras_Compras TxtRetIVAModal.Text = FormatoNumero(ViewState("RetIVA").ToString().ToDouble * 100, 6) TxtRetISRModal.Text = FormatoNumero(ViewState("RetISR").ToString().ToDouble * 100, 6) + 'OIC 2025-04-29 + If CveCompra > 0 AndAlso Modalidad = "A" Then + If ProvRetIVA > 0 Or ProvRetISR > 0 Then + TxtRetIVAModal.Text = FormatoNumero(ProvRetIVA, 6) + TxtRetISRModal.Text = FormatoNumero(ProvRetISR, 6) + ElseIf PsRetIVA > 0 Or PsRetISR > 0 Then + TxtRetIVAModal.Text = FormatoNumero(PsRetIVA, 6) + TxtRetISRModal.Text = FormatoNumero(PsRetISR, 6) + End If + End If + + + If (CveFactura > 0 Or CveCompra > 0) And TxtIEPS.Text.ToDecimal = 0 And PS("IEPSPorcentaje").ToString.ToDecimal > 0 Then TxtIEPSModal.Text = "0" Alert("El producto seleccionado contiene IEPS, pero el acumulado de la factura no contiene IEPS, por lo que no se agregara el impuesto.", TipoMensaje.MsgAdvertencia) @@ -18518,7 +18604,7 @@ Partial Class Compras_Compras UpPS.Update() CargaGvPersonal() - MostrarOcultarColumnaIEPS() + MostrarOcultarColumnaIEPSRetIVARetISR() End Sub @@ -20300,7 +20386,7 @@ Partial Class Compras_Compras Alert("Debe seleccionar al menos un impuesto", TipoMensaje.MsgAdvertencia) End If - MostrarOcultarColumnaIEPS() + MostrarOcultarColumnaIEPSRetIVARetISR() AddPS2() End Sub #End Region @@ -21156,12 +21242,12 @@ Partial Class Compras_Compras If ChkEsNoDeducible.Checked Then EsNoDeducible = True dvNoDeducible.Visible = True - GvPS.Columns(11).Visible = True + GvPS.Columns(13).Visible = True DivEsNoDeducible.Visible = True Else EsNoDeducible = False dvNoDeducible.Visible = False - GvPS.Columns(11).Visible = False + GvPS.Columns(13).Visible = False DivEsNoDeducible.Visible = False End If @@ -22955,6 +23041,16 @@ Partial Class Compras_Compras End If If DTProrrateoGasolina.Rows.Count > 0 Then + + If CveCompra > 0 Then + For Each dRow As DataRow In TmpDT.Rows + Dim CveCompraDetalle As Integer = dRow("CveCompraDetalle").ToString.ToEntero + If CveCompraDetalle > 0 Then + ClavesBorradas.Add(CveCompraDetalle) + End If + Next + End If + TmpDT.Rows.Clear() For Each dRow As DataRow In DTProrrateoGasolina.Rows AddPS(1, dRow("CveUM").ToString.ToEntero, dRow("UM").ToString, dRow("CveClasificacion").ToString.ToEntero, dRow("Clasificacion").ToString, dRow("CvePS").ToString.ToEntero, dRow("PS").ToString, 1, dRow("CveSubProyecto").ToString, dRow("SubProyecto").ToString, "", diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 3ebde3353..0c6535bcd 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1736,20 +1736,14 @@ Partial Class PopUpVerFactura Dim OpcionDetallado As Integer = 1 If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(197, 189) Then OpcionDetallado = 2 - Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1" - - If ConsultaPorSucursal Then - 'SI NO TIENE ESTOS VALORES, SARCALOS DEL CORTE - If CveCorte > 0 AndAlso (FechaConsulta = ModExtensiones.MaxFecha OrElse CveSubProyecto <= 0) Then - Using ObjVta As New ClsPuntoVenta - If ObjVta.GetVta_Cortes("-1", "-1", -1, CveCorte, UsuarioActual.CveEmpresa, -1) AndAlso ObjVta.DtResultados.Rows.Count > 0 Then - FechaConsulta = ObjVta.DtResultados.FiltroPrimeroValor("FechaInicial").ToString().ToDate().Date - CveSubProyecto = ObjVta.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero() - End If - End Using - End If - - CveCorte = -1 + If CveCorte > 0 AndAlso (FechaConsulta = ModExtensiones.MaxFecha OrElse CveSubProyecto <= 0) Then + Using ObjVta As New ClsPuntoVenta + If ObjVta.GetVta_Cortes("-1", "-1", -1, CveCorte, UsuarioActual.CveEmpresa, -1) AndAlso ObjVta.DtResultados.Rows.Count > 0 Then + FechaConsulta = ObjVta.DtResultados.FiltroPrimeroValor("FechaInicial").ToString().ToDate().Date + CveSubProyecto = ObjVta.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToEntero() + Nombre = ObjVta.DtResultados.FiltroPrimeroValor("UsuarioNombre").ToString + End If + End Using End If Dim ObjVenta As New ClsVentas @@ -1768,22 +1762,15 @@ Partial Class PopUpVerFactura If RowInfo IsNot Nothing Then Fecha = RowInfo("FechaInicial").ToString - Nombre = RowInfo("Nombre").ToString + End If End If If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(189, 197) Then - If ConsultaPorSucursal Then - If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto) Then - DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL") - Fecha = FechaConsulta.ToString("dd/MM/yyyy") - End If - Else - If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, CveSubProyecto, CveCorte:=CveCorte) Then - DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("CveCorte > 0") - Fecha = DtReporteCorte.FiltroPrimeroValor("FechaInicial", "") - End If + If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto) Then + DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL") + Fecha = FechaConsulta.ToString("dd/MM/yyyy") End If If ObjVenta.GetVta_MovimientosCajas(CveCorte, -1, CveSubProyecto:=CveSubProyecto, FechaConsulta:=FechaConsulta) Then @@ -1799,7 +1786,7 @@ Partial Class PopUpVerFactura Dim FechaCorte As String = $" Fecha fin {Fecha}" - If ConsultaPorSucursal Then + If OpcionDetallado = 2 Then FechaCorte = $" Fecha: {Fecha}" End If @@ -2901,6 +2888,7 @@ Partial Class PopUpVerFactura Dim CvePrePoliza As Integer = ObjInventarios.DtResultados.FiltroPrimeroValor("CvePrePoliza").ToEntero Dim DireccionCliente As String = ObjInventarios.DtResultados.FiltroPrimeroValor("DireccionCliente") + Dim Ruta As String = "" Dim Supervisor As String = "" @@ -2924,6 +2912,8 @@ Partial Class PopUpVerFactura Dim CveMoneda As Integer = ObjInventarios.CveMoneda Dim FolioVenta As String = ObjInventarios.FolioVenta Dim FolioOC As String = ObjInventarios.FolioOC + Dim DescripcionOC As String = ObjInventarios.DescripcionOC + Dim FolioInterno As String = ObjInventarios.FolioInterno Dim CveCliente As Integer = ObjInventarios.CveCliente @@ -3104,7 +3094,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, Guia:=Guia, Consola:=Consola, DireccionCliente:=DireccionCliente) + Ruta:=Ruta, Supervisor:=Supervisor, Guia:=Guia, Consola:=Consola, DireccionCliente:=DireccionCliente, DescripcionOC:=DescripcionOC) End Sub Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera @@ -3123,7 +3113,8 @@ 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 Guia As String = "", Optional Consola As String = "-1", Optional DireccionCliente As String = "") + Optional Ruta As String = Nothing, Optional Supervisor As String = Nothing, Optional Guia As String = "", Optional Consola As String = "-1", Optional DireccionCliente As String = "", + Optional DescripcionOC As String = "") Select Case CveConcepto @@ -3172,7 +3163,7 @@ Partial Class PopUpVerFactura If UsuarioActual.CveEmpresa.Contiene(4, 145) Then params.Add(New ReportParameter("FacturadoA", If(CveCompra > 0, dr("RazonSocial").ToString, ""))) End If - If UsuarioActual.CveEmpresa.Contiene(119, 199, 201) Then + If UsuarioActual.CveEmpresa.Contiene(119, 199, 201, 13) Then params.Add(New ReportParameter("LogoPath", RutaImagenLogo)) params.Add(New ReportParameter("RazonSocialOC", RazonSocialOC)) @@ -3185,12 +3176,16 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("NombreProveedor", If(CveCompra > 0, dr("RazonSocial").ToString, ""))) End If + If UsuarioActual.CveEmpresa.Contiene(13) Then + params.Add(New ReportParameter("DescripcionOC", DescripcionOC)) + End If + Dim ConceptoFormato As String = "ENTRADA DE ALMACÉN" If CveConcepto = 32 Then ConceptoFormato = "ENTRADA POR AJUSTE" If CveConcepto = 33 Then ConceptoFormato = "ENTRADA MANUAL" 'IMPRESION ESPECIAL SALIDA DE COMPUPROVEEDORES y VSH - If UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 4, 145, 146, 186, 193, 189, 199, 201) Then + If UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 4, 145, 146, 186, 193, 189, 199, 201, 13) Then params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("Concepto", ConceptoFormato)) params.Add(New ReportParameter("Almacen", Almacen)) diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx index 4a7d61348..4c7dd8fa6 100644 --- a/Compras/Proveedores.aspx +++ b/Compras/Proveedores.aspx @@ -3326,89 +3326,89 @@
- -
+
+
-
-
-
-
- - -
-
-
-
- - - -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - <%----%> - -
-
-
-
- - - -
-
-
-
-
-
- - - -
-
-
-
- - -
-
-
-
-
- - -
+
+ + +
-
-
- - - +
+
+
+ + + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + + +
+
+
+
+
+
+ + + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + + +
+
-
-
@@ -3427,38 +3427,38 @@
-
-
-
+
+
+
-
-
+
+
-
- - +
+ +
-
-
+
+
-
- - - Seleccione uno - - - - +
+ + + Seleccione uno + + + + + +
-
-