Ejemplo n.º 1
0
        public static string UpdateKho(string id, string maKho, string tenKho, string diaChi, string sodienthoai, string nguoiphutrach, string kichHoat, string ghiChu, string thuocTongKho, string loaiKho)
        {
            try
            {
                int    thuoctongkho_temp = 0;
                Guid   currentUserID     = Guid.NewGuid();
                string currentUser       = "";
                #region Get current User
                MembershipUser membershipUser = Membership.GetUser(HttpContext.Current.User.Identity.Name);
                if (membershipUser != null)
                {
                    currentUser   = membershipUser.UserName;
                    currentUserID = (Guid)membershipUser.ProviderUserKey;
                }
                #endregion get current User
                xRPDataContext dataContext = new xRPDataContext();
                Qlvt_KhoVatTu  qlvt        = new Qlvt_KhoVatTu();
                int?           idd         = int.Parse(id) == 0 || int.Parse(id) == -1 ? (int?)null : int.Parse(id);

                if (int.Parse(id) == -1)
                {
                    dataContext.Sp_Qlvt_KhoVatTu_Add_Edit_Deli("ADD", 0, maKho, tenKho, thuoctongkho_temp, bool.Parse(loaiKho), diaChi, sodienthoai, nguoiphutrach, ghiChu, int.Parse(kichHoat), currentUserID, currentUserID, ref idd, Util.GetIP(), Util.GetPCName());
                }
                if (int.Parse(id) > 0)
                {
                    dataContext.Sp_Qlvt_KhoVatTu_Add_Edit_Deli("EDIT", int.Parse(id), maKho, tenKho, thuoctongkho_temp, bool.Parse(loaiKho), diaChi, sodienthoai, nguoiphutrach, ghiChu, int.Parse(kichHoat), currentUserID, currentUserID, ref idd, Util.GetIP(), Util.GetPCName());
                }
            }
            catch (Exception)
            {
                return("ERROR");
            }
            return("SUCCESS");
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            xRPDataContext getalldmkho2 = new xRPDataContext();

            //List<Qlvt_KhoVatTu> lst = (from ds in getalldmkho2.Qlvt_KhoVatTu_GetAll()
            //                           select new Qlvt_KhoVatTu
            //                           {
            //                               ID = ds.ID,
            //                               MaHieuKho = ds.MaHieuKho,
            //                               TenKhoVatTu = ds.TenKhoVatTu
            //                           }).ToList();
            //dropThuocTongKho.DataSource = lst;
            //dropThuocTongKho.DataTextField = "TenKhoVatTu";
            //dropThuocTongKho.DataValueField = "ID";
            //dropThuocTongKho.DataBind();
            //dropThuocTongKho.Items.Insert(0, new ListItem("Tất cả", "0"));
            if (Attributes["param"] != null)
            {
                string URL = Attributes["param"];
                ID_Kho = Util.GetParam(URL, "id");
                trang  = Util.GetParam(URL, "trang");

                if (ID_Kho != "" && ID_Kho != "-1")
                {
                    int id = int.Parse(ID_Kho);

                    Qlvt_KhoVatTu qlkho = (from c2 in getalldmkho2.Qlvt_KhoVatTus where c2.ID == id select c2).FirstOrDefault();
                    txtMaKho.Text  = qlkho.MaHieuKho;
                    txtTenKho.Text = qlkho.TenKhoVatTu;
                    dropThuocTongKho.SelectedValue = qlkho.MaKhoCapTren.Value.ToString();
                    txtDiaChi.Text        = qlkho.DiaChi;
                    txtSoDienThoai.Text   = qlkho.SoDienThoai;
                    txtNguoiPhuTrach.Text = qlkho.NguoiPhuTrach;
                    if (qlkho.KichHoat.Value == true)
                    {
                        ckKichHoat.Checked = true;
                    }
                    else
                    {
                        ckKichHoat.Checked = false;
                    }
                    if (qlkho.LoaiKho.Value == true)
                    {
                        rdlLoaiKho.SelectedValue = "1";
                    }
                    else
                    {
                        rdlLoaiKho.SelectedValue = "0";
                    }
                    txtGhiChu.Text = qlkho.GhiChu;
                }
            }
        }
