1148 lines
47 KiB
C#
1148 lines
47 KiB
C#
using ADSTimbrado;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ADSTimbradoInterface
|
|
{
|
|
|
|
public enum TipoDeComprobante
|
|
{
|
|
SinDefinir = -1,
|
|
ingreso = 0,
|
|
egreso = 1,
|
|
traslado = 2
|
|
}
|
|
|
|
public interface Factura
|
|
{
|
|
int CveEstatusRefacturacion { get; set; }
|
|
int NuevaFactura { get; set; }
|
|
bool EnviarCorreo { get; set; }
|
|
List<string> ErrorList { get; set; }
|
|
int TipoContrato { get; set; }
|
|
int CvePedido { get; set; }
|
|
int CvePedidoA { get; set; }
|
|
int CvePedido2 { get; set; }
|
|
int CveAlmacenTraspasoOrigen { get; set; }
|
|
int CveAlmacenTraspasoDestino { get; set; }
|
|
int EsDevolucionVenta { get; set; }
|
|
int EsInterno { get; set; }
|
|
int CveEmpresaCRM { get; set; }
|
|
string EmpresaCRM { get; set; }
|
|
decimal TotalImpuestoLocal { get; set; }
|
|
bool AplicaDevolucion { get; set; }
|
|
int CveVentaDevolucion { get; set; }
|
|
string ObservacionesAlmacen { get; set; }
|
|
int CveOC { get; set; }
|
|
int CveCuentaTerminal { get; set; }
|
|
bool ClienteEsDistribuidor { get; set; }
|
|
bool AplicaGastoContrato { get; set; }
|
|
Factura FacturaDevolucion { get; set; }
|
|
int CveOrdenProduccion { get; set; }
|
|
int Pago { get; set; }
|
|
int TipoAmortizacionAnticipo { get; set; }
|
|
int CveAlmacenExistenciasContrato { get; set; }
|
|
int EraCotizacion { get; set; }
|
|
int CveRemision { get; set; }
|
|
int CveCotizacion { get; set; }
|
|
int DevPed { get; set; }
|
|
int CveFactura { get; set; }
|
|
int CveCicloComercial { get; set; }
|
|
string TipoDoctoDevolucion { get; set; }
|
|
bool SeGuardoPrePoliza { get; set; }
|
|
string DirectorioServidor { get; set; }
|
|
int FacturaMateriales { get; set; }
|
|
int TipoDescuento { get; set; }
|
|
decimal SubProyectoPorcentajeIVA { get; set; }
|
|
int CveAlmacenOrigenContrato { get; set; }
|
|
int CveDevolucion { get; set; }
|
|
decimal TotalOtrosConceptos { get; set; }
|
|
int CvePSAmortizacion { get; set; }
|
|
decimal SaldoVentaDevolucion { get; set; }
|
|
decimal Saldo { get; set; }
|
|
decimal SaldoAlmacen { get; set; }
|
|
decimal SaldoAnticipo { get; set; }
|
|
decimal SaldoAmortizado { get; set; }
|
|
int CvePAC { get; set; }
|
|
int CveAnticipo { get; set; }
|
|
List<int> RemisionesLista { get; set; }
|
|
int CveAlmacen { get; set; }
|
|
int CveAlmacenDevolucion { get; set; }
|
|
int CveVenta { get; set; }
|
|
int CveEmpresa { get; set; }
|
|
int CveSucursal { get; set; }
|
|
int CveSubProyecto { get; set; }
|
|
int CveAlmacenRecepcionUsados { get; set; }
|
|
int CveDireccionEnvio { get; set; }
|
|
bool RefacturacionGeneroNC { get; set; }
|
|
decimal Pagado { get; set; }
|
|
decimal DescuentoProntoPago { get; set; }
|
|
SubProyectoModel SubProyecto { get; set; }
|
|
System.Data.DataTable DtDetalle { get; set; }
|
|
System.Data.DataTable DtDetalleAC { get; set; }
|
|
System.Data.DataTable DtAjustes { get; set; }
|
|
System.Data.DataTable DtRecepcionUsados { get; set; }
|
|
System.Data.DataTable DtPolizasVirtuales { get; set; }
|
|
System.Data.DataTable DtVentasNC { get; set; }
|
|
System.Data.DataTable DtDeduccion { get; set; }
|
|
System.Data.DataTable DtFirmas { get; set; }
|
|
System.Data.DataTable DtDesgloseImpuestos { get; set; }
|
|
System.Data.DataTable DtDocumentosRelacionados { get; set; }
|
|
System.Data.DataTable DtNCVinculadas { get; set; }
|
|
|
|
System.Data.DataTable DtAnticipos { get; set; }
|
|
System.Data.DataTable DtPromociones { get; set; }
|
|
System.Data.DataTable DtImpuestosLocales { get; set; }
|
|
System.Data.DataTable DtPagos { get; set; }
|
|
System.Data.DataTable DtRemisionesPS { get; set; }
|
|
System.Data.DataTable DtRemisiones { get; set; }
|
|
System.Data.DataTable DtPedidos2 { get; set; }
|
|
System.Data.DataTable DtPedidos2PS { get; set; }
|
|
System.Data.DataTable DTOrdenesCompraPS { get; set; }
|
|
System.Data.DataTable DtCotizacionesPS { get; set; }
|
|
System.Data.DataTable DtDocumentacionCliente { get; set; }
|
|
System.Data.DataTable DtContratosSerieDetalle { get; set; }
|
|
System.Data.DataTable DtOtrosConceptos { get; set; }
|
|
System.Data.DataTable DtInventario { get; set; }
|
|
System.Data.DataTable DtRemConceptosSurtidos { get; set; }
|
|
List<int> UsadosBonificacion { get; set; }
|
|
int TipoBonificacion { get; set; }
|
|
CFDITimbre Timbre { get; set; }
|
|
int CveCliente { get; set; }
|
|
ClienteModel Cliente { get; set; }
|
|
SubProyectoModel SubProyectoMatriz { get; set; }
|
|
string Version { get; set; }
|
|
string Serie { get; set; }
|
|
int Folio { get; set; }
|
|
string SerieFolio { get; }
|
|
int Inv_CveMovimiento { get; set; }
|
|
int Inv_CveEstatusEntrega { get; set; }
|
|
string Inv_EstatusEntrega { get; set; }
|
|
decimal Inv_ValorInventario { get; set; }
|
|
DateTime Fecha { get; set; }
|
|
DateTime GetLastWeekdayOfMonth(DateTime fecha, DayOfWeek day);
|
|
DateTime GetFirstWeekdayOfMonth(DateTime fecha, DayOfWeek day);
|
|
bool EsHorarioVerano(DateTime fecha);
|
|
DateTime FechaCP { get; }
|
|
DateTime FechaVencimiento { get; set; }
|
|
string EstatusFactura { get; set; }
|
|
string SeTimbro { get; set; }
|
|
string TipoDocto { get; set; }
|
|
string RefDocto { get; set; }
|
|
bool RealizarDevolucionAlmacen { get; set; }
|
|
int CveAlmacenDevolucionVenta { get; set; }
|
|
string TipoDocumento { get; set; }
|
|
string TipodeComprobante { get; }
|
|
int CvePlantillaPoliza { get; }
|
|
TipoDeComprobante TipodeComprobanteSAT { get; }
|
|
int ClaseDoctoSat { get; }
|
|
int CveUsuario { get; set; }
|
|
string SerieFolioPadre { get; set; }
|
|
int CveMoneda { get; set; }
|
|
string Moneda { get; set; }
|
|
string MonedaSAT { get; set; }
|
|
string UsuarioCreo { get; set; }
|
|
string MonedaAbreviatura { get; set; }
|
|
decimal TipoCambio { get; set; }
|
|
decimal TipoCambioDolares { get; set; }
|
|
bool ConvertirPesos { get; set; }
|
|
bool ConvertirDolares { get; set; }
|
|
int FormaPago { get; set; }
|
|
string FormaPagoText { get; }
|
|
int CondicionesPago { get; set; }
|
|
string CondicionesPagoText { get; }
|
|
string MotivoDescuento { get; set; }
|
|
decimal SubTotal { get; set; }
|
|
decimal Descuento { get; set; }
|
|
decimal Amortizacion { get; set; }
|
|
decimal RetIVA { get; set; }
|
|
decimal RetISR { get; set; }
|
|
decimal IVA { get; set; }
|
|
decimal IEPS { get; set; }
|
|
decimal Total { get; set; }
|
|
decimal Otros { get; set; }
|
|
decimal TotalRemNCAplicado { get; set; }
|
|
decimal SubTotalTC { get; }
|
|
decimal DescuentoTC { get; }
|
|
decimal AmortizacionTC { get; }
|
|
// IVA
|
|
decimal RetIVATC { get; }
|
|
decimal RetISRTC { get; }
|
|
decimal IVATC { get; }
|
|
decimal IEPSTC { get; }
|
|
decimal TotalTC { get; }
|
|
decimal OtrosTC { get; }
|
|
string AtencionA { get; set; }
|
|
string AtnA { get; set; }
|
|
string TelefonoGenerico { get; set; }
|
|
string Det_OrdenCompra { get; set; }
|
|
string Det_FechaOrdenCompra { get; set; }
|
|
string Det_ContraRecibo { get; set; }
|
|
string Observaciones { get; set; }
|
|
string Alfa1 { get; set; }
|
|
string Alfa2 { get; set; }
|
|
string Alfa3 { get; set; }
|
|
DateTime Fech1 { get; set; }
|
|
DateTime Fech2 { get; set; }
|
|
DateTime Fech3 { get; set; }
|
|
decimal Num1 { get; set; }
|
|
decimal Num2 { get; set; }
|
|
decimal Num3 { get; set; }
|
|
int DiasCredito { get; set; }
|
|
bool EsDiasCreditoFijo { get; set; }
|
|
int CveCorte { get; set; }
|
|
int CveMesa { get; set; }
|
|
int NumeroPersonas { get; set; }
|
|
DateTime FechaPago { get; set; }
|
|
int CveNCaVincular { get; set; }
|
|
string FolioFiscal { get; set; }
|
|
string NoSerieCertificado { get; set; }
|
|
string SelloCFDi { get; set; }
|
|
string SelloSAT { get; set; }
|
|
DateTime FechaEmision { get; set; }
|
|
DateTime FechaCertificacion { get; set; }
|
|
string NoSerieCertificadoContribuyente { get; set; }
|
|
string NumeroCuenta { get; set; }
|
|
int CveTipoAmortizacionAnticipo { get; set; }
|
|
string DescripcionContrato { get; set; }
|
|
string NumeroDescripcionContrato { get; set; }
|
|
int CveComplementoTimbrado { get; set; }
|
|
ComplementoINE ComplementoINE { get; set; }
|
|
string FordGSDB { get; set; }
|
|
string FordASN { get; set; }
|
|
FemsaFactura FemsaFactura { get; set; }
|
|
int CveClienteSucursal { get; set; }
|
|
SucursalModel ClienteSucursal { get; set; }
|
|
EnviarAModel EnviarA { get; set; }
|
|
string NumeroContrato { get; set; }
|
|
string PedidoContrato { get; set; }
|
|
string OrdenCompra { get; set; }
|
|
int CveMetodoPago { get; set; }
|
|
string MetodoPago { get; set; }
|
|
string ClaveMetodoPagoSAT { get; set; }
|
|
int CveMetodoPago33 { get; set; }
|
|
string MetodoPago33 { get; set; }
|
|
int CveFormaPago33 { get; set; }
|
|
string MetodoPagoSAT33 { get; set; }
|
|
string FormaPago33 { get; set; }
|
|
string FormaPagoSAT33 { get; set; }
|
|
string UsoCFDI { get; set; }
|
|
int CveUsoCFDI { get; set; }
|
|
string ClaveUsoCFDI { get; set; }
|
|
int CveTipoRelacion { get; set; }
|
|
int CveEstatusFactura { get; set; }
|
|
int CveVendedor { get; set; }
|
|
string VendedorCodigo { get; set; }
|
|
int CveSucursalEjecucion { get; set; }
|
|
DateTime FechaEjecucion { get; set; }
|
|
int CveSucursalCobranza { get; set; }
|
|
int CveSubProyectoCobranza { get; set; }
|
|
int CveSubProyectoEjecucion { get; set; }
|
|
int CveOS { get; set; }
|
|
int CveContrato { get; set; }
|
|
int CveVentaPadre { get; set; }
|
|
int CvePrePoliza { get; set; }
|
|
string Entrega { get; set; }
|
|
string TiempoEntrega { get; set; }
|
|
DateTime Vigencia { get; set; }
|
|
int TipoEstatus { get; set; }
|
|
int CveCondicionEntrega { get; set; }
|
|
string CondicionEntrega { get; set; }
|
|
string TipoRelacion { get; set; }
|
|
List<string> UUIDRelacionados { get; set; }
|
|
int CveVentaRelacion { get; set; }
|
|
decimal ImporteRelacion { get; set; }
|
|
bool EsNCAmortizacion { get; set; }
|
|
decimal Kilometraje { get; set; }
|
|
int CveTipoRetencion { get; set; }
|
|
}
|
|
public interface ComplementoINE
|
|
{
|
|
string INETipoProceso { get; set; }
|
|
string INETipoComite { get; set; }
|
|
string INEEntidad { get; set; }
|
|
int INEIdContabilidad { get; set; }
|
|
}
|
|
public interface FemsaFactura
|
|
{
|
|
bool AplicaFEMSA { get; set; }
|
|
string FEMSA_NumSociedad { get; set; }
|
|
string FEMSA_NumProveedor { get; set; }
|
|
string FEMSA_Mail { get; set; }
|
|
int FEMSA_Version { get; set; }
|
|
long FEMSA_NumPedido { get; set; }
|
|
string FEMSA_NumEntrada { get; set; }
|
|
string FEMSA_NumRemision { get; set; }
|
|
string FEMSA_NumSocio { get; set; }
|
|
string FEMSA_CentroCosto { get; set; }
|
|
string FEMSA_IPeriodoLiquidacion { get; set; }
|
|
string FEMSA_FPeriodoLiquidacion { get; set; }
|
|
string FEMSA_CodRetencion1 { get; set; }
|
|
string FEMSA_CodRetencion2 { get; set; }
|
|
}
|
|
public interface SucursalModel
|
|
{
|
|
|
|
string LugarExp { get; }
|
|
int CveSucursal { get; set; }
|
|
string Calle { get; set; }
|
|
string Direccion { get; set; }
|
|
string NoExt { get; set; }
|
|
string NoInt { get; set; }
|
|
string Colonia { get; set; }
|
|
string Localidad { get; set; }
|
|
string Municipio { get; set; }
|
|
string Estado { get; set; }
|
|
string Pais { get; set; }
|
|
string CP { get; set; }
|
|
decimal IVA { get; set; }
|
|
string Serie { get; set; }
|
|
string TipoFormato { get; set; }
|
|
string FormatoFactura { get; set; }
|
|
string Sucursal { get; set; }
|
|
string CorreoSucursal { get; set; }
|
|
string TelefonoSucursal { get; set; }
|
|
string ImprimeNombreSucursal { get; set; }
|
|
}
|
|
public interface SubProyectoModel
|
|
{
|
|
|
|
string LugarExp { get; }
|
|
int CveSubProyecto { get; set; }
|
|
string Calle { get; set; }
|
|
string Direccion { get; set; }
|
|
string NoExt { get; set; }
|
|
string NoInt { get; set; }
|
|
string Colonia { get; set; }
|
|
string Localidad { get; set; }
|
|
string Municipio { get; set; }
|
|
string Estado { get; set; }
|
|
string Pais { get; set; }
|
|
string CP { get; set; }
|
|
decimal IVA { get; set; }
|
|
string Serie { get; set; }
|
|
string TipoFormato { get; set; }
|
|
string FormatoFactura { get; set; }
|
|
string SubProyecto { get; set; }
|
|
string Correo { get; set; }
|
|
string Telefono { get; set; }
|
|
string ImprimeNombre { get; set; }
|
|
int UTCOffsetVerano { get; set; }
|
|
int UTCOffsetInvierno { get; set; }
|
|
}
|
|
public interface ClienteModel
|
|
{
|
|
int CveCliente { get; set; }
|
|
string Nombre { get; set; }
|
|
string NombreComercial { get; set; }
|
|
string Codigo { get; set; }
|
|
string Direccion { get; set; }
|
|
string NoExt { get; set; }
|
|
string NoInt { get; set; }
|
|
string Colonia { get; set; }
|
|
string Localidad { get; set; }
|
|
string Ciudad { get; set; }
|
|
string Estado { get; set; }
|
|
string Pais { get; set; }
|
|
string RFC { get; set; }
|
|
string CP { get; set; }
|
|
string Telefono { get; set; }
|
|
string Contacto { get; set; }
|
|
string Mail { get; set; }
|
|
string MailCotizacion { get; set; }
|
|
string NotificarA { get; set; }
|
|
string Pagina { get; set; }
|
|
string Giro { get; set; }
|
|
int CvePrecioLista { get; set; }
|
|
string EnviarFactura { get; set; }
|
|
int CveSucursal { get; set; }
|
|
decimal RetIVA { get; set; }
|
|
decimal RetISR { get; set; }
|
|
decimal IEPS { get; set; }
|
|
bool RetIVAFletes { get; set; }
|
|
string Estatus { get; set; }
|
|
DateTime Fecha { get; set; }
|
|
string Usuario { get; set; }
|
|
string NombreCorto { get; set; }
|
|
string Vendedor { get; set; }
|
|
int PlazoCobranza { get; set; }
|
|
string Sucursal { get; set; }
|
|
string RecepcionPagos { get; set; }
|
|
string TipoPago { get; set; }
|
|
string CuentaContable { get; set; }
|
|
int IdCtaContClientes { get; set; }
|
|
int IdCtaContMonedaExtranjera { get; set; }
|
|
int IdCtaContComplementaria { get; set; }
|
|
int IdCtaContAnticipos { get; set; }
|
|
int IdCtaContRetIVA { get; set; }
|
|
int IdCtaContRetISR { get; set; }
|
|
int CveCuentaClientes { get; set; }
|
|
int CveCuentaMonedaExtranjera { get; set; }
|
|
int CveCuentaComplementaria { get; set; }
|
|
int CveCuentaAnticipos { get; set; }
|
|
int CveCuentaRetIVA { get; set; }
|
|
int CveCuentaRetISR { get; set; }
|
|
string ConvenioCIE { get; set; }
|
|
string FormaFacturacion { get; set; }
|
|
decimal LimiteCredito { get; set; }
|
|
string NumCtaPago { get; set; }
|
|
int CveMetodoPago { get; set; }
|
|
bool AplicaFEMSA { get; set; }
|
|
string FEMSA_NumSociedad { get; set; }
|
|
string FEMSA_NumProveedor { get; set; }
|
|
string FEMSA_Mail { get; set; }
|
|
bool AplicaDetallista { get; set; }
|
|
string Detallista_GLNComprador { get; set; }
|
|
string Detallista_Departamento { get; set; }
|
|
string Detallista_GLNVendedor { get; set; }
|
|
string Detallista_NumProveedor { get; set; }
|
|
string SevenEleven_NumProveedor { get; set; }
|
|
string Detallista_GLNEnvio { get; set; }
|
|
bool AplicaFord { get; set; }
|
|
string Ford_GSDB { get; set; }
|
|
string ReferenciaFiscal { get; set; }
|
|
string NumRegIdTrib { get; set; }
|
|
string CobranzaTelefono { get; set; }
|
|
bool AplicaComercioExterior { get; set; }
|
|
string ClaveSATPais { get; set; }
|
|
string ClaveSATEstado { get; set; }
|
|
string ClaveSATMunicipio { get; set; }
|
|
string ClaveSATColonia { get; set; }
|
|
string ClaveSATCP { get; set; }
|
|
}
|
|
public interface EnviarAModel
|
|
{
|
|
|
|
string LugarExp { get; }
|
|
int CveDireccionEnvio { get; set; }
|
|
string EnvioDireccion { get; set; }
|
|
string EnvioNoExt { get; set; }
|
|
string EnvioNoInt { get; set; }
|
|
string EnvioColonia { get; set; }
|
|
string EnvioCiudad { get; set; }
|
|
string EnvioEstado { get; set; }
|
|
string EnvioContacto { get; set; }
|
|
string EnvioDepartamento { get; set; }
|
|
string EnvioPedidoContrato { get; set; }
|
|
string EnvioCP { get; set; }
|
|
string EnvioTel { get; set; }
|
|
}
|
|
|
|
public class FacturaLogic
|
|
{
|
|
|
|
public int CveEstatusRefacturacion { get; set; } = 0;
|
|
public int NuevaFactura { get; set; }
|
|
public bool EnviarCorreo { get; set; } = false;
|
|
public List<string> ErrorList { get; set; }
|
|
public int TipoContrato { get; set; }
|
|
public int CvePedido { get; set; } = -1;
|
|
public int CvePedidoA { get; set; } = -1;
|
|
public int CvePedido2 { get; set; } = -1;
|
|
public int CveAlmacenTraspasoOrigen { get; set; } = -1;
|
|
public int CveAlmacenTraspasoDestino { get; set; } = -1;
|
|
public int EsDevolucionVenta { get; set; } = -1;
|
|
public int EsInterno { get; set; } = -1;
|
|
public int CveEmpresaCRM { get; set; } = -1;
|
|
public string EmpresaCRM { get; set; } = "";
|
|
public decimal TotalImpuestoLocal { get; set; } = 0;
|
|
public bool AplicaDevolucion { get; set; }
|
|
public int CveVentaDevolucion { get; set; }
|
|
public string ObservacionesAlmacen { get; set; }
|
|
public int CveOC { get; set; } = -1;
|
|
public int CveCuentaTerminal { get; set; } = -1;
|
|
public bool ClienteEsDistribuidor { get; set; } = false;
|
|
public bool AplicaGastoContrato { get; set; } = false;
|
|
public Factura FacturaDevolucion { get; set; }
|
|
public int CveOrdenProduccion { get; set; } = -1;
|
|
public int Pago { get; set; }
|
|
public int TipoAmortizacionAnticipo { get; set; }
|
|
public int CveAlmacenExistenciasContrato { get; set; }
|
|
public int EraCotizacion { get; set; }
|
|
public int CveRemision { get; set; } = -1;
|
|
public int CveCotizacion { get; set; } = -1;
|
|
public int DevPed { get; set; } = -1;
|
|
public int CveFactura { get; set; }
|
|
public int CveCicloComercial { get; set; }
|
|
public string TipoDoctoDevolucion { get; set; }
|
|
public bool SeGuardoPrePoliza { get; set; }
|
|
public string DirectorioServidor { get; set; }
|
|
public int FacturaMateriales { get; set; }
|
|
public int TipoDescuento { get; set; }
|
|
public decimal SubProyectoPorcentajeIVA { get; set; }
|
|
public int CveAlmacenOrigenContrato { get; set; }
|
|
public int CveDevolucion { get; set; }
|
|
public decimal TotalOtrosConceptos { get; set; }
|
|
public int CvePSAmortizacion { get; set; }
|
|
public decimal SaldoVentaDevolucion { get; set; }
|
|
public decimal Saldo { get; set; }
|
|
public decimal SaldoAlmacen { get; set; }
|
|
public decimal SaldoAnticipo { get; set; }
|
|
public decimal SaldoAmortizado { get; set; }
|
|
public int CvePAC { get; set; }
|
|
public int CveAnticipo { get; set; }
|
|
public List<int> RemisionesLista { get; set; }
|
|
public int CveAlmacen { get; set; }
|
|
public int CveAlmacenDevolucion { get; set; }
|
|
public int CveVenta { get; set; }
|
|
public int CveEmpresa { get; set; }
|
|
public int CveSucursal { get; set; } // sucursal de la empresa que factura
|
|
public int CveSubProyecto { get; set; }
|
|
public int CveAlmacenRecepcionUsados { get; set; } = -1;
|
|
public int CveDireccionEnvio { get; set; }
|
|
public bool RefacturacionGeneroNC { get; set; } = false;
|
|
public decimal Pagado { get; set; }
|
|
public decimal DescuentoProntoPago { get; set; }
|
|
// Public Property Sucursal As SucursalModel
|
|
public SubProyectoModel SubProyecto { get; set; }
|
|
|
|
public System.Data.DataTable DtDetalle { get; set; }
|
|
public System.Data.DataTable DtDetalleAC { get; set; }
|
|
public System.Data.DataTable DtAjustes { get; set; }
|
|
public System.Data.DataTable DtRecepcionUsados { get; set; }
|
|
public System.Data.DataTable DtPolizasVirtuales { get; set; }
|
|
public System.Data.DataTable DtVentasNC { get; set; }
|
|
public System.Data.DataTable DtDeduccion { get; set; }
|
|
public System.Data.DataTable DtFirmas { get; set; }
|
|
public System.Data.DataTable DtDesgloseImpuestos { get; set; }
|
|
public System.Data.DataTable DtDocumentosRelacionados { get; set; }
|
|
public System.Data.DataTable DtNCVinculadas { get; set; }
|
|
|
|
public System.Data.DataTable DtAnticipos { get; set; }
|
|
public System.Data.DataTable DtPromociones { get; set; }
|
|
public System.Data.DataTable DtImpuestosLocales { get; set; }
|
|
public System.Data.DataTable DtPagos { get; set; }
|
|
public System.Data.DataTable DtRemisionesPS { get; set; }
|
|
public System.Data.DataTable DtRemisiones { get; set; }
|
|
public System.Data.DataTable DtPedidos2 { get; set; }
|
|
public System.Data.DataTable DtPedidos2PS { get; set; }
|
|
public System.Data.DataTable DTOrdenesCompraPS { get; set; }
|
|
public System.Data.DataTable DtCotizacionesPS { get; set; }
|
|
public System.Data.DataTable DtDocumentacionCliente { get; set; }
|
|
public System.Data.DataTable DtContratosSerieDetalle { get; set; }
|
|
public System.Data.DataTable DtOtrosConceptos { get; set; }
|
|
public System.Data.DataTable DtInventario { get; set; }
|
|
// Public Property DtAnticipoAmortizacion As Data.DataTable
|
|
public System.Data.DataTable DtRemConceptosSurtidos { get; set; }
|
|
public List<int> UsadosBonificacion { get; set; }
|
|
public int TipoBonificacion { get; set; } = 0;
|
|
public CFDITimbre Timbre { get; set; }
|
|
public int CveCliente { get; set; }
|
|
public ClienteModel Cliente { get; set; }
|
|
public SubProyectoModel SubProyectoMatriz { get; set; }
|
|
// CFDi
|
|
//[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public string Version { get; set; }
|
|
public string Serie { get; set; } = "";
|
|
public int Folio { get; set; }
|
|
//[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public string SerieFolio
|
|
{
|
|
get
|
|
{
|
|
if (Serie != null && Serie.Trim() != string.Empty)
|
|
return string.Format("{0}-{1}", Serie, Folio);
|
|
else
|
|
return Folio.ToString();
|
|
}
|
|
}
|
|
|
|
public int Inv_CveMovimiento { get; set; }
|
|
public int Inv_CveEstatusEntrega { get; set; }
|
|
public string Inv_EstatusEntrega { get; set; }
|
|
public decimal Inv_ValorInventario { get; set; }
|
|
public DateTime Fecha { get; set; }
|
|
//[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public DateTime GetLastWeekdayOfMonth(DateTime fecha, DayOfWeek day)
|
|
{
|
|
DateTime lastDayOfMonth = new DateTime(fecha.Year, fecha.Month, 1).AddMonths(1).AddDays(-1);
|
|
int wantedDay = System.Convert.ToInt32(day);
|
|
int lastDay = System.Convert.ToInt32(lastDayOfMonth.DayOfWeek);
|
|
return lastDayOfMonth.AddDays(lastDay >= wantedDay ? wantedDay - lastDay : wantedDay - lastDay - 7);
|
|
}
|
|
public DateTime GetFirstWeekdayOfMonth(DateTime fecha, DayOfWeek day)
|
|
{
|
|
DateTime result = new DateTime(fecha.Year, fecha.Month, 1);
|
|
|
|
while (result.DayOfWeek != day)
|
|
result = result.AddDays(1);
|
|
|
|
return result;
|
|
}
|
|
public bool EsHorarioVerano(DateTime fecha)
|
|
{
|
|
int Year = fecha.Year;
|
|
DateTime FechaI = GetFirstWeekdayOfMonth(new DateTime(Year, 4, 1, 0, 0, 0), DayOfWeek.Sunday); // PRIMER DOMINGO DE ABRIL
|
|
DateTime FechaF = GetLastWeekdayOfMonth(new DateTime(Year, 10, 1, 23, 59, 59), DayOfWeek.Sunday); // ULTIMO DOMINGO DE OCTUBRE
|
|
|
|
return fecha >= FechaI && fecha <= FechaF;
|
|
}
|
|
public DateTime FechaCP
|
|
{
|
|
get
|
|
{
|
|
if (this.SubProyecto != null)
|
|
{
|
|
if (EsHorarioVerano(DateTime.Now))
|
|
return DateTime.UtcNow.AddHours(this.SubProyecto.UTCOffsetVerano);
|
|
else
|
|
return DateTime.UtcNow.AddHours(this.SubProyecto.UTCOffsetInvierno);
|
|
}
|
|
else
|
|
return Fecha;
|
|
}
|
|
}
|
|
public DateTime FechaVencimiento { get; set; }
|
|
public string EstatusFactura { get; set; }
|
|
public string SeTimbro { get; set; }
|
|
public string TipoDocto { get; set; }
|
|
public string RefDocto { get; set; }
|
|
public bool RealizarDevolucionAlmacen { get; set; }
|
|
public int CveAlmacenDevolucionVenta { get; set; }
|
|
|
|
public string TipoDocumento { get; set; }
|
|
|
|
|
|
|
|
//[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public string TipodeComprobante
|
|
{
|
|
get
|
|
{
|
|
switch (TipoDocto)
|
|
{
|
|
case "Ing":
|
|
{
|
|
return "Ingresos";
|
|
}
|
|
|
|
case "Egs":
|
|
{
|
|
return "Egresos";
|
|
}
|
|
|
|
case "Dev":
|
|
{
|
|
return "Devolucion";
|
|
}
|
|
|
|
case "Ped":
|
|
{
|
|
return "Pedido";
|
|
}
|
|
|
|
case "Cot":
|
|
{
|
|
return "Cotización";
|
|
}
|
|
|
|
case "Rem":
|
|
{
|
|
return "Remisión";
|
|
}
|
|
|
|
case "Nom":
|
|
{
|
|
return "Nom";
|
|
}
|
|
|
|
case "Ant":
|
|
{
|
|
return "Anticipos";
|
|
}
|
|
|
|
default:
|
|
{
|
|
return "No Identificado";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public int CvePlantillaPoliza
|
|
{
|
|
get
|
|
{
|
|
switch (TipoDocto)
|
|
{
|
|
case "Ing":
|
|
{
|
|
return 4;
|
|
}
|
|
|
|
case "Egs":
|
|
{
|
|
return 7;
|
|
}
|
|
|
|
case "Dev":
|
|
{
|
|
return 7;
|
|
}
|
|
|
|
case "Rem":
|
|
{
|
|
return 4;
|
|
}
|
|
|
|
case "Ant":
|
|
{
|
|
return 12;
|
|
}
|
|
|
|
default:
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public TipoDeComprobante TipodeComprobanteSAT
|
|
{
|
|
get
|
|
{
|
|
switch (TipoDocto)
|
|
{
|
|
case "Ing":
|
|
{
|
|
return TipoDeComprobante.ingreso;
|
|
}
|
|
|
|
case "Egs":
|
|
{
|
|
return TipoDeComprobante.egreso;
|
|
}
|
|
|
|
case "Dev":
|
|
{
|
|
return TipoDeComprobante.egreso;
|
|
}
|
|
|
|
//case "Cot":
|
|
// {
|
|
// return null/* TODO Change to default(_) if this is not a reference type */;
|
|
// }
|
|
|
|
//case "Rem":
|
|
// {
|
|
// return null/* TODO Change to default(_) if this is not a reference type */;
|
|
// }
|
|
|
|
//case "Nom":
|
|
// {
|
|
// return null/* TODO Change to default(_) if this is not a reference type */;
|
|
// }
|
|
|
|
case "Ant":
|
|
{
|
|
return TipoDeComprobante.ingreso;
|
|
}
|
|
|
|
default:
|
|
{
|
|
return TipoDeComprobante.SinDefinir/* TODO Change to default(_) if this is not a reference type */;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public int ClaseDoctoSat
|
|
{
|
|
get
|
|
{
|
|
switch (TipoDocto)
|
|
{
|
|
case "Ing":
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
case "Egs":
|
|
{
|
|
return 9;
|
|
}
|
|
|
|
case "Dev":
|
|
{
|
|
return 9;
|
|
}
|
|
|
|
case "Cot":
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
case "Rem":
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
case "Nom":
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
case "Ant":
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public int CveUsuario { get; set; }
|
|
public string SerieFolioPadre { get; set; }
|
|
public int CveMoneda { get; set; }
|
|
public string Moneda { get; set; }
|
|
public string MonedaSAT { get; set; }
|
|
public string UsuarioCreo { get; set; }
|
|
public string MonedaAbreviatura { get; set; }
|
|
public decimal TipoCambio { get; set; }
|
|
public decimal TipoCambioDolares { get; set; }
|
|
public bool ConvertirPesos { get; set; }
|
|
public bool ConvertirDolares { get; set; }
|
|
public int FormaPago { get; set; }
|
|
|
|
public string FormaPagoText
|
|
{
|
|
get
|
|
{
|
|
var retorno = "";
|
|
switch (FormaPago)
|
|
{
|
|
case 0:
|
|
{
|
|
retorno = "PAGO EN UNA SOLA EXHIBICIÓN";
|
|
break;
|
|
}
|
|
|
|
case 1:
|
|
{
|
|
retorno = "PAGO EN PARCIALIDADES";
|
|
break;
|
|
}
|
|
}
|
|
return retorno;
|
|
}
|
|
}
|
|
|
|
public int CondicionesPago { get; set; }
|
|
|
|
public string CondicionesPagoText
|
|
{
|
|
get
|
|
{
|
|
var retorno = "";
|
|
switch (CondicionesPago)
|
|
{
|
|
case 0:
|
|
{
|
|
retorno = "contado";
|
|
break;
|
|
}
|
|
|
|
case 1:
|
|
{
|
|
retorno = "crédito";
|
|
break;
|
|
}
|
|
}
|
|
return retorno;
|
|
}
|
|
}
|
|
|
|
public string MotivoDescuento { get; set; }
|
|
|
|
|
|
public decimal SubTotal { get; set; }
|
|
public decimal Descuento { get; set; }
|
|
public decimal Amortizacion { get; set; }
|
|
|
|
// IVA
|
|
public decimal RetIVA { get; set; }
|
|
public decimal RetISR { get; set; }
|
|
public decimal IVA { get; set; }
|
|
public decimal IEPS { get; set; }
|
|
|
|
public decimal Total { get; set; }
|
|
public decimal Otros { get; set; }
|
|
|
|
public decimal TotalRemNCAplicado { get; set; }
|
|
|
|
|
|
public decimal SubTotalTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return SubTotal * TipoCambio;
|
|
else
|
|
return SubTotal;
|
|
}
|
|
}
|
|
public decimal DescuentoTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return Descuento * TipoCambio;
|
|
else
|
|
return Descuento;
|
|
}
|
|
}
|
|
public decimal AmortizacionTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return Amortizacion * TipoCambio;
|
|
else
|
|
return Amortizacion;
|
|
}
|
|
}
|
|
// IVA
|
|
public decimal RetIVATC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return RetIVA * TipoCambio;
|
|
else
|
|
return RetIVA;
|
|
}
|
|
}
|
|
public decimal RetISRTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return RetISR * TipoCambio;
|
|
else
|
|
return RetISR;
|
|
}
|
|
}
|
|
public decimal IVATC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return IVA * TipoCambio;
|
|
else
|
|
return IVA;
|
|
}
|
|
}
|
|
public decimal IEPSTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return IEPS * TipoCambio;
|
|
else
|
|
return IEPS;
|
|
}
|
|
}
|
|
public decimal TotalTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return Total * TipoCambio;
|
|
else
|
|
return Total;
|
|
}
|
|
}
|
|
public decimal OtrosTC
|
|
{
|
|
get
|
|
{
|
|
if (ConvertirPesos)
|
|
return Otros * TipoCambio;
|
|
else
|
|
return Otros;
|
|
}
|
|
}
|
|
public string AtencionA { get; set; }
|
|
public string AtnA { get; set; }
|
|
public string TelefonoGenerico { get; set; }
|
|
public string Det_OrdenCompra { get; set; }
|
|
public string Det_FechaOrdenCompra { get; set; }
|
|
public string Det_ContraRecibo { get; set; }
|
|
public string Observaciones { get; set; }
|
|
|
|
public string Alfa1 { get; set; }
|
|
public string Alfa2 { get; set; }
|
|
public string Alfa3 { get; set; }
|
|
|
|
public DateTime Fech1 { get; set; }
|
|
public DateTime Fech2 { get; set; }
|
|
public DateTime Fech3 { get; set; }
|
|
|
|
public decimal Num1 { get; set; }
|
|
public decimal Num2 { get; set; }
|
|
public decimal Num3 { get; set; }
|
|
|
|
public int DiasCredito { get; set; }
|
|
public bool EsDiasCreditoFijo { get; set; }
|
|
|
|
public int CveCorte { get; set; }
|
|
public int CveMesa { get; set; }
|
|
public int NumeroPersonas { get; set; }
|
|
|
|
//[System.ComponentModel.DataAnnotations.Schema.NotMapped]
|
|
public DateTime FechaPago { get; set; }
|
|
|
|
public int CveNCaVincular { get; set; }
|
|
public string FolioFiscal { get; set; }
|
|
public string NoSerieCertificado { get; set; }
|
|
public string SelloCFDi { get; set; }
|
|
public string SelloSAT { get; set; }
|
|
public DateTime FechaEmision { get; set; }
|
|
public DateTime FechaCertificacion { get; set; }
|
|
public string NoSerieCertificadoContribuyente { get; set; }
|
|
public string NumeroCuenta { get; set; }
|
|
public int CveTipoAmortizacionAnticipo { get; set; } = -1;
|
|
public string DescripcionContrato { get; set; }
|
|
public string NumeroDescripcionContrato { get; set; }
|
|
public int CveComplementoTimbrado { get; set; } = 0;
|
|
public ComplementoINE ComplementoINE { get; set; }
|
|
public string FordGSDB { get; set; } = "";
|
|
public string FordASN { get; set; } = "";
|
|
public FemsaFactura FemsaFactura { get; set; }
|
|
|
|
//public void SetSubProyecto()
|
|
//{
|
|
// if (CveSubProyecto > 0)
|
|
// SubProyecto = new Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}"));
|
|
//}
|
|
//public void SetSubProyectoMatriz()
|
|
//{
|
|
// System.Data.DataRow Row = GlobalDTSubProyectos(-1, CveSubProyecto: -1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1");
|
|
// if (!Information.IsNothing(Row))
|
|
// SubProyectoMatriz = new Modelos.SubProyectoModel(Row);
|
|
//}
|
|
//public void SetCliente()
|
|
//{
|
|
// if (CveCliente > 0)
|
|
// Cliente = new Modelos.ClienteModel(CveCliente, CveEmpresa);
|
|
//}
|
|
//public void SetMoneda()
|
|
//{
|
|
// if (CveMoneda > 0)
|
|
// {
|
|
// DataRow dr = GlobalDTMonedas.FiltroPrimero(string.Format("CveMoneda ={0}", CveMoneda));
|
|
// if (!IsNothing(dr))
|
|
// {
|
|
// Moneda = dr("Moneda").ToString();
|
|
// MonedaSAT = dr("AbreviaturaSAT").ToString();
|
|
// MonedaAbreviatura = dr("Abreviatura").ToString();
|
|
// }
|
|
// }
|
|
//}
|
|
//public void SetMetodoPago()
|
|
//{
|
|
// if (CveMetodoPago > 0 && !IsNothing(GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))))
|
|
// {
|
|
// MetodoPago = GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))("MetodoPago").ToString();
|
|
// ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))("ClaveSAT").ToString();
|
|
// }
|
|
//}
|
|
//public void SetMoneda(ClsPaginas ObjClsPaginas)
|
|
//{
|
|
// if (!IsNothing(ObjClsPaginas))
|
|
// {
|
|
// DataRow dr = ObjClsPaginas.GlobalDTMonedas.FiltroPrimero(string.Format("CveMoneda ={0}", CveMoneda));
|
|
// if (!IsNothing(dr))
|
|
// {
|
|
// Moneda = dr("Moneda").ToString();
|
|
// MonedaSAT = dr("AbreviaturaSAT").ToString();
|
|
// MonedaAbreviatura = dr("Abreviatura").ToString();
|
|
// }
|
|
// }
|
|
//}
|
|
//public void SetMetodoPago(ClsPaginas ObjClsPaginas)
|
|
//{
|
|
// if (!IsNothing(ObjClsPaginas))
|
|
// {
|
|
// if (!IsNothing(ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))))
|
|
// {
|
|
// MetodoPago = ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))("MetodoPago").ToString();
|
|
// ClaveMetodoPagoSAT = ObjClsPaginas.GlobalDTMetodosPago.FiltroPrimero(string.Format(" CveMetodoPago ={0}", CveMetodoPago))("ClaveSAT").ToString();
|
|
// }
|
|
// }
|
|
//}
|
|
//public void SetSubProyecto(ClsPaginas obj)
|
|
//{
|
|
// if (CveSubProyecto > 0 && !IsNothing(obj))
|
|
// SubProyecto = new Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}"));
|
|
//}
|
|
//public void SetSubProyectoMatriz(ClsPaginas obj)
|
|
//{
|
|
// if (!IsNothing(obj))
|
|
// {
|
|
// System.Data.DataRow Row = GlobalDTSubProyectos(-1, CveSubProyecto: -1, CveEmpresa: obj.UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1");
|
|
// if (!Information.IsNothing(Row))
|
|
// SubProyectoMatriz = new Modelos.SubProyectoModel(Row);
|
|
// }
|
|
//}
|
|
|
|
public int CveClienteSucursal { get; set; }
|
|
public SucursalModel ClienteSucursal { get; set; }
|
|
public EnviarAModel EnviarA { get; set; }
|
|
public string NumeroContrato { get; set; }
|
|
public string PedidoContrato { get; set; }
|
|
public string OrdenCompra { get; set; } = "-1";
|
|
public int CveMetodoPago { get; set; }
|
|
public string MetodoPago { get; set; }
|
|
public string ClaveMetodoPagoSAT { get; set; }
|
|
public int CveMetodoPago33 { get; set; }
|
|
public string MetodoPago33 { get; set; }
|
|
public int CveFormaPago33 { get; set; }
|
|
public string MetodoPagoSAT33 { get; set; }
|
|
public string FormaPago33 { get; set; }
|
|
public string FormaPagoSAT33 { get; set; }
|
|
public string UsoCFDI { get; set; } = "";
|
|
public int CveUsoCFDI { get; set; }
|
|
public string ClaveUsoCFDI { get; set; } = "";
|
|
public int CveTipoRelacion { get; set; } = -1;
|
|
public int CveEstatusFactura { get; set; }
|
|
public int CveVendedor { get; set; }
|
|
public string VendedorCodigo { get; set; }
|
|
public int CveSucursalEjecucion { get; set; }
|
|
public DateTime FechaEjecucion { get; set; }
|
|
public int CveSucursalCobranza { get; set; }
|
|
|
|
public int CveSubProyectoCobranza { get; set; }
|
|
public int CveSubProyectoEjecucion { get; set; }
|
|
public int CveOS { get; set; }
|
|
public int CveContrato { get; set; }
|
|
public int CveVentaPadre { get; set; }
|
|
public int CvePrePoliza { get; set; }
|
|
public string Entrega { get; set; }
|
|
public string TiempoEntrega { get; set; }
|
|
public DateTime Vigencia { get; set; }
|
|
public int TipoEstatus { get; set; }
|
|
public int CveCondicionEntrega { get; set; }
|
|
public string CondicionEntrega { get; set; }
|
|
|
|
public string TipoRelacion { get; set; }
|
|
public List<string> UUIDRelacionados { get; set; }
|
|
|
|
|
|
public int CveVentaRelacion { get; set; } = -1;
|
|
public decimal ImporteRelacion { get; set; }
|
|
|
|
public bool EsNCAmortizacion { get; set; }
|
|
public decimal Kilometraje { get; set; }
|
|
|
|
public int CveTipoRetencion { get; set; }
|
|
}
|
|
|
|
}
|
|
|
|
|