예제 #1
0
        // For Estimate
        public static void SetCommodityToDetail(int i, EntityEstimateH entityH, ObservableCollection<EntityEstimateD> entityD, svcMstData.EntityMstData mst)
        {
            if (i == -1) return;

            svcMstData.EntityMstData _mst = mst;

            EntityBaseH entityBaseH = null;
            ObservableCollection<EntityBaseD> entityBaseD = null;

            ConvertFrom(entityH, ref entityBaseH, entityD, ref entityBaseD);

            _SetCommodityToDetail(i, ref entityBaseH, ref entityBaseD, _mst, eKbn.Sales);

            ConvertTo(entityBaseH, ref entityH, entityBaseD, ref entityD);

            // 明細計算
            CalcDetailNumber(i, entityH, entityD);
            CalcDetail(i, entityH, entityD);
        }
        // F2ボタン(クリア) クリック
        public override void btnF2_Click(object sender, RoutedEventArgs e)
        {
            this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Init;

            // 先頭選択
            this.dg.SelectedFirst();

            // ヘッダ初期化
            _entityH = null;
            SetBinding();
            utlState.tglStillApproval.IsChecked = false;

            // 明細初期化
            _entityListD = null;
            _entityListD = new ObservableCollection<EntityEstimateD>();

            // 明細追加
            Common.gblnDesynchronizeLock = false;
            this.btnF7_Click(null, null);

            this.dg.ItemsSource = _entityListD;

            this.utlNo.txtID_IsReadOnly = false;
            //this.utlNo.IsEnabled = true;
            this.utlNo.txtID.Text = "";
            ExBackgroundWorker.DoWork_Focus(this.utlNo.txtID, 10);

            // ロック解除
            DataPgLock.gLockPg(PG_NM, "", (int)DataPgLock.geLockType.UnLock);
        }
예제 #3
0
        // For Estimate
        public static void ReCalcDetail(EntityEstimateH entityH, ObservableCollection<EntityEstimateD> entityD)
        {
            for (int i = 0; i <= entityD.Count - 1; i++)
            {
                // 明細計算
                CalcDetail(i, entityH, entityD);
            }

            // 明細合計計算
            CalcSumDetail(entityH, entityD);
        }
예제 #4
0
        // For Estimate
        public static void CalcSumDetail(EntityEstimateH entityH, ObservableCollection<EntityEstimateD> entityD)
        {
            EntityBaseH entityBaseH = null;
            ObservableCollection<EntityBaseD> entityBaseD = null;
            ConvertFrom(entityH, ref entityBaseH, entityD, ref entityBaseD);

            _CalcSumDetail(ref entityBaseH, ref entityBaseD);

            ConvertTo(entityBaseH, ref entityH, entityBaseD, ref entityD);
        }
예제 #5
0
        // For Estimate
        public static void ConvertTo(EntityBaseH entityBaseH, ref EntityEstimateH entityH, ObservableCollection<EntityBaseD> entityBaseD, ref ObservableCollection<EntityEstimateD> entityD)
        {
            for (int i = 0; i <= entityD.Count - 1; i++)
            {
                #region Set Entity

                entityD[i]._id = entityBaseD[i].id;
                entityD[i]._rec_no = entityBaseD[i].rec_no;
                entityD[i]._breakdown_id = entityBaseD[i].breakdown_id;
                entityD[i]._breakdown_nm = entityBaseD[i].breakdown_nm;
                entityD[i]._deliver_division_id = entityBaseD[i].deliver_division_id;
                entityD[i]._deliver_division_nm = entityBaseD[i].deliver_division_nm;
                entityD[i]._commodity_id = entityBaseD[i].commodity_id;
                entityD[i]._commodity_name = entityBaseD[i].commodity_name;
                entityD[i]._unit_id = entityBaseD[i].unit_id;
                entityD[i]._unit_nm = entityBaseD[i].unit_nm;
                entityD[i]._enter_number = entityBaseD[i].enter_number;
                entityD[i]._case_number = entityBaseD[i].case_number;
                entityD[i]._number = entityBaseD[i].number;
                entityD[i]._unit_price = entityBaseD[i].unit_price;
                entityD[i]._sales_cost = entityBaseD[i].sales_cost;
                entityD[i]._tax = entityBaseD[i].tax;
                entityD[i]._no_tax_price = entityBaseD[i].no_tax_price;
                entityD[i]._price = entityBaseD[i].price;
                entityD[i]._profits = entityBaseD[i].profits;
                entityD[i]._profits_percent = entityBaseD[i].profits_percent;
                entityD[i]._tax_division_id = entityBaseD[i].tax_division_id;
                entityD[i]._tax_division_nm = entityBaseD[i].tax_division_nm;
                entityD[i]._tax_percent = entityBaseD[i].tax_percent;
                entityD[i]._inventory_management_division_id = entityBaseD[i].inventory_management_division_id;
                entityD[i]._inventory_number = entityBaseD[i].inventory_number;
                entityD[i]._retail_price_skip_tax = entityBaseD[i].retail_price_skip_tax;
                entityD[i]._retail_price_before_tax = entityBaseD[i].retail_price_before_tax;
                entityD[i]._sales_unit_price_skip_tax = entityBaseD[i].sales_unit_price_skip_tax;
                entityD[i]._sales_unit_price_before_tax = entityBaseD[i].sales_unit_price_before_tax;
                entityD[i]._sales_cost_price_skip_tax = entityBaseD[i].sales_cost_price_skip_tax;
                entityD[i]._sales_cost_price_before_tax = entityBaseD[i].sales_cost_price_before_tax;
                //entityD[i]._purchase_unit_price_skip_tax = entityBaseD[i].sales_cost_price_skip_tax;
                //entityD[i]._purchase_unit_price_before_tax = entityBaseD[i].sales_cost_price_before_tax;
                entityD[i]._number_decimal_digit = entityBaseD[i].number_decimal_digit;
                entityD[i]._unit_decimal_digit = entityBaseD[i].unit_decimal_digit;

                #endregion
            }

            #region Set Entity Head

            entityH._tax_change_id = entityBaseH.tax_change_id;
            entityH._business_division_id = entityBaseH.business_division_id;
            entityH._price_fraction_proc_id = entityBaseH.price_fraction_proc_id;
            entityH._tax_fraction_proc_id = entityBaseH.tax_fraction_proc_id;
            entityH._unit_kind_id = entityBaseH.unit_kind_id;
            entityH._sum_enter_number = entityBaseH.sum_enter_number;
            entityH._sum_case_number = entityBaseH.sum_case_number;
            entityH._sum_number = entityBaseH.sum_number;
            entityH._sum_unit_price = entityBaseH.sum_unit_price;
            entityH._sum_sales_cost = entityBaseH.sum_sales_cost;
            entityH._sum_tax = entityBaseH.sum_tax;
            entityH._sum_no_tax_price = entityBaseH.sum_no_tax_price;
            entityH._sum_price = entityBaseH.sum_price;
            entityH._sum_profits = entityBaseH.sum_profits;
            entityH._profits_percent = entityBaseH.profits_percent;
            entityH._credit_rate = entityBaseH.credit_rate;

            #endregion

        }
예제 #6
0
        // For Estimate
        public static void CalcDetailNumber(int i, EntityEstimateH entityH, ObservableCollection<EntityEstimateD> entityD)
        {
            EntityBaseH entityBaseH = null;
            ObservableCollection<EntityBaseD> entityBaseD = null;
            ConvertFrom(entityH, ref entityBaseH, entityD, ref entityBaseD);

            _CalcDetailNumber(i, ref entityBaseD);

            ConvertTo(entityBaseH, ref entityH, entityBaseD, ref entityD);

            // 明細計算
            CalcDetail(i, entityH, entityD);

            // 明細合計計算
            CalcSumDetail(entityH, entityD);
        }
        // ヘッダデータ取得
        private void GetHeadEstimate(long _No)
        {
            _entityEstimateH = null;
            _entityListEstimateD = null;

            object[] prm = new object[2];
            prm[0] = _No.ToString();
            prm[1] = _No.ToString();
            webService.objPerent = this;
            webService.CallWebService(ExWebService.geWebServiceCallKbn.GetEstimateListH,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.No,
                                      prm);
        }
        // データ取得コールバック呼出
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
                #region 受注

                // 受注ヘッダ
                case _GetHeadWebServiceCallKbn:
                    // 更新
                    if (objList != null)    
                    {
                        _entityH = (EntityOrderH)objList;

                        // エラー発生時
                        if (_entityH._message != "" && _entityH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlNo.txtID.Text = "";
                            return;
                        } 

                        // バインド反映
                        SetBinding();

                        // 明細データ取得
                        GetDetailData(_entityH._id);
                    }
                    // 新規
                    else
                    {
                        //// 明細追加
                        //this.btnF7_Click(null, null);

                        //this.dg.ItemsSource = _entityListD;
                        //webService.ProcessingDlgClose();
                        //this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        //this.utlNo.txtID_IsReadOnly = true;

                        webService.ProcessingDlgClose();
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        this.utlNo.txtID_IsReadOnly = false;
                    }
                    ExBackgroundWorker.DoWork_Focus(this.datOrderYmd, 10);
                    break;
                // 受注明細
                case _GetDetailWebServiceCallKbn:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListD = (ObservableCollection<EntityOrderD>)objList;
                    }
                    else 
                    {
                        _entityListD = null;
                    }

                    // 明細追加
                    this.btnF7_Click(null, null);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;

                    this.dg.ItemsSource = _entityListD;

                    if (_entityH._sales_allocation_flg == 1)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        this.utlMode.txtMode.Text = " 参照モード(売上計上済) ";
                        return;
                    }

                    if (_entityH._lock_flg == 0)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                    }

                    ExBackgroundWorker.DoWork_Focus(this.datOrderYmd, 10);
                    this.utlNo.txtID_IsReadOnly = true;
                    //this.utlNo.IsEnabled = false;

                    break;

                #endregion

                #region 見積

                // 見積ヘッダ
                case ExWebService.geWebServiceCallKbn.GetEstimateListH:
                    // 更新
                    if (objList != null)
                    {
                        _entityEstimateH = (EntityEstimateH)objList;

                        // エラー発生時
                        if (_entityEstimateH._message != "" && _entityEstimateH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        if (_entityEstimateH._order_allocation_flg == 1)
                        {
                            MessageBox.Show("受注計上済の為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }
                        else if (_entityEstimateH._sales_allocation_flg == 1)
                        {
                            MessageBox.Show("売上計上済の為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        if (Common.gintEstimateApprovalFlg == 1 && _entityEstimateH._state != 1)
                        {
                            MessageBox.Show("承認されていない為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        // 明細データ取得
                        GetDetailEstimate(_entityEstimateH._id);
                    }
                    // 新規
                    else
                    {
                        MessageBox.Show("見積番号:" + this.utlEstimateNo.txtID.Text + " は存在しません。");
                        webService.ProcessingDlgClose();
                        this.utlEstimateNo.txtID.Text = "";
                        ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                    }
                    break;
                // 見積明細
                case ExWebService.geWebServiceCallKbn.GetEstimateListD:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListEstimateD = (ObservableCollection<EntityEstimateD>)objList;
                    }
                    else
                    {
                        _entityListEstimateD = null;
                    }

                    // バインド反映
                    SetBinding();

                    ConverEstimateToOrder(this._entityH, this._entityListD, this._entityEstimateH, this._entityListEstimateD);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;

                    this.dg.ItemsSource = _entityListD;

                    ExBackgroundWorker.DoWork_Focus(this.datNokiYmd, 10);

                    this.utlEstimateNo.txtID.OnFormatString();
                    this.utlEstimateNo.txtID.UpdataFlg = false;

                    break;

                #endregion

                default:
                    break;
            }
        }
        // データ取得コールバック呼出
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
                #region 売上

                // 売上ヘッダ
                case _GetHeadWebServiceCallKbn:
                    // 更新
                    if (objList != null)
                    {
                        _entityH = (EntitySalesH)objList;

                        // エラー発生時
                        if (_entityH._message != "" && _entityH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlNo.txtID.Text = "";
                            return;
                        }

                        // バインド反映
                        SetBinding();

                        // 明細データ取得
                        GetDetailData(_entityH._id);
                    }
                    // 新規
                    else
                    {
                        //// 明細追加
                        //this.btnF7_Click(null, null);

                        //this.dg.ItemsSource = _entityListD;
                        webService.ProcessingDlgClose();
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        //this.utlNo.txtID_IsReadOnly = true;
                        //this.utlNo.IsEnabled = false;
                        this.utlNo.txtID_IsReadOnly = false;
                    }
                    ExBackgroundWorker.DoWork_Focus(this.utlPerson.txtID, 10);
                    break;
                // 売上明細
                case _GetDetailWebServiceCallKbn:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListD = (ObservableCollection<EntitySalesD>)objList;
                    }
                    else
                    {
                        _entityListD = null;
                    }

                    // 明細追加
                    this.btnF7_Click(null, null);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;

                    this.dg.ItemsSource = _entityListD;

                    // 前回情報保持
                    ConvertBeforeData(_entityH, _entityListD, _before_entityH, _before_entityListD);

                    if (_entityH._invoice_close_flg == 1)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        this.utlMode.txtMode.Text = " 参照モード(請求締切済) ";
                        return;
                    }

                    if (_entityH._receipt_receivable_kbn_nm == "消込未" || _entityH._receipt_receivable_kbn_nm == "")
                    {
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        this.utlMode.txtMode.Text = " 参照モード(" + _entityH._receipt_receivable_kbn_nm + ") ";
                        return;
                    }

                    if (_entityH._lock_flg == 0)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                        ConvertRedData(_entityH, _entityListD, _entityRedH, _entityListRedD);
                        _entityRedH._no = 0;
                        _entityRedH._id = 0;
                        _entityRedH._red_before_no = _entityH._no;
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                    }

                    // 売掛再計算
                    CalcSalesCredit();

                    ExBackgroundWorker.DoWork_Focus(this.utlPerson.txtID, 10);
                    this.utlNo.txtID_IsReadOnly = true;
                    //this.utlNo.IsEnabled = false;
                    break;

                #endregion

                #region 受注

                // 受注ヘッダ
                case ExWebService.geWebServiceCallKbn.GetOrderListH:
                    // 更新
                    if (objList != null)    
                    {
                        _entityOrderH = (EntityOrderH)objList;

                        // エラー発生時
                        if (_entityH._message != "" && _entityH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlOrderNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlOrderNo.txtID, 10);
                            return;
                        }

                        if (_entityOrderH._sales_allocation_flg == 1)
                        {
                            MessageBox.Show("売上計上済の為、受注番号:" + this.utlOrderNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlOrderNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlOrderNo.txtID, 10);
                            return;
                        }

                        // 明細データ取得
                        GetDetailOrder(_entityOrderH._id);
                    }
                    // 新規
                    else
                    {
                        MessageBox.Show("受注番号:" + this.utlOrderNo.txtID.Text + " は存在しません。");
                        webService.ProcessingDlgClose();
                        this.utlOrderNo.txtID.Text = "";
                        ExBackgroundWorker.DoWork_Focus(this.utlOrderNo.txtID, 10);
                    }
                    break;
                // 受注明細
                case ExWebService.geWebServiceCallKbn.GetOrderListD:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListOrderD = (ObservableCollection<EntityOrderD>)objList;
                    }
                    else 
                    {
                        _entityListOrderD = null;
                    }

                    // バインド反映
                    SetBinding();

                    ConverOrderToSales(this._entityH, this._entityListD, this._entityOrderH, this._entityListOrderD);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;


                    // 売掛再計算
                    CalcSalesCredit();

                    if (string.IsNullOrEmpty(_entityH._memo))
                    {
                        _entityH._memo = "受注No : " + ExCast.zFormatForID(_entityOrderH._no, Common.gintidFigureSlipNo);
                    }

                    this.dg.ItemsSource = _entityListD;
                    ExBackgroundWorker.DoWork_Focus(this.datNokiYmd, 10);

                    this.utlEstimateNo.txtID.OnFormatString();
                    this.utlOrderNo.txtID.OnFormatString();
                    this.utlEstimateNo.txtID.UpdataFlg = false;
                    this.utlOrderNo.txtID.UpdataFlg = false;

                    break;

                #endregion

                #region 見積

                // 見積ヘッダ
                case ExWebService.geWebServiceCallKbn.GetEstimateListH:
                    // 更新
                    if (objList != null)
                    {
                        _entityEstimateH = (EntityEstimateH)objList;

                        // エラー発生時
                        if (_entityEstimateH._message != "" && _entityEstimateH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        if (_entityEstimateH._order_allocation_flg == 1)
                        {
                            MessageBox.Show("受注計上済の為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }
                        else if (_entityEstimateH._sales_allocation_flg == 1)
                        {
                            MessageBox.Show("売上計上済の為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        if (Common.gintEstimateApprovalFlg == 1 && _entityEstimateH._state != 1)
                        {
                            MessageBox.Show("承認されていない為、見積番号:" + this.utlEstimateNo.txtID.Text + " は選択できません。");
                            webService.ProcessingDlgClose();
                            this.utlEstimateNo.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                            return;
                        }

                        // 明細データ取得
                        GetDetailEstimate(_entityEstimateH._id);
                    }
                    // 新規
                    else
                    {
                        MessageBox.Show("見積番号:" + this.utlEstimateNo.txtID.Text + " は存在しません。");
                        webService.ProcessingDlgClose();
                        this.utlEstimateNo.txtID.Text = "";
                        ExBackgroundWorker.DoWork_Focus(this.utlEstimateNo.txtID, 10);
                    }
                    break;
                // 見積明細
                case ExWebService.geWebServiceCallKbn.GetEstimateListD:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListEstimateD = (ObservableCollection<EntityEstimateD>)objList;
                    }
                    else
                    {
                        _entityListEstimateD = null;
                    }

                    // バインド反映
                    SetBinding();

                    ConverEstimateToSales(this._entityH, this._entityListD, this._entityEstimateH, this._entityListEstimateD);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;

                    this.dg.ItemsSource = _entityListD;

                    // 売掛再計算
                    CalcSalesCredit();

                    if (string.IsNullOrEmpty(_entityH._memo))
                    {
                        _entityH._memo = "見積No : " + ExCast.zFormatForID(this._entityEstimateH._no, Common.gintidFigureSlipNo);
                    }

                    ExBackgroundWorker.DoWork_Focus(this.utlOrderNo.txtID, 10);

                    this.utlEstimateNo.txtID.OnFormatString();
                    this.utlOrderNo.txtID.OnFormatString();
                    this.utlEstimateNo.txtID.UpdataFlg = false;
                    this.utlOrderNo.txtID.UpdataFlg = false;

                    break;

                #endregion

                default:
                    break;
            }
        }
        private void ConverEstimateToSales(EntitySalesH _entitySalesH,
                                           ObservableCollection<EntitySalesD> _entitySalesListD,
                                           EntityEstimateH _entityEstimateH,
                                           ObservableCollection<EntityEstimateD> _entityListEstimateD)
        {
            #region Set Entity Head

            _entitySalesH._order_no = 0;
            //_entitySalesH._sales_ymd = _entityEstimateH.or;

            this.utlCustomer.Is_MstID_Changed = false;
            this.utlSupply.Is_MstID_Changed = false;

            _entitySalesH._customer_id = _entityEstimateH._customer_id;
            _entitySalesH._customer_name = _entityEstimateH._customer_name;

            _entitySalesH._supplier_id = _entityEstimateH._supplier_id;
            _entitySalesH._supplier_name = _entityEstimateH._supplier_name;

            this.utlCustomer.Is_MstID_Changed = true;
            this.utlSupply.Is_MstID_Changed = true;
            this.utlCustomer.MstID_Changed(_entityEstimateH, new PropertyChangedEventArgs("customer_id"));
            this.utlSupply.MstID_Changed(_entityEstimateH, new PropertyChangedEventArgs("supplier_id"));

            _entitySalesH._tax_change_id = _entityEstimateH._tax_change_id;
            _entitySalesH._tax_change_name = _entityEstimateH._tax_change_name;

            _entitySalesH._business_division_id = _entityEstimateH._business_division_id;
            _entitySalesH._business_division_name = _entityEstimateH._business_division_name;

            _entitySalesH._supply_ymd = _entityEstimateH._supply_ymd;
            _entitySalesH._sum_enter_number = _entityEstimateH._sum_enter_number;
            _entitySalesH._sum_case_number = _entityEstimateH._sum_case_number;
            _entitySalesH._sum_number = _entityEstimateH._sum_number;
            _entitySalesH._sum_unit_price = _entityEstimateH._sum_unit_price;
            _entitySalesH._sum_sales_cost = _entityEstimateH._sum_sales_cost;
            _entitySalesH._sum_tax = _entityEstimateH._sum_tax;
            _entitySalesH._sum_no_tax_price = _entityEstimateH._sum_no_tax_price;
            _entitySalesH._sum_price = _entityEstimateH._sum_price;
            _entitySalesH._sum_profits = _entityEstimateH._sum_profits;
            _entitySalesH._profits_percent = _entityEstimateH._profits_percent;
            _entitySalesH._credit_limit_price = _entityEstimateH._credit_limit_price;
            _entitySalesH._sales_credit_price = _entityEstimateH._sales_credit_price;
            _entitySalesH._before_sales_credit_price = _entityEstimateH._sales_credit_price;

            _entitySalesH._invoice_id = _entityEstimateH._invoice_id;
            _entitySalesH._invoice_name = _entityEstimateH._invoice_name;

            _entitySalesH._credit_rate = _entityEstimateH._credit_rate;
            _entitySalesH._unit_kind_id = _entityEstimateH._unit_kind_id;

            _entitySalesH._invoice_state = "";
            _entitySalesH._receipt_receivable_kbn_nm = "消込未";

            _entitySalesH._memo = _entityEstimateH._memo;

            //_entitySalesH._update_person_id = ExCast.zCInt(dt.DefaultView[0]["UPDATE_PERSON_ID"]);
            //_entitySalesH._update_person_nm = ExCast.zCStr(dt.DefaultView[0]["UPDATE_PERSON_NM"]);

            //_entitySalesH._lock_flg = (int)lockFlg;

            #endregion

            #region Set Entity Detail

            if (_entitySalesListD == null) _entitySalesListD = new ObservableCollection<EntitySalesD>();
            _entitySalesListD.Clear();

            for (int i = 0; i <= _entityListEstimateD.Count - 1; i++)
            {
                EntitySalesD _entityD = new EntitySalesD();
                _entityD._id = _entitySalesH._id;
                _entityD._rec_no = _entityListEstimateD[i]._rec_no;
                _entityD._breakdown_id = _entityListEstimateD[i]._breakdown_id;
                _entityD._breakdown_nm = _entityListEstimateD[i]._breakdown_nm;
                List<string> lst;
                lst = MeiNameList.GetListMei(MeiNameList.geNameKbn.DELIVER_DIVISION_ID);
                _entityD._deliver_division_nm = lst[2];
                _entityD._deliver_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.DELIVER_DIVISION_ID, lst[2]);
                //_entityD._deliver_division_id = _entityListEstimateD[i]._deliver_division_id;
                //_entityD._deliver_division_nm = _entityListEstimateD[i]._deliver_division_nm;
                _entityD._commodity_id = _entityListEstimateD[i]._commodity_id;
                _entityD._commodity_name = _entityListEstimateD[i]._commodity_name;
                _entityD._unit_id = _entityListEstimateD[i]._unit_id;
                _entityD._unit_nm = _entityListEstimateD[i]._unit_nm;
                _entityD._enter_number = _entityListEstimateD[i]._enter_number;
                _entityD._case_number = _entityListEstimateD[i]._case_number;
                _entityD._number = _entityListEstimateD[i]._number;
                _entityD._order_number = _entityListEstimateD[i]._number;
                _entityD._order_stay_number = 0;
                _entityD._unit_price = _entityListEstimateD[i]._unit_price;
                _entityD._sales_cost = _entityListEstimateD[i]._sales_cost;
                _entityD._tax = _entityListEstimateD[i]._tax;
                _entityD._no_tax_price = _entityListEstimateD[i]._no_tax_price;
                _entityD._price = _entityListEstimateD[i]._price;
                _entityD._profits = _entityListEstimateD[i]._profits;
                _entityD._profits_percent = _entityListEstimateD[i]._profits_percent;
                _entityD._memo = _entityListEstimateD[i]._memo;
                _entityD._tax_division_id = _entityListEstimateD[i]._tax_division_id;
                _entityD._tax_division_nm = _entityListEstimateD[i]._tax_division_nm;
                _entityD._tax_percent = _entityListEstimateD[i]._tax_percent;
                _entityD._inventory_number = _entityListEstimateD[i]._inventory_number;
                _entityD._inventory_management_division_id = _entityListEstimateD[i]._inventory_management_division_id;
                _entityD._number_decimal_digit = _entityListEstimateD[i]._number_decimal_digit;
                _entityD._unit_decimal_digit = _entityListEstimateD[i]._unit_decimal_digit;
                _entitySalesListD.Add(_entityD);

            }

            #endregion
        }
 private void UpdateEstimate(int type, long EstimateNo, EntityEstimateH entityH, ObservableCollection<EntityEstimateD> entityD)
 {
     try
     {
         svcEstimateClient svc = new svcEstimateClient();
         svc.UpdateEstimateCompleted += new EventHandler<UpdateEstimateCompletedEventArgs>(this.UpdateEstimateCompleted);
         svc.UpdateEstimateAsync(Common.gstrSessionString, type, EstimateNo, entityH, entityD);
     }
     catch (Exception ex)
     {
         this.ProcessingDlgClose();
         ExMessageBox.Show(CLASS_NM + ".UpdateEstimate" + Environment.NewLine + ex.ToString(), "エラー確認");
     }
 }
        private void GetEstimateHCompleted(Object sender, GetEstimateHCompletedEventArgs e)
        {
            try
            {
                objEstimateH = e.Result;
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }

                if (objEstimateH != null)
                {
                    if (objEstimateH._message != "" && objEstimateH._message != null)
                    {
                        // 認証失敗
                        ExMessageBox.Show(objEstimateH._message);
                        objPerent.DataSelect((int)geWebServiceCallKbn.GetEstimateListH, (object)objEstimateH);
                    }
                    else
                    {
                        // 認証成功
                        objPerent.DataSelect((int)geWebServiceCallKbn.GetEstimateListH, (object)objEstimateH);
                    }
                }
                else
                {
                    objPerent.DataSelect((int)geWebServiceCallKbn.GetEstimateListH, null);
                }

            }
            catch (Exception ex)
            {
                this.ProcessingDlgClose();
                ExMessageBox.Show(CLASS_NM + ".GetEstimateHCompleted" + Environment.NewLine + ex.ToString(), "エラー確認");
            }
            finally
            {
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }
            }
        }
 private void GetEstimateH(long EstimateNoFrom, long EstimateNoTo)
 {
     try
     {
         objEstimateH = null;   // 初期化
         svcEstimateClient svc = new svcEstimateClient();
         svc.GetEstimateHCompleted += new EventHandler<GetEstimateHCompletedEventArgs>(this.GetEstimateHCompleted);
         svc.GetEstimateHAsync(Common.gstrSessionString, EstimateNoFrom, EstimateNoTo);
     }
     catch (Exception ex)
     {
         this.ProcessingDlgClose();
         ExMessageBox.Show(CLASS_NM + ".GetEstimateH" + Environment.NewLine + ex.ToString(), "エラー確認");
     }
 }
        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();
        }
