Example #1
0
        protected override ResultStatus Print(ReportHelper reportHelper)
        {
            ShowMsg("列印中...");
            try {
                //ShowFormWait();
                CommonReportLandscapeA4 reportLandscapeA4 = new CommonReportLandscapeA4();
                if (_defReport == null)
                {
                    _defReport = new defReport();
                }
                XtraReport xtraReport    = reportHelper.CreateCompositeReport(_defReport, reportLandscapeA4);
                string     dateCondition = DateText() == "" ? "" : "," + DateText();
                reportHelper.LeftMemo = ConditionText() + dateCondition;
                reportHelper.Create(xtraReport);

                reportHelper.Print(reportHelper.MainReport);
                ShowReport(_defReport);//xtraReport列印後畫面會莫名被清空,所以重新讓它顯示
                //CloseFormWait();
            }
            catch (Exception ex) {
                WriteLog(ex);
                throw ex;
            }
            finally {
                EndExport("列印完成!");
            }

            return(ResultStatus.Success);
        }
Example #2
0
        protected override ResultStatus Print(ReportHelper reportHelper)
        {
            ShowMsg("列印中...");
            try {
                CommonReportPortraitA4 reportPortraitA4 = new CommonReportPortraitA4();
                if (_defReport == null)
                {
                    _defReport = new defReport();
                }

                _defReport.SetMemoInPageFooter("註:★代表收盤前40秒間詢價");
                XtraReport xtraReport    = reportHelper.CreateCompositeReport(_defReport, reportPortraitA4);
                string     dateCondition = DateText() == "" ? "" : "," + DateText();
                reportHelper.LeftMemo = ConditionText() + dateCondition;
                reportHelper.Create(xtraReport);

                reportHelper.Print(reportHelper.MainReport);
                ShowReport(_defReport);
            }
            catch (Exception ex) {
                WriteLog(ex);
                throw ex;
            }
            finally {
                EndExport("列印完成!");
            }

            return(ResultStatus.Success);
        }
Example #3
0
        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);
        }
Example #4
0
        protected override ResultStatus Retrieve()
        {
            documentViewer1.DocumentSource = null;

            try {
                ShowMsg("開始讀取");
                if (!GetData())
                {
                    return(ResultStatus.Fail);
                }

                ShowMsg("資料搜尋...");
                //判斷連續x個月不符造市規定
                DataTable ids = b50032.CompareDataByParallel(_Data, SleCMth.Text);
                _Data = b50032.FilterDataByParallel(_Data, ids);

                ShowMsg("讀取中...");

                List <ReportProp> caption = new List <ReportProp> {
                    new ReportProp {
                        DataColumn = "CP_ROW", Caption = "筆數", CellWidth = 40, DetailRowFontSize = 8, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "AMM0_BRK_NO", Caption = "期貨商        代號", CellWidth = 70, DetailRowFontSize = 10, HeaderFontSize = 11, DataRowMerge = true
                    },
                    new ReportProp {
                        DataColumn = "BRK_ABBR_NAME", Caption = "期貨商名稱", CellWidth = 150, DetailRowFontSize = 9, HeaderFontSize = 11, DataRowMerge = true
                    },
                    new ReportProp {
                        DataColumn = "AMM0_ACC_NO", Caption = "帳號", CellWidth = 60, DetailRowFontSize = 10, HeaderFontSize = 11, DataRowMerge = true
                    },
                    new ReportProp {
                        DataColumn = "AMM0_PROD_ID", Caption = "商品名稱", CellWidth = 80, DetailRowFontSize = 10, HeaderFontSize = 11, DataRowMerge = true
                    },
                    new ReportProp {
                        DataColumn = "AMM0_YMD", Caption = "日期", CellWidth = 65, DetailRowFontSize = 9, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "AMM0_OM_QNTY", Caption = "委託          成交量", CellWidth = 65, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "AMM0_QM_QNTY", Caption = "報價          成交量", CellWidth = 65, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "QNTY", Caption = "造市量", CellWidth = 65, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11,
                        Expression = new DevExpress.XtraReports.UI.ExpressionBinding[] {
                            new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[QNTY]"),
                            new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "BackColor", "Iif ([QNTY] < [MMF_QNTY_LOW], RGB(255,128,255), RGB(255,255,255))")
                        }
                    },
                    new ReportProp {
                        DataColumn = "CP_M_QNTY", Caption = "造市者   總成交量", CellWidth = 75, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "CP_RATE_M", Caption = "總成交量   市佔率(%)", CellWidth = 60, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:##0.0#}", DetailRowFontSize = 10, HeaderFontSize = 8
                    },
                    new ReportProp {
                        DataColumn = "AMM0_VALID_CNT", Caption = "有效報價     筆數", CellWidth = 75, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "VALID_RATE", Caption = "有效報/詢價   比例(%)", CellWidth = 70, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:##0.0#}", DetailRowFontSize = 10, HeaderFontSize = 8,
                        Expression = new DevExpress.XtraReports.UI.ExpressionBinding[] {
                            new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[VALID_RATE]"),
                            new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "BackColor", "Iif ([VALID_RATE] < [MMF_RESP_RATIO], RGB(255,128,255), RGB(255,255,255))")
                        }
                    },
                    new ReportProp {
                        DataColumn = "AMM0_MARKET_R_CNT", Caption = "全市場   詢價筆數", CellWidth = 75, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "AMM0_MARKET_M_QNTY", Caption = "全市場   總成交量", CellWidth = 75, textAlignment = TextAlignment.MiddleRight, TextFormatString = "{0:#,##0}", DetailRowFontSize = 10, HeaderFontSize = 11
                    },
                    new ReportProp {
                        DataColumn = "AMM0_KEEP_FLAG", Caption = "符合報價每日平均維持時間", CellWidth = 55, textAlignment = TextAlignment.MiddleCenter, DetailRowFontSize = 10, HeaderFontSize = 8
                    }
                };
                _defReport = new defReport(_Data, caption);
                ShowReport(_defReport);

                ShowMsg("匯出檔案...");
                string destinationFilePath = Path.Combine(GlobalInfo.DEFAULT_REPORT_DIRECTORY_PATH, "50032.xlsx");
                try {
                    Workbook workbook = new Workbook();
                    workbook.CreateNewDocument();
                    workbook.SaveDocument(destinationFilePath, DocumentFormat.Xlsx);
                    ids.Columns.Remove(ids.Columns["CP_ROW"]);
                    ids.Columns.Remove(ids.Columns["CP_M_QNTY"]);
                    ids.Columns.Remove(ids.Columns["CP_RATE_M"]);
                    ids.Columns.Remove(ids.Columns["CP_INVALID"]);
                    workbook.Worksheets[0].Import(ids, true, 0, 0);
                    workbook.SaveDocument(destinationFilePath);
                }
                catch (Exception ex) {
                    if (File.Exists(destinationFilePath))
                    {
                        File.Delete(destinationFilePath);
                    }
                    throw ex;
                }
            }
            catch (Exception ex) {
                throw ex;
            }
            finally {
                EndExport();
            }

            return(ResultStatus.Success);
        }