From e0e23eadac2001e9c7f56c2c8ccbaacab8b31fcb Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Fri, 6 Nov 2020 22:48:56 -0700 Subject: [PATCH 01/24] Contratos Generador --- App_Code/ClsContratos.vb | 21 ++ Contratos/RepContratosObraAvancesDetalle.aspx | 10 +- .../RepContratosObraAvancesDetalle.aspx.vb | 202 +++++++++++++++++- 3 files changed, 227 insertions(+), 6 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 4aa1fc0a5..d57f54cd8 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -773,6 +773,27 @@ Public Class ClsContratos Return Retorno End Function + + Public Function GetContratosObraAvancesControlAcumulativo(CveContrato As Integer, CveEstimacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Con_ContratosObraAvancesControlAcumulativo") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEstimacion", SqlDbType.Int).Value = CveEstimacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar elcontrol acumulativo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #End Region #Region "C I C L O C O M E R C I A L" diff --git a/Contratos/RepContratosObraAvancesDetalle.aspx b/Contratos/RepContratosObraAvancesDetalle.aspx index 9a193cfdc..1a1269883 100644 --- a/Contratos/RepContratosObraAvancesDetalle.aspx +++ b/Contratos/RepContratosObraAvancesDetalle.aspx @@ -118,7 +118,7 @@
@@ -162,6 +162,14 @@ + + + + + + + +
diff --git a/Contratos/RepContratosObraAvancesDetalle.aspx.vb b/Contratos/RepContratosObraAvancesDetalle.aspx.vb index d17028e61..1a0f797b7 100644 --- a/Contratos/RepContratosObraAvancesDetalle.aspx.vb +++ b/Contratos/RepContratosObraAvancesDetalle.aspx.vb @@ -1,6 +1,7 @@ Imports Extensiones Imports System.Data - +Imports System.IO + Partial Class RepContratosObraAvancesDetalle Inherits ClsPaginas @@ -87,14 +88,205 @@ Partial Class RepContratosObraAvancesDetalle Dim HplNumeroEstimacion As HyperLink = e.Row.FCHyperLink("HplNumeroEstimacion") HplNumeroEstimacion.NavigateUrl = $"./RepContratosObraAvancesPartida.aspx?CveEstimacion={e.Row.DataKey("CveEstimacion")}&NumeroEstimacion={ e.Row.DataKey("NumeroEstimacion")}&CveContrato={ CveContrato }" + Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkAnexo") + + ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkAnexo) ' NavigateUrl='<%# Eval("CveEstimacion", "RepContratosObraAvancesPartida.aspx?CveEstimacion={0}")%>' End If - End Sub - - 'Protected Sub CmdConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click - ' CargaDatos() + End Sub + + 'Protected Sub CmdConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + ' CargaDatos() 'End Sub + Protected Sub LnkAnexo_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveEstimacion As Integer = GvRow.DataKey("CveEstimacion").ToEntero + Dim NumeroEstimacion As Integer = GvRow.DataKey("NumeroEstimacion").ToEntero + Dim FechaEstimacion As Date = GvRow.DataKey("FechaEstimacion").ToDate + Dim NumeroContrato As String = GvRow.DataKey("NumeroContrato") + + If CveEstimacion > 0 Then + GeneraAnexo(CveEstimacion, NumeroEstimacion, FechaEstimacion, NumeroContrato) + End If + + + End Sub + + + Private Sub GeneraAnexo(CveEstimacion As Integer, NumeroEstimacion As Integer, FechaEstimacion As Date, NumeroContrato As String) + + Dim PlantillaAnexo As String = $"{UsuarioActual.Empresa.Ruta}\Formatos\Anexo.xlsx" + + If Not System.IO.File.Exists(PlantillaAnexo) Then + Alert("No se encuentra la platilla de anexos.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim DtControl As New DataTable + Dim ObjContratos As New ClsContratos + + + + + If ObjContratos.GetContratosObraAvancesControlAcumulativo(CveContrato, CveEstimacion, UsuarioActual.CveEmpresa) Then + DtControl = ObjContratos.DtResultados + End If + ObjContratos.Dispose() + + If DtControl.Rows.Count > 0 Then + + + Dim WBAnexo = New ClosedXML.Excel.XLWorkbook(PlantillaAnexo) + + Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook + + Dim WSControl = WBAnexo.Worksheet(1) + Dim WSDetalle = WBAnexo.Worksheet(2) + + Dim CuerrentRow As Integer = 28 + + WSControl.Cell(17, 2).Value = NumeroEstimacion 'Estimacion + WSControl.Cell(20, 9).Value = FechaEstimacion.ToString("dd/MM/yyyy") 'Fecha estimacion + WSControl.Cell(19, 8).Value = "$ " & DtControl.SUM("Total").ToString("###,###,###.00") 'Total + + WSControl.Cell(20, 6).Value = NumeroContrato + + WSControl.Cell(18, 2).Value = "" 'Lugar + WSControl.Cell(17, 6).Value = "" 'Periodo Fecha Inicial + WSControl.Cell(17, 7).Value = "" 'Periuodo Fecha Final + WSControl.Cell(20, 2).Value = "" 'Obra + WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato + WSControl.Cell(19, 5).Value = "" 'Contrtatista + + + + For Each Drow As DataRow In DtControl.Rows + + WSControl.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString + WSControl.Cell(CuerrentRow, 2).Value = Drow("PS").ToString + WSControl.Cell(CuerrentRow, 3).Value = Drow("Abreviatura").ToString + WSControl.Cell(CuerrentRow, 4).Value = Drow("Cantidad").ToString.ToDecimal + WSControl.Cell(CuerrentRow, 5).Value = Drow("AcumuladoTotal").ToString.ToDecimal + WSControl.Cell(CuerrentRow, 6).Value = Drow("AcumuladoAnterior").ToString.ToDecimal + WSControl.Cell(CuerrentRow, 7).Value = Drow("CantidadActual").ToString.ToDecimal + WSControl.Cell(CuerrentRow, 8).Value = Drow("PU").ToString.ToDecimal + WSControl.Cell(CuerrentRow, 9).Value = Drow("Total").ToString.ToDecimal + + CuerrentRow = CuerrentRow + 1 + Next + + WBAnexo.Worksheet(1).CopyTo(WBAnexoSalvar, "CONTROL") + + + For Each Drow As DataRow In DtControl.Rows + + + If Drow("CantidadActual").ToString.ToDecimal > 0 Then + + WSDetalle.Cell(3, 6).Value = NumeroContrato + + WSDetalle.Cell(4, 9).Value = "" 'Fecha de + WSDetalle.Cell(4, 10).Value = "" 'Fecha a + WSDetalle.Cell(4, 11).Value = NumeroEstimacion + + 'WSDetalle.Picture("Logo").Name = $"Logo{Drow("CveContratoDetalle").ToString}" + 'WSDetalle.Picture("Firma").Name = $"Firma{Drow("CveContratoDetalle").ToString}" + + + WSDetalle.Cell(14, 2).Value = Drow("Codigo").ToString + WSDetalle.Cell(14, 3).Value = Drow("PS").ToString + WSDetalle.Cell(14, 4).Value = Drow("Abreviatura").ToString + + + WSDetalle.Cell(12, 3).Value = "" 'Concepto + + WSDetalle.Cell(14, 10).Value = Drow("CantidadActual").ToString.ToDecimal + WSDetalle.Cell(14, 11).Value = Drow("CantidadActual").ToString.ToDecimal + 'WSDetalle.Cell(61, 6).Value = "" 'Empresario + WSDetalle.Cell(61, 9).Value = Drow("Nombre").ToString 'Cliente + + + + Dim objContrato As New ClsContratos + Dim DTArchivos As New DataTable + + If objContrato.GetContratosAvanceAnexos(Drow("CveContratoDetalle").ToString.ToEntero, Drow("Fecha").ToString, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then + DTArchivos = objContrato.DtResultados + End If + objContrato.Dispose() + + Dim Imagenes As New List(Of ClosedXML.Excel.Drawings.IXLPicture) + + Dim CurrectRowImg As Integer = 19 'Row 19 primera imggen + Dim RowH As Double = WSDetalle.Row(19).Height + + For Each drowArchivos In DTArchivos.Rows + + Dim Archivo As String = drowArchivos("Archivo").ToString + Dim RutaArchivo As String = $"{UsuarioActual.Empresa.Ruta}\Contrato\{CveContrato}\Anexos\{Archivo}" + + If File.Exists(RutaArchivo) Then + + Dim Imagen = WSDetalle.AddPicture(RutaArchivo).MoveTo(WSDetalle.Cell(CurrectRowImg, 3)) + Imagen.Scale(WSDetalle.Column(3).Width / (Imagen.OriginalWidth * 0.145D)) + + Dim ImgWidth As Double = Imagen.Height + + Dim nRowmas As Integer = ImgWidth / RowH + + CurrectRowImg = CurrectRowImg + nRowmas + + Imagenes.Add(Imagen) + End If + + Next + WBAnexo.Worksheet(2).CopyTo(WBAnexoSalvar, If(Drow("Codigo").ToString.Trim.Length > 0, Drow("Codigo").ToString, Drow("CvePS").ToString)) + + For Each img As ClosedXML.Excel.Drawings.IXLPicture In Imagenes + img.Delete() + Next + + + End If + + + Next + + + + + Dim msB = New MemoryStream() + WBAnexoSalvar.SaveAs(msB) + + Dim BB As Byte() = msB.ToArray + msB.Dispose() + + Response.Clear() + Response.Buffer = True + Response.AddHeader("content-disposition", "attachment; filename=Anexo_Estimacion" & NumeroEstimacion & ".xlsx") + Response.ContentType = "application/vnd.ms-excel" + Response.BinaryWrite(BB) + Response.End() + + + Else + Alert("No se encontraron datos des control", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream + + Dim fs = New MemoryStream() + excelWorkbook.SaveAs(fs) + fs.Position = 0 + Return fs + + End Function + End Class \ No newline at end of file From acf451c328b27350e888e16178683c4a6e923b9e Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 7 Nov 2020 10:58:23 -0700 Subject: [PATCH 02/24] -- cuenta no procede, es cvecuentabancaria --- App_Code/ClsContabilidad.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index ddcd598c7..ed8ddbc71 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5551,7 +5551,6 @@ Public Class ClsContabilidad .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio .Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico - .Add("@Cuenta", SqlDbType.NVarChar).Value = Cuenta End With Try SqlAdapter.Fill(Data) From b1f41ac4f24d1233da51d255fc438c3ae0b296ab Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 7 Nov 2020 10:58:51 -0700 Subject: [PATCH 03/24] mensaje de alerta al cargar proyectados --- Inventarios/KardexAlmacenHorizontal.aspx.vb | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Inventarios/KardexAlmacenHorizontal.aspx.vb b/Inventarios/KardexAlmacenHorizontal.aspx.vb index f53140e8f..31f4b7296 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx.vb +++ b/Inventarios/KardexAlmacenHorizontal.aspx.vb @@ -393,6 +393,7 @@ Partial Class Inventarios_KardexAlmacen Private Sub AgregarProyeccion(dt As DataTable) Dim TieneError As Boolean = False + Dim StrCodigo As New StringBuilder Dim ObjInventarios As New ClsInventarios ObjInventarios.IniciaTransacSQL() @@ -400,25 +401,36 @@ Partial Class Inventarios_KardexAlmacen Dim DtProductosEmpresas As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) For Each dtRow As DataRow In dt.Rows Dim Codigo As String = dtRow("Código").ToString - Dim CvePS As Integer = DtProductosEmpresas.FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", Codigo)) - Dim Cantidad As Decimal = dtRow("Cantidad").ToString.ToDecimal - If Not ObjInventarios.AddMovimientosProyectados(CvePS, Cantidad, RblProyeccionOpcion.SelectedValue.ToEntero()) Then - TieneError = True - Exit For + + If Codigo <> "" Then + Dim CvePS As Integer = DtProductosEmpresas.FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", Codigo)).ToEntero + Dim Cantidad As Decimal = dtRow("Cantidad").ToString.ToDecimal + If CvePS <= 0 Then + TieneError = True + StrCodigo.AppendFormat(" {0}
", Codigo) + Exit For + ElseIf Not ObjInventarios.AddMovimientosProyectados(CvePS, Cantidad, RblProyeccionOpcion.SelectedValue.ToEntero()) Then + TieneError = True + StrCodigo.Append("Ocurrio un error al registrar") + Exit For + End If End If + Next Else TieneError = True End If If TieneError Then + Alert("Ocurrio un error al registrar el Código no encontrado: " & StrCodigo.ToString, TipoMensaje.MsgError) ObjInventarios.RollBack() Else ObjInventarios.Commit() + Alert("Se ha agregado la proyección de productos correctamente") End If ObjInventarios.Dispose() RegistraScript(String.Format("$('#{0}').modal('hide');", "DivProyeccion")) - Alert("Se ha agregado la proyección de productos correctamente") + End Sub Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable From 621c06201e14c41a761df86706992ba60d77a370 Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 7 Nov 2020 10:59:14 -0700 Subject: [PATCH 04/24] registro contable para traspasos --- Inventarios/EntregaAlmacen.aspx.vb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 3856176b0..e21187015 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -2466,25 +2466,34 @@ Partial Class Inventarios_EntregaAlmacen CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), Modulo:="RE/G8") FolioEntrada = ObjInventario.Folio + Dim ImporteAlmacen As Decimal = 0 If CveMovimientoEntrada <= 0 Then TextoError.AppendFormat("No se pudo generar el movimiento de entrada correctamente") ErrorMovInv = True Else - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then + ImporteAlmacen = ObjInventario.DtResultados.SUMD("Total") + For Each Dr As DataRow In ObjInventario.DtResultados.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=-3, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero()) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") Exit For End If - Next + Next + Else ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") End If End If + 'se registra + If ContabilizaMovimientoAlmacen(ObjConta, TxtFecha.Text.ToDate, HLFolio.Text, "EntregaAlmacen", CveMovimiento, CveMovimientoEntrada, ImporteAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, True) <= 0 Then + ErrorMovInv = True + End If + Else 'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN - SALIDA ALMACEN ErrorMovInv = Not GenerarPrePoliza(ObjInventario, ObjVentas, ObjConta, CveMovimiento, TextoError) End If From 515baa9582c73bb6b3284127fb149298bda4a8f2 Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 7 Nov 2020 10:59:35 -0700 Subject: [PATCH 05/24] -- modulo en l mov de almacen --- Inventarios/Consignaciones.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Inventarios/Consignaciones.aspx.vb b/Inventarios/Consignaciones.aspx.vb index e6886a8f2..a98290c76 100644 --- a/Inventarios/Consignaciones.aspx.vb +++ b/Inventarios/Consignaciones.aspx.vb @@ -849,7 +849,7 @@ Partial Class Inventarios_Consignaciones 'AGREGAMOS MOVIMIENTO If MovtoNew Then Folio = ObjInventario.GetFolioSiguiente(ConceptoDevolucion, UsuarioActual.CveEmpresa) - CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, ConceptoDevolucion, DdlMoneda.SelectedValue.ToEntero, Fecha, Folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveConsignacion:=CveConsignacion, Observaciones:=TxtObservacionesDevolucion.Text.Trim) + CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, ConceptoDevolucion, DdlMoneda.SelectedValue.ToEntero, Fecha, Folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveConsignacion:=CveConsignacion, Observaciones:=TxtObservacionesDevolucion.Text.Trim, Modulo:="Consig") End If If CveMovimiento > 0 Then From 97aa45912595ed718ef7793365abb628fceec57f Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Sat, 7 Nov 2020 14:01:42 -0700 Subject: [PATCH 06/24] Ajustes Contratos, excel --- Compras/eFacturas.aspx | 2 +- Compras/eFacturas.aspx.vb | 2 +- Contratos/ContratoAvance.aspx | 60 +-- Contratos/ContratoAvance.aspx.vb | 358 +++++++++++++++++- .../RepContratosObraAvancesDetalle.aspx.vb | 132 ++++++- 5 files changed, 471 insertions(+), 83 deletions(-) diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 6644f7db1..9b8a0ed78 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -658,7 +658,7 @@ - - - + + + + + +
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+ + + + +
+ + + + + + + + + +
Clasificación Contratado Avance Faltante Avance Por Facturar Anticipo
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + +
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+ + + + +
+ + + + + + + <%-- + --%> + +
Clasificación Contratado Avance Faltante Avance Por Facturar Anticipo
+
+ + + + + + + + + + + + + + + + + + + + + + +<%-- + + + + + + + + + + --%> + + + + +
+
+ + +
+
+ + +
+ + - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index fe738afd7..da9636f7a 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -454,12 +454,12 @@ Partial Class Contratos_ContratoObra If CveContrato > 0 Then If UsuarioActual.TienePermisoProceso(164) Then BtnEliminar.Visible = True - Gv.Columns(11).Visible = True - GvInsumos.Columns(9).Visible = True + Gv.Columns(9).Visible = True + GvInsumos.Columns(8).Visible = True Else BtnEliminar.Visible = False - Gv.Columns(11).Visible = False - GvInsumos.Columns(9).Visible = False + Gv.Columns(9).Visible = False + GvInsumos.Columns(8).Visible = False End If 'If CveTipoContrato.Contiene(11, 25) Then 'ciclo comercial @@ -469,8 +469,8 @@ Partial Class Contratos_ContratoObra Else TabPres.Visible = False - Gv.Columns(11).Visible = True - GvInsumos.Columns(9).Visible = True + Gv.Columns(9).Visible = True + GvInsumos.Columns(8).Visible = True End If @@ -993,7 +993,7 @@ Partial Class Contratos_ContratoObra 'RowPorcentajeComision.Visible = False RowEstatus.Visible = False 'dvAddendum.Visible = False - liImprimir.Visible = True + 'liImprimir.Visible = True CargaPlantillas() 'TrContratoPlantilla.Visible = True 'DdlPeriodo.SelectedValueExist(ObjContratos.DtResultados.Rows(0)("CvePeriodo")) @@ -1042,7 +1042,7 @@ Partial Class Contratos_ContratoObra 'TDObservacion.Visible = True 'tdObservaciones.Visible = True TxtObservaciones.Text = ObjContratos.DtResultados.Rows(0)("Observaciones").ToString - Gv.Columns(6).Visible = True + Gv.Columns(4).Visible = True 'DdlPeriodo.SelectedValueExist(ObjContratos.DtResultados.Rows(0)("CvePeriodo").ToString) End If @@ -1073,6 +1073,7 @@ Partial Class Contratos_ContratoObra TxtFechaInicial.Text = ObjContratos.FechaInicial.ToShortDateString TxtUbicacion.Text = ObjContratos.Ubicacion TxtResponsable.Text = ObjContratos.Responsable + TxtLugar.Text = ObjContratos.Lugar TxtPorAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero TxtPorAmortizacionAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero TxtPorGarantia.Text = ObjContratos.PorGarantia.FormatoNumero @@ -1100,8 +1101,8 @@ Partial Class Contratos_ContratoObra If ObjContratos.TipoEstatus = 2 Then DdlEstatus.Enabled = False If UsuarioActual.TienePermisoProceso(173) Then - liVigenteContrato.Visible = True - LBVigenteContrato.Visible = True + 'liVigenteContrato.Visible = True + 'LBVigenteContrato.Visible = True End If Else DdlEstatus.Items.Clear() @@ -1110,17 +1111,17 @@ Partial Class Contratos_ContratoObra DdlEstatus.DataBind() Select Case ObjContratos.TipoEstatus Case 1 - If UsuarioActual.TienePermisoProceso(173) Then - liTerminarContrato.Visible = True - LBTerminarContrato.Visible = True - - liCancelarContrato.Visible = True - LBCancelarContrato.Visible = True + If UsuarioActual.TienePermisoProceso(173) Then + ' liTerminarContrato.Visible = True + 'LBTerminarContrato.Visible = True + + ' liCancelarContrato.Visible = True + 'LBCancelarContrato.Visible = True End If Case 2, 3 ' reactivar el contrato - If UsuarioActual.TienePermisoProceso(173) Then - liVigenteContrato.Visible = True - LBVigenteContrato.Visible = True + If UsuarioActual.TienePermisoProceso(173) Then + ' liVigenteContrato.Visible = True + ' LBVigenteContrato.Visible = True End If End Select @@ -1315,7 +1316,7 @@ Partial Class Contratos_ContratoObra TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, TipoGarantia:=-1, Folio:=0, FechaVenc:=Nothing, EstatusFianza:=1, CvePeriodo:=-1, CveCuentaEquipo:=-1, CveContratoPlantilla:=-1, CveVendedor:=-1, - Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim()) + Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim) TieneError = Not GuardaFianzas(ObjContratos) @@ -1414,7 +1415,7 @@ Partial Class Contratos_ContratoObra CveAlmacenOrigen:=-1, CveAlmacenDestino:=-1, PorcentajeComision:=0, TipoGarantia:=-1, Folio:=-1, FechaVenc:=Nothing, EstatusFianza:=-1, CveContratoPlantilla:=-1, CveCuentaEquipo:=-1, CveVendedor:=-1, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=-1, AplicaImpuestosLocales:=False, - CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim()) Then + CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), Lugar:=TxtLugar.Text.Trim) Then TieneError = Not GuardaFianzas(ObjContratos) @@ -1840,11 +1841,11 @@ Partial Class Contratos_ContratoObra Gv.DataSource = DtTemp DtPresupuestos = DtTemp Gv.DataBind() - If CveTipoContrato = 25 Then - Gv.Columns(0).Visible = False - Gv.Columns(2).Visible = False - Gv.Columns(3).Visible = False - Gv.Columns(9).Visible = False + If CveTipoContrato = 25 Then + ' Gv.Columns(0).Visible = False + Gv.Columns(2).Visible = False + ' Gv.Columns(3).Visible = False + Gv.Columns(7).Visible = False End If 'If (Gv.Rows.Count > 0) Then ' Gv.UseAccessibleHeader = True @@ -2581,7 +2582,7 @@ Partial Class Contratos_ContratoObra End If TabReporteAvance.Visible = True - lbImprimirAvance.Visible = True + 'lbImprimirAvance.Visible = True Dim Modalidad = IfNull(Request("Tipo"), 1, 2) @@ -2600,16 +2601,32 @@ Partial Class Contratos_ContratoObra Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) End If - ObjContratos.Dispose() + 'ObjContratos.Dispose() GvDatosAvance.DataBind() If (GvDatosAvance.Rows.Count > 0) Then GvDatosAvance.UseAccessibleHeader = True GvDatosAvance.HeaderRow.TableSection = TableRowSection.TableHeader RegistraScript("OrdenarGV();") - End If - - UpGral.Update() + End If + + + + + + If ObjContratos.GetReporteContratosAvancesDetalleControl(CveContrato, UsuarioActual.CveEmpresa) Then + + GvDatosAvanceControl.DataSource = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances de control. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + + GvDatosAvanceControl.DataBind() + + ObjContratos.Dispose() + UpGral.Update() + End Sub Protected Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound @@ -2629,6 +2646,27 @@ Partial Class Contratos_ContratoObra e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 + End If + End Sub + + + Protected Sub GvDatosAvanceControl_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvanceControl.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveClasificacion").ToString.ToEntero = 0 Then + e.Row.CssClass = "Totales white" + ElseIf e.Row.DBCampo("CvePS").ToString.ToEntero = 0 Then + e.Row.CssClass = "SubTotales" + End If + + 'Dim Liga1 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|1" + 'e.Row.FCLinkButton("LBAvanceCantidad").CommandArgument = Liga1 + 'e.Row.FCLinkButton("LBAvanceImporte").CommandArgument = Liga1 + + 'Dim Liga2 = $"{e.Row.DBCampo("CveClasificacion").ToEntero}|{e.Row.DBCampo("Clasificacion")}|{e.Row.DBCampo("CvePS").ToEntero}|{e.Row.DBCampo("CodigoPS")}|2" + 'e.Row.FCLinkButton("LBAvanceXFacturarCantidad").CommandArgument = Liga2 + 'e.Row.FCLinkButton("LBAvanceXFacturarImporte").CommandArgument = Liga2 + End If End Sub Protected Sub MuestaModalVentasAvance(sender As Object, e As EventArgs) @@ -2672,9 +2710,9 @@ Partial Class Contratos_ContratoObra GVAvanceXDocumento.DataSource = ObjContratos.DtResultados DtAvanceDocumento = ObjContratos.DtResultados If DtAvanceDocumento.Rows.Count > 0 Then - LBImprimir.Visible = True - End If - LBImprimirInformacionG.Visible = True + 'LBImprimir.Visible = True + End If + ' LBImprimirInformacionG.Visible = True Else Alert("Ocurrió un error al obtener el Reporte de Avances por Documento. Por favor vuelva a intentar", TipoMensaje.MsgError) End If @@ -2871,7 +2909,7 @@ Partial Class Contratos_ContratoObra If GvContratosGastos.Rows.Count > 0 Then GvContratosGastos.HeaderRow.CssClass = "SinColor" - LBImprimirGastos.Visible = True + 'LBImprimirGastos.Visible = True End If UpContratoGasto.Update() @@ -2948,12 +2986,12 @@ Partial Class Contratos_ContratoObra UpPedidosDevoluciones.Update() End Sub - Protected Sub ImgExcelPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDevExcel.Click - GenerarPDFPedDev("Excel") - End Sub - Protected Sub ImgImprimirPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDev.Click - GenerarPDFPedDev() - End Sub + 'Protected Sub ImgExcelPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDevExcel.Click + ' GenerarPDFPedDev("Excel") + 'End Sub + 'Protected Sub ImgImprimirPedDev_Click(sender As Object, e As EventArgs) Handles LbImprimirPedDev.Click + ' GenerarPDFPedDev() + 'End Sub Private Sub GenerarPDFPedDev(Optional Formato As String = "PDF") If DsDatosPedDev Is Nothing Then Alert("No se pudieron consultar los pedidos y devoluciones", TipoMensaje.MsgAdvertencia) @@ -3202,27 +3240,27 @@ Partial Class Contratos_ContratoObra ObjInv.Dispose() - LnkAjusteAF.Visible = True + 'LnkAjusteAF.Visible = True DivHajusteAF.Visible = False GvDatosAlmacen.Columns(6).Visible = False CargaInventarios() - UPHajusteAF.Update() - UpHajusteAcciones.Update() - + UPHajusteAF.Update() + ' UpHajusteAcciones.Update() + End Sub - Protected Sub LnkAjusteAF_Click(sender As Object, e As EventArgs) - - LnkAjusteAF.Visible = False + Protected Sub LnkAjusteAF_Click(sender As Object, e As EventArgs) + + ' LnkAjusteAF.Visible = False DivHajusteAF.Visible = True GvDatosAlmacen.Columns(6).Visible = True CargaInventarios() - UPHajusteAF.Update() - UpHajusteAcciones.Update() + UPHajusteAF.Update() + ' UpHajusteAcciones.Update() UpAlmacen.Update() End Sub @@ -3425,9 +3463,9 @@ Partial Class Contratos_ContratoObra Response.End() End If End Sub - Public Sub LbDescargarExcel_Click(sender As Object, e As EventArgs) Handles LbDescargarExcel.Click - DescargarFormato() - End Sub + 'Public Sub LbDescargarExcel_Click(sender As Object, e As EventArgs) Handles LbDescargarExcel.Click + ' DescargarFormato() + 'End Sub Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) @@ -3702,9 +3740,9 @@ Partial Class Contratos_ContratoObra #Region " IMPRESION " #Region " IMPRIMIR AVANCE POR DOCUMENTO " - Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles LBImprimir.Click - GenerarPDF() - End Sub + 'Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles LBImprimir.Click + ' GenerarPDF() + 'End Sub Private Sub GenerarPDF(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -3730,66 +3768,67 @@ Partial Class Contratos_ContratoObra End If Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) ImprimirPDF("Empresas/Grales/Formatos/RepContratoAvanceDocumento.rdlc", dt, params, $"{Nombre}-AvanceDocumento", Formato:=Formato) - End Sub - Private Sub LBImprimirInformacionG_Click(sender As Object, e As EventArgs) Handles LBImprimirInformacionG.Click - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - Dim dt As DataTable = DtAvanceDocumento - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Contrato", Titulo)) - 'DATOS DEL CONTRATO - params.Add(New ReportParameter("NoContrato", TxtNumeroContrato.Text.Trim)) - params.Add(New ReportParameter("Descripcion", TxtDescripcionContrato.Text.Trim)) - params.Add(New ReportParameter("Proveedor", If(TrProveedor.Visible = True, DdlContratista.SelectedItem.Text.Trim, "-"))) - params.Add(New ReportParameter("Ubicacion", TxtUbicacion.Text.Trim)) - params.Add(New ReportParameter("Responsable", TxtResponsable.Text.Trim)) - params.Add(New ReportParameter("Almacen", "-")) - params.Add(New ReportParameter("Porcentaje", "-")) - 'CENTRO DE COSTOS - params.Add(New ReportParameter("Proyecto", If(DVddlproyecto.Visible = True, DdlProyecto.SelectedItem.Text.Trim, "-"))) - params.Add(New ReportParameter("SubProyecto", CveSubProyecto.ToString)) - params.Add(New ReportParameter("Addendum", "")) - 'INFORMACION - params.Add(New ReportParameter("Cliente", If(TrCliente.Visible = True, DdlCliente.SelectedItem.Text.Trim, "-"))) - params.Add(New ReportParameter("Sucursal", If(TrClienteSucursal.Visible = True, DdlSucursalCliente.SelectedItem.Text.Trim, "-"))) - params.Add(New ReportParameter("FechaInicial", TxtFechaInicial.Text.Trim)) - params.Add(New ReportParameter("FechaFinal", TxtFechaFinal.Text.Trim)) - params.Add(New ReportParameter("Moneda", DdlMoneda.SelectedItem.Text.Trim)) - params.Add(New ReportParameter("TipoCambio", If(tipoCambio.Visible = True, TxtTipoCambio.Text.Trim, "-"))) - params.Add(New ReportParameter("IVA", TxtPorIVA.Text.Trim)) - params.Add(New ReportParameter("Anticipo", TxtPorAnticipo.Text.Trim)) - params.Add(New ReportParameter("Amortizacion", TxtPorAmortizacionAnticipo.Text.Trim)) - params.Add(New ReportParameter("Garantia", TxtPorGarantia.Text.Trim)) - params.Add(New ReportParameter("Minimo", "-")) - params.Add(New ReportParameter("Maximo", "-")) - params.Add(New ReportParameter("Total", If(DvTotal.Visible = True, TxtTotal.Text.Trim, "-"))) - 'Estatus - params.Add(New ReportParameter("Estatus", DdlEstatus.SelectedItem.Text.Trim)) - params.Add(New ReportParameter("TipoGarantia", "")) - params.Add(New ReportParameter("EstatusFianza", "")) - params.Add(New ReportParameter("Folio", "0")) - params.Add(New ReportParameter("FechaVencimiento", "")) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas/Grales/Formatos/Contrato.rdlc", dt, params, $"Contrato-{Titulo}", Formato:="PDF") - End Sub + 'Private Sub LBImprimirInformacionG_Click(sender As Object, e As EventArgs) Handles LBImprimirInformacionG.Click + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + ' Dim dt As DataTable = DtAvanceDocumento + ' Dim params As New List(Of ReportParameter) + ' params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + ' params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + ' params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + ' params.Add(New ReportParameter("Contrato", Titulo)) + ' 'DATOS DEL CONTRATO + ' params.Add(New ReportParameter("NoContrato", TxtNumeroContrato.Text.Trim)) + ' params.Add(New ReportParameter("Descripcion", TxtDescripcionContrato.Text.Trim)) + ' params.Add(New ReportParameter("Proveedor", If(TrProveedor.Visible = True, DdlContratista.SelectedItem.Text.Trim, "-"))) + ' params.Add(New ReportParameter("Ubicacion", TxtUbicacion.Text.Trim)) + ' params.Add(New ReportParameter("Responsable", TxtResponsable.Text.Trim)) + ' params.Add(New ReportParameter("Almacen", "-")) + ' params.Add(New ReportParameter("Porcentaje", "-")) + ' 'CENTRO DE COSTOS + ' params.Add(New ReportParameter("Proyecto", If(DVddlproyecto.Visible = True, DdlProyecto.SelectedItem.Text.Trim, "-"))) + ' params.Add(New ReportParameter("SubProyecto", CveSubProyecto.ToString)) + ' params.Add(New ReportParameter("Addendum", "")) + ' 'INFORMACION + ' params.Add(New ReportParameter("Cliente", If(TrCliente.Visible = True, DdlCliente.SelectedItem.Text.Trim, "-"))) + ' params.Add(New ReportParameter("Sucursal", If(TrClienteSucursal.Visible = True, DdlSucursalCliente.SelectedItem.Text.Trim, "-"))) + ' params.Add(New ReportParameter("FechaInicial", TxtFechaInicial.Text.Trim)) + ' params.Add(New ReportParameter("FechaFinal", TxtFechaFinal.Text.Trim)) + ' params.Add(New ReportParameter("Moneda", DdlMoneda.SelectedItem.Text.Trim)) + ' params.Add(New ReportParameter("TipoCambio", If(tipoCambio.Visible = True, TxtTipoCambio.Text.Trim, "-"))) + ' params.Add(New ReportParameter("IVA", TxtPorIVA.Text.Trim)) + ' params.Add(New ReportParameter("Anticipo", TxtPorAnticipo.Text.Trim)) + ' params.Add(New ReportParameter("Amortizacion", TxtPorAmortizacionAnticipo.Text.Trim)) + ' params.Add(New ReportParameter("Garantia", TxtPorGarantia.Text.Trim)) + ' params.Add(New ReportParameter("Minimo", "-")) + ' params.Add(New ReportParameter("Maximo", "-")) + ' params.Add(New ReportParameter("Total", If(DvTotal.Visible = True, TxtTotal.Text.Trim, "-"))) + ' 'Estatus + ' params.Add(New ReportParameter("Estatus", DdlEstatus.SelectedItem.Text.Trim)) + ' params.Add(New ReportParameter("TipoGarantia", "")) + ' params.Add(New ReportParameter("EstatusFianza", "")) + ' params.Add(New ReportParameter("Folio", "0")) + ' params.Add(New ReportParameter("FechaVencimiento", "")) + + ' If Imagen.Exists Then + ' params.Add(New ReportParameter("LogoPath", logouri)) + ' Else + ' params.Add(New ReportParameter("LogoPath", "")) + ' End If + ' ImprimirPDF("Empresas/Grales/Formatos/Contrato.rdlc", dt, params, $"Contrato-{Titulo}", Formato:="PDF") + + 'End Sub + #End Region #Region "I M P R E S I O N D E G A S T O S" - Protected Sub ImgImprimirGastos_Click(sender As Object, e As EventArgs) Handles LBImprimirGastos.Click - GenerarPDFGastos() - End Sub + 'Protected Sub ImgImprimirGastos_Click(sender As Object, e As EventArgs) Handles LBImprimirGastos.Click + ' GenerarPDFGastos() + 'End Sub Private Sub GenerarPDFGastos(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -3819,22 +3858,22 @@ Partial Class Contratos_ContratoObra End If Dim Nombre As String = If(LtlTitulo.Text.Length > 20, LtlTitulo.Text.Substring(0, 20), LtlTitulo.Text) ImprimirPDF("Empresas/Grales/Formatos/RepContratoGastos.rdlc", dt, params, $"{Nombre}-Gastos", Formato:=Formato) - End Sub - - Private Sub LBAgregarGasto_Click(sender As Object, e As EventArgs) Handles LBAgregarGasto.Click - TxtDescripcion.Text = "" - TxtImporteC.Text = "" - TxtFecha.Text = "" - UpAgregarGastos.Update() - RegistraScript("$('#ModalAgregarGastos').modal();") End Sub + 'Private Sub LBAgregarGasto_Click(sender As Object, e As EventArgs) Handles LBAgregarGasto.Click + ' TxtDescripcion.Text = "" + ' TxtImporteC.Text = "" + ' TxtFecha.Text = "" + ' UpAgregarGastos.Update() + ' RegistraScript("$('#ModalAgregarGastos').modal();") + 'End Sub + #End Region #Region "I M P R E S I O N D E S U M I N I S T R O S" - Protected Sub ImgImprimirSuministros_Click(sender As Object, e As EventArgs) Handles LbImprimirSuministros.Click - GenerarPDFSuministros() - End Sub + 'Protected Sub ImgImprimirSuministros_Click(sender As Object, e As EventArgs) Handles LbImprimirSuministros.Click + ' GenerarPDFSuministros() + 'End Sub Private Sub GenerarPDFSuministros(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) @@ -3863,9 +3902,9 @@ Partial Class Contratos_ContratoObra #End Region #Region "I M P R E S I O N D E A V A N C E " - Private Sub lbImprimirAvance_Click(sender As Object, e As EventArgs) Handles lbImprimirAvance.Click - GenerarPDFAvance() - End Sub + 'Private Sub lbImprimirAvance_Click(sender As Object, e As EventArgs) Handles lbImprimirAvance.Click + ' GenerarPDFAvance() + 'End Sub Private Sub GenerarPDFAvance(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) @@ -3895,9 +3934,9 @@ Partial Class Contratos_ContratoObra #End Region #Region "I M P R E S I O N D E P R E S U P U E S T O " - Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click - GenerarPDFPPresupuesto() - End Sub + 'Private Sub lLbImprimirPresupuesto_Click(sender As Object, e As EventArgs) Handles LbImprimirPresupuesto.Click + ' GenerarPDFPPresupuesto() + 'End Sub Private Sub GenerarPDFPPresupuesto(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) @@ -3927,12 +3966,12 @@ Partial Class Contratos_ContratoObra #End Region #Region "I M P R E S I O N D E A C T I V O S F I J O S " - Private Sub LbImprmirAF_Click(sender As Object, e As EventArgs) Handles LbImprmirAF.Click - GenerarPDFActivosFijos() - End Sub - Private Sub LbImprmirAFExcel_Click(sender As Object, e As EventArgs) Handles LbImprmirAFExcel.Click - GenerarPDFActivosFijos("Excel") - End Sub + 'Private Sub LbImprmirAF_Click(sender As Object, e As EventArgs) Handles LbImprmirAF.Click + ' GenerarPDFActivosFijos() + 'End Sub + 'Private Sub LbImprmirAFExcel_Click(sender As Object, e As EventArgs) Handles LbImprmirAFExcel.Click + ' GenerarPDFActivosFijos("Excel") + 'End Sub Private Sub GenerarPDFActivosFijos(Optional Formato As String = "PDF") Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) @@ -4053,13 +4092,13 @@ Partial Class Contratos_ContratoObra ObjGral.Dispose() 'DdlPlantillaContrato.DataSource = DtPlantillasContratos 'DdlPlantillaContrato.DataBind() - End Sub - - Protected Sub BtnImprimirC_Click(sender As Object, e As EventArgs) Handles liImprimir.Click - ' Dim docx As String = DtPlantillasContratos.FiltroPrimeroValor("URL", $"CveContratoPlantilla = {DdlPlantillaContrato.SelectedValue}") - ' DescarFormato(docx) End Sub + 'Protected Sub BtnImprimirC_Click(sender As Object, e As EventArgs) Handles liImprimir.Click + ' ' Dim docx As String = DtPlantillasContratos.FiltroPrimeroValor("URL", $"CveContratoPlantilla = {DdlPlantillaContrato.SelectedValue}") + ' ' DescarFormato(docx) + 'End Sub + #End Region diff --git a/Contratos/RepContratosObraAvances.aspx b/Contratos/RepContratosObraAvances.aspx index 5587ae0af..7f31c16ea 100644 --- a/Contratos/RepContratosObraAvances.aspx +++ b/Contratos/RepContratosObraAvances.aspx @@ -28,7 +28,7 @@
-
+ <%--
Fecha Inicio:
@@ -46,9 +46,9 @@ -
- +
--%> +<%--
Fecha Fin:
@@ -65,7 +65,7 @@ -
+
--%>
Cliente: @@ -92,6 +92,151 @@ + + + + +
+ +
+
+ +
+ +
+ Contratos +

