|
|
|
|
@@ -37,7 +37,7 @@ Partial Class Ventas_RepPS
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.TienePermisoProceso(320) OrElse UsuarioActual.CveRol = 1 Then
|
|
|
|
|
LnkRepDiario.Visible = True
|
|
|
|
|
HLReporteDiario.Visible = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -49,6 +49,8 @@ Partial Class Ventas_RepPS
|
|
|
|
|
Private Sub CargaDatosIniciales()
|
|
|
|
|
txtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
|
|
|
|
|
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
|
|
|
|
|
|
|
|
|
TxtFechaConsulta.Text = Now.ToString("dd/MM/yyyy")
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub CargaCombos()
|
|
|
|
|
@@ -237,12 +239,12 @@ Partial Class Ventas_RepPS
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
Protected Sub LnkRepDiario_Click(sender As Object, e As EventArgs)
|
|
|
|
|
Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
|
|
|
|
Dim CveMoneda As Integer = -1
|
|
|
|
|
Dim TC As Integer = 1
|
|
|
|
|
Dim TCEspecifico As Decimal = -1
|
|
|
|
|
|
|
|
|
|
Dim FechaConsulta As DateTime = Now
|
|
|
|
|
Dim FechaConsulta As DateTime = TxtFechaConsulta.Text.ToDateTime()
|
|
|
|
|
|
|
|
|
|
Dim DataSet As DataSet = New DataSet
|
|
|
|
|
Dim ObjVentas As New ClsVentas()
|
|
|
|
|
@@ -276,6 +278,8 @@ Partial Class Ventas_RepPS
|
|
|
|
|
CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
#Region "V E N T A S - L L A N T A S, R I N E S, A L I N E A C I O N E S"
|
|
|
|
|
Dim CeldaTotalVentaAcumulada As ExcelCell = Nothing
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(2, 0).Value = "Sucursal"
|
|
|
|
|
'TITULO DE LLANTAS
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 3).Merged = True
|
|
|
|
|
@@ -322,7 +326,9 @@ Partial Class Ventas_RepPS
|
|
|
|
|
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxSucursalesLlantasAlin As Integer = 3
|
|
|
|
|
Dim idxTabla As Integer = 0
|
|
|
|
|
For Each Row As DataRow In DtSucursalesLLantasAlin.Rows
|
|
|
|
|
idxTabla += 1
|
|
|
|
|
worksheet.Cells(IdxSucursalesLlantasAlin, 0).Value = Row("SubProyecto")
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxSucursalesLlantasAlin, 1).Value = Row("LlantasCantidadAnterior")
|
|
|
|
|
@@ -345,6 +351,10 @@ Partial Class Ventas_RepPS
|
|
|
|
|
'worksheet.Cells(IdxSucursalesLlantasAlin, 12).Value = Row("VentaAcumulada")
|
|
|
|
|
worksheet.Cells(IdxSucursalesLlantasAlin, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 10).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 11).Name})"
|
|
|
|
|
|
|
|
|
|
If idxTabla = DtSucursalesLLantasAlin.Rows.Count Then
|
|
|
|
|
CeldaTotalVentaAcumulada = worksheet.Cells(IdxSucursalesLlantasAlin, 12)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin, 0, IdxSucursalesLlantasAlin, 12).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
@@ -368,11 +378,336 @@ Partial Class Ventas_RepPS
|
|
|
|
|
'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin - 1, 0, IdxSucursalesLlantasAlin - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "L L A N T A S M E S A Ñ O A N T E R I O R R E S U M E N"
|
|
|
|
|
Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxSucursalesLlantasAlin + 1
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable6.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable6.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})"
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantasResumen += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantasResumen += 1
|
|
|
|
|
|
|
|
|
|
'RESUMEN DE METAS
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = "Mes"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = "Meta"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Value = "DIF %"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTableMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleTitleTableMeta.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTableMeta.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTableMeta.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTableMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTableMeta.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTableMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantasResumen += 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = 0
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})"
|
|
|
|
|
|
|
|
|
|
Dim StyleDataMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleDataMeta.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleDataMeta.Font.Name = "Calibri"
|
|
|
|
|
StyleDataMeta.Font.Size = 8 * 20
|
|
|
|
|
StyleDataMeta.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleDataMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleDataMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleDataMeta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantasResumen += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
DtMesAnioAnteriorLLantasResumen.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "F R A N Q U I C I A S R E S U M E N"
|
|
|
|
|
|
|
|
|
|
Dim TotalFranquicias As Decimal = DtSucursalesLLantasAlin.FiltroPrimeroValor("LlantasCantidadAcumulada", "CveSubProyecto=11842").ToDecimal()
|
|
|
|
|
|
|
|
|
|
DtSucursalesLLantasAlin.Dispose()
|
|
|
|
|
|
|
|
|
|
Dim IdxRefFranquiciasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen
|
|
|
|
|
|
|
|
|
|
Dim columnRefFranquiciasResumen As Integer = 6
|
|
|
|
|
|
|
|
|
|
'PRM 19
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen).Value = $"PRM {Now.Year - 1}"
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 1).Value = "ALM PS"
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 2).Value = ""
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Value = TotalFranquicias
|
|
|
|
|
|
|
|
|
|
'TOMA EL VALOR DE DIF LLANTAS
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 1, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 4, 3).Name})"
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 1).Value = $"FRANQ {Now.Year}"
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Value = 4988
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen).Value = $"PRM {Now.Year}"
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 1).Value = ""
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2).Formula = $"=({worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Name} - {worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Name})"
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 3).Formula = $"+({worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2)})"
|
|
|
|
|
|
|
|
|
|
'TOMA EL VALOR DE DIF LLANTAS METAS
|
|
|
|
|
worksheet.Cells(IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 1, 3).Name})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTableFR = worksheet.Cells.GetSubrangeAbsolute(IdxRefFranquiciasResumen, columnRefFranquiciasResumen, IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen + 3).Style
|
|
|
|
|
StyleTitleTableFR.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTableFR.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTableFR.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTableFR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTableFR.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTableFR.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
'Dim StyleDataFranquicias = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
'StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
'StyleData.Font.Name = "Calibri"
|
|
|
|
|
'StyleData.Font.Size = 8 * 20
|
|
|
|
|
'StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
'StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
'StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
'StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxRefFranquiciasResumen += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "A Ñ O R E S U M E N"
|
|
|
|
|
Dim IdxRefAnioResumen As Integer = IdxRefFranquiciasResumen - 1
|
|
|
|
|
|
|
|
|
|
Dim columnRefAnioResumen As Integer = columnRefFranquiciasResumen + 5
|
|
|
|
|
|
|
|
|
|
'AÑO ANTERIOR
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen).Value = Now.Year - 1
|
|
|
|
|
Dim CellAnioAnterior = worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1)
|
|
|
|
|
CellAnioAnterior.Value = 0
|
|
|
|
|
|
|
|
|
|
'AÑO ACTUAL
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen).Value = Now.Year
|
|
|
|
|
Dim CellAnioActual = worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen + 1)
|
|
|
|
|
CellAnioActual.Value = 0
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 2, columnRefAnioResumen + 1).Formula = $"=({CeldaTotalVentaAcumulada.Name} - {worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1).Name})"
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen).Value = $"X DIA {Now.Year - 1}"
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen).Value = $"X DIA {Now.Year}"
|
|
|
|
|
|
|
|
|
|
Dim DiasFinMes As Integer = 0
|
|
|
|
|
|
|
|
|
|
Dim Day As Integer = Now.Day
|
|
|
|
|
Dim DaysMonth As Integer = DateTime.DaysInMonth(Now.Year, Now.Month)
|
|
|
|
|
Dim Month As Integer = Now.Month
|
|
|
|
|
Dim Year As Integer = Now.Year
|
|
|
|
|
|
|
|
|
|
For i = Day To DaysMonth
|
|
|
|
|
Dim DayRef As DateTime = New DateTime(Year, Month, i)
|
|
|
|
|
If DayRef.DayOfWeek <> DayOfWeek.Sunday Then
|
|
|
|
|
DiasFinMes += 1
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 1).Formula = $"=({CellAnioAnterior.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}"
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioAnterior.Name})"
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 1).Formula = $"=({CellAnioActual.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}"
|
|
|
|
|
worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioActual.Name})"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTableAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style
|
|
|
|
|
StyleTitleTableAR.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTableAR.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTableAR.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTableAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTableAR.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTableAR.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim StyleDataAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen + 1, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style
|
|
|
|
|
StyleDataAR.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleDataAR.Font.Name = "Calibri"
|
|
|
|
|
StyleDataAR.Font.Size = 8 * 20
|
|
|
|
|
StyleDataAR.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleDataAR.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleDataAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleDataAR.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxRefAnioResumen += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "L L A N T A S M E S A Ñ O A N T E R I O R"
|
|
|
|
|
Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxSucursalesLlantasAlin + 8
|
|
|
|
|
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%"
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style
|
|
|
|
|
StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable5.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable5.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style
|
|
|
|
|
StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleSubTitleTable5.Font.Name = "Calibri"
|
|
|
|
|
StyleSubTitleTable5.Font.Size = 8 * 20
|
|
|
|
|
StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1"
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
DtMesAnioAnteriorLLantas.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "A Ñ O A N T E R I O R"
|
|
|
|
|
Dim IdxRefAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas
|
|
|
|
|
|
|
|
|
|
Dim columnRefAnioAnterior As Integer = 9
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior).Value = "Sucursal"
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = (FechaConsulta.Year - 1).ToString()
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = FechaConsulta.Year.ToString()
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Value = "Dif"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior, IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style
|
|
|
|
|
StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable4.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable4.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
If Row("TipoFila").ToString() = "2" Then
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
IdxAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255))
|
|
|
|
|
|
|
|
|
|
IdxAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
DtAnioAnteriorLLantas.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "V E N T A S - S E R V I C I O S D E I N S T A L A C I O N, A M O R T I G U A D O R E S, P O L I Z A S"
|
|
|
|
|
Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxSucursalesLlantasAlin + 3
|
|
|
|
|
Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxMesAnioAnteriorLlantas + 3
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 0).Value = "Sucursal"
|
|
|
|
|
'TITULO SERVICIOS DE INSTALACION
|
|
|
|
|
@@ -550,176 +885,6 @@ Partial Class Ventas_RepPS
|
|
|
|
|
DtPorcentajes.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "A Ñ O A N T E R I O R"
|
|
|
|
|
Dim IdxRefAnioAnteriorLlantas As Integer = IdxPorcentajes + 3
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, 0).Value = "Sucursal"
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, 1).Value = (FechaConsulta.Year - 1).ToString()
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, 2).Value = FechaConsulta.Year.ToString()
|
|
|
|
|
worksheet.Cells(IdxRefAnioAnteriorLlantas, 3).Value = "Dif"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, 0, IdxRefAnioAnteriorLlantas, 3).Style
|
|
|
|
|
StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable4.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable4.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 0).Value = Row("Grupo")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, 2).Name})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, 0, IdxAnioAnteriorLlantas, 3).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
If Row("TipoFila").ToString() = "2" Then
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255))
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
IdxAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 0).Value = Row("Grupo")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxAnioAnteriorLlantas, 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, 2).Name})"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, 0, IdxAnioAnteriorLlantas, 3).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255))
|
|
|
|
|
|
|
|
|
|
IdxAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
DtAnioAnteriorLLantas.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "L L A N T A S M E S A Ñ O A N T E R I O R"
|
|
|
|
|
Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxAnioAnteriorLlantas + 3
|
|
|
|
|
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True
|
|
|
|
|
worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%"
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style
|
|
|
|
|
StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable5.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable5.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style
|
|
|
|
|
StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleSubTitleTable5.Font.Name = "Calibri"
|
|
|
|
|
StyleSubTitleTable5.Font.Size = 8 * 20
|
|
|
|
|
StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1"
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantas += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
DtMesAnioAnteriorLLantas.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
#Region "L L A N T A S M E S A Ñ O A N T E R I O R"
|
|
|
|
|
Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxMesAnioAnteriorLlantas + 2
|
|
|
|
|
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year))
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS"
|
|
|
|
|
worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %"
|
|
|
|
|
|
|
|
|
|
Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight
|
|
|
|
|
StyleTitleTable6.Font.Name = "Calibri"
|
|
|
|
|
StyleTitleTable6.Font.Size = 8 * 20
|
|
|
|
|
StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5)
|
|
|
|
|
'INICIA DESDE LA CUARTA FILA
|
|
|
|
|
Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1
|
|
|
|
|
|
|
|
|
|
For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper()
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas")
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})"
|
|
|
|
|
worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})"
|
|
|
|
|
|
|
|
|
|
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style
|
|
|
|
|
StyleData.Font.Weight = ExcelFont.NormalWeight
|
|
|
|
|
StyleData.Font.Name = "Calibri"
|
|
|
|
|
StyleData.Font.Size = 8 * 20
|
|
|
|
|
StyleData.VerticalAlignment = VerticalAlignmentStyle.Center
|
|
|
|
|
StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center
|
|
|
|
|
StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin)
|
|
|
|
|
StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-"
|
|
|
|
|
|
|
|
|
|
IdxMesAnioAnteriorLlantasResumen += 1
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
DtMesAnioAnteriorLLantasResumen.Dispose()
|
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
|
|
|
|
|
|
|
|
|
For i = 0 To columnCount
|
|
|
|
|
|