///<summary>
        ///printTorihiki
        ///印刷ダイアログ
        ///</summary>
        private void printTorihiki()
        {
            //SQL実行時に取り出したデータを入れる用
            DataTable dtSetCd_B = new DataTable();

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

            //ビジネス層のインスタンス生成(M1071取引先情報画面でも、M1070取引先マスタのビジネスを利用する)
            M1070_Torihikisaki_B torihikiB = new M1070_Torihikisaki_B();
            try
            {
                dtSetCd_B = torihikiB.getPrintData();

                //取得したデータがない場合
                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_A4, YOKO);

                pf.ShowDialog(this);

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

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

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

            }
            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;
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // データテーブル格納用
            List <DataTable> lstDtSuiihyo = new List <DataTable>();
            DataTable        dtSuiihyo    = null;

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

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

                txtYmdFrom.Focus();

                return;
            }

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

                txtYmdTo.Focus();

                return;
            }

            //日付フォーマット生成、およびチェック
            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;
            }
            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;
            }
            else
            {
                txtYmdTo.Text = strYMDformat;
            }

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

                return;
            }

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

                return;
            }

            //開始得意先コードのチェック
            if (labelSet_TokuisakiCdFrom.chkTxtTorihikisaki() == true)
            {
                labelSet_TokuisakiCdFrom.Focus();

                return;
            }

            //終了得意先コードのチェック
            if (labelSet_TokuisakiCdTo.chkTxtTorihikisaki() == true)
            {
                labelSet_TokuisakiCdTo.Focus();

                return;
            }

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

            // 担当者コード(開始)が空の場合
            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);
            }
            // 得意先コード(開始)が空の場合
            if (labelSet_TokuisakiCdFrom.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("0000");
            }
            else
            {
                lstSearchItem.Add(labelSet_TokuisakiCdFrom.CodeTxtText);
            }
            // 得意先コード(終了)が空の場合
            if (labelSet_TokuisakiCdTo.CodeTxtText.Equals(""))
            {
                lstSearchItem.Add("9999");
            }
            else
            {
                lstSearchItem.Add(labelSet_TokuisakiCdTo.CodeTxtText);
            }

            // グループ
            lstSearchItem.Add(rsGroup.judCheckBtn().ToString());

            // 出力先の選択が得意先別売上推移表の場合
            if (radSet_2btn.radbtn0.Checked)
            {
                lstSearchItem.Add("0");
            }
            else
            {
                lstSearchItem.Add("1");
            }

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

            try
            {
                int      cntYear   = 0;
                Boolean  blnData   = false;
                DateTime dtYmdFrom = DateTime.Parse(lstSearchItem[0]);
                DateTime dtYmdTo   = DateTime.Parse(lstSearchItem[1]);

                // 期間の年数計算
                while (true)
                {
                    dtYmdFrom = dtYmdFrom.AddYears(1);
                    cntYear  += 1;
                    if (dtYmdFrom.CompareTo(dtYmdTo) > 0)
                    {
                        break;
                    }
                }

                this.Cursor = Cursors.WaitCursor;

                for (int cnt = 0; cnt < cntYear; cnt++)
                {
                    // 検索実行
                    dtSuiihyo = suiihyoPrint_B.getSuiihyo(lstSearchItem);
                    lstDtSuiihyo.Add(dtSuiihyo);

                    // 対象データがある場合、フラグ(blnData)にtrueをセット
                    if (dtSuiihyo != null && dtSuiihyo.Rows.Count > 0)
                    {
                        blnData = true;
                    }

                    // 開始年月日を1年後にする
                    dtYmdFrom        = DateTime.Parse(lstSearchItem[0]);
                    dtYmdFrom        = dtYmdFrom.AddYears(1);
                    lstSearchItem[0] = dtYmdFrom.ToString();
                }

                this.Cursor = Cursors.Default;

                // 対象データがある場合
                if (blnData)
                {
                    lstSearchItem[0] = txtYmdFrom.Text;

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

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

                        // PDF作成
                        String strFile = suiihyoPrint_B.dbToPdf(lstDtSuiihyo, lstSearchItem);

                        this.Cursor = Cursors.Default;

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

                        // PDF作成
                        String strFile = suiihyoPrint_B.dbToPdf(lstDtSuiihyo, lstSearchItem);

                        this.Cursor = Cursors.Default;

                        // 一括印刷
                        pf.execPrint(null, strFile, CommonTeisu.SIZE_B4, 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)
            {
                // エラーロギング
                new CommonException(ex);

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

                return;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

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

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

                txtCalendarYMopen.Focus();

                return;
            }

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

                labelSet_TokuisakiStart.Focus();

                return;
            }

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

                labelSet_TokuisakiEnd.Focus();

                return;
            }

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

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

                txtCalendarYMopen.Focus();

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

            //初期化
            strYMDformat = "";

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

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

                txtCalendarYMclose.Focus();

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

            //営業所コードのチェック
            if (labelSet_Eigyosho1.chkTxtEigyousho() == true)
            {
                labelSet_Eigyosho1.Focus();

                return;
            }

            //グループコードのチェック
            if (labelSet_GroupCd1.chkTxtGroupCd() == true)
            {
                labelSet_GroupCd1.Focus();

                return;
            }

            //担当者コードのチェック
            if (labelSet_Tantousha1.chkTxtTantosha() == true)
            {
                labelSet_Tantousha1.Focus();

                return;
            }

            //受注者コードのチェック
            if (lsJuchusha.chkTxtTantosha() == true)
            {
                lsJuchusha.Focus();

                return;
            }

            //大分類コードのチェック
            if (labelSet_Daibunrui1.chkTxtDaibunrui() == true)
            {
                labelSet_Daibunrui1.Focus();

                return;
            }

            //中分類コードのチェック
            if (labelSet_Chubunrui1.chkTxtChubunrui(labelSet_Daibunrui1.CodeTxtText) == true)
            {
                labelSet_Chubunrui1.Focus();

                return;
            }

            //メーカーコードのチェック
            if (labelSet_Maker1.chkTxtMaker() == true)
            {
                labelSet_Maker1.Focus();

                return;
            }

            this.Cursor = Cursors.WaitCursor;

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

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtCalendarYMopen.Text);
                lstSearchItem.Add(txtCalendarYMclose.Text);
                lstSearchItem.Add(labelSet_TokuisakiStart.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiEnd.CodeTxtText);
                lstSearchItem.Add(labelSet_Daibunrui1.CodeTxtText);
                lstSearchItem.Add(labelSet_Eigyosho1.CodeTxtText);
                lstSearchItem.Add(labelSet_Tantousha1.CodeTxtText);
                lstSearchItem.Add(labelSet_Chubunrui1.CodeTxtText);
                lstSearchItem.Add(labelSet_GroupCd1.CodeTxtText);
                lstSearchItem.Add(lsJuchusha.CodeTxtText);
                lstSearchItem.Add(labelSet_Maker1.CodeTxtText);

                // 検索実行(印刷用)
                DataTable dtSiireSuiiList = uriagesuiihyoB.getUriageSuiiList(lstSearchItem, "print");

                this.Cursor = Cursors.Default;

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

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

                        // PDF作成
                        string strFile = uriagesuiihyoB.dbToPdf(dtSiireSuiiList, lstSearchItem[0]);

                        this.Cursor = Cursors.Default;

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

                        // PDF作成
                        string strFile = uriagesuiihyoB.dbToPdf(dtSiireSuiiList, lstSearchItem[0]);

                        this.Cursor = Cursors.Default;

                        // 用紙サイズ、印刷方向はインスタンス生成と同じ値を入れる
                        // ダイアログ表示時は最後の引数はtrue
                        // (ダイアログ非経由の直接印刷時は先頭引数にプリンタ名を入れ、最後の引数をfalseに)
                        pf.execPrint(null, @strFile, CommonTeisu.SIZE_A4, 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)
            {
                // エラーロギング
                new CommonException(ex);
                return;
            }
        }
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

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

                txtInputYMDStart.Focus();

                return;
            }

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

                txtInputYMDEnd.Focus();

                return;
            }

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

                txtDenpyoYMDStart.Focus();

                return;
            }

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

                txtDenpyoYMDEnd.Focus();

                return;
            }

            // 日付フォーマットチェック(入力年月日(開始))
            string datedata = txtInputYMDStart.chkDateDataFormat(txtInputYMDStart.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;
            }
            else
            {
                txtInputYMDStart.Text = datedata;
            }

            // 日付フォーマットチェック(入力年月日(終了))
            datedata = txtInputYMDEnd.chkDateDataFormat(txtInputYMDEnd.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;
            }
            else
            {
                txtInputYMDEnd.Text = datedata;
            }

            // 日付フォーマットチェック(伝票年月日(開始))
            datedata = txtDenpyoYMDStart.chkDateDataFormat(txtDenpyoYMDStart.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;
            }
            else
            {
                txtDenpyoYMDStart.Text = datedata;
            }

            // 日付フォーマットチェック(伝票年月日(終了))
            datedata = txtDenpyoYMDEnd.chkDateDataFormat(txtDenpyoYMDEnd.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;
            }
            else
            {
                txtDenpyoYMDEnd.Text = datedata;
            }

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

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtInputYMDStart.Text);
                lstSearchItem.Add(txtInputYMDEnd.Text);
                lstSearchItem.Add(txtDenpyoYMDStart.Text);
                lstSearchItem.Add(txtDenpyoYMDEnd.Text);
                lstSearchItem.Add(txtUserId.Text);
                lstSearchItem.Add(labelSet_TokuisakiCdFrom.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiCdTo.CodeTxtText);

                // 検索実行
                DataTable dtNyukinCheckList = checkPrintB.getNyukinCheckList(lstSearchItem);

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

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

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

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

                    pf.Dispose();
                }
                else
                {
                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            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;
            }
        }
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // 検索条件格納用
            List <string> lstSearchItem  = new List <string>();
            List <Array>  lstSearchItem2 = new List <Array>();

            DataTable dtSiireJisseki = new DataTable();

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

            // ヘッダーに条件を出力する値
            lstSearchItem.Add(labelSet_Siiresaki.ValueLabelText);   //仕入先名
            lstSearchItem.Add(labelSet_Daibunrui.ValueLabelText);   //大分類名
            lstSearchItem.Add(labelSet_Chubunrui.ValueLabelText);   //中分類名

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

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

                // 検索実行
                dtSiireJisseki = siireB.getSiireJissekiList(lstSearchItem, lstSearchItem2);

                if (dtSiireJisseki != null && dtSiireJisseki.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(txtDenpyoYMDStart.Text);              // 伝票年月日Start
                    lstoutItem.Add(txtDenpyoYMDEnd.Text);                // 伝票年月日End
                    lstoutItem.Add(labelSet_Etanto.ValueLabelText);      // 営業担当者名
                    lstoutItem.Add(labelSet_Htanto.ValueLabelText);      // 発注者名
                    lstoutItem.Add(labelSet_Jtanto.ValueLabelText);      // 受注者名
                    lstoutItem.Add(labelSet_Siiresaki.ValueLabelText);   // 仕入先名称
                    lstoutItem.Add(labelSet_Daibunrui.ValueLabelText);   // 大分類名称
                    lstoutItem.Add(labelSet_Chubunrui.ValueLabelText);   // 中分類名称
                    lstoutItem.Add(txtKataban.Text);                     // 型番1
                    lstoutItem.Add(txtKataban2.Text);                    // 型番2
                    lstoutItem.Add(txtKataban3.Text);                    // 型番3
                    lstoutItem.Add(txtBikou.Text);                       // 備考
                    lstoutItem.Add(labelSet_Tokuisaki.ValueLabelText);   // 得意先名称


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

                        // PDF作成
                        String strFile = siireB.dbToPdf(dtSiireJisseki, lstoutItem);

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

                        // PDF作成
                        String strFile = siireB.dbToPdf(dtSiireJisseki, 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;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();
            string        stSimebi      = "";

            if (string.IsNullOrWhiteSpace(txtEndDay.Text))
            {
                // データチェック
                if (!blnDataCheck())
                {
                    return;
                }
                stSimebi = txtSimekiriYmd.Text;
            }
            else
            {
                if (!blnDataCheck2())
                {
                    return;
                }
                stSimebi = txtEndDay.Text;
            }

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

            try
            {
                // 検索するデータをリストに格納
                //lstSearchItem.Add(txtSimekiriYmd.Text);
                lstSearchItem.Add(stSimebi);
                lstSearchItem.Add(txtStartYmd.Text);
                lstSearchItem.Add(txtSimekiribi.Text);
                lstSearchItem.Add(labelSet_TokuisakiCdFrom.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiCdTo.CodeTxtText);
                lstSearchItem.Add(Environment.UserName);

                // 検索実行
                DataTable dtSeikyuMeisai = meisaiPrintB.addSeikyuMeisaisho(lstSearchItem);

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

                    // プレビューの場合
                    if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                    {
                        // PDF作成
                        String strFile = meisaiPrintB.dbToPdf(dtSeikyuMeisai);

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

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

                    pf.Dispose();
                }
                else
                {
                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", 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;
            }
        }
Exemplo n.º 9
0
        ///<summary>
        ///printDenpyoCount
        ///印刷ダイアログ
        ///</summary>
        private void printDenpyoCount()
        {
            //SQL実行時に取り出したデータを入れる用
            DataTable dtSetCd_B = new DataTable();

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

            //検索開始日確保
            DateTime dateOpen;
            //検索終了日確保
            DateTime dateClose;

            //各取り出しデータ
            int intJuchu  = 0;
            int intHachu  = 0;
            int intShire  = 0;
            int intUriage = 0;
            int intNyuko  = 0;
            int intShuko  = 0;
            int intTanto  = 0;

            //合計データ用
            List <string> lstKei = new List <string>();

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

            try
            {
                //初期値
                Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A4, YOKO);

                pf.ShowDialog(this);
                pf.intPrintCnt = int.Parse(txtPrintCount.Text);

                //入力項目の記入に漏れがある場合
                if (txtDenpyoOpen.blIsEmpty() == false ||
                    txtDenpyoClose.blIsEmpty() == false ||
                    txtTantoshaCdOpen.codeTxt.blIsEmpty() == false ||
                    txtTantoshaCdClose.codeTxt.blIsEmpty() == false)
                {
                    //例外発生メッセージ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return;
                }

                //データの取得
                dtSetCd_B = denpyocountB.getData(txtDenpyoOpen.Text, txtDenpyoClose.Text, txtTantoshaCdOpen.CodeTxtText, txtTantoshaCdClose.CodeTxtText);

                //取得したデータがない場合
                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;
                }

                //datagridviewの行数分ループ
                for (int intRcnt = 0; intRcnt < dtSetCd_B.Rows.Count; intRcnt++)
                {
                    intJuchu = intJuchu + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["受注計"].ToString()));

                    intHachu = intHachu + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["発注計"].ToString()));

                    intShire = intShire + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["仕入計"].ToString()));

                    intUriage = intUriage + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["売上計"].ToString()));

                    intNyuko = intNyuko + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["入庫計"].ToString()));

                    intShuko = intShuko + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["出庫計"].ToString()));

                    intTanto = intTanto + (int)Math.Floor(double.Parse(dtSetCd_B.Rows[intRcnt]["担当計"].ToString()));
                }

                //合計データをまとめる
                lstKei.Add(intJuchu.ToString());
                lstKei.Add(intHachu.ToString());
                lstKei.Add(intShire.ToString());
                lstKei.Add(intUriage.ToString());
                lstKei.Add(intNyuko.ToString());
                lstKei.Add(intShuko.ToString());
                lstKei.Add(intTanto.ToString());

                //表示する年月日の取得、編集
                dateOpen  = DateTime.Parse(txtDenpyoOpen.Text);
                dateClose = DateTime.Parse(txtDenpyoClose.Text);

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

                    //結果セットをレコードセットに
                    strFile = denpyocountB.dbToPdf(dtSetCd_B, dateOpen, dateClose, txtTantoshaCdOpen.CodeTxtText, txtTantoshaCdClose.CodeTxtText, lstKei);

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

                    // PDF作成
                    strFile = denpyocountB.dbToPdf(dtSetCd_B, dateOpen, dateClose, txtTantoshaCdOpen.CodeTxtText, txtTantoshaCdClose.CodeTxtText, lstKei);

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

                pf.Dispose();

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

                //データロギング
                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;
            }
        }
