Exemplo n.º 1
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        Car_CarListBLL _bll = null;
        if ((int)ViewState["ID"] == 0)
        {
            _bll = new Car_CarListBLL();
        }
        else
        {
            _bll = new Car_CarListBLL((int)ViewState["ID"]);
        }

        pl_detail.GetData(_bll.Model);

        _bll.Model.CarNo = _bll.Model.CarNo.ToUpper();

        if ((int)ViewState["ID"] == 0)
        {
            ViewState["ID"] = _bll.Add();
        }
        else
        {
            _bll.Update();
        }
        Response.Redirect("CarList.aspx");
    }
Exemplo n.º 2
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        Car_CarListBLL _bll = null;

        if ((int)ViewState["ID"] == 0)
        {
            _bll = new Car_CarListBLL();
        }
        else
        {
            _bll = new Car_CarListBLL((int)ViewState["ID"]);
        }

        pl_detail.GetData(_bll.Model);

        _bll.Model.CarNo = _bll.Model.CarNo.ToUpper();

        if ((int)ViewState["ID"] == 0)
        {
            ViewState["ID"] = _bll.Add();
        }
        else
        {
            _bll.Update();
        }
        Response.Redirect("CarList.aspx");
    }
    private void BindDropDown()
    {
        #region 绑定用户可管辖的管理片区
        Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]);
        tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity();

        if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0)
        {
            tr_OrganizeCity.RootValue   = "0";
            tr_OrganizeCity.SelectValue = "1";
        }
        else
        {
            tr_OrganizeCity.RootValue   = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString();
            tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString();
        }
        #endregion

        select_Staff.SelectText  = staff.Model.RealName;
        select_Staff.SelectValue = staff.Model.ID.ToString();

        ddl_Transport.DataSource = DictionaryBLL.GetDicCollections("FNA_EvectionTransport");
        ddl_Transport.DataBind();
        ddl_Transport.Items.Insert(0, new ListItem("请选择...", "0"));

        ddl_Car.DataSource = Car_CarListBLL.GetCarListByOrganizeCity(staff.Model.OrganizeCity);
        ddl_Car.DataBind();
        ddl_Car.Items.Insert(0, new ListItem("请选择", "0"));
    }
    protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e)
    {
        int city = int.Parse(tr_OrganizeCity.SelectValue);

        ddl_Car.DataSource = Car_CarListBLL.GetCarListByOrganizeCity(city).OrderBy(p => p.CarNo);
        ddl_Car.DataBind();
        ddl_Car.Items.Insert(0, new ListItem("请选择", "0"));
    }
    private void BindDropDown()
    {
        int organizecity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;

        ddl_CarID.DataTextField  = "CarNo";
        ddl_CarID.DataValueField = "ID";

        ddl_CarID.DataSource = Car_CarListBLL.GetCarListByOrganizeCity(organizecity).OrderBy(p => p.CarNo).ToList();
        ddl_CarID.DataBind();
        ddl_CarID.Items.Insert(0, new ListItem("请选择", "0"));
    }
    void ddl_CarID_SelectedIndexChanged(object sender, EventArgs e)
    {
        #region 获取该车辆最后行程公里数
        int carID = int.Parse(ddl_CarID.SelectedValue);
        if (carID > 0)
        {
            Car_CarListBLL carBll = new Car_CarListBLL(carID);

            TextBox tbx_KilometresStart = (TextBox)pn_detail.FindControl("Car_DispatchRide_KilometresStart");
            if (tbx_KilometresStart != null)
            {
                if ((int)ViewState["ID"] == 0)
                {
                    tbx_KilometresStart.Text = carBll.Model.Kilometres.ToString();
                }

                if (tbx_KilometresStart.Text != "" && tbx_KilometresStart.Text != "0")
                {
                    tbx_KilometresStart.Enabled = false;
                }
                else
                {
                    tbx_KilometresStart.Enabled = true;
                }
            }

            if (carBll.Model["CarUsage"] == "5")
            {
                //自备车,不可录入费用信息
                if (pn_detail.FindControl("Car_DispatchRide_RoadToll") != null)
                {
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_RoadToll")).Enabled = false;
                }
                if (pn_detail.FindControl("Car_DispatchRide_FuelFee") != null)
                {
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_FuelFee")).Enabled = false;
                }
                if (pn_detail.FindControl("Car_DispatchRide_ParkingFee") != null)
                {
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_ParkingFee")).Enabled = false;
                }
                if (pn_detail.FindControl("Car_DispatchRide_OtherFee") != null)
                {
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_OtherFee")).Enabled = false;
                }
            }
        }
        #endregion
    }
    void ddl_CarID_SelectedIndexChanged(object sender, EventArgs e)
    {
        TextBox tbx_KilometresStart = (TextBox)pl_detail.FindControl("Car_DispatchRide_KilometresStart");

        if (tbx_KilometresStart != null)
        {
            int id = int.Parse(ddl_CarID.SelectedValue);
            if (id > 0)
            {
                Car_CarList c = new Car_CarListBLL(id).Model;
                if (c != null)
                {
                    tbx_KilometresStart.Text = c.Kilometres.ToString();
                }
            }
        }
    }
 void ddl_CarID_SelectedIndexChanged(object sender, EventArgs e)
 {
     TextBox tbx_KilometresStart = (TextBox)pl_detail.FindControl("Car_DispatchRide_KilometresStart");
     if (tbx_KilometresStart != null)
     {
         int id = int.Parse(ddl_CarID.SelectedValue);
         if (id > 0)
         {
             Car_CarList c = new Car_CarListBLL(id).Model;
             if (c != null)
                 tbx_KilometresStart.Text = c.Kilometres.ToString();
         }
     }
 }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region 判断传入参数是否为SheetCode
            if (Request.QueryString["SheetCode"] != null)
            {
                string code = Request.QueryString["SheetCode"];
                IList <FNA_FeeApply> list = FNA_FeeApplyBLL.GetModelList("SheetCode='" + code + "'");
                if (list.Count > 0)
                {
                    Response.Redirect("FeeApplyDetail3.aspx?ID=" + list[0].ID.ToString());
                }
                else
                {
                    Response.Redirect("FeeApplyList.aspx");
                }
            }
            #endregion

            #region 获取参数
            ViewState["ID"]              = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);
            ViewState["OrganizeCity"]    = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]);
            ViewState["FeeType"]         = Request.QueryString["FeeType"] == null ? 0 : int.Parse(Request.QueryString["FeeType"]);
            ViewState["AccountTitle2"]   = Request.QueryString["AccountTitle2"] == null ? 0 : int.Parse(Request.QueryString["AccountTitle2"]);
            ViewState["AccountMonth"]    = Request.QueryString["AccountMonth"] == null ? 0 : int.Parse(Request.QueryString["AccountMonth"]);
            ViewState["ActivityID"]      = Request.QueryString["ActivityID"] == null ? 0 : int.Parse(Request.QueryString["ActivityID"]);
            ViewState["Client"]          = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            ViewState["Brand"]           = Request.QueryString["Brand"] == null ? 0 : int.Parse(Request.QueryString["Brand"]);
            ViewState["RelateCar"]       = Request.QueryString["RelateCar"] == null ? 0 : int.Parse(Request.QueryString["RelateCar"]);
            ViewState["GiftFeeClassify"] = Request.QueryString["GiftFeeClassify"] == null ? 0 : int.Parse(Request.QueryString["GiftFeeClassify"]);
            ViewState["FromGeneralFlow"] = Request.QueryString["FromGeneralFlow"] == null ? "N" : Request.QueryString["FromGeneralFlow"];

            Session["FeeApplyDetail"] = null;
            Session["SuccessFlag"]    = null;
            #endregion

            BindDropDown();

            #region 创建费用明细的列表
            ListTable <FNA_FeeApplyDetail> _details = new ListTable <FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
            ViewState["Details"] = _details;

            int max = 0;
            if (_details.GetListItem().Count > 0)
            {
                _details.GetListItem().Max(p => p.ID);
            }
            ViewState["MaxID"] = max;
            #endregion

            if ((int)ViewState["ID"] == 0)
            {
                if ((int)ViewState["FeeType"] == 0 || (int)ViewState["OrganizeCity"] == 0)
                {
                    Response.Redirect("FeeApplyDetail0.aspx");
                    return;
                }
                ViewState["DicFeeType"] = DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()];

                if ((int)ViewState["AccountMonth"] == 0)
                {
                    ViewState["AccountMonth"] = AC_AccountMonthBLL.GetCurrentMonth();
                }

                #region 新费用申请时,初始化申请信息
                Label lb_OrganizeCity = (Label)pn_FeeApply.FindControl("FNA_FeeApply_OrganizeCity");
                if (lb_OrganizeCity != null)
                {
                    lb_OrganizeCity.Text = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", (int)ViewState["OrganizeCity"]);
                }

                Label lb_month = (Label)pn_FeeApply.FindControl("FNA_FeeApply_AccountMonth");
                if (lb_month != null)
                {
                    lb_month.Text = new AC_AccountMonthBLL((int)ViewState["AccountMonth"]).Model.Name;
                }

                Label lb_FeeType = (Label)pn_FeeApply.FindControl("FNA_FeeApply_FeeType");
                if (lb_FeeType != null)
                {
                    lb_FeeType.Text = ((Dictionary_Data)ViewState["DicFeeType"]).Name;
                }

                Label lb_staff = (Label)pn_FeeApply.FindControl("FNA_FeeApply_InsertStaff");
                if (lb_staff != null)
                {
                    lb_staff.Text = new Org_StaffBLL((int)Session["UserID"]).Model.RealName;
                }

                Label lb_InsertTime = (Label)pn_FeeApply.FindControl("FNA_FeeApply_InsertTime");
                if (lb_InsertTime != null)
                {
                    lb_InsertTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                }

                TextBox tbx_Title = (TextBox)pn_FeeApply.FindControl("FNA_FeeApply_Title");
                if (tbx_Title != null && lb_FeeType != null)
                {
                    tbx_Title.Text = lb_month.Text + " " + lb_FeeType.Text + "申请单" + Session["UserRealName"].ToString();
                }

                if ((int)ViewState["AccountTitle2"] != 0)
                {
                    Label lb_AccountTitle2 = (Label)pn_FeeApply.FindControl("FNA_FeeApply_AccountTitle2");
                    if (lb_AccountTitle2 != null)
                    {
                        lb_AccountTitle2.Text = new AC_AccountTitleBLL((int)ViewState["AccountTitle2"]).Model.Name;
                    }
                }

                DropDownList ddl_Brand = (DropDownList)pn_FeeApply.FindControl("FNA_FeeApply_ProductBrand");
                if (ddl_Brand != null)
                {
                    ddl_Brand.SelectedValue = ViewState["Brand"].ToString();
                }

                if ((int)ViewState["RelateCar"] != 0)
                {
                    Label lb_RelateCar = (Label)pn_FeeApply.FindControl("FNA_FeeApply_RelateCar");
                    if (lb_RelateCar != null)
                    {
                        Car_CarList car = new Car_CarListBLL((int)ViewState["RelateCar"]).Model;
                        if (car != null)
                        {
                            lb_RelateCar.Text = car.CarNo;
                        }
                        else
                        {
                            ViewState["RelateCar"] = 0;
                        }
                    }
                }
                #endregion

                if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
                {
                    BindBudgetInfo();
                }
                else if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "FeeRateControl")
                {
                    BindFeeRateInfo();
                }
                UploadFile1.Visible     = false;
                bt_Submit.Visible       = false;
                bt_ViewReport.Visible   = false;
                bt_Print.Visible        = false;
                bt_Copy.Visible         = false;
                bt_ViewWriteOff.Visible = false;
                bt_Cancel.Visible       = false;
                tbl_Remark.Visible      = true;
            }
            else
            {
                BindData();
            }
            bt_AddDetail.OnClientClick =
                string.Format("PopAddFeeDetail({0},{1},{2},{3},{4},{5});",
                              ViewState["FeeType"].ToString(),
                              ViewState["OrganizeCity"].ToString(),
                              ViewState["AccountMonth"].ToString(),
                              ViewState["AccountTitle2"].ToString(),
                              ViewState["Brand"].ToString(),
                              ViewState["RelateCar"].ToString()
                              );
        }

        #region 注册弹出窗口脚本
        string script = "function PopAddFeeDetail(feetype,organizecity,month,accounttitle2,brand,car){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("Pop_AddFeeApplyDetailItem.aspx") +
                  "?FeeType=' + feetype + '&OrganizeCity=' + organizecity + '&AccountMonth=' + month + '&AccountTitle2=' + accounttitle2 + '&Client=" +
                  ViewState["Client"].ToString() + "&Brand=' + brand + '&RelateCar=' + car + '&FromGeneralFlow=" + ViewState["FromGeneralFlow"].ToString()
                  + "&tempid='+tempid, window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopAddFeeDetail", script, true);

        script  = "function PopReport(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/ReportViewer/PubReportViewerFeeApp.aspx?ViewFramework=false&ReportPath=/MCS_FNA_Report/Report_FNA_ClientInfoByAppID_001&FeeAppID=' + id ") +
                  ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReport", script, true);

        script  = "function PopWriteOffListByDetailID(detailid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeWriteoff/Pop_FeeWriteOffListByFeeApply.aspx?tempid='+tempid+'&FeeApplyDetailID=' + detailid ") +
                  ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopWriteOffListByDetailID", script, true);

        script  = "function PopWriteOffListByApplyID(applyid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeWriteoff/Pop_FeeWriteOffListByFeeApply.aspx?tempid='+tempid+'&FeeApplyID=' + applyid ") +
                  ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopWriteOffListByApplyID", script, true);

        script  = "function PopAdjust(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("Pop_AdjustApplyDetail.aspx") +
                  "?ID=' + id + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopAdjust", script, true);

        script  = "function PopClientFNAInfo(clientid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeApplyOrWriteoffByClientList.aspx") +
                  "?ClientID=' + clientid + '&tempid='+tempid, window, 'dialogWidth:900px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopClientFNAInfo", script, true);
        #endregion
    }
