private void paycode_Load(object sender, EventArgs e)
 {
     obj = new mycontrol_paycode(this);
     ps  = new payslip();
     this.label1.Text                  = "System";
     this.label2.Text                  = "HRM";
     this.label3.Text                  = "Attendance";
     this.label4.Text                  = "Terminal";
     this.label5.Text                  = "Reports";
     this.label6.Text                  = "Wide Dimension";
     this.label7.Text                  = "Emp ID";
     this.label8.Text                  = "First Name";
     this.label9.Text                  = "Last Name";
     this.label10.Text                 = "Department";
     this.label11.Text                 = "CNIC";
     this.label12.Text                 = "Present";
     this.label13.Text                 = "Absent";
     this.label14.Text                 = "Basic Salary";
     this.label15.Text                 = "Bonus";
     this.label30.Text                 = "Increment";
     this.label31.Text                 = "Decrement";
     this.label16.Text                 = "Company";
     this.label17.Text                 = "Employee";
     this.label18.Text                 = "Paycode";
     this.label19.Text                 = "Rule";
     this.label20.Text                 = "Timetable";
     this.label21.Text                 = "Shift";
     this.label22.Text                 = "Schedule";
     this.label23.Text                 = "Exception Assign";
     this.label24.Text                 = "Device Management";
     this.label25.Text                 = "Zone";
     this.label26.Text                 = "Data Sync";
     this.label27.Text                 = "Records";
     this.label28.Text                 = "Calculate";
     this.label29.Text                 = "Report";
     this.label32.Text                 = "Salary of Month";
     this.button1.Text                 = "X";
     this.button2.Text                 = "-";
     this.blueButton1.Text             = "Generate Pay Slip";
     this.dateTimePicker1.Format       = DateTimePickerFormat.Custom;
     this.pictureBox16.BackgroundImage = Properties.Resources.paycodeactive_logo;
     obj.hrm_menu();
 }
Пример #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            payslip pay;
            int     id1;

            if (!Int32.TryParse(txtid.Text, out id1))


            {
                pay = new payslip();
                context.payslips.Add(pay);
            }
            else
            {
                pay = context.payslips.FirstOrDefault(p => p.payslipId == id1);
                if (pay == null)
                {
                    this.init();
                    return;
                }
            }
            pay.basic = double.Parse(txtbasic.Text);
            pay.ca    = double.Parse(txtca.Text);
            pay.ha    = double.Parse(txtha.Text);
            double a, d;

            if (double.TryParse(txtaddition.Text, out a))
            {
                pay.addition = a;
            }
            else
            {
                pay.addition = 0;
            }
            if (double.TryParse(txtDeduction.Text, out d))
            {
                pay.deduction = d;
            }
            else
            {
                pay.deduction = 0;
            }

            if (rbyes.Checked)
            {
                pay.genarate = "Yes";
                gnrt         = "Yes";
            }
            if (rbno.Checked)
            {
                pay.genarate = "No";
                gnrt         = "No";
            }
            id2             = Int32.Parse(lvlid.Text);
            pay.salId       = id2;
            pay.payslipDate = Convert.ToDateTime(dtpDate.Text);
            context.SaveChanges();
            //this.loadDetails(txtsrch.Text);
            double total = pay.ha + pay.ca + pay.basic + pay.addition - pay.deduction;

            txttotal.Text = total.ToString();



            string[] date = dtpDate.Text.Split('/');

            string ab = date[0];
            string b  = date[2];

            if (ab == "1")
            {
                ab = "01";
            }
            if (ab == "2")
            {
                ab = "02";
            }
            if (ab == "3")
            {
                ab = "03";
            }
            if (ab == "4")
            {
                ab = "04";
            }
            if (ab == "5")
            {
                ab = "05";
            }
            if (ab == "6")
            {
                ab = "06";
            }
            if (ab == "7")
            {
                ab = "07";
            }
            if (ab == "8")
            {
                ab = "08";
            }
            if (ab == "9")
            {
                ab = "09";
            }


            var payrl = context.payrolls.FirstOrDefault(p => p.month == ab && p.year == b);

            if (payrl != null)
            {
                if (gnrt == "Yes")
                {
                    payrl.total += total;
                    //context.payrolls.(payrl);
                    context.SaveChanges();
                    MetroFramework.MetroMessageBox.Show(this, "Payslip Genaretaed", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
            }
            this.loadDetails(txtsrch.Text);
        }