Correcion de error de compilacion
This commit is contained in:
@@ -132,7 +132,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
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);
|
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||||
@@ -170,188 +170,187 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion)
|
||||||
//private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion)
|
|
||||||
//{
|
|
||||||
// //var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
|
||||||
// //var retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
|
||||||
// return retorno;
|
|
||||||
//}
|
|
||||||
|
|
||||||
private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
|
|
||||||
{
|
{
|
||||||
int CtaCliente = 0;
|
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
||||||
int OrdenPago = 0;
|
var retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||||
string NombreCliente = "";
|
return retorno;
|
||||||
|
|
||||||
var ObjClientes = new ClsClientes();
|
|
||||||
if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
|
|
||||||
{
|
|
||||||
CtaCliente = ObjClientes.IdCtaContClientes;
|
|
||||||
NombreCliente = ObjClientes.NombreComercial;
|
|
||||||
}
|
|
||||||
ObjClientes.Dispose();
|
|
||||||
|
|
||||||
var ObjVentas = new ClsVentas();
|
|
||||||
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
|
||||||
{
|
|
||||||
if (ObjVentas.DtResultados.Rows.Count > 0)
|
|
||||||
{
|
|
||||||
OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Retorno = 0;
|
|
||||||
int IDPoliza = 0;
|
|
||||||
bool ErrorAC = false;
|
|
||||||
string Concepto = string.Format("GD {0}", NombreCliente);
|
|
||||||
int Paridad = 1;
|
|
||||||
bool TipoMovto = false;
|
|
||||||
if (CancelacionIngreso)
|
|
||||||
{
|
|
||||||
Concepto = string.Format("Cancelación GD {0}", NombreCliente);
|
|
||||||
Paridad = -1;
|
|
||||||
TipoMovto = true;
|
|
||||||
}
|
|
||||||
var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
|
|
||||||
DataRow dr = null;
|
|
||||||
int CtaISSSTESON = 643;
|
|
||||||
int CtaISPT = 1745;
|
|
||||||
var AC = new ClsAC();
|
|
||||||
|
|
||||||
//var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
|
|
||||||
//ObjAC.IniciaTransacSQL();
|
|
||||||
|
|
||||||
IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
|
|
||||||
|
|
||||||
if (IDPoliza > 0)
|
|
||||||
{
|
|
||||||
if (TipoComprobante == "OP")
|
|
||||||
{
|
|
||||||
//Orden de PAGO
|
|
||||||
if (OrdenPago == 1)
|
|
||||||
{
|
|
||||||
//ISSSTESON
|
|
||||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//ISPT
|
|
||||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//NORMAL
|
|
||||||
DataTable Detalles = null;
|
|
||||||
DataTable DTPresupuestoIngresos = null;
|
|
||||||
if (ObjVentas.GetVentaDetalle(CveVenta))
|
|
||||||
{
|
|
||||||
Detalles = ObjVentas.DtResultados.Copy();
|
|
||||||
}
|
|
||||||
if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
|
|
||||||
{
|
|
||||||
DTPresupuestoIngresos = AC.DtResultados.Copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Detalles != null && DTPresupuestoIngresos != null)
|
|
||||||
{
|
|
||||||
var query = from gvr in Detalles.AsEnumerable()
|
|
||||||
group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
|
|
||||||
select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
|
|
||||||
|
|
||||||
foreach (var item in query)
|
|
||||||
{
|
|
||||||
dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
|
|
||||||
if (dr != null)
|
|
||||||
{
|
|
||||||
Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
|
|
||||||
if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
// CARGO la deuda del cliente
|
|
||||||
if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
// abono,
|
|
||||||
if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorAC = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ErrorAC)
|
|
||||||
{
|
|
||||||
ObjAC.AjustaPoliza(IDPoliza);
|
|
||||||
Retorno = IDPoliza;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
|
|
||||||
}
|
|
||||||
AC.Dispose();
|
|
||||||
ObjVentas.Dispose();
|
|
||||||
|
|
||||||
return Retorno;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
|
||||||
|
//{
|
||||||
|
// int CtaCliente = 0;
|
||||||
|
// int OrdenPago = 0;
|
||||||
|
// string NombreCliente = "";
|
||||||
|
|
||||||
|
// var ObjClientes = new ClsClientes();
|
||||||
|
// if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
|
||||||
|
// {
|
||||||
|
// CtaCliente = ObjClientes.IdCtaContClientes;
|
||||||
|
// NombreCliente = ObjClientes.NombreComercial;
|
||||||
|
// }
|
||||||
|
// ObjClientes.Dispose();
|
||||||
|
|
||||||
|
// var ObjVentas = new ClsVentas();
|
||||||
|
// if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
||||||
|
// {
|
||||||
|
// if (ObjVentas.DtResultados.Rows.Count > 0)
|
||||||
|
// {
|
||||||
|
// OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// int Retorno = 0;
|
||||||
|
// int IDPoliza = 0;
|
||||||
|
// bool ErrorAC = false;
|
||||||
|
// string Concepto = string.Format("GD {0}", NombreCliente);
|
||||||
|
// int Paridad = 1;
|
||||||
|
// bool TipoMovto = false;
|
||||||
|
// if (CancelacionIngreso)
|
||||||
|
// {
|
||||||
|
// Concepto = string.Format("Cancelación GD {0}", NombreCliente);
|
||||||
|
// Paridad = -1;
|
||||||
|
// TipoMovto = true;
|
||||||
|
// }
|
||||||
|
// var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
|
||||||
|
// DataRow dr = null;
|
||||||
|
// int CtaISSSTESON = 643;
|
||||||
|
// int CtaISPT = 1745;
|
||||||
|
// var AC = new ClsAC();
|
||||||
|
|
||||||
|
// //var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
|
||||||
|
// //ObjAC.IniciaTransacSQL();
|
||||||
|
|
||||||
|
// IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
|
||||||
|
|
||||||
|
// if (IDPoliza > 0)
|
||||||
|
// {
|
||||||
|
// if (TipoComprobante == "OP")
|
||||||
|
// {
|
||||||
|
// //Orden de PAGO
|
||||||
|
// if (OrdenPago == 1)
|
||||||
|
// {
|
||||||
|
// //ISSSTESON
|
||||||
|
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //ISPT
|
||||||
|
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //NORMAL
|
||||||
|
// DataTable Detalles = null;
|
||||||
|
// DataTable DTPresupuestoIngresos = null;
|
||||||
|
// if (ObjVentas.GetVentaDetalle(CveVenta))
|
||||||
|
// {
|
||||||
|
// Detalles = ObjVentas.DtResultados.Copy();
|
||||||
|
// }
|
||||||
|
// if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
|
||||||
|
// {
|
||||||
|
// DTPresupuestoIngresos = AC.DtResultados.Copy();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (Detalles != null && DTPresupuestoIngresos != null)
|
||||||
|
// {
|
||||||
|
// var query = from gvr in Detalles.AsEnumerable()
|
||||||
|
// group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
|
||||||
|
// select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
|
||||||
|
|
||||||
|
// foreach (var item in query)
|
||||||
|
// {
|
||||||
|
// dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
|
||||||
|
// if (dr != null)
|
||||||
|
// {
|
||||||
|
// Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
|
||||||
|
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// // CARGO la deuda del cliente
|
||||||
|
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// // abono,
|
||||||
|
// if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ErrorAC = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!ErrorAC)
|
||||||
|
// {
|
||||||
|
// ObjAC.AjustaPoliza(IDPoliza);
|
||||||
|
// Retorno = IDPoliza;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
|
||||||
|
// }
|
||||||
|
// AC.Dispose();
|
||||||
|
// ObjVentas.Dispose();
|
||||||
|
|
||||||
|
// return Retorno;
|
||||||
|
//}
|
||||||
private string DecodeBase64(string strXMLCodificado)
|
private string DecodeBase64(string strXMLCodificado)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user