private string GetjzOrgjToZz_helper(string lsbh_old, string lsbh_new, string sk_tt, string Zz_Type, string yydh, string czy, string czy_bc, string czsj, string syzd, string xxzs)//对GetjzOrgjToZz方法的辅助方法 { //对每个表(Sjzzd,Sjzmx,循环查找,删除Sjzzd,Sjzmx里面的记录,将记录加到 //Sjzzd string s = common_file.common_app.get_failure; DataSet ds_temp = new DataSet(); Model.Sjzzd M_Sjzzd = B_sjjzd.GetModelList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_old + "'")[0]; krxm_old = M_Sjzzd.krxm; fjbh_old = M_Sjzzd.fjbh; //转向散客( if (Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_jz_sk) { ds_temp = B_Qskyd_fjrb.GetList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_new + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_new = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_new = ds_temp.Tables[0].Rows[0]["fjbh"].ToString(); sk_tt_afterZZ = ds_temp.Tables[0].Rows[0]["sktt"].ToString(); } } //转向团体(fjbh为空) if (Zz_Type == common_zw.zwzz_jz_tt || Zz_Type == common_zw.zwzz_gz_tt) { ds_temp = B_Qttyd_mainrecord.GetList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_new + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_new = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_new = ""; sk_tt_afterZZ = ds_temp.Tables[0].Rows[0]["sktt"].ToString(); } } if (GetjzOrgjToZz_helper_InsertToSzwzz_mx(lsbh_old, lsbh_new, krxm_old, krxm_new, fjbh_old, fjbh_new, "Syjcz", Zz_Type, czy, czsj, Zz_Type, yydh) == common_file.common_app.get_suc) { if (GetjzOrgjToZz_helper_InsertToSzwzz_mx(lsbh_old, lsbh_new, krxm_old, krxm_new, fjbh_old, fjbh_new, "Szwmx", Zz_Type, czy, czsj, Zz_Type, yydh) == common_file.common_app.get_suc) { s = common_file.common_app.get_suc; } } StringBuilder strsql = new StringBuilder(); strsql.Append("delete from Sjzzd"); strsql.Append(" where lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder(); strsql.Append("delete from Sjzmx"); strsql.Append(" where lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); return(s); }
private void s_bz_Load(object sender, EventArgs e) { if (jzzd_id > 0) { M_Sjzzd = B_sjzzd.GetModel(jzzd_id); if (M_Sjzzd != null) { tB_fpcs.Text = M_Sjzzd.fp_print.ToString(); tB_fpbz.Text = M_Sjzzd.bz; } } }
private void b_save_Click(object sender, EventArgs e) { M_Sjzzd = B_sjzzd.GetModel(jzzd_id); if (M_Sjzzd != null) { M_Sjzzd.fp_print = int.Parse(tB_fpcs.Text.Trim()); M_Sjzzd.bz = tB_fpbz.Text.Trim(); if (B_sjzzd.Update(M_Sjzzd)) { common_file.common_app.Message_box_show(common_file.common_app.message_title, "保存成功"); //p_fp.Visible = false; this.DialogResult = DialogResult.OK; this.Close(); } } }
private string GetjzOrgzOrZaiZToZz_helper(string lsbh_old, string jzbh_old, string lsbh_new, string sk_tt, string Zz_Type, string yydh, string czy, string czy_bc, string czsj, string syzd, string xxzs, string czy_GUID)//对GetjzOrgjToZz方法的辅助方法 { //对每个表(Sjzzd,Sjzmx,循环查找,删除Sjzzd,Sjzmx里面的记录,将记录加到 //Sjzzd string s = common_file.common_app.get_failure; DataSet ds_temp = new DataSet(); zz_lsbh = common_file.common_ddbh.ddbh("zwzz", "jzdate", "jzcounter", 6); #region 获取转入的团体或者散客的信息(krxm_new,fjbh_new) //转向散客 if (Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_jz_sk || Zz_Type == common_zw.zwzz_sk_sk || Zz_Type == common_zw.zwzz_tt_sk) { ds_temp = B_Qskyd_fjrb.GetList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_new + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_new = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_new = ds_temp.Tables[0].Rows[0]["fjbh"].ToString(); fjrb_new = ds_temp.Tables[0].Rows[0]["fjrb"].ToString(); sktt_new = ds_temp.Tables[0].Rows[0]["sktt"].ToString(); } } //转向团体(fjbh为空) if (Zz_Type == common_zw.zwzz_jz_tt || Zz_Type == common_zw.zwzz_gz_tt || Zz_Type == common_zw.zwzz_sk_tt || Zz_Type == common_zw.zwzz_tt_tt) { ds_temp = B_Qttyd_mainrecord.GetList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_new + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_new = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_new = ""; fjrb_new = "";//团体没有房间类别 sktt_new = ds_temp.Tables[0].Rows[0]["sktt"].ToString(); } } #endregion #region 转帐时旧获取旧的信息(krxm_old,fjbh_old) //挂或者记帐转帐旧的信息的获取 if (Zz_Type == common_zw.zwzz_jz_sk || Zz_Type == common_zw.zwzz_jz_tt || Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_gz_tt) { Model.Sjzzd M_Sjzzd = B_sjjzd.GetModelList("id>0 and yydh='" + yydh + "' and lsbh='" + lsbh_old + "' and jzbh='" + jzbh_old + "'")[0]; krxm_old = M_Sjzzd.krxm; fjbh_old = M_Sjzzd.fjbh; sktt_old = M_Sjzzd.sktt; } //在住类型的转帐旧的信息的获取 if (Zz_Type == common_zw.zwzz_sk_sk || Zz_Type == common_zw.zwzz_sk_tt || Zz_Type == common_zw.zwzz_tt_sk || Zz_Type == common_zw.zwzz_tt_tt) { //散客类型转 if (Zz_Type == common_zw.zwzz_sk_sk || Zz_Type == common_zw.zwzz_sk_tt) { ds_temp = new DataSet(); ds_temp = B_common.GetList("select krxm,fjbh from View_Qskzd", " lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_old = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_old = ds_temp.Tables[0].Rows[0]["fjbh"].ToString(); } } //团体类型转 if (Zz_Type == common_zw.zwzz_tt_sk || Zz_Type == common_zw.zwzz_tt_tt) { ds_temp = new DataSet(); ds_temp = B_common.GetList("select krxm from View_Qttzd", " lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { krxm_old = ds_temp.Tables[0].Rows[0]["krxm"].ToString(); fjbh_old = "";//团体房号为空 } } } #endregion #region //挂记帐类型执行的操作 if (Zz_Type == common_zw.zwzz_jz_sk || Zz_Type == common_zw.zwzz_jz_tt || Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_gz_tt) { if (GetjzOrgjToZz_helper_InsertToSzwzz_mx(lsbh_old, jzbh_old, lsbh_new, krxm_old, krxm_new, fjbh_old, fjbh_new, "Syjcz", Zz_Type, czy, czsj, Zz_Type, yydh, zz_lsbh, czy_GUID) == common_file.common_app.get_suc) { if (GetjzOrgjToZz_helper_InsertToSzwzz_mx(lsbh_old, jzbh_old, lsbh_new, krxm_old, krxm_new, fjbh_old, fjbh_new, "Szwmx", Zz_Type, czy, czsj, Zz_Type, yydh, zz_lsbh, czy_GUID) == common_file.common_app.get_suc) { //jzzd到bak,备份jzmx到bak ,备份押金操作到bak //删除jzmx及jzzd里面的数据 //更新Ssyxfmx及Ssyxfmx里面的lsbh //更新转入的Szwzd里面的xfje和fkje //获取转帐的金额 if (Zz_Type == common_zw.zwzz_jz_sk || Zz_Type == common_zw.zwzz_jz_tt || Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_gz_tt) { ds_temp = B_common.GetList("select * from Sjzzd ", " id>0 and yydh='" + yydh + "' and jzbh='" + jzbh_old + "'"); if (ds_temp != null && ds_temp.Tables[0].Rows.Count > 0) { xfje_zz = decimal.Parse(ds_temp.Tables[0].Rows[0]["xfje"].ToString()); fkje_zz = decimal.Parse(ds_temp.Tables[0].Rows[0]["fkje"].ToString()); } } string Zz_Type_temp = "";//备份时主单及明细的状态 if (Zz_Type == common_zw.zwzz_jz_sk || Zz_Type == common_zw.zwzz_jz_tt) { Zz_Type_temp = common_file.common_jzzt.czzt_jzzzz; } if (Zz_Type == common_zw.zwzz_gz_sk || Zz_Type == common_zw.zwzz_gz_tt) { Zz_Type_temp = common_file.common_jzzt.czzt_gzzzz; } strsql = new StringBuilder();//备份jzzd--jzzd_bak strsql.Append("insert into sjzzd_bak(yydh,qymc,jzbh,jzbh_new,lsbh,is_top,is_select,krxm,sktt,fjbh,xydw,krly,tfsj,czsj,czy,czzt,xyh,jzzt,sdcz,syzd,bz,fp_print,is_visible,fkje,xfje,ddsj,krxm_lz,fjbh_lz)"); strsql.Append("select yydh,qymc,jzbh,'',lsbh,is_top,is_select,krxm,sktt,fjbh,xydw,krly,tfsj,czsj,czy,'" + Zz_Type_temp + "',xyh,jzzt,sdcz,syzd,'" + "帐务由lsbh:" + lsbh_old + "通过:" + Zz_Type + "方式转到lsbh:" + lsbh_new + "',fp_print,is_visible,fkje,xfje,ddsj,krxm_lz,fjbh_lz from sjzzd"); strsql.Append(" where lsbh='" + lsbh_old + "' and jzbh='" + jzbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder();//备份jzmx--jzmx_bak strsql.Append("insert into sjzmx_bak(yydh,qymc,is_top,is_select,id_app,jzbh,jzbh_new,lsbh,krxm,fjrb,fjbh,sktt,xfrq,xfsj,czy,xfdr,xfrb,xfxm,xfbz,xfzy,jjje,xfje,yh,sjxfje,xfsl,shsc,czy_bc,czzt,czsj,syzd,is_visible,xyh,jzzt,fkfs,mxbh,tfsj)"); strsql.Append("select yydh,qymc,is_top,is_select,id_app,jzbh,'',lsbh,krxm,fjrb,fjbh,sktt,xfrq,xfsj,czy,xfdr,xfrb,xfxm,xfbz,xfzy,jjje,xfje,yh,sjxfje,xfsl,shsc,czy_bc,'" + Zz_Type_temp + "','" + czsj + "',syzd,is_visible,xyh,jzzt,fkfs,mxbh,tfsj from sjzmx"); strsql.Append(" where yydh='" + yydh + "' and jzbh='" + jzbh_old + "'"); B_common.ExecuteSql(strsql.ToString()); //更新收银消费明细里面的临时编号到new strsql = new StringBuilder(); strsql.Append("update Ssyxfmx set lsbh='" + lsbh_new + "',jzbh='' where id>=0 and jzbh='" + jzbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); //更新转入的LSBH对应Szwzd的消费和付款金额 strsql = new StringBuilder(); strsql.Append("update Szwzd set xfje=xfje+" + xfje_zz + ",fkje=fkje+" + fkje_zz + " where id>=0 and lsbh='" + lsbh_new + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder(); strsql.Append("delete from Sjzzd"); strsql.Append(" where lsbh='" + lsbh_old + "' and jzbh='" + jzbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder(); strsql.Append("delete from Sjzmx"); strsql.Append(" where jzbh='" + jzbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); s = common_file.common_app.get_suc; } } } #endregion #region //在住类型执行的操作 if (Zz_Type == common_zw.zwzz_sk_sk || Zz_Type == common_zw.zwzz_sk_tt || Zz_Type == common_zw.zwzz_tt_sk || Zz_Type == common_zw.zwzz_tt_tt) { if (GetjzOrgjToZz_helper_InsertToSzwzz_mx(lsbh_old, jzbh_old, lsbh_new, krxm_old, krxm_new, fjbh_old, fjbh_new, "Szwmx", Zz_Type, czy, czsj, Zz_Type, yydh, zz_lsbh, czy_GUID) == common_file.common_app.get_suc) { //在住的转帐(更新两边的Szwzd的消费金额) //更新转入的LSBH对应Szwzd的消费和付款金额 strsql = new StringBuilder(); strsql.Append("update Szwzd set xfje=xfje+" + xfje_zz + ",fkje=fkje+" + fkje_zz + " where id>=0 and lsbh='" + lsbh_new + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder(); strsql.Append("update Szwzd set xfje=xfje-(" + xfje_zz + "),fkje=fkje-(" + fkje_zz + ") where id>=0 and lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); //更新收银消费明细里面的临时编号到new(注意,只能更新在Szw_zz_fj_temp里面的记录) strsql = new StringBuilder(); strsql.Append("update Ssyxfmx set lsbh='" + lsbh_new + "',jzbh='' where id>=0 and id_app in (select id_app from Szw_zz_fj_temp where lsbh='" + lsbh_old + "' and yydh='" + yydh + "')"); B_common.ExecuteSql(strsql.ToString()); //最后,删除Szw_zz_fj_temp,以及Szw_temp里面的临时数据 strsql = new StringBuilder(); strsql.Append(" delete from Szw_zz_fj_temp where lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); strsql = new StringBuilder(); strsql.Append(" delete from Szw_temp where lsbh='" + lsbh_old + "' and yydh='" + yydh + "'"); B_common.ExecuteSql(strsql.ToString()); s = common_file.common_app.get_suc; } } #endregion if (s == common_file.common_app.get_suc) { DataSet ds_0 = B_common.GetList(" select * from Szwzz_mx ", " id>=0 and yydh='" + yydh + "' and xfzy='" + zz_lsbh + "'"); if (ds_0 != null && ds_0.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds_0.Tables[0].Rows.Count; i++) { B_common.ExecuteSql(" delete from Szw_union where id>=0 and yydh='" + yydh + "' and union_bh in (select union_bh from Szw_union where id_app='" + ds_0.Tables[0].Rows[i]["id_app"].ToString() + "')"); } } } return(s); }
private void GetZzInfo() { common_file.common_app.get_czsj(); // 记、挂--转帐 if (Zz_Type == Szwgl.common_zw.zwzz_gz_tt || Zz_Type == Szwgl.common_zw.zwzz_jz_tt || Zz_Type == Szwgl.common_zw.zwzz_gz_sk || Zz_Type == Szwgl.common_zw.zwzz_jz_sk) { //帐务向团体转 if (Zz_Type == Szwgl.common_zw.zwzz_gz_tt || Zz_Type == Szwgl.common_zw.zwzz_jz_tt)//向团体转 { if (dg_tt.Rows.Count > 0) { if (dg_tt.CurrentRow != null) { int i = dg_tt.CurrentRow.Index; DataRowView dgr = dg_tt.CurrentRow.DataBoundItem as DataRowView; i = DS_Qtt.Tables[0].Rows.IndexOf(dgr.Row); if (i > -1 && i < dg_tt.Rows.Count)//当前行为内容行 { int id_temp = Convert.ToInt32(DS_Qtt.Tables[0].Rows[i]["id"].ToString()); M_Qttyd_mainrecord = B_Qttyd_mainrecord.GetModelList("Id=" + id_temp)[0]; lsbh_new = M_Qttyd_mainrecord.lsbh; } } else { return; } } else { return; } } //帐务向散客转 if (Zz_Type == Szwgl.common_zw.zwzz_gz_sk || Zz_Type == Szwgl.common_zw.zwzz_jz_sk)//向散客转 { if (dg_sk.Rows.Count > 0) { if (dg_sk.CurrentRow != null) { int i = dg_sk.CurrentRow.Index; DataRowView dgr = dg_sk.CurrentRow.DataBoundItem as DataRowView; if (dgr != null) { i = DS_Qsk.Tables[0].Rows.IndexOf(dgr.Row); if (i > -1 && i < dg_sk.Rows.Count)//当前行为内容行 { int id_temp = Convert.ToInt32(DS_Qsk.Tables[0].Rows[i]["id"].ToString()); //DS_Qsk.Tables[0].Rows[i]["id"].ToString(); M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModelList("id=" + id_temp)[0]; lsbh_new = M_Qskyd_mainrecord.lsbh; } } } else { return; } } else { return; } } //注意这里传的是记挂的结帐主单ID M_Sjzzd = B_Sjzzd.GetModel(int.Parse(id)); lsbh_old = M_Sjzzd.lsbh; jzbh_old = M_Sjzzd.jzbh; sk_tt = M_Sjzzd.sktt; } //在住---向团体转 if (Zz_Type == Szwgl.common_zw.zwzz_sk_tt || Zz_Type == Szwgl.common_zw.zwzz_tt_tt || Zz_Type == Szwgl.common_zw.zwzz_tt_sk || Zz_Type == Szwgl.common_zw.zwzz_sk_sk) { if (Zz_Type == Szwgl.common_zw.zwzz_sk_tt || Zz_Type == Szwgl.common_zw.zwzz_tt_tt) { if (dg_tt.Rows.Count > 0) { if (dg_tt.CurrentRow != null) { int i = dg_tt.CurrentRow.Index; DataRowView dgr = dg_tt.CurrentRow.DataBoundItem as DataRowView; if (dgr != null) { i = DS_Qtt.Tables[0].Rows.IndexOf(dgr.Row); if (i > -1 && i < dg_tt.Rows.Count)//当前行为内容行 { int id_temp = Convert.ToInt32(DS_Qtt.Tables[0].Rows[i]["id"].ToString()); M_Qttyd_mainrecord = B_Qttyd_mainrecord.GetModelList("Id=" + id_temp)[0]; lsbh_new = M_Qttyd_mainrecord.lsbh; } } if (Zz_Type == Szwgl.common_zw.zwzz_sk_tt) { M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(int.Parse(id)); lsbh_old = M_Qskyd_mainrecord.lsbh; sk_tt = M_Qskyd_mainrecord.sktt; } if (Zz_Type == Szwgl.common_zw.zwzz_tt_tt) { M_Qttyd_mainrecord = B_Qttyd_mainrecord.GetModel(int.Parse(id)); lsbh_old = M_Qttyd_mainrecord.lsbh; sk_tt = M_Qttyd_mainrecord.sktt; } } else { return; } } else { return; } } //在住---向散客转 if (Zz_Type == Szwgl.common_zw.zwzz_tt_sk || Zz_Type == Szwgl.common_zw.zwzz_sk_sk) { if (dg_sk.Rows.Count > 0) { if (dg_sk.CurrentRow != null) { int i = dg_sk.CurrentRow.Index; DataRowView dgr = dg_sk.CurrentRow.DataBoundItem as DataRowView; if (dgr != null) { i = DS_Qsk.Tables[0].Rows.IndexOf(dgr.Row); if (i > -1 && i < dg_sk.Rows.Count)//当前行为内容行 { int id_temp = Convert.ToInt32(DS_Qsk.Tables[0].Rows[i]["id"].ToString()); //DS_Qsk.Tables[0].Rows[i]["id"].ToString(); M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModelList("id=" + id_temp)[0]; lsbh_new = M_Qskyd_mainrecord.lsbh; } } if (Zz_Type == Szwgl.common_zw.zwzz_sk_sk) { { M_Qskyd_mainrecord = B_Qskyd_mainrecord.GetModel(int.Parse(id)); lsbh_old = M_Qskyd_mainrecord.lsbh; sk_tt = M_Qskyd_mainrecord.sktt; } } if (Zz_Type == Szwgl.common_zw.zwzz_tt_sk) { M_Qttyd_mainrecord = B_Qttyd_mainrecord.GetModel(int.Parse(id)); lsbh_old = M_Qttyd_mainrecord.lsbh; sk_tt = M_Qttyd_mainrecord.sktt; } } else { return; } } else { return; } } } Cursor.Current = Cursors.Default; }