Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            var lR = GetMainReport().FirstOrDefault();
            using (var en = new WeekReportEntities())
            {
                TB_InsurenceRe InReport = en.TB_InsurenceRe.Where(p => p.InsurenceID == lR.InsurenceReID).FirstOrDefault();

                if (InReport != null)
                {
                    InReport.AnyCaseToNow   = int.Parse(txtAnyCaseToNow.Text);
                    InReport.CarBdCaseToNow = int.Parse(txtCarBdCaseToNow.Text);
                    InReport.MoneyToNow     = int.Parse(txtMoneyToNow.Text);
                    InReport.AnyCaseSec     = int.Parse(txtAnyCaseSec.Text);
                    InReport.WeekTotalBd    = int.Parse(txtWeekTotalBd.Text);

                    InReport.MonTotalExR = int.Parse(txtMonTotalExR.Text);
                    InReport.MonAnyExR   = int.Parse(txtMonAnyExR.Text);
                    InReport.MonBdExR    = int.Parse(txtMonBdExR.Text);

                    InReport.TotalWeekImport = int.Parse(txtImportC.Text);

                    InReport.RefinProject = txtRefineProject.Text;

                    InReport.SelfNumber = int.Parse(txtSelfNumber.Text);

                    en.SaveChanges();
                }
                else
                {
                    en.TB_InsurenceRe.Add(new TB_InsurenceRe
                    {
                        InsurenceID = lR.InsurenceReID,

                        AnyCaseToNow   = int.Parse(txtAnyCaseToNow.Text),
                        CarBdCaseToNow = int.Parse(txtCarBdCaseToNow.Text),
                        MoneyToNow     = int.Parse(txtMoneyToNow.Text),
                        AnyCaseSec     = int.Parse(txtAnyCaseSec.Text),
                        WeekTotalBd    = int.Parse(txtWeekTotalBd.Text),

                        MonTotalExR = int.Parse(txtMonTotalExR.Text),
                        MonAnyExR   = int.Parse(txtMonAnyExR.Text),
                        MonBdExR    = int.Parse(txtMonBdExR.Text),

                        TotalWeekImport = int.Parse(txtImportC.Text),

                        RefinProject = txtRefineProject.Text,

                        SelfNumber = int.Parse(txtSelfNumber.Text)
                    });

                    en.SaveChanges();
                }

                this.LoadReportData();
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }
Пример #2
0
    public void LoadReportData()
    {
        List <TB_Report> lR = GetMainReport();

        var mainReport = lR.FirstOrDefault();

        TB_User user = ((TB_User)Session[GlobalInfo.Session_User]);

        using (var en = new WeekReportEntities())
        {
            //訂單資料
            var OrderReport = en.TB_OrderReport.Where(p => p.OrderReID == mainReport.OrderReID).FirstOrDefault();

            //保險資料
            TB_InsurenceRe InReport = (from q in en.TB_InsurenceRe
                                       where q.InsurenceID == mainReport.InsurenceReID
                                       select q).FirstOrDefault();

            //抓其他資料表的資料
            var Goal = en.TB_MonthGoal.Where(p => p.Bureau == user.Bureau &&
                                             p.Class == user.Class &&
                                             p.yyyy == DateTime.Now.Year &&
                                             p.mm == DateTime.Now.Month).FirstOrDefault();

            int InGoalNum = (int)Goal.InGoalNum;
            int InAny     = (int)Goal.InAny;
            int InBd      = (int)Goal.InBd;

            lbGoalNumber.Text = Goal.InGoalNum.ToString();
            lbInSecCon.Text   = Goal.InAny.ToString();
            lbCarBdSec.Text   = Goal.InBd.ToString();
            lbGoalMoney.Text  = (InGoalNum * 0.76 * 11000).ToString();

            if (InReport != null)
            {
                int AnyCaseToNow   = (int)InReport.AnyCaseToNow;
                int CarBdCaseToNow = (int)InReport.CarBdCaseToNow;
                int MoneyToNow     = (int)InReport.MoneyToNow;
                int AnyCaseSec     = (int)InReport.AnyCaseSec;
                int WeekTotalBd    = (int)InReport.WeekTotalBd;

                txtAnyCaseToNow.Text   = InReport.AnyCaseToNow.ToString();
                txtCarBdCaseToNow.Text = InReport.CarBdCaseToNow.ToString();
                txtMoneyToNow.Text     = InReport.MoneyToNow.ToString();
                txtAnyCaseSec.Text     = InReport.AnyCaseSec.ToString();
                txtWeekTotalBd.Text    = InReport.WeekTotalBd.ToString();

                lbContinuePushR.Text   = (AnyCaseToNow * 100 / InGoalNum).ToString() + "%";
                lbBdContinuePushR.Text = (CarBdCaseToNow * 100 / InGoalNum).ToString() + "%";
                lbMoneyPushR.Text      = (MoneyToNow * 100 / (InGoalNum * 0.76 * 11000)).ToString("0.00") + "%";
                lbAnySecPushR.Text     = (AnyCaseSec * 100 / InAny).ToString() + "%";
                lbAnyBdR.Text          = (WeekTotalBd * 100 / InBd).ToString() + "%";

                txtMonTotalExR.Text = InReport.MonTotalExR.ToString();
                txtMonAnyExR.Text   = InReport.MonAnyExR.ToString();
                txtMonBdExR.Text    = InReport.MonBdExR.ToString();

                lbGoalMonth.Text    = OrderReport.OrderedCount.ToString();
                lbOrderCount.Text   = OrderReport.SaleCount.ToString();
                txtImportC.Text     = InReport.TotalWeekImport.ToString();
                lbInstallments.Text = ((int)InReport.TotalWeekImport * 100 / (int)OrderReport.SaleCount).ToString();

                txtRefineProject.Text = InReport.RefinProject;
                txtSelfNumber.Text    = InReport.SelfNumber.ToString();
            }
        }
    }
