예제 #1
0
        private void readyDataArray()
        {
            int daysInMonth = DateTime.DaysInMonth(procDate.Year, procDate.Month);

            dayArray   = new DateTime[daysInMonth];
            dowArray   = new int[daysInMonth];
            hdayArray  = new int[daysInMonth];
            workHArray = new decimal[dataGridView1.RowCount, daysInMonth];
            overHArray = new decimal[dataGridView1.RowCount, daysInMonth];
            checkArray = new int[dataGridView1.RowCount, daysInMonth];
            CalendarData cap = new CalendarData();

            procDate.BeginOfMonth();
            for (int i = 0; i < daysInMonth; i++)
            {
                dayArray[i]  = procDate.AddDays(i);
                dowArray[i]  = ( int )dayArray[i].DayOfWeek;
                hdayArray[i] = cap.ExitstenceHoliday(dayArray[i]) ? 1 : 0;
            }

            WorkReportData wrp = new WorkReportData();
            CostData       cdp = new CostData();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                string wkMCode = Convert.ToString(dataGridView1.Rows[i].Cells["MemberCode"].Value);
                cdp = new CostData();
                cdp = cdp.SelectCostMaster(Convert.ToString(dataGridView1.Rows[i].Cells["MemberCode"].Value), Convert.ToString(comboBoxOffice.SelectedValue), "A");

                decimal[] workHour;
                for (int j = 0; j < dayArray.Length; j++)
                {
                    workHour         = wrp.SelectSummaryWorkReport(Convert.ToString(dataGridView1.Rows[i].Cells["MemberCode"].Value), dayArray[j]);
                    workHArray[i, j] = workHour[0];
                    overHArray[i, j] = workHour[1];
                    checkArray[i, j] = ( int )workHour[2];

                    if (cdp != null && cdp.Unit == "時間")
                    {
                        if (workHour[0] > 0)
                        {
                            workHArray[i, j] = workHour[0] / 8;
                        }
                    }
                }
            }

            curNo = 0;
            displayWorkingData(dataGridView1, curNo);
        }