Пример #1
0
        /// <summary>
        /// 按下[讀取/預覽]按鈕時,去資料庫撈資料
        /// </summary>
        /// <returns></returns>
        protected override ResultStatus Retrieve()
        {
            base.Retrieve();

            if (!CheckInputText(txtStartDate.Text) || !CheckInputText(txtEndDate.Text))
            {
                MessageDisplay.Info("請輸入正確日期");
                return(ResultStatus.Fail);
            }

            DataTable dtContent = new DataTable();
            DataTable dtTXFP    = new DataTable();

            dtTXFP = new TXFP().ListDataByKey("POS");
            IGridDataP00xx gridData = daoP00xx.CreateGridData(daoP00xx.GetType(), GetType(), MethodBase.GetCurrentMethod().Name);
            QP00xx         qP00xx   = new QP00xx(txtStartDate.Text, txtEndDate.Text, null, null, null, dtTXFP);

            dtContent         = gridData.GetData(qP00xx);
            gcMain.DataSource = null;
            gvMain.GroupSummary.Clear();
            gvMain.Columns.Clear();//清除grid
            gcMain.DataSource = dtContent;

            foreach (DataColumn dc in dtContent.Columns)
            {
                //設定欄位屬性
                gvMain.SetColumnCaption(dc.ColumnName, GetColumnCaption(dc.Ordinal));
                gvMain.Columns[dc.ColumnName].AppearanceCell.TextOptions.VAlignment = VertAlignment.Top;
                //設定合併欄位(一樣的值不顯示)
                gvMain.Columns[dc.ColumnName].OptionsColumn.AllowMerge = (dc.Ordinal != 0 && dc.Ordinal != 1) ? DefaultBoolean.False : DefaultBoolean.True;
            }

            //設定群組 小記
            gvMain.OptionsView.AllowCellMerge = true;
            gvMain.OptionsCustomization.AllowMergedGrouping = DefaultBoolean.True;
            //設定 平行group
            gvMain.SortInfo.ClearAndAddRange(new[]
                                             { new GridMergedColumnSortInfo(new[] { gvMain.Columns[1], gvMain.Columns[2] },
                                                                            new [] { ColumnSortOrder.Ascending, ColumnSortOrder.Ascending }) }, 2);

            gvMain.SetGridGroupSummary(gvMain.Columns[1].FieldName, "總計{0}", DevExpress.Data.SummaryItemType.Count);

            GridHelper.SetCommonGrid(gvMain);
            gcMain.Visible = true;
            gvMain.OptionsBehavior.AllowFixedGroups = DefaultBoolean.True;
            gvMain.ExpandAllGroups();
            //設定每個column自動擴展
            gvMain.BestFitColumns();
            gcMain.Focus();

            return(ResultStatus.Success);
        }
