Beispiel #1
0
        public string Ssyxfmx_ls_add_app(string yydh, string qymc, string czy, string cssj, string jssj, string add_type, string xxzs)
        {
            string s = "";

            BBfx.B_syxfmx_ls_add B_syxfmx_ls_add_new = new B_syxfmx_ls_add();
            s = B_syxfmx_ls_add_new.Ssyxfmx_ls_add_app(yydh, qymc, czy, cssj, jssj, add_type, xxzs);
            return(s);
        }
Beispiel #2
0
        /// <summary>
        /// 挂记账的分析
        /// </summary>
        /// <param name="yydh"></param>
        /// <param name="qymc"></param>
        /// <param name="cssj"></param>
        /// <param name="jssj"></param>
        /// <param name="sel_cond"></param>绑定次条件,例:如果要具体查询某个挂账单位就要在这里绑定" and jzzt like '%'陈志永'%'"
        /// <param name="type"></param>//common_bb里的两个值gz_type = "gz";jz_type = "jz";
        /// <param name="czy"></param>
        /// <param name="czsj"></param>
        /// <param name="xxzs"></param>
        /// <returns></returns>
        public string get_g_j_fx_app(string yydh, string qymc, string cssj, string jssj, string sel_cond, string type, string czy, string czsj, string xxzs)
        {
            string get_result    = common_file.common_app.get_failure;
            string czzt_cond     = "";
            string czzt_cond_bak = "";

            BLL.Common B_Common = new Hotel_app.BLL.Common();
            if (type == BBfx.common_bb.gz_type)
            {
                czzt_cond     = " and (czzt like '%" + common_file_server.common_jzzt.czzt_gz_xg + "%'  and czzt!='" + common_file.common_jzzt.czzt_gzzjz + "')";
                czzt_cond_bak = " and (czzt='" + common_file_server.common_jzzt.czzt_gzzzz + "')";
            }
            else
            if (type == BBfx.common_bb.jz_type)
            {
                czzt_cond     = " and (czzt like '%" + common_file_server.common_jzzt.czzt_jz_xg + "%'  and czzt!='" + common_file.common_jzzt.czzt_jzzgz + "')";
                czzt_cond_bak = " and (czzt='" + common_file_server.common_jzzt.czzt_jzzzz + "')";
            }
            if (czzt_cond != "")
            {
                string sql_s = "delete from BS_g_j_fx where yydh='" + yydh + "' and czy_temp='" + czy + "'";
                B_Common.ExecuteSql(sql_s);

                string sel_cond_fs = " and yydh='" + yydh + "' and czy_temp='" + czy + "' and (tfsj between '" + cssj + "' and '" + jssj + "')";
                if (sel_cond != "")
                {
                    sel_cond_fs = sel_cond_fs + sel_cond;
                }


                string sel_cond_fs_b_c = " and yydh='" + yydh + "' and czy_temp='" + czy + "'  and ((tfsj between '" + cssj + "' and '" + jssj + "') and ((convert(varchar(10),xfsj,120) >convert(varchar(10),tfsj,120))) and (xfzy='" + Szwgl.common_zw.zwcl_bz + "' or xfzy='" + Szwgl.common_zw.zwcl_congz + "'))";
                if (sel_cond != "")
                {
                    sel_cond_fs_b_c = sel_cond_fs_b_c + sel_cond;
                }


                string sel_cond_cz = " and yydh='" + yydh + "'  and czy_temp='" + czy + "' and (czsj between '" + cssj + "' and '" + jssj + "')";
                if (sel_cond != "")
                {
                    sel_cond_cz = sel_cond_cz + sel_cond;
                }

                string xfsj_cod = " and yydh='" + yydh + "'  and czy_temp='" + czy + "' and ((xfsj between '" + cssj + "' and '" + jssj + "') and ((convert(varchar(10),xfsj,120) >convert(varchar(10),tfsj,120))) and (xfzy='" + Szwgl.common_zw.zwcl_bz + "' or xfzy='" + Szwgl.common_zw.zwcl_congz + "'))";
                if (sel_cond != "")
                {
                    xfsj_cod = xfsj_cod + sel_cond;
                }


                string jzzt = "";
                float  zfh = 0; float ds = 0; float qt = 0; float zyye = 0; float zzz = 0;
                float  zgz_zjz = 0; float zsz = 0; float wj = 0;

                float zfh_z = 0; float ds_z = 0; float qt_z = 0; float zyye_z = 0; float zzz_z = 0;
                float zgz_zjz_z = 0; float zsz_z = 0; float wj_z = 0;



                if (type == BBfx.common_bb.gz_type)
                {
                    czzt_cond = " and (czzt like '%" + common_file_server.common_jzzt.czzt_gz_xg + "%'  or czzt='" + common_file.common_jzzt.czzt_gzzzz + "')" + common_file_server.common_jzzt.czzt_like_sz;
                }
                else
                if (type == BBfx.common_bb.jz_type)
                {
                    czzt_cond = " and (czzt like '%" + common_file_server.common_jzzt.czzt_jz_xg + "%'  or  czzt='" + common_file.common_jzzt.czzt_jzzzz + "')" + common_file_server.common_jzzt.czzt_like_sz;
                }
                BBfx.B_syxfmx_ls_add B_syxfmx_ls_add_new = new B_syxfmx_ls_add();
                B_syxfmx_ls_add_new.Sjzmx_or_bak_ls_add_app(yydh, qymc, czy, cssj, jssj, czzt_cond, xxzs);



                int     i_0       = 0;
                DataSet DS_temp   = B_Common.GetList("select distinct jzzt from BS_jzmx_ls", "yydh='" + yydh + "' and id>=0" + czzt_cond);
                DataSet DS_temp_0 = B_Common.GetList("select distinct jzzt from BS_jzmx_bak_ls", "yydh='" + yydh + "' and id>=0" + czzt_cond);
                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 jzzt, ref zfh, ref ds, ref qt, ref zyye, ref zzz, ref zgz_zjz, ref zsz, ref wj);
                        jzzt = DS_temp.Tables[0].Rows[i_0]["jzzt"].ToString();
                        insert_s(B_Common, yydh, qymc, jzzt, type, zfh, ds, qt, zyye, zzz, zgz_zjz, zsz, wj, czy, cssj, jssj);
                    }
                }

                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++)
                    {
                        clear_cs(ref jzzt, ref zfh, ref ds, ref qt, ref zyye, ref zzz, ref zgz_zjz, ref zsz, ref wj);
                        jzzt    = DS_temp_0.Tables[0].Rows[i_0]["jzzt"].ToString();
                        DS_temp = B_Common.GetList("select id from BS_g_j_fx", "jzzt='" + jzzt + "' and yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "'");

                        if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                        {
                        }
                        else
                        {
                            insert_s(B_Common, yydh, qymc, jzzt, type, zfh, ds, qt, zyye, zzz, zgz_zjz, zsz, wj, czy, cssj, jssj);
                        }
                    }
                }



                //查询所有已经有的JZZT
                DataSet DS_temp_jzzt = B_Common.GetList("select distinct jzzt from BS_g_j_fx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "'");
                if (DS_temp_jzzt != null && DS_temp_jzzt.Tables[0].Rows.Count > 0)
                {
                    for (int j_0 = 0; j_0 < DS_temp_jzzt.Tables[0].Rows.Count; j_0++)
                    {
                        //发生额

                        //正常发生
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = " and (czzt like '%" + common_file_server.common_jzzt.czzt_gz_xg + "%'  and czzt!='" + common_file.common_jzzt.czzt_jzzgz + "') and (id_app not in (select id_app from VIEW_S_jzmx_bak_jzzgz where jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "'))";
                            czzt_cond_bak = " and (czzt='" + common_file_server.common_jzzt.czzt_gzzzz + "' or czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = " and (czzt like '%" + common_file_server.common_jzzt.czzt_jz_xg + "%'   and czzt!='" + common_file.common_jzzt.czzt_gzzjz + "') and (id_app not in (select id_app from VIEW_S_jzmx_bak_gzzjz where jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "'))";
                            czzt_cond_bak = " and (czzt='" + common_file_server.common_jzzt.czzt_jzzzz + "' or czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                        }
                        DS_temp = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje from BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and  xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_fs + czzt_cond + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);
                        DS_temp_0 = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_fs + czzt_cond_bak + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp_0, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);



                        //只有把这一步加上才不会对退房后的冲补账多调整
                        DS_temp = B_Common.GetList("select xfdr,-sum(sjxfje) as sjxfje from BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and  xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_fs_b_c + czzt_cond + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);
                        DS_temp_0 = B_Common.GetList("select xfdr,-sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_fs_b_c + czzt_cond_bak + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp_0, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);



                        //记转挂或挂转记而发生

                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = " and (czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                            czzt_cond_bak = " and (czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = " and (czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                            czzt_cond_bak = " and (czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                        }
                        DS_temp = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje from BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and  xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);
                        DS_temp_0 = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond_bak + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp_0, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);



                        ////退房后的冲、补账
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = " and (czzt = '" + common_file.common_jzzt.czzt_gzzjz + "' or czzt = '" + common_file.common_jzzt.czzt_gzfj + "' or czzt = '" + common_file.common_jzzt.czzt_gzzsz + "' or czzt = '" + common_file.common_jzzt.czzt_gz + "')";
                            czzt_cond_bak = " and (czzt = '" + common_file.common_jzzt.czzt_gzzzz + "') ";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = " and (czzt = '" + common_file.common_jzzt.czzt_jzzgz + "' or czzt = '" + common_file.common_jzzt.czzt_jzfj + "' or czzt = '" + common_file.common_jzzt.czzt_jzzsz + "' or czzt = '" + common_file.common_jzzt.czzt_jz + "') ";
                            czzt_cond_bak = "  and (czzt = '" + common_file.common_jzzt.czzt_jzzzz + "') ";
                        }
                        DS_temp = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje from BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and  xfdr<>'" + common_file.common_app.fkdr + "'" + xfsj_cod + czzt_cond + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);
                        DS_temp_0 = B_Common.GetList("select xfdr,sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + xfsj_cod + czzt_cond_bak + "group by xfdr order by xfdr");
                        add_fs(B_Common, DS_temp_0, yydh, qymc, czy, cssj, jssj, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), ref zfh_z, ref ds_z, ref qt_z, ref zyye_z);



                        //转在住
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = " ";
                            czzt_cond_bak = "and (czzt='" + common_file.common_jzzt.czzt_gzzzz + "')";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = " ";
                            czzt_cond_bak = "and (czzt='" + common_file.common_jzzt.czzt_jzzzz + "')";
                        }

                        DS_temp_0 = B_Common.GetList("select sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond_bak);
                        if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                        {
                            if (DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                            {
                                zzz_z = zzz_z + float.Parse(DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString());
                                update_s(B_Common, " set zzz=zzz+'" + DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() + "' ", yydh, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), czy, cssj, jssj);
                            }
                        }

                        //转记账或转挂账
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                            czzt_cond_bak = "and (czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                            czzt_cond_bak = "and (czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                        }


                        DS_temp = B_Common.GetList("select sum(sjxfje) as sjxfje From BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond);
                        if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                        {
                            if (DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                            {
                                zgz_zjz_z = zgz_zjz_z + float.Parse(DS_temp.Tables[0].Rows[0]["sjxfje"].ToString());
                                update_s(B_Common, " set zgz_zjz=zgz_zjz+'" + DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() + "' ", yydh, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), czy, cssj, jssj);
                            }
                        }


                        DS_temp_0 = B_Common.GetList("select sum(sjxfje) as sjxfje From BS_jzmx_bak_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond_bak);
                        if (DS_temp_0 != null && DS_temp_0.Tables[0].Rows.Count > 0)
                        {
                            if (DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                            {
                                zgz_zjz_z = zgz_zjz_z + float.Parse(DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString());
                                update_s(B_Common, " set zgz_zjz=zgz_zjz+'" + DS_temp_0.Tables[0].Rows[0]["sjxfje"].ToString() + "' ", yydh, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), czy, cssj, jssj);
                            }
                        }


                        //转结账
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_gzzsz + "' or czzt='" + common_file.common_jzzt.czzt_gzfj + "')";
                            czzt_cond_bak = "";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_jzzsz + "' or czzt='" + common_file.common_jzzt.czzt_jzfj + "')";
                            czzt_cond_bak = "";
                        }


                        DS_temp = B_Common.GetList("select sum(sjxfje) as sjxfje From BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond);
                        if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                        {
                            if (DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                            {
                                zsz_z = zsz_z + float.Parse(DS_temp.Tables[0].Rows[0]["sjxfje"].ToString());
                                update_s(B_Common, " set zsz=zsz+'" + DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() + "' ", yydh, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), czy, cssj, jssj);
                            }
                        }



                        //未结
                        if (type == BBfx.common_bb.gz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_gz + "' or czzt='" + common_file.common_jzzt.czzt_jzzgz + "')";
                            czzt_cond_bak = "";
                        }
                        else
                        if (type == BBfx.common_bb.jz_type)
                        {
                            czzt_cond     = "and (czzt='" + common_file.common_jzzt.czzt_jz + "' or czzt='" + common_file.common_jzzt.czzt_gzzjz + "')";
                            czzt_cond_bak = "";
                        }


                        DS_temp = B_Common.GetList("select sum(sjxfje) as sjxfje From BS_jzmx_ls", "jzzt='" + DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString() + "' and   xfdr<>'" + common_file.common_app.fkdr + "'" + sel_cond_cz + czzt_cond);
                        if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                        {
                            if (DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() != "")
                            {
                                wj_z = wj_z + float.Parse(DS_temp.Tables[0].Rows[0]["sjxfje"].ToString());
                                update_s(B_Common, " set wj=wj+'" + DS_temp.Tables[0].Rows[0]["sjxfje"].ToString() + "' ", yydh, DS_temp_jzzt.Tables[0].Rows[j_0]["jzzt"].ToString(), czy, cssj, jssj);
                            }
                        }
                    }


                    string id = "";
                    DS_temp = B_Common.GetList("select max(id) as id from BS_g_j_fx", " yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "'");
                    if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0)
                    {
                        id = DS_temp.Tables[0].Rows[0]["id"].ToString();
                    }
                    sql_s = "insert into BS_g_j_fx( yydh, qymc, jzzt, type, zfh, ds, qt, zyye, zzz, zgz_zjz, zsz, wj, czy_temp, cssj, jssj)";
                    sql_s = sql_s + "select  yydh, qymc, jzzt, type, zfh, ds, qt, zyye, zzz, zgz_zjz, zsz, wj, czy_temp, cssj, jssj from BS_g_j_fx where  yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "' order by zyye desc";
                    B_Common.ExecuteSql(sql_s);
                    sql_s = "delete from BS_g_j_fx where  yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "' and id<='" + id + "'";
                    B_Common.ExecuteSql(sql_s);
                    sql_s = "update BS_g_j_fx set jzzt='" + "其他" + "' where  yydh='" + yydh + "' and czy_temp='" + czy + "' and cssj='" + cssj + "' and jssj='" + jssj + "' and jzzt='" + "" + "'";
                    B_Common.ExecuteSql(sql_s);
                    insert_s(B_Common, yydh, qymc, "合计", type, zfh_z, ds_z, qt_z, zyye_z, zzz_z, zgz_zjz_z, zsz_z, wj_z, czy, cssj, jssj);


                    //sql_s = "delete from  BS_g_j_fx  where  yydh='" + yydh + "' and czy_temp='" + czy + "' and (zfh=0 and ds=0 and qt=0 and zyye=0 and zzz=0 and zgz_zjz=0 and zsz=0 and wj=0)";
                    //B_Common.ExecuteSql(sql_s);
                }


                DS_temp.Clear();
                DS_temp_0.Clear();
                DS_temp_jzzt.Clear();
                DS_temp.Dispose();
                DS_temp_0.Dispose();
                DS_temp_jzzt.Dispose();
            }
            get_result = common_file.common_app.get_suc;
            return(get_result);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="yydh"></param>
        /// <param name="qymc"></param>
        /// <param name="xsy_krly_xydw"></param>一级分析字段,如三个值分析到底是销售员xsy;客人来源krly;协议单位xydw,从common_bb获取,一定要字段的名称(也允许分析其他字段如片区、省份)
        /// <param name="xsy_krly_xydw_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(string yydh, string qymc, string xsy_krly_xydw, string xsy_krly_xydw_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_krly_xydw_value != "")
            {
                sel_cond = sel_cond + " and " + xsy_krly_xydw + " like '%" + xsy_krly_xydw_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_krly_xydw + "'";

            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_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();

            B_syxfmx_ls_add_new.Ssyxfmx_ls_add_app(yydh, qymc, czy, cssj, jssj, xsy_krly_xydw, xxzs);

            int i_0 = 0;

            DS_temp = B_Common.GetList("select " + xsy_krly_xydw + ",sum(sjxfje) as sjxfje from BQ_syxfmx_ls", sel_cond + " group by " + xsy_krly_xydw + " 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_krly_xydw].ToString() != "")
                    {
                        fxdr = DS_temp.Tables[0].Rows[i_0][xsy_krly_xydw].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_ls", sel_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + xsy_krly_xydw + "='" + DS_temp.Tables[0].Rows[i_0][xsy_krly_xydw].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_ls", sel_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + xsy_krly_xydw + "='" + DS_temp.Tables[0].Rows[i_0][xsy_krly_xydw].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_krly_xydw, 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_krly_xydw + "='" + DS_temp.Tables[0].Rows[i_0][xsy_krly_xydw].ToString() + "' ";
                        bbfx_add_sub(B_Common, DS_temp_0, yydh, qymc, xsy_krly_xydw, 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_krly_xydw, 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);
        }