protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.AddExportColumn("產線");
            profile.AddExportColumn("實際完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            //profile.AddExportColumn("退驗數量");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("單位");
            profile.AddExportColumn("內部工時").Name  = "內部實際總工時";
            profile.AddExportColumn("實際總工時").Name = "實際總工時\n(內+外)";
            profile.AddExportColumn("標準總工時");
            profile.AddExportColumn("標準總工資");
            profile.AddExportColumn("生產效率").Name = "標準總工時/\n實際總工時";
            profile.AddExportColumn("標準工時").Name = "單位標準工時\n(Hour/Kpcs)";
            profile.AddExportColumn("實際工時").Name = "單位實際工時\n(Hour/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.AddExportColumn("���u");
            profile.AddExportColumn("��ڧ�����");
            profile.AddExportColumn("�u�@�渹");
            profile.AddExportColumn("�Ǹ�");
            profile.AddExportColumn("�~��");
            profile.AddExportColumn("�~�W");
            //profile.AddExportColumn("�h��ƶq");
            profile.AddExportColumn("�ƶq");
            profile.AddExportColumn("���");
            profile.AddExportColumn("�����u��").Name = "��������`�u��";
            profile.AddExportColumn("����`�u��").Name = "����`�u��\n(��+�~)";
            profile.AddExportColumn("��`�u��");
            profile.AddExportColumn("��`�u��");
            profile.AddExportColumn("�Ͳ��IJv").Name = "�з��`�u��/\n����`�u��";
            profile.AddExportColumn("�зǤu��").Name = "���зǤu��\n(Hour/Kpcs)";
            profile.AddExportColumn("��ڤu��").Name = "����ڤu��\n(Hour/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("�u�@�渹") + 1).EntireColumn.NumberFormat = "@";
        }
Beispiel #3
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            //foreach (DataColumn column in _table.Columns)
            //    profile.AddExportColumn(column);

            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("單位");
            profile.AddExportColumn("標準工時").Name             = "標準總工時";
            profile.AddExportColumn("標準單位工資").Name           = "標準總工資";
            profile.AddExportColumn("實際工時(內+外)").Name        = "實際總工時(內+外)";
            profile.AddExportColumn("實際工資(內+外)").Name        = "實際總工資(內+外)";
            profile.AddExportColumn("系統時薪").Name             = "系統時薪\n(NT$/Hour)";
            profile.AddExportColumn("單位標準工資").Name           = "標準單位工資\n(NT$/Kpcs)";
            profile.AddExportColumn("實際單位工資(NT$/Kpcs)").Name = "實際單位工資\n(NT$/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            base.WriteColumnHeader();
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            //profile.ExcludeExportColumn(new List<DataColumn>(new DataColumn[]{_table.Columns["工品編號"]}));

            profile.AddExportColumn("產線");
            profile.AddExportColumn("單據日期");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("已生產數量").Name = "完成數量";
            profile.AddExportColumn("未完成數量").Name = "待製數量";
            profile.AddExportColumn("待驗數量");
            profile.AddExportColumn("退驗數量");

            profile.AddExportColumn("單位");
            profile.AddExportColumn("標準工時").Name   = "標準工時\n(Hour/Kpcs)";
            profile.AddExportColumn("單位人工成本").Name = "報價時薪\n(NT$/Hour)";
            profile.AddExportColumn("總標準工時");
            profile.AddExportColumn("內部工時");
            profile.AddExportColumn("內部工資");
            profile.AddExportColumn("外包工時");
            profile.AddExportColumn("外包工資");

            profile.AddExportColumn("完成%");
            profile.AddExportColumn("生產效率").Name = "已發生標準總工時/\n已發生實際總工時";
            profile.AddExportColumn("尚需工時").Name = "尚需標準工時";

            //profile.ColumnMap[_table.Columns["數量"]].Name = "數量";
            //profile.ColumnMap[_table.Columns["標準工時"]].Name = "標準工時\n(Hour/Kpcs)";
            //profile.ColumnMap[_table.Columns["單位人工成本"]].Name = "系統時薪\n(NT$/Hour)";
            //profile.ColumnMap[_table.Columns["生產效率"]].Name = "實際總工時/\n標準總工時";
            //profile.ColumnMap[_table.Columns["尚需工時"]].Name = "尚需標準工時";

            //profile.ColumnMap[_table.Columns["內部工時"]].Name = "內部工時\n(Hour/Kpcs)";
            //profile.ColumnMap[_table.Columns["內部工資"]].Name = "內部工資\n(NT$/Kpcs)";
            //profile.ColumnMap[_table.Columns["外包工資"]].Name = "外包工資\n(NT$/Kpcs)";
            //profile.ColumnMap[_table.Columns["外包工時"]].Name = "外包工時\n(Hour/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";


            base.WriteColumnHeader();
        }
