Page 156 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 156
ห้องสมุดกรมพัฒนาที่ดิน
ค- 43
string sSql = "";
sSql += "SELECT BureauIntra.Bureau, COUNT(*) AS Num";
sSql += " FROM Letter INNER JOIN BureauIntra ON
Letter.Letter_RecBureau = BureauIntra.BureauID";
string YMD1 = Request.Form["ddlDolY"] + Request.Form["ddlDolM"] +
Request.Form["ddlDolD"];
string YMD2 = Request.Form["ddlDolY2"] + Request.Form["ddlDolM2"] +
Request.Form["ddlDolD2"];
if (!YMD1.Contains("na") && !YMD2.Contains("na"))
sSql += " WHERE (Letter.Letter_Status = N'1') AND
(Letter.Letter_RecDate >= N'" + YMD1 + "') AND (Letter.Letter_RecDate <=
N'" + YMD2 + "')";
sSql += " GROUP BY BureauIntra.Bureau";
DBLetter.SelectCommand = sSql;
Session["SQL"] = sSql;
DBLetter.DataBind();
sSql = "";
sSql += "SELECT COUNT(*)";
sSql += " FROM Letter INNER JOIN BureauIntra ON
Letter.Letter_RecBureau = BureauIntra.BureauID";
if (!YMD1.Contains("na") && !YMD2.Contains("na"))
sSql += " WHERE (Letter.Letter_Status = N'1') AND
(Letter.Letter_RecDate >= N'" + YMD1 + "') AND (Letter.Letter_RecDate <=
N'" + YMD2 + "')";
DbMgt table = new DbMgt(str);
lblCLetter.Text = "รวมจ านวนหนังสือเวียนทุกหน่วยงาน :" + (table.exScalar(sSql));
}
}
----------------------------------------------------------------------------------------------