/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void miNendoSelect_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(InputNendo)); }
private void btnExcel_Click(object sender, EventArgs e) { Static.ExcelOutput(Static.ShiwakeDs.KeihiSum.TableName); }
/// <summary> /// 経費入力 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void miShiwakeInput_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(InputKeihi)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void miKotsuhiBatch_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(BatchKotsuhi)); }
private void miYokinSuitocho_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(ViewYokinSuitocho)); }
private void miZandakaNyuryoku_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(InputKurikoshi)); }
private void 資産照会ToolStripMenuItem_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(ViewShisan)); }
/// <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(); } }
private void miYayoiCsvImportAppend_Click(object sender, EventArgs e) { Static.AddShiwakeFromCSV(true); }
private void MDIParent_FormClosed(object sender, FormClosedEventArgs e) { Static.WriteNendo(); }
private void miInputUriage_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(InputUriage)); }
private void miViewShiwake_Click(object sender, EventArgs e) { Static.ShowChildForm(typeof(ViewShiwake)); }
private void btnExcel_Click(object sender, EventArgs e) { Static.ExcelOutput(Static.ShiwakeDs.YokinSuitocho.TableName); }
/// <summary> /// 画面の初期設定 /// </summary> void InitializeForm() { // 表示できる年度を設定 Static.GetShiwakeNendos().ForEach(x => cmbNendo.Items.Add(x)); cmbNendo.SelectedItem = Static.Nendo.ToString(); }
private void MDIParent_FormClosing(object sender, FormClosingEventArgs e) { Static.SaveFormPosition(); }
/// <summary> /// 閉じるボタン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClose_Click(object sender, EventArgs e) { Static.CloseChildForm(this.GetType()); }
/// <summary> /// 更新処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRegist_Click(object sender, EventArgs e) { Static.SaveZandakaXML(); Static.ShiwakeChanged(); }