private void BindData()
    {
        CM_PropertyInTelephone m = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]).Model;

        if (m != null)
        {
            pl_detail.BindData(m);
        }

        #region 状态控制
        switch (m.State)
        {
        case 1:
            bt_Install.Visible   = false;
            bt_Uninstall.Visible = false;
            break;

        case 2:
            pl_detail.SetControlsEnable(false);
            bt_OK.Visible        = false;
            bt_Submit.Visible    = false;
            bt_Install.Visible   = false;
            bt_Uninstall.Visible = false;
            break;

        case 3:
            pl_detail.SetControlsEnable(false);
            ((TextBox)pl_detail.FindControl("CM_PropertyInTelephone_TeleNumber")).Enabled = true;
            bt_Submit.Visible = false;
            bt_OK.Visible     = false;
            break;

        case 4:
            pl_detail.SetControlsEnable(false);
            bt_OK.Visible      = false;
            bt_Submit.Visible  = false;
            bt_Install.Visible = false;
            break;

        case 5:
            pl_detail.SetControlsEnable(false);
            bt_OK.Visible        = false;
            bt_Submit.Visible    = false;
            bt_Install.Visible   = false;
            bt_Uninstall.Visible = false;
            break;

        default:
            break;
        }
        #endregion
    }
    protected void bt_Uninstall_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            CM_PropertyInTelephoneBLL _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);

            _bll.Model.UninstallDate = DateTime.Today;
            _bll.Model.State         = 5; //已拆机状态
            _bll.Model.UpdateStaff   = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "成功将该电话设为已拆机状态,以后无法再申请该电话的费用!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
