private void BindReport(string strSoSo) { rptMaSoDuThuong tblReport = new rptMaSoDuThuong(); Promotion.Serial.Function objFunction = new Function(); tblReport.SetReportParameter(Constant.TEN_CHUONG_TRINH, "Khách hàng đã đọc, hiểu thể lệ " + Constant.TEN_CHUONG_TRINH + " và đồng ý tham gia Chương trình."); if (Session[Constant.USERNAME] != null) { Promotion.Serial.SerialBook objSerialBook = objFunction.GetSerialBookResultByBookNumber(strSoSo, dtStartDate, dtEndDate); if (objSerialBook != null) { tblReport.Parameters["SOSO"].Value = objSerialBook.Book_Number; if (objSerialBook.ValueDate != null) { tblReport.Parameters["NGAY_CAP_MA"].Value = "Ngày " + System.DateTime.Now.ToString("dd") + " tháng " + System.DateTime.Now.ToString("MM") + " năm " + System.DateTime.Now.ToString("yyyy"); } string strCustomerName = string.Empty; if (objSerialBook.Customer_Name.IndexOf("ý") > 0) { strCustomerName = objSerialBook.Customer_Name.Substring(0, objSerialBook.Customer_Name.IndexOf("ý")); } else { strCustomerName = objSerialBook.Customer_Name; } tblReport.Parameters["CUSNAME"].Value = strCustomerName; tblReport.Parameters["CMND"].Value = objSerialBook.CMTND; tblReport.Parameters["PHONE"].Value = objSerialBook.Telephone; tblReport.Parameters["KY_HAN"].Value = objSerialBook.Period.ToString() + " tháng"; tblReport.Parameters["AMOUNT"].Value = String.Format("{0:C}", objSerialBook.TotalAmount).Replace("$", "") + " " + objSerialBook.Currency; //preprocess lucky serial int nLuckyLength = 6 - objSerialBook.Seq.ToString().Length; string strLucky = objSerialBook.Seq.ToString(); int nLuckySerial = int.Parse(strLucky); for (int nIndex = 0; nIndex < nLuckyLength; nIndex++) { strLucky = "0" + strLucky; } tblReport.Parameters["LuckySerial"].Value = (nLuckySerial <= 11000) ? strLucky : string.Empty; string strSoTienBangChu = string.Empty; if (objSerialBook.Currency == "VND") { string TEMP = string.Empty; TEMP = objSerialBook.TotalAmount.ToString().Replace(",", "").Replace(".00 VND", ""); strSoTienBangChu = Spell(TEMP.ToString(), "đồng"); } if (objSerialBook.Currency == "USD") { int dau = objSerialBook.TotalAmount.ToString().IndexOf("."); if (dau > 0) { string phan_chan = objSerialBook.TotalAmount.ToString().Substring(0, dau); string phan_le = objSerialBook.TotalAmount.ToString().Substring(dau, objSerialBook.TotalAmount.ToString().Length - dau).Replace(".", ""); string doc_le = Spell(phan_le.ToString(), "cent"); string doc_chan = Spell(phan_chan.ToString(), "đô la"); strSoTienBangChu = doc_chan + " " + doc_le; } else { strSoTienBangChu = Spell(objSerialBook.TotalAmount.ToString(), "đô la"); } } if (!string.IsNullOrEmpty(strSoTienBangChu)) { string strFirstLetter = strSoTienBangChu.Substring(0, 1); strFirstLetter = strFirstLetter.ToUpper(); strSoTienBangChu = strFirstLetter + strSoTienBangChu.Substring(1); } tblReport.Parameters["AMOUNT_CHU"].Value = strSoTienBangChu; tblReport.Parameters["SERIAL"].Value = Common.FormatSerial(objSerialBook.Masoduthuongs.ToList()); } } ReportViewer1.Report = tblReport; }