Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptPhieuMuon rpt = new rptPhieuMuon();

            rpt.Site = this.Site;
            return(rpt);
        }
 private void frmPhieuMuon_Load(object sender, EventArgs e)
 {
     this.rpt = frmMuonSach.rpt;
     documentViewer1.PrintingSystem = rpt.PrintingSystem;
     rpt.CreateDocument();
 }
Esempio n. 3
0
        private void btnLapPhieuMuon_Click(object sender, EventArgs e)
        {
            if ((txtMaDocGia.EditValue == null) || (txtMaDocGia.EditValue.ToString().Equals("")))
            {
                XtraMessageBox.Show("Bạn chưa chọn độc giả\r\nVui lòng chọn!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (dtSachMuon.Rows.Count == 0)
            {
                XtraMessageBox.Show("Bạn chưa sách để mượn\r\nVui lòng chọn!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            int  row_index = gvSachMuon.FocusedRowHandle;
            int  amount    = 0;
            bool check     = false;

            foreach (DataRow item in dtSachMuon.Rows)
            {
                string    sqlRB = "select amount from provided where id_provided = '" + item["id_provided"] + "'";
                DataTable dt    = new DataTable();
                dt = con.readData(sqlRB);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        amount = Convert.ToInt32(dr["amount"].ToString()) - 1;
                    }
                }
                string sqlU = "update provided set amount = '" + amount + "' where id_provided = '" + item["id_provided"] + "'";
                string sqlC = "insert into lendingbook values ('" + con.creatId("LB", sqlR) + "', '" + id + "', '" + item["id_provided"] + "', '" + txtMaDocGia.EditValue.ToString() + "', '" + Convert.ToDateTime(item["lendingdate"].ToString()).ToString("yyyy-MM-dd") + "', '" + Convert.ToDateTime(item["dateexpect"].ToString()).ToString("yyyy-MM-dd") + "', '" + Convert.ToInt32(item["deposit"].ToString()) + "')";
                if (con.exeData(sqlU) && con.exeData(sqlC))
                {
                    check = true;
                }
                else
                {
                    break;
                }
            }
            if (check)
            {
                XtraMessageBox.Show("Lập phiếu mượn thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (XtraMessageBox.Show("Bạn có muốn xuất phiếu mượn không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    creatDTPhieuMuon();
                    int tong = 0;
                    foreach (DataRow item in dtPhieuMuon.Rows)
                    {
                        tong += Convert.ToInt32(item["deposit"]);
                    }
                    rptPhieuMuon rp = new rptPhieuMuon();
                    rp.DataSource = dtPhieuMuon;
                    rp.initData(DateTime.Now.Day.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Year.ToString(), frmLogin.name_user, txtMaDocGia.EditValue.ToString(), txtHoTen.EditValue.ToString(), tong);
                    rpt = rp;
                    frmPhieuMuon frm = new frmPhieuMuon();
                    frm.Show();
                }
                btnLamMoi.PerformClick();
            }
            else
            {
                XtraMessageBox.Show("Lập phiếu mượn thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnLamMoi.PerformClick();
            }
        }