Recepcion Almacen Bitacora recarga despues de guaraddo parcial

This commit is contained in:
rakcsle
2024-09-20 16:01:46 -07:00
parent afa2e0b2ec
commit 7a4c97573b
4 changed files with 372 additions and 67 deletions

View File

@@ -19,14 +19,25 @@
<li>
<a target="_blank" class="ayuda" href="../Documentacion/DocumentacionInventarios.aspx#RecepcionAlmacen">&nbsp;</a>
</li>
<li>
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="true" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
</li>
<%--
<li>
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="true" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
</li>
--%>
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAgregarExcel" Visible="true" OnClick="LnkAgregarExcel_Click" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="uppCargaBitacora" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<li>
<asp:LinkButton ID="HplCargaBitacora" runat="server" Visible="false" OnClick="HplCargaBitacora_Click" Style="color: #686868;"><i class="fa fa-file-load-o" style="color: #686868;"></i> Cargar Bitácora</asp:LinkButton>
<asp:LinkButton ID="HplCargaBitacora" runat="server" Visible="false" OnClick="HplCargaBitacora_Click" Style="color: #686868;"><i class="fa fa-book" aria-hidden="true"></i> Cargar Bitácora</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -7,6 +7,7 @@ Imports System.Text
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Imports Org.BouncyCastle.Asn1.X509
Partial Class Inventarios_RecepcionAlmacen
Inherits ClsPaginas
@@ -154,12 +155,21 @@ Partial Class Inventarios_RecepcionAlmacen
ViewState("PUSerie") = value
End Set
End Property
Private Property CveConsecSerie As Integer
'Private Property CveConsecSerie As Integer
' Get
' Return CType(ViewState("CveConsecSerie"), Integer)
' End Get
' Set(value As Integer)
' ViewState("CveConsecSerie") = value
' End Set
'End Property
Private Property CveCompraDetalle As Integer
Get
Return CType(ViewState("CveConsecSerie"), Integer)
Return CType(ViewState("CveCompraDetalle"), Integer)
End Get
Set(value As Integer)
ViewState("CveConsecSerie") = value
ViewState("CveCompraDetalle") = value
End Set
End Property
Private Property TotalGV As Decimal
@@ -412,6 +422,11 @@ Partial Class Inventarios_RecepcionAlmacen
End Property
Private Property ArchivoBitacora As String
Get
If ViewState("ArchivoBitacora") Is Nothing Then
ViewState("ArchivoBitacora") = ""
End If
Return CType(ViewState("ArchivoBitacora"), String)
End Get
Set(value As String)
@@ -420,6 +435,10 @@ Partial Class Inventarios_RecepcionAlmacen
End Property
Private Property ArchivoBitacoraDetalle As String
Get
If ViewState("ArchivoBitacoraDetalle") Is Nothing Then
ViewState("ArchivoBitacoraDetalle") = ""
End If
Return CType(ViewState("ArchivoBitacoraDetalle"), String)
End Get
Set(value As String)
@@ -1461,11 +1480,12 @@ Partial Class Inventarios_RecepcionAlmacen
'If e.Row.DBCampo("CveMetodoInventario").ToString = "5" Then
e.Row.FCButton("BtnSerie").Visible = True
e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"))
e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}°{6}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PU"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("CveCompraDetalle"))
e.Row.FCTextBox("TbCantidadF").Enabled = False
e.Row.FCCheckBox("cbInv").Enabled = False
Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count
'Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DataKey("Consec"))).Rows.Count
Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", e.Row.DataKey("CveCompraDetalle"))).Rows.Count
e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString
'' Empresa Acumuladores
@@ -1617,7 +1637,8 @@ Partial Class Inventarios_RecepcionAlmacen
TdSeriePS.Visible = True
TxtSeriePS.Focus()
CveConsecSerie = Gvr.DataKey("Consec").ToEntero
'CveConsecSerie = Gvr.DataKey("Consec").ToEntero
CveCompraDetalle = Gvr.DataKey("CveCompraDetalle").ToEntero
CvePSSerie = Gvr.DataKey("CvePS").ToEntero
CveUMSerie = Gvr.DataKey("CveUM").ToEntero
Exit Sub
@@ -1717,7 +1738,8 @@ Partial Class Inventarios_RecepcionAlmacen
CvePSSerie = Argumentos(0).ToEntero
CveUMSerie = Argumentos(1).ToEntero
PUSerie = Argumentos(2).ToDecimal
CveConsecSerie = Argumentos(5).ToEntero
'CveConsecSerie = Argumentos(5).ToEntero
CveCompraDetalle = Argumentos(6).ToEntero
CargaSerie(1)
@@ -1732,6 +1754,8 @@ Partial Class Inventarios_RecepcionAlmacen
DtDatosDetalle.Columns.Add("PU", GetType(Decimal))
DtDatosDetalle.Columns.Add("Serie", GetType(String))
DtDatosDetalle.Columns.Add("FechaCaducidad", GetType(String))
DtDatosDetalle.Columns.Add("CveCompraDetalle", GetType(Integer))
End If
End Sub
@@ -1747,11 +1771,13 @@ Partial Class Inventarios_RecepcionAlmacen
'RegistraScript("document.getElementById(""TxtSerie"").focus();")
RegistraScript("$('#DivSerie').modal();", "ModalLote")
GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
'GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle), "Consec DESC")
GvSerie.DataBind()
'VALIDA QUE SIGA AGREGANDO
If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then
'If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then
If Not DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle)).Rows.Count < LbCantidad.Text.ToEntero Then
BtnAgregarPS.Enabled = True
If CerrarCompletado Then
RegistraScript("$('#DivSerie').modal('hide');")
@@ -1764,7 +1790,9 @@ Partial Class Inventarios_RecepcionAlmacen
Dim Contador As Integer = 0
For Each Gvr As GridViewRow In GvInv.Rows
If Gvr.DataKey("CvePS").ToEntero = CvePSSerie Then
Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count
'Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count
Contador = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", Gvr.DataKey("CveCompraDetalle"))).Rows.Count
Gvr.FCCheckBox("cbInv").Enabled = False
Gvr.FCTextBox("TbCantidadF").Enabled = False
If DtDatosDetalle IsNot Nothing AndAlso Contador > 0 Then
@@ -1776,7 +1804,8 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
Dim Dr As DataRow = DtInv.Select($"Consec = {Gvr.DataKey("Consec")}")(0)
'Dim Dr As DataRow = DtInv.Select($"Consec = {Gvr.DataKey("Consec")}")(0)
Dim Dr As DataRow = DtInv.Select($"CveCompraDetalle = {Gvr.DataKey("CveCompraDetalle")}")(0)
Dr("CantidadSurtidaPantalla") = Gvr.FCTextBox("TbCantidadF").Text.ToDecimal
DtInv.AcceptChanges()
Next
@@ -1810,7 +1839,10 @@ Partial Class Inventarios_RecepcionAlmacen
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltroPrimero("", "PS")
For Each Serie In SeriesArreglo
DtDuplicado = DtDatosDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{Serie}'")
'DtDuplicado = DtDatosDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Serie = '{Serie}'")
DtDuplicado = DtDatosDetalle.FiltraParametros($"CveCompraDetalle = {CveCompraDetalle} AND Serie = '{Serie}'")
If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then
MensajeAlert.Append($"<br/> El numero de Serie <b>""{Serie}""</b> proporcionado ya se encuentra ingresado.")
TxtSerie.Text = ""
@@ -1836,7 +1868,8 @@ Partial Class Inventarios_RecepcionAlmacen
Dim Index As Integer = 0
Dim Cantidad As Integer = LbCantidad.Text.ToEntero
If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "Consec = " & CveConsecSerie).ToEntero
'If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "Consec = " & CveConsecSerie).ToEntero
If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "CveCompraDetalle = " & CveCompraDetalle).ToEntero
'DtInv
For Each Serie In SeriesArreglo
@@ -1847,7 +1880,8 @@ Partial Class Inventarios_RecepcionAlmacen
If Index > Cantidad Then Exit For
'VALIDA QUE SIGA AGREGANDO
If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < Cantidad Then
'If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < Cantidad Then
If Not DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle)).Rows.Count < Cantidad Then
MensajeAlert.Append("series cargadas en su totalidad") : Exit For
End If
@@ -1867,7 +1901,8 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
Row("ConsecId") = CveConsecSerie
'Row("ConsecId") = CveConsecSerie
Row("CveCompraDetalle") = CveCompraDetalle
Row("Consec") = DtDatosDetalle.Rows.Count + 1
Row("CvePS") = CvePSSerie
Row("CveUM") = CveUMSerie
@@ -1922,6 +1957,10 @@ Partial Class Inventarios_RecepcionAlmacen
Dim dtt As New DataTable
dtt.ReadXml(ArchivoBitacoraDetalle)
DtDatosDetalle = dtt
If Not DtDatosDetalle.Columns.Contains("CveCompraDetalle") Then
DtDatosDetalle.Columns.Add("CveCompraDetalle", GetType(Integer))
DtDatosDetalle.AcceptChanges()
End If
Alert("Registro(s) Recuperados", TipoMensaje.ToastInformacion)
End If
CargaGVInv()
@@ -1975,18 +2014,21 @@ Partial Class Inventarios_RecepcionAlmacen
CvePSSerie = Argumentos(0).ToEntero
CveUMSerie = Argumentos(1).ToEntero
PUSerie = Argumentos(2).ToDecimal
CveConsecSerie = Argumentos(5).ToEntero
'CveConsecSerie = Argumentos(5).ToEntero
CveCompraDetalle = Argumentos(6).ToEntero
CargaLote(1)
End Sub
Private Sub CargaLote(Tipo As Integer, Optional CerrarCompletado As Boolean = False)
RegistraScript("$('#DivLote').modal();", "ModalLote")
GvLote.Columns(2).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
'GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC")
GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", CveCompraDetalle), "Consec DESC")
GvLote.DataBind()
'VALIDA QUE SIGA AGREGANDO
If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("ConsecId = {0}", CveConsecSerie)) < LbLoteCantidad2.Text.ToDecimal Then
'If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("ConsecId = {0}", CveConsecSerie)) < LbLoteCantidad2.Text.ToDecimal Then
If Not DtDatosLoteDetalle.SUM("Cantidad", String.Format("CveCompraDetalle = {0}", CveCompraDetalle)) < LbLoteCantidad2.Text.ToDecimal Then
BtnAddPSLote.Enabled = False
If CerrarCompletado Then
RegistraScript("$('#DivLote').modal('hide');")
@@ -1999,7 +2041,9 @@ Partial Class Inventarios_RecepcionAlmacen
Dim Contador As Decimal = 0
For Each Gvr As GridViewRow In GvInv.Rows
If Gvr.DataKey("CvePS").ToEntero = CvePSSerie Then
Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("ConsecId = {0}", Gvr.DataKey("Consec")))
'Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("ConsecId = {0}", Gvr.DataKey("Consec")))
Contador = DtDatosLoteDetalle.SUMD("Cantidad", String.Format("CveCompraDetalle = {0}", Gvr.DataKey("CveCompraDetalle")))
Gvr.FCCheckBox("cbInv").Enabled = False
Gvr.FCTextBox("TbCantidadF").Enabled = False
If DtDatosLoteDetalle IsNot Nothing AndAlso Contador > 0 Then
@@ -2049,7 +2093,8 @@ Partial Class Inventarios_RecepcionAlmacen
Dim DtSeriesNuevas As New DataTable
DtSeriesNuevas.Columns.Add("Serie", GetType(String))
DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Lote = '{Lote}' ")
'DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"ConsecId = {CveConsecSerie} AND Lote = '{Lote}' ")
DtDuplicado = DtDatosLoteDetalle.FiltraParametros($"CveCompraDetalle = {CveCompraDetalle} AND Lote = '{Lote}' ")
If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then
Alert($"<br/> El numero de Lote <b>""{Lote}""</b> proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
@@ -2078,7 +2123,8 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
Row("ConsecId") = CveConsecSerie
'Row("ConsecId") = CveConsecSerie
Row("CveCompraDetalle") = CveCompraDetalle
Row("Consec") = DtDatosDetalle.Rows.Count + 1
Row("Cantidad") = CantidadLote
Row("CvePS") = CvePSSerie
@@ -2716,8 +2762,12 @@ Partial Class Inventarios_RecepcionAlmacen
PUExtranjero = DtInv.Rows(gvr.RowIndex)("PUExtranjero").ToString.ToDecimal
'SI FUE POR SERIE LOTE
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
'DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
'DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero))
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", gvr.DataKey("CveCompraDetalle").ToEntero))
DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("CveCompraDetalle = {0}", gvr.DataKey("CveCompraDetalle").ToEntero))
If DtDetalle.Rows.Count > 0 Then
Dim ContDt As Integer = 0
' por redondeo
@@ -3655,7 +3705,9 @@ Partial Class Inventarios_RecepcionAlmacen
ErrorMovInv = True
End Try
If Not ErrorMovInv Then
RenombrarBitacoras()
End If
'FINAL
If Not ErrorMovInv Then
@@ -3759,6 +3811,26 @@ Partial Class Inventarios_RecepcionAlmacen
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
End Sub
Private Sub RenombrarBitacoras()
Dim fechaActual As String = DateTime.Now.ToString("yyyyMMddHHmmss")
Dim fib As New FileInfo(ArchivoBitacora)
Dim fibd As New FileInfo(ArchivoBitacoraDetalle)
If fib.Exists() Then
Dim nuevoNombre As String = Path.Combine(fib.DirectoryName, Path.GetFileNameWithoutExtension(fib.Name) & "_" & fechaActual & ".xml")
fib.MoveTo(nuevoNombre)
End If
If fibd.Exists() Then
Dim nuevoNombreDetalle As String = Path.Combine(fibd.DirectoryName, Path.GetFileNameWithoutExtension(fibd.Name) & "_" & fechaActual & ".xml")
fibd.MoveTo(nuevoNombreDetalle)
End If
End Sub
Private Function GenerarMovimientoAlmacenVenta(CveAlmacen As Integer, CveConceptoAlmacen As Integer, CveVenta As Integer, CveMovimientoRelacionado As Integer, DtDetalle As DataTable, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, EsContabilizable As Boolean, Modulo As String) As MMovimientoAlmacen
Dim ErrorMovInv As Boolean = False
Dim Retorno As New MMovimientoAlmacen
@@ -4816,7 +4888,7 @@ Partial Class Inventarios_RecepcionAlmacen
Alert("El nombre de la segunda columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(2).ColumnName = "Producto" Then
If Not (dt.Columns(2).ColumnName = "Producto" Or dt.Columns(2).ColumnName = "Producto/Servicio") Then
Alert("El nombre de la tercera columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
@@ -4851,7 +4923,8 @@ Partial Class Inventarios_RecepcionAlmacen
Dim CveProducto As Integer = RowPS("CvePS").ToString().ToEntero()
Dim CveUnidadMedida As Integer = RowPS("CveUM").ToString().ToEntero()
CvePSSerie = CveProducto
CveConsecSerie = DtInv.FiltroPrimeroValor("Consec", "CvePS=" & CvePSSerie).ToEntero
'CveConsecSerie = DtInv.FiltroPrimeroValor("Consec", "CvePS=" & CvePSSerie).ToEntero
CveCompraDetalle = DtInv.FiltroPrimeroValor("CveCompraDetalle", "CvePS=" & CvePSSerie).ToEntero
Dim Cantidad As Double = RowExcel("Cantidad").ToString().ToDecimal()
Dim Serie As String = RowExcel("Serie").ToString()
@@ -4875,7 +4948,8 @@ Partial Class Inventarios_RecepcionAlmacen
If Valido Then
CveConsecSerie = RowPS("Consec").ToString.ToEntero
'CveConsecSerie = RowPS("Consec").ToString.ToEntero
CveCompraDetalle = RowPS("CveCompraDetalle").ToString.ToEntero
AgregaSerie(RowExcel("Serie").ToString, 1, False)
'AgregarPS(Cantidad, CveProducto, CveUnidadMedida, Observaciones, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(Not String.IsNullOrEmpty(Serie), Serie, ""), Lote:=Lote, FechaCaducidad:=FechaCaducidad, Limpia:=False)
@@ -4887,7 +4961,7 @@ Partial Class Inventarios_RecepcionAlmacen
Else
RowsNoCargados = RowsNoCargados + 1
ProductosNoCargados.AppendFormat("{0},", RowExcel("Producto").ToString())
ProductosNoCargados.AppendFormat("{0},", RowExcel("Producto/Servicio").ToString())
End If
End If
Next
@@ -4896,12 +4970,20 @@ Partial Class Inventarios_RecepcionAlmacen
Finally
Dim MensajeFinal As New StringBuilder()
If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then
MensajeFinal.Append("Los productos se cargaron correctamente. <br/><br/>")
End If
If RowsCargados > 0 Then
MensajeFinal.Append("Se cargaron <b>" & RowsCargados & "</b> productos correctamente.")
TxtExcel.Text = "[]"
UpConcepto.Update()
RegistraScript("$('#DivCargaExcel').modal('hide');")
End If
If RowsNoCargados > 0 Then
MensajeFinal.Append("No se pudieron cargar <b>" & RowsNoCargados & "</b> productos. <br/>Los siguientes productos no se pudieron cargar: " & ProductosNoCargados.ToString())
End If
@@ -4922,32 +5004,67 @@ Partial Class Inventarios_RecepcionAlmacen
End Sub
Public Sub DescargarFormato()
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoRecepcionAlmacen.xlsx"
Dim dtt As New DataTable
dtt = DtInv.Copy()
dtt.Columns.Remove("Cantidad")
dtt.Columns("CantidadF").ColumnName = "Cantidad"
dtt.Columns("PS").ColumnName = "Producto"
dtt.Columns("Codigo").ColumnName = "Código"
Dim PathArchivo As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoRecepcionAlmacen.xlsx"
Dim existingcol As New List(Of String) '= {"Cantidad", "Producto", "Código"}
If System.IO.File.Exists(PathArchivo) Then
For Each col As DataColumn In dtt.Columns
If Not col.ColumnName.Contiene("Cantidad", "Producto", "Código") Then
existingcol.Add(col.ColumnName)
End If
Next
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("Content-Disposition", "attachment; filename=FormatoRecepcionAlmacen.xlsx")
Response.TransmitFile(Directorio)
Response.End()
For Each colName As String In existingcol
dtt.Columns.Remove(colName)
Next
End If
dtt.Columns("Cantidad").SetOrdinal(0)
dtt.Columns("Código").SetOrdinal(1)
dtt.Columns("Producto").SetOrdinal(2)
dtt.Columns.Add("Serie", GetType(String))
dtt.ExportToExcel("FormatoRecepcionAlmacen.xlsx")
'Dim dtt As New DataTable
'dtt = DtInv.Copy()
'If dtt.Columns.Contains("Cantidad") Then
' dtt.Columns.Remove("Cantidad")
'End If
'If dtt.Columns.Contains("CantidadF") Then
' dtt.Columns("CantidadF").ColumnName = "Cantidad"
'End If
'If dtt.Columns.Contains("PS") Then
' dtt.Columns("PS").ColumnName = "Producto"
'End If
'If dtt.Columns.Contains("Codigo") Then
' dtt.Columns("Codigo").ColumnName = "Código"
'End If
'Dim existingcol As New List(Of String) '= {"Cantidad", "Producto", "Código"}
'For Each col As DataColumn In dtt.Columns
' If Not col.ColumnName.Contiene("Cantidad", "Producto", "Código") Then
' existingcol.Add(col.ColumnName)
' End If
'Next
'For Each colName As String In existingcol
' dtt.Columns.Remove(colName)
'Next
'Try
' dtt.Columns("Cantidad").SetOrdinal(0)
' dtt.Columns("Código").SetOrdinal(1)
' dtt.Columns("Producto").SetOrdinal(2)
'Catch ex As Exception
'End Try
'If Not dtt.Columns.Contains("PS") Then
' dtt.Columns.Add("Serie", GetType(String))
'End If
'dtt.ExportToExcel("FormatoRecepcionAlmacen.xlsx")
End Sub
@@ -4957,7 +5074,7 @@ Partial Class Inventarios_RecepcionAlmacen
'Create a DataTable.
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(9) {New DataColumn("CodBarra", GetType(String)),
dt.Columns.AddRange(New DataColumn(10) {New DataColumn("CodBarra", GetType(String)),
New DataColumn("OVenta", GetType(String)),
New DataColumn("Factura", GetType(String)),
New DataColumn("FechaFac", GetType(String)),
@@ -4966,7 +5083,8 @@ Partial Class Inventarios_RecepcionAlmacen
New DataColumn("Producto", GetType(String)),
New DataColumn("Serie", GetType(String)),'CodigoUnico
New DataColumn("Cantidad", GetType(Integer)),
New DataColumn("Código", GetType(String))})
New DataColumn("Código", GetType(String)),
New DataColumn("CveCompraDetalle", GetType(Integer))})
FolioFactura = FolioFactura.Replace("-", "")
'Read the contents of CSV file.
@@ -5049,5 +5167,10 @@ Partial Class Inventarios_RecepcionAlmacen
End Class
Protected Sub LnkAgregarExcel_Click(sender As Object, e As EventArgs)
TxtExcel.Text = "[]"
UpConcepto.Update()
RegistraScript("$('#DivCargaExcel').modal('show');")
End Sub
End Class