+ + +

+ +
+ +
+ Total +

+ $ +

+
+ +
+ +
+ +
+ +
+ +
+ + +
+
+
+ +
+ + + + +
+ Avance +

+ + + + +

+ +
+ Porcentaje +

+ + + + +

+ +
+ +
+ +
+ +
+
+
+ +
+ + <%--76% Avance--%> + +
+ +
+
Avance
+
+
+ +
+
+
+ +
+
+
+ +
+ + + + +
+ Faltante +

+ + + + +

+ +
+ Porcentaje +

+ + + + +

+ +
+ + +
+ +
+ +
+
+
+
+ + <%--76% Avance--%> + +
+
+
Faltante
+
+
+
+
+
+ +
+ +
+
+ @@ -116,45 +261,91 @@ DataKeyNames="CveContrato,NumeroContrato" ShowHeader="True" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"> - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - + + + +
diff --git a/Contratos/RepContratosObraAvances.aspx.vb b/Contratos/RepContratosObraAvances.aspx.vb index 6215f5a5a..066bab9dc 100644 --- a/Contratos/RepContratosObraAvances.aspx.vb +++ b/Contratos/RepContratosObraAvances.aspx.vb @@ -11,7 +11,7 @@ Partial Class RepContratosObraAvances CargaClientes() CargaContratos() - 'CargaDatos() + CargaDatos() End If End Sub @@ -20,9 +20,11 @@ Partial Class RepContratosObraAvances Private Sub CargaDatos() Dim Con As New ClsContratos + Dim DTDatos As New DataTable - If Con.GetContratosObraRepAvances(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If Con.GetContratosObraRepAvances(MinFecha, MaxFecha, DdlCliente.SelectedValue.ToEntero, DdlContrato.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GVDatos.DataSource = Con.DtResultados + DTDatos = Con.DtResultados Else GVDatos.DataSource = Nothing End If @@ -30,8 +32,47 @@ Partial Class RepContratosObraAvances Con.Dispose() GVDatos.DataBind() - UpDatos.Update() - + UpDatos.Update() + + + If DTDatos.Rows.Count > 0 Then + Indicadores(DTDatos) + End If + + End Sub + + + + Private Sub Indicadores(DTDatos As DataTable) + + Dim NumeroContratos As Integer = DTDatos.Rows.Count + + Dim TotalContratos As Decimal = DTDatos.SUM("Importe") + Dim TotalAvance As Decimal = DTDatos.SUM("AvanceImporte") + Dim TotalFaltante As Decimal = TotalContratos - TotalAvance + + + Dim TotalAvancePorcentaje As Decimal = (TotalAvance * 100) / TotalContratos + Dim TotalFaltantePorcentaje As Decimal = 100 - TotalAvancePorcentaje + + + LtlGrafNumeroContratos.Text = NumeroContratos.ToString + LtlGrafTotal.Text = TotalContratos.ToString("###,###,###.00") + + + LtlAvanceImporte.Text = $"$ {TotalAvance.ToString("###,###,###.00")}" + LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %" + LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%" + SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%") + + + LtlFaltanteImporte.Text = $"$ {TotalFaltante.ToString("###,###,###.00")}" + LtlFaltanteImportePorcentaje1.Text = $"{TotalFaltantePorcentaje.ToString("###.00")} %" + LtlFaltanteImportePorcentaje2.Text = $"{TotalFaltantePorcentaje.ToString("###.00")}%" + SPFaltante.Attributes.Add("style", $"width:{TotalFaltantePorcentaje.ToString.ToEntero}%") + + UpGrafica.Update() + End Sub #Region "C O M B O S" diff --git a/Contratos/RepContratosObraAvancesDetalle.aspx b/Contratos/RepContratosObraAvancesDetalle.aspx index 1a1269883..1cee61c45 100644 --- a/Contratos/RepContratosObraAvancesDetalle.aspx +++ b/Contratos/RepContratosObraAvancesDetalle.aspx @@ -8,89 +8,159 @@ - Reporte Contratos Avance Detalle + -<%-- + + + - -
-
+
-
- -
- -
-
- -
- Fecha Inicio: -
-
-
- - - - -
- - - - - - +
+
+
-
+
+ Numero Estimaciones +

