Compras Pronto Pago

This commit is contained in:
rakcsle
2024-04-01 16:30:05 -07:00
parent e280f83de6
commit bfde4b48e3
8 changed files with 647 additions and 175 deletions

View File

@@ -4,6 +4,7 @@ Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports Stimulsoft.Report.Check
Partial Class Compras_RepNotasCredito
Inherits ClsPaginas
@@ -11,15 +12,34 @@ Partial Class Compras_RepNotasCredito
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
DtDatos = CType(ViewState("DtDatos"), DataTable)
If ViewState("DtDatos") Is Nothing Then
ViewState("DtDatos") = New DataTable
End If
Return CType(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property DtDatosRemisiones As DataTable
Get
If ViewState("DtDatosRemisiones") Is Nothing Then
ViewState("DtDatosRemisiones") = New DataTable
End If
Return CType(ViewState("DtDatosRemisiones"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatosRemisiones") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ConfiguraTabs()
DdlProveedores.setEsWebService(True)
DdlProveedores.Attributes.Add("data-metodo", "getproveedores")
DdlProveedores.SelectedText = "Todos"
@@ -27,10 +47,33 @@ Partial Class Compras_RepNotasCredito
TxtFechaSaldar.Text = NowADS().ToShortDateString
CargaDatos()
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
If Tab.ActiveTabIndex = 0 Then
CargaDatos()
Else
CargaDatosRemisiones()
End If
End Sub
Private Sub ConfiguraTabs()
Tab.ActiveTabIndex = 0
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then
TabRemisionesNotasCredito.Visible = True
End If
End Sub
#Region "NOTAS DE CREDITO"
Private Sub CargaDatos()
DtDatos = New DataTable
Dim ObjCompras As New ClsCompras
Dim FechaI, FechaF As String
@@ -56,12 +99,95 @@ Partial Class Compras_RepNotasCredito
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
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
Protected Sub CargaGrid(Orden As String)
Dim DV As DataView = Nothing
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
If Orden <> String.Empty Then
GvDatos.DataSource = DV.ToTable()
Else
GvDatos.DataSource = DtDatos
End If
GvDatos.DataBind()
UpDatos.Update()
DV.Dispose()
End Sub
#End Region
#Region "REMISIONES"
Private Sub CargaDatosRemisiones()
DtDatosRemisiones = New DataTable
GvRemisiones.DataSource = Nothing
Dim ObjCompras As New ClsCompras
Dim FechaI, FechaF As String
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa, 2) Then
DtDatosRemisiones = ObjCompras.DtResultados
GvRemisiones.DataSource = DtDatosRemisiones
Else
Alert("Ocurrió un error al obtener las remisiones", Extensiones.TipoMensaje.MsgError)
End If
ObjCompras.Dispose()
GvRemisiones.DataBind()
UpDatosRemsiones.Update()
End Sub
Protected Sub GvRemisiones_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
End If
End Sub
#End Region
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("RepNotasCredito." & NowADS().ToShortDateString)
If Tab.ActiveTabIndex = 0 Then
GvDatos.ExportToExcel("RepNotasCredito." & NowADS().ToShortDateString)
Else
GvRemisiones.ExportToExcel("RepRemisionesNotasCredito." & NowADS().ToShortDateString)
End If
End Sub
@@ -219,44 +345,5 @@ Partial Class Compras_RepNotasCredito
End Sub
#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
Protected Sub CargaGrid(Orden As String)
Dim DV As DataView = Nothing
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
If Orden <> String.Empty Then
GvDatos.DataSource = DV.ToTable()
Else
GvDatos.DataSource = DtDatos
End If
GvDatos.DataBind()
UpDatos.Update()
DV.Dispose()
End Sub
#End Region
End Class