private void btnSavePrint_Click(object sender, System.EventArgs e)
        {
            try
            {
                //if (CheckValidatePatient())
                //{
                //    BenhNhan bn = GetInfBenhNhan();
                //    qlND.InsertBenhNhan(bn);

                CTBenhNhan ctbn = GetInfCTBenhNhan();
                qlND.InsertCTBenhNhan(ctbn);

                List<CTBenhNhanComplaint> listComplaint = GetInfCTBenhNhanComplaint();

                List<CTBenhNhanConditionDicsJoint> listDiscJoint = GetInfCTBenhNhanConditionDicsJoint();

                CTBenhNhanCondition cTBenhNhanConditions = GetInfCTBenhNhanCondition();

                List<CTBenhNhanConditionVertebral> listCTBenhNhanConditionVertebral = GetInfCTBenhNhanConditionVertebral();

                List<CTBenhNhanExcercise> ListCTBenhNhanExcercises = GetInfCTBenhNhanExcercise();
                qlND.InsertListCTBenhNhanExcercise(ListCTBenhNhanExcercises);

                List<CTBenhNhanMRIImage> listCTBenhNhanMRIImage = GetInfCTBenhNhanMRIImage();

                List<CTBenhNhanSnapShot> listCTBenhNhanSnapShot = GetInfCTBenhNhanSnapShot();

                //PrintPatient(txtFileNumberPatient.Text, lblCTBenhNhan.Text);
                //Print
                rptPatientMedical rptAll = new rptPatientMedical();

                //rptAll.parThangNam.Value = string.Format("DANH SÁCH CUỘC GỌI TỪ KHÁCH HÀNG THÁNG {0}/{1}", thang, nam);
                //rptAll.parThangNam.Visible = false;

                //rptAll.DataSource = list;
                //BindToBand
                DetailReportBand cTBenhNhanComplaint = rptAll.Bands["DetailReport_Complant"] as DetailReportBand;
                if (listComplaint.Count > 0)
                {
                    cTBenhNhanComplaint.DataSource = listComplaint;
                }
                else
                {
                    cTBenhNhanComplaint.Visible = false;
                }

                DetailReportBand cTBenhNhanMRIImage = rptAll.Bands["DetailReport_MRI"] as DetailReportBand;
                if (listCTBenhNhanMRIImage.Count > 0)
                {
                    cTBenhNhanMRIImage.DataSource = listCTBenhNhanMRIImage;
                }
                else
                {
                    cTBenhNhanMRIImage.Visible = false;
                }

                DetailReportBand cTBenhNhanDicsJoint = rptAll.Bands["DetailReport_DiscAndJoint"] as DetailReportBand;
                if (listDiscJoint.Count > 0)
                {
                    cTBenhNhanDicsJoint.DataSource = listDiscJoint;
                }
                else
                {
                    cTBenhNhanDicsJoint.Visible = false;
                }

                //List<CTBenhNhanCondition> listCondition = qlND.GetDSCTBenhNhanConditionByIDCTBenhNhan(lblCTBenhNhan.Text);
                ////DetailReportBand cTBenhNhanAnkle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
                ////cTBenhNhanAnkle.DataSource = cTBenhNhanConditions;
                List<CTBenhNhanCondition> listCondition = new List<CTBenhNhanCondition>();
                listCondition.Add(cTBenhNhanConditions);

                DetailReportBand DetailReport_Ankle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
                if ((bool)listCondition[0].Ankle)
                {
                    DetailReport_Ankle.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Ankle.Visible = false;
                }

                DetailReportBand DetailReport_Elbow = rptAll.Bands["DetailReport_Elbow"] as DetailReportBand;
                if ((bool)listCondition[0].Elbow)
                {
                    DetailReport_Elbow.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Elbow.Visible = false;
                }

                DetailReportBand DetailReport_Foot = rptAll.Bands["DetailReport_Foot"] as DetailReportBand;
                if ((bool)listCondition[0].FootPlantar || (bool)listCondition[0].FootPronation || (bool)listCondition[0].FootSupination)
                {
                    DetailReport_Foot.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Foot.Visible = false;
                }

                DetailReportBand DetailReport_Hip = rptAll.Bands["DetailReport_Hip"] as DetailReportBand;
                if ((bool)listCondition[0].Hip)
                {
                    DetailReport_Hip.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Hip.Visible = false;
                }

                DetailReportBand DetailReport_Knee = rptAll.Bands["DetailReport_Knee"] as DetailReportBand;
                if ((bool)listCondition[0].KneeACL || (bool)listCondition[0].KneeDegeneration || (bool)listCondition[0].KneeMCL || (bool)listCondition[0].KneeMeniscus)
                {
                    DetailReport_Knee.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Knee.Visible = false;
                }

                DetailReportBand DetailReport_Posture = rptAll.Bands["DetailReport_Posture"] as DetailReportBand;
                if ((bool)listCondition[0].PostureHyperLordosis || (bool)listCondition[0].PostureKyphosis)
                {
                    DetailReport_Posture.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Posture.Visible = false;
                }

                DetailReportBand DetailReport_Sacroiliac = rptAll.Bands["DetailReport_Sacroiliac"] as DetailReportBand;
                if ((bool)listCondition[0].SacroiliacDegeneration || (bool)listCondition[0].SacroiliacInbalance || (bool)listCondition[0].SacroiliacInflammation || (bool)listCondition[0].SacroiliacNormail)
                {
                    DetailReport_Sacroiliac.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Sacroiliac.Visible = false;
                }

                DetailReportBand DetailReport_Scoliosis = rptAll.Bands["DetailReport_Scoliosis"] as DetailReportBand;
                if ((bool)listCondition[0].ScoliosisCervico || (bool)listCondition[0].ScoliosisCervival || (bool)listCondition[0].ScoliosisLumbar || (bool)listCondition[0].ScoliosisThoracic || (bool)listCondition[0].ScoliosisThoracolumbar)
                {
                    DetailReport_Scoliosis.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Scoliosis.Visible = false;
                }

                DetailReportBand DetailReport_Shoulder = rptAll.Bands["DetailReport_Shoulder"] as DetailReportBand;
                if ((bool)listCondition[0].ShoulderACJoint || (bool)listCondition[0].ShoulderAdhesive || (bool)listCondition[0].ShoulderBursitis || (bool)listCondition[0].ShoulderImpingement || (bool)listCondition[0].ShoulderRotator)
                {
                    DetailReport_Shoulder.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Shoulder.Visible = false;
                }

                DetailReportBand DetailReport_Wrist = rptAll.Bands["DetailReport_Wrist"] as DetailReportBand;
                if ((bool)listCondition[0].Wrist)
                {
                    DetailReport_Wrist.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Wrist.Visible = false;
                }

                DetailReportBand cTBenhNhanVertebral = rptAll.Bands["DetailReport_Vertebral"] as DetailReportBand;
                if (listCTBenhNhanConditionVertebral.Count > 0)
                {
                    cTBenhNhanVertebral.DataSource = listCTBenhNhanConditionVertebral;
                }
                else
                {
                    cTBenhNhanVertebral.Visible = false;
                }

                DetailReportBand cTBenhNhanSnap = rptAll.Bands["DetailReport_Snap"] as DetailReportBand;
                if (listCTBenhNhanSnapShot.Count > 0)
                {
                    cTBenhNhanSnap.DataSource = listCTBenhNhanSnapShot;
                }
                else
                {
                    cTBenhNhanSnap.Visible = false;
                }

                List<sp_GetDSExcerciseByIDCTBNResult> listEx2 = qlND.GetDSExcerciseByIDCTBN(lblCTBenhNhan.Text);
                DetailReportBand DetailReport_Excercises = rptAll.Bands["DetailReport_Excercises"] as DetailReportBand;
                if (listEx2.Count > 0)
                {
                    DetailReport_Excercises.DataSource = listEx2;
                }
                else
                {
                    DetailReport_Excercises.Visible = false;
                }

                if (ctbn.Comment.Trim().Length > 0)
                {
                    rptAll.parComment.Value = ctbn.Comment.ToString();
                    rptAll.parComment.Visible = false;
                }
                else
                {
                    DetailReportBand DetailReport_Comment = rptAll.Bands["DetailReport_Comment"] as DetailReportBand;
                    DetailReport_Comment.Visible = false;
                    rptAll.parComment.Value = ctbn.Comment.ToString();
                    rptAll.parComment.Visible = false;
                }

                string phone = ConfigurationManager.AppSettings["Phone"].ToString();
                string address = ConfigurationManager.AppSettings["Address"].ToString();
                rptAll.parPhone.Value = phone;
                rptAll.parPhone.Visible = false;
                rptAll.parDiaChi.Value = address;
                rptAll.parDiaChi.Visible = false;

                rptAll.parDate.Value = ctbn.NgayKham.ToString();
                rptAll.parDate.Visible = false;
                rptAll.parFileNumber.Value = txtFileNumberPatient.Text;
                rptAll.parFileNumber.Visible = false;
                rptAll.parName.Value = txtNamePatient.Text;
                rptAll.parName.Visible = false;
                rptAll.parTreamentFor.Value = ctbn.TreatmentTimeFor.ToString();
                rptAll.parTreamentFor.Visible = false;
                rptAll.parTreamentTime.Value = ctbn.TreatmentTime.ToString();
                rptAll.parTreamentTime.Visible = false;
                rptAll.parTreamentTotal.Value = ctbn.TreatmentTimeTotal.ToString();
                rptAll.parTreamentTotal.Visible = false;

                ReportPrintTool tool = new ReportPrintTool(rptAll);
                //tool.PreviewForm.Shown += new EventHandler(PreviewForm_Shown);
                tool.ShowPreviewDialog();
                //insert

                qlND.InsertListCTBenhNhanMRIImage(listCTBenhNhanMRIImage);
                qlND.InsertListCTBenhNhanSnapShot(listCTBenhNhanSnapShot);
                qlND.InsertListCTBenhNhanConditionVertebral(listCTBenhNhanConditionVertebral);
                qlND.InsertCTBenhNhanCondition(cTBenhNhanConditions);
                qlND.InsertListCTBenhNhanConditionDicsJoint(listDiscJoint);
                qlND.InsertListCTBenhNhanComplaint(listComplaint);
                //
                ClearDataWhenSaveDone();
                //}
            }
            catch (Exception)
            {
                MessageBox.Show("Save error");
            }
        }
