diff --git a/App_Code/ClsContPAQi.vb b/App_Code/ClsContPAQi.vb index d2fe94141..b7d21d2e4 100644 --- a/App_Code/ClsContPAQi.vb +++ b/App_Code/ClsContPAQi.vb @@ -2264,16 +2264,18 @@ Public Class ClsContPAQi StrSQL.AppendLine(" @Folio INT,") StrSQL.AppendLine(" @NumMovto INT,") StrSQL.AppendLine(" @IdDiario INT,") + StrSQL.AppendLine(" @SegNegMovtos INT,") StrSQL.AppendLine(" @Fecha DATETIME,") StrSQL.AppendLine(" @IDEjercicio INT,") StrSQL.AppendLine(" @TimeStamp NVARCHAR (200);") StrSQL.AppendLine(" SET NOCOUNT ON;") StrSQL.AppendLine(" ") - StrSQL.AppendLine(" SET @Id = dbo.FNC_GetCounter ('Id_MovimientoPoliza');") + StrSQL.AppendLine(" SET @Id = dbo.FNC_GetCounter ('Id_MovimientoPoliza');") StrSQL.AppendLine(" SET @NumMovto = dbo.FNC_GetNumMovto (@IdPoliza);") - StrSQL.AppendLine(" SET @Fecha = @FechaMov;") + 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 @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("") StrSQL.AppendLine(" BEGIN TRY") StrSQL.AppendLine(" ") @@ -2306,7 +2308,7 @@ Public Class ClsContPAQi 'StrSQL.AppendLine("END") StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid)") - StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, @IdSegNeg, @SIGReferencia, @TimeStamp, @GUID);") + StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, IIF(@SegNegMovtos = 1,@IdSegNeg,0), @SIGReferencia, @TimeStamp, @GUID);") StrSQL.AppendLine(" ") ''DESCOMENTAR PARA CIERRE PERIODO @@ -3331,7 +3333,7 @@ Public Class ClsContPAQi StrSQL.Append(" INNER JOIN Cuentas C ON C.Id = A.IdSubCtade") StrSQL.Append(" )") StrSQL.Append(" SELECT Top(@RowNum) C.Id, C.Codigo, C.Nombre, C.IdAgrupadorSAT,SA.Nombre AS AgrupadorSAT, ") - StrSQL.Append(" CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS FLOAT), REPLACE (Mascarilla, 'X', '0')) ELSE C.Codigo END + ' - ' + C.Nombre AS CtaCodigo, ") + StrSQL.Append(" CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS DECIMAL(35,0)), REPLACE (Mascarilla, 'X', '0')) ELSE C.Codigo END + ' - ' + C.Nombre AS CtaCodigo, ") StrSQL.Append(" C.Tipo, C.EsBaja, C.CtaMayor, C.Afectable, C.IdMoneda, C.DigAgrup, C.NomIdioma, ") StrSQL.Append(" CASE ") StrSQL.Append(" WHEN SUBSTRING (C.Codigo, 1, 1) = '1' THEN 'Activo' ") @@ -3339,8 +3341,8 @@ Public Class ClsContPAQi StrSQL.Append(" WHEN SUBSTRING (C.Codigo, 1, 1) = '3' THEN 'Capital' ") StrSQL.Append(" WHEN SUBSTRING (C.Codigo, 1, 1) IN ('4', '5', '6', '7', '8', '9') THEN 'ER' ") StrSQL.Append(" ELSE 'Otras' ") - StrSQL.Append(" END AS Clasificacion, CAST (C.Id AS varCHAR(10)) + '||' + C.Nombre AS IdNombre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS FLOAT),REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END CuentaFormato, ") - StrSQL.Append(" CFad.Id AS IdPadre, CFad.Codigo AS CodigoPadre, CFad.Nombre AS NombrePadre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS FLOAT), REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END + ' - ' + C.Nombre + ' ' + CASE WHEN C.Afectable = 1 THEN '(Afec)' ELSE '(No Afect)' END AS CtaCodigoPadre ") + StrSQL.Append(" END AS Clasificacion, CAST (C.Id AS varCHAR(10)) + '||' + C.Nombre AS IdNombre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS DECIMAL(35,0)),REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END CuentaFormato, ") + StrSQL.Append(" CFad.Id AS IdPadre, CFad.Codigo AS CodigoPadre, CFad.Nombre AS NombrePadre, CASE WHEN ISNUMERIC (C.Codigo) = 1 THEN FORMAT (CAST (C.Codigo AS DECIMAL(35,0)), REPLACE (Mascarilla, 'X', '0') ) ELSE C.Codigo END + ' - ' + C.Nombre + ' ' + CASE WHEN C.Afectable = 1 THEN '(Afec)' ELSE '(No Afect)' END AS CtaCodigoPadre ") StrSQL.Append(" , CASE WHEN CtaSup IN ('_ACTIVO','_BPASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE','_ORDEN') ") StrSQL.Append(" AND NOT SubCtade IN ('_ACTIVO','_BPASIVO','_CAPITAL','_UTILIDAD','_RACREEDOR','_RDEUDOR','_CUADRE') THEN 1 ELSE 0 END AS CtaInicial,") StrSQL.Append(" E.Nivel, E.Orden") diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index f49810f6a..fc35b6ae2 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1075,14 +1075,14 @@ Public Class ClsContabilidad Select Case CveConcepto Case 2, 17 'Pago Proveedores - + Concepto = $"{NombreComercial} F:{SerieFolio}" Case 30 'Bancos Concepto = FolioBancario Case 4, 6 'Compra Case 1, 5 'Proveedores - Concepto = SerieFolio + Concepto = $"{NombreComercial} F:{SerieFolio}" Case 37 'Deudores @@ -1099,7 +1099,7 @@ Public Class ClsContabilidad End Select - Case 4, 7, 11, 12 + Case 4, 7, 11, 12, 122, 145 Select Case CveConcepto diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 92975bdfe..6af4ed287 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -1248,7 +1248,7 @@ Public Class ClsGenerales #End Region #Region "C O L E C T I V A S" - Public Function GetColectivas(CveColectiva As Integer, Colectiva As String, Codigo As String, Tipo As String, CveEmpresa As Integer) As Boolean + Public Function GetColectivas(Optional CveColectiva As Integer = -1, Optional Colectiva As String = "-1", Optional Codigo As String = "-1", Optional Tipo As String = "-1", Optional CveEmpresa As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_ColectivasGet") diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 4dcd35be4..0ff33a38c 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1755,7 +1755,7 @@ Public Class ClsInventarios Public Function RepMovimientos(CveEmpresa As Integer, CveMoneda As Integer, FechaI As String, FechaF As String, CveConcepto As Integer, CveProveedor As Integer, Almacenes As String, - CveCategoria As Integer, CveClasificacion As Integer, CvePS As Integer, Tipo As Integer, Optional CveMarca As Integer = -1, Optional CvePersonal As Integer = -1, + CveCategoria As Integer, CveClasificacion As Integer, CvePS As Integer, Tipo As Integer, Optional CveMarca As String = "-1", Optional CvePersonal As Integer = -1, Optional CveClasificacion2 As Integer = -1, Optional CveTipoAlmacen As String = "-1", Optional Modalidad As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1774,7 +1774,7 @@ Public Class ClsInventarios ' .Add("@CveSubFamilia", SqlDbType.Int).Value = CveSubFamilia .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@CveMarca", SqlDbType.VarChar).Value = CveMarca .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal .Add("@CveClasificacion2", SqlDbType.Int).Value = CveClasificacion2 .Add("@CveTipoAlmacen", SqlDbType.VarChar).Value = CveTipoAlmacen diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 1699d7a4d..887b33ddb 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -375,61 +375,96 @@ Public Class ClsPaginas Property GlobalDTFraccionArancelaria() As DataTable Get - GlobalDTFraccionArancelaria = DirectCast(Application("GlobalDTFraccionArancelaria"), EnumerableRowCollection(Of DataRow)).CopyToDataTable + Dim AppNombre As String = "GlobalDTFraccionArancelaria" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATFraccionArancelaria() Then Application(AppNombre) = ObjGrales.DtResultados.AsEnumerable() + ObjGrales.Dispose() + End If + GlobalDTFraccionArancelaria = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable End Get Set(value As DataTable) - Application("GlobalDTFraccionArancelaria") = value + Dim AppNombre As String = "GlobalDTFraccionArancelaria" + Application(AppNombre) = value End Set End Property Property GlobalDTIncoterm() As DataTable Get - GlobalDTIncoterm = DirectCast(Application("GlobalDTIncoterm"), DataTable) + Dim AppNombre As String = "GlobalDTIncoterm" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATIncoterm() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + GlobalDTIncoterm = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTIncoterm") = value + Dim AppNombre As String = "GlobalDTIncoterm" + Application(AppNombre) = value End Set End Property Property GlobalDTTipoOperacion() As DataTable Get - GlobalDTTipoOperacion = DirectCast(Application("GlobalDTTipoOperacion"), DataTable) + Dim AppNombre As String = "GlobalDTTipoOperacion" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATTipoOperacion() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + GlobalDTTipoOperacion = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTTipoOperacion") = value + Dim AppNombre As String = "GlobalDTTipoOperacion" + Application(AppNombre) = value End Set End Property Property GlobalDTSATMotivoTraslado() As DataTable Get - GlobalDTSATMotivoTraslado = DirectCast(Application("GlobalDTSATMotivoTraslado"), DataTable) + Dim AppNombre As String = "GlobalDTSATMotivoTraslado" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATMotivoTraslado() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + GlobalDTSATMotivoTraslado = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTSATMotivoTraslado") = value + Dim AppNombre As String = "GlobalDTSATMotivoTraslado" + Application(AppNombre) = value End Set End Property Property GlobalDTUnidadAduana() As DataTable Get - GlobalDTUnidadAduana = DirectCast(Application("GlobalDTUnidadAduana"), DataTable) - End Get - Set(value As DataTable) - Application("GlobalDTUnidadAduana") = value - End Set - End Property - - - Property GlobalDTGralPaises() As DataTable - Get - If Application("GlobalDTGralPaises") Is Nothing Then + Dim AppNombre As String = "GlobalDTUnidadAduana" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATPais() Then Application("GlobalDTGralPaises") = ObjGrales.DtResultados Else Application("GlobalDTGralPaises") = Nothing + If ObjGrales.GetSATUnidadesAduana() Then Application(AppNombre) = ObjGrales.DtResultados ObjGrales.Dispose() End If - GlobalDTGralPaises = DirectCast(Application("GlobalDTGralPaises"), DataTable) + GlobalDTUnidadAduana = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTGralPaises") = value + Dim AppNombre As String = "GlobalDTUnidadAduana" + Application(AppNombre) = value + End Set + End Property + Property GlobalDTGralPaises() As DataTable + Get + Dim AppNombre As String = "GlobalDTGralPaises" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATPais() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + GlobalDTGralPaises = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = "GlobalDTGralPaises" + Application(AppNombre) = value End Set End Property Property GlobalDTGralEstados(ClaveSATPais As String, Optional CvePais As Integer = -1) As DataTable @@ -437,7 +472,7 @@ Public Class ClsPaginas Dim AppNombre As String = "GlobalDTGralEstados" If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATEstado("-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing + If ObjGrales.GetSATEstado("-1") Then Application(AppNombre) = ObjGrales.DtResultados ObjGrales.Dispose() End If @@ -463,7 +498,7 @@ Public Class ClsPaginas Dim AppNombre As String = "GlobalDTGralMunicipios" If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATMunicipio("-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing + If ObjGrales.GetSATMunicipio("-1") Then Application(AppNombre) = ObjGrales.DtResultados ObjGrales.Dispose() End If @@ -490,7 +525,7 @@ Public Class ClsPaginas If Application("GlobalDTLocalidad") Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATLocalidad(-1, -1) Then Application("GlobalDTLocalidad") = ObjGrales.DtResultados Else Application("GlobalDTLocalidad") = Nothing + If ObjGrales.GetSATLocalidad(-1, -1) Then Application("GlobalDTLocalidad") = ObjGrales.DtResultados ObjGrales.Dispose() End If @@ -523,14 +558,13 @@ Public Class ClsPaginas End Property - Property GlobalDTGralColonias(ClaveSATEstado As String, ClaveSATMunicipio As String, ClaveSATColonia As String, Optional CveMunicipio As Integer = -1, Optional CodigoPostal As Integer = -1, Optional CveColonia As Integer = -1) As DataTable Get Dim AppNombre As String = "GlobalDTGralColonias" If Application(AppNombre) Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATColonia("-1", "-1", "-1") Then Application(AppNombre) = ObjGrales.DtResultados Else Application(AppNombre) = Nothing + If ObjGrales.GetSATColonia("-1", "-1", "-1") Then Application(AppNombre) = ObjGrales.DtResultados ObjGrales.Dispose() End If @@ -561,7 +595,7 @@ Public Class ClsPaginas Get If Application("GlobalDTPSATUM") Is Nothing Then Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATUnidadMedida Then Application("GlobalDTPSATUM") = ObjGrales.DtResultados.AsEnumerable() Else Application("GlobalDTPSATUM") = Nothing + If ObjGrales.GetSATUnidadMedida Then Application("GlobalDTPSATUM") = ObjGrales.DtResultados.AsEnumerable() ObjGrales.Dispose() End If @@ -1007,18 +1041,36 @@ Public Class ClsPaginas End Property Property GlobalDTFamilias(Optional CveEmpresa As Integer = -1) As DataTable Get - If CveEmpresa <> -1 Then - - Dim Dv As New DataView(DirectCast(Application("GlobalDTFamilias"), DataTable), String.Format("CveEmpresa = {0} ", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTFamilias = Dv.ToTable - Dv.Dispose() - Else - GlobalDTFamilias = DirectCast(Application("GlobalDTFamilias"), DataTable) + Dim AppNombre As String = $"GlobalDTFamilias-{CveEmpresa}" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetCategorias(CveEmpresa, 2) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() End If + GlobalDTFamilias = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTFamilias") = value + Dim AppNombre As String = $"GlobalDTFamilias-{CveEmpresa}" + Application(AppNombre) = value + End Set + End Property + Property GlobalDTCategoriasPresupuestos(Optional CveEmpresa As Integer = -1) As DataTable + Get + Dim AppNombre As String = $"GlobalDTCategoriasPresupuestos-{CveEmpresa}" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetCategorias(CveEmpresa, 3) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() + End If + + GlobalDTCategoriasPresupuestos = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = $"GlobalDTCategoriasPresupuestos-{CveEmpresa}" + Application(AppNombre) = value End Set End Property @@ -1109,6 +1161,14 @@ Public Class ClsPaginas 'End Property Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1, Optional RegimenFiscalReceptor As String = "-1") As DataTable Get + Dim AppNombre As String = "GlobalDTSATUsosCFDI" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGrales As New ClsGenerales + If ObjGrales.GetSATUsosCFDI() Then Application(AppNombre) = ObjGrales.DtResultados + ObjGrales.Dispose() + End If + If EsPersonaFisica <> -1 Then Dim Tipo As New StringBuilder If EsPersonaFisica = 1 Then Tipo.Append("AplicaPersonaFisica = 1") Else Tipo.Append("AplicaPersonaMoral = 1") @@ -1117,16 +1177,17 @@ Public Class ClsPaginas Tipo.AppendFormat("AND RegimenFiscalReceptor LIKE '%{0}%'", RegimenFiscalReceptor) End If - Dim Dv As New DataView(DirectCast(Application("GlobalDTSATUsosCFDI"), DataTable), Tipo.ToString(), " UsoCFDIDescripcion", DataViewRowState.CurrentRows) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Tipo.ToString(), " UsoCFDIDescripcion", DataViewRowState.CurrentRows) GlobalDTSATUsosCFDI = Dv.ToTable Dv.Dispose() Else - GlobalDTSATUsosCFDI = DirectCast(Application("GlobalDTSATUsosCFDI"), DataTable) + GlobalDTSATUsosCFDI = DirectCast(Application(AppNombre), DataTable) End If End Get - Set(ByVal value As DataTable) - Application("GlobalDTSATUsosCFDI") = value + Set(value As DataTable) + Dim AppNombre As String = "GlobalDTSATUsosCFDI" + Application(AppNombre) = value End Set End Property Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable @@ -2616,11 +2677,11 @@ Public Class ClsPaginas #Region "***********************************************************************DT GENERALES**************************************************************************************" Property GlobalDTGralCategorias(CveEmpresa As Integer) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTGralCategorias-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTGralCategorias-{CveEmpresa}" 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim ObjGenerales As New ClsGenerales - If ObjGenerales.GetCategorias(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados Else Application(AppNombre) = Nothing + If ObjGenerales.GetCategorias(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados ObjGenerales.Dispose() End If @@ -2634,54 +2695,69 @@ Public Class ClsPaginas Dv.Dispose() End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTGralCategorias-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTGralCategorias-{CveEmpresa}" Application(AppNombre) = value End Set - End Property Property GlobalDTGralCategorias2(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTCategorias2"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralCategorias2 = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralCategorias2 = DirectCast(Application("GlobalDTCategorias2"), DataTable) + Dim AppNombre As String = $"GlobalDTGralCategorias2-{CveEmpresa}" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetCategorias(CveEmpresa, 4) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() End If + + Dim filtro As New StringBuilder + 'If CveMarca > 0 Then + ' filtro.AppendFormat(" CveMarca={0} ", CveMarca) + 'End If + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTGralCategorias2 = Dv.ToTable + Dv.Dispose() End Get Set(value As DataTable) - Application("GlobalDTCategorias2") = value + Dim AppNombre As String = $"GlobalDTGralCategorias2-{CveEmpresa}" + Application(AppNombre) = value End Set End Property - Property GlobalDTGralEscolaridades() As DataTable Get - GlobalDTGralEscolaridades = DirectCast(Application("GlobalDTGralEscolaridades"), DataTable) + Dim AppNombre As String = "GlobalDTGralEscolaridades" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetEscolaridades() Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() + End If + GlobalDTGralEscolaridades = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTGralEscolaridades") = value + Dim AppNombre As String = "GlobalDTGralEscolaridades" + Application(AppNombre) = value End Set End Property Property GlobalDTGralColectivas(CveEmpresa As Integer) As DataTable Get - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application("GlobalDTGralColectivas"), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), "", DataViewRowState.CurrentRows) - GlobalDTGralColectivas = Dv.ToTable - Dv.Dispose() - Else - GlobalDTGralColectivas = DirectCast(Application("GlobalDTGralColectivas"), DataTable) + Dim AppNombre As String = $"GlobalDTGralColectivas-{CveEmpresa}" + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetColectivas(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() End If + GlobalDTGralColectivas = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTGralColectivas") = value + Dim AppNombre As String = $"GlobalDTGralColectivas-{CveEmpresa}" + Application(AppNombre) = value End Set End Property Property GlobalDTGralMarcas(CveEmpresa As Integer, Optional CveMarca As Integer = -1) As DataTable Get - Dim AppNombre As String = String.Format("GlobalDTGralMarcas-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTGralMarcas-{CveEmpresa}" 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim ObjMarcas As New ClsProductosServicios @@ -2701,7 +2777,7 @@ Public Class ClsPaginas End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTGralMarcas-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTGralMarcas-{CveEmpresa}" Application(AppNombre) = value End Set End Property @@ -3496,33 +3572,58 @@ Public Class ClsPaginas #Region "**********************************************************************GLOBAL DT RH (RECURSOS HUMANOS)********************************************************************" Property GlobalDTAsistenciaDetalle() As DataTable Get - GlobalDTAsistenciaDetalle = DirectCast(Application("GlobalDTAsistenciaDetalle"), DataTable) + Dim AppNombre As String = "GlobalDTAsistenciaDetalle" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetAsistenciasDetalle() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTAsistenciaDetalle = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTAsistenciaDetalle") = value + Dim AppNombre As String = "GlobalDTAsistenciaDetalle" + Application(AppNombre) = value End Set End Property Property GlobalDTAsistenciasInasistencias() As DataTable Get - GlobalDTAsistenciasInasistencias = DirectCast(Application("GlobalDTAsistenciasInasistencias"), DataTable) + Dim AppNombre As String = "GlobalDTAsistenciasInasistencias" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetAsistenciasInasistencias() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTAsistenciasInasistencias = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTAsistenciasInasistencias") = value + Dim AppNombre As String = "GlobalDTAsistenciasInasistencias" + Application(AppNombre) = value End Set End Property Property GlobalDTEstatusPersonal() As DataTable Get - GlobalDTEstatusPersonal = DirectCast(Application("GlobalDTEstatusPersonal"), DataTable) + Dim AppNombre As String = "GlobalDTEstatusPersonal" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetEstatusPersonal() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTEstatusPersonal = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTEstatusPersonal") = value + Dim AppNombre As String = "GlobalDTEstatusPersonal" + Application(AppNombre) = value End Set End Property - Property GlobalDTRHPersonal(CveEmpresa As Integer, Optional CvePersonal As Integer = -1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTRHPersonal-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTRHPersonal-{CveEmpresa}" 'sino existe, recarga los datos If DirectCast(Application(AppNombre), DataTable) Is Nothing Then Dim ObjPersonal As New ClsRH @@ -3530,145 +3631,239 @@ Public Class ClsPaginas ObjPersonal.Dispose() End If - If CveEmpresa <> -1 Or CvePersonal <> -1 Then - Dim Str As StringBuilder = New StringBuilder() - If CveEmpresa <> -1 Then Str.AppendFormat("CveEmpresa = {0}", CveEmpresa) - If CvePersonal <> -1 Then Str.AppendFormat(" {0} CvePersonal = {1}", If(Str.Length > 0, "AND", ""), CvePersonal) - - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTRHPersonal = Dv.ToTable - Dv.Dispose() - Else - GlobalDTRHPersonal = DirectCast(Application(AppNombre), DataTable) - End If - + GlobalDTRHPersonal = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTRHPersonal-{0}", CveEmpresa) + Dim AppNombre As String = $"GlobalDTRHPersonal-{CveEmpresa}" Application(AppNombre) = value End Set End Property - - Property GlobalDTDepartamentos() As DataTable Get - GlobalDTDepartamentos = DirectCast(Application("GlobalDTDepartamentos"), DataTable) + Dim AppNombre As String = "GlobalDTDepartamentos" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetDepartamentos() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTDepartamentos = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTDepartamentos") = value + Dim AppNombre As String = "GlobalDTDepartamentos" + Application(AppNombre) = value End Set End Property Property GlobalDTRHPuestos(CveEmpresa As Integer) As DataTable Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTRHPuestos"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTRHPuestos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTRHPuestos = DirectCast(Application("GlobalDTRHPuestos"), DataTable) + Dim AppNombre As String = $"GlobalDTRHPuestos-{CveEmpresa}" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetPuestos(CveEmpresa) Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() End If + GlobalDTRHPuestos = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTRHPuestos") = value + Dim AppNombre As String = $"GlobalDTRHPuestos-{CveEmpresa}" + Application(AppNombre) = value End Set End Property Property GlobalDTEscolaridad() As DataTable Get - GlobalDTEscolaridad = DirectCast(Application("GlobalDTEscolaridad"), DataTable) + Dim AppNombre As String = "GlobalDTEscolaridad" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetEscolaridades() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTEscolaridad = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTEscolaridad") = value + Dim AppNombre As String = "GlobalDTEscolaridad" + Application(AppNombre) = value End Set End Property Property GlobalDTEstadoCivil() As DataTable Get - GlobalDTEstadoCivil = DirectCast(Application("GlobalDTEstadoCivil"), DataTable) + Dim AppNombre As String = "GlobalDTEstadoCivil" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetEstadoCivil() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTEstadoCivil = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTEstadoCivil") = value + Dim AppNombre As String = "GlobalDTEstadoCivil" + Application(AppNombre) = value End Set End Property Property GlobalDTDocumentos() As DataTable Get - GlobalDTDocumentos = DirectCast(Application("GlobalDTDocumentos"), DataTable) + Dim AppNombre As String = "GlobalDTDocumentos" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetDocumentos() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTDocumentos = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTDocumentos") = value + Dim AppNombre As String = "GlobalDTDocumentos" + Application(AppNombre) = value End Set End Property Property GlobalDTGenero() As DataTable Get - GlobalDTGenero = DirectCast(Application("GlobalDTGenero"), DataTable) + Dim AppNombre As String = "GlobalDTGenero" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetGeneros() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTGenero = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTGenero") = value + Dim AppNombre As String = "GlobalDTGenero" + Application(AppNombre) = value End Set End Property Property GlobalDTMotivoBaja() As DataTable Get - GlobalDTMotivoBaja = DirectCast(Application("GlobalDTMotivoBaja"), DataTable) + Dim AppNombre As String = "GlobalDTMotivoBaja" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetMotivoBaja() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTMotivoBaja = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTMotivoBaja") = value + Dim AppNombre As String = "GlobalDTMotivoBaja" + Application(AppNombre) = value End Set End Property Property GlobalDTTiposContrato() As DataTable Get - GlobalDTTiposContrato = DirectCast(Application("GlobalDTTiposContrato"), DataTable) + Dim AppNombre As String = "GlobalDTTiposContrato" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetTiposContrato() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTTiposContrato = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTTiposContrato") = value + Dim AppNombre As String = "GlobalDTTiposContrato" + Application(AppNombre) = value End Set End Property Property GlobalDTRutas() As DataTable Get - GlobalDTRutas = DirectCast(Application("GlobalDTRutas"), DataTable) + Dim AppNombre As String = "GlobalDTRutas" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetRutas() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTRutas = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTRutas") = value + Dim AppNombre As String = "GlobalDTRutas" + Application(AppNombre) = value End Set End Property Property GlobalDTTurno() As DataTable Get - GlobalDTTurno = DirectCast(Application("GlobalDTTurno"), DataTable) + Dim AppNombre As String = "GlobalDTTurno" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetTurnos() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTTurno = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTTurno") = value + Dim AppNombre As String = "GlobalDTTurno" + Application(AppNombre) = value End Set End Property Property GlobalDTJornadas() As DataTable Get - GlobalDTJornadas = DirectCast(Application("GlobalDTJornadas"), DataTable) + Dim AppNombre As String = "GlobalDTJornadas" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetJornadas() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTJornadas = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTJornadas") = value + Dim AppNombre As String = "GlobalDTJornadas" + Application(AppNombre) = value End Set End Property Property GlobalDTMotivosHorasExtras() As DataTable Get - GlobalDTMotivosHorasExtras = DirectCast(Application("GlobalDTMotivosHorasExtras"), DataTable) + Dim AppNombre As String = "GlobalDTMotivosHorasExtras" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetMotivoHorasExtras() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTMotivosHorasExtras = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTMotivosHorasExtras") = value + Dim AppNombre As String = "GlobalDTMotivosHorasExtras" + Application(AppNombre) = value End Set End Property Property GlobalDTTipoBuzon() As DataTable Get - GlobalDTTipoBuzon = DirectCast(Application("GlobalDTTipoBuzon"), DataTable) + Dim AppNombre As String = "GlobalDTTipoBuzon" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetTipoBuzon() Then Application(AppNombre) = ObjPersonal.DtResultados + ObjPersonal.Dispose() + End If + + GlobalDTTipoBuzon = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTTipoBuzon") = value + Dim AppNombre As String = "GlobalDTTipoBuzon" + Application(AppNombre) = value End Set End Property #End Region #Region "*********** D T - C O M B U S T I B L E S ***********" - - Property GlobalDTCombustibles(CveEmpresa As Integer) As DataTable Get If CveEmpresa <> -1 Then @@ -3884,19 +4079,20 @@ Public Class ClsPaginas End Set End Property Property GlobalDTPaqueteriaGuiaTipos(CveEmpresa As Integer) As DataTable - Get - If CveEmpresa <> -1 Then - Dim StrSQL As String = String.Format("CveEmpresa = {0}", CveEmpresa) - Dim Dv As New DataView(DirectCast(Application("GlobalDTPaqueteriaGuiaTipos"), DataTable), StrSQL, "", DataViewRowState.CurrentRows) - GlobalDTPaqueteriaGuiaTipos = Dv.ToTable - Dv.Dispose() - Else - GlobalDTPaqueteriaGuiaTipos = DirectCast(Application("GlobalDTPaqueteriaGuiaTipos"), DataTable) + Dim AppNombre As String = $"GlobalDTPaqueteriaGuiaTipos-{CveEmpresa}" + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjGenerales As New ClsGenerales + If ObjGenerales.GetGralPaqueteriasGuiasTipo(CveEmpresa) Then Application(AppNombre) = ObjGenerales.DtResultados + ObjGenerales.Dispose() End If + + GlobalDTPaqueteriaGuiaTipos = DirectCast(Application(AppNombre), DataTable) End Get Set(value As DataTable) - Application("GlobalDTPaqueteriaGuiaTipos") = value + Dim AppNombre As String = $"GlobalDTPaqueteriaGuiaTipos-{CveEmpresa}" + Application(AppNombre) = value End Set End Property Public Shared Property GlobalDTClasificacionPorcentaje(CveEmpresa As Integer, Optional CveClasicacionPorcentaje As Integer = -1, Optional CveClasicacion As Integer = -1, @@ -10300,8 +10496,8 @@ Public Class ClsPaginas If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 92, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoExtranjera, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True - Else + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 332, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True + Else 'Agregamos Nacional If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 92, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipo, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index ae5d47fc5..9685028a6 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -1628,6 +1628,66 @@ Namespace Extensiones Public Function FCRangeValidator(ByVal Row As GridViewRow, ByVal Control As String) As RangeValidator Return DirectCast(Row.FindControl(Control), RangeValidator) End Function + + + Public Function GetColumn(ByVal gv As GridView, ByVal name As String) As Integer + Dim index As Integer = 0 + Dim found As Boolean = False + + For Each c As DataControlField In gv.Columns + + If TypeOf c Is BoundField Then + Dim field As BoundField = CType(c, BoundField) + + If name = field.DataField OrElse name = field.SortExpression OrElse name = field.HeaderText Then + found = True + Exit For + End If + End If + + index += 1 + Next + + Return If(found, index, -1) + End Function + + + Public Function HiddenColumns(gv As GridView) As List(Of Integer) + Dim columns As New List(Of Integer) + + For i As Integer = 0 To gv.Columns.Count - 1 + If gv.Columns(i).Visible = False Then columns.Add(i) + Next + + Return columns + End Function + + + Public Sub ShowAllColumns(gv As GridView) + For i As Integer = 0 To gv.Columns.Count - 1 + gv.Columns(i).Visible = True + Next + End Sub + + + Public Sub HideColumns(gv As GridView, columns As List(Of Integer)) + For Each i As Integer In columns + gv.Columns(i).Visible = False + Next + End Sub + + + Public Sub DataBind(gv As GridView, BindearCamposNoVisibles As Boolean) + If BindearCamposNoVisibles Then + Dim NoVisibles As List(Of Integer) = gv.HiddenColumns() + gv.ShowAllColumns() + gv.DataBind() + gv.HideColumns(NoVisibles) + Else + gv.DataBind() + End If + End Sub + #End Region #Region "Excel PDF" diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index a2c82ecc4..94533a423 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -1544,15 +1544,15 @@ Partial Class Bancos_IE DivOtrosIngresosEgresos.Visible = True End If - If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then - Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - Else - BtnGuardar.Enabled = True - End If - UpGuardar.Update() - End If + 'If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + ' If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then + ' Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + ' BtnGuardar.Enabled = False + ' Else + ' BtnGuardar.Enabled = True + ' End If + ' UpGuardar.Update() + 'End If CargaCuentasDepositos() @@ -1600,15 +1600,15 @@ Partial Class Bancos_IE HdnProvPorRetISR.Value = "0" 'ObjProveedor.RetISR.ToString IDCtaBeneficiario = ObjPersonal.IdCtaContPersonal - If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then - Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - Else - BtnGuardar.Enabled = True - End If - UpGuardar.Update() - End If + 'If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + ' If IDCtaBeneficiario = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then + ' Alert("El Beneficiario no tiene cuenta contable vinculada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + ' BtnGuardar.Enabled = False + ' Else + ' BtnGuardar.Enabled = True + ' End If + ' UpGuardar.Update() + 'End If CargaCuentasDepositos() Else diff --git a/Bancos/PagoAcreedor.aspx.cs b/Bancos/PagoAcreedor.aspx.cs index d9f4f41b0..fb4ab7a2d 100644 --- a/Bancos/PagoAcreedor.aspx.cs +++ b/Bancos/PagoAcreedor.aspx.cs @@ -550,8 +550,7 @@ public partial class Bancos_PagoAcreedor : ClsPaginas //CONTABILIZA if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { - if (IDCtaContableAcreedor > 0 && IDCtaContableBancos > 0) - { + if (ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa)) { IDPoliza = ObjMov.ContaIdPoliza; @@ -560,18 +559,16 @@ public partial class Bancos_PagoAcreedor : ClsPaginas { Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError); } - } - else - { - if (IDCtaContableAcreedor < 1) + + if (IDCtaContableAcreedor < 1 && UsuarioActual.Empresa.TipoContabilidad == 2) { Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia); } - if (IDCtaContableBancos < 1) + if (IDCtaContableBancos < 1 && UsuarioActual.Empresa.TipoContabilidad == 2) { Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia); } - } + } if (MsgError.Equals("")) diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index 697ec6c74..3a210032b 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -836,14 +836,14 @@ public partial class Bancos_PagoDeudor : ClsPaginas if (CveMoneda != 1 && UsaComplementaria) { - decimal difComplementaria = ImporteMN - (ImporteBanco + ImporteComplementaria); - - if (difComplementaria != 0) - { - ImporteComplementaria = difComplementaria > 0 ? (ImporteComplementaria+ difComplementaria) : (ImporteComplementaria- difComplementaria); - } - + //decimal difComplementaria = ImporteMN - (ImporteBanco + ImporteComplementaria); + //if (difComplementaria != 0) + //{ + // ImporteComplementaria = difComplementaria > 0 ? (ImporteComplementaria+ difComplementaria) : (ImporteComplementaria- difComplementaria); + //} + ImporteComplementaria = (ImporteBanco * TC) - ImporteBanco; + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, ImporteBanco, Ref, CveConceptoContableBancoComplementario, Conc, DateTime.Now, IDCtaContableBancosComplementario, -1, CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteMX: ImporteComplementaria, ImporteME: ImporteBanco, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) { MsgError = "No se pudo insertar concepto de bancos complementaria"; diff --git a/Bancos/PrestamoPersonal.aspx.cs b/Bancos/PrestamoPersonal.aspx.cs index e8c36bc90..fd1c1d4e8 100644 --- a/Bancos/PrestamoPersonal.aspx.cs +++ b/Bancos/PrestamoPersonal.aspx.cs @@ -379,8 +379,8 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas //CONTABILIZA if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { - if (IDCtaContablePrestamo > 0 && IDCtaContableBancos > 0) - { + //if (IDCtaContablePrestamo > 0 && IDCtaContableBancos > 0) + //{ if (ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa)) { IDPoliza = ObjMov.ContaIdPoliza; @@ -389,18 +389,18 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError); } - } - else - { - if (IDCtaContablePrestamo < 1) - { - Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia); - } - if (IDCtaContableBancos < 1) - { - Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia); - } - } + //} + //else + //{ + // if (IDCtaContablePrestamo < 1) + // { + // Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia); + // } + // if (IDCtaContableBancos < 1) + // { + // Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia); + // } + //} } if (MsgError.Equals("")) @@ -635,8 +635,8 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas //CONTABILIZA if (UsuarioActual.Empresa.Funcionalidad(200).Equals("1") && MsgError.Equals("")) { - if (IDCtaContablePrestamo > 0 && IDCtaContableBancosPrestamo > 0) - { + //if (IDCtaContablePrestamo > 0 && IDCtaContableBancosPrestamo > 0) + //{ if (ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa)) { IDPoliza = ObjMov.ContaIdPoliza; @@ -645,18 +645,18 @@ public partial class Bancos_PrestamoPersonal : ClsPaginas { Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError); } - } - else - { - if (IDCtaContablePrestamo < 1) - { - Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia); - } - if (IDCtaContableBancosPrestamo < 1) - { - Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia); - } - } + //} + //else + //{ + // if (IDCtaContablePrestamo < 1) + // { + // Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Acreedor es invalida", TipoMensaje.MsgAdvertencia); + // } + // if (IDCtaContableBancosPrestamo < 1) + // { + // Alert("No se puede contabilizar la Prepoliza debido a que la cuenta bancaria es invalida", TipoMensaje.MsgAdvertencia); + // } + //} } if (MsgError.Equals("")) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index eadfd1fe5..405c5dcb1 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -8633,6 +8633,7 @@ Partial Class Compras_Compras Pago.ImportePago = ImporteAnt Pago.OtroGastoIngreso = ImporComisionAnticipo Pago.CveMonedaPago = CveMonedaAnticipo + Pago.TCPago = TipoCambioAnt Select Case gvr.DataKey("TipoDocto") Case "NC", "DEV" @@ -8661,10 +8662,6 @@ Partial Class Compras_Compras PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal - - - - If CveMonedaAnticipo > 1 Then Dim ImporteAntMN As Decimal = TipoCambioAnt * ImporteAnt - ImporteAnt If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimientoCompra, ImporteAntMN, "", CveConceptoCompraComplementaria, "", TxtFechaPago.Text.ToDate, IdCtaContableComp, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(TipoCambioAnt = 1, 0, ImporteAnt), TipoCambio:=TipoCambioAnt, CveSubProyecto:=CveSubProyectoAnticipo) Then diff --git a/Compras/Proveedores.aspx.vb b/Compras/Proveedores.aspx.vb index 0fcad37ea..26a459684 100644 --- a/Compras/Proveedores.aspx.vb +++ b/Compras/Proveedores.aspx.vb @@ -3835,7 +3835,6 @@ Partial Class Compras_Proveedores Private Sub ImprimirReporteCxPCrystal(Optional Formato As String = "PDF") Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepProveedorCxP.rpt", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") - 'Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim DTCxPTempral As DataTable = Nothing @@ -4217,7 +4216,6 @@ Partial Class Compras_Proveedores params.Add(New ReportParameter("LimiteCredito", TxtLimiteCredito.Text)) params.Add(New ReportParameter("SaldoDisponible", (TxtLimiteCredito.Text.ToDouble - dr("Saldo").ToString.ToDouble).ToString.FormatoNumero)) params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {Proveedor}{FechaIn}{FechaFn}{FechVI}{FechVF}")) - params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) ImprimirPDF("Empresas/Grales/Formatos/RepProveedorCxP.rdlc", DTCxPTempral, params, "RepCxP") @@ -4225,7 +4223,6 @@ Partial Class Compras_Proveedores Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia) End If - ElseIf rblreporte.SelectedValue = "anc" Then 'OBTENEMOS LOS DATOS diff --git a/Compras/RepCxPDetalle.aspx b/Compras/RepCxPDetalle.aspx index 31fcd036e..e32659bd7 100644 --- a/Compras/RepCxPDetalle.aspx +++ b/Compras/RepCxPDetalle.aspx @@ -15,44 +15,45 @@ } - - - - -
  • - Generar PDF + + + + +
  • + Generar PDF +
  • +
  • + Generar Excel +
  • + +
  • + Excel Personalizado +
  • + +
  • + +
  • -
  • - Generar Excel -
  • - -
  • - Excel Personalizado -
  • - -
  • -
  • - -
  • - Ver Dlls en pesos - -
  • - - -
  • - Programar Recursos - -
  • - -
    - - - - - -
    - +
  • + Ver Dlls en pesos + +
  • + + +
  • + Programar Recursos + +
  • + + + + + + + + +
    Reporte de CxP - Detalle @@ -216,18 +217,18 @@ - -
    - - - -
    - - -
    - - - + +
    + + + +
    + + +
    + + +
    Comprobación:
    @@ -241,19 +242,19 @@
    -
    +
    Moneda:
    -
    - -
    +
    + +
    Aplica NC:
    -
    +
    - -
    + +
    @@ -264,7 +265,7 @@ - <%--0--%> diff --git a/Compras/RepCxPDetalle.aspx.vb b/Compras/RepCxPDetalle.aspx.vb index 22ed077f9..10ad64961 100644 --- a/Compras/RepCxPDetalle.aspx.vb +++ b/Compras/RepCxPDetalle.aspx.vb @@ -83,18 +83,6 @@ Partial Class RepCxPDetalle ViewState("FechaFin") = value End Set End Property - - - Private Property Personalizo As Integer - Get - Return ViewState("Personalizo").ToString.ToEntero - End Get - - Set(value As Integer) - ViewState("Personalizo") = value - End Set - End Property - Public Property FechaVInicio() As String Get @@ -205,7 +193,6 @@ Partial Class RepCxPDetalle Private Property TCEspecifico As Double - Public Property DTCuentasContables() As DataTable Get If ViewState("DTCuentasContables") Is Nothing Then @@ -218,20 +205,14 @@ Partial Class RepCxPDetalle Set(value As DataTable) ViewState("DTCuentasContables") = value End Set - End Property - - - + End Property #End Region - - 'pRivate ReadOnly Property ColumnasVisibles As - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - Personalizo = 0 - + 'Private ReadOnly Property ColumnasVisibles As + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then ViewState("Opcion") = IfNull(Request("Op"), "S") - MostrarOcultarColumnas() + MostrarOcultarColumnas(False) CargaCombos() If Request("Op") IsNot Nothing Then CargaDatos() @@ -274,7 +255,6 @@ Partial Class RepCxPDetalle DdlUsuarioRegistro.Items.Insert(0, New ListItem("Todos", "-1")) DdlUsuarioRegistro.SelectedValueExist(UsuarioRegistro) - Dim CveSucursal As Integer = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero 'DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) @@ -309,7 +289,6 @@ Partial Class RepCxPDetalle FechaCorte = IfNull(Request("FechaCorte"), Now.ToDate.ToString).ToString txtCorteA.Text = $"31/12/{Now.Year}" - If Request("FechaI") <> "-1" AndAlso IsDate(Request("FechaI")) Then txtFechaI.Text = Request("FechaI") If Request("FechaF") <> "-1" AndAlso IsDate(Request("FechaF")) Then txtFechaF.Text = Request("FechaF") If Request("FechaVI") <> "-1" AndAlso IsDate(Request("FechaVI")) Then txtFechaVI.Text = Request("FechaVI") @@ -349,8 +328,6 @@ Partial Class RepCxPDetalle GvDatos.Columns(11).Visible = (UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 Or UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0) - - For Each lItem As ListItem In DdlGrupo.Items If lItem.Value.ToEntero = 9 Then @@ -358,7 +335,6 @@ Partial Class RepCxPDetalle End If Next - End Sub Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged @@ -544,11 +520,8 @@ Partial Class RepCxPDetalle End If End If - - End If - If e.Row.DBCampo("CveCompra") = "" Then e.Row.FCLabel("LblMoneda").Text = "" End If @@ -595,7 +568,7 @@ Partial Class RepCxPDetalle #End Region #Region "PERSONALIZAR" - Protected Sub MostrarOcultarColumnas() + Protected Sub MostrarOcultarColumnas(Optional Personalizo As Boolean = True) If ChkTipoDocto.Checked Then GvDatos.Columns(0).Visible = True @@ -639,15 +612,12 @@ Partial Class RepCxPDetalle GvDatos.Columns(7).Visible = False End If - If ChkMoneda.Checked Then GvDatos.Columns(8).Visible = True Else GvDatos.Columns(8).Visible = False End If - - If ChkSaldo.Checked Then GvDatos.Columns(9).Visible = True Else @@ -692,12 +662,12 @@ Partial Class RepCxPDetalle GvDatos.Columns(16).Visible = ChkDescripcion.Checked - Personalizo = 1 - If Personalizo = 1 Then + If Personalizo Then ImgExcelPersonalizado.Visible = True Else ImgExcelPersonalizado.Visible = False - End If + End If + UPAcciones.Update() UPDatos.Update() End Sub diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index a7ae9b1c2..88ea2a459 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -498,7 +498,7 @@ Partial Class ContabilidadC_RegPrePoliza HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza")) divContabilziada.Visible = True BtnEliminar.Visible = False - If UsuarioActual.CveUsuario = 100 Then + If UsuarioActual.CveUsuario = 100 OrElse UsuarioActual.CveEmpresa.Contiene(13, 83) Then BtnContabilizar.Visible = True BtnContabilizar.Text = "Actualizar Poliza" End If diff --git a/Contabilidad2/CatCuentas.aspx b/Contabilidad2/CatCuentas.aspx index 58b1d4c79..9810d4268 100644 --- a/Contabilidad2/CatCuentas.aspx +++ b/Contabilidad2/CatCuentas.aspx @@ -125,7 +125,7 @@
    Tipo de Cuenta
    - + @@ -145,7 +145,7 @@
    Cuenta Mayor
    - + diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 31e334953..6b1c27c79 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -19,25 +19,27 @@ background-color: #95A5A6; color: white; } - .table-scrollable { margin-top: 0px !important; margin-bottom: 0px !important; } - .margenbound { margin-left: 15px; text-align: right; } - .amChartsAttribution { - margin-top: -2px; - margin-bottom: 8px; - visibility: hidden; - } div[id^=chartdiv] { width: 100%; height: 400px; } + .portlet-total { + float:right!important; + display:inline-block!important; + } + .abbr { + overflow: hidden; + text-overflow: ellipsis; + display:block!important; + } @@ -96,12 +98,6 @@
    - <%----%>
    @@ -111,15 +107,15 @@
    - Ventas por Productos -
    -
    -
    -
    + Ventas por Productos
    +
    + + +
    - + <%--TODO: Esto se puede meter en el stored procedured, pero me da cosa moverle :S--%> + + + <%--TODO: Esto puede tronar si el valor es DBNull --%> + <%# If(Convert.ToDecimal(Eval("Cantidad")) = 0, 0.ToString("C"), (Convert.ToDecimal(Eval("SubTotal")) / Convert.ToInt32(Eval("Cantidad"))).ToString("C")) %> + +
    @@ -143,11 +145,7 @@
    - Ventas por Productos - Gráfica -
    -
    -
    -
    + Ventas por Productos - Gráfica
    @@ -168,20 +166,20 @@
    - Compras Productores -
    -
    -
    -
    + Compras Productores
    +
    + + +
    + AutoGenerateColumns="False" AllowPaging="False" ShowFooter="True"> @@ -190,6 +188,7 @@ +
    @@ -202,11 +201,7 @@
    - Compras Productores - Gráfica por Cantidad(Kg) -
    -
    -
    -
    + Compras Productores - Gráfica por Cantidad(Kg)
    @@ -227,15 +222,15 @@
    - Gastos -
    -
    -
    -
    + Gastos
    +
    + + +
    - Compras por clasificación - Gráfica -
    -
    -
    -
    + Compras por clasificación - Gráfica
    @@ -283,15 +274,15 @@
    - Cuentas por cobrar -
    -
    -
    -
    + Cuentas por cobrar
    +
    + + +
    - Cuentas por cobrar - Gráfica Saldo VS Recuperado -
    -
    -
    -
    + Cuentas por cobrar - Gráfica Saldo VS Recuperado
    @@ -330,30 +317,6 @@
    - -
    - - -
    -
    - - Cuentas por cobrar - Gráfica Recuperado -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    @@ -363,15 +326,15 @@
    - Cuentas por Pagar productores -
    -
    -
    -
    + Cuentas por Pagar productores
    +
    + + +
    - Cuentas por Pagar productores - Gráfica -
    -
    -
    -
    + Cuentas por Pagar productores - Gráfica
    @@ -418,15 +377,15 @@
    - Cuentas por Pagar no productores -
    -
    -
    -
    + Cuentas por Pagar no productores
    +
    + + +
    - Cuentas por Pagar no productores - Gráfica -
    -
    -
    -
    + Cuentas por Pagar no productores - Gráfica
    @@ -507,7 +462,17 @@ align: 'left' }, legend: { - enabled: false + enabled: false, + // esto es para la grafica de pie + layout: 'vertical', + align: 'right', + width: 220, + verticalAlign: 'middle', + borderWidth: 0, + useHTML: true, + labelFormatter: function () { + return '
    ' + this.name + '
    ' + '
    ' + this.y.toLocaleString() + this.unit + '' + '$' + this.y2.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + '
    '; + }, }, xAxis: { type: 'category' @@ -547,6 +512,10 @@ // }, // //footerFormat: '{point.key}' //}, + tooltip: { + //valuePrefix: '$', + valueSuffix: " " + '{point.unit}' + }, plotOptions: { series: { animation: true, @@ -577,9 +546,14 @@ } }, pie: { + allowPointSelect: true, + cursor: 'pointer', dataLabels: { - enabled: true - } + enabled: true, + distance: -30, + format: '{point.percentage:.1f} %' + }, + showInLegend: true } }, series: [ @@ -594,11 +568,11 @@ //AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, type: "serial", dataProvider: json["VxP"] }); // Ventas x Producto $('#' + "chartdiv_vxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["VxP"]) }] }) - $('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], type: 'pie', data: customAccessor(json["CompProductores"]) }] }) + $('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, chart: {}, legend: { ...chartconfig.legend, enabled: true }, series: [{ ...chartconfig.series[0], keys: ['name', 'y', 'y2', 'unit', 'unit2'], type: 'pie', data: customAccessorPie(json["CompProductores"]) }] }) $('#' + "chartdiv_compacreed").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CompAcreed"]) }] }) $('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] }) $('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) - $('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { type: 'line', data: customAccessor(json["CxCR"]) }] }) + $('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { ...chartconfig.series[0], type: 'line', data: customAccessor(json["CxCR"]) }] }) function customAccessor(data) { const newData = []; @@ -609,10 +583,18 @@ newData.push([point.Texto, point.Valor, point.Unidad]); } }); - //newData.sort(function (a, b) { - // return a[0] > b[0] ? 1 : -1; - //}); - //console.log(JSON.stringify(newData)) + return newData; + } + + function customAccessorPie(data) { + const newData = []; + data.forEach(function (point, index) { + if (point.Texto == "Otros") { + newData.push({ name: point.Texto, y: point.Cantidad, y2: point.Importe, unit: point.UnidadC, unit2:point.UnidadI, color: '#000000' }); + } else { + newData.push([point.Texto, point.Cantidad, point.Importe, point.UnidadC, point.UnidadI]); + } + }); return newData; } diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index 0566e31e4..b2bf87ec9 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -83,38 +83,51 @@ Partial Class General_RepIndicadorResumen GvCxC.HeaderRow.Cells(2).Text = "Recuperado" End If - 'Mostrar gráficos solo si hay datos en su respectiva tabla + 'Mostrar gráficos y totales en portlets solo si hay datos en su respectiva tabla If GvVxP.Rows.Count > 0 Then UPGraficaVxP.Visible = True + PLVxPTot.InnerHtml = "" + "Cantidad: " + "" + String.Format("{0:n} Kg", CType(GvVxP.DataSource, DataTable).SUM("Cantidad", "Orden IS NOT NULL")) _ + + "" + "Total: " + "" + String.Format("{0:c} MXN", CType(GvVxP.DataSource, DataTable).SUM("SubTotalMN", "Orden IS NOT NULL")) Else UPGraficaVxP.Visible = False + PLVxPTot.InnerHtml = Nothing End If If GvCompProductores.Rows.Count > 0 Then UPGraficaCompProductores.Visible = True + PLCompProductoresTot.InnerHtml = "" + "Cantidad: " + "" + String.Format("{0:n} Kg", CType(GvCompProductores.DataSource, DataTable).SUM("Cantidad", "")) Else UPGraficaCompProductores.Visible = False + PLCompProductoresTot.InnerHtml = Nothing End If If GvCompAcreed.Rows.Count > 0 Then UPGraficaCompAcreed.Visible = True + PLGastosTot.InnerHtml = "" + "Importe: " + "" + String.Format("{0:c} MXN", CType(GvCompAcreed.DataSource, DataTable).SUM("SubTotalMN", "CveClasificacion IS NOT NULL")) Else UPGraficaCompAcreed.Visible = False + PLGastosTot.InnerHtml = Nothing End If If GvCxC.Rows.Count > 0 Then UPGraficaCxC.Visible = True - 'UPGraficaCxCRec.Visible = True + PLCxCTot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("SaldoMN", "CveCliente IS NOT NULL")) + Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL") + If (Recuper > 0) Then PLCxCTot.InnerHtml += "" + "Rec: " + "" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL")) Else UPGraficaCxC.Visible = False - 'UPGraficaCxCRec.Visible = False + PLCxCTot.InnerHtml = Nothing End If If GvCxP192.Rows.Count > 0 Then UPGraficaCxP192.Visible = True + PLCxP192Tot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")) Else UPGraficaCxP192.Visible = False + PLCxP192Tot.InnerHtml = Nothing End If If GvCxP.Rows.Count > 0 Then UPGraficaCxP.Visible = True + PLCxPTot.InnerHtml = "" + "Saldo: " + "" + String.Format("{0:c} MXN", CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")) Else UPGraficaCxP.Visible = False + PLCxPTot.InnerHtml = Nothing End If 'Si no había datos en ninguna tabla no cargar función de gráficos @@ -149,6 +162,32 @@ Partial Class General_RepIndicadorResumen End If End If End Sub + Dim CompProductoresTotales As Decimal() = New Decimal(5 - 1) {} + Protected Sub GvCompProductores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompProductores.RowDataBound + 'Esto tambien se podría meter en el Stored Procedure + If e.Row.RowType = DataControlRowType.DataRow Then + CompProductoresTotales(0) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Cantidad"), 0)) + CompProductoresTotales(1) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "SubTotal"), 0)) + CompProductoresTotales(2) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "PUPromedioKG"), 0)) + CompProductoresTotales(3) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Saldo"), 0)) + CompProductoresTotales(4) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Abonado"), 0)) + ElseIf e.Row.RowType = DataControlRowType.Footer Then + 'Movemos el pie a la primera fila de la tabla + Dim footerRow As GridViewRow = e.Row + GvCompProductores.Controls(0).Controls.Remove(footerRow) + GvCompProductores.Controls(0).Controls.AddAt(1, footerRow) + 'Ahora se registran los datos + e.Row.Cells(0).Text = "Totales" + e.Row.Cells(1).Text = CompProductoresTotales(0).ToString("N") + e.Row.Cells(2).Text = CompProductoresTotales(1).ToString("C") + e.Row.Cells(3).Text = (CompProductoresTotales(2) / GvCompProductores.Rows.Count).ToString("C") 'Promedio + e.Row.Cells(4).Text = CompProductoresTotales(3).ToString("C") + e.Row.Cells(5).Text = CompProductoresTotales(4).ToString("C") + For i As Integer = 1 To e.Row.Cells.Count - 1 + e.Row.Cells(i).CssClass = "margenbound" + Next + End If + End Sub Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompAcreed.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CveClasificacion") = "" Then @@ -230,32 +269,40 @@ Partial Class General_RepIndicadorResumen 'Dim group_resto_vxp = From e In resto_vxp Group e By e.Texto Into gpo = Group 'Dim group_resto_vxp = resto_vxp.GroupBy(Function(e) New With {Key e.Texto, Key e.Valor, Key e.Color, Key e.Unidad}).ToList() - 'Compras ProveedorClasificacion=192 + 'Compras Productores ProveedorClasificacion=192 DtCompProductores.Reset() DtCompProductores.Columns.Add("Texto") - DtCompProductores.Columns.Add("Valor") - DtCompProductores.Columns.Add("Unidad") + DtCompProductores.Columns.Add("Cantidad") + DtCompProductores.Columns.Add("Importe") + DtCompProductores.Columns.Add("UnidadC") + DtCompProductores.Columns.Add("UnidadI") For Each Dr As DataRow In GvCompProductores.DataSource.Rows Dim Row = DtCompProductores.NewRow() Row("Texto") = Dr("RazonSocial").ToString - Row("Valor") = Dr("Cantidad").ToString.FormatoNumero - Row("Unidad") = "Kg" + Row("Cantidad") = Dr("Cantidad").ToString.FormatoNumero + Row("Importe") = Dr("SubTotal").ToString.FormatoNumero + Row("UnidadC") = "Kg" + Row("UnidadI") = "MXN" DtCompProductores.Rows.Add(Row) Next - Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()} Dim group_comp_productores = comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = g.Key, - .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), - .Unidad = "MXN" + .Cantidad = Math.Round(g.Sum(Function(x) x.Cantidad), 2), + .Importe = Math.Round(g.Sum(Function(x) x.Importe), 2), + .UnidadC = "Kg", + .UnidadI = "MXN" }).ToDataTable - Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()} + Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()} Dim group_resto_comp_productores = resto_comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", - .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), - .Unidad = "MXN" + .Cantidad = Math.Round(g.Sum(Function(x) x.Cantidad), 2), + .Importe = Math.Round(g.Sum(Function(x) x.Importe), 2), + .UnidadC = "Kg", + .UnidadI = "MXN" }) - Dim query_comp_productores = top_comp_productores.Union(group_resto_comp_productores).OrderByDescending(Function(x) x.Valor) + Dim query_comp_productores = top_comp_productores.Union(group_resto_comp_productores).OrderByDescending(Function(x) x.Cantidad) 'Compras TipoProveedor=1 Acreedores (Gastos) DtCompAcreed.Reset() @@ -403,6 +450,7 @@ Partial Class General_RepIndicadorResumen }) Dim query_cxp = top_cxp.Union(group_resto_cxp).OrderByDescending(Function(x) x.Valor) + 'Serializar datos agrupándolos por su respectivo DataTable, todos en un solo JSON Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CompProductores = query_comp_productores, .CompAcreed = query_comp_acreed, .CxC = query_cxc, .CxCR = query_cxcr, .CxP192 = query_cxp192, .CxP = query_cxp}) 'Alert(json) diff --git a/Global.asax b/Global.asax index 10ae25b9a..e8091ab91 100644 --- a/Global.asax +++ b/Global.asax @@ -9,36 +9,37 @@