protected override ResultStatus Retrieve() { if (gbDetial.EditValue.Equals("rb_detail")) { MessageDisplay.Warning("明細資料僅提供「轉出」CSV檔案,請按轉出功能!"); return(ResultStatus.Fail); } if (!StartRetrieve()) { return(ResultStatus.Fail); } if (!GetData()) { return(ResultStatus.Fail); } List <ReportProp> caption = new List <ReportProp> { new ReportProp { DataColumn = "AMM0_YMD", Caption = "日期", CellWidth = gbDetial.EditValue.Equals("rb_gnodate")?120:65, DetailRowFontSize = gbDetial.EditValue.Equals("rb_gnodate")?8:9, HeaderFontSize = 11 }, new ReportProp { DataColumn = "AMM0_BRK_NO", Caption = "期貨商 代號", CellWidth = 80, DetailRowFontSize = 10, HeaderFontSize = 11 }, new ReportProp { DataColumn = "BRK_ABBR_NAME", Caption = "期貨商名稱", CellWidth = 150, DetailRowFontSize = 9.75f, HeaderFontSize = 11 }, new ReportProp { DataColumn = "AMM0_CNT", Caption = "詢價筆數", CellWidth = gbDetial.EditValue.Equals("rb_gnodate")?90:120, textAlignment = TextAlignment.MiddleRight, DetailRowFontSize = 11, HeaderFontSize = 11 }, new ReportProp { DataColumn = "CP_RATE_VALID_CNT", Caption = "佔全市場 詢價比例(%)", CellWidth = 100, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:##0.0#}", DetailRowFontSize = 11, HeaderFontSize = 11 }, new ReportProp { DataColumn = "AMM0_MARKET_R_CNT", Caption = "全市場 詢價筆數", CellWidth = 120, textAlignment = TextAlignment.MiddleRight, DetailRowFontSize = 11, HeaderFontSize = 11 } }; //商品名稱會根據列印順序有所不同 ReportProp productName = new ReportProp { DataColumn = "AMM0_PROD_ID", Caption = "商品名稱", CellWidth = 120, DetailRowFontSize = 11, HeaderFontSize = 11 }; if (_D500Xx.SortType == "P") { caption.Insert(1, productName);//選擇商品,商品名稱會位於第二欄 } else { caption.Insert(3, productName);//選擇造勢者,商品名稱會位於第四欄 } _defReport = new defReport(_Data, caption); ShowReport(_defReport); //WriteLog("查詢資料 " + _D500Xx.LogText, "query", "R"); return(ResultStatus.Success); }
protected override ResultStatus Retrieve() { if (gbReportType.EditValue.Equals("rb_date")) { string lsRtn = PbFunc.f_get_jsw_seq(_ProgramID, "E", 0, emEndDate.DateTimeValue, gbMarket.EditValue.Equals("rb_market_1") ? "1" : "0"); if (lsRtn != "") { DialogResult ChooseResult = MessageDisplay.Choose(emEndDate.Text + " 統計資料未轉入完畢,是否要繼續?" + Environment.NewLine + lsRtn); if (ChooseResult == DialogResult.No) { stMsgTxt.Visible = false; return(ResultStatus.Fail); } } } if (!StartRetrieve()) { return(ResultStatus.Fail); } if (!GetData()) { return(ResultStatus.Fail); } if (gbDetial.EditValue.Equals("rb_gdate")) { decimal TotR = 0, TotM = 0, llR = 0, llM = 0; string lsProdId = "", lsYMD = ""; foreach (DataRow dr in _Data.Rows) { if (lsProdId != dr["AMM0_PROD_ID"].AsString() || lsYMD != dr["AMM0_YMD"].AsString()) { llR = dr["AMM0_MARKET_R_CNT"].AsDecimal(); llM = dr["AMM0_MARKET_M_QNTY"].AsDecimal(); TotR = TotR + llR; TotM = TotM + llM; lsProdId = dr["AMM0_PROD_ID"].AsString(); lsYMD = dr["AMM0_YMD"].AsString(); } else { //當遇到造市者沒有足月時,造成總計不同 //皆以最大值為全市場值 if (llR < dr["AMM0_MARKET_R_CNT"].AsDecimal() || llM < dr["AMM0_MARKET_M_QNTY"].AsDecimal()) { TotR = TotR - llR; TotM = TotM - llM; llR = dr["AMM0_MARKET_R_CNT"].AsDecimal(); llM = dr["AMM0_MARKET_M_QNTY"].AsDecimal(); TotR = TotR + llR; TotM = TotM + llM; } } }//foreach (DataRow dr in dt.Rows) _Data.Rows[0]["TOT_R"] = TotR; _Data.Rows[0]["TOT_M"] = TotM; } documentViewer1.DocumentSource = null; //報表內容選擇分日期 if (gbDetial.EditValue.Equals("rb_gdate")) { _RW50030 = new RW50030(); _RW50030.DataSource = _Data; _RW50030.SetSortType(_D500Xx.SortType); _Report = _RW50030; } else { List <ReportProp> caption = new List <ReportProp> { new ReportProp { DataColumn = "CP_ROW", Caption = "筆數", CellWidth = 45, Expression = new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[DataSource.CurrentRowIndex]+1") } }, new ReportProp { DataColumn = "AMM0_YMD", Caption = "日期", CellWidth = gbDetial.EditValue.Equals("rb_gnodate")?110:50, DetailRowFontSize = 8.25f }, new ReportProp { DataColumn = "AMM0_BRK_NO", Caption = "期貨商代號", CellWidth = 57 }, new ReportProp { DataColumn = "BRK_ABBR_NAME", Caption = "期貨商名稱", CellWidth = 150, Expression = new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[BRK_ABBR_NAME]"), new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Font.Size", "Iif ( len(trim([BRK_ABBR_NAME]) ) >8.25 , 9, 9.75)") } }, new ReportProp { DataColumn = "AMM0_ACC_NO", Caption = "投資人帳號", CellWidth = 53 }, new ReportProp { DataColumn = "AMM0_OM_QNTY", Caption = "一般委託成交量", CellWidth = 65, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", HeaderFontSize = 9 }, new ReportProp { DataColumn = "AMM0_QM_QNTY", Caption = "報價成交量", CellWidth = 65, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}" }, new ReportProp { DataColumn = "AMM0_BTRADE_M_QNTY", Caption = "鉅額交易成交量", CellWidth = 70, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", HeaderFontSize = 9 }, new ReportProp { DataColumn = "CP_M_QNTY", Caption = "造市者總成交量", CellWidth = 70, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}" }, new ReportProp { DataColumn = "CP_RATE_M", Caption = "總成交量市佔率(%)", CellWidth = 55, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:##0.0#}", HeaderFontSize = 8f }, new ReportProp { DataColumn = "AMM0_VALID_CNT", Caption = "有效報價筆數", CellWidth = 60, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", HeaderFontSize = 8f }, new ReportProp { DataColumn = "AMM0_MARKET_R_CNT", Caption = "全市場詢價筆數", CellWidth = 70, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}" }, new ReportProp { DataColumn = "AMM0_MARKET_M_QNTY", Caption = "全市場總成交量", CellWidth = 70, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}" }, new ReportProp { DataColumn = "CP_KEEP_TIME", Caption = "累計維持時間(分)", CellWidth = 65, textAlignment = TextAlignment.MiddleRight } }; //商品名稱會根據列印順序有所不同 ReportProp productName = new ReportProp { DataColumn = "AMM0_PROD_ID", Caption = "商品名稱", CellWidth = 100 }; if (_D500Xx.SortType == "P") { caption.Insert(2, productName);//選擇商品,商品名稱會位於第三欄 } else { caption.Insert(5, productName);//選擇造勢者,商品名稱會位於第六欄 } _Report = new defReport(_Data, caption); } ShowReport(_Report); _ToolBtnPrintAll.Enabled = true; _ToolBtnExport.Enabled = true; return(ResultStatus.Success); }