Ajustes Contratos, excel

This commit is contained in:
Rakcsle Supertramp
2020-11-07 14:01:42 -07:00
parent befcdb34aa
commit 97aa459125
5 changed files with 471 additions and 83 deletions

View File

@@ -1,6 +1,7 @@
Imports Extensiones
Imports System.Data
Imports System.IO
Imports ClosedXML.Excel
Partial Class RepContratosObraAvancesDetalle
Inherits ClsPaginas
@@ -152,7 +153,8 @@ Partial Class RepContratosObraAvancesDetalle
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(19, 8).Value = "$ " & DtControl.SUM("Importe").ToString("###,###,###.00") 'Total
WSControl.Cell(19, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(20, 6).Value = NumeroContrato
@@ -163,7 +165,7 @@ Partial Class RepContratosObraAvancesDetalle
WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato
WSControl.Cell(19, 5).Value = "" 'Contrtatista
Dim RowCountControl As Integer = 1
For Each Drow As DataRow In DtControl.Rows
@@ -177,7 +179,121 @@ Partial Class RepContratosObraAvancesDetalle
WSControl.Cell(CuerrentRow, 8).Value = Drow("PU").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Value = Drow("Total").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
WSControl.Cell(CuerrentRow, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'ultimo Row
If DtControl.Rows.Count = RowCountControl Then
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSControl.Cell(CuerrentRow + 1, 8).Value = "Total:"
WSControl.Cell(CuerrentRow + 1, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(CuerrentRow + 1, 8).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Value = DtControl.SUM("Total")
WSControl.Cell(CuerrentRow + 1, 9).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
Dim range = WSControl.Range($"A{CuerrentRow + 3}:D{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"E{CuerrentRow + 3}:I{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"A{CuerrentRow + 4}:D{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "ING. WALTER ROBERTO VILLEGAS LARES"
range = WSControl.Range($"E{CuerrentRow + 4}:I{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "C. SALVADOR SUAREZ"
range = WSControl.Range($"A{CuerrentRow + 5}:D{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "SERVICIOS ELECTRICOS Y CONTROL DE HERMOSILLO S.A. DE C.V."
range.Style.Font.Bold = True
range = WSControl.Range($"E{CuerrentRow + 5}:I{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "GASERVICIO MATAMOROS SA DE CV"
range.Style.Font.Bold = True
End If
CuerrentRow = CuerrentRow + 1
RowCountControl = RowCountControl + 1
Next
WBAnexo.Worksheet(1).CopyTo(WBAnexoSalvar, "CONTROL")
@@ -280,13 +396,13 @@ Partial Class RepContratosObraAvancesDetalle
End Sub
Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream
'Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream
Dim fs = New MemoryStream()
excelWorkbook.SaveAs(fs)
fs.Position = 0
Return fs
' Dim fs = New MemoryStream()
' excelWorkbook.SaveAs(fs)
' fs.Position = 0
' Return fs
End Function
'End Function
End Class