From 1ebf10f80d9c8f884764d8d6dc30e6c77fe671e3 Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 11 May 2024 07:26:23 -0700 Subject: [PATCH 1/6] -- nuevo Reporte de vencimientos --- App_Code/ClsPaginas.vb | 6 +- App_Code/ClsVentas.vb | 24 ++ Ventas/RepVencimientosCredito.aspx | 233 +++++++++++++++ Ventas/RepVencimientosCredito.aspx.cs | 409 ++++++++++++++++++++++++++ 4 files changed, 667 insertions(+), 5 deletions(-) create mode 100644 Ventas/RepVencimientosCredito.aspx create mode 100644 Ventas/RepVencimientosCredito.aspx.cs diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 0b524ae8f..277b6fbf5 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10670,7 +10670,6 @@ Public Class ClsPaginas PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 69) PaginaDict.Add("/Sistemas/CatParametros.aspx".ToUpper(), 143) PaginaDict.Add("/Sistemas/PopUpCargaCertificados.aspx".ToUpper(), 144) - PaginaDict.Add("/Sistemas/CatNotificaciones.aspx".ToUpper(), 146) PaginaDict.Add("/Sistemas/EmpresasModulos.aspx".ToUpper(), 346) PaginaDict.Add("/Sistemas/CatSesiones.aspx".ToUpper(), 374) PaginaDict.Add("/Sistemas/CatFuncionalidades.aspx".ToUpper(), 568) @@ -10789,10 +10788,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/CatEspecialidadesSubEspecialidades.aspx".ToUpper(), 1346) PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546) PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347) - - - - + PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index ab0b16d22..844dbb8db 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5983,6 +5983,30 @@ Public Class ClsVentas End Function + Public Function GetLineasAdicionalesVencimientos(CveCliente As Integer, TipoLinea As Integer, FechaInicio As Date, FechaFin As Date, CveMoneda As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_LineasAdicionalesVencimientosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error obtener las lineas de adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + + End Function + + Public Function CambioClientesVendedor(CveCliente As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Ventas/RepVencimientosCredito.aspx b/Ventas/RepVencimientosCredito.aspx new file mode 100644 index 000000000..8c3639ca1 --- /dev/null +++ b/Ventas/RepVencimientosCredito.aspx @@ -0,0 +1,233 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepVencimientosCredito.aspx.cs" Inherits="Ventas_RepVencimientosCredito" %> + + + + + + + + + + + + + + + +
  • + Excel +
  • +
    + + + +
    + +
    + + + + + + +
    +
    +
    + + +
    +
    +
    + +
    Comercializador:
    +
    + +
    + +
    Cliente:
    +
    + +
    + +
    Estatus:
    +
    + + + <%-- --%> + + + +
    +
    Agrupador:
    +
    + + + + +
    + +
    +
    +
    + +
    +
    +
    + + +
    +
    + + + + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + +
    +
    +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + + +
    +
    + + + + + <%-- MODAL COMPROBANTE --%> + + <%-- FIN MODAL COMPROBANTE --%> + + + + + + +
    + + + + + + diff --git a/Ventas/RepVencimientosCredito.aspx.cs b/Ventas/RepVencimientosCredito.aspx.cs new file mode 100644 index 000000000..e40e21656 --- /dev/null +++ b/Ventas/RepVencimientosCredito.aspx.cs @@ -0,0 +1,409 @@ +using System; using System.Web.UI.WebControls; using Extensiones; using System.Data; using static Extensiones.ModExtensiones; +using System.Collections.Generic; +using System.IO; +using System.Web.UI; + + +public partial class Ventas_RepVencimientosCredito : ClsPaginas +{ + #region PROPIEDADES + + + private int CveLineaAdicional + { + get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); } + set { ViewState["CveLineaAdicional"] = (int)value; } + } + + private int CveVenta + { + get { return (ViewState["CveVenta"] == null) ? 0 : int.Parse(ViewState["CveVenta"].ToString()); } + set { ViewState["CveVenta"] =(int) value; } + } + + private int TipoLinea + { + get { return (ViewState["TipoLinea"] == null) ? 1: int.Parse(ViewState["TipoLinea"].ToString()); } + set { ViewState["TipoLinea"] = (int)value; } + } + + private DataTable DTDatosGvLineasAdicionales + { + get + { + if (ViewState["DTDatosGvLineasAdicionales"] == null) + { + ViewState["DTDatosGvLineasAdicionales"] = new DataTable(); + } + return (DataTable)ViewState["DTDatosGvLineasAdicionales"]; + } + set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; } + } + + private string LineaAdicionalComprobante + { + get { + + if(ViewState["LineaAdicionalComprobante"] == null) + { + ViewState["LineaAdicionalComprobante"] = ""; + } + + return ViewState["LineaAdicionalComprobante"].ToString(); + } + set { ViewState["LineaAdicionalComprobante"] = value; } + } + + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + InicializaValores(); + CargaDatos(); + } + } + + private void InicializaValores() + { + + if (Request["OP"] != null && Request["OP"].ToString() == "PO") + { + DVProveedor1.Visible = true; + DVProveedor2.Visible = true; + TipoLinea = 2; + LtlEncabezado.Text = "Reporte PO"; + GvLAPO.Visible = true; + DvLineaPO.Visible = true; + DVAgrupador1.Visible = true; + DVAgrupador2.Visible = true; + + } + else + { + DvLinea.Visible = true; + GvLineasAdicionales.Visible = true; + } + + + if(UsuarioActual.Empresa.Funcionalidad(105) == "1") { + DdlProveedor.setEsWebService(true); + DdlProveedor.Attributes.Add("data-metodo", "getproveedores"); + DdlProveedor.SelectedText = "Todos"; + DdlProveedor.SelectedValue = "-1"; + }else { + DdlProveedor.setEsWebService(false); + DdlProveedor.ddl.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa); + DdlProveedor.ddl.DataBind(); + DdlProveedor.ddl.Items.Insert(0, new ListItem("-", "-1")); + } + + DdlClientes.setEsWebService(true); + DdlClientes.Attributes.Add("data-metodo", "getcliente"); + DdlClientes.SelectedText = "Todos"; + DdlClientes.SelectedValue = "-1"; + + + + } + + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatos(); + } + + private void CargaDatos() + { + DTDatosGvLineasAdicionales = new DataTable(); + LnkDescargaExcel.Visible = false; + + ClsVentas objVentas = new ClsVentas(); + + int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1; + + if(TipoLinea == 1) + { + if (objVentas.RepLineasAdicionales(-1,-1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 1, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)) + { + GvLineasAdicionales.DataSource = objVentas.DtResultados; + + if (objVentas.DtResultados.Rows.Count > 0) + { + DTDatosGvLineasAdicionales = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); + } + } + else + { + GvLineasAdicionales.DataSource = null; + } + } + else + { + + if (DdlAgrupador.SelectedValue.ToEntero()== 1){ + GvLAPO.Columns[0].HeaderText = "Comercializador"; + } + else + { + GvLAPO.Columns[0].HeaderText = "Cliente"; + } + + if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa)) + { + GvLAPO.DataSource = objVentas.DtResultados; + + if (objVentas.DtResultados.Rows.Count > 0) + { + DTDatosGvLineasAdicionales = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); + } + } + else + { + GvLAPO.DataSource = null; + } + } + + objVentas.Dispose(); + GvLineasAdicionales.DataBind(); + GvLAPO.DataBind(); + UpLineasAdicionales.Update(); + } + + + protected void LnkCargarComprobante_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer; + + CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); + CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); + LineaAdicionalComprobante = GvRow.DataKey("LineaAdicionalComprobante").ToString(); + + RegistraScript("$('#ModalComprobante').modal('show');",""); + } + + protected void BtnAddComprobante_Click(object sender, EventArgs e) + { + bool errorCargaComprobante = false; + string FileExtension = "-1"; + List filesgral = Anexo.getfiles().Archivos; + string filemove = ""; + FileInfo fiNuevo; + + DirectoryInfo df = new DirectoryInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\"); + + //Crea directorio si no existe + if (!df.Exists) + { + try + { + Directory.CreateDirectory(df.FullName); + } + catch + { + errorCargaComprobante = true; + } + } + + //borrar archivo anterior + if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0) + { + FileInfo fiAnterior = new FileInfo($@"{df.FullName}{LineaAdicionalComprobante}"); + if (fiAnterior.Exists) + { + try + { + File.Delete(fiAnterior.FullName); + } + catch + { + errorCargaComprobante = true; + } + } + } + + if(!errorCargaComprobante){ + + string RutaArchivoTemp = ""; + foreach (Archivo fileItem in filesgral) + { + FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", ""); + filemove = fileItem.filename; + RutaArchivoTemp = $@"{AppDomain.CurrentDomain.BaseDirectory}\Temp\{fileItem.filename}"; + break; + } + + if((!errorCargaComprobante) && RutaArchivoTemp.Length > 0) + { + fiNuevo = new FileInfo(RutaArchivoTemp); + + if (fiNuevo.Exists) + { + try + { + if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}")) + { + File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); + } + File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); + errorCargaComprobante = false; + } + catch + { + errorCargaComprobante = true; + } + if (!errorCargaComprobante) + { + ClsVentas objVentas = new ClsVentas(); + if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, $@"{CveVenta}{fiNuevo.Extension}", -1, UsuarioActual.CveEmpresa)) + { + errorCargaComprobante = true; + } + objVentas.Dispose(); + } + } + } + } + + if (!errorCargaComprobante) + { + CargaDatos(); + Anexo.Text = "[]"; + RegistraScript("$('#ModalComprobante').modal('hide');", ""); + Alert("Comprobante actualizado correctamente."); + } + UpAddComprobancte.Update(); + } + + protected void LnkCambiarEstatus_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; + int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToEntero(); + int CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + bool errorCambioEstatus = false; + ClsVentas objVentas = new ClsVentas(); + if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, "", 2, UsuarioActual.CveEmpresa)) + { + errorCambioEstatus = true; + } + if (!errorCambioEstatus) + { + CargaDatos(); + } + objVentas.Dispose(); + } + + protected void LnkDescargaExcel_Click(object sender, EventArgs e) + { + if(TipoLinea == 1) + { + GridView gvTemp = GvLineasAdicionales; + //gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString()); + gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150); + } + else if(TipoLinea == 2) + { + GridView gvTemp = GvLAPO; + gvTemp.Columns[12].Visible = false; + //gvTemp.ExportToExcelX("ReportePO" + NowADS().ToShortDateString()); + gvTemp.ExportToExcelGembox( "ReportePO", UsuarioActual, "Reporte PO ", AnchoImagen:150); + } + } + + protected void GvLAPO_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + + LinkButton LnkCambiarEstatus = e.Row.FCLinkButton("LnkCambiarEstatus"); + LinkButton LnkCargarComprobante = e.Row.FCLinkButton("LnkCargarComprobante"); + LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante"); + + if (e.Row.DataKey("CveLineaAdicional")=="") + { + if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "") + { + e.Row.CssClass = "SubTotales2"; + if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "" && e.Row.DataKey("CveProveedor") != "") + { + e.Row.Cells[0].Text = ""+ e.Row.DBCampo("Proveedor") +""; + } + } + else + { + e.Row.CssClass = "SubTotales"; + } + LnkCambiarEstatus.Visible = false; + LnkCargarComprobante.Visible = false; + LnkDescargaComprobante.Visible = false; + } + else + { + if (e.Row.DataKey("CveVenta").ToEntero() > 0 && e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 1) + { + + if (UsuarioActual.TienePermisoProceso(356)) LnkCambiarEstatus.Visible = true; + LnkCargarComprobante.Visible = true; + } + + if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0) + { + FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}"); + + if (fi.Exists) + { + LnkDescargaComprobante.Visible = true; + ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaComprobante); + } + } + } + } + } + + protected void LnkDescargaComprobante_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; + string Comprobante = GvRow.DataKey("LineaAdicionalComprobante"); + FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{Comprobante}"); + + if (fi.Exists) + { + Response.Clear(); + Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name); + Response.AddHeader("Content-Length", fi.Length.ToString()); + Response.ContentType = "text/octet-stream"; + Response.Flush(); + Response.TransmitFile(fi.FullName); + Response.End(); + } + } + + protected void GvLAPO_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "Estatus") + { + GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; + int CveLineaAdicionalActualizarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); + int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); + + bool errorCambioEstatus = false; + //int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus + + ClsVentas objVentas = new ClsVentas(); + if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicionalActualizarEstatus, CveVenta,"", 2, UsuarioActual.CveEmpresa)) + { + errorCambioEstatus = true; + } + objVentas.Dispose(); + if (!errorCambioEstatus) + { + CargaDatos(); + } + } + } + +} \ No newline at end of file From 90c9c1fde3dc722a12ea07aec3032c1e2157d596 Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 11 May 2024 07:26:59 -0700 Subject: [PATCH 2/6] -- mejorar el mensaje del concepto pareja que falta cuenta --- App_Code/ClsContabilidad.vb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 10d58a750..e9fd6f6d5 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1004,11 +1004,13 @@ Public Class ClsContabilidad If ex1.Message.Contains("50015;") Then OnError("No se puede registrar una póliza en un ejercicio Cerrado", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) ElseIf ex1.Message.Contains("50024; La Cuenta no fue detectada") Then - Dim dtt As DataTable = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable) + Dim dr As Data.DataRow = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable).FiltroPrimero("") Dim StrMsg As String = "" - If dtt IsNot Nothing Then + If dr IsNot Nothing Then + If CveConceptoContable <> dr("CveConceptoContable").ToString.ToEntero Then 'si el concepto pareja no es principal, lo obtengo + dr = ClsPaginas.GlobalDTContaConceptosContables(dr("CveParejaContable").ToString.ToEntero).FiltroPrimero("") + End If Dim tCveEmp As Integer = CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).CveEmpresa - Dim dr As Data.DataRow = dtt.FiltroPrimero("") If dr IsNot Nothing Then StrMsg = dr("ConceptoContable").ToString If dr("AplicaClasificacion").ToString = "True" Then From a4695df7af2a6f4df0079e8d72608b95becb1a5c Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 13 May 2024 08:44:00 -0700 Subject: [PATCH 3/6] =?UTF-8?q?EMD=20-=20OC=20Autorizadas,=20registrar=20p?= =?UTF-8?q?rep=C3=B3liza=20154=20Cargo,=20152=20Abono?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Contratos/RepPresupuestos.aspx | 14 ++- OC/OC.aspx.vb | 117 ++++++++++++++++++--- Transportes/RepContratos.aspx | 74 ++++++------- Transportes/RepContratosCalendario.aspx | 20 ++-- Transportes/RepContratosCalendario.aspx.vb | 5 +- 5 files changed, 167 insertions(+), 63 deletions(-) diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx index e62242dae..d8ba3eecc 100644 --- a/Contratos/RepPresupuestos.aspx +++ b/Contratos/RepPresupuestos.aspx @@ -330,6 +330,7 @@ Agrupador Autorizado + Comprometido Ejercido Por Ejercer Pagado @@ -342,6 +343,7 @@ <%-- + @@ -377,9 +379,11 @@ Total + - + + @@ -459,15 +463,19 @@ <%-- --%> - + <%-- --%> - + + + + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 426f06023..71a3f72b6 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -6,6 +6,7 @@ Imports System.Data.SqlClient Imports System.IO Imports Extensiones Imports GemBox.Spreadsheet +Imports Microsoft.Owin.Security.Provider Imports Newtonsoft.Json Partial Class OC_OC @@ -2852,6 +2853,14 @@ Partial Class OC_OC End If + If Not TieneError AndAlso TipoOC = "OC" Then + + If Not GeneraPrePolizaPresupuesto(CveOrdenCompra, OC.IniciaTransacSQL) Then + TieneError = True + End If + + End If + If Not TieneError Then If Conta IsNot Nothing Then Conta.Commit() OC.Commit() @@ -3304,6 +3313,7 @@ Partial Class OC_OC 'TERMINA TODO POR SI OCURRIÓ ALGO RARO If TieneError Then + If OC IsNot Nothing Then OC.RollBack() If UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto Then If Conta IsNot Nothing Then Conta.RollBack() @@ -3505,6 +3515,16 @@ Partial Class OC_OC End If + + If Not HuboError AndAlso UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + + If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then + HuboError = True + End If + + End If + + Catch ex As Exception HuboError = True End Try @@ -9027,22 +9047,6 @@ Partial Class OC_OC If resultadosFiltrados.Count > 0 Then - Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable() - Group row By - SubProyecto = row.Field(Of String)("SubProyecto"), - CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"), - Clasificacion = row.Field(Of String)("Clasificacion"), - CveClasificacion = row.Field(Of Integer)("CveClasificacion") - Into Group - Select New With { - .SubProyecto = SubProyecto, - .CveSubProyecto = CveSubProyecto, - .Clasificacion = Clasificacion, - .CveClasificacion = CveClasificacion, - .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total")))) - }).ToList() - - If Opcion = 1 Then @@ -9075,6 +9079,22 @@ Partial Class OC_OC End If Else + + Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable() + Group row By + SubProyecto = row.Field(Of String)("SubProyecto"), + CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"), + Clasificacion = row.Field(Of String)("Clasificacion"), + CveClasificacion = row.Field(Of Integer)("CveClasificacion") + Into Group + Select New With { + .SubProyecto = SubProyecto, + .CveSubProyecto = CveSubProyecto, + .Clasificacion = Clasificacion, + .CveClasificacion = CveClasificacion, + .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total")))) + }).ToList() + For Each item In EnumAgrupado Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto) @@ -9105,6 +9125,7 @@ Partial Class OC_OC respuesta = True End If Next + End If Else @@ -9130,6 +9151,70 @@ Partial Class OC_OC End Function + Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPrePoliza As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean + + Dim Respuesta As Boolean = True + + If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + + Dim ObjConta As New ClsContabilidad() + + If transaccion Is Nothing Then + ObjConta = New ClsContabilidad(Nothing) + Else + ObjConta = New ClsContabilidad(transaccion) + End If + + + Dim CvePrePolizaPreSuPuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePrePolizaPreSuPuesto > 0 Then + + Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable() + Group row By + SubProyecto = row.Field(Of String)("SubProyecto"), + CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"), + Clasificacion = row.Field(Of String)("Clasificacion"), + CveClasificacion = row.Field(Of Integer)("CveClasificacion") + Into Group + Select New With { + .SubProyecto = SubProyecto, + .CveSubProyecto = CveSubProyecto, + .Clasificacion = Clasificacion, + .CveClasificacion = CveClasificacion, + .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))) + If(IsDBNull(r("IVA")), 0D, Convert.ToDecimal(r("IVA"))) + If(IsDBNull(r("IEPSPSIVA")), 0D, Convert.ToDecimal(r("IEPSPSIVA"))) - If(IsDBNull(r("RetIVA")), 0D, Convert.ToDecimal(r("RetIVA"))) - If(IsDBNull(r("RetISR")), 0D, Convert.ToDecimal(r("RetISR")))) + }).ToList() + + For Each item In EnumAgrupado + + Dim SerieFolio = $"OC: {Folio}, Clasificación: {item.Clasificacion}" + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, item.TotalSum, item.TotalSum, 154, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Respuesta = False + Exit For + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, item.TotalSum, item.TotalSum, 152, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Respuesta = False + Exit For + End If + + Next + Else + Respuesta = False + End If + + + + End If + + Return Respuesta + + End Function + + + + #End Region diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 86deadc43..d8dd7ac16 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -41,15 +41,16 @@ <%-- Filtro Visible - Consulta --%>
    - +
    -
    -
    +
    + + <%--
    --%> + <%-- Fecha Inicial --%> -
    +
    @@ -69,7 +70,7 @@
    <%-- Fecha Final --%> -
    +
    @@ -100,43 +101,44 @@
    -
    + <%--
    --%>
    <%-- Filtro Oculto --%> -
    -
    -
    + + + +
    +
    +
    +
    +
    @@ -485,7 +491,7 @@
    - + @@ -691,14 +697,14 @@ } function updateEvent(event, element) { + $('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros); $('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato); $('#<%=TxtObservaciones.ClientID%>').val(event.title); $('#<%=TxtDescripcion.ClientID%>').val(event.title); $('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento); - <%--$('#<%=TxtFechaSalida.ClientID%>').val(event.start._i); - $('#<%=TxtFechaRegreso.ClientID%>').val(event.end._i);--%> + $('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i)); $('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal)); @@ -722,7 +728,8 @@ $('#HidModCveCliente').val(event.CveCliente); - $('#<%=BtnModal.ClientID%>').click(); + $('#<%=BtnModal.ClientID%>').click(); + } @@ -793,6 +800,7 @@ } function Calendario() { + var date = new Date(); var d = date.getDate(); var m = date.getMonth(); diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index bff2a01e6..e47c8d212 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -38,7 +38,7 @@ Partial Class RepContratosCalendario InicializaCalendar() CargaDatos() End If - InicializaCalendar() + 'InicializaCalendar() End Sub Private Sub CargaDatos() Dim ObjContratos As New ClsContratos @@ -193,7 +193,8 @@ Partial Class RepContratosCalendario Dim ObjContratos As New ClsContratos ObjContratos.IniciaTransacSQL() - If Contrato.ToEntero <= 0 Then Contrato = CveContrato.Value + Contrato = CveContrato.Value + If ObjContratos.UpdateContratos(Contrato.ToEntero, 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) Then ObjContratos.Commit() Alert("Actualizado Correctamente.") From 46599f20de7160580b893b1c729a5ae6d270a539 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 13 May 2024 10:54:05 -0700 Subject: [PATCH 4/6] =?UTF-8?q?EMD=20-=20OC=20Autorizadas,=20registrar=20p?= =?UTF-8?q?rep=C3=B3liza=20154=20Cargo,=20152=20Abono=20dolares?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Contratos/RepPresupuestos.aspx | 8 ++++---- OC/OC.aspx.vb | 29 +++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx index d8ba3eecc..ebe5ac5bd 100644 --- a/Contratos/RepPresupuestos.aspx +++ b/Contratos/RepPresupuestos.aspx @@ -329,8 +329,8 @@ - - + + @@ -342,8 +342,8 @@ <%-- - - + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 71a3f72b6..7fe4a936e 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -926,7 +926,13 @@ Partial Class OC_OC ChkEntregaDirecta.Checked = False End If - + If CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then + If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then + Alert("PrePoliza de Presupuesto Generada Correctamente") + Else + Alert("No Se Genero la PrePoliza de Presupuesto Generada Correctamente", TipoMensaje.MsgAdvertencia) + End If + End If End If @@ -9151,21 +9157,28 @@ Partial Class OC_OC End Function - Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPrePoliza As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean + Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPresupuesto As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean Dim Respuesta As Boolean = True If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + Dim CveMonedaPresupuesto As Integer = DdlMoneda.SelectedValue.ToEntero + Dim TC As Decimal = If(CveMonedaPresupuesto = 1, 1, GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal) + + If CveMonedaPresupuesto > 1 AndAlso TC = 0 Then + Alert($"No se genero la prepoliza de presupuesto, no se pudo obtener el Tipo de Cambio de la fecha {TxtFecha.Text}", TipoMensaje.MsgAdvertencia) + Return False + End If + Dim ObjConta As New ClsContabilidad() If transaccion Is Nothing Then - ObjConta = New ClsContabilidad(Nothing) + ObjConta = New ClsContabilidad() Else ObjConta = New ClsContabilidad(transaccion) End If - Dim CvePrePolizaPreSuPuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If CvePrePolizaPreSuPuesto > 0 Then @@ -9189,12 +9202,16 @@ Partial Class OC_OC Dim SerieFolio = $"OC: {Folio}, Clasificación: {item.Clasificacion}" - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, item.TotalSum, item.TotalSum, 154, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + Dim Importe As Decimal = item.TotalSum + Dim ImporteME As Decimal = If(CveMonedaPresupuesto = 1, 0, item.TotalSum) + Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, 1, item.TotalSum * TC) + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then Respuesta = False Exit For End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, item.TotalSum, item.TotalSum, 152, SerieFolio, SerieFolio, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPrePoliza, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, Importe, ImporteMN, 152, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then Respuesta = False Exit For End If From ab93b922557aae3986392ed4cc3932f019695b92 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 13 May 2024 17:38:55 -0700 Subject: [PATCH 5/6] VyA - calendario pierde las fechas, la regresa al mes actual al hacer postback --- OC/OC.aspx.vb | 8 +-- Transportes/RepContratosCalendario.aspx | 61 ++++++++++++++++++++-- Transportes/RepContratosCalendario.aspx.vb | 8 +-- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 7fe4a936e..55c3c1330 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -926,7 +926,7 @@ Partial Class OC_OC ChkEntregaDirecta.Checked = False End If - If CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then + If UsuarioActual.CveEmpresa.Contiene(13, 73) AndAlso CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then Alert("PrePoliza de Presupuesto Generada Correctamente") Else @@ -3522,7 +3522,7 @@ Partial Class OC_OC End If - If Not HuboError AndAlso UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + If UsuarioActual.CveEmpresa.Contiene(13, 73) Then If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then HuboError = True @@ -9161,7 +9161,7 @@ Partial Class OC_OC Dim Respuesta As Boolean = True - If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + If UsuarioActual.CveEmpresa.Contiene(13, 73) Then Dim CveMonedaPresupuesto As Integer = DdlMoneda.SelectedValue.ToEntero Dim TC As Decimal = If(CveMonedaPresupuesto = 1, 1, GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal) @@ -9204,7 +9204,7 @@ Partial Class OC_OC Dim Importe As Decimal = item.TotalSum Dim ImporteME As Decimal = If(CveMonedaPresupuesto = 1, 0, item.TotalSum) - Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, 1, item.TotalSum * TC) + Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, item.TotalSum, item.TotalSum * TC) If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then Respuesta = False diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index ed6b65f08..04147c7a9 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -500,6 +500,9 @@ + + + @@ -688,8 +691,14 @@ var date = null; function InitCalendar() { - $(document).ready(function () { - Calendario(); + $(document).ready(function () { + + let mes = parseInt($('#<%=HidCurrentMonth.ClientID%>').val()); + let anio = parseInt($('#<%=HidCurrentYear.ClientID%>').val()); + + + Calendario(mes,anio); + }); } @@ -799,7 +808,20 @@ updateEventOnDropResize(event); } - function Calendario() { + function Calendario(mes = -1, anio = -1) { + + + let fechaActual = new Date(); + if (mes === -1) { + mes = fechaActual.getMonth() + 1; + } + if (anio === -1) { + anio = fechaActual.getFullYear(); + } + + + let mesFormateado = ('0' + mes).slice(-2); + let fechaInicio = `${anio}-${mesFormateado}-01`; var date = new Date(); var d = date.getDate(); @@ -807,6 +829,7 @@ var y = date.getFullYear(); var h = {}; + //alert(fechaInicio); if ($('#calendar').width() <= 400) { $('#calendar').addClass("mobile"); h = { @@ -826,6 +849,7 @@ $('#calendar').fullCalendar('destroy'); $('#calendar').fullCalendar({ + defaultDate: fechaInicio, header: h, monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'], @@ -857,10 +881,39 @@ } }, eventDrop: eventDropped, - eventResize: eventResized + eventResize: eventResized, + viewRender: function(view, element) { + + let pointDate = view.intervalStart; + let currentMonth = pointDate.month() + 1; + let currentYear = pointDate.year(); + + $('#<%=HidCurrentMonth.ClientID%>').val(currentMonth); + $('#<%=HidCurrentYear.ClientID%>').val(currentYear); + + } + }); } + function obtenerFechaInicio(mes = -1, anio = -1) { + let fechaActual = new Date(); + + if (mes === -1) { + mes = fechaActual.getMonth() + 1; // getMonth() es base 0, así que se suma 1 + } + if (anio === -1) { + anio = fechaActual.getFullYear(); + } + + + let mesFormateado = ('0' + mes).slice(-2); + + + let fechaInicio = `${anio}-${mesFormateado}-01`; + + return fechaInicio; + } diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index e47c8d212..dbafeca6b 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -107,7 +107,8 @@ Partial Class RepContratosCalendario UPPGantt.Update() End If End Sub - Private Sub InicializaCalendar() + Private Sub InicializaCalendar() + RegistraScript("InitCalendar();") DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True End Sub @@ -200,11 +201,12 @@ Partial Class RepContratosCalendario Alert("Actualizado Correctamente.") Else ObjContratos.RollBack() - End If - + End If + 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) From 8ea3861e0e1c89d3c17947c5edf666abc8265e43 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Mon, 13 May 2024 18:38:00 -0700 Subject: [PATCH 6/6] OC.aspx, validar presupuesto con el valor del concepto 154 --- OC/OC.aspx.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 55c3c1330..40d6360bd 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -9034,7 +9034,8 @@ Partial Class OC_OC Dim respuesta As Boolean = False - If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + 'If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then + If UsuarioActual.CveEmpresa.Contiene(13, 83) Then Dim ObjCon As New ClsContratos Dim CvePresupuesto As Integer = 0
    AgrupadorAutorizadoComprometidoAutorizadoComprometido Ejercido Por Ejercer Pagado