コード例 #1
0
ファイル: OPQT.cs プロジェクト: idevman/sap-di-connector
        public override int GetHashCode()
        {
            int hashCode = 98921229;

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DocStatus);

            hashCode = hashCode * -1521134295 + UpdateDate.GetHashCode();
            return(hashCode);
        }
コード例 #2
0
ファイル: OPOR.cs プロジェクト: idevman/sap-di-connector
        public override int GetHashCode()
        {
            int hashCode = 1540013303;

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DocStatus);

            hashCode = hashCode * -1521134295 + UpdateDate.GetHashCode();
            hashCode = hashCode * -1521134295 + PurchaseRequestId.GetHashCode();
            return(hashCode);
        }
コード例 #3
0
        /// <summary>
        /// Generates hash code
        /// </summary>
        /// <returns>hash code</returns>
        public override int GetHashCode()
        {
            var hashCode = 2126638501;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ReqName);

            hashCode = hashCode * -1521134295 + ReqType.GetHashCode();
            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + ReqDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <PRQ1> > .Default.GetHashCode(Items);

            return(hashCode);
        }
コード例 #4
0
ファイル: ORDR.cs プロジェクト: idevman/sap-di-connector
        /// <summary>
        /// Generates hash code
        /// </summary>
        /// <returns>hash code</returns>
        public override int GetHashCode()
        {
            var hashCode = -144526589;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CardCode);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CardName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(NumAtCard);

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <RDR1> > .Default.GetHashCode(Items);

            return(hashCode);
        }
