/// <summary> /// setGridsData /// 各グリッドにデータを入れる /// </summary> private void setGridsData(int iIdx) { //データ渡し用 List <string> lstString = new List <string>(); DataTable dtView = new DataTable(); DBConnective con = new DBConnective(); D1550_ShohinZaikoKakunin_B shohinzaikoB = new D1550_ShohinZaikoKakunin_B(); try { //商品データ取り出し dtView = shohinzaikoB.getSelectItem((string)gridShohin.Rows[iIdx].Cells["商品コード"].Value, con); //商品データ表示処理 #region //データがある場合 if (dtView.Rows.Count != 0) { lblGrayTeka.Text = dtView.Rows[0]["定価"].ToString(); lblGrayHyojunbaika.Text = dtView.Rows[0]["標準売価"].ToString(); lblGrayShireTanka.Text = dtView.Rows[0]["仕入単価"].ToString(); lblGrayHyokaTanka.Text = dtView.Rows[0]["標準売価"].ToString(); lblGraytateneShireTanka.Text = dtView.Rows[0]["建値仕入単価"].ToString(); lblGrayHakosu.Text = dtView.Rows[0]["箱入数"].ToString(); lblsetHonTana.CodeTxtText = dtView.Rows[0]["棚番本社"].ToString(); lblsetHonTana.chkTxtTanaban(); lblsetGifuTana.CodeTxtText = dtView.Rows[0]["棚番岐阜"].ToString(); lblsetGifuTana.chkTxtTanaban(); //カンマ付の処理 Int64 intdata = Int64.Parse(lblGrayTeka.Text); lblGrayTeka.Text = string.Format("{0:#,0}", intdata); intdata = Int64.Parse(lblGrayHyojunbaika.Text); lblGrayHyojunbaika.Text = string.Format("{0:#,0}", intdata); intdata = Int64.Parse(lblGrayShireTanka.Text); lblGrayShireTanka.Text = string.Format("{0:#,0.00}", intdata); intdata = Int64.Parse(lblGrayHyokaTanka.Text); lblGrayHyokaTanka.Text = string.Format("{0:#,0.00}", intdata); intdata = Int64.Parse(lblGraytateneShireTanka.Text); lblGraytateneShireTanka.Text = string.Format("{0:#,0.00}", intdata); intdata = Int64.Parse(lblGrayHakosu.Text); lblGrayHakosu.Text = string.Format("{0:#,0}", intdata); //定価が0以外の場合 if (lblGrayTeka.Text.Trim() != "0") { decimal decTeka = decimal.Parse(lblGrayTeka.Text); //標準売価が0以外の場合 if (lblGrayHyojunbaika.Text.Trim() != "0") { decimal decHayojunBaika = decimal.Parse(lblGrayHyojunbaika.Text); lblGrayHyojunbaikaRitsu.Text = ((decHayojunBaika / decTeka) * 100).ToString("0.0"); } else { lblGrayHyojunbaikaRitsu.Text = ""; } //仕入単価が0以外の場合 if (lblGrayShireTanka.Text.Trim() != "0.00") { decimal decShireTanka = decimal.Parse(lblGrayShireTanka.Text); lblGrayShireTankaRitsu.Text = ((decShireTanka / decTeka) * 100).ToString("0.0"); } else { lblGrayShireTankaRitsu.Text = ""; } //評価単価が0以外の場合 if (lblGrayHyokaTanka.Text.Trim() != "0.00") { decimal decHyokaTanka = decimal.Parse(lblGrayHyokaTanka.Text); lblGrayHyokaTankaRitsu.Text = ((decHyokaTanka / decTeka) * 100).ToString("0.0"); } else { lblGrayHyokaTankaRitsu.Text = ""; } //建値仕入単価が0以外の場合 if (lblGraytateneShireTanka.Text.Trim() != "0.00") { decimal dectateneShireTanka = decimal.Parse(lblGraytateneShireTanka.Text); lblGraytateneShireTankaRitsu.Text = ((dectateneShireTanka / decTeka) * 100).ToString("0.0"); } else { lblGraytateneShireTankaRitsu.Text = ""; } } else { lblGrayHyojunbaikaRitsu.Text = ""; lblGrayShireTankaRitsu.Text = ""; lblGrayHyokaTankaRitsu.Text = ""; lblGraytateneShireTankaRitsu.Text = ""; } } #endregion //売上データ取り出し //受注残データ取り出し //発注残データ取り出し //商品元帳データ取り出し //仕入データ取り出し //月別売上データ取り出し //月別仕入データ取り出し //商品別単価データ取り出し } catch (Exception ex) { new CommonException(ex); //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } finally { //解放 con.Dispose(); } }