public ActionResult DeleteConfirmed(int id)
        {
            SalaryComponents salaryComponents = Service.Get(id);

            Service.RemoveByEntity(salaryComponents);
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "SalaryComponentsId,ComponentName,ComponentValue,Type")] SalaryComponents salaryComponents)
        {
            if (ModelState.IsValid)
            {
                Service.Insert(salaryComponents);
                return(RedirectToAction("Index"));
            }

            return(View(salaryComponents));
        }
Exemple #3
0
        /// <summary>
        /// Button Actully Helps to take Excl sheet and save the data in the db.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            //First Thing is We got the Path of the file. So What we can do is
            //Use that path we have to store all the people in our database.
            // All the salaries and stuff.


            //Logic for First Reading the Data.

            string    path      = @"C:\PayrollManagerofCTPL\Input Template\DataFile.xlsx";
            var       excelFile = new Microsoft.Office.Interop.Excel.Application();
            Workbook  workbook  = excelFile.Workbooks.Open(path);
            Worksheet worksheet = workbook.Worksheets[1];

            //for (int row = 1, col = 2; row <= 5; row++)
            //{
            //    MessageBox.Show(worksheet.Cells[row,col].Value.ToString());
            //}
            for (int col = 2; col <= 52; col++)
            {
                //for (int row = 1; row < 36; row++) // Actully Row will fetch the details so we have to have to put that in inner Loop.
                SalaryComponents salaryComponents = new SalaryComponents();


                salaryComponents.employeeID                            = (int)worksheet.Cells[col, 1].Value;
                salaryComponents.employeeName                          = worksheet.Cells[col, 2].Value;
                salaryComponents.basic_plus_DA1                        = (int)worksheet.Cells[col, 3].Value;
                salaryComponents.hra                                   = (int)worksheet.Cells[col, 4].Value;
                salaryComponents.conveyance1                           = (int)worksheet.Cells[col, 5].Value;
                salaryComponents.productionIncentive1                  = (int)worksheet.Cells[col, 6].Value;
                salaryComponents.food                                  = (int)worksheet.Cells[col, 7].Value;
                salaryComponents.allowance1                            = (int)worksheet.Cells[col, 8].Value;
                salaryComponents.allowance2                            = (int)worksheet.Cells[col, 9].Value;
                salaryComponents.cea                                   = (int)worksheet.Cells[col, 10].Value;
                salaryComponents.attendance_bonus                      = (int)worksheet.Cells[col, 11].Value;
                salaryComponents.bonus1                                = (int)worksheet.Cells[col, 12].Value;
                salaryComponents.commitment_allowance                  = (int)worksheet.Cells[col, 13].Value;
                salaryComponents.ot_hours                              = (int)worksheet.Cells[col, 14].Value;
                salaryComponents.allowance3_dailyrepory                = (int)worksheet.Cells[col, 15].Value;
                salaryComponents.grossSalary                           = (int)worksheet.Cells[col, 16].Value;
                salaryComponents.esi_debits                            = (int)worksheet.Cells[col, 17].Value;
                salaryComponents.pf_debits                             = (int)worksheet.Cells[col, 18].Value;
                salaryComponents.ptax_debits                           = (int)worksheet.Cells[col, 19].Value;
                salaryComponents.tds_debits                            = (int)worksheet.Cells[col, 20].Value;
                salaryComponents.totaldebits                           = (int)worksheet.Cells[col, 21].Value;
                salaryComponents.otherdebits                           = (int)worksheet.Cells[col, 22].Value;
                salaryComponents.net_salary                            = (int)worksheet.Cells[col, 23].Value;
                salaryComponents.earned_leave_credit                   = (int)worksheet.Cells[col, 24].Value;
                salaryComponents.takeHome                              = (int)worksheet.Cells[col, 25].Value;
                salaryComponents.severance_pakage                      = (int)worksheet.Cells[col, 26].Value;
                salaryComponents.esi_employer_credit                   = (int)worksheet.Cells[col, 27].Value;
                salaryComponents.pf_employer_credit                    = (int)worksheet.Cells[col, 28].Value;
                salaryComponents.mobile_phone_credit                   = (int)worksheet.Cells[col, 29].Value;
                salaryComponents.canteen_credit                        = (int)worksheet.Cells[col, 30].Value;
                salaryComponents.gratuity                              = (int)worksheet.Cells[col, 31].Value;
                salaryComponents.medical_insurance                     = (int)worksheet.Cells[col, 32].Value;
                salaryComponents.accidentql_insurance                  = (int)worksheet.Cells[col, 33].Value;
                salaryComponents.total_other_credits                   = (int)worksheet.Cells[col, 34].Value;
                salaryComponents.savings_salary                        = (int)worksheet.Cells[col, 35].Value;
                salaryComponents.ctc                                   = (int)worksheet.Cells[col, 36].Value;
                salaryComponents.numberofLeaves                        = (int)worksheet.Cells[col, 37].Value;
                salaryComponents.number_of_Available_Working_hours     = (int)worksheet.Cells[col, 38].Value;
                salaryComponents.number_of_availableWorkingDays        = (int)worksheet.Cells[col, 39].Value;
                salaryComponents.optforEsi                             = (int)worksheet.Cells[col, 40].Value;
                salaryComponents.optforpf                              = (int)worksheet.Cells[col, 41].Value;
                salaryComponents.overtimeRate                          = (int)worksheet.Cells[col, 42].Value;
                salaryComponents.allowance4                            = 0;
                salaryComponents.allowance6                            = 0;
                salaryComponents.allowance5_telephone                  = 0;
                salaryComponents.accrued_savings                       = 0;
                salaryComponents.accrued_deposite                      = 0;
                salaryComponents.number_of_days_worked                 = 0;
                salaryComponents.number_of_Hours_worked                = 0;
                salaryComponents.salary_package_allowance2_outrstation = 0;
                salaryComponents.salary_package_allowance3_dailyReport = 0;
                salaryComponents.salary_package_allowance4             = 0;
                salaryComponents.salary_package_allowance5             = 0;
                salaryComponents.salary_package_attendance_bonus       = 0;
                salaryComponents.numberofOutstationDays                = 0;
                salaryComponents.numberofdaysinDailyReport             = 0;
                salaryComponents.Bonus                                 = 0;
                salaryComponents.basicPlusDA_salary_package            = 0;
                salaryComponents.pf_debits2                            = 0;
                salaryComponents.allowance1_multiplicationFactor       = 0;
                salaryComponents.allowance4_multiplicationFactor       = 0;
                salaryComponents.allowance5_multiplicationFactor       = 0;
                salaryComponents.allowance6_multiplicationFactor       = 0;
                salaryComponents.ptax_debits2                          = 0;
                salaryComponents.pf_employer_credit2                   = 0;
                salaryComponents.production_incentive                  = 0;
                salaryComponents.early_attandance_bonus_salarypkg      = 0;
                salaryComponents.late_attendance_debitrate             = 0;
                salaryComponents.latebydays                            = 0;
                salaryComponents.early_attendance_bonus                = 0;
                salaryComponents.earned_leave_credit2                  = 0;
                Datalayer dl  = new Datalayer();
                Response  res = dl.saveSalaryComponentofEmployee(salaryComponents);
                if (res.success)
                {
                    MessageBox.Show("Salary Components saved in the Database");
                }
                else if (res.isException)
                {
                    MessageBox.Show("Exception occured : " + res.exception);
                }
            }



            if (!string.IsNullOrEmpty(txtpathofemployee.Text))
            {
                SalaryComponents salaryComponents = new SalaryComponents();
            }
            excelFile.Workbooks.Close();
        }