Beispiel #5
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            //profile.ExcludeExportColumn(new List<DataColumn>(new DataColumn[] { _table.Columns["工品編號"] }));
            //foreach (DataColumn column in _table.Columns)

            profile.AddExportColumn("產線");
            profile.AddExportColumn("實際完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            //profile.AddExportColumn("退驗數量");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("單位");
            profile.AddExportColumn("內部工時");
            profile.AddExportColumn("內部工資");
            profile.AddExportColumn("外包工時");
            profile.AddExportColumn("外包工資");
            profile.AddExportColumn("實際總工時");
            profile.AddExportColumn("標準總工時");
            profile.AddExportColumn("實際總工資");
            profile.AddExportColumn("標準總工資");
            profile.AddExportColumn("生產效率");
            profile.AddExportColumn("標準工時");
            profile.AddExportColumn("單位人工成本");
            profile.AddExportColumn("單位標準工資");
            profile.AddExportColumn("實際工時");
            profile.AddExportColumn("實際工資");

            profile.ColumnMap[_table.Columns["內部工時"]].Name   = "內部實際總工時";
            profile.ColumnMap[_table.Columns["內部工資"]].Name   = "內部實際總工資";
            profile.ColumnMap[_table.Columns["外包工資"]].Name   = "外包實際總工資";
            profile.ColumnMap[_table.Columns["外包工時"]].Name   = "外包實際總工時";
            profile.ColumnMap[_table.Columns["標準工時"]].Name   = "單位標準工時\n(Hour/Kpcs)";
            profile.ColumnMap[_table.Columns["單位人工成本"]].Name = "報價時薪\n(NT$/Hour)";
            profile.ColumnMap[_table.Columns["單位標準工資"]].Name = "單位標準工資\n(NT$/Kpcs)";
            profile.ColumnMap[_table.Columns["生產效率"]].Name   = "標準總工時/\n實際總工時";
            profile.ColumnMap[_table.Columns["實際總工時"]].Name  = "實際總工時\n(內+外)";
            profile.ColumnMap[_table.Columns["實際總工資"]].Name  = "實際總工資\n(內+外)";
            profile.ColumnMap[_table.Columns["標準總工資"]].Name  = "報價總工資";
            profile.ColumnMap[_table.Columns["實際工時"]].Name   = "單位實際工時\n(Hour/Kpcs)";
            profile.ColumnMap[_table.Columns["實際工資"]].Name   = "單位實際工資\n(NT$/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";

            base.WriteColumnHeader();
        }
        protected override void AfterContentWritten()
        {
            ReportSourceProfile profile = this.SheetAdapter.ReportProfile;

            //設定顯示格式
            this.SheetAdapter.SetFormat(4, profile.IndexOf("退驗數量") + 1, "[紅色]G/通用格式;G/通用格式;* \"-\"_-");

            this.SheetAdapter.SetFormat(3, profile.IndexOf("待驗數量") + 1, "[=0]* \"-\"_-;G/通用格式");
            this.SheetAdapter.SetFormat(3, profile.IndexOf("已生產數量") + 1, "[=0]* \"-\"_-;G/通用格式");

            this.SheetAdapter.SetFormat(3, profile.IndexOf("完成%") + 1, "0.00%");
            this.SheetAdapter.SetFormat(3, profile.IndexOf("生產效率") + 1, "0.00%");

            //設定小數位數
            int[] formatCols = new int[]
            {
                profile.IndexOf("總標準工時") + 1,
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("單位人工成本") + 1,
                profile.IndexOf("內部工時") + 1,
                profile.IndexOf("內部工資") + 1,
                profile.IndexOf("外包工資") + 1,
                profile.IndexOf("外包工時") + 1,
                profile.IndexOf("尚需工時") + 1
            };

            foreach (int col in formatCols)
            {
                this.SheetAdapter.SetFormat(3, col, "[=0]* \"-\"_-;G/通用格式");
            }

            this.SheetAdapter.RoundValues(formatCols, 3, 2);

            //設定外觀樣式
            Range range;

            range = this.SheetAdapter.GetUsedRange(3);
            range.Columns.AutoFit();

            this.SheetAdapter.GetRange(1, profile.IndexOf("單位人工成本") + 1).EntireColumn.ColumnWidth = 15;
            this.SheetAdapter.GetRange(1, profile.IndexOf("標準工時") + 1).EntireColumn.ColumnWidth   = 12;
            this.SheetAdapter.GetRange(1, profile.IndexOf("生產效率") + 1).EntireColumn.ColumnWidth   = 18.25;

            range = this.SheetAdapter.GetUsedRange(3);
            this.SheetAdapter.SetBorder(range, true, true, true, true);

            range = this.SheetAdapter.GetRange(4, 1);
            range.Select();
            this.Application.ActiveWindow.FreezePanes = true;

            base.AfterContentWritten();
        }
Beispiel #7
0
        protected override void BeforeExport()
        {
            // Create table
            CreateReportTable();

            // Set the profile
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.ColumnHeaderHAlign = XlHAlign.xlHAlignCenter;
            profile.ColumnHeaderBold   = false;
            profile.ColumnHeaderHGrid  = true;
            profile.ColumnHeaderVGrid  = true;
            profile.HorizontalGrid     = true;
            profile.VerticalGrid       = true;

            profile.AddExportColumn("品號", "品 號");
            profile.AddExportColumn("內容", "內 容");
            profile.AddExportColumn("數量", "數 量");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("備註", "備 註");

            this.SheetAdapter.ReportProfile = profile;
            // *****

            // Get data from db
            OleDbConnection conn         = DbConnection.Instance;
            ConnectionState oriConnState = conn.State;

            if ((conn.State & ConnectionState.Open) != ConnectionState.Open)
            {
                conn.Open();
            }

            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = conn;
            cmd.CommandText = "SELECT 品號, 客戶 AS 內容, 數量, 預計完成日 " +
                              "FROM 工作單 AS A INNER JOIN 工作單品號 AS B ON A.單號 = B.單號 WHERE A.單號 = '" + _worksheetNo + "'";
            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);

            adapter.Fill(_table);

            if (oriConnState == ConnectionState.Closed)
            {
                conn.Close();
            }
            // *****

            base.BeforeExport();
        }