示例#3
0
    protected void ddl_Tele_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddl_Tele.SelectedValue != "0")
        {
            int teleid = int.Parse(ddl_Tele.SelectedValue);
            CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model;

            lb_TeleApplyInfo.Text = string.Format("电话费:{0:0.##元},宽带费:{1:0.##元}", tele.TeleCost, tele.NetCost);
            lb_TeleApplyCost.Text = (tele.TeleCost + tele.NetCost).ToString("0.##");
            tbx_TeleCost.Text     = lb_TeleApplyCost.Text;

            bt_AddTeleFee.Enabled = true;
        }
        else
        {
            bt_AddTeleFee.Enabled = false;
        }
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        CM_PropertyInTelephoneBLL _bll;

        if ((int)ViewState["TelephoneID"] != 0)
        {
            //修改
            _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
        }
        else
        {
            //新增
            _bll = new CM_PropertyInTelephoneBLL();
        }

        pl_detail.GetData(_bll.Model);

        #region 判断必填项

        #endregion
        if ((int)ViewState["TelephoneID"] != 0)
        {
            //修改
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "修改成功!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
        else
        {
            //新增
            _bll.Model.State       = 1;
            _bll.Model.ApproveFlag = 2;

            _bll.Model.InsertStaff   = (int)Session["UserID"];
            ViewState["TelephoneID"] = _bll.Add();
            if ((int)ViewState["TelephoneID"] > 0)
            {
                MessageBox.ShowAndRedirect(this, "新增成功!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        CM_PropertyInTelephoneBLL _bll;
        if ((int)ViewState["TelephoneID"] != 0)
        {
            //修改
            _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
        }
        else
        {
            //新增
            _bll = new CM_PropertyInTelephoneBLL();
        }

        pl_detail.GetData(_bll.Model);

        #region 判断必填项

        #endregion
        if ((int)ViewState["TelephoneID"] != 0)
        {
            //修改
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "修改成功!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
        else
        {
            //新增
            _bll.Model.State = 1;
            _bll.Model.ApproveFlag = 2;

            _bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["TelephoneID"] = _bll.Add();
            if ((int)ViewState["TelephoneID"] > 0)
            {
                MessageBox.ShowAndRedirect(this, "新增成功!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            string _title = "";

            CM_PropertyInTelephoneBLL _bll        = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
            NameValueCollection       dataobjects = new NameValueCollection();
            dataobjects.Add("ID", _bll.Model.ID.ToString());
            if (_bll.Model.Client > 0)
            {
                CM_Client _c = new CM_ClientBLL(_bll.Model.Client).Model;
                if (_c != null)
                {
                    dataobjects.Add("ClientID", _bll.Model.Client.ToString());
                    dataobjects.Add("ClientName", _c.FullName);
                    _title += _c.FullName;
                }
            }
            dataobjects.Add("TeleNumber", _bll.Model.TeleNumber.ToString());
            dataobjects.Add("TeleCost", _bll.Model.TeleCost.ToString("0.##"));
            dataobjects.Add("NetCost", _bll.Model.NetCost.ToString("0.##"));

            #region 组织任务标题

            _title += "电话号码:" + _bll.Model.TeleNumber;

            #endregion

            int TaskID = EWF_TaskBLL.NewTask("CM_PropertyInTelephone_Flow", (int)Session["UserID"], _title,
                                             "~/SubModule/CM/PD/PropertyInTelephoneDetail.aspx?TelephoneID=" + _bll.Model.ID.ToString(), dataobjects);
            if (TaskID > 0)
            {
                _bll.Model.State       = 2;
                _bll.Model.ApproveTask = TaskID;
                _bll.Update();
                new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            }

            Response.Redirect("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + TaskID.ToString());
        }
    }
示例#7
0
    private void BindTeleList()
    {
        IList <CM_PropertyInTelephone> teles = CM_PropertyInTelephoneBLL.GetListByOrganizeCity((int)ViewState["OrganizeCity"]);

        ddl_Tele.DataSource = teles;
        ddl_Tele.DataBind();
        ddl_Tele.Items.Insert(0, new ListItem("请选择", "0"));

        ddl_TeleCostMonth.DataSource = AC_AccountMonthBLL.GetModelList("BeginDate BETWEEN DateAdd(month,-3,DATEADD(day,-7,GETDATE())) AND GETDATE()");
        ddl_TeleCostMonth.DataBind();
        ddl_TeleCostMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-7)).ToString();

        ddl_MobileCostMonth.DataSource = AC_AccountMonthBLL.GetModelList("BeginDate BETWEEN DateAdd(month,-3,DATEADD(day,-7,GETDATE())) AND GETDATE()");
        ddl_MobileCostMonth.DataBind();
        ddl_MobileCostMonth.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-7)).ToString();

        select_MobileStaff.SelectValue = Session["UserID"].ToString();
        select_MobileStaff.SelectText  = Session["UserRealName"].ToString();
        select_MobileStaff_SelectChange(null, null);
    }
    protected void bt_Install_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            CM_PropertyInTelephoneBLL _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
            pl_detail.GetData(_bll.Model);

            if (_bll.Model.TeleNumber == "")
            {
                MessageBox.Show(this, "请正确输入安装的电话号码!");
                return;
            }

            _bll.Model.State = 4;       //已安装状态
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "成功将该电话设为安装状态!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
    protected void bt_Install_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            CM_PropertyInTelephoneBLL _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
            pl_detail.GetData(_bll.Model);

            if (_bll.Model.TeleNumber == "")
            {
                MessageBox.Show(this, "请正确输入安装的电话号码!");
                return;
            }

            _bll.Model.State       = 4; //已安装状态
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "成功将该电话设为安装状态!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
    protected void ddl_Tele_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddl_Tele.SelectedValue != "0")
        {
            int teleid = int.Parse(ddl_Tele.SelectedValue);
            CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model;

            lb_TeleApplyInfo.Text = string.Format("电话费:{0:0.##元},宽带费:{1:0.##元}", tele.TeleCost, tele.NetCost);
            lb_TeleApplyCost.Text = (tele.TeleCost + tele.NetCost).ToString("0.##");
            tbx_TeleCost.Text = lb_TeleApplyCost.Text;

            bt_AddTeleFee.Enabled = true;
        }
        else
        {
            bt_AddTeleFee.Enabled = false;
        }
    }
    protected void bt_AddTeleFee_Click(object sender, EventArgs e)
    {
        if (ddl_Tele.SelectedValue == "0") return;

        int teleid = int.Parse(ddl_Tele.SelectedValue);
        CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model;

        decimal writeoffcost = decimal.Parse(tbx_TeleCost.Text);
        decimal applycost = tele.TeleCost + tele.NetCost;

        if (writeoffcost > applycost)
        {
            MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_TeleApplyCost.Text + "!");
            tbx_TeleCost.Text = lb_TeleApplyCost.Text;
            return;
        }

        SaveGrid();
        ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

        #region 组织电话费核销明细
        FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail();
        item.ID = (int)ViewState["MaxID"];
        item.AccountTitle = ConfigHelper.GetConfigInt("TeleCostACTitle");
        item.ApplyCost = applycost;
        item.WriteOffCost = writeoffcost;

        item["TeleFeeRelateTelephone"] = tele.ID.ToString();
        item.Client = tele.Client;

        #region 获取当前会计月的开始及截止日期
        int month = int.Parse(ddl_TeleCostMonth.SelectedValue);
        AC_AccountMonth m = new AC_AccountMonthBLL(month).Model;
        item.BeginMonth = m.ID;
        item.EndMonth = m.ID;
        item.BeginDate = m.BeginDate;
        item.EndDate = m.EndDate;
        #endregion

        if (tele.Client > 0)
        {
            CM_Client client = new CM_ClientBLL(tele.Client).Model;
            if (client != null) item.Remark = "物业:" + client.FullName + ";";
        }
        item.Remark += "电话号码:" + ddl_Tele.SelectedItem.Text + ";月份:" + ddl_TeleCostMonth.SelectedItem.Text +
            ";限额:" + lb_TeleApplyInfo.Text + ";";

        if (tbx_TeleRemark.Text != "")
            item.Remark += "说明:" + tbx_TeleRemark.Text;
        #endregion

        if (FNA_FeeWriteOffBLL.CheckTeleFeeHasWriteOff(item.AccountTitle, item.BeginMonth, tele.ID))
        {
            MessageBox.Show(this, "该电话指定月的费用,已在其他报销单中报销,请勿重复报销!");
        }
        else
        {
            ListTable<FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable<FNA_FeeWriteOffDetail>;
            if (_details.GetListItem().FirstOrDefault(p =>
                p.AccountTitle == item.AccountTitle &&
                p.BeginMonth == item.BeginMonth &&
                p["TeleFeeRelateTelephone"] == item["TeleFeeRelateTelephone"]) == null)
            {
                _details.Add(item);             //新增科目
            }
            else
            {
                MessageBox.Show(this, "该电话指定月的费用,已在本报销单中,请勿重复报销!");
            }
        }
        BindGrid();
        AddEmptyDetail();
    }
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            string _title = "";

            CM_PropertyInTelephoneBLL _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", _bll.Model.ID.ToString());
            if (_bll.Model.Client > 0)
            {
                CM_Client _c = new CM_ClientBLL(_bll.Model.Client).Model;
                if (_c != null)
                {
                    dataobjects.Add("ClientID", _bll.Model.Client.ToString());
                    dataobjects.Add("ClientName", _c.FullName);
                    _title += _c.FullName;
                }
            }
            dataobjects.Add("TeleNumber", _bll.Model.TeleNumber.ToString());
            dataobjects.Add("TeleCost", _bll.Model.TeleCost.ToString("0.##"));
            dataobjects.Add("NetCost", _bll.Model.NetCost.ToString("0.##"));

            #region 组织任务标题

            _title += "电话号码:" + _bll.Model.TeleNumber;

            #endregion

            int TaskID = EWF_TaskBLL.NewTask("CM_PropertyInTelephone_Flow", (int)Session["UserID"], _title,
                "~/SubModule/CM/PD/PropertyInTelephoneDetail.aspx?TelephoneID=" + _bll.Model.ID.ToString(), dataobjects);
            if (TaskID > 0)
            {
                _bll.Model.State = 2;
                _bll.Model.ApproveTask = TaskID;
                _bll.Update();
                new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            }

            Response.Redirect("~/SubModule/EWF/TaskDetail.aspx?TaskID=" + TaskID.ToString());
        }
    }
    private void BindData()
    {
        CM_PropertyInTelephone m = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]).Model;
        if (m != null) pl_detail.BindData(m);

        #region 状态控制
        switch (m.State)
        {
            case 1:
                bt_Install.Visible = false;
                bt_Uninstall.Visible = false;
                break;
            case 2:
                pl_detail.SetControlsEnable(false);
                bt_OK.Visible = false;
                bt_Submit.Visible = false;
                bt_Install.Visible = false;
                bt_Uninstall.Visible = false;
                break;
            case 3:
                pl_detail.SetControlsEnable(false);
                ((TextBox)pl_detail.FindControl("CM_PropertyInTelephone_TeleNumber")).Enabled = true;
                bt_Submit.Visible = false;
                bt_OK.Visible = false;
                break;
            case 4:
                pl_detail.SetControlsEnable(false);
                bt_OK.Visible = false;
                bt_Submit.Visible = false;
                bt_Install.Visible = false;
                break;
            case 5:
                pl_detail.SetControlsEnable(false);
                bt_OK.Visible = false;
                bt_Submit.Visible = false;
                bt_Install.Visible = false;
                bt_Uninstall.Visible = false;
                break;
            default:
                break;
        }
        #endregion
    }
    protected void bt_Uninstall_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["TelephoneID"] != 0)
        {
            CM_PropertyInTelephoneBLL _bll = new CM_PropertyInTelephoneBLL((int)ViewState["TelephoneID"]);

            _bll.Model.UninstallDate = DateTime.Today;
            _bll.Model.State = 5;       //已拆机状态
            _bll.Model.UpdateStaff = (int)Session["UserID"];
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "成功将该电话设为已拆机状态,以后无法再申请该电话的费用!", "PropertyDetail.aspx?ClientID=" + _bll.Model.Client.ToString());
            }
        }
    }
