private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityPurchaseMst();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlZip.MstID_Changed;
            _entity.PropertyChanged += this.utlSummingUp.MstID_Changed;
            _entity.PropertyChanged += this.utlPaymentDivision.MstID_Changed;
            _entity.PropertyChanged += this.utlGroup1.MstID_Changed;
            _entity.PropertyChanged += this._PropertyChanged;

            NumberConverter nmConvDecm0 = new NumberConverter();

            #region Bind

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindingAboutName = new Binding("_about_name");
            BindingAboutName.Mode = BindingMode.TwoWay;
            BindingAboutName.Source = _entity;
            this.txtAdoutName.SetBinding(TextBox.TextProperty, BindingAboutName);

            Binding BindingZipCodeFrom = new Binding("_zip_code_from");
            BindingZipCodeFrom.Mode = BindingMode.TwoWay;
            BindingZipCodeFrom.Source = _entity;
            this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom);

            Binding BindingZipCodeTo = new Binding("_zip_code_to");
            BindingZipCodeTo.Mode = BindingMode.TwoWay;
            BindingZipCodeTo.Source = _entity;
            this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo);

            this.utlZip.is_zip_from_first_flg = true;
            this.utlZip.is_zip_to_first_flg = true;

            Binding BindingAdress1 = new Binding("_adress1");
            BindingAdress1.Mode = BindingMode.TwoWay;
            BindingAdress1.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1);

            Binding BindingAdress2 = new Binding("_adress2");
            BindingAdress2.Mode = BindingMode.TwoWay;
            BindingAdress2.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2);

            Binding BindingStationName = new Binding("_station_name");
            BindingStationName.Mode = BindingMode.TwoWay;
            BindingStationName.Source = _entity;
            this.txtStationName.SetBinding(TextBox.TextProperty, BindingStationName);

            Binding BindingPostName = new Binding("_post_name");
            BindingPostName.Mode = BindingMode.TwoWay;
            BindingPostName.Source = _entity;
            this.txtPostName.SetBinding(TextBox.TextProperty, BindingPostName);

            Binding BindingPersonName = new Binding("_person_name");
            BindingPersonName.Mode = BindingMode.TwoWay;
            BindingPersonName.Source = _entity;
            this.txtPersonName.SetBinding(TextBox.TextProperty, BindingPersonName);

            Binding BindingTitleId = new Binding("_title_id");
            BindingTitleId.Mode = BindingMode.TwoWay;
            BindingTitleId.Source = _entity;
            this.utlTitle.txtID.SetBinding(TextBox.TextProperty, BindingTitleId);

            Binding BindingTitleName = new Binding("_title_name");
            BindingTitleName.Mode = BindingMode.TwoWay;
            BindingTitleName.Source = _entity;
            this.utlTitle.txtNm.SetBinding(TextBox.TextProperty, BindingTitleName);

            Binding BindingTel = new Binding("_tel");
            BindingTel.Mode = BindingMode.TwoWay;
            BindingTel.Source = _entity;
            this.txtTel.SetBinding(TextBox.TextProperty, BindingTel);

            Binding BindingFax = new Binding("_fax");
            BindingFax.Mode = BindingMode.TwoWay;
            BindingFax.Source = _entity;
            this.txtFax.SetBinding(TextBox.TextProperty, BindingFax);

            Binding BindingMailAdress = new Binding("_mail_adress");
            BindingMailAdress.Mode = BindingMode.TwoWay;
            BindingMailAdress.Source = _entity;
            this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress);

            Binding BindingBusinessDivisionId = new Binding("_business_division_id");
            BindingBusinessDivisionId.Mode = BindingMode.TwoWay;
            BindingBusinessDivisionId.Source = _entity;
            this.utlBusiness.txtID.SetBinding(TextBox.TextProperty, BindingBusinessDivisionId);

            Binding BindingBusinessDivisionName = new Binding("_business_division_nm");
            BindingBusinessDivisionName.Mode = BindingMode.TwoWay;
            BindingBusinessDivisionName.Source = _entity;
            this.utlBusiness.txtNm.SetBinding(TextBox.TextProperty, BindingBusinessDivisionName);

            Binding BindingUnitKindId = new Binding("_unit_kind_id");
            BindingUnitKindId.Mode = BindingMode.TwoWay;
            BindingUnitKindId.Source = _entity;
            this.utlUnitKind.txtID.SetBinding(TextBox.TextProperty, BindingUnitKindId);

            Binding BindingUnitKindName = new Binding("_unit_kind_nm");
            BindingUnitKindName.Mode = BindingMode.TwoWay;
            BindingUnitKindName.Source = _entity;
            this.utlUnitKind.txtNm.SetBinding(TextBox.TextProperty, BindingUnitKindName);

            Binding BindingCreditRate = new Binding("_credit_rate");
            BindingCreditRate.Mode = BindingMode.TwoWay;
            BindingCreditRate.Source = _entity;
            this.txtCreditRate.SetBinding(TextBox.TextProperty, BindingCreditRate);

            Binding BindingTaxChangeId = new Binding("_tax_change_id");
            BindingTaxChangeId.Mode = BindingMode.TwoWay;
            BindingTaxChangeId.Source = _entity;
            this.utlTaxChange.txtID.SetBinding(TextBox.TextProperty, BindingTaxChangeId);

            Binding BindingTaxChangeName = new Binding("_tax_change_nm");
            BindingTaxChangeName.Mode = BindingMode.TwoWay;
            BindingTaxChangeName.Source = _entity;
            this.utlTaxChange.txtNm.SetBinding(TextBox.TextProperty, BindingTaxChangeName);

            Binding BindingSummingUpGroupId = new Binding("_summing_up_group_id");
            BindingSummingUpGroupId.Mode = BindingMode.TwoWay;
            BindingSummingUpGroupId.Source = _entity;
            this.utlSummingUp.txtID.SetBinding(TextBox.TextProperty, BindingSummingUpGroupId);

            Binding BindingSummingUpGroupName = new Binding("_summing_up_group_nm");
            BindingSummingUpGroupName.Mode = BindingMode.TwoWay;
            BindingSummingUpGroupName.Source = _entity;
            this.utlSummingUp.txtNm.SetBinding(TextBox.TextProperty, BindingSummingUpGroupName);

            Binding BindigPriceFractionProcId = new Binding("_price_fraction_proc_id");
            BindigPriceFractionProcId.Mode = BindingMode.TwoWay;
            BindigPriceFractionProcId.Source = _entity;
            this.utlPriceFractionProc.txtID.SetBinding(TextBox.TextProperty, BindigPriceFractionProcId);

            Binding BindigPriceFractionProcName = new Binding("_price_fraction_proc_nm");
            BindigPriceFractionProcName.Mode = BindingMode.TwoWay;
            BindigPriceFractionProcName.Source = _entity;
            this.utlPriceFractionProc.txtNm.SetBinding(TextBox.TextProperty, BindigPriceFractionProcName);

            Binding BindigTaxFractionProcId = new Binding("_tax_fraction_proc_id");
            BindigTaxFractionProcId.Mode = BindingMode.TwoWay;
            BindigTaxFractionProcId.Source = _entity;
            this.utlTaxFractionProc.txtID.SetBinding(TextBox.TextProperty, BindigTaxFractionProcId);

            Binding BindigTaxFractionProcName = new Binding("_tax_fraction_proc_nm");
            BindigTaxFractionProcName.Mode = BindingMode.TwoWay;
            BindigTaxFractionProcName.Source = _entity;
            this.utlTaxFractionProc.txtNm.SetBinding(TextBox.TextProperty, BindigTaxFractionProcName);

            Binding BindigSalesCreditPrice = new Binding("_payment_credit_price");
            BindigSalesCreditPrice.Mode = BindingMode.TwoWay;
            BindigSalesCreditPrice.Source = _entity;
            this.txtSalesLimitPrice.SetBinding(TextBox.TextProperty, BindigSalesCreditPrice);
            this.txtSalesLimitPrice.OnFormatString();

            Binding BindigPaymentDivisionId = new Binding("_payment_division_id");
            BindigPaymentDivisionId.Mode = BindingMode.TwoWay;
            BindigPaymentDivisionId.Source = _entity;
            this.utlPaymentDivision.txtID.SetBinding(TextBox.TextProperty, BindigPaymentDivisionId);

            Binding BindigPaymentDivisionName = new Binding("_payment_division_nm");
            BindigPaymentDivisionName.Mode = BindingMode.TwoWay;
            BindigPaymentDivisionName.Source = _entity;
            this.utlPaymentDivision.txtNm.SetBinding(TextBox.TextProperty, BindigPaymentDivisionName);

            Binding BindigPaymentCycleId = new Binding("_payment_cycle_id");
            BindigPaymentCycleId.Mode = BindingMode.TwoWay;
            BindigPaymentCycleId.Source = _entity;
            this.utlPaymentCycle.txtID.SetBinding(TextBox.TextProperty, BindigPaymentCycleId);

            Binding BindigPaymentCycleName = new Binding("_payment_cycle_nm");
            BindigPaymentCycleName.Mode = BindingMode.TwoWay;
            BindigPaymentCycleName.Source = _entity;
            this.utlPaymentCycle.txtNm.SetBinding(TextBox.TextProperty, BindigPaymentCycleName);

            Binding BindigPaymentDay = new Binding("_payment_day");
            BindigPaymentDay.Mode = BindingMode.TwoWay;
            BindigPaymentDay.Source = _entity;
            this.txtPaymentDay.SetBinding(TextBox.TextProperty, BindigPaymentDay);

            Binding BindigBillSite = new Binding("_bill_site");
            BindigBillSite.Mode = BindingMode.TwoWay;
            BindigBillSite.Source = _entity;
            this.txtBillSite.SetBinding(TextBox.TextProperty, BindigBillSite);

            Binding BindigGroup1Id = new Binding("_group1_id");
            BindigGroup1Id.Mode = BindingMode.TwoWay;
            BindigGroup1Id.Source = _entity;
            this.utlGroup1.txtID.SetBinding(TextBox.TextProperty, BindigGroup1Id);

            Binding BindigGroup1Name = new Binding("_group1_nm");
            BindigGroup1Name.Mode = BindingMode.TwoWay;
            BindigGroup1Name.Source = _entity;
            this.utlGroup1.txtNm.SetBinding(TextBox.TextProperty, BindigGroup1Name);

            Binding BindigDiaplayDivisionId = new Binding("_display_division_id");
            BindigDiaplayDivisionId.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId);

            Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm");
            BindigDiaplayDivisionNm.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm);

            Binding BindigMemo = new Binding("_memo");
            BindigMemo.Mode = BindingMode.TwoWay;
            BindigMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo);

            #endregion

            this.utlID.txtID.SetZeroToNullString();
            this.utlTitle.txtID.SetZeroToNullString();
            this.utlBusiness.txtID.SetZeroToNullString();
            this.utlUnitKind.txtID.SetZeroToNullString();
            this.utlTaxFractionProc.txtID.SetZeroToNullString();
            this.utlSummingUp.txtID.SetZeroToNullString();
            this.utlPaymentDivision.txtID.SetZeroToNullString();
            this.utlPaymentCycle.txtID.SetZeroToNullString();
            this.utlPriceFractionProc.txtID.SetZeroToNullString();
            this.utlTaxFractionProc.txtID.SetZeroToNullString();
            this.utlGroup1.txtID.SetZeroToNullString();

            this.txtSalesLimitPrice.OnFormatString();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._business_division_id = 1;                              // 取引区分 1:掛売上
                _entity._unit_kind_id = 2;                                      // 単価種類 2:売上単価
                _entity._tax_change_id = (int)Common.geTaxChange.OUT_TAX_SUM;   // 税転換 1:外税/伝票計
                _entity._price_fraction_proc_id = 2;                            // 金額端数処理 2:切り上げ
                _entity._tax_fraction_proc_id = 2;                              // 税端数処理 2:切り上げ
                _entity._display_division_id = 1;
                _entity._credit_rate = 100;
            }
        }
        private void SetBinding()
        {
            if (_entityH == null)
            {
                _entityH = new EntityInOutDeliveryH();
            }

            if (_entityListD == null)
            {
                _entityListD = new ObservableCollection<EntityInOutDeliveryD>();
            }

            // マスタコントロールPropertyChanged
            _entityH.PropertyChanged += this.utlCompanyGroup.MstID_Changed;
            _entityH.PropertyChanged += this.utlCustomer.MstID_Changed;
            _entityH.PropertyChanged += this.utlPurchase.MstID_Changed;
            _entityH.PropertyChanged += this.utlPerson.MstID_Changed;
            _entityH.PropertyChanged += this._PropertyChanged;
            this.utlCustomer.ParentData = _entityH;
            this.utlPurchase.ParentData = _entityH;
            this.utlPerson.ParentData = _entityH;

            NumberConverter nmConvDecm0 = new NumberConverter();
            NumberConverter nmConvDecm2 = new NumberConverter();
            nmConvDecm2.DecimalPlaces = 2;

            #region Bind

            // バインド
            Binding BindingInOutDeliveryYmd = new Binding("_in_out_delivery_ymd");
            BindingInOutDeliveryYmd.Mode = BindingMode.TwoWay;
            BindingInOutDeliveryYmd.Source = _entityH;
            this.datInOutDeliveryYmd.SetBinding(DatePicker.SelectedDateProperty, BindingInOutDeliveryYmd);

            if (string.IsNullOrEmpty(_entityH._in_out_delivery_ymd))
            {
                _entityH._in_out_delivery_ymd = DateTime.Now.ToString("yyyy/MM/dd");
            }
            
            Binding BindingInpPersonID = new Binding("_update_person_id");
            BindingInpPersonID.Mode = BindingMode.TwoWay;
            BindingInpPersonID.Source = _entityH;
            this.utlPerson.txtID.SetBinding(TextBox.TextProperty, BindingInpPersonID);

            Binding BindingInpPersonName = new Binding("_update_person_nm");
            BindingInpPersonName.Mode = BindingMode.TwoWay;
            BindingInpPersonName.Source = _entityH;
            this.utlPerson.txtNm.SetBinding(TextBox.TextProperty, BindingInpPersonName);

            if (_entityH._update_person_id == 0)
            {
                // デフォルト担当の設定
                this.utlPerson.txtID.Text = Common.gintDefaultPersonId.ToString();
                _entityH._update_person_id = Common.gintDefaultPersonId;
                this.utlPerson.MstID_Changed(null, new PropertyChangedEventArgs("_update_person_id"));
            }

            Binding BindingInOutDeliveryKbnId = new Binding("_in_out_delivery_kbn");
            BindingInOutDeliveryKbnId.Mode = BindingMode.TwoWay;
            BindingInOutDeliveryKbnId.Source = _entityH;
            this.utlInOutDeliveryKbn.txtID.SetBinding(TextBox.TextProperty, BindingInOutDeliveryKbnId);

            Binding BindingInOutDeliveryKbnName = new Binding("_in_out_delivery_kbn_nm");
            BindingInOutDeliveryKbnName.Mode = BindingMode.TwoWay;
            BindingInOutDeliveryKbnName.Source = _entityH;
            this.utlInOutDeliveryKbn.txtNm.SetBinding(TextBox.TextProperty, BindingInOutDeliveryKbnName);

            Binding BindingInOutDeliveryToKbnId = new Binding("_in_out_delivery_to_kbn");
            BindingInOutDeliveryToKbnId.Mode = BindingMode.TwoWay;
            BindingInOutDeliveryToKbnId.Source = _entityH;
            this.utlInOutDeliveryToKbn.txtID.SetBinding(TextBox.TextProperty, BindingInOutDeliveryToKbnId);

            Binding BindingInOutDeliveryToKbnName = new Binding("_in_out_delivery_to_kbn_nm");
            BindingInOutDeliveryToKbnName.Mode = BindingMode.TwoWay;
            BindingInOutDeliveryToKbnName.Source = _entityH;
            this.utlInOutDeliveryToKbn.txtNm.SetBinding(TextBox.TextProperty, BindingInOutDeliveryToKbnName);

            Binding BindingCompanyGroupId = new Binding("_group_id_to");
            BindingCompanyGroupId.Mode = BindingMode.TwoWay;
            BindingCompanyGroupId.Source = _entityH;
            this.utlCompanyGroup.txtID.SetBinding(TextBox.TextProperty, BindingCompanyGroupId);

            Binding BindingCompanyGroupName = new Binding("_group_id_to_nm");
            BindingCompanyGroupName.Mode = BindingMode.TwoWay;
            BindingCompanyGroupName.Source = _entityH;
            this.utlCompanyGroup.txtNm.SetBinding(TextBox.TextProperty, BindingCompanyGroupName);
            
            Binding BindingCustomeNo = new Binding("_customer_id");
            BindingCustomeNo.Mode = BindingMode.TwoWay;
            BindingCustomeNo.Source = _entityH;
            this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomeNo);

            Binding BindingCustomeName = new Binding("_customer_name");
            BindingCustomeName.Mode = BindingMode.TwoWay;
            BindingCustomeName.Source = _entityH;
            this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomeName);

            Binding BindingPurchaseId = new Binding("_purchase_id");
            BindingPurchaseId.Mode = BindingMode.TwoWay;
            BindingPurchaseId.Source = _entityH;
            this.utlPurchase.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseId);

            Binding BindingPurchaseName = new Binding("_purchase_name");
            BindingPurchaseName.Mode = BindingMode.TwoWay;
            BindingPurchaseName.Source = _entityH;
            this.utlPurchase.txtNm.SetBinding(TextBox.TextProperty, BindingPurchaseName);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entityH;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            // 入数計
            Binding BindingEnterNumber = new Binding("_sum_enter_number");
            BindingEnterNumber.Mode = BindingMode.TwoWay;
            BindingEnterNumber.Source = _entityH;
            BindingEnterNumber.Converter = nmConvDecm0;
            this.txtEnterNumber.SetBinding(TextBox.TextProperty, BindingEnterNumber);
            
            // ケース数計
            Binding BindingCaseNumber = new Binding("_sum_case_number");
            BindingCaseNumber.Mode = BindingMode.TwoWay;
            BindingCaseNumber.Source = _entityH;
            BindingCaseNumber.Converter = nmConvDecm0;
            this.txtCaseNumber.SetBinding(TextBox.TextProperty, BindingCaseNumber);
            
            // 数量計
            Binding BindingNumber = new Binding("_sum_number");
            BindingNumber.Mode = BindingMode.TwoWay;
            BindingNumber.Source = _entityH;
            BindingNumber.Converter = nmConvDecm2;
            this.txtNumber.SetBinding(TextBox.TextProperty, BindingNumber);
            
            #endregion

            this.utlCustomer.txtID.SetZeroToNullString();
            this.utlPurchase.txtID.SetZeroToNullString();
            this.utlCompanyGroup.txtID.SetZeroToNullString();
            this.utlPerson.txtID.SetZeroToNullString();
        }
        private void SetBinding()
        {
            if (_entityH == null)
            {
                _entityH = new EntityEstimateH();
            }

            if (_entityListD == null)
            {
                _entityListD = new ObservableCollection<EntityEstimateD>();
            }

            // マスタコントロールPropertyChanged
            _entityH.PropertyChanged += this.utlCustomer.MstID_Changed;
            _entityH.PropertyChanged += this.utlSupply.MstID_Changed;
            _entityH.PropertyChanged += this.utlPerson.MstID_Changed;
            _entityH.PropertyChanged += this._PropertyChanged;
            this.utlCustomer.ParentData = _entityH;
            this.utlSupply.ParentData = _entityH;
            this.utlPerson.ParentData = _entityH;

            NumberConverter nmConvDecm0 = new NumberConverter();
            NumberConverter nmConvDecm2 = new NumberConverter();
            nmConvDecm2.DecimalPlaces = 2;

            #region Bind

            // バインド
            Binding BindingState = new Binding("_state");
            BindingState.Mode = BindingMode.TwoWay;
            BindingState.Source = _entityH;
            this.utlState.SetBinding(Utl_State.StateValueProperty, BindingState);

            Binding BindingOrderYmd = new Binding("_estimate_ymd");
            BindingOrderYmd.Mode = BindingMode.TwoWay;
            BindingOrderYmd.Source = _entityH;
            this.datEstimateYmd.SetBinding(DatePicker.SelectedDateProperty, BindingOrderYmd);

            if (string.IsNullOrEmpty(_entityH._estimate_ymd))
            {
                _entityH._estimate_ymd = DateTime.Now.ToString("yyyy/MM/dd");
            }
            
            Binding BindingInpPersonID = new Binding("_update_person_id");
            BindingInpPersonID.Mode = BindingMode.TwoWay;
            BindingInpPersonID.Source = _entityH;
            this.utlPerson.txtID.SetBinding(TextBox.TextProperty, BindingInpPersonID);

            Binding BindingInpPersonName = new Binding("_update_person_nm");
            BindingInpPersonName.Mode = BindingMode.TwoWay;
            BindingInpPersonName.Source = _entityH;
            this.utlPerson.txtNm.SetBinding(TextBox.TextProperty, BindingInpPersonName);

            if (_entityH._update_person_id == 0)
            {
                // デフォルト担当の設定
                this.utlPerson.txtID.Text = Common.gintDefaultPersonId.ToString();
                _entityH._update_person_id = Common.gintDefaultPersonId;
                this.utlPerson.MstID_Changed(null, new PropertyChangedEventArgs("_update_person_id"));
            }

            Binding BindingCustomeNo = new Binding("_customer_id");
            BindingCustomeNo.Mode = BindingMode.TwoWay;
            BindingCustomeNo.Source = _entityH;
            this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomeNo);

            Binding BindingCustomeName = new Binding("_customer_name");
            BindingCustomeName.Mode = BindingMode.TwoWay;
            BindingCustomeName.Source = _entityH;
            this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomeName);

            Binding BindingSupplyNo = new Binding("_supplier_id");
            BindingSupplyNo.Mode = BindingMode.TwoWay;
            BindingSupplyNo.Source = _entityH;
            this.utlSupply.txtID.SetBinding(TextBox.TextProperty, BindingSupplyNo);
            this.utlSupply.txtID2.SetBinding(TextBox.TextProperty, BindingCustomeNo);

            Binding BindingSupplyName = new Binding("_supplier_name");
            BindingSupplyName.Mode = BindingMode.TwoWay;
            BindingSupplyName.Source = _entityH;
            this.utlSupply.txtNm.SetBinding(TextBox.TextProperty, BindingSupplyName);

            Binding BindingTax = new Binding("_tax_change_id");
            BindingTax.Mode = BindingMode.TwoWay;
            BindingTax.Source = _entityH;
            this.utlTax.txtID.SetBinding(TextBox.TextProperty, BindingTax);

            Binding BindingTaxName = new Binding("_tax_change_name");
            BindingTaxName.Mode = BindingMode.TwoWay;
            BindingTaxName.Source = _entityH;
            this.utlTax.txtNm.SetBinding(TextBox.TextProperty, BindingTaxName);

            Binding BindingBusiness = new Binding("_business_division_id");
            BindingBusiness.Mode = BindingMode.TwoWay;
            BindingBusiness.Source = _entityH;
            this.utlBusiness.txtID.SetBinding(TextBox.TextProperty, BindingBusiness);

            Binding BindingBusinessName = new Binding("_business_division_name");
            BindingBusinessName.Mode = BindingMode.TwoWay;
            BindingBusinessName.Source = _entityH;
            this.utlBusiness.txtNm.SetBinding(TextBox.TextProperty, BindingBusinessName);

            Binding BindingNokiYmd = new Binding("_supply_ymd");
            BindingNokiYmd.Mode = BindingMode.TwoWay;
            BindingNokiYmd.Source = _entityH;
            this.datNokiYmd.SetBinding(DatePicker.SelectedDateProperty, BindingNokiYmd);

            Binding BindingTimeLimitYmd = new Binding("_time_limit_ymd");
            BindingTimeLimitYmd.Mode = BindingMode.TwoWay;
            BindingTimeLimitYmd.Source = _entityH;
            this.datTimeLimitYmd.SetBinding(DatePicker.SelectedDateProperty, BindingTimeLimitYmd);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entityH;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            // 入数計
            Binding BindingEnterNumber = new Binding("_sum_enter_number");
            BindingEnterNumber.Mode = BindingMode.TwoWay;
            BindingEnterNumber.Source = _entityH;
            BindingEnterNumber.Converter = nmConvDecm0;
            this.txtEnterNumber.SetBinding(TextBox.TextProperty, BindingEnterNumber);
            
            // ケース数計
            Binding BindingCaseNumber = new Binding("_sum_case_number");
            BindingCaseNumber.Mode = BindingMode.TwoWay;
            BindingCaseNumber.Source = _entityH;
            BindingCaseNumber.Converter = nmConvDecm0;
            this.txtCaseNumber.SetBinding(TextBox.TextProperty, BindingCaseNumber);
            
            // 数量計
            Binding BindingNumber = new Binding("_sum_number");
            BindingNumber.Mode = BindingMode.TwoWay;
            BindingNumber.Source = _entityH;
            BindingNumber.Converter = nmConvDecm2;
            this.txtNumber.SetBinding(TextBox.TextProperty, BindingNumber);
            
            // 単価計
            Binding BindingUnitPrice = new Binding("_sum_unit_price");
            BindingUnitPrice.Mode = BindingMode.TwoWay;
            BindingUnitPrice.Source = _entityH;
            BindingUnitPrice.Converter = nmConvDecm2;
            this.txtUnitPrice.SetBinding(TextBox.TextProperty, BindingUnitPrice);
            
            // 売上原価計

            // 消費税額計
            Binding BindingSumTax = new Binding("_sum_tax");
            BindingSumTax.Mode = BindingMode.TwoWay;
            BindingSumTax.Source = _entityH;
            BindingSumTax.Converter = nmConvDecm0;
            this.txtTax.SetBinding(TextBox.TextProperty, BindingSumTax);
            
            // 税抜金額計
            Binding BindingTaxNoPrice = new Binding("_sum_no_tax_price");
            BindingTaxNoPrice.Mode = BindingMode.TwoWay;
            BindingTaxNoPrice.Source = _entityH;
            BindingTaxNoPrice.Converter = nmConvDecm0;
            this.txtTaxNoPrice.SetBinding(TextBox.TextProperty, BindingTaxNoPrice);

            // 税込金額計
            this.txtSumPrice.Text = ExCast.zCStr(ExCast.zCDbl(_entityH._sum_no_tax_price) + ExCast.zCDbl(_entityH._sum_tax));
            this.txtSumPrice.OnFormatString();

            // 金額計
            Binding BindingPrice = new Binding("_sum_price");
            BindingPrice.Mode = BindingMode.TwoWay;
            BindingPrice.Source = _entityH;
            BindingPrice.Converter = nmConvDecm0;
            this.txtPrice.SetBinding(TextBox.TextProperty, BindingPrice);
            
            // 粗利計(売上金額計-売上原価計)
            Binding BindingProfits = new Binding("_sum_profits");
            BindingProfits.Mode = BindingMode.TwoWay;
            BindingProfits.Source = _entityH;
            BindingProfits.Converter = nmConvDecm0;
            this.txtProfits.SetBinding(TextBox.TextProperty, BindingProfits);
            
            // 粗利率(売上原価計÷売上金額計×100)
            Binding BindingProfitsPercent = new Binding("_profits_percent");
            BindingProfitsPercent.Mode = BindingMode.TwoWay;
            BindingProfitsPercent.Source = _entityH;
            BindingProfitsPercent.Converter = nmConvDecm0;
            this.txtProfitsPercent.SetBinding(TextBox.TextProperty, BindingProfitsPercent);

            // 与信限度額
            Binding BindingCreditLimitPrice = new Binding("_credit_limit_price");
            BindingCreditLimitPrice.Mode = BindingMode.TwoWay;
            BindingCreditLimitPrice.Source = _entityH;
            BindingCreditLimitPrice.Converter = nmConvDecm0;
            this.txtCreditLimitPrice.SetBinding(TextBox.TextProperty, BindingCreditLimitPrice);

            // 売掛残高
            Binding BindingSalesCreditPrice = new Binding("_sales_credit_price");
            BindingSalesCreditPrice.Mode = BindingMode.TwoWay;
            BindingSalesCreditPrice.Source = _entityH;
            BindingSalesCreditPrice.Converter = nmConvDecm0;
            this.txtSalesLimitPrice.SetBinding(TextBox.TextProperty, BindingSalesCreditPrice);

            #endregion

            this.utlCustomer.txtID.SetZeroToNullString();
            this.utlSupply.txtID.SetZeroToNullString();
            this.utlPerson.txtID.SetZeroToNullString();
            this.utlTax.txtID.SetZeroToNullString();
            this.utlBusiness.txtID.SetZeroToNullString();
        }
        private void SetBinding()
        {
            bool is_null = false;

            if (_entity == null)
            {
                _entity = new EntitySupplier();
                is_null = true;
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCustomer.MstID_Changed;
            _entity.PropertyChanged += this.utlZip.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            #region Bind

            string _customerId = ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim());
            string _customerNm = this.utlCustomer.txtNm.Text.Trim();

            // バインド
            Binding BindingCustomerId = new Binding("_customer_id");
            BindingCustomerId.Mode = BindingMode.TwoWay;
            BindingCustomerId.Source = _entity;
            this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomerId);
            this.utlID.txtID2.SetBinding(TextBox.TextProperty, BindingCustomerId);

            Binding BindingCustomerName = new Binding("_customer_nm");
            BindingCustomerName.Mode = BindingMode.TwoWay;
            BindingCustomerName.Source = _entity;
            this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomerName);

            if (is_null == false)
            {
                this.utlCustomer.txtID.Text = _customerId;
                this.utlCustomer.txtNm.Text = _customerNm;
            }

            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindingAboutName = new Binding("_about_name");
            BindingAboutName.Mode = BindingMode.TwoWay;
            BindingAboutName.Source = _entity;
            this.txtAdoutName.SetBinding(TextBox.TextProperty, BindingAboutName);

            Binding BindingZipCodeFrom = new Binding("_zip_code_from");
            BindingZipCodeFrom.Mode = BindingMode.TwoWay;
            BindingZipCodeFrom.Source = _entity;
            this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom);

            Binding BindingZipCodeTo = new Binding("_zip_code_to");
            BindingZipCodeTo.Mode = BindingMode.TwoWay;
            BindingZipCodeTo.Source = _entity;
            this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo);

            this.utlZip.is_zip_from_first_flg = true;
            this.utlZip.is_zip_to_first_flg = true;

            Binding BindingAdress1 = new Binding("_adress1");
            BindingAdress1.Mode = BindingMode.TwoWay;
            BindingAdress1.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1);

            Binding BindingAdress2 = new Binding("_adress2");
            BindingAdress2.Mode = BindingMode.TwoWay;
            BindingAdress2.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2);

            Binding BindingStationName = new Binding("_station_name");
            BindingStationName.Mode = BindingMode.TwoWay;
            BindingStationName.Source = _entity;
            this.txtStationName.SetBinding(TextBox.TextProperty, BindingStationName);

            Binding BindingPostName = new Binding("_post_name");
            BindingPostName.Mode = BindingMode.TwoWay;
            BindingPostName.Source = _entity;
            this.txtPostName.SetBinding(TextBox.TextProperty, BindingPostName);

            Binding BindingPersonName = new Binding("_person_name");
            BindingPersonName.Mode = BindingMode.TwoWay;
            BindingPersonName.Source = _entity;
            this.txtPersonName.SetBinding(TextBox.TextProperty, BindingPersonName);

            Binding BindingTitleId = new Binding("_title_id");
            BindingTitleId.Mode = BindingMode.TwoWay;
            BindingTitleId.Source = _entity;
            this.utlTitle.txtID.SetBinding(TextBox.TextProperty, BindingTitleId);

            Binding BindingTitleName = new Binding("_title_name");
            BindingTitleName.Mode = BindingMode.TwoWay;
            BindingTitleName.Source = _entity;
            this.utlTitle.txtNm.SetBinding(TextBox.TextProperty, BindingTitleName);

            Binding BindingTel = new Binding("_tel");
            BindingTel.Mode = BindingMode.TwoWay;
            BindingTel.Source = _entity;
            this.txtTel.SetBinding(TextBox.TextProperty, BindingTel);

            Binding BindingFax = new Binding("_fax");
            BindingFax.Mode = BindingMode.TwoWay;
            BindingFax.Source = _entity;
            this.txtFax.SetBinding(TextBox.TextProperty, BindingFax);

            Binding BindingMailAdress = new Binding("_mail_adress");
            BindingMailAdress.Mode = BindingMode.TwoWay;
            BindingMailAdress.Source = _entity;
            this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress);

            Binding BindigDiaplayDivisionId = new Binding("_display_division_id");
            BindigDiaplayDivisionId.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId);

            Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm");
            BindigDiaplayDivisionNm.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm);

            Binding BindigMemo = new Binding("_memo");
            BindigMemo.Mode = BindingMode.TwoWay;
            BindigMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo);

            #endregion

            if (ExCast.IsNumeric(this.utlID.txtID.Text.Trim()))
            {
                this.utlID.txtID.SetZeroToNullString();
            }
            this.utlID.txtID.FormatToID();            
            this.utlTitle.txtID.SetZeroToNullString();
            this.utlCustomer.txtID.SetZeroToNullString();

            this.utlCustomer.txtID.FormatToID();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._divide_permission_id = 2;
                _entity._display_division_id = 1;
            }
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityPerson();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCompanyGroup.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingGroupId = new Binding("_group_id");
            BindingGroupId.Mode = BindingMode.TwoWay;
            BindingGroupId.Source = _entity;
            this.utlCompanyGroup.txtID.SetBinding(TextBox.TextProperty, BindingGroupId);

            Binding BindingGroupName = new Binding("_group_nm");
            BindingGroupName.Mode = BindingMode.TwoWay;
            BindingGroupName.Source = _entity;
            this.utlCompanyGroup.txtNm.SetBinding(TextBox.TextProperty, BindingGroupName);

            Binding BindingDisplayDivisionId = new Binding("_display_division_id");
            BindingDisplayDivisionId.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindingDisplayDivisionId);

            Binding BindingDisplayDivisionNm = new Binding("_display_division_nm");
            BindingDisplayDivisionNm.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindingDisplayDivisionNm);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            this.utlID.txtID.SetZeroToNullString();

            // 初期値設定
            if (ExCast.zCInt(this.utlCompanyGroup.txtID.Text.Trim()) == 0)
            {
                this.utlCompanyGroup.MstID_Changed(null, new PropertyChangedEventArgs("_group_id"));
            }
            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._display_division_id = 1;
            }

        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityUser();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCompanyGroup.MstID_Changed;
            _entity.PropertyChanged += this.utlPerson.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            // バインド
            Binding BindingAfterLoginId = new Binding("_after_login_id");
            BindingAfterLoginId.Mode = BindingMode.TwoWay;
            BindingAfterLoginId.Source = _entity;
            this.txtLoginId.SetBinding(TextBox.TextProperty, BindingAfterLoginId);

            Binding BindingLoginPassword = new Binding("_login_password");
            BindingLoginPassword.Mode = BindingMode.TwoWay;
            BindingLoginPassword.Source = _entity;
            this.txtLoginPassword.SetBinding(PasswordBox.PasswordProperty, BindingLoginPassword);
            this.txtLoginPasswordConfirm.Password = "";

            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingGroupId = new Binding("_group_id");
            BindingGroupId.Mode = BindingMode.TwoWay;
            BindingGroupId.Source = _entity;
            this.utlCompanyGroup.txtID.SetBinding(TextBox.TextProperty, BindingGroupId);

            Binding BindingGroupName = new Binding("_group_nm");
            BindingGroupName.Mode = BindingMode.TwoWay;
            BindingGroupName.Source = _entity;
            this.utlCompanyGroup.txtNm.SetBinding(TextBox.TextProperty, BindingGroupName);

            Binding BindingPersonId = new Binding("_person_id");
            BindingPersonId.Mode = BindingMode.TwoWay;
            BindingPersonId.Source = _entity;
            this.utlPerson.txtID.SetBinding(TextBox.TextProperty, BindingPersonId);

            Binding BindingPersonNm = new Binding("_person_nm");
            BindingPersonNm.Mode = BindingMode.TwoWay;
            BindingPersonNm.Source = _entity;
            this.utlPerson.txtNm.SetBinding(TextBox.TextProperty, BindingPersonNm);

            Binding BindingDisplayDivisionId = new Binding("_display_division_id");
            BindingDisplayDivisionId.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindingDisplayDivisionId);

            Binding BindingDisplayDivisionNm = new Binding("_display_division_nm");
            BindingDisplayDivisionNm.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindingDisplayDivisionNm);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            this.utlCompanyGroup.txtID.OnFormatString();
            this.utlPerson.txtID.OnFormatString();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._display_division_id = 1;
            }

        }
        private void SetBinding()
        {
            if (_entityH == null)
            {
                _entityH = new EntityPaymentCashH();
            }

            if (_entityListD == null)
            {
                _entityListD = new ObservableCollection<EntityPaymentCashD>();
            }

            // マスタコントロールPropertyChanged
            _entityH.PropertyChanged += this.utlPurchase.MstID_Changed;
            _entityH.PropertyChanged += this.utlPerson.MstID_Changed;
            _entityH.PropertyChanged += this.utlPaymentDivision.MstID_Changed;
            _entityH.PropertyChanged += this.utlSummingUp.MstID_Changed;
            _entityH.PropertyChanged += this._PropertyChanged;
            this.utlPurchase.ParentData = _entityH;
            this.utlPerson.ParentData = _entityH;

            NumberConverter nmConvDecm0 = new NumberConverter();
            NumberConverter nmConvDecm2 = new NumberConverter();
            nmConvDecm2.DecimalPlaces = 2;

            #region Bind

            // バインド
            Binding BindingPaymentCashYmd = new Binding("_payment_cash_ymd");
            BindingPaymentCashYmd.Mode = BindingMode.TwoWay;
            BindingPaymentCashYmd.Source = _entityH;
            this.datPaymentCashYmd.SetBinding(DatePicker.SelectedDateProperty, BindingPaymentCashYmd);

            if (string.IsNullOrEmpty(_entityH._payment_cash_ymd))
            {
                _entityH._payment_cash_ymd = DateTime.Now.ToString("yyyy/MM/dd");
            }
            
            Binding BindingPersonId = new Binding("_person_id");
            BindingPersonId.Mode = BindingMode.TwoWay;
            BindingPersonId.Source = _entityH;
            this.utlPerson.txtID.SetBinding(TextBox.TextProperty, BindingPersonId);

            Binding BindingPersonNm = new Binding("_person_name");
            BindingPersonNm.Mode = BindingMode.TwoWay;
            BindingPersonNm.Source = _entityH;
            this.utlPerson.txtNm.SetBinding(TextBox.TextProperty, BindingPersonNm);

            if (_entityH._person_id == 0)
            {
                // デフォルト担当の設定
                this.utlPerson.txtID.Text = Common.gintDefaultPersonId.ToString();
                _entityH._person_id = Common.gintDefaultPersonId;
                this.utlPerson.MstID_Changed(null, new PropertyChangedEventArgs("_person_id"));
            }

            Binding BindingPaymentNo = new Binding("_payment_no");
            BindingPaymentNo.Mode = BindingMode.TwoWay;
            BindingPaymentNo.Source = _entityH;
            this.utlPaymentNo.txtID.SetBinding(TextBox.TextProperty, BindingPaymentNo);

            Binding BindingPaymentPlanYmd = new Binding("_payment_plan_day");
            BindingPaymentPlanYmd.Mode = BindingMode.TwoWay;
            BindingPaymentPlanYmd.Source = _entityH;
            this.datPaymentPlanYmd.SetBinding(DatePicker.SelectedDateProperty, BindingPaymentPlanYmd);

            Binding BindingPaymentCloseYmd = new Binding("_payment_yyyymmdd");
            BindingPaymentCloseYmd.Mode = BindingMode.TwoWay;
            BindingPaymentCloseYmd.Source = _entityH;
            this.datPaymentCloseYmd.SetBinding(DatePicker.SelectedDateProperty, BindingPaymentCloseYmd);

            //Binding BindingInvoiceKbnNm = new Binding("_invoice_kbn_nm");
            //BindingInvoiceKbnNm.Mode = BindingMode.TwoWay;
            //BindingInvoiceKbnNm.Source = _entityH;
            //this.txtPaymentKbn.SetBinding(TextBox.TextProperty, BindingInvoiceKbnNm);

            Binding BindingPurchaseId = new Binding("_purchase_id");
            BindingPurchaseId.Mode = BindingMode.TwoWay;
            BindingPurchaseId.Source = _entityH;
            this.utlPurchase.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseId);

            Binding BindingPurchaseNm = new Binding("_purchase_name");
            BindingPurchaseNm.Mode = BindingMode.TwoWay;
            BindingPurchaseNm.Source = _entityH;
            this.utlPurchase.txtNm.SetBinding(TextBox.TextProperty, BindingPurchaseNm);

            Binding BindingPaymentDivisionId = new Binding("_payment_division_id");
            BindingPaymentDivisionId.Mode = BindingMode.TwoWay;
            BindingPaymentDivisionId.Source = _entityH;
            this.utlPaymentDivision.txtID.SetBinding(TextBox.TextProperty, BindingPaymentDivisionId);

            Binding BindingPaymentDivisionNm = new Binding("_payment_division_nm");
            BindingPaymentDivisionNm.Mode = BindingMode.TwoWay;
            BindingPaymentDivisionNm.Source = _entityH;
            this.utlPaymentDivision.txtNm.SetBinding(TextBox.TextProperty, BindingPaymentDivisionNm);

            Binding BindingSummingUpId = new Binding("_summing_up_group_id");
            BindingSummingUpId.Mode = BindingMode.TwoWay;
            BindingSummingUpId.Source = _entityH;
            this.utlSummingUp.txtID.SetBinding(TextBox.TextProperty, BindingSummingUpId);

            Binding BindingSummingUpNm = new Binding("_summing_up_group_nm");
            BindingSummingUpNm.Mode = BindingMode.TwoWay;
            BindingSummingUpNm.Source = _entityH;
            this.utlSummingUp.txtNm.SetBinding(TextBox.TextProperty, BindingSummingUpNm);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entityH;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            Binding BindingPaymentPrice = new Binding("_payment_price");
            BindingPaymentPrice.Mode = BindingMode.TwoWay;
            BindingPaymentPrice.Source = _entityH;
            this.txtPaymentPrice.SetBinding(TextBox.TextProperty, BindingPaymentPrice);

            Binding BindingBeforePaymentPrice = new Binding("_before_payment_price");
            BindingBeforePaymentPrice.Mode = BindingMode.TwoWay;
            BindingBeforePaymentPrice.Source = _entityH;
            this.txtPaymentCashBeforePrice.SetBinding(TextBox.TextProperty, BindingBeforePaymentPrice);

            Binding BindingSumPrice = new Binding("_sum_price");
            BindingSumPrice.Mode = BindingMode.TwoWay;
            BindingSumPrice.Source = _entityH;
            this.txtPrice.SetBinding(TextBox.TextProperty, BindingSumPrice);

            Binding BindingCreditPrice = new Binding("_credit_price");
            BindingCreditPrice.Mode = BindingMode.TwoWay;
            BindingCreditPrice.Source = _entityH;
            this.txtCreditPrice.SetBinding(TextBox.TextProperty, BindingCreditPrice);

            DetailSumInvoicePrice();

            #endregion

            this.utlPaymentNo.txtID.SetZeroToNullString();
            this.utlPurchase.txtID.SetZeroToNullString();
            this.utlPerson.txtID.SetZeroToNullString();

            this.utlPaymentNo.txtID.OnFormatString();
            this.utlPurchase.txtID.OnFormatString();
            this.utlPaymentDivision.txtID.OnFormatString();
            this.utlSummingUp.txtID.OnFormatString();
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityCommodity();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlMainPurchaseId.MstID_Changed;
            _entity.PropertyChanged += this.utlGroup1.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            #region Bind

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindigUnitId = new Binding("_unit_id");
            BindigUnitId.Mode = BindingMode.TwoWay;
            BindigUnitId.Source = _entity;
            this.utlUnit.txtID.SetBinding(TextBox.TextProperty, BindigUnitId);

            Binding BindigUnitNm = new Binding("_unit_nm");
            BindigUnitNm.Mode = BindingMode.TwoWay;
            BindigUnitNm.Source = _entity;
            this.utlUnit.txtNm.SetBinding(TextBox.TextProperty, BindigUnitNm);

            Binding BindigEnterNumber = new Binding("_enter_number");
            BindigEnterNumber.Mode = BindingMode.TwoWay;
            BindigEnterNumber.Source = _entity;
            this.txtEnterNumver.SetBinding(TextBox.TextProperty, BindigEnterNumber);

            Binding BindigNumberDecimalDigit = new Binding("_number_decimal_digit");
            BindigNumberDecimalDigit.Mode = BindingMode.TwoWay;
            BindigNumberDecimalDigit.Source = _entity;
            this.txtNumverDecimalDigit.SetBinding(TextBox.TextProperty, BindigNumberDecimalDigit);

            Binding BindigUnitDecimalDigit = new Binding("_unit_decimal_digit");
            BindigUnitDecimalDigit.Mode = BindingMode.TwoWay;
            BindigUnitDecimalDigit.Source = _entity;
            this.txtUnitDecimalDigit.SetBinding(TextBox.TextProperty, BindigUnitDecimalDigit);

            Binding BindigTaxationDivitionId = new Binding("_taxation_divition_id");
            BindigTaxationDivitionId.Mode = BindingMode.TwoWay;
            BindigTaxationDivitionId.Source = _entity;
            this.utlTaxationDivisionID.txtID.SetBinding(TextBox.TextProperty, BindigTaxationDivitionId);

            Binding BindigTaxationDivitionNm = new Binding("_taxation_divition_nm");
            BindigTaxationDivitionNm.Mode = BindingMode.TwoWay;
            BindigTaxationDivitionNm.Source = _entity;
            this.utlTaxationDivisionID.txtNm.SetBinding(TextBox.TextProperty, BindigTaxationDivitionNm);

            Binding BindigInventoryManagementDivisionId = new Binding("_inventory_management_division_id");
            BindigInventoryManagementDivisionId.Mode = BindingMode.TwoWay;
            BindigInventoryManagementDivisionId.Source = _entity;
            this.utlInventoryDivisionId.txtID.SetBinding(TextBox.TextProperty, BindigInventoryManagementDivisionId);

            Binding BindigInventoryManagementDivisionNm = new Binding("_inventory_management_division_nm");
            BindigInventoryManagementDivisionNm.Mode = BindingMode.TwoWay;
            BindigInventoryManagementDivisionNm.Source = _entity;
            this.utlInventoryDivisionId.txtNm.SetBinding(TextBox.TextProperty, BindigInventoryManagementDivisionNm);

            Binding BindigPurchaselot = new Binding("_purchase_lot");
            BindigPurchaselot.Mode = BindingMode.TwoWay;
            BindigPurchaselot.Source = _entity;
            this.txtPurchaseLot.SetBinding(TextBox.TextProperty, BindigPurchaselot);

            Binding BindigLeadTime = new Binding("_lead_time");
            BindigLeadTime.Mode = BindingMode.TwoWay;
            BindigLeadTime.Source = _entity;
            this.txtLeadTime.SetBinding(TextBox.TextProperty, BindigLeadTime);

            Binding BindigJustInventoryNumver = new Binding("_just_inventory_number");
            BindigJustInventoryNumver.Mode = BindingMode.TwoWay;
            BindigJustInventoryNumver.Source = _entity;
            this.txtJustInventoryNumber.SetBinding(TextBox.TextProperty, BindigJustInventoryNumver);

            Binding BindigInventoryNumver = new Binding("_inventory_number");
            BindigInventoryNumver.Mode = BindingMode.TwoWay;
            BindigInventoryNumver.Source = _entity;
            this.txtInventoryNumber.SetBinding(TextBox.TextProperty, BindigInventoryNumver);

            Binding BindigMainPurchaseId = new Binding("_main_purchase_id");
            BindigMainPurchaseId.Mode = BindingMode.TwoWay;
            BindigMainPurchaseId.Source = _entity;
            this.utlMainPurchaseId.txtID.SetBinding(TextBox.TextProperty, BindigMainPurchaseId);

            Binding BindigMainPurchaseNm = new Binding("_main_purchase_nm");
            BindigMainPurchaseNm.Mode = BindingMode.TwoWay;
            BindigMainPurchaseNm.Source = _entity;
            this.utlMainPurchaseId.txtNm.SetBinding(TextBox.TextProperty, BindigMainPurchaseNm);

            Binding BindigRetailPriceSkipTax = new Binding("_retail_price_skip_tax");
            BindigRetailPriceSkipTax.Mode = BindingMode.TwoWay;
            BindigRetailPriceSkipTax.Source = _entity;
            this.txtRetailPriceSkipTax.SetBinding(TextBox.TextProperty, BindigRetailPriceSkipTax);

            Binding BindigRetailPriceBeforeTax = new Binding("_retail_price_before_tax");
            BindigRetailPriceBeforeTax.Mode = BindingMode.TwoWay;
            BindigRetailPriceBeforeTax.Source = _entity;
            this.txtRetailPriceBeforeTax.SetBinding(TextBox.TextProperty, BindigRetailPriceBeforeTax);

            Binding BindigSalesUnitPriceSkipTax = new Binding("_sales_unit_price_skip_tax");
            BindigSalesUnitPriceSkipTax.Mode = BindingMode.TwoWay;
            BindigSalesUnitPriceSkipTax.Source = _entity;
            this.txtSalesUnitSkipTax.SetBinding(TextBox.TextProperty, BindigSalesUnitPriceSkipTax);

            Binding BindigSalesUnitPriceBeforeTax = new Binding("_sales_unit_price_before_tax");
            BindigSalesUnitPriceBeforeTax.Mode = BindingMode.TwoWay;
            BindigSalesUnitPriceBeforeTax.Source = _entity;
            this.txtSalesUnitBeforeTax.SetBinding(TextBox.TextProperty, BindigSalesUnitPriceBeforeTax);

            Binding BindigSalesCostPriceSkipTax = new Binding("_sales_cost_price_skip_tax");
            BindigSalesCostPriceSkipTax.Mode = BindingMode.TwoWay;
            BindigSalesCostPriceSkipTax.Source = _entity;
            this.txtSalesCostSkipTax.SetBinding(TextBox.TextProperty, BindigSalesCostPriceSkipTax);

            Binding BindigSalesCostPriceBeforeTax = new Binding("_sales_cost_price_before_tax");
            BindigSalesCostPriceBeforeTax.Mode = BindingMode.TwoWay;
            BindigSalesCostPriceBeforeTax.Source = _entity;
            this.txtSalesCostBeforeTax.SetBinding(TextBox.TextProperty, BindigSalesCostPriceBeforeTax);

            Binding BindigPPurcharseUnitPriceSkipTax = new Binding("_purchase_unit_price_skip_tax");
            BindigPPurcharseUnitPriceSkipTax.Mode = BindingMode.TwoWay;
            BindigPPurcharseUnitPriceSkipTax.Source = _entity;
            this.txtPurchaseUnitSkipTax.SetBinding(TextBox.TextProperty, BindigPPurcharseUnitPriceSkipTax);

            Binding BindigPPurcharseUnitPriceBeforeTax = new Binding("_purchase_unit_price_before_tax");
            BindigPPurcharseUnitPriceBeforeTax.Mode = BindingMode.TwoWay;
            BindigPPurcharseUnitPriceBeforeTax.Source = _entity;
            this.txtPurchaseUnitBeforeTax.SetBinding(TextBox.TextProperty, BindigPPurcharseUnitPriceBeforeTax);

            Binding BindigGroup1Id = new Binding("_group1_id");
            BindigGroup1Id.Mode = BindingMode.TwoWay;
            BindigGroup1Id.Source = _entity;
            this.utlGroup1.txtID.SetBinding(TextBox.TextProperty, BindigGroup1Id);

            Binding BindigGroup1Name = new Binding("_group1_nm");
            BindigGroup1Name.Mode = BindingMode.TwoWay;
            BindigGroup1Name.Source = _entity;
            this.utlGroup1.txtNm.SetBinding(TextBox.TextProperty, BindigGroup1Name);

            Binding BindigDiaplayDivisionId = new Binding("_display_division_id");
            BindigDiaplayDivisionId.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId);

            Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm");
            BindigDiaplayDivisionNm.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm);

            Binding BindigMemo = new Binding("_memo");
            BindigMemo.Mode = BindingMode.TwoWay;
            BindigMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo);

            #endregion
            
            this.utlID.txtID.SetZeroToNullString();
            this.utlUnit.txtID.SetZeroToNullString();
            this.utlTaxationDivisionID.txtID.SetZeroToNullString();
            this.utlInventoryDivisionId.txtID.SetZeroToNullString();
            this.utlGroup1.txtID.SetZeroToNullString();

            this.utlMainPurchaseId.txtID.FormatToID();
            this.txtEnterNumver.OnFormatString();
            this.txtPurchaseLot.OnFormatString();
            this.txtJustInventoryNumber.OnFormatString();
            this.txtInventoryNumber.OnFormatString();
            this.txtRetailPriceSkipTax.OnFormatString();
            this.txtRetailPriceBeforeTax.OnFormatString();
            this.txtSalesUnitSkipTax.OnFormatString();
            this.txtSalesUnitBeforeTax.OnFormatString();
            this.txtSalesCostSkipTax.OnFormatString();
            this.txtSalesCostBeforeTax.OnFormatString();
            this.txtPurchaseUnitSkipTax.OnFormatString();
            this.txtPurchaseUnitBeforeTax.OnFormatString();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._unit_id = 1;                               // 単位 1:個
                _entity._enter_number = 1;                          // 入数
                _entity._taxation_divition_id = 1;                  // 課税区分 1:課税
                _entity._inventory_management_division_id = 1;      // 在庫管理区分 1:在庫管理する
                _entity._display_division_id = 1;
            }
        }
        private void SetBinding()
        {
            if (_entityH == null)
            {
                _entityH = new EntityPurchaseH();
            }

            if (_entityListD == null)
            {
                _entityListD = new ObservableCollection<EntityPurchaseD>();
            }

            // マスタコントロールPropertyChanged
            _entityH.PropertyChanged += this.utlPurchase.MstID_Changed;
            _entityH.PropertyChanged += this.utlCustomer.MstID_Changed;
            _entityH.PropertyChanged += this.utlSupplier.MstID_Changed;
            _entityH.PropertyChanged += this.utlPerson.MstID_Changed;
            _entityH.PropertyChanged += this._PropertyChanged;
            this.utlPurchase.ParentData = _entityH;
            this.utlCustomer.ParentData = _entityH;
            this.utlSupplier.ParentData = _entityH;
            this.utlPerson.ParentData = _entityH;

            NumberConverter nmConvDecm0 = new NumberConverter();
            NumberConverter nmConvDecm2 = new NumberConverter();
            nmConvDecm2.DecimalPlaces = 2;

            #region Bind

            // バインド
            Binding BindingPurchaseOrderNo = new Binding("_purchase_order_no");
            BindingPurchaseOrderNo.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderNo.Source = _entityH;
            this.utlPurchaseOrderNo.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseOrderNo);

            Binding BindingPurchaseYmd = new Binding("_purchase_ymd");
            BindingPurchaseYmd.Mode = BindingMode.TwoWay;
            BindingPurchaseYmd.Source = _entityH;
            this.datPurchaseYmd.SetBinding(DatePicker.SelectedDateProperty, BindingPurchaseYmd);

            if (string.IsNullOrEmpty(_entityH._purchase_ymd))
            {
                _entityH._purchase_ymd = DateTime.Now.ToString("yyyy/MM/dd");
            }
            
            Binding BindingInpPersonID = new Binding("_update_person_id");
            BindingInpPersonID.Mode = BindingMode.TwoWay;
            BindingInpPersonID.Source = _entityH;
            this.utlPerson.txtID.SetBinding(TextBox.TextProperty, BindingInpPersonID);

            Binding BindingInpPersonName = new Binding("_update_person_nm");
            BindingInpPersonName.Mode = BindingMode.TwoWay;
            BindingInpPersonName.Source = _entityH;
            this.utlPerson.txtNm.SetBinding(TextBox.TextProperty, BindingInpPersonName);

            if (_entityH._update_person_id == 0)
            {
                // デフォルト担当の設定
                this.utlPerson.txtID.Text = Common.gintDefaultPersonId.ToString();
                _entityH._update_person_id = Common.gintDefaultPersonId;
                this.utlPerson.MstID_Changed(null, new PropertyChangedEventArgs("_update_person_id"));
            }

            Binding BindingPurchaseId = new Binding("_purchase_id");
            BindingPurchaseId.Mode = BindingMode.TwoWay;
            BindingPurchaseId.Source = _entityH;
            this.utlPurchase.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseId);

            Binding BindingPurchaseName = new Binding("_purchase_name");
            BindingPurchaseName.Mode = BindingMode.TwoWay;
            BindingPurchaseName.Source = _entityH;
            this.utlPurchase.txtNm.SetBinding(TextBox.TextProperty, BindingPurchaseName);

            Binding BindingPaymentNo = new Binding("_payment_no");
            BindingPaymentNo.Mode = BindingMode.TwoWay;
            BindingPaymentNo.Source = _entityH;
            this.txtPaymentNo.SetBinding(TextBox.TextProperty, BindingPaymentNo);

            Binding BindingPaymentState = new Binding("_payment_state");
            BindingPaymentState.Mode = BindingMode.TwoWay;
            BindingPaymentState.Source = _entityH;
            this.txtPaymentState.SetBinding(TextBox.TextProperty, BindingPaymentState);

            Binding BindingPaymentCashtState = new Binding("_payment_cash_receivable_kbn");
            BindingPaymentCashtState.Mode = BindingMode.TwoWay;
            BindingPaymentCashtState.Source = _entityH;
            this.txtPaymentCashState.SetBinding(TextBox.TextProperty, BindingPaymentCashtState);

            Binding BindingSendId = new Binding("_send_kbn_id");
            BindingSendId.Mode = BindingMode.TwoWay;
            BindingSendId.Source = _entityH;
            this.utlSendKbn.txtID.SetBinding(TextBox.TextProperty, BindingSendId);

            Binding BindingSendName = new Binding("_send_kbn_nm");
            BindingSendName.Mode = BindingMode.TwoWay;
            BindingSendName.Source = _entityH;
            this.utlSendKbn.txtNm.SetBinding(TextBox.TextProperty, BindingSendName);

            if (_entityH._send_kbn_id == 0)
            {
                _entityH._send_kbn_id = 1;
            }

            Binding BindingCustomeNo = new Binding("_customer_id");
            BindingCustomeNo.Mode = BindingMode.TwoWay;
            BindingCustomeNo.Source = _entityH;
            this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomeNo);

            Binding BindingCustomeName = new Binding("_customer_name");
            BindingCustomeName.Mode = BindingMode.TwoWay;
            BindingCustomeName.Source = _entityH;
            this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomeName);

            Binding BindingSupplyNo = new Binding("_supplier_id");
            BindingSupplyNo.Mode = BindingMode.TwoWay;
            BindingSupplyNo.Source = _entityH;
            this.utlSupplier.txtID.SetBinding(TextBox.TextProperty, BindingSupplyNo);
            this.utlSupplier.txtID2.SetBinding(TextBox.TextProperty, BindingCustomeNo);

            Binding BindingSupplyName = new Binding("_supplier_name");
            BindingSupplyName.Mode = BindingMode.TwoWay;
            BindingSupplyName.Source = _entityH;
            this.utlSupplier.txtNm.SetBinding(TextBox.TextProperty, BindingSupplyName);

            Binding BindingTax = new Binding("_tax_change_id");
            BindingTax.Mode = BindingMode.TwoWay;
            BindingTax.Source = _entityH;
            this.utlTax.txtID.SetBinding(TextBox.TextProperty, BindingTax);

            Binding BindingTaxName = new Binding("_tax_change_name");
            BindingTaxName.Mode = BindingMode.TwoWay;
            BindingTaxName.Source = _entityH;
            this.utlTax.txtNm.SetBinding(TextBox.TextProperty, BindingTaxName);

            Binding BindingBusiness = new Binding("_business_division_id");
            BindingBusiness.Mode = BindingMode.TwoWay;
            BindingBusiness.Source = _entityH;
            this.utlBusiness.txtID.SetBinding(TextBox.TextProperty, BindingBusiness);

            Binding BindingBusinessName = new Binding("_business_division_name");
            BindingBusinessName.Mode = BindingMode.TwoWay;
            BindingBusinessName.Source = _entityH;
            this.utlBusiness.txtNm.SetBinding(TextBox.TextProperty, BindingBusinessName);

            Binding BindingUnitKindId = new Binding("_unit_kind_id");
            BindingUnitKindId.Mode = BindingMode.TwoWay;
            BindingUnitKindId.Source = _entityH;
            this.utlUnitKind.txtID.SetBinding(TextBox.TextProperty, BindingUnitKindId);

            Binding BindingCreditRate = new Binding("_credit_rate");
            BindingCreditRate.Mode = BindingMode.TwoWay;
            BindingCreditRate.Source = _entityH;
            this.txtCreditRate.SetBinding(TextBox.TextProperty, BindingCreditRate);

            Binding BindingNokiYmd = new Binding("_supply_ymd");
            BindingNokiYmd.Mode = BindingMode.TwoWay;
            BindingNokiYmd.Source = _entityH;
            this.datNokiYmd.SetBinding(DatePicker.SelectedDateProperty, BindingNokiYmd);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entityH;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            // 入数計
            Binding BindingEnterNumber = new Binding("_sum_enter_number");
            BindingEnterNumber.Mode = BindingMode.TwoWay;
            BindingEnterNumber.Source = _entityH;
            BindingEnterNumber.Converter = nmConvDecm0;
            this.txtEnterNumber.SetBinding(TextBox.TextProperty, BindingEnterNumber);
            
            // ケース数計
            Binding BindingCaseNumber = new Binding("_sum_case_number");
            BindingCaseNumber.Mode = BindingMode.TwoWay;
            BindingCaseNumber.Source = _entityH;
            BindingCaseNumber.Converter = nmConvDecm0;
            this.txtCaseNumber.SetBinding(TextBox.TextProperty, BindingCaseNumber);
            
            // 数量計
            Binding BindingNumber = new Binding("_sum_number");
            BindingNumber.Mode = BindingMode.TwoWay;
            BindingNumber.Source = _entityH;
            BindingNumber.Converter = nmConvDecm2;
            this.txtNumber.SetBinding(TextBox.TextProperty, BindingNumber);
            
            // 単価計
            Binding BindingUnitPrice = new Binding("_sum_unit_price");
            BindingUnitPrice.Mode = BindingMode.TwoWay;
            BindingUnitPrice.Source = _entityH;
            BindingUnitPrice.Converter = nmConvDecm2;
            this.txtUnitPrice.SetBinding(TextBox.TextProperty, BindingUnitPrice);
            
            // 消費税額計
            Binding BindingSumTax = new Binding("_sum_tax");
            BindingSumTax.Mode = BindingMode.TwoWay;
            BindingSumTax.Source = _entityH;
            BindingSumTax.Converter = nmConvDecm0;
            this.txtTax.SetBinding(TextBox.TextProperty, BindingSumTax);
            
            // 税抜金額計
            Binding BindingTaxNoPrice = new Binding("_sum_no_tax_price");
            BindingTaxNoPrice.Mode = BindingMode.TwoWay;
            BindingTaxNoPrice.Source = _entityH;
            BindingTaxNoPrice.Converter = nmConvDecm0;
            this.txtTaxNoPrice.SetBinding(TextBox.TextProperty, BindingTaxNoPrice);

            // 税込金額計
            this.txtSumPrice.Text = ExCast.zCStr(ExCast.zCDbl(_entityH._sum_no_tax_price) + ExCast.zCDbl(_entityH._sum_tax));
            this.txtSumPrice.OnFormatString();

            // 金額計
            Binding BindingPrice = new Binding("_sum_price");
            BindingPrice.Mode = BindingMode.TwoWay;
            BindingPrice.Source = _entityH;
            BindingPrice.Converter = nmConvDecm0;
            this.txtPrice.SetBinding(TextBox.TextProperty, BindingPrice);
            
            // 買掛残高
            Binding BindingPaymentCreditPrice = new Binding("_payment_credit_price");
            BindingPaymentCreditPrice.Mode = BindingMode.TwoWay;
            BindingPaymentCreditPrice.Source = _entityH;
            BindingPaymentCreditPrice.Converter = nmConvDecm0;
            this.txtPaymentLimitPrice.SetBinding(TextBox.TextProperty, BindingPaymentCreditPrice);

            #endregion

            this.utlPurchaseOrderNo.txtID.OnFormatString();
            this.utlPurchaseOrderNo.txtID.SetZeroToNullString();
            this.utlPurchase.txtID.SetZeroToNullString();
            this.utlCustomer.txtID.SetZeroToNullString();
            this.utlSupplier.txtID.SetZeroToNullString();
            this.utlPerson.txtID.SetZeroToNullString();
            this.utlTax.txtID.SetZeroToNullString();
            this.utlBusiness.txtID.SetZeroToNullString();

            this.txtPaymentNo.Text = ExCast.zFormatForID(this.txtPaymentNo.Text, Common.gintidFigureSlipNo);
            this.txtPaymentLimitPrice.OnFormatString();
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityReportSetting();
            }

            _entity.PropertyChanged += this.utlCompanyGroup_F.MstID_Changed;
            _entity.PropertyChanged += this.utlCompanyGroup_T.MstID_Changed;

            // マスタコントロールPropertyChanged
            //_entity.PropertyChanged += this.utlInvoice.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            nmConvDecm0.IsMaxMinCheck = true;
            nmConvDecm0.MaxNumber = 350;
            nmConvDecm0.MinNumber = -350;

            NumberConverter nmConvDecm2 = new NumberConverter();
            nmConvDecm2.FormatString = "000";

            #region Bind

            switch (_entity._size)
            {
                case 0:      // デフォルト
                    this.cmbReportSize.SelectedIndex = 0;
                    break;
                case 1:      // A3
                    this.cmbReportSize.SelectedIndex = 1;
                    break;
                case 2:      // A4
                    this.cmbReportSize.SelectedIndex = 2;
                    break;
                case 3:      // A5
                    this.cmbReportSize.SelectedIndex = 3;
                    break;
                default:
                    this.cmbReportSize.SelectedIndex = 0;
                    break;
            }

            switch (_entity._orientation)
            {
                case 0:      // 指定無し
                    this.rdoVertical.IsChecked = false;
                    this.rdoHorizontal.IsChecked = false;
                    this.rdoOriDefault.IsChecked = true;
                    break;
                case 1:      // 縦
                    this.rdoVertical.IsChecked = true;
                    this.rdoHorizontal.IsChecked = false;
                    this.rdoOriDefault.IsChecked = false;
                    break;
                case 2:      // 横
                    this.rdoVertical.IsChecked = false;
                    this.rdoHorizontal.IsChecked = true;
                    this.rdoOriDefault.IsChecked = false;
                    break;
                default:
                    this.rdoVertical.IsChecked = false;
                    this.rdoHorizontal.IsChecked = false;
                    this.rdoOriDefault.IsChecked = true;
                    break;
            }

            switch (_entity._group_total)
            {
                case 0:      // 無し
                    this.rdoGroupTotalKbnNasi.IsChecked = true;
                    this.rdoGroupTotalKbnAri.IsChecked = false;
                    break;
                case 1:      // 有り
                    this.rdoGroupTotalKbnNasi.IsChecked = false;
                    this.rdoGroupTotalKbnAri.IsChecked = true;
                    break;
                default:
                    this.rdoGroupTotalKbnNasi.IsChecked = true;
                    this.rdoGroupTotalKbnAri.IsChecked = false;
                    break;
            }

            switch (_entity._total_kbn)
            {
                case 0:      // 無し
                    this.cmbTotalKbn.SelectedIndex = 0;
                    break;
                case 1:      // 得意先別
                    this.cmbTotalKbn.SelectedIndex = 1;
                    break;
                case 2:      // 商品別
                    this.cmbTotalKbn.SelectedIndex = 2;
                    break;
                case 3:      // 担当別
                    this.cmbTotalKbn.SelectedIndex = 3;
                    break;
                default:
                    this.cmbTotalKbn.SelectedIndex = 0;
                    break;
            }

            // バインド
            Binding BindingLeftMargin = new Binding("_left_margin");
            BindingLeftMargin.Mode = BindingMode.TwoWay;
            BindingLeftMargin.Converter = nmConvDecm0;
            BindingLeftMargin.Source = _entity;
            this.txtLeftMargin.SetBinding(TextBox.TextProperty, BindingLeftMargin);

            Binding BindingRightMargin = new Binding("_right_margin");
            BindingRightMargin.Mode = BindingMode.TwoWay;
            BindingRightMargin.Converter = nmConvDecm0;
            BindingRightMargin.Source = _entity;
            this.txtRightMargin.SetBinding(TextBox.TextProperty, BindingRightMargin);

            Binding BindingTopMargin = new Binding("_top_margin");
            BindingTopMargin.Mode = BindingMode.TwoWay;
            BindingTopMargin.Converter = nmConvDecm0;
            BindingTopMargin.Source = _entity;
            this.txtTopMargin.SetBinding(TextBox.TextProperty, BindingTopMargin);

            Binding BindingBottomMargin = new Binding("_bottom_margin");
            BindingBottomMargin.Mode = BindingMode.TwoWay;
            BindingBottomMargin.Converter = nmConvDecm0;
            BindingBottomMargin.Source = _entity;
            this.txtButtomMargin.SetBinding(TextBox.TextProperty, BindingBottomMargin);

            if (DataAuthority.IsReportTotal())
            {
                Binding BindingGroupIdFrom = new Binding("_group_id_from");
                BindingGroupIdFrom.Mode = BindingMode.TwoWay;
                //BindingGroupIdFrom.Converter = nmConvDecm2;
                BindingGroupIdFrom.Source = _entity;
                this.utlCompanyGroup_F.txtID.SetBinding(TextBox.TextProperty, BindingGroupIdFrom);

                Binding BindingGroupNmFrom = new Binding("_group_nm_from");
                BindingGroupNmFrom.Mode = BindingMode.TwoWay;
                BindingGroupNmFrom.Source = _entity;
                this.utlCompanyGroup_F.txtNm.SetBinding(TextBox.TextProperty, BindingGroupNmFrom);

                Binding BindingGroupIdTo = new Binding("_group_id_to");
                BindingGroupIdTo.Mode = BindingMode.TwoWay;
                //BindingGroupIdTo.Converter = nmConvDecm2;
                BindingGroupIdTo.Source = _entity;
                this.utlCompanyGroup_T.txtID.SetBinding(TextBox.TextProperty, BindingGroupIdTo);

                Binding BindingGroupNmTo = new Binding("_group_nm_to");
                BindingGroupNmTo.Mode = BindingMode.TwoWay;
                BindingGroupNmTo.Source = _entity;
                this.utlCompanyGroup_T.txtNm.SetBinding(TextBox.TextProperty, BindingGroupNmTo);

                if (ExCast.zCInt(_entity._group_id_from) == 0 && ExCast.zCInt(_entity._group_id_to) == 0)
                {
                    this.utlCompanyGroup_F.txtID.Text = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_id_from = string.Format("{0:000}", Common.gintGroupId);

                    //_entity._group_nm_from = Common.gstrGroupNm;
                    //this.utlCompanyGroup_F.txtID.Text = Common.gintGroupId.ToString();

                    this.utlCompanyGroup_T.txtID.Text = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_id_to = string.Format("{0:000}", Common.gintGroupId);
                    //_entity._group_nm_to = Common.gstrGroupNm;
                    //this.utlCompanyGroup_T.txtID.Text = Common.gintGroupId.ToString();

                    this.utlCompanyGroup_F.MstID_Changed(null, new PropertyChangedEventArgs("_group_id_from"));
                    this.utlCompanyGroup_T.MstID_Changed(null, new PropertyChangedEventArgs("_group_id_to"));
                }
            }
            
            #endregion

            this.txtLeftMargin.OnFormatString();
            this.txtRightMargin.OnFormatString();
            this.txtTopMargin.OnFormatString();
            this.txtButtomMargin.OnFormatString();

            //this.utlCompanyGroup_F.txtID.OnFormatString();
            //this.utlCompanyGroup_T.txtID.OnFormatString();
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityCompany();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlZip.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();
            nmConvDecm0.IsMaxMinCheck = true;
            nmConvDecm0.MinNumber = 4;
            nmConvDecm0.MaxNumber = 15;

            #region Bind

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindingZipCodeFrom = new Binding("_zip_code_from");
            BindingZipCodeFrom.Mode = BindingMode.TwoWay;
            BindingZipCodeFrom.Source = _entity;
            this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom);

            Binding BindingZipCodeTo = new Binding("_zip_code_to");
            BindingZipCodeTo.Mode = BindingMode.TwoWay;
            BindingZipCodeTo.Source = _entity;
            this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo);

            this.utlZip.is_zip_from_first_flg = true;
            this.utlZip.is_zip_to_first_flg = true;

            Binding BindingAdress1 = new Binding("_adress1");
            BindingAdress1.Mode = BindingMode.TwoWay;
            BindingAdress1.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1);

            Binding BindingAdress2 = new Binding("_adress2");
            BindingAdress2.Mode = BindingMode.TwoWay;
            BindingAdress2.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2);

            Binding BindingTel = new Binding("_tel");
            BindingTel.Mode = BindingMode.TwoWay;
            BindingTel.Source = _entity;
            this.txtTel.SetBinding(TextBox.TextProperty, BindingTel);

            Binding BindingFax = new Binding("_fax");
            BindingFax.Mode = BindingMode.TwoWay;
            BindingFax.Source = _entity;
            this.txtFax.SetBinding(TextBox.TextProperty, BindingFax);

            Binding BindingMailAdress = new Binding("_mail_adress");
            BindingMailAdress.Mode = BindingMode.TwoWay;
            BindingMailAdress.Source = _entity;
            this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress);

            Binding BindingGroupDisplayNm = new Binding("_group_display_name");
            BindingGroupDisplayNm.Mode = BindingMode.TwoWay;
            BindingGroupDisplayNm.Source = _entity;
            this.txtGroupDisplayNm.SetBinding(TextBox.TextProperty, BindingGroupDisplayNm);

            Binding BindingIdFigureSlipNo = new Binding("_id_figure_slip_no");
            BindingIdFigureSlipNo.Converter = nmConvDecm0;
            BindingIdFigureSlipNo.Mode = BindingMode.TwoWay;
            BindingIdFigureSlipNo.Source = _entity;
            this.txtDenNoFg.SetBinding(TextBox.TextProperty, BindingIdFigureSlipNo);

            Binding BindingIdFigureCustomer = new Binding("_id_figure_customer");
            BindingIdFigureCustomer.Converter = nmConvDecm0;
            BindingIdFigureCustomer.Mode = BindingMode.TwoWay;
            BindingIdFigureCustomer.Source = _entity;
            this.txtCustomerIdFg.SetBinding(TextBox.TextProperty, BindingIdFigureCustomer);

            Binding BindingIdFigurePurchase = new Binding("_id_figure_purchase");
            BindingIdFigurePurchase.Converter = nmConvDecm0;
            BindingIdFigurePurchase.Mode = BindingMode.TwoWay;
            BindingIdFigurePurchase.Source = _entity;
            this.txtPurchaseIdFg.SetBinding(TextBox.TextProperty, BindingIdFigurePurchase);

            Binding BindingIdFigureCommodity = new Binding("_id_figure_commodity");
            BindingIdFigureCommodity.Converter = nmConvDecm0;
            BindingIdFigureCommodity.Mode = BindingMode.TwoWay;
            BindingIdFigureCommodity.Source = _entity;
            this.txtCommdityIdFg.SetBinding(TextBox.TextProperty, BindingIdFigureCommodity);

            Binding BindingEstimateYmd = new Binding("_estimate_ymd");
            BindingEstimateYmd.Mode = BindingMode.TwoWay;
            BindingEstimateYmd.Source = _entity;
            this.txtEstimateYmd.SetBinding(TextBox.TextProperty, BindingEstimateYmd);

            Binding BindingOrderYmd = new Binding("_order_ymd");
            BindingOrderYmd.Mode = BindingMode.TwoWay;
            BindingOrderYmd.Source = _entity;
            this.txtOrderYmd.SetBinding(TextBox.TextProperty, BindingOrderYmd);

            Binding BindingSalesYmd = new Binding("_sales_ymd");
            BindingSalesYmd.Mode = BindingMode.TwoWay;
            BindingSalesYmd.Source = _entity;
            this.txtSalesYmd.SetBinding(TextBox.TextProperty, BindingSalesYmd);

            Binding BindingReceiptYmd = new Binding("_receipt_ymd");
            BindingReceiptYmd.Mode = BindingMode.TwoWay;
            BindingReceiptYmd.Source = _entity;
            this.txtReceiptYmd.SetBinding(TextBox.TextProperty, BindingReceiptYmd);

            Binding BindingPurchaseOrderYmd = new Binding("_purchase_order_ymd");
            BindingPurchaseOrderYmd.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderYmd.Source = _entity;
            this.txtPurchaseOrderYmd.SetBinding(TextBox.TextProperty, BindingPurchaseOrderYmd);

            Binding BindingPurchaseYmd = new Binding("_purchase_ymd");
            BindingPurchaseYmd.Mode = BindingMode.TwoWay;
            BindingPurchaseYmd.Source = _entity;
            this.txtPurchaseYmd.SetBinding(TextBox.TextProperty, BindingPurchaseYmd);

            Binding BindingCashPaymentYmd = new Binding("_cash_payment_ymd");
            BindingCashPaymentYmd.Mode = BindingMode.TwoWay;
            BindingCashPaymentYmd.Source = _entity;
            this.txtCashPaymentYmd.SetBinding(TextBox.TextProperty, BindingCashPaymentYmd);

            Binding BindingProduceYmd = new Binding("_produce_ymd");
            BindingProduceYmd.Mode = BindingMode.TwoWay;
            BindingProduceYmd.Source = _entity;
            this.txtProduceYmd.SetBinding(TextBox.TextProperty, BindingProduceYmd);

            Binding BindingShipYmd = new Binding("_ship_ymd");
            BindingShipYmd.Mode = BindingMode.TwoWay;
            BindingShipYmd.Source = _entity;
            this.txtShipYmd.SetBinding(TextBox.TextProperty, BindingShipYmd);

            Binding BindingEstimateCnt = new Binding("_estimate_cnt");
            BindingEstimateCnt.Mode = BindingMode.TwoWay;
            BindingEstimateCnt.Source = _entity;
            this.txtEstimateCnt.SetBinding(TextBox.TextProperty, BindingEstimateCnt);

            Binding BindingOrderCnt = new Binding("_order_cnt");
            BindingOrderCnt.Mode = BindingMode.TwoWay;
            BindingOrderCnt.Source = _entity;
            this.txtOrderCnt.SetBinding(TextBox.TextProperty, BindingOrderCnt);

            Binding BindingSalesCnt = new Binding("_sales_cnt");
            BindingSalesCnt.Mode = BindingMode.TwoWay;
            BindingSalesCnt.Source = _entity;
            this.txtSalesCnt.SetBinding(TextBox.TextProperty, BindingSalesCnt);

            Binding BindingReceiptCnt = new Binding("_receipt_cnt");
            BindingReceiptCnt.Mode = BindingMode.TwoWay;
            BindingReceiptCnt.Source = _entity;
            this.txtReceiptCnt.SetBinding(TextBox.TextProperty, BindingReceiptCnt);

            Binding BindingPurchaseOrderCnt = new Binding("_purchase_order_cnt");
            BindingPurchaseOrderCnt.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderCnt.Source = _entity;
            this.txtPurchaseOrderCnt.SetBinding(TextBox.TextProperty, BindingPurchaseOrderCnt);

            Binding BindingPurchaseCnt = new Binding("_purchase_cnt");
            BindingPurchaseCnt.Mode = BindingMode.TwoWay;
            BindingPurchaseCnt.Source = _entity;
            this.txtPurchaseCnt.SetBinding(TextBox.TextProperty, BindingPurchaseCnt);

            Binding BindingCashPaymentCnt = new Binding("_cash_payment_cnt");
            BindingCashPaymentCnt.Mode = BindingMode.TwoWay;
            BindingCashPaymentCnt.Source = _entity;
            this.txtCashPaymentCnt.SetBinding(TextBox.TextProperty, BindingCashPaymentCnt);

            Binding BindingProduceCnt = new Binding("_produce_cnt");
            BindingProduceCnt.Mode = BindingMode.TwoWay;
            BindingProduceCnt.Source = _entity;
            this.txtProduceCnt.SetBinding(TextBox.TextProperty, BindingProduceCnt);

            Binding BindingShipCnt = new Binding("_ship_cnt");
            BindingShipCnt.Mode = BindingMode.TwoWay;
            BindingShipCnt.Source = _entity;
            this.txtShipCnt.SetBinding(TextBox.TextProperty, BindingShipCnt);

            #endregion

            this.txtEstimateCnt.OnFormatString();
            this.txtOrderCnt.OnFormatString();
            this.txtSalesCnt.OnFormatString();
            this.txtReceiptCnt.OnFormatString();
            this.txtPurchaseOrderCnt.OnFormatString();
            this.txtPurchaseCnt.OnFormatString();
            this.txtCashPaymentCnt.OnFormatString();
            this.txtProduceCnt.OnFormatString();
            this.txtShipCnt.OnFormatString();
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityCompanyGroup();
                _entity._estimate_approval_flg = 1;
                _entity._invoice_print_flg = 1;
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlZip.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            #region Bind

            #region グループ情報

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindingZipCodeFrom = new Binding("_zip_code_from");
            BindingZipCodeFrom.Mode = BindingMode.TwoWay;
            BindingZipCodeFrom.Source = _entity;
            this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom);

            Binding BindingZipCodeTo = new Binding("_zip_code_to");
            BindingZipCodeTo.Mode = BindingMode.TwoWay;
            BindingZipCodeTo.Source = _entity;
            this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo);

            this.utlZip.is_zip_from_first_flg = true;
            this.utlZip.is_zip_to_first_flg = true;

            Binding BindingAdress1 = new Binding("_adress1");
            BindingAdress1.Mode = BindingMode.TwoWay;
            BindingAdress1.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1);

            Binding BindingAdress2 = new Binding("_adress2");
            BindingAdress2.Mode = BindingMode.TwoWay;
            BindingAdress2.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2);

            Binding BindingTel = new Binding("_tel");
            BindingTel.Mode = BindingMode.TwoWay;
            BindingTel.Source = _entity;
            this.txtTel.SetBinding(TextBox.TextProperty, BindingTel);

            Binding BindingFax = new Binding("_fax");
            BindingFax.Mode = BindingMode.TwoWay;
            BindingFax.Source = _entity;
            this.txtFax.SetBinding(TextBox.TextProperty, BindingFax);

            Binding BindingMailAdress = new Binding("_mail_adress");
            BindingMailAdress.Mode = BindingMode.TwoWay;
            BindingMailAdress.Source = _entity;
            this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress);

            Binding BindigDiaplayDivisionId = new Binding("_display_division_id");
            BindigDiaplayDivisionId.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId);

            Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm");
            BindigDiaplayDivisionNm.Mode = BindingMode.TwoWay;
            BindigDiaplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm);

            Binding BindigMemo = new Binding("_memo");
            BindigMemo.Mode = BindingMode.TwoWay;
            BindigMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo);

            #endregion

            #region グループ運用情報

            if (_entity._estimate_approval_flg == 0)
            {
                this.rdoApprovalAri.IsChecked = false;
                this.rdoApprovalNasi.IsChecked = true;
            }
            else
            {
                this.rdoApprovalAri.IsChecked = true;
                this.rdoApprovalNasi.IsChecked = false;
            }

            #endregion

            #region 入金口座情報

            Binding BindingBankName = new Binding("_bank_nm");
            BindingBankName.Mode = BindingMode.TwoWay;
            BindingBankName.Source = _entity;
            this.txtBankName.SetBinding(TextBox.TextProperty, BindingBankName);

            Binding BindingBankBranchName = new Binding("_bank_branch_nm");
            BindingBankBranchName.Mode = BindingMode.TwoWay;
            BindingBankBranchName.Source = _entity;
            this.txtBranchName.SetBinding(TextBox.TextProperty, BindingBankBranchName);

            Binding BindingBankAccountNo = new Binding("_bank_account_no");
            BindingBankAccountNo.Mode = BindingMode.TwoWay;
            BindingBankAccountNo.Source = _entity;
            this.txtAccountNo.SetBinding(TextBox.TextProperty, BindingBankAccountNo);

            Binding BindingBankAccountName = new Binding("_bank_account_nm");
            BindingBankAccountName.Mode = BindingMode.TwoWay;
            BindingBankAccountName.Source = _entity;
            this.txtAccountName.SetBinding(TextBox.TextProperty, BindingBankAccountName);

            Binding BindingBankAccountKana = new Binding("_bank_account_kana");
            BindingBankAccountKana.Mode = BindingMode.TwoWay;
            BindingBankAccountKana.Source = _entity;
            this.txtAccountKana.SetBinding(TextBox.TextProperty, BindingBankAccountKana);

            if (_entity._invoice_print_flg == 0)
            {
                this.rdoInvvoicePrintNasi.IsChecked = true;
                this.rdoInvvoicePrintAri.IsChecked = false;
            }
            else
            {
                this.rdoInvvoicePrintNasi.IsChecked = false;
                this.rdoInvvoicePrintAri.IsChecked = true;
            }

            #endregion

            #region 伝票情報

            Binding BindingEstimateYmd = new Binding("_estimate_ymd");
            BindingEstimateYmd.Mode = BindingMode.TwoWay;
            BindingEstimateYmd.Source = _entity;
            this.txtEstimateYmd.SetBinding(TextBox.TextProperty, BindingEstimateYmd);

            Binding BindingOrderYmd = new Binding("_order_ymd");
            BindingOrderYmd.Mode = BindingMode.TwoWay;
            BindingOrderYmd.Source = _entity;
            this.txtOrderYmd.SetBinding(TextBox.TextProperty, BindingOrderYmd);

            Binding BindingSalesYmd = new Binding("_sales_ymd");
            BindingSalesYmd.Mode = BindingMode.TwoWay;
            BindingSalesYmd.Source = _entity;
            this.txtSalesYmd.SetBinding(TextBox.TextProperty, BindingSalesYmd);

            Binding BindingReceiptYmd = new Binding("_receipt_ymd");
            BindingReceiptYmd.Mode = BindingMode.TwoWay;
            BindingReceiptYmd.Source = _entity;
            this.txtReceiptYmd.SetBinding(TextBox.TextProperty, BindingReceiptYmd);

            Binding BindingPurchaseOrderYmd = new Binding("_purchase_order_ymd");
            BindingPurchaseOrderYmd.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderYmd.Source = _entity;
            this.txtPurchaseOrderYmd.SetBinding(TextBox.TextProperty, BindingPurchaseOrderYmd);

            Binding BindingPurchaseYmd = new Binding("_purchase_ymd");
            BindingPurchaseYmd.Mode = BindingMode.TwoWay;
            BindingPurchaseYmd.Source = _entity;
            this.txtPurchaseYmd.SetBinding(TextBox.TextProperty, BindingPurchaseYmd);

            Binding BindingCashPaymentYmd = new Binding("_cash_payment_ymd");
            BindingCashPaymentYmd.Mode = BindingMode.TwoWay;
            BindingCashPaymentYmd.Source = _entity;
            this.txtCashPaymentYmd.SetBinding(TextBox.TextProperty, BindingCashPaymentYmd);

            Binding BindingProduceYmd = new Binding("_produce_ymd");
            BindingProduceYmd.Mode = BindingMode.TwoWay;
            BindingProduceYmd.Source = _entity;
            this.txtProduceYmd.SetBinding(TextBox.TextProperty, BindingProduceYmd);

            Binding BindingShipYmd = new Binding("_ship_ymd");
            BindingShipYmd.Mode = BindingMode.TwoWay;
            BindingShipYmd.Source = _entity;
            this.txtShipYmd.SetBinding(TextBox.TextProperty, BindingShipYmd);

            Binding BindingEstimateCnt = new Binding("_estimate_cnt");
            BindingEstimateCnt.Mode = BindingMode.TwoWay;
            BindingEstimateCnt.Source = _entity;
            this.txtEstimateCnt.SetBinding(TextBox.TextProperty, BindingEstimateCnt);

            Binding BindingOrderCnt = new Binding("_order_cnt");
            BindingOrderCnt.Mode = BindingMode.TwoWay;
            BindingOrderCnt.Source = _entity;
            this.txtOrderCnt.SetBinding(TextBox.TextProperty, BindingOrderCnt);

            Binding BindingSalesCnt = new Binding("_sales_cnt");
            BindingSalesCnt.Mode = BindingMode.TwoWay;
            BindingSalesCnt.Source = _entity;
            this.txtSalesCnt.SetBinding(TextBox.TextProperty, BindingSalesCnt);

            Binding BindingReceiptCnt = new Binding("_receipt_cnt");
            BindingReceiptCnt.Mode = BindingMode.TwoWay;
            BindingReceiptCnt.Source = _entity;
            this.txtReceiptCnt.SetBinding(TextBox.TextProperty, BindingReceiptCnt);

            Binding BindingPurchaseOrderCnt = new Binding("_purchase_order_cnt");
            BindingPurchaseOrderCnt.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderCnt.Source = _entity;
            this.txtPurchaseOrderCnt.SetBinding(TextBox.TextProperty, BindingPurchaseOrderCnt);

            Binding BindingPurchaseCnt = new Binding("_purchase_cnt");
            BindingPurchaseCnt.Mode = BindingMode.TwoWay;
            BindingPurchaseCnt.Source = _entity;
            this.txtPurchaseCnt.SetBinding(TextBox.TextProperty, BindingPurchaseCnt);

            Binding BindingCashPaymentCnt = new Binding("_cash_payment_cnt");
            BindingCashPaymentCnt.Mode = BindingMode.TwoWay;
            BindingCashPaymentCnt.Source = _entity;
            this.txtCashPaymentCnt.SetBinding(TextBox.TextProperty, BindingCashPaymentCnt);

            Binding BindingProduceCnt = new Binding("_produce_cnt");
            BindingProduceCnt.Mode = BindingMode.TwoWay;
            BindingProduceCnt.Source = _entity;
            this.txtProduceCnt.SetBinding(TextBox.TextProperty, BindingProduceCnt);

            Binding BindingShipCnt = new Binding("_ship_cnt");
            BindingShipCnt.Mode = BindingMode.TwoWay;
            BindingShipCnt.Source = _entity;
            this.txtShipCnt.SetBinding(TextBox.TextProperty, BindingShipCnt);

            Binding BindingEstimateNo = new Binding("_estimate_no");
            BindingEstimateNo.Mode = BindingMode.TwoWay;
            BindingEstimateNo.Source = _entity;
            this.utlEstimateNo.txtID.SetBinding(TextBox.TextProperty, BindingEstimateNo);

            Binding BindingOrderNo = new Binding("_order_no");
            BindingOrderNo.Mode = BindingMode.TwoWay;
            BindingOrderNo.Source = _entity;
            this.utlOrderNo.txtID.SetBinding(TextBox.TextProperty, BindingOrderNo);

            Binding BindingSalesNo = new Binding("_sales_no");
            BindingSalesNo.Mode = BindingMode.TwoWay;
            BindingSalesNo.Source = _entity;
            this.utlSalesNo.txtID.SetBinding(TextBox.TextProperty, BindingSalesNo);

            Binding BindingReceiptNo = new Binding("_receipt_no");
            BindingReceiptNo.Mode = BindingMode.TwoWay;
            BindingReceiptNo.Source = _entity;
            this.utlReceiptNo.txtID.SetBinding(TextBox.TextProperty, BindingReceiptNo);

            Binding BindingPurchaseOrderNo = new Binding("_purchase_order_no");
            BindingPurchaseOrderNo.Mode = BindingMode.TwoWay;
            BindingPurchaseOrderNo.Source = _entity;
            this.utlPurchaseOrderNo.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseOrderNo);

            Binding BindingPurchaseNo = new Binding("_purchase_no");
            BindingPurchaseNo.Mode = BindingMode.TwoWay;
            BindingPurchaseNo.Source = _entity;
            this.utlPurchaseNo.txtID.SetBinding(TextBox.TextProperty, BindingPurchaseNo);

            Binding BindingCashPaymentNo = new Binding("_cash_payment_no");
            BindingCashPaymentNo.Mode = BindingMode.TwoWay;
            BindingCashPaymentNo.Source = _entity;
            this.utlCashPaymentNo.txtID.SetBinding(TextBox.TextProperty, BindingCashPaymentNo);

            Binding BindingProduceNo = new Binding("_produce_no");
            BindingProduceNo.Mode = BindingMode.TwoWay;
            BindingProduceNo.Source = _entity;
            this.utlProduceNo.txtID.SetBinding(TextBox.TextProperty, BindingProduceNo);

            Binding BindingShipNo = new Binding("_ship_no");
            BindingShipNo.Mode = BindingMode.TwoWay;
            BindingShipNo.Source = _entity;
            this.utlShipNo.txtID.SetBinding(TextBox.TextProperty, BindingShipNo);

            #endregion

            #endregion

            this.utlID.txtID.SetZeroToNullString();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._display_division_id = 1;
            }

            this.txtEstimateCnt.OnFormatString();
            this.txtOrderCnt.OnFormatString();
            this.txtSalesCnt.OnFormatString();
            this.txtReceiptCnt.OnFormatString();
            this.txtPurchaseOrderCnt.OnFormatString();
            this.txtPurchaseCnt.OnFormatString();
            this.txtCashPaymentCnt.OnFormatString();
            this.txtProduceCnt.OnFormatString();
            this.txtShipCnt.OnFormatString();

            this.utlEstimateNo.txtID.OnFormatString();
            this.utlOrderNo.txtID.OnFormatString();
            this.utlSalesNo.txtID.OnFormatString();
            this.utlReceiptNo.txtID.OnFormatString();
            this.utlPurchaseOrderNo.txtID.OnFormatString();
            this.utlPurchaseNo.txtID.OnFormatString();
            this.utlCashPaymentNo.txtID.OnFormatString();
            this.utlProduceNo.txtID.OnFormatString();
            this.utlShipNo.txtID.OnFormatString();

            before_EstimateNo = _entity._estimate_no;
            before_OrderNo = _entity._order_no;
            before_SalesNo = _entity._sales_no;
            before_ReceiptNo = _entity._receipt_no;
            before_PurchaseOrderNo = _entity._purchase_order_no;
            before_PurchaseNo = _entity._purchase_no;
            before_CashPaymentNo = _entity._cash_payment_no;
            before_ProduceNo = _entity._produce_no;
            before_ShipNo = _entity._ship_no;
        }