diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 2880efb7d..5f44efe8a 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -3225,7 +3225,7 @@ Public Class ClsContabilidad #Region " CUENTAS " - Public Function GetCuentas(CveCuenta As Integer, Codigo As String, Afectable As Integer, CveEmpresa As Integer, Optional RowNum As Integer = 100000, Optional CvePadre As Integer = -1) As Boolean ', Codigo As String, Nombre As String, CveClasificacionCuenta As Integer, TipoCuenta As Integer, Afectable As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + Public Function GetCuentas(CveCuenta As Integer, Codigo As String, Afectable As Integer, CveEmpresa As Integer, Optional RowNum As Integer = 100000, Optional CvePadre As Integer = -1, Optional Nombre As String = "-1") As Boolean ', Codigo As String, Nombre As String, CveClasificacionCuenta As Integer, TipoCuenta As Integer, Afectable As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean Dim Retorno = False DataAdapter("PA_Conta_CuentasGet") @@ -3234,6 +3234,7 @@ Public Class ClsContabilidad .Add("@Codigo", SqlDbType.VarChar).Value = Codigo .Add("@Afectable", SqlDbType.VarChar).Value = Afectable .Add("@CveEmpresa", SqlDbType.VarChar).Value = CveEmpresa + .Add("@Nombre", SqlDbType.VarChar).Value = Nombre .Add("@RowNum", SqlDbType.VarChar).Value = RowNum .Add("@CvePadre", SqlDbType.Int).Value = CvePadre End With diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 8009b4b60..f9f915c25 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -2619,12 +2619,13 @@ Public Class ClsGenerales #End Region #Region "SAT PRODUCTOS SERVICIOS Y UNIDAD DE MEDIDA" - Public Function GetSATProductosServicios(Optional SATClaveProductoServicio As String = "-1") As Boolean + Public Function GetSATProductosServicios(Optional SATClaveProductoServicio As String = "-1", Optional CveSATPS As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_SAT_ProductosServiciosGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@SATClaveProductoServicio", SqlDbType.Int).Value = SATClaveProductoServicio + With SqlAdapter.SelectCommand.Parameters + .Add("@SATClaveProductoServicio", SqlDbType.VarChar).Value = SATClaveProductoServicio + .Add("@CveSATPS", SqlDbType.Int).Value = CveSATPS End With 'SqlTypes.SqlDateTime.Null Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 65369f14c..2e98da7cf 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -293,7 +293,7 @@ Public Class ClsPaginas Application("Directorio") = value End Set End Property - Public Shared ReadOnly Property GlobalDTPSATPS(SATClaveProductoServicio As String) As DataTable + Public Shared ReadOnly Property GlobalDTPSATPS(SATClaveProductoServicio As String, Optional CveSATPS As Integer = -1) As DataTable Get 'If Application("GlobalDTPSATPS") Is Nothing Then ' Dim ObjGrales As New ClsGenerales @@ -304,13 +304,13 @@ Public Class ClsPaginas 'GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable Dim ObjGrales As New ClsGenerales - If ObjGrales.GetSATProductosServicios(SATClaveProductoServicio) Then + If ObjGrales.GetSATProductosServicios(SATClaveProductoServicio, CveSATPS) Then GlobalDTPSATPS = ObjGrales.DtResultados Else GlobalDTPSATPS = Nothing End If - ObjGrales.Dispose() + 'GlobalDTPSATPS = DirectCast(Application("GlobalDTPSATPS"), EnumerableRowCollection(Of DataRow)).CopyToDataTable End Get 'Set(value As DataTable) ' Application("GlobalDTPSATPS") = value @@ -647,7 +647,7 @@ Public Class ClsPaginas End Property - Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1, Optional Estatus As Integer = 1) As DataTable + Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1, Optional UsoClasificacion As Integer = -1, Optional CveClasificacion As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTClasificaciones-{0}", CveEmpresa) 'sino existe, recarga los datos @@ -662,7 +662,6 @@ Public Class ClsPaginas If CveCategoria <> -1 Then Str.AppendFormat(" AND CveCategoria = {0}", CveCategoria) If UsoClasificacion <> -1 Then Str.AppendFormat(" AND UsoClasificacion IN ({0},3) ", UsoClasificacion) If CveClasificacion <> -1 Then Str.AppendFormat(" AND CveClasificacion = {0}", CveClasificacion) - If Estatus <> -1 Then Str.AppendFormat(" AND Estatus = '{0}'", If(Estatus = 1, "Activo", "Inactivo")) Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString(), "", DataViewRowState.CurrentRows) GlobalDTClasificaciones = Dv.ToTable Dv.Dispose() @@ -1759,7 +1758,7 @@ Public Class ClsPaginas ObjProveedores.Dispose() End If - If CveEmpresa <> -1 Then + If CveEmpresa <> -1 AndAlso Application(AppNombre) IsNot Nothing Then Dim StrSQL As New StringBuilder StrSQL.AppendFormat("CveEmpresa = {0}", CveEmpresa) If CveProveedor >= 0 Then StrSQL.AppendFormat(" AND CveProveedor = {0} ", CveProveedor) @@ -3076,6 +3075,8 @@ Public Class ClsPaginas End Set End Property + + Property GlobalDTContaConceptosContables(CvePlantillaPoliza As Integer) As DataTable Get If CvePlantillaPoliza <> -1 Then @@ -3848,7 +3849,6 @@ Public Class ClsPaginas If Application("GlobalSIGAppPaginas") Is Nothing Then PaginaDict = New System.Collections.Hashtable - PaginaDict.Add("/Nomina/ISRCalculoAnual.aspx".ToUpper(), 918) PaginaDict.Add("/Nomina/Acumulados.aspx".ToUpper(), 916) PaginaDict.Add("/RH/CalculoSBC.aspx".ToUpper(), 915) @@ -4619,7 +4619,6 @@ Public Class ClsPaginas PaginaDict.Add("/GPS/RepGastos.aspx".ToUpper(), 685) PaginaDict.Add("/GPS/RecursoConfiableTracking.aspx".ToUpper(), 692) PaginaDict.Add("/GPS/KimberlyClarkTracking.aspx".ToUpper(), -1) - PaginaDict.Add("/GPS/RepUnidades.aspx".ToUpper(), 780) #End Region 'INVENTARIOS #Region "Inventarios" @@ -5953,19 +5952,6 @@ Public Class ClsPaginas Dim TipoDocumentoRef As String = "" Dim AplicaPagare As String = "1" - Dim RFCReceptor As String = "" - - If String.IsNullOrEmpty(Vta.RFCReceptor) Then - RFCReceptor = Vta.Cliente.RFC - If Vta.FacturarSucursal Then - If Vta.ClienteSucursal IsNot Nothing Then - RFCReceptor = Vta.ClienteSucursal.RFC - End If - End If - Else - RFCReceptor = Vta.RFCReceptor - End If - Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) Dim ImgCBB As String '= String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6095,7 +6081,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6110,7 +6096,7 @@ Public Class ClsPaginas 'CLIENTE params.Add(New CrystalParametro("ClienteCodigo", Vta.Cliente.Codigo)) - params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New CrystalParametro("ClienteDireccion", ClienteDireccion)) params.Add(New CrystalParametro("ClienteLugar", ClienteLugar)) @@ -6142,7 +6128,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("SelloSAT", Vta.SelloSAT)) params.Add(New CrystalParametro("QR", ImgCBB)) - params.Add(New CrystalParametro("ClienteRFC", RFCReceptor)) + params.Add(New CrystalParametro("ClienteRFC", Vta.Cliente.RFC)) params.Add(New CrystalParametro("FormaPago", Vta.FormaPagoText)) params.Add(New CrystalParametro("Moneda", Vta.Moneda)) params.Add(New CrystalParametro("TipoCambio", Vta.TipoCambio.ToString)) @@ -6477,18 +6463,7 @@ Public Class ClsPaginas Dim NombreArchivoDescarga As String = "" Dim TipoDocumento As String = "" Dim TipoDocumentoRef As String = "" - Dim RFCReceptor As String = "" - If String.IsNullOrEmpty(Vta.RFCReceptor) Then - RFCReceptor = Vta.Cliente.RFC - If Vta.FacturarSucursal Then - If Vta.ClienteSucursal IsNot Nothing Then - RFCReceptor = Vta.ClienteSucursal.RFC - End If - End If - Else - RFCReceptor = Vta.RFCReceptor - End If Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) @@ -6643,7 +6618,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists AndAlso Vta.CveCliente.ToEntero > 0 Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6664,14 +6639,14 @@ Public Class ClsPaginas params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) + params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) End If If Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) params.Add(New ReportParameter("ClienteNombre", Vta.Cliente.Nombre)) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) + params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) End If 'TOTALES diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index f4504bbb3..63f73011e 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4388,6 +4388,134 @@ Public Class ClsVentas End Function #End Region + +#Region " AUTORIZACION LIMITES " + + Public Function AutorizacionLimitesGet(CveCliente As Integer, CveCveVendedor As Integer, CveEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_AutorizacionLimitesGet", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveCveVendedor", SqlDbType.Int).Value = CveCveVendedor + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al obtener las Autorizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + + Public Function AutorizacionLimitesRemove(CveAutorizacion As Integer, CveCliente As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_AutorizacionLimitesRemove", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al eliminar la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + + Public Function AutorizacionLimitesAdd(CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveUsuario As Integer, CveEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_AutorizacionLimitesAdd", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al agregar la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + + Public Function AutorizacionLimitesEstatusUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_AutorizacionlimitesEstatusUpdate", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al actualizar la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + + Public Function AutorizacionLimitesUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_AutorizacionLimitesUpdate", CommandType.StoredProcedure) + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al actualizar el Estatus de la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function +#End Region + #Region "CANCELACION REMISION" Public Function UpdateCancelaRemision(CveVenta As Integer, SeCancelaRemision As Boolean) As Boolean diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 4d52b8b02..e2ba8339d 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -406,6 +406,8 @@ Public Class E141 : Implements IHttpHandler Else retorno = "False" End If + Case "ActualizarPreciosJson" + retorno = ActualizarPreciosJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarExistencias" respuesta = ActualizarExistencias() If respuesta Then @@ -413,6 +415,8 @@ Public Class E141 : Implements IHttpHandler Else retorno = "False" End If + Case "ActualizarExistenciasJson" + retorno = ActualizarExistenciasJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarVendedores" respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False)) If respuesta Then @@ -2118,6 +2122,26 @@ Public Class E141 : Implements IHttpHandler Return Retorno End Function + Private Function ActualizarPreciosJson(Todos As Boolean) As String + Dim payload = New JObject() + + Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetPreciosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + payload.Add(New JProperty("products", GenerarPayloadPrecios(DtPS))) + End If + + Return payload.ToString() + End Function + Private Function GenerarPayloadPrecios(DtPS As DataTable) As JArray Dim ArrayPS As New JArray For Each RowPS As DataRow In DtPS.Rows @@ -2215,6 +2239,25 @@ Public Class E141 : Implements IHttpHandler Return Retorno End Function + Private Function ActualizarExistenciasJson(Todos As Boolean) As String + Dim payload = New JObject() + + Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0 + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + If ObjPS.GetExistenciasEmpresa("-1", CveEmpresa) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + payload.Add(New JProperty("stock", GenerarPayloadExistencias(DtPS))) + End If + + Return payload.ToString() + End Function + Private Function GenerarPayloadExistencias(DtPS As DataTable) As JArray Dim ArrayPS As New JArray For Each RowPS As DataRow In DtPS.Rows @@ -2233,7 +2276,7 @@ Public Class E141 : Implements IHttpHandler #End Region -#Region "A C T U A L I Z A R - E X I S T E N C I A S" +#Region "A C T U A L I Z A R - V E N D E D O R E S" Private Function ActualizarVendedores(Todos As Boolean) As Boolean Dim Retorno As Boolean = False diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index d59b4c02d..50ad3494f 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -92,6 +92,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ActualizaPrePoliza(context) Case "getpersonal" getpersonal(context) + Case "getcuentascontables" + GetCuentasContables(context) Case "getcontratos" GetContratos(context) Case "GettingCURP" @@ -580,6 +582,15 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + 'Dim i As Integer = 0 'limpieza de columnas + 'While i < DtRetorno.Columns.Count + ' If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then + ' DtRetorno.Columns.RemoveAt(i) + ' Else + ' i = i + 1 + ' End If + 'End While + DtRetorno.Columns("CveCliente").ColumnName = "id" DtRetorno.Columns(ColumnaNombre).ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString @@ -615,11 +626,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ObjProveedores.Dispose() End If - 'Dim ObjProveedores As New ClsCompProveedores - 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - ' DtRetorno = ObjProveedores.DtResultados - 'End If - 'ObjProveedores.Dispose() Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable) '.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa)) If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name)) @@ -628,14 +634,24 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + Dim i As Integer = 0 'limpieza de columnas + While i < DtRetorno.Columns.Count + If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then + DtRetorno.Columns.RemoveAt(i) + Else + i = i + 1 + End If + End While + DtRetorno.Columns("CveProveedor").ColumnName = "id" DtRetorno.Columns("NombreCortoProveedor").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString context.Response.Write(retorno) + DtRetorno.Dispose() Else context.Response.Write("[]") End If - DtRetorno.Dispose() + Return retorno End Function #End Region @@ -1169,11 +1185,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ObjPersonal.Dispose() End If - 'Dim ObjProveedores As New ClsCompProveedores - 'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then - ' DtRetorno = ObjProveedores.DtResultados - 'End If - 'ObjProveedores.Dispose() Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}") If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then DtRetorno = dt.FiltraParametros($"NombreCompleto like '%{Name}%'") @@ -1181,6 +1192,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState End If If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + DtRetorno.Columns("CvePersonal").ColumnName = "id" DtRetorno.Columns("NombreCompleto").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString @@ -1227,4 +1239,47 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Return retorno End Function #End Region + +#Region "Get Cuentas" + Private Function GetCuentasContables(ByVal context As HttpContext) As String + Dim retorno As String = "" + Dim DtRetorno As DataTable = Nothing + + Dim usuario As Usuario = UsuarioActual(context) + Dim CveEmpresa As String + If IsNothing(usuario) Then + context.Response.Write("") + Else + CveEmpresa = usuario.CveEmpresa + + Dim Name = IfNull(context.Request("Name"), "-1").ToString + Dim ObjConta As New ClsContabilidad + If ObjConta.GetCuentas(-1, "-1", 1, CveEmpresa, Nombre:=Name) Then + DtRetorno = ObjConta.DtResultados + End If + ObjConta.Dispose() + + End If + + If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then + Dim i As Integer = 0 'limpieza de columnas + While i < DtRetorno.Columns.Count + If Not DtRetorno.Columns(i).ColumnName.Contiene("CveCuenta", "CtaCodigo") Then + DtRetorno.Columns.RemoveAt(i) + Else + i = i + 1 + End If + End While + DtRetorno.Columns("CveCuenta").ColumnName = "id" + DtRetorno.Columns("CtaCodigo").ColumnName = "text" + retorno = JsonConvert.SerializeObject(DtRetorno).ToString + context.Response.Write(retorno) + Else + context.Response.Write("[]") + End If + + DtRetorno.Dispose() + Return retorno + End Function +#End Region End Class \ No newline at end of file diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index c59201a8f..e96343893 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -715,7 +715,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas TCDoc = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate().AddMonths(-1).LastDayOfMonth()).ToDecimal(); } - Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal(); + Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal().RoundSQL(); ImporteMN = Importe; ImporteComplementaria = 0; @@ -756,8 +756,8 @@ public partial class Bancos_PagoDeudor : ClsPaginas } } - ImporteMN = Math.Round(ImporteMN, 2, MidpointRounding.AwayFromZero); - ImporteComplementaria = Math.Round(ImporteComplementaria, 2, MidpointRounding.AwayFromZero); + ImporteMN = ImporteMN.RoundSQL(); + ImporteComplementaria = ImporteComplementaria.RoundSQL(); if (tCveMoneda != 1) { @@ -825,7 +825,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas } else { - ImporteMNBanco = ImporteBanco * TC; + ImporteMNBanco = (ImporteBanco * TC).RoundSQL(); ImporteComplementaria = 0; } } diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 1d606c9e3..6015bbbd6 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -4422,7 +4422,7 @@
-
+
8% diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 2eda03230..ce5eb995c 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4621,6 +4621,13 @@ Partial Class Compras_Compras 'End If End If + + 'Compra + Dim CveFactura As Integer = -1 + If Request("CveFactura") IsNot Nothing Then + CveFactura = Request("CveFactura").ToString.ToEntero + End If + 'si el registro es manual, toma el mismo dato If CveFactura <= 0 Then TotalOriginal = TxtTotal.Text.ToDecimal @@ -4637,14 +4644,13 @@ Partial Class Compras_Compras - 'Compra If ObjCompras.AddCompra(DdlTipoComprobante.SelectedValue, TxtDescripcion.Text.Trim, TxtSerie.Text.Trim, TxtFolio.Text.Trim, TxtFolioSecundario.Text.Trim, CveProveedor, TxtSubTotal.Text.ToDouble, TxtDescuento.Text.ToDouble, LblAmortizacion.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtIEPS.Text.ToDouble, TxtOtrosImpuestos.Text.ToDouble, TxtRedondeo.Text.ToDouble, TxtTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate, DdlMoneda.SelectedValue.ToEntero, TipoCambio, TxtFechaPago.Text.Trim.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen, - CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto, EsImportacion:=EsImportacion) Then + CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto, EsImportacion:=EsImportacion, CveFactura:=CveFactura) Then ViewState("CveCompra") = ObjCompras.CveCompra If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString @@ -8424,16 +8430,20 @@ Partial Class Compras_Compras Msg.Append("¿Desea realizar una evaluacion 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 - BtnGuardar.Enabled = False - UpFacturar.Update() - Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) End If @@ -18225,12 +18235,12 @@ Partial Class Compras_Compras If Version = "3.3" And CveSATPS > 0 Then Dim DrPSSAT As DataRow = Nothing If CargaXml Then - DrPSSAT = GlobalDTPSATPS("-1").FiltroPrimero(String.Format("SATClavePS={0}", CveSATPS)) + DrPSSAT = GlobalDTPSATPS("-1", CveSATPS).FiltroPrimero("") 'If GlobalDTPSATPS().FiltraParametros(String.Format("SATClavePS={0}", CveSATPS)).Rows.Count > 0 Then ' DrPSSAT = GlobalDTPSATPS().FiltraParametros(String.Format("SATClavePS={0}", CveSATPS)).Rows(0) 'End If Else - DrPSSAT = GlobalDTPSATPS("-1").FiltroPrimero(String.Format("SATClavePS={0}", CveSATPS)) + DrPSSAT = GlobalDTPSATPS("-1", CveSATPS).FiltroPrimero("") '= GlobalDTPSATPS().FiltroPrimero(String.Format("SATClavePS={0}", CveSATPS)) 'If GlobalDTPSATPS().FiltraParametros(String.Format("CveSATPS={0}", CveSATPS)).Rows.Count > 0 Then ' DrPSSAT = GlobalDTPSATPS().FiltraParametros(String.Format("CveSATPS={0}", CveSATPS)).Rows(0) 'End If diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 2b9d9ec0a..136e3c504 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -453,8 +453,6 @@ Partial Class ContabilidadC_RegPrePolizaS End If End If - - divDatosPrincipales.Visible = False divObservaciones.Visible = False UPMovs.Visible = False @@ -1958,7 +1956,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If ObjConta2.Dispose() - If CveCuenta <= 0 Then + If CveCuenta <= 0 AndAlso CveConceptoContable <> 30 Then ' concepto 30-Bancos, tomará la cuetna de las especificaciones que se hagan enel modal Alert(String.Format("La cuenta {0} no se reconoció, favor de verificar el archivo.", Row("Cuenta").ToString)) DtMovimientos.Clear() Exit For diff --git a/Contabilidad2/RepEstadoActividades.aspx.vb b/Contabilidad2/RepEstadoActividades.aspx.vb index 0141383de..c9d8051e6 100644 --- a/Contabilidad2/RepEstadoActividades.aspx.vb +++ b/Contabilidad2/RepEstadoActividades.aspx.vb @@ -248,7 +248,7 @@ Partial Class AC_RepEstadoActividades 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray 'e.Row.ControlStyle.ForeColor = Drawing.Color.White e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then + ElseIf e.Row.DBCampo("CtaMayor").ToString.Contiene("3", "4") Then 'e.Row.CssClass = "SubTotales3" e.Row.ControlStyle.Font.Bold = True End If @@ -277,7 +277,7 @@ Partial Class AC_RepEstadoActividades 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray 'e.Row.ControlStyle.ForeColor = Drawing.Color.White e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then + ElseIf e.Row.DBCampo("CtaMayor").ToString.Contiene("3", "4") Then 'e.Row.CssClass = "SubTotales" e.Row.ControlStyle.Font.Bold = True End If diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index c6cce12bd..3470619bb 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1233,14 +1233,14 @@ Partial Class General_SaldosIniciales Dim Folio As Integer = Row("Folio").ToString.ToEntero Dim Fecha As Date = Row("Fecha").ToString.ToDate Dim FechaVencimiento As Date = Row("Fecha Vencimiento").ToString.ToDate - Dim ImpuestoLocal As Double = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString.ToDouble, 0.0) + Dim ImpuestoLocal As Decimal = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString.ToDecimal, 0D) Dim Amortizacion As Double = If(dt.Columns.Contains("Amort.Ant"), Row("Amort.Ant").ToString.ToDouble, 0.0) Dim SubTotal As Decimal = Row("SubTotal").ToString.ToDecimal Dim IVA As Decimal = Row("IVA").ToString.ToDecimal Dim Total As Decimal = Row("Total").ToString.ToDecimal Dim Saldo As Decimal = Row("Saldo").ToString.ToDecimal Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero - Dim RetIVA As Double = Row("Ret IVA").ToString.ToDouble + Dim RetIVA As Decimal = Row("Ret IVA").ToString.ToDecimal Dim RetISR As Double = Row("Ret ISR").ToString.ToDouble Dim Moneda As String = Row("Moneda").ToString Dim TipoCambio As String = Row("Tipo Cambio").ToString @@ -1249,7 +1249,6 @@ Partial Class General_SaldosIniciales Dim CveVendedor As Integer = 0 Dim IEPS As Decimal = 0 'Row("IEPS").ToString.ToDecimal Dim CveClienteSucursal As Integer = 0 'Row("CveClienteSucursal").ToString.ToEntero - Dim ImpuestosLocales As Decimal = If(dt.Columns.Contains("ImpuestoLocal"), Row("ImpuestoLocal").ToString.ToDecimal, 0) Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString, "") Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString.ToDecimal, 4), 0) @@ -1300,7 +1299,7 @@ Partial Class General_SaldosIniciales 0, 0, 0, FechaVencimiento, Fecha, "", "", Fecha, CveVendedor, Folio2, "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=Sucursal.ToEntero, CveSubProyectoEjecucion:=Sucursal.ToEntero, CveSubProyectoCobranza:=Sucursal.ToEntero, IEPS:=IEPS, - ObservacionesAlmacen:=Transaccion, Entrega:=CodCliente, ImpuestoLocal:=ImpuestosLocales) Then + ObservacionesAlmacen:=Transaccion, Entrega:=CodCliente, ImpuestoLocal:=ImpuestoLocal) Then ErrorVentas = True Exit For End If @@ -1329,14 +1328,22 @@ Partial Class General_SaldosIniciales If UsuarioActual.CveEmpresa.Contiene(119, 158) Then UsaComplementaria = True 'PrePólizaDetalle - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=Sucursal.ToEntero) Then ErrorVentas = True : Exit For - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString, ConceptoContable, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=Sucursal.ToEntero, PorcentajeImpuesto:=PorcentajeIVA) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString, ConceptoContable, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total, PorcentajeImpuesto:=PorcentajeIVA) Then ErrorVentas = True : Exit For If IVA > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IVA, PorcentajeImpuesto:=PorcentajeIVA) Then ErrorVentas = True : Exit For End If 'If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio.ToString, 38, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS) Then ErrorVentas = True : Exit For + If RetIVA > 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, Folio.ToString, 8, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=RetIVA, PorcentajeImpuesto:=PorcentajeIVA) Then ErrorVentas = True : Exit For + End If + If ImpuestoLocal > 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, Folio.ToString, 27, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImpuestoLocal, PorcentajeImpuesto:=PorcentajeIVA) Then ErrorVentas = True : Exit For + End If + + If UsaComplementaria Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total * TipoCambio.ToDecimal - Total, Folio.ToString, 203, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteME:=Total, ImporteMX:=Total * TipoCambio.ToDecimal - Total, TipoCambio:=TipoCambio.ToDecimal) Then ErrorVentas = True : Exit For End If diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 11ada3319..2a458ea07 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1331,7 +1331,7 @@ Partial Class Inventarios_EntradasSalidas tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero End If - If UsuarioActual.CveEmpresa = 119 AndAlso Not tCveSubProyecto.Contiene(10276) Then + If UsuarioActual.CveEmpresa = 119 AndAlso Not tCveSubProyecto.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then FechaCaducidadVal = MinFecha FechaCaducidad = MinFecha Lote = "" @@ -3845,16 +3845,16 @@ Partial Class Inventarios_EntradasSalidas Dim ObjInventario As New ClsInventarios Dim CveUM As Integer Dim Mensaje As String = "" - Dim FechaCaducidad As Date - Dim lote As String + 'Dim FechaCaducidad As Date + 'Dim lote As String If ObjProductosServicios.GetPS(DdlPSSalida.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then If ObjProductosServicios.DtResultados.Rows.Count > 0 Then CveUM = ObjProductosServicios.CveUnidadMedida.ToString.ToEntero End If End If - FechaCaducidad = If(ObjProductosServicios.AplicaCaducidad, TxtCaducidadSalida.Text.ToDate, MinFecha) - lote = If(ObjProductosServicios.AplicaLote, TxtLoteSalida.Text.ToString, "-1") + Dim Lote As String = If(TxtLoteSalida.Text = "", "", TxtLoteSalida.Text) + Dim FechaCaducidad As Date = If(TxtCaducidadSalida.Text = "", MinFecha.ToShortDateString, TxtCaducidadSalida.Text).ToDate If ObjInventario.GetExistenciasPS(DdlPSSalida.SelectedValue.ToEntero, CveUM, UsuarioActual.CveEmpresa, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, PendientePorSurtir:=1, Lote:=lote, FechaCaducidad:=FechaCaducidad) >= TxtCantidadSalidaInv.Text.ToDouble Then If Not DdlPSSalida.SelectedValue.ToEntero > 0 Then diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 0c0018eb9..f0df0fce3 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -973,8 +973,8 @@ Partial Class Inventarios_EntregaAlmacen If CBool(e.Row.DBCampo("AplicaCaducidad")) Then e.Row.FCTextBox("TxtCaducidad").Visible = True e.Row.FCLinkButton("LnkCaducidad").Visible = True - e.Row.FCTextBox("TxtCaducidad").ReadOnly = True - CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False + e.Row.FCTextBox("TxtCaducidad").readonly = True + CType(e.row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then @@ -2275,6 +2275,7 @@ Partial Class Inventarios_EntregaAlmacen If ErrorMovInv Then Exit For + Else ErrorMovInv = True End If @@ -2601,27 +2602,24 @@ Partial Class Inventarios_EntregaAlmacen Dim CveAlmacenOrigen = If(CveAlmacenTraspasoDestino > 0, CveAlmacenTraspasoDestino, DdlAlmacen.SelectedValue.ToEntero()) Dim CveSeccionAlmacen As Integer = 0 Dim ValorTraspaso As Decimal = 0 - - 'SI TIENE APARTADOS DEBE GENERAR LOS TRASPASOS - If DtTempApartados.Rows.Count > 0 Then - + If DtTempApartados IsNot Nothing AndAlso DtTempApartados.Rows.Count > 0 Then For Each Dr As DataRow In DtTempApartados.Rows If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString().ToEntero() Then - CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, - CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9") - FolioSalida = ObjInventario.Folio - CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() + CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, + Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, + CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9") + FolioSalida = ObjInventario.Folio + CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() + + Dim DrMovto = DtTraspasos.NewRow + DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero() + DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero() + DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado + DrMovto("FolioSalida") = FolioSalida + DtTraspasos.Rows.Add(DrMovto) + End If - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero() - DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero() - DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - If Not CveMovimientoSalidaApartado > 0 Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") @@ -2636,85 +2634,82 @@ Partial Class Inventarios_EntregaAlmacen CveSeccionAlmacen = -3 If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") - Exit For - End If - Next - - If Not ErrorMovInv Then - - Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePolizaTraspaso > 0 Then - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalidaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") + Exit For End If + Next - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero() + If Not ErrorMovInv Then + + Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaTraspaso > 0 Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalidaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + + For Each Dr1 As DataRow In DtTraspasos.Rows + CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero() CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString().ToEntero(), 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), - If Not CveMovimientoEntradaApartado > 0 Then + CveMovimientoRelacionado:=CveMovimientoSalida, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, + CveCliente:=CveCliente, Modulo:="RE/G10") + FolioEntrada = ObjInventario.Folio + + If Not CveMovimientoEntradaApartado > 0 Then ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.") - Exit For - End If + TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.") + Exit For + End If - Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado - Dr1("FolioEntrada") = FolioEntrada + Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado + Dr1("FolioEntrada") = FolioEntrada - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL - For Each Dr As DataRow In ObjInventario.DtResultados.Rows + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL + For Each Dr As DataRow In ObjInventario.DtResultados.Rows - CveSeccionAlmacen = -3 + CveSeccionAlmacen = -3 - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") - Exit For - End If - Next - End If + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then + ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") + Exit For + End If + Next + End If - If ErrorMovInv Then Exit For + If ErrorMovInv Then Exit For - If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then - ErrorMovInv = True - End If - Next + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + Next - Else - ErrorMovInv = True + Else + ErrorMovInv = True + End If End If - End If - + End If End If End If - End If - End If - - End If - - End If End If - End If - - 'QUEMAR REMISIONES - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then - DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0") - Else - ErrorMovInv = True - End If - - If Not ErrorMovInv Then + + 'QUEMAR REMISIONES + If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then + Dim DtDevRem As New DataTable + + 'CARGA REMISIONES DE LA VENTA DEVUELTA + If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then + DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0") + Else + ErrorMovInv = True + End If + + If Not ErrorMovInv Then If DtDevRem.Rows.Count > 0 Then For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString().ToEntero(), 2) Then @@ -3280,10 +3275,10 @@ Partial Class Inventarios_EntregaAlmacen 'sino es transitorio, los transitorios, ya no se hace otro movimiento ConceptoMovimiento = If(ChkTransitorio.Checked, 2, 27) - Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino) - CveMovimientoEntrada = ObjInventario.AddMovimiento(Almacen2, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, - Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenTraspasoDestino, - Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP) + Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino) + CveMovimientoEntrada = ObjInventario.AddMovimiento(Almacen2, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, + Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenTraspasoDestino, + Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP) FolioEntrada = ObjInventario.Folio If CveMovimientoEntrada > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx.vb b/Inventarios/PaquetesArmadoDesarmado.aspx.vb index 7e8f78fbe..720f688d5 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx.vb +++ b/Inventarios/PaquetesArmadoDesarmado.aspx.vb @@ -605,14 +605,14 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("") Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero - Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) - If AplicaSeccion Then - CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero - End If + 'Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) + 'If AplicaSeccion Then + ' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + 'End If If AplicaSerie Then For Each Gvr As GridViewRow In GvSeriesPaqueteDesarmado.Rows 'AGREGA MOVTO DETALLE DE LA SALIDA DEL PAQUETE - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Gvr.DataKey("Serie").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=-3, Serie:=Gvr.DataKey("Serie").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida" Exit For diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 0585cb4a3..48675aa7f 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -3009,10 +3009,8 @@ Partial Class Inventarios_RecepcionAlmacen Row("CveUM") = GvRow.DataKey("CveUM").ToEntero() DtPSVirtual.Rows.Add(Row) End If - End If Next - End If Next @@ -3065,36 +3063,32 @@ Partial Class Inventarios_RecepcionAlmacen Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero()).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero() + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, 13, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoRef, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/VD") + If CveMovimientoVirtual > 0 Then + FolioVirtual = ObjInventario.Folio - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, 13, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, CveMovimientoRelacionado:=CveMovimientoRef, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/VD") + For Each RowUsado As DataRow In DtPSVirtual.Rows + Dim CvePS = RowUsado("CvePS").ToString().ToEntero() + Dim CantidadUsado As Decimal = RowUsado("Cantidad").ToString().ToDecimal() + Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() + Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() - If CveMovimientoVirtual > 0 Then - FolioVirtual = ObjInventario.Folio - - For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() - Dim CantidadUsado As Decimal = RowUsado("Cantidad").ToString().ToDecimal() - Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() - Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - ErrorMovInv = True - Exit For - End If - Next - - If SumarImporteUsados Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) Then - ImporteIngresoAdicional = ObjInventario.DtResultados.SUMD("TotalOriginal") - End If + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For End If + Next - Else - ErrorMovInv = True + If SumarImporteUsados Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) Then + ImporteIngresoAdicional = ObjInventario.DtResultados.SUMD("TotalOriginal") + End If End If - End If + Else + ErrorMovInv = True + End If Else ErrorMovInv = True End If diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index ff91f38ce..a50ab4f25 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2761,7 +2761,7 @@ Partial Class Inventarios_RecepcionUsados CveClasificacion = drPS("CveClasificacion").ToString.ToEntero Dim Arr = PS.Split("-"c) - If Arr.Count > 0 Then + If Arr.Count > 1 Then If (DdlBCIAjuste.Items.FindByText(Arr(1).ToString) IsNot Nothing) Then DdlBCIAjuste.SelectedValueExist(DdlBCIAjuste.Items.FindByText(Arr(1).ToString).Value) End If diff --git a/Inventarios/ReconstruirCostos.aspx.vb b/Inventarios/ReconstruirCostos.aspx.vb index 1f082cf1d..6b714f911 100644 --- a/Inventarios/ReconstruirCostos.aspx.vb +++ b/Inventarios/ReconstruirCostos.aspx.vb @@ -37,10 +37,9 @@ Partial Class Inventario_ReconstruirCostos If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then DdlMarca.DataSource = ObjPS.DtResultados - DdlMarca.DataBind() - End If ObjPS.Dispose() + DdlMarca.DataBind() End Sub Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click CargaDatos() diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index 647d737bd..320609c34 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -331,7 +331,7 @@
- Ver Compra + VerCompra
@@ -454,7 +454,7 @@
- + diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 303283d94..4187a209a 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -344,7 +344,7 @@ Partial Class Inventarios_TraspasoAlmacen 'End If If Mov.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtMovimientos = Mov.DtResultados.DefaultView.ToTable("Cantidad, CveUM, CvePS, CveAF, PS, Serie, CveClasificacion, EstatusExistencia") + DtMovimientos = Mov.DtResultados.DefaultView.ToTable("Cantidad, CveUM, CvePS, CveAF, PS, Serie, CveSeccionAlmacen, CveClasificacion, EstatusExistencia") CargaGvDatos() End If diff --git a/OC/PopUpBuscarReq.aspx b/OC/PopUpBuscarReq.aspx index 58bb5d2b3..0944834f3 100644 --- a/OC/PopUpBuscarReq.aspx +++ b/OC/PopUpBuscarReq.aspx @@ -88,10 +88,8 @@ Proveedor: - - - - + + diff --git a/OC/PopUpBuscarReq.aspx.vb b/OC/PopUpBuscarReq.aspx.vb index 35d10cc86..1290d66c0 100644 --- a/OC/PopUpBuscarReq.aspx.vb +++ b/OC/PopUpBuscarReq.aspx.vb @@ -84,10 +84,14 @@ Partial Class OC_PopUpBuscarReq ' DdlProyectos.Items.Insert(0, New ListItem("Todos", "-1")) 'End If - DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedor.DataBind() + 'DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + 'DdlProveedor.DataBind() - DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + 'DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + DdlProveedor.setEsWebService(True) + DdlProveedor.Attributes.Add("data-metodo", "getproveedores") + DdlProveedor.SelectedText = "Todos" + DdlProveedor.SelectedValue = "-1" 'DdlSubProyectos.DataSource = DtEstatusUsuarios.FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"}) 'GlobalDTSubProyectos(DdlProyectos.SelectedValue.ToEntero).FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)) DdlSubProyectos.DataSource = If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), @@ -174,8 +178,10 @@ Partial Class OC_PopUpBuscarReq 'Cargar Datos If ValidarFiltrosSeleccionado() Then + Dim CveProveedor As Integer = If(DdlProveedor.SelectedValue.ToEntero > 0, DdlProveedor.SelectedValue.ToEntero, -1) + Dim ObjOC As New ClsOC - ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, DdlProveedor.SelectedValue.ToEntero, + ObjOC.GetOrdenesCompraRep(DdlTipo.SelectedValue, CveProyecto, CveSubProyecto, -1, DdlEstatus.SelectedValue.ToEntero, FI, MaxFecha, -1, CveProveedor, If(TxtFolio.Text.ToEntero <= 0, -1, TxtFolio.Text.ToEntero), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Guia:=guia, SoloSubProyectosConPermiso:=If(UsuarioActual.Empresa.Funcionalidad(530) = "1", True, False), TopSelect:=100) Dim DtOC = ObjOC.DtResultados ' tipotermino, esattus inicial diff --git a/Ventas/CatClasificaciones.aspx.vb b/Ventas/CatClasificaciones.aspx.vb index eb1ea5c8c..eab05b55b 100644 --- a/Ventas/CatClasificaciones.aspx.vb +++ b/Ventas/CatClasificaciones.aspx.vb @@ -118,7 +118,7 @@ Partial Class CatClasificaciones 'End If 'Cuenta.Dispose() Else - If UsuarioActual.Empresa.TipoContabilizacion = 2 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 Then DivCuentaIngresos.Visible = False DivCuentaCostos.Visible = False DivCuentaGasto.Visible = False @@ -224,17 +224,26 @@ Partial Class CatClasificaciones Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1) - Dim ObjEmpresa As New ClsSisEmpresas - Dim Empresa As Empresa = Nothing - If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then - Empresa = ObjEmpresa.Empresa - Dim ObjContabilidad As New ClsContPAQi(Empresa) - If ObjContabilidad.GetCuentas(-1, "-1", 1, 20000) Then - DtCuentasContables = ObjContabilidad.DtResultados + + If UsuarioActual.Empresa.TipoContabilizacion = 1 Then + + Dim ObjEmpresa As New ClsSisEmpresas + Dim Empresa As Empresa = Nothing + If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + Empresa = ObjEmpresa.Empresa + Dim ObjContabilidad As New ClsContPAQi(Empresa) + If ObjContabilidad.GetCuentas(-1, "-1", 1, 20000) Then + DtCuentasContables = ObjContabilidad.DtResultados + End If + ObjContabilidad.Dispose() End If - ObjContabilidad.Dispose() + ObjEmpresa.Dispose() + ElseIf UsuarioActual.Empresa.TipoContabilizacion = 2 Then + DdlCuentaGasto.DataValueField = "CveCuenta" + DdlCuentaGasto.DataTextField = "Cuenta" End If - ObjEmpresa.Dispose() + + End Sub Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click diff --git a/Ventas/RepPS.aspx b/Ventas/RepPS.aspx index 7c3aeed05..48d0adee4 100644 --- a/Ventas/RepPS.aspx +++ b/Ventas/RepPS.aspx @@ -68,7 +68,7 @@ Excel
  • - Reporte Diario + Reporte Diario
  • @@ -222,6 +222,53 @@
    + + + + + + + + diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 55f38afb9..cf7a1a120 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -37,7 +37,7 @@ Partial Class Ventas_RepPS End If If UsuarioActual.TienePermisoProceso(320) OrElse UsuarioActual.CveRol = 1 Then - LnkRepDiario.Visible = True + HLReporteDiario.Visible = True End If @@ -49,6 +49,8 @@ Partial Class Ventas_RepPS Private Sub CargaDatosIniciales() txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" txtFechaF.Text = Now.ToString("dd/MM/yyyy") + + TxtFechaConsulta.Text = Now.ToString("dd/MM/yyyy") End Sub Private Sub CargaCombos() @@ -237,12 +239,12 @@ Partial Class Ventas_RepPS #End Region - Protected Sub LnkRepDiario_Click(sender As Object, e As EventArgs) + Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click Dim CveMoneda As Integer = -1 Dim TC As Integer = 1 Dim TCEspecifico As Decimal = -1 - Dim FechaConsulta As DateTime = Now + Dim FechaConsulta As DateTime = TxtFechaConsulta.Text.ToDateTime() Dim DataSet As DataSet = New DataSet Dim ObjVentas As New ClsVentas() @@ -276,6 +278,8 @@ Partial Class Ventas_RepPS CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center #Region "V E N T A S - L L A N T A S, R I N E S, A L I N E A C I O N E S" + Dim CeldaTotalVentaAcumulada As ExcelCell = Nothing + worksheet.Cells(2, 0).Value = "Sucursal" 'TITULO DE LLANTAS worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 3).Merged = True @@ -322,7 +326,9 @@ Partial Class Ventas_RepPS 'INICIA DESDE LA CUARTA FILA Dim IdxSucursalesLlantasAlin As Integer = 3 + Dim idxTabla As Integer = 0 For Each Row As DataRow In DtSucursalesLLantasAlin.Rows + idxTabla += 1 worksheet.Cells(IdxSucursalesLlantasAlin, 0).Value = Row("SubProyecto") worksheet.Cells(IdxSucursalesLlantasAlin, 1).Value = Row("LlantasCantidadAnterior") @@ -345,6 +351,10 @@ Partial Class Ventas_RepPS 'worksheet.Cells(IdxSucursalesLlantasAlin, 12).Value = Row("VentaAcumulada") worksheet.Cells(IdxSucursalesLlantasAlin, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 10).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 11).Name})" + If idxTabla = DtSucursalesLLantasAlin.Rows.Count Then + CeldaTotalVentaAcumulada = worksheet.Cells(IdxSucursalesLlantasAlin, 12) + End If + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin, 0, IdxSucursalesLlantasAlin, 12).Style StyleData.Font.Weight = ExcelFont.BoldWeight StyleData.Font.Name = "Calibri" @@ -368,11 +378,336 @@ Partial Class Ventas_RepPS 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin - 1, 0, IdxSucursalesLlantasAlin - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight + +#End Region + +#Region "L L A N T A S M E S A Ñ O A N T E R I O R R E S U M E N" + Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxSucursalesLlantasAlin + 1 + + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes" + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" + + Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style + StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable6.Font.Name = "Calibri" + StyleTitleTable6.Font.Size = 8 * 20 + StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center + + + Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5) + 'INICIA DESDE LA CUARTA FILA + Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1 + + For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxMesAnioAnteriorLlantasResumen += 1 + Next + + IdxMesAnioAnteriorLlantasResumen += 1 + + 'RESUMEN DE METAS + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = "Mes" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = "Meta" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" + + Dim StyleTitleTableMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleTitleTableMeta.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableMeta.Font.Name = "Calibri" + StyleTitleTableMeta.Font.Size = 8 * 20 + StyleTitleTableMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableMeta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center + + IdxMesAnioAnteriorLlantasResumen += 1 + + For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = 0 + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" + + Dim StyleDataMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleDataMeta.Font.Weight = ExcelFont.NormalWeight + StyleDataMeta.Font.Name = "Calibri" + StyleDataMeta.Font.Size = 8 * 20 + StyleDataMeta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataMeta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxMesAnioAnteriorLlantasResumen += 1 + Next + + DtMesAnioAnteriorLLantasResumen.Dispose() +#End Region + +#Region "F R A N Q U I C I A S R E S U M E N" + + Dim TotalFranquicias As Decimal = DtSucursalesLLantasAlin.FiltroPrimeroValor("LlantasCantidadAcumulada", "CveSubProyecto=11842").ToDecimal() + DtSucursalesLLantasAlin.Dispose() + + Dim IdxRefFranquiciasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + + Dim columnRefFranquiciasResumen As Integer = 6 + + 'PRM 19 + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen).Value = $"PRM {Now.Year - 1}" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 1).Value = "ALM PS" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 2).Value = "" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Value = TotalFranquicias + + 'TOMA EL VALOR DE DIF LLANTAS + worksheet.Cells(IdxRefFranquiciasResumen + 1, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 4, 3).Name})" + + worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 1).Value = $"FRANQ {Now.Year}" + worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Value = 4988 + + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen).Value = $"PRM {Now.Year}" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 1).Value = "" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2).Formula = $"=({worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Name} - {worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Name})" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 3).Formula = $"+({worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2)})" + + 'TOMA EL VALOR DE DIF LLANTAS METAS + worksheet.Cells(IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 1, 3).Name})" + + + Dim StyleTitleTableFR = worksheet.Cells.GetSubrangeAbsolute(IdxRefFranquiciasResumen, columnRefFranquiciasResumen, IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen + 3).Style + StyleTitleTableFR.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableFR.Font.Name = "Calibri" + StyleTitleTableFR.Font.Size = 8 * 20 + StyleTitleTableFR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableFR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableFR.HorizontalAlignment = HorizontalAlignmentStyle.Center + + 'Dim StyleDataFranquicias = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + 'StyleData.Font.Weight = ExcelFont.NormalWeight + 'StyleData.Font.Name = "Calibri" + 'StyleData.Font.Size = 8 * 20 + 'StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + 'StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + 'StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + 'StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxRefFranquiciasResumen += 1 + + +#End Region + +#Region "A Ñ O R E S U M E N" + Dim IdxRefAnioResumen As Integer = IdxRefFranquiciasResumen - 1 + + Dim columnRefAnioResumen As Integer = columnRefFranquiciasResumen + 5 + + 'AÑO ANTERIOR + worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen).Value = Now.Year - 1 + Dim CellAnioAnterior = worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1) + CellAnioAnterior.Value = 0 + + 'AÑO ACTUAL + worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen).Value = Now.Year + Dim CellAnioActual = worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen + 1) + CellAnioActual.Value = 0 + + worksheet.Cells(IdxRefAnioResumen + 2, columnRefAnioResumen + 1).Formula = $"=({CeldaTotalVentaAcumulada.Name} - {worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1).Name})" + + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen).Value = $"X DIA {Now.Year - 1}" + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen).Value = $"X DIA {Now.Year}" + + Dim DiasFinMes As Integer = 0 + + Dim Day As Integer = Now.Day + Dim DaysMonth As Integer = DateTime.DaysInMonth(Now.Year, Now.Month) + Dim Month As Integer = Now.Month + Dim Year As Integer = Now.Year + + For i = Day To DaysMonth + Dim DayRef As DateTime = New DateTime(Year, Month, i) + If DayRef.DayOfWeek <> DayOfWeek.Sunday Then + DiasFinMes += 1 + End If + Next + + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 1).Formula = $"=({CellAnioAnterior.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioAnterior.Name})" + + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 1).Formula = $"=({CellAnioActual.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioActual.Name})" + + Dim StyleTitleTableAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style + StyleTitleTableAR.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableAR.Font.Name = "Calibri" + StyleTitleTableAR.Font.Size = 8 * 20 + StyleTitleTableAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableAR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableAR.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim StyleDataAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen + 1, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style + StyleDataAR.Font.Weight = ExcelFont.NormalWeight + StyleDataAR.Font.Name = "Calibri" + StyleDataAR.Font.Size = 8 * 20 + StyleDataAR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataAR.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataAR.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxRefAnioResumen += 1 + + +#End Region + +#Region "L L A N T A S M E S A Ñ O A N T E R I O R" + Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxSucursalesLlantasAlin + 8 + + worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True + worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True + worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%" + + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %" + + Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style + StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable5.Font.Name = "Calibri" + StyleTitleTable5.Font.Size = 8 * 20 + StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style + StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight + StyleSubTitleTable5.Font.Name = "Calibri" + StyleSubTitleTable5.Font.Size = 8 * 20 + StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center + StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4) + 'INICIA DESDE LA CUARTA FILA + Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1 + + For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1" + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxMesAnioAnteriorLlantas += 1 + Next + + DtMesAnioAnteriorLLantas.Dispose() +#End Region + +#Region "A Ñ O A N T E R I O R" + Dim IdxRefAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + + Dim columnRefAnioAnterior As Integer = 9 + + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior).Value = "Sucursal" + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = (FechaConsulta.Year - 1).ToString() + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = FechaConsulta.Year.ToString() + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Value = "Dif" + + Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior, IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style + StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable4.Font.Name = "Calibri" + StyleTitleTable4.Font.Size = 8 * 20 + StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3) + 'INICIA DESDE LA CUARTA FILA + Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1 + + For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" + + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + If Row("TipoFila").ToString() = "2" Then + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) + End If + + IdxAnioAnteriorLlantas += 1 + Next + + For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" + + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) + + IdxAnioAnteriorLlantas += 1 + Next + DtAnioAnteriorLLantas.Dispose() #End Region #Region "V E N T A S - S E R V I C I O S D E I N S T A L A C I O N, A M O R T I G U A D O R E S, P O L I Z A S" - Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxSucursalesLlantasAlin + 3 + Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxMesAnioAnteriorLlantas + 3 worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 0).Value = "Sucursal" 'TITULO SERVICIOS DE INSTALACION @@ -550,176 +885,6 @@ Partial Class Ventas_RepPS DtPorcentajes.Dispose() #End Region -#Region "A Ñ O A N T E R I O R" - Dim IdxRefAnioAnteriorLlantas As Integer = IdxPorcentajes + 3 - - worksheet.Cells(IdxRefAnioAnteriorLlantas, 0).Value = "Sucursal" - worksheet.Cells(IdxRefAnioAnteriorLlantas, 1).Value = (FechaConsulta.Year - 1).ToString() - worksheet.Cells(IdxRefAnioAnteriorLlantas, 2).Value = FechaConsulta.Year.ToString() - worksheet.Cells(IdxRefAnioAnteriorLlantas, 3).Value = "Dif" - - Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, 0, IdxRefAnioAnteriorLlantas, 3).Style - StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable4.Font.Name = "Calibri" - StyleTitleTable4.Font.Size = 8 * 20 - StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center - - Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3) - 'INICIA DESDE LA CUARTA FILA - Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1 - - For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows - worksheet.Cells(IdxAnioAnteriorLlantas, 0).Value = Row("Grupo") - worksheet.Cells(IdxAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxAnioAnteriorLlantas, 2).Value = Row("LLantas") - worksheet.Cells(IdxAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, 2).Name})" - - - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, 0, IdxAnioAnteriorLlantas, 3).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - - If Row("TipoFila").ToString() = "2" Then - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) - End If - - IdxAnioAnteriorLlantas += 1 - Next - - For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows - worksheet.Cells(IdxAnioAnteriorLlantas, 0).Value = Row("Grupo") - worksheet.Cells(IdxAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxAnioAnteriorLlantas, 2).Value = Row("LLantas") - worksheet.Cells(IdxAnioAnteriorLlantas, 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, 2).Name})" - - - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, 0, IdxAnioAnteriorLlantas, 3).Style - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) - - IdxAnioAnteriorLlantas += 1 - Next - DtAnioAnteriorLLantas.Dispose() -#End Region - -#Region "L L A N T A S M E S A Ñ O A N T E R I O R" - Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxAnioAnteriorLlantas + 3 - - worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True - worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True - worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%" - - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %" - - Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style - StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable5.Font.Name = "Calibri" - StyleTitleTable5.Font.Size = 8 * 20 - StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center - - Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style - StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight - StyleSubTitleTable5.Font.Name = "Calibri" - StyleSubTitleTable5.Font.Size = 8 * 20 - StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center - StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center - - Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4) - 'INICIA DESDE LA CUARTA FILA - Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1 - - For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows - worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1" - - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - - IdxMesAnioAnteriorLlantas += 1 - Next - - DtMesAnioAnteriorLLantas.Dispose() -#End Region - -#Region "L L A N T A S M E S A Ñ O A N T E R I O R" - Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxMesAnioAnteriorLlantas + 2 - - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes" - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" - - Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style - StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable6.Font.Name = "Calibri" - StyleTitleTable6.Font.Size = 8 * 20 - StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center - - - Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5) - 'INICIA DESDE LA CUARTA FILA - Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1 - - For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas") - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" - - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - - IdxMesAnioAnteriorLlantasResumen += 1 - Next - - DtMesAnioAnteriorLLantasResumen.Dispose() -#End Region - Dim columnCount = worksheet.CalculateMaxUsedColumns() For i = 0 To columnCount diff --git a/asmx/WSSIGApp.asmx b/asmx/WSSIGApp.asmx index 4e223989a..9aaca8891 100644 --- a/asmx/WSSIGApp.asmx +++ b/asmx/WSSIGApp.asmx @@ -1867,7 +1867,7 @@ Public Class WSSIGApp 'VALIDA PROMOCIONES Y EXISTENCIAS Dim ObjVentas As New ClsVentas - If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, CveCliente, ObjFactura.CveVendedor, -1, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, CveCliente, ObjFactura.CveVendedor, 1, UsuarioActual.CveEmpresa) Then ObjFactura.DtPromociones = ObjVentas.DtResultados End If ObjVentas.Dispose() @@ -1951,13 +1951,13 @@ Public Class WSSIGApp ObjFactura.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", $"CveUsoCFDI = {ObjCliente.CveUsoCFDI}") ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {ObjCliente.CveUsoCFDI}") - ObjFactura.CveMetodoPago = ObjCliente.CveMetodoPago - If GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows.Count > 0 Then - ObjFactura.MetodoPago = GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows(0)("MetodoPago").ToString - Else - ObjFactura.CveMetodoPago = 1 - ObjFactura.MetodoPago = "Efectivo" - End If + 'ObjFactura.CveMetodoPago = ObjCliente.CveMetodoPago + 'If GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows.Count > 0 Then + ' ObjFactura.MetodoPago = GlobalDTMetodosPago.FiltraParametros($"CveMetodoPago = {ObjCliente.CveMetodoPago}").Rows(0)("MetodoPago").ToString + 'Else + ' ObjFactura.CveMetodoPago = 1 + ' ObjFactura.MetodoPago = "Efectivo" + 'End If ObjFactura.CveClienteSucursal = -1 End If