示例#15
0
    protected void bt_AddTeleFee_Click(object sender, EventArgs e)
    {
        if (ddl_Tele.SelectedValue == "0")
        {
            return;
        }

        int teleid = int.Parse(ddl_Tele.SelectedValue);
        CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model;

        decimal writeoffcost = decimal.Parse(tbx_TeleCost.Text);
        decimal applycost    = tele.TeleCost + tele.NetCost;

        if (writeoffcost > applycost)
        {
            MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_TeleApplyCost.Text + "!");
            tbx_TeleCost.Text = lb_TeleApplyCost.Text;
            return;
        }

        SaveGrid();
        ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

        #region 组织电话费核销明细
        FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail();
        item.ID           = (int)ViewState["MaxID"];
        item.AccountTitle = ConfigHelper.GetConfigInt("TeleCostACTitle");
        item.ApplyCost    = applycost;
        item.WriteOffCost = writeoffcost;

        item["TeleFeeRelateTelephone"] = tele.ID.ToString();
        item.Client = tele.Client;

        #region 获取当前会计月的开始及截止日期
        int             month = int.Parse(ddl_TeleCostMonth.SelectedValue);
        AC_AccountMonth m     = new AC_AccountMonthBLL(month).Model;
        item.BeginMonth = m.ID;
        item.EndMonth   = m.ID;
        item.BeginDate  = m.BeginDate;
        item.EndDate    = m.EndDate;
        #endregion

        if (tele.Client > 0)
        {
            CM_Client client = new CM_ClientBLL(tele.Client).Model;
            if (client != null)
            {
                item.Remark = "物业:" + client.FullName + ";";
            }
        }
        item.Remark += "电话号码:" + ddl_Tele.SelectedItem.Text + ";月份:" + ddl_TeleCostMonth.SelectedItem.Text +
                       ";限额:" + lb_TeleApplyInfo.Text + ";";

        if (tbx_TeleRemark.Text != "")
        {
            item.Remark += "说明:" + tbx_TeleRemark.Text;
        }
        #endregion

        if (FNA_FeeWriteOffBLL.CheckTeleFeeHasWriteOff(item.AccountTitle, item.BeginMonth, tele.ID))
        {
            MessageBox.Show(this, "该电话指定月的费用,已在其他报销单中报销,请勿重复报销!");
        }
        else
        {
            ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>;
            if (_details.GetListItem().FirstOrDefault(p =>
                                                      p.AccountTitle == item.AccountTitle &&
                                                      p.BeginMonth == item.BeginMonth &&
                                                      p["TeleFeeRelateTelephone"] == item["TeleFeeRelateTelephone"]) == null)
            {
                _details.Add(item);             //新增科目
            }
            else
            {
                MessageBox.Show(this, "该电话指定月的费用,已在本报销单中,请勿重复报销!");
            }
        }
        BindGrid();
        AddEmptyDetail();
    }