diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 2853c3502..54044a384 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -1356,6 +1356,109 @@ Public Class ClsOIEventos End Function #End Region +#Region "Circular" + Public Function GetCircular(CveEmpresa As Integer, Optional CveCircular As Integer = -1, Optional FechaI As String = "-1", Optional FechaF As String = "-1") As Boolean + + FechaI = If(FechaI = "-1", Today.AddYears(-1).ToString, FechaI) + FechaF = If(FechaF = "-1", Today.AddYears(1).ToString, FechaF) + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_CircularesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCircular", SqlDbType.Int).Value = CveCircular + .Add("@FechaI", SqlDbType.DateTime).Value = FechaI + .Add("@FechaF", SqlDbType.DateTime).Value = FechaF + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCircular(Asunto As String, Circular As String, CorreosInternos As String, FechaIng As String, CveUsuario As Integer, CveEmpresa As Integer, Optional CorreosExternos As String = "-1") As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_CircularesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Circular", SqlDbType.VarChar).Value = Circular + .Add("@CorreosInternos", SqlDbType.VarChar).Value = CorreosInternos + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + .Add("@CorreosExternos", SqlDbType.VarChar).Value = CorreosExternos + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateCircular(CveCircular As Integer, Asunto As String, Circular As String, CorreosInternos As String, CorreosExternos As String, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_CircularesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCircular", SqlDbType.Int).Value = CveCircular + .Add("@Asunto", SqlDbType.VarChar).Value = Asunto + .Add("@Circular", SqlDbType.VarChar).Value = Circular + .Add("@CorreosInternos", SqlDbType.VarChar).Value = CorreosInternos + .Add("@CorreosExternos", SqlDbType.VarChar).Value = CorreosExternos + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function DeleteCircular(CveCircular As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_OI_CircularesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCircular", SqlDbType.Int).Value = CveCircular + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Circular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 7ebca2bba..c28990fb5 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3976,6 +3976,8 @@ Public Class ClsPaginas PaginaDict.Add("/Compras/CatPaqueteriasGuiasTipo.aspx".ToUpper(), 753) PaginaDict.Add("/Compras/RepEvaluacionesProveedores.aspx".ToUpper(), 754) PaginaDict.Add("/Ventas/RepTopClientesVentas.aspx".ToUpper(), 755) + PaginaDict.Add("/OI/Circular.aspx".ToUpper(), 756) + PaginaDict.Add("/OI/CircularDetalle.aspx".ToUpper(), 757) #End Region diff --git a/OI/Circular.aspx b/OI/Circular.aspx new file mode 100644 index 000000000..a7b7ad95d --- /dev/null +++ b/OI/Circular.aspx @@ -0,0 +1,75 @@ +<%@ Page Title="OI Circular" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Circular.aspx.vb" Inherits="OI_Circular" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Circular + + + + +
  • + Agregar Circular +
  • +
    +
    +
    + + + +
    +
    +
    + + "> + +
    +
    +
    +
    Fecha Inicial:
    +
    +
    + + + + +
    + + +
    +
    Fecha Final:
    +
    +
    + + + + +
    + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + +
    + + \ No newline at end of file diff --git a/OI/Circular.aspx.vb b/OI/Circular.aspx.vb new file mode 100644 index 000000000..f9649b090 --- /dev/null +++ b/OI/Circular.aspx.vb @@ -0,0 +1,32 @@ +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class OI_Circular + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + IniciarFiltros() + CargaDatos() + End If + End Sub + Private Sub IniciarFiltros() + Dim FechaI As DateTime = New DateTime(Today.Year, Today.Month, 1) + Dim FechaF As DateTime = New DateTime(Today.Year, Today.Month, 1).AddMonths(1).AddDays(-1) + TxtFechaI.Text = FechaI.ToString() + TxtFechaF.Text = FechaF.ToString + End Sub + Private Sub CargaDatos() + Dim ObjOI As New ClsOIEventos + If ObjOI.GetCircular(UsuarioActual.CveEmpresa, -1, TxtFechaI.Text, TxtFechaF.Text) Then + GvDatos.DataSource = ObjOI.DtResultados + End If + ObjOI.Dispose() + GvDatos.DataBind() + End Sub + + Protected Sub btConsultar_Click() Handles btConsultar.Click + CargaDatos() + End Sub +End Class diff --git a/OI/CircularDetalle.aspx b/OI/CircularDetalle.aspx new file mode 100644 index 000000000..61f187fd2 --- /dev/null +++ b/OI/CircularDetalle.aspx @@ -0,0 +1,97 @@ +<%@ Page Title="OI Circular" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CircularDetalle.aspx.vb" Inherits="OI_CircularDetalle" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Circular Detalle + + + + +
  • + Agregar Circular +
  • +
    +
    +
    + + + +
    +
    + + + <%--Cliente: --%> + <%----%> + <%----%> + <%-- + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + Asunto: +
    +
    + +
    +
    +
    +
    +
    + Para: +
    +
    + +
    +
    +
    +
    +
    + Correos Adicionales: +
    +
    + +
    +
    +
    +
    +
    + Circular: +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/OI/CircularDetalle.aspx.vb b/OI/CircularDetalle.aspx.vb new file mode 100644 index 000000000..c0f1202c5 --- /dev/null +++ b/OI/CircularDetalle.aspx.vb @@ -0,0 +1,79 @@ +Imports System.Data +Imports System.Linq +Imports Extensiones + +Partial Class OI_CircularDetalle + Inherits ClsPaginas + + Private Property CveCircular As Integer + Get + Return ViewState("CveCircular").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCircular") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargarCve() + ConfigurarBotones() + CargaDatos() + End If + End Sub + + Private Sub CargarCve() + Dim PreCveCircular As String = Request.Params("CveCircular").ToString + If IsNumeric(PreCveCircular) Then + CveCircular = PreCveCircular.ToEntero + End If + End Sub + + Private Sub ConfigurarBotones() + If CveCircular > 0 Then + BtnGuardar.Text = "Guardar" + BtnEliminar.Visible = True + Else + BtnGuardar.Text = "Actualizar" + End If + End Sub + + Private Sub CargaDatos() + If CveCircular > 0 Then + Dim ObjOI As New ClsOIEventos + If ObjOI.GetCircular(UsuarioActual.CveEmpresa, CveCircular) Then + Dim Circular As DataRow = ObjOI.DtResultados(0) + + TxtAsunto.Text = Circular.Item("Asunto") + TxtCorreo.Value = Circular.Item("CorreosInternos") + TxtCorreoAdicional.Value = Circular.Item("CorreosExternos") + TxtCircular.Value = Circular.Item("Circular") + + UpCliente.Update() + End If + ObjOI.Dispose() + End If + End Sub + + Private Sub BtnGuardar_Click() Handles BtnGuardar.Click + Dim ObjOI As New ClsOIEventos + If CveCircular > 0 Then + If ObjOI.UpdateCircular(CveCircular, TxtAsunto.Text, TxtCircular.Value, TxtCorreo.Value, TxtCorreoAdicional.Value, UsuarioActual.CveUsuario) Then + Alert("Actualizado correctamente") + End If + Else + Dim CorreoExtra As String = If(TxtCorreoAdicional.Value = "", "-1", TxtCorreoAdicional.Value) + If ObjOI.AddCircular(TxtAsunto.Text, TxtCircular.Value, TxtCorreo.Value, Today.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CorreoExtra) Then + Alert("Ingresado correctamente") + End If + End If + End Sub + + Private Sub BtnEliminar_Click() Handles BtnEliminar.Click + Dim ObjOI As New ClsOIEventos + If ObjOI.DeleteCircular(CveCircular) Then + Response.Redirect("~/OI/CircularDetalle.aspx?CveCircular=-1") + End If + ObjOI.Dispose() + End Sub +End Class