Correcion al enviar acuse de cancelacion

This commit is contained in:
2020-06-22 22:06:52 -07:00
parent 65f4500402
commit 5fc4abd0b6

View File

@@ -34,39 +34,48 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
private void CargaDatos() private void CargaDatos()
{ {
HdnLigaRefacturar.Value = ""; HdnLigaRefacturar.Value = "";
if (Request["CveVenta"] != null) if (Request["CveVenta"] != null)
{ {
this.CveVenta = Request["CveVenta"].ToString().ToEntero(); this.CveVenta = Request["CveVenta"].ToString().ToEntero();
} }
var ObjVentas = new ClsVentas(); var ObjVentas = new ClsVentas();
if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario))
{ {
if (CveVenta > 0)
{ if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0)
DtVentas = ObjVentas.DtResultados.FiltraParametros($"CveVenta={CveVenta}"); {
} DtVentas = ObjVentas.DtResultados.FiltraParametros($"CveVenta={Request["CveVenta"].ToString().ToEntero()}");
else }
{ else
DtVentas = ObjVentas.DtResultados.Copy(); {
DtVentas = ObjVentas.DtResultados.Copy();
} }
} }
ObjVentas.Dispose(); ObjVentas.Dispose();
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
if (DtRefacturar.Rows.Count > 0) if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
{ {
DivRefacturar.Visible = true; DivRefacturar.Visible = true;
GvRefacturaciones.DataSource = DtRefacturar; GvRefacturaciones.DataSource = DtRefacturar;
GvRefacturaciones.DataBind(); GvRefacturaciones.DataBind();
} }
GvDatos.DataBind(); GvDatos.DataBind();
UPDatos.Update(); UPDatos.Update();
} }
protected void BtnValidar_Click(object sender, EventArgs e) protected void BtnValidar_Click(object sender, EventArgs e)
{ {
HdnLigaRefacturar.Value = ""; this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
int CveVenta = GvRow.DataKey("CveVenta").ToEntero(); this.CveVenta = GvRow.DataKey("CveVenta").ToEntero();
int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); int CveCliente = GvRow.DataKey("CveCliente").ToEntero();
string Total = GvRow.DataKey("Total"); string Total = GvRow.DataKey("Total");
string SubTotal = GvRow.DataKey("SubTotal"); string SubTotal = GvRow.DataKey("SubTotal");
@@ -92,9 +101,12 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
} }
protected void BtnValidarRefacturacion_Click(object sender, EventArgs e) protected void BtnValidarRefacturacion_Click(object sender, EventArgs e)
{ {
HdnLigaRefacturar.Value = ""; this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
int CveVenta = GvRow.DataKey("CveVenta").ToEntero(); this.CveVenta = GvRow.DataKey("CveVenta").ToEntero();
int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); int CveCliente = GvRow.DataKey("CveCliente").ToEntero();
string Total = GvRow.DataKey("Total"); string Total = GvRow.DataKey("Total");
string SubTotal = GvRow.DataKey("SubTotal"); string SubTotal = GvRow.DataKey("SubTotal");
@@ -134,6 +146,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
{ {
HdnLigaRefacturar.Value = ""; HdnLigaRefacturar.Value = "";
var retorno = new MRespuestaSAT() var retorno = new MRespuestaSAT()
{ {
Mensaje = "", Mensaje = "",
@@ -291,7 +304,10 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
} }
protected void LnkValidar_Click(object sender, EventArgs e) protected void LnkValidar_Click(object sender, EventArgs e)
{ {
this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
if (DtVentas != null) if (DtVentas != null)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
@@ -328,7 +344,14 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
} }
public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e) public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e)
{ {
ImprimeCancelacion(CveVenta); if (this.CveVenta > 0)
{
ImprimeCancelacion(this.CveVenta);
}
else
{
Alert("No se encontro la factura para enviar el acuse", TipoMensaje.MsgAdvertencia);
}
} }
public void ImprimeCancelacion(int CveVenta) public void ImprimeCancelacion(int CveVenta)