Beispiel #8
0
        protected override void WriteColumnHeader()
        {
            // Create profile
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            List <DataColumn>   exclude = new List <DataColumn>();

            exclude.Add(_table.Columns["借入"]);
            profile.ExcludeExportColumn(exclude);
            this.SheetAdapter.ReportProfile = profile;
            // *****

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            base.WriteColumnHeader();
        }
        protected override void AfterContentWritten()
        {
            //base.AfterContentWritten();

            ReportSourceProfile profile = this.SheetAdapter.ReportProfile;

            //設定顯示格式
            this.SheetAdapter.SetFormat(4, profile.IndexOf("退驗數量") + 1, "[紅色]G/通用格式;G/通用格式;* \"-\"_-");

            this.SheetAdapter.SetFormat(3, profile.IndexOf("待驗數量") + 1, "[=0]* \"-\"_-;G/通用格式");
            this.SheetAdapter.SetFormat(3, profile.IndexOf("已生產數量") + 1, "[=0]* \"-\"_-;G/通用格式");

            this.SheetAdapter.SetFormat(3, profile.IndexOf("完成%") + 1, "0.00%");
            this.SheetAdapter.SetFormat(3, profile.IndexOf("生產效率") + 1, "0.00%");

            //設定小數位數
            int[] formatCols = new int[]
            {
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("內部工時") + 1,
                profile.IndexOf("外包工時") + 1,
                profile.IndexOf("尚需工時") + 1
            };

            foreach (int col in formatCols)
            {
                this.SheetAdapter.SetFormat(3, col, "[=0]* \"-\"_-;G/通用格式");
            }

            this.SheetAdapter.RoundValues(formatCols, 3, 2);

            //設定外觀樣式
            Range range;

            range = this.SheetAdapter.GetUsedRange(3);
            range.Columns.AutoFit();

            this.SheetAdapter.GetRange(1, profile.IndexOf("標準工時") + 1).ColumnWidth = 12;
            this.SheetAdapter.GetRange(1, profile.IndexOf("生產效率") + 1).ColumnWidth = 12;

            range = this.SheetAdapter.GetUsedRange(3);
            this.SheetAdapter.SetBorder(range, true, true, true, true);
        }
        protected override void AfterContentWritten()
        {
            //base.AfterContentWritten();

            ReportSourceProfile profile = this.SheetAdapter.ReportProfile;

            //this.SheetAdapter.SetFormat(4, profile.IndexOf("退驗數量") + 1, "[紅色]G/通用格式;G/通用格式;* \"-\"_-");
            //this.SheetAdapter.SetFormat(4, profile.IndexOf("工作單號") + 1, "0");
            this.SheetAdapter.SetFormat(4, profile.IndexOf("生產效率") + 1, "0.00%");


            //設定小數位數
            int[] formatCols = new int[]
            {
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("內部工時") + 1,
                profile.IndexOf("實際工時") + 1,
                profile.IndexOf("實際總工時") + 1,
                profile.IndexOf("標準總工時") + 1,
                profile.IndexOf("標準總工資") + 1
            };

            foreach (int col in formatCols)
            {
                this.SheetAdapter.SetFormat(4, col, "[=0]* \"-\"_-;G/通用格式");
            }

            this.SheetAdapter.RoundValues(formatCols, 4, 2);

            Range range;

            range = this.SheetAdapter.GetRange(3, 1, this.SheetAdapter.UsedRowsCount, _table.Columns.IndexOf("內部工時") + 1);
            range.Columns.AutoFit();

            for (int i = 0; i < 6; i++)
            {
                this.SheetAdapter.GetRange(1, profile.IndexOf("實際總工時") + i + 1).ColumnWidth = 13.5;
            }

            range = this.SheetAdapter.GetUsedRange(3);
            this.SheetAdapter.SetBorder(range, true, true, true, true);
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.AddExportColumn("產線");
            profile.AddExportColumn("單據日期");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("已生產數量").Name = "完成數量";
            profile.AddExportColumn("未完成數量").Name = "待製數量";
            profile.AddExportColumn("待驗數量");
            profile.AddExportColumn("退驗數量");

            profile.AddExportColumn("單位");
            profile.AddExportColumn("標準工時").Name = "標準工時\n(Hour/Kpcs)";
            //profile.AddExportColumn("單位人工成本").Name = "系統時薪\n(NT$/Hour)";
            profile.AddExportColumn("總標準工時");
            profile.AddExportColumn("內部工時");
            //profile.AddExportColumn("內部工資");
            profile.AddExportColumn("外包工時");
            //profile.AddExportColumn("外包工資");

            profile.AddExportColumn("完成%");
            profile.AddExportColumn("生產效率").Name = "標準總工時/\n實際總工時";
            profile.AddExportColumn("尚需工時").Name = "尚需標準工時";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.AddExportColumn("產線");
            profile.AddExportColumn("單據日期");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("已生產數量").Name = "完成數量";
            profile.AddExportColumn("未完成數量").Name = "待製數量";
            profile.AddExportColumn("待驗數量");
            profile.AddExportColumn("退驗數量");

            profile.AddExportColumn("單位");
            profile.AddExportColumn("標準工時").Name = "標準工時\n(Hour/Kpcs)";
            //profile.AddExportColumn("單位人工成本").Name = "系統時薪\n(NT$/Hour)";
            profile.AddExportColumn("總標準工時");
            profile.AddExportColumn("內部工時");
            //profile.AddExportColumn("內部工資");
            profile.AddExportColumn("外包工時");
            //profile.AddExportColumn("外包工資");

            profile.AddExportColumn("完成%");
            profile.AddExportColumn("生產效率").Name = "標準總工時/\n實際總工時";
            profile.AddExportColumn("尚需工時").Name = "尚需標準工時";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";
        }
Beispiel #13
0
        protected override void AfterContentWritten()
        {
            ReportSourceProfile profile = this.SheetAdapter.ReportProfile;

            //設定顯示格式

            //設定小數位數
            int[] formatCols = new int[]
            {
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("標準單位工資") + 1,
                profile.IndexOf("實際工時(內+外)") + 1,
                profile.IndexOf("實際工資(內+外)") + 1,
                profile.IndexOf("實際單位工資(NT$/Kpcs)") + 1,
            };

            foreach (int col in formatCols)
            {
                this.SheetAdapter.SetFormat(4, col, "[=0]* \"-\"_-;G/通用格式");
            }

            this.SheetAdapter.RoundValues(formatCols, 4, 2);

            //設定外觀樣式
            Range reportBodyRange = this.SheetAdapter.GetUsedRange(3);

            reportBodyRange.Columns.AutoFit();

            this.SheetAdapter.GetRange(1, profile.IndexOf("系統時薪") + 1).ColumnWidth             = 12.5;
            this.SheetAdapter.GetRange(1, profile.IndexOf("單位標準工資") + 1).ColumnWidth           = 15;
            this.SheetAdapter.GetRange(1, profile.IndexOf("實際單位工資(NT$/Kpcs)") + 1).ColumnWidth = 15;

            this.SheetAdapter.SetBorder(reportBodyRange, XlLineStyle.xlContinuous, XlBorderWeight.xlThin, true, true, true, true);

            base.AfterContentWritten();
        }
Beispiel #14
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            //foreach (DataColumn column in _table.Columns)
            //    profile.AddExportColumn(column);

            profile.AddExportColumn("�~��");
            profile.AddExportColumn("�~�W");
            profile.AddExportColumn("�ƶq");
            profile.AddExportColumn("���");
            profile.AddExportColumn("�зǤu��").Name = "�з��`�u��";
            profile.AddExportColumn("�зdz��u��").Name = "�з��`�u��";
            profile.AddExportColumn("��ڤu��(��+�~)").Name = "����`�u��(��+�~)";
            profile.AddExportColumn("��ڤu��(��+�~)").Name = "����`�u��(��+�~)";
            profile.AddExportColumn("�t���~").Name = "�t���~\n(NT$/Hour)";
            profile.AddExportColumn("���зǤu��").Name = "�зdz��u��\n(NT$/Kpcs)";
            profile.AddExportColumn("��ڳ��u��(NT$/Kpcs)").Name = "��ڳ��u��\n(NT$/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            base.WriteColumnHeader();
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            //profile.ExcludeExportColumn(new List<DataColumn>(new DataColumn[]{_table.Columns["工品編號"]}));

            profile.AddExportColumn("產線");
            profile.AddExportColumn("單據日期");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("工作單號");
            profile.AddExportColumn("序號");
            profile.AddExportColumn("品號");
            profile.AddExportColumn("品名");
            profile.AddExportColumn("數量");
            profile.AddExportColumn("已生產數量").Name = "完成數量";
            profile.AddExportColumn("未完成數量").Name = "待製數量";
            profile.AddExportColumn("待驗數量");
            profile.AddExportColumn("退驗數量");

            profile.AddExportColumn("單位");
            profile.AddExportColumn("標準工時").Name = "標準工時\n(Hour/Kpcs)";
            profile.AddExportColumn("單位人工成本").Name = "報價時薪\n(NT$/Hour)";
            profile.AddExportColumn("總標準工時");
            profile.AddExportColumn("內部工時");
            profile.AddExportColumn("內部工資");
            profile.AddExportColumn("外包工時");
            profile.AddExportColumn("外包工資");

            profile.AddExportColumn("完成%");
            profile.AddExportColumn("生產效率").Name = "已發生標準總工時/\n已發生實際總工時";
            profile.AddExportColumn("尚需工時").Name = "尚需標準工時";

            //profile.ColumnMap[_table.Columns["數量"]].Name = "數量";
            //profile.ColumnMap[_table.Columns["標準工時"]].Name = "標準工時\n(Hour/Kpcs)";
            //profile.ColumnMap[_table.Columns["單位人工成本"]].Name = "系統時薪\n(NT$/Hour)";
            //profile.ColumnMap[_table.Columns["生產效率"]].Name = "實際總工時/\n標準總工時";
            //profile.ColumnMap[_table.Columns["尚需工時"]].Name = "尚需標準工時";

            //profile.ColumnMap[_table.Columns["內部工時"]].Name = "內部工時\n(Hour/Kpcs)";
            //profile.ColumnMap[_table.Columns["內部工資"]].Name = "內部工資\n(NT$/Kpcs)";
            //profile.ColumnMap[_table.Columns["外包工資"]].Name = "外包工資\n(NT$/Kpcs)";
            //profile.ColumnMap[_table.Columns["外包工時"]].Name = "外包工時\n(Hour/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";

            base.WriteColumnHeader();
        }
