示例#1
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);
            }
        }
示例#2
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");
            }
        }