Exemplo n.º 10
0
        ///<summary>
        ///printShukoshonin
        ///印刷ダイアログ
        ///</summary>
        private void printShukoshonin()
        {
            //SQL実行時に取り出したデータを入れる用
            DataTable dtPrintData = new DataTable();

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

            //文字判定(出庫年月日)
            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 (lblset_Eigyosho.codeTxt.blIsEmpty() == false)
            {
                //メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                //営業所コードにフォーカス
                lblset_Eigyosho.Focus();
                return;
            }
            //営業所コードの存在チェック
            else if (lblset_Eigyosho.chkTxtEigyousho() == true)
            {
                //営業所コードにフォーカス
                lblset_Eigyosho.Focus();
                return;
            }

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

            try
            {
                //戻り値のDatatableを取り込む
                dtPrintData = shukoshoninB.getPrintData();

                //1件以上データがない場合
                if (dtPrintData.Rows.Count < 1)
                {
                    //例外発生メッセージ(OK)
                    BaseMessageBox basemessageboxNodata = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessageboxNodata.ShowDialog();
                    return;
                }

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

                pf.ShowDialog(this);

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

                    //結果セットをレコードセットに
                    strFile = shukoshoninB.dbToPdf(dtPrintData);

                    this.Cursor = Cursors.Default;

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

                    // PDF作成
                    strFile = shukoshoninB.dbToPdf(dtPrintData);

                    this.Cursor = Cursors.Default;

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

                pf.Dispose();

                //データ作成チェックがある場合
                if (chbxDataCreate.Checked == true)
                {
                    //処理済の更新&倉庫間移動データの追加
                    addSoukoIdouData();

                    //例外発生メッセージ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }

                ////グリッド再表示
                //setGridData();
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;

                //エラーロギング
                new CommonException(ex);
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

            // 検索するデータをリストに格納
            lstSearchItem.Add(labelSet_Daibunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Chubunrui.CodeTxtText);
            lstSearchItem.Add(labelSet_Maker.CodeTxtText);
            lstSearchItem.Add(txtTanabanHonsha.Text);
            lstSearchItem.Add(txtTanabanGifu.Text);
            lstSearchItem.Add(txtKataban.Text);

            // 並び替え
            if (radSet_2btn.radbtn0.Checked)
            {
                lstSearchItem.Add("0");
            }
            else
            {
                lstSearchItem.Add("1");
            }

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

            try
            {
                // 検索実行
                DataTable dtShohinList = shohinB.getShohinList(lstSearchItem);

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

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

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

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

                    pf.Dispose();
                }
                else
                {
                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            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;
            }
        }
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データチェック処理
            if (!dataCheack())
            {
                return;
            }

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

            this.Cursor = Cursors.WaitCursor;

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

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtKamikiYMDopen.Text);               //[0]
                lstSearchItem.Add(txtKamikiYMDclose.Text);              //[1]
                lstSearchItem.Add(txtSimokiYMDopen.Text);               //[2]
                lstSearchItem.Add(txtSimokiYMDclose.Text);              //[3]
                lstSearchItem.Add(labelSet_Torihikisaki.CodeTxtText);   //[4]
                lstSearchItem.Add(labelSet_Tantousha.CodeTxtText);      //[5]
                lstSearchItem.Add(labelSet_Daibunrui.CodeTxtText);      //[6]
                lstSearchItem.Add(labelSet_Chubunrui.CodeTxtText);      //[7]
                lstSearchItem.Add(labelSet_Maker.CodeTxtText);          //[8]

                // 検索実行(印刷用)
                DataTable dtSyohingunUriageSiire = syohingunuriagesiireprintB.getSyohingunUriageSiireItiran(lstSearchItem);

                this.Cursor = Cursors.Default;

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

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

                pf.ShowDialog(this);
                if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                {
                    this.Cursor = Cursors.WaitCursor;

                    //PDF作成
                    string strFile = syohingunuriagesiireprintB.dbToPdf(dtSyohingunUriageSiire);

                    this.Cursor = Cursors.Default;

                    pf.execPreview(@strFile);
                }
                else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                {
                    this.Cursor = Cursors.WaitCursor;

                    //PDF作成
                    string strFile = syohingunuriagesiireprintB.dbToPdf(dtSyohingunUriageSiire);

                    this.Cursor = Cursors.Default;

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

                pf.Dispose();
            }
            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;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データ検索用
            List <string> lstSearchItem = new List <string>();

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

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

                txtInputYMDStart.Focus();

                return;
            }

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

                txtInputYMDEnd.Focus();

                return;
            }

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

                txtDenpyoYMDStart.Focus();

                return;
            }

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

                txtDenpyoYMDEnd.Focus();

                return;
            }

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

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

                txtInputYMDStart.Focus();

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

            //初期化
            strYMDformat = "";

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

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

                txtInputYMDEnd.Focus();

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

            //初期化
            strYMDformat = "";

            //日付フォーマット生成、およびチェック
            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;
            }

            //初期化
            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;
            }

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

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtInputYMDStart.Text);
                lstSearchItem.Add(txtInputYMDEnd.Text);
                lstSearchItem.Add(txtDenpyoYMDStart.Text);
                lstSearchItem.Add(txtDenpyoYMDEnd.Text);
                lstSearchItem.Add(txtUserId.Text);
                lstSearchItem.Add(labelSet_SiiresakiCdFrom.CodeTxtText);
                lstSearchItem.Add(labelSet_SiiresakiCdTo.CodeTxtText);

                // 検索実行
                DataTable dtSiireCheckList = checkPrintB.getSiireCheckList(lstSearchItem);

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

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

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

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

                    pf.Dispose();
                }
                else
                {
                    // メッセージボックスの処理、対象データがない場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION);
                    basemessagebox.ShowDialog();
                }
            }
            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;
            }
        }
        ///<summary>
        ///printShireMotocyoKakunin
        ///印刷ダイアログ
        ///</summary>
        private void printShireMotocyoKakunin()
        {
            //SQL実行時に取り出したデータを入れる用
            DataTable dtPrintData = new DataTable();

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

            //印刷対象の選択用
            string strInsatsuSelect = "";

            //営業所の選択用
            string strEigyosho = "";

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

            //得意先コードの検索開始項目のチェック
            if (labelSet_SiiresakiStart.codeTxt.blIsEmpty() == false ||
                StringUtl.blIsEmpty(labelSet_SiiresakiStart.ValueLabelText) == false ||
                labelSet_SiiresakiStart.chkTxtTorihikisaki() == true)
            {
                labelSet_SiiresakiStart.Focus();
                return;
            }

            //得意先コードの終了開始項目のチェック
            if (labelSet_SiiresakiEnd.codeTxt.blIsEmpty() == false ||
                StringUtl.blIsEmpty(labelSet_SiiresakiEnd.ValueLabelText) == false ||
                labelSet_SiiresakiEnd.chkTxtTorihikisaki() == true)
            {
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "仕入先コードを範囲で指定してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                labelSet_SiiresakiEnd.Focus();
                return;
            }

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

                txtYmStart.Focus();

                return;
            }

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

                txtYmEnd.Focus();

                return;
            }

            //得意先開始チェック
            if (labelSet_SiiresakiStart.chkTxtTorihikisaki())
            {
                labelSet_SiiresakiStart.Focus();

                return;
            }

            //得意先終了チェック
            if (labelSet_SiiresakiEnd.chkTxtTorihikisaki())
            {
                labelSet_SiiresakiEnd.Focus();

                return;
            }

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

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

                txtYmStart.Focus();

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

            //初期化
            strYMDformat = "";

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

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

                txtYmEnd.Focus();

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

            //印刷対象の範囲指定をする場合
            if (radSet_Insatsu.radbtn1.Checked == true)
            {
                strInsatsuSelect = "0";
            }
            else
            {
                strInsatsuSelect = "1";
            }

            //営業所の指定をする場合
            if (radSet_Eigyo.radbtn0.Checked == true)
            {
                strEigyosho = "0";
            }
            else if (radSet_Eigyo.radbtn1.Checked == true)
            {
                strEigyosho = "1";
            }
            else if (radSet_Eigyo.radbtn2.Checked == true)
            {
                strEigyosho = "2";
            }

            //その月の最終日を求める(年月日検索終了項目用)
            int intDay = DateTime.DaysInMonth(DateTime.Parse(txtYmEnd.Text).Year, DateTime.Parse(txtYmEnd.Text).Month);

            //印刷用データを入れる用
            List <string> lstPrintData = new List <string>();

            //印刷用データを入れる
            lstPrintData.Add(labelSet_SiiresakiStart.CodeTxtText);
            lstPrintData.Add(labelSet_SiiresakiEnd.CodeTxtText);
            lstPrintData.Add(DateTime.Parse(txtYmStart.Text).ToString("yyyy/MM/dd"));
            lstPrintData.Add(DateTime.Parse(txtYmEnd.Text).ToString("yyyy/MM/") + intDay.ToString());
            lstPrintData.Add(strInsatsuSelect);
            lstPrintData.Add(strEigyosho);

            //仕入先コード範囲内の取引先を取得
            E0340_SiiresakiMotochouKakunin_B siireB = new E0340_SiiresakiMotochouKakunin_B();

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

                dtPrintData = siireB.getPrintData(lstPrintData);

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

                //データが無ければ
                if (dtPrintData.Rows.Count < 1)
                {
                    //例外発生メッセージ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "対象のデータがありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                    return;
                }

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

                pf.ShowDialog(this);

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

                    //結果セットをレコードセットに
                    strFile = siireB.dbToPdf(dtPrintData, lstPrintData);

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

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

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

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

                    // 一括印刷
                    pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.YOKO, true);
                }
            }
            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;
            }
        }