Пример #2
0
        /// <summary>
        /// 按下[讀取/預覽]按鈕時,去資料庫撈資料
        /// </summary>
        /// <returns></returns>
        protected override ResultStatus Retrieve()
        {
            base.Retrieve();

            if (!CheckInputText(txtStartDate.Text) || !CheckInputText(txtEndDate.Text))
            {
                MessageDisplay.Info("請輸入正確日期");
                return(ResultStatus.Fail);
            }

            DataTable dtContentI          = new DataTable();
            DataTable dtContentF          = new DataTable();
            DataTable dtContent           = new DataTable();
            DataTable dtTXFP              = new DataTable();
            string    type                = ddlbType.EditValue.AsString();
            string    cate                = ddlbCate.EditValue.AsString();
            string    searchType          = ddlbCate.Text.Substring(0, 1);
            string    groupSummaryAccount = "合計{0}戶";
            string    groupSummaryTimes   = "合計{0}次";
            string    summaryAccount      = "總計{0}戶";
            string    summaryTimes        = "總計{0}次";

            dtTXFP = new TXFP().ListDataByKey("POS");
            //取 F 的欄位來給I加總用
            IGridDataP00xx gridData = daoP00xx.CreateGridData(daoP00xx.GetType(), GetType(), MethodBase.GetCurrentMethod().Name);
            QP00xx         qP00xxI  = new QP00xx(txtStartDate.Text, txtEndDate.Text, type, null, "I", dtTXFP);
            QP00xx         qP00xxF  = new QP00xx(txtStartDate.Text, txtEndDate.Text, type, null, "F", dtTXFP);

            dtContentI        = gridData.GetData(qP00xxI);
            dtContentF        = gridData.GetData(qP00xxF);
            gcMain.DataSource = null;
            gvMain.GroupSummary.Clear();
            gvMain.Columns.Clear();//清除grid
            dtContentF.Columns.Remove(dtContentF.Columns["0"]);

            List <string> FcmName = new List <string>();

            foreach (DataRow drI in dtContentI.Rows)
            {
                DataRow drF = dtContentF.Select("FCM_NAME =" + "'" + drI["FCM_NAME"].ToString() + "'")[0];
                if (FcmName.Where(f => f == drI["FCM_NAME"].ToString()).Count() == 0)
                {
                    FcmName.Add(drI["FCM_NAME"].ToString());
                    drI["0"] = drF[2].AsString();
                }
            }

            dtContent         = searchType == "I" ? dtContentI : dtContentF;
            gcMain.DataSource = dtContent;

            foreach (DataColumn dc in dtContent.Columns)
            {
                //設定欄位屬性
                gvMain.SetColumnCaption(dc.ColumnName, GetColumnCaption(dc.Ordinal, searchType));
                gvMain.Columns[dc.ColumnName].AppearanceCell.TextOptions.VAlignment = VertAlignment.Top;
                //設定合併欄位(一樣的值不顯示)
                gvMain.Columns[dc.ColumnName].OptionsColumn.AllowMerge = (dc.Ordinal != 0 && dc.Ordinal != 1) ? DefaultBoolean.False : DefaultBoolean.True;
            }

            gvMain.Columns[1].Group();//依流水號分群

            //依交易人查詢
            if (searchType == "I")
            {
                gvMain.Columns.Last().Visible = false;//隱藏小記欄位
                gvMain.OptionsView.AllowCellMerge = true;
                //設定群組 小記
                gvMain.SetGridGroupSummary(gvMain.Columns[4].FieldName, groupSummaryTimes, SummaryItemType.Sum, true, gvMain.Columns[4].FieldName);
                gvMain.SetGridGroupSummary(gvMain.Columns[5].FieldName, groupSummaryAccount, SummaryItemType.Sum, true, gvMain.Columns[2].FieldName);

                //總計
                gvMain.SetGridSummary(gvMain.Columns[2].FieldName, gvMain.Columns[5].FieldName, summaryAccount, SummaryItemType.Sum);
                gvMain.SetGridSummary(gvMain.Columns[4].FieldName, gvMain.Columns[4].FieldName, summaryTimes, SummaryItemType.Sum);
            }
            else //searchType="F"
            {
                gvMain.OptionsView.AllowCellMerge = false;
                //分群小記
                gvMain.SetGridGroupSummary(gvMain.Columns[2].FieldName, groupSummaryAccount, SummaryItemType.Sum, true, gvMain.Columns[2].FieldName);
                gvMain.SetGridGroupSummary(gvMain.Columns[3].FieldName, groupSummaryTimes, SummaryItemType.Sum, true, gvMain.Columns[3].FieldName);

                //總計
                gvMain.SetGridSummary(gvMain.Columns[2].FieldName, gvMain.Columns[2].FieldName, summaryAccount, SummaryItemType.Sum);
                gvMain.SetGridSummary(gvMain.Columns[3].FieldName, gvMain.Columns[3].FieldName, summaryTimes, SummaryItemType.Sum);
            }

            GridHelper.SetCommonGrid(gvMain);
            gcMain.Visible = true;
            gvMain.OptionsView.ShowFooter           = true;
            gvMain.OptionsBehavior.AllowFixedGroups = DefaultBoolean.True;
            gvMain.ExpandAllGroups();
            //設定每個column自動擴展
            gvMain.BestFitColumns();
            gcMain.Focus();

            return(ResultStatus.Success);
        }
