Example #1
0
 private void butLuu_Click(object sender, EventArgs e)
 {
     try
     {
         string angaykhoaso = m_v.f_ngaykhoaso(m_userid);
         string atmp        = f_Get_Sobienlai();
         if (atmp.Split(':')[1] == "1")//Hết số
         {
             MessageBox.Show(this, "Hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             cbLoai.Focus();
             return;
         }
         if (s_loaidv == "" || s_quyenso == "")
         {
             MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             cbLoai.Focus();
             return;
         }
         atmp = f_Get_Sobienlai_dichvu();
         if (s_quyenso_dichvu == "" && ((v_loai == "0" && bTT_Tachhoadon) ||
                                        (v_loai == "1" && bTTRV_Tachhoadon) || (v_loai == "2" && bBHYT_Tachhoadon) || (v_loai == "2" && bBhyt_dichvu)))
         {
             MessageBox.Show(this, "Chọn quyển sổ dịch vụ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             cbLoai.Focus();
             return;
         }
         if (v_loai == "1")
         {
             atmp = f_Get_Sobienlai_thatthu();
             if (atmp.Split(':')[1] == "1")//Hết số
             {
                 MessageBox.Show(this, "Quyển số thất thu hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbLoai.Focus();
                 return;
             }
             if (s_loaidv == "" || (s_quyenso_thatthu == "" && bTtrv_thatthu))
             {
                 MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbLoai.Focus();
                 return;
             }
             //----------------------------------------------
             atmp = f_Get_Sobienlai_thua();
             if (atmp.Split(':')[1] == "1")//Hết số
             {
                 MessageBox.Show(this, "Quyển số thừa hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbLoai.Focus();
                 return;
             }
             if (s_loaidv == "" || (s_quyenso_thua == "" && bTtrv_thatthu))
             {
                 MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbLoai.Focus();
                 return;
             }
             atmp = f_Get_Sobienlai_dichvu();
             if (atmp.Split(':')[1] == "1")//Hết số
             {
                 MessageBox.Show(this, "Quyển số thừa hết sổ, đề nghị chọn sổ mới!", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 dichvu.Focus();
                 return;
             }
             if (s_loaidv == "" || (s_quyenso_dichvu == "" && (bTtrv_dichvu || bTt_gtgt)))
             {
                 MessageBox.Show(this, "Chọn quyển sổ cần thu rồi nhấn nút chọn", m_v.s_AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbLoai.Focus();
                 return;
             }
         }
         if (angaykhoaso != "xx/xx/xxxx" && angaykhoaso.Trim() != "")
         {
             if (m_v.f_parse_date(angaykhoaso) >= txtNgaythu.Value)
             {
                 MessageBox.Show(this, lan.Change_language_MessageText("Ngày làm việc phải > ") + angaykhoaso, lan.Change_language_MessageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 txtNgaythu.Focus();
                 return;
             }
             else
             {
                 this.DialogResult = DialogResult.OK;
                 System.GC.Collect();
                 this.Close();
             }
         }
         else
         {
             this.DialogResult = DialogResult.OK;
             System.GC.Collect();
             this.Close();
         }
         f_capnhat_db(m_v.mmyy(txtNgaythu.Text.Substring(0, 10)));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }