Exemplo n.º 1
0
        public void WritePaySlipInfo(string strCsvFileName, Employee e, EmployeeSalary es)
        {
            var csv     = new StringBuilder();
            var first   = "Name";
            var second  = "Pay Period";
            var third   = "Gross Income";
            var fourth  = "Income Tax";
            var fifth   = "Net Income";
            var sixth   = "Super";
            var newLine = "";

            //name, pay period,gross income, income tax, net income and super.
            newLine = string.Format("{0},{1},{2},{3},{4},{5}", first, second, third, fourth, fifth, sixth);
            csv.AppendLine(newLine);


            first   = e.firstName + " " + e.lastName;
            second  = es.payPeroid;
            third   = (es.grossIncome).ToString();
            fourth  = (es.incomeTax).ToString();
            fifth   = (es.netIncome).ToString();
            sixth   = (es.super).ToString();
            newLine = string.Format("{0},{1},{2},{3},{4},{5}", first, second, third, fourth, fifth, sixth);
            csv.AppendLine(newLine);

            File.WriteAllText(strCsvFileName, csv.ToString());
        }
Exemplo n.º 2
0
        public string GeneratePaySlipInfo(Employee e, EmployeeSalary es)
        {
            var first  = "Name";
            var second = "Pay Period";
            var third  = "Gross Income";
            var fourth = "Income Tax";
            var fifth  = "Net Income";
            var sixth  = "Super";

            es.payPeroid   = GetPayPeriod(es.paymentDate);
            es.grossIncome = GetGrossIncome(es.annualSalary);
            es.incomeTax   = GetTaxOnIncome(es.annualSalary);
            es.netIncome   = GetNetIncome(es.grossIncome, es.incomeTax);
            es.super       = GetSuper(es.grossIncome, es.superRate);

            first  = e.firstName + " " + e.lastName;
            second = es.payPeroid;
            third  = (es.grossIncome).ToString();
            fourth = (es.incomeTax).ToString();
            fifth  = (es.netIncome).ToString();
            sixth  = (es.super).ToString();
            return(string.Format("{0},{1},{2},{3},{4},{5}", first, second, third, fourth, fifth, sixth));
        }