Exemplo n.º 10
0
    private void BindData()
    {
        Car_CarList m = new Car_CarListBLL((int)ViewState["ID"]).Model;

        pl_detail.BindData(m);
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_EvectionRouteBLL bll;
        Car_DispatchRideBLL car_ridebll = null;

        if ((int)ViewState["ID"] == 0)
            bll = new FNA_EvectionRouteBLL();
        else
            bll = new FNA_EvectionRouteBLL((int)ViewState["ID"]);

        pn_detail.GetData(bll.Model);

        #region 保存车辆使用信息
        if (bll.Model.Transport == "4")
        {
            //自驾车时,关联派车单
            if (string.IsNullOrEmpty(bll.Model["RelateCarDispatch"]))
            {
                car_ridebll = new Car_DispatchRideBLL();
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.Matters = "差旅行程";
                car_ridebll.Model.State = 3; //已交车
                car_ridebll.Model.OrganizeCity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
                car_ridebll.Model.ActGoBackTime = DateTime.Now;
                car_ridebll.Model.ApproveFlag = 2;
                car_ridebll.Model.ApplyStaff = bll.Model.RelateStaff;
                car_ridebll.Model.InsertStaff = (int)Session["UserID"];

                bll.Model["RelateCarDispatch"] = car_ridebll.Add().ToString();
            }
            else
            {
                car_ridebll = new Car_DispatchRideBLL(int.Parse(bll.Model["RelateCarDispatch"]));
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.UpdateStaff = (int)Session["UserID"];
                car_ridebll.Update();
            }

            //更新车辆最后的公里数
            Car_CarListBLL CarBll = new Car_CarListBLL(car_ridebll.Model.CarID);
            if (CarBll.Model != null)
            {
                if (Car_DispatchRideBLL.GetModelList("CarID=" + car_ridebll.Model.CarID.ToString() +
                    " AND ID > " + car_ridebll.Model.ID.ToString()).Count == 0)
                {
                    //如果当前用车信息是该车辆最后一次用车记录,则更新车辆最后公里数
                    CarBll.Model.Kilometres = car_ridebll.Model.KilometresEnd;
                    CarBll.Update();
                }
            }
        }
        #endregion

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["ID"] = bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (car_ridebll != null && car_ridebll.Model["RelateEvectionRoute"] == "")
        {
            car_ridebll.Model["RelateEvectionRoute"] = ViewState["ID"].ToString();
            car_ridebll.Update();
        }

        if (sender != null)
            MessageBox.ShowAndClose(this, "保存成功!");
    }
    void ddl_CarID_SelectedIndexChanged(object sender, EventArgs e)
    {
        #region 获取该车辆最后行程公里数
        int carID = int.Parse(ddl_CarID.SelectedValue);
        if (carID > 0)
        {
            Car_CarListBLL carBll = new Car_CarListBLL(carID);

            TextBox tbx_KilometresStart = (TextBox)pn_detail.FindControl("Car_DispatchRide_KilometresStart");
            if (tbx_KilometresStart != null)
            {
                if ((int)ViewState["ID"] == 0) tbx_KilometresStart.Text = carBll.Model.Kilometres.ToString();

                if (tbx_KilometresStart.Text != "" && tbx_KilometresStart.Text != "0")
                    tbx_KilometresStart.Enabled = false;
                else
                    tbx_KilometresStart.Enabled = true;
            }

            if (carBll.Model["CarUsage"] == "5")
            {
                //自备车,不可录入费用信息
                if (pn_detail.FindControl("Car_DispatchRide_RoadToll") != null)
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_RoadToll")).Enabled = false;
                if (pn_detail.FindControl("Car_DispatchRide_FuelFee") != null)
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_FuelFee")).Enabled = false;
                if (pn_detail.FindControl("Car_DispatchRide_ParkingFee") != null)
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_ParkingFee")).Enabled = false;
                if (pn_detail.FindControl("Car_DispatchRide_OtherFee") != null)
                    ((TextBox)pn_detail.FindControl("Car_DispatchRide_OtherFee")).Enabled = false;
            }
        }
        #endregion
    }
 private void BindDropDown()
 {
     ddl_Car.DataSource = Car_CarListBLL.GetModelList("State IN (1,2)");
     ddl_Car.DataBind();
     ddl_Car.Items.Insert(0, new ListItem("请选择", "0"));
 }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterClientScriptInclude("meizzDate", Page.ResolveClientUrl("~/App_Themes/basic/meizzDate.js"));
        if (!IsPostBack)
        {
            #region 获取参数
            ViewState["FeeType"]         = Request.QueryString["FeeType"] == null ? 1 : int.Parse(Request.QueryString["FeeType"]);
            ViewState["AccountTitle2"]   = Request.QueryString["AccountTitle2"] == null ? 0 : int.Parse(Request.QueryString["AccountTitle2"]);
            ViewState["Client"]          = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            ViewState["AccountMonth"]    = Request.QueryString["AccountMonth"] == null ? 0 : int.Parse(Request.QueryString["AccountMonth"]);
            ViewState["Brand"]           = Request.QueryString["Brand"] == null ? 0 : int.Parse(Request.QueryString["Brand"]);
            ViewState["RelateCar"]       = Request.QueryString["RelateCar"] == null ? 0 : int.Parse(Request.QueryString["RelateCar"]);
            ViewState["FromGeneralFlow"] = Request.QueryString["FromGeneralFlow"] == null ? "N" : Request.QueryString["FromGeneralFlow"];

            if (Request.QueryString["OrganizeCity"] != null)
            {
                select_Client.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?OrganizeCity=" + Request.QueryString["OrganizeCity"];
            }
            #endregion

            BindDropDown();

            if (ViewState["Client"] != null && (int)ViewState["Client"] > 0)
            {
                MCSFramework.Model.CM.CM_Client c = new CM_ClientBLL((int)ViewState["Client"]).Model;
                if (c != null)
                {
                    select_Client.SelectText  = c.FullName;
                    select_Client.SelectValue = c.ID.ToString();
                    select_Client.Enabled     = false;
                }
            }

            #region 是否是车辆参数
            if ((int)ViewState["RelateCar"] > 0)
            {
                Car_CarList car = new Car_CarListBLL((int)ViewState["RelateCar"]).Model;
                if (car != null)
                {
                    lb_RelateCar.Text = car.CarNo;
                    tb_Client.Visible = false;
                }
                else
                {
                    ViewState["RelateCar"] = 0;
                    tb_Car.Visible         = false;
                }
            }
            else
            {
                tb_Car.Visible = false;
            }
            #endregion

            #region  递或创建空的费用明细列表
            ListTable <FNA_FeeApplyDetail> _details;

            if (Session["FeeApplyDetail"] != null)
            {
                _details = (ListTable <FNA_FeeApplyDetail>)Session["FeeApplyDetail"];
                int max = 0;
                foreach (FNA_FeeApplyDetail item in _details.GetListItem())
                {
                    if (item.ID > max)
                    {
                        max = item.ID;
                    }
                }
                ViewState["MaxID"]   = max;
                ViewState["Details"] = _details;
            }
            else
            {
                _details             = new ListTable <FNA_FeeApplyDetail>(new List <FNA_FeeApplyDetail>(), "ID");
                ViewState["MaxID"]   = 0;
                ViewState["Details"] = _details;
                AddEmptyDetail();
            }


            #endregion

            BindGrid();
        }
    }
Exemplo n.º 15
0
 private void BindData()
 {
     Car_CarList m = new Car_CarListBLL((int)ViewState["ID"]).Model;
     pl_detail.BindData(m);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region 判断传入参数是否为SheetCode
            if (Request.QueryString["SheetCode"] != null)
            {
                string code = Request.QueryString["SheetCode"];
                IList<FNA_FeeApply> list = FNA_FeeApplyBLL.GetModelList("SheetCode='" + code + "'");
                if (list.Count > 0)
                    Response.Redirect("FeeApplyDetail3.aspx?ID=" + list[0].ID.ToString());
                else
                    Response.Redirect("FeeApplyList.aspx");
            }
            #endregion

            #region 获取参数
            ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);
            ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]);
            ViewState["FeeType"] = Request.QueryString["FeeType"] == null ? 0 : int.Parse(Request.QueryString["FeeType"]);
            ViewState["AccountTitle2"] = Request.QueryString["AccountTitle2"] == null ? 0 : int.Parse(Request.QueryString["AccountTitle2"]);
            ViewState["AccountMonth"] = Request.QueryString["AccountMonth"] == null ? 0 : int.Parse(Request.QueryString["AccountMonth"]);
            ViewState["ActivityID"] = Request.QueryString["ActivityID"] == null ? 0 : int.Parse(Request.QueryString["ActivityID"]);
            ViewState["Client"] = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            ViewState["Brand"] = Request.QueryString["Brand"] == null ? 0 : int.Parse(Request.QueryString["Brand"]);
            ViewState["RelateCar"] = Request.QueryString["RelateCar"] == null ? 0 : int.Parse(Request.QueryString["RelateCar"]);
            ViewState["GiftFeeClassify"] = Request.QueryString["GiftFeeClassify"] == null ? 0 : int.Parse(Request.QueryString["GiftFeeClassify"]);
            ViewState["FromGeneralFlow"] = Request.QueryString["FromGeneralFlow"] == null ? "N" : Request.QueryString["FromGeneralFlow"];

            Session["FeeApplyDetail"] = null;
            Session["SuccessFlag"] = null;
            #endregion

            BindDropDown();

            #region 创建费用明细的列表
            ListTable<FNA_FeeApplyDetail> _details = new ListTable<FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
            ViewState["Details"] = _details;

            int max = 0;
            if (_details.GetListItem().Count > 0) _details.GetListItem().Max(p => p.ID);
            ViewState["MaxID"] = max;
            #endregion

            if ((int)ViewState["ID"] == 0)
            {
                if ((int)ViewState["FeeType"] == 0 || (int)ViewState["OrganizeCity"] == 0)
                {
                    Response.Redirect("FeeApplyDetail0.aspx");
                    return;
                }
                ViewState["DicFeeType"] = DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()];

                if ((int)ViewState["AccountMonth"] == 0)
                    ViewState["AccountMonth"] = AC_AccountMonthBLL.GetCurrentMonth();

                #region 新费用申请时,初始化申请信息
                Label lb_OrganizeCity = (Label)pn_FeeApply.FindControl("FNA_FeeApply_OrganizeCity");
                if (lb_OrganizeCity != null) lb_OrganizeCity.Text = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", (int)ViewState["OrganizeCity"]);

                Label lb_month = (Label)pn_FeeApply.FindControl("FNA_FeeApply_AccountMonth");
                if (lb_month != null) lb_month.Text = new AC_AccountMonthBLL((int)ViewState["AccountMonth"]).Model.Name;

                Label lb_FeeType = (Label)pn_FeeApply.FindControl("FNA_FeeApply_FeeType");
                if (lb_FeeType != null) lb_FeeType.Text = ((Dictionary_Data)ViewState["DicFeeType"]).Name;

                Label lb_staff = (Label)pn_FeeApply.FindControl("FNA_FeeApply_InsertStaff");
                if (lb_staff != null) lb_staff.Text = new Org_StaffBLL((int)Session["UserID"]).Model.RealName;

                Label lb_InsertTime = (Label)pn_FeeApply.FindControl("FNA_FeeApply_InsertTime");
                if (lb_InsertTime != null) lb_InsertTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");

                TextBox tbx_Title = (TextBox)pn_FeeApply.FindControl("FNA_FeeApply_Title");
                if (tbx_Title != null && lb_FeeType != null)
                    tbx_Title.Text = lb_month.Text + " " + lb_FeeType.Text + "申请单" + Session["UserRealName"].ToString();

                if ((int)ViewState["AccountTitle2"] != 0)
                {
                    Label lb_AccountTitle2 = (Label)pn_FeeApply.FindControl("FNA_FeeApply_AccountTitle2");
                    if (lb_AccountTitle2 != null) lb_AccountTitle2.Text = new AC_AccountTitleBLL((int)ViewState["AccountTitle2"]).Model.Name;
                }

                DropDownList ddl_Brand = (DropDownList)pn_FeeApply.FindControl("FNA_FeeApply_ProductBrand");
                if (ddl_Brand != null) ddl_Brand.SelectedValue = ViewState["Brand"].ToString();

                if ((int)ViewState["RelateCar"] != 0)
                {
                    Label lb_RelateCar = (Label)pn_FeeApply.FindControl("FNA_FeeApply_RelateCar");
                    if (lb_RelateCar != null)
                    {
                        Car_CarList car = new Car_CarListBLL((int)ViewState["RelateCar"]).Model;
                        if (car != null)
                            lb_RelateCar.Text = car.CarNo;
                        else
                            ViewState["RelateCar"] = 0;
                    }
                }
                #endregion

                if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
                    BindBudgetInfo();
                else if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "FeeRateControl")
                    BindFeeRateInfo();
                UploadFile1.Visible = false;
                bt_Submit.Visible = false;
                bt_ViewReport.Visible = false;
                bt_Print.Visible = false;
                bt_Copy.Visible = false;
                bt_ViewWriteOff.Visible = false;
                bt_Cancel.Visible = false;
                tbl_Remark.Visible = true;
            }
            else
            {
                BindData();
            }
            bt_AddDetail.OnClientClick =
                string.Format("PopAddFeeDetail({0},{1},{2},{3},{4},{5});",
                    ViewState["FeeType"].ToString(),
                    ViewState["OrganizeCity"].ToString(),
                    ViewState["AccountMonth"].ToString(),
                    ViewState["AccountTitle2"].ToString(),
                    ViewState["Brand"].ToString(),
                    ViewState["RelateCar"].ToString()
                    );
        }

        #region 注册弹出窗口脚本
        string script = "function PopAddFeeDetail(feetype,organizecity,month,accounttitle2,brand,car){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("Pop_AddFeeApplyDetailItem.aspx") +
            "?FeeType=' + feetype + '&OrganizeCity=' + organizecity + '&AccountMonth=' + month + '&AccountTitle2=' + accounttitle2 + '&Client=" +
            ViewState["Client"].ToString() + "&Brand=' + brand + '&RelateCar=' + car + '&FromGeneralFlow=" + ViewState["FromGeneralFlow"].ToString()
            + "&tempid='+tempid, window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopAddFeeDetail", script, true);

        script = "function PopReport(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/ReportViewer/PubReportViewerFeeApp.aspx?ViewFramework=false&ReportPath=/MCS_FNA_Report/Report_FNA_ClientInfoByAppID_001&FeeAppID=' + id ") +
            ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReport", script, true);

        script = "function PopWriteOffListByDetailID(detailid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeWriteoff/Pop_FeeWriteOffListByFeeApply.aspx?tempid='+tempid+'&FeeApplyDetailID=' + detailid ") +
            ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopWriteOffListByDetailID", script, true);

        script = "function PopWriteOffListByApplyID(applyid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeWriteoff/Pop_FeeWriteOffListByFeeApply.aspx?tempid='+tempid+'&FeeApplyID=' + applyid ") +
            ", window, 'dialogWidth:800px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopWriteOffListByApplyID", script, true);

        script = "function PopAdjust(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("Pop_AdjustApplyDetail.aspx") +
            "?ID=' + id + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopAdjust", script, true);

        script = "function PopClientFNAInfo(clientid){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../FeeApplyOrWriteoffByClientList.aspx") +
            "?ClientID=' + clientid + '&tempid='+tempid, window, 'dialogWidth:900px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopClientFNAInfo", script, true);
        #endregion
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_EvectionRouteBLL bll;
        Car_DispatchRideBLL  car_ridebll = null;

        if ((int)ViewState["ID"] == 0)
        {
            bll = new FNA_EvectionRouteBLL();
        }
        else
        {
            bll = new FNA_EvectionRouteBLL((int)ViewState["ID"]);
        }

        pn_detail.GetData(bll.Model);

        #region 保存车辆使用信息
        if (bll.Model.Transport == "4")
        {
            //自驾车时,关联派车单
            if (string.IsNullOrEmpty(bll.Model["RelateCarDispatch"]))
            {
                car_ridebll = new Car_DispatchRideBLL();
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination   = bll.Model.EvectionLine;
                car_ridebll.Model.Matters       = "差旅行程";
                car_ridebll.Model.State         = 3; //已交车
                car_ridebll.Model.OrganizeCity  = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
                car_ridebll.Model.ActGoBackTime = DateTime.Now;
                car_ridebll.Model.ApproveFlag   = 2;
                car_ridebll.Model.ApplyStaff    = bll.Model.RelateStaff;
                car_ridebll.Model.InsertStaff   = (int)Session["UserID"];

                bll.Model["RelateCarDispatch"] = car_ridebll.Add().ToString();
            }
            else
            {
                car_ridebll = new Car_DispatchRideBLL(int.Parse(bll.Model["RelateCarDispatch"]));
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.UpdateStaff = (int)Session["UserID"];
                car_ridebll.Update();
            }

            //更新车辆最后的公里数
            Car_CarListBLL CarBll = new Car_CarListBLL(car_ridebll.Model.CarID);
            if (CarBll.Model != null)
            {
                if (Car_DispatchRideBLL.GetModelList("CarID=" + car_ridebll.Model.CarID.ToString() +
                                                     " AND ID > " + car_ridebll.Model.ID.ToString()).Count == 0)
                {
                    //如果当前用车信息是该车辆最后一次用车记录,则更新车辆最后公里数
                    CarBll.Model.Kilometres = car_ridebll.Model.KilometresEnd;
                    CarBll.Update();
                }
            }
        }
        #endregion

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["ID"]       = bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (car_ridebll != null && car_ridebll.Model["RelateEvectionRoute"] == "")
        {
            car_ridebll.Model["RelateEvectionRoute"] = ViewState["ID"].ToString();
            car_ridebll.Update();
        }

        if (sender != null)
        {
            MessageBox.ShowAndClose(this, "保存成功!");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterClientScriptInclude("meizzDate", Page.ResolveClientUrl("~/App_Themes/basic/meizzDate.js"));
        if (!IsPostBack)
        {
            #region 获取参数
            ViewState["FeeType"] = Request.QueryString["FeeType"] == null ? 1 : int.Parse(Request.QueryString["FeeType"]);
            ViewState["AccountTitle2"] = Request.QueryString["AccountTitle2"] == null ? 0 : int.Parse(Request.QueryString["AccountTitle2"]);
            ViewState["Client"] = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            ViewState["AccountMonth"] = Request.QueryString["AccountMonth"] == null ? 0 : int.Parse(Request.QueryString["AccountMonth"]);
            ViewState["Brand"] = Request.QueryString["Brand"] == null ? 0 : int.Parse(Request.QueryString["Brand"]);
            ViewState["RelateCar"] = Request.QueryString["RelateCar"] == null ? 0 : int.Parse(Request.QueryString["RelateCar"]);
            ViewState["FromGeneralFlow"] = Request.QueryString["FromGeneralFlow"] == null ? "N" : Request.QueryString["FromGeneralFlow"];

            if (Request.QueryString["OrganizeCity"] != null)
            {
                select_Client.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?OrganizeCity=" + Request.QueryString["OrganizeCity"];
            }
            #endregion

            BindDropDown();

            if (ViewState["Client"] != null && (int)ViewState["Client"] > 0)
            {
                MCSFramework.Model.CM.CM_Client c = new CM_ClientBLL((int)ViewState["Client"]).Model;
                if (c != null)
                {
                    select_Client.SelectText = c.FullName;
                    select_Client.SelectValue = c.ID.ToString();
                    select_Client.Enabled = false;
                }
            }

            #region 是否是车辆参数
            if ((int)ViewState["RelateCar"] > 0)
            {
                Car_CarList car = new Car_CarListBLL((int)ViewState["RelateCar"]).Model;
                if (car != null)
                {
                    lb_RelateCar.Text = car.CarNo;
                    tb_Client.Visible = false;
                }
                else
                {
                    ViewState["RelateCar"] = 0;
                    tb_Car.Visible = false;
                }
            }
            else
            {
                tb_Car.Visible = false;
            }
            #endregion

            #region 传递或创建空的费用明细列表
            ListTable<FNA_FeeApplyDetail> _details;

            if (Session["FeeApplyDetail"] != null)
            {
                _details = (ListTable<FNA_FeeApplyDetail>)Session["FeeApplyDetail"];
                int max = 0;
                foreach (FNA_FeeApplyDetail item in _details.GetListItem())
                {
                    if (item.ID > max) max = item.ID;
                }
                ViewState["MaxID"] = max;
                ViewState["Details"] = _details;
            }
            else
            {
                _details = new ListTable<FNA_FeeApplyDetail>(new List<FNA_FeeApplyDetail>(), "ID");
                ViewState["MaxID"] = 0;
                ViewState["Details"] = _details;
                AddEmptyDetail();
            }

            #endregion

            BindGrid();
        }
    }