Пример #3
0
        /// <summary>
        /// 按下[讀取/預覽]按鈕時,去資料庫撈資料
        /// </summary>
        /// <returns></returns>
        protected override ResultStatus Retrieve()
        {
            base.Retrieve();

            if (!CheckInputText(txtStartDate.Text) || !CheckInputText(txtEndDate.Text))
            {
                MessageDisplay.Info("請輸入正確日期");
                return(ResultStatus.Fail);
            }

            DataTable dtContent  = new DataTable();
            DataTable dtTXFP     = new DataTable();
            string    type       = ddlbType.EditValue.AsString();
            string    item       = ddlbItem.EditValue.AsString();
            string    cate       = ddlbCate.EditValue.AsString();
            string    searchType = ddlbCate.Text.Substring(0, 1);

            dtTXFP = new TXFP().ListDataByKey("POS");
            IGridDataP00xx gridData = daoP00xx.CreateGridData(daoP00xx.GetType(), GetType(), MethodBase.GetCurrentMethod().Name);
            QP00xx         qP00xx   = new QP00xx(txtStartDate.Text, txtEndDate.Text, type, item, cate, dtTXFP);

            dtContent         = gridData.GetData(qP00xx);
            gcMain.DataSource = null;
            gvMain.GroupSummary.Clear();
            gvMain.Columns.Clear();//清除grid
            gcMain.DataSource = dtContent;

            foreach (DataColumn dc in dtContent.Columns)
            {
                //設定欄位屬性
                gvMain.SetColumnCaption(dc.ColumnName, GetColumnCaption(dc.Ordinal, searchType));
                gvMain.Columns[dc.ColumnName].AppearanceCell.TextOptions.VAlignment = VertAlignment.Top;
                //設定合併欄位(一樣的值不顯示)
                gvMain.Columns[dc.ColumnName].OptionsColumn.AllowMerge = (dc.Ordinal != 0 && dc.Ordinal != 1) ? DefaultBoolean.False : DefaultBoolean.True;
            }

            //依交易人查詢
            if (searchType == "I")
            {
                //設定群組 小記
                gvMain.Columns[1].Group();
                gvMain.OptionsView.AllowCellMerge = true;
                gvMain.OptionsView.ShowFooter     = false;
                gvMain.SetGridGroupSummary(gvMain.Columns[1].FieldName, "合計{0}戶", DevExpress.Data.SummaryItemType.Count);
            }
            else //依期貨商合計
            {
                gvMain.OptionsView.ShowFooter = true;
                gvMain.SetGridSummary(gvMain.Columns.Last().FieldName, gvMain.Columns.Last().FieldName, "總計{0}戶", DevExpress.Data.SummaryItemType.Sum);
            }

            GridHelper.SetCommonGrid(gvMain);
            gcMain.Visible = true;
            gvMain.OptionsBehavior.AllowFixedGroups = DefaultBoolean.True;
            gvMain.ExpandAllGroups();
            //設定每個column自動擴展
            gvMain.BestFitColumns();
            gcMain.Focus();

            return(ResultStatus.Success);
        }
Пример #4
0
        /// <summary>
        /// 按下[讀取/預覽]按鈕時,去資料庫撈資料
        /// </summary>
        /// <returns></returns>
        protected override ResultStatus Retrieve()
        {
            base.Retrieve();
            try {
                DP00xx    daoP00xx = new DP00xx();
                DataTable dt       = new DataTable();
                DataTable dtTXFP   = new DataTable();
                dtTXFP = new TXFP().ListDataByKey("POS");

                IGridDataP00xx gridData = daoP00xx.CreateGridData(daoP00xx.GetType(), GetType(), MethodBase.GetCurrentMethod().Name);
                QP00xx         qP00xx   = new QP00xx(txtFcmNo.Text, txtAccNo.Text, dtTXFP);
                dt = gridData.GetData(qP00xx);
                // dt = new DP0040().SP_QUERY_USER_STATUS(txtFcmNo.Text , txtAccNo.Text , "POS" , dtTXFP);

                //將datatable的Title換掉
                dt.Columns[0].ColumnName = "FCM_NAME";
                dt.Columns[1].ColumnName = "FCM_NO";
                dt.Columns[2].ColumnName = "SEQ_ACC_NO";
                dt.Columns[3].ColumnName = "SYS_TYPE";
                dt.Columns[4].ColumnName = "W_STATUS";
                dt.Columns[5].ColumnName = "APPLY_DATE";
                dt.Columns[6].ColumnName = "LOCK_CNT";

                //dddw_pos_sys_id
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][3].AsString() == "W")
                    {
                        dt.Rows[i][3] = "網際網路";
                    }
                    else if (dt.Rows[i][3].AsString() == "V")
                    {
                        dt.Rows[i][3] = "電話語音";
                    }
                }

                gcMain.DataSource = null;
                gvMain.GroupSummary.Clear();
                gvMain.Columns.Clear();//清除grid
                gcMain.DataSource = dt;

                gcMain.Visible = true;
                gcMain.Focus();

                //David 將第一筆以外的三個欄位都設為空值(仿PB產出結果)
                for (int i = 1; i <= gvMain.RowCount; i++)
                {
                    gvMain.SetRowCellValue(i, "FCM_NAME", "");
                    gvMain.SetRowCellValue(i, "FCM_NO", "");
                    gvMain.SetRowCellValue(i, "SEQ_ACC_NO", "");
                }

                //可測資料
                //S653010 0014735 (W V)
                //F002000 0875493
                //F002000 1003688
                //F002000 1121612
                //F002000 9101809
            } catch (Exception ex) {
                WriteLog(ex);
                return(ResultStatus.Fail);
            }

            return(ResultStatus.Success);
        }