예제 #1
0
    private void BindGrid()
    {
        ListTable <FNA_FeeWriteOffDetail> _details;

        if (ViewState["Details"] != null)
        {
            _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>;
        }
        else
        {
            _details = new ListTable <FNA_FeeWriteOffDetail>(new FNA_FeeWriteOffBLL((int)ViewState["ID"]).Items, "ID");
        }
        if (_details.GetListItem().Count(p => p.AccountTitle == 82) > 0)
        {
            ViewState["FLPurchase"] = FNA_FeeWriteOffBLL.GetPurchaseVolume((int)ViewState["ID"]);
        }
        gv_List.BindGrid <FNA_FeeWriteOffDetail>(_details.GetListItem().OrderBy(p => p.Client).ThenBy(p => p.AccountTitle).ThenBy(p => p.BeginMonth).ToList());

        //求费用核消金额合计
        decimal _totalcost = 0;

        foreach (FNA_FeeWriteOffDetail _detail in _details.GetListItem())
        {
            _totalcost += _detail.WriteOffCost + _detail.AdjustCost;
        }
        lb_TotalCost.Text = _totalcost.ToString("0.###");

        if (bt_EditWriteOffDetail.Visible || bt_AddTitleNoApply.Visible)
        {
            Session["FeeWriteOffDetails"] = ViewState["Details"];       //放入Session中,允许编辑明细
        }
    }
    private void BindGridPrint()
    {
        IList <FNA_FeeWriteOffDetail> list = (IList <FNA_FeeWriteOffDetail>)ViewState["Details"];

        if (list.Count(p => p.AccountTitle == 82) > 0)
        {
            ViewState["FLPurchase"]          = FNA_FeeWriteOffBLL.GetPurchaseVolume((int)ViewState["ID"]);
            gv_ListDetail.Columns[9].Visible = true;
        }
        gv_ListDetail.BindGrid <FNA_FeeWriteOffDetail>(list.OrderBy(p => p.Client).ThenBy(p => p.AccountTitle).ThenBy(p => p.BeginMonth).ToList());
    }
예제 #3
0
    private void BindData()
    {
        int id = (int)ViewState["ID"];

        FNA_FeeWriteOffBLL bll = new FNA_FeeWriteOffBLL(id);

        ViewState["Details"]    = bll.Items.OrderBy(p => p.Client).ToList();
        ViewState["FLPurchase"] = FNA_FeeWriteOffBLL.GetPurchaseVolume((int)ViewState["ID"]);
        FNA_FeeWriteOff writeoff = bll.Model;

        if (writeoff == null)
        {
            Response.Redirect("FeeWriteOffList.aspx");
        }

        pn_FeeWriteOff.BindData(writeoff);

        ViewState["AccountMonth"]       = writeoff.AccountMonth;
        ViewState["SheetCode"]          = writeoff.SheetCode;
        ViewState["State"]              = writeoff.State;
        ViewState["HasFeeApply"]        = writeoff["HasFeeApply"];
        ViewState["IsEvectionWriteOff"] = writeoff["IsEvectionWriteOff"];
        ViewState["InsteadPayClient"]   = bll.Model.InsteadPayClient;
        writeoff["Remark"]              = writeoff["Remark"].Replace("\r", "<br/>");
        detailPrint.Visible             = true;
        if (bll.Model.InsteadPayClient > 0)
        {
            BindGridPrint();
            string type = "";
            if (writeoff["InvoiceClassAB"] != "0" && writeoff["InvoiceClassAB"] != "")
            {
                try
                {
                    type = DictionaryBLL.Dictionary_Data_GetAlllList("TableName='FNA_InvoiceClassAB' AND Code='" + writeoff["InvoiceClassAB"] + "'")[0].Name;
                }
                catch
                {
                }
            }

            lbl_message.Text        = "<font color='red'>" + new CM_ClientBLL((int)ViewState["InsteadPayClient"]).Model.FullName + "</font>代垫费用" + "<font color='red'>" + type + "</font>" + "明细表";
            div_client.InnerText    = new CM_ClientBLL((int)ViewState["InsteadPayClient"]).Model.FullName;
            div_type.InnerText      = div_type2.InnerText = div_type3.InnerText = div_type0.InnerText = type;
            div_SheetCode.InnerText = writeoff.SheetCode;
        }
        else if (bll.Model["InsteadPayStaff"] != "0" && bll.Model["InsteadPayStaff"] != "")
        {
            BindGridPrint();
            string type = "";
            if (writeoff["InvoiceClassAB"] != "0" && writeoff["InvoiceClassAB"] != "")
            {
                try
                {
                    type = DictionaryBLL.Dictionary_Data_GetAlllList("TableName='FNA_InvoiceClassAB' AND Code='" + writeoff["InvoiceClassAB"] + "'")[0].Name;
                }
                catch
                {
                }
            }
            lbl_message.Text         = "<font color='red'>" + new Org_StaffBLL(int.Parse(writeoff["InsteadPayStaff"])).Model.RealName + "</font>代垫费用" + "<font color='red'>" + type + "</font>" + "明细表";
            div_client.InnerText     = new Org_StaffBLL(int.Parse(writeoff["InsteadPayStaff"])).Model.RealName;
            div_type.InnerText       = div_type2.InnerText = div_type3.InnerText = div_type0.InnerText = type;
            div_SheetCode.InnerText  = writeoff.SheetCode;
            div_insType.InnerText    = "员工:";
            label_insName.InnerText  = "该员工";
            label_insName2.InnerText = label_insName3.InnerText = "代垫员工";
        }
        writeoff.InsteadPayClient = 0;
        pn_Remark.BindData(writeoff);

        //求费用核消金额合计
        decimal _totalcost = 0;

        foreach (FNA_FeeWriteOffDetail _detail in bll.Items)
        {
            _totalcost += _detail.WriteOffCost + _detail.AdjustCost;
        }
        _totalcost           = Math.Round(_totalcost, 1);
        lb_TotalCostCN.Text  = MCSFramework.Common.Rmb.CmycurD(_totalcost.ToString());
        lb_TotalCost.Text    = _totalcost.ToString("#,##0.00");
        lab_TotalCostCN.Text = lb_TotalCostCN.Text;
        lab_TotalCost.Text   = lb_TotalCost.Text;
        BindGrid();

        #region 绑定差旅行程
        if (writeoff["IsEvectionWriteOff"] == "Y")
        {
            tb_EvectionRouteList.Visible         = true;
            gv_EvectionRouteList.ConditionString = "FNA_EvectionRoute.WriteOffID = " + ViewState["ID"].ToString();
            gv_EvectionRouteList.BindGrid();
        }
        #endregion
    }