Exemple #4
0
        public void populatethedetailsofemployees()
        {
            Datalayer dl = new Datalayer();

            //First get the employee data from here and then you can see the data from there.
            Employee employee = new Employee();

            employee = GetSelectedEmployee();
            //MessageBox.Show(employee.employeeID.ToString());
            Response res = dl.getEmployeeSalaryDetails(GetSelectedEmployee());

            if (res.success)
            {
                SalaryComponents salaryComponents = new SalaryComponents();
                //Logic ??????
                salaryComponents            = (SalaryComponents)res.body;
                txtBasicplusDA.Text         = salaryComponents.basic_plus_DA1.ToString();
                txtBonus.Text               = salaryComponents.bonus1.ToString();
                txtConveyance.Text          = salaryComponents.conveyance1.ToString();
                txtProductionIncentive.Text = salaryComponents.productionIncentive1.ToString();
                txtFood.Text = salaryComponents.food.ToString();
                txtCompanyRevenueLtd.Text = salaryComponents.allowance1.ToString();
                txtdailyAllow.Text        = salaryComponents.allowance2.ToString();
                txtMobileAllowance.Text   = salaryComponents.allowance5_telephone.ToString();
                txtoutstationAllow.Text   = salaryComponents.allowance4.ToString();  //
                txtCEA.Text = salaryComponents.cea.ToString();
                txtCommitmentAllowance.Text = salaryComponents.commitment_allowance.ToString();
                txtAttendanceBonus.Text     = salaryComponents.attendance_bonus.ToString();
                txtGrossSalary.Text         = salaryComponents.grossSalary.ToString();
                txtEsiDebits.Text           = salaryComponents.esi_debits.ToString();
                txtPfDebits.Text            = salaryComponents.pf_debits.ToString();
                txtPtaxDebits.Text          = salaryComponents.ptax_debits.ToString();
                txtTDSDebits.Text           = salaryComponents.tds_debits.ToString();
                txtOtherDebits.Text         = salaryComponents.otherdebits.ToString();
                //txtlateattendance
                txtTotalDebits.Text          = salaryComponents.totaldebits.ToString();
                txtESIEmployerCredit.Text    = salaryComponents.esi_employer_credit.ToString();
                txtPFEmployerCredit.Text     = salaryComponents.pf_employer_credit.ToString();
                txtMobileCredit.Text         = salaryComponents.mobile_phone_credit.ToString();
                txtEarnedLeavecredit.Text    = salaryComponents.earned_leave_credit.ToString();
                txtGratuity.Text             = salaryComponents.gratuity.ToString();
                txtMedicalInsurance.Text     = salaryComponents.medical_insurance.ToString();
                txtAccidentInsurance.Text    = salaryComponents.accidentql_insurance.ToString();
                txtEarlyAttendanceBonus.Text = salaryComponents.early_attendance_bonus.ToString();
                txttotalOtherCredits.Text    = salaryComponents.total_other_credits.ToString();

                // txtdepos .Text = salaryComponents.accrued_deposite.ToString();
                // txtaccuredSavings.Text = salaryComponents.accrued_savings.ToString();
                // txtCurrentMonthAccredDeposit.Text = "0";
                // txtCurrentMonthAccruedSavings.Text = "0";
                txtSeverancePackage.Text = salaryComponents.severance_pakage.ToString();
                txtTakeHome.Text         = salaryComponents.takeHome.ToString();
                txtsavingsalary.Text     = salaryComponents.savings_salary.ToString();
                txtnetsalary.Text        = salaryComponents.net_salary.ToString();
                txtctc.Text = salaryComponents.ctc.ToString();
            }
            else if (res.isException)
            {
                MessageBox.Show("Exception while doing certain automation" + res.exception);
            }
        }
