Beispiel #1
0
 private void b_save_Click(object sender, EventArgs e)
 {
     tB_xfxm.Text = xfxm;
     tB_xfje.Text = xfje;
     tB_sj.Text   = xfsj;
     if (((Maticsoft.Common.PageValidate.IsDecimal(tB_fcje.Text.Trim()) || Maticsoft.Common.PageValidate.IsNumber(tB_fcje.Text.Trim())) == false))
     {
         common_file.common_app.Message_box_show(common_file.common_app.message_title, "分拆金额填写不正确");
         return;
     }
     if (decimal.Parse(tB_fcje.Text.Trim()).Equals(0))
     {
         common_file.common_app.Message_box_show(common_file.common_app.message_title, "请填写分拆金额");
         return;
     }
     if (common_file.common_app.message_box_show_select(common_file.common_app.message_title, "你确定要分拆这条记录嘛?") == true)
     {
         decimal je_need = decimal.Parse(tB_fcje.Text.Trim());
         decimal je_last = decimal.Parse(tB_xfje.Text.Trim()) - je_need;
         //执行分拆
         SfjczHelper.Fun_fj_chaizhang(id_app_old, id_app_new, union_lzbh_temp, je_need, je_last, czzt, DateTime.Now.ToString(), "2");
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Beispiel #2
0
 private void Fun_chaiZhang_cx(string id_app_1)
 {
     SfjczHelper.Fun_fj_chaizhang_cx(id_app_1, czzt, jzbh);
 }
Beispiel #3
0
 //判断哪条记录要进行分拆,然后调用chaizhang方法
 private void Fun_chaiZ(decimal _fjje)
 {
     id_app_temp_1 = "";    //要进行拆帐的那条记录的ID_App的值
     fjje          = _fjje; //decimal.Parse(tb_fjje.Text.Trim());
     ljje          = 0;
     je_need       = 0;     //要拆出的金额(ljje与fjje的差额)
     je_last       = 0;     //拆出后剩下的金额数
     lists_id__app = new List <string>();
     //循环dg_xyjl4
     for (int i = 0; i < dg_xyjl.Rows.Count; i++)
     {
         if (dg_xyjl.Rows[i].Cells["sjxfje"].Value != null && dg_xyjl.Rows[i].Cells["sjxfje"].Value.ToString().Trim() != "")
         {
             id_app_temp_1 = dg_xyjl.Rows[i].Cells["id_app"].Value.ToString();
             ljje         += decimal.Parse(dg_xyjl.Rows[i].Cells["sjxfje"].Value.ToString());
             if (ljje > fjje)//累计金额>分结金额时,就要拆帐
             {
                 //获取当前的这条记录的id_app进行拆帐
                 M_Szwmx = B_Szwmx.GetModelList(" id>=0  and yydh='" + common_file.common_app.yydh + "'  and  id_app='" + id_app_temp_1 + "'")[0];
                 je_need = fjje - (ljje - M_Szwmx.sjxfje);// fjje - ljje;//要拆出来的金额
                 je_last = M_Szwmx.sjxfje - je_need;
                 //金额找出来后
                 //生成新的union_bh,id_app
                 string Union_bh_new = common_file.common_ddbh.ddbh("lzbh", "szdate", "szcounter", 6); //算帐操作
                 string id_app_new   = "";
                 if (czzt == common_file.common_jzzt.czzt_bfsz)                                        //部分算帐
                 {
                     id_app_new = common_file.common_ddbh.ddbh("bfjz", "jzdate", "jzcounter", 6);      //前缀保留成部分结帐
                 }
                 if (czzt == common_file.common_jzzt.czzt_gz || czzt == common_file.common_jzzt.czzt_jzzgz)
                 {
                     id_app_new = common_file.common_ddbh.ddbh("gzfj", "jzdate", "jzcounter", 6);           //前缀保留成挂帐分结
                 }
                 if (czzt == common_file.common_jzzt.czzt_jz || czzt == common_file.common_jzzt.czzt_gzzjz) //记帐分结
                 {
                     id_app_new = common_file.common_ddbh.ddbh("jzfj", "jzdate", "jzcounter", 6);
                 }
                 if (czzt == common_file.common_jzzt.czzt_zz) //在住转帐的时候
                 {                                            //标识为部分转帐
                     id_app_new = common_file.common_ddbh.ddbh("bfzz", "jzdate", "jzcounter", 6);
                 }
                 //将原来的一条拆成两条(包括Szwmx以及Ssyxfxm,向Szw_union写入两条记录,除金额不一样,其它保持一致
                 if (czzt == common_file.common_jzzt.czzt_bfsz)
                 {
                     SfjczHelper.Fun_fj_chaizhang(id_app_temp_1, id_app_new, Union_bh_new, je_need, je_last, common_file.common_jzzt.czzt_bfsz, DateTime.Now.ToString(), "1");
                 }
                 if (czzt == common_file.common_jzzt.czzt_jz || czzt == common_file.common_jzzt.czzt_gzzjz)
                 {
                     SfjczHelper.Fun_fj_chaizhang(id_app_temp_1, id_app_new, Union_bh_new, je_need, je_last, common_file.common_jzzt.czzt_jzfj, DateTime.Now.ToString(), "1");
                 }
                 if (czzt == common_file.common_jzzt.czzt_gz || czzt == common_file.common_jzzt.czzt_jzzgz)
                 {
                     SfjczHelper.Fun_fj_chaizhang(id_app_temp_1, id_app_new, Union_bh_new, je_need, je_last, common_file.common_jzzt.czzt_gzfj, DateTime.Now.ToString(), "1");
                 }
                 if (czzt == common_file.common_jzzt.czzt_zz)
                 {
                     SfjczHelper.Fun_fj_chaizhang(id_app_temp_1, id_app_new, Union_bh_new, je_need, je_last, common_file.common_jzzt.czzt_zz, DateTime.Now.ToString(), "1");
                 }
             }
             else if (ljje <= fjje)
             {
                 //将这条记录写入到Szw_zz_fj_temp
                 strsql = new StringBuilder();
                 strsql.Append("insert into  Szw_zz_fj_temp(yydh,qymc,jzbh,id_app,lsbh,czy,czsj)");
                 strsql.Append("   select  yydh,qymc,jzbh,'" + id_app_temp_1 + "',lsbh,'" + common_file.common_app.czy_GUID + "','" + DateTime.Now.ToString() + "'  from  Szwmx ");
                 strsql.Append("  where  id_app='" + id_app_temp_1 + "'");
                 B_common.ExecuteSql(strsql.ToString());
                 if (ljje < fjje)
                 {
                     continue;//这里先把数据加进去(最后再绑定数据)
                 }
             }
             break;//刷新的时候就直接跳出去
         }
     }
     BindData_dg_xyjl();
     BindData_dg_xzjl();
 }