Limpieza, lienas adicionales
This commit is contained in:
@@ -70,10 +70,19 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
|
||||
|
||||
private void InicializaValores()
|
||||
{
|
||||
|
||||
if (Request["OP"] != null && Request["OP"].ToString() == "PO")
|
||||
|
||||
if (Request["OP"] != null && Request["OP"].ToString() == "PO")
|
||||
{
|
||||
DVProveedor1.Visible = true;
|
||||
DVProveedor2.Visible = true;
|
||||
TipoLinea = 2;
|
||||
LtlEncabezado.Text = "Reporte PO";
|
||||
GvLineasAdicionalesPO.Visible = true;
|
||||
DvLineaPO.Visible = true;
|
||||
DVAgrupador1.Visible = true;
|
||||
DVAgrupador2.Visible = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DvLinea.Visible = true;
|
||||
@@ -97,8 +106,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
|
||||
}
|
||||
|
||||
DdlClientes.setEsWebService(true);
|
||||
DdlClientes.Attributes.Add("data-metodo", "getcliente");
|
||||
DdlClientes.SelectedText = "Todos";
|
||||
DdlClientes.Attributes.Add("data-metodo", "getcliente");
|
||||
DdlClientes.SelectedText = "Todos";
|
||||
DdlClientes.SelectedValue = "-1";
|
||||
|
||||
@@ -117,24 +125,61 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
|
||||
DTDatosGvLineasAdicionales = new DataTable();
|
||||
LnkDescargaExcel.Visible = false;
|
||||
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
|
||||
int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1;
|
||||
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
|
||||
int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1;
|
||||
|
||||
GvLineasAdicionales.DataSource = objVentas.DtResultados;
|
||||
|
||||
if( objVentas.DtResultados.Rows.Count > 0)
|
||||
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){
|
||||
GvLineasAdicionalesPO.Columns[0].HeaderText = "Comercializador";
|
||||
}
|
||||
else
|
||||
{
|
||||
GvLineasAdicionalesPO.Columns[0].HeaderText = "Cliente";
|
||||
}
|
||||
|
||||
if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvLineasAdicionalesPO.DataSource = objVentas.DtResultados;
|
||||
|
||||
if (objVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DTDatosGvLineasAdicionales = objVentas.DtResultados;
|
||||
LnkDescargaExcel.Visible = true;
|
||||
UpAcciones.Update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GvLineasAdicionalesPO.DataSource = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
objVentas.Dispose();
|
||||
|
||||
GvLineasAdicionales.DataBind();
|
||||
GvLineasAdicionalesPO.DataBind();
|
||||
@@ -276,36 +321,60 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
|
||||
}
|
||||
objVentas.Dispose();
|
||||
}
|
||||
|
||||
|
||||
protected void LnkDescargaExcel_Click(object sender, EventArgs e)
|
||||
|
||||
|
||||
protected void LnkDescargaExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if(TipoLinea == 1)
|
||||
{
|
||||
GridView gvTemp = GvLineasAdicionales;
|
||||
gvTemp.ExportToExcelx("RepLienasAdicionales");
|
||||
}
|
||||
else if(TipoLinea == 2)
|
||||
{
|
||||
GridView gvTemp = GvLineasAdicionalesPO;
|
||||
gvTemp.Columns[9].Visible = false;
|
||||
gvTemp.ExportToExcelx( "RepPO");
|
||||
}
|
||||
gvTemp.Columns[8].Visible = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void GvLineasAdicionales_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
protected void GvLineasAdicionalesPO_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.RowType == DataControlRowType.DataRow)
|
||||
|
||||
|
||||
if (e.Row.DataKey("CveLineaAdicional").ToEntero() == 0)
|
||||
{
|
||||
e.Row.CssClass = "SubTotales";
|
||||
if(e.Row.DataKey("CveVenta").ToEntero() > 0)
|
||||
{
|
||||
LnkCambiarEstatus.Visible = false;
|
||||
LnkCargarComprobante.Visible = false;
|
||||
}
|
||||
|
||||
if (e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 2)
|
||||
{
|
||||
e.Row.FCLinkButton("LnkCargarComprobante").Visible = false;
|
||||
}
|
||||
|
||||
if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0 )
|
||||
{
|
||||
LnkDescargaComprobante.Visible = false;
|
||||
}
|
||||
LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante");
|
||||
|
||||
if (fi.Exists)
|
||||
{
|
||||
else
|
||||
{
|
||||
if (e.Row.DataKey("CveVenta").ToEntero() > 0 && e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 1)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -327,30 +396,28 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
|
||||
Response.ContentType = "text/octet-stream";
|
||||
Response.Flush();
|
||||
Response.TransmitFile(fi.FullName);
|
||||
Response.End();
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvLineasAdicionales_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||
{
|
||||
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
|
||||
int CveLineaAdicionalActualzarEstatus = 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();
|
||||
protected void GvLineasAdicionalesPO_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName == "Estatus")
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
|
||||
int CveLineaAdicionalActualzarEstatus = 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.UpdateLineasAdicionales(CveLineaAdicionalActualzarEstatus, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, CveVenta: CveVenta, CveLineaAdicionalEstatus: 2))
|
||||
{
|
||||
errorCambioEstatus = true;
|
||||
}
|
||||
objVentas.Dispose();
|
||||
if (!errorCambioEstatus)
|
||||
if (!objVentas.UpdateLineasAdicionales(CveLineaAdicionalActualzarEstatus, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, CveVenta: CveVenta, CveLineaAdicionalEstatus: cveestatus))
|
||||
{
|
||||
errorCambioEstatus = true;
|
||||
}
|
||||
|
||||
|
||||
objVentas.Dispose();
|
||||
if (!errorCambioEstatus)
|
||||
{
|
||||
{
|
||||
CargaDatos();
|
||||
Reference in New Issue
Block a user