Filtro in inventario fisico: proveedores
This commit is contained in:
@@ -254,7 +254,7 @@
|
||||
|
||||
</div>
|
||||
<div class="row" runat="server" id="divAgruparMes" visible="false">
|
||||
<div class="col-md-1"><span>Agrupar por meses:</span></div>
|
||||
<div class="col-md-1"><span>Ver por meses:</span></div>
|
||||
<div class="col-md-1">
|
||||
<asp:CheckBox runat="server" ID="chkAgruparMes"/>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Compras_RepCxP
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -191,7 +193,7 @@ Partial Class Compras_RepCxP
|
||||
If chkAgruparMes.Checked Then
|
||||
|
||||
Dim monthNames As String() = {"", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"}
|
||||
GvCxP.Columns(2).Visible = True
|
||||
GvCxP.Columns(2).Visible = False
|
||||
GvCxP.Columns(3).Visible = True
|
||||
GvCxP.Columns(4).Visible = True
|
||||
GvCxP.Columns(5).Visible = True
|
||||
@@ -486,7 +488,8 @@ Partial Class Compras_RepCxP
|
||||
FC.Add(0, " ,2,1,Titulos")
|
||||
FC.Add(2, String.Format("Vencido,{0},1,Titulos", CantVencidos + 2))
|
||||
FC.Add(3, String.Format("Por Vencer,{0},1,Titulos", CantPorVencer + 2))
|
||||
|
||||
CantVencidos = 0
|
||||
CantPorVencer = 0
|
||||
End If
|
||||
GetMultiRowHeader(DirectCast(sender, GridView), e, FC, "Titulos")
|
||||
End If
|
||||
@@ -1015,7 +1018,333 @@ Partial Class Compras_RepCxP
|
||||
|
||||
|
||||
Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click
|
||||
GenerarPDF("EXCEL")
|
||||
Dim Mov As New ClsMovimientos
|
||||
Dim FechaI As String = txtFechaI.Text
|
||||
Dim FechaF As String = txtFechaF.Text
|
||||
Dim FechaVI As String = txtFechaVI.Text
|
||||
Dim FechaVF As String = txtFechaVF.Text
|
||||
If txtFechaI.Text = "" Then FechaI = "-1"
|
||||
If txtFechaF.Text = "" Then FechaF = "-1"
|
||||
If txtFechaVI.Text = "" Then FechaVI = "-1"
|
||||
If txtFechaVF.Text = "" Then FechaVF = "-1"
|
||||
Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1)
|
||||
Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
|
||||
If Mov.GetCxP(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, -1, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlEstatusCompra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero,
|
||||
DdlSubProyecto.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=IIf(DdlTipoProveedor.SelectedValue.ToEntero = 3, -1, DdlTipoProveedor.SelectedValue.ToEntero), Comprobaciones:=DdlComprobacion.SelectedValue.ToEntero,
|
||||
TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then
|
||||
|
||||
End If
|
||||
Dim Dr As DataRow = Mov.DtResultados.Rows(0)
|
||||
Dim NombreArchivo As String
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim workbook As New ExcelFile()
|
||||
Dim worksheet = workbook.Worksheets.Add("Cxp")
|
||||
Dim Mes(12) As String
|
||||
Dim monthNames As String() = {"", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"}
|
||||
Mes(0) = monthNames(Dr("NomMes1").ToString.ToDate.Month)
|
||||
Mes(1) = monthNames(Dr("NomMes2").ToString.ToDate.Month)
|
||||
Mes(2) = monthNames(Dr("NomMes3").ToString.ToDate.Month)
|
||||
Mes(3) = monthNames(Dr("NomMes4").ToString.ToDate.Month)
|
||||
Mes(4) = monthNames(Dr("NomMes5").ToString.ToDate.Month)
|
||||
Mes(5) = monthNames(Dr("NomMes6").ToString.ToDate.Month)
|
||||
Mes(6) = monthNames(Dr("NomMes7").ToString.ToDate.Month)
|
||||
Mes(7) = monthNames(Dr("NomMes8").ToString.ToDate.Month)
|
||||
Mes(8) = monthNames(Dr("NomMes9").ToString.ToDate.Month)
|
||||
Mes(9) = monthNames(Dr("NomMes10").ToString.ToDate.Month)
|
||||
Mes(10) = monthNames(Dr("NomMes11").ToString.ToDate.Month)
|
||||
Mes(11) = monthNames(Dr("NomMes12").ToString.ToDate.Month)
|
||||
Mes(12) = "12+"
|
||||
If RblTipoCambio.SelectedValue = 3 And TxtEspecifico.Text <> "" Then
|
||||
TCEspecifico = TxtEspecifico.Text
|
||||
Else
|
||||
TCEspecifico = -1
|
||||
End If
|
||||
|
||||
|
||||
Dim DtExcel As DataTable
|
||||
If chkAgruparMes.Checked Then
|
||||
DtExcel = (From row As DataRow In Mov.DtResultados.Rows
|
||||
Select New With
|
||||
{
|
||||
.GPO = row.Item("GPO"),
|
||||
.Saldo = row.Item("Saldo"),
|
||||
.TotalVencido = row.Item("vencido"),
|
||||
.Mes1 = row.Item("Mes1"),
|
||||
.Mes2 = row.Item("Mes2"),
|
||||
.Mes3 = row.Item("Mes3"),
|
||||
.Mes4 = row.Item("Mes4"),
|
||||
.Mes5 = row.Item("Mes5"),
|
||||
.Mes6 = row.Item("Mes6"),
|
||||
.Mes7 = row.Item("Mes7"),
|
||||
.Mes8 = row.Item("Mes8"),
|
||||
.Mes9 = row.Item("Mes9"),
|
||||
.Mes10 = row.Item("Mes10"),
|
||||
.Mes11 = row.Item("Mes11"),
|
||||
.Mes12 = row.Item("Mes12"),
|
||||
.Mes13 = row.Item("Mes13"),
|
||||
.TotalxVencer = row.Item("por_vencer")
|
||||
}).QueryToDataTable(True)
|
||||
Else
|
||||
DtExcel = (From row As DataRow In Mov.DtResultados.Rows
|
||||
Select New With
|
||||
{
|
||||
.GPO = row.Item("GPO"),
|
||||
.Saldo = row.Item("Saldo"),
|
||||
.Columna1vencido = row.Item("Columna1"),
|
||||
.Columna2vencido = row.Item("Columna2"),
|
||||
.Columna3vencido = row.Item("Columna3"),
|
||||
.Columna4vencido = row.Item("Columna4"),
|
||||
.Columna5vencido = row.Item("Columna5"),
|
||||
.Columna6vencido = row.Item("Columna6"),
|
||||
.Columna7vencido = row.Item("Columna7"),
|
||||
.Columna8vencido = row.Item("Columna8"),
|
||||
.Columna9vencido = row.Item("Columna9"),
|
||||
.Columna10vencido = row.Item("Columna10"),
|
||||
.Columna11vencido = row.Item("Columna11"),
|
||||
.Columna12vencido = row.Item("Columna12"),
|
||||
.Columna13vencido = row.Item("Columna13"),
|
||||
.TotalVencido = row.Item("vencido"),
|
||||
.Columna1xVencer = row.Item("Columna1"),
|
||||
.Columna2xVencer = row.Item("Columna2"),
|
||||
.Columna3xVencer = row.Item("Columna3"),
|
||||
.Columna4xVencer = row.Item("Columna4"),
|
||||
.Columna5xVencer = row.Item("Columna5"),
|
||||
.Columna6xVencer = row.Item("Columna6"),
|
||||
.Columna7xVencer = row.Item("Columna7"),
|
||||
.Columna8xVencer = row.Item("Columna8"),
|
||||
.Columna9xVencer = row.Item("Columna9"),
|
||||
.Columna10xVencer = row.Item("Columna10"),
|
||||
.Columna11xVencer = row.Item("Columna11"),
|
||||
.Columna12xVencer = row.Item("Columna12"),
|
||||
.Columna13xVencer = row.Item("Columna13"),
|
||||
.TotalxVencer = row.Item("por_vencer")
|
||||
}).QueryToDataTable(True)
|
||||
End If
|
||||
Mov.Dispose()
|
||||
|
||||
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
|
||||
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
||||
For i = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
|
||||
|
||||
If chkAgruparMes.Checked Then
|
||||
worksheet.Cells("A1").Value = DdlGrupo.SelectedItem.Text
|
||||
worksheet.Cells("D1").Value = Mes(0)
|
||||
worksheet.Cells("E1").Value = Mes(1)
|
||||
worksheet.Cells("F1").Value = Mes(2)
|
||||
worksheet.Cells("G1").Value = Mes(3)
|
||||
worksheet.Cells("H1").Value = Mes(4)
|
||||
worksheet.Cells("I1").Value = Mes(5)
|
||||
worksheet.Cells("J1").Value = Mes(6)
|
||||
worksheet.Cells("K1").Value = Mes(7)
|
||||
worksheet.Cells("L1").Value = Mes(8)
|
||||
worksheet.Cells("M1").Value = Mes(9)
|
||||
worksheet.Cells("N1").Value = Mes(10)
|
||||
worksheet.Cells("O1").Value = Mes(11)
|
||||
worksheet.Cells("P1").Value = Mes(12)
|
||||
Else
|
||||
Dim Vencido As Integer = 0
|
||||
Dim Xvencer As Integer = 0
|
||||
If Dr("TC1").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("C1").Value = Dr("NomC1").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC1").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("Q1").Value = Dr("NomC1").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC2").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("D1").Value = Dr("NomC2").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC2").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("R1").Value = Dr("NomC2").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC3").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("E1").Value = Dr("NomC3").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC3").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("S1").Value = Dr("NomC3").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC4").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("F1").Value = Dr("NomC4").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC4").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("T1").Value = Dr("NomC4").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC5").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("G1").Value = Dr("NomC5").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC5").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("U1").Value = Dr("NomC5").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC6").ToString = "1" Then
|
||||
worksheet.Cells("H1").Value = Dr("NomC6").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC6").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("V1").Value = Dr("NomC6").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC7").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("I1").Value = Dr("NomC7").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC7").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("W1").Value = Dr("NomC7").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC8").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("J1").Value = Dr("NomC8").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC8").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("X1").Value = Dr("NomC8").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC9").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("K1").Value = Dr("NomC9").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC9").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("Y1").Value = Dr("NomC9").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC10").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("L1").Value = Dr("NomC10").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC10").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("Z1").Value = Dr("NomC10").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC11").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("M1").Value = Dr("NomC11").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC11").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("AA1").Value = Dr("NomC11").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC12").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("N1").Value = Dr("NomC12").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC12").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("AB1").Value = Dr("NomC12").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
If Dr("TC13").ToString.ToEntero = 1 Then
|
||||
worksheet.Cells("O1").Value = Dr("NomC13").ToString
|
||||
Vencido += 1
|
||||
ElseIf Dr("TC13").ToString.ToEntero = 2 Then
|
||||
worksheet.Cells("AC1").Value = Dr("NomC13").ToString
|
||||
Xvencer += 1
|
||||
End If
|
||||
|
||||
|
||||
If Dr("TC13").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(28)
|
||||
End If
|
||||
If Dr("TC12").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(27)
|
||||
End If
|
||||
|
||||
If Dr("TC11").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(26)
|
||||
End If
|
||||
|
||||
If Dr("TC10").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(25)
|
||||
End If
|
||||
If Dr("TC9").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(24)
|
||||
End If
|
||||
|
||||
If Dr("TC8").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(23)
|
||||
End If
|
||||
If Dr("TC7").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(22)
|
||||
End If
|
||||
|
||||
If Dr("TC6").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(21)
|
||||
End If
|
||||
If Dr("TC5").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(20)
|
||||
End If
|
||||
|
||||
If Dr("TC4").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(19)
|
||||
End If
|
||||
If Dr("TC3").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(18)
|
||||
End If
|
||||
If Dr("TC2").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(17)
|
||||
End If
|
||||
If Dr("TC1").ToString.ToEntero <> 2 Then
|
||||
worksheet.Columns.Remove(16)
|
||||
End If
|
||||
|
||||
|
||||
If Dr("TC13").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(14)
|
||||
End If
|
||||
|
||||
If Dr("TC12").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(13)
|
||||
End If
|
||||
|
||||
If Dr("TC11").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(12)
|
||||
End If
|
||||
|
||||
If Dr("TC10").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(11)
|
||||
End If
|
||||
If Dr("TC9").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(10)
|
||||
End If
|
||||
|
||||
If Dr("TC8").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(9)
|
||||
End If
|
||||
If Dr("TC7").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(8)
|
||||
End If
|
||||
|
||||
If Dr("TC6").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(7)
|
||||
End If
|
||||
If Dr("TC5").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(6)
|
||||
End If
|
||||
|
||||
If Dr("TC4").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(5)
|
||||
End If
|
||||
If Dr("TC3").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(4)
|
||||
End If
|
||||
If Dr("TC2").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(3)
|
||||
End If
|
||||
If Dr("TC1").ToString.ToEntero <> 1 Then
|
||||
worksheet.Columns.Remove(2)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
NombreArchivo = "CxP"
|
||||
workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault)
|
||||
'GenerarPDF("EXCEL")
|
||||
End Sub
|
||||
|
||||
Private Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
||||
|
||||
Reference in New Issue
Block a user