Puntos GDiaz:

-- Inv. Fisico, exportar productos con diferencias
--Ajustes de Inv Físico, permitir la importación de productos de diferencia.(IF).
This commit is contained in:
2024-09-07 11:16:55 -07:00
parent ee63160638
commit 4c302ac800
4 changed files with 522 additions and 317 deletions

View File

@@ -3,6 +3,7 @@ Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Imports Stimulsoft.Base.StiDbType
Partial Class Inventarios_RepAnomalias
Inherits ClsPaginas
@@ -99,6 +100,9 @@ Partial Class Inventarios_RepAnomalias
Dim Inventario As New ClsInventarios
Dim dt As DataTable = Nothing
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
LnkExportarFormatoAjuste.Visible = True
End If
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then
GvF.Columns(2).Visible = True 'clasificación
@@ -1094,6 +1098,58 @@ Partial Class Inventarios_RepAnomalias
End Sub
Private Sub LnkExportarFormatoAjuste_Click(sender As Object, e As EventArgs) Handles LnkExportarFormatoAjuste.Click
Dim DtFaltantes As DataTable = (From row As GridViewRow In GvF.Rows.Cast(Of GridViewRow)
Where row.RowType = DataControlRowType.DataRow
Select New With
{
.Codigo = row.DataKey("Codigo"),
.Producto = row.DataKey("PS"),
.Unidad = row.DataKey("Abreviatura"),
.Diferencia = row.DataKey("Diferencia").ToDecimal() * -1,
.Costo = row.DataKey("Costo").ToDecimal(),
.EntradaSalida = 1 'ENTRADA
}).QueryToDataTable(True)
Dim DtSobrantes As DataTable = (From row As GridViewRow In GvS.Rows.Cast(Of GridViewRow)
Where row.RowType = DataControlRowType.DataRow
Select New With
{
.Codigo = row.DataKey("Codigo"),
.Producto = row.DataKey("PS"),
.Unidad = row.DataKey("Abreviatura"),
.Diferencia = row.DataKey("Diferencia").ToDecimal(),
.Costo = row.DataKey("Costo").ToDecimal(),
.EntradaSalida = 0 'SALIDA
}).QueryToDataTable(True)
Dim DtExcel As DataTable = DtFaltantes.AsEnumerable().Union(DtSobrantes.AsEnumerable()).OrderBy(Function(x) x.Field(Of Integer)("EntradaSalida") = 1).CopyToDataTable()
DtExcel.TableName = "Existencias"
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim FileExcel As New ExcelFile()
Dim worksheet As ExcelWorksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns()
For i As Integer = 0 To columnCount
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
Next
FileExcel.Save(Response, "FormatoAjusteInventario.xlsx", SaveOptions.XlsxDefault)
End Sub
End Class