Пример #3
0
    public void ShowData()
    {
        int reID = (int)Session[GlobalInfo.Session_ShowAllParam];

        using (var en = new WeekReportEntities())
        {
            //抓到目前的報表主檔
            TB_Report MainRe = en.TB_Report.Where(p => p.ReportID == reID).FirstOrDefault();

            //目前報表當月目標
            TB_MonthGoal MonthGoal = en.TB_MonthGoal.Where(p => p.Bureau == MainRe.Bureau &&
                                                           p.Class == MainRe.Class &&
                                                           p.yyyy == MainRe.TimeStart.Value.Year &&
                                                           p.mm == MainRe.TimeStart.Value.Month)
                                     .FirstOrDefault();

            //訂單報表
            TB_OrderReport OrderRe = en.TB_OrderReport.Where(p => p.OrderReID == MainRe.OrderReID).FirstOrDefault();
            //保險報表
            TB_InsurenceRe InsureRe = en.TB_InsurenceRe.Where(p => p.InsurenceID == MainRe.InsurenceReID).FirstOrDefault();
            //中古車報表
            TB_OldCarSaleRe OldCarRe = en.TB_OldCarSaleRe.Where(p => p.OldCarSaleReID == MainRe.OldCarSaleReID).FirstOrDefault();
            //精裝配件
            TB_CarAssRe CarAssRe = en.TB_CarAssRe.Where(p => p.CarAssReID == MainRe.CarAssReID).FirstOrDefault();
            //人員管理概要
            TB_HumanRe HumanRe = en.TB_HumanRe.Where(p => p.HumanResourceReID == MainRe.HumanManageReID).FirstOrDefault();

            #region ---------------------------訂單部分-----------------------------

            //本月目標
            MonthGoalLabel.Text = MonthGoal.OrderNum.ToString();

            DateTime dt = ((DateTime)MainRe.TimeEnd);

            Decimal rate = (decimal)((DateTime)MainRe.TimeEnd).Day / (decimal)DateTime.DaysInMonth(dt.Year, dt.Month);

            rlgMonthGoal.Pointer.Value = rate * 100;


            //累積至本周受定台數
            OrderedCountLabel.Text = Convert.ToString(OrderRe.OrderedCount);

            rlgOrderedCount.Pointer.Value = (decimal)OrderRe.OrderedCount / (decimal)MonthGoal.OrderNum * 100;

            if (rlgOrderedCount.Pointer.Value < rlgMonthGoal.Pointer.Value)
            {
                rlgOrderedCount.Pointer.Color = System.Drawing.Color.Red;
            }

            //累積至本周販賣台數
            SaleCountLabel.Text = OrderRe.SaleCount.ToString();

            rlgSaleCount.Pointer.Value = (decimal)OrderRe.SaleCount / (decimal)MonthGoal.OrderNum * 100;

            if (rlgSaleCount.Pointer.Value < rlgMonthGoal.Pointer.Value)
            {
                rlgSaleCount.Pointer.Color = System.Drawing.Color.Red;
            }

            //目前掌握台數
            OnControlLabel.Text = OrderRe.OnControl.ToString();

            rlgOnControl.Pointer.Value = (decimal)OrderRe.OnControl / (decimal)MonthGoal.OrderNum * 100;

            if (rlgOnControl.Pointer.Value < rlgMonthGoal.Pointer.Value)
            {
                rlgOnControl.Pointer.Color = System.Drawing.Color.Red;
            }

            //至月底預估台數
            ExpectationsLabel.Text = OrderRe.Expectations.ToString();

            rlgExpectations.Pointer.Value = (decimal)OrderRe.Expectations / (decimal)MonthGoal.OrderNum * 100;

            if (rlgExpectations.Pointer.Value < rlgMonthGoal.Pointer.Value)
            {
                rlgExpectations.Pointer.Color = System.Drawing.Color.Red;
            }

            //各業專本周受訂狀況
            OrderDetailLabel.Text = OrderRe.OrderDetail;
            //未開市人員
            UnorderDetailLabel.Text = OrderRe.UnorderDetail;
            //針對本周該課(新訂弱勢車種)說明
            WeekCarLabel.Text = OrderRe.WeekCar;
            //其他問題點改善說明
            OthersLabel.Text = OrderRe.Others;
            //販賣管理自評
            SelfNumberLabel.Text = OrderRe.SelfNumber.ToString();

            #endregion

            #region ---------------------------保險部分-----------------------------

            //本月目標件數
            InGoalLabel.Text = MonthGoal.InGoalNum.ToString();
            //累積至本周任意件數
            AnyCaseToNowLabel.Text        = InsureRe.AnyCaseToNow.ToString();
            rlgAnyCaseToNow.Pointer.Value = (decimal)InsureRe.AnyCaseToNow / (decimal)MonthGoal.InGoalNum * 100;

            //累積至本周車體(甲乙丙)件數
            CarBdCaseToNowLabel.Text        = InsureRe.CarBdCaseToNow.ToString();
            rlgCarBdCaseToNow.Pointer.Value = (decimal)InsureRe.CarBdCaseToNow / (decimal)MonthGoal.InGoalNum * 100;

            //本月目標保費
            lbInsurenceBill.Text = (MonthGoal.InGoalNum * 0.76 * 11000).ToString();

            //累積至本周任意總保費
            MoneyToNowLabel.Text        = InsureRe.MoneyToNow.ToString();
            rlgMoneyToNow.Pointer.Value = (decimal)InsureRe.MoneyToNow / (decimal)(MonthGoal.InGoalNum * 0.76 * 11000) * 100;

            //本月預估保費達成率
            MonTotalExRLabel.Text = InsureRe.MonTotalExR.ToString() + "%";


            //任意目標件數
            InSecConLabel.Text = MonthGoal.InAny.ToString();

            //累積至本周任意件數
            AnyCaseSecLabel.Text        = MonthGoal.InAny.ToString();
            rlgAnyCaseSec.Pointer.Value = (decimal)MonthGoal.InAny / (decimal)MonthGoal.InAny * 100;

            //本月預估達成率
            MonAnyExRLabel.Text = InsureRe.MonAnyExR.ToString() + "%";

            //車體目標件數
            CarBdSecLabel.Text = InsureRe.CarBdSec.ToString();

            //累積至本周車體(甲乙)件數
            WeekTotalBdLabel.Text        = InsureRe.WeekTotalBd.ToString();
            rlgWeekTotalBd.Pointer.Value = (decimal)InsureRe.WeekTotalBd / (decimal)MonthGoal.InBd * 100;

            //本月預估達成率
            MonBdExRLabel.Text = InsureRe.MonBdExR.ToString() + "%";

            //弱勢險種改善計畫
            txtRefinProject.Text = InsureRe.RefinProject;

            //本月目標
            lbInstallmentsMonthGoal.Text = ((decimal)(MonthGoal.OrderNum * 0.45)).ToString("0");

            //累積至本周販賣台數
            lbSaleCount.Text = OrderRe.SaleCount.ToString();

            //累積至本周進件台數
            TotalWeekImportLabel.Text = InsureRe.TotalWeekImport.ToString();
            rlgInsurenceInstallments.Pointer.Value = (decimal)InsureRe.TotalWeekImport / (decimal)OrderRe.SaleCount * 100;

            //保險/分期管理自評
            SelfNumber1Label.Text = InsureRe.SelfNumber.ToString();

            #endregion

            #region ---------------------------中古車部分---------------------------
            //換購台數
            ChangeBuyLabel.Text = OldCarRe.ChangeBuy.ToString();

            //本周查估台數
            BuyExLabel.Text = OldCarRe.BuyEx.ToString();

            //成交台數
            DealNumLabel.Text = OldCarRe.DealNum.ToString();

            //戰敗車原因及流向說明
            FailDealDetailTextBox.Text = OldCarRe.FailDealDetail.ToString();

            //中古車管理自評
            SelfNumber2Label.Text = OldCarRe.SelfNumber.ToString();
            #endregion

            #region --------------------------精裝配件------------------------------

            //精裝招攬累計件數
            RefinementNumLabel.Text = CarAssRe.RefinementNum.ToString();

            //影音招攬累計件數
            VAudioNumLabel.Text = CarAssRe.VAudioNum.ToString();

            //精裝推販問題原因說明/改善計畫
            RefineDetailTextBox.Text = CarAssRe.RefineDetail.ToString();

            //車美仕配件問題件數
            AssProNumLabel.Text = CarAssRe.AssProNum.ToString();

            //PDS整備問題件數
            PDSProNumLabel.Text = CarAssRe.PDSProNum.ToString();

            //其他問題點回饋
            OthersProDetailTextBox.Text = CarAssRe.OthersProDetail.ToString();

            //精裝管理自評
            SelfNumber3Label.Text = CarAssRe.SelfNumber.ToString();

            #endregion

            #region --------------------------人員管理------------------------------

            //本課別尚缺人數
            PeopleNeedLabel.Text = HumanRe.PeopleNeed.ToString();

            //當周面試人數
            InterviewLabel.Text = HumanRe.Interview.ToString();

            //2年以下新入社人員狀況觀察
            NewEmpDetailTextBox.Text = HumanRe.NewEmpDetail;

            //本周特別關懷弱勢人員
            SpecialEmpTextBox.Text = HumanRe.SpecialEmp;

            //本周優良業專
            WeekGoodEmpTextBox.Text = HumanRe.WeekGoodEmp;

            //人員自評管理
            SelfNumber4Label.Text = HumanRe.SelfNumber.ToString();

            #endregion
        }
    }