From d5a4849d274ed3c93e017dc5313fd44668cfee37 Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Wed, 2 Sep 2020 12:00:59 -0700 Subject: [PATCH] Exel anexos horizontales, AF --- AF/OrdenTrabajo.aspx | 487 ++++++++++-------- AF/OrdenTrabajo.aspx.vb | 110 +++- AF/TipoOrdenTrabajo.aspx | 65 +-- AF/TipoOrdenTrabajo.aspx.vb | 347 ++++++++++--- App_Code/ClsAF.vb | 131 ++++- App_Code/modExtensiones.vb | 156 ++++++ Contabilidad2/RepAnexoCatalogoAnual.aspx | 17 + Contabilidad2/RepAnexoCatalogoAnual.aspx.vb | 46 +- Contabilidad2/RepAnexoCatalogoCC.aspx | 12 + Contabilidad2/RepAnexoCatalogoCC.aspx.vb | 27 +- Contabilidad2/RepAnexoCatalogoMensual.aspx | 15 + Contabilidad2/RepAnexoCatalogoMensual.aspx.vb | 29 +- .../RepEstadoResultadosHorizontal.aspx.vb | 120 ++++- Inventarios/EntradasSalidas.aspx.vb | 16 +- 14 files changed, 1213 insertions(+), 365 deletions(-) diff --git a/AF/OrdenTrabajo.aspx b/AF/OrdenTrabajo.aspx index 955d449d4..2725753e6 100644 --- a/AF/OrdenTrabajo.aspx +++ b/AF/OrdenTrabajo.aspx @@ -55,223 +55,300 @@ -
-
-
-
- - +
+ +
+
+
+
+ + + +
+
+
+ <%--
+
+
+ + +
+ +
+ + + + +
+ + +
+ + + + +
+ +
+ + + + +
+ + +
+ + + + +
+ + + +
+ + +
+
-
-
- <%--
+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
-
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
-
- - - - +
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + - + + + + + + -
- - - - -
- -
- - - - - + + + + + + + + + + +
+ + -
- - -
- -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -318,13 +395,15 @@
+ +
- + diff --git a/AF/OrdenTrabajo.aspx.vb b/AF/OrdenTrabajo.aspx.vb index d7c2d7326..632937a24 100644 --- a/AF/OrdenTrabajo.aspx.vb +++ b/AF/OrdenTrabajo.aspx.vb @@ -36,6 +36,7 @@ Partial Class AF_OrdenTrabajo If Request("CveOrdenTrabajo") IsNot Nothing Then CveOrdenTrabajo = Request("CveOrdenTrabajo").ToEntero + Tab.Visible = True End If CargaCombos() @@ -50,6 +51,15 @@ Partial Class AF_OrdenTrabajo #Region " CARGA COMBOS " Protected Sub CargaCombos() + + + CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) + + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa, -1) + DdlAF.DataBind() + + + Dim ObjAF As New ClsAF If ObjAF.GetTiposServicios(-1, -1, -1, UsuarioActual.CveEmpresa) Then @@ -58,10 +68,21 @@ Partial Class AF_OrdenTrabajo DdlTipoServicio.DataSource = Nothing End If + + If ObjAF.GetOrdenesTrabajoEstatus(UsuarioActual.CveEmpresa) Then + DdlOrdenesTrabajoEstatus.DataSource = ObjAF.DtResultados + Else + DdlOrdenesTrabajoEstatus.DataSource = Nothing + End If + + ObjAF.Dispose() DdlTipoServicio.DataBind() + DdlOrdenesTrabajoEstatus.DataBind() + DdlTipoServicio.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlOrdenesTrabajoEstatus.SelectedValueExist(1) UpFiltro.Update() @@ -95,16 +116,6 @@ Partial Class AF_OrdenTrabajo - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - - - End If - - End Sub - #End Region Protected Sub LnkEliminarMetricaValor_Click(sender As Object, e As EventArgs) @@ -114,6 +125,34 @@ Partial Class AF_OrdenTrabajo Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + If CveOrdenTrabajo <= 0 Then + + + Dim ObjAF As New ClsAF + ObjAF.IniciaTransacSQL() + Dim ErrorProceso As Boolean = False + + If Not ObjAF.AddOrdenesTrabajo(DdlTipoServicio.SelectedValue.ToEntero, DdlAF.SelectedValue.ToEntero, TxtServicio.Text.Trim, DdlSubProyecto.SelectedValue.ToEntero, DdlPrioridad.SelectedValue.ToEntero, txtFechaI.Text.ToDate, MaxFecha, MaxFecha, DdlOrdenesTrabajoEstatus.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + + + End If + + If Not ErrorProceso Then + ObjAF.Commit() + Alert($"Orden de trabajo guardada corectamente Folio {ObjAF.FolioOT}") + Else + ObjAF.RollBack() + End If + + + + ObjAF.Dispose() + + + Else + + End If @@ -282,4 +321,55 @@ Partial Class AF_OrdenTrabajo +#Region "FOLIOS" + + + Private Function CargaFolios() As Boolean + + Dim Respuesta As Boolean = False + + If DdlSubProyecto.SelectedValue.ToEntero() <= 0 Then + Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError) + Return False + Exit Function + End If + + Dim ObjFolios As New ClsGralFolios() + + If ObjFolios.GetFolios("OT", UsuarioActual.CveEmpresa) Then + + Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyecto.SelectedValue)) + + If DT.Rows.Count > 0 Then + Respuesta = True + Else + + Alert("No tiene registrados Folios para " & DdlSubProyecto.SelectedItem.Text & " ", TipoMensaje.MsgAdvertencia) + End If + + DT.Dispose() + + End If + + ObjFolios.Dispose() + + + Return Respuesta + End Function + +#End Region + + + Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) + + If CargaFolios() Then + BtnGuardar.Enabled = True + Else + BtnGuardar.Enabled = False + End If + + UpGuardar.Update() + + + End Sub End Class diff --git a/AF/TipoOrdenTrabajo.aspx b/AF/TipoOrdenTrabajo.aspx index 907178821..f15bf08c9 100644 --- a/AF/TipoOrdenTrabajo.aspx +++ b/AF/TipoOrdenTrabajo.aspx @@ -28,7 +28,7 @@ } .table.dataTable { - margin-top: 0px !important; + margin-top: 0px !important; } .dataTables_scrollBody table th { @@ -81,36 +81,24 @@
-
- - - - -
- -
- - - - -
- -
+
-<%--
- - - - + +
+ + + -
--%> +
+ +
@@ -133,7 +121,7 @@
-
+
@@ -181,13 +169,14 @@ + OnRowDataBound="GvActividades_RowDataBound" + DataKeyNames="CveTipoServicioActividad,CveActividad,Duracion" GridLines="None"> - + @@ -217,19 +206,35 @@
-
+
- + + + + + + + + + + + + + + + + - + diff --git a/AF/TipoOrdenTrabajo.aspx.vb b/AF/TipoOrdenTrabajo.aspx.vb index f559d1da8..cebcd7af4 100644 --- a/AF/TipoOrdenTrabajo.aspx.vb +++ b/AF/TipoOrdenTrabajo.aspx.vb @@ -67,6 +67,9 @@ Partial Class AF_TipoOrdenTrabajo End Property + + + #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load @@ -77,57 +80,23 @@ Partial Class AF_TipoOrdenTrabajo CveTipoServicio = Request("CveTipoServicio").ToEntero End If + CargaCombos() + + If CveTipoServicio = -1 Then CrearTablas() + CargaActividades() + CargaCheckList() + Else + CargaDatos() End If - CargaCombos() + End If End Sub - Property IndexMaterial As Integer - Get - If ViewState("IndexMaterial") Is Nothing Then - Return -1 - Else - Return ViewState("IndexMaterial").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("IndexMaterial") = value - End Set - End Property - - - - Property IndexActividades As Integer - Get - If ViewState("IndexActividades") Is Nothing Then - Return -1 - Else - Return ViewState("IndexActividades").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("IndexActividades") = value - End Set - End Property - - Property IndexCheckList As Integer - Get - If ViewState("IndexCheckList") Is Nothing Then - Return -1 - Else - Return ViewState("IndexCheckList").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("IndexCheckList") = value - End Set - End Property - @@ -157,10 +126,6 @@ Partial Class AF_TipoOrdenTrabajo DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - If CveTipoServicio <= 0 Then - CargaActividades() - - End If End Sub @@ -221,6 +186,25 @@ Partial Class AF_TipoOrdenTrabajo Private Sub CargaDatos() + Dim ErrorProceso As Boolean = False + + Dim ObjAf As New ClsAF + + If ObjAf.GetTiposServicios(CveTipoServicio, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + + If ObjAf.DtResultados.Rows.Count > 0 Then + TxtTipoServicio.Text = ObjAf.DtResultados(0)("Nombre").ToString + DdlTipoMantenimiento.SelectedValueExist(ObjAf.DtResultados(0)("CveTipoMantenimiento").ToString) + End If + + + Else + ErrorProceso = True + End If + + ObjAf.Dispose() + CargaMateriales() CargaActividades() CargaCheckList() @@ -233,7 +217,9 @@ Partial Class AF_TipoOrdenTrabajo Dim ObjAF As New ClsAF - If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio) Then + If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio, UsuarioActual.CveEmpresa) Then + + DTMateriales = ObjAF.DtResultados GvMaterial.DataSource = DTMateriales Else @@ -256,20 +242,26 @@ Partial Class AF_TipoOrdenTrabajo Dim ObjAF As New ClsAF - If CveTipoServicio <= 0 Then + If CveTipoServicio > 0 Then - If ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa) Then + If ObjAF.GetTiposServiciosActividades(-1, CveTipoServicio, -1) Then GvActividades.DataSource = ObjAF.DtResultados Else GvActividades.DataSource = Nothing End If + Else + If ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa) Then + GvActividades.DataSource = ObjAF.DtResultados + Else + GvActividades.DataSource = Nothing + End If End If + ObjAF.Dispose() GvActividades.DataBind() - UpGvActividades.Update() End Sub @@ -278,17 +270,51 @@ Partial Class AF_TipoOrdenTrabajo Dim ObjAF As New ClsAF + If CveTipoServicio > 0 Then + + If ObjAF.GetCheckList(-1, CveTipoServicio, -1, UsuarioActual.CveEmpresa) Then + GvCheckList.DataSource = ObjAF.DtResultados + Else + GvCheckList.DataSource = Nothing + End If + + Else + If ObjAF.GetCheckListActividad(-1, -1, UsuarioActual.CveEmpresa) Then + GvCheckList.DataSource = ObjAF.DtResultados + Else + GvCheckList.DataSource = Nothing + End If + End If + + ObjAF.Dispose() - + GvCheckList.DataBind() + UpGvCheckList.Update() End Sub - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) + + + + Protected Sub GvCheckList_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + If e.Row.DataKey("CveCheckListActividad").ToEntero = 0 Then + + e.Row.FCLiteral("LtlNROW").Text = e.Row.DataKey("CheckListActividadGrupo").ToString + Chk.Visible = False + e.Row.Attributes.Add("style", "background-color:#DDD") + + End If + + + If e.Row.DataKey("CveTipoServicio").ToEntero > 0 Then + Chk.Checked = True + End If End If @@ -572,36 +598,146 @@ Partial Class AF_TipoOrdenTrabajo 'validacion? + If CveTipoServicio = -1 Then + + If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + CveTipoServicio = ObjAF.CveTipoServicio + + For Each GvRow As GridViewRow In GvMaterial.Rows + + If Not ObjAF.AddTiposServiciosMaterial(CveTipoServicio, GvRow.DataKey("Cantidad").ToDecimal, GvRow.DataKey("CveUM").ToEntero, GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("Tipo").ToEntero) Then + ErrorProceso = True + Exit For + End If + + Next + + For Each GvRow As GridViewRow In GvActividades.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + If Chk.Checked Then + If Not ObjAF.AddTiposServiciosActividades(GvRow.DataKey("CveActividad").ToEntero, CveTipoServicio, Horas, "") Then + ErrorProceso = True + Exit For + End If + End If + Next - CveTipoServicio = ObjAF.CveTipoServicio + For Each GvRow As GridViewRow In GvCheckList.Rows - For Each GvRow As GridViewRow In GvMaterial.Rows + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero + + If Chk.Checked Then + If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then + ErrorProceso = True + Exit For + End If + End If + + + Next + + + End If + + Else + + If Not ObjAF.UpdateTiposServicios(CveTipoServicio, TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If + + + If Not ErrorProceso Then + + For Each GvRow As GridViewRow In GvActividades.Rows + + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero + Dim CveActividad As Integer = GvRow.DataKey("CveActividad").ToEntero + + Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + If Chk.Checked Then + + If CveTipoServicioActividad > 0 Then + If Not ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividad, Horas, "") Then + ErrorProceso = True + Exit For + End If + Else + If Not ObjAF.AddTiposServiciosActividades(CveActividad, CveTipoServicio, Horas, "") Then + ErrorProceso = True + Exit For + End If + End If + + Else + + If CveTipoServicioActividad > 0 Then + If Not ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + Exit For + End If + End If + + End If + Next + + If Not ErrorProceso Then + + For Each GvRow As GridViewRow In GvCheckList.Rows + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + + + If Chk.Visible Then + + Dim CveTipoServicioTmp As Integer = GvRow.DataKey("CveTipoServicio").ToEntero + Dim CveCheckList As Integer = GvRow.DataKey("CveCheckList").ToEntero + Dim CveCheckListActividad As Integer = GvRow.DataKey("CveCheckListActividad").ToEntero + + If CveTipoServicioTmp > 0 Then + + If Not Chk.Checked Then + + If Not ObjAF.DeleteCheckList(CveCheckList) Then + ErrorProceso = True + Exit For + End If + End If + + Else + + If Chk.Checked Then + If Not ObjAF.AddCheckList(CveTipoServicio, CveCheckListActividad) Then + ErrorProceso = True + Exit For + End If + End If + + End If + + + + End If + + Next - If Not ObjAF.AddTiposServiciosMaterial(CveTipoServicio, GvRow.DataKey("Cantidad").ToDecimal, GvRow.DataKey("CveUM").ToEntero, GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("Tipo").ToEntero) Then - ErrorProceso = True - Exit For End If - Next - - For Each GvRow As GridViewRow In GvActividades.Rows - - Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") - Dim Horas As Decimal = GvRow.FCTextBox("").Text.ToDecimal - - - If ObjAF.AddTiposServiciosActividades(GvRow.DataKey("").ToEntero) Then - - Next - + End If End If + + If ErrorProceso Then ObjAF.RollBack() Else @@ -612,6 +748,77 @@ Partial Class AF_TipoOrdenTrabajo ObjAF.Dispose() + CargaDatos() + End Sub + + Protected Sub Chk_CheckedChanged(sender As Object, e As EventArgs) + + 'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, CheckBox).BindingContainer, GridViewRow) + 'Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + + 'Dim CveTipoServicioActividad As Integer = GvRow.DataKey("CveTipoServicioActividad").ToEntero + 'Dim CveActividad As Integer = GvRow.DataKey("CveActividad").ToEntero + + 'Dim Horas As Decimal = GvRow.FCTextBox("TxtHoras").Text.ToDecimal + + 'Dim ObjAF As New ClsAF + + + 'If Chk.Checked Then + + ' If CveTipoServicioActividad > 0 Then + ' If ObjAF.UpdateTiposServiciosActividades(CveTipoServicioActividad, CveActividad, Horas, "") Then + + ' End If + ' Else + ' If ObjAF.AddTiposServiciosActividades(CveActividad, CveTipoServicio, Horas, "") Then + + ' End If + ' End If + + 'Else + + + ' If CveTipoServicioActividad > 0 Then + + ' If ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa) Then + + ' End If + + ' End If + + 'End If + + + 'ObjAF.Dispose() + + + End Sub + + + + Protected Sub GvActividades_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim CveTipoServicioActividad As Integer = e.Row.DataKey("CveTipoServicioActividad").ToEntero + Dim TxtHoras As TextBox = e.Row.FCTextBox("TxtHoras") + Dim Chk As CheckBox = e.Row.FCCheckBox("Chk") + + If CveTipoServicioActividad > 0 Then + + Chk.Checked = True + TxtHoras.Text = e.Row.DataKey("Duracion") + + + + End If + + + + End If + + End Sub End Class diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index c66beb356..1457316a7 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -91,6 +91,8 @@ Public Class ClsAF Public Property CveDispositivo As Integer Public Property MedidaVehicular As Integer Public Property CveTipoServicio As Integer + Public Property CveOrdenTrabajo As Integer + Public Property FolioOT As Integer #End Region @@ -3480,6 +3482,7 @@ Public Class ClsAF #End Region #Region "TIPO SERVICIO" + Public Function GetTiposServicios(CveTipoServicio As Integer, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -3572,7 +3575,7 @@ Public Class ClsAF Return Retorno End Function - Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividad As Integer) As Boolean + Public Function GetTiposServiciosActividades(CveTipoServicioActividad As Integer, CveTipoServicio As Integer, CveActividad As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosActividadesGet") @@ -3580,6 +3583,7 @@ Public Class ClsAF With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio End With Try @@ -3592,14 +3596,15 @@ Public Class ClsAF Return Retorno End Function - Public Function AddTiposServiciosActividades(CveActividad As Integer, Duracion As Integer, Observaciones As String) As Boolean + Public Function AddTiposServiciosActividades(CveActividad As Integer, CveTipoServicio As Integer, Duracion As Decimal, Observaciones As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosActividadesAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@Duracion", SqlDbType.Int).Value = Duracion + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones End With @@ -3613,7 +3618,7 @@ Public Class ClsAF Return Retorno End Function - Public Function UpdateTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividad As Integer, Duracion As Integer, Observaciones As String) As Boolean + Public Function UpdateTiposServiciosActividades(CveTipoServicioActividad As Integer, CveActividad As Integer, Duracion As Decimal, Observaciones As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosActividadesUpdate") @@ -3621,7 +3626,7 @@ Public Class ClsAF With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad .Add("@CveActividad", SqlDbType.Int).Value = CveActividad - .Add("@Duracion", SqlDbType.Int).Value = Duracion + .Add("@Duracion", SqlDbType.SmallMoney).Value = Duracion .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones End With @@ -3635,13 +3640,14 @@ Public Class ClsAF Return Retorno End Function - Public Function DeleteTiposServiciosActividades(CveTipoServicioActividad As Integer) As Boolean + Public Function DeleteTiposServiciosActividades(CveTipoServicioActividad As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosActividadesDelete") With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoServicioActividad", SqlDbType.Int).Value = CveTipoServicioActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -3654,7 +3660,7 @@ Public Class ClsAF Return Retorno End Function - Public Function GetTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer) As Boolean + Public Function GetTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveTipoServicio As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosMaterialGet") @@ -3662,6 +3668,7 @@ Public Class ClsAF With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -4005,7 +4012,7 @@ Public Class ClsAF Return Retorno End Function - Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer) As Boolean + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_CheckListActividadGet") @@ -4013,6 +4020,7 @@ Public Class ClsAF With SqlAdapter.SelectCommand.Parameters .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -4085,7 +4093,7 @@ Public Class ClsAF Return Retorno End Function - Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_CheckListGet") @@ -4094,6 +4102,7 @@ Public Class ClsAF .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try @@ -4166,6 +4175,110 @@ Public Class ClsAF Return Retorno End Function + + + + + + +#Region "O R D E N E S D E T R A B A J O" + + Public Function GetOrdenesTrabajoEstatus(CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoEstatusGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetOrdenesTrabajo(CveTipoServicio As Integer, CveAF As Integer, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + Public Function AddOrdenesTrabajo(CveTipoServicio As Integer, CveAF As Integer, Servicio As String, CveSubProyecto As Integer, Prioridad As Integer, FechaInicio As Date, FechaFin As Date, FechaFinReal As Date, CveEstatusOT As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_OrdenesTrabajoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@Servicio", SqlDbType.VarChar).Value = Servicio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@FechaFinReal", SqlDbType.Date).Value = FechaFinReal + .Add("@CveEstatusOT", SqlDbType.Int).Value = CveEstatusOT + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + .Add("@CveOrdenTrabajo", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@Folio", SqlDbType.Int).Direction = ParameterDirection.Output + + End With + + Try + SqlAdapter.Fill(Data) + + CveOrdenTrabajo = SqlAdapter.SelectCommand.Parameters("@CveOrdenTrabajo").Value.ToString.ToEntero + FolioOT = SqlAdapter.SelectCommand.Parameters("@Folio").Value.ToString.ToEntero + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar la orden de trabajo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + + +#End Region + #End Region diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index c5fb9f873..f99963785 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -2053,7 +2053,163 @@ Namespace Extensiones style.Clear() End If + End Sub + + + Public Sub ExportToExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, FechaIMes As String, FechaFMes As String, Titulo As String, SubProyecto As String, Divisor As Integer, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional DatoTituloExtra As String ="") + + Dim sw1 As New StringWriter() + Dim htw1 As New HtmlTextWriter(sw1) + GridView.RenderControl(htw1) + + Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + + Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) + + htmlStream1.Position = 0 + Dim sr1 As New StreamReader(htmlStream1) + Dim myStr1 = sr1.ReadToEnd() + sr1.Dispose() + htmlStream1.Dispose() + sw1.Dispose() + + Dim HtmlCompleto As String = myStr1 + + HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") + + Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) + + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) + + Dim excel As GemBox.Spreadsheet.ExcelFile + + excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) + + If Usuario IsNot Nothing Then + + Dim TotalRowHeader As Integer = 8 + Dim TotalRowFooter As Integer = 2 + + + Dim worksheet = excel.Worksheets(0) + worksheet.Rows.InsertEmpty(0, TotalRowHeader) + Dim celdasConTexto = worksheet.GetUsedCellRange(True) + celdasConTexto.Style.Font.Name = "Calibri Light" + + Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + RangoNombreEmpresa.Merged = True + RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + RangoNombreEmpresa.Style.Font.Size = 18 * 20 + RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + RangoTitulo.Merged = True + RangoTitulo.Value = Titulo + RangoTitulo.Style.Font.Size = 20 * 20 + RangoTitulo.Style.Font.Name = "Calibri Light" + RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) + RangoFechas.Merged = True + RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}" + RangoFechas.Style.Font.Size = 15 * 20 + RangoFechas.Style.Font.Name = "Calibri Light" + RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + If SubProyecto.Length > 0 Then + Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex) + RangoSubProyecto.Merged = True + RangoSubProyecto.Value = SubProyecto + RangoSubProyecto.Style.Font.Size = 20 * 20 + RangoSubProyecto.Style.Font.Name = "Calibri Light" + RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + End If + + + If DatoTituloExtra.Length > 0 Then + Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + RangoDatoTituloExtra.Merged = True + RangoDatoTituloExtra.Value = DatoTituloExtra + RangoDatoTituloExtra.Style.Font.Size = 20 * 20 + RangoDatoTituloExtra.Style.Font.Name = "Calibri Light" + RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoDatoTituloExtra.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + End If + + + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + + worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + + + If i > 0 Then + Try + worksheet.Columns(i).AutoFit(1) + Catch ex As Exception + End Try + End If + + Next + + Dim IndexEndTable As Integer = GridView.Rows.Count + TotalRowHeader + TotalRowFooter + + worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre + + worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using + End If + + + For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + + If I > 0 Then + + If Divisor = 1 Then + worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00" + Else + worksheet.Columns(I + 1).Style.NumberFormat = "#,##" + End If + + Try + worksheet.Columns(I).AutoFit(1) + Catch ex As Exception + End Try + + End If + Next + + End If + + excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") + + End Sub + + Public Sub ExportToExcel(GridView As HtmlTable, NombreArchivoXLS As String) Dim sb As StringBuilder = New StringBuilder() diff --git a/Contabilidad2/RepAnexoCatalogoAnual.aspx b/Contabilidad2/RepAnexoCatalogoAnual.aspx index 569e1ad17..fb82be51c 100644 --- a/Contabilidad2/RepAnexoCatalogoAnual.aspx +++ b/Contabilidad2/RepAnexoCatalogoAnual.aspx @@ -10,6 +10,23 @@ + + + + +
  • + Generar Excel +
  • + +
    + + + +
    + + + +
    diff --git a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb index ec453de5d..9ab4095e6 100644 --- a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb @@ -133,12 +133,24 @@ Partial Class Contabilidad2_RepAnexoCatalogoAnual 'RegistraScript($"LimpiaCeros({DdlDivisor.SelectedValue});") RegistraScript($"LimpiaCeros();") - Conta.Dispose() - End Sub - + Conta.Dispose() + + + + If GvAnual.Rows.Count > 0 Then + + LnkExportar.Visible = True + UpAcciones.Update() + + End If + + + + End Sub + #End Region - - + + #Region " GV ROW DATABOUND " Protected Sub GvAnual_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAnual.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -150,9 +162,25 @@ Partial Class Contabilidad2_RepAnexoCatalogoAnual e.Row.Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em") End If - End Sub + End Sub + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + Dim SubProyecto As String = "" + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + SubProyecto = DdlSubProyecto.SelectedItem.Text + End If + + GvAnual.ExportToExcelGembox("AnexoCatálogoAnual", UsuarioActual, $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio2.SelectedValue}", "Anexo del Catálogo - Anual", SubProyecto, DdlDivisor.SelectedValue.ToEntero, DatoTituloExtra:=$"Periodo {DdlPeriodo.SelectedItem.Text}") + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + #End Region - - - + + + End Class diff --git a/Contabilidad2/RepAnexoCatalogoCC.aspx b/Contabilidad2/RepAnexoCatalogoCC.aspx index 9546b56cf..3112f9121 100644 --- a/Contabilidad2/RepAnexoCatalogoCC.aspx +++ b/Contabilidad2/RepAnexoCatalogoCC.aspx @@ -11,6 +11,18 @@ + + + +
  • + Generar Excel +
  • + +
    + + + +
    diff --git a/Contabilidad2/RepAnexoCatalogoCC.aspx.vb b/Contabilidad2/RepAnexoCatalogoCC.aspx.vb index bf8696979..4f23d7626 100644 --- a/Contabilidad2/RepAnexoCatalogoCC.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoCC.aspx.vb @@ -112,6 +112,14 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC Else GvCC.DataSource = Nothing + End If + + + If GvCC.Rows.Count > 0 Then + + LnkExportar.Visible = True + UpAcciones.Update() + End If RegistraScript($"LimpiaCeros({DdlDivisor.SelectedValue});") @@ -132,9 +140,22 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC e.Row.Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em") End If - End Sub + End Sub #End Region - - + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + Dim SubProyecto As String = "" + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + SubProyecto = DdlSubProyecto.SelectedItem.Text + End If + + GvCC.ExportToExcelGembox("AnexoCatálogoMensual", UsuarioActual, $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio.SelectedValue}", "Anexo del Catálogo - Mensual", SubProyecto, DdlDivisor.SelectedValue.ToEntero, DatoTituloExtra:=$"Periodo {DdlPeriodo.SelectedItem.Text}") + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub End Class diff --git a/Contabilidad2/RepAnexoCatalogoMensual.aspx b/Contabilidad2/RepAnexoCatalogoMensual.aspx index 8f3140105..fca1971b5 100644 --- a/Contabilidad2/RepAnexoCatalogoMensual.aspx +++ b/Contabilidad2/RepAnexoCatalogoMensual.aspx @@ -16,6 +16,21 @@ + + + + +
  • + Generar Excel +
  • + +
    + + + +
    + +
    diff --git a/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb b/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb index b54bb1fdc..cd2ab26cc 100644 --- a/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb @@ -79,7 +79,15 @@ Partial Class Contabilidad2_RepAnexoCatalogoMensual GvMensual2.DataSource = Nothing End If GvMensual2.DataBind() - UpMensual.Update() + UpMensual.Update() + + If GvMensual2.Rows.Count > 0 Then + + LnkExportar.Visible = True + UpAcciones.Update() + + End If + RegistraScript($"LimpiaCeros();") Conta.Dispose() @@ -99,9 +107,22 @@ Partial Class Contabilidad2_RepAnexoCatalogoMensual e.Row.Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em") End If - End Sub + End Sub #End Region - - + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + Dim SubProyecto As String = "" + + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + SubProyecto = DdlSubProyecto.SelectedItem.Text + End If + + GvMensual2.ExportToExcelGembox("AnexoCatálogoMensual", UsuarioActual, $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio.SelectedValue}", "Anexo del Catálogo - Mensual", SubProyecto, DdlDivisor.SelectedValue.ToEntero, DatoTituloExtra:=$"Periodo {DdlPeriodo.SelectedItem.Text}") + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub End Class diff --git a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb index 58c7fb895..1d8913d62 100644 --- a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb +++ b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb @@ -174,6 +174,22 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End Set End Property + + Private Property CountDinamicoAnual As Integer + + Get + If ViewState("CountDinamicoAnual") Is Nothing Then + Return 0 + Else + Return ViewState("CountDinamicoAnual").ToString.ToEntero + End If + + End Get + Set(value As Integer) + ViewState("CountDinamicoAnual") = value + End Set + End Property + #End Region #Region " S U B P R O Y E C T O H O R I Z O N T A L " @@ -230,6 +246,23 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End Property + + Private Property CountDinamicoSubProyecto As Integer + + Get + If ViewState("CountDinamicoSubProyecto") Is Nothing Then + Return 0 + Else + Return ViewState("CountDinamicoSubProyecto").ToString.ToEntero + End If + + End Get + Set(value As Integer) + ViewState("CountDinamicoSubProyecto") = value + End Set + End Property + + #End Region @@ -1081,6 +1114,17 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim IndexGv As Integer = 1 Dim IndexMax As Integer = 1 + + Dim IDX_LIMPIAR As Integer = 1 + + For IDX_LIMPIAR = 1 To 25 + + GvIngresosAnualH.Columns(IDX_LIMPIAR).Visible = False + GvGastosAnualH.Columns(IDX_LIMPIAR).Visible = False + GvTotalesAnualH.Columns(IDX_LIMPIAR).Visible = False + Next + + If DtIngresosAnualH.Rows.Count > 0 Then @@ -1142,6 +1186,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("PorcentajeAcumulado") = "100.00" Row.Item("CtaMayor") = -1 Row.Item("CountDinamico") = DtGastosAnualH.MAX("CountDinamico") + CountDinamicoAnual = DtGastosAnualH.MAX("CountDinamico").ToEntero DtIngresosAnualH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL INGRESOS " @@ -1441,9 +1486,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal '34 Dim IDX_LIMPIAR As Integer = 1 - For IDX_LIMPIAR = 1 To 34 + For IDX_LIMPIAR = 1 To 35 CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).DataField = Nothing CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).HeaderText = "" + GvIngresosSubProyectoH.Columns(IDX_LIMPIAR).Visible = False Next @@ -1499,6 +1545,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("PorcentajeAcumulado") = "100.00" Row.Item("CtaMayor") = -1 Row.Item("CountDinamico") = DtIngresosSubProyectoH.MAX("CountDinamico") + CountDinamicoSubProyecto = DtIngresosSubProyectoH.MAX("CountDinamico").ToEntero DtIngresosSubProyectoH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL INGRESOS " @@ -1692,6 +1739,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red End If + End If End Sub @@ -1751,7 +1799,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal ExportToExcelG(GvIngresosAnualH, GvGastosAnualH, TMesT1, "Reporte_Anual_Horizontal", UsuarioActual, "Anual Horizontal", Gv3:=GvTotalesAnualH) ElseIf Tab.ActiveTabIndex = 3 AndAlso GvIngresosSubProyectoH.Rows.Count > 0 Then - ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, "Proyecto Horizontal", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True) + ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, $"{LblSubProyecto.Text} Horizontal", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True) End If End Sub @@ -1829,28 +1877,21 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") - Dim asd As String = "" - Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) - - - - GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8") + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) Dim excel As GemBox.Spreadsheet.ExcelFile - 'Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault - - 'Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString())) - ' excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options) excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) If Usuario IsNot Nothing Then + Dim TotalRowHeader As Integer = 8 Dim TotalRowFooter As Integer = 2 + Dim worksheet = excel.Worksheets(0) worksheet.Rows.InsertEmpty(0, TotalRowHeader) Dim celdasConTexto = worksheet.GetUsedCellRange(True) @@ -1865,15 +1906,6 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - 'Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) - 'RangoFiltros.Merged = True - 'RangoFiltros.Value = "Filtros" - 'RangoFiltros.Style.Font.Size = 15 * 20 - 'RangoFiltros.Style.Font.Name = "Calibri Light" - 'RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left - 'RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) RangoTitulo.Merged = True RangoTitulo.Value = Titulo @@ -1882,7 +1914,27 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) + RangoFechas.Merged = True + RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}" + RangoFechas.Style.Font.Size = 15 * 20 + RangoFechas.Style.Font.Name = "Calibri Light" + RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + If EsPorSubProtyecto And DdlSubproyecto.SelectedValue.ToEntero > 0 Then + Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex) + RangoSubProyecto.Merged = True + RangoSubProyecto.Value = DdlSubproyecto.SelectedItem.Text + RangoSubProyecto.Style.Font.Size = 20 * 20 + RangoSubProyecto.Style.Font.Name = "Calibri Light" + RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + End If + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center @@ -1929,10 +1981,30 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End Using End If - End If - 'End Using - 'htw.Dispose() + + + + + For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + + If I > 0 Then + + If DdlDivisor.SelectedValue.ToEntero = 1 Then + worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00" + Else + worksheet.Columns(I + 1).Style.NumberFormat = "#,##" + End If + + Try + worksheet.Columns(I).AutoFit(1) + Catch ex As Exception + End Try + + End If + Next + + End If excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 7891db1e0..f21672890 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -290,6 +290,10 @@ Partial Class Inventarios_EntradasSalidas TxtFecha.Text = Now.ToShortDateString RVFecha.MaximumValue = Now.ToShortDateString + If Not UsuarioActual.CveEmpresa = 41 Then + TxtFecha.Enabled = False + End If + CantidadTotal = 0 IndexSeccionAlmacen = 0 @@ -482,6 +486,7 @@ Partial Class Inventarios_EntradasSalidas DdlCConcepto.DataSource = GlobalDTInvConceptos.FiltraParametros("CveConcepto NOT IN (4,5)") DdlCConcepto.DataBind() + 'Llenar el dropdownlist de almacén If Not IfNull(Request("CI"), -1).ToString.ToEntero > 0 Then DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen NOT IN (9,11)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) @@ -508,6 +513,8 @@ Partial Class Inventarios_EntradasSalidas DdlConcepto.Items.Insert(0, New ListItem("Seleccione", "-1")) End If + + CargaPS() ' CargaDdlPaqueteria() @@ -2025,11 +2032,16 @@ Partial Class Inventarios_EntradasSalidas DdlConcepto.Items.Insert(0, New ListItem("Entrada Almacen ", "2")) End If - If UsuarioActual.CveEmpresa = 72 AndAlso CveTipoAlmacen.Contiene(14, 19) AndAlso UsuarioActual.CveUsuario = 2185 Then + + If UsuarioActual.CveEmpresa = 72 AndAlso (UsuarioActual.CveUsuario = 2185 OrElse UsuarioActual.CveRol = 1) Then 'DdlConcepto.Items.Add(New ListItem("Seleccione", "-1")) DdlConcepto.Items.Add(New ListItem("Entrada por Ajuste", "32")) - DdlConcepto.Items.Add(New ListItem("Salida por Ajuste", "34")) + + If CveTipoAlmacen.Contiene(12, 14, 19) Then + DdlConcepto.Items.Add(New ListItem("Salida por Ajuste", "34")) + End If + End If