Exemplo n.º 2
0
        private void btnSavePrint_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (CheckValidatePatient())
                {
                    BenhNhan bn = GetInfBenhNhan();
                    qlND.InsertBenhNhan(bn);

                    CTBenhNhan ctbn = GetInfCTBenhNhan();
                    qlND.InsertCTBenhNhan(ctbn);

                    List<CTBenhNhanComplaint> listComplaint = GetInfCTBenhNhanComplaint();
                    qlND.InsertListCTBenhNhanComplaint(listComplaint);

                    List<CTBenhNhanConditionDicsJoint> listDiscJoint = GetInfCTBenhNhanConditionDicsJoint();
                    qlND.InsertListCTBenhNhanConditionDicsJoint(listDiscJoint);

                    CTBenhNhanCondition cTBenhNhanConditions = GetInfCTBenhNhanCondition();
                    qlND.InsertCTBenhNhanCondition(cTBenhNhanConditions);

                    List<CTBenhNhanConditionVertebral> listCTBenhNhanConditionVertebral = GetInfCTBenhNhanConditionVertebral();
                    qlND.InsertListCTBenhNhanConditionVertebral(listCTBenhNhanConditionVertebral);

                    List<CTBenhNhanExcercise> ListCTBenhNhanExcercises = GetInfCTBenhNhanExcercise();
                    qlND.InsertListCTBenhNhanExcercise(ListCTBenhNhanExcercises);

                    List<CTBenhNhanMRIImage> listCTBenhNhanMRIImage = GetInfCTBenhNhanMRIImage();
                    qlND.InsertListCTBenhNhanMRIImage(listCTBenhNhanMRIImage);

                    List<CTBenhNhanSnapShot> listCTBenhNhanSnapShot = GetInfCTBenhNhanSnapShot();
                    qlND.InsertListCTBenhNhanSnapShot(listCTBenhNhanSnapShot);

                    //PrintPatient(txtFileNumberPatient.Text, lblCTBenhNhan.Text);
                    //Print
                    rptPatientMedical rptAll = new rptPatientMedical();

                    //rptAll.parThangNam.Value = string.Format("DANH SÁCH CUỘC GỌI TỪ KHÁCH HÀNG THÁNG {0}/{1}", thang, nam);
                    //rptAll.parThangNam.Visible = false;

                    //rptAll.DataSource = list;
                    //BindToBand
                    DetailReportBand cTBenhNhanComplaint = rptAll.Bands["DetailReport_Complant"] as DetailReportBand;
                    cTBenhNhanComplaint.DataSource = listComplaint;
                    DetailReportBand cTBenhNhanMRIImage = rptAll.Bands["DetailReport_MRI"] as DetailReportBand;
                    cTBenhNhanMRIImage.DataSource = listCTBenhNhanMRIImage;
                    DetailReportBand cTBenhNhanDicsJoint = rptAll.Bands["DetailReport_DiscAndJoint"] as DetailReportBand;
                    cTBenhNhanDicsJoint.DataSource = listDiscJoint;

                    //List<CTBenhNhanCondition> listCondition = qlND.GetDSCTBenhNhanConditionByIDCTBenhNhan(lblCTBenhNhan.Text);
                    ////DetailReportBand cTBenhNhanAnkle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
                    ////cTBenhNhanAnkle.DataSource = cTBenhNhanConditions;
                    List<CTBenhNhanCondition> listCondition = new List<CTBenhNhanCondition>();
                    listCondition.Add(cTBenhNhanConditions);
                    DetailReportBand DetailReport_Ankle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
                    DetailReport_Ankle.DataSource = listCondition;
                    DetailReportBand DetailReport_Elbow = rptAll.Bands["DetailReport_Elbow"] as DetailReportBand;
                    DetailReport_Elbow.DataSource = listCondition;
                    DetailReportBand DetailReport_Foot = rptAll.Bands["DetailReport_Foot"] as DetailReportBand;
                    DetailReport_Foot.DataSource = listCondition;
                    DetailReportBand DetailReport_Hip = rptAll.Bands["DetailReport_Hip"] as DetailReportBand;
                    DetailReport_Hip.DataSource = listCondition;
                    DetailReportBand DetailReport_Knee = rptAll.Bands["DetailReport_Knee"] as DetailReportBand;
                    DetailReport_Knee.DataSource = listCondition;
                    DetailReportBand DetailReport_Posture = rptAll.Bands["DetailReport_Posture"] as DetailReportBand;
                    DetailReport_Posture.DataSource = listCondition;
                    DetailReportBand DetailReport_Sacroiliac = rptAll.Bands["DetailReport_Sacroiliac"] as DetailReportBand;
                    DetailReport_Sacroiliac.DataSource = listCondition;
                    DetailReportBand DetailReport_Scoliosis = rptAll.Bands["DetailReport_Scoliosis"] as DetailReportBand;
                    DetailReport_Scoliosis.DataSource = listCondition;
                    DetailReportBand DetailReport_Shoulder = rptAll.Bands["DetailReport_Shoulder"] as DetailReportBand;
                    DetailReport_Shoulder.DataSource = listCondition;
                    DetailReportBand DetailReport_Wrist = rptAll.Bands["DetailReport_Wrist"] as DetailReportBand;
                    DetailReport_Wrist.DataSource = listCondition;

                    DetailReportBand cTBenhNhanVertebral = rptAll.Bands["DetailReport_Vertebral"] as DetailReportBand;
                    cTBenhNhanVertebral.DataSource = listCTBenhNhanConditionVertebral;
                    DetailReportBand cTBenhNhanSnap = rptAll.Bands["DetailReport_Snap"] as DetailReportBand;
                    cTBenhNhanSnap.DataSource = listCTBenhNhanSnapShot;

                    List<sp_GetDSExcerciseByIDCTBNResult> listEx2 = qlND.GetDSExcerciseByIDCTBN(lblCTBenhNhan.Text);
                    DetailReportBand DetailReport_Excercises = rptAll.Bands["DetailReport_Excercises"] as DetailReportBand;
                    DetailReport_Excercises.DataSource = listEx2;

                    rptAll.parComment.Value = ctbn.Comment.ToString();
                    rptAll.parComment.Visible = false;
                    rptAll.parDate.Value = ctbn.NgayKham.ToString();
                    rptAll.parDate.Visible = false;
                    rptAll.parFileNumber.Value = bn.ID.ToString();
                    rptAll.parFileNumber.Visible = false;
                    rptAll.parName.Value = bn.TenBN.ToString();
                    rptAll.parName.Visible = false;
                    rptAll.parTreamentFor.Value = ctbn.TreatmentTimeFor.ToString();
                    rptAll.parTreamentFor.Visible = false;
                    rptAll.parTreamentTime.Value = ctbn.TreatmentTime.ToString();
                    rptAll.parTreamentTime.Visible = false;
                    rptAll.parTreamentTotal.Value = ctbn.TreatmentTimeFor.ToString();
                    rptAll.parTreamentTotal.Visible = false;

                    ReportPrintTool tool = new ReportPrintTool(rptAll);
                    //tool.PreviewForm.Shown += new EventHandler(PreviewForm_Shown);
                    tool.ShowPreviewDialog();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Save error");
            }
        }
        public void PrintPatient(string IDBenhNhan, string IDCTBenhNhan)
        {
            //var rowHandle = gridView_CuocGoi.FocusedRowHandle;
            //// Get the value for the given column - convert to the type you're expecting
            //string IDBenhNhan = gridView_CuocGoi.GetRowCellValue(rowHandle, "IDBenhNhan").ToString();
            //string IDCTBenhNhan = gridView_CuocGoi.GetRowCellValue(rowHandle, "IDCTBenhNhan").ToString();
            //LoadList
            List<CTBenhNhanComplaint> listComplaint = qlND.GetDSCTBenhNhanComplaintByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanMRIImage> listMRIImage = qlND.GetDSCTBenhNhanMRIImageByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanCondition> listCondition = qlND.GetDSCTBenhNhanConditionByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanConditionDicsJoint> listConditionDicsJoint = qlND.GetDSCTBenhNhanConditionDicsJointByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanConditionVertebral> listConditionVertebral = qlND.GetDSCTBenhNhanConditionVertebralByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanExcercise> listExcercise = qlND.GetDSCTBenhNhanExcerciseByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanSnapShot> listSnapShot = qlND.GetDSCTBenhNhanSnapShotByIDCTBenhNhan(IDCTBenhNhan);
            CTBenhNhan cTBenhNhan = qlND.GetCTBenhNhanByIDCTBenhNhan(IDCTBenhNhan).SingleOrDefault();
            BenhNhan benhNhan = qlND.GetBenhNhanByID(IDBenhNhan);
            List<sp_GetDSExcerciseByIDCTBNResult> listEx = qlND.GetDSExcerciseByIDCTBN(IDCTBenhNhan);

            rptPatientMedical rptAll = new rptPatientMedical();

            //rptAll.parThangNam.Value = string.Format("DANH SÁCH CUỘC GỌI TỪ KHÁCH HÀNG THÁNG {0}/{1}", thang, nam);
            //rptAll.parThangNam.Visible = false;

            //rptAll.DataSource = list;
            //BindToBand
            DetailReportBand cTBenhNhanComplaint = rptAll.Bands["DetailReport_Complant"] as DetailReportBand;
            cTBenhNhanComplaint.DataSource = listComplaint;
            DetailReportBand cTBenhNhanMRIImage = rptAll.Bands["DetailReport_MRI"] as DetailReportBand;
            cTBenhNhanMRIImage.DataSource = listMRIImage;
            DetailReportBand cTBenhNhanDicsJoint = rptAll.Bands["DetailReport_DiscAndJoint"] as DetailReportBand;
            cTBenhNhanDicsJoint.DataSource = listConditionDicsJoint;

            DetailReportBand cTBenhNhanAnkle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
            cTBenhNhanAnkle.DataSource = listCondition;
            DetailReportBand DetailReport_Ankle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
            DetailReport_Ankle.DataSource = listCondition;
            DetailReportBand DetailReport_Elbow = rptAll.Bands["DetailReport_Elbow"] as DetailReportBand;
            DetailReport_Elbow.DataSource = listCondition;
            DetailReportBand DetailReport_Foot = rptAll.Bands["DetailReport_Foot"] as DetailReportBand;
            DetailReport_Foot.DataSource = listCondition;
            DetailReportBand DetailReport_Hip = rptAll.Bands["DetailReport_Hip"] as DetailReportBand;
            DetailReport_Hip.DataSource = listCondition;
            DetailReportBand DetailReport_Knee = rptAll.Bands["DetailReport_Knee"] as DetailReportBand;
            DetailReport_Knee.DataSource = listCondition;
            DetailReportBand DetailReport_Posture = rptAll.Bands["DetailReport_Posture"] as DetailReportBand;
            DetailReport_Posture.DataSource = listCondition;
            DetailReportBand DetailReport_Sacroiliac = rptAll.Bands["DetailReport_Sacroiliac"] as DetailReportBand;
            DetailReport_Sacroiliac.DataSource = listCondition;
            DetailReportBand DetailReport_Scoliosis = rptAll.Bands["DetailReport_Scoliosis"] as DetailReportBand;
            DetailReport_Scoliosis.DataSource = listCondition;
            DetailReportBand DetailReport_Shoulder = rptAll.Bands["DetailReport_Shoulder"] as DetailReportBand;
            DetailReport_Shoulder.DataSource = listCondition;
            DetailReportBand DetailReport_Wrist = rptAll.Bands["DetailReport_Wrist"] as DetailReportBand;
            DetailReport_Wrist.DataSource = listCondition;

            DetailReportBand cTBenhNhanVertebral = rptAll.Bands["DetailReport_Vertebral"] as DetailReportBand;
            cTBenhNhanVertebral.DataSource = listConditionVertebral;
            DetailReportBand cTBenhNhanSnap = rptAll.Bands["DetailReport_Snap"] as DetailReportBand;
            cTBenhNhanSnap.DataSource = listSnapShot;
            DetailReportBand DetailReport_Excercises = rptAll.Bands["DetailReport_Excercises"] as DetailReportBand;
            DetailReport_Excercises.DataSource = listEx;
            //DetailReportBand cTBenhNhanComment = rptAll.Bands["DetailReport_Comment"] as DetailReportBand;
            //cTBenhNhanComment.DataSource = cTBenhNhan.Comment;

            rptAll.parComment.Value = cTBenhNhan.Comment.ToString();
            rptAll.parComment.Visible = false;
            rptAll.parDate.Value = cTBenhNhan.NgayKham.ToString();
            rptAll.parDate.Visible = false;
            rptAll.parFileNumber.Value = benhNhan.ID.ToString();
            rptAll.parFileNumber.Visible = false;
            rptAll.parName.Value = benhNhan.TenBN.ToString();
            rptAll.parName.Visible = false;
            rptAll.parTreamentFor.Value = cTBenhNhan.TreatmentTimeFor.ToString();
            rptAll.parTreamentFor.Visible = false;
            rptAll.parTreamentTime.Value = cTBenhNhan.TreatmentTime.ToString();
            rptAll.parTreamentTime.Visible = false;
            rptAll.parTreamentTotal.Value = cTBenhNhan.TreatmentTimeFor.ToString();
            rptAll.parTreamentTotal.Visible = false;

            ReportPrintTool tool = new ReportPrintTool(rptAll);
            //tool.PreviewForm.Shown += new EventHandler(PreviewForm_Shown);
            tool.ShowPreviewDialog();
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var rowHandle = gridView_CuocGoi.FocusedRowHandle;
            // Get the value for the given column - convert to the type you're expecting
            string IDBenhNhan = gridView_CuocGoi.GetRowCellValue(rowHandle, "IDBenhNhan").ToString();
            string IDCTBenhNhan = gridView_CuocGoi.GetRowCellValue(rowHandle, "IDCTBenhNhan").ToString();
            //LoadList
            List<CTBenhNhanComplaint> listComplaint = qlND.GetDSCTBenhNhanComplaintByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanMRIImage> listMRIImage = qlND.GetDSCTBenhNhanMRIImageByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanCondition> listCondition = qlND.GetDSCTBenhNhanConditionByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanConditionDicsJoint> listConditionDicsJoint = qlND.GetDSCTBenhNhanConditionDicsJointByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanConditionVertebral> listConditionVertebral = qlND.GetDSCTBenhNhanConditionVertebralByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanExcercise> listExcercise = qlND.GetDSCTBenhNhanExcerciseByIDCTBenhNhan(IDCTBenhNhan);
            List<CTBenhNhanSnapShot> listSnapShot = qlND.GetDSCTBenhNhanSnapShotByIDCTBenhNhan(IDCTBenhNhan);
            CTBenhNhan cTBenhNhan = qlND.GetCTBenhNhanByIDCTBenhNhan(IDCTBenhNhan).SingleOrDefault();
            BenhNhan benhNhan = qlND.GetBenhNhanByID(IDBenhNhan);
            List<sp_GetDSExcerciseByIDCTBNResult> listEx = qlND.GetDSExcerciseByIDCTBN(IDCTBenhNhan);

            rptPatientMedical rptAll = new rptPatientMedical();

            //rptAll.parThangNam.Value = string.Format("DANH SÁCH CUỘC GỌI TỪ KHÁCH HÀNG THÁNG {0}/{1}", thang, nam);
            //rptAll.parThangNam.Visible = false;

            //rptAll.DataSource = list;
            //BindToBand
            DetailReportBand cTBenhNhanComplaint = rptAll.Bands["DetailReport_Complant"] as DetailReportBand;
            if (listComplaint.Count > 0)
            {
                cTBenhNhanComplaint.DataSource = listComplaint;
            }
            else
            {
                cTBenhNhanComplaint.Visible = false;
            }

            DetailReportBand cTBenhNhanMRIImage = rptAll.Bands["DetailReport_MRI"] as DetailReportBand;
            if (listMRIImage.Count > 0)
            {
                cTBenhNhanMRIImage.DataSource = listMRIImage;
            }
            else
            {
                cTBenhNhanMRIImage.Visible = false;
            }

            DetailReportBand cTBenhNhanDicsJoint = rptAll.Bands["DetailReport_DiscAndJoint"] as DetailReportBand;
            if (listConditionDicsJoint.Count > 0)
            {
                cTBenhNhanDicsJoint.DataSource = listConditionDicsJoint;
            }
            else
            {
                cTBenhNhanDicsJoint.Visible = false;
            }

            //List<CTBenhNhanCondition> listCondition = qlND.GetDSCTBenhNhanConditionByIDCTBenhNhan(lblCTBenhNhan.Text);
            ////DetailReportBand cTBenhNhanAnkle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
            ////cTBenhNhanAnkle.DataSource = cTBenhNhanConditions;
            //List<CTBenhNhanCondition> listCondition = new List<CTBenhNhanCondition>();
            //listCondition.Add(cTBenhNhanConditions);
            DetailReportBand DetailReport_Ankle = rptAll.Bands["DetailReport_Ankle"] as DetailReportBand;
            DetailReportBand DetailReport_Elbow = rptAll.Bands["DetailReport_Elbow"] as DetailReportBand;
            DetailReportBand DetailReport_Foot = rptAll.Bands["DetailReport_Foot"] as DetailReportBand;
            DetailReportBand DetailReport_Hip = rptAll.Bands["DetailReport_Hip"] as DetailReportBand;
            DetailReportBand DetailReport_Knee = rptAll.Bands["DetailReport_Knee"] as DetailReportBand;
            DetailReportBand DetailReport_Posture = rptAll.Bands["DetailReport_Posture"] as DetailReportBand;
            DetailReportBand DetailReport_Sacroiliac = rptAll.Bands["DetailReport_Sacroiliac"] as DetailReportBand;
            DetailReportBand DetailReport_Scoliosis = rptAll.Bands["DetailReport_Scoliosis"] as DetailReportBand;
            DetailReportBand DetailReport_Shoulder = rptAll.Bands["DetailReport_Shoulder"] as DetailReportBand;
            DetailReportBand DetailReport_Wrist = rptAll.Bands["DetailReport_Wrist"] as DetailReportBand;
            if (listCondition.Count > 0)
            {
                if ((bool)listCondition[0].Ankle)
                {
                    DetailReport_Ankle.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Ankle.Visible = false;
                }

                if ((bool)listCondition[0].Elbow)
                {
                    DetailReport_Elbow.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Elbow.Visible = false;
                }

                if ((bool)listCondition[0].FootPlantar || (bool)listCondition[0].FootPronation || (bool)listCondition[0].FootSupination)
                {
                    DetailReport_Foot.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Foot.Visible = false;
                }

                if ((bool)listCondition[0].Hip)
                {
                    DetailReport_Hip.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Hip.Visible = false;
                }

                if ((bool)listCondition[0].KneeACL || (bool)listCondition[0].KneeDegeneration || (bool)listCondition[0].KneeMCL || (bool)listCondition[0].KneeMeniscus)
                {
                    DetailReport_Knee.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Knee.Visible = false;
                }

                if ((bool)listCondition[0].PostureHyperLordosis || (bool)listCondition[0].PostureKyphosis)
                {
                    DetailReport_Posture.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Posture.Visible = false;
                }

                if ((bool)listCondition[0].SacroiliacDegeneration || (bool)listCondition[0].SacroiliacInbalance || (bool)listCondition[0].SacroiliacInflammation || (bool)listCondition[0].SacroiliacNormail)
                {
                    DetailReport_Sacroiliac.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Sacroiliac.Visible = false;
                }

                if ((bool)listCondition[0].ScoliosisCervico || (bool)listCondition[0].ScoliosisCervival || (bool)listCondition[0].ScoliosisLumbar || (bool)listCondition[0].ScoliosisThoracic || (bool)listCondition[0].ScoliosisThoracolumbar)
                {
                    DetailReport_Scoliosis.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Scoliosis.Visible = false;
                }

                if ((bool)listCondition[0].ShoulderACJoint || (bool)listCondition[0].ShoulderAdhesive || (bool)listCondition[0].ShoulderBursitis || (bool)listCondition[0].ShoulderImpingement || (bool)listCondition[0].ShoulderRotator)
                {
                    DetailReport_Shoulder.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Shoulder.Visible = false;
                }

                if ((bool)listCondition[0].Wrist)
                {
                    DetailReport_Wrist.DataSource = listCondition;
                }
                else
                {
                    DetailReport_Wrist.Visible = false;
                }
            }
            else
            {
                DetailReport_Ankle.Visible = false;
                DetailReport_Elbow.Visible = false;
                DetailReport_Foot.Visible = false;
                DetailReport_Hip.Visible = false;
                DetailReport_Knee.Visible = false;
                DetailReport_Posture.Visible = false;
                DetailReport_Sacroiliac.Visible = false;
                DetailReport_Scoliosis.Visible = false;
                DetailReport_Shoulder.Visible = false;
                DetailReport_Wrist.Visible = false;
            }
            DetailReportBand cTBenhNhanVertebral = rptAll.Bands["DetailReport_Vertebral"] as DetailReportBand;
            if (listConditionVertebral.Count > 0)
            {
                cTBenhNhanVertebral.DataSource = listConditionVertebral;
            }
            else
            {
                cTBenhNhanVertebral.Visible = false;
            }

            DetailReportBand cTBenhNhanSnap = rptAll.Bands["DetailReport_Snap"] as DetailReportBand;
            if (listSnapShot.Count > 0)
            {
                cTBenhNhanSnap.DataSource = listSnapShot;
            }
            else
            {
                cTBenhNhanSnap.Visible = false;
            }

            DetailReportBand DetailReport_Excercises = rptAll.Bands["DetailReport_Excercises"] as DetailReportBand;
            if (listEx.Count > 0)
            {
                DetailReport_Excercises.DataSource = listEx;
            }
            else
            {
                DetailReport_Excercises.Visible = false;
            }

            if (cTBenhNhan.Comment.Trim().Length > 0)
            {
                rptAll.parComment.Value = cTBenhNhan.Comment.ToString();
                rptAll.parComment.Visible = false;
            }
            else
            {
                DetailReportBand DetailReport_Comment = rptAll.Bands["DetailReport_Comment"] as DetailReportBand;
                DetailReport_Comment.Visible = false;
                rptAll.parComment.Value = cTBenhNhan.Comment.ToString();
                rptAll.parComment.Visible = false;
            }

            string phone = ConfigurationManager.AppSettings["Phone"].ToString();
            string address = ConfigurationManager.AppSettings["Address"].ToString();
            rptAll.parPhone.Value = phone;
            rptAll.parPhone.Visible = false;
            rptAll.parDiaChi.Value = address;
            rptAll.parDiaChi.Visible = false;

            rptAll.parComment.Value = cTBenhNhan.Comment.ToString();
            rptAll.parComment.Visible = false;
            rptAll.parDate.Value = cTBenhNhan.NgayKham.ToString();
            rptAll.parDate.Visible = false;
            rptAll.parFileNumber.Value = benhNhan.ID.ToString();
            rptAll.parFileNumber.Visible = false;
            rptAll.parName.Value = benhNhan.TenBN.ToString();
            rptAll.parName.Visible = false;
            rptAll.parTreamentFor.Value = cTBenhNhan.TreatmentTimeFor.ToString();
            rptAll.parTreamentFor.Visible = false;
            rptAll.parTreamentTime.Value = cTBenhNhan.TreatmentTime.ToString();
            rptAll.parTreamentTime.Visible = false;
            rptAll.parTreamentTotal.Value = cTBenhNhan.TreatmentTimeFor.ToString();
            rptAll.parTreamentTotal.Visible = false;

            ReportPrintTool tool = new ReportPrintTool(rptAll);
            //tool.PreviewForm.Shown += new EventHandler(PreviewForm_Shown);
            tool.ShowPreviewDialog();
        }