Beispiel #16
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile();
            profile.VerticalGrid = true;
            profile.ColumnHeaderVGrid = true;
            profile.HorizontalGrid = true;
            this.SheetAdapters[0].ReportProfile = profile;

            if (_form.InspeceMode == InspeceMode.ByPn)
            {
                _columnHdrRow++;

                profile.Table = _groupTable;

                profile.AddExportColumn("������").Name = "�̫�����\n�������";
                profile.AddExportColumn("���u");
                profile.AddExportColumn("�u�@�渹");
                profile.AddExportColumn("�~��").Name = "�Ƹ�";
                profile.AddExportColumn("�Ȥ�W��");
                profile.AddExportColumn("�`�ƶq").Name = "�u�@��\n�`�ƶq";
                //profile.AddExportColumn("�e�˦���");
                profile.AddExportColumn("OkNum").Name = "����OK\n�`�ƶq";
                profile.AddExportColumn("Total").Name = "�`����";
                profile.ColumnMap[_groupTable.Columns["Total"]].MergeSpan = 5;
                profile.ColumnMap[_groupTable.Columns["Total"]].MergeTitle = "QC# ���窬�A";

                profile.AddExportColumn("OK").Name = "OK����";
                profile.AddExportColumn("ReOK").Name = "����OK\n����";
                profile.AddExportColumn("Concession").Name = "�S��OK\n����";
                profile.AddExportColumn("NG").Name = "NG����";
                profile.AddExportColumn("QCN").Name = "QC#�J��";
                //profile.AddExportColumn("���窬�A");
                profile.AddExportColumn("�~��i��").Name = "�~��i��\n�J��";
                profile.AddExportColumn("Remark");

                this.SheetAdapters[0].PasteColumns(_groupTable, _columnHdrRow, 1);
            }
            else
            {
                profile.Table = _table;

                //profile.ExcludeExportColumn(new List<DataColumn>(
                //    new DataColumn[] { _table.Columns["�u�ɸ�ƽs��"], _table.Columns["�̫�e�˽s��"], _table.Columns["�̫��������"], _table.Columns["�u�~�s��"] }));
                //profile.ColumnMap[_table.Columns["�~��"]].Name = "�Ƹ�";
                //profile.ColumnMap[_table.Columns["QCN"]].Name = "QC#";

                profile.AddExportColumn("������");
                profile.AddExportColumn("���u");
                profile.AddExportColumn("�u�@�渹");
                profile.AddExportColumn("�~��").Name = "�Ƹ�";
                profile.AddExportColumn("�Ȥ�W��");
                profile.AddExportColumn("����ƶq");
                profile.AddExportColumn("�e�˦���");
                profile.AddExportColumn("QCN").Name = "QC#";
                profile.AddExportColumn("���窬�A");
                profile.AddExportColumn("�~��i��");
                profile.AddExportColumn("Remark");

                this.SheetAdapters[0].PasteColumns(_table, _columnHdrRow, 1);
            }

            if (_form.OutputStatistic)
            {
                profile = new ReportSourceProfile(_statisticTable);

                profile.AddExportColumn("���u");
                profile.AddExportColumn("�J�w�`���").Name = "�J�w�`���\n(by QC#)";
                profile.AddExportColumn("�e���`����");
                profile.AddExportColumn("�X��v");

                profile.VerticalGrid = true;
                profile.ColumnHeaderVGrid = true;
                profile.HorizontalGrid = true;

                this.SheetAdapters[1].ReportProfile = profile;
                this.SheetAdapters[1].PasteColumns(_statisticTable, _columnHdrRow, 1);
            }

            base.WriteColumnHeader();
        }
Beispiel #17
0
        protected override void BeforeExport()
        {
            // Create table
            CreateReportTable();

            // Set the profile
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            profile.ColumnHeaderHAlign = XlHAlign.xlHAlignCenter;
            profile.ColumnHeaderBold = false;
            profile.ColumnHeaderHGrid = true;
            profile.ColumnHeaderVGrid = true;
            profile.HorizontalGrid = true;
            profile.VerticalGrid = true;

            profile.AddExportColumn("品號", "品 號");
            profile.AddExportColumn("內容", "內 容");
            profile.AddExportColumn("數量", "數 量");
            profile.AddExportColumn("預計完成日");
            profile.AddExportColumn("備註", "備 註");

            this.SheetAdapter.ReportProfile = profile;
            // *****

            // Get data from db
            OleDbConnection conn = DbConnection.Instance;
            ConnectionState oriConnState = conn.State;
            if ((conn.State & ConnectionState.Open) != ConnectionState.Open)
                conn.Open();

            OleDbCommand cmd = new OleDbCommand();
            cmd.Connection = conn;
            cmd.CommandText = "SELECT 品號, 客戶 AS 內容, 數量, 預計完成日 "+
                                "FROM 工作單 AS A INNER JOIN 工作單品號 AS B ON A.單號 = B.單號 WHERE A.單號 = '" + _worksheetNo + "'";
            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(_table);

            if (oriConnState == ConnectionState.Closed)
                conn.Close();
            // *****

            base.BeforeExport();
        }
