///<summary>
        ///updKoshin
        ///データの更新
        ///</summary>
        private void updKoshin()
        {
            //変更する発注IDがない場合
            if (strHachuID == "")
            {
                return;
            }

            //発注数空チェック
            if (txtHachusu.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtHachusu.Focus();

                return;
            }

            //発注数の数値チェック
            if (txtHachusu.chkMoneyText())
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された数値が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtHachusu.Focus();

                return;
            }

            //発注数が仕入数以下の場合
            if (int.Parse(txtHachusu.Text) < int.Parse(txtShiresu.Text))
            {
                //発注数が仕入数以下の場合のメッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "発注数は仕入数以上を入力してください", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }

            //ビジネス層のインスタンス生成
            A0470_Hachusuhenko_B hachusuhenkoB = new A0470_Hachusuhenko_B();

            DBConnective con = null;

            KATO.Business.A0010_JuchuInput.A0010_JuchuInput_B juchuB = new KATO.Business.A0010_JuchuInput.A0010_JuchuInput_B();

            con = new DBConnective();

            try
            {
                DataTable dt = hachusuhenkoB.getHatchuData(strHachuID);
                hachusuhenkoB.updKoushin(txtHachusu.Text, strHachuID);

                if (dt != null && dt.Rows.Count > 0)
                {
                    con.BeginTrans();
                    juchuB.updZaiko(dt.Rows[0]["商品コード"].ToString(), dt.Rows[0]["営業所コード"].ToString(), dt.Rows[0]["納期"].ToString(), Environment.UserName, con);
                    con.Commit();
                }

                //メッセージボックスの処理、登録完了のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();

                //下部のみ取消動作
                txtHinmei_Katashiki.Clear();
                txtHachusu.Clear();
                txtShiresu.Clear();
                txtTanka.Clear();

                //グリッド表示
                setHachusuhenko();
            }
            catch (Exception ex)
            {
                if (con != null)
                {
                    con.Rollback();
                }
                //エラーロギング
                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;
            }
        }
示例#2
0
        ///<summary>
        ///AtenaView
        ///取引先コード入力項目から離れた時
        ///</summary>
        public void AtenaView(object sender, EventArgs e)
        {
            //検索時のデータ取り出し先
            DataTable dtSetData;

            //取引先入力項目が空の場合
            if (!StringUtl.blIsEmpty(labelSet_Torihikisaki.CodeTxtText))
            {
                return;
            }

            //ビジネス層のインスタンス生成
            M0620_HushoAtenaInsatsu_B hushoatenainsatsu = new M0620_HushoAtenaInsatsu_B();

            try
            {
                dtSetData = hushoatenainsatsu.getEigyoshoTextLeave(labelSet_Torihikisaki.CodeTxtText);

                //住所1を使用する場合
                if (radAtena1.Checked == true)
                {
                    lblGrayMeisho.Text = dtSetData.Rows[0]["取引先名称"].ToString();
                    lblGrayYubin.Text  = dtSetData.Rows[0]["郵便番号"].ToString();
                    lblGrayJusho1.Text = dtSetData.Rows[0]["住所1"].ToString();
                    lblGrayJusho2.Text = dtSetData.Rows[0]["住所2"].ToString();
                }
                else if (radAtena2.Checked == true)
                {
                    lblGrayMeisho.Text = dtSetData.Rows[0]["取引先名称"].ToString();
                    lblGrayYubin.Text  = dtSetData.Rows[0]["A郵便番号"].ToString();
                    lblGrayJusho1.Text = dtSetData.Rows[0]["A住所1"].ToString();
                    lblGrayJusho2.Text = dtSetData.Rows[0]["A住所2"].ToString();
                }
                else if (radAtena3.Checked == true)
                {
                    lblGrayMeisho.Text = dtSetData.Rows[0]["領収書送付先名"].ToString();
                    lblGrayYubin.Text  = dtSetData.Rows[0]["領収書送付郵便番号"].ToString();
                    lblGrayJusho1.Text = dtSetData.Rows[0]["領収書送付住所1"].ToString();
                    lblGrayJusho2.Text = dtSetData.Rows[0]["領収書送付住所2"].ToString();
                }
                else if (radAtena4.Checked == true)
                {
                    lblGrayMeisho.Text = dtSetData.Rows[0]["請求書送付先名"].ToString();
                    lblGrayYubin.Text  = dtSetData.Rows[0]["請求書送付郵便番号"].ToString();
                    lblGrayJusho1.Text = dtSetData.Rows[0]["請求書送付住所1"].ToString();
                    lblGrayJusho2.Text = dtSetData.Rows[0]["請求書送付住所2"].ToString();
                }
                else
                {
                    lblGrayMeisho.Text = dtSetData.Rows[0]["取引先名称"].ToString();
                    lblGrayYubin.Text  = dtSetData.Rows[0]["郵便番号"].ToString();
                    lblGrayJusho1.Text = dtSetData.Rows[0]["住所1"].ToString();
                    lblGrayJusho2.Text = dtSetData.Rows[0]["住所2"].ToString();
                }

                //長4を選択
                if (radSet_2btn_Yoshi.radbtn0.Checked == true)
                {
                    blNaga4 = true;
                }
                //長3を選択
                else if (radSet_2btn_Yoshi.radbtn1.Checked == true)
                {
                    blNaga4 = false;
                }
            }
            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;
            }
        }
