當前位置: 首頁>>代碼示例>>C#>>正文


C# Int64.ToDouble方法代碼示例

本文整理匯總了C#中System.Int64.ToDouble方法的典型用法代碼示例。如果您正苦於以下問題:C# Int64.ToDouble方法的具體用法?C# Int64.ToDouble怎麽用?C# Int64.ToDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Int64的用法示例。


在下文中一共展示了Int64.ToDouble方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddTaxes

		private void AddTaxes(Millicents GrossForFICA, Millicents GrossForFed, Millicents GrossForState, Millicents GrossForLocal, Income income, Person person)
		{
			person.UpdateIncomeTaxStatusByDate(0/*JulianDay*/);
			IncomeTaxStatus status = person.IncomeTaxStatus;
			TaxTable federal = TaxTable.CreateFederal(status);
			TaxTable state = TaxTable.CreateState(status, person.Location);
			TaxTable local = TaxTable.CreateLocal(status, person.Location);

			double AnnualPayPeriods = income.Frequency.ToAnnualPeriods();

			// FICA
			double GrossFICA = GrossForFICA.ToDouble();
			double SocSecWages = Math.Min(GrossFICA, Math.Max(TaxTable.MaxSocSecWages - GrossFICA, 0));
			double SocSec = Math.Round(SocSecWages * TaxTable.SocSecPercent, 2);
			double Medicare = Math.Round(GrossFICA * TaxTable.MedicarePercent, 2);

			// Federal
			double FederalGross = GrossForFed.ToDouble() * AnnualPayPeriods;
			double FederalExemptions = federal.Exemptions(status.FederalExemptions);
			double FederalTaxableGross = Math.Max(FederalGross - FederalExemptions, 0);
			double FederalTaxTotal = Math.Round(federal.Compute(FederalTaxableGross), 2);
			double FederalTax = Math.Round(FederalTaxTotal / AnnualPayPeriods, 2);

			// State
			double StateGross = GrossForState.ToDouble() * AnnualPayPeriods;
			double StateExemptions = state.Exemptions(status.StateLocalExemptions);
			double StateTaxableGross = Math.Max(StateGross - StateExemptions, 0);
			double StateTaxTotal = Math.Round(state.Compute(StateTaxableGross), 2);
			double StateTax = Math.Round(StateTaxTotal / AnnualPayPeriods, 2);

			// Local
			double LocalGross = GrossForLocal.ToDouble() * AnnualPayPeriods;
			double LocalExemptions = local.Exemptions(status.StateLocalExemptions);
			double LocalTaxableGross = Math.Max(LocalGross - LocalExemptions, 0);
			double LocalTaxTotal = Math.Round(local.Compute(LocalTaxableGross), 2);
			double LocalTax = Math.Round(LocalTaxTotal / AnnualPayPeriods, 2);

			// Other calculations
			//double NetPay = GrossFed - SocSec - Medicare - FedTax - StateTax;
			//double AvgTaxRate = (SocSec + Medicare + FedTax + StateTax) / GrossFed;
			//double CompanyPayrollTaxes = FedTax + (2*SocSec )+ (2*Medicare);
			//double CompanyLiability = GrossFed + SocSec + Medicare;

			// If the income is not exempt, add the tax transactions
			if (!income.TaxExempt.FICA && SocSec != 0)
				income.Transactions.Add(NewTaxTransaction("Tax: SS", SocSec.ToMillicents(), income.Frequency, income.TargetAccount));
			if (!income.TaxExempt.FICA && Medicare != 0)
				income.Transactions.Add(NewTaxTransaction("Tax: Medicare", Medicare.ToMillicents(), income.Frequency, income.TargetAccount));
			if (!income.TaxExempt.Federal && FederalTax != 0)
				income.Transactions.Add(NewTaxTransaction("Tax: Federal", FederalTax.ToMillicents(), income.Frequency, income.TargetAccount));
			if (!income.TaxExempt.State && StateTax != 0)
				income.Transactions.Add(NewTaxTransaction("Tax: State", StateTax.ToMillicents(), income.Frequency, income.TargetAccount));
			if (!income.TaxExempt.Local && LocalTax != 0)
				income.Transactions.Add(NewTaxTransaction("Tax: Local", LocalTax.ToMillicents(), income.Frequency, income.TargetAccount));
		}
開發者ID:,項目名稱:,代碼行數:55,代碼來源:


注:本文中的System.Int64.ToDouble方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。