/// <summary>
        /// Error Check for the whole form
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        private bool ErrorCheck(int index)
        {
            if (index == 11)
            {
                if (type == 1)
                {
                    DataTable dtpay = new DataTable();
                    dpe.LargePayNO = ScPaymentProcessNum.TxtCode.Text;
                    dtpay          = sibl.D_Pay_LargePayNoSelect(dpe);
                    if (dtpay.Rows.Count == 0)
                    {
                        sibl.ShowMessage("E138");
                        ScPaymentProcessNum.SetFocus(1);
                        return(false);
                    }
                    else
                    {
                        if (!string.IsNullOrWhiteSpace(dtpay.Rows[0]["DeleteDateTime"].ToString()))
                        {
                            sibl.ShowMessage("E140");
                            ScPaymentProcessNum.SetFocus(1);
                            return(false);
                        }
                    }
                }

                else if (type == 2)
                {
                    if (!RequireCheck(new Control[] { ScPaymentNum.TxtCode }))
                    {
                        return(false);
                    }

                    DataTable dtpayno = new DataTable();
                    dpe.PayNo = ScPaymentNum.TxtCode.Text;
                    dtpayno   = sibl.D_Pay_PayNoSelect(dpe);
                    if (dtpayno.Rows.Count == 0)
                    {
                        sibl.ShowMessage("E138");
                        ScPaymentNum.SetFocus(1);
                        return(false);
                    }
                    else
                    {
                        if (!string.IsNullOrWhiteSpace(dtpayno.Rows[0]["DeleteDateTime"].ToString()))
                        {
                            sibl.ShowMessage("E140");
                            ScPaymentNum.SetFocus(1);
                            return(false);
                        }
                        if (!string.IsNullOrWhiteSpace(dtpayno.Rows[0]["FBCreateDate"].ToString()))
                        {
                            sibl.ShowMessage("E144");
                            ScPaymentNum.SetFocus(1);
                            return(false);
                        }
                        txtPaymentDate.Text         = dtpayno.Rows[0]["PayDate"].ToString();
                        mfye.InputPossibleStartDate = txtPaymentDate.Text;
                        mfye.InputPossibleEndDate   = txtPaymentDate.Text;
                        DataTable dtcontrol = new DataTable();
                        dtcontrol = sibl.M_Control_PaymentSelect(mfye);
                        if (dtcontrol.Rows.Count == 0)
                        {
                            sibl.ShowMessage("E115");
                            ScPaymentNum.SetFocus(1);
                            return(false);
                        }
                        //else
                        //{
                        //    DataDisplay();
                        //}
                    }
                }

                else if (type == 3)
                {
                    if (!RequireCheck(new Control[] { txtDueDate2 }))
                    {
                        return(false);
                    }
                    else
                    {
                        int result = txtDueDate1.Text.CompareTo(txtDueDate2.Text);
                        if (result > 0)
                        {
                            sibl.ShowMessage("E104");
                            txtDueDate2.Focus();
                        }
                    }

                    //if (!RequireCheck(new Control[] { ScPayee.TxtCode }))
                    //    return false;
                    //else
                    //if(!string.IsNullOrWhiteSpace(ScPayee.TxtCode.Text))
                    //{
                    mve.VendorCD      = ScPayee.TxtCode.Text;
                    mve.ChangeDate    = DateTime.Now.ToString("yyyy/MM/dd");
                    mve.MoneyPayeeFlg = "1";
                    DataTable dtvendor = new DataTable();
                    dtvendor = sibl.M_Vendor_Select(mve);
                    if (dtvendor.Rows.Count == 0)
                    {
                        sibl.ShowMessage("E101");
                        ScPayee.SetFocus(1);
                        return(false);
                    }
                    else
                    {
                        ScPayee.LabelText = dtvendor.Rows[0]["VendorName"].ToString();
                    }
                    //}
                }
            }
            else if (index == 12)
            {
                if (!RequireCheck(new Control[] { txtPaymentDate }))
                {
                    return(false);
                }

                mfye.InputPossibleStartDate = txtPaymentDate.Text;
                mfye.InputPossibleEndDate   = txtPaymentDate.Text;
                DataTable dtcontrol = new DataTable();
                dtcontrol = sibl.M_Control_PaymentSelect(mfye);
                if (dtcontrol.Rows.Count == 0)
                {
                    sibl.ShowMessage("E115");
                    ScPaymentNum.SetFocus(1);
                    return(false);
                }

                //店舗の締日チェック
                //店舗締マスターで判断
                M_StoreClose_Entity msce = new M_StoreClose_Entity();
                msce.StoreCD      = InOperatorCD;
                msce.FiscalYYYYMM = txtPaymentDate.Text.Replace("/", "").Substring(0, 6);
                DataTable dtposition = sibl.CheckClosePosition(msce);
                if (dtposition.Rows.Count > 0)
                {
                    if (dtposition.Rows[0]["ClosePosition2"].ToString() == "1")
                    {
                        sibl.ShowMessage("E203");
                        return(false);
                    }
                    else if (dtposition.Rows[0]["ClosePosition2"].ToString() == "2")
                    {
                        sibl.ShowMessage("E194");
                        return(false);
                    }
                }

                if (!RequireCheck(new Control[] { ScStaff.TxtCode }))
                {
                    return(false);
                }
                else
                {
                    mse.StaffCD    = ScStaff.TxtCode.Text;
                    mse.ChangeDate = txtPaymentDate.Text;
                    DataTable dtstaff = new DataTable();
                    dtstaff = sibl.M_Staff_Select(mse);
                    //if (!ScStaff.SelectData())
                    if (dtstaff.Rows.Count == 0)
                    {
                        sibl.ShowMessage("E101");
                        ScStaff.SetFocus(1);
                        return(false);
                    }
                    else
                    {
                        ScStaff.LabelText = dtstaff.Rows[0]["StaffName"].ToString();
                    }
                }

                //if (!RequireCheck(new Control[] {cboPaymentType}))
                if (string.IsNullOrWhiteSpace(cboPaymentType.SelectedValue.ToString()))
                {
                    sibl.ShowMessage("E102");
                    cboPaymentType.Focus();
                    return(false);
                }
                else
                {
                    mmpe.ID = "314";
                    DataTable dtmulti = new DataTable();
                    dtmulti = sibl.M_MultiPorpose_Select(mmpe);
                    if (dtmulti.Rows.Count == 0)
                    {
                        sibl.ShowMessage("E128");
                        cboPaymentType.Focus();
                        return(false);
                    }
                    else
                    {
                        string name = dtmulti.Rows[0]["Char1"].ToString();
                    }
                }

                if (string.IsNullOrWhiteSpace(cboPaymentSourceAcc.SelectedValue.ToString()))
                {
                    sibl.ShowMessage("E102");
                    cboPaymentSourceAcc.Focus();
                    return(false);
                }
                mke.ChangeDate = txtPaymentDate.Text;
                DataTable dtkouza = new DataTable();
                dtkouza = sibl.M_Kouza_SelectByDate(mke);
                if (dtkouza.Rows.Count == 0)
                {
                    sibl.ShowMessage("E128");
                    cboPaymentSourceAcc.Focus();
                    return(false);
                }
                else
                {
                    cboPaymentSourceAcc.SelectedValue = dtkouza.Rows[0]["KouzaCD"].ToString();
                }
                if (string.IsNullOrWhiteSpace(txtBillSettleDate.Text))
                {
                    sibl.ShowMessage("E102");
                    txtBillSettleDate.Focus();
                    return(false);
                }
            }

            return(true);
        }
        private void F11()
        {
            type = 3;
            if (ErrorCheck(11))
            {
                dppe.PayPlanDateFrom = txtDueDate1.Text;
                dppe.PayPlanDateTo   = txtDueDate2.Text;
                dppe.PayeeCD         = ScPayee.TxtCode.Text;
                dppe.Operator        = InOperatorCD;

                dtpayplan = sibl.D_Pay_SelectForPayPlanDate1(dppe);
                if (dtpayplan.Rows.Count > 0)
                {
                    string year  = DateTime.Today.Year.ToString();
                    string month = DateTime.Today.Month.ToString();
                    if (month.Length == 1)
                    {
                        month = 0 + DateTime.Now.Month.ToString();
                    }
                    string day = DateTime.Today.Day.ToString();
                    if (day.Length == 1)
                    {
                        day = 0 + DateTime.Today.Day.ToString();
                    }
                    txtPaymentDate.Text          = year + "/" + month + "/" + day;
                    ScStaff.TxtCode.Text         = InOperatorCD;
                    ScStaff.LabelText            = dtpayplan.Rows[0]["StaffName"].ToString();
                    cboPaymentType.SelectedValue = 1;
                    if (cboPaymentType.SelectedValue == null)
                    {
                        cboPaymentType.SelectedValue = -1;
                    }
                    cboPaymentSourceAcc.SelectedValue = dtpayplan.Rows[0]["KouzaCD"].ToString();
                    txtBillSettleDate.Text            = string.Empty;
                    dtpayplan.Columns.Add("colCheck", typeof(bool)); foreach (DataRow dr in dtpayplan.Rows)
                    {
                        dr["colCheck"] = true;                                                                                      ///PTK Addded
                    }
                    dgvPayment.DataSource       = dtpayplan;
                    dgvPayment.Rows[0].Selected = true;
                    Checkstate(true);
                    LabelDataBind();
                    if (dgvPayment.Rows.Count > 0)
                    {
                        Btn_F7.Enabled = true;
                    }

                    //if (dgvPayment.SelectedRows.Count != 0)
                    //{
                    //DataGridViewRow row = this.dgvPayment.SelectedRows[0];
                    //dppe.PayPlanDate = row.Cells["colPaymentdueDate"].Value.ToString();
                    //dppe.PayeeCD = row.Cells["colPayeeCD"].Value.ToString();
                    dt4 = sibl.D_Pay_SelectForPayPlanDate2(dppe);
                    if (dt4.Rows.Count > 0)
                    {
                        dt4Detail = dt4.Copy();
                        dt4Detail.Columns.Remove("Number");
                        dt4Detail.Columns.Remove("RecordedDate");
                        dt4Detail.Columns.Remove("PayPlanGaku");
                        dt4Detail.Columns.Remove("PayConfirmGaku");
                        dt4Detail.Columns.Remove("UnpaidAmount1");
                        dt4Detail.Columns.Remove("UnpaidAmount2");
                        dt4Detail.Columns.Remove("PayPlanNO");


                        dt4.Columns.Remove("TransferGaku");
                        //dt4.Columns.Remove("TransferFeeGaku");
                        dt4.Columns.Remove("VendorName");
                        dt4.Columns.Remove("BankCD");
                        dt4.Columns.Remove("BankName");
                        dt4.Columns.Remove("BranchCD");
                        dt4.Columns.Remove("BranchName");
                        dt4.Columns.Remove("KouzaKBN");
                        dt4.Columns.Remove("KouzaNO");
                        dt4.Columns.Remove("KouzaMeigi");
                        dt4.Columns.Remove("FeeKBN");
                        dt4.Columns.Remove("Fee");
                        dt4.Columns.Remove("CashGaku");
                        dt4.Columns.Remove("OffsetGaku");
                        dt4.Columns.Remove("BillGaku");
                        dt4.Columns.Remove("BillDate");
                        dt4.Columns.Remove("BillNO");
                        dt4.Columns.Remove("ERMCGaku");
                        dt4.Columns.Remove("ERMCNO");
                        dt4.Columns.Remove("ERMCDate");
                        dt4.Columns.Remove("OtherGaku1");
                        dt4.Columns.Remove("Account1");
                        dt4.Columns.Remove("start1");
                        dt4.Columns.Remove("SubAccount1");
                        dt4.Columns.Remove("end1label");
                        dt4.Columns.Remove("OtherGaku2");
                        dt4.Columns.Remove("Account2");
                        dt4.Columns.Remove("start2");
                        dt4.Columns.Remove("SubAccount2");
                        dt4.Columns.Remove("end2label");
                    }
                    //}
                }

                else
                {
                    sibl.ShowMessage("E128");
                    ScPayee.SetFocus(1);
                }
                txtPaymentDate.ReadOnly  = true;
                ScStaff.TxtCode.ReadOnly = true;
                ScStaff.SearchEnable     = false;
                EnablePanel(PanelDetail);
                btnSelectAll.Enabled  = true;
                btnReleaseAll.Enabled = true;
            }
        }