示例#3
0
        ///<summary>
        ///     F10:Excel出力
        ///</summary>
        private void excelTanaorosiKinyuuhyo()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データ検索用(プロシージャ用)
            List <string> lstSearchItemProc = new List <string>();

            // データチェック
            if (!blnDataCheack())
            {
                return;
            }

            // 検索するデータをリストに格納
            lstSearchItem.Add(txtYmd.Text);
            lstSearchItem.Add(labelSet_Eigyosho.CodeTxtText);
            lstSearchItem.Add(labelSet_Daibunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Chubunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Maker.CodeTxtText);
            lstSearchItem.Add(txtTanabanFrom.Text);
            lstSearchItem.Add(txtTanabanTo.Text);

            // 検索するデータをリストに格納(プロシージャ用)
            lstSearchItemProc.Add(txtYmd.Text);
            lstSearchItemProc.Add(labelSet_Eigyosho.CodeTxtText);
            lstSearchItemProc.Add(labelSet_Daibunrui.CodeTxtText);
            lstSearchItemProc.Add((radSort.judCheckBtn() + 1).ToString());

            // ビジネス層のインスタンス生成
            F0570_TanaorosiKinyuhyoPrint_B tanaorosiPrint_B = new F0570_TanaorosiKinyuhyoPrint_B();

            try
            {
                BaseMessageBox basemessagebox;

                // 印刷するにチェックが入っていない場合
                if (chkPrintOnly.Checked == false)
                {
                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // 棚卸記入表の件数を取得
                    DataTable dtTanaorosiCount = tanaorosiPrint_B.getTanaorosiCount(lstSearchItem);

                    //元に戻す
                    Cursor.Current = Cursors.Default;

                    // 対象データがある場合
                    if (dtTanaorosiCount != null && dtTanaorosiCount.Rows.Count > 0)
                    {
                        // 件数が1件以上の場合
                        if (int.Parse(dtTanaorosiCount.Rows[0][0].ToString()) > 0)
                        {
                            // メッセージボックスの処理(YES,NO)
                            basemessagebox = new BaseMessageBox(this, "棚卸記入表", "既にデータが作成されています。書き換えますか?", CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);

                            // Noが押された場合
                            if (basemessagebox.ShowDialog() == DialogResult.No)
                            {
                                return;
                            }
                        }
                    }

                    try
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        // 棚卸記入表テーブルに追加
                        tanaorosiPrint_B.addTanaorosi(lstSearchItem);

                        //元に戻す
                        Cursor.Current = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        //元に戻す
                        Cursor.Current = Cursors.Default;

                        // エラーロギング
                        new CommonException(ex);

                        // メッセージボックスの処理、追加失敗の場合のウィンドウ(OK)
                        basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }
                }

                //待機状態
                Cursor.Current = Cursors.WaitCursor;

                // 検索実行
                DataTable dtTanaorosi = tanaorosiPrint_B.getTanaorosi(lstSearchItemProc);

                //元に戻す
                Cursor.Current = Cursors.Default;

                // 対象データがある場合
                if (dtTanaorosi != null && dtTanaorosi.Rows.Count > 0)
                {
                    string strFilter = "";

                    // 中分類コードがある場合
                    if (!lstSearchItem[3].Equals(""))
                    {
                        strFilter += "中分類コード = '" + lstSearchItem[3] + "'";
                    }

                    // メーカーコードがある場合
                    if (!lstSearchItem[4].Equals(""))
                    {
                        if (!strFilter.Equals(""))
                        {
                            strFilter += " AND ";
                        }
                        strFilter += "メーカーコード = '" + lstSearchItem[4] + "'";
                    }

                    // 棚番がある場合
                    if (!lstSearchItem[5].Equals("") && !lstSearchItem[6].Equals(""))
                    {
                        if (!strFilter.Equals(""))
                        {
                            strFilter += " AND ";
                        }
                        strFilter += "棚番 >= '" + lstSearchItem[5] + "' AND 棚番 <= '" + lstSearchItem[6] + "'";
                    }

                    // 対象データから更に絞り込み(中分類コード、メーカーコード、棚番)
                    if (!strFilter.Equals(""))
                    {
                        DataView dvTanaorosi = new DataView(dtTanaorosi);
                        dvTanaorosi.RowFilter = strFilter;
                        dtTanaorosi           = dvTanaorosi.ToTable();

                        // 対象データがない場合
                        if (dtTanaorosi == null || dtTanaorosi.Rows.Count == 0)
                        {
                            // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                            basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                            basemessagebox.ShowDialog();

                            return;
                        }
                    }

                    // SaveFileDialogクラスのインスタンスを作成
                    SaveFileDialog sfd = new SaveFileDialog();
                    // ファイル名の指定
                    sfd.FileName = "棚卸プレシート_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xlsx";
                    // デフォルトパス取得(デスクトップ)
                    string Init_dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    //はじめに表示されるフォルダを指定する
                    sfd.InitialDirectory = Init_dir;
                    // ファイルフィルタの設定
                    sfd.Filter = "すべてのファイル(*.*)|*.*";

                    //ダイアログを表示する
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        CreatePdf cpdf = new CreatePdf();

                        // 出力するヘッダを設定

                        //Linqで必要なデータをselect
                        var outDataAll = dtTanaorosi.AsEnumerable()
                                         .Select(dat => new
                        {
                            eigyo         = dat["営業所名"],
                            daibunruiName = dat["大分類名"],
                            chubunruiName = dat["中分類名"],
                            tanaban       = dat["棚番"],
                            maker         = dat["メーカー名"],
                            kataban       = dat["品名型番"],
                            zsuryo        = (decimal)dat["指定日在庫"],
                            suryo         = (decimal)dat["棚卸数量"]
                        }).ToList();

                        //リストをデータテーブルに変換
                        DataTable dtChkList = cpdf.ConvertToDataTable(outDataAll);

                        string[] header =
                        {
                            "営業所名",
                            "大分類名",
                            "中分類名",
                            "棚番",
                            "メーカー名",
                            "品名型番",
                            "指定日在庫",
                            "棚卸数量",
                        };

                        string outFile = sfd.FileName;

                        // Excel作成処理
                        cpdf.DtToXls(dtChkList, "業種マスタリスト", outFile, 3, 1, header);

                        //元に戻す
                        Cursor.Current = Cursors.Default;

                        // メッセージボックスの処理、Excel作成完了の場合のウィンドウ(OK)
                        basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excelファイルを作成しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                        basemessagebox.ShowDialog();
                    }
                }
            }
            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;
            }
        }
        /// <summary>
        /// F10:Excel出力
        /// </summary>
        private void exportXls()
        {
            // SaveFileDialogクラスのインスタンスを作成
            SaveFileDialog sfd = new SaveFileDialog();

            // ファイル名の指定
            sfd.FileName = "請求一覧表_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xlsx";
            // デフォルトパス取得(デスクトップ)
            string Init_dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            //はじめに表示されるフォルダを指定する
            sfd.InitialDirectory = Init_dir;
            // ファイルフィルタの設定
            sfd.Filter = "すべてのファイル(*.*)|*.*";

            try
            {
                //待機状態
                Cursor.Current = Cursors.WaitCursor;

                // データチェック処理
                if (!dataCheack())
                {
                    //元に戻す
                    Cursor.Current = Cursors.Default;
                    return;
                }

                // データ検索用
                List <string> lstSearchItem = new List <string>();


                // ビジネス層のインスタンス生成
                B0410_SeikyuItiranPrint_B seikyuitiranprintB = new B0410_SeikyuItiranPrint_B();

                // 検索するデータをリストに格納
                lstSearchItem.Add(txtSimekiriYMD.Text);
                lstSearchItem.Add(txtKaisiYMD.Text);
                lstSearchItem.Add(labelSet_TokuisakiStart.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiEnd.CodeTxtText);
                lstSearchItem.Add(txtSimekiribiCd.Text);
                if (radSetSort.judCheckBtn() == 0 || radSetSort.radbtn0.Checked)
                {
                    lstSearchItem.Add("1");
                }
                else if (radSetSort.judCheckBtn() == 1 || radSetSort.radbtn1.Checked)
                {
                    lstSearchItem.Add("2");
                }
                else
                {
                    lstSearchItem.Add("3");
                }
                lstSearchItem.Add(Environment.UserName);


                // 検索実行
                DataTable dtSeikyuItiran = seikyuitiranprintB.getSeikyuItiran(lstSearchItem);

                // カーソルを戻す
                this.Cursor = Cursors.Default;

                // 検索結果にデータがあった場合
                if (dtSeikyuItiran.Rows.Count > 0)
                {
                    // ダイアログ表示
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        CreatePdf cpdf = new CreatePdf();

                        // 出力するヘッダを設定
                        string[] header =
                        {
                            "コード",
                            "得意先名",
                            "前月売掛残",
                            "入金現金",
                            "入金小切手",
                            "入金振込",
                            "入金手形",
                            "入金相殺",
                            "入金手数料",
                            "入金その他",
                            "繰越残高",
                            "当月売上高",
                            "当月消費税",
                            "当月残高",
                            "税区分",
                        };

                        // Linqで出力対象の項目をSelect
                        // カラム名は以下のようにつける(カラム名でフォーマットを判断するため)
                        // 金額関係:***kingaku
                        // 単価関係:***tanka
                        // 原価:***genka
                        // 数量:***suryo
                        var outDat = dtSeikyuItiran.AsEnumerable()
                                     .Select(dat => new
                        {
                            code              = dat["得意先コード"],
                            tokuisakiName     = dat["得意先名"],
                            zenurizanKingaku  = dat["前月売掛残"],
                            genKingaku        = dat["入金現金"],
                            kogiteKingaku     = dat["入金小切手"],
                            furikomiKingaku   = dat["入金振込"],
                            teagataKingaku    = dat["入金手形"],
                            sosaiKingaku      = dat["入金相殺"],
                            tesuryoKingaku    = dat["入金手数料"],
                            sonotakingaku     = dat["入金その他"],
                            kurizanKingaku    = dat["繰越残高"],
                            uriagedataKingaku = dat["当月売上高"],
                            zeiKingaku        = dat["当月消費税"],
                            tougetuzanKingaku = dat["当月残高"],
                            zeiku             = dat["税区"],
                        }).ToList();

                        // listをDataTableに変換
                        DataTable dtSiireChk = cpdf.ConvertToDataTable(outDat);

                        string outFile = sfd.FileName;

                        cpdf.DtToXls(dtSiireChk, "請求一覧表", outFile, 3, 1, header);

                        this.Cursor = Cursors.Default;

                        // メッセージボックスの処理、Excel作成完了の場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excelファイルを作成しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                        basemessagebox.ShowDialog();
                    }
                }
                else
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    //元に戻す
                    Cursor.Current = Cursors.Default;
                    return;
                }
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
示例#5
0
        /// <summary>
        /// setUriage
        /// データグリッドビューにデータを表示
        /// </summary>
        private void setUriage()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データチェック
            if (!blnDataCheck())
            {
                return;
            }

            // 検索するデータをリストに格納
            lstSearchItem.Add(txtYear.Text);
            lstSearchItem.Add(lsTantoF.CodeTxtText);
            lstSearchItem.Add(lsTantoT.CodeTxtText);

            // ビジネス層のインスタンス生成
            C1530_TantouUriageArariNenkan_B uriagePrint_B = new C1530_TantouUriageArariNenkan_B();

            try
            {
                // 検索実行
                DataTable dtUriage = uriagePrint_B.getUriage(lstSearchItem);
                int       rowsCnt  = dtUriage.Rows.Count;

                // 対象データがある場合
                if (dtUriage != null && rowsCnt > 0)
                {
                    // 総合計
                    DataRow   drGoukei   = dtUriage.NewRow();
                    DataTable dt         = null;
                    decimal[] decKingaku = uriagePrint_B.getGoukeiKingaku(dtUriage, ref dt);

                    // 総合計行へ値をセット
                    drGoukei["担当者名"] = "総合計";

                    for (int month = 1; month <= 6; month++)
                    {
                        drGoukei["売上額" + month.ToString()] = decKingaku[month * 3 - 3];
                        drGoukei["粗利額" + month.ToString()] = decKingaku[month * 3 - 2];
                        if (decKingaku[month * 3 - 1] == 0)
                        {
                            drGoukei["前年比率" + month.ToString()] = 0;
                        }
                        else
                        {
                            drGoukei["前年比率" + month.ToString()] = decKingaku[month * 3 - 2] / decKingaku[month * 3 - 1];
                        }
                    }
                    drGoukei["上期売上額"] = decKingaku[18];
                    drGoukei["上期粗利額"] = decKingaku[19];
                    if (decKingaku[20] == 0)
                    {
                        drGoukei["上期前年比率"] = 0;
                    }
                    else
                    {
                        drGoukei["上期前年比率"] = decKingaku[19] / decKingaku[20];
                    }

                    for (int month = 7; month <= 12; month++)
                    {
                        drGoukei["売上額" + month.ToString()] = decKingaku[month * 3];
                        drGoukei["粗利額" + month.ToString()] = decKingaku[month * 3 + 1];
                        if (decKingaku[month * 3 + 2] == 0)
                        {
                            drGoukei["前年比率" + month.ToString()] = 0;
                        }
                        else
                        {
                            drGoukei["前年比率" + month.ToString()] = decKingaku[month * 3 + 1] / decKingaku[month * 3 + 2];
                        }
                    }
                    drGoukei["下期売上額"] = decKingaku[39];
                    drGoukei["下期粗利額"] = decKingaku[40];
                    if (decKingaku[41] == 0)
                    {
                        drGoukei["上期前年比率"] = 0;
                    }
                    else
                    {
                        drGoukei["下期前年比率"] = decKingaku[40] / decKingaku[41];
                    }

                    // グループ合計
                    int[] groupRowsCnt = null;
                    int   groupsCnt    = 0;
                    int   groupRowCnt  = 0;
                    decimal[,] decKingakuGroup = uriagePrint_B.getGroupKingaku(dtUriage, ref groupRowsCnt, ref groupsCnt);

                    // グループ名を取得
                    DataView  dv      = new DataView(dtUriage);
                    DataTable dtGroup = dv.ToTable(true, "グループ名");

                    for (int cnt = 0; cnt < groupsCnt; cnt++)
                    {
                        DataRow drGroupGoukei = dtUriage.NewRow();

                        // 合計行へ値をセット
                        drGroupGoukei["担当者名"] = dtGroup.Rows[cnt][0].ToString();

                        for (int month = 1; month <= 6; month++)
                        {
                            drGroupGoukei["売上額" + month.ToString()] = decKingakuGroup[cnt, month * 3 - 3];
                            drGroupGoukei["粗利額" + month.ToString()] = decKingakuGroup[cnt, month * 3 - 2];
                            if (decKingakuGroup[cnt, month * 3 - 1] == 0)
                            {
                                drGroupGoukei["前年比率" + month.ToString()] = 0;
                            }
                            else
                            {
                                drGroupGoukei["前年比率" + month.ToString()] = decKingakuGroup[cnt, month * 3 - 2] / decKingakuGroup[cnt, month * 3 - 1];
                            }
                        }
                        drGroupGoukei["上期売上額"] = decKingakuGroup[cnt, 18];
                        drGroupGoukei["上期粗利額"] = decKingakuGroup[cnt, 19];
                        if (decKingakuGroup[cnt, 20] == 0)
                        {
                            drGroupGoukei["上期前年比率"] = 0;
                        }
                        else
                        {
                            drGroupGoukei["上期前年比率"] = decKingakuGroup[cnt, 19] / decKingakuGroup[cnt, 20];
                        }

                        for (int month = 7; month <= 12; month++)
                        {
                            drGroupGoukei["売上額" + month.ToString()] = decKingakuGroup[cnt, month * 3];
                            drGroupGoukei["粗利額" + month.ToString()] = decKingakuGroup[cnt, month * 3 + 1];
                            if (decKingakuGroup[cnt, month * 3 + 2] == 0)
                            {
                                drGroupGoukei["前年比率" + month.ToString()] = 0;
                            }
                            else
                            {
                                drGroupGoukei["前年比率" + month.ToString()] = decKingakuGroup[cnt, month * 3 + 1] / decKingakuGroup[cnt, month * 3 + 2];
                            }
                        }
                        drGroupGoukei["下期売上額"] = decKingakuGroup[cnt, 39];
                        drGroupGoukei["下期粗利額"] = decKingakuGroup[cnt, 40];
                        if (decKingakuGroup[cnt, 41] == 0)
                        {
                            drGroupGoukei["上期前年比率"] = 0;
                        }
                        else
                        {
                            drGroupGoukei["下期前年比率"] = decKingakuGroup[cnt, 40] / decKingakuGroup[cnt, 41];
                        }

                        // グループ合計行を追加
                        groupRowCnt += groupRowsCnt[cnt];
                        dtUriage.Rows.InsertAt(drGroupGoukei, groupRowCnt + cnt);
                    }

                    // 合計行を追加
                    dtUriage.Rows.Add(drGoukei);

                    // データテーブルからデータグリッドへセット
                    gridUriage.DataSource = dtUriage;
                }

                Control cNow = this.ActiveControl;
                cNow.Focus();
            }
            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;
            }
        }
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データチェック
            if (!blnDataCheack())
            {
                return;
            }

            //待機状態
            Cursor.Current = Cursors.WaitCursor;

            // 検索するデータをリストに格納
            lstSearchItem.Add(txtYmdFrom.Text);
            lstSearchItem.Add(txtYmdTo.Text);

            // 営業所コード(開始)が空の場合
            if (labelSet_EigyoshoCdFrom.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("0000");
            }
            else
            {
                lstSearchItem.Add(labelSet_EigyoshoCdFrom.CodeTxtText);
            }
            // 営業所コード(終了)が空の場合
            if (labelSet_EigyoshoCdTo.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("9999");
            }
            else
            {
                lstSearchItem.Add(labelSet_EigyoshoCdTo.CodeTxtText);
            }

            // グループコード(開始)が空の場合
            if (labelSet_GroupCdFrom.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("0000");
            }
            else
            {
                lstSearchItem.Add(labelSet_GroupCdFrom.CodeTxtText);
            }
            // グループコード(終了)が空の場合
            if (labelSet_GroupCdTo.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("9999");
            }
            else
            {
                lstSearchItem.Add(labelSet_GroupCdTo.CodeTxtText);
            }

            // 担当者コード(開始)が空の場合
            if (labelSet_TantoushaCdFrom.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("0000");
            }
            else
            {
                lstSearchItem.Add(labelSet_TantoushaCdFrom.CodeTxtText);
            }
            // 担当者コード(終了)が空の場合
            if (labelSet_TantoushaCdTo.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("9999");
            }
            else
            {
                lstSearchItem.Add(labelSet_TantoushaCdTo.CodeTxtText);
            }

            // 経過月数
            lstSearchItem.Add(intDateDiff(txtYmdFrom.Text, txtYmdTo.Text).ToString());

            // ビジネス層のインスタンス生成
            C0130_TantouUriageArariPrint_B uriagePrint_B = new C0130_TantouUriageArariPrint_B();

            try
            {
                // 検索実行
                DataTable dtUriage = uriagePrint_B.getUriage(lstSearchItem);

                // 対象データがある場合
                if (dtUriage != null && dtUriage.Rows.Count > 0)
                {
                    //元に戻す
                    Cursor.Current = Cursors.Default;

                    // 印刷ダイアログ
                    Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A4, CommonTeisu.YOKO);
                    pf.lblBusu.Visible = true;
                    pf.txtBusu.Visible = true;
                    pf.ShowDialog(this);

                    // プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        // カーソルを待機状態にする
                        this.Cursor = Cursors.WaitCursor;

                        // PDF作成
                        String strFile = uriagePrint_B.dbToPdf(dtUriage, lstSearchItem, null, 0);

                        // プレビュー
                        //pf.execPreview(strFile);
                    }
                    // 一括印刷の場合
                    else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                    {
                        // カーソルを待機状態にする
                        this.Cursor = Cursors.WaitCursor;

                        string s = pf.txtBusu.Text;

                        int num = 0;

                        if (!string.IsNullOrWhiteSpace(s))
                        {
                            num = int.Parse(s);
                        }

                        // PDF作成
                        String strFile = uriagePrint_B.dbToPdf(dtUriage, lstSearchItem, pf.printer, num);

                        // 一括印刷
                        //pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.YOKO, true);
                    }
                    // カーソルの状態を元に戻す
                    this.Cursor = Cursors.Default;

                    pf.Dispose();
                }
                else
                {
                    // カーソルの状態を元に戻す
                    this.Cursor = Cursors.Default;

                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                // カーソルの状態を元に戻す
                this.Cursor = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
        /// <summary>
        /// blnDataCheack
        /// データチェック処理
        /// </summary>
        private Boolean blnDataCheack()
        {
            //年月日の日付フォーマット後を入れる用
            string strYMDformat = "";

            // 空文字判定(開始年月日)
            if (txtYmdFrom.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtYmdFrom.Focus();

                return(false);
            }

            // 空文字判定(終了年月日)
            if (txtYmdTo.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtYmdTo.Focus();

                return(false);
            }

            // 閲覧権限がない場合
            if (!"1".Equals(etsuranFlg))
            {
                // 空文字判定(営業所コード(開始))
                if (labelSet_EigyoshoCdFrom.CodeTxtText.Equals(""))
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    labelSet_EigyoshoCdFrom.Focus();

                    return(false);
                }

                // 空文字判定(営業所コード(終了))
                if (labelSet_EigyoshoCdTo.CodeTxtText.Equals(""))
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    labelSet_EigyoshoCdTo.Focus();

                    return(false);
                }

                // 空文字判定(グループコード(開始))
                if (labelSet_GroupCdFrom.CodeTxtText.Equals(""))
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    labelSet_GroupCdFrom.Focus();

                    return(false);
                }

                // 空文字判定(グループコード(終了))
                if (labelSet_GroupCdTo.CodeTxtText.Equals(""))
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    labelSet_GroupCdTo.Focus();

                    return(false);
                }
            }

            //日付フォーマット生成、およびチェック
            strYMDformat = txtYmdFrom.chkDateDataFormat(txtYmdFrom.Text);

            //開始年月日の日付チェック
            if (strYMDformat == "")
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtYmdFrom.Focus();

                return(false);
            }
            else
            {
                txtYmdFrom.Text = strYMDformat;
            }

            //初期化
            strYMDformat = "";

            //日付フォーマット生成、およびチェック
            strYMDformat = txtYmdTo.chkDateDataFormat(txtYmdTo.Text);

            //終了年月日の日付チェック
            if (strYMDformat == "")
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtYmdTo.Focus();

                return(false);
            }
            else
            {
                txtYmdTo.Text = strYMDformat;
            }

            //営業所コードの検索開始のチェック
            if (labelSet_EigyoshoCdFrom.chkTxtEigyousho() == true)
            {
                labelSet_EigyoshoCdFrom.Focus();

                return(false);
            }

            //営業所コードの検索終了のチェック
            if (labelSet_EigyoshoCdTo.chkTxtEigyousho() == true)
            {
                labelSet_EigyoshoCdTo.Focus();

                return(false);
            }

            //グループコードの検索開始のチェック
            if (labelSet_GroupCdFrom.chkTxtGroupCd() == true)
            {
                labelSet_GroupCdFrom.Focus();

                return(false);
            }

            //グループコードの検索終了のチェック
            if (labelSet_GroupCdTo.chkTxtGroupCd() == true)
            {
                labelSet_GroupCdTo.Focus();

                return(false);
            }

            //担当者コードの検索開始のチェック
            if (labelSet_TantoushaCdFrom.chkTxtTantosha() == true)
            {
                labelSet_TantoushaCdFrom.Focus();

                return(false);
            }

            //担当者コードの検索終了のチェック
            if (labelSet_TantoushaCdTo.chkTxtTantosha() == true)
            {
                labelSet_TantoushaCdTo.Focus();

                return(false);
            }

            return(true);
        }
示例#8
0
        ///<summary>
        ///     得意先売上検収データ取得
        ///</summary>
        private void getTokuisakiKensyu()
        {
            //年月日の日付フォーマット後を入れる用
            string strYMDformat = "";

            //得意先が空の場合
            if (labelSet_Tokuisaki.codeTxt.blIsEmpty() == false)
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "得意先を指定してください ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                labelSet_Tokuisaki.Focus();

                return;
            }

            //検索開始年月日に記入がある場合
            if (txtDenpyoYMDStart.blIsEmpty())
            {
                //日付フォーマット生成、およびチェック
                strYMDformat = txtDenpyoYMDStart.chkDateDataFormat(txtDenpyoYMDStart.Text);

                //検索開始年月日の日付チェック
                if (strYMDformat == "")
                {
                    // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    txtDenpyoYMDStart.Focus();

                    return;
                }
                else
                {
                    txtDenpyoYMDStart.Text = strYMDformat;
                }
            }

            //検索終了年月日に記入がある場合
            if (txtDenpyoYMDEnd.blIsEmpty())
            {
                //初期化
                strYMDformat = "";

                //日付フォーマット生成、およびチェック
                strYMDformat = txtDenpyoYMDEnd.chkDateDataFormat(txtDenpyoYMDEnd.Text);

                //検索終了年月日の日付チェック
                if (strYMDformat == "")
                {
                    // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    txtDenpyoYMDEnd.Focus();

                    return;
                }
                else
                {
                    txtDenpyoYMDEnd.Text = strYMDformat;
                }
            }

            //大分類チェック
            if (labelSet_Daibunrui.chkTxtDaibunrui())
            {
                labelSet_Daibunrui.Focus();
                return;
            }

            //中分類チェック
            if (labelSet_Chubunrui.chkTxtChubunrui(labelSet_Daibunrui.CodeTxtText))
            {
                labelSet_Chubunrui.Focus();
                return;
            }



            try
            {
                A0660_TokuisakiUriageKakunin_B siirekakuninB = new A0660_TokuisakiUriageKakunin_B();

                // 検索文字列格納用
                string[] arrSerach = new string[7];
                // 出力順条件取得用
                string[] arrOrder = new string[2];
                // 表示条件取得用
                string[] arrDisplay = new string[3];

                arrSerach[0] = labelSet_Tokuisaki.CodeTxtText;                   // 得意先コード
                arrSerach[1] = txtDenpyoYMDStart.Text;                           // 伝票年月日start
                arrSerach[2] = txtDenpyoYMDEnd.Text;                             // 伝票年月日end
                arrSerach[3] = labelSet_Daibunrui.CodeTxtText;                   // 大分類コード
                arrSerach[4] = labelSet_Chubunrui.CodeTxtText;                   // 中分類コード
                arrSerach[5] = txtKataban.Text;                                  // 品名・型番
                arrSerach[6] = txtBiko.Text;                                     // 備考

                arrOrder[0] = radOutOrder.radbtn0.Checked.ToString().ToUpper();  // 出力順 日付・伝票番号順
                arrOrder[1] = radOutOrder.radbtn1.Checked.ToString().ToUpper();  // 出力順 型番・日付順

                arrDisplay[0] = radDisplay.radbtn0.Checked.ToString().ToUpper(); // 表示 すべて
                arrDisplay[1] = radDisplay.radbtn1.Checked.ToString().ToUpper(); // 表示 未検収
                arrDisplay[2] = radDisplay.radbtn2.Checked.ToString().ToUpper(); // 表示 検収済

                DataTable dtUriagekensyu = siirekakuninB.getSiireData(arrSerach, arrOrder, arrDisplay);

                // 入力合計
                var total = (int)dtUriagekensyu.AsEnumerable().Sum(s => s.Field <decimal>("売上金額"));
                // 検収済合計
                var kensyuSum = (int)dtUriagekensyu.AsEnumerable().Where(s => s.Field <string>("検収状態") == "済")
                                .Sum(s => s.Field <decimal>("売上金額"));
                // 未検収合計
                var mikenSum = (int)dtUriagekensyu.AsEnumerable().Where(s => s.Field <string>("検収状態") != "済")
                               .Sum(s => s.Field <decimal>("売上金額"));

                // gridにバインド
                gridTokuisakiKensyu.DataSource = dtUriagekensyu;

                // カンマを付けてテキストボックスに入れる
                txtInputTotal.Text    = String.Format("{0:#,0}", total);
                txtKensyuTotal.Text   = String.Format("{0:#,0}", kensyuSum);
                txtMikensyuTotal.Text = String.Format("{0:#,0}", mikenSum);

                int rowCnt = 0;
                foreach (var row in gridTokuisakiKensyu.Rows)
                {
                    // 済の行は赤くする
                    if (gridTokuisakiKensyu.Rows[rowCnt].Cells[9].Value.ToString().Trim().Equals("済"))
                    {
                        gridTokuisakiKensyu.Rows[rowCnt].DefaultCellStyle.ForeColor = Color.Red;
                    }
                    else
                    {
                        gridTokuisakiKensyu.Rows[rowCnt].DefaultCellStyle.ForeColor = Color.Empty;
                    }
                    rowCnt++;
                }
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);
                // エラーメッセージ表示
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "データ取得に失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
            }
        }
示例#9
0
        ///<summary>
        ///     F10:Excel出力
        ///</summary>
        private void exportXls()
        {
            // SaveFileDialogクラスのインスタンスを作成
            SaveFileDialog sfd = new SaveFileDialog();

            // ファイル名の指定
            sfd.FileName = "得意先売上検収入力_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xlsx";
            // デフォルトパス取得(デスクトップ)
            string Init_dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            //はじめに表示されるフォルダを指定する
            sfd.InitialDirectory = Init_dir;
            // ファイルフィルタの設定
            sfd.Filter = "すべてのファイル(*.*)|*.*";


            //年月日の日付フォーマット後を入れる用
            string strYMDformat = "";

            //待機状態
            Cursor.Current = Cursors.WaitCursor;

            //得意先が空の場合
            if (labelSet_Tokuisaki.codeTxt.blIsEmpty() == false)
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "得意先を指定してください ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                labelSet_Tokuisaki.Focus();

                return;
            }

            //検索開始年月日に記入がある場合
            if (txtDenpyoYMDStart.blIsEmpty())
            {
                //日付フォーマット生成、およびチェック
                strYMDformat = txtDenpyoYMDStart.chkDateDataFormat(txtDenpyoYMDStart.Text);

                //検索開始年月日の日付チェック
                if (strYMDformat == "")
                {
                    // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    txtDenpyoYMDStart.Focus();

                    return;
                }
                else
                {
                    txtDenpyoYMDStart.Text = strYMDformat;
                }
            }

            //検索終了年月日に記入がある場合
            if (txtDenpyoYMDEnd.blIsEmpty())
            {
                //初期化
                strYMDformat = "";

                //日付フォーマット生成、およびチェック
                strYMDformat = txtDenpyoYMDEnd.chkDateDataFormat(txtDenpyoYMDEnd.Text);

                //検索終了年月日の日付チェック
                if (strYMDformat == "")
                {
                    // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    txtDenpyoYMDEnd.Focus();

                    return;
                }
                else
                {
                    txtDenpyoYMDEnd.Text = strYMDformat;
                }
            }

            //大分類チェック
            if (labelSet_Daibunrui.chkTxtDaibunrui())
            {
                labelSet_Daibunrui.Focus();
                return;
            }

            //中分類チェック
            if (labelSet_Chubunrui.chkTxtChubunrui(labelSet_Daibunrui.CodeTxtText))
            {
                labelSet_Chubunrui.Focus();
                return;
            }

            try
            {
                A0660_TokuisakiUriageKakunin_B siirekakuninB = new A0660_TokuisakiUriageKakunin_B();

                // 検索文字列格納用
                string[] arrSerach = new string[7];
                // 出力順条件取得用
                string[] arrOrder = new string[2];
                // 表示条件取得用
                string[] arrDisplay = new string[3];

                arrSerach[0] = labelSet_Tokuisaki.CodeTxtText;                   // 得意先コード
                arrSerach[1] = txtDenpyoYMDStart.Text;                           // 伝票年月日start
                arrSerach[2] = txtDenpyoYMDEnd.Text;                             // 伝票年月日end
                arrSerach[3] = labelSet_Daibunrui.CodeTxtText;                   // 大分類コード
                arrSerach[4] = labelSet_Chubunrui.CodeTxtText;                   // 中分類コード
                arrSerach[5] = txtKataban.Text;                                  // 品名・型番
                arrSerach[6] = txtBiko.Text;                                     // 備考

                arrOrder[0] = radOutOrder.radbtn0.Checked.ToString().ToUpper();  // 出力順 日付・伝票番号順
                arrOrder[1] = radOutOrder.radbtn1.Checked.ToString().ToUpper();  // 出力順 型番・日付順

                arrDisplay[0] = radDisplay.radbtn0.Checked.ToString().ToUpper(); // 表示 すべて
                arrDisplay[1] = radDisplay.radbtn1.Checked.ToString().ToUpper(); // 表示 未検収
                arrDisplay[2] = radDisplay.radbtn2.Checked.ToString().ToUpper(); // 表示 検収済

                // 検索実行
                DataTable dtUriagekensyu = siirekakuninB.getSiireData(arrSerach, arrOrder, arrDisplay);

                // カーソルをデフォルトに戻す
                this.Cursor = Cursors.Default;

                if (dtUriagekensyu.Rows.Count > 0)
                {
                    //ダイアログを表示する
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        CreatePdf cpdf = new CreatePdf();

                        // 出力するヘッダを設定
                        string[] header =
                        {
                            "日付",
                            "伝No.",
                            "メーカー",
                            "品名・型式",
                            "数量",
                            "売上単価",
                            "売上金額",
                            "備考",
                            "検収",
                        };

                        // Linqで出力対象の項目をSelect
                        // カラム名は以下のようにつける(カラム名でフォーマットを判断するため)
                        // 金額関係:***kingaku
                        // 単価関係:***tanka
                        // 原価:***genka
                        // 数量:***suryo
                        var outDat = dtUriagekensyu.AsEnumerable()
                                     .Select(dat => new
                        {
                            denYmd        = dat["伝票年月日"],
                            denNo         = dat["伝票番号"],
                            maker         = dat["メーカー"],
                            hinmei        = dat["品名型式"],
                            suryo         = dat["数量"],
                            uriagetanka   = dat["売上単価"],
                            uriagekingaku = dat["売上金額"],
                            biko          = dat["備考"],
                            kensyu        = dat["検収状態"]
                        }).ToList();

                        // listをDataTableに変換
                        DataTable dtUriKensyuList = cpdf.ConvertToDataTable(outDat);

                        string outFile = sfd.FileName;

                        cpdf.DtToXls(dtUriKensyuList, "得意先売上検収入力", outFile, 3, 1, header);

                        this.Cursor = Cursors.Default;

                        // メッセージボックスの処理、Excel作成完了の場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excelファイルを作成しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                        basemessagebox.ShowDialog();
                    }
                }
                else
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return;
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                // Excel出力失敗メッセージ
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excel出力に失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
示例#10
0
        /// <summary>
        /// blnDataCheck
        /// データチェック
        /// </summary>
        private Boolean blnDataCheck()
        {
            // 移動年月日のStart・Endは必須項目
            if (txtIdouYMDStart.Text.Equals(""))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n日付を入力してください。 ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtIdouYMDStart.Focus();

                return(false);
            }
            if (txtIdouYMDEnd.Text.Equals(""))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n日付を入力してください。 ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtIdouYMDEnd.Focus();

                return(false);
            }

            // 移動年月日のStart・Endの日付フォーマットチェック
            string datedata = txtIdouYMDStart.chkDateDataFormat(txtIdouYMDStart.Text);

            if ("".Equals(datedata))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_DATE_ALERT, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return(false);
            }
            else
            {
                txtIdouYMDStart.Text = datedata;
            }

            datedata = txtIdouYMDEnd.chkDateDataFormat(txtIdouYMDEnd.Text);
            if ("".Equals(datedata))
            {
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_DATE_ALERT, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return(false);
            }
            else
            {
                txtIdouYMDEnd.Text = datedata;
            }

            // 空文字チェック(営業所コード)
            if (labelSet_Eigyosho.codeTxt.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                labelSet_Eigyosho.Focus();
                return(false);
            }
            // 文字列チェック(営業所コード)
            if (labelSet_Eigyosho.chkTxtEigyousho())
            {
                return(false);
            }

            // 文字列チェック(大分類コード)
            if (labelSet_Daibunrui.chkTxtDaibunrui())
            {
                return(false);
            }


            // 大分類が存在していないが中分類が存在している場合
            if ("".Equals(labelSet_Daibunrui.CodeTxtText) && !"".Equals(labelSet_Chubunrui.CodeTxtText))
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                // 中分類コードを空にする。
                labelSet_Chubunrui.CodeTxtText    = "";
                labelSet_Chubunrui.ValueLabelText = "";

                labelSet_Daibunrui.Focus();
                return(false);
            }
            // 大分類が存在していて中分類も存在している場合
            else if (!"".Equals(labelSet_Daibunrui.CodeTxtText) && !"".Equals(labelSet_Chubunrui.CodeTxtText))
            {
                // 文字列チェック(中分類コード)
                if (labelSet_Chubunrui.chkTxtChubunrui(labelSet_Daibunrui.CodeTxtText))
                {
                    return(false);
                }
            }

            // 文字列チェック(メーカー)
            if (labelSet_Maker.chkTxtMaker())
            {
                return(false);
            }

            // 文字列チェック(営業担当者)
            if (labelSet_Tantousha.chkTxtTantosha())
            {
                return(false);
            }

            // 文字列チェック(入力担当者)
            if (labelSet_Nyuuryokusha.chkTxtTantosha())
            {
                return(false);
            }

            return(true);
        }
示例#11
0
        ///<summary>
        ///setGridSeihinDoubleClick
        ///データグリッドビュー内のデータ選択後の処理
        ///</summary>
        private void setSelectItem()
        {
            //データグリッドビューにデータが存在しなければ終了
            if (gridSeihin.RowCount == 0)
            {
                return;
            }

            //選択された月用
            string strSelectMonth = "";

            //選択された日付用
            string strSelectDay = "";

            //選択行の検索情報取得用
            List <string> lstSelectData = new List <string>();

            //検索データ用
            DateTime dateSelect;

            //検索データを取り込む
            dateSelect = (DateTime)gridSeihin.CurrentRow.Cells[0].Value;

            //月データを入れる
            strSelectMonth = dateSelect.Month.ToString();

            //文字数が1だった場合、0パディング
            if (strSelectMonth.Length == 1)
            {
                strSelectMonth = dateSelect.Month.ToString().PadLeft(2, '0');
            }

            //日付データを入れる
            strSelectDay = dateSelect.Day.ToString();

            //文字数が1だった場合、0パディング
            if (strSelectDay.Length == 1)
            {
                strSelectDay = dateSelect.Day.ToString().PadLeft(2, '0');
            }

            //日付データを取得
            string strSelectDate = (dateSelect.Year + "/" + strSelectMonth + "/" + strSelectDay).ToString();

            //名前データを取得
            string strSelectName = (string)gridSeihin.CurrentRow.Cells[1].Value.ToString();

            //検索するデータの取得
            lstSelectData.Add(strSelectDate);
            lstSelectData.Add(strSelectName);

            //ビジネス層のインスタンス生成
            ShohizeiritsuList_B shohizeilistB = new ShohizeiritsuList_B();

            try
            {
                //データグリッドビュー内のデータ選択後の処理
                shohizeilistB.getSelectItem(intFrmKind, strSelectDate);

                setEndAction(lstSelectData);
            }
            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;
            }
        }
示例#12
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // 検索条件格納用
            List <string> lstSearchItem  = new List <string>();
            List <Array>  lstSearchItem2 = new List <Array>();

            DataTable dtSoukoIdou = new DataTable();

            // ビジネス層のインスタンス生成
            D0280_SoukoIdouKakunin_B soukoIdouB = new D0280_SoukoIdouKakunin_B();

            try
            {
                // 検索データをリストに格納
                lstSearchItem  = setSearchList();
                lstSearchItem2 = getRadioBtn();

                // 検索実行
                dtSoukoIdou = soukoIdouB.getSoukoIdouList(lstSearchItem, lstSearchItem2, 2);

                if (dtSoukoIdou != null && dtSoukoIdou.Rows.Count > 0)
                {
                    // 印刷ダイアログ
                    Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A3, CommonTeisu.YOKO);
                    pf.ShowDialog(this);

                    // PDF出力用List(各テキストボックスの値をコードではなく名称で取得)
                    List <string> lstoutItem = new List <string>();
                    lstoutItem.Add(labelSet_Eigyosho.ValueLabelText);   // 営業所
                    lstoutItem.Add(txtIdouYMDStart.Text);               // 移動年月日Start
                    lstoutItem.Add(txtIdouYMDEnd.Text);                 // 移動年月日End
                    lstoutItem.Add(labelSet_Daibunrui.ValueLabelText);  // 大分類名称
                    lstoutItem.Add(txtKataban.Text);                    // 型番
                    lstoutItem.Add(txtBikou.Text);                      // 備考


                    // プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        // カーソルを待機状態にする
                        this.Cursor = Cursors.WaitCursor;

                        // PDF作成
                        String strFile = soukoIdouB.dbToPdf(dtSoukoIdou, lstoutItem);

                        // プレビュー
                        pf.execPreview(strFile);
                        pf.ShowDialog(this);
                    }
                    // 一括印刷の場合
                    else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                    {
                        // カーソルを待機状態にする
                        this.Cursor = Cursors.WaitCursor;

                        // PDF作成
                        String strFile = soukoIdouB.dbToPdf(dtSoukoIdou, lstoutItem);

                        // 一括印刷
                        pf.execPrint(null, strFile, CommonTeisu.SIZE_A3, CommonTeisu.YOKO, true);
                    }

                    pf.Dispose();

                    // カーソルの状態を元に戻す
                    this.Cursor = Cursors.Default;
                }
                else
                {
                    // カーソルの状態を元に戻す
                    this.Cursor = Cursors.Default;

                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                // カーソルの状態を元に戻す
                this.Cursor = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
示例#13
0
        ///<summary>
        ///setTxtGyoshuLeave
        ///code入力箇所からフォーカスが外れた時
        ///</summary>
        public void setTxtGyoshuLeave(object sender, EventArgs e)
        {
            //検索時のデータ取り出し先
            DataTable dtSetCd;

            //文字チェック用
            Boolean blnGood;

            //前後の空白を取り除く
            txtGyoshuCd.Text = txtGyoshuCd.Text.Trim();

            //空文字判定
            if (txtGyoshuCd.blIsEmpty() == false)
            {
                return;
            }

            // 業種コードチェック
            if (chkGyoshuCd() == true)
            {
                return;
            }

            //ビジネス層のインスタンス生成
            M1060_Gyoshu_B daibunB = new M1060_Gyoshu_B();

            try
            {
                //戻り値のDatatableを取り込む
                dtSetCd = daibunB.getTxtGyoshuLeave(txtGyoshuCd.Text);

                //Datatable内のデータが存在する場合
                if (dtSetCd.Rows.Count != 0)
                {
                    txtGyoshuCd.Text   = dtSetCd.Rows[0]["業種コード"].ToString();
                    txtGyoshuName.Text = dtSetCd.Rows[0]["業種名"].ToString();

                    // ファンクションボタン制御
                    this.btnF01.Enabled = true;
                    this.btnF03.Enabled = true;
                    this.btnF04.Enabled = true;
                }
                else
                {
                    txtGyoshuName.Text = "";

                    // ファンクションボタン制御
                    this.btnF01.Enabled = true;
                    this.btnF03.Enabled = false;
                    this.btnF04.Enabled = true;
                }
                txtGyoshuName.Focus();
            }
            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;
            }
        }