+ + +

+ +
+ +
+ Numero Estimaciones +

+ +

+
+ +
+ +
+ +
+ +
+ +
-
- Fecha Fin: -
-
-
- - - +
+
+
+ +
+ + + + +
+ Avance +

+ + - - - - - - - - + +

+ +
+ Porcentaje +

+ + + + +

+ +
-
- Cliente: -
-
- -
+
+ +
+ +
+
+
+ +
+ + <%--76% Avance--%> + +
+ +
+
Avance
+
+
-
- Contrato: -
-
- -
- - -
-
-
- + +
+
+
+ +
+ + + + +
+ Fecha Fin +

+ + + + +

+ +
+ Dias Restantes +

+ + + + +

+ +
+ + +
+ +
+ +
+
+ + <%--
+
+ + 76% Avance + +
+
+
Días
+
+
+
--%> + +
+
+ +
+ - --%> + @@ -99,11 +169,11 @@
-
- +
+
-
+
" style="display: inline-block; margin-right: -20px; width: 150px; height: 25px; border-color: #89C4F4;" /> " class="btn btn-circle btn-sm label-info"> @@ -115,7 +185,7 @@
-
+
0, Request("CveContrato").ToString.ToEntero, -1) - LblNumeroContrato.Text = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"Numero Contrato: {Request("NumeroContrato").ToString}", "") + NumeroContrato = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"{Request("NumeroContrato").ToString}", "") + LblNumeroContrato.Text = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"Estimaciones del Contrato: {Request("NumeroContrato").ToString}", "") If CveContrato > 0 Then CargaDatos() @@ -40,54 +52,72 @@ Partial Class RepContratosObraAvancesDetalle Private Sub CargaDatos() Dim Con As New ClsContratos - + Dim DTDatos As DataTable = New DataTable + Dim DTContrato As DataTable = New DataTable + If Con.GetContratosObraRepAvancesDetalle(CveContrato, UsuarioActual.CveEmpresa) Then GVDatos.DataSource = Con.DtResultados - + DTDatos = Con.DtResultados If Con.DtResultados.Rows.Count = 0 Then Alert("No se encontraron estimaciones.", TipoMensaje.MsgAdvertencia) End If Else GVDatos.DataSource = Nothing + End If + If Con.GetContratosObraRepAvances(MinFecha, MaxFecha, -1, CveContrato, UsuarioActual.CveEmpresa) Then + DTContrato = Con.DtResultados + If DTContrato.Rows.Count > 0 Then + Indicadores(DTContrato, DTDatos.Rows.Count) + End If End If + + Con.Dispose() GVDatos.DataBind() - UpDatos.Update() - + UpDatos.Update() + End Sub - '#Region "C O M B O S" + Private Sub Indicadores(DTDatos As DataTable, NumeroEstimaciones As Integer) + + LtlGrafNumeroEstimaciones.Text = NumeroEstimaciones - ' Private Sub CargaContratos() - ' DdlContrato.DataSource = GlobalDTContratos.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveContratoTipo IN(30,31) ") - ' DdlContrato.DataBind() - ' DdlContrato.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todos", "-1")) - ' End Sub + Dim AvanceImporte As Decimal = DTDatos(0)("AvanceImporte").ToString.ToDecimal + Dim TotalContratos As Decimal = DTDatos(0)("Importe").ToString.ToDecimal + Dim TotalAvancePorcentaje As Decimal = (AvanceImporte * 100) / TotalContratos + Dim TotalFaltantePorcentaje As Decimal = 100 - TotalAvancePorcentaje + + Dim FechaFinal As Date = DTDatos(0)("FechaFinal").ToString.ToDate + Dim Dias As Integer = (FechaFinal - Now).Days + + Dias = If(Dias < 0, 0, Dias) + + LtlAvanceImporte.Text = $"$ {AvanceImporte.ToString("###,###,###.00")}" + + LtlAvanceImporteProcentaje1.Text = $"{TotalAvancePorcentaje.ToString("###.00")} %" + LtlAvanceImporteProcentaje2.Text = $"{TotalAvancePorcentaje.ToString("###.00")}%" + SPAvance1.Attributes.Add("style", $"width:{TotalAvancePorcentaje.ToString.ToEntero}%") + + LtlFechaFin.Text = FechaFinal.ToString("dd/MM/yyyy") + LtlDiasRestantes.Text = Dias.ToString("###,###") + + UpGrafica.Update() + + End Sub + - ' Private Sub CargaClientes() - ' Dim dt As DataTable = Nothing - ' Dim Cli As New ClsClientes - ' If Cli.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - ' dt = Cli.DtResultados - ' End If - ' Cli.Dispose() - ' DdlCliente.DataSource = dt - ' DdlCliente.DataBind() - ' DdlCliente.Items.Insert(0, New ListItem("Todos", "-1")) - ' End Sub - '#End Region Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim HplNumeroEstimacion As HyperLink = e.Row.FCHyperLink("HplNumeroEstimacion") - HplNumeroEstimacion.NavigateUrl = $"./RepContratosObraAvancesPartida.aspx?CveEstimacion={e.Row.DataKey("CveEstimacion")}&NumeroEstimacion={ e.Row.DataKey("NumeroEstimacion")}&CveContrato={ CveContrato }" + HplNumeroEstimacion.NavigateUrl = $"./RepContratosObraAvancesPartida.aspx?CveEstimacion={e.Row.DataKey("CveEstimacion")}&NumeroEstimacion={ e.Row.DataKey("NumeroEstimacion")}&CveContrato={ CveContrato }&NumeroContrato={NumeroContrato}" Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkAnexo") @@ -97,9 +127,6 @@ Partial Class RepContratosObraAvancesDetalle End Sub - 'Protected Sub CmdConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click - ' CargaDatos() - 'End Sub Protected Sub LnkAnexo_Click(sender As Object, e As EventArgs) @@ -130,18 +157,23 @@ Partial Class RepContratosObraAvancesDetalle Dim DtControl As New DataTable Dim ObjContratos As New ClsContratos - - + Dim Lugar As String = "" + Dim DescripcionContrato As String = "" If ObjContratos.GetContratosObraAvancesControlAcumulativo(CveContrato, CveEstimacion, UsuarioActual.CveEmpresa) Then DtControl = ObjContratos.DtResultados + + + If DtControl.Rows.Count > 0 Then + Lugar = DtControl(0)("Lugar").ToString + DescripcionContrato = DtControl(0)("DescripcionContrato").ToString + End If End If ObjContratos.Dispose() If DtControl.Rows.Count > 0 Then - Dim WBAnexo = New ClosedXML.Excel.XLWorkbook(PlantillaAnexo) Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook @@ -158,10 +190,16 @@ Partial Class RepContratosObraAvancesDetalle WSControl.Cell(20, 6).Value = NumeroContrato - WSControl.Cell(18, 2).Value = "" 'Lugar + WSControl.Cell(18, 2).Value = Lugar + WSControl.Cell(18, 2).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left) + WSControl.Cell(18, 2).Style.Alignment.SetVertical(XLAlignmentVerticalValues.Top) + WSControl.Cell(17, 6).Value = "" 'Periodo Fecha Inicial WSControl.Cell(17, 7).Value = "" 'Periuodo Fecha Final - WSControl.Cell(20, 2).Value = "" 'Obra + WSControl.Cell(20, 2).Value = DescripcionContrato + WSControl.Cell(20, 2).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left) + WSControl.Cell(20, 2).Style.Alignment.SetVertical(XLAlignmentVerticalValues.Top) + WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato WSControl.Cell(19, 5).Value = "" 'Contrtatista @@ -310,9 +348,7 @@ Partial Class RepContratosObraAvancesDetalle WSDetalle.Cell(4, 10).Value = "" 'Fecha a WSDetalle.Cell(4, 11).Value = NumeroEstimacion - 'WSDetalle.Picture("Logo").Name = $"Logo{Drow("CveContratoDetalle").ToString}" - 'WSDetalle.Picture("Firma").Name = $"Firma{Drow("CveContratoDetalle").ToString}" - + WSDetalle.Cell(6, 6).Value = DescripcionContrato WSDetalle.Cell(14, 2).Value = Drow("Codigo").ToString WSDetalle.Cell(14, 3).Value = Drow("PS").ToString @@ -353,7 +389,7 @@ Partial Class RepContratosObraAvancesDetalle Dim ImgWidth As Double = Imagen.Height - Dim nRowmas As Integer = ImgWidth / RowH + Dim nRowmas As Integer = (ImgWidth / RowH).ToEntero CurrectRowImg = CurrectRowImg + nRowmas @@ -396,13 +432,5 @@ Partial Class RepContratosObraAvancesDetalle End Sub - 'Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream - - ' Dim fs = New MemoryStream() - ' excelWorkbook.SaveAs(fs) - ' fs.Position = 0 - ' Return fs - - 'End Function End Class \ No newline at end of file diff --git a/Contratos/RepContratosObraAvancesPartida.aspx b/Contratos/RepContratosObraAvancesPartida.aspx index 31ffcfad3..ec7f8299d 100644 --- a/Contratos/RepContratosObraAvancesPartida.aspx +++ b/Contratos/RepContratosObraAvancesPartida.aspx @@ -8,45 +8,14 @@ - Reporte Contratos Avance por partida + -<%-- - - -
-
-
-
    -
  • Cliente: - -
  • -
  • Contratos: - -
  • -
  • Sección: - -
  • -
  • Partida: - -
  • -
  • Productos y Servicios: - -
  • -