Beispiel #18
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile();

            profile.VerticalGrid                = true;
            profile.ColumnHeaderVGrid           = true;
            profile.HorizontalGrid              = true;
            this.SheetAdapters[0].ReportProfile = profile;

            if (_form.InspeceMode == InspeceMode.ByPn)
            {
                _columnHdrRow++;

                profile.Table = _groupTable;

                profile.AddExportColumn("檢驗日期").Name = "最後檢驗\n完成日期";
                profile.AddExportColumn("產線");
                profile.AddExportColumn("工作單號");
                profile.AddExportColumn("品號").Name = "料號";
                profile.AddExportColumn("客戶名稱");
                profile.AddExportColumn("總數量").Name = "工作單\n總數量";
                //profile.AddExportColumn("送檢次數");
                profile.AddExportColumn("OkNum").Name = "檢驗OK\n總數量";
                profile.AddExportColumn("Total").Name = "總筆數";
                profile.ColumnMap[_groupTable.Columns["Total"]].MergeSpan  = 5;
                profile.ColumnMap[_groupTable.Columns["Total"]].MergeTitle = "QC# 檢驗狀態";

                profile.AddExportColumn("OK").Name         = "OK筆數";
                profile.AddExportColumn("ReOK").Name       = "重檢OK\n筆數";
                profile.AddExportColumn("Concession").Name = "特採OK\n筆數";
                profile.AddExportColumn("NG").Name         = "NG筆數";
                profile.AddExportColumn("QCN").Name        = "QC#彙整";
                //profile.AddExportColumn("檢驗狀態");
                profile.AddExportColumn("品質履歷").Name = "品質履歷\n彙整";
                profile.AddExportColumn("Remark");

                this.SheetAdapters[0].PasteColumns(_groupTable, _columnHdrRow, 1);
            }
            else
            {
                profile.Table = _table;

                //profile.ExcludeExportColumn(new List<DataColumn>(
                //    new DataColumn[] { _table.Columns["工時資料編號"], _table.Columns["最後送檢編號"], _table.Columns["最後檢驗紀錄"], _table.Columns["工品編號"] }));
                //profile.ColumnMap[_table.Columns["品號"]].Name = "料號";
                //profile.ColumnMap[_table.Columns["QCN"]].Name = "QC#";

                profile.AddExportColumn("檢驗日期");
                profile.AddExportColumn("產線");
                profile.AddExportColumn("工作單號");
                profile.AddExportColumn("品號").Name = "料號";
                profile.AddExportColumn("客戶名稱");
                profile.AddExportColumn("檢驗數量");
                profile.AddExportColumn("送檢次數");
                profile.AddExportColumn("QCN").Name = "QC#";
                profile.AddExportColumn("檢驗狀態");
                profile.AddExportColumn("品質履歷");
                profile.AddExportColumn("Remark");

                this.SheetAdapters[0].PasteColumns(_table, _columnHdrRow, 1);
            }

            if (_form.OutputStatistic)
            {
                profile = new ReportSourceProfile(_statisticTable);

                profile.AddExportColumn("產線");
                profile.AddExportColumn("入庫總批數").Name = "入庫總批數\n(by QC#)";
                profile.AddExportColumn("送檢總次數");
                profile.AddExportColumn("合格率");

                profile.VerticalGrid      = true;
                profile.ColumnHeaderVGrid = true;
                profile.HorizontalGrid    = true;

                this.SheetAdapters[1].ReportProfile = profile;
                this.SheetAdapters[1].PasteColumns(_statisticTable, _columnHdrRow, 1);
            }

            base.WriteColumnHeader();
        }
