private string getContentType(RPT.ExportFormatType type) { if (type == RPT.ExportFormatType.PDF) { return "application/pdf"; } else if (type == RPT.ExportFormatType.XLS) { return "application/vnd.ms-excel"; } else if (type == RPT.ExportFormatType.TXT) { return "application/rtf"; } else if (type == RPT.ExportFormatType.DOC) { return "application/vnd.ms-word"; } return "text/html"; }
public static byte[] byteResult(genericReportData data) { string _file = string.Empty; string _ext = ".pdf"; try { _file = data.PathRPT.Trim().Substring(data.PathRPT.Length - 1) == @"\" ? data.PathRPT + (string.IsNullOrEmpty(data.area) ? string.Empty : data.area + @"\") + data.fileRPT : data.PathRPT.Trim() + @"\" + (string.IsNullOrEmpty(data.area) ? string.Empty : data.area + @"\") + data.fileRPT; if (System.IO.File.Exists(_file)) { //CrystalDecisions.Shared.ExportFormatType _exportType; //if (data.exportTO == RP.Saude.Report.RPT.ExportFormatType.DOC) //{ // _exportType = CrystalDecisions.Shared.ExportFormatType.WordForWindows; // _ext = ".doc"; //} //else if (data.exportTO == RP.Saude.Report.RPT.ExportFormatType.HTML) //{ // _exportType = CrystalDecisions.Shared.ExportFormatType.HTML40; // _ext = ".html"; //} //else if (data.exportTO == RP.Saude.Report.RPT.ExportFormatType.TXT) //{ // _exportType = CrystalDecisions.Shared.ExportFormatType.RichText; // _ext = ".txt"; //} //else if (data.exportTO == RP.Saude.Report.RPT.ExportFormatType.XLS) //{ // _exportType = CrystalDecisions.Shared.ExportFormatType.Excel; // _ext = ".xls"; //} //else //{ // _exportType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; //} var rep = new RPT( _file, data.exportTO, data.listData, data.parameters); return rep.readRPT(); } return null; } finally { /* dispose method */ } }
public override void ExecuteResult(System.Web.Mvc.ControllerContext context) { context.HttpContext.Response.Clear(); context.HttpContext.Response.ContentType = getContentType(type); context.HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=" + saveName); var report = new RPT(file, type, listData, parameters); var buffer = report.readRPT(); context.HttpContext.Response.BinaryWrite(buffer); }
public void MyBind() { int pageCount = 0; DataTable dt = new DataTable(); M_UserInfo mu = tpuser_Bll.GetLogin(); //barBll.GetUser(); if (!string.IsNullOrEmpty(Request.QueryString["searchstr"]) || !string.IsNullOrEmpty(Request.QueryString["uid"]) || !string.IsNullOrEmpty(Request.QueryString["islike"])) { string skey = Request.QueryString["searchstr"]; int uid = DataConvert.CLng(Request.QueryString["uid"]); bool sellike = DataConvert.CLng(Request.QueryString["islike"]) > 0 ? true : false; string skeyTlp = "\"<span style='color:#ff6a00;'>{0}</span>\""; if (!string.IsNullOrEmpty(skey)) { BarName_L.Text = "相关" + string.Format(skeyTlp, skey) + "的贴子"; Title_L.Text = skey + "\"的贴子"; dt = barBll.SelByCateID(skey, 3); } else if (sellike) { BarName_L.Text = string.Format(skeyTlp, "我的收藏"); Title_L.Text = "我的收藏"; dt = barBll.SelByCateID(mu.UserID.ToString(), 4); } else { M_UserInfo smu = new M_UserInfo(); if (uid < 1)//匿名用户不允许搜索 { smu.UserName = "******"; } else { smu = buser.GetUserByUserID(uid); dt = barBll.SelByCateID(uid.ToString(), 2); } BarName_L.Text = string.Format(skeyTlp, smu.HoneyName) + "的贴子"; Title_L.Text = smu.HoneyName + "的贴子"; } Cid = cateMod.CateID; totalspan.InnerText = "共搜索到" + dt.Rows.Count + "个贴子"; function.Script(this, "SetImg('/App_Themes/User/timg.jpg');"); IsSearch = true; MsgTitle_T.Enabled = false; MsgContent_T.Enabled = false; SendDiv.Visible = false; } else { Cid = cateMod.CateID; dt = barBll.SelByCateID(CateID.ToString(), 1, true); cateMod = guestBll.GetCate(CateID); #region 权限校验 if (cateMod.IsBarOwner(mu.UserID)) { barowner_div.Visible = true; IsBarOwner = true; DPBind(); } else//非吧主权限验证 { switch (cateMod.PermiBit) { case "1": //版面类别 emptydiv.Style.Add("display", "none"); send_div.Visible = false; RPT.Visible = false; break; default: if (!authBll.AuthCheck(cateMod, mu, "needlog")) //访问权限 { function.WriteErrMsg("你没有访问权限"); } if (!authBll.AuthCheck(cateMod, mu, "send")) //发贴权限 { send_div.Visible = false; noauth_div.Visible = true; } break; } } #endregion BarInfo_L.Text = cateMod.Desc; function.Script(this, "SetImg('" + cateMod.BarImage + "');"); if (cateMod.IsNull) { function.WriteErrMsg("该贴吧不存在!!"); } Title_L.Text = cateMod.CateName; BarName_L.Text = cateMod.CateName; DataTable chdt = B_GuestBook.GetCateList(CateID); if (chdt.Rows.Count > 0) { ChildRPT.DataSource = chdt; ChildRPT.DataBind(); } else { childBar.Visible = false; } } RPT.DataSource = PageCommon.GetPageDT(pageSize, CPage, dt, out pageCount); RPT.DataBind(); int tiecount = 0; int recout = 0; barBll.GetCount(CateID, out tiecount, out recout); replycount.InnerText = recout.ToString(); dnum_span.InnerText = dt.Rows.Count.ToString(); dnum_span2.InnerText = tiecount.ToString(); pagenum_span1.InnerText = pageCount.ToString(); MsgPage_L.Text = PageCommon.CreatePageHtml(pageCount, CPage); if (dt.Rows.Count > 0) { contentdiv.Visible = true; } else { emptydiv.Visible = true; } Anony_Span.Visible = mu.UserID <= 0; }
private void MyBind() { RPT.DataSource = cateBll.SelByGuest(); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = TempBll.SelByPid(Pid); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = examBll.GetSelectByC_ClassId(0); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = GetDt(); RPT.DataBind(); }
private void ManipulateExcel(string excelDestinationPath) { DateTime dateIn = txtDate.DateTimeValue; Workbook workbook = new Workbook(); workbook.LoadDocument(excelDestinationPath); Worksheet worksheet = workbook.Worksheets[0]; worksheet.Cells[0, 0].Value = txtDate.Text + worksheet.Cells[0, 0].Value; #region 602111 DataTable dt602111 = dao60210.ListDataFor602111(dateIn); if (dt602111.Rows.Count == 0) { MessageDisplay.Info(string.Format("{0},{1}─{2},無任何資料!", txtDate.Text, _ProgramID, "日報表.一、證券及期貨市場指數價格日報(選擇權市場)")); } else { foreach (DataRow row in dt602111.Rows) { int rowIndex = row["RPT_SEQ_NO"].AsInt(); if (rowIndex == 0) { continue; } worksheet.Cells[rowIndex - 1, 2].Value = row["AMIF_CLOSE_PRICE"].AsDecimal(); worksheet.Cells[rowIndex - 1, 3].Value = row["AMIF_UP_DOWN_VAL"].AsDecimal(); decimal amif_sum_amt = row["AMIF_SUM_AMT"].AsDecimal(); if (amif_sum_amt > 0) { worksheet.Cells[rowIndex - 1, 5].Value = amif_sum_amt; } } flag++; } #endregion 602111 #region 602112 DataTable dt602112 = dao60210.ListDataFor602112(dateIn); if (dt602112.Rows.Count == 0) { MessageDisplay.Info(string.Format("{0},{1}─{2},無任何資料!", txtDate.Text, _ProgramID, "日報表.一、證券及期貨市場指數價格日報(期貨市場)")); } else { // GroupBy用 var queryForGroupBy = dt602112.AsEnumerable().GroupBy(t => new { t1 = t.Field <string>("AMIF_KIND_ID") }) .Select(g => new { KindID = g.Key.t1.Trim(), Qty = g.Sum(s => s.Field <decimal>("AMIF_M_QNTY_TAL")) }); string kindId = ""; foreach (DataRow row in dt602112.Rows) { int rowIndex = row["RPT_SEQ_NO"].AsInt(); if (rowIndex == 0) { continue; } string AMIF_KIND_ID = row["AMIF_KIND_ID"].AsString(); if (kindId == AMIF_KIND_ID) { continue; } kindId = AMIF_KIND_ID; int AMIF_M_QNTY_TAL = row["AMIF_M_QNTY_TAL"].AsInt(); if (AMIF_M_QNTY_TAL != 0) { worksheet.Cells[rowIndex - 1, 2].Value = row["AMIF_CLOSE_PRICE"].AsDecimal(); worksheet.Cells[rowIndex - 1, 3].Value = row["AMIF_UP_DOWN_VAL"].AsDecimal(); } else { worksheet.Cells[rowIndex - 1, 2].Value = 0; worksheet.Cells[rowIndex - 1, 3].Value = "-"; } var groupKindId = queryForGroupBy.Where(m => m.KindID == AMIF_KIND_ID).FirstOrDefault(); if (groupKindId != null) { worksheet.Cells[rowIndex - 1, 5].Value = groupKindId.Qty; } } flag++; } #endregion 602112 #region 602113 DateTime lastDate = dao60210.GetStwLastDate(dateIn); DataTable dt602113 = dao60210.ListDataFor602113(dateIn, lastDate); if (dt602113.Rows.Count == 0) { MessageDisplay.Info(string.Format("{0},{1}─{2},無任何資料!", txtDate.Text, _ProgramID, "日報表.一、證券及期貨市場指數價格日報(新加坡摩臺)")); } else { // GroupBy用 var groupBy602113 = dt602113.AsEnumerable().GroupBy(t => new { }) .Select(g => new { Qty = g.Sum(s => s.Field <decimal>("M_QNTY")) }); string kindIDPrev = ""; foreach (DataRow row in dt602113.Rows) { int rowIndex = row["RPT_SEQ_NO"].AsInt(); if (rowIndex == 0) { continue; } string KIND_ID = row["KIND_ID"].AsString(); string SETTLE_DATE = row["SETTLE_DATE"].AsString(); decimal CLOSE_PRICE = row["CLOSE_PRICE"].AsDecimal(); decimal STW_LAST_SETTLE = row["STW_LAST_SETTLE"].AsDecimal(); // 現貨 if (SETTLE_DATE == "000000") { worksheet.Cells[rowIndex - 1, 7].Value = CLOSE_PRICE; continue; } // 期貨 if (kindIDPrev == KIND_ID) { continue; } kindIDPrev = KIND_ID; decimal M_QNTY = row["M_QNTY"].AsDecimal(); if (M_QNTY != 0) { worksheet.Cells[rowIndex - 1, 2].Value = CLOSE_PRICE; worksheet.Cells[rowIndex - 1, 3].Value = CLOSE_PRICE - STW_LAST_SETTLE; } var groupSum = groupBy602113.FirstOrDefault(); if (groupSum != null) { worksheet.Cells[rowIndex - 1, 5].Value = groupSum.Qty; } } flag++; } #endregion 602113 #region 602114 DataTable dtRPT = new RPT().ListData("%602114%"); if (dtRPT.Rows.Count == 0) { MessageDisplay.Info(string.Format("{0},{1}─{2},無任何資料!", txtDate.Text, _ProgramID, "RPT")); } else { int RPT_SEQ_NO = dtRPT.Rows[0]["RPT_SEQ_NO"].AsInt(); int RPT_VALUE_2 = dtRPT.Rows[0]["RPT_VALUE_2"].AsInt(); string RPT_VALUE = dtRPT.Rows[0]["RPT_VALUE"].AsString().Trim(); worksheet.Cells[RPT_SEQ_NO - 1, RPT_VALUE_2 - 1].Value = RPT_VALUE + GlobalInfo.USER_DPT_NAME + "/" + GlobalInfo.USER_NAME; } #endregion 602114 workbook.SaveDocument(excelDestinationPath); }
private void MyBind() { RPT.DataSource = bsBll.Sel(); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = shopGrade.GetShopGradeinfo(); RPT.DataBind(); }
public void MyBind() { DataTable dt = new DataTable(); M_UserInfo mu = buser.GetLogin(); switch (SType) { case 0: //订单 orderMod = orderBll.SelModelByOrderNo(OrderNo); //Total_L.Text = orderMod.Balance_price.ToString("f2") + "+" + orderMod.Freight.ToString("f2") + "=" + orderMod.Ordersamount.ToString("f2") + "元 (金额+运费)"; labelmoney01.Text = orderMod.Receivablesamount.ToString("f2"); ExpressNum_T.Text = orderMod.ExpressNum; ExpressDelivery_T.Text = orderMod.ExpressDelivery; if (orderMod == null || orderMod.id == 0) { function.WriteErrMsg("订单不存在"); } if (orderMod.Userid != mu.UserID) { function.WriteErrMsg("该订单不属于你,无法查看"); } dt = SelByOrderID(orderMod.id); price = orderMod.Balance_price; fare = orderMod.Freight; allamount = orderMod.Ordersamount; DataTable dt1 = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC"); if (dt1.Rows.Count > 0) { payMod = payBll.SelModelByPayNo(dt1.Rows[0]["PayNo"].ToString()); allamount = (double)payMod.MoneyPay; arrive = payMod.ArriveMoney; point = payMod.UsePoint; } Total_L.Text = price.ToString("f2") + " + " + fare.ToString("f2") + " - " + arrive.ToString("f2") + "-" + (point * 0.01).ToString("f2") + "(" + point + ")" + " = " + allamount.ToString("f2"); Total_L.Text = Total_L.Text + " (商品总价+运费-优惠券-积分兑换=总额)"; break; case 1: //购物车 dt = cartBll.GetCarProList(OrderNo); break; } if (orderMod.Paymentstatus != (int)M_OrderList.PayEnum.HasPayed) { PayUrl_A.Visible = true; DataTable dt1 = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC"); string payurl = "&OrderCode=" + orderMod.OrderNo; if (dt1.Rows.Count > 0) { payurl = "&PayNo=" + dt1.Rows[0]["PayNo"]; } uappMod = uappBll.SelModelByUid(buser.GetLogin().UserID, "wechat"); if (uappMod != null) { M_WX_User wxuserMod1 = wxuserBll.SelForOpenid(1, uappMod.OpenID); M_WX_User wxuserMod2 = wxuserBll.SelForOpenid(2, uappMod.OpenID); if (wxuserMod1 != null && wxuserMod2 == null) { PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=1" + payurl; } else if (wxuserMod2 != null && wxuserMod1 == null) { PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=2" + payurl; } else if (wxuserMod1 == null && wxuserMod2 == null) { PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl; } } else { PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl; } } if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["Additional"].ToString())) { User_Div.Visible = true; M_Cart_Travel model = JsonConvert.DeserializeObject <M_Cart_Travel>(dt.Rows[0]["Additional"].ToString()); List <M_Cart_Contract> modelList = new List <M_Cart_Contract>(); modelList.AddRange(model.Guest); modelList.AddRange(model.Contract); UserRPT.DataSource = modelList; UserRPT.DataBind(); } pronum = dt.Rows.Count; RPT.DataSource = dt; RPT.DataBind(); }
void MyBind() { RPT.DataSource = PkBll.SelByUid(buser.GetLogin().UserID); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = bll.GetTrademarkAll(); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = knowBll.Select_All(NodeID, 0); RPT.DataBind(); }
public void MyBind() { RPT.DataSource = nodeBll.SelByPid(0); RPT.DataBind(); }
/// <summary> /// wf_30410 (sheet1 data) /// </summary> /// <param name="workbook"></param> /// <param name="sheetNo">SheetNo.tradeSum</param> /// <param name="row"> 3 </param> /// <returns></returns> protected bool wf_30410(Workbook workbook, SheetNo sheetNo, int row) { string rptName = "股票期貨各標的交易概況統計表"; //報表標題名稱 labMsg.Text = _ProgramID + "-" + rptName + " 轉檔中..."; try { //1. 取得資料最大日期, 抓取OI用 string maxDate = new D30410().GetMaxDate(StartDate, EndDate); if (string.IsNullOrEmpty(maxDate)) { MessageDisplay.Info(string.Format("{0}~{1},{2} - {3},無任何資料!", StartDate, EndDate, _ProgramID, rptName), GlobalInfo.ResultText); return(false); }//if (string.IsNullOrEmpty(maxDate)) //2. 讀取資料 string eDate = maxDate; DataTable dt30410 = new D30410().ListData(StartDate, eDate); if (dt30410.Rows.Count <= 0) { MessageDisplay.Info(string.Format("{0}~{1},{2} - {3},無任何資料!", StartDate, eDate, _ProgramID, rptName), GlobalInfo.ResultText); } //if (dt.Rows.Count <= 0 ) //3. 切換Sheet Worksheet ws = workbook.Worksheets[(int)sheetNo]; ws.Cells[1, 0].Value = txtStartDate.Text; ws.Cells[1, 1].Value = txtEndDate.Text; int rowTotal = new RPT().DataByRptId("30410", "30410").AsInt(); //將rowTotal轉為int使用 rowTotal += row; string KindId = "19000101"; foreach (DataRow dr in dt30410.Rows) { row++; string ai2KindId = dr["ai2_kind_id"].AsString(); string apdkName = dr["apdk_name"].AsString(); int exRow = row - 1; if (KindId != ai2KindId) { KindId = ai2KindId; ws.Cells[exRow, 0].Value = KindId; ws.Cells[exRow, 1].Value = apdkName; } ws.Cells[exRow, 2].Value = dr["ai2_m_qnty"].AsDecimal(); ws.Cells[exRow, 3].Value = dr["ai2_oi"].AsDecimal(); ws.Cells[exRow, 4].Value = dr["am10_cnt"].AsDecimal(); ws.Cells[exRow, 6].Value = dr["am9_acc_cnt"].AsDecimal(); ws.Cells[exRow, 8].Value = dr["ab4_id_cnt"].AsDecimal(); } //4. 刪除空白列 if (dt30410.Rows.Count < rowTotal) { ws.Rows.Remove(row, rowTotal - row); } ws.Range["A1"].Select(); ws.ScrollToRow(0); return(true); } catch (Exception ex) { WriteLog(ex); return(false); } }
public void MyBind(string skey = "") { RPT.DataSource = comBll.Sel("2", -100, MsgID, "", skey); RPT.DataBind(); }
/// <summary> /// wf_30412 (sheet3 data) /// </summary> /// <param name="workbook"></param> /// <param name="sheetNo">SheetNo.tradeDetail</param> /// <param name="row"> 4 </param> /// <returns></returns> protected bool wf_30412(Workbook workbook, SheetNo sheetNo, int row) { string rptName = "股票期貨各標的未平倉量分佈明細統計表"; //報表標題名稱 string rptId = "30412"; ShowMsg(string.Format("{0}-{1} 轉檔中...", rptId, rptName)); try { //1. 取得資料最大日期, 抓取OI用 (在wf_30410取得) string maxDate = new D30410().GetMaxDate(StartDate, EndDate); if (string.IsNullOrEmpty(maxDate)) { MessageDisplay.Info(string.Format("{0}~{1},{2} - {3},無任何資料!", StartDate, EndDate, rptId, rptName), GlobalInfo.ResultText); return(false); }//if (string.IsNullOrEmpty(maxDate)) DateTime eDate = DateTime.ParseExact(maxDate, "yyyyMMdd", null); //yyyy/MM/dd //2. 讀取資料 DataTable dt30412 = new D30410().ListData2(txtStartDate.DateTimeValue, eDate); if (dt30412.Rows.Count <= 0) { MessageDisplay.Info(string.Format("{0}~{1},{2} - {3},無任何資料!", txtStartDate.Text, txtEndDate.Text, rptId, rptName), GlobalInfo.ResultText); return(false); } //if (dt.Rows.Count <= 0 ) //3. 切換Sheet Worksheet ws30412 = workbook.Worksheets[(int)sheetNo]; ws30412.Range["A1"].Select(); ws30412.Cells[1, 0].Value = txtStartDate.Text; ws30412.Cells[1, 1].Value = txtEndDate.Text; //3.1 撈資料列總數 //PB這邊帶入參數為txnId = 30410 , txdId = 30410,兩者撈出皆為500 int rowCnt = new RPT().DataByRptId("30410", "30411").AsInt(); int rowTotal = row + rowCnt; //4.填資料(交割年月) int found = 0; int maxSeqNo = dt30412.Compute("Max(seq_no)", "").AsInt(); //取得seq_no欄位的最大值 for (int w = 1; w <= maxSeqNo; w++) { if (dt30412.Select("seq_no =" + w).Length != 0) { found = dt30412.Rows.IndexOf(dt30412.Select(string.Format("seq_no ={0}", w))[0]); } if (found >= 0) { string text = dt30412.Rows[found]["amif_settle_date"].AsString(); ws30412.Cells[3, w + 2].Value = text.SubStr(0, 4) + "/" + text.SubStr(4, 2); } } string kindId = ""; foreach (DataRow dr in dt30412.Rows) { string amifKindId = dr["amif_kind_id"].AsString(); string apdkName = dr["apdk_name"].AsString(); decimal amifOpenInt = dr["amif_open_interest"].AsDecimal(); found = dr["seq_no"].AsInt(); if (kindId != amifKindId) { kindId = amifKindId; row++; ws30412.Cells[row - 1, 0].Value = kindId; ws30412.Cells[row - 1, 1].Value = apdkName; } ws30412.Cells[row - 1, found + 2].Value = amifOpenInt; } //4. 刪除空白列 Range ra = ws30412.Range[string.Format("{0}:504", row + 1)]; ra.Delete(DeleteMode.EntireRow); ws30412.Range["A1"].Select(); ws30412.ScrollToRow(0); return(true); } catch (Exception ex) { WriteLog(ex); return(false); } }
private void MyBind() { RPT.DataSource = SelMyLend(); RPT.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { B_ARoleAuth.CheckEx(ZLEnum.Auth.model, "NodeManage"); if (function.isAjax() && Request.Form["want"] != null) { #region AJAX int nodeID = DataConvert.CLng(Request.Form["nid"]); if (nodeID == 0) { Response.Clear(); Response.End(); } string json = ""; DataTable dt = bll.SelForShowAll(nodeID); if (dt != null && dt.Rows.Count > 0) { string[] cols = "Meta_Keywords,Meta_Description,Description".Split(','); foreach (string col in cols) { dt.Columns.Remove(col); } dt.Columns.Add(new DataColumn("icon", typeof(string))); dt.Columns.Add(new DataColumn("type2", typeof(string))); dt.Columns.Add(new DataColumn("oper", typeof(string))); //dt.Columns.Add(new DataColumn("showhidden",typeof(string))); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; dt.Rows[i]["icon"] = GetIcon(dr["NodeName"].ToString(), Convert.ToInt32(dr["NodeID"]), Convert.ToInt32(dr["Depth"]), Convert.ToInt32(dr["NodeType"]), dr["nodeDir"].ToString(), Convert.ToInt32(dr["ChildCount"]), dr["ContentModel"].ToString()); dt.Rows[i]["type2"] = GetNodeType(dr["NodeType"].ToString()); dt.Rows[i]["oper"] = GetOper(dr); dt.Rows[i]["Purview"] = ""; } json = JsonHelper.JsonSerialDataTable(dt); } Response.Clear(); Response.Write(json); Response.End(); #endregion } if (!IsPostBack) { DataTable nodetable = new DataTable(); if (Action == "del") { EmptyNode(); Response.Redirect("NodeManage.aspx"); return; } else if (Action == "showall") { nodetable = bll.SelForShowAll(0, true); } else { nodetable = bll.SelForShowAll(0); } DataRow dr = nodetable.NewRow();//根节点 dr["NodeID"] = 0; dr["NodeType"] = (int)NodeEnum.Root; dr["NodeName"] = Call.SiteName; dr["NodeDir"] = "root"; dr["Depth"] = 0; dr["ItemCount"] = nodetable.Compute("SUM(ItemCount)", "ParentID=0"); dr["ChildCount"] = nodetable.Rows.Count; dr["SafeGuard"] = 0; dr["NodeBySite"] = 0; nodetable.Rows.InsertAt(dr, 0); //-------------- nodetable.DefaultView.RowFilter = "NodeBySite IS NULL OR NodeBySite=0"; nodetable = nodetable.DefaultView.ToTable(); RPT.DataSource = nodetable; RPT.DataBind(); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>" + Resources.L.工作台 + "</a></li><li><a href='" + customPath2 + "Config/SiteInfo.aspx'>" + Resources.L.系统设置 + "</a></li><li class='active dropdown'><a href='NodeManage.aspx'>" + Resources.L.节点管理 + "</a> <a href='#' class='dropdown-toggle' data-toggle='dropdown'>" + Resources.L.便捷操作 + " <span class='caret'></span></a> <ul class='dropdown-menu' role='menu'><li><a href='NodeManage.aspx?action=showall'>" + Resources.L.展开所有节点 + "</a></li><li><a href=\'NodeManage.aspx\' >" + Resources.L.收缩所有节点 + "</a></li> <li><a href=\'javascript:void(0)\' onclick=\'emptynode()\'>" + Resources.L.除所有节点 + "</a></li><li><a href=\"" + customPath2 + "Config/EmptyData.aspx\">[" + Resources.L.初始化全站数据 + "]</a></li></ul></li>" + Call.GetHelp(15)); } }
protected void Page_Load(object sender, EventArgs e) { B_User.CheckIsLogged(); if (function.isAjax()) { string action = Request.Form["action"], vpath = Request.Form["vpath"], result = "", warning = "";//动作,需要加水印的图片路径 if (vpath.Contains("?")) { vpath = vpath.Substring(0, vpath.IndexOf("?")); } switch (action) { case "crop": //根据提交的图片路径与宽度等参数,完成剪切 { int x1 = int.Parse(Request["x1"]); int y1 = int.Parse(Request["y1"]); int width = int.Parse(Request["width"]); int height = int.Parse(Request["height"]); savePath += (function.GetRandomString(4) + Path.GetFileName(vpath)); result = ImageDealLib.imgcrop(vpath, savePath, x1, y1, width, height, ImageDealLib.FileCache.Save, out warning); } break; case "rotate": { int angle = DataConverter.CLng(Request.Form["angle"]); Bitmap bmp = imgHelper.Rotate(vpath, angle); savePath += function.GetRandomString(6) + Path.GetExtension(vpath); result = imgHelper.SaveImg(savePath, bmp); bmp.Dispose(); } break; case "zoom": //缩放 { int width = int.Parse(Request.Form["width"]); int height = int.Parse(Request.Form["height"]); savePath += (function.GetRandomString(4) + Path.GetFileName(vpath)); Bitmap bmp = imgHelper.ZoomImg(vpath, height, width); result = imgHelper.SaveImg(savePath, bmp); } break; case "fontwater": //文字水印 { System.Drawing.Image fontimg = AddFontWater(savePath + function.GetRandomString(6) + ".jpg"); savePath += "fontw_" + Path.GetFileName(vpath); result = ImageDealLib.makewatermark(vpath, fontimg, GetWaterType(Request.Form["pos"]), savePath, ImageDealLib.ImageType.JPEG, ImageDealLib.FileCache.Save, out warning); result += "?" + function.GetRandomString(6); } break; case "imgwater": //水印图片路径 { string watervpath = Request.Form["watervpath"]; int trans = DataConverter.CLng(Request.Form["trans"]); savePath += "imgw_" + Path.GetFileName(vpath); result = ImageDealLib.makewatermark(vpath, watervpath, GetWaterType(Request.Form["pos"]), savePath, ImageDealLib.ImageType.JPEG, ImageDealLib.FileCache.Save, out warning, trans); result += "?" + function.GetRandomString(6); } break; } Response.Write(result); Response.Flush(); Response.End(); } if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(); string ipath = Request.QueryString["ipath"].ToLower().Replace("/uploadfiles/user/" + mu.UserName + mu.UserID + "/", ""); string UserPath = "/UploadFiles/User/" + mu.UserName + mu.UserID + "/" + ipath.TrimStart('/');//不做过多的限制,如需要文件安全,则使用单独的文件服务器 if (string.IsNullOrEmpty(UserPath) || !SafeC.IsImage(UserPath)) { function.WriteErrMsg("只允许编辑图片文件!"); } if (!Directory.Exists(Server.MapPath(savePath))) { Directory.CreateDirectory(Server.MapPath(savePath)); } if (!File.Exists(Server.MapPath(UserPath))) { function.WriteErrMsg("需要修改的图片" + UserPath + "不存在"); } NowImg_Hid.Value = SourceImg_Hid.Value = UserPath; System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath(UserPath)); ImgWidth_Hid.Value = img.Width.ToString(); ImgHeight_Hid.Value = img.Height.ToString(); RPT.DataSource = GetWaterImgDT(); RPT.DataBind(); img.Dispose(); } }
private void ReBind() { RPT.CPage = 1; RPT.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { B_Admin.CheckIsLogged(); if (function.isAjax()) { string action = Request.Form["action"], vpath = Request.Form["vpath"], result = "", warning = "";//动作,需要加水印的图片路径 if (vpath.Contains("?")) { vpath = vpath.Substring(0, vpath.IndexOf("?")); } switch (action) { case "crop": //根据提交的图片路径与宽度等参数,完成剪切 int x1 = int.Parse(Request.Form["x1"]); int y1 = int.Parse(Request.Form["y1"]); int width = int.Parse(Request.Form["width"]); int height = int.Parse(Request.Form["height"]); savePath += (function.GetRandomString(4) + Path.GetFileName(vpath)); result = ImageDealLib.imgcrop(vpath, savePath, x1, y1, width, height, ImageDealLib.FileCache.Save, out warning); break; case "fontwater": //文字水印 { System.Drawing.Image fontimg = AddFontWater(savePath + function.GetRandomString(6) + ".jpg"); savePath += "fontw_" + Path.GetFileName(vpath); result = ImageDealLib.makewatermark(vpath, fontimg, GetWaterType(Request.Form["pos"]), savePath, ImageDealLib.ImageType.JPEG, ImageDealLib.FileCache.Save, out warning); result += "?" + function.GetRandomString(6); } break; case "imgwater": //水印图片路径 { string watervpath = Request.Form["watervpath"]; int trans = DataConverter.CLng(Request.Form["trans"]); savePath += "imgw_" + Path.GetFileName(vpath); result = ImageDealLib.makewatermark(vpath, watervpath, GetWaterType(Request.Form["pos"]), savePath, ImageDealLib.ImageType.JPEG, ImageDealLib.FileCache.Save, out warning, trans); result += "?" + function.GetRandomString(6); } break; } Response.Write(result); Response.Flush(); Response.End(); } if (!IsPostBack) { if (string.IsNullOrEmpty(IPath) || !SafeC.IsImage(IPath)) { function.WriteErrMsg("只允许编辑图片文件!"); } if (!Directory.Exists(savePath)) { Directory.CreateDirectory(Server.MapPath(savePath)); } if (!File.Exists(Server.MapPath(IPath))) { function.WriteErrMsg("需要修改的图片" + IPath + "不存在"); } NowImg_Hid.Value = SourceImg_Hid.Value = IPath; RPT.DataSource = GetWaterImgDT(); RPT.DataBind(); //string warning; //----剪切图 //vpath = ImageDealLib.imgcrop("/test/222.jpg", "/test/", 200, 200, 200, 200, ImageDealLib.FileCache.Save, out warning); //function.WriteErrMsg(vpath); //----生成水印 //string watervpath = AddFontWater(); //ImageDealLib.makewatermark("/test/222.jpg", "/test/usbqyr.jpg", ImageDealLib.WaterType.RightDown, "/test/", ImageDealLib.ImageType.JPEG, ImageDealLib.FileCache.Save, out warning); //----我们的水印 //WaterImages water = new WaterImages(); //string localPath = Server.MapPath("/test/222.jpg"); //string tempurl = Server.MapPath("/test/watered12.jpg"); //water.DrawImage(localPath, function.VToP("/Images/admin_logo.jpg"), tempurl); } }
/// <summary> /// 期貨市場動態報導-期貨 /// </summary> /// <param name="rptId"></param> /// <param name="rptName"></param> /// <param name="ws30011"></param> private void wf_30011(string rptId, string rptName, Worksheet ws30011) { try { rptName = "期貨市場動態報導-期貨"; rptId = "30011"; ShowMsg(rptId + "-" + rptName + " 轉檔中..."); string kindID = "", settleDate = "", index = "", indexStr = "", kindID2 = ""; int rowIndex = 0, mxwCnt = 0, mxwRow = 0, rowCnt = 0; decimal value, mQnty, value2; Range delRange; indexStr = "000000"; ws30011.Cells[0, 10].Value = "民國" + (txtSDate.DateTimeValue.Year - 1911) + "年" + txtSDate.DateTimeValue.Month + "月" + txtSDate.DateTimeValue.Day + "日"; //讀取資料 DataTable dt30011 = dao30010.d_30011(txtSDate.DateTimeValue); if (dt30011.Rows.Count == 0) { MessageDisplay.Info(txtSDate.Text + "," + rptId + '-' + rptName + ",無任何資料!"); labMsg.Visible = false; return; } //RPT daoRPT = new RPT(); DataTable dtRPT = daoRPT.ListAllByTXD_ID(rptId); if (dtRPT.Rows.Count == 0) { MessageDisplay.Info(rptId + '-' + "RPT無任何資料!"); labMsg.Visible = false; return; } flag++; //填資料 mxwCnt = 0; foreach (DataRow dr in dt30011.Rows) { mQnty = dr["AMIF_M_QNTY_TAL"].AsDecimal(); if (kindID2 != dr["AMIF_KIND_ID2"].AsString()) { kindID2 = dr["AMIF_KIND_ID2"].AsString(); rowIndex = dr["RPT_SEQ_NO"].AsInt() - 1 - 1; rowCnt = 0; index = dr["RPT_VALUE_3"].AsString(); } kindID = dr["AMIF_KIND_ID"].AsString(); rowIndex = rowIndex + 1; if (kindID2 == "MXW") { mxwRow = rowIndex; mxwCnt = mxwCnt + 1; } settleDate = dr["AMIF_SETTLE_DATE"].AsString(); if (settleDate == indexStr) { settleDate = "指數"; } else { if (kindID == "STW" && rowCnt >= 2) { rowCnt = rowCnt + 1; continue; } /* 第一筆不是指數,則跳一列 */ if (rowCnt == 0 && index == indexStr) { rowIndex = rowIndex + 1; rowCnt = rowCnt + 1; } if (dr["AMIF_EXPIRY_TYPE"].AsString() == "W") { ws30011.Cells[rowIndex, 1].Value = settleDate.SubStr(settleDate.Length - 2, 2).AsInt() + "W" + kindID.SubStr(2, 1); } else { ws30011.Cells[rowIndex, 1].Value = settleDate.SubStr(settleDate.Length - 2, 2).AsInt(); } } value = dr["AMIF_OPEN_PRICE"].AsDecimal(); if ((value != 0 && mQnty > 0) || (settleDate == "指數" && value != 0)) { ws30011.Cells[rowIndex, 2].Value = value; } value = dr["AMIF_HIGH_PRICE"].AsDecimal(); if (value != 0) { ws30011.Cells[rowIndex, 3].Value = value; } value = dr["AMIF_LOW_PRICE"].AsDecimal(); if (value != 0 || (settleDate == "指數" && value != 0)) { ws30011.Cells[rowIndex, 4].Value = value; } value = dr["AMIF_CLOSE_PRICE"].AsDecimal(); if ((value != 0 && mQnty > 0) || (settleDate == "指數" && value != 0)) { ws30011.Cells[rowIndex, 5].Value = value; } value2 = dr["AMIF_UP_DOWN_VAL"].AsDecimal(); if ((value != 0 && mQnty > 0) || (settleDate == "指數" && value != 0)) { ws30011.Cells[rowIndex, 6].Value = value2; if ((dr["AMIF_CLOSE_PRICE"].AsDecimal() - dr["AMIF_UP_DOWN_VAL"].AsDecimal()) == 0) { MessageDisplay.Error(kindID + " 收盤價-漲跌幅=0 ,計算漲跌點%造成除數為0"); return; } value2 = Math.Round((dr["AMIF_UP_DOWN_VAL"].AsDecimal() / (dr["AMIF_CLOSE_PRICE"].AsDecimal() - dr["AMIF_UP_DOWN_VAL"].AsDecimal())) * 100, 3, MidpointRounding.AwayFromZero); ws30011.Cells[rowIndex, 7].Value = value2; } ws30011.Cells[rowIndex, 8].SetValue(dr["AMIF_M_QNTY_TAL"]); if (settleDate != "指數") { if (kindID.SubStr(0, 3) != "STW") { ws30011.Cells[rowIndex, 9].SetValue(dr["AMIF_SETTLE_PRICE"]); } ws30011.Cells[rowIndex, 10].SetValue(dr["AMIF_OPEN_INTEREST"]); } rowCnt = rowCnt + 1; }//foreach (DataRow dr in dt30011.Rows) if (mxwCnt == 0) { mxwRow = dao30010.getMxwRow() - 1; //delRange = ws30011.Range[(li_mxw_row).ToString() + ":" + (li_mxw_row + 1).ToString()]; //delRange.Delete(DeleteMode.EntireRow); ws30011.Rows.Hide(mxwRow, mxwRow + 1); } else if (mxwCnt < 2) { //delRange = ws30011.Rows[(li_mxw_row + 1).ToString()]; //delRange.Delete(DeleteMode.EntireRow); ws30011.Rows.Hide(mxwRow + 1, mxwRow + 1); } } catch (Exception ex) { throw ex; } }
protected void mybind_btn_Click(object sender, EventArgs e) { RPT.DataBind(); }
protected override ResultStatus Export() { try { dao30050 = new D30050(); daoRPT = new RPT(); string rptId = "30050", file; string asYmd = txtSDate.Text.Replace("/", ""); // 1. 複製檔案 file = PbFunc.wf_copy_file(rptId, rptId); if (file == "") { return(ResultStatus.Fail); } // 2. 開啟檔案 Workbook workbook = new Workbook(); workbook.LoadDocument(file); // 3. 匯出資料 int rowNum = 1; string rptName, dataType, ymd; int g, rowNumRPT, found, colNum; #region wf_30051 rptName = "最大交易量及未平倉數"; rptId = "30051"; // 切換Sheet Worksheet ws30050 = workbook.Worksheets[0]; // 讀取並填入資料 for (g = 1; g < 3; g++) { if (g == 1) { dataType = "M"; colNum = 1; } else { dataType = "OI"; colNum = 3; } DataTable dt30051 = dao30050.d_30051(asYmd, dataType); if (dt30051.Rows.Count == 0) { MessageDisplay.Info(txtSDate.Text + "," + rptId + '-' + rptName + ",無任何資料!"); return(ResultStatus.Fail); } dt30051.Filter("RPT_SEQ_NO > 0"); foreach (DataRow dr in dt30051.Rows) { rowNumRPT = dr["RPT_SEQ_NO"].AsInt() - 1; ws30050.Cells[rowNumRPT, colNum].SetValue(dr["AI4_QNTY"]); ymd = dr["AI4_MAX_YMD"].AsString(); ymd = ymd.SubStr(0, 4) + "/" + ymd.SubStr(4, 2) + "/" + ymd.SubStr(6, 2); ws30050.Cells[rowNumRPT, colNum + 1].Value = ymd; } } #endregion rowNum = rowNum + 3; #region wf_30052 string sumType = "", sumSubtype = "", prodType = "", paramKey = ""; rptName = "交易量及未平倉數排序"; rptId = "30052"; /******************* * RPT *******************/ daoRPT = new RPT(); DataTable dtRPT = daoRPT.ListAllByTXD_ID(rptId); if (dtRPT.Rows.Count == 0) { MessageDisplay.Error(rptId + '-' + "RPT無任何資料!"); return(ResultStatus.Fail); } for (g = 1; g < 9; g++) { if (g == 2 || g == 4 || g == 6) { dataType = "OI"; colNum = 3; } else { dataType = "M"; colNum = 1; } switch (g) { case 1: case 2: sumType = "D"; sumSubtype = "1"; prodType = "F%"; paramKey = "%"; break; case 3: case 4: sumType = "D"; sumSubtype = "3"; prodType = "O%"; paramKey = "TXO%"; break; case 5: case 6: sumType = "D"; sumSubtype = "0"; prodType = "%"; paramKey = "%"; break; case 7: sumType = "Y"; sumSubtype = "0"; prodType = "%"; paramKey = "%"; break; case 8: sumType = "M"; sumSubtype = "0"; prodType = "%"; paramKey = "%"; colNum = 3; break; } DataTable dt30052 = dao30050.d_30052(asYmd, sumType, sumSubtype, prodType, paramKey, dataType); if (dt30052.Rows.Count == 0) { return(ResultStatus.Fail); } DataRow[] find = dtRPT.Select("rpt_seq_no=" + g.AsString()); if (find.Length != 0) { found = dtRPT.Rows.IndexOf(find[0]); } else { continue; } rowNum = dtRPT.Rows[found]["RPT_VALUE"].AsString().AsInt() - 1; rowNum = rowNum - 1; foreach (DataRow dr in dt30052.Rows) { rowNum = rowNum + 1; ws30050.Cells[rowNum, colNum].SetValue(dr["AI4_QNTY"]); ymd = dr["AI4_MAX_YMD"].AsString(); if (g == 7) { ymd = ymd; } else if (g == 8) { ymd = ymd.SubStr(0, 4) + "/" + ymd.SubStr(4, 2); } else { ymd = ymd.SubStr(0, 4) + "/" + ymd.SubStr(4, 2) + "/" + ymd.SubStr(6, 2); } ws30050.Cells[rowNum, colNum + 1].Value = ymd; } } // g = 9 DataRow[] findG9 = dtRPT.Select("rpt_seq_no=" + g.AsString()); if (findG9.Length != 0) { found = dtRPT.Rows.IndexOf(findG9[0]); rowNum = dtRPT.Rows[found]["RPT_VALUE"].AsString().AsInt() - 1; ws30050.Cells[rowNum, 1].Value = txtSDate.Text; } #endregion // 4. 存檔 ws30050.ScrollToRow(0); workbook.SaveDocument(file); } catch (Exception ex) { MessageDisplay.Error("輸出錯誤"); throw ex; } return(ResultStatus.Success); }
/// <summary> /// 通用分页过程 by h. /// </summary> /// <param name="Cll"></param> public void Page_list(DataTable Cll) { RPT.DataSource = Cll; RPT.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { RPT.DataSource = senBll.SelTop(); RPT.DataBind(); }
protected void Skey_Btn_Click(object sender, EventArgs e) { RPT.DataBind(); }
protected void Bind(DataTable dt) { RPT.DataSource = dt; RPT.DataBind(); }
protected override ResultStatus Export() { // 1. ue_export_before if (txtEDate.DateTimeValue.Year != txtSDate.DateTimeValue.Year) { MessageDisplay.Error("不可跨年度查詢!"); txtSDate.Focus(); return(ResultStatus.Fail); } // 2. ue_export string rptId = "30030", file; // 2.1 複製檔案 file = PbFunc.wf_copy_file(rptId, rptId); if (file == "") { return(ResultStatus.Fail); } // 2.2 開啟檔案 Workbook workbook = new Workbook(); workbook.LoadDocument(file); flag = 0; // 2.3 匯出Excel int rowKeep, rowNum; rowNum = 1; #region wf_30031 string rptName, kindId; int f, g, colNum, rowTol, found; /************************************* * ls_rpt_name = 報表名稱 * ls_rpt_id = 報表代號 * li_ole_col = Excel的Column位置 * li_ole_row_tol = Excel的Column預留數 * ls_kind_id = param_key *************************************/ rptName = "當年每月日均量統計表"; rptId = "30031"; string symd = txtSDate.Text.Replace("/", "").Trim(); string eymd = txtEDate.Text.Replace("/", "").Trim(); string ymd = ""; // 切換Sheet,總共只有一個sheet Worksheet ws30030 = workbook.Worksheets[0]; // RPT daoRPT = new RPT(); DataTable dtRPT = daoRPT.ListAllByTXD_ID(rptId); if (dtRPT.Rows.Count <= 0) { MessageDisplay.Error(rptId + '-' + "RPT無任何資料!"); //return ResultStatus.Fail; } else { // 讀取資料 dao30030 = new D30030(); DataTable dt30031 = dao30030.d_30031(symd + "01", eymd + "31"); dt30031.Filter("RPT_SEQ_NO > 0"); if (dt30031.Rows.Count <= 0) { MessageDisplay.Info(eymd + "," + rptId + '-' + rptName + ",無任何資料!"); //return ResultStatus.Fail; } else { // 填入資料 rowTol = rowNum + 302; ws30030.Cells[rowTol + 2, 0].Value = txtEDate.Text.SubStr(5, 2) + "月百分比(%)"; string rptType, sumType; rptType = ""; g = 0; for (f = 0; f < dt30031.Rows.Count; f++) { DataRow dr = dt30031.Rows[f]; if (ymd != dr["AI2_YMD"].AsString()) { ymd = dr["AI2_YMD"].AsString(); rowNum = rowNum + 1; ws30030.Cells[rowNum, 0].Value = ymd.SubStr(4, 2) + "/" + ymd.SubStr(6, 2); } kindId = dr["AI2_PARAM_KEY"].AsString(); colNum = dr["RPT_SEQ_NO"].AsInt() - 1; ws30030.Cells[rowNum, colNum].SetValue(dr["AI2_M_QNTY"]); /* 未沖銷量 */ DataRow[] find = dtRPT.Select("rpt_value like 'OI%'"); if (find.Length != 0) { found = dtRPT.Rows.IndexOf(find[0]); } else { found = -1; } if (found >= 0) { found = dtRPT.Rows[found]["RPT_SEQ_NO"].AsInt(); ws30030.Cells[rowNum, found - 1].SetValue(dt30031.Compute("sum(AI2_OI)", $@"AI2_YMD='{ymd}'")); } } ws30030.Cells[rowTol + 1, 0].Value = "合計(" + (txtEDate.DateTimeValue.Year - 1911).AsString() + '/' + txtEDate.DateTimeValue.Month.AsString() + ')'; // 刪除空白列 if (rowTol > rowNum) { ws30030.Rows.Remove(rowNum + 1, rowTol - rowNum); } flag++; } } #endregion rowNum = rowNum + 6; #region wf_30032 rptName = "當年每月日均量統計表"; rptId = "30032"; // 讀取資料 DataTable dt30032 = dao30030.d_30032("M", symd.SubStr(0, 4) + "01", eymd); if (dt30032.Rows.Count == 0) { //PB這邊註解掉 //MessageDisplay.Info(eymd + "," + rptId + '-' + rptName + ",無任何資料!"); //return ResultStatus.Fail; } dt30032.Filter("RPT_SEQ_NO > 0"); /* OI */ DataTable dt30032OI = dao30030.d_30032_OI(symd.SubStr(0, 4) + "01", eymd); if (dt30032OI.Rows.Count == 0) { //PB這邊註解掉 //MessageDisplay.Info(eymd + "," + rptId + '-' + rptName + ",無任何資料!"); //return ResultStatus.Fail; } int colTol = dao30030.colTol() - 1; rowTol = rowNum + 12; //填入資料 int row = 0; ymd = ""; g = 0; found = 0; for (f = 0; f < dt30032.Rows.Count; f++) { DataRow dr = dt30032.Rows[f]; if (ymd != dr["AI2_YMD"].AsString()) { ymd = dr["AI2_YMD"].AsString(); if (ymd == "999999") { row = rowTol + 1; } else { rowNum = rowNum + 1; row = rowNum; ws30030.Cells[row, 0].Value = (ymd.SubStr(0, 4).AsInt() - 1911).AsString() + "/" + ymd.SubStr(4, 2); } /* 未沖銷量 */ if (ymd == "999999") { colNum = dt30032OI.Rows[found]["RPT_SEQ_NO"].AsInt() - 1; decimal sumAI2OI = dt30032OI.Compute("sum(AI2_OI)", "").AsDecimal(); decimal sumAI2DayCount = dt30032OI.Compute("sum(AI2_DAY_COUNT)", "").AsDecimal(); if (sumAI2DayCount == 0) { ws30030.Cells[row, colNum].Value = 0; } else { decimal sumAvgOI = Math.Round(sumAI2OI / sumAI2DayCount, MidpointRounding.AwayFromZero); ws30030.Cells[row, colNum].Value = sumAvgOI; } } else { DataRow[] find = dt30032OI.Select("ai2_ymd ='" + ymd + "'"); if (find.Length != 0) { found = dt30032OI.Rows.IndexOf(find[0]); } else { found = -1; } if (found >= 0) { colNum = dt30032OI.Rows[found]["RPT_SEQ_NO"].AsInt() - 1; decimal AI2OI = dt30032OI.Rows[found]["AI2_OI"].AsDecimal(); decimal AI2DayCount = dt30032OI.Rows[found]["AI2_DAY_COUNT"].AsDecimal(); if (AI2DayCount == 0) { ws30030.Cells[row, colNum].Value = 0; } else { decimal avgOI = Math.Round(AI2OI / AI2DayCount, MidpointRounding.AwayFromZero); ws30030.Cells[row, colNum].Value = avgOI; } } } colNum = colTol; if (colNum > 0) { decimal mQntyYM = dt30032.Compute($@"sum(ai2_m_qnty)", $@"AI2_YMD='{ymd}'").AsDecimal() - dt30032.Compute($@"sum(ai2_m_qnty)", $@"AI2_YMD='{ymd}' and substring(AI2_PARAM_KEY,1,3)='SUM'").AsDecimal(); decimal dayCountYM = dt30032.Compute("max(ai2_day_count)", $@"AI2_YMD='{ymd}'").AsDecimal(); ws30030.Cells[row, colNum].Value = Math.Round(mQntyYM / dayCountYM, MidpointRounding.AwayFromZero); } } kindId = dr["AI2_PARAM_KEY"].AsString(); colNum = dr["RPT_SEQ_NO"].AsInt() - 1; if (kindId == "RHF") { colNum = colNum; } decimal ai2MQnty = dr["AI2_M_QNTY"].AsDecimal(); decimal ai2DayCount = dr["AI2_DAY_COUNT"].AsDecimal(); ws30030.Cells[row, colNum].Value = Math.Round(ai2MQnty / ai2DayCount, MidpointRounding.AwayFromZero); } // 刪除空白列 if (rowTol > rowNum) { ws30030.Rows.Remove(rowNum + 1, rowTol - rowNum); } #endregion rowNum = rowNum + 4; rowKeep = rowNum; #region wf_30033 int dayCount; decimal taifex, tse, sgxDt; rowTol = 0; rptName = "當年每月TAIFEX期貨與TSE成交值之比較表"; rptId = "30033"; // 讀取資料 DataTable dt30033 = dao30030.d_30033(symd.SubStr(0, 4) + "01", eymd); if (dt30033.Rows.Count <= 0) { MessageDisplay.Info(symd.SubStr(0, 4) + "01~" + eymd + "," + rptId + '-' + rptName + ",無任何資料!"); //return ResultStatus.Fail; } else { // 填入資料 rowTol = rowNum + 1 + 11; /* 明細 */ for (f = 0; f < dt30033.Rows.Count; f++) { DataRow dr = dt30033.Rows[f]; rowNum = rowNum + 1; taifex = dr["AA1_TAIFEX"].AsDecimal(); tse = dr["AA1_TSE"].AsDecimal(); sgxDt = dr["AA1_SGX_DT"].AsDecimal(); dayCount = dr["AA1_DAY_COUNT"].AsInt(); ws30030.Cells[rowNum, 0].Value = dr["AA1_YM"].AsString(); ws30030.Cells[rowNum, 1].Value = taifex; ws30030.Cells[rowNum, 2].Value = tse; ws30030.Cells[rowNum, 4].Value = dayCount; } // 刪除空白列 if (rowTol > rowNum) { ws30030.Rows.Remove(rowNum + 1, rowTol - rowNum); } flag++; } #endregion rowTol = rowNum + 1; rowNum = rowKeep; #region wf_30034 string ym; decimal value; rptName = "當年每月TAIFEX期貨與TSE成交值之比較表"; rptId = "30034"; // 讀取資料 // 計算當月最後一日 if (eymd.SubStr(4, 2) == "12") { ym = (eymd.SubStr(0, 4).AsInt() + 1).AsString() + "01"; } else { ym = eymd.SubStr(0, 4) + ("0" + (eymd.SubStr(4, 2).AsInt() + 1).AsString()).PadLeft(3, '0').SubStr(1, 2); } ym = PbFunc.relativedate((ym.SubStr(0, 4) + "/" + ym.SubStr(4, 2) + "/01").AsDateTime("yyyy/MM/dd"), -1).ToString("yyyyMMdd"); DataTable dt30034 = dao30030.d_30034(txtSDate.Text.SubStr(0, 4) + "0101", ym, txtSDate.Text.SubStr(0, 4) + "01", eymd); if (dt30034.Rows.Count <= 0) { MessageDisplay.Info(eymd.SubStr(0, 4) + "0101~" + ym + "," + rptId + '-' + rptName + ",無任何資料!"); //return ResultStatus.Fail; } else { // 每月 for (f = rowNum + 1; f <= rowTol - 1; f++) { ym = ws30030.Cells[f, 0].Value.AsString(); DataRow[] find = dt30034.Select("trim(stw_ymd) ='" + ym + "'"); if (find.Length != 0) { found = dt30034.Rows.IndexOf(find[0]); } else { found = -1; } if (found >= 0) { decimal stwAmt = dt30034.Rows[found]["STW_AMT"].AsDecimal(); decimal aa1UsRate = dt30034.Rows[found]["AA1_US_RATE"].AsDecimal(); decimal stwDays = dt30034.Rows[found]["STW_DAYS"].AsDecimal(); ws30030.Cells[f, 6].Value = stwAmt * aa1UsRate / stwDays / 100000000; } } // 本年度 decimal sumC = dt30034.Compute("sum(cp_c)", "").AsDecimal(); decimal sumStwDays = dt30034.Compute("sum(stw_days)", "").AsDecimal(); value = sumC / sumStwDays / 100000000; ws30030.Cells[rowTol, 6].Value = value; flag++; } #endregion if (flag <= 0) { File.Delete(file); return(ResultStatus.Fail); } else { workbook.SaveDocument(file); return(ResultStatus.Success); } }
protected void Search_Btn_Click1(object sender, EventArgs e) { RPT.DataBind(); }