コード例 #1
0
        //竞品分布
        //组团周度排名
        //组团业态周度排名
        //组团近八周排名
        //组团业态近近八周排名


        public ISlideCollection _plus_jp_baoyi_1(string str, int cjbh)
        {
            try
            {
                var param = Cache_param_zb._param_jp.Where(m => m.cjid == cjbh);
                var p     = new Presentation();
                var t     = p.Slides;
                t.RemoveAt(0);
                foreach (var item in param)
                {
                    var tp    = new Presentation(str);
                    var temp  = tp.Slides;
                    var page2 = temp[1];

                    #region 本周主团项目排名
                    DataTable dt2 = new DataTable();
                    dt2.Columns.Add("排名");
                    dt2.Columns.Add("项目名称");
                    dt2.Columns.Add("成交套数");
                    dt2.Columns.Add("成交金额");
                    dt2.Columns.Add("建面体量");
                    dt2.Columns.Add("套内体量");
                    dt2.Columns.Add("建面均价");
                    dt2.Columns.Add("套内均价");
                    var data1 = (from a in Cache_data_cjjl.bz.AsEnumerable()
                                 where item.ztcs.Contains(a["zt"])
                                 group a by new { lpmc = a["lpmc"] } into s
                                 select new
                    {
                        lpmc = s.Key.lpmc,
                        ts = s.Sum(a => a["ts"].doubls()),
                        cjje = s.Sum(a => a["cjje"].longs()),
                        jmtl = s.Sum(a => a["jzmj"].doubls()),
                        tntl = s.Sum(a => a["tnmj"].doubls()),
                    }).OrderByDescending(m => m.cjje).Take(10).ToList();

                    for (int i = 0; i < data1.Count; i++)
                    {
                        DataRow dr2 = dt2.NewRow();
                        dr2["排名"]   = i + 1;
                        dr2["项目名称"] = data1[i].lpmc;
                        dr2["成交套数"] = data1[i].ts;
                        dr2["成交金额"] = data1[i].cjje.je_wy();
                        dr2["建面体量"] = data1[i].jmtl.mj_wf();
                        dr2["套内体量"] = data1[i].tntl.mj_wf();
                        dr2["建面均价"] = (data1[i].cjje / data1[i].jmtl).je_y();
                        dr2["套内均价"] = (data1[i].cjje / data1[i].tntl).je_y();
                        dt2.Rows.Add(dr2);
                    }
                    Office_Tables.SetTable(page2, dt2, 1, null, null);
                    t.AddClone(page2);



                    foreach (var yt in item.ytcs)
                    {
                        var tp1   = new Presentation(str);
                        var temp1 = tp1.Slides;
                        var page3 = temp1[1];

                        DataTable dt2_1 = new DataTable();
                        dt2_1.Columns.Add("排名");
                        dt2_1.Columns.Add("项目名称");
                        dt2_1.Columns.Add("成交套数");
                        dt2_1.Columns.Add("成交金额");
                        dt2_1.Columns.Add("建面体量");
                        dt2_1.Columns.Add("套内体量");
                        dt2_1.Columns.Add("建面均价");
                        dt2_1.Columns.Add("套内均价");
                        var data2_1 = (from a in Cache_data_cjjl.bz.AsEnumerable()
                                       where item.ztcs.Contains(a["zt"]) && a["yt"].ToString() == yt
                                       group a by new { lpmc = a["lpmc"] } into s
                                       select new
                        {
                            lpmc = s.Key.lpmc,
                            ts = s.Sum(a => a["ts"].doubls()),
                            cjje = s.Sum(a => a["cjje"].longs()),
                            jmtl = s.Sum(a => a["jzmj"].doubls()),
                            tntl = s.Sum(a => a["tnmj"].doubls()),
                        }).OrderByDescending(m => m.cjje).ToList();
                        for (int i = 0; i < data2_1.Count; i++)
                        {
                            DataRow dr2_1 = dt2_1.NewRow();
                            dr2_1["排名"]   = i + 1;
                            dr2_1["项目名称"] = data2_1[i].lpmc;
                            dr2_1["成交套数"] = data2_1[i].ts;
                            dr2_1["成交金额"] = data2_1[i].cjje.je_wy();
                            dr2_1["建面体量"] = data2_1[i].jmtl.mj_wf();
                            dr2_1["套内体量"] = data2_1[i].tntl.mj_wf();
                            dr2_1["建面均价"] = (data2_1[i].cjje / data2_1[i].jmtl).je_y();
                            dr2_1["套内均价"] = (data2_1[i].cjje / data2_1[i].tntl).je_y();
                            dt2_1.Rows.Add(dr2_1);
                        }
                        Office_Tables.SetTable(page3, dt2_1, 1, null, null);
                        t.AddClone(page3);
                    }


                    #endregion

                    #region 组团近八周排名


                    int[] index1 = { 2, 3, 0, 1, 2 };
                    foreach (var ztpmitem in this.JBZ_ZT_PM(str, index1, item.ztcs))
                    {
                        t.AddClone(ztpmitem);
                    }
                    int[] index2 = { 3, 3, 0, 1, 2 };
                    foreach (var ztytpmitem in this.JBZ_ZT_YT_PM(str, index2, item.ztcs, item.ytcs))
                    {
                        t.AddClone(ztytpmitem);
                    }
                    #endregion

                    #region 竞品表现
                    #region 认购
                    var page5 = temp[4];

                    DataTable dt5_0 = new DataTable();

                    dt5_0.Columns.Add(Base_Config_Jzgj.项目名称);
                    dt5_0.Columns.Add(Base_Config_Jzgj.业态);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_新开套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_新开销售套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_新开建面均价);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_本周来电);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_本周到访量);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购建面均价);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购建面均价);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.周_认购建面均价);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_认购套数);
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_认购建面均价);
                    dt5_0.Columns.Add("合计认购套数");
                    dt5_0.Columns.Add(Base_Config_Rgsj.本周_变化原因);
                    IAutoShape text5_0 = (IAutoShape)page5.Shapes[0];
                    text5_0.TextFrame.Text = string.Format(text5_0.TextFrame.Text, item.bamc);
                    if (item.jpxmlb != null && item.jpxmlb.Count > 0)
                    {
                        dt5_0 = GET_JPXM_BX_RG(dt5_0, item.jpxmlb);
                        Office_Tables.SetJP_baoyi_1_Table(page5, dt5_0, 1, null, null);
                        t.AddClone(page5);
                    }
                    #endregion


                    #region 备案
                    var       page6 = temp[5];
                    DataTable dt6_0 = new DataTable();

                    dt6_0.Columns.Add(Base_Config_Jzgj.项目名称);
                    dt6_0.Columns.Add(Base_Config_Jzgj.业态);
                    dt6_0.Columns.Add(Base_Config_Jzgj.竞争格局_主力面积区间);
                    dt6_0.Columns.Add("主力房型");
                    dt6_0.Columns.Add(Base_Config_Cjba.周_备案套数);
                    dt6_0.Columns.Add(Base_Config_Cjba.周_建面均价);
                    dt6_0.Columns.Add(Base_Config_Cjba.周_备案套数);
                    dt6_0.Columns.Add(Base_Config_Cjba.周_建面均价);
                    dt6_0.Columns.Add(Base_Config_Cjba.周_备案套数);
                    dt6_0.Columns.Add(Base_Config_Cjba.周_建面均价);
                    dt6_0.Columns.Add(Base_Config_Cjba.本周_备案套数);
                    dt6_0.Columns.Add(Base_Config_Cjba.本周_建面均价);
                    dt6_0.Columns.Add("合计认购套数");
                    dt6_0.Columns.Add("合计建面均价");
                    IAutoShape text6 = (IAutoShape)page6.Shapes[0];
                    text6.TextFrame.Text = string.Format(text6.TextFrame.Text, item.bamc);
                    if (item.jpxmlb != null && item.jpxmlb.Count > 0)
                    {
                        dt6_0 = GET_JPXM_BX_BA(dt6_0, item.jpxmlb);
                        Office_Tables.SetJP_baoyi_2_Table(page6, dt6_0, 1, null, null);
                        t.AddClone(page6);
                    }
                    #endregion
                    #endregion
                }

                return(t);
            }
            catch (Exception e)
            {
                Base_Log.Log(e.Message);
                return(null);
            }
        }