Beispiel #19
0
        protected override void AfterContentWritten()
        {
            ReportSourceProfile profile = this.SheetAdapters[0].ReportProfile;

            //設定顯示格式
            this.SheetAdapters[0].SetFormat(_columnHdrRow, profile.IndexOf("工作單號") + 1, "0");
            if (_form.InspeceMode == InspeceMode.ByQcNo)
            {
                this.SheetAdapters[0].SetFormat(_columnHdrRow, profile.IndexOf("QCN") + 1, "@");
            }

            Range range;

            range = this.SheetAdapters[0].GetUsedRange(_columnHdrRow);
            this.SheetAdapters[0].SetBorder(range, true, true, true, true);

            range = this.SheetAdapters[0].GetRange(_columnHdrRow + 1, 1);
            range.Select();
            this.Application.ActiveWindow.FreezePanes = true;

            //抬頭
            range = this.SheetAdapters[0].GetRange(1, 1, 1, this.SheetAdapters[0].UsedColumnsCount);
            this.SheetAdapters[0].SetBorder(range, false, true, false, false);

            range           = this.SheetAdapters[0].GetRange(1, 1);
            range.Font.Size = 18;
            range.Font.Bold = true;

            //欄位抬頭
            if (_form.InspeceMode == InspeceMode.ByPn)
            {
                for (int i = 0; i < profile.Columns.Count; i++)
                {
                    ReportColumn rptCol = profile.Columns[i];
                    if (rptCol.MergeSpan == 0)
                    {
                        range = this.SheetAdapters[0].GetRange(_columnHdrRow - 1, rptCol.Index + 1, _columnHdrRow, rptCol.Index + 1);
                        range.Merge(Missing);
                    }
                    else
                    {
                        range = this.SheetAdapters[0].GetRange(_columnHdrRow - 1, rptCol.Index + 1, _columnHdrRow - 1, rptCol.Index + rptCol.MergeSpan);
                        range.Merge(Missing);

                        range           = this.SheetAdapters[0].GetRange(_columnHdrRow - 1, rptCol.Index + 1, _columnHdrRow - 1, rptCol.Index + 1);
                        range.Value2    = rptCol.MergeTitle;
                        range.Font.Bold = true;

                        i += rptCol.MergeSpan - 1;
                    }
                }
                range = this.SheetAdapters[0].GetRange(_columnHdrRow - 1, 1, _columnHdrRow, this.SheetAdapters[0].UsedColumnsCount);
                range.Interior.Color = 13434828;
                //range.AutoFilter(1, Missing, XlAutoFilterOperator.xlAnd, Missing, true);
                range.HorizontalAlignment = XlHAlign.xlHAlignCenter;
                this.SheetAdapters[0].SetBorder(range, true, true, true, true);
                this.SheetAdapters[0].SetBorder(range, XlBordersIndex.xlInsideHorizontal);
                this.SheetAdapters[0].SetBorder(range, XlBordersIndex.xlInsideVertical);
            }
            else
            {
                range = this.SheetAdapters[0].GetRange(_columnHdrRow, 1, _columnHdrRow, this.SheetAdapters[0].UsedColumnsCount);
                range.Interior.Color      = 13434828;
                range.HorizontalAlignment = XlHAlign.xlHAlignCenter;
            }

            //產線欄
            range = this.SheetAdapters[0].GetRange(_columnHdrRow + 1, profile.IndexOf("產線") + 1, this.SheetAdapters[0].UsedRowsCount, profile.IndexOf("產線") + 1);
            range.HorizontalAlignment = XlHAlign.xlHAlignCenter;

            //隱藏格線
            this.Application.ActiveWindow.DisplayGridlines = false;

            //顯示總筆數
            range = this.SheetAdapters[0].GetRange(this.SheetAdapters[0].UsedRowsCount + 2, 1);
            int count = _form.InspeceMode == InspeceMode.ByPn ? _groupTable.Rows.Count : _table.Rows.Count;

            range.Value2    = "共 " + count + " 筆";
            range.Font.Bold = true;

            this.Sheets[0].UsedRange.Font.Name = "Arial";

            //品質履歷欄
            if (_table.Rows.Count > 0)
            {
                range            = this.SheetAdapters[0].GetRange(_columnHdrRow + 1, profile.IndexOf("品質履歷") + 1, this.SheetAdapters[0].UsedRowsCount, profile.IndexOf("品質履歷") + 1);
                range.Font.Color = 255;
                //range.Font.Bold = true;
            }

            // Inser方法會在Excel2003失敗 所以採取迂迴方法達成(??)
            //this.SheetAdapters[0].Worksheet.UsedRange.Cut(Missing);
            //this.SheetAdapters[0].GetRange(1, this.SheetAdapters[0].Worksheet.UsedRange.Columns.Count + 2).Select();
            //this.SheetAdapters[0].Worksheet.Paste(Missing, Missing);

            //((Range)this.Application.Selection).Cut(Missing);
            //this.SheetAdapters[0].GetRange(1, 2).Select();
            //this.SheetAdapters[0].Worksheet.Paste(Missing, Missing);

            //調整欄寬
            range = this.SheetAdapters[0].GetRange(_form.InspeceMode == InspeceMode.ByPn ? _columnHdrRow - 1 : _columnHdrRow, 1, this.SheetAdapters[0].UsedRowsCount, this.SheetAdapters[0].UsedColumnsCount);
            range.Columns.AutoFit();

            if (_form.InspeceMode == InspeceMode.ByPn)
            {
                for (int i = 0; i < 5; i++)
                {
                    this.SheetAdapters[0].GetRange(1, profile.IndexOf("Total") + 1 + i).ColumnWidth = 8.5;
                }

                range = this.SheetAdapters[0].GetRange(1, profile.IndexOf("品質履歷") + 1);
                if ((double)range.ColumnWidth < 10)
                {
                    range.ColumnWidth = 10;
                }
            }

            //欄位自動篩選
            //range = this.SheetAdapters[0].GetRange(_columnHdrRow, 2, _columnHdrRow, this.SheetAdapters[0].UsedColumnsCount).EntireRow;
            range = this.SheetAdapters[0].GetRange(_columnHdrRow, 1, this.SheetAdapters[0].UsedRowsCount - 2, this.SheetAdapters[0].UsedColumnsCount);
            range.AutoFilter(1, Missing, XlAutoFilterOperator.xlAnd, Missing, true);

            //插入空白行
            this.SheetAdapters[0].GetRange(1, 1).EntireColumn.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);



            ////調整欄寬
            //range = this.SheetAdapters[0].GetRange(_form.InspeceMode == InspeceMode.ByPn ? _columnHdrRow - 1 : _columnHdrRow, 1, this.SheetAdapters[0].UsedRowsCount, this.SheetAdapters[0].UsedColumnsCount);
            //range.Columns.AutoFit();

            //if (_form.InspeceMode == InspeceMode.ByPn)
            //{
            //    for (int i = 0; i < 5; i++)
            //        this.SheetAdapters[0].GetRange(1, profile.IndexOf("Total") + 2 + i).ColumnWidth = 8.5;

            //    range = this.SheetAdapters[0].GetRange(1, profile.IndexOf("品質履歷") + 2);
            //    if ((double)range.ColumnWidth < 10)
            //        range.ColumnWidth = 10;
            //}

            ////欄位自動篩選
            ////range = this.SheetAdapters[0].GetRange(_columnHdrRow, 2, _columnHdrRow, this.SheetAdapters[0].UsedColumnsCount).EntireRow;
            //range = this.SheetAdapters[0].GetRange(_columnHdrRow, 1, this.SheetAdapters[0].UsedRowsCount - 2, this.SheetAdapters[0].UsedColumnsCount);
            //range.AutoFilter(1, Missing, XlAutoFilterOperator.xlAnd, Missing, true);

            this.SheetAdapters[0].GetRange(1, 1).EntireColumn.ColumnWidth        = 4;
            this.SheetAdapters[0].GetRange(_columnHdrRow, 1).EntireRow.RowHeight = 40;

            if (_form.OutputStatistic)
            {
                profile = this.SheetAdapters[1].ReportProfile;

                //抬頭
                range           = this.SheetAdapters[1].GetRange(1, 1).EntireRow;
                range.Font.Size = 18;
                range.Font.Bold = true;

                //欄位抬頭
                range = this.SheetAdapters[1].GetRange(_columnHdrRow, 1, _columnHdrRow, this.SheetAdapters[1].UsedColumnsCount);
                range.Interior.Color = 16777164;
                //range.AutoFilter(1, Missing, XlAutoFilterOperator.xlAnd, Missing, true);
                range.HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //產線欄
                range = this.SheetAdapters[1].GetRange(_columnHdrRow + 1, profile.IndexOf("產線") + 1, this.SheetAdapters[1].UsedRowsCount, profile.IndexOf("產線") + 1);
                range.HorizontalAlignment = XlHAlign.xlHAlignCenter;

                //字體顏色
                range            = this.SheetAdapters[1].GetRange(_columnHdrRow, 1, this.SheetAdapters[1].UsedRowsCount - 1, this.SheetAdapters[1].UsedColumnsCount);
                range.Font.Color = 16711680;

                //總和行
                if (_table.Rows.Count > 0)
                {
                    range                = this.SheetAdapters[1].GetRange(this.SheetAdapters[1].UsedRowsCount, 1, this.SheetAdapters[1].UsedRowsCount, this.SheetAdapters[1].UsedColumnsCount);
                    range.Font.Bold      = true;
                    range.Font.Color     = 255;
                    range.Interior.Color = 65535;
                }

                //資料格式
                this.SheetAdapters[1].SetFormat(_columnHdrRow, profile.IndexOf("合格率") + 1, "0.00%");

                this.Sheets[1].UsedRange.Font.Name = "Arial";



                // Inser方法會在Excel2003失敗 所以採取迂迴方法達成
                //this.SheetAdapters[1].Worksheet.Select(Missing);
                //this.SheetAdapters[1].Worksheet.UsedRange.Cut(Missing);
                //this.SheetAdapters[1].GetRange(1, this.SheetAdapters[1].Worksheet.UsedRange.Columns.Count + 2).Select();
                //this.SheetAdapters[1].Worksheet.Paste(Missing, Missing);

                //((Range)this.Application.Selection).Cut(Missing);
                //this.SheetAdapters[1].GetRange(1, 2).Select();
                //this.SheetAdapters[1].Worksheet.Paste(Missing, Missing);



                //欄位自動篩選
                range = this.SheetAdapters[1].GetRange(_columnHdrRow, 1, this.SheetAdapters[1].UsedRowsCount - 1, this.SheetAdapters[1].UsedColumnsCount);
                //range = this.SheetAdapters[1].GetRange(_columnHdrRow, 2, _columnHdrRow, this.SheetAdapters[1].UsedColumnsCount);
                range.AutoFilter(1, Missing, XlAutoFilterOperator.xlAnd, Missing, true);

                //調整欄寬
                range = this.SheetAdapters[1].GetRange(_columnHdrRow, 1, this.SheetAdapters[1].UsedRowsCount, this.SheetAdapters[1].UsedColumnsCount);
                range.Columns.AutoFit();

                this.SheetAdapters[1].GetRange(1, 1).EntireColumn.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);
                this.SheetAdapters[1].GetRange(1, 1).EntireColumn.ColumnWidth = 4;

                this.SheetAdapters[1].Worksheet.Select(Missing);
                this.SheetAdapters[1].Worksheet.Name = "Statistic";

                this.Application.ActiveWindow.DisplayGridlines = false;
            }

            this.SheetAdapters[0].Worksheet.Select(Missing);
            this.SheetAdapters[0].Worksheet.Name = "Report";

            base.AfterContentWritten();
        }