示例#14
0
        ///<summary>
        ///delGyoushu
        ///テキストボックス内のデータをDBから削除
        ///</summary>
        public void delGyoushu()
        {
            //記入情報削除用
            List <string> lstGyoushu = new List <string>();

            //検索時のデータ取り出し先
            DataTable dtSetCd;

            //文字判定(業種コード、業種名)
            if (txtGyoshuCd.blIsEmpty() == false && txtGyoshuName.blIsEmpty() == false)
            {
                return;
            }

            // 業種コードチェック
            if (chkGyoshuCd() == true)
            {
                return;
            }

            //ビジネス層のインスタンス生成
            M1060_Gyoshu_B gyoshuB = new M1060_Gyoshu_B();

            try
            {
                //ビジネス層、検索ロジックに移動
                dtSetCd = gyoshuB.getTxtGyoshuLeave(txtGyoshuCd.Text);

                //検索結果にデータが存在しなければ終了
                if (dtSetCd.Rows.Count == 0)
                {
                    return;
                }

                //メッセージボックスの処理、削除するか否かのウィンドウ(YES,NO)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_BEFORE, CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);
                //NOが押された場合
                if (basemessagebox.ShowDialog() == DialogResult.No)
                {
                    return;
                }

                //削除情報を入れる(業種コード、業種名、ユーザー名)
                lstGyoushu.Add(dtSetCd.Rows[0]["業種コード"].ToString());
                lstGyoushu.Add(dtSetCd.Rows[0]["業種名"].ToString());
                lstGyoushu.Add(SystemInformation.UserName);

                //ビジネス層、削除ロジックに移動
                gyoshuB.delGyoshu(lstGyoushu);

                //メッセージボックスの処理、削除完了のウィンドウ(OK)
                basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_AFTER, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();
                //テキストボックスを白紙にする
                delText();
            }
            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;
            }
        }
        ///<summary>
        ///addHachu
        ///テキストボックス内のデータをDBに登録または更新
        ///</summary>
        private void addShuko()
        {
            //データ追加用(テーブル名)
            List <string> lstTableName = new List <string>();
            //データ追加用(データ内容)
            List <string> lstData = new List <string>();

            //年月日の日付フォーマット後を入れる用
            string strYMDformat = "";

            //文字判定(出庫年月日)
            if (txtYMD.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //出庫年月日にフォーカス
                txtYMD.Focus();
                return;
            }

            //文字判定(担当者)
            if (lblsetTantosha.codeTxt.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //担当者にフォーカス
                lblsetTantosha.Focus();
                return;
            }

            //文字判定(出庫営業所)
            if (lblsetShukoEigyosho.codeTxt.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //出庫営業所にフォーカス
                lblsetShukoEigyosho.Focus();
                return;
            }

            //文字判定(大分類がなく、中分類がある場合)
            if (lblsetDaibunrui.codeTxt.blIsEmpty() == false && lblsetChubunrui.codeTxt.blIsEmpty() == true)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                // 中分類コードを空にする。
                lblsetChubunrui.CodeTxtText    = "";
                lblsetChubunrui.ValueLabelText = "";

                lblsetDaibunrui.Focus();
                return;
            }
            //大分類があり、中分類もある場合
            else if (lblsetDaibunrui.codeTxt.blIsEmpty() == true && lblsetChubunrui.codeTxt.blIsEmpty() == true)
            {
                //文字判定(中分類)
                if (lblsetChubunrui.chkTxtChubunrui(lblsetDaibunrui.CodeTxtText))
                {
                    lblsetChubunrui.Focus();
                    return;
                }
            }

            //文字判定(メーカー)
            if (lblsetMaker.codeTxt.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //メーカーにフォーカス
                lblsetMaker.Focus();
                return;
            }

            //文字判定(数量)
            if (txtSu.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //数量にフォーカス
                txtSu.Focus();
                return;
            }

            //文字判定(単価)
            if (txtTanka.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //単価にフォーカス
                txtTanka.Focus();
                return;
            }

            //文字判定(品名)
            if (txtHinmei.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //品名にフォーカス
                txtHinmei.Focus();
                return;
            }

            //日付フォーマット生成、およびチェック
            strYMDformat = txtYMD.chkDateDataFormat(txtYMD.Text);

            //開始年月日の日付チェック
            if (strYMDformat == "")
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtYMD.Focus();

                return;
            }
            else
            {
                txtYMD.Text = strYMDformat;
            }

            //担当者コードが正しくない場合
            if (lblsetTantosha.chkTxtTantosha() == true)
            {
                //担当者にフォーカス
                lblsetTantosha.Focus();
                return;
            }

            //出庫営業所コードが正しくない場合
            if (lblsetShukoEigyosho.chkTxtEigyousho() == true)
            {
                //出庫営業所にフォーカス
                lblsetShukoEigyosho.Focus();
                return;
            }

            //大分類コードが正しくない場合
            if (lblsetDaibunrui.chkTxtDaibunrui() == true)
            {
                //大分類にフォーカス
                lblsetDaibunrui.Focus();
                return;
            }

            //メーカーコードが正しくない場合
            if (lblsetMaker.chkTxtMaker() == true)
            {
                //メーカーにフォーカス
                lblsetMaker.Focus();
                return;
            }

            //数量、数値チェック
            if (txtSu.chkMoneyText())
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された数値が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtSu.Focus();
                return;
            }

            //単価、数値チェック
            if (txtTanka.chkMoneyText())
            {
                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された数値が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtTanka.Focus();
                return;
            }

            //伝票番号がない場合、伝票番号テーブルから新規伝票番号を得る
            if (txtDenpyoNo.blIsEmpty() == false)
            {
                //ビジネス層のインスタンス生成
                A0160_ShukoIraiInput_B shukoiraiB = new A0160_ShukoIraiInput_B();
                try
                {
                    //新規番号を取得
                    txtDenpyoNo.Text = (shukoiraiB.getNewDenpyo("出庫依頼")).Rows[0]["最終番号"].ToString();
                }
                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;
                }
            }

            //DB登録用
            string strC1 = "";
            string strC2 = "";
            string strC3 = "";
            string strC4 = "";
            string strC5 = "";
            string strC6 = "";

            //品名を自分で記入した場合
            if (txtHinmei.Enabled == true)
            {
                //品名をC1に入れる
                strC1 = txtHinmei.Text;
            }
            //品名が編集できない場合(商品検索画面から取り込んだ場合)
            else
            {
                //自分で記入した場合空になるのでテキストボックスをそのまま入れる(現行通り)
                strC1 = txtC1.Text;
                strC2 = txtC2.Text;
                strC3 = txtC3.Text;
                strC4 = txtC4.Text;
                strC5 = txtC5.Text;
                strC6 = txtC6.Text;
            }

            //商品コードを入れる用
            string strShohinCd;

            //商品コードが空でない場合
            if (txtShohinCd.blIsEmpty() == false)
            {
                //強制的に88888を記入
                strShohinCd = "88888";
            }
            else
            {
                //商品コードテキストボックスを記入
                strShohinCd = txtShohinCd.Text;
            }

            try
            {
                //ビジネス層のインスタンス生成
                A0160_ShukoIraiInput_B shukoiraiB = new A0160_ShukoIraiInput_B();

                //PROCに必要なテーブル名の追加
                lstData.Add(DateTime.Parse(txtYMD.Text).ToString()); //依頼年月日
                lstData.Add(txtDenpyoNo.Text);                       //伝票番号
                lstData.Add(lblsetTantosha.CodeTxtText);             //担当者コード
                lstData.Add(lblsetEigyosho.CodeTxtText);             //営業所コード
                lstData.Add(lblsetShukoEigyosho.CodeTxtText);        //出庫営業所コード
                lstData.Add(txtShohinCd.Text);                       //商品コード
                lstData.Add(lblsetMaker.CodeTxtText);                //メーカーコード
                lstData.Add(lblsetDaibunrui.CodeTxtText);            //大分類コード
                lstData.Add(lblsetChubunrui.CodeTxtText);            //中分類コード
                lstData.Add(strC1);                                  //C1
                lstData.Add(strC2);                                  //C2
                lstData.Add(strC3);                                  //C3
                lstData.Add(strC4);                                  //C4
                lstData.Add(strC5);                                  //C5
                lstData.Add(strC6);                                  //C6
                lstData.Add(txtSu.Text);                             //数量
                lstData.Add(txtTanka.Text);                          //単価
                lstData.Add(DBNull.Value.ToString());                //承認年月日
                lstData.Add("N");                                    //承認
                lstData.Add("0");                                    //処理済
                lstData.Add(SystemInformation.UserName);             //ユーザー名

                //PROCに必要なカラム名の追加
                lstTableName.Add("@依頼年月日");               //依頼年月日
                lstTableName.Add("@伝票番号");                //伝票番号
                lstTableName.Add("@担当者コード");              //担当者
                lstTableName.Add("@営業所コード");              //営業所
                lstTableName.Add("@出庫倉庫");                //出庫営業所
                lstTableName.Add("@商品コード");               //商品コード
                lstTableName.Add("@メーカーコード");             //メーカーコード
                lstTableName.Add("@大分類コード");              //大分類コード
                lstTableName.Add("@中分類コード");              //中分類コード
                lstTableName.Add("@C1");                  //C1
                lstTableName.Add("@C2");                  //C2
                lstTableName.Add("@C3");                  //C3
                lstTableName.Add("@C4");                  //C4
                lstTableName.Add("@C5");                  //C5
                lstTableName.Add("@C6");                  //C6
                lstTableName.Add("@数量");                  //数量
                lstTableName.Add("@単価");                  //単価
                lstTableName.Add("@承認年月日");               //承認年月日
                lstTableName.Add("@承認");                  //承認
                lstTableName.Add("@処理済");                 //処理済
                lstTableName.Add("@ユーザー名");               //ユーザー名

                //データの追加または更新
                shukoiraiB.addShukoInput(lstData, lstTableName);

                //メッセージボックスの処理、登録完了のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();

                //指定テキストボックスを白紙にする
                delText();

                //出庫依頼明細グリッドの表示
                setGridData();

                //出庫営業所にフォーカス
                lblsetShukoEigyosho.Focus();
            }
            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;
            }
        }
示例#16
0
        ///<summary>
        ///setSelectItem
        ///データグリッドビュー内のデータ選択後の処理
        ///</summary>
        private void setSelectItem()
        {
            //検索結果にデータが存在しなければ終了
            if (gridShiresaki.RowCount == 0)
            {
                return;
            }

            //データ渡し用
            List <string> lstSelectData = new List <string>();

            string strSelectId   = (string)gridShiresaki.CurrentRow.Cells["得意先コード"].Value;
            string strSelectName = (string)gridShiresaki.CurrentRow.Cells["得意先名"].Value;

            //int intSelectRow = 0;
            //int intSelectColumn = 0;

            ////何行目かを確保
            //intSelectRow = gridShiresaki.CurrentCell.RowIndex;
            //intSelectColumn = gridShiresaki.CurrentCell.ColumnIndex;

            ////datagridviewをdatatable化
            //DataTable dtSelect = (DataTable)gridShiresaki.DataSource;

            ////選択した得意先コードの確保
            //strSelectId = dtSelect.Rows[intSelectRow]["得意先コード"].ToString();

            ////選択した得意先コードが存在しない場合
            //if (strSelectId == "")
            //{
            //    return;
            //}

            ////選択した得意先名の確保
            //strSelectName = dtSelect.Rows[intSelectRow]["得意先名"].ToString();

            //前後の空白を取り除く

            strSelectName = strSelectName.Trim();
            strSelectId   = strSelectId.Trim();

            //検索情報を入れる
            lstSelectData.Add(strSelectId);
            lstSelectData.Add(strSelectName);

            //ビジネス層のインスタンス生成
            ShiresakiList_B shiresakilistB = new ShiresakiList_B();

            try
            {
                //ビジネス層、検索ロジックに移動
                shiresakilistB.getSelectItem(intFrmKind, strSelectId);
                EndAction(lstSelectData);
            }
            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;
            }
        }
        ///<summary>
        ///delShuko
        ///データ削除
        ///</summary>
        private void delShuko()
        {
            //データ追加用(テーブル名)
            List <string> lstTableName = new List <string>();
            //データ追加用(データ内容)
            List <string> lstData = new List <string>();

            //伝票番号がない場合
            if (txtDenpyoNo.blIsEmpty() == false)
            {
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, "削除する伝票を呼び出してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //グリッドにフォーカス
                gridShuko.Focus();
                return;
            }

            //メッセージボックスの処理、削除するか否かのウィンドウ(YES,NO)
            BaseMessageBox basemessageboxDel = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_BEFORE, CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);

            //NOが押された場合
            if (basemessageboxDel.ShowDialog() == DialogResult.No)
            {
                return;
            }

            try
            {
                //ビジネス層のインスタンス生成
                A0160_ShukoIraiInput_B shukoiraiB = new A0160_ShukoIraiInput_B();

                //PROCに必要なデータの追加
                lstData.Add(txtDenpyoNo.Text);                  //伝票番号
                lstData.Add(SystemInformation.UserName);        //ユーザー名

                //PROCに必要なカラム名の追加
                lstTableName.Add("@伝票番号");                 //伝票番号
                lstTableName.Add("@ユーザー名");                //ユーザー名

                //データの削除
                shukoiraiB.updShukoInputDel(lstData, lstTableName);

                //メッセージボックスの処理、削除完了のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();

                //指定テキストボックスを白紙にする
                delText();

                //出庫営業所にフォーカス
                lblsetShukoEigyosho.Focus();
            }
            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;
            }
        }
