/// <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); }
/// <summary>获得可用房数量 /// /// </summary> /// <param name="yd_dj"></param> /// <param name="ddsj_temp"></param> /// <param name="lksj_temp"></param> /// <param name="fjrb_temp"></param> /// <param name="is_lksj"></param>//是否包含离开时间包含就不要排除当日预离房,如果不包含就排除当日预离房 ///<param name="is_contain_wx"></param>//是否包含维修(就是说维修时还可排给预订房,但在维修房绝对不能排给登记)TRUE维修房可用,FALSE维修房不能用 /// <param name="ylsl"></param>//如果是修改要把原来的数量输入到这边,如果新增这个值就为0 /// <param name="xzsl"></param>//现在要预订或入住的数量。 /// <returns></returns> public static float get_fjzt_sl_canused(string yd_dj, DateTime ddsj_temp, DateTime lksj_temp, string fjrb_temp, bool is_lksj, bool is_contain_wx, float ylsl, float xzsl) { BLL.Common B_Common = new BLL.Common(); string select_strwhere = "(1=1) "; string ddsj_temp_0 = ddsj_temp.ToShortDateString(); string lksj_temp_0 = lksj_temp.ToShortDateString() + " " + "23:59:59"; DataSet DS_temp; if (fjrb_temp.Trim() != "") { DS_temp = B_Common.GetList("select count(*) as fs from Ffjzt", "fjrb='" + fjrb_temp + "'" + common_file.common_app.yydh_select); } else { DS_temp = B_Common.GetList("select count(*) as fs from Ffjzt", "id>=0" + common_file.common_app.yydh_select); } float zfs = 0; float zysl = 0; float kyfs = 0; if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { zfs = int.Parse(DS_temp.Tables[0].Rows[0]["fs"].ToString()); } string fjrb_fjbh_select = ""; string fjrb_fjbh = ""; if (fjrb_temp.Trim() != "") { fjrb_fjbh = " and (fjrb='" + fjrb_temp + "')"; } if (is_contain_wx == false) { fjrb_fjbh_select = fjrb_fjbh + " and (Zyzt ='" + common_file.common_fjzt.wxf + " 'and Zyzt='" + common_file.common_fjzt.qtf + "')";//用于维修房 } else { fjrb_fjbh_select = fjrb_fjbh + " and (Zyzt='" + common_file.common_fjzt.qtf + "')";//用于其它房(其它房不管是在预订还是在登记的时候都要排除掉) } string wx_select_condition = " and ((ddsj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (ddsj<'" + ddsj_temp_0 + "' and lksj>'" + lksj_temp_0 + "') or (lksj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "'))"; if (is_lksj == false)//false 时离开时间也是不可用,但TRUE时离开那一天可用 { select_strwhere = " (id>=0 and fjrb<>''" + common_file.common_app.yydh_select + ")" + wx_select_condition + fjrb_fjbh_select; DS_temp = B_Common.GetList("select count(*) as sl from Fwx_other", select_strwhere); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { if (DS_temp.Tables[0].Rows[0]["sl"].ToString() != "") { zysl = float.Parse(DS_temp.Tables[0].Rows[0]["sl"].ToString()); } } select_strwhere = " (id>=0 and lzfs>0 and fjrb<>''" + common_file.common_app.yydh_select + ")" + wx_select_condition + fjrb_fjbh; DS_temp = B_Common.GetList("select sum(lzfs) as sl from VIEW_Qfjrb_fs_tj", select_strwhere); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { if (DS_temp.Tables[0].Rows[0]["sl"].ToString() != "") { zysl = zysl + float.Parse(DS_temp.Tables[0].Rows[0]["sl"].ToString()); } } } else//if (is_lksj == false)//false 时离开时间也是不可用,但TRUE时离开那一天可用 { select_strwhere = " (id>=0 and fjrb<>''" + common_file.common_app.yydh_select + ")" + wx_select_condition + fjrb_fjbh_select; DS_temp = B_Common.GetList("select count(*) as sl from Fwx_other", select_strwhere); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { if (DS_temp.Tables[0].Rows[0]["sl"].ToString() != "") { zysl = float.Parse(DS_temp.Tables[0].Rows[0]["sl"].ToString()); } } string dj_select_condition = ""; // //dj_select_condition = " and ((CONVERT(varchar(10),ddsj, 120) between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (CONVERT(varchar(10),ddsj, 120) <'" + ddsj_temp_0 + "' and CONVERT(varchar(10),lksj, 120)>'" + lksj_temp_0 + "') or (CONVERT(varchar(10),lksj, 120) between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "'))"; string ddsj_cs = ddsj_temp.ToShortDateString(); string ddsj_js = ddsj_temp.ToShortDateString() + " " + "23:59:59"; string lksj_cs = lksj_temp.ToShortDateString(); string lksj_js = lksj_temp.ToShortDateString() + " " + "23:59:59"; if (ddsj_temp.ToShortDateString() != lksj_temp.ToShortDateString()) { dj_select_condition = " and (((ddsj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (ddsj<'" + ddsj_temp_0 + "' and lksj>'" + lksj_temp_0 + "') or (lksj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "')) and (lsbh not in (select lsbh from VIEW_Qfjrb_fs_tj where (ddsj between '" + lksj_cs + "' and '" + lksj_js + "' and lksj>='" + lksj_cs + "') or (lksj between '" + ddsj_cs + "' and '" + ddsj_js + "' and ddsj<='" + ddsj_js + "') )) )"; } else { //dj_select_condition = " and (((ddsj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (ddsj<'" + ddsj_temp_0 + "' and lksj>'" + lksj_temp_0 + "') or (lksj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "')) and (lsbh not in (select lsbh from VIEW_Qfjrb_fs_tj where ((ddsj between '" + lksj_cs + "' and '" + lksj_js + "' and lksj>='" + lksj_cs + "') or (lksj between '" + ddsj_cs + "' and '" + ddsj_js + "' and ddsj<='" + ddsj_js + "')) and (CONVERT(varchar(10),ddsj, 120)=CONVERT(varchar(10),lksj, 120)) )) )"; dj_select_condition = " and (((ddsj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (ddsj<'" + ddsj_temp_0 + "' and lksj>'" + lksj_temp_0 + "') or (lksj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "')) and (lsbh not in (select lsbh from VIEW_Qfjrb_fs_tj where ((ddsj between '" + lksj_cs + "' and '" + lksj_js + "' and lksj>='" + lksj_cs + "') or (lksj between '" + ddsj_cs + "' and '" + ddsj_js + "' and ddsj<='" + ddsj_js + "')) )) )"; } //dj_select_condition = " and (((ddsj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "') or (ddsj<'" + ddsj_temp_0 + "' and lksj>'" + lksj_temp_0 + "') or (lksj between '" + ddsj_temp_0 + "' and '" + lksj_temp_0 + "')) and ((lsbh not in(select lsbh from VIEW_Qfjrb_fs_tj where ddsj between '" + lksj_cs + "' and '" + lksj_js + "' and lksj>='" + lksj_cs + "')) and ((lsbh not in(select lsbh from VIEW_Qfjrb_fs_tj where lksj between '" + ddsj_cs + "' and '" + ddsj_js + "' and ddsj<='" + ddsj_js + "')))))"; select_strwhere = " (id>=0 and lzfs>0 and fjrb<>'' " + common_file.common_app.yydh_select + ")" + dj_select_condition + fjrb_fjbh; DS_temp = B_Common.GetList("select sum(lzfs) as sl from VIEW_Qfjrb_fs_tj", select_strwhere); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { if (DS_temp.Tables[0].Rows[0]["sl"].ToString() != "") { zysl = zysl + float.Parse(DS_temp.Tables[0].Rows[0]["sl"].ToString()); } } } kyfs = zfs + ylsl - xzsl - zysl; DS_temp.Dispose(); return(kyfs); }
/// <summary> /// 二级分析 /// </summary> /// <param name="B_Common"></param> /// <param name="DS_temp_0"></param> /// <param name="yydh"></param> /// <param name="qymc"></param> /// <param name="xsy_krly_xydw"></param> /// <param name="xsy_krly_xydw_value"></param> /// <param name="second_value"></param> /// <param name="parent_cond"></param> /// <param name="xd_czzfs"></param> /// <param name="zfs"></param> /// <param name="czy"></param> /// <param name="cssj"></param> /// <param name="jssj"></param> /// <param name="czsj"></param> /// <param name="xxzs"></param> public void bbfx_add_sub(BLL.Common B_Common, DataSet DS_temp_0, string yydh, string qymc, string xsy_krly_xydw, string xsy_krly_xydw_value, string second_value, string parent_cond, float xd_czzfs, float xd_zyye_z, float zfs, float zyye_z, string czy, string cssj, string jssj, DateTime czsj, string xxzs) { string fxdr = ""; string fxrb = ""; float zyye = 0; float zfh = 0; float czfs = 0; float pjczl = 0; float xd_pjczl = 0; float pjfj = 0; float jcb = 0; float pjbl = 0; float xd_pjbl = 0; //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; DataSet DS_temp; DS_temp = B_Common.GetList("select " + second_value + ",sum(sjxfje) as sjxfje from BQ_syxfmx_ls", parent_cond + " group by " + second_value + " 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][second_value].ToString() != "") { fxdr = DS_temp.Tables[0].Rows[i_0][second_value].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", parent_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + second_value + "='" + DS_temp.Tables[0].Rows[i_0][second_value].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", parent_cond + " and xfdr='" + Szwgl.common_zw.dr_ff + "' and " + second_value + "='" + DS_temp.Tables[0].Rows[i_0][second_value].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)); } pjczl = float.Parse(Convert.ToString(Math.Floor(czfs / zfs * 10000) / 10000)); //pjfj = float.Parse(Convert.ToString(Math.Floor(zfh / czfs * 100) / 100)); xd_pjczl = float.Parse(Convert.ToString(Math.Floor(czfs / xd_czzfs * 10000) / 10000)); //jcb = pjczl * pjfj; pjbl = float.Parse(Convert.ToString(Math.Floor(zyye / zyye_z * 10000) / 10000)); xd_pjbl = float.Parse(Convert.ToString(Math.Floor(zyye / xd_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 + xsy_krly_xydw_value, b_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); } } DS_temp.Clear(); DS_temp.Dispose(); }
public string Qskdj_add_edit_delete(string id, string yydh, string qymc, string lsbh, string ddbh, string hykh, string hyrx, string krxm, string tlkr, string krgj, string krmz, string yxzj, string zjhm, string krxb, string krsr, string krdh, string krsj, string krEmail, string krdz, string krjg, string krdw, string krzy, string cxmd, string qzrx, string qzhm, string zjyxq, string tlyxq, string tjrq, string lzka, string krly, string xyh, string xydw, string xsy, string ddrx, string ddwz, string zyzt, string krrx, string kr_children, string ddsj, string lzts, string lksj, string qtyq, string czy, string czsj, string cznr, string sktt, string yddj, string main_sec, string yddj_rx, string syzd, string vip_type, string tsyq, string add_edit_delete, string xxzs, string ddly, string hykh_bz) { string s = common_file.common_app.get_failure; BLL.Qskyd_mainrecord B_Qskyd_mainrecord = new Hotel_app.BLL.Qskyd_mainrecord(); Model.Qskyd_mainrecord M_Qskyd_mainrecord = new Hotel_app.Model.Qskyd_mainrecord(); BLL.Qskyd_mainrecord_new B_Qskyd_mainrecord_new = new Hotel_app.BLL.Qskyd_mainrecord_new(); BLL.Ffjzt B_Ffjzt = new Hotel_app.BLL.Ffjzt(); Model.Ffjzt M_Ffjzt = new Hotel_app.Model.Ffjzt(); BLL.Qskyd_fjrb B_Qskyd_fjrb = new Hotel_app.BLL.Qskyd_fjrb(); Model.Qskyd_fjrb M_Qskyd_fjrb = new Hotel_app.Model.Qskyd_fjrb(); BLL.Common B_Common = new Hotel_app.BLL.Common(); if (add_edit_delete == common_file.common_app.get_add) { if (main_sec == common_file.common_app.main_sec_sec) { M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(int.Parse(id)); } M_Qskyd_mainrecord.yydh = yydh; M_Qskyd_mainrecord.qymc = qymc; M_Qskyd_mainrecord.syzd = syzd; M_Qskyd_mainrecord.lsbh = lsbh; M_Qskyd_mainrecord.ddbh = ddbh; M_Qskyd_mainrecord.hykh = hykh; M_Qskyd_mainrecord.hyrx = hyrx; M_Qskyd_mainrecord.krxm = krxm; M_Qskyd_mainrecord.tlkr = tlkr; M_Qskyd_mainrecord.krgj = krgj; M_Qskyd_mainrecord.krmz = krmz; M_Qskyd_mainrecord.yxzj = yxzj; M_Qskyd_mainrecord.zjhm = zjhm; M_Qskyd_mainrecord.krxb = krxb; M_Qskyd_mainrecord.krsr = Convert.ToDateTime(krsr); M_Qskyd_mainrecord.krdh = krdh; M_Qskyd_mainrecord.krsj = krsj; M_Qskyd_mainrecord.krEmail = krEmail; M_Qskyd_mainrecord.krdz = krdz; M_Qskyd_mainrecord.krjg = krjg; M_Qskyd_mainrecord.krdw = krdw; M_Qskyd_mainrecord.krzy = krzy; M_Qskyd_mainrecord.cxmd = cxmd; M_Qskyd_mainrecord.qzrx = qzrx; M_Qskyd_mainrecord.qzhm = qzhm; M_Qskyd_mainrecord.zjyxq = Convert.ToDateTime(zjyxq); M_Qskyd_mainrecord.tlyxq = Convert.ToDateTime(tlyxq); M_Qskyd_mainrecord.tjrq = Convert.ToDateTime(tjrq); M_Qskyd_mainrecord.czy = czy; M_Qskyd_mainrecord.czsj = Convert.ToDateTime(czsj); M_Qskyd_mainrecord.cznr = cznr; M_Qskyd_mainrecord.main_sec = main_sec; M_Qskyd_mainrecord.vip_type = vip_type; M_Qskyd_mainrecord.hykh_bz = hykh_bz; M_Qskyd_mainrecord.krrx = krrx; string krrx_0 = get_htk(krxm, zjhm); if (krrx_0 != "") { M_Qskyd_mainrecord.krrx = krrx_0; } if (main_sec == common_file.common_app.main_sec_main) { M_Qskyd_mainrecord.lzka = lzka; M_Qskyd_mainrecord.krly = krly; if (krly == "") { string krly_0 = get_hy(hykh); if (krly_0 != "") { M_Qskyd_mainrecord.krly = krly_0; } } M_Qskyd_mainrecord.xyh = xyh; M_Qskyd_mainrecord.xydw = xydw; M_Qskyd_mainrecord.xsy = xsy; M_Qskyd_mainrecord.ddrx = ddrx; M_Qskyd_mainrecord.ddwz = ddwz; M_Qskyd_mainrecord.zyzt = zyzt; M_Qskyd_mainrecord.kr_children = Convert.ToInt32(kr_children); M_Qskyd_mainrecord.ddsj = Convert.ToDateTime(ddsj); M_Qskyd_mainrecord.lzts = Convert.ToInt32(lzts); M_Qskyd_mainrecord.lksj = Convert.ToDateTime(lksj); M_Qskyd_mainrecord.qtyq = qtyq; M_Qskyd_mainrecord.sktt = sktt; M_Qskyd_mainrecord.yddj = yddj; M_Qskyd_mainrecord.tsyq = tsyq; M_Qskyd_mainrecord.ddly = ddly; } B_Qskyd_mainrecord.Add(M_Qskyd_mainrecord); { if (main_sec == common_file.common_app.main_sec_main) { Q_ff_xyxf Q_ff_xyxf_new = new Q_ff_xyxf(); Q_ff_xyxf_new.Qyddj_otherfee_add(yydh, qymc, lsbh, krxm, sktt, "", czy); } } s = common_file.common_app.get_suc; } else if (add_edit_delete == common_file.common_app.get_edit) { //M_Qskyd_mainrecord.id = int.Parse(id); M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(int.Parse(id)); DateTime ddsj_temp = M_Qskyd_mainrecord.ddsj; DateTime lksj_temp = M_Qskyd_mainrecord.lksj; string krxm_temp = M_Qskyd_mainrecord.krxm; DataSet DS_temp; string fjbh_temp = ""; DS_temp = B_Qskyd_fjrb.GetList("lsbh='" + M_Qskyd_mainrecord.lsbh + "'"); if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { fjbh_temp = DS_temp.Tables[0].Rows[0]["fjbh"].ToString(); if (fjbh_temp != "") { //这边要判断是否有一间房间,两个主单的情况,另外如抵离时间有变动,房态里的抵离时间也要跟着变动 if (yddj == common_file.common_yddj.yddj_yd) { if (ddsj_temp != DateTime.Parse(ddsj)) { //清除 if (ddsj_temp >= DateTime.Now.Date && ddsj_temp < DateTime.Now.Date.AddDays(1)) { //清除预订 Qyddj.Qskyd_fjrb_add_edit_delete Qskyd_fjrb_add_edit_delete_new = new Qskyd_fjrb_add_edit_delete(); s = Qskyd_fjrb_add_edit_delete_new.clear_old_yd_fjzt(fjbh_temp, M_Qskyd_mainrecord.ddsj, M_Qskyd_mainrecord.lksj, DateTime.Parse(czsj), czy, xxzs); } B_Common.ExecuteSql("update Qskyd_mainrecord set ddsj='" + ddsj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "')"); //B_Common.ExecuteSql("update Qskyd_fjrb set ddsj='" + ddsj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "')"); //判断新的预订是否要改房态 if (DateTime.Parse(ddsj) >= DateTime.Now.Date && DateTime.Parse(ddsj) < DateTime.Now.Date.AddDays(1)) { Qyddj.Qskyd_fjrb_add_edit_delete Qskyd_fjrb_add_edit_delete_new = new Qskyd_fjrb_add_edit_delete(); Qskyd_fjrb_add_edit_delete_new.add_fjbh_yd_fjzt(M_Qskyd_mainrecord.lsbh, fjbh_temp, M_Qskyd_mainrecord.sktt, DateTime.Parse(czsj), czy, xxzs); } } if (lksj_temp != DateTime.Parse(lksj)) { string s_temp = "update Qskyd_mainrecord set lksj='" + lksj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj + "' and lksj='" + lksj_temp + "')"; B_Common.ExecuteSql(s_temp); //B_Common.ExecuteSql("update Qskyd_fjrb set lksj='" + lksj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "')"); s_temp = "update Ffjzt set yd_lksj='" + lksj + "',czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh_temp + "' and yd_ddsj='" + ddsj + "' and yd_lksj='" + lksj_temp + "'"; B_Common.ExecuteSql(s_temp); } } else if (yddj == common_file.common_yddj.yddj_dj) { if (lksj_temp != DateTime.Parse(lksj)) { B_Common.ExecuteSql("update Qskyd_mainrecord set lksj='" + lksj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "')"); // B_Common.ExecuteSql("update Qskyd_fjrb set lksj='" + lksj + "',shsc=0,czsj='" + czsj + "' where lsbh in(select lsbh from View_Qskzd where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "')"); B_Common.ExecuteSql("update Ffjzt set lksj='" + lksj + "',czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh_temp + "' and ddsj='" + ddsj_temp + "' and lksj='" + lksj_temp + "'"); } } } } DS_temp.Dispose(); M_Qskyd_mainrecord.yydh = yydh; M_Qskyd_mainrecord.qymc = qymc; M_Qskyd_mainrecord.lsbh = lsbh; M_Qskyd_mainrecord.ddbh = ddbh; M_Qskyd_mainrecord.hykh = hykh; M_Qskyd_mainrecord.hyrx = hyrx; M_Qskyd_mainrecord.krxm = krxm; M_Qskyd_mainrecord.tlkr = tlkr; M_Qskyd_mainrecord.krgj = krgj; M_Qskyd_mainrecord.krmz = krmz; M_Qskyd_mainrecord.yxzj = yxzj; M_Qskyd_mainrecord.zjhm = zjhm; M_Qskyd_mainrecord.krxb = krxb; M_Qskyd_mainrecord.krsr = Convert.ToDateTime(krsr); M_Qskyd_mainrecord.krdh = krdh; if (M_Qskyd_mainrecord.ddyy != common_file.common_app.ydzx_flag) { M_Qskyd_mainrecord.xsy = xsy; M_Qskyd_mainrecord.xyh = xyh; M_Qskyd_mainrecord.xydw = xydw; M_Qskyd_mainrecord.krly = krly; } //if(M_Qskyd_mainrecord.ddyy != common_file.common_app.ydzx_flage&&M_Qskyd_mainrecord.krly != common_file.common_app.krly_xydw_flage) //{ // M_Qskyd_mainrecord.xsy = xsy; // } M_Qskyd_mainrecord.krsj = krsj; M_Qskyd_mainrecord.krEmail = krEmail; M_Qskyd_mainrecord.krdz = krdz; M_Qskyd_mainrecord.krjg = krjg; M_Qskyd_mainrecord.krdw = krdw; M_Qskyd_mainrecord.krzy = krzy; M_Qskyd_mainrecord.cxmd = cxmd; M_Qskyd_mainrecord.qzrx = qzrx; M_Qskyd_mainrecord.qzhm = qzhm; M_Qskyd_mainrecord.zjyxq = Convert.ToDateTime(zjyxq); M_Qskyd_mainrecord.tlyxq = Convert.ToDateTime(tlyxq); M_Qskyd_mainrecord.tjrq = Convert.ToDateTime(tjrq); M_Qskyd_mainrecord.lzka = lzka; if (krly == "") { string krly_0 = get_hy(hykh); if (krly_0 != "") { M_Qskyd_mainrecord.krly = krly_0; } } M_Qskyd_mainrecord.ddrx = ddrx; M_Qskyd_mainrecord.ddwz = ddwz; M_Qskyd_mainrecord.zyzt = zyzt; M_Qskyd_mainrecord.krrx = krrx; string krrx_0 = get_htk(krxm, zjhm); if (krrx_0 != "") { M_Qskyd_mainrecord.krrx = krrx_0; } M_Qskyd_mainrecord.kr_children = Convert.ToInt32(kr_children); if (M_Qskyd_mainrecord.yddj != common_file.common_yddj.yddj_dj) { M_Qskyd_mainrecord.ddsj = Convert.ToDateTime(ddsj); } M_Qskyd_mainrecord.lzts = Convert.ToInt32(lzts); M_Qskyd_mainrecord.lksj = Convert.ToDateTime(lksj); M_Qskyd_mainrecord.qtyq = qtyq; M_Qskyd_mainrecord.czy = czy; M_Qskyd_mainrecord.czsj = Convert.ToDateTime(czsj); M_Qskyd_mainrecord.cznr = cznr; //M_Qskyd_mainrecord.sktt = sktt; //M_Qskyd_mainrecord.yddj = yddj; //M_Qskyd_mainrecord.main_sec = main_sec; M_Qskyd_mainrecord.vip_type = vip_type; M_Qskyd_mainrecord.tsyq = tsyq; M_Qskyd_mainrecord.ddly = ddly; M_Qskyd_mainrecord.hykh_bz = hykh_bz; //common_file.common_Qskyd_mainrecord.PlInter(int.Parse(id), "修改");//删除前批量添加到备份表里 B_Qskyd_mainrecord_new.Pladd(int.Parse(id), common_file.common_app.chinese_edit, "", czy, czsj, "xg", ""); B_Qskyd_mainrecord.Update(M_Qskyd_mainrecord); fjbh_temp = ""; string shlf_temp = "0"; bool shlf0 = common_file.common_fjzt.Islf(M_Qskyd_mainrecord.lsbh); if (shlf0 == true) { shlf_temp = "1"; } string shts_temp = "0"; bool shts0 = common_file.common_fjzt.Ists(M_Qskyd_mainrecord.lsbh); if (shts0 == true) { shts_temp = "1"; } string shvip_temp = "0"; bool shvip0 = common_file.common_fjzt.IsVIP(M_Qskyd_mainrecord.lsbh); if (shvip0 == true) { shvip_temp = "1"; } string fjbm_temp = "0"; bool fjbm0 = common_file.common_fjzt.Isbm(M_Qskyd_mainrecord.lsbh); if (fjbm0 == true) { fjbm_temp = "1"; } string krxm0 = M_Qskyd_mainrecord.krxm; if (DS_temp != null && DS_temp.Tables[0].Rows.Count > 0) { fjbh_temp = DS_temp.Tables[0].Rows[0]["fjbh"].ToString(); if (yddj == common_file.common_yddj.yddj_dj) { B_Common.ExecuteSql("update Ffjzt set krxm='" + krxm0 + "',shlf='" + shlf_temp + "',shts='" + shts_temp + "',shvip='" + shvip_temp + "',fjbm='" + fjbm_temp + "',czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh_temp + "'"); } else if (yddj == common_file.common_yddj.yddj_yd) { B_Common.ExecuteSql("update Ffjzt set krxm='" + krxm0 + "',shlf='" + shlf_temp + "',shts='" + shts_temp + "',shvip='" + shvip_temp + "',fjbm='" + fjbm_temp + "',czsj='" + DateTime.Now.ToString() + "' where fjbh='" + fjbh_temp + "' and yd_ddsj='" + M_Qskyd_mainrecord.ddsj + "' and yd_lksj='" + M_Qskyd_mainrecord.lksj + "' and zyzt<>'" + common_file.common_fjzt.zzf + "'"); } } s = common_file.common_app.get_suc; } else if (add_edit_delete == common_file.common_app.get_delete) { s = delete_sz_xgft(id, "sc", cznr, qtyq, "", czy, czsj, xxzs); //通过qtyq传递取消原因过来 } return(s); }
/// <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); }
/// <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); }
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); }