Beispiel #20
0
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);

            profile.AddExportColumn("編號");
            profile.AddExportColumn("借入產線");
            profile.AddExportColumn("員工編號");
            profile.AddExportColumn("員工姓名");
            profile.AddExportColumn("日期");
            profile.AddExportColumn("工作單號");
            if(_table.Columns.Contains("品號"))
                profile.AddExportColumn("品號");
            profile.AddExportColumn("非生產名稱").Name = "非生產";
            profile.AddExportColumn("工時");
            profile.AddExportColumn("數量").Name = "完成";
            if (_table.Columns.Contains("待驗數量"))
                profile.AddExportColumn("待驗數量");
            profile.AddExportColumn("備註");

            this.SheetAdapter.GetRange(1, profile.IndexOf("工作單號") + 1).EntireColumn.NumberFormat = "@";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, _columnHeaderRow, 1);
            base.WriteColumnHeader();
        }
Beispiel #21
0
        protected override void BeforeExport()
        {
            // Create table
            CreateReportTable();

            // Get data form db
            OleDbConnection conn = DbConnection.Instance;
            ConnectionState oriConnState = conn.State;
            if ((conn.State & ConnectionState.Open) != ConnectionState.Open)
                conn.Open();

            OleDbCommand cmd = new OleDbCommand();
            cmd.Connection = conn;
            cmd.CommandText = "SELECT 單據日期, A.單號 as 工作單號, 客戶, 品號, 數量, 預計完成日, B.實際完成日, B.編號 as 序號 " +
                                "FROM 工作單 as A INNER JOIN 工作單品號 as B on A.單號 = B.單號";

            string whereTxt = null;
            if(_worksheetNo != null)
            {
                whereTxt = "A.單號 = ?";
                cmd.Parameters.Add(new OleDbParameter("單號", _worksheetNo));
            }
            else if (_useDate)
            {
                whereTxt = "A.單據日期 >= #" + _startDate.ToString("yyyy/MM/dd") + "# AND A.單據日期 <= #" + _endDate.ToString("yyyy/MM/dd") + "#";
            }

            if (whereTxt != null)
                cmd.CommandText += " WHERE " + whereTxt;

            cmd.CommandText += " ORDER by A.單號, B.編號, B.品號";

            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(_table);

            // Fill the serial number ( 1.08.6 below only)
            /*
            string currentSheet = null;
            int sn = 1;
            foreach (DataRow row in _table.Rows)
            {
                string sheet = (string)row["工作單號"];
                if (sheet != currentSheet)
                {
                    currentSheet = sheet;
                    sn = 1;
                }
                row["序號"] = sn++;
            }
            */

            if (oriConnState == ConnectionState.Closed)
                conn.Close();
            // *****

            // Create profile
            ReportSourceProfile profile = new ReportSourceProfile();
            profile.ColumnHeaderHGrid = true;

            base.BeforeExport();
        }
        protected override void WriteColumnHeader()
        {
            // Create profile
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            List<DataColumn> exclude = new List<DataColumn>();
            exclude.Add(_table.Columns["�ɤJ"]);
            profile.ExcludeExportColumn(exclude);
            this.SheetAdapter.ReportProfile = profile;
            // *****

            this.SheetAdapter.PasteColumns(_table, 3, 1);

            base.WriteColumnHeader();
        }
        protected override void WriteColumnHeader()
        {
            ReportSourceProfile profile = new ReportSourceProfile(_table);
            //profile.ExcludeExportColumn(new List<DataColumn>(new DataColumn[] { _table.Columns["�u�~�s��"] }));
            //foreach (DataColumn column in _table.Columns)

            profile.AddExportColumn("���u");
            profile.AddExportColumn("��ڧ�����");
            profile.AddExportColumn("�u�@�渹");
            profile.AddExportColumn("�Ǹ�");
            profile.AddExportColumn("�~��");
            profile.AddExportColumn("�~�W");
            //profile.AddExportColumn("�h��ƶq");
            profile.AddExportColumn("�ƶq");
            profile.AddExportColumn("���");
            profile.AddExportColumn("�����u��");
            profile.AddExportColumn("�����u��");
            profile.AddExportColumn("�~�]�u��");
            profile.AddExportColumn("�~�]�u��");
            profile.AddExportColumn("����`�u��");
            profile.AddExportColumn("��`�u��");
            profile.AddExportColumn("����`�u��");
            profile.AddExportColumn("��`�u��");
            profile.AddExportColumn("�Ͳ��IJv");
            profile.AddExportColumn("�зǤu��");
            profile.AddExportColumn("���H�u����");
            profile.AddExportColumn("���зǤu��");
            profile.AddExportColumn("��ڤu��");
            profile.AddExportColumn("��ڤu��");

            profile.ColumnMap[_table.Columns["�����u��"]].Name = "��������`�u��";
            profile.ColumnMap[_table.Columns["�����u��"]].Name = "��������`�u��";
            profile.ColumnMap[_table.Columns["�~�]�u��"]].Name = "�~�]����`�u��";
            profile.ColumnMap[_table.Columns["�~�]�u��"]].Name = "�~�]����`�u��";
            profile.ColumnMap[_table.Columns["�зǤu��"]].Name = "���зǤu��\n(Hour/Kpcs)";
            profile.ColumnMap[_table.Columns["���H�u����"]].Name = "�������~\n(NT$/Hour)";
            profile.ColumnMap[_table.Columns["���зǤu��"]].Name = "���зǤu��\n(NT$/Kpcs)";
            profile.ColumnMap[_table.Columns["�Ͳ��IJv"]].Name = "�з��`�u��/\n����`�u��";
            profile.ColumnMap[_table.Columns["����`�u��"]].Name = "����`�u��\n(��+�~)";
            profile.ColumnMap[_table.Columns["����`�u��"]].Name = "����`�u��\n(��+�~)";
            profile.ColumnMap[_table.Columns["��`�u��"]].Name = "�����`�u��";
            profile.ColumnMap[_table.Columns["��ڤu��"]].Name = "����ڤu��\n(Hour/Kpcs)";
            profile.ColumnMap[_table.Columns["��ڤu��"]].Name = "����ڤu��\n(NT$/Kpcs)";

            this.SheetAdapter.ReportProfile = profile;
            this.SheetAdapter.PasteColumns(_table, 3, 1);

            Application.ErrorCheckingOptions.NumberAsText = false;
            this.SheetAdapter.GetRange(4, profile.IndexOf("�u�@�渹") + 1).EntireColumn.NumberFormat = "@";

            base.WriteColumnHeader();
        }
