Validacion en listado de remisiones
This commit is contained in:
@@ -2789,27 +2789,35 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
'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
|
||||
For Each Row As DataRow In DtRemisionesRelacionadas.Rows
|
||||
If (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) OrElse ObjFactura.RemisionesLista.Count > 0 Then
|
||||
|
||||
If Not ObjConta.TraspasarSaldosRemision(Row("CveVenta").ToString().ToEntero(), ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
|
||||
'Factura
|
||||
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
|
||||
End If
|
||||
|
||||
'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:=Row("CveVenta").ToString().ToEntero()) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
|
||||
If ErrorPrepoliza Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If ObjFactura.RemisionesLista.Count = 0 AndAlso (DtRemisionesRelacionadas IsNot Nothing AndAlso DtRemisionesRelacionadas.Rows.Count > 0) Then
|
||||
For Each Row As DataRow In DtRemisionesRelacionadas.Rows
|
||||
ObjFactura.RemisionesLista.Add(Row("CveVenta").ToString().ToEntero())
|
||||
Next
|
||||
End If
|
||||
|
||||
If ObjFactura.RemisionesLista.Count > 0 Then
|
||||
For Each CveRemision As Integer In RemisionesLista
|
||||
If Not ObjConta.TraspasarSaldosRemision(CveRemision, ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then
|
||||
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
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
|
||||
'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
|
||||
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("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);
|
||||
//if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
//{
|
||||
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
{
|
||||
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"))
|
||||
{
|
||||
sb.Append("Esta factura no es cancelable.");
|
||||
return sb.ToString();
|
||||
}
|
||||
//if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
|
||||
//{
|
||||
// CveEstatus = 5;
|
||||
// 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")
|
||||
{
|
||||
CveEstatus = 5;
|
||||
var solicitud = new WSGF.Service1SoapClient();
|
||||
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
|
||||
// if (acuse.Estado == 0)
|
||||
// {
|
||||
// var xmlAcuse = new System.Xml.XmlDocument();
|
||||
// xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
|
||||
|
||||
if (acuse.Estado == 0)
|
||||
{
|
||||
var xmlAcuse = new System.Xml.XmlDocument();
|
||||
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
|
||||
// CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
|
||||
// CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
||||
// }
|
||||
|
||||
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
|
||||
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;
|
||||
// var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||
|
||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
{
|
||||
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||
}
|
||||
}
|
||||
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
|
||||
{
|
||||
//ASIGNAMOS ESTATUS EMITIDA
|
||||
CveEstatus = 3;
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||
}
|
||||
ObjVentas.Dispose();
|
||||
}
|
||||
// sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
// if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
// {
|
||||
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||
// }
|
||||
//}
|
||||
//else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
|
||||
//{
|
||||
// //ASIGNAMOS ESTATUS EMITIDA
|
||||
// CveEstatus = 3;
|
||||
// var ObjVentas = new ClsVentas();
|
||||
// if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||
// }
|
||||
// ObjVentas.Dispose();
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user