Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"]));
         _dep = new publicClass.Dep(_uer.Udep_id);
         string          cmd_yj    = "select top 1 m_date_word from m_state where 1=1 and m_dep_id= " + _uer.Udep_id + "order by m_s_id desc";
         publicClass.MSE mse       = new publicClass.MSE(DateTime.Now);
         string          cmd_bysr  = string.Format("select case when sum(amount) is null then 0 else sum(amount) end  from bill where bill_type=1 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E);
         string          cmd_byzc  = string.Format("select case when sum(amount) is null then 0 else sum(amount) end  from bill where bill_type=2 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E);;
         string          cmd_zyzh  = "select count(*) from depno where 1=1 and state=1";
         string          cmd_wldw  = "select count(*) from exc_dep where 1=1 and state=1";
         string          cmd_dy    = "select count(*) from bill where isfiled=1 and prnt=0";
         string          cmd_sp    = "select count(*) from bill where op=" + _uer.Ulvl;
         string          cmd_gd    = "select count(*) from bill where op=5 and isfiled =0";
         string          str_where = " and dep_id= " + _uer.Udep_id;
         if (_uer.Ulvl <= 2)
         {
             cmd_bysr += " and payfrom = " + _uer.Udep_id;
             cmd_byzc += " and payfrom =" + _uer.Udep_id;
             cmd_zyzh += str_where;
             cmd_wldw += str_where;;
             cmd_dy   += " and payfrom = " + _uer.Udep_id;
             cmd_sp   += " and payfrom = " + _uer.Udep_id;
             cmd_gd   += " and payfrom = " + _uer.Udep_id;
         }
         publicClass.Dosql ds = new publicClass.Dosql();
         ds.DoRe(cmd_yj);
         yj_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds          = new publicClass.Dosql();
         ds.DoRe(cmd_bysr);
         bysr_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds            = new publicClass.Dosql();
         ds.DoRe(cmd_byzc);
         byzc_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds            = new publicClass.Dosql();
         ds.DoRe(cmd_zyzh);
         zyzh_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds            = new publicClass.Dosql();
         ds.DoRe(cmd_wldw);
         wldw_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds            = new publicClass.Dosql();
         ds.DoRe(cmd_dy);
         dy_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds          = new publicClass.Dosql();
         ds.DoRe(cmd_sp);
         sp_lab.Text = ds.DtOut.Rows[0][0].ToString();
         ds          = new publicClass.Dosql();
         ds.DoRe(cmd_gd);
         gd_lab.Text   = ds.DtOut.Rows[0][0].ToString();
         dbsx_lal.Text = (Convert.ToInt32(sp_lab.Text) + Convert.ToInt32(dy_lab.Text) + Convert.ToInt32(gd_lab.Text)).ToString();
         sz_lab.Text   = (Convert.ToDecimal(bysr_lab.Text) - Convert.ToDecimal(byzc_lab.Text)).ToString();
         sp_img.Text   = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(sp_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString());
         gd_img.Text   = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(gd_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString());
         dy_img.Text   = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(dy_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString());
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 2
0
 protected void creat_info_list()
 {
     try
     {
         string            cmd_pde_no_list = "select * from depno where dep_id=" + _uer.Udep_id;
         string            cmd_minfo       = "select * from m_info where dep_id=" + _uer.Udep_id + "and m_date_word like '" + m_state + "'";
         publicClass.Dosql ds = new publicClass.Dosql();
         DataTable         dt_dep_no_list, dt_out, dt_minfo;
         ds.DoRe(cmd_pde_no_list);
         dt_dep_no_list = ds.DtOut;
         ds             = new publicClass.Dosql();
         ds.DoRe(cmd_minfo);
         dt_minfo = ds.DtOut;
         dt_out   = new DataTable();
         dt_out.Columns.Add("no_id");
         dt_out.Columns.Add("no");
         dt_out.Columns.Add("state");
         dt_out.Columns.Add("m_date_word");
         dt_out.Columns.Add("qcye");
         dt_out.Columns.Add("bqsr");
         dt_out.Columns.Add("bqzc");
         dt_out.Columns.Add("qmye");
         foreach (DataRow dr in dt_dep_no_list.Rows)
         {
             DataRow in_dr = dt_out.NewRow();
             in_dr["no_id"]       = dr["no_id"];
             in_dr["no"]          = dr["no"];
             in_dr["state"]       = Convert.ToBoolean(dr["state"])?"启用":"停用";
             in_dr["m_date_word"] = (temp[1] == 12 ? temp[0] + 1 : temp[0]).ToString() + "-" + (temp[1] == 12 ? 1 : temp[1] + 1).ToString();
             DataRow[] r = dt_minfo.Select("no_id=" + dr["no_id"]);
             if (r.Length == 0)
             {
                 in_dr["qcye"] = Convert.ToDecimal("0.00");
             }
             else
             {
                 in_dr["qcye"] = Convert.ToDecimal(r[0][8].ToString());
             }
             publicClass.MSE mse      = new publicClass.MSE(Convert.ToDateTime((temp[1] == 12 ? temp[0] + 1 : temp[0]).ToString() + "-" + (temp[1] == 12 ? 1 : temp[1] + 1).ToString() + "-25"));
             string          cmd_bqsr = string.Format("select sum(amount) from bill where payfrom={0} and payto=-1 and isfiled =1 and make_date between '{1}' and '{2}' and payfrom_no = {3}", _uer.Udep_id, mse.S, mse.E, dr["no_id"]);
             string          cmd_bqzc = string.Format("select sum(amount) from bill where payfrom={0} and payto<>-1 and isfiled =1 and make_date between '{1}' and '{2}' and payfrom_no = {3}", _uer.Udep_id, mse.S, mse.E, dr["no_id"]);
             ds = new publicClass.Dosql();
             ds.DoRe(cmd_bqsr);
             in_dr["bqsr"] = Convert.ToDecimal(ds.DtOut.Rows[0][0].ToString() == ""? "0.00" : ds.DtOut.Rows[0][0].ToString());
             ds            = new publicClass.Dosql();
             ds.DoRe(cmd_bqzc);
             in_dr["bqzc"] = Convert.ToDecimal(ds.DtOut.Rows[0][0].ToString() == "" ? "0.00" : ds.DtOut.Rows[0][0].ToString());
             in_dr["qmye"] = Convert.ToDecimal(in_dr["bqsr"]) + Convert.ToDecimal(in_dr["qcye"]) - Convert.ToDecimal(in_dr["bqzc"]);
             dt_out.Rows.Add(in_dr);
         }
         this.m_info.DataSource = dt_out;
         this.m_info.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 3
0
 protected void save_Click(object sender, EventArgs e)
 {
     try
     {
         string  new_date_word = (temp[1] == 12 ? temp[0] + 1 : temp[0]).ToString() + "-" + (temp[1] == 12 ? 1 : temp[1] + 1).ToString();
         string  new_date = new publicClass.MSE(Convert.ToDateTime(new_date_word + "-20")).E.ToShortDateString();
         decimal qcye, bqsr, bqzc, qmye;
         int     no_id;
         List <publicClass.DS_input> ips_list = new List <publicClass.DS_input>();
         foreach (DataRow r in ((DataTable)this.m_info.DataSource).Rows)
         {
             no_id = Convert.ToInt32(r[0]);
             qcye  = Convert.ToDecimal(r[4]);
             bqsr  = Convert.ToDecimal(r[5]);
             bqzc  = Convert.ToDecimal(r[6]);
             qmye  = Convert.ToDecimal(r[7]);
             if (qcye != 0 || bqsr != 0 || bqzc != 0 || qmye != 0)
             {
                 publicClass.DS_input ip = new publicClass.DS_input();
                 ip._cmd      = "insert into m_info values(@no_id,@ms_date,@qcye,@bqsr,@bqzc,@dep_id,@op_id,@qmye,@data_word)";
                 ip._par_name = new string[] { "@no_id", "@ms_date", "@qcye", "@bqsr", "@bqzc", "@dep_id", "@op_id", "@qmye", "@data_word" };
                 ip._par_type = new SqlDbType[] { SqlDbType.BigInt, SqlDbType.Date, SqlDbType.Decimal, SqlDbType.Decimal, SqlDbType.Decimal, SqlDbType.BigInt, SqlDbType.BigInt, SqlDbType.Decimal, SqlDbType.Text };
                 ip._par_val  = new object[] { no_id, new_date, qcye, bqsr, bqzc, _uer.Udep_id, _uer.Uid, qmye, new_date_word };
                 ips_list.Add(ip);
             }
         }
         publicClass.DS_input ip2             = new publicClass.DS_input();
         ip2._cmd      = string.Format("insert into m_state values ('{0}','{1}',{2})", new_date_word, new_date, _uer.Udep_id);
         ip2._par_name = new string[] { };
         ip2._par_type = new SqlDbType[] { };
         ip2._par_val  = new object[] { };
         ips_list.Add(ip2);
         publicClass.Dosql ds = new publicClass.Dosql();
         ds.DoNoRe(ips_list.ToArray());
     }
     catch (Exception ex)
     {
     }
     finally
     {
         creat_summary();
         creat_info_list();
     }
 }
Exemplo n.º 4
0
 protected void filed_Click(object sender, EventArgs e)
 {
     try
     {
         startup();
         if (_bill.Op == 5)
         {
             publicClass.Dep     dep  = new publicClass.Dep(_bill.Payfrom);
             string              head = dep.DeShort + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString();
             publicClass.exc_dep exc  = new publicClass.exc_dep();;
             if (_bill.Payto != -1)
             {
                 exc = new publicClass.exc_dep(_bill.Payto);
             }
             else
             {
                 exc.Edep_name = "无";
                 exc.Edep_no   = "无";
             }
             string secret = "Fd:" + new publicClass.Dep(_bill.Payfrom).DeName;
             secret += "Fn:" + new publicClass.dep_no(_bill.Payfrom_no).No;
             secret += "A:" + _bill.Amount;
             secret += "Td:" + exc.Edep_name + "Tn:" + exc.Edep_no;
             secret += "Ur:" + new publicClass.Uer(_bill.Maker).Uname + "Md:" + _bill.Make_date.ToShortDateString();
             string               base64 = publicClass.str2base64.to64(secret);
             publicClass.MSE      mse    = new publicClass.MSE(_bill.Make_date);
             string               up_str = string.Format("update bill set isfiled=1,bill_id_head='{0}',bill_id_body =(select max(bill_id_body)+1 from bill where make_date between '{1}' and '{2}'),secret='{3}' where bill_id={4} ", head, mse.S.ToShortDateString(), mse.E.ToShortDateString(), base64, _bill.Bill_id);
             publicClass.DS_input ip     = new publicClass.DS_input();
             ip._cmd      = up_str;
             ip._par_name = new string[] { };
             ip._par_type = new SqlDbType[] { };
             ip._par_val  = new object[] { };
             publicClass.Dosql ds = new publicClass.Dosql();
             ds.DoNoRe(new publicClass.DS_input[] { ip });
         }
     }
     catch
     {
     }
     finally
     {
         Response.Redirect("review.aspx");
     }
 }
Exemplo n.º 5
0
        private void bill_list_creat(int _pageindex = 1, int _pagesize = 6, string wherestr = "")
        {
            int    _pagecount = 0, _pages, _page_s, _page_e;
            string cmd, datatemp = "";

            string[] dataarr;
            if (Session["showfiled_list_where"] != null)
            {
                wherestr = Session["showfiled_list_where"].ToString();
            }
            else
            {
                wherestr = "";
            }
            if (wherestr.IndexOf("between") < 0)
            {
                publicClass.MSE mse = new publicClass.MSE(DateTime.Now);
                wherestr = "and make_date between '" + mse.S.ToShortDateString() + "' and '" + mse.E.ToShortDateString() + "'";
            }
            //设置查询条件
            try
            {
                cmd = "select count(*) from bill where isfiled=1 " + wherestr;
                if (_uer.Ulvl <= 2)
                {
                    cmd += " and payfrom = " + _uer.Udep_id;
                }
                publicClass.Dosql ds = new publicClass.Dosql();
                ds.DoRe(cmd);
                if (ds.Sqled)
                {
                    _pagecount = Convert.ToInt32(ds.DtOut.Rows[0][0]);
                }
                _pages = _pagecount % _pagesize == 0 ? _pagecount / _pagesize : (_pagecount / _pagesize) + 1;

                _pageindex = _pageindex > _pages ? _pages : _pageindex;
                _pageindex = _pageindex < 1 ? 1 : _pageindex;

                hide.Value = _pageindex.ToString();//控制分页按钮高亮

                if (_pages <= 5)
                {
                    _page_s = 1;
                    _page_e = _pages;
                }
                else
                {
                    _page_s = _pageindex - 2 < 1 ? 1 : _pageindex - 2;
                    if (_pageindex <= 2)
                    {
                        _page_e = 5;
                    }
                    else
                    {
                        _page_e = _pageindex + 2 > _pages ? _pages : _pageindex + 2;
                    }
                }

                if (_page_s == 1)
                {
                    front.Visible = false;
                }
                else
                {
                    front.Visible = true;
                }
                if (_pageindex + 2 < _pages)
                {
                    back.Visible = true;
                }
                else
                {
                    back.Visible = false;
                }
                this.end.CommandArgument = _pages.ToString();
                for (int i = _page_s; i <= _page_e; i++)
                {
                    datatemp += i.ToString() + ",";
                }
                if (datatemp.Length != 0)
                {
                    dataarr = datatemp.Substring(0, datatemp.Length - 1).Split(',');
                }
                else
                {
                    dataarr = new string[] { "1" };
                }
                this.pagestr.DataSource = dataarr;
                this.pagestr.DataBind();

                //cmd = string.Format("select e.* ,f.* from (select c.*,d.no_name,d.no from (select top({0}) a.*,b.dep_name from bill a,dep b where a.payfrom =b.dep_id  and isfiled =0 and bill_id not in (select top({1})bill_id from bill where 1=1 {2} order by bill_id desc) {3}) c left join depno d on d.no_id = c.payfrom_no) e left join exc_dep f on e.payto=f.edep_id", _pagesize, _pagesize*(_pageindex-1),wherestr,wherestr);

                if (_uer.Ulvl <= 2)
                {
                    wherestr += " and payfrom = " + _uer.Udep_id;
                }
                cmd = string.Format("select e.*,f.* from(select c.*,d.edep_name,d.edep_no from (select a.*,b.no_name,b.no from (select top {0} * from bill where 1=1 and isfiled=1 {1} and bill_id not in(select top {2} bill_id from bill where 1=1 and isfiled=1 {3} order by bill_id desc,prnt asc) order by bill_id desc,prnt asc) a left join depno b on a.payfrom_no=b.no_id) c left join  exc_dep d on c.payto =d.edep_id) e left join dep f on e.payfrom= f.dep_id", _pagesize, wherestr, _pagesize * (_pageindex - 1), wherestr);
                //cmd += " order by bill_id desc";
                ds = null;
                ds = new publicClass.Dosql();
                ds.DoRe(cmd);
                if (ds.Sqled)
                {
                    this.Repeater1.DataSource = ds.DtOut;
                    this.Repeater1.DataBind();
                }
            }
            catch (Exception ex)
            {
            }
        }