示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="yydh"></param>
        /// <param name="qymc"></param>
        /// <param name="xsy_hykh"></param>一级分析字段,如三个值分析到底是销售员xsy;客人来源krly;协议单位xydw,从common_bb获取,一定要字段的名称(也允许分析其他字段如片区、省份)
        /// <param name="xsy_hykh_value"></param>是否有具体要分析哪一家,主要是用来处理一级字段如果有限定,就用来对一级字段的模糊查询
        /// <param name="is_second"></param>分析二级情况,例如有两种情况,一种是销售员下面带协议单位,一种是客人来源还协议单位
        /// <param name="second_value"></param>要分析的二级字段的名称
        /// <param name="other_cond"></param>是否有包含其他的查询条件(例如要查省份时一定要绑定国家是中国)
        /// <param name="czy"></param>
        /// <param name="cssj"></param>
        /// <param name="jssj"></param>
        /// <param name="czsj"></param>
        /// <param name="xxzs"></param>
        ///
        public string bbfx_add_app_hykh(string yydh, string qymc, string xsy_hykh, string xsy_hykh_value, bool is_second, string second_value, string other_cond, string czy, string cssj, string jssj, DateTime czsj, string xxzs)
        {
            string get_result = common_file.common_app.get_failure;
            string sel_cond   = " yydh='" + yydh + "' and czy_temp='" + czy + "' and xfdr!='" + Szwgl.common_zw.dr_ds + "' and (xfsj between '" + cssj + "' and '" + jssj + "')" + other_cond;

            if (xsy_hykh_value != "")
            {
                sel_cond = sel_cond + " and " + xsy_hykh + " like '%" + xsy_hykh_value + "%'";
            }
            string sub_sel_con = "";
            float  zfs = 1; string fxdr = ""; string fxrb = ""; float zyye = 0; float zfh = 0; float czfs = 0; float xd_czzfs = 1; float xd_czzfs_out = 1; float pjczl = 0; float xd_pjczl = 0; float pjfj = 0; float jcb = 0;
            float  pjbl = 0; float xd_pjbl = 0;

            float ljzfh  = 0;
            float ljczfs = 0;
            float ljzyye = 0;

            BLL.Common B_Common = new Hotel_app.BLL.Common();
            string     sql_s    = "delete from BQ_syxffx where czy_temp='" + czy + "' and type='" + xsy_hykh + "'";

            B_Common.ExecuteSql(sql_s);
            DataSet DS_temp;
            DataSet DS_temp_0;

            //获取总房数
            DS_temp_0 = B_Common.GetList("select sum(zfs) as zfs from BSzhrbbfl", " yydh='" + yydh + "' and bbrq between '" + cssj + "' and '" + jssj + "'");
            if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
            {
                if (DS_temp_0.Tables[0].Rows[0]["zfs"].ToString() != "")
                {
                    zfs = float.Parse(DS_temp_0.Tables[0].Rows[0]["zfs"].ToString());
                }
            }

            //获取营业额
            string sel_cond_0 = " yydh='" + yydh + "' and xfdr!='" + Szwgl.common_zw.dr_ds + "' and (xfsj between '" + cssj + "' and '" + jssj + "')";
            float  zyye_z     = 1;

            DS_temp_0 = B_Common.GetList("select sum(sjxfje) as sjxfje from Ssyxfmx", sel_cond_0);
            if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
            {
                if (DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                {
                    zyye_z = float.Parse(DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString());
                }
            }


            xd_czzfs_out = 1;
            DS_temp_0    = B_Common.GetList("select sum(xfsl) as xfsl from BQ_syxfmx_hy_ls", sel_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "'");
            if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
            {
                if (DS_temp_0.Tables[0].Rows[0]["xfsl"].ToString() != "")
                {
                    xd_czzfs_out = float.Parse(DS_temp_0.Tables[0].Rows[0]["xfsl"].ToString());
                }
            }

            B_syxfmx_ls_add B_syxfmx_ls_add_new = new B_syxfmx_ls_add();

            Ssyxfmx_hy_ls_add_app(yydh, qymc, czy, cssj, jssj, xsy_hykh, xxzs);

            int i_0 = 0;

            DS_temp = B_Common.GetList("select " + xsy_hykh + ",sum(sjxfje) as sjxfje from BQ_syxfmx_hy_ls", sel_cond + " group by " + xsy_hykh + " order by sjxfje desc");
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                {
                    clear_cs(ref fxdr, ref fxrb, ref zyye, ref zfh, ref czfs, ref pjczl, ref xd_pjczl, ref pjfj, ref jcb, ref pjbl, ref xd_pjbl);
                    if (DS_temp.Tables[0].Rows[i_0][xsy_hykh].ToString() != "")
                    {
                        fxdr = DS_temp.Tables[0].Rows[i_0][xsy_hykh].ToString();
                        fxrb = fxdr;
                    }
                    else
                    {
                        fxdr = "其他";
                        fxrb = fxdr;
                    }
                    if (DS_temp.Tables[0].Rows[i_0]["sjxfje"].ToString() != "")
                    {
                        zyye = float.Parse(DS_temp.Tables[0].Rows[i_0]["sjxfje"].ToString());
                    }
                    DS_temp_0 = B_Common.GetList("select sum(sjxfje) as sjxfje from BQ_syxfmx_hy_ls", sel_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + xsy_hykh + "='" + DS_temp.Tables[0].Rows[i_0][xsy_hykh].ToString() + "'");
                    if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                    {
                        if (DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                        {
                            zfh = float.Parse(DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString());
                        }
                    }
                    DS_temp_0 = B_Common.GetList("select sum(xfsl) as xfsl from BQ_syxfmx_hy_ls", sel_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + xsy_hykh + "='" + DS_temp.Tables[0].Rows[i_0][xsy_hykh].ToString() + "' ");
                    if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                    {
                        if (DS_temp_0.Tables[0].Rows[0]["xfsl"].ToString() != "")
                        {
                            czfs = float.Parse(DS_temp_0.Tables[0].Rows[0]["xfsl"].ToString());
                        }
                    }
                    if (zfh <= 0 || czfs <= 0)
                    {
                        pjfj = 0;
                    }
                    else
                    {
                        pjfj = float.Parse(Convert.ToString(Math.Floor(zfh / czfs * 100) / 100));
                    }
                    ljzfh    = ljzfh + zfh;
                    ljczfs   = ljczfs + czfs;
                    ljzyye   = ljzyye + zyye;
                    pjczl    = float.Parse(Convert.ToString(Math.Floor(czfs / zfs * 10000) / 10000));
                    xd_pjczl = float.Parse(Convert.ToString(Math.Floor(czfs / xd_czzfs_out * 10000) / 10000));
                    pjbl     = float.Parse(Convert.ToString(Math.Floor(zyye / zyye_z * 10000) / 10000));
                    xd_pjbl  = float.Parse(Convert.ToString(Math.Floor(zyye / zyye_z * 10000) / 10000));
                    jcb      = float.Parse(Convert.ToString(Math.Floor(pjczl * pjfj * 100) / 100));
                    insert_s(B_Common, yydh, qymc, xsy_hykh, s_space + fxdr, s_space + fxrb, zyye, zfh, czfs, Convert.ToString(pjczl * 100) + "%", Convert.ToString(xd_pjczl * 100) + "%", pjfj, jcb, Convert.ToString(pjbl * 100) + "%", Convert.ToString(xd_pjbl * 100) + "%", czy, cssj, jssj);
                    ////如果要分析二级情况
                    //if (is_second == true)
                    //{
                    //    sub_sel_con = sel_cond + "and " + xsy_hykh + "='" + DS_temp.Tables[0].Rows[i_0][xsy_hykh].ToString() + "' ";
                    //    bbfx_add_sub(B_Common, DS_temp_0, yydh, qymc, xsy_hykh, fxdr, second_value, sub_sel_con, czfs, zyye, zfs, zyye_z, czy, cssj, jssj, czsj, xxzs);
                    //}
                }
                pjczl = float.Parse(Convert.ToString(Math.Floor(ljczfs / zfs * 10000) / 10000));

                if (ljczfs <= 0)
                {
                    pjfj = 0;
                }
                else
                {
                    pjfj = float.Parse(Convert.ToString(Math.Floor(ljzfh / ljczfs * 100) / 100));
                }
                xd_pjczl = float.Parse(Convert.ToString(Math.Floor(ljczfs / xd_czzfs_out * 10000) / 10000));
                pjbl     = float.Parse(Convert.ToString(Math.Floor(ljzyye / zyye_z * 10000) / 10000));
                xd_pjbl  = float.Parse(Convert.ToString(Math.Floor(ljzyye / zyye_z * 10000) / 10000));
                jcb      = float.Parse(Convert.ToString(Math.Floor(pjczl * pjfj * 100) / 100));
                insert_s(B_Common, yydh, qymc, xsy_hykh, s_space + "合计", s_space + "合计", ljzyye, ljzfh, ljczfs, Convert.ToString(pjczl * 100) + "%", Convert.ToString(xd_pjczl * 100) + "%", pjfj, jcb, Convert.ToString(pjbl * 100) + "%", Convert.ToString(xd_pjbl * 100) + "%", czy, cssj, jssj);
            }
            DS_temp_0.Clear();
            DS_temp_0.Dispose();
            DS_temp.Clear();
            DS_temp.Dispose();
            get_result = common_file.common_app.get_suc;
            return(get_result);
        }
示例#2
0
        /// <summary>
        /// 生成营业部分的最终报表
        /// </summary>
        /// <param name="yydh"></param>
        /// <param name="qymc"></param>
        /// <param name="czy"></param>
        /// <param name="rq"></param>
        /// <param name="czsj"></param>
        /// <param name="xxzs"></param>
        /// <returns></returns>
        public string zhrbb_add_fy_app(string yydh, string qymc, string czy, DateTime rq, DateTime czsj, string xxzs)
        {
            string get_result = common_file.common_app.get_failure;

            string sql_s = "";

            BLL.Common B_Common = new Hotel_app.BLL.Common();
            DataSet    DS_temp;

            //日
            DS_temp = B_Common.GetList("select zfs from BBfx_zfs", "rq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "'");
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                zfs_r = int.Parse(DS_temp.Tables[0].Rows[0]["zfs"].ToString());
            }
            else
            {
                zfs_r = common_bb.get_zfs();
                sql_s = "insert into BBfx_zfs(yydh,qymc,zfs,rq) values('" + yydh + "','" + qymc + "','" + zfs_r + "','" + rq.ToShortDateString() + "')";
                B_Common.ExecuteSql(sql_s);
            }
            sql_s = "delete from Ssyxfmx_bb_ls where czy_temp='" + czy + "'";
            B_Common.ExecuteSql(sql_s);
            sql_s = "delete from BBfx_yyjl where czy_temp='" + czy + "' and y_z_w='" + y_z_w_y + "'";
            B_Common.ExecuteSql(sql_s);

            Ssyxfmx_ls_add(yydh, qymc, rq, rq, czy, czsj);
            zhrbb_add_fy(yydh, qymc, czy, "r", rq);


            //月
            int ybtqts = 0;

            DS_temp = B_Common.GetList("select ybtqts from Qcounter", " id>=0");
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                if (DS_temp.Tables[0].Rows[0]["ybtqts"].ToString() != "")
                {
                    ybtqts = int.Parse(DS_temp.Tables[0].Rows[0]["ybtqts"].ToString());
                }
            }
            zfs_y = zfs_r;

            DateTime yfcssj = common_bb.judge_yfcssj(rq, ybtqts);
            string   sel_s  = " rq between '" + yfcssj.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "'";

            DS_temp = B_Common.GetList("select sum(zfs) as zfs from BBfx_zfs", sel_s);
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                if (DS_temp.Tables[0].Rows[0]["zfs"].ToString() != "")
                {
                    zfs_y = int.Parse(DS_temp.Tables[0].Rows[0]["zfs"].ToString());
                }
            }

            sql_s = "delete from Ssyxfmx_bb_ls where czy_temp='" + czy + "'";
            B_Common.ExecuteSql(sql_s);


            Ssyxfmx_ls_add(yydh, qymc, yfcssj, rq, czy, czsj);
            zhrbb_add_fy(yydh, qymc, czy, "y", rq);

            //把最终结果转移到正式的地方存储
            sql_s = "delete from BBfx_yyjl_last_save where bbrq='" + rq.ToShortDateString() + "' and y_z_w='y'";
            B_Common.ExecuteSql(sql_s);
            sql_s = "insert into BBfx_yyjl_last_save (yydh,qymc,sbzd,xfrb,sjxfje,czy,y_r,y_z_w,bbrq) select yydh,qymc,sbzd,xfrb,sjxfje,'" + czy + "',y_r,y_z_w,'" + rq.ToShortDateString() + "' from BBfx_yyjl where czy_temp='" + czy + "' and bbrq='" + rq.ToShortDateString() + "' and y_z_w='y'";
            B_Common.ExecuteSql(sql_s);

            sql_s   = "";
            DS_temp = B_Common.GetList("select id from BSzhrbbfl", "yydh='" + yydh + "' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "'");
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                sql_s = "update BSzhrbbfl set zfs='" + zfs_fl.ToString() + "',zyye='" + zyye_fl.ToString() + "',zfh='" + zfh_fl.ToString() + "',czfs='" + czfs_fl.ToString() + "',pjczl='" + Convert.ToString(pjczl_fl * 100) + "%" + "',pjfj='" + pjfj_fl.ToString() + "',jcb='" + jcb_fl.ToString() + "',wjds='" + wjds_fl.ToString() + "' where yydh='" + yydh + "' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "'";
            }
            else
            {
                sql_s = "insert into BSzhrbbfl(yydh,qymc,bbrq,zfs,zyye,zfh,czfs,pjczl_nu,pjczl,pjfj,jcb,wjds) values('" + yydh + "','" + qymc + "','" + rq.ToShortDateString() + "','" + zfs_fl.ToString() + "','" + zyye_fl.ToString() + "','" + zfh_fl.ToString() + "','" + czfs_fl.ToString() + "','" + pjczl_fl.ToString() + "','" + Convert.ToString(pjczl_fl * 100) + "%" + "','" + pjfj_fl.ToString() + "','" + jcb_fl.ToString() + "','" + wjds_fl.ToString() + "')";
            }
            if (sql_s != "")
            {
                B_Common.ExecuteSql(sql_s);
            }

            common_file.common_czjl.add_czjl(yydh, qymc, czy, "生成日报表-费用", "", "", czsj);

            DS_temp.Clear();
            DS_temp.Dispose();
            get_result = common_file.common_app.get_suc;
            return(get_result);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="yydh"></param>
        /// <param name="qymc"></param>
        /// <param name="rq"></param>
        /// <param name="czy"></param>
        /// <param name="czsj"></param>
        /// <param name="judge_rx"></param>四个值1生成营业收入,2生成账务收入,3生成未结,4全部
        /// <param name="xxzs"></param>
        /// <returns></returns>
        public string New_zhrbb_app(string yydh, string qymc, DateTime rq, string czy, DateTime czsj, int judge_rx, string xxzs)
        {
            string     get_result     = common_file.common_app.get_failure;
            B_zhrbb_zw B_zhrbb_zw_new = new B_zhrbb_zw();

            switch (judge_rx)
            {
            case 1:
                zhrbb_add_fy_app(yydh, qymc, czy, rq, czsj, xxzs);
                break;

            case 2:

                B_zhrbb_zw_new.zhrbb_zw_app(yydh, qymc, czy, rq, czsj.ToString(), xxzs);
                break;

            case 3:
                B_zhrbb_zw_new.zhrbb_zw_ys_wj_app(yydh, qymc, czy, rq, czsj.ToString(), xxzs);
                break;

            case 4:
                zhrbb_add_fy_app(yydh, qymc, czy, rq, czsj, xxzs);
                B_zhrbb_zw_new.zhrbb_zw_app(yydh, qymc, czy, rq, czsj.ToString(), xxzs);
                B_zhrbb_zw_new.zhrbb_zw_ys_wj_app(yydh, qymc, czy, rq, czsj.ToString(), xxzs);
                break;
            }
            BLL.Common B_Common = new Hotel_app.BLL.Common();
            string     sql_s    = "delete from  BSzhrbb where bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "'";

            B_Common.ExecuteSql(sql_s);

            sql_s = "insert into BSzhrbb(yydh,qymc,bbrq,rbxm,brrj,byrj,rbxm0,brrj0,byrj0) select yydh,qymc,'" + rq.ToShortDateString() + "',xfrb,sjxfje,'','','','' from BBfx_yyjl_last_save where y_z_w='y' and y_r='r' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id";
            B_Common.ExecuteSql(sql_s);

            DataSet DS_temp_yl;
            int     k_0 = 0;

            DS_temp_yl = B_Common.GetList("select id from BSzhrbb", " bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");

            DataSet DS_temp;

            DS_temp = B_Common.GetList("select xfrb,sjxfje from BBfx_yyjl_last_save", " y_z_w='y' and y_r='y' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");
            if (DS_temp_yl != null && DS_temp_yl.Tables[0].Rows.Count > 0 && DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (k_0 = 0; k_0 < DS_temp_yl.Tables[0].Rows.Count; k_0++)
                {
                    if (k_0 < DS_temp.Tables[0].Rows.Count)
                    {
                        if (DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() != "")
                        {
                            sql_s = "update BSzhrbb set byrj='" + DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() + "' where id='" + DS_temp_yl.Tables[0].Rows[k_0]["id"].ToString() + "'";
                            B_Common.ExecuteSql(sql_s);
                        }
                    }
                }
            }


            int k_first = 0;

            DS_temp = B_Common.GetList("select xfrb,sjxfje from BBfx_yyjl_last_save", " (y_z_w='z' ) and y_r='r' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");
            if (DS_temp_yl != null && DS_temp_yl.Tables[0].Rows.Count > 0 && DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (k_0 = 0; k_0 < DS_temp_yl.Tables[0].Rows.Count; k_0++)
                {
                    if (k_0 < DS_temp.Tables[0].Rows.Count)
                    {
                        if (DS_temp.Tables[0].Rows[k_0]["xfrb"].ToString() != "")
                        {
                            sql_s = "update BSzhrbb set rbxm0='" + DS_temp.Tables[0].Rows[k_0]["xfrb"].ToString() + "',brrj0='" + DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() + "' where id='" + DS_temp_yl.Tables[0].Rows[k_0]["id"].ToString() + "'";
                            B_Common.ExecuteSql(sql_s);
                        }
                        k_first = k_first + 1;
                    }
                }
            }



            DS_temp = B_Common.GetList("select xfrb,sjxfje from BBfx_yyjl_last_save", " (y_z_w='w') and y_r='r' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");
            if (DS_temp_yl != null && DS_temp_yl.Tables[0].Rows.Count > 0 && DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (k_0 = 0; k_first < DS_temp_yl.Tables[0].Rows.Count; k_0++)
                {
                    if (k_0 < DS_temp.Tables[0].Rows.Count)
                    {
                        if (DS_temp.Tables[0].Rows[k_0]["xfrb"].ToString() != "")
                        {
                            sql_s = "update BSzhrbb set rbxm0='" + DS_temp.Tables[0].Rows[k_0]["xfrb"].ToString() + "',brrj0='" + DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() + "' where id='" + DS_temp_yl.Tables[0].Rows[k_first]["id"].ToString() + "'";
                            B_Common.ExecuteSql(sql_s);
                        }
                    }
                    k_first = k_first + 1;
                }
            }



            k_first = 0;


            DS_temp = B_Common.GetList("select xfrb,sjxfje from BBfx_yyjl_last_save", " (y_z_w='z') and y_r='y' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");
            if (DS_temp_yl != null && DS_temp_yl.Tables[0].Rows.Count > 0 && DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (k_0 = 0; k_0 < DS_temp_yl.Tables[0].Rows.Count; k_0++)
                {
                    if (k_0 < DS_temp.Tables[0].Rows.Count)
                    {
                        if (DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() != "")
                        {
                            sql_s = "update BSzhrbb set byrj0='" + DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() + "' where id='" + DS_temp_yl.Tables[0].Rows[k_0]["id"].ToString() + "'";
                            B_Common.ExecuteSql(sql_s);
                        }
                        k_first = k_first + 1;
                    }
                }
            }



            DS_temp = B_Common.GetList("select xfrb,sjxfje from BBfx_yyjl_last_save", " (y_z_w='w') and y_r='y' and bbrq between '" + rq.ToShortDateString() + "' and '" + rq.ToShortDateString() + " 23:59:59" + "' order by id");
            if (DS_temp_yl != null && DS_temp_yl.Tables[0].Rows.Count > 0 && DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                for (k_0 = 0; k_first < DS_temp_yl.Tables[0].Rows.Count; k_0++)
                {
                    if (k_0 < DS_temp.Tables[0].Rows.Count)
                    {
                        if (DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() != "")
                        {
                            sql_s = "update BSzhrbb set byrj0='" + DS_temp.Tables[0].Rows[k_0]["sjxfje"].ToString() + "' where id='" + DS_temp_yl.Tables[0].Rows[k_first]["id"].ToString() + "'";
                            B_Common.ExecuteSql(sql_s);
                        }
                    }
                    k_first = k_first + 1;
                }
            }



            common_file.common_czjl.add_czjl(yydh, qymc, czy, "生成日报表-综合", "", "", czsj);
            DS_temp.Clear();
            DS_temp.Dispose();
            get_result = common_file.common_app.get_suc;
            return(get_result);
        }