Ejemplo n.º 3
0
        protected void BindData(int id)
        {
            xRPDataContext dts             = new xRPDataContext();
            var            sysconfig       = dts.Sys_ThongSoHeThongs;
            string         tenCongTy       = (from t in sysconfig where t.ThongSo == "TenCongTy" select t.GiaTri).FirstOrDefault();
            string         diaChiCongTy    = (from t in sysconfig where t.ThongSo == "DiaChiCongTy" select t.GiaTri).FirstOrDefault();
            string         dienThoaiCongTy = (from t in sysconfig where t.ThongSo == "DienThoaiLienHe" select t.GiaTri).FirstOrDefault();

            lblTenCongTy.Text       = tenCongTy;
            lblDiaChiCongTy.Text    = "Địa chỉ: " + diaChiCongTy;
            lblDienThoaiCongTy.Text = "Số ĐT: " + dienThoaiCongTy;
            string ngayhomnay = new Sys_ThongSoHeThongRepository().GetThongSoHeThong("DiaPhuong", "Hà Nội") + ", ngày" + " " + DateTime.Now.Day.ToString() + " " + "tháng" + " " + DateTime.Now.Month.ToString() + " " + "năm" + " " + DateTime.Now.Year.ToString();

            lblNgayIn.Text               = ngayhomnay;
            this.currentPhieuNhap        = dts.Qlvt_PhieuNhaps.Where(x => x.ID == id).FirstOrDefault();
            this.currentKhoVatTu         = dts.Qlvt_KhoVatTus.Where(x => x.ID == currentPhieuNhap.MaKhoVatTu).FirstOrDefault();
            lblMaPhieuNhap.Text          = "Mã phiếu nhập kho: " + currentPhieuNhap.MaHieuPhieuNhap;
            lblNhapTaiKho.Text           = "Kho nhập: " + currentKhoVatTu.TenKhoVatTu;
            lblNgayNhapKho.Text          = "Ngày nhập kho: " + currentPhieuNhap.NgayNhap.Value.ToString("dd/MM/yyyy");
            lblNoiDung.Text              = "Nội dung:" + currentPhieuNhap.GhiChu;
            lblNhaCungCap.Text           = "Nhà cung cấp: " + currentPhieuNhap.Qlvt_NhaCungCap.TenNhaCungCap;
            objectDataSource1.DataSource = dts.sp_Baocao_PhieuNhapVatTu(id);
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    ID = Request.QueryString["id"].ToString();
                    string type = Request.QueryString["type"];
                    if (string.IsNullOrWhiteSpace(type) || type != "2")
                    {
                        type = "1";
                    }

                    xRPDataContext   dts  = new xRPDataContext();
                    DataTable        dt   = GetData(int.Parse(Request.QueryString["id"].ToString()));
                    var              data = dts.sp_Baocao_PhieuNhapVatTu(int.Parse(ID));
                    ReportDataSource rpt  = new ReportDataSource("dtsPhieuNhap", data);
                    rpViewer.LocalReport.DataSources.Clear();
                    rpViewer.LocalReport.DataSources.Add(rpt);
                    rpViewer.LocalReport.ReportPath = type == "1" ? "Report/QuanLyVatTu/NhapVatTu/ReportNhapKho.rdlc" : "Report/QuanLyVatTu/NhapVatTu/ReportNhapKhoNCC.rdlc";
                    rpViewer.LocalReport.Refresh();


                    this.currentPhieuNhap = (from t in dts.Qlvt_PhieuNhaps where t.ID == int.Parse(Request.QueryString["id"].ToString()) select t).FirstOrDefault();
                    this.currentKhoVatTu  = (from ds in dts.Qlvt_KhoVatTus where ds.ID == currentPhieuNhap.MaKhoVatTu select ds).FirstOrDefault();

                    string tencongty = "", diachi = "", sodienthoai = "";
                    var    listthongsoht = (from ds in dts.Sys_ThongSoHeThongs select ds).ToList();
                    foreach (var item in listthongsoht)
                    {
                        if (item.ThongSo == "TenCongTy")
                        {
                            tencongty = item.GiaTri;
                        }
                        if (item.ThongSo == "DiaChiCongTy")
                        {
                            diachi = item.GiaTri;
                        }
                        if (item.ThongSo == "DienThoaiLienHe")
                        {
                            sodienthoai = item.GiaTri;
                        }
                    }

                    //Lấy thông tin nhà cung cấp
                    var nhacungcap = (from ds in dts.Qlvt_NhaCungCaps where ds.ID == currentPhieuNhap.MaNhaCungCap select ds).FirstOrDefault();

                    ReportParameter[] p = new ReportParameter[12];
                    p[0] = new ReportParameter("maphieunhap", currentPhieuNhap.MaHieuPhieuNhap);
                    p[1] = new ReportParameter("nhaptaikho", currentKhoVatTu.TenKhoVatTu);
                    p[2] = new ReportParameter("tencongty", tencongty);
                    p[3] = new ReportParameter("diachi", diachi.ToUpper());
                    p[4] = new ReportParameter("sodienthoai", sodienthoai);
                    p[5] = new ReportParameter("ngayin", new Sys_ThongSoHeThongRepository().GetThongSoHeThong("DiaPhuong", "Hà Nội") + ", ngày" + " " + DateTime.Now.Day.ToString() + " " + "tháng" + " " + DateTime.Now.Month.ToString() + " " + "năm" + " " + DateTime.Now.Year.ToString());

                    double x = 0, y = 0, z = 0, k = 0;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(dt.Rows[i][3].ToString()))
                        {
                            x = x + double.Parse(dt.Rows[i][3].ToString());
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[i][5].ToString()))
                        {
                            y = y + double.Parse(dt.Rows[i][5].ToString());
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[i][4].ToString()))
                        {
                            z = z + double.Parse(dt.Rows[i][4].ToString());
                        }
                        if (!string.IsNullOrEmpty(dt.Rows[i][7].ToString()))
                        {
                            k = k + double.Parse(dt.Rows[i][7].ToString());
                        }
                    }
                    p[7]  = new ReportParameter("tongdltt", x.ToString());
                    p[8]  = new ReportParameter("tongtruloi", y.ToString());
                    p[9]  = new ReportParameter("tongtruthuakho", z.ToString());
                    p[10] = new ReportParameter("tongthucnhap", k.ToString());
                    p[11] = new ReportParameter("tien", Util.ReadMoney(k.ToString()));
                    p[6]  = new ReportParameter("ngaynhapkho", currentPhieuNhap.NgayNhap.ToString());
                    rpViewer.LocalReport.SetParameters(p);
                    if (currentPhieuNhap.TinhTrang != 2)
                    {
                        ltAccept.Text = "<li class=\"menu-item icon-only\"><a id=\"btnAccept\" class=\"menu-bar-item-button icon accept-icon\" href=\"javascript:duyetPhieuNhap('" + currentPhieuNhap.ID + "');\"></a></li>";
                    }
                }
            }
        }