示例#18
0
        ///<summary>
        ///addDaibunrui
        ///テキストボックス内のデータをDBに登録
        ///</summary>
        private void addDaibunrui()
        {
            //記入情報登録用
            List <string> lstString = new List <string>();

            //文字判定(大分類コード)
            if (txtDaibunrui.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtDaibunrui.Focus();
                return;
            }
            //文字判定(大分類名)
            if (txtName.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtName.Focus();
                return;
            }

            // 大分類コードエラーチェック
            if (chkDaibunCd() == true)
            {
                return;
            }

            //登録情報を入れる(大分類コード、大分類名、ラべル1~6、ユーザー名)
            lstString.Add(txtDaibunrui.Text);
            lstString.Add(txtName.Text);
            lstString.Add(txtLabel1.Text);
            lstString.Add(txtLabel2.Text);
            lstString.Add(txtLabel3.Text);
            lstString.Add(txtLabel4.Text);
            lstString.Add(txtLabel5.Text);
            lstString.Add(txtLabel6.Text);
            lstString.Add(SystemInformation.UserName);

            //ビジネス層のインスタンス生成
            M1010_Daibunrui_B daibunB = new M1010_Daibunrui_B();

            try
            {
                //登録
                daibunB.addDaibunrui(lstString);

                //メッセージボックスの処理、登録完了のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();
                //テキストボックスを白紙にする
                delText();
            }
            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;
            }
        }
        /// <summary>
        /// F10:Excel出力
        /// </summary>
        private void exportXls()
        {
            // SaveFileDialogクラスのインスタンスを作成
            SaveFileDialog sfd = new SaveFileDialog();

            // ファイル名の指定
            sfd.FileName = "担当者別売上管理表_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xlsx";
            // デフォルトパス取得(デスクトップ)
            string Init_dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            //はじめに表示されるフォルダを指定する
            sfd.InitialDirectory = Init_dir;
            // ファイルフィルタの設定
            sfd.Filter = "すべてのファイル(*.*)|*.*";

            try
            {
                // データ検索用
                List <string> lstSearchItem = new List <string>();

                // データチェック
                if (!blnDataCheack())
                {
                    return;
                }

                //待機状態
                Cursor.Current = Cursors.WaitCursor;

                // 検索するデータをリストに格納
                lstSearchItem.Add(txtYmdFrom.Text);
                lstSearchItem.Add(txtYmdTo.Text);

                // 営業所コード(開始)が空の場合
                if (labelSet_EigyoshoCdFrom.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("0000");
                }
                else
                {
                    lstSearchItem.Add(labelSet_EigyoshoCdFrom.CodeTxtText);
                }
                // 営業所コード(終了)が空の場合
                if (labelSet_EigyoshoCdTo.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("9999");
                }
                else
                {
                    lstSearchItem.Add(labelSet_EigyoshoCdTo.CodeTxtText);
                }

                // グループコード(開始)が空の場合
                if (labelSet_GroupCdFrom.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("0000");
                }
                else
                {
                    lstSearchItem.Add(labelSet_GroupCdFrom.CodeTxtText);
                }
                // グループコード(終了)が空の場合
                if (labelSet_GroupCdTo.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("9999");
                }
                else
                {
                    lstSearchItem.Add(labelSet_GroupCdTo.CodeTxtText);
                }

                // 担当者コード(開始)が空の場合
                if (labelSet_TantoushaCdFrom.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("0000");
                }
                else
                {
                    lstSearchItem.Add(labelSet_TantoushaCdFrom.CodeTxtText);
                }
                // 担当者コード(終了)が空の場合
                if (labelSet_TantoushaCdTo.CodeTxtText.Equals(""))
                {
                    lstSearchItem.Add("9999");
                }
                else
                {
                    lstSearchItem.Add(labelSet_TantoushaCdTo.CodeTxtText);
                }

                // 経過月数
                lstSearchItem.Add(intDateDiff(txtYmdFrom.Text, txtYmdTo.Text).ToString());

                // ビジネス層のインスタンス生成
                C0130_TantouUriageArariPrint_B uriagePrint_B = new C0130_TantouUriageArariPrint_B();

                // 検索実行
                DataTable dtUriage = uriagePrint_B.getUriage(lstSearchItem);

                // カーソルを戻す
                this.Cursor = Cursors.Default;

                // 対象データがある場合
                if (dtUriage != null && dtUriage.Rows.Count > 0)
                {
                    // ダイアログ表示
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        CreatePdf cpdf = new CreatePdf();

                        // 出力するヘッダを設定
                        string[] header =
                        {
                            "営業所名",
                            "グループ名",
                            "担当者名",
                            "売上額",
                            "粗利額",
                            "粗利率",
                            "指定期間内受注残金額",
                            "指定期間内受注残粗利",
                            "指定期間以降受注残金額",
                            "指定期間以降受注残粗利",
                            "月末売掛金残",
                            "当月入金額",
                            "月目標",
                            "期間達成率",
                        };

                        // Linqで出力対象の項目をSelect
                        // カラム名は以下のようにつける(カラム名でフォーマットを判断するため)
                        // 金額関係:***kingaku
                        // 単価関係:***tanka
                        // 原価:***genka
                        // 数量:***suryo
                        var outDat = dtUriage.AsEnumerable()
                                     .Select(dat => new
                        {
                            eigyosyoName              = dat["営業所名"],
                            groupName                 = dat["グループ名"],
                            tantoName                 = dat["担当者名"],
                            uriageKingaku             = dat["売上額"],
                            arariKingaku              = dat["粗利額"],
                            arariritu                 = dat["粗利率"],
                            getumatuJuchuzanKingaku   = dat["月末迄受注残売上"],
                            getumatuJuchuarariKingaku = dat["月末迄受注残粗利"],
                            yokugetuJuchuzankingaku   = dat["翌月以降受注残売上"],
                            yokugetuJuchuarariKingaku = dat["翌月以降受注残粗利"],
                            urikakezanKingaku         = dat["月末売掛金残"],
                            nyuKingaku                = dat["当月入金額"],
                            tougetuzanKingaku         = dat["年間売上目標"],
                            taseiritu                 = dat["達成率"],
                        }).ToList();

                        // listをDataTableに変換
                        DataTable dtTantoArari = cpdf.ConvertToDataTable(outDat);

                        string outFile = sfd.FileName;

                        cpdf.DtToXls(dtTantoArari, "担当者別売上管理表", outFile, 3, 1, header);

                        this.Cursor = Cursors.Default;

                        // メッセージボックスの処理、Excel作成完了の場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excelファイルを作成しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                        basemessagebox.ShowDialog();
                    }
                }
                else
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    //元に戻す
                    Cursor.Current = Cursors.Default;
                    return;
                }
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);

                // Excel出力失敗メッセージ
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excel出力に失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
示例#20
0
        ///<summary>
        ///delDaibunrui
        ///テキストボックス内のデータをDBから削除
        ///</summary>
        public void delDaibunrui()
        {
            //記入情報削除用
            List <string> lstDaibunData = new List <string>();

            //検索時のデータ取り出し先
            DataTable dtSetCd;

            //空文字判定(大分類コード)
            if (txtDaibunrui.blIsEmpty() == false)
            {
                return;
            }

            // 大分類コードエラーチェック
            if (chkDaibunCd() == true)
            {
                return;
            }

            //ビジネス層のインスタンス生成
            M1010_Daibunrui_B daibunB = new M1010_Daibunrui_B();

            try
            {
                //検索
                dtSetCd = daibunB.getTxtDaibunruiLeave(txtDaibunrui.Text);

                //検索結果にデータが存在しなければ終了
                if (dtSetCd.Rows.Count == 0)
                {
                    return;
                }

                //メッセージボックスの処理、削除するか否かのウィンドウ(YES,NO)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_BEFORE, CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);
                //NOが押された場合
                if (basemessagebox.ShowDialog() == DialogResult.No)
                {
                    return;
                }

                //削除情報を入れる(大分類CD、大分類名、ラベル1~6、ユーザー名)
                lstDaibunData.Add(dtSetCd.Rows[0]["大分類コード"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["大分類名"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名1"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名2"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名3"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名4"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名5"].ToString());
                lstDaibunData.Add(dtSetCd.Rows[0]["ラベル名6"].ToString());
                lstDaibunData.Add(SystemInformation.UserName);

                //ビジネス層、削除ロジックに移動
                daibunB.delDaibunrui(lstDaibunData);
                //メッセージボックスの処理、削除完了のウィンドウ(OK)
                basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_AFTER, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                basemessagebox.ShowDialog();
                //テキストボックスを白紙にする
                delText();
            }
            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;
            }
        }
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            //待機状態
            Cursor.Current = Cursors.WaitCursor;

            // データチェック処理
            if (!dataCheack())
            {
                //元に戻す
                Cursor.Current = Cursors.Default;
                return;
            }

            // データ検索用
            List <string> lstSearchItem = new List <string>();


            // ビジネス層のインスタンス生成
            B0410_SeikyuItiranPrint_B seikyuitiranprintB = new B0410_SeikyuItiranPrint_B();

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtSimekiriYMD.Text);
                lstSearchItem.Add(txtKaisiYMD.Text);
                lstSearchItem.Add(labelSet_TokuisakiStart.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiEnd.CodeTxtText);
                lstSearchItem.Add(txtSimekiribiCd.Text);
                if (radSetSort.judCheckBtn() == 0 || radSetSort.radbtn0.Checked)
                {
                    lstSearchItem.Add("1");
                }
                else if (radSetSort.judCheckBtn() == 1 || radSetSort.radbtn1.Checked)
                {
                    lstSearchItem.Add("2");
                }
                else
                {
                    lstSearchItem.Add("3");
                }
                lstSearchItem.Add(Environment.UserName);


                // 検索実行(印刷用)
                DataTable dtSeikyuItiran = seikyuitiranprintB.getSeikyuItiran(lstSearchItem);

                // レコードが0件だった場合は終了)
                if (dtSeikyuItiran.Rows.Count <= 0)
                {
                    // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();

                    //元に戻す
                    Cursor.Current = Cursors.Default;
                    return;
                }

                //元に戻す
                Cursor.Current = Cursors.Default;

                //プリントダイアログ!
                Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_B4, CommonTeisu.YOKO);

                pf.ShowDialog(this);
                if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                {
                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // PDF作成
                    string strFile = seikyuitiranprintB.dbToPdf(dtSeikyuItiran, lstSearchItem);
                    pf.execPreview(@strFile);
                }
                else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                {
                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // PDF作成
                    string strFile = seikyuitiranprintB.dbToPdf(dtSeikyuItiran, lstSearchItem);

                    // 用紙サイズ、印刷方向はインスタンス生成と同じ値を入れる
                    // ダイアログ表示時は最後の引数はtrue
                    // (ダイアログ非経由の直接印刷時は先頭引数にプリンタ名を入れ、最後の引数をfalseに)
                    pf.execPrint(null, @strFile, CommonTeisu.SIZE_A4, CommonTeisu.YOKO, true);
                }

                //元に戻す
                Cursor.Current = Cursors.Default;
                pf.Dispose();
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);

                //元に戻す
                Cursor.Current = Cursors.Default;
                return;
            }
        }
