private Treatment Fill(DataSet ds)
        {
            Treatment treatobj = new Treatment();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    treatobj.patientid   = Convert.ToInt32(ds.Tables[0].Rows[0]["patientid"].ToString());
                    treatobj.hid         = Convert.ToInt32(ds.Tables[0].Rows[0]["hid"].ToString());
                    treatobj.treatmentid = Convert.ToInt32(ds.Tables[0].Rows[0]["treatmentid"].ToString());

                    treatobj.followup_dt   = ds.Tables[0].Rows[0]["followup_dt"].ToString();
                    treatobj.checkfollowup = ds.Tables[0].Rows[0]["isFollowup"].ToString();

                    treatobj.xray_dt = ds.Tables[0].Rows[0]["xray_dt"].ToString();
                    treatobj.xray    = ds.Tables[0].Rows[0]["isXRay"].ToString();

                    treatobj.bloodtest_dt = ds.Tables[0].Rows[0]["bloodtest_dt"].ToString();
                    treatobj.bloodtest    = ds.Tables[0].Rows[0]["isBloodTest"].ToString();

                    treatobj.occupation = ds.Tables[0].Rows[0]["occupation"].ToString();
                    treatobj.dfname     = ds.Tables[0].Rows[0]["dfname"].ToString();
                    treatobj.dlname     = ds.Tables[0].Rows[0]["dlname"].ToString();
                }

                if (ds.Tables[1].Rows.Count > 0)
                {
                    List <TreatmentMedicine> TM = new List <TreatmentMedicine>();
                    for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                    {
                        TreatmentMedicine t = new TreatmentMedicine();
                        t.m          = ds.Tables[1].Rows[i]["m"].ToString();
                        t.a          = ds.Tables[1].Rows[i]["a"].ToString();
                        t.e          = ds.Tables[1].Rows[i]["e"].ToString();
                        t.n          = ds.Tables[1].Rows[i]["n"].ToString();
                        t.mischecked = ds.Tables[1].Rows[i]["m"].ToString() == "" ? false : true;
                        t.aischecked = ds.Tables[1].Rows[i]["a"].ToString() == "" ? false : true;
                        t.eischecked = ds.Tables[1].Rows[i]["e"].ToString() == "" ? false : true;
                        t.nischecked = ds.Tables[1].Rows[i]["n"].ToString() == "" ? false : true;
                        t.medicineid = Convert.ToInt32(ds.Tables[1].Rows[i]["medicineid"].ToString());
                        t.particular = ds.Tables[1].Rows[i]["particular"].ToString();
                        t.qty        = Convert.ToInt32(ds.Tables[1].Rows[i]["quantity"].ToString() == "" ? "0" : ds.Tables[1].Rows[i]["quantity"].ToString());
                        TM.Add(t);
                    }
                    treatobj.TreatMedicineList = TM;
                    HttpContext.Current.Session["TreatmentMedicine"] = TM;
                }
                if (ds.Tables[2].Rows.Count > 0)
                {
                    int             i  = 0;
                    TreatmentVision tv = new TreatmentVision();
                    tv.right_vn          = ds.Tables[2].Rows[i]["right_vn"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_vn"].ToString();
                    tv.right_dist_sph    = ds.Tables[2].Rows[i]["right_dist_sph"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_dist_sph"].ToString();
                    tv.right_dist_cyl    = ds.Tables[2].Rows[i]["right_dist_cyl"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_dist_cyl"].ToString();
                    tv.right_dist_axis   = ds.Tables[2].Rows[i]["right_dist_axis"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_dist_axis"].ToString();
                    tv.right_near_sph    = ds.Tables[2].Rows[i]["right_near_sph"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_near_sph"].ToString();
                    tv.right_near_cyl    = ds.Tables[2].Rows[i]["right_near_cyl"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_near_cyl"].ToString();
                    tv.right_near_axis   = ds.Tables[2].Rows[i]["right_near_axis"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["right_near_axis"].ToString();
                    tv.left_vn           = ds.Tables[2].Rows[i]["left_vn"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_vn"].ToString();
                    tv.left_dist_sph     = ds.Tables[2].Rows[i]["left_dist_sph"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_dist_sph"].ToString();
                    tv.left_dist_cyl     = ds.Tables[2].Rows[i]["left_dist_cyl"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_dist_cyl"].ToString();
                    tv.left_dist_axis    = ds.Tables[2].Rows[i]["left_dist_axis"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_dist_axis"].ToString();
                    tv.left_near_sph     = ds.Tables[2].Rows[i]["left_near_sph"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_near_sph"].ToString();
                    tv.left_near_cyl     = ds.Tables[2].Rows[i]["left_near_cyl"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_near_cyl"].ToString();
                    tv.left_near_axis    = ds.Tables[2].Rows[i]["left_near_axis"].ToString() == "" ? "0" : ds.Tables[2].Rows[i]["left_near_axis"].ToString();
                    treatobj.TreatVision = tv;
                }
                if (ds.Tables[3].Rows.Count > 0)
                {
                    TreatmentInvestigation        t  = new TreatmentInvestigation();
                    List <TreatmentInvestigation> ti = new List <TreatmentInvestigation>();
                    ti = t.GetList();

                    for (int i = 0; i < ds.Tables[3].Rows.Count; i++)
                    {
                        ti.Where(w => w.invName == ds.Tables[3].Rows[i]["diseasename"].ToString()).ToList().ForEach(s => s.isChecked = true);
                    }
                    HttpContext.Current.Session["TreatInvestigationList"] = treatobj.TreatInvestigationList = ti;
                }
                else
                {
                    TreatmentInvestigation        t  = new TreatmentInvestigation();
                    List <TreatmentInvestigation> ti = new List <TreatmentInvestigation>();
                    ti = t.GetList();
                    treatobj.TreatInvestigationList = ti;
                }


                if (ds.Tables[4].Rows.Count > 0)
                {
                    List <TreatmentFundus> TF = new List <TreatmentFundus>();
                    for (int i = 0; i < ds.Tables[4].Rows.Count; i++)
                    {
                        TreatmentFundus tfun = new TreatmentFundus();
                        tfun.fundusid   = Convert.ToInt32(ds.Tables[4].Rows[i]["fundusid"]);
                        tfun.fundusname = ds.Tables[4].Rows[i]["fundusname"].ToString();
                        TF.Add(tfun);
                    }
                    treatobj.TreatFundusList = TF;
                    HttpContext.Current.Session["TreatmentFundus"] = TF;
                }

                if (ds.Tables[5].Rows.Count > 0)
                {
                    List <TreatmentComplents> TC = new List <TreatmentComplents>();
                    for (int i = 0; i < ds.Tables[5].Rows.Count; i++)
                    {
                        TreatmentComplents t = new TreatmentComplents();
                        t.complentid   = Convert.ToInt32(ds.Tables[5].Rows[i]["complentsid"].ToString());
                        t.complentname = ds.Tables[5].Rows[i]["complentsname"].ToString();
                        TC.Add(t);
                    }
                    treatobj.TreatComplentsList = TC;
                    HttpContext.Current.Session["TreatmentComplents"] = TC;
                }

                if (ds.Tables[6].Rows.Count > 0)
                {
                    List <TreatmentDiagnosis> TD = new List <TreatmentDiagnosis>();
                    for (int i = 0; i < ds.Tables[6].Rows.Count; i++)
                    {
                        TreatmentDiagnosis t = new TreatmentDiagnosis();
                        t.diagnosisid   = Convert.ToInt32(ds.Tables[6].Rows[i]["diagnosisid"]);
                        t.diagnosisname = ds.Tables[6].Rows[i]["disgnosisname"].ToString();
                        TD.Add(t);
                    }
                    treatobj.TreatDiagnosisList = TD;
                    HttpContext.Current.Session["TreatmentDiagnosis"] = TD;
                }

                if (ds.Tables[7].Rows.Count > 0)
                {
                    List <TreatmentCheckups> TCH = new List <TreatmentCheckups>();
                    for (int i = 0; i < ds.Tables[7].Rows.Count; i++)
                    {
                        TreatmentCheckups t = new TreatmentCheckups();
                        t.checkupid   = Convert.ToInt32(ds.Tables[7].Rows[i]["checkupid"]);
                        t.checkupname = ds.Tables[7].Rows[i]["checkupname"].ToString();
                        TCH.Add(t);
                    }
                    treatobj.TreatCheckupList = TCH;
                    HttpContext.Current.Session["TreatmentCheckups"] = TCH;
                }

                if (ds.Tables[8].Rows.Count > 0)
                {
                    List <TreatmentHistory> TH = new List <TreatmentHistory>();
                    for (int i = 0; i < ds.Tables[8].Rows.Count; i++)
                    {
                        TreatmentHistory t = new TreatmentHistory();
                        t.historyid   = Convert.ToInt32(ds.Tables[8].Rows[i]["historyid"]);
                        t.historyname = ds.Tables[8].Rows[i]["historyname"].ToString();
                        t.from_dt     = ds.Tables[8].Rows[i]["from_dt"].ToString();
                        t.to_dt       = ds.Tables[8].Rows[i]["to_dt"].ToString();
                        TH.Add(t);
                    }
                    treatobj.TreatHistoryList = TH;
                    HttpContext.Current.Session["TreatmentHistory"] = TH;
                }

                if (ds.Tables[9].Rows.Count > 0)
                {
                    List <TreatmentAdvice> TA = new List <TreatmentAdvice>();
                    for (int i = 0; i < ds.Tables[9].Rows.Count; i++)
                    {
                        TreatmentAdvice t = new TreatmentAdvice();
                        t.adviceid   = Convert.ToInt32(ds.Tables[9].Rows[i]["adviceid"]);
                        t.advicename = ds.Tables[9].Rows[i]["advicename"].ToString();
                        TA.Add(t);
                    }
                    treatobj.TreatAdviceList = TA;
                    HttpContext.Current.Session["TreatmentAdvice"] = TA;
                }

                if (ds.Tables[10].Rows.Count > 0)
                {
                    TreatmentTnVn tn = new TreatmentTnVn();
                    tn.tn_re_clg       = ds.Tables[10].Rows[0]["tn_re_clg"].ToString();
                    tn.tn_le_clg       = ds.Tables[10].Rows[0]["tn_le_clg"].ToString();
                    tn.vn_re_clg       = ds.Tables[10].Rows[0]["vn_re_clg"].ToString();
                    tn.vn_le_clg       = ds.Tables[10].Rows[0]["vn_le_clg"].ToString();
                    tn.tn_re_clg_t     = ds.Tables[10].Rows[0]["tn_re_clg_t"].ToString();
                    tn.tn_le_clg_t     = ds.Tables[10].Rows[0]["tn_le_clg_t"].ToString();
                    tn.vn_re_clg_v     = ds.Tables[10].Rows[0]["vn_re_clg_v"].ToString();
                    tn.vn_le_clg_v     = ds.Tables[10].Rows[0]["vn_le_clg_v"].ToString();
                    tn.tn_re_cph       = ds.Tables[10].Rows[0]["tn_re_cph"].ToString();
                    tn.tn_le_cph       = ds.Tables[10].Rows[0]["tn_le_cph"].ToString();
                    tn.vn_re_cph       = ds.Tables[10].Rows[0]["vn_re_cph"].ToString();
                    tn.vn_le_cph       = ds.Tables[10].Rows[0]["vn_le_cph"].ToString();
                    treatobj.TreatTnVn = tn;
                }
            }
            return(treatobj);
        }
Beispiel #2
0
        public static string GenerateTreatmentPDF()
        {
            string HospitalName = "Kamla Eye Clinic";
            //Get Treatment Details
            Treatment obj = new Treatment();

            obj.CMD         = "View1";
            obj.treatmentid = Convert.ToInt32(HttpContext.Current.Session["treatmentid"]);
            obj.patientid   = Convert.ToInt32(HttpContext.Current.Session["patientid"]);
            obj.hid         = Convert.ToInt32(HttpContext.Current.Session["hospital"]);
            string       xml = Common.ToXML(obj);
            DBConnection con = new DBConnection();
            DataSet      d   = con.ExecuteProcedure("SP_Treatment", xml);

            //Get Patient Details
            PatientMaster pm = new PatientMaster();

            pm.CMD       = "View1";
            pm.hid       = Convert.ToInt32(HttpContext.Current.Session["hospital"]);
            pm.patientid = Convert.ToInt32(HttpContext.Current.Session["patientid"]);
            string  xml1        = Common.ToXML(pm);
            DataSet ds          = con.ExecuteProcedure("SP_PatientRegistration", xml1);
            string  patientname = ds.Tables[0].Rows[0]["title"] + " " + ds.Tables[0].Rows[0]["fname"] + " " + ds.Tables[0].Rows[0]["mname"] + " " + ds.Tables[0].Rows[0]["lname"];

            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                {
                    StringBuilder sb = new StringBuilder();

                    //Generate Invoice (Treatment) Header.
                    sb.Append("<div style='font-family:verdana'>");

                    sb.Append("<table width='700px'>");

                    sb.Append("<tr style='font-size:30px'><td colspan=2>");
                    sb.Append(HospitalName);
                    sb.Append("</td></tr>");

                    sb.Append("<tr style='font-size:14px'><td>Treatment Date #:");
                    sb.Append(d.Tables[0].Rows[0]["create_dt"]);
                    sb.Append("</td><td>Treatment Id #:");
                    sb.Append(d.Tables[0].Rows[0]["treatmentid"]);
                    sb.Append("</td></tr></table><br/>");

                    sb.Append("<table border='1' width='700px' style='font-size:13px; border-collapse:collapse;'>");
                    sb.Append("<tr><td colspan ='4' style='background-color:#ddd; font-weight:bold'> PATIENT DETAILS </td></tr>");
                    sb.Append("<tr><td>Patient Name:</td><td>");
                    sb.Append(patientname);
                    sb.Append("</td><td>Patient Id:</td><td>");
                    sb.Append(ds.Tables[0].Rows[0]["patientid"]);
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td>Patient Age:</td><td >");
                    sb.Append(ds.Tables[0].Rows[0]["age"]);
                    sb.Append("</td><td>Consultant</td><td>");
                    sb.Append(d.Tables[0].Rows[0]["dfname"] + "&nbsp;" + d.Tables[0].Rows[0]["dlname"]);
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td>Address:</td>");
                    sb.Append("<td>-</td>");
                    sb.Append("<td>Contact No :</td><td>");
                    sb.Append(ds.Tables[0].Rows[0]["contact"]);
                    sb.Append("</td></tr>");
                    sb.Append("</table><br/>");

                    //Generate Treatment
                    sb.Append("<table border='0' width='700px' style='font-size:13px; border-collapse: collapse;'>");
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");


                    // Investigations
                    sb.Append("<td colspan ='5'> Investigations :</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[3].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[3].Rows[i]["diseasename"]);
                        if (i == d.Tables[3].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");

                    //Presenting Complains
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan ='5'> Presenting Complains :</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[5].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[5].Rows[i]["complentsname"]);
                        if (i == d.Tables[5].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");


                    //Provisional Diagnosis
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan ='5'> Provisional Diagnosis :</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[6].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[6].Rows[i]["disgnosisname"]);
                        if (i == d.Tables[6].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");

                    //Previous Disease
                    sb.Append("<tr style='background-color:#ddd; font-weight:bold'>");

                    sb.Append("<td colspan ='5'> Previous Disease and Duration:</td></tr>");
                    sb.Append("<tr style ='font-weight:bold'><td>Sr.No#</td><td>Disease#</td><td>From Date#</td><td>To Date#</td></tr>");
                    sb.Append("<tr><td colspan='5'></td></tr>");
                    for (int i = 0; i <= d.Tables[8].Rows.Count - 1; i++)
                    {
                        sb.Append("<td>");
                        sb.Append(i + 1);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[8].Rows[i]["historyname"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[8].Rows[i]["from_dt"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[8].Rows[i]["to_dt"]);
                        sb.Append("</td>");
                    }
                    sb.Append("</tr>");

                    //Tn And Vn Details

                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold' >");
                    sb.Append("<td colspan ='5'> Tn And Vn :</td></tr>");
                    sb.Append("<tr><td></td><td><u>cgl</u></td><td>cgl</td><td>Using glasses</td><td>cph</td></tr>");

                    sb.Append("<tr><td colspan='5'></td></tr>");
                    for (int i = 0; i <= d.Tables[10].Rows.Count - 1; i++)
                    {
                        sb.Append("<tr><td>Vn-RE</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_re_clg"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_re_clg_v"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_re_ug"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_re_cph"]);
                        sb.Append("</td></tr>");


                        sb.Append("<tr><td>Vn-LE</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_le_clg"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_le_clg_v"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_le_ug"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_le_cph"]);
                        sb.Append("</td></tr>");


                        sb.Append("<tr><td>Tn-RE</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_re_clg"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_re_clg_t"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["vn_ug_add"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_re_cph"]);
                        sb.Append("</td></tr>");

                        sb.Append("<tr><td>Tn-LE</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_le_clg"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_le_clg_t"]);
                        sb.Append("</td>");
                        sb.Append("<td>");
                        sb.Append(d.Tables[10].Rows[0]["tn_le_cph"]);
                        sb.Append("</td></tr>");
                    }

                    //S/L
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan ='5'> S/L :</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[7].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[7].Rows[i]["checkupname"]);
                        if (i == d.Tables[7].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");

                    //Fundus (F)
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan ='5'> Fundus (F) :</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[4].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[4].Rows[i]["fundusname"]);
                        if (i == d.Tables[4].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");


                    //Medicine
                    sb.Append("<tr style='background-color:#ddd; font-weight:bold'>");

                    sb.Append("<td colspan ='5'> Previous Disease and Duration:</td></tr>");
                    sb.Append("<tr style ='font-weight:bold' align='center'><td>Sr.No #</td><td>Medicine #</td><td>Quantity #</td><td>Timeing #</td></tr>");
                    sb.Append("<tr><td colspan='5'></td></tr>");
                    for (int i = 0; i <= d.Tables[1].Rows.Count - 1; i++)
                    {
                        sb.Append("<tr align='center'><td>");
                        sb.Append(i + 1);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[1].Rows[i]["particular"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[1].Rows[i]["quantity"]);
                        sb.Append("</td><td>");
                        sb.Append("&nbsp;&nbsp;");
                        sb.Append(d.Tables[1].Rows[i]["m"]);
                        sb.Append("&nbsp;&nbsp;");
                        sb.Append(d.Tables[1].Rows[i]["a"]);
                        sb.Append("&nbsp;&nbsp;");
                        sb.Append(d.Tables[1].Rows[i]["e"]);
                        sb.Append("&nbsp;&nbsp;");
                        sb.Append(d.Tables[1].Rows[i]["n"]);
                        sb.Append("&nbsp;&nbsp;");
                        sb.Append("</td></tr>");
                    }

                    //Advice
                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan ='5'> Advice:</td></tr>");
                    sb.Append("<tr><td colspan ='5'>");
                    for (int i = 0; i <= d.Tables[9].Rows.Count - 1; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append("&nbsp;&nbsp;");
                        }
                        sb.Append(i + 1);
                        sb.Append(".&nbsp;");
                        sb.Append(d.Tables[9].Rows[i]["advicename"]);
                        if (i == d.Tables[9].Rows.Count - 1)
                        {
                            sb.Append(".");
                        }
                    }
                    sb.Append("</td></tr>");


                    //Reports
                    sb.Append("<tr style='background-color:#ddd; font-weight:bold'>");

                    sb.Append("<td colspan ='5'>Reports:</td></tr>");
                    sb.Append("<tr style ='font-weight:bold' align='center'><td>Sr.No#</td><td>Report#</td><td>date#</td></tr>");
                    sb.Append("<tr align='center'><td colspan='5'><td>");
                    for (int i = 0; i <= d.Tables[0].Rows.Count - 1; i++)
                    {
                        if (d.Tables[0].Rows[i]["isBloodTest"].ToString() == "Y")
                        {
                            sb.Append("</tr align='center'><td>");
                            sb.Append("1");
                            sb.Append("</td><td>");
                            sb.Append("Blood Test");
                            sb.Append("</td><td>");
                            sb.Append(d.Tables[0].Rows[i]["bloodtest_dt"]);
                            sb.Append("</td></tr>");
                        }

                        if (d.Tables[0].Rows[i]["isXRay"].ToString() == "Y")
                        {
                            sb.Append("</tr align='center'><td>");
                            sb.Append("2");
                            sb.Append("</td><td>");
                            sb.Append("X-Ray");
                            sb.Append("</td><td>");
                            sb.Append(d.Tables[0].Rows[i]["xray_dt"]);
                            sb.Append("</td></tr>");
                        }
                    }
                    sb.Append("</td></tr>");

                    //Tn And Vn Details

                    sb.Append("<tr style = 'background-color:#ddd; font-weight:bold' >");
                    sb.Append("<td colspan ='5'> Eye Vision :</td></tr>");

                    sb.Append("<tr><td colspan='5'>");
                    sb.Append("<table border='1'width='700px' style='border-collapse:collapse;'>");
                    sb.Append("<tr align='center'><td>Eye</td><td colspan = '3'>Right</td><td colspan ='3'>Left</td></tr>");

                    for (int i = 0; i <= d.Tables[2].Rows.Count - 1; i++)
                    {
                        sb.Append("<tr align='center'><td>Vn</td><td colspan ='3'>6/");
                        sb.Append(d.Tables[2].Rows[0]["right_vn"]);
                        sb.Append("</td><td colspan ='3'>6/");
                        sb.Append(d.Tables[2].Rows[0]["left_vn"]);
                        sb.Append("</td></tr>");
                        sb.Append("<tr align='center'><td></td><td>Sph.</td><td>Cyl.</td><td>Axis.</td><td>Sph.</td><td>Cyl.</td><td>Axis.</td></tr>");

                        sb.Append("<tr align='center'><td>Dist.</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_dist_sph"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_dist_cyl"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_dist_axis"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_dist_sph"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_dist_cyl"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_dist_axis"]);
                        sb.Append("</td></tr>");

                        sb.Append("<tr align='center'><td>Near.</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_near_sph"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_near_cyl"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["right_near_axis"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_near_sph"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_near_cyl"]);
                        sb.Append("</td><td>");
                        sb.Append(d.Tables[2].Rows[0]["left_near_axis"]);
                        sb.Append("</td></tr>");
                    }

                    sb.Append("</table></td></tr>");

                    sb.Append("<tr><td colspan='5'></td></tr>");

                    //Followup
                    sb.Append("<tr style='background-color:#ddd; font-weight:bold'>");
                    sb.Append("<td colspan='2'>Follow-up Date :</td><td colspan='3'>");
                    for (int i = 0; i <= d.Tables[0].Rows.Count - 1; i++)
                    {
                        if (d.Tables[0].Rows[0]["isFollowup"].ToString() == "Y")
                        {
                            sb.Append(d.Tables[0].Rows[i]["followup_dt"]);
                        }
                        else
                        {
                            sb.Append("-");
                        }
                    }
                    sb.Append("</td></tr></table>");
                    sb.Append("<br><span style='font-size:11px'>## This is computer generated print there no need of signaure.</span>");
                    return(sb.ToString());
                }
            }
        }