private void create_cbKubun() { ComboBoxEdit cbe = new ComboBoxEdit(comboBoxKubun); cbe.ValueItem = new string[] { "20", "31", "32", "41" }; cbe.DisplayItem = new string[] { "営業担当者", "得意先", "部門", "商品区分" }; cbe.Basic(); }
private void create_cbOffice() { ComboBoxEdit cbe = new ComboBoxEdit(comboBoxOffice); cbe.ValueItem = new string [] { "H", "K", "S", "T", "A" }; cbe.DisplayItem = new string[] { "本社", "郡山", "相双", "関東", "全て" }; cbe.Basic(); }
// 支払い基準 private void create_cbPayRoule() { ComboBoxEdit cb = new ComboBoxEdit(comboBoxPayRoule); cb.ValueItem = new string[] { "0", "1" }; cb.DisplayItem = new string[] { "出来高払い", "完成払い" }; cb.Basic(); }
/// <summary> /// 年月コンボボックス設定 /// </summary> /// <param name="SetCode"></param> private void CreateCbMonth(string SetCode) { CommonData com = new CommonData(); // M_Commonアクセスクラス DateTime[] ClosingDate; // 締め年月格納用 if (SetCode == "Dummy") { // すべてが選択されていた場合 ClosingDate = new DateTime[this.comboBoxOfficeCode.Items.Count]; for (int i = 0; i < this.comboBoxOfficeCode.Items.Count; i++) { ClosingDate[i] = com.SelectCloseDate(Convert.ToString(((DataRowView)this.comboBoxOfficeCode.Items[i]).Row[0].ToString())); } } else { // すべて以外が選択されていた場合 ClosingDate = new DateTime[1]; ClosingDate[0] = com.SelectCloseDate(Convert.ToString(this.comboBoxOfficeCode.SelectedValue)); } DateTime MaxDate = DateTime.MinValue; // 最終締め年月格納用 for (int i = 0; i < ClosingDate.Length; i++) { // 最終締め月を取得 if (MaxDate <= ClosingDate[i]) { MaxDate = ClosingDate[i]; } } // 最大1年度分の月情報を表示する int DefMonth = 0; // 処理回数カウント用 string AddYear = ""; // 年情報格納用 string AddMonth = ""; // 月情報格納用 do { //AddYear += MaxDate.AddMonths(-DefMonth).Year + MaxDate.AddMonths(-DefMonth).Month.ToString("00") + ","; AddYear += MaxDate.AddMonths(-DefMonth).ToString("yyyy/MM/dd") + ","; AddMonth += MaxDate.AddMonths(-DefMonth).Month + "月現在,"; DefMonth++; } while (MaxDate.AddMonths(-DefMonth).Month != 6); // 末尾のカンマを外す AddYear = AddYear.Substring(0, AddYear.Length - 1); AddMonth = AddMonth.Substring(0, AddMonth.Length - 1); ComboBoxEdit cbe = new ComboBoxEdit(this.comboBoxMonth); // コンボボックス制御クラス cbe.ValueItem = AddYear.Split(','); cbe.DisplayItem = AddMonth.Split(','); cbe.Basic(); }
// 出力範囲の項目1から項目3を編集 private void create_cbRangeItem() { ComboBoxEdit cbe; for (int i = 0; i < cbItem.Length; i++) { cbe = new ComboBoxEdit(cbItem[i]); cbe.ValueItem = cif.VItemArray2; cbe.DisplayItem = cif.DItemArray2; cbe.Basic(); } }
// ComboBox作成 // 作成方法の2項目を編集 private void create_cbClassification() { ComboBoxEdit cbe; for (int i = 0; i < cbClass.Length; i++) { cbe = new ComboBoxEdit(cbClass[i]); cbe.ValueItem = cif.VItemArray2; cbe.DisplayItem = cif.DItemArray2; cbe.Basic(); } }
// ComboBox作成 // 作成方法の2項目を編集 private void create_cbClassification() { ComboBoxEdit cbe = new ComboBoxEdit(cbClass[0]); cbe.ValueItem = cif.VItemArray0; cbe.DisplayItem = cif.DItemArray0; cbe.Basic(); cbe = new ComboBoxEdit(cbClass[1]); cbe.ValueItem = cif.VItemArray1; cbe.DisplayItem = cif.DItemArray1; cbe.Basic(); }
private void create_cbFY() { DateTime dtNow = DateTime.Now; ComboBoxEdit cbe = new ComboBoxEdit(comboBoxFY); cbe.ValueItem = new string[3]; cbe.DisplayItem = new string[3]; for (int i = 0; i < cbe.ValueItem.Length; i++) { cbe.ValueItem[i] = i.ToString(); cbe.DisplayItem[i] = (dtNow.FiscalYear() - i).ToString(); } cbe.Basic(); }
// 会計年度 private void create_cbYM() { DateTime dt = DateTime.Today; nowFY = dt.FiscalYear(); ComboBoxEdit cbe = new ComboBoxEdit(comboBoxFY); cbe.DisplayItem = new string[5]; cbe.ValueItem = new string[5]; for (int i = 0; i < 5; i++) { cbe.DisplayItem[i] = Convert.ToString(nowFY - i); cbe.ValueItem[i] = i.ToString(); } cbe.Basic(); if (iniPro) { comboBoxFY.Text = (YearPeriod == "") ? nowFY.ToString() : YearPeriod; } }
// 出力範囲、範囲指定欄のComboBox,dateTimePicker(カレンダ)を編集し表示する private void edit_RangeComboBox(int idx) { invisible_AllRangeArea(idx); if (Convert.ToInt32(cbItem[idx].SelectedValue) == 0) { return; // 指定なし } string msg = "「出力範囲」"; int selectValue = Convert.ToInt32(cbItem[idx].SelectedValue); switch (idx) { case 0: if ((selectValue == Convert.ToInt32(cbItem[1].SelectedValue)) || (selectValue == Convert.ToInt32(cbItem[2].SelectedValue))) { MessageBox.Show(msg + "項目2や項目3と同一項目の選択はできません。"); return; } break; case 1: if ((selectValue == Convert.ToInt32(cbItem[0].SelectedValue)) || (selectValue == Convert.ToInt32(cbItem[2].SelectedValue))) { MessageBox.Show(msg + "項目1や項目3と同一項目の選択はできません。"); return; } break; case 2: if ((selectValue == Convert.ToInt32(cbItem[0].SelectedValue)) || (selectValue == Convert.ToInt32(cbItem[1].SelectedValue))) { MessageBox.Show(msg + "項目1や項目2と同一項目の選択はできません。"); return; } break; default: break; } lblSubT[idx].Visible = true; lblTilde[idx].Visible = true; cbItemTO[idx].Visible = true; cbItemFR[idx].Visible = true; // "指定なし", "原価計上日", "業務番号", "顧客", "原価項目", "業務担当者", "営業担当者" int tiNo = Convert.ToInt32(cbItem[idx].SelectedValue); SqlHandling sh = new SqlHandling("D_CostReport"); string strSql = ""; DataTable dt; if (tiNo == 4) //業務担当者 { strSql = "DISTINCT CASE WHEN LEN( ISNULL( " + cif.TItemArray[tiNo] + ", '')) < 3 THEN RIGHT('00' + RTRIM(ISNULL(" + cif.TItemArray[tiNo] + ", '')), 3) ELSE ISNULL (" + cif.TItemArray[tiNo] + ", '') END AS LeaderMCode"; } else if (tiNo == 5) //営業担当者 { strSql = "DISTINCT CASE WHEN LEN( ISNULL( " + cif.TItemArray[tiNo] + ", '')) < 3 THEN RIGHT('00' + RTRIM(ISNULL(" + cif.TItemArray[tiNo] + ", '')), 3) ELSE ISNULL (" + cif.TItemArray[tiNo] + ", '') END AS SalesMCode"; } else { strSql = "DISTINCT ISNULL ( " + cif.TItemArray[tiNo] + ", '') AS " + cif.TItemArray[tiNo]; } dt = sh.SelectFullDescription(strSql + " FROM D_CostReport WHERE " + cif.TItemArray[tiNo] + " <> '' AND OfficeCode = '" + comboBoxOffice.SelectedValue.ToString() + "'" + " ORDER BY " + cif.TItemArray[tiNo]); if (dt == null) { MessageBox.Show("選択対象となるべきデータがありません。"); cbItem[idx].SelectedValue = "0"; invisible_RangeLabel(idx); return; } ComboBoxEdit cbe = new ComboBoxEdit(cbItemFR[idx]); ComboBoxEdit cbe1 = new ComboBoxEdit(cbItemTO[idx]); cbe.ValueItem = new string[dt.Rows.Count]; cbe.DisplayItem = new string[dt.Rows.Count]; cbe1.ValueItem = new string[dt.Rows.Count]; cbe1.DisplayItem = new string[dt.Rows.Count]; DataRow dr; for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; cbe.ValueItem[i] = Convert.ToString(dr[cif.TItemArray[tiNo]]); cbe1.ValueItem[i] = cbe.ValueItem[i]; } if (tiNo == 1) //業務番号 { sh = new SqlHandling(); string sqlStr = "DISTINCT T.TaskName, T.CostType FROM D_Task AS T INNER JOIN D_TaskInd AS I " + "ON T.TaskID = I.TaskID WHERE I.OfficeCode = '" + comboBoxOffice.SelectedValue.ToString() + "' AND " + " I.TaskCode = '"; for (int i = 0; i < cbe.ValueItem.Length; i++) { dt = sh.SelectFullDescription(sqlStr + cbe.ValueItem[i] + "'"); if ((dt != null) && (dt.Rows.Count > 0)) { dr = dt.Rows[0]; cbe.DisplayItem[i] = "(" + cbe.ValueItem[i] + ") " + "(" + Convert.ToString(dr["CostType"]) + ") " + Convert.ToString(dr["TaskName"]); cbe1.DisplayItem[i] = cbe.DisplayItem[i]; } } } else { // 20190519 anonymous add if (tiNo == 6) { for (int i = 0; i < cbe.ValueItem.Length; i++) { cbe.DisplayItem[i] = Conv.DepartName(comboBoxOffice.SelectedValue.ToString(), cbe.ValueItem[i]); } } else { cbe.DisplayItem = edit_ComboBoxValueItem(tiNo, cbe.ValueItem); } //cbe.DisplayItem = edit_ComboBoxValueItem(tiNo, cbe.ValueItem); // 20190519 anonymous add end cbe1.DisplayItem = cbe.DisplayItem; } cbe.Basic(); cbe1.Basic(); }