コード例 #1
0
        } // !AddTradeLineCommentItem()

        /// <summary>
        /// Adds a new line to the invoice. The line id is generated automatically.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="unitCode"></param>
        /// <param name="unitQuantity"></param>
        /// <param name="grossUnitPrice"></param>
        /// <param name="netUnitPrice"></param>
        /// <param name="billedQuantity"></param>
        /// <param name="taxType"></param>
        /// <param name="categoryCode"></param>
        /// <param name="taxPercent"></param>
        /// <param name="comment"></param>
        /// <param name="id"></param>
        /// <param name="sellerAssignedID"></param>
        /// <param name="buyerAssignedID"></param>
        /// <param name="deliveryNoteID"></param>
        /// <param name="deliveryNoteDate"></param>
        /// <param name="buyerOrderID"></param>
        /// <param name="buyerOrderDate"></param>
        /// <returns></returns>
        public TradeLineItem AddTradeLineItem(string name,
                                              string description            = null,
                                              QuantityCodes unitCode        = QuantityCodes.Unknown,
                                              decimal?unitQuantity          = null,
                                              decimal grossUnitPrice        = Decimal.MinValue,
                                              decimal netUnitPrice          = Decimal.MinValue,
                                              decimal billedQuantity        = Decimal.MinValue,
                                              TaxTypes taxType              = TaxTypes.Unknown,
                                              TaxCategoryCodes categoryCode = TaxCategoryCodes.Unknown,
                                              decimal taxPercent            = Decimal.MinValue,
                                              string comment          = null,
                                              GlobalID id             = null,
                                              string sellerAssignedID = "", string buyerAssignedID    = "",
                                              string deliveryNoteID   = "", DateTime?deliveryNoteDate = null,
                                              string buyerOrderID     = "", DateTime?buyerOrderDate   = null)
        {
            return(AddTradeLineItem(lineID: _getNextLineId(),
                                    name: name,
                                    description: description,
                                    unitCode: unitCode,
                                    unitQuantity: unitQuantity,
                                    grossUnitPrice: grossUnitPrice,
                                    netUnitPrice: netUnitPrice,
                                    billedQuantity: billedQuantity,
                                    taxType: taxType,
                                    categoryCode: categoryCode,
                                    taxPercent: taxPercent,
                                    comment: comment,
                                    id: id,
                                    sellerAssignedID: sellerAssignedID,
                                    deliveryNoteID: deliveryNoteID,
                                    buyerOrderID: buyerOrderID));
        } // !AddTradeLineItem()
コード例 #2
0
        public void AddScheduledTax(Municipality municipality, DateTime start, TaxTypes type, int taxPercentage)
        {
            var taxPeriod = _taxPeriodFactory.CreateTaxPeriod(start, type, taxPercentage);

            municipality.AddTaxPeriod(taxPeriod);
            _municipalityRepository.Update(municipality, new CancellationToken());
        }
コード例 #3
0
 public Subject()
 {
     ITaxNum    = 0;
     Name       = "";
     StartDate  = DateTime.Now;
     Activities = new Collection <ActivitiesClass>();
     TaxType    = new TaxTypes();
 }
コード例 #4
0
 public void RefreshLists()
 {
     CostAccountCategoryList          = CostAccountCategories.GetAll().ToSvenTechCollection();
     CostAccountCategoriesHierachical = CostAccountCategoryList.ToHierachicalCollection <CostAccountCategory>()
                                        .ToSvenTechCollection();
     TaxTypeList   = TaxTypes.GetAll().ToSvenTechCollection();
     _CostAccounts = CostAccounts.GetAll().ToSvenTechCollection();
 }
コード例 #5
0
        private void InsertNewTaxEntry(Municipality municipality, TaxTypes taxType, DateTime startDate, float taxRate)
        {
            var newEntry = new TaxEntry {
                Municipality = municipality, TaxType = taxType, StartDate = startDate, TaxRate = taxRate
            };

            _taxProvider.Insert(newEntry);
        }
