This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-03-13 16:48:55 -07:00
parent 0460bda9ce
commit 2605932ee1

View File

@@ -19102,7 +19102,7 @@ Partial Class Ventas
Conexion.Open() Conexion.Open()
Dim cmd = Conexion.CreateCommand() Dim cmd = Conexion.CreateCommand()
cmd.CommandType = CommandType.Text cmd.CommandType = CommandType.Text
cmd.CommandText = "Select * FROM [Hoja1$]" cmd.CommandText = "Select * FROM [Hoja1$] WHERE Cantidad >=1"
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
DataAdapter.Fill(dt) DataAdapter.Fill(dt)
Case Else Case Else
@@ -19155,6 +19155,8 @@ Partial Class Ventas
dt.TableName = "Datos" dt.TableName = "Datos"
Dim DtSubProyecto As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DtSubProyecto.CaseSensitive = False
If Not ErrorArchivo Then If Not ErrorArchivo Then
NumRow = 1 NumRow = 1
Dim RowNoEncontrados As String = "" Dim RowNoEncontrados As String = ""
@@ -19179,8 +19181,6 @@ Partial Class Ventas
NumRow = NumRow + 1 NumRow = NumRow + 1
If Proyecto <> "" Then If Proyecto <> "" Then
Dim DtSubProyecto As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DtSubProyecto.CaseSensitive = False
DrProyecto = DtSubProyecto.FiltroPrimero($"(SubProyecto) = '{Proyecto}'") DrProyecto = DtSubProyecto.FiltroPrimero($"(SubProyecto) = '{Proyecto}'")
If DrProyecto IsNot Nothing Then If DrProyecto IsNot Nothing Then
CveSubProyecto = DrProyecto("CveSubProyecto").ToString.ToEntero CveSubProyecto = DrProyecto("CveSubProyecto").ToString.ToEntero
@@ -19193,38 +19193,80 @@ Partial Class Ventas
End If End If
If Codigo <> "" Then If Codigo <> "" Then
Dim StrArray() As String = GetPS("Codigo", Codigo).Split("|"c)
If StrArray.Length > 0 Then Using ObjPS As New ClsProductosServicios
If CBool(StrArray(0)) = True Then If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, Codigo:=Codigo) Then
CvePS = StrArray(1).ToEntero If ObjPS.CvePS > 0 Then
CvePS = ObjPS.CvePS
CveUM = ObjPS.CveUnidadMedida
Else
RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If
Else Else
RowNoEncontrados &= StrArray(1) & "<\BR>" RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If End If
End If End Using
'Dim StrArray() As String = GetPS("Codigo", Codigo).Split("|"c)
'If StrArray.Length > 0 Then
' If CBool(StrArray(0)) = True Then
' CvePS = StrArray(1).ToEntero
' Else
' RowNoEncontrados &= StrArray(1) & "<\BR>"
' End If
'End If
ElseIf CodigoBarras <> "" Then ElseIf CodigoBarras <> "" Then
Dim StrArray() As String = GetPS("CodigoBarras", CodigoBarras).Split("|"c)
If StrArray.Length > 0 Then Using ObjPS As New ClsProductosServicios
If CBool(StrArray(0)) = True Then If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, CodigoBarras:=CodigoBarras) Then
CvePS = StrArray(1).ToEntero If ObjPS.CvePS > 0 Then
CvePS = ObjPS.CvePS
CveUM = ObjPS.CveUnidadMedida
Else
RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If
Else Else
RowNoEncontrados &= StrArray(1) & "<\BR>" RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If End If
End If End Using
'Dim StrArray() As String = GetPS("CodigoBarras", CodigoBarras).Split("|"c)
'If StrArray.Length > 0 Then
' If CBool(StrArray(0)) = True Then
' CvePS = StrArray(1).ToEntero
' Else
' RowNoEncontrados &= StrArray(1) & "<\BR>"
' End If
'End If
ElseIf ProductoServicio <> "" Then ElseIf ProductoServicio <> "" Then
Dim StrArray() As String = GetPS("PS", ProductoServicio).Split("|"c)
If StrArray.Length > 0 Then Using ObjPS As New ClsProductosServicios
If CBool(StrArray(0)) = True Then If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, CodigoBarras:=CodigoBarras) Then
CvePS = StrArray(1).ToEntero If ObjPS.CvePS > 0 Then
CvePS = ObjPS.CvePS
CveUM = ObjPS.CveUnidadMedida
Else
RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If
Else Else
RowNoEncontrados &= StrArray(1) & "<\BR>" RowNoEncontrados = String.Format("{3}&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró {0} en la fila {1}, columna {2}<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
End If End If
End If End Using
'Dim StrArray() As String = GetPS("PS", ProductoServicio).Split("|"c)
'If StrArray.Length > 0 Then
' If CBool(StrArray(0)) = True Then
' CvePS = StrArray(1).ToEntero
' Else
' RowNoEncontrados &= StrArray(1) & "<\BR>"
' End If
'End If
Else Else
RowNoEncontrados &= "<\BR>&nbsp;&nbsp;&nbsp;&nbsp;- En la fila " & NumRow & " no se especificó código, código de barras ó descripción." RowNoEncontrados &= "<\BR>&nbsp;&nbsp;&nbsp;&nbsp;- En la fila " & NumRow & " no se especificó código, código de barras ó descripción."
End If End If
If CvePS > 0 Then If CvePS > 0 Then
CveUM = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString.ToEntero 'CveUM = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"CvePS = '{CvePS}'").ToString.ToEntero
AgregarProductoServicio(Cantidad, CveUM, UM, -1, "", AgregarProductoServicio(Cantidad, CveUM, UM, -1, "",
CvePS, HdnPS.Value, Observaciones, PrecioUnitario, HdnDescuento.Value.ToDecimal, CvePS, HdnPS.Value, Observaciones, PrecioUnitario, HdnDescuento.Value.ToDecimal,
@@ -19276,17 +19318,21 @@ Partial Class Ventas
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
End If End If
End Sub End Sub
Private Function GetPS(Opt As String, Valor As String) As String
Dim StrReturn As String = String.Empty
Dim CvePS As Integer = 0 'Private dtps As DataTable = Nothing
CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", Opt & " = '" & Valor & "'").ToString.ToEntero 'Private Function GetPS(Opt As String, Valor As String) As String
If CvePS > 0 Then ' Dim StrReturn As String = String.Empty
StrReturn = "True|" & CvePS.ToString ' Dim CvePS As Integer = 0
Else ' If dtps Is Nothing Then dtps = GlobalDTPS(UsuarioActual.CveEmpresa)
StrReturn = "False|&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró " & Valor & " en la fila " & NumRow & ", columna " & Opt ' CvePS = dtps.FiltroPrimeroValor("CvePS", Opt & " = '" & Valor & "'").ToString().ToEntero()
End If ' If CvePS > 0 Then
Return StrReturn ' StrReturn = "True|" & CvePS.ToString
End Function ' Else
' StrReturn = "False|&nbsp;&nbsp;&nbsp;&nbsp;- No se encontró " & Valor & " en la fila " & NumRow & ", columna " & Opt
' End If
' Return StrReturn
'End Function
#End Region #End Region
#Region "P E D I D O S" #Region "P E D I D O S"