Modalidad Contable en RepVentas

This commit is contained in:
2020-11-13 20:51:25 -07:00
parent dfd0d7ffe0
commit 90655409a2
5 changed files with 120 additions and 54 deletions

View File

@@ -10,8 +10,8 @@ Imports System.IO
Imports System.Xml
Partial Class Ventas_RepVentas
Inherits ClsPaginas
Inherits ClsPaginas
#Region "Propiedades"
Private Property Opcion As String
Get
@@ -74,12 +74,12 @@ Partial Class Ventas_RepVentas
Set(value As DataTable)
ViewState("DtColor") = value
End Set
End Property
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
TipoCambio = 1
@@ -117,11 +117,11 @@ Partial Class Ventas_RepVentas
End If
End If
End Sub
End Sub
#Region " CARGA COMBOS "
Private Sub CargaGrupo()
DdlGrupo.Items.Insert(0, New ListItem("Año", "1"))
DdlGrupo.Items.Insert(1, New ListItem("Mes", "2"))
@@ -284,10 +284,10 @@ Partial Class Ventas_RepVentas
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
'DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
End Sub
#End Region
#Region " CARGA DATOS "
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
@@ -321,7 +321,7 @@ Partial Class Ventas_RepVentas
If ObjVentas.GetRepVentas(FechaI, FechaF, FechaIEjec, FechaFEjec, CveCliente, DdlSubProyectoEjecucion.SelectedValue.ToEntero, Vendedores,
DdlUsuario.SelectedValue.ToEntero, Estatus, "-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, TipoComprobante, DdlProyecto.SelectedValue.ToEntero, Sucursales, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, CveUsuarioConsulta:=UsuarioActual.CveUsuario,
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero) Then
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, ModalidadContable:=ChkModalidadContable.Checked) Then
GvDatos.DataSource = ObjVentas.DtResultados
DtVentas = ObjVentas.DtResultados
Else
@@ -332,12 +332,12 @@ Partial Class Ventas_RepVentas
CveProyecto = DdlProyecto.SelectedValue.ToEntero
ObjVentas.Dispose()
GvDatos.DataBind()
End Sub
End Sub
#End Region
#Region "SELECTED INDEX CHANGE"
Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaClientes()
End Sub
@@ -380,10 +380,10 @@ Partial Class Ventas_RepVentas
CargaDatos()
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
UPDatos.Update()
End Sub
End Sub
#End Region
#Region " GV DATOS - ROW DATABOUND "
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -417,11 +417,60 @@ Partial Class Ventas_RepVentas
Else
CveSubProyecto = e.Row.DBCampo("CveSubProyecto")
CveProyecto = e.Row.DBCampo("CveProyecto")
End If
'LIGA A DETALLE
Dim Liga As String = $"/Ventas/RepVentaDetalle.aspx?GPO={DdlGrupo.SelectedValue}&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&AnioEjec={e.Row.DBCampo("AnioEjec")}&MesEjec={e.Row.DBCampo("MesEjec")}&AnioMesEjec={e.Row.DBCampo("AnioMesEjec")}&FechaEjec={e.Row.DBCampo("FechaEjec")}&CveCliente={e.Row.DBCampo("CveCliente")}&CveVendedor={ e.Row.DBCampo("CveVendedor")}&CveUsuario={e.Row.DBCampo("CveUsuario")}&CveEstatusFactura={e.Row.DBCampo("CveEstatusFactura")}&FechaI={FechaI}&FechaF={FechaF}&FechaIEjec={FechaIEjec}&FechaFEjec={FechaFEjec}&IVA={e.Row.DBCampo("GPO_IVA")}&CveCorte={ e.Row.DBCampo("CveCorte")}&TipoDocto={ DdlTipoComprobante.GetSelectedValuesM}&CveSubProyectoEjecucion={e.Row.DBCampo("CveSubProyectoEjecucion")}&CveSubProyecto={CveSubProyecto}&CveProyecto={CveProyecto}&TipoCambio={TipoCambio}&TCEspecifico={TCEspecifico}&CveMoneda={CveMoneda}&CveClienteClasificacion={e.Row.DBCampo("CveClienteClasificacion")}&CveCondicionesPago={DdlCondicionesPago.SelectedValue}&TipoCliente={ If(DdlGrupo.SelectedValue.ToEntero = 20, e.Row.DBCampo("TipoCliente"), DdlTipoCliente.SelectedValue)}"
End If
Dim FechaInicial As String = FechaI
Dim FechaFinal As String = FechaF
If Not e.Row.DBCampo("GPO").Contains("Total") Then
Select Case DdlGrupo.SelectedValue.ToEntero()
Case 2 ' MES
Dim FechaIRef As DateTime = FechaI.ToDateTime()
Dim FechaFRef As DateTime = FechaF.ToDateTime()
Dim Anio As Integer = FechaFRef.Year
Dim Mes As Integer = e.Row.DBCampo("Mes").ToEntero()
Dim lastDayOfMonth = DateTime.DaysInMonth(Anio, Mes)
Dim Dia As Integer = FechaFRef.Day
If e.Row.DBCampo("Mes").ToEntero() <> FechaFRef.Month Then
Dia = lastDayOfMonth
End If
If e.Row.DBCampo("Mes").ToEntero() <> FechaIRef.Month Then
FechaInicial = New DateTime(Anio, Mes, 1).ToString("dd/MM/yyyy")
End If
FechaFinal = New DateTime(Anio, Mes, Dia).ToString("dd/MM/yyyy")
Case 3 ' AÑO/MES
Dim FechaIRef As DateTime = FechaI.ToDateTime()
Dim FechaFRef As DateTime = FechaF.ToDateTime()
Dim Anio As Integer = e.Row.DBCampo("Anio").ToEntero()
Dim Mes As Integer = e.Row.DBCampo("Mes").ToEntero()
Dim lastDayOfMonth = DateTime.DaysInMonth(Anio, Mes)
Dim Dia As Integer = FechaFRef.Day
If e.Row.DBCampo("Mes").ToEntero() <> FechaFRef.Month Then
Dia = lastDayOfMonth
End If
If e.Row.DBCampo("Mes").ToEntero() <> FechaIRef.Month Then
FechaInicial = New DateTime(Anio, Mes, 1).ToString("dd/MM/yyyy")
End If
FechaFinal = New DateTime(Anio, Mes, Dia).ToString("dd/MM/yyyy")
Case 4 ' FECHA
FechaInicial = e.Row.DBCampo("Fecha").ToDateTime().ToString("dd/MM/yyyy")
FechaFinal = e.Row.DBCampo("Fecha").ToDateTime().ToString("dd/MM/yyyy")
End Select
End If
'LIGA A DETALLE
Dim Liga As String = $"/Ventas/RepVentaDetalle.aspx?GPO={DdlGrupo.SelectedValue}&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&AnioEjec={e.Row.DBCampo("AnioEjec")}&MesEjec={e.Row.DBCampo("MesEjec")}&AnioMesEjec={e.Row.DBCampo("AnioMesEjec")}&FechaEjec={e.Row.DBCampo("FechaEjec")}&CveCliente={e.Row.DBCampo("CveCliente")}&CveVendedor={ e.Row.DBCampo("CveVendedor")}&CveUsuario={e.Row.DBCampo("CveUsuario")}&CveEstatusFactura={e.Row.DBCampo("CveEstatusFactura")}&FechaI={FechaInicial}&FechaF={FechaFinal}&FechaIEjec={FechaIEjec}&FechaFEjec={FechaFEjec}&IVA={e.Row.DBCampo("GPO_IVA")}&CveCorte={ e.Row.DBCampo("CveCorte")}&TipoDocto={ DdlTipoComprobante.GetSelectedValuesM}&CveSubProyectoEjecucion={e.Row.DBCampo("CveSubProyectoEjecucion")}&CveSubProyecto={CveSubProyecto}&CveProyecto={CveProyecto}&TipoCambio={TipoCambio}&TCEspecifico={TCEspecifico}&CveMoneda={CveMoneda}&CveClienteClasificacion={e.Row.DBCampo("CveClienteClasificacion")}&CveCondicionesPago={DdlCondicionesPago.SelectedValue}&TipoCliente={ If(DdlGrupo.SelectedValue.ToEntero = 20, e.Row.DBCampo("TipoCliente"), DdlTipoCliente.SelectedValue)}&ModalidadContable={If(ChkModalidadContable.Checked, 1, 0)}"
e.Row.FCLiteral("LtlGrupo").Text = "<a class=""" & Css & """ href=""" & Liga & """>" & e.Row.FCLiteral("LtlGrupo").Text & "</a>"
@@ -434,9 +483,9 @@ Partial Class Ventas_RepVentas
End If
End If
End Sub
End Sub
#End Region
#Region " PERSONALIZAR "
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs)
Personaliza()
@@ -519,18 +568,18 @@ Partial Class Ventas_RepVentas
UPDatos.Update()
End Sub
End Sub
#End Region
#Region " EXCEL "
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
'GvDatos.ExportToExcel("ReporteVentas" & Now.ToShortDateString)
GenerarPDF("Excel")
End Sub
End Sub
#End Region
#Region "PDF"
Private Sub GenerarPDF(Optional Formato As String = "PDF")
If DtVentas IsNot Nothing Then
Dim StrFiltro As New StringBuilder
@@ -602,10 +651,10 @@ Partial Class Ventas_RepVentas
Response.AppendHeader("Content-Disposition", "attachment; filename=ReporteHP.csv")
Response.Write(Str.ToString)
Context.Response.End()
End Sub
End Sub
#End Region
#Region "XML-CONFIGURACIÓN"
Private Sub XmlConf(CveUsuario As Integer, CveModulo As Integer, Values As String(,))
Dim settings As New XmlWriterSettings()
@@ -644,11 +693,11 @@ Partial Class Ventas_RepVentas
{"SucursalEjecuccion", DdlSubProyectoEjecucion.Text.ToString()},
{"Proyecto", DdlProyecto.Text.ToString()}
}
End Sub
End Sub
#End Region
#Region "GRAFICA"
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
If Not DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
@@ -778,9 +827,9 @@ Partial Class Ventas_RepVentas
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
CambioGrafica()
End Sub
End Sub
#End Region
End Class