Commit inicial Ventas Productivo
This commit is contained in:
187
AC/RepProgramaOperativo.aspx.vb
Normal file
187
AC/RepProgramaOperativo.aspx.vb
Normal file
@@ -0,0 +1,187 @@
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
|
||||
Partial Class AC_RepProgramaOperativo
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
|
||||
Private Property DtProgramaOperativo As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtProgramaOperativo"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtProgramaOperativo") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
SetValues()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " VALORES INICIALES "
|
||||
Private Sub SetValues()
|
||||
CargaEjercicios()
|
||||
End Sub
|
||||
Private Sub CargaEjercicios()
|
||||
Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
If ClsConta.GetEjercicios() Then
|
||||
DdlEjercicio.DataSource = ClsConta.DtResultados
|
||||
Else
|
||||
DdlEjercicio.DataSource = Nothing
|
||||
End If
|
||||
ClsConta.Dispose()
|
||||
DdlEjercicio.DataBind()
|
||||
|
||||
DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub CargaDatos()
|
||||
Dim objAC As New ClsAC
|
||||
Dim Ejercicio As Integer = DdlEjercicio.SelectedValue.ToString.ToEntero
|
||||
Dim EsProyecto As Boolean = CBool(DdlProyecto.SelectedValue.ToString)
|
||||
|
||||
BtnProyecto.Visible = False
|
||||
|
||||
If objAC.GetProgramasOperativos(-1, UsuarioActual.CveEmpresa, EsProyecto, Ejercicio) Then
|
||||
GVD.DataSource = objAC.DtResultados
|
||||
GlobalDTAC_ProgramaOperativo(-1) = objAC.DtResultados
|
||||
DtProgramaOperativo = objAC.DtResultados
|
||||
|
||||
'debe de haber datos para habilitar los botones
|
||||
If DtProgramaOperativo.Rows.Count > 0 Then
|
||||
If EsProyecto Then
|
||||
If DtProgramaOperativo.Rows(0)("Bloqueado").ToString = "0" Then
|
||||
BtnProyecto.Visible = True
|
||||
End If
|
||||
Else
|
||||
'si es anteproyecto
|
||||
If DtProgramaOperativo.Rows(0)("Bloqueado").ToString = "0" Then
|
||||
BtnProyecto.Visible = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
UPPDatos.Update()
|
||||
|
||||
objAC.Dispose()
|
||||
GVD.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub consultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub GVD_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVD.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
'Formato a columnas
|
||||
'e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
|
||||
'e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Center
|
||||
|
||||
'Se generan las ligas
|
||||
'e.Row.FCLiteral("LtlClave").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlClave").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlProgramaOperativo").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlProgramaOperativo").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlClasificacionFuncional").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlClasificacionFuncional").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlClasificacionAdministrativa").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlClasificacionAdministrativa").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlProgramaCONAC").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlProgramaCONAC").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlClasificacionGeografica").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlClasificacionGeografica").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlUM").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlUM").Text & "</a>"
|
||||
'e.Row.FCLiteral("LtlTotal").Text = "<a class=""Texto"" href=""/AC/ProgramaOperativo.aspx?CveProgramaOperativo=" & e.Row.DBCampo("CveProgramaOperativo") & """>" & e.Row.FCLiteral("LtlTotal").Text.FormatoNumero & "</a>"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnProyecto_Click(sender As Object, e As EventArgs) Handles BtnProyecto.Click
|
||||
Dim objAC As New ClsAC()
|
||||
objAC.IniciaTransacSQL()
|
||||
|
||||
'Dim Total As Double = txtTotal.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Enero As Double = txtEnero.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Febrero As Double = txtFebrero.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Marzo As Double = txtMarzo.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Abril As Double = txtAbril.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Mayo As Double = txtMayo.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Junio As Double = txtJunio.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Julio As Double = txtJulio.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Agosto As Double = txtAgosto.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Septiembre As Double = txtSeptiembre.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Octubre As Double = txtOctubre.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Noviembre As Double = txtNoviembre.Text.Replace(",", "").Trim.ToDouble
|
||||
'Dim Diciembre As Double = txtDiciembre.Text.Replace(",", "").Trim.ToDouble
|
||||
|
||||
Dim ErrorAC = False
|
||||
For Each dr As DataRow In DtProgramaOperativo.Rows
|
||||
If Not objAC.BloquearProgramaOperativo(dr("CveProgramaOperativo").ToString.ToEntero) Then
|
||||
ErrorAC = True
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorAC Then
|
||||
objAC.Commit()
|
||||
Alert("Los Programas Operativos se autorizaron correctamente", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("Ocurrió un error al bloquear los Programas Operativos ", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
|
||||
'If CveProgramaOperativo > 0 AndAlso Then
|
||||
' If objAC.ProyectoProgramaOperativo(txtClave.Text, txtProgramaOperativo.Text, CboClasificacionFuncional.SelectedValue.ToEntero, CboClasificacionAdministrativa.SelectedValue.ToEntero, CboProgramaCONAC.SelectedValue.ToEntero, CboClasificacionGeografica.SelectedValue.ToEntero,
|
||||
' txtProblematica.Text, txtCausa.Text, txtEfecto.Text, CboMeta.SelectedValue.ToEntero, CboUM.SelectedValue.ToEntero, Total,
|
||||
' Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre, DdlEjercicio.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProgramaOperativo) Then
|
||||
' Alert("El Programa Operativo se ACTUALIZO Correctamente como PROYECTO", TipoMensaje.MsgInformacion, "document.location.href=""/AC/RepProgramaOperativo.aspx""")
|
||||
' GlobalDTAC_ProgramaOperativo(-1) = objAC.DtResultados
|
||||
' End If
|
||||
'Else
|
||||
' Alert("ERROR", TipoMensaje.MsgError)
|
||||
'End If
|
||||
|
||||
'If EsProyecto = 1 Then
|
||||
' If objAC.BloquearProgramaOperativo(CveProgramaOperativo) Then
|
||||
' Alert("El Programa Operativo se ACTUALIZO Correctamente como PROYECTO AUTORIZADO", TipoMensaje.MsgInformacion, "document.location.href=""/AC/RepProgramaOperativo.aspx""")
|
||||
' End If
|
||||
'End If
|
||||
|
||||
objAC.Dispose()
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "I M P R I M I R "
|
||||
Protected Sub LBPdf_Click(sender As Object, e As EventArgs)
|
||||
ImprimirReporte()
|
||||
End Sub
|
||||
Protected Sub LBExcel_Click(sender As Object, e As EventArgs)
|
||||
ImprimirReporte("Excel")
|
||||
End Sub
|
||||
Protected Sub ImprimirReporte(Optional Formato As String = "PDF")
|
||||
'nombre del archivo a generar
|
||||
Dim fileName As String = "ReporteProgramaOperativo"
|
||||
'ubicacion del rdlc
|
||||
Dim reportpath As String = "AC/Reportes/RepProgramaOperativo.rdlc"
|
||||
|
||||
'parametros a enviar al reporte
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri))
|
||||
params.Add(New ReportParameter("pEjercicio", DdlEjercicio.SelectedValue.ToString))
|
||||
ImprimirPDF(reportpath, DtProgramaOperativo, params, fileName, Formato)
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user