Beispiel #24
0
        protected override void AfterContentWritten()
        {
            ReportSourceProfile profile = this.SheetAdapter.ReportProfile;

            //設定顯示格式
            //this.SheetAdapter.SetFormat(4, profile.IndexOf("退驗數量") + 1, "[紅色]G/通用格式;G/通用格式;* \"-\"_-");
            //string format = "#,##0.00;#,##0.00;* \"-\"_-";
            //string format = "G/通用格式;G/通用格式;* \"-\"_-";

            this.SheetAdapter.SetFormat(4, profile.IndexOf("生產效率") + 1, "0.00%");

            //設定小數位數
            int[] formatCols = new int[]
            {
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("單位人工成本") + 1,
                profile.IndexOf("標準總工時") + 1,
                profile.IndexOf("標準總工資") + 1,
                profile.IndexOf("單位標準工資") + 1,
                profile.IndexOf("內部工時") + 1,
                profile.IndexOf("內部工資") + 1,
                profile.IndexOf("外包工資") + 1,
                profile.IndexOf("外包工時") + 1,
                profile.IndexOf("實際工時") + 1,
                profile.IndexOf("實際工資") + 1,
                profile.IndexOf("實際總工時") + 1,
                profile.IndexOf("實際總工資") + 1
            };

            foreach (int col in formatCols)
            {
                this.SheetAdapter.SetFormat(4, col, "[=0]* \"-\"_-;G/通用格式");
            }

            formatCols = new int[]
            {
                profile.IndexOf("標準工時") + 1,
                profile.IndexOf("單位人工成本") + 1,
                profile.IndexOf("標準總工時") + 1,
                profile.IndexOf("標準總工資") + 1,
                profile.IndexOf("單位標準工資") + 1,
                profile.IndexOf("內部工時") + 1,
                profile.IndexOf("內部工資") + 1,
                profile.IndexOf("外包工資") + 1,
                profile.IndexOf("外包工時") + 1,
                profile.IndexOf("實際工時") + 1,
                profile.IndexOf("實際工資") + 1,
                profile.IndexOf("實際總工資") + 1
            };
            this.SheetAdapter.RoundValues(formatCols, 4, 2);

            //移動欄位
            //this.SheetAdapter.GetRange(1, 14, 1, 15).EntireColumn.Cut(Missing);
            //this.SheetAdapter.GetRange(1, 21).EntireColumn.Insert(XlInsertShiftDirection.xlShiftToRight, Missing);

            //設定外觀樣式
            Range range;

            for (int i = 0; i < 4; i++)
            {
                this.SheetAdapter.GetRange(1, profile.IndexOf("內部工時") + 1 + i).ColumnWidth = 15.5;
            }
            for (int i = 0; i < 10; i++)
            {
                this.SheetAdapter.GetRange(1, profile.IndexOf("實際總工時") + 1 + i).ColumnWidth = 13.5;
            }

            //this.SheetAdapter.GetRange(1, _table.Columns.IndexOf("單位人工成本") + 1).ColumnWidth = 15;
            range = this.SheetAdapter.GetRange(3, 1, this.SheetAdapter.UsedRowsCount, profile.IndexOf("單位") + 1);
            range.Columns.AutoFit();

            range = this.SheetAdapter.GetUsedRange(3);
            this.SheetAdapter.SetBorder(range, true, true, true, true);

            //設定小計總計列公式
            int    subttlCol             = this.SheetAdapter.ReportProfile.IndexOf("實際總工時") + 1;
            string subttlColLetter       = BookLib.GetColumnLetter(subttlCol);
            int    subttlEffectCol       = this.SheetAdapter.ReportProfile.IndexOf("生產效率") + 1;
            string subttlEffectColLetter = BookLib.GetColumnLetter(subttlEffectCol);
            string ttlFormula            = "=";

            foreach (int subttlRow in _subttlRows)
            {
                Range subttlCell = this.SheetAdapter.GetRange(subttlRow, subttlCol);
                subttlCell.Formula        = "= " + subttlCell.Value + " + " + subttlColLetter + (subttlRow - 1) + " + " + subttlColLetter + (subttlRow - 2);
                subttlCell.Interior.Color = 65535;
                //更改 標準總工時/實際總工時
                Range subttlEffectCell = this.SheetAdapter.GetRange(subttlRow, subttlEffectCol);
                subttlEffectCell.Formula = "=" + BookLib.GetColumnLetter(this.SheetAdapter.ReportProfile.IndexOf("標準總工時") + 1) + subttlRow + "/"
                                           + subttlColLetter + subttlRow;

                ttlFormula += subttlColLetter + (subttlRow) + "+";
            }
            ttlFormula = ttlFormula.Substring(0, ttlFormula.Length - 1);

            //總計列公式
            Range ttlCell = this.SheetAdapter.GetRange(_ttlRow, subttlCol);

            ttlCell.Formula        = ttlFormula;
            ttlCell.Interior.Color = 65535;

            //更改 標準總工時/實際總工時
            Range ttlEffectCell = this.SheetAdapter.GetRange(_ttlRow, subttlEffectCol);

            ttlEffectCell.Formula = "=" + BookLib.GetColumnLetter(this.SheetAdapter.ReportProfile.IndexOf("標準總工時") + 1) + _ttlRow + "/"
                                    + subttlColLetter + _ttlRow;

            range = this.SheetAdapter.GetRange(4, 1);
            range.Select();
            this.Application.ActiveWindow.FreezePanes = true;

            base.AfterContentWritten();
        }