示例#4
0
        public int F_ftxsfx(string yydh, string qymc, DateTime fxrq, string czy)
        {
            //返回多少个房型涉及到多少个字段
            common_file.common_app.get_czsj();
            int      get_result = 0;
            string   sql_s      = "";
            string   table_name = "VS_syxfmx_cz";
            DateTime cssj_year  = Convert.ToDateTime(fxrq.Year.ToString() + "-01-01");

            BLL.Common B_Common = new Hotel_app.BLL.Common();
            B_Common.ExecuteSql("delete from F_kfxsfx where czy_temp='" + czy + "'");
            DataSet DS_temp;
            int     ybtqts = 0;

            DS_temp = B_Common.GetList("select ybtqts from Qcounter", " id>=0");
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                if (DS_temp.Tables[0].Rows[0]["ybtqts"].ToString() != "")
                {
                    ybtqts = int.Parse(DS_temp.Tables[0].Rows[0]["ybtqts"].ToString());
                }
            }


            DateTime cssj_yf = BBfx.common_bb.judge_yfcssj(fxrq, ybtqts);

            DateTime cssj = Convert.ToDateTime(fxrq.ToShortDateString());
            DateTime jssj = Convert.ToDateTime(fxrq.ToShortDateString() + " 23:59:59");
            DataSet  DS_temp_0;



            //获取总房数
            float zfs = 1;

            DS_temp_0 = B_Common.GetList("select sum(zfs) as zfs from BSzhrbbfl", " yydh='" + yydh + "' and bbrq between '" + cssj + "' and '" + jssj + "'");
            if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
            {
                if (DS_temp_0.Tables[0].Rows[0]["zfs"].ToString() != "")
                {
                    zfs = float.Parse(DS_temp_0.Tables[0].Rows[0]["zfs"].ToString());
                }
            }


            //获取营业额
            string sel_cond_0 = " yydh='" + yydh + "' and xfdr!='" + Szwgl.common_zw.dr_ds + "' and (xfsj between '" + cssj + "' and '" + jssj + "')";
            float  zyye       = 1;

            DS_temp = B_Common.GetList("select sum(sjxfje) as sjxfje from Ssyxfmx", sel_cond_0);
            if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
            {
                if (DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                {
                    zyye = float.Parse(DS_temp.Tables[0].Rows[0]["sjxfje"].ToString());
                }
            }



            DS_temp_0 = B_Common.GetList("select fjrb from Ffjrb", "id>=0 order by id");
            DataSet DS_temp_1   = B_Common.GetList("select distinct fjrb from VS_syxfmx_cz", "id>=0 and fjrb!=''  and xfsj>='" + cssj_year.ToString() + "' and fjrb not in (select distinct fjrb from Ffjrb) order by fjrb");
            int     fjrb_arg_sl = 0;

            if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
            {
                fjrb_arg_sl = fjrb_arg_sl + DS_temp_0.Tables[0].Rows.Count;
            }
            if (DS_temp_1 != null && DS_temp_1.Tables[0].Rows.Count > 0)
            {
                fjrb_arg_sl = fjrb_arg_sl + DS_temp_1.Tables[0].Rows.Count;
            }
            if (fjrb_arg_sl > 0)
            {
                int      i_0      = 0;
                string[] fjrb_arg = new string[fjrb_arg_sl];

                if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp_0.Tables[0].Rows.Count; i_0++)
                    {
                        fjrb_arg[i_0] = DS_temp_0.Tables[0].Rows[i_0]["fjrb"].ToString();
                    }
                }

                if (DS_temp_1 != null && DS_temp_1.Tables[0].Rows.Count > 0)
                {
                    for (int j_0 = 1; j_0 < DS_temp_1.Tables[0].Rows.Count; j_0++)
                    {
                        fjrb_arg[j_0 + i_0] = DS_temp_1.Tables[0].Rows[j_0]["fjrb"].ToString();
                    }
                }
                sql_s = "";

                //获得房类数量
                get_result = fjrb_arg_sl;

                //string  sql_s_0 = "insert into Fkfxsfx (";
                string insert_cs = "yydh,qymc,krly";

                string insert_value = "'" + yydh + "','" + qymc + "',''";
                for (i_0 = 1; i_0 < fjrb_arg_sl + 1; i_0++)
                {
                    insert_cs    = insert_cs + ",fjrb_fs_" + i_0.ToString() + ",fjrb_fy_" + i_0.ToString();
                    insert_value = insert_value + ",'" + fjrb_arg[i_0 - 1] + "','" + fjrb_arg[i_0 - 1] + "'";
                }

                insert_cs    = insert_cs + ",hj_r_fs,hj_r_fy,hj_y_fs,hj_y_fy,hj_n_fs,hj_n_fy,pjczl,pjfj,pjbl,jcb,czy_temp";
                insert_value = insert_value + ",'本日合计','本日合计','本月累计','本月累计','本年累计','本年累计','出租率','平均房价','占比','交叉比','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);

                DS_temp_0 = B_Common.GetList("select krly from Xkrly", "id>=0 order by order_asc,krly");
                DS_temp_1 = B_Common.GetList("select distinct krly from VS_syxfmx_cz", "id>=0 and xfsj>='" + cssj_year.ToString() + "' and krly not in (select distinct krly from Xkrly) order by krly");
                if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp_0.Tables[0].Rows.Count; i_0++)
                    {
                        insert_value = "'" + yydh + "','" + qymc + "','" + DS_temp_0.Tables[0].Rows[i_0]["krly"].ToString() + "'";
                        for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                        {
                            insert_value = insert_value + ",'0'";
                        }
                        insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                        sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                        B_Common.ExecuteSql(sql_s);
                    }
                }

                if (DS_temp_1 != null && DS_temp_1.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp_1.Tables[0].Rows.Count; i_0++)
                    {
                        insert_value = "'" + yydh + "','" + qymc + "','" + DS_temp_1.Tables[0].Rows[i_0]["krly"].ToString() + "'";
                        for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                        {
                            insert_value = insert_value + ",'0'";
                        }
                        insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                        sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                        B_Common.ExecuteSql(sql_s);
                    }
                }

                insert_value = "'" + yydh + "','" + qymc + "','" + "逾时" + "'";
                for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                {
                    insert_value = insert_value + ",'0'";
                }
                insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);


                insert_value = "'" + yydh + "','" + qymc + "','" + "加床" + "'";
                for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                {
                    insert_value = insert_value + ",'0'";
                }
                insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);

                insert_value = "'" + yydh + "','" + qymc + "','" + "本日合计" + "'";
                for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                {
                    insert_value = insert_value + ",'0'";
                }
                insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);

                insert_value = "'" + yydh + "','" + qymc + "','" + "本月累计" + "'";
                for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                {
                    insert_value = insert_value + ",'0'";
                }
                insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);


                insert_value = "'" + yydh + "','" + qymc + "','" + "本年累计" + "'";
                for (int k_0 = 0; k_0 < fjrb_arg_sl * 2; k_0++)
                {
                    insert_value = insert_value + ",'0'";
                }
                insert_value = insert_value + ",'0','0','0','0','0','0','0%','0','0%','0','" + czy + "'";
                sql_s        = "insert into F_kfxsfx (" + insert_cs + ") values (" + insert_value + ")";
                B_Common.ExecuteSql(sql_s);

                //修改数据

                //能找到客人来源的.



                DS_temp = B_Common.GetList("select id,krly,hj_r_fs from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "'");
                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        //排除选到设置进去的表头.
                        if (DS_temp.Tables[0].Rows[i_0]["hj_r_fs"].ToString() != "本日合计" && DS_temp.Tables[0].Rows[i_0]["krly"].ToString() != "逾时" && DS_temp.Tables[0].Rows[i_0]["krly"].ToString() != "加床" && DS_temp.Tables[0].Rows[i_0]["krly"].ToString() != "本日合计" && DS_temp.Tables[0].Rows[i_0]["krly"].ToString() != "本月累计" && DS_temp.Tables[0].Rows[i_0]["krly"].ToString() != "本年累计")
                        {
                            update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, "and (xfxm not in('" + Szwgl.common_zw.ff_jsbtfy + "','" + Szwgl.common_zw.ff_jsqtfy + "','" + Szwgl.common_zw.ff_jcfy + "')) and krly='" + DS_temp.Tables[0].Rows[i_0]["krly"].ToString() + "'");
                            //如果要分出单审的房费把这个启用,其余关闭
                            //update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, "and (xfxm not in('" + Szwgl.common_zw.ff_jsbtfy + "','" + Szwgl.common_zw.ff_jsqtfy + "','" + Szwgl.common_zw.ff_sqff + "','" + Szwgl.common_zw.ff_jcfy + "')) and krly='" + DS_temp.Tables[0].Rows[i_0]["krly"].ToString() + "'");
                        }
                    }
                }



                //逾时的



                DS_temp = B_Common.GetList("select id,krly from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and krly='" + "逾时" + "'");
                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, "and (xfxm in('" + Szwgl.common_zw.ff_jsbtfy + "','" + Szwgl.common_zw.ff_jsqtfy + "'))   ");
                        //如果要分出单审的房费把这个启用,其余关闭
                        //update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, "and (xfxm in('" + Szwgl.common_zw.ff_jsbtfy + "','" + Szwgl.common_zw.ff_jsqtfy + "','" + Szwgl.common_zw.ff_sqff + "'))   ");
                    }
                }



                //加床的



                DS_temp = B_Common.GetList("select id,krly from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and krly='" + "加床" + "'");

                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, "and (xfxm in('" + Szwgl.common_zw.ff_jcfy + "'))   ");
                    }
                }


                //本日的

                DS_temp = B_Common.GetList("select id,krly from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and krly='" + "本日合计" + "'");
                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        update_contain(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, " ");
                    }
                }

                //update_contain_y_n

                //本月的

                DS_temp = B_Common.GetList("select id,krly from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and krly='" + "本月累计" + "'");
                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        update_contain_y_n(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, " and (xfsj between '" + cssj_yf.ToString() + "' and '" + jssj.ToString() + "')");
                    }
                }

                //本年的

                DS_temp = B_Common.GetList("select id,krly from F_kfxsfx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and krly='" + "本年累计" + "'");
                if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                {
                    for (i_0 = 0; i_0 < DS_temp.Tables[0].Rows.Count; i_0++)
                    {
                        update_contain_y_n(yydh, qymc, DS_temp, i_0, B_Common, DS_temp_0, table_name, cssj, jssj, fjrb_arg_sl, fjrb_arg, zfs, zyye, cssj_yf, cssj_year, " and (xfsj between '" + cssj_year.ToString() + "' and '" + jssj.ToString() + "')");
                    }
                }

                B_Common.ExecuteSql("update F_kfxsfx set krly='" + "其他未分类" + "' where krly='' and hj_r_fs<>'本日合计'");//DS_temp.Tables[0].Rows[i_0]["hj_r_fs"].ToString() != "本日合计"
            }
            DS_temp.Clear();
            DS_temp.Dispose();
            DS_temp_0.Clear();
            DS_temp_0.Dispose();
            DS_temp_1.Clear();
            DS_temp_1.Dispose();
            return(get_result);
        }