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:
@@ -4,6 +4,7 @@ Option Strict On
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Inventarios_EntradasSalidas
|
||||
Inherits ClsPaginas
|
||||
@@ -421,6 +422,9 @@ Partial Class Inventarios_EntradasSalidas
|
||||
'ImgFecha.Visible = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
BtnModalExcelAjuste.Visible = True
|
||||
End If
|
||||
|
||||
CantidadTotal = 0
|
||||
IndexSeccionAlmacen = 0
|
||||
@@ -4128,8 +4132,11 @@ Partial Class Inventarios_EntradasSalidas
|
||||
AddPSEntrada(DdlPS.SelectedValue.ToEntero, TxtCantidadInvFisico.Text.ToDouble, TxtCostoPromedio.Text.ToDecimal)
|
||||
End Sub
|
||||
|
||||
Protected Sub AddPSEntrada(CvePS As Integer, Cantidad As Double, CostoPromedio As Double)
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPS.SelectedText = "" : Exit Sub
|
||||
Protected Sub AddPSEntrada(CvePS As Integer, Cantidad As Double, CostoPromedio As Double, Optional Sonido As Boolean = True, Optional CargaGV As Boolean = True)
|
||||
|
||||
If Sonido Then
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPS.SelectedText = "" : Exit Sub
|
||||
End If
|
||||
|
||||
Dim Valido As Boolean = True
|
||||
|
||||
@@ -4168,8 +4175,15 @@ Partial Class Inventarios_EntradasSalidas
|
||||
registro.Item("FechaCaducidad") = Caducidad
|
||||
|
||||
DtMovimientosEntradaInvFisico.Rows.Add(registro)
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
|
||||
If CargaGV Then
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
End If
|
||||
|
||||
If Sonido Then
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -4266,8 +4280,10 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub AddPSSalida(CvePS As Integer, Cantidad As Double)
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPSSalida.SelectedText = "" : Exit Sub
|
||||
Protected Sub AddPSSalida(CvePS As Integer, Cantidad As Double, Optional Sonido As Boolean = True, Optional CargaGV As Boolean = True)
|
||||
If Sonido Then
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPSSalida.SelectedText = "" : Exit Sub
|
||||
End If
|
||||
|
||||
Dim Valido As Boolean = True
|
||||
|
||||
@@ -4306,8 +4322,15 @@ Partial Class Inventarios_EntradasSalidas
|
||||
registro.Item("FechaCaducidad") = Caducidad
|
||||
|
||||
DtMovimientosSalidaInvFisico.Rows.Add(registro)
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
|
||||
If CargaGV Then
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
End If
|
||||
|
||||
If Sonido Then
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -6053,8 +6076,87 @@ Partial Class Inventarios_EntradasSalidas
|
||||
Public Property TieneError As Boolean
|
||||
End Class
|
||||
|
||||
Protected Sub BtnCargaExcelAjuste_Click(sender As Object, e As EventArgs)
|
||||
If TxtExcelAjuste.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcelAjuste.getfiles().Archivos(0)
|
||||
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path
|
||||
CargarArchivo(Directorio, file.filename)
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String)
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim Tipo As String = "EXCEL"
|
||||
Dim dt As DataTable = Nothing
|
||||
Dim ErrorArchivo As Boolean = False
|
||||
|
||||
Try
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
|
||||
If Not ErrorArchivo AndAlso dt IsNot Nothing Then
|
||||
|
||||
dt.TableName = "Datos"
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPS.SelectedText = "" : Exit Sub
|
||||
|
||||
For Each row As DataRow In dt.Rows
|
||||
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, Codigo:=row("Codigo").ToString(), Estatus:=-1).FiltroPrimero("")
|
||||
Dim CvePS As Integer = DrPS("CvePS").ToString().ToEntero()
|
||||
|
||||
If row("EntradaSalida").ToString() = "1" Then
|
||||
AddPSEntrada(CvePS, row("Diferencia").ToString().ToDecimal(), row("Costo").ToString().ToDecimal(), Sonido:=False, CargaGV:=False)
|
||||
Else
|
||||
AddPSSalida(CvePS, row("Diferencia").ToString().ToDecimal(), Sonido:=False, CargaGV:=False)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al cargar los precios.", ex)
|
||||
Finally
|
||||
|
||||
If TieneError Then
|
||||
If DtMovimientosEntradaInvFisico IsNot Nothing Then
|
||||
DtMovimientosEntradaInvFisico.Clear()
|
||||
End If
|
||||
If DtMovimientosSalidaInvFisico IsNot Nothing Then
|
||||
DtMovimientosSalidaInvFisico.Clear()
|
||||
End If
|
||||
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
|
||||
Alert("Ocurrió un error al cargar los datos", TipoMensaje.MsgError)
|
||||
Else
|
||||
If DtMovimientosEntradaInvFisico.Rows.Count <> dt.FiltraParametros("EntradaSalida = 1").Rows.Count Then
|
||||
Alert("No se cargaron todas las entradas.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
If DtMovimientosSalidaInvFisico.Rows.Count <> dt.FiltraParametros("EntradaSalida = 0").Rows.Count Then
|
||||
Alert("No se cargaron todas las salidas.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert("Los datos se cargaron correctamente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivCargaAjuste').modal('hide')")
|
||||
End If
|
||||
|
||||
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
UpModalAjuste.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user