agregar columnas de PL1 y PL2, en la descarga de excel

This commit is contained in:
JPerez
2025-07-11 10:24:33 -07:00
parent 485ed9c648
commit c9e641710c

View File

@@ -42057,6 +42057,7 @@ Partial Class Ventas
Where row.RowType = DataControlRowType.DataRow
Select New With
{
.CveVentaDetalle = row.DataKey("CveVentaDetalle").ToEntero(),
.Codigo = row.DataKey("Codigo").Trim(),
.NumeroParte = row.DataKey("NumeroParte").Trim(),
.Descripcion = row.DataKey("PS").Trim(),
@@ -42065,13 +42066,32 @@ Partial Class Ventas
.Precio = row.FCLiteral("LtlPU").Text.Trim().ToDecimal(),
.SubImporte = row.DataKey("TotalImporte").ToDecimal(),
.MargenUtilidad = row.FCLabel("LblCostoPorcentaje").Text.Replace("%", "").Replace(" ", "").Trim().ToDecimal(),
.UltimoCosto = row.FCLabel("LblCosto").Text.Trim().ToDecimal()
.UltimoCosto = row.FCLabel("LblCosto").Text.Trim().ToDecimal(),
.PL1 = 0D,
.PL2 = 0D
}).QueryToDataTable(True)
If DtExcel.Rows.Count < 1 Then
Alert("No hay resultados en la busqueda.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim DtPreciosLista As DataTable = Nothing
If UsuarioActual.CveEmpresa = 189 Then
Dim ObjVta As New ClsVentas
If ObjVta.GetVentaDetallePreciosLista(Me.CveVenta, UsuarioActual.CveEmpresa) Then
DtPreciosLista = ObjVta.DtResultados.Copy()
End If
ObjVta.Dispose()
If DtPreciosLista IsNot Nothing Then
For Each Row As DataRow In DtExcel.Rows
Row("PL1") = DtPreciosLista.FiltroPrimeroValor("PL1", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToDecimal()
Row("PL2") = DtPreciosLista.FiltroPrimeroValor("PL2", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToDecimal()
Next
End If
End If
Dim folio = LblSerie.Text + "-" + TxtFolio.Text
@@ -42085,6 +42105,9 @@ Partial Class Ventas
DtExcel.Columns("MargenUtilidad").ColumnName = "Margen de utilidad"
DtExcel.Columns("UltimoCosto").ColumnName = "Último costo"
'QUITAR COLUMNA DE VENTA DETALLE, EL USUARIO NO DEBE VERLA
DtExcel.Columns.Remove("CveVentaDetalle")
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim FileExcel As New ExcelFile()
@@ -42109,6 +42132,10 @@ Partial Class Ventas
worksheet.Columns(7).Style.NumberFormat = "#,##0.00"
'ULTIMO COSTO
worksheet.Columns(8).Style.NumberFormat = "$#,##0.00_);($#,##0.00)"
'PL1
worksheet.Columns(9).Style.NumberFormat = "$#,##0.00_);($#,##0.00)"
'PL2
worksheet.Columns(10).Style.NumberFormat = "$#,##0.00_);($#,##0.00)"
Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns()
For i As Integer = 0 To columnCount