コード例 #1
0
ファイル: FinanceStat.aspx.cs プロジェクト: 892182825/SP
    private void GetTotal()
    {
        #region "Total"
        double totalIncome = 0.0;
        double totalPayout = 0.0;


        //PV
        if (ViewState["PV"] != null)
        {
            ReleaseBLL.GetPV(Convert.ToInt32(this.DropQiShu1.SelectedValue), Convert.ToInt32(this.DropQiShu2.SelectedValue), out totalPayout, out totalIncome);
        }
        else
        {
            ReleaseBLL.GetBonus(Convert.ToInt32(this.DropQiShu1.SelectedValue), Convert.ToInt32(this.DropQiShu2.SelectedValue), rateNum, out totalIncome, out totalPayout);
        }

        TableRow  tr = new TableRow();
        TableCell myCell;

        myCell                 = new TableCell();
        myCell.Text            = GetTran("001358", "所有期");
        myCell.HorizontalAlign = HorizontalAlign.Center;
        tr.Cells.Add(myCell);

        myCell                 = new TableCell();
        myCell.Text            = "________ ";
        myCell.HorizontalAlign = HorizontalAlign.Center;
        tr.Cells.Add(myCell);

        if (ViewState["PV"] != null)
        {
            myCell                 = new TableCell();
            myCell.Text            = totalIncome.ToString("f0");
            myCell.HorizontalAlign = HorizontalAlign.Right;
            tr.Cells.Add(myCell);

            myCell                 = new TableCell();
            myCell.Text            = totalPayout.ToString("f0");
            myCell.HorizontalAlign = HorizontalAlign.Right;
            tr.Cells.Add(myCell);
        }
        else
        {
            myCell                 = new TableCell();
            myCell.Text            = totalIncome.ToString("C");
            myCell.HorizontalAlign = HorizontalAlign.Right;
            tr.Cells.Add(myCell);

            myCell                 = new TableCell();
            myCell.Text            = totalPayout.ToString("C");
            myCell.HorizontalAlign = HorizontalAlign.Right;
            tr.Cells.Add(myCell);
        }

        double per = 0.0;
        if (totalIncome != 0)
        {
            per = totalPayout * 100 / totalIncome;
        }
        if (per < 0)
        {
            per = 0.0;
        }
        myCell                 = new TableCell();
        myCell.Text            = (per / 100).ToString("P");
        myCell.HorizontalAlign = HorizontalAlign.Center;
        tr.Cells.Add(myCell);

        myCell = new TableCell();
        myCell.HorizontalAlign = HorizontalAlign.Left;
        Image Img = new Image();
        Img.ImageUrl = "images/jsline.gif";
        try
        {
            Img.Width = (int)per;
        }
        catch
        {
        }
        Img.Height = 20;
        myCell.Controls.Add(Img);
        myCell.Height = 25;
        myCell.Width  = 100;
        myCell.Wrap   = false;
        tr.Cells.Add(myCell);

        Table1.Rows.Add(tr);
        #endregion
    }