Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void miNendoSelect_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(InputNendo));
 }
Пример #2
0
 private void btnExcel_Click(object sender, EventArgs e)
 {
     Static.ExcelOutput(Static.ShiwakeDs.KeihiSum.TableName);
 }
Пример #3
0
 /// <summary>
 /// 経費入力
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void miShiwakeInput_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(InputKeihi));
 }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void miKotsuhiBatch_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(BatchKotsuhi));
 }
Пример #5
0
 private void miYokinSuitocho_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(ViewYokinSuitocho));
 }
Пример #6
0
 private void miZandakaNyuryoku_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(InputKurikoshi));
 }
Пример #7
0
 private void 資産照会ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(ViewShisan));
 }
Пример #8
0
        /// <summary>
        /// CSV出力する
        /// </summary>
        /// <param name="isYayoi">弥生か?</param>
        private void OutputCSV(ClickType clickType)
        {
            if (IsOutput() == false)
            {
                return;
            }

            var date = new DateTime(Static.Nendo, 1, 1);
            var sb   = new System.Text.StringBuilder();

            if (rdoHoliday.Checked)
            {
                while (Static.Nendo == date.Year)
                {
                    // 土曜日、日曜日、祝日を出力
                    int week = (int)date.DayOfWeek;
                    if (!Static.HolidayList.Any(x => x.Date == date) && !(week == 0 || week == 6))
                    {
                        date = date.AddDays(1);
                        continue;
                    }

                    if (clickType == ClickType.YayoiCsv)
                    {
                        // 弥生で取込めるフォーマット
                        sb.AppendLine(CreateYayoiCSV(date));
                    }
                    else if (clickType == ClickType.Csv)
                    {
                        // 日付,科目,補助科目,金額,摘要
                        sb.AppendLine(CreateCSV(date));
                    }
                    else
                    {
                        // 経費を足す
                        AddShiwake(date);
                    }

                    date = date.AddDays(1);
                }
            }
            else if (rdoYobi.Checked)
            {
                bool isChecked = false;
                foreach (Control ctl in grpYobi.Controls)
                {
                    if (ctl is CheckBox)
                    {
                        if ((ctl as CheckBox).Checked)
                        {
                            isChecked = true;
                            break;
                        }
                    }
                }

                if (!isChecked)
                {
                    MessageBox.Show("曜日が1つも指定されていません。曜日を指定してください。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                while (Static.Nendo == date.Year)
                {
                    if ((chkYobiNichi.Checked && date.DayOfWeek == DayOfWeek.Sunday) ||
                        (chkYobiGetsu.Checked && date.DayOfWeek == DayOfWeek.Monday) ||
                        (chkYobiKa.Checked && date.DayOfWeek == DayOfWeek.Tuesday) ||
                        (chkYobiSui.Checked && date.DayOfWeek == DayOfWeek.Wednesday) ||
                        (chkYobiMoku.Checked && date.DayOfWeek == DayOfWeek.Thursday) ||
                        (chkYobiKin.Checked && date.DayOfWeek == DayOfWeek.Friday) ||
                        ((chkYobiDo.Checked && date.DayOfWeek == DayOfWeek.Saturday)))
                    {
                        if (clickType == ClickType.YayoiCsv)
                        {
                            // 弥生で取込めるフォーマット
                            sb.AppendLine(CreateYayoiCSV(date));
                        }
                        else if (clickType == ClickType.Csv)
                        {
                            // 日付,科目,補助科目,金額,摘要
                            sb.AppendLine(CreateCSV(date));
                        }
                        else
                        {
                            // 経費を足す
                            AddShiwake(date);
                        }
                    }

                    date = date.AddDays(1);
                }
            }
            else if (rdoTsuki.Checked)
            {
                bool isChecked = false;
                foreach (Control ctl in grpTsuki.Controls)
                {
                    if (ctl is CheckBox)
                    {
                        if ((ctl as CheckBox).Checked)
                        {
                            isChecked = true;
                            break;
                        }
                    }
                }

                if (!isChecked)
                {
                    MessageBox.Show("月が1つも指定されていません。月を指定してください。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                while (Static.Nendo == date.Year)
                {
                    // 土曜日、日曜日、祝日は読み飛ばし
                    if (Static.HolidayList.Any(x => x.Date == date))
                    {
                        date = date.AddDays(1);
                        continue;
                    }

                    // 土日も外す
                    int week = (int)date.DayOfWeek;
                    if (week == 0 || week == 6)
                    {
                        date = date.AddDays(1);
                        continue;
                    }

                    if ((chkTsuki01.Checked && date.Month == 1) ||
                        (chkTsuki02.Checked && date.Month == 2) ||
                        (chkTsuki03.Checked && date.Month == 3) ||
                        (chkTsuki04.Checked && date.Month == 4) ||
                        (chkTsuki05.Checked && date.Month == 5) ||
                        (chkTsuki06.Checked && date.Month == 6) ||
                        (chkTsuki07.Checked && date.Month == 7) ||
                        (chkTsuki08.Checked && date.Month == 8) ||
                        (chkTsuki09.Checked && date.Month == 9) ||
                        (chkTsuki10.Checked && date.Month == 10) ||
                        (chkTsuki11.Checked && date.Month == 11) ||
                        (chkTsuki12.Checked && date.Month == 12))
                    {
                        if (clickType == ClickType.YayoiCsv)
                        {
                            // 弥生で取込めるフォーマット
                            sb.AppendLine(CreateYayoiCSV(date));
                        }
                        else if (clickType == ClickType.Csv)
                        {
                            // 日付,科目,補助科目,金額,摘要
                            sb.AppendLine(CreateCSV(date));
                        }
                        else
                        {
                            // 経費を足す
                            AddShiwake(date);
                        }
                    }

                    date = date.AddDays(1);
                }
            }
            else
            {
                while (Static.Nendo == date.Year)
                {
                    if (rdoNormal.Checked)
                    {
                        // 休日は除外
                        if (Static.HolidayList.Any(x => x.Date == date))
                        {
                            date = date.AddDays(1);
                            continue;
                        }

                        // 土日も外す
                        int week = (int)date.DayOfWeek;
                        if (week == 0 || week == 6)
                        {
                            date = date.AddDays(1);
                            continue;
                        }
                    }

                    if (clickType == ClickType.YayoiCsv)
                    {
                        // 弥生で取込めるフォーマット
                        sb.AppendLine(CreateYayoiCSV(date));
                    }
                    else if (clickType == ClickType.Csv)
                    {
                        // 日付,科目,補助科目,金額,摘要
                        sb.AppendLine(CreateCSV(date));
                    }
                    else
                    {
                        // 経費を足す
                        AddShiwake(date);
                    }

                    date = date.AddDays(1);
                }
            }

            if (clickType != ClickType.Shiwake)
            {
                if (IsSaveFile(sb.ToString(), clickType == ClickType.YayoiCsv) == true)
                {
                    MessageBox.Show("CSV出力しました。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("経費に追加しました。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Static.SaveShiwakeXML();
            }
        }
Пример #9
0
 private void miYayoiCsvImportAppend_Click(object sender, EventArgs e)
 {
     Static.AddShiwakeFromCSV(true);
 }
Пример #10
0
 private void MDIParent_FormClosed(object sender, FormClosedEventArgs e)
 {
     Static.WriteNendo();
 }
Пример #11
0
 private void miInputUriage_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(InputUriage));
 }
Пример #12
0
 private void miViewShiwake_Click(object sender, EventArgs e)
 {
     Static.ShowChildForm(typeof(ViewShiwake));
 }
Пример #13
0
 private void btnExcel_Click(object sender, EventArgs e)
 {
     Static.ExcelOutput(Static.ShiwakeDs.YokinSuitocho.TableName);
 }
Пример #14
0
 /// <summary>
 /// 画面の初期設定
 /// </summary>
 void InitializeForm()
 {
     // 表示できる年度を設定
     Static.GetShiwakeNendos().ForEach(x => cmbNendo.Items.Add(x));
     cmbNendo.SelectedItem = Static.Nendo.ToString();
 }
Пример #15
0
 private void MDIParent_FormClosing(object sender, FormClosingEventArgs e)
 {
     Static.SaveFormPosition();
 }
Пример #16
0
 /// <summary>
 /// 閉じるボタン
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnClose_Click(object sender, EventArgs e)
 {
     Static.CloseChildForm(this.GetType());
 }
Пример #17
0
 /// <summary>
 /// 更新処理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRegist_Click(object sender, EventArgs e)
 {
     Static.SaveZandakaXML();
     Static.ShiwakeChanged();
 }