コード例 #5
0
        /// <summary>
        /// Obtiene un objeto RegistroLRFacturasRecibidas, este objeto se utiliza
        /// para la serialización xml.
        /// </summary>
        /// <param name="updateInnerSII">Si es true, actualiza el objeto SII subyacente
        /// con el valor calculado.</param>
        /// <param name="skipErrors">Indica si hay que omitir las excepciones.</param>
        /// <returns>Nueva instancia del objeto para serialización
        /// xml RegistroLRFacturasEmitidas.</returns>
        public RegistroLRFacturasRecibidas ToSII(bool updateInnerSII = false, bool skipErrors = false)
        {
            if (InnerSII != null)
            {
                return(InnerSII);
            }

            RegistroLRFacturasRecibidas siiInvoice = new RegistroLRFacturasRecibidas();

            if (IssueDate == null && !skipErrors)
            {
                throw new ArgumentNullException("IssueDate is null.");
            }

            if (PostingDate == null && !skipErrors)
            {
                throw new ArgumentNullException("PostingDate is null.");
            }

            if (RegisterDate == null && !skipErrors)
            {
                throw new ArgumentNullException("RegisterDate is null.");
            }

            if (!string.IsNullOrEmpty(ExternalReference) &&
                !(Settings.Current.IDVersionSii.CompareTo("1.1") < 0))
            {
                siiInvoice.FacturaRecibida.RefExterna = ExternalReference;
            }

            if (Settings.Current.IDVersionSii.CompareTo("1.1") < 0)
            {
                siiInvoice.PeriodoImpositivo.Ejercicio = (PostingDate ?? new DateTime(1, 1, 1)).ToString("yyyy");
                siiInvoice.PeriodoImpositivo.Periodo   = (PostingDate ?? new DateTime(1, 1, 1)).ToString("MM");
            }
            else
            {
                siiInvoice.PeriodoLiquidacion.Ejercicio = (PostingDate ?? new DateTime(1, 1, 1)).ToString("yyyy");
                siiInvoice.PeriodoLiquidacion.Periodo   = (PostingDate ?? new DateTime(1, 1, 1)).ToString("MM");
            }

            if (SellerParty == null && !skipErrors)
            {
                throw new ArgumentNullException("SellerParty is null.");
            }

            if (GrossAmount != 0)
            {
                siiInvoice.FacturaRecibida.ImporteTotal = SIIParser.FromDecimal(GrossAmount);
            }


            if (!(Settings.Current.IDVersionSii.CompareTo("1.1") < 0))
            {
                if (GrossAmount > UpperLimit)
                {
                    siiInvoice.FacturaRecibida.Macrodato = "S";
                }
            }

            siiInvoice.IDFactura.NumSerieFacturaEmisor        = InvoiceNumber;
            siiInvoice.IDFactura.FechaExpedicionFacturaEmisor = SIIParser.FromDate(IssueDate);

            /* B) Facturas Recibidas
             *
             * En un plazo de cuatro días naturales desde la fecha en que se produzca el registro
             * contable de la factura y, en todo caso, antes del día 16 del mes siguiente al periodo
             * de liquidación en que se hayan incluido las operaciones correspondientes
             * (período en que se deduce el IVA soportado).
             * Se entiende que el registro contable de la factura se produce en la fecha de entrada
             * en el sistema contable con independencia de la fecha reflejada en el asiento contable. */

            siiInvoice.FacturaRecibida.FechaRegContable = SIIParser.FromDate(RegisterDate);

            if (OperationIssueDate != null)
            {
                siiInvoice.FacturaRecibida.FechaOperacion = SIIParser.FromDate(OperationIssueDate);
            }


            if (Settings.Current.IDVersionSii.CompareTo("1.1") >= 0 && TaxDate != null)
            {
                siiInvoice.FacturaRecibida.ADeducirEnPeriodoPosterior = "S";
                siiInvoice.FacturaRecibida.EjercicioDeduccion         = TaxDate?.ToString("yyyy");
                siiInvoice.FacturaRecibida.PeriodoDeduccion           = TaxDate?.ToString("MM");;
            }

            siiInvoice.FacturaRecibida.TipoFactura = InvoiceType.ToString();
            siiInvoice.FacturaRecibida.ClaveRegimenEspecialOTrascendencia =
                ((int)ClaveRegimenEspecialOTrascendencia).ToString().PadLeft(2, '0');

            siiInvoice.FacturaRecibida.DescripcionOperacion = InvoiceText;

            if (InvoiceType == InvoiceType.F5)
            {
                /* SII_Descripcion_ServicioWeb_v0.7.pdf (pag. 203)
                 * 8.1.2.2.Ejemplo mensaje XML de alta de importación
                 * En los datos identificativos correspondientes al proveedor se consignaran los del importador y titular del libro registro
                 * Deberán consignarse, como número de factura y fecha de expedición, el número de referencia que figura en el propio DUA y la fecha de su
                 * admisión por la Administración Aduanera respectivamente*/

                SellerParty = BuyerParty;
            }

            siiInvoice.FacturaRecibida.Contraparte = GetContraparte(siiInvoice, skipErrors);

            // Tratamiento de las facturas rectificativas.

            if (InvoicesRectified.Count != 0)
            {
                siiInvoice.FacturaRecibida.TipoRectificativa = RectifiedType.ToString();


                if (RectifiedBase != 0)
                {
                    // Si consta el datos de importe rectificacion (tipo rectif 's'), lo ponemos
                    ImporteRectificacion importeRectifica = new ImporteRectificacion();

                    importeRectifica.BaseRectificada                = SIIParser.FromDecimal(RectifiedBase);
                    importeRectifica.CuotaRectificada               = SIIParser.FromDecimal(RectifiedAmount);
                    importeRectifica.CuotaRecargoRectificado        = SIIParser.FromDecimal(RectifiedEquivCharge);
                    siiInvoice.FacturaRecibida.ImporteRectificacion = importeRectifica;
                }

                siiInvoice.FacturaRecibida.FacturasRectificadas = new List <IDFactura>();

                foreach (var regRect in InvoicesRectified)
                {
                    IDFactura FactRectificada = new IDFactura();

                    FactRectificada.NumSerieFacturaEmisor        = regRect.RectifiedInvoiceNumber;
                    FactRectificada.FechaExpedicionFacturaEmisor = SIIParser.FromDate(regRect.RectifiedIssueDate);
                    // En este caso pongo a null IDEmisorFactura para que no serialice una etiqueta vacía.
                    FactRectificada.IDEmisorFactura = null;

                    siiInvoice.FacturaRecibida.FacturasRectificadas.Add(FactRectificada);
                }
            }
            else
            {
                if (InvoiceType.ToString().StartsWith("R") && !skipErrors)
                {
                    throw new Exception("RectifiedInvoiceNumber for InvoiceType of kind 'R' must be not null.");
                }
            }


            // Desgloses

            DesgloseIVA desgloseIVA = GetDesgloseIVA();


            if (IsInversionSujetoPasivo)
            {
                siiInvoice.FacturaRecibida.DesgloseFactura.InversionSujetoPasivo = desgloseIVA;
            }
            else
            {
                siiInvoice.FacturaRecibida.DesgloseFactura.DesgloseIVA = desgloseIVA;
            }


            decimal cuotaDeducible = 0;

            foreach (KeyValuePair <decimal, decimal[]> kvp in TaxesOutputs)
            {
                cuotaDeducible += kvp.Value[1];
            }

            siiInvoice.FacturaRecibida.CuotaDeducible = SIIParser.FromDecimal(cuotaDeducible);

            if (updateInnerSII)
            {
                InnerSII = siiInvoice;
            }

            return(siiInvoice);
        }