예제 #15
0
        // For Estimate
        public static void ConvertFrom(EntityEstimateH entityH, ref EntityBaseH entityBaseH, ObservableCollection<EntityEstimateD> entityD, ref ObservableCollection<EntityBaseD> entityBaseD)
        {
            entityBaseD = new ObservableCollection<EntityBaseD>();

            for (int i = 0; i <= entityD.Count - 1; i++)
            {
                EntityBaseD _entityBaseD = new EntityBaseD();

                #region Set Entity Detail

                _entityBaseD.id = entityD[i]._id;
                _entityBaseD.rec_no = entityD[i]._rec_no;
                _entityBaseD.breakdown_id = entityD[i]._breakdown_id;
                _entityBaseD.breakdown_nm = entityD[i]._breakdown_nm;
                _entityBaseD.deliver_division_id = entityD[i]._deliver_division_id;
                _entityBaseD.deliver_division_nm = entityD[i]._deliver_division_nm;
                _entityBaseD.commodity_id = entityD[i]._commodity_id;
                _entityBaseD.commodity_name = entityD[i]._commodity_name;
                _entityBaseD.unit_id = entityD[i]._unit_id;
                _entityBaseD.unit_nm = entityD[i]._unit_nm;
                _entityBaseD.enter_number = entityD[i]._enter_number;
                _entityBaseD.case_number = entityD[i]._case_number;
                _entityBaseD.number = entityD[i]._number;
                _entityBaseD.unit_price = entityD[i]._unit_price;
                _entityBaseD.sales_cost = entityD[i]._sales_cost;
                _entityBaseD.tax = entityD[i]._tax;
                _entityBaseD.no_tax_price = entityD[i]._no_tax_price;
                _entityBaseD.price = entityD[i]._price;
                _entityBaseD.profits = entityD[i]._profits;
                _entityBaseD.profits_percent = entityD[i]._profits_percent;
                _entityBaseD.tax_division_id = entityD[i]._tax_division_id;
                _entityBaseD.tax_division_nm = entityD[i]._tax_division_nm;
                _entityBaseD.tax_percent = entityD[i]._tax_percent;
                _entityBaseD.inventory_management_division_id = entityD[i]._inventory_management_division_id;
                _entityBaseD.inventory_number = entityD[i]._inventory_number;
                _entityBaseD.retail_price_skip_tax = entityD[i]._retail_price_skip_tax;
                _entityBaseD.retail_price_before_tax = entityD[i]._retail_price_before_tax;
                _entityBaseD.sales_unit_price_skip_tax = entityD[i]._sales_unit_price_skip_tax;
                _entityBaseD.sales_unit_price_before_tax = entityD[i]._sales_unit_price_before_tax;
                _entityBaseD.sales_cost_price_skip_tax = entityD[i]._sales_cost_price_skip_tax;
                _entityBaseD.sales_cost_price_before_tax = entityD[i]._sales_cost_price_before_tax;
                _entityBaseD.number_decimal_digit = entityD[i]._number_decimal_digit;
                _entityBaseD.unit_decimal_digit = entityD[i]._unit_decimal_digit;

                #endregion

                entityBaseD.Add(_entityBaseD);
            }

            entityBaseH = new EntityBaseH();

            #region Set Entity Head

            entityBaseH.tax_change_id = entityH._tax_change_id;
            entityBaseH.business_division_id = entityH._business_division_id;
            entityBaseH.price_fraction_proc_id = entityH._price_fraction_proc_id;
            entityBaseH.tax_fraction_proc_id = entityH._tax_fraction_proc_id;
            entityBaseH.unit_kind_id = entityH._unit_kind_id;
            entityBaseH.sum_enter_number = entityH._sum_enter_number;
            entityBaseH.sum_case_number = entityH._sum_case_number;
            entityBaseH.sum_number = entityH._sum_number;
            entityBaseH.sum_unit_price = entityH._sum_unit_price;
            entityBaseH.sum_sales_cost = entityH._sum_sales_cost;
            entityBaseH.sum_tax = entityH._sum_tax;
            entityBaseH.sum_no_tax_price = entityH._sum_no_tax_price;
            entityBaseH.sum_price = entityH._sum_price;
            entityBaseH.sum_profits = entityH._sum_profits;
            entityBaseH.profits_percent = entityH._profits_percent;
            entityBaseH.credit_rate = entityH._credit_rate;

            #endregion
        }
        // データ取得コールバック呼出
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
                // 見積ヘッダ
                case _GetHeadWebServiceCallKbn:
                    // 更新
                    if (objList != null)    
                    {
                        _entityH = (EntityEstimateH)objList;

                        // エラー発生時
                        if (_entityH._message != "" && _entityH._message != null)
                        {
                            webService.ProcessingDlgClose();
                            this.utlNo.txtID.Text = "";
                            return;
                        } 

                        // バインド反映
                        SetBinding();

                        // 明細データ取得
                        GetDetailData(_entityH._id);
                    }
                    // 新規
                    else
                    {
                        //// 明細追加
                        //this.btnF7_Click(null, null);

                        //this.dg.ItemsSource = _entityListD;
                        //webService.ProcessingDlgClose();
                        //this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        //this.utlNo.txtID_IsReadOnly = true;

                        webService.ProcessingDlgClose();
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        this.utlNo.txtID_IsReadOnly = false;
                    }
                    ExBackgroundWorker.DoWork_Focus(this.datEstimateYmd, 10);
                    break;
                // 見積明細
                case _GetDetailWebServiceCallKbn:
                    // 2回設定がかかりエラーになる為
                    try
                    {
                        this.dg.ItemsSource = null;
                    }
                    catch
                    {
                        return;
                    }

                    if (objList != null)
                    {
                        _entityListD = (ObservableCollection<EntityEstimateD>)objList;
                    }
                    else 
                    {
                        _entityListD = null;
                    }

                    // 明細追加
                    this.btnF7_Click(null, null);

                    // 明細再計算
                    DataDetail.IsCalcPrice = false;
                    DataDetail.ReCalcDetail(_entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;

                    this.dg.ItemsSource = _entityListD;

                    ExBackgroundWorker.DoWork_Focus(this.datEstimateYmd, 10);

                    if (_entityH._order_allocation_flg == 1)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        this.utlMode.txtMode.Text = " 参照モード(受注計上済) ";
                        MessageBox.Show("受注計上済の為、変更できません。");
                        this.Focus();
                        return;
                    }
                    else if (_entityH._sales_allocation_flg == 1)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        this.utlMode.txtMode.Text = " 参照モード(売上計上済) ";
                        MessageBox.Show("売上計上済の為、変更できません。");
                        this.Focus();
                        return;
                    }

                    if (_entityH._lock_flg == 0)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                    }

                    this.utlNo.txtID_IsReadOnly = true;
                    //this.utlNo.IsEnabled = false;
                    break;
                default:
                    break;
            }
        }
        private void ConverEstimateToOrder(EntityOrderH _entityOrderH,
                                           ObservableCollection<EntityOrderD> _entityListOrderD,
                                           EntityEstimateH _entityEstimateH,
                                           ObservableCollection<EntityEstimateD> _entityListEstimateD)
        {
            #region Set Entity Head

            _entityOrderH._estimateno = _entityEstimateH._no;
            //_entityOrderH._order_ymd = _entityEstimateH.or;

            this.utlCustomer.Is_MstID_Changed = false;
            this.utlSupply.Is_MstID_Changed = false;

            _entityOrderH._customer_id = _entityEstimateH._customer_id;
            _entityOrderH._customer_name = _entityEstimateH._customer_name;

            _entityOrderH._supplier_id = _entityEstimateH._supplier_id;
            _entityOrderH._supplier_name = _entityEstimateH._supplier_name;

            this.utlCustomer.Is_MstID_Changed = true;
            this.utlSupply.Is_MstID_Changed = true;
            this.utlCustomer.MstID_Changed(_entityOrderH, new PropertyChangedEventArgs("customer_id"));
            this.utlSupply.MstID_Changed(_entityOrderH, new PropertyChangedEventArgs("supplier_id"));

            _entityOrderH._tax_change_id = _entityEstimateH._tax_change_id;
            _entityOrderH._tax_change_name = _entityEstimateH._tax_change_name;

            _entityOrderH._business_division_id = _entityEstimateH._business_division_id;
            _entityOrderH._business_division_name = _entityEstimateH._business_division_name;

            _entityOrderH._supply_ymd = _entityEstimateH._supply_ymd;
            _entityOrderH._sum_enter_number = _entityEstimateH._sum_enter_number;
            _entityOrderH._sum_case_number = _entityEstimateH._sum_case_number;
            _entityOrderH._sum_number = _entityEstimateH._sum_number;
            _entityOrderH._sum_unit_price = _entityEstimateH._sum_unit_price;
            _entityOrderH._sum_sales_cost = _entityEstimateH._sum_sales_cost;
            _entityOrderH._sum_tax = _entityEstimateH._sum_tax;
            _entityOrderH._sum_no_tax_price = _entityEstimateH._sum_no_tax_price;
            _entityOrderH._sum_price = _entityEstimateH._sum_price;
            _entityOrderH._sum_profits = _entityEstimateH._sum_profits;
            _entityOrderH._profits_percent = _entityEstimateH._profits_percent;
            _entityOrderH._credit_limit_price = _entityEstimateH._credit_limit_price;
            _entityOrderH._sales_credit_price = _entityEstimateH._sales_credit_price;
            _entityOrderH._memo = _entityEstimateH._memo;

            //_entityOrderH._update_person_id = ExCast.zCInt(dt.DefaultView[0]["UPDATE_PERSON_ID"]);
            //_entityOrderH._update_person_nm = ExCast.zCStr(dt.DefaultView[0]["UPDATE_PERSON_NM"]);

            //_entityOrderH._lock_flg = (int)lockFlg;

            _entityOrderH._sales_allocation_flg = 0;

            #endregion

            #region Set Entity Detail

            if (_entityListOrderD == null) _entityListOrderD = new ObservableCollection<EntityOrderD>();
            _entityListOrderD.Clear();

            for (int i = 0; i <= _entityListEstimateD.Count - 1; i++)
            {
                EntityOrderD _entityOrderD = new EntityOrderD();
                _entityOrderD._id = _entityOrderH._id;
                _entityOrderD._rec_no = _entityListEstimateD[i]._rec_no;
                _entityOrderD._breakdown_id = _entityListEstimateD[i]._breakdown_id;
                _entityOrderD._breakdown_nm = _entityListEstimateD[i]._breakdown_nm;
                _entityOrderD._deliver_division_id = _entityListEstimateD[i]._deliver_division_id;
                _entityOrderD._deliver_division_nm = _entityListEstimateD[i]._deliver_division_nm;
                _entityOrderD._commodity_id = _entityListEstimateD[i]._commodity_id;
                _entityOrderD._commodity_name = _entityListEstimateD[i]._commodity_name;
                _entityOrderD._unit_id = _entityListEstimateD[i]._unit_id;
                _entityOrderD._unit_nm = _entityListEstimateD[i]._unit_nm;
                _entityOrderD._enter_number = _entityListEstimateD[i]._enter_number;
                _entityOrderD._case_number = _entityListEstimateD[i]._case_number;
                _entityOrderD._number = _entityListEstimateD[i]._number;
                _entityOrderD._unit_price = _entityListEstimateD[i]._unit_price;
                _entityOrderD._sales_cost = _entityListEstimateD[i]._sales_cost;
                _entityOrderD._tax = _entityListEstimateD[i]._tax;
                _entityOrderD._no_tax_price = _entityListEstimateD[i]._no_tax_price;
                _entityOrderD._price = _entityListEstimateD[i]._price;
                _entityOrderD._profits = _entityListEstimateD[i]._profits;
                _entityOrderD._profits_percent = _entityListEstimateD[i]._profits_percent;
                _entityOrderD._memo = _entityListEstimateD[i]._memo;
                _entityOrderD._tax_division_id = _entityListEstimateD[i]._tax_division_id;
                _entityOrderD._tax_division_nm = _entityListEstimateD[i]._tax_division_nm;
                _entityOrderD._tax_percent = _entityListEstimateD[i]._tax_percent;
                _entityOrderD._inventory_number = _entityListEstimateD[i]._inventory_number;
                _entityOrderD._inventory_management_division_id = _entityListEstimateD[i]._inventory_management_division_id;
                _entityOrderD._number_decimal_digit = _entityListEstimateD[i]._number_decimal_digit;
                _entityOrderD._unit_decimal_digit = _entityListEstimateD[i]._unit_decimal_digit;
                _entityListOrderD.Add(_entityOrderD);

            }

            #endregion
        }