-
-
- -
-
-
-
-
-
--%> + @@ -56,7 +25,7 @@
- +
diff --git a/Contratos/RepContratosObraAvancesPartida.aspx.vb b/Contratos/RepContratosObraAvancesPartida.aspx.vb index 07287f5ab..2abb6424b 100644 --- a/Contratos/RepContratosObraAvancesPartida.aspx.vb +++ b/Contratos/RepContratosObraAvancesPartida.aspx.vb @@ -25,7 +25,6 @@ Partial Class RepContratosObraAvancesPartida Property CveContrato As Integer - Get If ViewState("CveContrato") Is Nothing Then Return -1 @@ -36,8 +35,20 @@ Partial Class RepContratosObraAvancesPartida Set(value As Integer) ViewState("CveContrato") = value End Set - - + End Property + + + Property NumeroContrato As String + Get + If ViewState("NumeroContrato") Is Nothing Then + Return "" + Else + Return ViewState("NumeroContrato").ToString + End If + End Get + Set(value As String) + ViewState("NumeroContrato") = value + End Set End Property Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -46,8 +57,9 @@ Partial Class RepContratosObraAvancesPartida CveEstimacion = If(Request("CveEstimacion") IsNot Nothing AndAlso Request("CveEstimacion").ToString.ToEntero > 0, Request("CveEstimacion").ToString.ToEntero, -1) CveContrato = If(Request("CveContrato") IsNot Nothing AndAlso Request("CveContrato").ToString.ToEntero > 0, Request("CveContrato").ToString.ToEntero, -1) + NumeroContrato = If(Request("NumeroContrato") IsNot Nothing AndAlso Request("NumeroContrato").ToString.Length > 0, $"{Request("NumeroContrato").ToString}", "") - LblEstimacion.Text = If(Request("NumeroEstimacion") IsNot Nothing AndAlso Request("NumeroEstimacion").ToString.Length > 0, $"Numero Estimacion: {Request("NumeroEstimacion").ToString}", "") + LblEstimacion.Text = If(Request("NumeroEstimacion") IsNot Nothing AndAlso Request("NumeroEstimacion").ToString.Length > 0, $"Contgrato { NumeroContrato } Estimacion {Request("NumeroEstimacion").ToString}", "") If CveEstimacion > 0 Then