Commit inicial Ventas Productivo
This commit is contained in:
124
PyME/Contabilidad/PlantillasPolizas.aspx.vb
Normal file
124
PyME/Contabilidad/PlantillasPolizas.aspx.vb
Normal file
@@ -0,0 +1,124 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Contabilidad_PlantillasPolizas
|
||||
Inherits ClsPaginas
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjPlantillaPolizas As New ClsContabilidad
|
||||
If ObjPlantillaPolizas.GetConta_PlantillasPolizasEmpresas(-1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
GvDatos.DataSource = ObjPlantillaPolizas.DtResultados
|
||||
GvDatos.DataBind()
|
||||
|
||||
If ObjPlantillaPolizas.GetConta_PlantillasPolizas(-1, -1) Then
|
||||
DdlPlantillaPoliza.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros("CvePlantillaPoliza NOT IN (1,2,3,4,7,10,11,12,32,60)", "", {"CvePlantillaPoliza", "PlantillaPoliza"})
|
||||
DdlPlantillaPoliza.DataBind()
|
||||
End If
|
||||
|
||||
If ObjPlantillaPolizas.GetConta_TiposPoliza(UsuarioActual.CveEmpresa) Then
|
||||
DdlTiposPoliza.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL")
|
||||
DdlTipoPolizaModal.DataSource = ObjPlantillaPolizas.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa} OR CveEmpresa IS NULL")
|
||||
DdlTiposPoliza.DataBind()
|
||||
DdlTipoPolizaModal.DataBind()
|
||||
End If
|
||||
Else
|
||||
Me.GvDatos.DataSource = Nothing
|
||||
End If
|
||||
OrdenaDatos()
|
||||
UpDatos.Update()
|
||||
ObjPlantillaPolizas.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarPoliza_Click(sender As Object, e As EventArgs) Handles BtnAgregarPoliza.Click
|
||||
Dim ObjPlantillaPolizas As New ClsContabilidad
|
||||
|
||||
If ObjPlantillaPolizas.AddConta_PlantillasPolizasEmpresas(DdlPlantillaPoliza.SelectedValue.ToEntero, DdlTipoPolizaModal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Response.Redirect(String.Format("/Contabilidad/PlantillasPolizasDetalle.aspx?CvePlantillaPoliza={0}", DdlPlantillaPoliza.SelectedValue))
|
||||
Else
|
||||
Alert("Ocurrió un error al agregar la plantilla.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjPlantillaPolizas.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnActualizarPlantilla_Click(sender As Object, e As EventArgs) Handles BtnActualizarPlantilla.Click
|
||||
Dim ObjPlantillaPolizas As New ClsContabilidad
|
||||
|
||||
If ObjPlantillaPolizas.UpdateConta_PlantillasPolizasEmpresas(DdlPlantillaPoliza.SelectedValue.ToEntero, DdlTiposPoliza.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivActualizarPlantilla"))
|
||||
CargaDatos()
|
||||
Alert("La plantilla se actualizó correctamente.")
|
||||
Else
|
||||
Alert("Ocurrió un error al agregar la plantilla.", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
ObjPlantillaPolizas.Dispose()
|
||||
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
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(5).Width = Unit.Pixel(40)
|
||||
e.Row.Cells(6).Width = Unit.Pixel(40)
|
||||
End If
|
||||
|
||||
If e.Row.DataKey("CveEmpresa").ToEntero = 1 Then
|
||||
e.Row.FCLinkButton("ImgE").Visible = False
|
||||
e.Row.FCLinkButton("ImgD").Visible = False
|
||||
End If
|
||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
||||
e.Row.FCLiteral("LtlPlantillaPoliza").Text = "<a class=""Texto"" href=""/Contabilidad/PlantillasPolizasDetalle.aspx?CvePlantillaPoliza=" & e.Row.DBCampo("CvePlantillaPoliza") & """>" & e.Row.FCLiteral("LtlPlantillaPoliza").Text & "</a>"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||
Dim ObjPlantillaPolizas As New ClsContabilidad
|
||||
If ObjPlantillaPolizas.RemoveConta_PlantillasPolizasDetalle(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
||||
If ObjPlantillaPolizas.RemoveConta_PlantillasPolizas(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.EditIndex = -1
|
||||
GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa) = ObjPlantillaPolizas.DtResultados
|
||||
CargaDatos()
|
||||
Alert("La Plantilla Poliza se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
ObjPlantillaPolizas.Dispose()
|
||||
End Sub
|
||||
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
DdlTiposPoliza.SelectedValueExist(GvRow.DataKey("TipoPoliza"))
|
||||
|
||||
UpModal.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivActualizarPlantilla"))
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " O R D E N A M I E N T O JAVASCRIPT"
|
||||
Private Sub OrdenaDatos()
|
||||
If (GvDatos.Rows.Count > 0) Then
|
||||
GvDatos.UseAccessibleHeader = True
|
||||
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
|
||||
RegistraScript("OrdenarGV();")
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user