This commit is contained in:
rrene
2020-05-30 14:58:55 -07:00
17 changed files with 544 additions and 245 deletions

View File

@@ -49,27 +49,38 @@ Partial Class PopUpBuscarFolio
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim Reporte As New ClsInventarios
If ValidarFiltrosSeleccionados() Then
Dim Reporte As New ClsInventarios
Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha)
Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha)
Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha)
Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha)
Dim FechaInicial = If(TxtFechaI.Text.Trim <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text.ToDate, MinFecha)
Dim FechaFinal = If(TxtFechaF.Text.Trim <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text.ToDate, MaxFecha)
Dim FechaIngI = If(TxtFechaIngInicio.Text.Trim <> "" AndAlso TxtFechaIngInicio.Text <> "__/__/____", TxtFechaIngInicio.Text.ToDate, MinFecha)
Dim FechaIngF = If(TxtFechaIngFin.Text.Trim <> "" AndAlso TxtFechaIngFin.Text <> "__/__/____", TxtFechaIngFin.Text.ToDate, MaxFecha)
If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero, FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then
GvM.DataSource = Reporte.DtResultados
LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0)
If Reporte.GetMovimientosRep(DdlAlmacen.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, If(TxtFolio.Text = "", "-1", TxtFolio.Text.Trim).ToEntero,
FechaIngI, FechaIngF, FechaInicial, FechaFinal, -1, UsuarioActual.CveEmpresa) Then
GvM.DataSource = Reporte.DtResultados
LtlTotalRegistros.Text = Reporte.DtResultados.Rows.Count.ToString.FormatoNumero(0)
Else
GvM.DataSource = Nothing
End If
GvM.DataBind()
UPDatos.Update()
TblBusqueda.Visible = True
Reporte.Dispose()
Else
GvM.DataSource = Nothing
Alert("Seleccione un criterio de busqueda", TipoMensaje.MsgAdvertencia)
End If
GvM.DataBind()
UPDatos.Update()
TblBusqueda.Visible = True
Reporte.Dispose()
End Sub
Private Function ValidarFiltrosSeleccionados() As Boolean
If DdlAlmacen.SelectedValue.ToEntero > 0 Then Return True
If DdlTipoMovimiento.SelectedValue.ToEntero > 0 Then Return True
If TxtFolio.Text.Length > 0 Then Return True
Return False
End Function
#End Region
End Class

View File

@@ -94,72 +94,77 @@ Partial Class Inventarios_Default
End If
End Sub
Private Sub CargaDatos(CvePS As Integer, Tipo As Integer)
Dim ObjInventarios As New ClsInventarios()
If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then
Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If dr IsNot Nothing Then
LtPs.Text = $"Producto: <b>{dr("PSCodigo").ToString}</b>"
Dim CvePrecioLista As Integer = -1
If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista
CvePrecioLista = -2
End If
If ValidarFiltrosSeleccionados() Then
Dim ObjInventarios As New ClsInventarios()
If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then
Dim dr As Data.DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
Dim ObjVta As New ClsVentas
Dim objPS As New ClsProductosServicios
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
If ObjVta.DtResultados.Rows.Count > 0 Then
If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then
If objPS.DtResultados.Rows.Count > 0 Then
LtPrecioPS.Text = $"Precio de venta: <b>$: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}</b>"
If dr IsNot Nothing Then
LtPs.Text = $"Producto: <b>{dr("PSCodigo").ToString}</b>"
Dim CvePrecioLista As Integer = -1
If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista
CvePrecioLista = -2
End If
Dim ObjVta As New ClsVentas
Dim objPS As New ClsProductosServicios
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
If ObjVta.DtResultados.Rows.Count > 0 Then
If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then
If objPS.DtResultados.Rows.Count > 0 Then
LtPrecioPS.Text = $"Precio de venta: <b>$: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}</b>"
End If
End If
End If
End If
ObjVta.Dispose()
objPS.Dispose()
If UsuarioActual.CveEmpresa = 119 Then
If CBool(dr("AplicaIEPS")) Then
LtlIEPS.Visible = True
LtlIEPSPorcentaje.Visible = True
LtlIEPSPorcentaje.Text = $"<b>% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}</b>"
Else
LtlIEPS.Visible = False
LtlIEPSPorcentaje.Visible = False
End If
If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then
LtlIVA.Visible = True
LtlIVAPorcentaje.Visible = True
LtlIVAPorcentaje.Text = $"<b>Si</b>"
Else
LtlIVA.Visible = False
LtlIVAPorcentaje.Visible = False
End If
End If
End If
ObjVta.Dispose()
objPS.Dispose()
If UsuarioActual.CveEmpresa = 119 Then
If CBool(dr("AplicaIEPS")) Then
LtlIEPS.Visible = True
LtlIEPSPorcentaje.Visible = True
LtlIEPSPorcentaje.Text = $"<b>% {(dr("IEPSPorcentaje").ToString.ToDouble * 100).FormatoNumero}</b>"
Else
LtlIEPS.Visible = False
LtlIEPSPorcentaje.Visible = False
End If
If dr("IVA").ToString = "-1" OrElse dr("IVA").ToString.ToDecimal > 0 Then
LtlIVA.Visible = True
LtlIVAPorcentaje.Visible = True
LtlIVAPorcentaje.Text = $"<b>Si</b>"
Else
LtlIVA.Visible = False
LtlIVAPorcentaje.Visible = False
End If
If UsuarioActual.CveUsuario = 100 Then
HlPendiente.Visible = True
HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS)
End If
If ObjInventarios.DtResultados.Rows.Count > 0 Then
GV.DataSource = ObjInventarios.DtResultados
Else
GV.DataSource = Nothing
Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);")
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
End If
End If
If UsuarioActual.CveUsuario = 100 Then
HlPendiente.Visible = True
HlPendiente.NavigateUrl = String.Format("/Inventarios/RepVentasXSurtir.aspx?CvePS={0}", CvePS)
End If
ObjInventarios.Dispose()
GV.DataBind()
If ObjInventarios.DtResultados.Rows.Count > 0 Then
GV.DataSource = ObjInventarios.DtResultados
Else
GV.DataSource = Nothing
Dim Js = If(Tipo = 1, "", "window.setTimeout(Focus,200);")
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
End If
UPDatos.Update()
TblBusqueda.Visible = True
Else
Alert("Seleccione un producto o servicio", TipoMensaje.MsgAdvertencia)
End If
ObjInventarios.Dispose()
GV.DataBind()
UPDatos.Update()
TblBusqueda.Visible = True
End Sub
Private Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -227,6 +232,7 @@ Partial Class Inventarios_Default
End Sub
Private Sub CargarDatosMedRin()
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.GetExistenciasMedRin(DDlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlRin.SelectedValue.ToEntero, DdlMedidas.SelectedValue.ToEntero) Then
GvMedRin.DataSource = ObjInventarios.DtResultados
@@ -236,4 +242,9 @@ Partial Class Inventarios_Default
UPDatos.Update()
End Sub
Private Function ValidarFiltrosSeleccionados() As Boolean
If DDlPS.SelectedValue.ToEntero > 0 Then Return True
Return False
End Function
End Class