Commit inicial Ventas Productivo
This commit is contained in:
182
Inventarios/PopUpExistenciasAlmacen.aspx.vb
Normal file
182
Inventarios/PopUpExistenciasAlmacen.aspx.vb
Normal file
@@ -0,0 +1,182 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Partial Class Inventarios_Default
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
Private ReadOnly Property CvePS As Integer
|
||||
Get
|
||||
Return ViewState("CvePS").ToString.ToEntero
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CType(Me.Master, BaseMasterPage).EsPopup = True
|
||||
CType(Me.Master, BaseMasterPage).PopupWidth = 780
|
||||
RegistraScript("if($get('tdContenido')){$get('tdContenido').style.height='465px'}")
|
||||
|
||||
InicializaValores()
|
||||
CargaSubProyecto()
|
||||
|
||||
If Request("CvePS") IsNot Nothing AndAlso IsNumeric(Request("CvePS")) AndAlso Request("CvePS").ToEntero > 0 Then
|
||||
ViewState("CvePS") = Request("CvePS")
|
||||
CargaDatos(CvePS, 1)
|
||||
DDlPS.SelectedValue = CvePS.ToString
|
||||
End If
|
||||
|
||||
If Not Request("EsThickbox") Is Nothing Then
|
||||
hdnEsThickbox.Value = Request("EsThickbox")
|
||||
Else
|
||||
hdnEsThickbox.Value = "N"
|
||||
End If
|
||||
|
||||
Me.Form.DefaultButton = BtnBuscar.UniqueID
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(132) = "1" Then
|
||||
DivCodigoSeriePS.Visible = True
|
||||
TxtCodigoPS.Focus()
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
||||
LtPrecioPS.Visible = True
|
||||
DivSucursal.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub InicializaValores()
|
||||
|
||||
'FUNCIONALIDAD 105
|
||||
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
|
||||
DDlPS.setEsWebService(True)
|
||||
Else
|
||||
DDlPS.setEsWebService(False)
|
||||
|
||||
'FUNCIONALIDAD DE COMPUESTO
|
||||
If UsuarioActual.Empresa.Funcionalidad(143) = "1" Then
|
||||
DDlPS.ddl.DataTextField = "PSCodigoCompuesto"
|
||||
End If
|
||||
|
||||
DDlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
DDlPS.DataBind()
|
||||
End If
|
||||
|
||||
Dim Txt As String = IfNull(Request("Txt"), "").ToString
|
||||
If Txt <> "" Then LblTitulo.Text = String.Format("Búsqueda de {0}", Txt)
|
||||
|
||||
End Sub
|
||||
Private Sub CargaSubProyecto()
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DdlSubProyecto.SelectedValue = Nothing
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa, Estatus:=1)
|
||||
DdlSubProyecto.DataBind()
|
||||
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("-", "-1"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click
|
||||
CargaDatos(DDlPS.SelectedValue.ToEntero, 1)
|
||||
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 ObjVta As New ClsVentas
|
||||
Dim objPS As New ClsProductosServicios
|
||||
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
|
||||
If ObjVta.DtResultados.Rows.Count > 0 Then
|
||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero, -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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
If e.Row.DBCampo("CveAlmacen") = "" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
GV.Columns(5).Visible = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " BUSCA | CODIGO - SERIE "
|
||||
Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If TxtCodigoPS.Text = "" Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{TxtCodigoPS.Text}'")
|
||||
If DrPS Is Nothing Then
|
||||
Alert($"No se ha encontrado un producto del Codigo ""<b>{TxtCodigoPS.Text}</b>"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);")
|
||||
TxtCodigoPS.Text = ""
|
||||
TxtCodigoPS.Focus()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
CargaDatos(DrPS("CvePS").ToString.ToEntero, 2)
|
||||
|
||||
TxtCodigoPS.Text = ""
|
||||
TxtCodigoPS.Focus()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user