示例#22
0
        ///<summary>
        ///setTxtDaibunruiLeave
        ///code入力箇所からフォーカスが外れた時
        ///</summary>
        public void setTxtDaibunruiLeave(object sender, EventArgs e)
        {
            //フォーカス位置の確保
            Control cActive = this.ActiveControl;

            //検索時のデータ取り出し先
            DataTable dtSetCd = null;

            //前後の空白を取り除く
            txtDaibunrui.Text = txtDaibunrui.Text.Trim();

            //空文字判定
            if (txtDaibunrui.blIsEmpty() == false)
            {
                return;
            }

            // 大分類コードエラーチェック
            if (chkDaibunCd() == true)
            {
                return;
            }

            //ビジネス層、検索ロジックに移動
            M1010_Daibunrui_B daibunB = new M1010_Daibunrui_B();

            try
            {
                //戻り値のDatatableを取り込む
                dtSetCd = daibunB.getTxtDaibunruiLeave(txtDaibunrui.Text);

                //Datatable内のデータが存在する場合
                if (dtSetCd.Rows.Count != 0)
                {
                    txtDaibunrui.Text = dtSetCd.Rows[0]["大分類コード"].ToString();
                    txtName.Text      = dtSetCd.Rows[0]["大分類名"].ToString();
                    txtLabel1.Text    = dtSetCd.Rows[0]["ラベル名1"].ToString();
                    txtLabel2.Text    = dtSetCd.Rows[0]["ラベル名2"].ToString();
                    txtLabel3.Text    = dtSetCd.Rows[0]["ラベル名3"].ToString();
                    txtLabel4.Text    = dtSetCd.Rows[0]["ラベル名4"].ToString();
                    txtLabel5.Text    = dtSetCd.Rows[0]["ラベル名5"].ToString();
                    txtLabel6.Text    = dtSetCd.Rows[0]["ラベル名6"].ToString();
                    txtName.Focus();
                    this.btnF01.Enabled = true;
                    this.btnF03.Enabled = true;
                    this.btnF04.Enabled = true;
                }
                else
                {
                    txtName.Text        = "";
                    this.btnF01.Enabled = true;
                    this.btnF03.Enabled = false;
                    this.btnF04.Enabled = true;
                }
                cActive.Focus();
            }
            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;
            }
        }
        /// <summary>
        /// dataCheack
        /// データチェック処理
        /// </summary>
        private Boolean dataCheack()
        {
            // 空文字判定(締切年月日)
            if (txtSimekiriYMD.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtSimekiriYMD.Focus();
                return(false);
            }
            else
            {
                // 日付フォーマットチェック
                string datedata = txtSimekiriYMD.chkDateDataFormat(txtSimekiriYMD.Text);
                if ("".Equals(datedata))
                {
                    // メッセージボックスの処理
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_DATE_ALERT, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return(false);
                }
                else
                {
                    txtSimekiriYMD.Text = datedata;
                }
            }

            // 空文字判定(開始年月日)
            if (txtKaisiYMD.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtKaisiYMD.Focus();
                return(false);
            }
            else
            {
                // 日付フォーマットチェック
                string datedata = txtKaisiYMD.chkDateDataFormat(txtKaisiYMD.Text);
                if ("".Equals(datedata))
                {
                    // メッセージボックスの処理
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_DATE_ALERT, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return(false);
                }
                else
                {
                    txtKaisiYMD.Text = datedata;
                }
            }


            // 空文字判定(締切日コード)
            if (txtSimekiribiCd.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                txtSimekiribiCd.Focus();
                return(false);
            }

            // 空文字判定(開始得意先コード)
            if (labelSet_TokuisakiStart.codeTxt.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                labelSet_TokuisakiStart.Focus();
                return(false);
            }
            else
            {
                // 入力チェック(得意先コード(取引先))
                if (labelSet_TokuisakiStart.chkTxtTorihikisaki())
                {
                    return(false);
                }
            }

            // 空文字判定(終了得意先コード)
            if (labelSet_TokuisakiEnd.codeTxt.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                labelSet_TokuisakiEnd.Focus();
                return(false);
            }
            else
            {
                // 入力チェック(得意先コード(取引先))
                if (labelSet_TokuisakiEnd.chkTxtTorihikisaki())
                {
                    return(false);
                }
            }

            //string tmp1 = DateTime.Parse(txtSimekiriYMD.Text).DayOfWeek.ToString("d");
            string tmp1 = DateTime.Parse(txtSimekiriYMD.Text).ToString("dd");

            if (tmp1 != txtSimekiribiCd.Text)
            {
                // メッセージボックスの処理、の場合のウィンドウ(YES,NO)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, "締日付の確認", "締切年月日の日付と締切日コードが違います。\r\n続行しますか?", CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);

                // NOが押された場合
                if (basemessagebox.ShowDialog() == DialogResult.No)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#24
0
        ///<summary>
        ///     F10:Excel出力
        ///</summary>
        private void excelDaibun()
        {
            //SQL実行時に取り出したデータを入れる用
            DataTable dtSetCd_B = new DataTable();

            //ビジネス層のインスタンス生成
            M1010_Daibunrui_B daibunB = new M1010_Daibunrui_B();

            try
            {
                dtSetCd_B = daibunB.getPrintData();

                BaseMessageBox basemessagebox;
                //取得したデータがない場合
                if (dtSetCd_B == null || dtSetCd_B.Rows.Count == 0)
                {
                    //例外発生メッセージ(OK)
                    basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return;
                }

                // SaveFileDialogクラスのインスタンスを作成
                SaveFileDialog sfd = new SaveFileDialog();
                // ファイル名の指定
                sfd.FileName = "大分類マスタ_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xlsx";
                // デフォルトパス取得(デスクトップ)
                string Init_dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                //はじめに表示されるフォルダを指定する
                sfd.InitialDirectory = Init_dir;
                // ファイルフィルタの設定
                sfd.Filter = "すべてのファイル(*.*)|*.*";

                //ダイアログを表示する
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    CreatePdf cpdf = new CreatePdf();

                    // 出力するヘッダを設定
                    string[] header =
                    {
                        "コード",
                        "大分類名",
                    };

                    string outFile = sfd.FileName;

                    // Excel作成処理
                    cpdf.DtToXls(dtSetCd_B, "大分類マスタリスト", outFile, 3, 1, header);

                    // メッセージボックスの処理、Excel作成完了の場合のウィンドウ(OK)
                    basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "Excelファイルを作成しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            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;
            }
        }
示例#25
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データチェック
            if (!blnDataCheck())
            {
                return;
            }

            // 検索するデータをリストに格納
            lstSearchItem.Add(txtYear.Text);
            lstSearchItem.Add(lsTantoF.CodeTxtText);
            lstSearchItem.Add(lsTantoT.CodeTxtText);

            // ビジネス層のインスタンス生成
            C1530_TantouUriageArariNenkan_B uriagePrint_B = new C1530_TantouUriageArariNenkan_B();

            try
            {
                this.Cursor = Cursors.WaitCursor;

                // 検索実行
                DataTable dtUriage = uriagePrint_B.getUriage(lstSearchItem);

                this.Cursor = Cursors.Default;

                // 対象データがある場合
                if (dtUriage != null && dtUriage.Rows.Count > 0)
                {
                    // 印刷ダイアログ
                    Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A3, CommonTeisu.YOKO);
                    pf.ShowDialog(this);

                    // プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        this.Cursor = Cursors.WaitCursor;

                        // PDF作成
                        String strFile = uriagePrint_B.dbToPdf(dtUriage, lstSearchItem);

                        this.Cursor = Cursors.Default;

                        // プレビュー
                        pf.execPreview(strFile);
                    }
                    // 一括印刷の場合
                    else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                    {
                        this.Cursor = Cursors.WaitCursor;

                        // PDF作成
                        String strFile = uriagePrint_B.dbToPdf(dtUriage, lstSearchItem);

                        this.Cursor = Cursors.Default;

                        // 一括印刷
                        pf.execPrint(null, strFile, CommonTeisu.SIZE_A3, CommonTeisu.YOKO, true);
                    }

                    pf.Dispose();
                }
                else
                {
                    this.Cursor = Cursors.Default;

                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
        ///<summary>
        ///setShukoData
        ///出庫依頼データの表示
        ///</summary>
        private void setShukoData()
        {
            //検索時のデータ取り出し先
            DataTable dtSetCd;

            //前後の空白を取り除く
            txtDenpyoNo.Text = txtDenpyoNo.Text.Trim();

            //伝票番号がない場合
            if (txtDenpyoNo.blIsEmpty() == false)
            {
                return;
            }

            //ビジネス層のインスタンス生成
            A0160_ShukoIraiInput_B shukoiraiB = new A0160_ShukoIraiInput_B();

            try
            {
                //戻り値のDatatableを取り込む
                dtSetCd = shukoiraiB.getShukoData(txtDenpyoNo.Text);

                //1件以上データがある場合
                if (dtSetCd.Rows.Count > 0)
                {
                    txtYMD.Text = DateTime.Parse(dtSetCd.Rows[0]["依頼年月日"].ToString()).ToString("yyyy/MM/dd");
                    lblsetTantosha.CodeTxtText      = dtSetCd.Rows[0]["担当者コード"].ToString();
                    lblsetShukoEigyosho.CodeTxtText = dtSetCd.Rows[0]["出庫倉庫"].ToString();
                    lblsetShukoEigyosho.chkTxtEigyousho();
                    lblsetDaibunrui.CodeTxtText = dtSetCd.Rows[0]["大分類コード"].ToString();
                    lblsetDaibunrui.chkTxtDaibunrui();
                    lblsetChubunrui.CodeTxtText = dtSetCd.Rows[0]["中分類コード"].ToString();
                    lblsetChubunrui.chkTxtChubunrui(lblsetDaibunrui.CodeTxtText);
                    lblsetMaker.CodeTxtText = dtSetCd.Rows[0]["メーカーコード"].ToString();
                    lblsetMaker.chkTxtMaker();
                    txtC1.Text = dtSetCd.Rows[0]["C1"].ToString();
                    txtC2.Text = dtSetCd.Rows[0]["C2"].ToString();
                    txtC3.Text = dtSetCd.Rows[0]["C3"].ToString();
                    txtC4.Text = dtSetCd.Rows[0]["C4"].ToString();
                    txtC5.Text = dtSetCd.Rows[0]["C5"].ToString();
                    txtC6.Text = dtSetCd.Rows[0]["C6"].ToString();
                    txtSu.Text = dtSetCd.Rows[0]["数量"].ToString();
                    txtSu.Text = decimal.Parse(txtSu.Text).ToString("#,0.00");
                    txtSu.updPriceMethod();
                    txtTanka.Text = dtSetCd.Rows[0]["単価"].ToString();
                    txtTanka.Text = decimal.Parse(txtTanka.Text).ToString("#,0.00");
                    txtTanka.updPriceMethod();
                    lblsetEigyosho.CodeTxtText = dtSetCd.Rows[0]["営業所コード"].ToString();
                    txtShohinCd.Text           = dtSetCd.Rows[0]["商品コード"].ToString();

                    //商品コードが88888の場合
                    if (txtShohinCd.Text == "88888")
                    {
                        //品名にC1の情報を入れる
                        txtHinmei.Text = txtC1.Text;
                    }
                    else
                    {
                        //各データを入れる
                        txtC1.Text = dtSetCd.Rows[0]["C1"].ToString().Trim();
                        txtC2.Text = dtSetCd.Rows[0]["C2"].ToString().Trim();
                        txtC3.Text = dtSetCd.Rows[0]["C3"].ToString().Trim();
                        txtC4.Text = dtSetCd.Rows[0]["C4"].ToString().Trim();
                        txtC5.Text = dtSetCd.Rows[0]["C5"].ToString().Trim();
                        txtC6.Text = dtSetCd.Rows[0]["C6"].ToString().Trim();

                        txtHinmei.Text = txtC1.Text + txtC2.Text + txtC3.Text + txtC4.Text + txtC5.Text + txtC6.Text;
                    }
                }
            }
            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();
            }
        }
示例#27
0
        ///<summary>
        ///printHusho
        ///印刷ダイアログ
        ///</summary>
        private void printHusho()
        {
            //敬称
            string strKeisho = "";

            //SQL実行先のフラグ管理
            int intFlag = 0;

            //印刷情報取得用
            List <string> lstAtenaInsatsu = new List <string>();

            //SQL実行時に取り出したデータを入れる用
            DataTable dtSetCd_B = new DataTable();

            //PDF作成後の入れ物
            string strFile = "";

            //取引先入力項目に記入がある場合
            if (StringUtl.blIsEmpty(labelSet_Torihikisaki.codeTxt.ToString()))
            {
                //様にチェックされている場合
                if (radSet_2btn_Kesho.radbtn0.Checked == true)
                {
                    strKeisho = "  様";
                }
                else if (radSet_2btn_Kesho.radbtn1.Checked == true)
                {
                    strKeisho = "  御中";
                }

                //住所①を使用にチェックされている場合
                if (radAtena1.Checked == true)
                {
                    intFlag = 0;
                }
                //住所②を使用にチェックされている場合
                else if (radAtena2.Checked == true)
                {
                    intFlag = 1;
                }
                //領収書送付先を使用にチェックされている場合
                else if (radAtena3.Checked == true)
                {
                    intFlag = 2;
                }
                //請求書送付先を使用にチェックされている場合
                else if (radAtena4.Checked == true)
                {
                    intFlag = 3;
                }

                //ビジネス層のインスタンス生成
                M0620_HushoAtenaInsatsu_B hushoatenainsatsuB = new M0620_HushoAtenaInsatsu_B();
                try
                {
                    lstAtenaInsatsu.Add(labelSet_Torihikisaki.CodeTxtText);
                    lstAtenaInsatsu.Add(intFlag.ToString());
                    lstAtenaInsatsu.Add(strKeisho);

                    dtSetCd_B = hushoatenainsatsuB.getAtenaInsatsuData(lstAtenaInsatsu);

                    //取得したデータがない場合
                    if (dtSetCd_B.Rows.Count == 0 || dtSetCd_B == null)
                    {
                        //例外発生メッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();
                        return;
                    }

                    //初期値
                    Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_NAGA4, TATE);

                    //長4の場合
                    if (radSet_2btn_Yoshi.radbtn0.Checked == true || radSet_2btn_Yoshi.judCheckBtn() == 0)
                    {
                        blNaga4 = true;
                        //印刷ダイアログ
                        pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_NAGA4, false);
                        pf.ShowDialog(this);
                    }
                    else if (radSet_2btn_Yoshi.radbtn1.Checked == true || radSet_2btn_Yoshi.judCheckBtn() == 1)
                    {
                        blNaga4 = false;
                        //印刷ダイアログ
                        pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_NAGA3, false);
                        pf.ShowDialog(this);
                    }

                    //プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        //結果セットをレコードセットに
                        strFile = hushoatenainsatsuB.dbToPdf(dtSetCd_B, blNaga4);

                        // プレビュー
                        pf.execPreview(strFile);
                    }
                    // 一括印刷の場合
                    else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                    {
                        // PDF作成
                        strFile = hushoatenainsatsuB.dbToPdf(dtSetCd_B, blNaga4);

                        if (blNaga4 == true)
                        {
                            // 一括印刷
                            pf.execPrint(null, strFile, CommonTeisu.SIZE_NAGA4, CommonTeisu.YOKO, false);
                        }
                        else
                        {
                            // 一括印刷
                            pf.execPrint(null, strFile, CommonTeisu.SIZE_NAGA3, CommonTeisu.YOKO, false);
                        }
                    }
                }
                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;
                }
            }
        }
        ///<summary>
        ///showShohinList
        ///商品リストの実行
        ///</summary>
        private void showShohinList()
        {
            //商品検索画面のインスタンス生成
            ShouhinList shouhinlist = new ShouhinList(this);

            try
            {
                //検索項目に一つでも記入がある場合
                if (lblsetDaibunrui.codeTxt.blIsEmpty() == false &&
                    lblsetChubunrui.codeTxt.blIsEmpty() == false &&
                    lblsetMaker.codeTxt.blIsEmpty() == false &&
                    txtKensaku.blIsEmpty() == false)
                {
                    //商品検索画面へ移動時に検索をしない
                    shouhinlist.blKensaku = false;
                }
                else
                {
                    //商品検索画面へ移動時に検索をする
                    shouhinlist.blKensaku = true;
                }

                //表示していた品名を確保
                string strHinmeiBef = txtHinmei.Text;

                //検索項目が編集できる状態かどうか判断
                Boolean blEnabledTrue = false;

                //検索項目が編集できる状態だった場合(Enable処理は複数一挙に行うため、大分類コードのみの確認でOK)
                if (lblsetDaibunrui.Enabled == true)
                {
                    //検索項目が編集できる状態だった判定
                    blEnabledTrue = true;
                }

                //編集可能にする
                lblsetDaibunrui.Enabled = true;
                lblsetChubunrui.Enabled = true;
                lblsetMaker.Enabled     = true;
                txtHinmei.Enabled       = true;
                lblHinmei.Enabled       = true;

                //商品検索画面と繋げるデータ
                shouhinlist.intFrmKind      = CommonTeisu.FRM_HACHUINPUT; //画面No
                shouhinlist.lsDaibunrui     = lblsetDaibunrui;            //大分類ラベルセット
                shouhinlist.lsChubunrui     = lblsetChubunrui;            //中分類ラベルセット
                shouhinlist.lsMaker         = lblsetMaker;                //メーカーラベルセット
                shouhinlist.btxtHinC1Hinban = txtHinmei;                  //品名テキストボックス
                shouhinlist.btxtHinC1       = txtC1;                      //C1テキストボックス
                shouhinlist.btxtHinC2       = txtC2;                      //C2テキストボックス
                shouhinlist.btxtHinC3       = txtC3;                      //C3テキストボックス
                shouhinlist.btxtHinC4       = txtC4;                      //C4テキストボックス
                shouhinlist.btxtHinC5       = txtC5;                      //C5テキストボックス
                shouhinlist.btxtHinC6       = txtC6;                      //C6テキストボックス
                shouhinlist.btxtShohinCd    = txtShohinCd;                //商品コードテキストボックス
                shouhinlist.btxtKensaku     = txtKensaku;                 //検索テキストボックス
                shouhinlist.bmtxtShireTanka = txtTanka;                   //単価テキストボックス

                //商品検索画面の表示
                shouhinlist.ShowDialog();

                //商品リストから新しく選ばれた場合
                if (strHinmeiBef != txtHinmei.Text)
                {
                    txtHinmei.Enabled = false;
                    lblHinmei.Enabled = false;

                    //カンマ処理
                    txtTanka.updPriceMethod();
                    //数量テキストボックスにフォーカス
                    txtSu.Focus();
                }
                else
                {
                    //商品リストに行く前に検索項目が編集できない状態だった場合
                    if (blEnabledTrue == false)
                    {
                        //編集不可能にする(検索前の状態にする)
                        lblsetDaibunrui.Enabled = false;
                        lblsetChubunrui.Enabled = false;
                        lblsetMaker.Enabled     = false;
                        txtHinmei.Enabled       = false;
                        lblHinmei.Enabled       = false;
                    }
                }
            }
            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;
            }
        }
