Validacion en listado de remisiones
This commit is contained in:
@@ -2789,27 +2789,35 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora
|
'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora
|
||||||
If DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0 Then
|
If (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0 Then
|
||||||
For Each Row As DataRow In DtRemisionesRelacionadas.Rows
|
|
||||||
|
|
||||||
If Not ObjConta.TraspasarSaldosRemision(Row("CveVenta").ToString().ToEntero(), ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then
|
If ObjFactura.RemisionesLista.Count = 0 AndAlso (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) Then
|
||||||
ErrorPrepoliza = True
|
For Each Row As DataRow In DtRemisionesRelacionadas.Rows
|
||||||
End If
|
ObjFactura.RemisionesLista.Add(Row("CveVenta").ToString().ToEntero())
|
||||||
|
Next
|
||||||
'Factura
|
End If
|
||||||
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={Row("CveVenta").ToString().ToEntero()}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
|
||||||
ErrorPrepoliza = True
|
If ObjFactura.RemisionesLista.Count > 0 Then
|
||||||
End If
|
For Each CveRemision As Integer In RemisionesLista
|
||||||
|
If Not ObjConta.TraspasarSaldosRemision(CveRemision, ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then
|
||||||
'Remision
|
ErrorPrepoliza = True
|
||||||
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Row("CveVenta").ToString().ToEntero()) Then
|
End If
|
||||||
ErrorPrepoliza = True
|
|
||||||
End If
|
'Factura
|
||||||
|
If Not ObjEventos.AddEventoBitacora($"Sustituye a: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>Folio Factura</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
|
||||||
If ErrorPrepoliza Then
|
ErrorPrepoliza = True
|
||||||
Exit For
|
End If
|
||||||
End If
|
|
||||||
Next
|
'Remision
|
||||||
|
If Not ObjEventos.AddEventoBitacora($"Refacturacion en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
||||||
|
ErrorPrepoliza = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ErrorPrepoliza Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
'REGRESA SALDO A LAS REMISIONES QUE SE FACTURARON EN EL INGRESO QUE SE ESTA CANCELANDO
|
'REGRESA SALDO A LAS REMISIONES QUE SE FACTURARON EN EL INGRESO QUE SE ESTA CANCELANDO
|
||||||
If ObjFactura.TipoDocto = "Ing" And ValorMultiplicador = -1 AndAlso NuevaFactura <> 1 AndAlso Not SeCancelaRemisionProceso Then ' se debe de excluir cuando es refacturación
|
If ObjFactura.TipoDocto = "Ing" And ValorMultiplicador = -1 AndAlso NuevaFactura <> 1 AndAlso Not SeCancelaRemisionProceso Then ' se debe de excluir cuando es refacturación
|
||||||
|
|||||||
@@ -103,58 +103,58 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
|
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
|
||||||
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
|
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
|
||||||
|
|
||||||
//var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||||
|
|
||||||
//sb.AppendFormat("{0} <br/>", FueCancelado);
|
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||||
//if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||||
//{
|
{
|
||||||
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
|
||||||
|
//{
|
||||||
|
// sb.Append("Esta factura no es cancelable.");
|
||||||
|
// return sb.ToString();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
|
//if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
|
||||||
{
|
//{
|
||||||
sb.Append("Esta factura no es cancelable.");
|
// CveEstatus = 5;
|
||||||
return sb.ToString();
|
// var solicitud = new WSGF.Service1SoapClient();
|
||||||
}
|
// var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
|
||||||
|
|
||||||
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
|
// if (acuse.Estado == 0)
|
||||||
{
|
// {
|
||||||
CveEstatus = 5;
|
// var xmlAcuse = new System.Xml.XmlDocument();
|
||||||
var solicitud = new WSGF.Service1SoapClient();
|
// xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
|
||||||
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
|
|
||||||
|
|
||||||
if (acuse.Estado == 0)
|
// CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
|
||||||
{
|
// CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
||||||
var xmlAcuse = new System.Xml.XmlDocument();
|
// }
|
||||||
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
|
|
||||||
|
|
||||||
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
|
// var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
|
||||||
|
|
||||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
// sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
// if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||||
{
|
// {
|
||||||
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
|
//else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
|
||||||
{
|
//{
|
||||||
//ASIGNAMOS ESTATUS EMITIDA
|
// //ASIGNAMOS ESTATUS EMITIDA
|
||||||
CveEstatus = 3;
|
// CveEstatus = 3;
|
||||||
var ObjVentas = new ClsVentas();
|
// var ObjVentas = new ClsVentas();
|
||||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
// if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||||
{
|
// {
|
||||||
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
// sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
// sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||||
}
|
// }
|
||||||
ObjVentas.Dispose();
|
// ObjVentas.Dispose();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user