Exemple #5
0
        //This class will save the data in the database. So we have to write the logic so that we can do the calculations in the field and have to update them
        // as well when it trigger something like a + b then C will immediate have the value when we habe defined something like a+ b = c in the field of c.


        /// <summary>
        /// This is the method which will save all the data and call the datalayer to save the salary components into the database.
        /// </summary>
        /// <param name="sender"></param>
        ///
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Employee employee = new Employee();

            employee = GetSelectedEmployee();
            SalaryComponents salaryComponents = new SalaryComponents();

            salaryComponents.employeeID             = employee.employeeID;
            salaryComponents.basic_plus_DA1         = Int32.Parse(txtBasicplusDA.Text);
            salaryComponents.bonus1                 = Int32.Parse(txtBonus.Text);
            salaryComponents.hra                    = Int32.Parse(txtHRA.Text);
            salaryComponents.conveyance1            = Int32.Parse(txtConveyance.Text);
            salaryComponents.productionIncentive1   = Int32.Parse(txtProductionIncentive.Text);
            salaryComponents.food                   = Int32.Parse(txtFood.Text);
            salaryComponents.allowance1             = Int32.Parse(txtCompanyRevenueLtd.Text);
            salaryComponents.allowance2             = Int32.Parse(txtoutstationAllow.Text);
            salaryComponents.cea                    = Int32.Parse(txtCEA.Text);
            salaryComponents.ot_hours               = Int32.Parse(txtMinimumOtHours.Text);
            salaryComponents.commitment_allowance   = Int32.Parse(txtCommitmentAllowance.Text);
            salaryComponents.attendance_bonus       = Int32.Parse(txtAttendanceBonus.Text);
            salaryComponents.grossSalary            = Int32.Parse(txtGrossSalary.Text);
            salaryComponents.allowance3_dailyrepory = Int32.Parse(txtdailyAllow.Text);
            salaryComponents.allowance4             = Int32.Parse(txtMobileAllowance.Text);;
            salaryComponents.allowance5_telephone   = Int32.Parse(txtAllowance5.Text);
            salaryComponents.allowance6             = Int32.Parse(txtspecialallow.Text);
            salaryComponents.esi_debits             = Int32.Parse(txtEsiDebits.Text);
            salaryComponents.pf_debits              = Int32.Parse(txtPfDebits.Text);
            salaryComponents.ptax_debits            = Int32.Parse(txtPtaxDebits.Text);
            salaryComponents.tds_debits             = Int32.Parse(txtTDSDebits.Text);
            salaryComponents.otherdebits            = Int32.Parse(txtOtherDebits.Text);
            salaryComponents.totaldebits            = Int32.Parse(txtTotalDebits.Text);
            salaryComponents.esi_employer_credit    = Int32.Parse(txtESIEmployerCredit.Text);
            salaryComponents.pf_employer_credit     = Int32.Parse(txtPFEmployerCredit.Text);
            salaryComponents.mobile_phone_credit    = Int32.Parse(txtMobileCredit.Text);
            salaryComponents.canteen_credit         = Int32.Parse(txtCanteenCredit.Text);
            salaryComponents.earned_leave_credit    = Int32.Parse(txtEarnedLeavecredit.Text);
            salaryComponents.gratuity               = Int32.Parse(txtGratuity.Text);
            salaryComponents.medical_insurance      = Int32.Parse(txtMedicalInsurance.Text);
            salaryComponents.accidentql_insurance   = Int32.Parse(txtAccidentInsurance.Text);
            salaryComponents.total_other_credits    = Int32.Parse(txttotalOtherCredits.Text);
            salaryComponents.accrued_deposite       = 0;
            salaryComponents.accrued_savings        = 0;
            salaryComponents.severance_pakage       = Int32.Parse(txtSeverancePackage.Text);
            salaryComponents.takeHome               = Int32.Parse(txtTakeHome.Text);
            salaryComponents.savings_salary         = Int32.Parse(txtsavingsalary.Text);
            salaryComponents.net_salary             = Int32.Parse(txtnetsalary.Text);
            salaryComponents.ctc                    = Int32.Parse(txtctc.Text);
            if (checkoptforesi.IsChecked == true)
            {
                salaryComponents.optforEsi = 1;
            }
            else
            {
                salaryComponents.optforEsi           = 0;
                salaryComponents.esi_debits          = 0;
                salaryComponents.esi_employer_credit = 0;
            }
            if (checkoptforpf.IsChecked == true)
            {
                salaryComponents.optforpf = 1;
            }
            else
            {
                salaryComponents.optforpf            = 0;
                salaryComponents.pf_debits           = 0;
                salaryComponents.esi_employer_credit = 0;
            }

            salaryComponents.numberofLeaves = 0;
            salaryComponents.number_of_availableWorkingDays = 0;
            salaryComponents.number_of_days_worked          = 0;
            salaryComponents.number_of_Hours_worked         = 0;
            salaryComponents.overTime_inhours                      = 0;
            salaryComponents.salary_package_allowance1             = 0;
            salaryComponents.salary_package_allowance2_outrstation = 0;
            salaryComponents.salary_package_allowance3_dailyReport = 0;
            salaryComponents.salary_package_allowance4             = 0;
            salaryComponents.salary_package_allowance5             = 0;
            salaryComponents.salary_package_allowance6             = 0;
            salaryComponents.salary_package_attendance_bonus       = 0;
            salaryComponents.overtimeRate                    = Int32.Parse(txtOvertimeRate.Text);
            salaryComponents.numberofOutstationDays          = 0;
            salaryComponents.numberofdaysinDailyReport       = 0;
            salaryComponents.multriplicationFactor           = 1;
            salaryComponents.basicPlusDA_salary_package      = 0;
            salaryComponents.allowance1_multiplicationFactor = 0;
            salaryComponents.allowance4_multiplicationFactor = 0;
            salaryComponents.allowance5_multiplicationFactor = 0;
            salaryComponents.allowance6_multiplicationFactor = 0;
            salaryComponents.Bonus                            = 0;
            salaryComponents.pf_debits2                       = 0; //--------------------------------------???
            salaryComponents.ptax_debits2                     = 0;
            salaryComponents.pf_employer_credit2              = 0;
            salaryComponents.earned_leave_credit2             = 0;
            salaryComponents.gratuity2                        = 0;
            salaryComponents.conveyance2                      = 0;
            salaryComponents.production_incentive             = 0;
            salaryComponents.early_attandance_bonus_salarypkg = 0;
            salaryComponents.late_attendance_debitrate        = Int32.Parse(txtLateAttendanceDebitRate.Text);
            salaryComponents.latebydays                       = 0;
            salaryComponents.late_attendence_relaxation       = 0;
            salaryComponents.total_Late_Attendance_debit      = 0;
            salaryComponents.early_attendance_bonus           = Int32.Parse(txtEarlyAttendanceBonus.Text);
            salaryComponents.employeeName                     = employee.employeeName;

            Datalayer dl = new Datalayer();

            MessageBox.Show(salaryComponents.employeeID.ToString());
            Response res = dl.UpdateSalaryComponentsofEmployees(salaryComponents);

            if (res.success)
            {
                MessageBox.Show("Salary Components saved in the Database");
            }
            else if (res.isException)
            {
                MessageBox.Show("Exception occured : " + res.exception);
            }
        }
