Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

207
AF/CatSubTipos.aspx.vb Normal file
View File

@@ -0,0 +1,207 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Linq
Imports Extensiones
Partial Class AF_CatSubTipos
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
CargaTipos()
CargaDatos()
End If
End Sub
Private Sub CargaTipos()
DdlTipos.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa) '.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTipos.DataBind()
End Sub
Private Sub CargaGlobal()
Dim ObjSubTipos As New ClsAF
If ObjSubTipos.GetSubTiposActivosFijos(-1) Then
GlobalDTSubTipoActivoFijo(-1) = ObjSubTipos.DtResultados
End If
ObjSubTipos.Dispose()
End Sub
Public Sub CargaDatos()
Dim ObjSubTipos As New ClsAF
If ObjSubTipos.GetSubTiposActivosFijos(UsuarioActual.CveEmpresa) Then
ViewState("DTSubTipos") = ObjSubTipos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Else
Me.GvDatos.DataSource = Nothing
End If
ObjSubTipos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
CargaGlobal()
End Sub
#Region "G V D A T O S"
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Center
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
e.Row.FCDropDownList("DdlTipos").DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa) '.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlTipos").DataBind()
e.Row.FCDropDownList("DdlTipos").SelectedValue = e.Row.DBCampo("CveTipoActivoFijo")
End If
If e.Row.RowIndex = 0 Then
e.Row.Cells(5).Width = Unit.Pixel(100)
e.Row.Cells(6).Width = Unit.Pixel(65)
End If
End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjSubTipos As New ClsAF
Dim TieneError = False
If ObjSubTipos.RemoveSubTiposActivosFijos(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTSubTipos") = ObjSubTipos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("El SubTipos se eliminó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("OCurrió un error al eliminar el sub tipo del Activo Fijo. Por favor vuelva a intentar.", TipoMensaje.MsgError)
TieneError = True
End If
ObjSubTipos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
If Not TieneError Then
CargaDatos()
End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
GvDatos.EditIndex = -1
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
Dim ObjSubTipos As New ClsAF
Dim TieneError = False
Dim CveTipos As Integer = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("DdlTipos"), DropDownList).SelectedValue.ToEntero
Dim SubTipos As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtSubTipos"), TextBox).Text.Trim
Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstado").Checked
Dim CveSubTipos As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
If ObjSubTipos.UpdateSubTiposActivosFijos(CveSubTipos, CveTipos, SubTipos, Estatus, UsuarioActual.CveEmpresa) Then
GvDatos.EditIndex = -1
ViewState("DTSubTipos") = ObjSubTipos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("OCurrió un error al actualizar el sub tipo del Activo Fijo. Por favor vuelva a intentar.", TipoMensaje.MsgError)
TieneError = True
End If
ObjSubTipos.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
If Not TieneError Then
CargaDatos()
End If
End Sub
Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatos.RowEditing
GvDatos.EditIndex = e.NewEditIndex
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
End Sub
#End Region
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden
CargaGrid(Orden)
End Sub
Private Sub CargaGrid(Orden As String)
If Orden <> String.Empty Then
Dim DV As New DataView(CType(ViewState("DTSubTipos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
GvDatos.DataSource = DV.ToTable()
DV.Dispose()
Else
GvDatos.DataSource = CType(ViewState("DTSubTipos"), DataTable)
End If
GvDatos.DataBind()
UpDatos.Update()
End Sub
#End Region
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
Dim ObjAF As New ClsAF
Dim TieneError = False
If ObjAF.AddSubTiposActivosFijos(DdlTipos.SelectedValue.ToEntero, TxtSubTipos.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
TxtSubTipos.Text = ""
Alert("El nuevo SubTipo se guardó correctamente.", TipoMensaje.MsgInformacion)
UpTitulos.Update()
Else
TieneError = True
End If
ObjAF.Dispose()
If Not TieneError Then
CargaDatos()
End If
End Sub
End Class