コード例 #6
0
        public void CreateCreditDebit(GrossNetType grossNetType, BookingType bookingType, decimal amount, CostAccount costAccountCreditor, CostAccount costAccountDebitor, TaxType taxType, out List <Credit> credits, out List <Debit> debits)
        {
            credits = new List <Credit>();
            debits  = new List <Debit>();

            if (costAccountCreditor == null || costAccountDebitor == null)
            {
                return;
            }

            CalculateTax(grossNetType, taxType, amount, out decimal tax, out decimal amountWithoutTax);

            Debit  debit  = new Debit();
            Credit credit = new Credit();

            TaxType nonTax = TaxTypes.GetById(1);

            if (bookingType == BookingType.Invoice)
            {
                if (taxType.Description.IndexOf("Vorsteuer", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    credits.AddRange(CreateCredits(grossNetType, nonTax, tax + amountWithoutTax, costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, taxType, amount, costAccountDebitor));
                }
                else if (taxType.Description.IndexOf("Umsatzsteuer", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    credits.AddRange(CreateCredits(grossNetType, taxType, amount, costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, nonTax, tax + amountWithoutTax, costAccountDebitor));
                }
                else
                {
                    credits.AddRange(CreateCredits(grossNetType, nonTax, amount, costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, nonTax, amount, costAccountDebitor));
                }
            }
            else if (bookingType == BookingType.CreditAdvice)
            {
                // ToDo Check with Tobias !!!

                if (taxType.Description.IndexOf("Vorsteuer", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    credits.AddRange(CreateCredits(grossNetType, nonTax, amount * (-1), costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, taxType, amount, costAccountDebitor));
                }
                else if (taxType.Description.IndexOf("Umsatzsteuer", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    credits.AddRange(CreateCredits(grossNetType, taxType, amount, costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, nonTax, amount * (-1), costAccountDebitor));
                }
                else
                {
                    credits.AddRange(CreateCredits(grossNetType, nonTax, amount, costAccountCreditor));
                    debits.AddRange(CreateDebits(grossNetType, nonTax, amount * (-1), costAccountDebitor));
                }
            }
        }
コード例 #7
0
        private void DeleteItem()
        {
            if (SelectedItem is null)
            {
                return;
            }

            TaxTypes.Delete(SelectedItem.TaxTypeId);
            TaxTypeList.Remove(SelectedItem);
        }
コード例 #8
0
 public ITaxStrategy GetTaxStrategy(TaxTypes type)
 {
     return(type switch
     {
         TaxTypes.Daily => new DailyTaxStrategy(),
         TaxTypes.Weekly => new WeeklyTaxStrategy(),
         TaxTypes.Monthly => new MonthlyTaxStrategy(),
         TaxTypes.Yearly => new YearlyTaxStrategy(),
         _ => throw new NotSupportedException(),
     });
コード例 #9
0
        public CompanyViewModel()
        {
            if (IsInDesignMode)
            {
                return;
            }

            TaxTypeList       = TaxTypes.GetAll().ToSvenTechCollection();
            SelectedTaxTypeId = 1;
        }
コード例 #10
0
ファイル: TaxTypes.cs プロジェクト: rj2Skipper/ZUGFeRD-csharp
 public static TaxTypes FromString(this TaxTypes _, string s)
 {
     try
     {
         return((TaxTypes)Enum.Parse(typeof(TaxTypes), s));
     }
     catch
     {
         return(TaxTypes.Unknown);
     }
 } // !FromString()
コード例 #11
0
        public TaxPeriod CreateTaxPeriod(DateTime start, TaxTypes type, int taxPercentage)
        {
            DateTime end;

            return(type switch
            {
                TaxTypes.Yearly => CreateYearlyPeriod(start, taxPercentage),
                TaxTypes.Monthly => CreateMontlyPeriod(start, taxPercentage),
                TaxTypes.Weekly => CreateWeeklyPeriod(start, taxPercentage),
                TaxTypes.Daily => CreateDailyPeriod(start, taxPercentage),
                _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
            });
コード例 #12
0
        public object UpdateTaxType(TaxTypes _taxTypesObj)
        {
            SqlParameter outputStatus = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[UpdateTaxType]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value        = _taxTypesObj.Code;
                        cmd.Parameters.Add("@Description", SqlDbType.VarChar, 50).Value = _taxTypesObj.Description;
                        cmd.Parameters.Add("@Rate", SqlDbType.Decimal).Value            = _taxTypesObj.Rate;
                        cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = _taxTypesObj.commonObj.UpdatedBy;
                        cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value    = _taxTypesObj.commonObj.UpdatedDate;
                        outputStatus           = cmd.Parameters.Add("@Status", SqlDbType.SmallInt);
                        outputStatus.Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();
                    }
                }

                switch (outputStatus.Value.ToString())
                {
                case "0":

                    throw new Exception(Cobj.UpdateFailure);

                case "1":
                    _taxTypesObj.Code = outputStatus.Value.ToString();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(new
            {
                Status = outputStatus.Value.ToString(),
                Message = Cobj.UpdateSuccess
            });
        }
コード例 #13
0
        private void AddNewItem(RowEventArgs e)
        {
            TaxType newItem = (TaxType)e.Row;

            if (newItem.TaxTypeId == 0)
            {
                TaxTypes.Insert(newItem);
            }
            else
            {
                TaxTypes.Update(newItem);
            }
        }
コード例 #14
0
ファイル: TaxFactory.cs プロジェクト: ganeshran/taxreporter
 public ITaxDue GetTaxInstance(TaxTypes type)
 {
     switch (type)
     {
         case TaxTypes.EducationCess:
             return IoCWrapper.Get<ITaxDue>(type.ToString());
         case TaxTypes.ForeignRemittanceTax:
                 return SimplePerentTaxHelper("Foreign Remittance Tax", 0.05);
         case TaxTypes.ServiceTax:
                 return SimplePerentTaxHelper("Service Tax", 0.10);
         default:
             return null;
     }
 }
コード例 #15
0
        } // !SetDeliveryNoteReferenceDocument()

        public void AddLogisticsServiceCharge(decimal amount, string description, TaxTypes taxTypeCode, TaxCategoryCodes taxCategoryCode, decimal taxPercent)
        {
            this.ServiceCharges.Add(new ServiceCharge()
            {
                Description = description,
                Amount      = amount,
                Tax         = new Tax()
                {
                    CategoryCode = taxCategoryCode,
                    TypeCode     = taxTypeCode,
                    Percent      = taxPercent
                }
            });
        } // !AddLogisticsServiceCharge()
コード例 #16
0
        public void AddApplicableTradeTax(decimal basisAmount, decimal percent, TaxTypes typeCode, TaxCategoryCodes?categoryCode = null, decimal allowanceChargeBasisAmount = 0)
        {
            Tax tax = new Tax()
            {
                BasisAmount = basisAmount,
                Percent     = percent,
                TypeCode    = typeCode,
                AllowanceChargeBasisAmount = allowanceChargeBasisAmount
            };

            if ((categoryCode != null) && (categoryCode.Value != TaxCategoryCodes.Unknown))
            {
                tax.CategoryCode = categoryCode;
            }

            this.Taxes.Add(tax);
        } // !AddApplicableTradeTax()
コード例 #17
0
        public List <TaxTypes> GetAllTaxTypes()
        {
            List <TaxTypes> taxTypesList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[GetTaxTypes]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                taxTypesList = new List <TaxTypes>();
                                while (sdr.Read())
                                {
                                    TaxTypes _taxTypesObj = new TaxTypes();
                                    {
                                        _taxTypesObj.Code        = (sdr["Code"].ToString() != "" ? (sdr["Code"].ToString()) : _taxTypesObj.Code);
                                        _taxTypesObj.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : _taxTypesObj.Description);
                                        _taxTypesObj.Rate        = (sdr["Rate"].ToString() != "" ? decimal.Parse(sdr["Rate"].ToString()) : _taxTypesObj.Rate);
                                    }
                                    taxTypesList.Add(_taxTypesObj);
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(taxTypesList);
        }
コード例 #18
0
        public TaxTypes GetTaxTypeDetailsByCode(string Code)
        {
            TaxTypes _taxTypesObj = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[GetTaxTypeDetails]";
                        cmd.Parameters.Add("@Code", SqlDbType.NVarChar, 10).Value = Code;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                if (sdr.Read())
                                {
                                    _taxTypesObj             = new TaxTypes();
                                    _taxTypesObj.Code        = (sdr["Code"].ToString() != "" ? (sdr["Code"].ToString()) : _taxTypesObj.Code);
                                    _taxTypesObj.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : _taxTypesObj.Description);
                                    _taxTypesObj.Rate        = (sdr["Rate"].ToString() != "" ? decimal.Parse(sdr["Rate"].ToString()) : _taxTypesObj.Rate);
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(_taxTypesObj);
        }
コード例 #19
0
        public object InsertUpdateTaxType(TaxTypes _taxTypesObj)
        {
            object result = null;

            try
            {
                if ((_taxTypesObj.isUpdate) == "0")
                {
                    result = _taxTypesRepository.InsertTaxType(_taxTypesObj);
                }
                else
                {
                    result = _taxTypesRepository.UpdateTaxType(_taxTypesObj);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #20
0
        public List <Tax> GetTaxes(int municipalityId, TaxTypes type, DateTime dateFrom, DateTime?dateTo = null)
        {
            var sql = new MySqlCommand($@"
                SELECT Id, MunicipalityId, Value, Date, Type
                FROM taxes
                WHERE
                    MunicipalityId = ?municipalityId AND
                    {(dateTo.HasValue ? "Date BETWEEN ?dateFrom AND ?dateTo" : "Date = ?dateFrom")} AND
                    Type = ?type
            ;");

            sql.Parameters.AddWithValue("?municipalityId", municipalityId);
            sql.Parameters.AddWithValue("?dateFrom", dateFrom);
            sql.Parameters.AddWithValue("?type", (int)type);

            if (dateTo.HasValue)
            {
                sql.Parameters.AddWithValue("?dateTo", dateTo.Value);
            }

            return(DbRepository.FetchList <Tax>(sql));
        }
コード例 #21
0
 public TaxCodeIndia(
     string code,
     ITaxableItem lineItem,
     string taxGroup,
     string currency,
     decimal value,
     decimal limitMin,
     decimal limitMax,
     bool exempt,
     TaxBase taxBase,
     TaxLimitBase limitBase,
     TaxCalculationMode method,
     string taxOnTax,
     string unit,
     decimal collectMin,
     decimal collectMax,
     decimal abatementPercent,
     TaxTypes taxType,
     TaxCodeProvider provider)
     : base(value, limitMin, limitMax, provider)
 {
     this.Code                 = code;
     this.LineItem             = lineItem;
     this.TaxGroup             = taxGroup;
     this.Currency             = currency;
     this.Exempt               = exempt;
     this.TaxBase              = taxBase;
     this.TaxLimitBase         = limitBase;
     this.TaxCalculationMethod = method;
     this.TaxOnTax             = taxOnTax;
     this.Unit                 = unit;
     this.CollectLimitMax      = collectMax;
     this.CollectLimitMin      = collectMin;
     this.AbatementPercent     = abatementPercent;
     this.TaxType              = taxType;
 }
コード例 #22
0
        public void Post(int municipalityID, TaxTypes taxType, DateTime startDate, float taxRate)
        {
            var municipalityObj = _municipalityProvider.GetByID(municipalityID);

            InsertNewTaxEntry(municipalityObj, taxType, startDate, taxRate);
        }
コード例 #23
0
        public void Post(string municipality, TaxTypes taxType, DateTime startDate, float taxRate)
        {
            var municipalityObj = _municipalityProvider.GetByTitle(municipality);

            InsertNewTaxEntry(municipalityObj, taxType, startDate, taxRate);
        }
コード例 #24
0
 private SvenTechCollection <TaxType> LoadTaxTypesFromDb()
 {
     return(TaxTypes.GetAll().ToSvenTechCollection());
 }
コード例 #25
0
ファイル: TaxTypes.cs プロジェクト: rj2Skipper/ZUGFeRD-csharp
        } // !FromString()

        public static string EnumToString(this TaxTypes t)
        {
            return(t.ToString("g"));
        } // !ToString()
コード例 #26
0
ファイル: TaxManagerShould.cs プロジェクト: zaLTys/TaxManager
        public async Task BeAbleToAddTaxEntry(string dateFrom, string dateTo, int municipalityId, TaxTypes taxType, decimal taxApplied, string municipalityName)
        {
            var dateFromAsDate   = Convert.ToDateTime(dateFrom);
            var dateToAsDate     = Convert.ToDateTime(dateTo);
            var taxEntryToInsert = new TaxEntryCreateDto(dateFromAsDate, dateToAsDate, municipalityId, (int)taxType, taxApplied);
            var taxManager       = new Api.Domain.TaxManager(_testRepository, _mapper);

            var result = await taxManager.InsertTaxEntryAsync(taxEntryToInsert);

            Assert.Equal(taxEntryToInsert.TaxType, result.TaxType);
            Assert.Equal(taxEntryToInsert.DateFrom, result.DateFrom);
            Assert.Equal(taxEntryToInsert.DateTo, result.DateTo);
            Assert.Equal(taxEntryToInsert.MunicipalityId, result.MunicipalityId);
            Assert.Equal(taxEntryToInsert.TaxValue, result.TaxValue);
            Assert.NotNull(result.Id);

            var check = await taxManager.GetMunicipalityTaxForDateAsync(municipalityName, dateFrom);

            AssertResult(taxEntryToInsert.TaxValue, check);
        }
コード例 #27
0
 private void RefreshList()
 {
     TaxTypeList = TaxTypes.GetAll().ToOberservableCollection();
 }
コード例 #28
0
        } // !AddLogisticsServiceCharge()

        public void AddTradeAllowanceCharge(bool isDiscount, decimal basisAmount, CurrencyCodes currency, decimal actualAmount, string reason, TaxTypes taxTypeCode, TaxCategoryCodes taxCategoryCode, decimal taxPercent)
        {
            this.TradeAllowanceCharges.Add(new TradeAllowanceCharge()
            {
                ChargeIndicator = !isDiscount,
                Reason          = reason,
                BasisAmount     = basisAmount,
                ActualAmount    = actualAmount,
                Currency        = currency,
                Amount          = actualAmount,
                Tax             = new Tax()
                {
                    CategoryCode = taxCategoryCode,
                    TypeCode     = taxTypeCode,
                    Percent      = taxPercent
                }
            });
        } // !AddTradeAllowanceCharge()
コード例 #29
0
        } // !AddTradeLineItem()

        /// <summary>
        /// Adds a new line to the invoice. The line id is passed as a parameter.
        /// </summary>
        public TradeLineItem AddTradeLineItem(string lineID,
                                              string name,
                                              string description            = null,
                                              QuantityCodes unitCode        = QuantityCodes.Unknown,
                                              decimal?unitQuantity          = null,
                                              decimal?grossUnitPrice        = null,
                                              decimal?netUnitPrice          = null,
                                              decimal billedQuantity        = 0,
                                              TaxTypes taxType              = TaxTypes.Unknown,
                                              TaxCategoryCodes categoryCode = TaxCategoryCodes.Unknown,
                                              decimal taxPercent            = 0,
                                              string comment              = null,
                                              GlobalID id                 = null,
                                              string sellerAssignedID     = "", string buyerAssignedID      = "",
                                              string deliveryNoteID       = "", DateTime?deliveryNoteDate   = null,
                                              string buyerOrderID         = "", DateTime?buyerOrderDate     = null,
                                              DateTime?billingPeriodStart = null, DateTime?billingPeriodEnd = null)
        {
            TradeLineItem newItem = new TradeLineItem()
            {
                LineID             = lineID,
                GlobalID           = id,
                SellerAssignedID   = sellerAssignedID,
                BuyerAssignedID    = buyerAssignedID,
                Name               = name,
                Description        = description,
                UnitCode           = unitCode,
                UnitQuantity       = unitQuantity,
                GrossUnitPrice     = grossUnitPrice,
                NetUnitPrice       = netUnitPrice,
                BilledQuantity     = billedQuantity,
                TaxType            = taxType,
                TaxCategoryCode    = categoryCode,
                TaxPercent         = taxPercent,
                BillingPeriodStart = billingPeriodStart,
                BillingPeriodEnd   = billingPeriodEnd
            };

            if (String.IsNullOrEmpty(lineID))
            {
                throw new ArgumentException("LineID cannot be Null or Empty");
            }
            else
            {
                if (this.TradeLineItems.Any(p => p.AssociatedDocument.LineID.ToLower() == lineID.ToLower()))
                {
                    throw new ArgumentException("LineID must be unique");
                }
            }

            newItem.AssociatedDocument = new ZUGFeRD.AssociatedDocument(lineID);
            if (!String.IsNullOrEmpty(comment))
            {
                newItem.AssociatedDocument.Notes.Add(new Note(comment, SubjectCodes.Unknown, ContentCodes.Unknown));
            }

            if (!String.IsNullOrEmpty(deliveryNoteID) || deliveryNoteDate.HasValue)
            {
                newItem.SetDeliveryNoteReferencedDocument(deliveryNoteID, deliveryNoteDate);
            }

            if (!String.IsNullOrEmpty(buyerOrderID) || buyerOrderDate.HasValue)
            {
                newItem.SetOrderReferencedDocument(buyerOrderID, buyerOrderDate);
            }

            this.TradeLineItems.Add(newItem);
            return(newItem);
        } // !AddTradeLineItem()
コード例 #30
0
        } // !addTradeLineCommentItem()

        /// <summary>
        /// @todo Rabatt ergänzen:
        /// <ram:AppliedTradeAllowanceCharge>
        ///                 <ram:ChargeIndicator><udt:Indicator>false</udt:Indicator></ram:ChargeIndicator>
        ///                 <ram:CalculationPercent>2.00</ram:CalculationPercent>
        ///                 <ram:BasisAmount currencyID = "EUR" > 1.5000 </ ram:BasisAmount>
        ///                 <ram:ActualAmount currencyID = "EUR" > 0.0300 </ ram:ActualAmount>
        ///                 <ram:Reason>Artikelrabatt 1</ram:Reason>
        ///             </ram:AppliedTradeAllowanceCharge>
        /// </summary>
        public TradeLineItem addTradeLineItem(string name,
                                              string description            = null,
                                              QuantityCodes unitCode        = QuantityCodes.Unknown,
                                              decimal?unitQuantity          = null,
                                              decimal grossUnitPrice        = Decimal.MinValue,
                                              decimal netUnitPrice          = Decimal.MinValue,
                                              decimal billedQuantity        = Decimal.MinValue,
                                              TaxTypes taxType              = TaxTypes.Unknown,
                                              TaxCategoryCodes categoryCode = TaxCategoryCodes.Unknown,
                                              decimal taxPercent            = Decimal.MinValue,
                                              string comment          = null,
                                              GlobalID id             = null,
                                              string sellerAssignedID = "", string buyerAssignedID    = "",
                                              string deliveryNoteID   = "", DateTime?deliveryNoteDate = null,
                                              string buyerOrderID     = "", DateTime?buyerOrderDate   = null)
        {
            TradeLineItem newItem = new TradeLineItem()
            {
                GlobalID         = id,
                SellerAssignedID = sellerAssignedID,
                BuyerAssignedID  = buyerAssignedID,
                Name             = name,
                Description      = description,
                UnitCode         = unitCode,
                UnitQuantity     = unitQuantity,
                GrossUnitPrice   = grossUnitPrice,
                NetUnitPrice     = netUnitPrice,
                BilledQuantity   = billedQuantity,
                TaxType          = taxType,
                TaxCategoryCode  = categoryCode,
                TaxPercent       = taxPercent,
                LineTotalAmount  = netUnitPrice * billedQuantity
            };

            int?_lineID = null;

            if (this.TradeLineItems.Count > 0)
            {
                _lineID = this.TradeLineItems.Last().AssociatedDocument.LineID;
            }

            if (_lineID.HasValue)
            {
                _lineID = _lineID.Value + 1;
            }
            else
            {
                _lineID = 1;
            }

            newItem.AssociatedDocument = new ZUGFeRD.AssociatedDocument(_lineID);
            if (!String.IsNullOrEmpty(comment))
            {
                newItem.AssociatedDocument.Notes.Add(new Note(comment, SubjectCodes.Unknown, ContentCodes.Unknown));
            }

            if (!String.IsNullOrEmpty(deliveryNoteID) || deliveryNoteDate.HasValue)
            {
                newItem.setDeliveryNoteReferencedDocument(deliveryNoteID, deliveryNoteDate);
            }

            if (!String.IsNullOrEmpty(buyerOrderID) || buyerOrderDate.HasValue)
            {
                newItem.setOrderReferencedDocument(buyerOrderID, buyerOrderDate);
            }

            this.TradeLineItems.Add(newItem);
            return(newItem);
        } // !addTradeLineItem()
コード例 #31
0
 public TaxPeriod CreateTaxPeriod(DateTime start, TaxTypes type, int percentage)
 {
     throw new NotImplementedException();
 }