示例#29
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データ検索用(プロシージャ用)
            List <string> lstSearchItemProc = new List <string>();

            // データチェック
            if (!blnDataCheack())
            {
                return;
            }

            // 検索するデータをリストに格納
            lstSearchItem.Add(txtYmd.Text);
            lstSearchItem.Add(labelSet_Eigyosho.CodeTxtText);
            lstSearchItem.Add(labelSet_Daibunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Chubunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Maker.CodeTxtText);
            lstSearchItem.Add(txtTanabanFrom.Text);
            lstSearchItem.Add(txtTanabanTo.Text);

            // 検索するデータをリストに格納(プロシージャ用)
            lstSearchItemProc.Add(txtYmd.Text);
            lstSearchItemProc.Add(labelSet_Eigyosho.CodeTxtText);
            lstSearchItemProc.Add(labelSet_Daibunrui.CodeTxtText);
            lstSearchItemProc.Add((radSort.judCheckBtn() + 1).ToString());

            // ビジネス層のインスタンス生成
            F0570_TanaorosiKinyuhyoPrint_B tanaorosiPrint_B = new F0570_TanaorosiKinyuhyoPrint_B();

            try
            {
                // 印刷するにチェックが入っていない場合
                if (chkPrintOnly.Checked == false)
                {
                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // 棚卸記入表の件数を取得
                    DataTable dtTanaorosiCount = tanaorosiPrint_B.getTanaorosiCount(lstSearchItem);

                    //元に戻す
                    Cursor.Current = Cursors.Default;

                    // 対象データがある場合
                    if (dtTanaorosiCount != null && dtTanaorosiCount.Rows.Count > 0)
                    {
                        // 件数が1件以上の場合
                        if (int.Parse(dtTanaorosiCount.Rows[0][0].ToString()) > 0)
                        {
                            // メッセージボックスの処理(YES,NO)
                            BaseMessageBox basemessagebox = new BaseMessageBox(this, "棚卸記入表", "既にデータが作成されています。書き換えますか?", CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION);

                            // Noが押された場合
                            if (basemessagebox.ShowDialog() == DialogResult.No)
                            {
                                return;
                            }
                        }
                    }

                    try
                    {
                        //待機状態
                        Cursor.Current = Cursors.WaitCursor;

                        // 棚卸記入表テーブルに追加
                        tanaorosiPrint_B.addTanaorosi(lstSearchItem);

                        //元に戻す
                        Cursor.Current = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        //元に戻す
                        Cursor.Current = Cursors.Default;

                        // エラーロギング
                        new CommonException(ex);

                        // メッセージボックスの処理、追加失敗の場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }
                }

                //待機状態
                Cursor.Current = Cursors.WaitCursor;

                // 検索実行
                DataTable dtTanaorosi = tanaorosiPrint_B.getTanaorosi(lstSearchItemProc);

                //元に戻す
                Cursor.Current = Cursors.Default;

                // 対象データがある場合
                if (dtTanaorosi != null && dtTanaorosi.Rows.Count > 0)
                {
                    string strFilter = "";

                    // 中分類コードがある場合
                    if (!lstSearchItem[3].Equals(""))
                    {
                        strFilter += "中分類コード = '" + lstSearchItem[3] + "'";
                    }

                    // メーカーコードがある場合
                    if (!lstSearchItem[4].Equals(""))
                    {
                        if (!strFilter.Equals(""))
                        {
                            strFilter += " AND ";
                        }
                        strFilter += "メーカーコード = '" + lstSearchItem[4] + "'";
                    }

                    // 棚番がある場合
                    if (!lstSearchItem[5].Equals("") && !lstSearchItem[6].Equals(""))
                    {
                        if (!strFilter.Equals(""))
                        {
                            strFilter += " AND ";
                        }
                        strFilter += "棚番 >= '" + lstSearchItem[5] + "' AND 棚番 <= '" + lstSearchItem[6] + "'";
                    }

                    // 対象データから更に絞り込み(中分類コード、メーカーコード、棚番)
                    if (!strFilter.Equals(""))
                    {
                        DataView dvTanaorosi = new DataView(dtTanaorosi);
                        dvTanaorosi.RowFilter = strFilter;
                        dtTanaorosi           = dvTanaorosi.ToTable();

                        // 対象データがない場合
                        if (dtTanaorosi == null || dtTanaorosi.Rows.Count == 0)
                        {
                            // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                            BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                            basemessagebox.ShowDialog();

                            return;
                        }
                    }

                    // 印刷ダイアログ
                    Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A4, CommonTeisu.TATE);
                    pf.ShowDialog(this);

                    //待機状態
                    Cursor.Current = Cursors.WaitCursor;

                    // プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        // PDF作成
                        String strFile = tanaorosiPrint_B.dbToPdf(dtTanaorosi, lstSearchItem, null);

                        //元に戻す
                        Cursor.Current = Cursors.Default;

                        // プレビュー
                        //pf.execPreview(strFile);
                    }
                    // 一括印刷の場合
                    else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                    {
                        // PDF作成
                        String strFile = tanaorosiPrint_B.dbToPdf(dtTanaorosi, lstSearchItem, pf.printer);

                        //元に戻す
                        Cursor.Current = Cursors.Default;

                        // 一括印刷
                        //pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.TATE, true);
                    }

                    pf.Dispose();
                }
                else
                {
                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                //元に戻す
                Cursor.Current = Cursors.Default;

                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                return;
            }
        }
示例#30
0
        ///<summary>
        ///A0470_Hachusuhenko_Load
        ///画面レイアウト設定
        ///</summary>
        private void A0470_Hachusuhenko_Load(object sender, EventArgs e)
        {
            this.Show();
            this._Title = "発注数変更";

            // フォームでもキーイベントを受け取る
            this.KeyPreview = true;

            this.btnF01.Text = STR_FUNC_F1_HYOJII;
            this.btnF04.Text = STR_FUNC_F4;
            this.btnF05.Text = "F5:選択";
            this.btnF08.Text = "F8:更新";
            this.btnF09.Text = STR_FUNC_F9;
            this.btnF12.Text = STR_FUNC_F12;

            DataTable dtTantoshaCd = new DataTable();

            //ビジネス層のインスタンス生成
            A0470_Hachusuhenko_B hachusuhenkoB = new A0470_Hachusuhenko_B();

            try
            {
                //ログインIDから担当者コードを取り出す
                dtTantoshaCd = hachusuhenkoB.getEigyiCdSetUserID(SystemInformation.UserName);

                //担当者データがある場合
                if (dtTantoshaCd.Rows.Count > 0)
                {
                    //一行目にデータがない場合
                    if (dtTantoshaCd.Rows[0][0].ToString() == "")
                    {
                        return;
                    }

                    //本社の場合
                    if (dtTantoshaCd.Rows[0]["営業所コード"].ToString() == "0001")
                    {
                        radSet_3btn_Basho.radbtn1.Checked = true;
                    }
                    else
                    {
                        radSet_3btn_Basho.radbtn2.Checked = true;
                    }
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
            }

            SetUpGrid();
        }