Exemplo n.º 15
0
        ///<summary>
        ///printUrikakeZan
        ///印刷ダイアログ
        ///</summary>
        private void printUrikakeZan()
        {
            //グリッドに表示されていない場合
            if (gridTokuisaki.Rows.Count == 0)
            {
                return;
            }

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

            //データの取り出し用
            DataTable dtPrintData = new DataTable();

            //列情報を取得
            DataGridViewColumnCollection cols = gridTokuisaki.Columns;

            //行情報を取得
            DataGridViewRowCollection rows = gridTokuisaki.Rows;

            //取引先経理情報登録時の情報
            List <string> lstTorihiki = new List <string>();

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

            this.Cursor = Cursors.WaitCursor;

            //空チェック(開始得意先コード)
            if (StringUtl.blIsEmpty(lblsetTokuisakiCdopen.CodeTxtText) == false)
            {
                this.Cursor = Cursors.Default;

                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                lblsetTokuisakiCdopen.Focus();
                return;
            }

            //空チェック(終了得意先コード)
            if (StringUtl.blIsEmpty(lblsetTokuisakiCdclose.CodeTxtText) == false)
            {
                this.Cursor = Cursors.Default;

                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                lblsetTokuisakiCdclose.Focus();
                return;
            }

            ////パワーユーザーの場合
            //if ("1".Equals(this.etsuranFlg))
            //{
            //    //空チェック(終了得意先コード)
            //    if (StringUtl.blIsEmpty(lblsetTokuisakiCdclose.CodeTxtText) == false)
            //    {
            //        this.Cursor = Cursors.Default;

            //        // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
            //        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n日付を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
            //        basemessagebox.ShowDialog();

            //        lblsetTokuisakiCdclose.Focus();
            //        return;
            //    }
            //}

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

            //開始年月日の日付チェック
            if (strYMDformat == "")
            {
                this.Cursor = Cursors.Default;

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

                txtYMopen.Focus();

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

            //初期化
            strYMDformat = "";

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

            //終了年月日の日付チェック
            if (strYMDformat == "")
            {
                this.Cursor = Cursors.Default;

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

                txtYMclose.Focus();

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

            this.Cursor = Cursors.Default;

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

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

            //検索開始得意先コードのチェック
            if (lblsetTokuisakiCdopen.chkTxtTorihikisaki() == true)
            {
                lblsetTokuisakiCdopen.Focus();

                return;
            }

            //検索終了得意先コードのチェック
            if (lblsetTokuisakiCdclose.chkTxtTorihikisaki() == true)
            {
                lblsetTokuisakiCdclose.Focus();

                return;
            }

            ////パワーユーザーの場合
            //if ("1".Equals(this.etsuranFlg))
            //{
            //    //スルー
            //}
            //else
            //{
            //    //データチェック(年月度が同じの場合)
            //    if (txtYMopen.Text == txtYMclose.Text)
            //    {
            //        //一か月単位は出来ないメッセージ(OK)
            //        BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "1ケ月単位は指定できません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
            //        basemessagebox.ShowDialog();
            //        txtYMopen.Focus();
            //        return;
            //    }
            //}

            this.Cursor = Cursors.WaitCursor;

            DataTable dtGridViewTokusaki = new DataTable();

            List <string> lstStringViewData = new List <string>();

            lstStringViewData.Add(lblsetTokuisakiCdopen.CodeTxtText);

            lstStringViewData.Add(lblsetTokuisakiCdclose.CodeTxtText);

            ////パワーユーザーの場合
            //if ("1".Equals(this.etsuranFlg))
            //{
            //    lstStringViewData.Add(lblsetTokuisakiCdclose.CodeTxtText);
            //}
            //else
            //{
            //    lstStringViewData.Add(lblsetTokuisakiCdopen.CodeTxtText);
            //}

            string strShuturyoku = "";

            //出力順のラジオボタン判定
            if (radShuturyoku.radbtn0.Checked == true)
            {
                strShuturyoku = "Tokuisaki";
            }
            else
            {
                strShuturyoku = "Hurigana";
            }

            lstStringViewData.Add(DateTime.Parse(txtYMopen.Text).ToString("yyyy/MM/dd"));
            lstStringViewData.Add(DateTime.Parse(txtYMclose.Text).ToString("yyyy/MM/dd"));
            lstStringViewData.Add(strShuturyoku);

            C0520_KaikakekinZandakaIchiranKakunin_B kaikakekakuninB = new C0520_KaikakekinZandakaIchiranKakunin_B();

            try
            {
                dtPrintData = kaikakekakuninB.getPrintData(lstStringViewData);

                this.Cursor = Cursors.Default;

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

                pf.ShowDialog(this);

                //プレビューの場合
                if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                {
                    //現在時間と使用者PCユーザー名を確保
                    lstTorihiki.Add(DateTime.Now.ToString());
                    lstTorihiki.Add(SystemInformation.UserName);

                    this.Cursor = Cursors.WaitCursor;

                    //結果セットをレコードセットに
                    strFile = kaikakekakuninB.dbToPdf(dtPrintData, lstTorihiki);

                    this.Cursor = Cursors.Default;

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

                    // プレビュー
                    pf.execPreview(strFile);
                }
                // 一括印刷の場合
                else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                {
                    //現在時間と使用者PCユーザー名を確保
                    lstTorihiki.Add(DateTime.Now.ToString());
                    lstTorihiki.Add(SystemInformation.UserName);

                    this.Cursor = Cursors.WaitCursor;

                    //結果セットをレコードセットに
                    strFile = kaikakekakuninB.dbToPdf(dtPrintData, lstTorihiki);

                    this.Cursor = Cursors.Default;

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

                    // 一括印刷
                    pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.YOKO, true);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;

                //データロギング
                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;
            }
        }
Exemplo n.º 16
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>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            //PDF作成後の入れ物
            string strFile = "";

            //データの取り出し用
            DataTable dtPrintData = new DataTable();

            //列情報を取得
            DataGridViewColumnCollection cols = gridTokuteimukesakiTanka.Columns;

            //行情報を取得
            DataGridViewRowCollection rows = gridTokuteimukesakiTanka.Rows;

            //取引先経理情報登録時の情報
            List <string> lstTorihiki = new List <string>();

            foreach (DataGridViewColumn c in cols)
            {
                if (c.ValueType != null)
                {
                    dtPrintData.Columns.Add(c.Name, c.ValueType);
                }
                else
                {
                    dtPrintData.Columns.Add(c.Name);
                }
            }

            foreach (DataGridViewRow r in rows)
            {
                List <object> array = new List <object>();

                foreach (DataGridViewCell cell in r.Cells)
                {
                    array.Add(cell.Value);
                }

                dtPrintData.Rows.Add(array.ToArray());
            }

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

            try
            {
                //初期値
                Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A4, YOKO);

                pf.ShowDialog(this);

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

                    //現在時間と使用者PCユーザー名を確保
                    lstTorihiki.Add(DateTime.Now.ToString());
                    lstTorihiki.Add(SystemInformation.UserName);

                    //結果セットをレコードセットに
                    strFile = tokuteimukesakitankaB.dbToPdf(dtPrintData, lstTorihiki);

                    this.Cursor = Cursors.Default;

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

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

                    //現在時間と使用者PCユーザー名を確保
                    lstTorihiki.Add(DateTime.Now.ToString());
                    lstTorihiki.Add(SystemInformation.UserName);

                    //結果セットをレコードセットに
                    strFile = tokuteimukesakitankaB.dbToPdf(dtPrintData, lstTorihiki);

                    this.Cursor = Cursors.Default;

                    //印刷できなかった場合
                    if (strFile == "")
                    {
                        //印刷時エラーメッセージ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this, "印刷", "印刷時エラーです。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                        basemessagebox.ShowDialog();

                        return;
                    }

                    // 一括印刷
                    pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.YOKO, true);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;

                //エラーロギング
                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;
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// printReport
        /// PDFを出力する
        /// </summary>
        private void printReport()
        {
            // データチェック処理
            if (!dataCheack())
            {
                return;
            }

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


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

            try
            {
                // 検索するデータをリストに格納
                lstSearchItem.Add(txtNyuryokuYMDstart.Text);
                lstSearchItem.Add(txtNyuryokuYMDend.Text);
                lstSearchItem.Add(txtDenpyoYMDstart.Text);
                lstSearchItem.Add(txtDenpyoYMDend.Text);
                lstSearchItem.Add(txtUserID.Text);
                lstSearchItem.Add(labelSet_TokuisakiCdFrom.CodeTxtText);
                lstSearchItem.Add(labelSet_TokuisakiCdTo.CodeTxtText);

                // 検索実行(印刷用)
                DataTable dtSiireSuiiList = uriagecheckprintB.getUriageCheckList(lstSearchItem);

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

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

                pf.ShowDialog(this);
                if (this.printFlg == CommonTeisu.ACTION_PREVIEW)
                {
                    // PDF作成
                    string strFile;
                    strFile = uriagecheckprintB.dbToPdf(dtSiireSuiiList, lstSearchItem);
                    pf.execPreview(@strFile);
                }
                else if (this.printFlg == CommonTeisu.ACTION_PRINT)
                {
                    // PDF作成
                    string strFile;
                    strFile = uriagecheckprintB.dbToPdf(dtSiireSuiiList, lstSearchItem);

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

                pf.Dispose();
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);
                return;
            }
        }