private void btn_upd_Click(object sender, EventArgs e) { int r = 0; String code = ""; isnew = false; if (dgv_list.Rows.Count > 1) { try { r = dgv_list.CurrentRow.Index; cbo_employee.SelectedValue = dgv_list["dgvl_empno", r].Value.ToString(); code = dgv_list["dgvl_code", r].Value.ToString(); txt_code.Text = code; txt_desc.Text = dgv_list["dgvl_description", r].Value.ToString(); cbo_contraacct.SelectedValue = dgv_list["dgvl_trn_type", r].Value.ToString(); cbo_stocklocation.Text = dgv_list["dgvl_location", r].Value.ToString(); cbo_costcenter.Text = dgv_list["dgvl_ccname", r].Value.ToString(); cbo_scc.Text = dgv_list["dgvl_sub_costcenter", r].Value.ToString(); dtp_deduction.Value = gm.toDateValue(dgv_list["dgvl_deduction_date", r].Value.ToString()); dtp_trnxdt.Value = gm.toDateValue(dgv_list["dgvl_trnxdate", r].Value.ToString()); txt_amnt_loan.Text = gm.toNormalDoubleFormat(dgv_list["dgvl_loan_amount", r].Value.ToString()).ToString("0.00"); txt_deduction.Text = gm.toNormalDoubleFormat(dgv_list["dgvl_deduction_amount", r].Value.ToString()).ToString("0.00"); } catch { } //disp_itemlist(code); //total_amountdue(); goto_tbcntrl_info(); //goto_win2(); } }
private void btn_upditem_Click(object sender, EventArgs e) { isnew = false; txt_code.Enabled = false; int r = -1; try { r = dgv_list.CurrentRow.Index; String code = dgv_list["dgvl_code", r].Value.ToString(); if (dgv_list.Rows.Count > 1 && !String.IsNullOrEmpty(code)) { try { txt_code.Text = code; txt_month.Text = dgv_list["dgvl_month", r].Value.ToString(); txt_sbr.Text = dgv_list["dgvl_sbr", r].Value.ToString(); txt_pbr.Text = dgv_list["dgvl_pbr", r].Value.ToString(); txt_pr.Text = dgv_list["dgvl_pr", r].Value.ToString(); dtp_sbr_date.Value = gm.toDateValue(dgv_list["dgvl_sbr_date", r].Value.ToString()); dtp_pbr_date.Value = gm.toDateValue(dgv_list["dgvl_pbr_date", r].Value.ToString()); dtp_pr_date.Value = gm.toDateValue(dgv_list["dgvl_pr_date", r].Value.ToString()); } catch (Exception er) { } goto_win2(); } else { MessageBox.Show("No remittance unit selected."); } } catch { MessageBox.Show("No remittance unit selected."); } }
private void display_employee(String code) { DataTable dt = db.QueryBySQLCode("SELECT distinct emp.*,civil.*,day.*,dept.*,section.*,emp_status.*,pos.*,wtax.*,rate_type.* FROM rssys.hr_employee emp LEFT JOIN rssys.hr_civil_status civil ON civil.code = emp.civil_status LEFT JOIN rssys.hr_days day ON day.day = emp.dayoff1 LEFT JOIN rssys.hr_department dept ON dept.deptid = emp.department LEFT JOIN rssys.hr_depsection section ON section.secid = emp.section LEFT JOIN rssys.hr_emp_status emp_status ON emp_status.statcode = emp.empstatus LEFT JOIN rssys.hr_position pos ON pos.postid = emp.positions LEFT JOIN rssys.hr_rate_type rate_type ON rate_type.ratecode = emp.rate_type LEFT JOIN rssys.hr_wtax wtax ON wtax.code = emp.tax_bracket WHERE emp.empid ='" + code + "' LIMIT 1"); if (dt.Rows.Count > 0) { frm_clear(); txt_code.Text = dt.Rows[0]["empid"].ToString(); txt_firstname.Text = dt.Rows[0]["firstname"].ToString(); txt_lastname.Text = dt.Rows[0]["lastname"].ToString(); txt_mi.Text = dt.Rows[0]["mi"].ToString(); cbo_department.SelectedValue = dt.Rows[0]["department"].ToString(); gc.load_section(cbo_section, cbo_department.SelectedValue.ToString()); cbo_section.SelectedValue = dt.Rows[0]["section"].ToString(); cbo_position.SelectedValue = dt.Rows[0]["positions"].ToString(); dtp_hired.Value = gm.toDateValue(dt.Rows[0]["date_hired"].ToString()); if (!String.IsNullOrEmpty(dt.Rows[0]["date_resigned"].ToString()) && DateTime.Parse(dt.Rows[0]["date_resigned"].ToString()).ToString("yyyy-MM-dd") != "1900-01-01") { chk_resigned.Checked = true; dtp_resigned.Value = gm.toDateValue(dt.Rows[0]["date_resigned"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[0]["date_terminated"].ToString()) && DateTime.Parse(dt.Rows[0]["date_terminated"].ToString()).ToString("yyyy-MM-dd") != "1900-01-01") { chk_terminated.Checked = true; dtp_terminated.Value = gm.toDateValue(dt.Rows[0]["date_terminated"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[0]["contractual_date"].ToString()) && DateTime.Parse(dt.Rows[0]["contractual_date"].ToString()).ToString("yyyy-MM-dd") != "1900-01-01") { chk_contractual.Checked = true; dtp_contractual.Value = gm.toDateValue(dt.Rows[0]["contractual_date"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[0]["prohibition_date"].ToString()) && DateTime.Parse(dt.Rows[0]["prohibition_date"].ToString()).ToString("yyyy-MM-dd") != "1900-01-01") { chk_probition.Checked = true; dtp_probitioned.Value = gm.toDateValue(dt.Rows[0]["prohibition_date"].ToString()); } if (!String.IsNullOrEmpty(dt.Rows[0]["date_regular"].ToString()) && DateTime.Parse(dt.Rows[0]["date_regular"].ToString()).ToString("yyyy-MM-dd") != "1900-01-01") { chk_regular.Checked = true; dtp_regularized.Value = gm.toDateValue(dt.Rows[0]["date_regular"].ToString()); } cbo_status.SelectedValue = dt.Rows[0]["empstatus"].ToString(); txt_contract_days.Text = dt.Rows[0]["contract_days"].ToString(); txt_prc_number.Text = dt.Rows[0]["prc"].ToString(); txt_ctc_num.Text = dt.Rows[0]["ctc"].ToString(); cbo_rate_type.SelectedValue = dt.Rows[0]["rate_type"].ToString(); txt_pay_rate.Text = dt.Rows[0]["pay_rate"].ToString(); txt_biometric.Text = dt.Rows[0]["biometric"].ToString(); txt_sss_num.Text = dt.Rows[0]["sss"].ToString(); txt_pagibig.Text = dt.Rows[0]["pagibig"].ToString(); txt_philhealth.Text = dt.Rows[0]["philhealth"].ToString(); cbo_sss.SelectedValue = dt.Rows[0]["sss_bracket"].ToString(); cbo_pagibig.SelectedValue = dt.Rows[0]["pagibig_bracket"].ToString(); cbo_philhealth.SelectedValue = dt.Rows[0]["philhealth_bracket"].ToString(); txt_payroll_act.Text = dt.Rows[0]["payroll_account"].ToString(); txt_tin.Text = dt.Rows[0]["tin"].ToString(); cbo_tax_bracket.SelectedValue = dt.Rows[0]["tax_bracket"].ToString(); txt_primary.Text = dt.Rows[0]["primary_ed"].ToString(); txt_secondary.Text = dt.Rows[0]["secondary_ed"].ToString(); txt_graduate.Text = dt.Rows[0]["graduate"].ToString(); txt_post_graduate.Text = dt.Rows[0]["post_graduate"].ToString(); txt_tertiary.Text = dt.Rows[0]["tertiary_ed"].ToString(); prev_pay_rate = txt_pay_rate.Text; prev_rate_type = cbo_rate_type.SelectedValue.ToString(); if (dt.Rows[0]["fixed_rate"].ToString() == "1") { chk_fixed_rate.Checked = true; } //date_shift_sched_from.Value = Convert.ToDateTime(DateTime.Now.ToString("M/d/yyyy") + " " + dt.Rows[0]["shift_sched_from"].ToString()); //date_shift_sched_to.Value = Convert.ToDateTime(DateTime.Now.ToString("M/d/yyyy") + " " + dt.Rows[0]["shift_sched_to"].ToString()); //date_sift_sched_sat_from.Value = Convert.ToDateTime(DateTime.Now.ToString("M/d/yyyy") + " " + dt.Rows[0]["shift_sched_sat_from"].ToString()); //date_sift_sched_sat_to.Value = Convert.ToDateTime(DateTime.Now.ToString("M/d/yyyy") + " " + dt.Rows[0]["shift_sched_sat_to"].ToString()); cbo_shiftsched.SelectedValue = dt.Rows[0]["shift_sched"].ToString(); cbo_shiftsched_sat.SelectedValue = dt.Rows[0]["shift_sched_sat"].ToString(); cbo_dayoff1.SelectedValue = dt.Rows[0]["dayoff1"].ToString(); cbo_dayoff2.SelectedValue = dt.Rows[0]["dayoff2"].ToString(); cbo_gender.SelectedItem = dt.Rows[0]["sex"].ToString(); date_birth.Value = gm.toDateValue(dt.Rows[0]["birth"].ToString()); cbo_civil_stat.SelectedValue = dt.Rows[0]["civil_status"].ToString(); txt_religion.Text = dt.Rows[0]["religion"].ToString(); txt_height.Text = dt.Rows[0]["height"].ToString(); txt_weight.Text = dt.Rows[0]["weight"].ToString(); txt_father.Text = dt.Rows[0]["father"].ToString(); txt_father_address.Text = dt.Rows[0]["father_address"].ToString(); txt_father_contact.Text = dt.Rows[0]["father_contact"].ToString(); txt_father_occupation.Text = dt.Rows[0]["father_job"].ToString(); txt_mother.Text = dt.Rows[0]["mother"].ToString(); txt_mother_address.Text = dt.Rows[0]["mother_address"].ToString(); txt_mother_contact.Text = dt.Rows[0]["mother_contact"].ToString(); txt_mother_occupation.Text = dt.Rows[0]["mother_job"].ToString(); txt_contact_no.Text = dt.Rows[0]["emp_contact"].ToString(); txt_home_tel.Text = dt.Rows[0]["home_tel"].ToString(); txt_email.Text = dt.Rows[0]["email"].ToString(); txt_home_address.Text = dt.Rows[0]["home_address"].ToString(); txt_ctc_name.Text = dt.Rows[0]["emergency_name"].ToString(); txt_ctc_no.Text = dt.Rows[0]["emergency_contact"].ToString(); txt_home_add.Text = dt.Rows[0]["em_home_address"].ToString(); txt_relation.Text = dt.Rows[0]["relationship"].ToString(); } }