固定资产折旧

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
 
namespace WindowsFormsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double cost =Convert .ToDouble ( textBox1.Text)  ;
            double DepreciatedValue = Convert.ToDouble(textBox2.Text);
            double salvage = Convert.ToDouble(textBox6.Text);
            double life = Convert.ToDouble(textBox5.Text);
            double period = 1;
            double factor = 2;
            bool f   ;  //是否净值原值
            bool n;       //是否入账前使用
            double monthed = 0;
            double money = cost;
            double yuan=cost;
            double l = life;
            f = radioButton1.Checked;
            n = checkBox1.Checked;


         
            string i = comboBox1.Text;  
             double b=0;
             double r = 0;

             switch (i)
             {
                 case "双倍余额递减法":

                     if (n)
                     {
                         monthed = Convert.ToDouble(textBox7.Text);
                     }

                     if (f)
                     {
                         cost = cost - DepreciatedValue;
                         life = life - monthed;
                     }
                     else
                     {
                         period = period + monthed;
                     }

                     life = life / 12;
                     period = Math.Ceiling(period / 12);

                     if (life <= 2 || life - period < 2)
                     {
                         b = Microsoft.VisualBasic.Financial.SLN(cost, salvage, life) / 12.0;
                         r = b / (yuan) * 100;
                     }
                     else
                     {
                         b = Microsoft.VisualBasic.Financial.DDB(cost, salvage, life, period, factor) / 12.0;
                         r = Microsoft.VisualBasic.Financial.SLN(yuan, salvage, l/12) / 12.0 / (yuan) * 100 * 2;
                     }

                   
                     break;
                 case "平均年限法":
                     if (n)
                     {
                         monthed = Convert.ToDouble(textBox7.Text);
                     }

                     if (f)
                     {
                         cost = cost - DepreciatedValue;
                         life = life - monthed;
                     }
                     else
                     {
                         //life = life + monthed;
                         period = period + monthed;
                     }

                     life = life / 12;
                     period = Math.Ceiling(period / 12);


                     b = Microsoft.VisualBasic.Financial.SLN(cost, salvage, life)/12.0;
                     r = b / (yuan) * 100;
                     break;
                 case "工作量法":
                     b = Microsoft.VisualBasic.Financial.SLN(cost, salvage, life);
                     break;
                 case "年数总和法":
                     if (n)
                     {
                         monthed = Convert.ToDouble(textBox7.Text);
                     }

                     if (f)
                     {
                         cost = cost - DepreciatedValue;
                         life = life - monthed;
                     }
                     else
                     {
                         period = period + monthed;
                     }

                     life = life / 12;
                     period = Math.Ceiling(period / 12);

                     b = Microsoft.VisualBasic.Financial.SYD(cost, salvage, life, period)/12.0;

                     r = b /( yuan - salvage)*100;

                     break;

             }

             textBox9.Text = b.ToString("0.00");
             textBox8.Text = r.ToString("0.00");
        }
    }
}

猜你喜欢

转载自blog.csdn.net/mxbing1984/article/details/82345062