diff --git a/AF/CatActividades.aspx b/AF/CatActividades.aspx new file mode 100644 index 000000000..907d6a766 --- /dev/null +++ b/AF/CatActividades.aspx @@ -0,0 +1,82 @@ +<%@ Page Title="AF - Catálogo de Actividades" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatActividades.aspx.cs" Inherits="AF_CatActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividadedes + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatActividades.aspx.cs b/AF/CatActividades.aspx.cs new file mode 100644 index 000000000..8336030ab --- /dev/null +++ b/AF/CatActividades.aspx.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatActividades : ClsPaginas +{ + private int CveActividad + { + get + { + return ViewState["CveActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + DdlPuesto.DataSource = get_GlobalDTRHPuestos(UsuarioActual.CveEmpresa); + DdlPuesto.DataBind(); + DdlPuesto.Items.Insert(0,new ListItem("-1","Seleccione")); + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadD_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Agregar"; + TxtNombre.Text = ""; + DdlPuesto.SelectedValueExist(-1); + TxtCantidad.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividad.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + TxtNombre.Text = GvRow.DataKey("Nombre"); + DdlPuesto.SelectedValueExist(GvRow.DataKey("CvePuesto")); + TxtCantidad.Text = GvRow.DataKey("Cantidad"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarActividadD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveActividad = GvRow.DataKey("CveActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteActividades(CveActividad)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se eliminó la Actividad correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividad_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarActividad.Text == "Agregar") + { + if (ObjAF.AddActividades(TxtNombre.Text, DdlPuesto.SelectedValue.ToEntero(),TxtCantidad.Text.ToDecimal(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se agregó la Actividad correctamente"); + } + } + else + { + if (ObjAF.UpdateActividades(CveActividad,TxtNombre.Text, DdlPuesto.SelectedValue.ToEntero(), TxtCantidad.Text.ToDecimal(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + Alert("Se actualizó la Actividad correctamente"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarActividadD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckList.aspx b/AF/CatCheckList.aspx new file mode 100644 index 000000000..790db7f2a --- /dev/null +++ b/AF/CatCheckList.aspx @@ -0,0 +1,74 @@ +<%@ Page Title="AF - Catálogo de CheckList" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckList.aspx.cs" Inherits="AF_CatCheckList" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de CheckList + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckList.aspx.cs b/AF/CatCheckList.aspx.cs new file mode 100644 index 000000000..d488bf25c --- /dev/null +++ b/AF/CatCheckList.aspx.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckList : ClsPaginas +{ + private int CveCheckList + { + get + { + return ViewState["CveCheckList"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckList"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckList(-1, -1, -1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + DdlTipoServicio.Items.Clear(); + if (ObjAF.GetTiposServicios(-1,-1,-1,UsuarioActual.CveEmpresa)) + { + DdlTipoServicio.DataSource = ObjAF.DtResultados; + DdlTipoServicio.DataBind(); + DdlTipoServicio.Items.Insert(0, new ListItem("Seleccione","-1")); + } + + DdlCheckListActividad.Items.Clear(); + if (ObjAF.GetCheckListActividad(-1, -1)) + { + DdlCheckListActividad.DataSource = ObjAF.DtResultados; + DdlCheckListActividad.DataBind(); + DdlCheckListActividad.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarCheckList.Text = "Agregar"; + DdlTipoServicio.SelectedValueExist(-1); + DdlCheckListActividad.SelectedValueExist(-1); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckList = GvRow.DataKey("CveCheckList").ToEntero(); + DdlTipoServicio.SelectedValueExist(GvRow.DataKey("CveTipoServicio")); + DdlCheckListActividad.SelectedValueExist(GvRow.DataKey("CveCheckListActividad")); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckList = GvRow.DataKey("CveCheckList").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckList(CveCheckList)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se eliminó el CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckList(DdlTipoServicio.SelectedValue.ToEntero(), DdlCheckListActividad.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se agregó el CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckList(CveCheckList, DdlTipoServicio.SelectedValue.ToEntero(), DdlCheckListActividad.SelectedValue.ToEntero())) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se actualizó el CheckList correctamente"); + } + } + ObjAF.Dispose(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckListActividades.aspx b/AF/CatCheckListActividades.aspx new file mode 100644 index 000000000..e4179f25a --- /dev/null +++ b/AF/CatCheckListActividades.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="AF - Catálogo de Actividades de CheckList" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividades.aspx.cs" Inherits="AF_CatCheckListActividades" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Actividades de CheckList + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListActividades.aspx.cs b/AF/CatCheckListActividades.aspx.cs new file mode 100644 index 000000000..f21d58f7a --- /dev/null +++ b/AF/CatCheckListActividades.aspx.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListActividades : ClsPaginas +{ + private int CveCheckListActividad + { + get + { + return ViewState["CveCheckListActividad"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividad"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividad(-1, -1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + if (ObjAF.GetCheckListActividadGrupo(-1)) + { + DdlCheckListActividadGrupo.DataSource = ObjAF.DtResultados; + DdlCheckListActividadGrupo.DataBind(); + DdlCheckListActividadGrupo.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Agregar"; + TxtCheckListActividad.Text = ""; + DdlCheckListActividadGrupo.SelectedValueExist(-1); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarActividadCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + TxtCheckListActividad.Text = GvRow.DataKey("CheckListActividad"); + DdlCheckListActividadGrupo.SelectedValueExist(GvRow.DataKey("CveCheckListActividadGrupo")); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividad(CveCheckListActividad)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + Alert("Se eliminó la Actividad de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarActividadCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarActividadCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividad(TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero())) + { + Alert("Se agregó la Actividad de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividad(CveCheckListActividad, TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero())) + { + Alert("Se actualizó la Actividad de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckListActividadesGrupos.aspx b/AF/CatCheckListActividadesGrupos.aspx new file mode 100644 index 000000000..77121933f --- /dev/null +++ b/AF/CatCheckListActividadesGrupos.aspx @@ -0,0 +1,70 @@ +<%@ Page Title="AF - Catálogo de Grupos de CheckLists" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListActividadesGrupos.aspx.cs" Inherits="AF_CatCheckListActividadesGrupos" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Grupos de CheckLists + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListActividadesGrupos.aspx.cs b/AF/CatCheckListActividadesGrupos.aspx.cs new file mode 100644 index 000000000..516ccb505 --- /dev/null +++ b/AF/CatCheckListActividadesGrupos.aspx.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListActividadesGrupos : ClsPaginas +{ + private int CveCheckListActividadGrupo + { + get + { + return ViewState["CveCheckListActividadGrupo"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListActividadGrupo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListActividadGrupo(-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Agregar"; + TxtGrupoCheckList.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarGrupoCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + TxtGrupoCheckList.Text = GvRow.DataKey("CheckListActividadGrupo"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListActividadGrupo = GvRow.DataKey("CveCheckListActividadGrupo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListActividadGrupo(CveCheckListActividadGrupo)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + Alert("Se eliminó el Grupo de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarGrupoCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarGrupoCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListActividadGrupo(TxtGrupoCheckList.Text)) + { + Alert("Se agregó el Grupo de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListActividadGrupo(CveCheckListActividadGrupo, TxtGrupoCheckList.Text)) + { + Alert("Se actualizó el Grupo de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + } +} \ No newline at end of file diff --git a/AF/CatCheckListTipo.aspx b/AF/CatCheckListTipo.aspx new file mode 100644 index 000000000..518b59864 --- /dev/null +++ b/AF/CatCheckListTipo.aspx @@ -0,0 +1,70 @@ +<%@ Page Title="AF - Catálogo de Tipos de CheckLists" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatCheckListTipo.aspx.cs" Inherits="AF_CatCheckListTipo" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Tipos de CheckLists + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AF/CatCheckListTipo.aspx.cs b/AF/CatCheckListTipo.aspx.cs new file mode 100644 index 000000000..f3cdafa22 --- /dev/null +++ b/AF/CatCheckListTipo.aspx.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class AF_CatCheckListTipo : ClsPaginas +{ + private int CveCheckListTipo + { + get + { + return ViewState["CveCheckListTipo"].ToString().ToEntero(); + } + + set + { + ViewState["CveCheckListTipo"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsAF ObjAF = new ClsAF(); + if (ObjAF.GetCheckListTipo(-1)) + { + GvDatos.DataSource = ObjAF.DtResultados; + GvDatos.DataBind(); + } + + ObjAF.Dispose(); + } + + protected void BtnAgregarTipoCheckListD_Click(object sender, EventArgs e) + { + BtnAgregarTipoCheckList.Text = "Agregar"; + TxtTipoCheckList.Text = ""; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarTipoCheckList.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListTipo = GvRow.DataKey("CveCheckListTipo").ToEntero(); + TxtTipoCheckList.Text = GvRow.DataKey("CheckListTipo"); + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGrupoCheckListD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveCheckListTipo = GvRow.DataKey("CveCheckListTipo").ToEntero(); + ClsAF ObjAF = new ClsAF(); + if (ObjAF.DeleteCheckListTipo(CveCheckListTipo)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + Alert("Se eliminó el Grupo de CheckList correctamente"); + } + ObjAF.Dispose(); + } + + protected void BtnAgregarTipoCheckList_Click(object sender, EventArgs e) + { + ClsAF ObjAF = new ClsAF(); + if (BtnAgregarTipoCheckList.Text == "Agregar") + { + if (ObjAF.AddCheckListTipo(TxtTipoCheckList.Text)) + { + Alert("Se agregó el Tipo de CheckList correctamente"); + } + } + else + { + if (ObjAF.UpdateCheckListTipo(CveCheckListTipo, TxtTipoCheckList.Text)) + { + Alert("Se actualizó el Tipo de CheckList correctamente"); + } + } + ObjAF.Dispose(); + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGrupoCheckListD")); + } +} \ No newline at end of file diff --git a/AF/OrdenServicio.aspx.vb b/AF/OrdenServicio.aspx.vb deleted file mode 100644 index f95760d7e..000000000 --- a/AF/OrdenServicio.aspx.vb +++ /dev/null @@ -1,437 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.IO -Imports Extensiones -Imports GemBox.Spreadsheet -Imports Microsoft.Reporting.WebForms - -Partial Class AF_OrdenServicio - Inherits ClsPaginas - -#Region " PROPIEDADES" - - Property DT_Cabeceras As DataTable - Get - - If ViewState("DT_Cabeceras") Is Nothing Then - - Return New DataTable - Else - Return DirectCast(ViewState("DT_Cabeceras"), DataTable) - End If - - End Get - Set(value As DataTable) - ViewState("DT_Cabeceras") = value - End Set - End Property - - - Property DT_Datos As DataTable - Get - - If ViewState("DT_Datos") Is Nothing Then - Return New DataTable - Else - Return DirectCast(ViewState("DT_Datos"), DataTable) - End If - - End Get - Set(value As DataTable) - ViewState("DT_Datos") = value - End Set - End Property - - - Property ReporteBytes As Byte() - Get - If ViewState("ReporteBytes") Is Nothing Then - Return Nothing - Else - Return DirectCast(ViewState("ReporteBytes"), Byte()) - End If - End Get - Set(value As Byte()) - ViewState("ReporteBytes") = value - End Set - End Property - -#End Region - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - - CargaCombos() - 'CargaDatos() - - - TxtFecha.Text = $"{Now.Day.ToString("00")}/{Now.Month.ToString("00")}/{Now.Year}" - - End If - End Sub - - -#Region " CARGA PARAMETROS " - -#End Region - -#Region " CARGA COMBOS " - Protected Sub CargaCombos() - CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto) - LblSubProyecto2.Text = LblSubProyecto.Text - - - - - - End Sub - - -#End Region - -#Region " CARGA DATOS " - 'Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs) - ' CargaDatos() - - 'End Sub - - -#End Region - -#Region " GV DATOS " - - Private Sub CargaDatos() - - Dim ObjAF As New ClsAF - - If ObjAF.GetMetricasRegistro(DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, TxtFecha.Text.ToDate) Then - DT_Cabeceras = ObjAF.DSResultados.Tables(0) - DT_Datos = ObjAF.DSResultados.Tables(1) - - - If DT_Cabeceras.Rows.Count > 0 AndAlso DT_Datos.Rows.Count > 0 Then - BtnGuardar.Visible = True - Else - BtnGuardar.Visible = False - GvDatos.DataSource = Nothing - GvDatos.DataBind() - End If - - Else - GvDatos.DataSource = Nothing - GvDatos.DataBind() - BtnGuardar.Visible = False - End If - - ObjAF.Dispose() - - If DT_Datos.Rows.Count > 0 Then - CargaTablas() - End If - - UpGuardar.Update() - UpDatos.Update() - - End Sub - - Private Sub CargaTablas() - - Dim IDX_LIMPIAR As Integer = 1 - - For IDX_LIMPIAR = 1 To 15 - GvDatos.Columns(IDX_LIMPIAR).HeaderText = "" - GvDatos.Columns(IDX_LIMPIAR).Visible = False - Next - - Dim x As Integer = 0 - Dim limite As Integer = DT_Cabeceras.Rows.Count - 1 - - - For x = 0 To limite - GvDatos.Columns(x + 1).HeaderText = DT_Cabeceras.Rows(x)("Metrica").ToString - GvDatos.Columns(x + 1).Visible = True - Next x - - - GvDatos.DataSource = DT_Datos - GvDatos.DataBind() - - - - - 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 - - e.Row.FCDropDownList("DdlPersonal").DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("CveEstatusPersonal = 1") - e.Row.FCDropDownList("DdlPersonal").DataBind() - e.Row.FCDropDownList("DdlPersonal").Items.Insert(0, New ListItem("Selecione uno", "-1")) - - e.Row.FCDropDownList("DdlPersonal").SelectedValueExist(e.Row.DataKey("CvePersonaResponsable")) - - End If - - End Sub - -#End Region - - Protected Sub LnkEliminarMetricaValor_Click(sender As Object, e As EventArgs) - - End Sub - - Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) - - If DdlSubProyecto.SelectedValue.ToEntero > 0 Then - CargaDatos() - - Else - GvDatos.DataSource = Nothing - GvDatos.DataBind() - - UpDatos.Update() - - End If - - End Sub - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - - - Dim ObjAF As New ClsAF - Dim limite As Integer = DT_Cabeceras.Rows.Count - 1 - - ObjAF.IniciaTransacSQL() - - Dim ErrorProceso As Boolean = False - - For Each GvRow As GridViewRow In GvDatos.Rows - If GvRow.RowType = DataControlRowType.DataRow Then - - Dim DdlPersonal As DropDownList = GvRow.FCDropDownList("DdlPersonal") - - If DdlPersonal.SelectedValue.ToEntero <= 0 Then - Alert($"unidad: {GvRow.DataKey("Unidad")} require personal", TipoMensaje.MsgAdvertencia) - - ErrorProceso = True - Exit For - End If - - If ObjAF.AddMetricasValores(GvRow.DataKey("CveActivoFijo").ToEntero, DdlPersonal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveEmpresa) Then - - Dim CveMetricaValor As Integer = ObjAF.CveMetricaValor - Dim x As Integer = 0 - - For x = 0 To limite - Dim valor As Decimal = GvRow.FCTextBox($"TxtMetrica{x + 1}").Text.ToDecimal - - ' valor = If(valor.Trim.Length = 0, "0", valor) - If ObjAF.AddMetricasValoresDetalle(CveMetricaValor, DT_Cabeceras(x)("CveMetrica").ToString.ToEntero, valor) Then - ErrorProceso = False - Else - ErrorProceso = True - Exit For - End If - Next x - - If ErrorProceso Then - Exit For - End If - - Else - ErrorProceso = True - Exit For - End If - End If - - Next - - - If Not ErrorProceso Then - - ObjAF.Commit() - ExportToExcelG(GvDatos, $"RegistroRevision{Now.ToString("yyyyMMddmmss")}", UsuarioActual, "ReporteRevision", 100, 100, filtros:=$"Filtros {LblSubProyecto.Text}: {DdlSubProyecto.SelectedItem.Text} Fecha: {TxtFecha.Text}") - RegistraScript("$('#ModalDescargaReporte').modal({ backdrop: 'static', keyboard: false });") - GvDatos.DataSource = Nothing - GvDatos.DataBind() - - BtnGuardar.Visible = False - - UpDatos.Update() - UpGuardar.Update() - - Else - ObjAF.RollBack() - End If - - ObjAF.Dispose() - - End Sub - - - - -#Region "DESCARGA EXCEL" - - Public Sub ExportToExcelG(Gv1 As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional filtros As String = "") - - - - For Each GvRow As GridViewRow In Gv1.Rows - - Dim IDX_LIMPIAR As Integer = 1 - - For IDX_LIMPIAR = 1 To 15 - GvRow.Cells(IDX_LIMPIAR).Text = GvRow.FCTextBox($"TxtMetrica{IDX_LIMPIAR}").Text - Next - - If GvRow.FCDropDownList("DDLPersonal").SelectedValue.ToEntero > 0 Then - GvRow.Cells(16).Text = GvRow.FCDropDownList("DDLPersonal").SelectedItem.Text - Else - GvRow.Cells(16).Text = "" - End If - - Next - - - - Dim sw1 As New StringWriter() - Dim htw1 As New HtmlTextWriter(sw1) - Gv1.RenderControl(htw1) - - Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault - Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) - - htmlStream1.Position = 0 - Dim sr1 As New StreamReader(htmlStream1) - Dim myStr1 = sr1.ReadToEnd() - - sr1.Dispose() - htmlStream1.Dispose() - sw1.Dispose() - - Dim HtmlCompleto As String = myStr1 - - - HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") - - Dim asd As String = "" - - - Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) - - GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet()) - - Dim excel As GemBox.Spreadsheet.ExcelFile - - excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) - - If Usuario IsNot Nothing Then - Dim TotalRowHeader As Integer = 8 - Dim TotalRowFooter As Integer = 2 - - Dim worksheet = excel.Worksheets(0) - worksheet.Rows.InsertEmpty(0, TotalRowHeader) - Dim celdasConTexto = worksheet.GetUsedCellRange(True) - celdasConTexto.Style.Font.Name = "Calibri Light" - - Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) - RangoNombreEmpresa.Merged = True - RangoNombreEmpresa.Value = Usuario.Empresa.Empresa - RangoNombreEmpresa.Style.Font.Size = 18 * 20 - RangoNombreEmpresa.Style.Font.Name = "Calibri Light" - RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) - RangoFiltros.Merged = True - RangoFiltros.Value = filtros - RangoFiltros.Style.Font.Size = 15 * 20 - RangoFiltros.Style.Font.Name = "Calibri Light" - RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left - RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) - RangoTitulo.Merged = True - RangoTitulo.Value = Titulo - RangoTitulo.Style.Font.Size = 20 * 20 - RangoTitulo.Style.Font.Name = "Calibri Light" - RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 - worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - - - - - If i > 0 Then - Try - worksheet.Columns(i).AutoFit(1) - Catch ex As Exception - End Try - End If - - Next - - Dim IndexEndTable As Integer = Gv1.Rows.Count + 4 + TotalRowHeader + TotalRowFooter - - worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" - worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre - - worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" - worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) - - If Imagen.Exists Then - Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) - Using sr As New StreamReader(Ruta) - Dim ms As New MemoryStream() - sr.BaseStream.CopyTo(ms) - worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) - End Using - End If - - End If - - - - - Dim memoryStream As New MemoryStream() - excel.Save(memoryStream, SaveOptions.XlsxDefault) - ReporteBytes = memoryStream.ToArray() - memoryStream.Dispose() - - End Sub - - - Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs) - - - Response.ContentType = "application/force-download" - Response.AppendHeader("Content-Disposition", $"attachment;filename=RegistroRevision{Now.ToString("yyyyMMddmmss")}.xlsx") - Response.BinaryWrite(ReporteBytes) - Response.End() - - End Sub - - - Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) - End Sub - -#End Region - - - -End Class diff --git a/AF/OrdenServicio.aspx b/AF/OrdenTrabajo.aspx similarity index 72% rename from AF/OrdenServicio.aspx rename to AF/OrdenTrabajo.aspx index 36780ba5a..955d449d4 100644 --- a/AF/OrdenServicio.aspx +++ b/AF/OrdenTrabajo.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OrdenServicio.aspx.vb" Inherits="AF_OrdenServicio" EnableEventValidation = "false" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OrdenTrabajo.aspx.vb" Inherits="AF_OrdenTrabajo" EnableEventValidation = "false" %> @@ -74,33 +74,31 @@
    - -
    -
    - -
    - - - - -
    - - - - - +
    + + + +
    - +
    + + + + + +
    @@ -112,43 +110,7 @@ -<%--
    -
    -
    - - - - - - -
    -
    - -
    - - -
    -
    - -
    -
    Fecha:
    -
    - - - - -
    -
    - - -
    -
    - -
    --%> + @@ -162,12 +124,7 @@ GridLines="None"> - <%-- - - - - - --%> + @@ -339,14 +296,14 @@

    Metricas guardadas correctamente.

    - - Descarga Reporte Excel + <%-- + Descarga Reporte Excel--%>
    - + <%-- --%> diff --git a/AF/OrdenTrabajo.aspx.vb b/AF/OrdenTrabajo.aspx.vb new file mode 100644 index 000000000..d7c2d7326 --- /dev/null +++ b/AF/OrdenTrabajo.aspx.vb @@ -0,0 +1,285 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.IO +Imports Extensiones +Imports GemBox.Spreadsheet +Imports Microsoft.Reporting.WebForms + +Partial Class AF_OrdenTrabajo + Inherits ClsPaginas + +#Region " PROPIEDADES" + + Property CveOrdenTrabajo As Integer + Get + If ViewState("CveOrdenTrabajo") Is Nothing Then + Return -1 + Else + Return ViewState("CveOrdenTrabajo").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveOrdenTrabajo") = value + End Set + End Property + + + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + + If Request("CveOrdenTrabajo") IsNot Nothing Then + CveOrdenTrabajo = Request("CveOrdenTrabajo").ToEntero + End If + + CargaCombos() + End If + End Sub + + +#Region " CARGA PARAMETROS " + +#End Region + +#Region " CARGA COMBOS " + Protected Sub CargaCombos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServicios(-1, -1, -1, UsuarioActual.CveEmpresa) Then + DdlTipoServicio.DataSource = ObjAF.DtResultados + Else + DdlTipoServicio.DataSource = Nothing + End If + + ObjAF.Dispose() + + DdlTipoServicio.DataBind() + DdlTipoServicio.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpFiltro.Update() + + + + End Sub + + +#End Region + +#Region " CARGA DATOS " + 'Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs) + ' CargaDatos() + + 'End Sub + + +#End Region + +#Region " GV DATOS " + + Private Sub CargaDatos() + + Dim ObjAF As New ClsAF + + + ObjAF.Dispose() + + + 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 + + + + End If + + End Sub + +#End Region + + Protected Sub LnkEliminarMetricaValor_Click(sender As Object, e As EventArgs) + + End Sub + + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + + + + + End Sub + + + + +#Region "DESCARGA EXCEL" + + 'Public Sub ExportToExcelG(Gv1 As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional filtros As String = "") + + + + ' For Each GvRow As GridViewRow In Gv1.Rows + + ' Dim IDX_LIMPIAR As Integer = 1 + + ' For IDX_LIMPIAR = 1 To 15 + ' GvRow.Cells(IDX_LIMPIAR).Text = GvRow.FCTextBox($"TxtMetrica{IDX_LIMPIAR}").Text + ' Next + + ' If GvRow.FCDropDownList("DDLPersonal").SelectedValue.ToEntero > 0 Then + ' GvRow.Cells(16).Text = GvRow.FCDropDownList("DDLPersonal").SelectedItem.Text + ' Else + ' GvRow.Cells(16).Text = "" + ' End If + + ' Next + + + + ' Dim sw1 As New StringWriter() + ' Dim htw1 As New HtmlTextWriter(sw1) + ' Gv1.RenderControl(htw1) + + ' Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + ' Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) + + ' htmlStream1.Position = 0 + ' Dim sr1 As New StreamReader(htmlStream1) + ' Dim myStr1 = sr1.ReadToEnd() + + ' sr1.Dispose() + ' htmlStream1.Dispose() + ' sw1.Dispose() + + ' Dim HtmlCompleto As String = myStr1 + + + ' HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") + + ' Dim asd As String = "" + + + ' Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) + + ' GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet()) + + ' Dim excel As GemBox.Spreadsheet.ExcelFile + + ' excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) + + ' If Usuario IsNot Nothing Then + ' Dim TotalRowHeader As Integer = 8 + ' Dim TotalRowFooter As Integer = 2 + + ' Dim worksheet = excel.Worksheets(0) + ' worksheet.Rows.InsertEmpty(0, TotalRowHeader) + ' Dim celdasConTexto = worksheet.GetUsedCellRange(True) + ' celdasConTexto.Style.Font.Name = "Calibri Light" + + ' Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + ' RangoNombreEmpresa.Merged = True + ' RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + ' RangoNombreEmpresa.Style.Font.Size = 18 * 20 + ' RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + ' RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + ' RangoFiltros.Merged = True + ' RangoFiltros.Value = filtros + ' RangoFiltros.Style.Font.Size = 15 * 20 + ' RangoFiltros.Style.Font.Name = "Calibri Light" + ' RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + ' RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + ' RangoTitulo.Merged = True + ' RangoTitulo.Value = Titulo + ' RangoTitulo.Style.Font.Size = 20 * 20 + ' RangoTitulo.Style.Font.Name = "Calibri Light" + ' RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + ' worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + ' worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + ' worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + + + + ' If i > 0 Then + ' Try + ' worksheet.Columns(i).AutoFit(1) + ' Catch ex As Exception + ' End Try + ' End If + + ' Next + + ' Dim IndexEndTable As Integer = Gv1.Rows.Count + 4 + TotalRowHeader + TotalRowFooter + + ' worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + ' worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre + + ' worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + ' worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") + + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + ' If Imagen.Exists Then + ' Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + ' Using sr As New StreamReader(Ruta) + ' Dim ms As New MemoryStream() + ' sr.BaseStream.CopyTo(ms) + ' worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + ' End Using + ' End If + + ' End If + + + + + ' Dim memoryStream As New MemoryStream() + ' excel.Save(memoryStream, SaveOptions.XlsxDefault) + ' ReporteBytes = memoryStream.ToArray() + ' memoryStream.Dispose() + + 'End Sub + + + 'Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs) + + + ' Response.ContentType = "application/force-download" + ' Response.AppendHeader("Content-Disposition", $"attachment;filename=RegistroRevision{Now.ToString("yyyyMMddmmss")}.xlsx") + ' Response.BinaryWrite(ReporteBytes) + ' Response.End() + + 'End Sub + + + 'Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + 'End Sub + +#End Region + + + +End Class diff --git a/AF/TipoOrdenTrabajo.aspx b/AF/TipoOrdenTrabajo.aspx new file mode 100644 index 000000000..907178821 --- /dev/null +++ b/AF/TipoOrdenTrabajo.aspx @@ -0,0 +1,376 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="TipoOrdenTrabajo.aspx.vb" Inherits="AF_TipoOrdenTrabajo" EnableEventValidation = "false" %> + + + + + + + + + + Tipo Servicio + + + + + +
  • + +
  • +
    +
    + + +
    + + + + + + + +
    +
    +
    +
    +
    + + + Tipo Servicio +
    +
    +
    + <%--
    +
    +
    + + +
    + +
    + + + + +
    + +
    + + + + +
    + +
    + + + + +
    + +<%--
    + + + + + +
    --%> + + +
    + + +
    + +
    +
    + + + +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + +
    + + + + + + + + + + + +
    +
    +
    + + + + + + + + +
    +
    + + +
    + + + + + + diff --git a/AF/TipoOrdenTrabajo.aspx.vb b/AF/TipoOrdenTrabajo.aspx.vb new file mode 100644 index 000000000..f559d1da8 --- /dev/null +++ b/AF/TipoOrdenTrabajo.aspx.vb @@ -0,0 +1,617 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.IO +Imports Extensiones +Imports GemBox.Spreadsheet +Imports Microsoft.Reporting.WebForms + +Partial Class AF_TipoOrdenTrabajo + Inherits ClsPaginas + +#Region " PROPIEDADES" + + Property CveTipoServicio As Integer + Get + If ViewState("CveTipoServicio") Is Nothing Then + Return -1 + Else + Return ViewState("CveTipoServicio").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveTipoServicio") = value + End Set + End Property + + Property DTMateriales As DataTable + Get + If ViewState("DTMateriales") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTMateriales"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTMateriales") = value + End Set + End Property + + + Property DTActividades As DataTable + Get + If ViewState("DTActividades") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTActividades"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTActividades") = value + End Set + End Property + + + Property DTACheckList As DataTable + Get + If ViewState("DTACheckList") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTACheckList"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTACheckList") = value + End Set + End Property + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + + If Request("CveTipoServicio") IsNot Nothing Then + CveTipoServicio = Request("CveTipoServicio").ToEntero + End If + + If CveTipoServicio = -1 Then + CrearTablas() + End If + + CargaCombos() + End If + End Sub + + + + Property IndexMaterial As Integer + Get + If ViewState("IndexMaterial") Is Nothing Then + Return -1 + Else + Return ViewState("IndexMaterial").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("IndexMaterial") = value + End Set + End Property + + + + Property IndexActividades As Integer + Get + If ViewState("IndexActividades") Is Nothing Then + Return -1 + Else + Return ViewState("IndexActividades").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("IndexActividades") = value + End Set + End Property + + Property IndexCheckList As Integer + Get + If ViewState("IndexCheckList") Is Nothing Then + Return -1 + Else + Return ViewState("IndexCheckList").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("IndexCheckList") = value + End Set + End Property + + + + +#Region " CARGA PARAMETROS " + +#End Region + +#Region " CARGA COMBOS " + + Protected Sub CargaCombos() + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposMantenimiento(-1) Then + DdlTipoMantenimiento.DataSource = ObjAF.DtResultados + Else + DdlTipoMantenimiento.DataSource = Nothing + End If + + ObjAF.Dispose() + + DdlTipoMantenimiento.DataBind() + DdlTipoMantenimiento.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpFiltro.Update() + + DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + + If CveTipoServicio <= 0 Then + CargaActividades() + + End If + + End Sub + + + + + +#End Region + +#Region "CREAR TABLAS" + + Private Sub CrearTablas() + 'CveTipoServicioMaterial CveTipoServicio Cantidad CveUM CvePS Tipo + + Dim DtTempMaterial As New DataTable + Dim DtTempActividades As New DataTable + + DtTempMaterial.Columns.Add("CveTipoServicioMaterial", GetType(Integer)) + DtTempMaterial.Columns.Add("CveTipoServicio", GetType(Integer)) + DtTempMaterial.Columns.Add("Cantidad", GetType(Decimal)) + DtTempMaterial.Columns.Add("CveUM", GetType(Integer)) + DtTempMaterial.Columns.Add("CvePS", GetType(Integer)) + DtTempMaterial.Columns.Add("Tipo", GetType(Integer)) + DtTempMaterial.Columns.Add("PS", GetType(String)) + DtTempMaterial.Columns.Add("Abreviatura", GetType(String)) + DtTempMaterial.AcceptChanges() + + DTMateriales = DtTempMaterial + + + 'CveTipoServicioActividad CveActividad Duracion Observaciones + + DtTempActividades.Columns.Add("CveTipoServicioActividad", GetType(String)) + DtTempActividades.Columns.Add("CveActividad", GetType(String)) + DtTempActividades.Columns.Add("Duracion", GetType(Decimal)) + DtTempActividades.Columns.Add("Observaciones", GetType(String)) + DtTempActividades.AcceptChanges() + + DTActividades = DtTempActividades + + + End Sub + + +#End Region + + +#Region " CARGA DATOS " + 'Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs) + ' CargaDatos() + + 'End Sub + + +#End Region + +#Region " GV DATOS " + + Private Sub CargaDatos() + + CargaMateriales() + CargaActividades() + CargaCheckList() + + End Sub + + Private Sub CargaMateriales() + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.GetTiposServiciosMaterial(-1, CveTipoServicio) Then + GvMaterial.DataSource = DTMateriales + + Else + GvMaterial = Nothing + End If + + ObjAF.Dispose() + + GvMaterial.DataBind() + Else + GvMaterial.DataSource = DTMateriales + GvMaterial.DataBind() + End If + + UpGvMaterial.Update() + + End Sub + + Private Sub CargaActividades() + + Dim ObjAF As New ClsAF + + If CveTipoServicio <= 0 Then + + If ObjAF.GetActividades(-1, -1, -1, UsuarioActual.CveEmpresa) Then + GvActividades.DataSource = ObjAF.DtResultados + Else + GvActividades.DataSource = Nothing + End If + + End If + + ObjAF.Dispose() + + GvActividades.DataBind() + + UpGvActividades.Update() + + End Sub + + Private Sub CargaCheckList() + + Dim ObjAF As New ClsAF + + + ObjAF.Dispose() + + + End Sub + + + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + + + End If + + End Sub + +#End Region + + + + + + + + +#Region "DESCARGA EXCEL" + + 'Public Sub ExportToExcelG(Gv1 As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional filtros As String = "") + + + + ' For Each GvRow As GridViewRow In Gv1.Rows + + ' Dim IDX_LIMPIAR As Integer = 1 + + ' For IDX_LIMPIAR = 1 To 15 + ' GvRow.Cells(IDX_LIMPIAR).Text = GvRow.FCTextBox($"TxtMetrica{IDX_LIMPIAR}").Text + ' Next + + ' If GvRow.FCDropDownList("DDLPersonal").SelectedValue.ToEntero > 0 Then + ' GvRow.Cells(16).Text = GvRow.FCDropDownList("DDLPersonal").SelectedItem.Text + ' Else + ' GvRow.Cells(16).Text = "" + ' End If + + ' Next + + + + ' Dim sw1 As New StringWriter() + ' Dim htw1 As New HtmlTextWriter(sw1) + ' Gv1.RenderControl(htw1) + + ' Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + ' Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) + + ' htmlStream1.Position = 0 + ' Dim sr1 As New StreamReader(htmlStream1) + ' Dim myStr1 = sr1.ReadToEnd() + + ' sr1.Dispose() + ' htmlStream1.Dispose() + ' sw1.Dispose() + + ' Dim HtmlCompleto As String = myStr1 + + + ' HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") + + ' Dim asd As String = "" + + + ' Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) + + ' GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet()) + + ' Dim excel As GemBox.Spreadsheet.ExcelFile + + ' excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) + + ' If Usuario IsNot Nothing Then + ' Dim TotalRowHeader As Integer = 8 + ' Dim TotalRowFooter As Integer = 2 + + ' Dim worksheet = excel.Worksheets(0) + ' worksheet.Rows.InsertEmpty(0, TotalRowHeader) + ' Dim celdasConTexto = worksheet.GetUsedCellRange(True) + ' celdasConTexto.Style.Font.Name = "Calibri Light" + + ' Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + ' RangoNombreEmpresa.Merged = True + ' RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + ' RangoNombreEmpresa.Style.Font.Size = 18 * 20 + ' RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + ' RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + ' RangoFiltros.Merged = True + ' RangoFiltros.Value = filtros + ' RangoFiltros.Style.Font.Size = 15 * 20 + ' RangoFiltros.Style.Font.Name = "Calibri Light" + ' RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + ' RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + ' Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + ' RangoTitulo.Merged = True + ' RangoTitulo.Value = Titulo + ' RangoTitulo.Style.Font.Size = 20 * 20 + ' RangoTitulo.Style.Font.Name = "Calibri Light" + ' RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + ' worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + ' worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + ' worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + ' worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + + + + ' If i > 0 Then + ' Try + ' worksheet.Columns(i).AutoFit(1) + ' Catch ex As Exception + ' End Try + ' End If + + ' Next + + ' Dim IndexEndTable As Integer = Gv1.Rows.Count + 4 + TotalRowHeader + TotalRowFooter + + ' worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + ' worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre + + ' worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + ' worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") + + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + ' If Imagen.Exists Then + ' Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + ' Using sr As New StreamReader(Ruta) + ' Dim ms As New MemoryStream() + ' sr.BaseStream.CopyTo(ms) + ' worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + ' End Using + ' End If + + ' End If + + + + + ' Dim memoryStream As New MemoryStream() + ' excel.Save(memoryStream, SaveOptions.XlsxDefault) + ' ReporteBytes = memoryStream.ToArray() + ' memoryStream.Dispose() + + 'End Sub + + + 'Protected Sub LnkDescargaReporte_Click(sender As Object, e As EventArgs) + + + ' Response.ContentType = "application/force-download" + ' Response.AppendHeader("Content-Disposition", $"attachment;filename=RegistroRevision{Now.ToString("yyyyMMddmmss")}.xlsx") + ' Response.BinaryWrite(ReporteBytes) + ' Response.End() + + 'End Sub + + + 'Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + 'End Sub + +#End Region + + + + Protected Sub LnkAgregarMaterial_Click(sender As Object, e As EventArgs) + + RegistraScript("$('#ModalMateriales').modal('show');") + ResetModalMaterial() + End Sub + + Private Sub ResetModalMaterial() + + DdlPS.txtValue.Value = "" + DdlPS.txtText.Value = "" + TxtCantidad.Text = "" + + UpModalMaterialesBody.Update() + + End Sub + + + + + Protected Sub BtnGuardarMaterial_Click(sender As Object, e As EventArgs) + + If DdlPS.txtValue.Value.ToString.ToEntero <= 0 Then + Alert("Debe seleccionar un producto o servicio", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveUnidadMedida As Integer = -1 + Dim CvePS As Integer = DdlPS.txtValue.Value.ToEntero + Dim Tipo As Integer = -1 + Dim UMAbreviatura As String = "" + + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + CveUnidadMedida = drPS("CveUM").ToString.ToEntero + Tipo = drPS("CveTipoPS").ToString.ToEntero + UMAbreviatura = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Abreviatura", $"CveUnidadMedida = {CveUnidadMedida}") + + If CveTipoServicio > 0 Then + + Dim ObjAF As New ClsAF + + If ObjAF.AddTiposServiciosMaterial(CveTipoServicio, TxtCantidad.Text.ToDecimal, CveUnidadMedida, CvePS, Tipo) Then + Alert("Material agregado correctamente") + End If + + ObjAF.Dispose() + + Else + + Dim nRow As DataRow = DTMateriales.NewRow + + nRow("CveTipoServicioMaterial") = -1 + nRow("CveTipoServicio") = -1 + nRow("Cantidad") = TxtCantidad.Text.ToEntero + nRow("CveUM") = CveUnidadMedida + nRow("CvePS") = DdlPS.txtValue.Value.ToEntero + nRow("Tipo") = Tipo + nRow("Abreviatura") = UMAbreviatura + nRow("PS") = DdlPS.txtText.Value + + DTMateriales.Rows.Add(nRow) + Alert("Material agregado correctamente") + + End If + + CargaMateriales() + + ResetModalMaterial() + + RegistraScript("$('#ModalMateriales').modal('hide');") + + End Sub + + Protected Sub LnkEliminarMaterial_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) + If CveTipoServicio > 0 Then + + + Dim CveTipoServicioMaterial As Integer = GvRow.DataKey("CveTipoServicioMaterial").ToEntero + + Dim ObjAF As New ClsAF + If ObjAF.DeleteTiposServiciosMaterial(CveTipoServicioMaterial, UsuarioActual.CveEmpresa) Then + Alert("Material agregado correctamente") + End If + ObjAF.Dispose() + Else + + + Dim dr As DataRow = DTMateriales.Rows(GvRow.RowIndex) + dr.Delete() + DTMateriales.AcceptChanges() + Alert("Material agregado correctamente") + End If + + CargaMateriales() + + End Sub + + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + + Dim ObjAF As New ClsAF + Dim ErrorProceso As Boolean = False + Dim SBError As New StringBuilder + + ObjAF.IniciaTransacSQL() + + 'validacion? + + + + If ObjAF.AddTiposServicios(TxtTipoServicio.Text.Trim, DdlTipoMantenimiento.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + + + CveTipoServicio = ObjAF.CveTipoServicio + + For Each GvRow As GridViewRow In GvMaterial.Rows + + If Not ObjAF.AddTiposServiciosMaterial(CveTipoServicio, GvRow.DataKey("Cantidad").ToDecimal, GvRow.DataKey("CveUM").ToEntero, GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("Tipo").ToEntero) Then + ErrorProceso = True + Exit For + End If + + Next + + For Each GvRow As GridViewRow In GvActividades.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim Horas As Decimal = GvRow.FCTextBox("").Text.ToDecimal + + + If ObjAF.AddTiposServiciosActividades(GvRow.DataKey("").ToEntero) Then + + Next + + + End If + + + If ErrorProceso Then + ObjAF.RollBack() + Else + ObjAF.Commit() + Alert("Tipo servicio guardado correctamente.", TipoMensaje.MsgInformacion) + End If + + + ObjAF.Dispose() + + End Sub + +End Class diff --git a/App_Code/ClsAF.vb b/App_Code/ClsAF.vb index e1402fd73..c66beb356 100644 --- a/App_Code/ClsAF.vb +++ b/App_Code/ClsAF.vb @@ -89,10 +89,12 @@ Public Class ClsAF Public Property CveGrupoAF As Integer Public Property CveAFPadre As Integer Public Property CveDispositivo As Integer - Public Property MedidaVehicular As Integer - + Public Property MedidaVehicular As Integer + Public Property CveTipoServicio As Integer + + #End Region - + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) If TransaccionCompartida Is Nothing Then @@ -3502,7 +3504,7 @@ Public Class ClsAF Public Function AddTiposServicios(Nombre As String, CveTipoMantenimiento As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - + CveTipoServicio = -1 DataAdapter("PA_AF_TiposServicioAdd") With SqlAdapter.SelectCommand.Parameters @@ -3510,10 +3512,16 @@ Public Class ClsAF .Add("@CveTipoMantenimiento", SqlDbType.Int).Value = CveTipoMantenimiento .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveTipoServicio", SqlDbType.Int).Direction = ParameterDirection.Output + + End With Try SqlAdapter.Fill(Data) + + CveTipoServicio = SqlAdapter.SelectCommand.Parameters("@CveTipoServicio").Value.ToString.ToEntero + Retorno = True Catch ex As Exception OnError("Ocurrió un error al agregar los tipos servicios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) @@ -3715,13 +3723,15 @@ Public Class ClsAF Return Retorno End Function - Public Function DeleteTiposServiciosMaterial(CveTipoServicioMaterial As Integer) As Boolean + Public Function DeleteTiposServiciosMaterial(CveTipoServicioMaterial As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_AF_TiposServiciosMaterialDelete") With SqlAdapter.SelectCommand.Parameters .Add("@CveTipoServicioMaterial", SqlDbType.Int).Value = CveTipoServicioMaterial + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With Try @@ -3775,6 +3785,387 @@ Public Class ClsAF Return Retorno End Function + Public Function AddActividades(Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .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 la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateActividades(CveActividad As Integer, Nombre As String, CvePuesto As Integer, Cantidad As Decimal, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + .Add("@Nombre", SqlDbType.NVarChar).Value = Nombre + .Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto + .Add("@Cantidad", SqlDbType.SmallMoney).Value = Cantidad + .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 actualizar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteActividades(CveActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_ActividadesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveActividad", SqlDbType.Int).Value = CveActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la actividad", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividadGrupo(CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividadGrupo(CveCheckListActividadGrupo As Integer, CheckListActividadGrupo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + .Add("@CheckListActividadGrupo", SqlDbType.NVarChar).Value = CheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividadGrupo(CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGrupoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el grupo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListTipo(CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListTipo(CveCheckListTipo As Integer, CheckListTipo As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + .Add("@CheckListTipo", SqlDbType.NVarChar).Value = CheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListTipo(CveCheckListTipo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListTipoDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListTipo", SqlDbType.Int).Value = CveCheckListTipo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckListActividad(CveCheckListActividad As Integer, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckListActividad(CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckListActividad(CveCheckListActividad As Integer, CheckListActividad As String, CveCheckListActividadGrupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + .Add("@CheckListActividad", SqlDbType.NVarChar).Value = CheckListActividad + .Add("@CveCheckListActividadGrupo", SqlDbType.Int).Value = CveCheckListActividadGrupo + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckListActividad(CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListActividadDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las actividades de CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddCheckList(CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateCheckList(CveCheckList As Integer, CveTipoServicio As Integer, CveCheckListActividad As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + .Add("@CveTipoServicio", SqlDbType.Int).Value = CveTipoServicio + .Add("@CveCheckListActividad", SqlDbType.Int).Value = CveCheckListActividad + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function DeleteCheckList(CveCheckList As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_AF_CheckListDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCheckList", SqlDbType.Int).Value = CveCheckList + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el CheckList", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #End Region diff --git a/App_Code/ClsCompProveedores.vb b/App_Code/ClsCompProveedores.vb index 7532b38b7..388666a47 100644 --- a/App_Code/ClsCompProveedores.vb +++ b/App_Code/ClsCompProveedores.vb @@ -1785,6 +1785,27 @@ Public Class ClsCompProveedores End Function + Public Function GetContratoProvedores(CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Prov_SAT_ContratosProveedoresGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al Obtener los contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveContrato(CveContrato As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -1812,7 +1833,7 @@ Public Class ClsCompProveedores - Public Function AddRePresentanteLegal(RepresentanteLegal As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Public Function AddRePresentanteLegal(RepresentanteLegal As String, CveUsuario As Integer, CveEmpresa As Integer, CveProveedor As Integer) As Boolean Dim Retorno As Boolean = False @@ -1822,6 +1843,7 @@ Public Class ClsCompProveedores .Add("@RepresentanteLegal", SqlDbType.VarChar).Value = RepresentanteLegal .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor End With Try diff --git a/App_Code/ClsEdocumentacion.vb b/App_Code/ClsEdocumentacion.vb index 878dbc95b..b06f629cf 100644 --- a/App_Code/ClsEdocumentacion.vb +++ b/App_Code/ClsEdocumentacion.vb @@ -458,7 +458,8 @@ Public Class ClsEdocumentacion Return Retorno End Function - Public Function DocumentacionElectronicaAuditoriaGet(CveProveedor As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional Modulo As Integer = 3, Optional Estatus As Integer = -1) As Boolean + Public Function DocumentacionElectronicaAuditoriaGet(CveProveedor As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional Modulo As Integer = 3, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, + Optional CveTipoContrato As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Edoc_DocumentacionElectronicaAuditoriaGet") @@ -471,6 +472,8 @@ Public Class ClsEdocumentacion .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Modulo", SqlDbType.Int).Value = Modulo .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveTipoContrato", SqlDbType.Int).Value = CveTipoContrato End With Try diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 80b8e3306..69f64de00 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -2728,7 +2728,7 @@ Public Class ClsGenerales #Region "P A Q U E T E R I A S G U I A S" Public Function AddPaqueteriasGuias(CvePaqueteria As Integer, CvePaqueteriaGuiaTipo As Integer, CveEstatus As Integer, CveSubProyecto As Integer, Fecha As String, Rastreo As String, Guia As String, NumCajas As Integer, Peso As Double, Dimensiones As String, FechaEstimada As String, Observaciones As String, CveUsuario As Integer, CveEmpresa As Integer, Optional ImplicaCosto As Boolean = True, - Optional EsEntregaInterna As Boolean = False) As Integer + Optional EsEntregaInterna As Boolean = False, Optional PolizaSeguro As String = "-1") As Integer Dim Retorno As Integer = -1 @@ -2755,6 +2755,7 @@ Public Class ClsGenerales .Add("@CvePaqueteriaGuiaTipo", SqlDbType.SmallInt).Value = CvePaqueteriaGuiaTipo .Add("@EsEntregaInterna", SqlDbType.Bit).Value = EsEntregaInterna + .Add("@PolizaSeguro", SqlDbType.NVarChar).Value = PolizaSeguro .Add("@CvePaqueteriaGuia", SqlDbType.Int).Direction = ParameterDirection.Output diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index 4a1cd26ba..b12725805 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -1729,9 +1729,11 @@ Public Class ClsOC 'End Function #End Region - Public Function GetOrdenesCompraRep(Tipo As String, CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEstatus As Integer, - FechaInicio As Date, FechaFin As Date, CveOrdenCompra As Integer, CveProveedor As Integer, Folio As Integer, CveUsuarioRegistro As Integer, CveUsuario As Integer, CveEmpresa As Integer, CvePS As Integer, Optional PendientePorSurtir As Boolean = False, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", Optional CveActivoFijo As Integer = -1, - Optional SoloSubProyectosConPermiso As Boolean = False, Optional CveUsuarioAutorizo As Integer = -1, Optional TopSelect As Integer = 10000) As Boolean + Public Function GetOrdenesCompraRep(Tipo As String, CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEstatus As Integer, FechaInicio As Date, + FechaFin As Date, CveOrdenCompra As Integer, CveProveedor As Integer, Folio As Integer, CveUsuarioRegistro As Integer, CveUsuario As Integer, + CveEmpresa As Integer, CvePS As Integer, Optional PendientePorSurtir As Boolean = False, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", + Optional CveActivoFijo As Integer = -1, Optional SoloSubProyectosConPermiso As Boolean = False, Optional CveUsuarioAutorizo As Integer = -1, + Optional CveUsuarioAsignado As Integer = -1, Optional EntregaDirecta As Integer = -1, Optional TopSelect As Integer = 10000) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OC_OrdenesCompraRep") @@ -1757,6 +1759,8 @@ Public Class ClsOC .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso .Add("@CveUsuarioAutorizo", SqlDbType.Int).Value = CveUsuarioAutorizo + .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = CveUsuarioAsignado + .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta .Add("@TopSelect", SqlDbType.Int).Value = TopSelect End With @@ -1863,7 +1867,7 @@ Public Class ClsOC End Function Public Function GetOrdenesPendientes(pTipo As String, pTipoBusqueda As Integer, pCveEmpresa As Integer, pCveProyecto As Integer, pCveSubProyecto As Integer, pCveEstatusCompra As Integer, - pCveUsuario As Integer, CveCliente As Integer, Optional SoloSubProyectosConPermiso As Boolean = False) As Boolean + pCveUsuario As Integer, CveCliente As Integer, Optional SoloSubProyectosConPermiso As Boolean = False, Optional CveUsuarioAsignado As Integer = -1, Optional EntregaDirecta As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OC_OrdenesCompraPendientes") @@ -1878,6 +1882,8 @@ Public Class ClsOC .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@TipoBusqueda", SqlDbType.Int).Value = pTipoBusqueda .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso + .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = CveUsuarioAsignado + .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 628bf554b..1e93bc42a 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3955,6 +3955,16 @@ Public Class ClsPaginas PaginaDict.Add("/AF/CatTiposServicios.aspx".ToUpper(), 765) PaginaDict.Add("/AF/CatTiposServiciosActividades.aspx".ToUpper(), 766) PaginaDict.Add("/AF/CatTiposServiciosMateriales.aspx".ToUpper(), 767) + PaginaDict.Add("/AF/CatActividades.aspx".ToUpper(), 768) + PaginaDict.Add("/AF/CatCheckListActividadesGrupos.aspx".ToUpper(), 769) + PaginaDict.Add("/AF/CatCheckListTipo.aspx".ToUpper(), 770) + PaginaDict.Add("/AF/CatCheckListActividades.aspx".ToUpper(), 771) + PaginaDict.Add("/AF/CatCheckList.aspx".ToUpper(), 772) + + PaginaDict.Add("/AF/TipoOrdenTrabajo.aspx".ToUpper(), -1) + PaginaDict.Add("/AF/OrdenTrabajo.aspx".ToUpper(), -1) + PaginaDict.Add("/AF/RepOrdenTrabajo.aspx".ToUpper(), -1) + #End Region 'AIMMGM #Region "AIMMGM" diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 3ac5ef12b..7e1ee24e2 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -3839,7 +3839,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al agregar el Curso CursoAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al agregar el Curso CursoAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -3875,7 +3875,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al Actualizar el Curso CursoUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Actualizar el Curso CursoUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -3894,12 +3894,12 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo Retorno = True Catch exs As SqlException If exs.ErrorCode = -2146232060 Then - OnError("Ocurrió al Eliminar el Curso, Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Curso, Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else - OnError("Ocurrió al Eliminar el Curso CursoRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Curso CursoRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End If Catch ex As Exception - OnError("Ocurrió al Eliminar el Curso CursoRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Curso CursoRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try @@ -3924,7 +3924,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al consultar el reporte CursosRepGet.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al consultar el reporte CursosRepGet.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4115,7 +4115,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al agregar el Tema TemaAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al agregar el Tema TemaAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4140,7 +4140,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al Actualizar el Tema TemaUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió error al Actualizar el Tema TemaUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4161,9 +4161,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo If exs.Message.Contains("Número: 547;") Then - OnError("Ocurrió al Eliminar el Tema Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("El Tema no se puede eliminar porque tiene registros relacionados..", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else - OnError("Ocurrió al Eliminar el Tema TemasRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("El Tema no se puede eliminar porque tiene registros relacionados. TemasRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End If @@ -4174,7 +4174,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo 'End If Catch ex As Exception - OnError("Ocurrió al Eliminar el Tema TemasRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Tema TemasRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function @@ -4225,7 +4225,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al agregar el Subtema SubtemaAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al agregar el Subtema SubtemaAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4251,7 +4251,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al Actualizar el Subtema SubtemaUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Actualizar el Subtema SubtemaUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4270,12 +4270,12 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo Catch exs As SqlException If exs.ErrorCode = -2146232060 Then - OnError("Ocurrió al Eliminar el Subtema, Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Subtema, Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else - OnError("Ocurrió al Eliminar el Subtema SubtemaRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Subtema SubtemaRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End If Catch ex As Exception - OnError("Ocurrió al Eliminar el Subtema SubtemaRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Subtema SubtemaRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno End Function @@ -4329,7 +4329,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al agregar el Capacitador CapacitadorAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al agregar el Capacitador CapacitadorAdd.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4358,7 +4358,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió al Actualizar el Capacitador CapacitadorUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Actualizar el Capacitador CapacitadorUpdate.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno @@ -4376,12 +4376,12 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo Retorno = True Catch exs As SqlException If exs.ErrorCode = -2146232060 Then - OnError("Ocurrió al Eliminar el Tema Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Tema Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else - OnError("Ocurrió al Eliminar el Tema CapaditadorRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Tema CapaditadorRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End If Catch ex As Exception - OnError("Ocurrió al Eliminar el Tema CapacitadorRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + OnError("Ocurrió un error al Eliminar el Tema CapacitadorRemove.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index e3592c397..3e1fabf64 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -460,8 +460,7 @@ Public Class ClsVentas Optional TipoDocto As String = "Cot", Optional Vigencia As Date = MinFecha, Optional CondicionesPago As Integer = -1, Optional AtencionA As String = "-1", Optional PedidoContrato As String = "-1", Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Double = -1, - Optional RetISR As Double = -1, Optional Kilometraje As Double = 0, Optional CveVendedor As Integer = -1, Optional ObsAlm As String = "", Optional FormaPaqueteria As Integer = -1, - Optional CorreoNot As String = "-1") As Boolean + Optional RetISR As Double = -1, Optional Kilometraje As Double = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUpdate") @@ -492,10 +491,6 @@ Public Class ClsVentas .Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal .Add("@OrdenCompra", SqlDbType.VarChar).Value = OrdenCompra .Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@ObservacionesAlm", SqlDbType.NVarChar).Value = ObsAlm - .Add("@FormaPaqueteria", SqlDbType.Int).Value = FormaPaqueteria - .Add("@CorreoNotificacion", SqlDbType.NVarChar).Value = CorreoNot End With Try @@ -507,6 +502,32 @@ Public Class ClsVentas Return Retorno End Function + + Public Function UpdateObservacionesVenta(CveVenta As Integer, CveEmpresa As Integer, CveVendedor As Integer, Observaciones As String, FormaPaqueteria As Integer, CorreoNotificaciones As String, ObservacionesAlm As String, + Pedido As String, OrdenCompra As String, FechaPago As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasObservacionesUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Observaciones", SqlDbType.NVarChar).Value = Observaciones + .Add("@FormaPaqueteria", SqlDbType.Int).Value = FormaPaqueteria + .Add("@CorreoNotificaciones", SqlDbType.NVarChar).Value = CorreoNotificaciones + .Add("@ObservacionesAlm", SqlDbType.NVarChar).Value = ObservacionesAlm + .Add("@Pedido", SqlDbType.NVarChar).Value = Pedido + .Add("@OrdenCompra", SqlDbType.NVarChar).Value = OrdenCompra + .Add("@FechaPago", SqlDbType.Date).Value = FechaPago + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las observaciones de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") diff --git a/App_Code/DtDatos.xsd b/App_Code/DtDatos.xsd index 799552e6a..f64700eb6 100644 --- a/App_Code/DtDatos.xsd +++ b/App_Code/DtDatos.xsd @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -179,7 +179,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -235,10 +235,28 @@ + + - + + + + + + + + + + + + + + + + + @@ -271,22 +289,8 @@ - - - - - - - - - - - - - - - - + + diff --git a/App_Code/DtDatos.xss b/App_Code/DtDatos.xss index 6fa884b50..e0a664890 100644 --- a/App_Code/DtDatos.xss +++ b/App_Code/DtDatos.xss @@ -16,9 +16,9 @@ - - - + + + \ No newline at end of file diff --git a/App_WebReferences/RCGPSService/configuration91.svcinfo b/App_WebReferences/RCGPSService/configuration91.svcinfo index 74eb6fcf0..60a186b35 100644 --- a/App_WebReferences/RCGPSService/configuration91.svcinfo +++ b/App_WebReferences/RCGPSService/configuration91.svcinfo @@ -1,5 +1,5 @@ - + diff --git a/App_WebReferences/WSPenske/ReceiveGPSInfo.wsdl b/App_WebReferences/WSPenske/ReceiveGPSInfo.wsdl index b2c6f6577..73cde7e36 100644 --- a/App_WebReferences/WSPenske/ReceiveGPSInfo.wsdl +++ b/App_WebReferences/WSPenske/ReceiveGPSInfo.wsdl @@ -83,6 +83,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -103,6 +129,12 @@ + + + + + + @@ -116,6 +148,10 @@ + + + + @@ -146,6 +182,15 @@ + + + + + + + + + @@ -176,6 +221,15 @@ + + + + + + + + + diff --git a/App_WebReferences/WSRVConsultas/configuration91.svcinfo b/App_WebReferences/WSRVConsultas/configuration91.svcinfo index 95fb42f85..4f5b80053 100644 --- a/App_WebReferences/WSRVConsultas/configuration91.svcinfo +++ b/App_WebReferences/WSRVConsultas/configuration91.svcinfo @@ -1,5 +1,5 @@ - + diff --git a/App_WebReferences/WSRVConsultas/service1.wsdl b/App_WebReferences/WSRVConsultas/service1.wsdl index b7b24ac5b..acaf74ae5 100644 --- a/App_WebReferences/WSRVConsultas/service1.wsdl +++ b/App_WebReferences/WSRVConsultas/service1.wsdl @@ -153,6 +153,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -242,6 +279,12 @@ + + + + + + @@ -290,6 +333,11 @@ + + Consultar un CFDI directamente por UUID y Fecha + + + Consultar los CFDIs emitidos por rango de fecha @@ -366,6 +414,15 @@ + + + + + + + + + @@ -450,6 +507,15 @@ + + + + + + + + + diff --git a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd index 3794d9bb1..1e54f4ce6 100644 --- a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd +++ b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd @@ -3,7 +3,9 @@ + + diff --git a/App_WebReferences/wsValidaCFDi2/configuration91.svcinfo b/App_WebReferences/wsValidaCFDi2/configuration91.svcinfo index 03e1cea96..cf557a755 100644 --- a/App_WebReferences/wsValidaCFDi2/configuration91.svcinfo +++ b/App_WebReferences/wsValidaCFDi2/configuration91.svcinfo @@ -1,5 +1,5 @@ - + diff --git a/Ashx/GenerarPDFFactura.ashx b/Ashx/GenerarPDFFactura.ashx index e1b597879..d97b1c057 100644 --- a/Ashx/GenerarPDFFactura.ashx +++ b/Ashx/GenerarPDFFactura.ashx @@ -9,22 +9,26 @@ Imports Extensiones Imports System.IO Imports Microsoft.Reporting.WebForms +Imports ADSistemaLibrary.SatXml +Imports ADSistemaLibrary.SatXml.XmlSatCFDI + Public Class GenerarPDFFactura : Implements IHttpHandler - Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable - Get - Return False - End Get + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get End Property - Public ReadOnly Property EsProduccion As Boolean - Get - If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then - Return False - Else - Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") - End If - End Get + Public ReadOnly Property EsProduccion As Boolean + Get + Return False + 'If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then + ' Return False + 'Else + ' Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") + 'End If + End Get End Property Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest @@ -46,96 +50,211 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Dim Formato As String = "" - If datos.API_SALI Then - Formato = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReporteAPISali.rdlc" - Else - Formato = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReporteAPI.rdlc" - End If + Dim Xml = New System.Xml.XmlDocument() + Xml.LoadXml(datos.XML) + Dim ArchivoXML = $"{context.Server.MapPath("/")}/Temp/{DateTime.UtcNow.Ticks}_{datos.Factura.Serie}-{datos.Factura.Folio}.xml" + Xml.Save(ArchivoXML) - Parametros.Add(New ReportParameter("Empresa", datos.Empresa.Empresa)) - Parametros.Add(New ReportParameter("RFC", datos.Empresa.RFC)) - Parametros.Add(New ReportParameter("DomicilioExpedicion", datos.Empresa.DomicilioFiscal)) - Parametros.Add(New ReportParameter("Serie", datos.Factura.Serie)) - Parametros.Add(New ReportParameter("Folio", datos.Factura.Folio)) - Parametros.Add(New ReportParameter("Fecha", datos.Factura.Fecha)) - Parametros.Add(New ReportParameter("ClienteNombre", datos.Cliente.NombreComercial)) - Parametros.Add(New ReportParameter("ClienteDireccion", datos.Cliente.Calle + " Colonia " + datos.Cliente.Colonia + " " + datos.Cliente.Ciudad + ", " + datos.Cliente.Estado)) - Parametros.Add(New ReportParameter("ClienteLugar", datos.Cliente.Ciudad)) - Parametros.Add(New ReportParameter("ClienteRFC", datos.Cliente.RFC)) - Parametros.Add(New ReportParameter("ImporteLetra", datos.Factura.Total.Texto2Letras())) - Parametros.Add(New ReportParameter("FormaPago", datos.Factura.FormaPago)) - Parametros.Add(New ReportParameter("MetodoPago", datos.Factura.MetodoPago)) - Parametros.Add(New ReportParameter("SelloCFDI", datos.Timbrado.SelloCFDI)) - Parametros.Add(New ReportParameter("SelloSAT", datos.Timbrado.SelloSAT)) - Parametros.Add(New ReportParameter("CadenaOriginal", datos.Timbrado.CadenaOriginal)) - Parametros.Add(New ReportParameter("FolioFiscal", datos.Factura.UUID)) - Parametros.Add(New ReportParameter("SerieCertificadoSAT", datos.Timbrado.SerieCertificadoSAT)) - Parametros.Add(New ReportParameter("FechaCertificado", datos.Timbrado.FechaCertificado)) - Parametros.Add(New ReportParameter("CertificadoContribuyente", datos.Timbrado.CertificadoContribuyente)) - Parametros.Add(New ReportParameter("UsoCFDI", datos.Factura.UsoCFDI)) - Parametros.Add(New ReportParameter("Vencimiento", datos.Factura.FechaVencimiento)) - Parametros.Add(New ReportParameter("SubTotal", datos.Factura.SubTotal)) - Parametros.Add(New ReportParameter("Descuentos", datos.Factura.Descuentos)) - Parametros.Add(New ReportParameter("IVA", datos.Factura.IVA)) - Parametros.Add(New ReportParameter("IEPS", datos.Factura.IEPS)) - Parametros.Add(New ReportParameter("Total", datos.Factura.Total)) - Parametros.Add(New ReportParameter("QR", datos.Timbrado.QR)) + ImprimirbytesPDF(context, GenerarCFDi(context, ArchivoXML, datos), "Factura") - Dim DtDatos As New DataTable - DtDatos.Columns.Add(New DataColumn("Cantidad", GetType(Decimal))) - DtDatos.Columns.Add(New DataColumn("UnidadMedida", GetType(String))) - DtDatos.Columns.Add(New DataColumn("PS", GetType(String))) - DtDatos.Columns.Add(New DataColumn("PU", GetType(Decimal))) - DtDatos.Columns.Add(New DataColumn("IVA", GetType(Decimal))) - DtDatos.Columns.Add(New DataColumn("IEPS", GetType(Decimal))) - DtDatos.Columns.Add(New DataColumn("Descuento", GetType(Decimal))) - DtDatos.Columns.Add(New DataColumn("Total", GetType(Decimal))) + 'If datos.API_SALI Then + ' Dim Xml = New System.Xml.XmlDocument() + ' Xml.LoadXml(datos.XML) + ' Dim ArchivoXML = $"{context.Server.MapPath("/")}/Temp/{DateTime.UtcNow.Ticks}_{datos.Factura.Serie}-{datos.Factura.Folio}.xml" + ' Xml.Save(ArchivoXML) - Dim DtImpuestos As New DataTable - DtImpuestos.Columns.Add(New DataColumn("Impuesto", GetType(String))) - DtImpuestos.Columns.Add(New DataColumn("Tipo", GetType(String))) - DtImpuestos.Columns.Add(New DataColumn("Base", GetType(Decimal))) - DtImpuestos.Columns.Add(New DataColumn("TipoFactor", GetType(String))) - DtImpuestos.Columns.Add(New DataColumn("TasaOCuota", GetType(String))) - DtImpuestos.Columns.Add(New DataColumn("Importe", GetType(Decimal))) + ' ImprimirbytesPDF(context, GenerarCFDi(context, ArchivoXML, datos), "Factura") + 'Else + ' Formato = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReporteAPI.rdlc" - For Each PS In datos.Factura.ListaProductos - Dim Row = DtDatos.NewRow() - Row("Cantidad") = PS.Cantidad - Row("UnidadMedida") = PS.UnidadMedida - Row("PS") = PS.CodigoPS - Row("PU") = PS.PU - Row("IVA") = PS.IVA - Row("IEPS") = PS.IEPS - Row("Descuento") = PS.Descuento - Row("Total") = (PS.Cantidad * PS.PU) + PS.IVA + PS.IEPS + ' Parametros.Add(New ReportParameter("Empresa", datos.Empresa.Empresa)) + ' Parametros.Add(New ReportParameter("RFC", datos.Empresa.RFC)) + ' Parametros.Add(New ReportParameter("DomicilioExpedicion", datos.Empresa.DomicilioFiscal)) + ' Parametros.Add(New ReportParameter("Serie", datos.Factura.Serie)) + ' Parametros.Add(New ReportParameter("Folio", datos.Factura.Folio)) + ' Parametros.Add(New ReportParameter("Fecha", datos.Factura.Fecha)) + ' Parametros.Add(New ReportParameter("ClienteNombre", datos.Cliente.NombreComercial)) + ' Parametros.Add(New ReportParameter("ClienteDireccion", datos.Cliente.Calle + " Colonia " + datos.Cliente.Colonia + " " + datos.Cliente.Ciudad + ", " + datos.Cliente.Estado)) + ' Parametros.Add(New ReportParameter("ClienteLugar", datos.Cliente.Ciudad)) + ' Parametros.Add(New ReportParameter("ClienteRFC", datos.Cliente.RFC)) + ' Parametros.Add(New ReportParameter("ImporteLetra", datos.Factura.Total.Texto2Letras())) + ' Parametros.Add(New ReportParameter("FormaPago", datos.Factura.FormaPago)) + ' Parametros.Add(New ReportParameter("MetodoPago", datos.Factura.MetodoPago)) + ' Parametros.Add(New ReportParameter("SelloCFDI", datos.Timbrado.SelloCFDI)) + ' Parametros.Add(New ReportParameter("SelloSAT", datos.Timbrado.SelloSAT)) + ' Parametros.Add(New ReportParameter("CadenaOriginal", datos.Timbrado.CadenaOriginal)) + ' Parametros.Add(New ReportParameter("FolioFiscal", datos.Factura.UUID)) + ' Parametros.Add(New ReportParameter("SerieCertificadoSAT", datos.Timbrado.SerieCertificadoSAT)) + ' Parametros.Add(New ReportParameter("FechaCertificado", datos.Timbrado.FechaCertificado)) + ' Parametros.Add(New ReportParameter("CertificadoContribuyente", datos.Timbrado.CertificadoContribuyente)) + ' Parametros.Add(New ReportParameter("UsoCFDI", datos.Factura.UsoCFDI)) + ' Parametros.Add(New ReportParameter("Vencimiento", datos.Factura.FechaVencimiento)) + ' Parametros.Add(New ReportParameter("SubTotal", datos.Factura.SubTotal)) + ' Parametros.Add(New ReportParameter("Descuentos", datos.Factura.Descuentos)) + ' Parametros.Add(New ReportParameter("IVA", datos.Factura.IVA)) + ' Parametros.Add(New ReportParameter("IEPS", datos.Factura.IEPS)) + ' Parametros.Add(New ReportParameter("Total", datos.Factura.Total)) + ' Parametros.Add(New ReportParameter("QR", datos.Timbrado.QR)) - DtDatos.Rows.Add(Row) - Next + ' Dim DtDatos As New DataTable + ' DtDatos.Columns.Add(New DataColumn("Cantidad", GetType(Decimal))) + ' DtDatos.Columns.Add(New DataColumn("UnidadMedida", GetType(String))) + ' DtDatos.Columns.Add(New DataColumn("PS", GetType(String))) + ' DtDatos.Columns.Add(New DataColumn("PU", GetType(Decimal))) + ' DtDatos.Columns.Add(New DataColumn("IVA", GetType(Decimal))) + ' DtDatos.Columns.Add(New DataColumn("IEPS", GetType(Decimal))) + ' DtDatos.Columns.Add(New DataColumn("Descuento", GetType(Decimal))) + ' DtDatos.Columns.Add(New DataColumn("Total", GetType(Decimal))) - Dim RowImpuesto = DtImpuestos.NewRow() - RowImpuesto("Impuesto") = "IVA" - RowImpuesto("Tipo") = "Traslado" - RowImpuesto("Base") = datos.Factura.SubTotal - RowImpuesto("TipoFactor") = "Tasa" - RowImpuesto("TasaOCuota") = "16%" - RowImpuesto("Importe") = datos.Factura.IVA + ' Dim DtImpuestos As New DataTable + ' DtImpuestos.Columns.Add(New DataColumn("Impuesto", GetType(String))) + ' DtImpuestos.Columns.Add(New DataColumn("Tipo", GetType(String))) + ' DtImpuestos.Columns.Add(New DataColumn("Base", GetType(Decimal))) + ' DtImpuestos.Columns.Add(New DataColumn("TipoFactor", GetType(String))) + ' DtImpuestos.Columns.Add(New DataColumn("TasaOCuota", GetType(String))) + ' DtImpuestos.Columns.Add(New DataColumn("Importe", GetType(Decimal))) - DtImpuestos.Rows.Add(RowImpuesto) + ' For Each PS In datos.Factura.ListaProductos + ' Dim Row = DtDatos.NewRow() + ' Row("Cantidad") = PS.Cantidad + ' Row("UnidadMedida") = PS.UnidadMedida + ' Row("PS") = PS.CodigoPS + ' Row("PU") = PS.PU + ' Row("IVA") = PS.IVA + ' Row("IEPS") = PS.IEPS + ' Row("Descuento") = PS.Descuento + ' Row("Total") = (PS.Cantidad * PS.PU) + PS.IVA + PS.IEPS - ListaDS.Add(New ReportDataSource("DsProductos", DtDatos)) - ListaDS.Add(New ReportDataSource("DsImpuestos", DtImpuestos)) + ' DtDatos.Rows.Add(Row) + ' Next - ImprimirbytesPDF(context, StreamPDF(context, Formato, ListaDS, Parametros), "Factura") + ' Dim RowImpuesto = DtImpuestos.NewRow() + ' RowImpuesto("Impuesto") = "IVA" + ' RowImpuesto("Tipo") = "Traslado" + ' RowImpuesto("Base") = datos.Factura.SubTotal + ' RowImpuesto("TipoFactor") = "Tasa" + ' RowImpuesto("TasaOCuota") = "16%" + ' RowImpuesto("Importe") = datos.Factura.IVA + + ' DtImpuestos.Rows.Add(RowImpuesto) + + ' ListaDS.Add(New ReportDataSource("DsProductos", DtDatos)) + ' ListaDS.Add(New ReportDataSource("DsImpuestos", DtImpuestos)) + + ' ImprimirbytesPDF(context, StreamPDF(context, Formato, ListaDS, Parametros), "Factura") + 'End If + Else + retorno = "no hay datossss" End If Catch ex As Exception + retorno = ex.ToString() ex.GuardaLog(ex.ToString()) context.Response.Write(retorno) End Try End Sub + Private Function GenerarCFDi(ByVal context As HttpContext, RutaXml As String, datos As ParametroWS) As Byte() + Dim bytes As Byte() = Nothing + + Dim objxml As XmlSatCFDI = XmlSatCFDI.readXML(RutaXml) + + Dim rutaReporte As String = "\Empresas\Grales\Formatos\FacturaSALI.rdlc" + + Dim QR As ClbNegBICFDv3_2.ClsNegCBBGenerar = New ClbNegBICFDv3_2.ClsNegCBBGenerar() + Dim cQr As Byte() = QR.GenerarCBBBytes(objxml.emisor.Rfc, objxml.receptor.Rfc, objxml.comprobante.Total, objxml.complemento.UUID) + Dim parametros As List(Of ReportParameter) = New List(Of ReportParameter)() + parametros.Add(New ReportParameter("comprobante_Certificado", objxml.comprobante.Certificado)) + parametros.Add(New ReportParameter("comprobante_CondicionesDePago", objxml.comprobante.CondicionesDePago)) + parametros.Add(New ReportParameter("comprobante_Confirmacion", objxml.comprobante.Confirmacion)) + parametros.Add(New ReportParameter("comprobante_Fecha", objxml.comprobante.Fecha)) + parametros.Add(New ReportParameter("comprobante_Serie", objxml.comprobante.Serie)) + parametros.Add(New ReportParameter("comprobante_Folio", objxml.comprobante.Folio)) + parametros.Add(New ReportParameter("comprobante_Descuento", objxml.comprobante.Descuento.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_SubTotal", objxml.comprobante.SubTotal.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_Total", objxml.comprobante.Total.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_Version", objxml.comprobante.Version)) + parametros.Add(New ReportParameter("comprobante_TipoDeComprobante", objxml.comprobante.TipoDeComprobanteTexto)) + parametros.Add(New ReportParameter("comprobante_FormaPago", objxml.comprobante.FormaPagoTexto)) + parametros.Add(New ReportParameter("comprobante_LugarExpedicion", objxml.comprobante.LugarExpedicion)) + parametros.Add(New ReportParameter("comprobante_NoCertificado", objxml.comprobante.NoCertificado)) + parametros.Add(New ReportParameter("comprobante_Sello", objxml.comprobante.Sello)) + parametros.Add(New ReportParameter("comprobante_Moneda", objxml.comprobante.Moneda)) + parametros.Add(New ReportParameter("comprobante_TipoCambio", objxml.comprobante.TipoCambio.ToString("N2"))) + parametros.Add(New ReportParameter("comprobante_MetodoPago", objxml.comprobante.MetodoPagoTexto)) + parametros.Add(New ReportParameter("emisor_Rfc", objxml.emisor.Rfc)) + parametros.Add(New ReportParameter("emisor_Nombre", objxml.emisor.Nombre)) + parametros.Add(New ReportParameter("emisor_RegimenFiscal", objxml.emisor.RegimenFiscalTexto)) + parametros.Add(New ReportParameter("emisor_Direccion", datos.Empresa.DomicilioFiscal)) + parametros.Add(New ReportParameter("receptor_Rfc", objxml.receptor.Rfc)) + parametros.Add(New ReportParameter("receptor_Nombre", objxml.receptor.Nombre)) + parametros.Add(New ReportParameter("receptor_NumRegIdTrib", objxml.receptor.NumRegIdTrib)) + parametros.Add(New ReportParameter("receptor_ResidenciaFiscal", objxml.receptor.ResidenciaFiscal)) + parametros.Add(New ReportParameter("receptor_UsoCFDI", objxml.receptor.UsoCFDITexto)) + parametros.Add(New ReportParameter("complemento_FechaTimbrado", objxml.complemento.FechaTimbrado)) + parametros.Add(New ReportParameter("complemento_NoCertificadoSAT", objxml.complemento.NoCertificadoSAT)) + parametros.Add(New ReportParameter("complemento_RfcProvCertif", objxml.complemento.RfcProvCertif)) + parametros.Add(New ReportParameter("complemento_SelloCFD", objxml.complemento.SelloCFD)) + parametros.Add(New ReportParameter("complemento_SelloSAT", objxml.complemento.SelloSAT)) + parametros.Add(New ReportParameter("complemento_UUID", objxml.complemento.UUID)) + parametros.Add(New ReportParameter("complemento_CadenaOriginal", objxml.complemento.CadenaOriginal)) + + + Dim ds As New List(Of ReportDataSource) + + Dim rdsTotales As ReportDataSource = New ReportDataSource() + Dim ltotales As List(Of utilValores) = New List(Of utilValores)() + ltotales.Add(New utilValores("Subtotal", objxml.comprobante.SubTotal.ToString("N2"))) + + If objxml.comprobante.Descuento > 0 Then + ltotales.Add(New utilValores("Descuento", objxml.comprobante.Descuento.ToString("N2"))) + End If + + For Each item As CFDIImpuesto In objxml.Impuestos + + If item.Importe > 0 Then + Dim TasaOCuota As Decimal = 0 + Decimal.TryParse(item.TasaOCuota, TasaOCuota) + ltotales.Add(New utilValores($"Impuestos {item.Tipo} {item.ImpuestoTexto} {(If(item.TipoFactor = "Tasa", (TasaOCuota * 100).ToString("N4"), item.TasaOCuota))} {(If(item.TipoFactor = "Tasa", "%", ""))}", item.Importe.ToString("N2"))) + End If + Next + + ltotales.Add(New utilValores("Total", objxml.comprobante.Total.ToString("N2"))) + rdsTotales.Name = "dsTotales" + rdsTotales.Value = ltotales + ds.Add(rdsTotales) + + Dim rds2 As ReportDataSource = New ReportDataSource() + Dim limagenes As List(Of utilImage) = New List(Of utilImage)() + limagenes.Add(New utilImage(cQr)) + rds2.Name = "dsImagenes" + rds2.Value = limagenes + ds.Add(rds2) + + Dim rdsrelacionados As ReportDataSource = New ReportDataSource() + rdsrelacionados.Name = "dsRelacionados" + rdsrelacionados.Value = objxml.cFDIRelacionados + ds.Add(rdsrelacionados) + + Dim rds1 As ReportDataSource = New ReportDataSource() + rds1.Name = "dsConceptos" + rds1.Value = objxml.GetConceptosforpdf() + + ds.Add(rds1) + + Try + bytes = StreamPDF(context, rutaReporte, ds, parametros) + + System.IO.File.Delete(RutaXml) + Catch ex As Exception + + End Try + + Return bytes + + End Function + Public Function StreamPDF(ByVal context As HttpContext, RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() 'limpio ReportViwer Dim sw As New System.Diagnostics.Stopwatch() @@ -150,8 +269,8 @@ Public Class GenerarPDFFactura : Implements IHttpHandler If EsProduccion Then - Dim CveUsuario As Integer = 0 - Dim CveEmpresa As Integer = 0 + Dim CveUsuario As Integer = -1 + Dim CveEmpresa As Integer = -1 Dim wsreport As New WSRDLC.WebServiceSoapClient Dim params As New List(Of WSRDLC.ReportParameter) @@ -175,6 +294,7 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Bytes = wsreport.StreamPDFBytes(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario) wsreport = Nothing params = Nothing + Else If IsNothing(MR) Then MR = New ReportViewer Try @@ -364,8 +484,10 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Public Property Factura As FacturaWS Public Property Cliente As ClienteWS Public Property Empresa As EmpresaWS - Public Property Timbrado As DatosSATWS Public Property API_SALI As Boolean + Public Property Timbrado As DatosSATWS + + Public Property XML As String End Class diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 7537d835a..2fc14f0ad 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -467,11 +467,12 @@ + - + @@ -650,7 +651,7 @@
    -
    +
    @@ -658,7 +659,7 @@ <%----%>
    -
    +
    @@ -1232,7 +1233,7 @@ - + @@ -2559,11 +2560,11 @@ - +

    - +

    @@ -3303,7 +3304,7 @@