Beispiel #1
0
        protected void DropLoaiPhieu_SelectedIndexChanged(object sender, EventArgs e)
        {
            string loai         = DropLoaiPhieu.SelectedValue.ToString();
            string tenloaiphieu = DropLoaiPhieu.SelectedIndex.ToString();

            Session["loaiphieu"] = loai;
            if (loai == "PDN2")
            {
                divPhieuMuaHang.Visible = true;
                divPhieuDeNghi.Visible  = false;
                btnLuuTam.Enabled       = false;
                btnTiepTu.Enabled       = false;
                SuppliesDAO.SearchAjax(txtdonvitinh.Text);
            }
            else
            {
                divPhieuMuaHang.Visible = false;
                divPhieuDeNghi.Visible  = true;
                btnLuuTam.Visible       = true;
                btnTiepTu.Visible       = true;
            }
            lbthongbao.Visible = false;
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string loaiphieu = DropLoaiPhieu.SelectedValue.ToString();

            if (loaiphieu != "PDN2")
            {
                DateTime  date    = DateTime.Today;
                dalPDN    dal     = new dalPDN();
                DataTable dt      = dal.DemSoLuongPhieu();
                string    aa      = dt.Rows[0]["pdno"].ToString().Trim();
                string    maphieu = "";
                if (dt.Rows.Count != 0 && aa != "")
                {
                    string dem = (int.Parse(aa) + 1).ToString();
                    maphieu = dem;
                }
                else
                {
                    maphieu = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyyMM") + "00" + 1;
                }
                string bophan = DropDonVi.SelectedItem.Value.ToString();

                string tieude     = txtTieuDe.Text;
                string noidung    = CKEditorControl1.Text;
                string bp         = DropDonVi.SelectedItem.Text;
                string loaiP      = DropLoaiPhieu.SelectedItem.Text;
                string congty     = Session["congty"].ToString();
                string user       = Session["user"].ToString();
                string ngaythang  = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("yyyy/MM/dd");
                string ngaythang1 = DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("Ngày " + "dd" + "Tháng " + "MM" + "Năm" + "yyyy");
                //string idphieu = Session["maphieu"].ToString();



                Busers2 us = UserBUS.TimMaNhanVienTheoBoPhan(user, bophan, congty);
                if (us == null)
                {
                    lbthongbao.Text = "Người dùng này không nằm trong bộ phận " + bp;
                }
                else
                {
                    pdna phieun = new pdna();
                    {
                        phieun.pdno = maphieu;

                        phieun.GSBH       = congty;
                        phieun.pdno       = maphieu;
                        phieun.Abtype     = loaiphieu;
                        phieun.pddepid    = bophan;
                        phieun.mytitle    = tieude;
                        phieun.pdmemovn   = noidung;
                        phieun.CFMDate0   = DateTime.Today;
                        phieun.CFMID0     = user;
                        phieun.YN         = 5;
                        phieun.USERID     = user;
                        phieun.dagui      = false;
                        phieun.bixoa      = false;
                        phieun.LevelDoing = 0;
                        phieun.ABC        = 1;
                    }
                    pdnaBUS.InsertPDNA(phieun);

                    Session["loaiP"]     = loaiP;
                    Session["loaiphieu"] = loaiphieu;
                    Session["maphieu"]   = maphieu;
                    Session["bp"]        = bophan;
                    Session["bophan"]    = bp;
                    Session["noidung"]   = noidung;
                    Session["ngaytao"]   = ngaythang;
                    Session["tieude"]    = tieude;
                    Response.Redirect("FrmView.aspx");
                }
                SuppliesDAO.SearchAjax(txtdonvitinh.Text);
            }
            else
            {
                Response.Redirect("FrmView.aspx");
            }

            Session.Remove("ktmaphieu");
            Session.Remove("CGNO");
            Session.Remove("ZSBH");
            Session.Remove("themhang");
        }