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

264
CxC/RepCxCSemanal.aspx.vb Normal file
View File

@@ -0,0 +1,264 @@
Option Explicit On
Option Strict On
Imports Extensiones
Partial Class CxC_RepCxCSemanal
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
CargaDatos()
End If
End Sub
Private Sub CargaCombos()
'CargaClientes
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
DdlClientes.DataSource = ObjClientes.DtResultados
Else
DdlClientes.DataSource = Nothing
End If
ObjClientes.Dispose()
DdlClientes.DataBind()
'CargaSubProyectos
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
'Vendedor
'CargaUsuarios
DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlUsuario.DataBind()
'CargaEstatus
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(" CveEstatusFactura NOT IN (1, 4, 5) ")
DdlEstatus.DataBind()
DdlEstatus.Items.Add(New ListItem("Canceladas", "4"))
DdlEstatus.SelectedIndex = 2
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
UPDatos.Update()
End Sub
Private Sub CargaDatos()
Dim ObjMovtos As New ClsMovimientos()
Dim FechaI As String = txtFechaI.Text
Dim FechaF As String = txtFechaF.Text
If txtFechaI.Text = "" Then FechaI = "-1"
If txtFechaF.Text = "" Then FechaF = "-1"
'FechaI, FechaF, -1, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero
If ObjMovtos.GetCxCSemanal(FechaI, FechaF, DdlClientes.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlVendedor.SelectedValue, DdlUsuario.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero,
"-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero) Then
GvDatos.DataSource = ObjMovtos.DtResultados
Else
GvDatos.DataSource = Nothing
End If
ObjMovtos.Dispose()
GvDatos.DataBind()
End Sub
Protected Sub GvDatos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowCreated
If e.Row.RowType = DataControlRowType.Header Then
Dim FC As New SortedList
FC.Add(0, " ,2,1,ColumnaenBlanco")
FC.Add(2, "Vencido,4,1,Titulos")
FC.Add(3, "Por Vencer,5,1,Titulos")
GetMultiRowHeader(DirectCast(sender, GridView), e, FC, "Titulos")
End If
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Css As String = "Texto"
If e.Row.DBCampo("Orden") = "" Then
e.Row.BackColor = Drawing.Color.LightGray
End If
If e.Row.RowIndex = 1 Then
e.Row.Cells(0).Width = Unit.Pixel(295)
e.Row.Cells(1).Width = Unit.Pixel(90)
e.Row.Cells(2).Width = Unit.Pixel(75)
e.Row.Cells(3).Width = Unit.Pixel(75)
e.Row.Cells(4).Width = Unit.Pixel(75)
e.Row.Cells(5).Width = Unit.Pixel(75)
e.Row.Cells(6).Width = Unit.Pixel(75)
e.Row.Cells(7).Width = Unit.Pixel(75)
e.Row.Cells(8).Width = Unit.Pixel(75)
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Right
Dim FechaI, FechaF As String
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
'If e.Row.RowType = DataControlRowType.DataRow Then
' Dim Css As String = "Texto"
' If e.Row.RowIndex = 0 Then
' e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
' e.Row.Cells(0).Width = Unit.Pixel(200)
' e.Row.CssClass = "Totales"
' Css = "Totales"
' End If
' e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(10).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(11).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(12).HorizontalAlign = HorizontalAlign.Right
' e.Row.Cells(13).HorizontalAlign = HorizontalAlign.Right
' Dim FechaI, FechaF As String
' FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
' FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
Dim Liga1 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=V1&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga2 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=V8&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga3 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=V30&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga4 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=XV0&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga5 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=XV8&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga6 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=XV15&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga7 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=XV30&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga8 As String = String.Format("/CxC/RepCxCDetalle.aspx.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga9 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=TV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue, e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim Liga10 As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=TPV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue,
e.Row.DBCampo("Anio"),
e.Row.DBCampo("Mes"),
e.Row.DBCampo("AnioMes"),
e.Row.DBCampo("Fecha"),
e.Row.DBCampo("CveCliente"),
e.Row.DBCampo("CveSubProyecto"),
e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"),
e.Row.DBCampo("CveEstatusFactura"),
e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
Dim LigaTot As String = String.Format("/CxC/RepCxCDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveCliente={5}&CveSubProyecto={6}&Vendedor={7}&CveUsuario={8}&CveEstatusFactura={9}&IVA={10}&FechaI={11}&FechaF={12}",
DdlGrupo.SelectedValue,
e.Row.DBCampo("Anio"),
e.Row.DBCampo("Mes"),
e.Row.DBCampo("AnioMes"),
e.Row.DBCampo("Fecha"),
e.Row.DBCampo("CveCliente"),
e.Row.DBCampo("CveSubProyecto"),
e.Row.DBCampo("Vendedor"),
e.Row.DBCampo("CveUsuario"),
e.Row.DBCampo("CveEstatusFactura"),
e.Row.DBCampo("GPO_IVA"), FechaI, FechaF)
e.Row.FCHyperLink("HplSaldo").NavigateUrl = LigaTot
e.Row.FCHyperLink("LtlSem1").NavigateUrl = Liga1
e.Row.FCHyperLink("LtlSem2").NavigateUrl = Liga2
e.Row.FCHyperLink("LtlSem3").NavigateUrl = Liga3
e.Row.FCHyperLink("LtlSem4").NavigateUrl = Liga9
e.Row.FCHyperLink("LtlSem5").NavigateUrl = Liga4
e.Row.FCHyperLink("LtlSem6").NavigateUrl = Liga5
e.Row.FCHyperLink("LtlSem7").NavigateUrl = Liga6
e.Row.FCHyperLink("LtlSem8").NavigateUrl = Liga7
e.Row.FCHyperLink("LtlMayor8Sem").NavigateUrl = Liga10
'e.Row.FCHyperLink("LtlSaldo1").NavigateUrl = LigaTot
' e.Row.FCLiteral("LtlSaldo").Text = "<a class=""" & Css & """ href=""" & LigaTot & """>" & e.Row.FCLiteral("LtlSaldo").Text & "</a>"
' e.Row.FCLiteral("LtlVencido1_7").Text = "<a class=""" & Css & """ href=""" & Liga1 & """>" & e.Row.FCLiteral("LtlVencido1_7").Text & "</a>"
' e.Row.FCLiteral("LtlVencido8_30").Text = "<a class=""" & Css & """ href=""" & Liga2 & """>" & e.Row.FCLiteral("LtlVencido8_30").Text & "</a>"
' e.Row.FCLiteral("LtlVencido30_mas").Text = "<a class=""" & Css & """ href=""" & Liga3 & """>" & e.Row.FCLiteral("LtlVencido30_mas").Text & "</a>"
' e.Row.FCLiteral("LtlPorVender0_7").Text = "<a class=""" & Css & """ href=""" & Liga4 & """>" & e.Row.FCLiteral("LtlPorVender0_7").Text & "</a>"
' e.Row.FCLiteral("LtlPorVencer8_14").Text = "<a class=""" & Css & """ href=""" & Liga5 & """>" & e.Row.FCLiteral("LtlPorVencer8_14").Text & "</a>"
' e.Row.FCLiteral("LtlPorVencer15_30").Text = "<a class=""" & Css & """ href=""" & Liga6 & """>" & e.Row.FCLiteral("LtlPorVencer15_30").Text & "</a>"
' e.Row.FCLiteral("LtlPorVencido30_mas").Text = "<a class=""" & Css & """ href=""" & Liga7 & """>" & e.Row.FCLiteral("LtlPorVencido30_mas").Text & "</a>"
' e.Row.FCLiteral("LtlVentas").Text = "<a class=""" & Css & """ href=""" & Liga8 & """>" & e.Row.FCLiteral("LtlVentas").Text & "</a>"
' e.Row.FCLiteral("LtlSaldo1").Text = "<a class=""" & Css & """ href=""" & LigaTot & """>" & e.Row.FCLiteral("LtlSaldo1").Text & "</a>"
' If (e.Row.DBCampo("Total").ToDouble - e.Row.DBCampo("Saldo").ToDouble) <> 0 Then
' e.Row.FCLiteral("LtlVentasRecuperado").Text = (e.Row.DBCampo("Total").ToDouble + e.Row.DBCampo("Saldo").ToDouble).FormatoNumero & "%"
' End If
' e.Row.FCLiteral("LtlPorRecuperado").Text = (((e.Row.DBCampo("Total").ToDouble + e.Row.DBCampo("Saldo").ToDouble) * 100) / e.Row.DBCampo("Total").ToDouble).FormatoNumero & "%"
' e.Row.FCLiteral("LtlPorPorRecuperar").Text = ((e.Row.DBCampo("Saldo").ToDouble * -100) / e.Row.DBCampo("Total").ToDouble).FormatoNumero & "%"
' If e.Row.DBCampo("Saldo").ToDouble = 0 Then e.Row.FCLiteral("LtlSaldo").Text = "" : e.Row.FCLiteral("LtlSaldo1").Text = ""
' If e.Row.DBCampo("vencido_1_7").ToDouble = 0 Then e.Row.FCLiteral("LtlVencido1_7").Text = ""
' If e.Row.DBCampo("vencido_8_30").ToDouble = 0 Then e.Row.FCLiteral("LtlVencido8_30").Text = ""
' If e.Row.DBCampo("vencido_30_mas").ToDouble = 0 Then e.Row.FCLiteral("LtlVencido30_mas").Text = ""
' If e.Row.DBCampo("por_vencer_0_7").ToDouble = 0 Then e.Row.FCLiteral("LtlPorVender0_7").Text = ""
' If e.Row.DBCampo("por_vencer_8_14").ToDouble = 0 Then e.Row.FCLiteral("LtlPorVencer8_14").Text = ""
' If e.Row.DBCampo("por_vencer_15_30").ToDouble = 0 Then e.Row.FCLiteral("LtlPorVencer15_30").Text = ""
' If e.Row.DBCampo("por_vencido_30_mas").ToDouble = 0 Then e.Row.FCLiteral("LtlPorVencido30_mas").Text = ""
' If e.Row.DBCampo("Total").ToDouble = 0 Then e.Row.FCLiteral("LtlVentas").Text = ""
End If
End Sub
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
'If ChkVentasVsSaldo.Checked Then
' GvDatos.Columns(9).Visible = True
' GvDatos.Columns(10).Visible = True
' GvDatos.Columns(11).Visible = True
' GvDatos.Columns(12).Visible = True
' GvDatos.Columns(13).Visible = True
'Else
' GvDatos.Columns(9).Visible = False
' GvDatos.Columns(10).Visible = False
' GvDatos.Columns(11).Visible = False
' GvDatos.Columns(12).Visible = False
' GvDatos.Columns(13).Visible = False
'End If
UPDatos.Update()
End Sub
'Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click
' GvDatos.ExportToExcel("ReporteCxC_" & Now.ToShortDateString)
'End Sub
End Class