Commit inicial Ventas Productivo
This commit is contained in:
306
Finanzas/AnalisisCreditoCliente.aspx.vb
Normal file
306
Finanzas/AnalisisCreditoCliente.aspx.vb
Normal file
@@ -0,0 +1,306 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.IO
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
Partial Class Finanzas_AnalisisCreditoCliente
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
|
||||
Private Property DtVencido As DataTable
|
||||
Get
|
||||
DtVencido = CType(ViewState("DtVencido"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtVencido") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtRotacion As DataTable
|
||||
Get
|
||||
DtRotacion = CType(ViewState("DtRotacion"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtRotacion") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtSaldoMensual As DataTable
|
||||
Get
|
||||
DtSaldoMensual = CType(ViewState("DtSaldoMensual"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtSaldoMensual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtComportamientoVentas As DataTable
|
||||
Get
|
||||
DtComportamientoVentas = CType(ViewState("DtComportamientoVentas"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtComportamientoVentas") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
TxtFechaICredito.Text = Now.AddYears(-2).ToShortDateString
|
||||
TxtFechaFCredito.Text = Now.ToShortDateString
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetClienteVencido(-1, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then
|
||||
DtVencido = ObjClientes.DtResultados
|
||||
End If
|
||||
|
||||
If ObjClientes.GetRotacionCartera(-1, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then
|
||||
DtRotacion = ObjClientes.DtResultados
|
||||
End If
|
||||
|
||||
If ObjClientes.GetClienteSaldoMensual(-1, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then
|
||||
DtSaldoMensual = ObjClientes.DtResultados
|
||||
End If
|
||||
|
||||
If ObjClientes.GetClienteComportamientoVentaMensual(-1, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then
|
||||
DtComportamientoVentas = ObjClientes.DtResultados
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGraficas()
|
||||
|
||||
If Not DtVencido IsNot Nothing AndAlso Not DtVencido.Rows.Count > 0 Then
|
||||
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Saldo As Double = DtVencido.SUM("Saldo")
|
||||
Dim LimiteCredito As Double = DtVencido.Rows(0)("LimiteCreditoTotal").ToString.ToDouble
|
||||
|
||||
Dim Dt As New DataTable()
|
||||
Dt.Columns.Add("value")
|
||||
Dt.Columns.Add("date")
|
||||
For Each Dr As DataRow In DtVencido.Rows
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = Dt.NewRow()
|
||||
Row("value") = Dr("DiasVencidos").ToString
|
||||
Row("date") = ""
|
||||
Dt.Rows.Add(Row)
|
||||
Next
|
||||
|
||||
LblVencido.Text = DtVencido.SUM("Total", "DiasVencidos > 0").FormatoNumero
|
||||
LblPorVencer.Text = DtVencido.SUM("Total", "DiasVencidos <= 0").FormatoNumero
|
||||
|
||||
'Dim query = From s In Dt.AsEnumerable() Select New With {.date = "", .value = s("value").ToString()}
|
||||
'Dim json = Newtonsoft.Json.JsonConvert.SerializeObject(query)
|
||||
''RegistraScript($"CargaGraficaVencido({Dt.ToJson})", "22")
|
||||
|
||||
Dim Dt2 As New DataTable()
|
||||
Dt2.Columns.Add("limite")
|
||||
Dt2.Columns.Add("saldo")
|
||||
Dt2.Columns.Add("year")
|
||||
Dim Row2 As DataRow = Nothing
|
||||
Row2 = Dt2.NewRow()
|
||||
Row2("limite") = LimiteCredito
|
||||
Row2("saldo") = Saldo
|
||||
Row2("year") = ""
|
||||
Dt2.Rows.Add(Row2)
|
||||
'Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()}
|
||||
'Dim json2 = Newtonsoft.Json.JsonConvert.SerializeObject(query2)
|
||||
|
||||
RegistraScript($"CargaGraficaLimiteCredito({Dt2.ToJson})", "33")
|
||||
|
||||
If DtRotacion IsNot Nothing AndAlso DtRotacion.Rows.Count > 0 Then
|
||||
LblVentasModal.Text = DtRotacion.SUM("Ventas").ToString.FormatoNumero
|
||||
LblPagadoModal.Text = DtRotacion.SUM("Pagado").ToString.FormatoNumero
|
||||
LblRotacionModal.Text = DtRotacion.AVG("Rotacion").ToString.FormatoNumero
|
||||
LblDiasModal.Text = DtRotacion.SUM("Dias").ToString.FormatoNumero
|
||||
LblDiasCreditoModal.Text = DtRotacion.SUM("DiasCredito").ToString.FormatoNumero
|
||||
End If
|
||||
|
||||
Dim Dt3 As New DataTable()
|
||||
Dt3.Columns.Add("mes")
|
||||
|
||||
Dim Dt4 As New DataTable()
|
||||
Dt4.Columns.Add("balloonText")
|
||||
Dt4.Columns.Add("bullet")
|
||||
Dt4.Columns.Add("title")
|
||||
Dt4.Columns.Add("valueField")
|
||||
Dt4.Columns.Add("fillAlphas")
|
||||
Dt4.Columns.Add("hidden")
|
||||
|
||||
|
||||
Dim Cont As Integer = 1
|
||||
For Each Dr As DataRow In DtComportamientoVentas.Rows
|
||||
Dt3.Columns.Add(Dr("Ano").ToString)
|
||||
Dim Row4 As DataRow = Nothing
|
||||
Row4 = Dt4.NewRow()
|
||||
Row4("balloonText") = "Ventas [[category]]: [[value]]"
|
||||
Row4("bullet") = "round"
|
||||
Row4("title") = Dr("Ano").ToString
|
||||
Row4("valueField") = Dr("Ano").ToString
|
||||
Row4("fillAlphas") = 0
|
||||
Row4("hidden") = If(Cont > DtComportamientoVentas.Rows.Count - 3, False, True)
|
||||
Dt4.Rows.Add(Row4)
|
||||
Cont += 1
|
||||
Next
|
||||
|
||||
Dim RowEnero As DataRow = Nothing
|
||||
RowEnero = Dt3.NewRow()
|
||||
Dim RowFebrero As DataRow = Nothing
|
||||
RowFebrero = Dt3.NewRow()
|
||||
Dim RowMarzo As DataRow = Nothing
|
||||
RowMarzo = Dt3.NewRow()
|
||||
Dim RowAbril As DataRow = Nothing
|
||||
RowAbril = Dt3.NewRow()
|
||||
Dim RowMayo As DataRow = Nothing
|
||||
RowMayo = Dt3.NewRow()
|
||||
Dim RowJunio As DataRow = Nothing
|
||||
RowJunio = Dt3.NewRow()
|
||||
Dim RowJulio As DataRow = Nothing
|
||||
RowJulio = Dt3.NewRow()
|
||||
Dim RowAgosto As DataRow = Nothing
|
||||
RowAgosto = Dt3.NewRow()
|
||||
Dim RowSeptiembre As DataRow = Nothing
|
||||
RowSeptiembre = Dt3.NewRow()
|
||||
Dim RowOctubre As DataRow = Nothing
|
||||
RowOctubre = Dt3.NewRow()
|
||||
Dim RowNoviembre As DataRow = Nothing
|
||||
RowNoviembre = Dt3.NewRow()
|
||||
Dim RowDiciembre As DataRow = Nothing
|
||||
RowDiciembre = Dt3.NewRow()
|
||||
For Each Dr As DataRow In DtComportamientoVentas.Rows
|
||||
RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString
|
||||
RowEnero("mes") = "Enero"
|
||||
RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString
|
||||
RowFebrero("mes") = "Febrero"
|
||||
RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString
|
||||
RowMarzo("mes") = "Marzo"
|
||||
RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString
|
||||
RowAbril("mes") = "Abril"
|
||||
RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString
|
||||
RowMayo("mes") = "Mayo"
|
||||
RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString
|
||||
RowJunio("mes") = "Junio"
|
||||
RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString
|
||||
RowJulio("mes") = "Julio"
|
||||
RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString
|
||||
RowAgosto("mes") = "Agosto"
|
||||
RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString
|
||||
RowSeptiembre("mes") = "Septiembre"
|
||||
RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString
|
||||
RowOctubre("mes") = "Octubre"
|
||||
RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString
|
||||
RowNoviembre("mes") = "Noviembre"
|
||||
RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString
|
||||
RowDiciembre("mes") = "Diciembre"
|
||||
Next
|
||||
Dt3.Rows.Add(RowEnero)
|
||||
Dt3.Rows.Add(RowFebrero)
|
||||
Dt3.Rows.Add(RowMarzo)
|
||||
Dt3.Rows.Add(RowAbril)
|
||||
Dt3.Rows.Add(RowMayo)
|
||||
Dt3.Rows.Add(RowJunio)
|
||||
Dt3.Rows.Add(RowJulio)
|
||||
Dt3.Rows.Add(RowAgosto)
|
||||
Dt3.Rows.Add(RowSeptiembre)
|
||||
Dt3.Rows.Add(RowOctubre)
|
||||
Dt3.Rows.Add(RowNoviembre)
|
||||
Dt3.Rows.Add(RowDiciembre)
|
||||
|
||||
RegistraScript($"CargaGraficaComportamientoVentas({Dt3.ToJson},{Dt4.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44")
|
||||
|
||||
Dim Dt5 As New DataTable()
|
||||
Dt5.Columns.Add("mes")
|
||||
|
||||
Dim Dt6 As New DataTable()
|
||||
Dt6.Columns.Add("balloonText")
|
||||
Dt6.Columns.Add("bullet")
|
||||
Dt6.Columns.Add("title")
|
||||
Dt6.Columns.Add("valueField")
|
||||
Dt6.Columns.Add("fillAlphas")
|
||||
Dt6.Columns.Add("hidden")
|
||||
|
||||
Cont = 1
|
||||
For Each Dr As DataRow In DtSaldoMensual.Rows
|
||||
Dt5.Columns.Add(Dr("Ano").ToString)
|
||||
Dim Row6 As DataRow = Nothing
|
||||
Row6 = Dt6.NewRow()
|
||||
Row6("balloonText") = "Saldo [[category]]: [[value]]"
|
||||
Row6("bullet") = "round"
|
||||
Row6("title") = Dr("Ano").ToString
|
||||
Row6("valueField") = Dr("Ano").ToString
|
||||
Row6("fillAlphas") = 0
|
||||
Row6("hidden") = If(Cont > DtSaldoMensual.Rows.Count - 3, False, True)
|
||||
Dt6.Rows.Add(Row6)
|
||||
Cont += 1
|
||||
Next
|
||||
RowEnero = Dt5.NewRow()
|
||||
RowFebrero = Dt5.NewRow()
|
||||
RowMarzo = Dt5.NewRow()
|
||||
RowAbril = Dt5.NewRow()
|
||||
RowMayo = Dt5.NewRow()
|
||||
RowJunio = Dt5.NewRow()
|
||||
RowJulio = Dt5.NewRow()
|
||||
RowAgosto = Dt5.NewRow()
|
||||
RowSeptiembre = Dt5.NewRow()
|
||||
RowOctubre = Dt5.NewRow()
|
||||
RowNoviembre = Dt5.NewRow()
|
||||
RowDiciembre = Dt5.NewRow()
|
||||
For Each Dr As DataRow In DtSaldoMensual.Rows
|
||||
RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString
|
||||
RowEnero("mes") = "Enero"
|
||||
RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString
|
||||
RowFebrero("mes") = "Febrero"
|
||||
RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString
|
||||
RowMarzo("mes") = "Marzo"
|
||||
RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString
|
||||
RowAbril("mes") = "Abril"
|
||||
RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString
|
||||
RowMayo("mes") = "Mayo"
|
||||
RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString
|
||||
RowJunio("mes") = "Junio"
|
||||
RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString
|
||||
RowJulio("mes") = "Julio"
|
||||
RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString
|
||||
RowAgosto("mes") = "Agosto"
|
||||
RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString
|
||||
RowSeptiembre("mes") = "Septiembre"
|
||||
RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString
|
||||
RowOctubre("mes") = "Octubre"
|
||||
RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString
|
||||
RowNoviembre("mes") = "Noviembre"
|
||||
RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString
|
||||
RowDiciembre("mes") = "Diciembre"
|
||||
Next
|
||||
Dt5.Rows.Add(RowEnero)
|
||||
Dt5.Rows.Add(RowFebrero)
|
||||
Dt5.Rows.Add(RowMarzo)
|
||||
Dt5.Rows.Add(RowAbril)
|
||||
Dt5.Rows.Add(RowMayo)
|
||||
Dt5.Rows.Add(RowJunio)
|
||||
Dt5.Rows.Add(RowJulio)
|
||||
Dt5.Rows.Add(RowAgosto)
|
||||
Dt5.Rows.Add(RowSeptiembre)
|
||||
Dt5.Rows.Add(RowOctubre)
|
||||
Dt5.Rows.Add(RowNoviembre)
|
||||
Dt5.Rows.Add(RowDiciembre)
|
||||
|
||||
|
||||
RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55")
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
CargaGraficas()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user