From dbe40ab4d516715f99b1f7e61c5f585c93bcad7f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 20 Jul 2024 15:48:28 -0700 Subject: [PATCH 1/8] --FIX merge --- Ventas/Ventas.aspx.vb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 886952b47..e571f3701 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5284,8 +5284,12 @@ Partial Class Ventas Trsaldo.Visible = True HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) - TrMotivoDev.Visible = True - lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString() + + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + TrMotivoDev.Visible = True + lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString() + End If + Case "Ped" DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped")) CvePedido = CveVenta @@ -12279,7 +12283,13 @@ Partial Class Ventas ObjFactura.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim ObjFactura.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim ObjFactura.Det_ContraRecibo = TxtDet_ContraRecibo.Text.Trim - ObjFactura.MonedaAbreviatura = DdlMoneda.SelectedItem.Text + ObjFactura.MonedaAbreviatura = "" + + Try + ObjFactura.MonedaAbreviatura = GlobalDTMonedas().FiltroPrimeroValor("Moneda", $"CveMoneda = {DdlMoneda.SelectedValue.ToEntero}") + Catch ex As Exception + + End Try If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso DvModalRequiereOSFecha.Visible Then ObjFactura.FechaEjecucion = TxtFechaOS.Text.Trim.ToDateTime From 539099fbe30d06cad5b98660ca331994174750f2 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 20 Jul 2024 15:48:45 -0700 Subject: [PATCH 2/8] --Subproyectos en catalogo de precios de lista --- App_Code/ClsVentas.vb | 49 ++++++- Ventas/CatPreciosLista.aspx | 233 ++++++++++++++++++--------------- Ventas/CatPreciosLista.aspx.vb | 58 ++++++-- 3 files changed, 222 insertions(+), 118 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 4323620af..726c85552 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2158,6 +2158,49 @@ Public Class ClsVentas #End Region #Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016 + + Public Function GetPreciosListasSubProyecto(CvePrecioLista As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_PrecioListaSubProyectosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdatePreciosListasSubProyecto(CvePrecioLista As Integer, CveSubProyecto As Integer, Permitir As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_PrecioListaSubProyectosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Permitir", SqlDbType.Bit).Value = Permitir + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetPrecioListas(Optional CveEmpresa As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -2177,7 +2220,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer + Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Restringida As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Vta_PrecioListaAdd") @@ -2188,6 +2231,7 @@ Public Class ClsVentas .Add("@PrecioLista", SqlDbType.VarChar).Value = PrecioLista .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada + .Add("@Restringida", SqlDbType.Bit).Value = Restringida .Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia .Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output @@ -2210,7 +2254,7 @@ Public Class ClsVentas End Function Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double, - Predeterminada As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean + Predeterminada As Boolean, Restringida As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PrecioListaUpdate") @@ -2221,6 +2265,7 @@ Public Class ClsVentas .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada + .Add("@Restringida", SqlDbType.Bit).Value = Restringida .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia End With diff --git a/Ventas/CatPreciosLista.aspx b/Ventas/CatPreciosLista.aspx index d694e50f9..2c33a6998 100644 --- a/Ventas/CatPreciosLista.aspx +++ b/Ventas/CatPreciosLista.aspx @@ -1,108 +1,125 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatPreciosLista.aspx.vb" Inherits="Ventas_CatPreciosLista" %> - - - - - - - Catálogo de Precios de Lista - - - - -
  • - - - Agregar Precio de Lista - - -
  • -
    - - - -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatPreciosLista.aspx.vb" Inherits="Ventas_CatPreciosLista" %> + + + + + + + Catálogo de Precios de Lista + + + + +
  • + + + Agregar Precio de Lista + + +
  • +
    + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Ventas/CatPreciosLista.aspx.vb b/Ventas/CatPreciosLista.aspx.vb index 70a637066..79368fa16 100644 --- a/Ventas/CatPreciosLista.aspx.vb +++ b/Ventas/CatPreciosLista.aspx.vb @@ -31,6 +31,9 @@ Partial Class Ventas_CatPreciosLista If Not Page.IsPostBack Then CvePrecioLista = -1 EsEditar = 0 + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + divPermiso.Visible = True + End If dvEstatus.Visible = False CargaDatos() End If @@ -56,9 +59,19 @@ Partial Class Ventas_CatPreciosLista TxtPrecioLista.Text = GvRow.DataKey("PrecioLista").ToString ChkPredeterminada.Checked = GvRow.DataKey("Predeterminada") = "True" chkEstatus.Checked = CBool(GvRow.DataKey("Estatus")) + ChkRestringida.Checked = CBool(GvRow.DataKey("Restringuida")) + EsEditar = 1 BtnAgregarCatalogo.Text = "Actualizar" dvEstatus.Visible = True + + Using ObjVenta As New ClsVentas + If ObjVenta.GetPreciosListasSubProyecto(CvePrecioLista, UsuarioActual.CveEmpresa) Then + GvSubProyectos.DataSource = ObjVenta.DtResultados.Copy() + End If + End Using + GvSubProyectos.DataBind() + UpBodyCo.Update() UpFooter.Update() RegistraScript("$('#divAgregar').modal()") @@ -76,19 +89,46 @@ Partial Class Ventas_CatPreciosLista Dim TieneError As Boolean = False Try If EsEditar = 0 Then - If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) > 0 Then - Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError) + Dim CvePrecioLista As Integer = ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, ChkRestringida.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) + If Not CvePrecioLista > 0 Then TieneError = True End If + + If Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + For Each GvRow As GridViewRow In GvSubProyectos.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + Dim Permitir As Boolean = GvRow.FCCheckBox("ChkPermitir").Checked + Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero() + If Not ObjVta.UpdatePreciosListasSubProyecto(CvePrecioLista, CveSubProyecto, Permitir, UsuarioActual.CveEmpresa) Then + TieneError = False + Exit For + End If + End If + Next + End If + End If + ElseIf EsEditar = 1 Then - If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then - Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError) + If Not ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, ChkRestringida.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then TieneError = True End If + + If Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + For Each GvRow As GridViewRow In GvSubProyectos.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + Dim Permitir As Boolean = GvRow.FCCheckBox("ChkPermitir").Checked + Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero() + If Not ObjVta.UpdatePreciosListasSubProyecto(Me.CvePrecioLista, CveSubProyecto, Permitir, UsuarioActual.CveEmpresa) Then + TieneError = False + Exit For + End If + End If + Next + End If + End If + EsEditar = 0 dvEstatus.Visible = False BtnAgregarCatalogo.Text = "Agregar" @@ -100,8 +140,10 @@ Partial Class Ventas_CatPreciosLista If TieneError Then ObjVta.RollBack() + Alert("Ocurrió un error al guardar el precio de lista", TipoMensaje.MsgError) Else ObjVta.Commit() + Alert("El precio de lista se guardo correctamente", TipoMensaje.MsgInformacion) End If RegistraScript("$('#divAgregar').modal('hide')") From d12e75ba593af13d4c2e24c7083b36d1d0cd61bb Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 20 Jul 2024 21:35:48 -0700 Subject: [PATCH 3/8] --Metodo para filtrar PL por sucursal --- App_Code/ClsVentas.vb | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 726c85552..18032d741 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2157,7 +2157,27 @@ Public Class ClsVentas #End Region -#Region "V E N T A S - P R E C I O L I S T A S" 'Hecho por Charlie 1/9/2016 +#Region "V E N T A S - P R E C I O L I S T A S" + + Public Function GetPreciosListaSPPermitidos(CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_PrecioListaSPPermitdosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el catálogo de listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function Public Function GetPreciosListasSubProyecto(CvePrecioLista As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -2195,7 +2215,7 @@ Public Class ClsVentas SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Listas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al actualizar el subproyecto del precio de lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno From 990a281e73d33e9f0563a307b6249da2ad606811 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 20 Jul 2024 21:44:48 -0700 Subject: [PATCH 4/8] -- --- Ventas/CatPreciosLista.aspx | 2 +- Ventas/CatPreciosLista.aspx.vb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Ventas/CatPreciosLista.aspx b/Ventas/CatPreciosLista.aspx index 2c33a6998..ecfdaf7b3 100644 --- a/Ventas/CatPreciosLista.aspx +++ b/Ventas/CatPreciosLista.aspx @@ -90,7 +90,7 @@ -
    +
    diff --git a/Ventas/CatPreciosLista.aspx.vb b/Ventas/CatPreciosLista.aspx.vb index 79368fa16..d71056c60 100644 --- a/Ventas/CatPreciosLista.aspx.vb +++ b/Ventas/CatPreciosLista.aspx.vb @@ -33,6 +33,7 @@ Partial Class Ventas_CatPreciosLista EsEditar = 0 If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then divPermiso.Visible = True + divSP.Visible = True End If dvEstatus.Visible = False CargaDatos() From 587e8edfacdddd946e8741ebaa2d4f4705ca8bab Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Mon, 22 Jul 2024 06:09:17 -0700 Subject: [PATCH 5/8] --- App_Code/CLSErrorMessage.vb | 18 ++++++++++++++++ App_Code/ClsNominas.vb | 23 +++++++++++++++++++-- App_Code/modExtensiones.vb | 3 +++ Nomina/ConceptoNomina.aspx | 6 +++++- Nomina/ConceptoNomina.aspx.cs | 12 ++++++++--- Nomina/Nomina.aspx.cs | 39 +++++++++++++++++++---------------- 6 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 App_Code/CLSErrorMessage.vb diff --git a/App_Code/CLSErrorMessage.vb b/App_Code/CLSErrorMessage.vb new file mode 100644 index 000000000..550e561bf --- /dev/null +++ b/App_Code/CLSErrorMessage.vb @@ -0,0 +1,18 @@ +Imports ClosedXML.Excel.XLPredefinedFormat +Imports System.Buffers +Imports Microsoft.VisualBasic + +Public NotInheritable Class CLSErrorMessage + + + Public Shared Function GetErrorMesagge(mesage As String, ex As Exception, tipoMensaje As Extensiones.ModExtensiones.TipoMensaje) As Tuple(Of String, Extensiones.ModExtensiones.TipoMensaje) + Dim newmesage As String = mesage + Dim newtipoMensaje As Extensiones.ModExtensiones.TipoMensaje = tipoMensaje + If ex.ToString().ToLower().Contains("chk_rh_personalsalarioimss") Then + newmesage = "El salario base cotización no puede ser menor al salario diario integrado" + newtipoMensaje = Extensiones.ModExtensiones.TipoMensaje.MsgAdvertencia + End If + + Return Tuple.Create(newmesage, newtipoMensaje) + End Function +End Class diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index d29728f94..44f5a3d97 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -642,6 +642,22 @@ Public Class ClsNominas retorno = RunQuery("Ocurrió un error al obtener el valor de la UMA.") Return retorno End Function + Public Function GetEfectivaleXLS(CvePeriodo As Int32, CveEmpresa As Int32, CvePersonal As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_EfectivaleXLSGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el layout de nóminas(Efetivale).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure) @@ -1455,7 +1471,7 @@ Public Class ClsNominas Public Function AddConcepto(Codigo As String, Concepto As String, Tipo As String, Formula As String, Sistema As Boolean, Estado As Boolean, CveConceptoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsRetencion As Boolean, CveClasificacion As Integer, CveTipoGasto As Integer, TipoCalculo As Boolean, CveConceptoContable As Integer, AplicaFiniquito As Integer, AutomaticoGlobal As Integer, Especie As Integer, Imprimir As Integer, CveSATConcepto As Integer, - ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer) As Integer + ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer, Optional AplicaEfectivale As Integer = 0) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Nom_ConceptosAdd") @@ -1488,6 +1504,7 @@ Public Class ClsNominas .Add("CveConceptoContableB", SqlDbType.Int).Value = cveConceptoContableB .Add("CveCuentaB", SqlDbType.Int).Value = CveCuentaB .Add("CveConceptoContablePasivo", SqlDbType.Int).Value = CveConceptoContablePasivo + .Add("AplicaEfectivale", SqlDbType.Int).Value = AplicaEfectivale End With @@ -1514,7 +1531,8 @@ Public Class ClsNominas Public Function UpdateConcepto(Codigo As String, Concepto As String, Tipo As String, Formula As String, Sistema As Boolean, Estado As Boolean, CveConceptoPadre As Integer, CveConcepto As Integer, EsRetencion As Boolean, CveClasificacion As Integer, CveTipoGasto As Integer, TipoCalculo As Boolean, CveConceptoContable As Integer, AplicaFiniquito As Integer, AutomaticoGlobal As Integer, Especie As Integer, Imprimir As Integer, CveSATConcepto As Integer, CveEmpresa As Integer, - ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer) As Boolean + ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, + CveConceptoContablePasivo As Integer, Optional AplicaEfectivale As Integer = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_ConceptosUpdate") @@ -1546,6 +1564,7 @@ Public Class ClsNominas .Add("CveConceptoContableB", SqlDbType.Int).Value = cveConceptoContableB .Add("CveCuentaB", SqlDbType.Int).Value = CveCuentaB .Add("CveConceptoContablePasivo", SqlDbType.Int).Value = CveConceptoContablePasivo + .Add("AplicaEfectivale", SqlDbType.Int).Value = AplicaEfectivale End With Try diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 5bb948f6b..e3cf0a3af 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -600,6 +600,9 @@ Namespace Extensiones Public Sub OnError(Obj As Object, Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "", Optional TipoMensaje As TipoMensaje = TipoMensaje.MsgError) GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + Dim resultado = CLSErrorMessage.GetErrorMesagge(Mensaje, Exeption, TipoMensaje) + Mensaje = resultado.Item1 + TipoMensaje = resultado.Item2 Alert(Obj, Mensaje, TipoMensaje) If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) End Sub diff --git a/Nomina/ConceptoNomina.aspx b/Nomina/ConceptoNomina.aspx index 067ac9bc9..443e37391 100644 --- a/Nomina/ConceptoNomina.aspx +++ b/Nomina/ConceptoNomina.aspx @@ -424,12 +424,16 @@
    - +
    + +
    + +
    diff --git a/Nomina/ConceptoNomina.aspx.cs b/Nomina/ConceptoNomina.aspx.cs index 812c420ba..cba504251 100644 --- a/Nomina/ConceptoNomina.aspx.cs +++ b/Nomina/ConceptoNomina.aspx.cs @@ -362,7 +362,7 @@ public partial class Nomina_CatConcepto : ClsPaginas int CveConceptoContablePasivo = DdlConceptoContablePasivo.SelectedValue.ToEntero(); int IdCtaContableB = (DdlCtaContableB.DataValueField == "Id" ? DdlCtaContableB.SelectedValue.ToEntero() : 0); int CveCuentaB = (DdlCtaContableB.DataValueField == "Id" ? 0 : DdlCtaContableB.SelectedValue.ToEntero()); - + int AplicaEfectivale = chkAplicaEfectivale.Checked ? 1 : 0; ClsNominas ObjNomina = new ClsNominas(); ObjNomina.IniciaTransacSQL(); @@ -372,7 +372,7 @@ public partial class Nomina_CatConcepto : ClsPaginas { TieneError = !ObjNomina.UpdateConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, CveConcepto, retencion, CveClasificacion, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto, - UsuarioActual.CveEmpresa, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB , CveCuentaB, CveConceptoContablePasivo); + UsuarioActual.CveEmpresa, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB , CveCuentaB, CveConceptoContablePasivo, AplicaEfectivale); if (!TieneError) { @@ -404,7 +404,7 @@ public partial class Nomina_CatConcepto : ClsPaginas { CveConcepto = ObjNomina.AddConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, retencion, CveClasificacion, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, - CveSATConcepto, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB, CveCuentaB, CveConceptoContablePasivo); + CveSATConcepto, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB, CveCuentaB, CveConceptoContablePasivo, AplicaEfectivale); @@ -502,6 +502,7 @@ public partial class Nomina_CatConcepto : ClsPaginas ChkEstado.Checked = drow["Estado"].Equals("Activo"); ChkSistema.Checked = drow["Sistema"].Equals("Sí"); ChkAutomaticoLiquidacion.Checked = drow["AplicaFiniquito"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); + chkAplicaEfectivale.Checked = drow["AplicaEfectivale"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); ChkContabiliza.Checked = drow["Contabiliza"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); chkCtaImporteNegativoProv.Checked = drow["CtaImporteNegativoProv"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); ChkAutomaticoGlobal.Checked = drow["AutomaticoGlobal"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); @@ -671,4 +672,9 @@ public partial class Nomina_CatConcepto : ClsPaginas //} } + + protected void chkAplicaEfectivale_CheckedChanged(object sender, EventArgs e) + { + + } } \ No newline at end of file diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index 0ca01bdac..2e2f0452c 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -710,7 +710,7 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkTimbrarTodos.Visible = (dtempleados.Rows.Count > 0 && dtempleados.COUNT("CvePersonal", "SeTimbro=0 AND CvePersonal >0 AND NomAutorizado =1") > 0); } - } + } } @@ -7198,7 +7198,7 @@ public partial class Nomina_Nomina2 : ClsPaginas } using (ClsNominas ObjMovt = new ClsNominas()) { - ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa, SRCvePersonal, CcveMovtoPermanente); + ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa, SRCvePersonal, CcveMovtoPermanente); GVMovtoPermanenteSaldos.DataSource = ObjMovt.DtResultados; GVMovtoPermanenteSaldos.DataBind(); } @@ -10019,28 +10019,31 @@ public partial class Nomina_Nomina2 : ClsPaginas libro.Cell(row, column++).Value = "XTIPOPEDIDO"; libro.Cell(row, column++).Value = "XNUMERO"; libro.Cell(row, column++).Value = "XIMPORTE"; - //libro.Cell(row, column++).Value = "CLABE"; - //libro.Cell(row, column++).Value = "Neto"; + int maxxolumn = column; libro.Range(row, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; libro.Range(row, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); DataRow dcon; decimal subtotal = 0; - if (dtempleados != null && dtempleados.Rows.Count > 0 && dtConceptos != null && dtConceptos.Rows.Count > 0 && (dcon = dtConceptos.FiltroPrimero("Tipo ='P' AND Codigo = 'P028' ")) != null) + DataTable dt = null; + using (ClsNominas objnom = new ClsNominas()) { - foreach (DataRow dRow in dtempleados.FiltraParametros("CvePersonal > 0").Rows) + objnom.GetEfectivaleXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa, -1); + dt = objnom.DtResultados; + } + if (dt != null && dt.Rows.Count > 0) + { + + foreach (DataRow dRow in dt.Rows) { - decimal importe = dRow[string.Format("V_{0}", dcon["CveConcepto"])].ToString().ToDecimal(); - if (importe > 0) - { - subtotal = subtotal + importe; - row++; - column = 1; - libro.Cell(row, column++).Value = "'103646-1"; - libro.Cell(row, column++).Value = "'DISPERSION"; - libro.Cell(row, column++).Value = string.Format("'{0}", dRow["Codigo"]); - libro.Cell(row, column++).Value = importe; - } + decimal importe = dRow["Importe"].ToString().ToDecimal(); + subtotal = subtotal + importe; + row++; + column = 1; + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XCLIENTE"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XTIPOPEDIDO"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["CodigoDispersionVale"]); + libro.Cell(row, column++).Value = importe; } } libro.Cell(1, 2).Value = subtotal; @@ -10383,7 +10386,7 @@ public partial class Nomina_Nomina2 : ClsPaginas if (!ErroresValidaciones) { - DataRow RowCuenta = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta: DdlCuenta.SelectedValue.ToEntero(), CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(""); + DataRow RowCuenta = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta: DdlCuenta.SelectedValue.ToEntero(), CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(""); var ClaveMoneda = "001"; // PESOS MEXICANOS //REGISTRO DE CONTROL - IMPORTACIÓN From fed72cbc38864ea872d28f11977149d0cbcaadd4 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Mon, 22 Jul 2024 06:45:47 -0700 Subject: [PATCH 6/8] --- App_Code/ClsNominas.vb | 63 +++++++++++++++++++++--------------------- Nomina/Nomina.aspx.cs | 33 ++++++++++++---------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 44f5a3d97..aff44610d 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -658,27 +658,28 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean - Dim retorno As Boolean = False - DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure) - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el layout de nóminas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return retorno - End Function - Public Function GetDispersionnomina(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean + 'Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean + ' Dim retorno As Boolean = False + ' DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure) + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el layout de nóminas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return retorno + 'End Function + Public Function GetDispersionnomina(CvePeriodo As Int32, CveEmpresa As Int32, CveSATBanco As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_Dispersionnomina", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco End With Try SqlAdapter.Fill(Data) @@ -3763,21 +3764,21 @@ Public Class ClsNominas End Function - Public Function GetDispersionNominaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean - Dim retorno As Boolean = False - DataAdapter("PA_Nom_DispersionNominaBanorteGet", CommandType.StoredProcedure) - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el layout de nominas Banorte.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return retorno - End Function + 'Public Function GetDispersionNominaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean + ' Dim retorno As Boolean = False + ' DataAdapter("PA_Nom_DispersionNominaBanorteGet", CommandType.StoredProcedure) + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el layout de nominas Banorte.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return retorno + 'End Function Public Function PreNominaTotalSemana(numeroPeriodo As Int32, cveEmpresa As Int32, cveSubProyecto As Int32, cveTipoNomina As Int32, tipoTrabajador As String, ejercicio As Int32, facturado As Boolean) As Boolean Dim retorno As Boolean = False diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index 0afbbfbf2..de3b59033 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -10005,28 +10005,31 @@ public partial class Nomina_Nomina2 : ClsPaginas libro.Cell(row, column++).Value = "XTIPOPEDIDO"; libro.Cell(row, column++).Value = "XNUMERO"; libro.Cell(row, column++).Value = "XIMPORTE"; - //libro.Cell(row, column++).Value = "CLABE"; - //libro.Cell(row, column++).Value = "Neto"; + int maxxolumn = column; libro.Range(row, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; libro.Range(row, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); DataRow dcon; decimal subtotal = 0; - if (dtempleados != null && dtempleados.Rows.Count > 0 && dtConceptos != null && dtConceptos.Rows.Count > 0 && (dcon = dtConceptos.FiltroPrimero("Tipo ='P' AND Codigo = 'P028' ")) != null) + DataTable dt = null; + using (ClsNominas objnom = new ClsNominas()) { - foreach (DataRow dRow in dtempleados.FiltraParametros("CvePersonal > 0").Rows) + objnom.GetEfectivaleXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa, -1); + dt = objnom.DtResultados; + } + if (dt != null && dt.Rows.Count > 0) + { + + foreach (DataRow dRow in dt.Rows) { - decimal importe = dRow[string.Format("V_{0}", dcon["CveConcepto"])].ToString().ToDecimal(); - if (importe > 0) - { - subtotal = subtotal + importe; - row++; - column = 1; - libro.Cell(row, column++).Value = "'103646-1"; - libro.Cell(row, column++).Value = "'DISPERSION"; - libro.Cell(row, column++).Value = string.Format("'{0}", dRow["Codigo"]); - libro.Cell(row, column++).Value = importe; - } + decimal importe = dRow["Importe"].ToString().ToDecimal(); + subtotal = subtotal + importe; + row++; + column = 1; + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XCLIENTE"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XTIPOPEDIDO"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["CodigoDispersionVale"]); + libro.Cell(row, column++).Value = importe; } } libro.Cell(1, 2).Value = subtotal; From 373d89181e9279fd7878b5bb4c07f41de69a3714 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 22 Jul 2024 09:48:55 -0700 Subject: [PATCH 7/8] --FIX error compilacion --- Ventas/Clientes.aspx.vb | 2 +- Ventas/Ventas.aspx.vb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 9fe195a53..4dfcdcd4f 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -10619,7 +10619,7 @@ Partial Class Clientes End If Dim ObjVentas As New ClsVentas(transaccionSQL) - Dim CvePrecioListaNuevo As Integer = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, False, 0, CvePrecioListaClonar:=CvePrecioListaClonar) + Dim CvePrecioListaNuevo As Integer = ObjVentas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, False, False, 0, CvePrecioListaClonar:=CvePrecioListaClonar) If Not CvePrecioListaNuevo > 0 Then respuesta = False diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index e571f3701..5d94a92a9 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3731,6 +3731,20 @@ Partial Class Ventas UpPS.Update() End Sub + + Private Sub CargaListasPreciosSubProyectos() + 'If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(360) = "1" Then + ' DivPrecioLista.Visible = True + ' Using ObjVta As New ClsVentas + ' If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then + ' Dim Dt = ObjVta.DtResultados.Copy() + ' DdlPrecioLista.DataSource = Dt + ' DdlPrecioLista.SelectedValue = Dt.FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'") + ' End If + ' End Using + ' UpPS.Update() + 'End If + End Sub Private Sub BloqueaClasificaciones() If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then DdlClasificacion.Enabled = False @@ -18550,6 +18564,8 @@ Partial Class Ventas DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue) End If + CargaListasPreciosSubProyectos() + UpDetalle.Update() UpEmitirTransitorio.Update() End Sub From 389344bf8e75ab844716b283e5381e93f797c7be Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 22 Jul 2024 11:10:06 -0700 Subject: [PATCH 8/8] Vya - Nuevas observaciones 2024.07.19 --- App_Code/CalendarEvent.vb | 4 + App_Code/ClsContratos.vb | 42 +++ Ashx/CargaEventos.ashx | 358 ++++++++++++--------- Compras/eFacturas.aspx.vb | 2 +- Transportes/RepContratoDetalle.aspx | 18 +- Transportes/RepContratoDetalle.aspx.vb | 18 +- Transportes/RepContratos.aspx | 45 ++- Transportes/RepContratos.aspx.vb | 99 +++++- Transportes/RepContratosCalendario.aspx | 119 +++++-- Transportes/RepContratosCalendario.aspx.vb | 65 +++- 10 files changed, 535 insertions(+), 235 deletions(-) diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index da3261896..f0a7a8aca 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -62,4 +62,8 @@ Public Class CalendarEvent Public Property NumeroContrato As String Public Property Observaciones As String + Public Property CveMoneda As Integer + Public Property Moneda As String + + End Class diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 52d3826f9..6d8b7fdf3 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -684,6 +684,48 @@ Public Class ClsContratos Return Retorno End Function + Public Function GetContratosValUnidadesAgendadas(CveAF As Integer, FechaInicial As DateTime, FechaFinal As DateTime, CveEmpresa As Integer, CveContrato As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Con_ContratosValUnidadesAgendadasGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@FechaInicial", SqlDbType.DateTime).Value = FechaInicial + .Add("@FechaFinal", SqlDbType.DateTime).Value = FechaFinal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las unidades agendadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + + Public Function UpdateContratoArchivo(CveContrato As Integer, Archivo As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Con_ContratosArchivoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@Archivo", SqlDbType.VarChar).Value = Archivo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el archivo adjunto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #End Region diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index d5dbda671..75b6ae9e5 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -107,12 +107,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState If context.Request("U").ToEntero > 0 Then CveUsuario = context.Request("U").ToEntero - CveEmpresa = context.Request("E").ToEntero - - Dim CveSubProyecto As Integer = If(context.Request("CveSubProyecto") IsNot Nothing, context.Request("CveSubProyecto").ToEntero, -1) - Dim CveUsuarioPara As Integer = If(context.Request("CveUsuarioPara") IsNot Nothing, context.Request("CveUsuarioPara").ToEntero, -1) - - + CveEmpresa = context.Request("E").ToEntero + FI = context.Request("start").ToDate FF = context.Request("end").ToDate @@ -487,168 +483,208 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState Dim tipoVista As String = context.Request("tipoVista") DT_SubProyectos.Columns.Add("CveSubProyecto", GetType(Integer)) DT_SubProyectos.Columns.Add("backgroundColor") - DT_EstatusOS.Columns.Add("", GetType(Integer)) - - Dim cveContrato As Integer = -1 + DT_EstatusOS.Columns.Add("", GetType(Integer)) - If context.Request("cveContrato") IsNot Nothing Then - cveContrato = context.Request("cveContrato").ToEntero() + + Dim cveContrato As Integer = If(context.Request("cveContrato") IsNot Nothing, context.Request("cveContrato").ToEntero, -1) + Dim CveSubProyecto As Integer = If(context.Request("CveSubProyecto") IsNot Nothing, context.Request("CveSubProyecto").ToEntero, -1) + Dim CveUsuarioPara As Integer = If(context.Request("CveUsuarioPara") IsNot Nothing, context.Request("CveUsuarioPara").ToEntero, -1) + + Dim CveCliente As Integer = If(context.Request("CveCliente") IsNot Nothing, context.Request("CveCliente").ToEntero, -1) + Dim CveContratoEstatus As Integer = If(context.Request("CveContratoEstatus") IsNot Nothing, context.Request("CveContratoEstatus").ToEntero, -1) + Dim CveTipoActivoFijo As Integer = If(context.Request("CveTipoActivoFijo") IsNot Nothing, context.Request("CveTipoActivoFijo").ToEntero, -1) + Dim CvePersonal As Integer = If(context.Request("CvePersonal") IsNot Nothing, context.Request("CvePersonal").ToEntero, -1) + + If Not cveContrato > 0 Then + cveContrato = -1 + End If + + If Not CveCliente > 0 Then + CveCliente = -1 End If - If ObjContratos.GetContratos(cveContrato, usuarioActual_.CveEmpresa, TipoContrato:=34) Then - - If ObjContratos.DtResultados.Rows.Count > 0 Then - - Try - For Each dr As DataRow In ObjContratos.DtResultados.Rows - Dim cevent As CalendarEvent = New CalendarEvent() - - cevent.id = dr("CveContrato").ToString.ToEntero - cevent.title = dr("DescripcionContrato").ToString - cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) - cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) - cevent.FechaFinal = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime) - cevent.allDay = False - cevent.NombreAcercamiento = dr("Ubicacion").ToString - cevent.CveCliente = dr("CveCliente").ToString.ToEntero - cevent.NombreComercial = dr("NombreComercial").ToString - cevent.CvePersonal = dr("CveChofer").ToString.ToEntero - cevent.CvePersonal2 = dr("CveChofer2").ToString.ToEntero - cevent.CveEventoEstatus = dr("CveContratosEstatus").ToString.ToEntero - cevent.Dolares = dr("Importe").ToString.ToDecimal - cevent.Pesos = dr("ImporteMax").ToString.ToDecimal - cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal + If ObjContratos.GetContratos(cveContrato, usuarioActual_.CveEmpresa, TipoContrato:=34, CveCliente:=CveCliente, CveEstatus:=CveContratoEstatus) Then + + 'CveTipoAF + 'CveChofer, CveChofer2 + Dim filtro As String = "" + If CveTipoActivoFijo > 0 Then + filtro = $"{filtro} CveTipoAF = {CveTipoActivoFijo}" + End If + + If CvePersonal > 0 Then + If filtro.Length > 0 Then + filtro = $"{filtro} AND " + End If + filtro = $"{filtro} CveChofer = {CvePersonal} OR CveChofer2 = {CvePersonal} " + End If + + + If CveSubProyecto > 0 Then + If filtro.Length > 0 Then + filtro = $"{filtro} AND " + End If + filtro = $"{filtro} CveSubProyecto = {CveSubProyecto} " + End If + + Dim DTContratos As DataTable = ObjContratos.DtResultados.FiltraParametros(filtro) + + If DTContratos.Rows.Count > 0 Then + + Try + For Each dr As DataRow In DTContratos.Rows + Dim cevent As CalendarEvent = New CalendarEvent() + + cevent.id = dr("CveContrato").ToString.ToEntero + cevent.title = dr("DescripcionContrato").ToString + cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) + cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) + cevent.FechaFinal = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime) + cevent.allDay = False + cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveCliente = dr("CveCliente").ToString.ToEntero + cevent.NombreComercial = dr("NombreComercial").ToString + cevent.CvePersonal = dr("CveChofer").ToString.ToEntero + cevent.CvePersonal2 = dr("CveChofer2").ToString.ToEntero + cevent.CveEventoEstatus = dr("CveContratosEstatus").ToString.ToEntero + cevent.Dolares = dr("Importe").ToString.ToDecimal + cevent.Pesos = dr("ImporteMax").ToString.ToDecimal + cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.CveTipoAF = dr("CveTipoAF").ToString.ToEntero - cevent.backgroundColor = dr("BackgroundColor").ToString - cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString - cevent.NumeroContrato = dr("NumeroContrato").ToString - cevent.Observaciones = dr("Observaciones").ToString - - If Not cevent.recurrenciatipo > 0 Then - - 'AGREGAMOS CUANDO NO ES RECURRENTE - Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA - If dr("FechaFinal").ToString.ToDateTime > tFecha Or dr("FechaInicial").ToString.ToDateTime > tFecha Then - events.Add(cevent) - End If - Else - - 'EMPIEZA METODO PARA AGREGAR CUANDO SI ES RECURRENTE - - Dim FinRecurrencia As Integer = cevent.recurrenciafin.ToEntero - Dim FI As DateTime, FF As DateTime, FT As DateTime - Dim DiasSemana As String() = cevent.diassemana.Split(","c) - FI = cevent.start.ToDateTime - FF = cevent.end.ToDateTime - - 'OBTENEMOS LA FECHA TERMINO (FT) DE LA RECURRENCIA - Select Case FinRecurrencia - Case -1 - FT = DateAdd(DateInterval.Year, 2, dr("FechaInicial").ToString.ToDateTime) - Case Is > 0 - FinRecurrencia -= 1 - Select Case cevent.recurrenciatipo - Case 1 - FT = DateAdd(DateInterval.Hour, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) - Case 2 - FT = DateAdd(DateInterval.Day, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) - Case 3 - FT = DateAdd(DateInterval.WeekOfYear, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) - FT = DateAdd(DateInterval.Day, (7 - Weekday(FT)).ToString.ToDouble, FT) - Case 4 - FT = DateAdd(DateInterval.Month, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) - Case 5 - FT = DateAdd(DateInterval.Year, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) - End Select - End Select - - 'SI ES TIPO SEMANAL Y DIASSEMANA TIENE VALORES CHECKEA ESTOS VALORES - Do - If DiasSemana.Length > 0 AndAlso DiasSemana(0) <> "" Then - For Each drDias As String In DiasSemana - Dim FIT As Date = FI, FFT As Date = FF - - FIT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FI)).ToString.ToDouble, FI) - FFT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FF)).ToString.ToDouble, FF) - - cevent = New CalendarEvent() - cevent.id = dr("CveContrato").ToString.ToEntero - cevent.description = dr("DescripcionContrato").ToString - cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) - cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) - cevent.allDay = False - cevent.CveCliente = dr("CveCliente").ToString.ToEntero - cevent.NombreComercial = dr("NombreComercial").ToString - cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.backgroundColor = dr("BackgroundColor").ToString + cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString + cevent.NumeroContrato = dr("NumeroContrato").ToString + cevent.Observaciones = dr("Observaciones").ToString + cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero + cevent.CveMoneda = dr("CveMoneda").ToString.ToEntero + cevent.Moneda = dr("Moneda").ToString + + + If Not cevent.recurrenciatipo > 0 Then + + 'AGREGAMOS CUANDO NO ES RECURRENTE + Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA + If dr("FechaFinal").ToString.ToDateTime > tFecha Or dr("FechaInicial").ToString.ToDateTime > tFecha Then + events.Add(cevent) + End If + Else + + 'EMPIEZA METODO PARA AGREGAR CUANDO SI ES RECURRENTE + + Dim FinRecurrencia As Integer = cevent.recurrenciafin.ToEntero + Dim FI As DateTime, FF As DateTime, FT As DateTime + Dim DiasSemana As String() = cevent.diassemana.Split(","c) + FI = cevent.start.ToDateTime + FF = cevent.end.ToDateTime + + 'OBTENEMOS LA FECHA TERMINO (FT) DE LA RECURRENCIA + Select Case FinRecurrencia + Case -1 + FT = DateAdd(DateInterval.Year, 2, dr("FechaInicial").ToString.ToDateTime) + Case Is > 0 + FinRecurrencia -= 1 + Select Case cevent.recurrenciatipo + Case 1 + FT = DateAdd(DateInterval.Hour, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) + Case 2 + FT = DateAdd(DateInterval.Day, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) + Case 3 + FT = DateAdd(DateInterval.WeekOfYear, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) + FT = DateAdd(DateInterval.Day, (7 - Weekday(FT)).ToString.ToDouble, FT) + Case 4 + FT = DateAdd(DateInterval.Month, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) + Case 5 + FT = DateAdd(DateInterval.Year, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime) + End Select + End Select + + 'SI ES TIPO SEMANAL Y DIASSEMANA TIENE VALORES CHECKEA ESTOS VALORES + Do + If DiasSemana.Length > 0 AndAlso DiasSemana(0) <> "" Then + For Each drDias As String In DiasSemana + Dim FIT As Date = FI, FFT As Date = FF + + FIT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FI)).ToString.ToDouble, FI) + FFT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FF)).ToString.ToDouble, FF) + + cevent = New CalendarEvent() + cevent.id = dr("CveContrato").ToString.ToEntero + cevent.description = dr("DescripcionContrato").ToString + cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) + cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) + cevent.allDay = False + cevent.CveCliente = dr("CveCliente").ToString.ToEntero + cevent.NombreComercial = dr("NombreComercial").ToString + cevent.NombreAcercamiento = dr("Ubicacion").ToString cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero - cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero - cevent.CvePersonal = dr("CveChofer").ToString.ToEntero - - - '11/05/2018 - Evento Gasto Recurrente - cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero - If cevent.CveTipoEvento = 10 Then - cevent.Importe = dr("Importe").ToString.ToDouble - End If - - If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then - cevent.backgroundColor = "#1BBC9B" - End If - - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL Y/0 SI LA FECHA INICIAL DE LA RECURRENCIA ES MENOR A LA FECHA QUE SE CREO EL EVENTO NO LO AGREGA - If FIT > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) And FIT >= dr("FechaInicial").ToString.ToDateTime Then - events.Add(cevent) - End If - Next - Else - cevent = New CalendarEvent() - cevent.id = dr("CveContrato").ToString.ToEntero - cevent.description = dr("DescripcionContrato").ToString - cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) - cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) - cevent.NombreAcercamiento = dr("Ubicacion").ToString + cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero + cevent.CvePersonal = dr("CveChofer").ToString.ToEntero + + + '11/05/2018 - Evento Gasto Recurrente + cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero + If cevent.CveTipoEvento = 10 Then + cevent.Importe = dr("Importe").ToString.ToDouble + End If + + If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then + cevent.backgroundColor = "#1BBC9B" + End If + + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL Y/0 SI LA FECHA INICIAL DE LA RECURRENCIA ES MENOR A LA FECHA QUE SE CREO EL EVENTO NO LO AGREGA + If FIT > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) And FIT >= dr("FechaInicial").ToString.ToDateTime Then + events.Add(cevent) + End If + Next + Else + cevent = New CalendarEvent() + cevent.id = dr("CveContrato").ToString.ToEntero + cevent.description = dr("DescripcionContrato").ToString + cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) + cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) + cevent.NombreAcercamiento = dr("Ubicacion").ToString cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero - cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero - cevent.allDay = False - - - - 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA - If FI > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) Then - events.Add(cevent) - End If - End If - - Select Case cevent.recurrenciatipo - Case 1 - FI = DateAdd(DateInterval.Hour, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Hour, cevent.frecuencia, FF) - Case 2 - FI = DateAdd(DateInterval.Day, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Day, cevent.frecuencia, FF) - Case 3 - FI = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FF) - Case 4 - FI = DateAdd(DateInterval.Month, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Month, cevent.frecuencia, FF) - Case 5 - FI = DateAdd(DateInterval.Year, cevent.frecuencia, FI) - FF = DateAdd(DateInterval.Year, cevent.frecuencia, FF) - End Select - - Loop Until FI > FT - End If - Next - Catch ex As Exception - GuardaLog(ex.ToString()) - End Try - End If - - End If - ObjContratos.Dispose() + cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero + cevent.allDay = False + + + + 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA + If FI > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) Then + events.Add(cevent) + End If + End If + + Select Case cevent.recurrenciatipo + Case 1 + FI = DateAdd(DateInterval.Hour, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Hour, cevent.frecuencia, FF) + Case 2 + FI = DateAdd(DateInterval.Day, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Day, cevent.frecuencia, FF) + Case 3 + FI = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FF) + Case 4 + FI = DateAdd(DateInterval.Month, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Month, cevent.frecuencia, FF) + Case 5 + FI = DateAdd(DateInterval.Year, cevent.frecuencia, FI) + FF = DateAdd(DateInterval.Year, cevent.frecuencia, FF) + End Select + + Loop Until FI > FT + End If + Next + Catch ex As Exception + GuardaLog(ex.ToString()) + End Try + End If + + End If + ObjContratos.Dispose() Return ErrorEventos End Function diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 0c556ae5a..722ac2d7f 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2852,7 +2852,7 @@ Partial Class Compras_eFacturas Protected Sub LnkSolicitarSat_Click(ByVal sender As Object, ByVal e As EventArgs) - Exit Sub + Dim sbResultado As StringBuilder = New StringBuilder() Dim idSolicitudCFDI As Integer = 0 diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index eb0470f9f..5812337ce 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -117,8 +117,7 @@
    - - +
    @@ -136,6 +135,21 @@
    +
    + +
    + + + +
    +
    + +
    +
    +
    diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index c56d1e3f3..a50e74d4c 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -125,6 +125,15 @@ Partial Class RepContratoDetalle 'Lista de Monedas DdlMoneda.DataSource = GlobalDTMonedas DdlMoneda.DataBind() + + + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoModal) + + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + End Sub Private Sub CargaDatos() 'Información General @@ -139,7 +148,7 @@ Partial Class RepContratoDetalle SubProyecto = Contrato.Rows(0)("SubProyecto").ToString CveMasivo = Contrato.Rows(0)("CveMasivo").ToString.ToEntero LbFolio.Text = Contrato.Rows(0)("NumeroContrato").ToString - LbCveSubProyecto.Text = Contrato.Rows(0)("CveSubProyecto").ToString + DdlClientes.SelectedText = Contrato.Rows(0)("NombreComercial").ToString DdlClientes.SelectedValue = Contrato.Rows(0)("CveCliente").ToString DdlMoneda.SelectedValue = Contrato.Rows(0)("CveMoneda").ToString @@ -147,13 +156,14 @@ Partial Class RepContratoDetalle TxtObservaciones.Text = Contrato.Rows(0)("Observaciones").ToString TelefonoEmpresa = Contrato.Rows(0)("Telefono").ToString TxtUbicacion.Text = Contrato.Rows(0)("Ubicacion").ToString - TxtFechaSalida.Text = Contrato.Rows(0)("FechaInicial").ToString - TxtFechaRegreso.Text = Contrato.Rows(0)("FechaFinal").ToString + TxtFechaSalida.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss") + TxtFechaRegreso.Text = Contrato.Rows(0)("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss") TxtCantidadPasajeros.Text = Contrato.Rows(0)("CantidadPasajeros").ToString DdlTipoAF.SelectedValue = If(Contrato.Rows(0)("CveTipoAF") Is Nothing, "", Contrato.Rows(0)("CveTipoAF").ToString) TxtImporte.Text = Math.Round(Importe, 2).ToString TxtAnticipo.Text = Math.Round(Anticipo, 2).ToString CveContratoEstatus = Contrato.Rows(0)("CveContratosEstatus").ToString.ToEntero + DdlSubProyecto.SelectedValueExist(Contrato.Rows(0)("CveSubProyecto").ToString) If Not IsDBNull(ObjContratos.Archivo) AndAlso ObjContratos.Archivo <> "" AndAlso ObjContratos.Archivo <> "-1" AndAlso ObjContratos.Archivo <> $"{ObjContratos.CveContrato}." Then ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "CONTRATOS", ObjContratos.Archivo) @@ -277,7 +287,7 @@ Partial Class RepContratoDetalle ObjContratos.IniciaTransacSQL() Try If ObjContratos.UpdateContratos(CveContrato, LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", - LbCveSubProyecto.Text.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal, + DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=CveContratoTipo, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveContratosEstatus:=CveContratoEstatus, Observaciones:=TxtObservacion.Text) Then Alert("Contrato actualizado correctamente") End If diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 69f5d475e..f35f0f535 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -262,7 +262,8 @@
    -
    @@ -273,6 +274,28 @@
    + + +
    + +
    +
    + + + + + + <%--
    + +
    --%> +
    +
    +
    +
    @@ -323,18 +346,16 @@
    - + > -
    - -
    +
    @@ -344,18 +365,16 @@
    - + > -
    - -
    +
    @@ -468,10 +487,10 @@ Text="Agregar" ValidationGroup="GrpGuardar"> - + aria-hidden="true">Subir Archivo--%>
    diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index e77e81d96..f1b92413e 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -51,6 +51,11 @@ Partial Class ListadoContratos DdlEstatus.DataBind() DdlEstatus.Items.Insert(0, New ListItem("Todos", "-1")) + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoModal) + + DdlSubProyectoModal.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoModal.DataBind() + DdlSubProyectoModal.Items.Insert(0, New ListItem("Seleccione uno", "-1")) End Sub Private Sub CargaDatos() Dim ObjContratos As New ClsContratos @@ -91,27 +96,102 @@ Partial Class ListadoContratos End Sub Protected Sub AddContrato(sender As Object, e As EventArgs) + Dim ErrorProceso As Boolean = False + Dim CveContrato As Integer = -1 + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Extensiones.Archivo) = Anexo.getfiles().Archivos + Dim Filename As String = "" + Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") + + If Not Directory.Exists(folderContratosPath) Then + Directory.CreateDirectory(folderContratosPath) + End If + + If DdlClientes.SelectedValue = "" Then Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero + 'Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero 'Agregamos Contrato Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() - If ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDateTime, TxtFechaRegreso.Text.ToDateTime, TxtUbicacion.Text, "", CveSubProyecto, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text, CveVendedor:=UsuarioActual.CveVendedor) > 0 Then - ObjContratos.Commit() - Alert("Agregado Correctamente.") + + CveContrato = ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDateTime, TxtFechaRegreso.Text.ToDateTime, TxtUbicacion.Text, "", + DdlSubProyectoModal.SelectedValue.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal, + DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text, + CveVendedor:=UsuarioActual.CveVendedor) + + If CveContrato > 0 Then + + If Filesgral.Count > 0 Then + + For Each fileItem As Archivo In Filesgral + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + Dim fDestino = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", $"{CveContrato.ToString}.{ FileExtension}") + + Try + If File.Exists(fDestino) Then + File.Delete(fDestino) + End If + + File.Move(fileItem.FileUrl, fDestino) + + If Not File.Exists(fDestino) Then + ErrorProceso = True + End If + + If ObjContratos.UpdateContratoArchivo(CveContrato, $"{CveContrato.ToString}.{ FileExtension}", UsuarioActual.CveEmpresa) Then + ErrorProceso = False + End If + + Catch ex As Exception + ErrorProceso = True + End Try + + + Exit For + Next + + Else + ErrorProceso = False + End If + Anexo.Text = "" + + Else + ErrorProceso = True End If - ObjContratos.Dispose() + 'Aumentamos Folio - Dim ObjFolios As New ClsGralFolios - If ObjFolios.UpdateFolioActual(CveSubProyecto, "Con", True, UsuarioActual.CveEmpresa) Then - ObjFolios.Dispose() + Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL()) + If Not ObjFolios.UpdateFolioActual(DdlSubProyectoModal.SelectedValue.ToEntero, "Con", True, UsuarioActual.CveEmpresa) Then + ErrorProceso = True End If + + If Not ErrorProceso Then + ObjContratos.Commit() + Alert("Agregado Correctamente.") + Else + ObjContratos.RollBack() + Alert("Se presento un error al guardar el contrato.", TipoMensaje.MsgAdvertencia) + End If + + ObjContratos.Dispose() + + ResetModal() + + CargaDatos() + RegistraScript("$('#ModalAgregar').modal('hide')", "hidemodal1") + End Sub + + Protected Sub ResetModal() 'Reiniciamos modal TxtDescripcion.Text = "" TxtFechaSalida.Text = "" @@ -119,6 +199,7 @@ Partial Class ListadoContratos TxtObservaciones.Text = "" TxtUbicacion.Text = "" DdlClientes.SelectedText = "" + DdlSubProyectoModal.SelectedValueExist(-1) DdlTipoAF.SelectedValueExist(-1) TxtImporte.Text = "" TxtAnticipo.Text = "" @@ -126,8 +207,6 @@ Partial Class ListadoContratos LbArchivo.Text = "" UpModal.Update() - CargaDatos() - RegistraScript("$('#ModalAgregar').modal('hide')", "hidemodal1") End Sub Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString) diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index 9902036ff..9eae17ef2 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -46,7 +46,7 @@ <%-- Filtros --%> -
    +
    <%-- Filtro Visible - Consulta --%>
    @@ -103,7 +103,7 @@ <%-- Estatus --%>
    - @@ -118,7 +118,7 @@
    @@ -126,7 +126,7 @@
    @@ -134,7 +134,7 @@
    @@ -148,7 +148,7 @@
    <%--Calendario Tab--%> - +
    @@ -208,7 +208,7 @@ + data-sort="true" DataKeyNames="CveContrato, NumeroContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, NombreComercial, CveTipoAF, Importe, ImporteMin, ImporteMax, Observaciones, CveAF, CveChofer, CveChofer2, CveContratosEstatus, CantidadPasajeros,CveMoneda,Moneda,CveSubProyecto"> @@ -358,6 +358,17 @@
    +
    + +
    + + + +
    +
    +
    @@ -401,7 +412,7 @@
    - +
    @@ -601,12 +612,22 @@ yAxis.data.setAll(categorias); + // Obtener valores de las cajas de texto + var fechaI = document.getElementById('<%= txtFechaI.ClientID %>').value; + var fechaF = document.getElementById('<%= txtFechaF.ClientID %>').value; + + // Convertir valores a objetos Date + var minDate = new Date(fechaI.split("/").reverse().join("-")); + var maxDate = new Date(fechaF.split("/").reverse().join("-")); + dateAxis = am5xy.DateAxis.new(root, { - baseInterval: { timeUnit: "minute", count: 1 }, + baseInterval: { timeUnit: "day", count: 1 }, renderer: am5xy.AxisRendererX.new(root, { minorGridEnabled: true, minGridDistance: 90 - }) + }), + min: minDate.getTime(), + max: maxDate.getTime() //min: new Date(2024, 6, 15).getTime(), //max: new Date(2024, 6, 31).getTime() }); @@ -752,10 +773,17 @@ $('#<%=DdlEstatusContrato.ClientID%>').val(event.CveEventoEstatus); $('#<%=TxtDolares.ClientID%>').val(event.Dolares); $('#<%=TxtPesos.ClientID%>').val(event.Pesos); + $('#<%=TxtMoneda.ClientID%>').val(event.Moneda); + + //document.getElementById('<%= TxtMoneda.ClientID %>').value = event.Moneda; + $('#<%=TxtAnticipo.ClientID%>').val(event.Anticipo); $('#<%=HdnCveContrato.ClientID%>').val(event.id); $('#<%=DdlTipoAF.ClientID%>').val(event.CveTipoAF); + $('#<%=DdlSubProyectoModal.ClientID%>').val(event.CveSubProyecto); + + // alert(event.Moneda); if (event.NombreComercial !== null) { @@ -769,29 +797,46 @@ } + function formatearFechaISO(fechaISO) { + let fecha = new Date(fechaISO); - function formatearFechaISO(fechaISO) { - let fecha = new Date(fechaISO); + // Formatear la fecha en DD/MM/YYYY + let dia = fecha.getDate().toString().padStart(2, '0'); + let mes = (fecha.getMonth() + 1).toString().padStart(2, '0'); // getMonth() devuelve mes de 0-11 + let año = fecha.getFullYear(); + + // Formatear la hora en formato 24 horas + let horas = fecha.getHours().toString().padStart(2, '0'); + let minutos = fecha.getMinutes().toString().padStart(2, '0'); + let segundos = fecha.getSeconds().toString().padStart(2, '0'); + + // Combinar la fecha y la hora + return `${dia}/${mes}/${año} ${horas}:${minutos}:${segundos}`; + } + + + //function formatearFechaISO(fechaISO) { + // let fecha = new Date(fechaISO); - // Formatear la fecha en DD/MM/YYYY - let dia = fecha.getDate().toString().padStart(2, '0'); - let mes = (fecha.getMonth() + 1).toString().padStart(2, '0'); // getMonth() devuelve mes de 0-11 - let año = fecha.getFullYear(); + // // Formatear la fecha en DD/MM/YYYY + // let dia = fecha.getDate().toString().padStart(2, '0'); + // let mes = (fecha.getMonth() + 1).toString().padStart(2, '0'); // getMonth() devuelve mes de 0-11 + // let año = fecha.getFullYear(); - // Formatear la hora en formato 12 horas con AM/PM - let horas = fecha.getHours(); - let minutos = fecha.getMinutes().toString().padStart(2, '0'); - let periodo = 'a. m.'; - if (horas >= 12) { - periodo = 'p. m.'; - horas = horas > 12 ? horas - 12 : horas; // Convertir hora de formato 24 a 12 horas - } - if (horas === 0) horas = 12; // Medianoche se muestra como 12 a.m. - horas = horas.toString().padStart(2, '0'); + // // Formatear la hora en formato 12 horas con AM/PM + // let horas = fecha.getHours(); + // let minutos = fecha.getMinutes().toString().padStart(2, '0'); + // let periodo = 'a. m.'; + // if (horas >= 12) { + // periodo = 'p. m.'; + // horas = horas > 12 ? horas - 12 : horas; // Convertir hora de formato 24 a 12 horas + // } + // if (horas === 0) horas = 12; // Medianoche se muestra como 12 a.m. + // horas = horas.toString().padStart(2, '0'); - // Combinar la fecha y la hora - return `${dia}/${mes}/${año} ${horas}:${minutos}:00 ${periodo}`; - } + // // Combinar la fecha y la hora + // return `${dia}/${mes}/${año} ${horas}:${minutos}:00 ${periodo}`; + //} function RadionButtonSelectedValueSet(name, SelectdValue) { $('input[name="' + name + '"][value="' + SelectdValue + '"]').prop('checked', true); @@ -905,7 +950,11 @@ tipoVista: '<%= RBTipoVista.Text %>', METODO: 'contrato_transportes', CveUsuarioPara: $('#DdlTecnico').val(), - CveSubProyecto: $('#DdlSubProyecto').val() + CveSubProyecto: $('#DdlSubProyecto').val(), + CveCliente: $('#C_DdlCliente_Value').val(), + CveContratoEstatus: $('#DdlEstatusConsulta').val(), + CveTipoActivoFijo: $('#DdlTipoUnidad').val(), + CvePersonal: $('#DdlChoferFiltro').val() } }, eventDrop: eventDropped, @@ -944,6 +993,16 @@ } + function TabAltaClicked(sender, e) { + + setTimeout(function () { + InitCalendar(); + + }, 10); + + } + + diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index ce5475750..5ff342023 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -75,6 +75,8 @@ Partial Class RepContratosCalendario GvContratos.DataBind() UpTitulos.Update() + RegistraScript("InitCalendar();") + End Sub Public Shared Function GetLastDayOfMonth(ByVal dateTime As DateTime) As DateTime @@ -157,7 +159,7 @@ Partial Class RepContratosCalendario DdlTipoUnidad.DataBind() 'Lista de Activos fijos - DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa) + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros(" EstadoActivoFijo= 'Activo' ") DdlAF.DataBind() DdlAF.Items.Insert(0, New ListItem("-", "-1")) @@ -187,7 +189,13 @@ Partial Class RepContratosCalendario DdlSubProyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) DdlSubProyectos.DataBind() - DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) + + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoModal) + + DdlSubProyectoModal.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoModal.DataBind() + DdlSubProyectoModal.Items.Insert(0, New ListItem("Seleccione uno", "-1")) 'CargarCentrosDeCosto(Nothing, DdlSubProyectos, Nothing, LblSubProyecto) UpModal.Update() @@ -196,7 +204,8 @@ Partial Class RepContratosCalendario Private Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim BackgroundColor As String = DataBinder.Eval(e.Row.DataItem, "BackgroundColor").ToString() - e.Row.BackColor = Drawing.ColorTranslator.FromHtml(BackgroundColor) + e.Row.BackColor = Drawing.ColorTranslator.FromHtml(BackgroundColor) + e.Row.Cells(1).Attributes.Add("data-order", e.Row.DBCampo("FechaInicial").ToDate.Ticks.ToString) End If End Sub Protected Sub MostrarModal(sender As Object, e As System.EventArgs) @@ -219,15 +228,40 @@ Partial Class RepContratosCalendario Protected Sub UpdateContrato(sender As Object, e As EventArgs) Dim ObjContratos As New ClsContratos - If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, CveContratosEstatus:=DdlEstatusContrato.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text.Trim) Then - RegistraScript("$('#ModalActualizar').modal('hide');") + Dim DTAgendadados As New DataTable + If ObjContratos.GetContratosValUnidadesAgendadas(DdlAF.SelectedValue.ToEntero, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, UsuarioActual.CveEmpresa, CveContrato) Then + + DTAgendadados = ObjContratos.DtResultados.Copy + + If DTAgendadados.Rows.Count > 0 Then + Dim sb As New StringBuilder + sb.Append($"Se detectaron Contratos con la unidad {DdlAF.SelectedItem.Text} asignada en las fechas especificadas.

    ") + For Each dr As DataRow In DTAgendadados.Rows + sb.AppendLine($"Contrato: {dr("NumeroContrato").ToString }, Salida: {dr("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss")}, Regreso: {dr("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss")}
    ") + Next + + Alert(sb.ToString, TipoMensaje.MsgAdvertencia) + DTAgendadados.Dispose() + ObjContratos.Dispose() + Exit Sub + + End If + + End If + + + If ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", DdlSubProyectoModal.SelectedValue.ToEntero, + -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, CveContratosEstatus:=DdlEstatusContrato.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text.Trim) Then + RegistraScript("$('#ModalActualizar').modal('hide');") Alert("Actualizado Correctamente.") End If - ObjContratos.Dispose() - UpTitulos.Update() - CargaDatos() - InicializaCalendar() + ObjContratos.Dispose() + + UpTitulos.Update() + CargaDatos() + InicializaCalendar() + End Sub Protected Sub UpdateModal(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) @@ -238,14 +272,15 @@ Partial Class RepContratosCalendario TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato") TxtObservaciones.Text = GvRow.DataKey("Observaciones") TxtUbicacion.Text = GvRow.DataKey("Ubicacion") - TxtFechaSalida.Text = Convert.ToDateTime(GvRow.DataKey("FechaInicial")).ToString("dd/MM/yyyy hh:mm tt") - TxtFechaRegreso.Text = Convert.ToDateTime(GvRow.DataKey("FechaFinal")).ToString("dd/MM/yyyy hh:mm tt") - TxtMoneda.Text = GvRow.DataKey("CveMoneda") + TxtFechaSalida.Text = Convert.ToDateTime(GvRow.DataKey("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss") + TxtFechaRegreso.Text = Convert.ToDateTime(GvRow.DataKey("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ") + TxtMoneda.Text = GvRow.DataKey("Moneda") 'Requeridos - DdlAF.SelectedValue = GvRow.DataKey("CveAF") + DdlAF.SelectedValueExist(GvRow.DataKey("CveAF")) DdlChofer.SelectedValueExist(GvRow.DataKey("CveChofer")) DdlChofer2.SelectedValueExist(GvRow.DataKey("CveChofer2")) - DdlEstatusContrato.SelectedValue = GvRow.DataKey("CveContratosEstatus") + DdlEstatusContrato.SelectedValueExist(GvRow.DataKey("CveContratosEstatus")) + DdlSubProyectoModal.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) CveContrato = GvRow.DataKey("CveContrato").ToEntero UpCommando.Update() UpModal.Update() @@ -283,6 +318,8 @@ Partial Class RepContratosCalendario Protected Sub RBTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs) InicializaCalendar() CargaCronograma() + + End Sub Protected Sub DdlTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs)