This commit is contained in:
2025-03-03 16:57:11 -07:00
3 changed files with 89 additions and 11 deletions

View File

@@ -177,6 +177,52 @@ Namespace Extensiones
Dim dataTable As DataTable = New DataTable()
Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0)
' VALIDACIÓN DE COLUMNAS DUPLICADAS
Try
If firstRowHasHeaders Then
Dim columnNames As New List(Of String)()
For col As Integer = 0 To worksheet.Rows(curRow).AllocatedCells.Count - 1
Dim cellValue As Object = worksheet.Rows(curRow).Cells(col).Value
Dim colName As String = If(cellValue Is Nothing, $"Unnamed Column {col + 1}",
cellValue.ToString())
columnNames.Add(colName)
Next
Dim duplicates As New List(Of String)()
Dim dict As New Dictionary(Of String, Integer)(StringComparer.OrdinalIgnoreCase)
For Each name In columnNames
If dict.ContainsKey(name) Then
dict(name) += 1
Else
dict(name) = 1
End If
Next
For Each kvp In dict
If kvp.Value > 1 Then
duplicates.Add(kvp.Key)
End If
Next
If duplicates.Count > 0 Then
Alert(New Object, "El archivo de Excel contiene columnas duplicadas, las columnas duplicadas son: " & String.Join(", ", duplicates), TipoMensaje.MsgAdvertencia)
Return New DataTable
End If
End If
Catch ex As Exception
End Try
' FIN DE LA VALIDACIÓN
For cols = 0 To worksheet.Rows(curRow).AllocatedCells.Count - 1
If firstRowHasHeaders Then

File diff suppressed because one or more lines are too long

View File

@@ -6072,7 +6072,7 @@ Partial Class Ventas
Dim ObjUsados As New ClsVentas
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa, ServicioDomicilio:=CBool(DbRowVenta("ServicioDomicilio"))) Then
DtUsadosPendientes = ObjUsados.DtResultados.Copy()
End If