-- ajustes para rep vencimientos
This commit is contained in:
@@ -113,144 +113,38 @@
|
||||
|
||||
<asp:UpdatePanel ID="UpLineasAdicionales" runat="server" RenderMode="Inline" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row " runat="server" visible ="false" id="DvLinea">
|
||||
<div class=" col-md-12" style="text-align: right!important">
|
||||
<input type="text" id="TxtBuscarLineaAdicional" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvD.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvD.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row " runat="server" visible ="false" id="DvLineaPO">
|
||||
<div class=" col-md-12" style="text-align: right!important">
|
||||
<input type="text" id="TxtBuscarLineaAdicionalpo" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:GridView ID="GvD" Width="100%" runat="server" GridLines="None" Visible="false"
|
||||
DataKeyNames="CveLineaAdicional,LineaAdicional,CveCliente,CveProveedor,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveUsuario,CveCategoria,FechaIng,CveLineaAdicionalEstatus,Proveedor,LineaAdicionalComprobante,DiasVencimiento,CveVenta"
|
||||
<asp:GridView ID="GvD" Width="100%" runat="server" GridLines="None"
|
||||
DataKeyNames="CveLineaAdicional,LineaAdicional,CveCliente,CveProveedor,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveUsuario,CveCategoria,FechaIng,Proveedor,DiasVencimiento"
|
||||
CssClass="table table-striped table-advance table-hover ScrollAD input-sm " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="LineaAdicional" HeaderText="Linea Adicional" />
|
||||
<asp:BoundField DataField="NombreCliente" HeaderText="Cliente" />
|
||||
<asp:HyperLinkField DataTextField="NombreCliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" HeaderText="Cliente" />
|
||||
<asp:BoundField DataField="Proveedor" HeaderText="Comercializador" />
|
||||
<asp:BoundField DataField="TipoLineaSTR" HeaderText="Tipo Linea" />
|
||||
<asp:BoundField DataField="Importe" HeaderText="Importe" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="Abreviatura" HeaderText="Moneda" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
|
||||
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasVencimiento" HeaderText="Dias de Venc." />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
|
||||
<asp:BoundField DataField="FechaVencimiento" HeaderText="F. Vencimiento" DataFormatString="{0:d}" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
<asp:GridView ID="GvLAPO" Width="100%" runat="server" GridLines="None" Visible="false"
|
||||
DataKeyNames="CveLineaAdicional,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveLineaAdicionalEstatus,LineaAdicionalComprobante,CveVenta,CveCliente,CveProveedor"
|
||||
CssClass="table table-striped table-advance table-hover ScrollAD input-sm mysmallbtn" ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"
|
||||
OnRowCommand="GvLAPO_RowCommand"
|
||||
OnRowDataBound="GvLAPO_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField ="Agrupador" HeaderText="Agrupador" />
|
||||
<asp:BoundField DataField="LineaAdicional" HeaderText="PO" />
|
||||
<asp:BoundField DataField="Importe" HeaderText="Importe PO" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="Abreviatura" HeaderText="Mon" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
|
||||
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasVencimiento" HeaderText="D.Plazo" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasTranscurridos" HeaderText="D.Trans" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="FechaVenta" HeaderText="F. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField DataField="FechaVencimientoVenta" HeaderText="F. Venc. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
|
||||
<asp:BoundField DataField="FechaEnvio" HeaderText="F. Envío" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:TemplateField HeaderText="Opciones" ItemStyle-Width="75px" HeaderStyle-Width="75px">
|
||||
<ItemTemplate>
|
||||
<div class="row" >
|
||||
<div class="col-md-4" style="max-width:26px!important">
|
||||
<asp:LinkButton ID="LnkCargarComprobante" Visible="false" runat="server" AlternateText="Editar" CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-upload'></i>" OnClick="LnkCargarComprobante_Click"
|
||||
ToolTip="Cargar Comprobante" />
|
||||
<asp:LinkButton ID="LnkDescargaComprobante" Visible="false" runat="server" AlternateText="Descarga" CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-download'></i>" OnClick="LnkDescargaComprobante_Click"
|
||||
ToolTip="Descargar Comprobante" />
|
||||
</div>
|
||||
<div class="col-md-4" style="max-width:26px!important" title="Cambiar estatus a Enviado">
|
||||
<asp:LinkButton ID="LnkCambiarEstatus" runat="server" Visible="false" AlternateText="CambiarEstatus"
|
||||
CommandName="Estatus" CommandArgument='<%# Eval("CveLineaAdicionalEstatus") %>' CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="¿Cambiar Estado?" data-btn-ok-label="si"
|
||||
ToolTip="Cambiar estatus a Enviado" />
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<%-- MODAL COMPROBANTE --%>
|
||||
<div id="ModalComprobante" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" style="width: 700px;">
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Agregar Comprbante</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UpAddComprobancte" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<asp:TextBox ID="Anexo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAddComprobante" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" OnClick="BtnAddComprobante_Click" />
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%-- FIN MODAL COMPROBANTE --%>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
|
||||
@@ -88,58 +88,20 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
DTDatosGvD = new DataTable();
|
||||
LnkDescargaExcel.Visible = false;
|
||||
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
DTDatosGvD = new DataTable();
|
||||
LnkDescargaExcel.Visible = false;
|
||||
|
||||
int CveProveedor = -1;
|
||||
|
||||
if(TipoLinea == 1)
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
|
||||
if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), 1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvD.DataSource = objVentas.DtResultados;
|
||||
|
||||
if (objVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DTDatosGvD = objVentas.DtResultados;
|
||||
LnkDescargaExcel.Visible = true;
|
||||
if (objVentas.GetLineasAdicionalesVencimientos( DdlClientes.SelectedValue.ToEntero(), -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
}
|
||||
GvD.DataSource = objVentas.DtResultados;
|
||||
|
||||
if (objVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DTDatosGvD = objVentas.DtResultados;
|
||||
{
|
||||
GvD.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)
|
||||
{
|
||||
DTDatosGvD = objVentas.DtResultados;
|
||||
LnkDescargaExcel.Visible = true;
|
||||
UpAcciones.Update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LnkDescargaExcel.Visible = true;
|
||||
UpAcciones.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
objVentas.Dispose();
|
||||
@@ -155,116 +117,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas
|
||||
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<Archivo> 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)
|
||||
{
|
||||
|
||||
RegistraScript("$('#ModalComprobante').modal('show');","");
|
||||
}
|
||||
|
||||
@@ -273,14 +126,7 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas
|
||||
protected void LnkDescargaExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(TipoLinea == 1)
|
||||
{
|
||||
GridView gvTemp = GvD;
|
||||
//gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString());
|
||||
gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150);
|
||||
}
|
||||
else if(TipoLinea == 2)
|
||||
{
|
||||
GridView gvTemp = GvLAPO;
|
||||
{
|
||||
GridView gvTemp = GvD;
|
||||
//gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString());
|
||||
gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150);
|
||||
@@ -351,28 +197,6 @@ public partial class Ventas_RepVencimientosCredito : ClsPaginas
|
||||
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)
|
||||
{
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user