From 895fec5199e863d1d46f1ddb89609000b8e76f90 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 29 May 2024 07:41:43 -0700 Subject: [PATCH] -- ajustes para rep vencimientos --- Ventas/RepVencimientosCredito.aspx | 120 +--------------- Ventas/RepVencimientosCredito.aspx.cs | 196 ++------------------------ 2 files changed, 17 insertions(+), 299 deletions(-) diff --git a/Ventas/RepVencimientosCredito.aspx b/Ventas/RepVencimientosCredito.aspx index 4e0d07699..6e137229f 100644 --- a/Ventas/RepVencimientosCredito.aspx +++ b/Ventas/RepVencimientosCredito.aspx @@ -113,144 +113,38 @@ -
" 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 index 8c7d13ece..bcd923158 100644 --- a/Ventas/RepVencimientosCredito.aspx.cs +++ b/Ventas/RepVencimientosCredito.aspx.cs @@ -88,58 +88,20 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas LnkDescargaExcel.Visible = false; ClsVentas objVentas = new ClsVentas(); - - int CveProveedor = -1; - - if(TipoLinea == 1) + + if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa)) { - if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), 1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa)) - { - GvD.DataSource = objVentas.DtResultados; + GvD.DataSource = objVentas.DtResultados; - if (objVentas.DtResultados.Rows.Count > 0) - { - DTDatosGvD = objVentas.DtResultados; - LnkDescargaExcel.Visible = true; - UpAcciones.Update(); - } - } - else + if (objVentas.DtResultados.Rows.Count > 0) { - GvD.DataSource = null; + DTDatosGvD = objVentas.DtResultados; + LnkDescargaExcel.Visible = true; + UpAcciones.Update(); } } - 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) - { - DTDatosGvD = objVentas.DtResultados; - LnkDescargaExcel.Visible = true; - UpAcciones.Update(); - } - } - else - { - GvLAPO.DataSource = null; - } - } - objVentas.Dispose(); GvD.DataBind(); - GvLAPO.DataBind(); UpLineasAdicionales.Update(); } @@ -155,116 +117,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas 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) { @@ -273,14 +126,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas GridView gvTemp = GvD; //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) @@ -351,28 +197,6 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas } } - 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