Exemple #6
0
        //Import the attendance from the excel file.
        private void Button_Click_7(object sender, RoutedEventArgs e)
        {
            if (!(cmbselectMonth.SelectedIndex == -1 && cmbselectyear.SelectedIndex == -1))
            {
                string filepath = "";
                //Attendance Logic
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Title            = "Excel File Dialog";
                dialog.InitialDirectory = @"c:\";
                dialog.Filter           = "Excel Files|*.xls;*.xlsx;*.xlsm";
                //dialog.IsFolderPicker = true;

                if (dialog.ShowDialog() == DialogResult)
                {
                    filepath = dialog.FileName;
                }
                MessageBox.Show(filepath);

                //At this moment we have the path of the excel file.
                var excelFile = new Microsoft.Office.Interop.Excel.Application();
                filepath = @"C:\Users\Vikas\Desktop\ChromeDownload\file.xlsx";
                Workbook  workbook  = excelFile.Workbooks.Open(filepath);
                Worksheet worksheet = workbook.Worksheets[1];
                for (int col = 9; col < 1319; col = col + 14)
                {
                    string value             = worksheet.Cells[col, 2].Value;
                    double totalWorkDuration = worksheet.Cells[col, 12].Value;
                    double present           = worksheet.Cells[col, 16].Value;
                    double absent            = worksheet.Cells[col, 19].Value;
                    double Latebydays        = worksheet.Cells[col, 23].Value;
                    // double earlygoingbydays = worksheet.Cells[col, 29];
                    // double LeavesTaken = worksheet.Cells[col, 32];

                    // MessageBox.Show(earlygoingbydays.ToString());

                    //Now at this point we have the Name of Employees
                    Datalayer dl  = new Datalayer();
                    Response  res = dl.getSalarycomponentsvianame(value);
                    //this will show that our query is fine and working
                    //and we have the data
                    if (res.success)
                    {
                        SalaryComponents salarycomponents = (SalaryComponents)res.body;
                        salarycomponents.number_of_Hours_worked = (int)totalWorkDuration;
                        salarycomponents.number_of_days_worked  = (int)present;
                        salarycomponents.numberofLeaves         = (int)absent;
                        salarycomponents.latebydays             = (int)Latebydays;
                        Datalayer dla      = new Datalayer();
                        Response  response = dla.UpdateSalaryComponentsofEmployees(salarycomponents);
                        if (response.success)
                        {
                            MessageBox.Show("Salary Components saved in the Database");
                        }
                        else if (response.isException)
                        {
                            MessageBox.Show("Exception occured : " + res.exception);
                        }
                    }
                    if (res.isException)
                    {
                        MessageBox.Show("This name is not in the database" + value);
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Select the Month and Year for the Attendance");
            }
        }
Exemple #7
0
        //Generate for all.
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //for this we have to take data from all the employees and then we have to

            if (cmbselectMonth.SelectedIndex > 0 && cmbselectyear.SelectedIndex > 0)
            {
                //First get all the employees.
                try
                {
                    Datalayer dl  = new Datalayer();
                    Response  res = dl.GetAllEmployeesID();
                    if (res.success)
                    {
                        List <Employee> employees = (List <Employee>)res.body;
                        for (int i = 0; i < employees.Count; i++)
                        {
                            //How we have the employee ID of all the employees so now let's start the game !

                            //we can fetch the salary components according to the employeeid
                            Datalayer dla      = new Datalayer();
                            Response  response = dla.getEmployeeSalaryDetailsbyID(employees[i].employeeID);
                            if (response.success)
                            {
                                SalaryComponents salaryComponents = new SalaryComponents();
                                salaryComponents = (SalaryComponents)response.body;
                                //salaryComponents = (SalaryComponents)res.body;
                                ////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/\/\/\/\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
                                var          Workbook  = new XLWorkbook("SALARYCOMPONENTS.xlsx");
                                IXLWorksheet worksheet = Workbook.Worksheet("Sal Temp");


                                worksheet.Cell("B1").Value  = salaryComponents.basic_plus_DA1;
                                worksheet.Cell("B3").Value  = salaryComponents.hra;
                                worksheet.Cell("B4").Value  = salaryComponents.conveyance1;
                                worksheet.Cell("B5").Value  = salaryComponents.productionIncentive1;
                                worksheet.Cell("B6").Value  = salaryComponents.food;
                                worksheet.Cell("B7").Value  = salaryComponents.allowance1;
                                worksheet.Cell("B8").Value  = salaryComponents.allowance2;
                                worksheet.Cell("B14").Value = salaryComponents.allowance3_dailyrepory;
                                worksheet.Cell("B15").Value = salaryComponents.allowance4;
                                worksheet.Cell("B16").Value = salaryComponents.allowance5_telephone;
                                worksheet.Cell("B17").Value = salaryComponents.allowance6;
                                worksheet.Cell("B9").Value  = salaryComponents.cea;
                                worksheet.Cell("F15").Value = salaryComponents.overtimeRate;
                                worksheet.Cell("F14").Value = salaryComponents.salary_package_attendance_bonus;
                                worksheet.Cell("F7").Value  = salaryComponents.ot_hours;
                                worksheet.Cell("D4").Value  = salaryComponents.tds_debits;
                                worksheet.Cell("D5").Value  = salaryComponents.otherdebits;
                                worksheet.Cell("I13").Value = salaryComponents.late_attendance_debitrate;
                                worksheet.Cell("D9").Value  = salaryComponents.mobile_phone_credit;
                                worksheet.Cell("D10").Value = salaryComponents.canteen_credit;
                                worksheet.Cell("D13").Value = salaryComponents.medical_insurance;
                                worksheet.Cell("D14").Value = salaryComponents.accidentql_insurance;
                                worksheet.Cell("I17").Value = salaryComponents.early_attendance_bonus;
                                worksheet.Cell("D18").Value = salaryComponents.severance_pakage;

                                if (salaryComponents.optforEsi == 1)
                                {
                                    worksheet.Cell("F1").Value = 1;
                                }
                                else
                                {
                                    worksheet.Cell("F1").Value = 0;
                                }
                                if (salaryComponents.optforpf == 1)
                                {
                                    worksheet.Cell("F2").Value = 1;
                                }
                                else
                                {
                                    worksheet.Cell("F2").Value = 0;
                                }



                                ////Display the data now
                                //txtBonus.Text = (worksheet.Cell("B2").Value).ToString();
                                //txtCommitmentAllowance.Text = (worksheet.Cell("B11").Value).ToString();
                                //txtGrossSalary.Text = (worksheet.Cell("B13").Value).ToString();

                                //txtPtaxDebits.Text = (worksheet.Cell("D3").Value).ToString();
                                //txtTotalDebits.Text = (worksheet.Cell("D6").Value).ToString();
                                //txtESIEmployerCredit.Text = (worksheet.Cell("D7").Value).ToString();
                                //txtPFEmployerCredit.Text = (worksheet.Cell("D8").Value).ToString();
                                //txtEarnedLeavecredit.Text = (worksheet.Cell("D11").Value).ToString();
                                //txtGratuity.Text = (worksheet.Cell("D12").Value).ToString();
                                //txttotalOtherCredits.Text = (worksheet.Cell("D15").Value).ToString();
                                //txtTakeHome.Text = (worksheet.Cell("D19").Value).ToString();
                                //txtsavingsalary.Text = (worksheet.Cell("D20").Value).ToString();
                                //txtnetsalary.Text = (worksheet.Cell("D21").Value).ToString();
                                //txtctc.Text = (worksheet.Cell("D22").Value).ToString();

                                //Now creating the particular Fields for the system

                                //Create the folder for the employee
                                string monthname   = getCurrentMonth();
                                string year        = getcurrentYear();
                                string nameofEMP   = salaryComponents.employeeName;
                                string pathfileabs = @"C:\PayrollManagerofCTPL\SalaryData\";
                                string path        = pathfileabs + nameofEMP + @"\" + year + @"\" + monthname;
                                if (!Directory.Exists(path))
                                {
                                    Directory.CreateDirectory(path);
                                    //Thread.Sleep(100);
                                }
                                string filename = monthname + "" + year;
                                string filepath = path + @"\" + filename + ".xlsx";
                                Workbook.SaveAs(filepath);
                                GenerateSalaryOfEmployee generateSalaryOfEmployee = new ClassLibrary.MainClasses.GenerateSalaryOfEmployee();
                                generateSalaryOfEmployee.employeeID     = salaryComponents.employeeID;
                                generateSalaryOfEmployee.nameofEmployee = salaryComponents.employeeName;
                                generateSalaryOfEmployee.monthName      = monthname;
                                generateSalaryOfEmployee.year           = year;
                                generateSalaryOfEmployee.pathFile       = filepath;

                                Datalayer datalayer = new Datalayer();
                                Response  response1 = dl.savegeneratesalaryinDB(generateSalaryOfEmployee);
                                if (response1.success)
                                {
                                }
                                else if (res.isException)
                                {
                                    MessageBox.Show("Error occured" + response1.exception);
                                }
                                //Workbook.SaveAs(@"C:\Users\Vikas\Desktop\Merci\file.xlsx");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception on the front Page" + ex);
                }
                MessageBox.Show("Generated For all");
            }
            else
            {
                MessageBox.Show("Choose Proper Month And Year In order to genearate the salary");
            }
        }