コード例 #1
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        int count = 0;

        foreach (GridViewRow row in gv_List.Rows)
        {
            int     id = (int)gv_List.DataKeys[row.RowIndex]["ID"];
            TextBox tbx_BankVoucherNo = (TextBox)row.FindControl("tbx_BankVoucherNo");
            if (tbx_BankVoucherNo != null)
            {
                if (tbx_BankVoucherNo.Text != "")
                {
                    string No = tbx_BankVoucherNo.Text;
                    if (No == "空" || No == "无")
                    {
                        No = "";
                    }

                    FNA_FeeApplyDetail d = new FNA_FeeApplyBLL().GetDetailModel(id);
                    d["BankVoucherNo"] = No;
                    new FNA_FeeApplyBLL(d.ApplyID).UpdateDetail(d);
                    count++;
                }
            }
        }

        if (sender != null)
        {
            MessageBox.Show(this, "成功更新" + count.ToString() + "行记录!"); BindGrid();
        }
    }
コード例 #2
0
    /// <summary>
    /// 获取最早的付款截止日期
    /// </summary>
    /// <param name="bll"></param>
    /// <returns></returns>
    private DateTime GetMinPayDate(CM_ContractBLL bll)
    {
        DateTime minpaydate = bll.Model.EndDate;

        foreach (CM_ContractDetail item in bll.Items)
        {
            IList <FNA_FeeApplyDetail> feeapplydetails = new FNA_FeeApplyBLL().GetDetail
                                                             ("Client = " + select_Client.SelectValue + " AND RelateContractDetail = " + item.ID.ToString() +
                                                             " AND Flag<>3");
            if (feeapplydetails.Count == 0)
            {
                minpaydate = bll.Model.BeginDate;
                break;
            }
            else
            {
                DateTime _date = feeapplydetails.Max(p => p.EndDate).AddDays(1);
                if (_date < minpaydate)
                {
                    minpaydate = _date;
                }
            }
        }

        return(minpaydate);
    }
コード例 #3
0
    protected void bt_Cancel_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);

            #region 发起工作流
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", ViewState["ID"].ToString());
            dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString());
            dataobjects.Add("AccountMonth", bll.Model.AccountMonth.ToString());
            dataobjects.Add("FeeType", bll.Model.FeeType.ToString());

            #region 组合审批任务主题
            string title = "费用取消" + ",申请备案号:" + bll.Model.SheetCode;
            #endregion

            int TaskID = EWF_TaskBLL.NewTask("FNA_FeeApplyFlow_Cancel", (int)Session["UserID"], title, "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString(), dataobjects);
            if (TaskID <= 0)
            {
                MessageBox.Show(this, "对不起,工作流发起失败,请与管理员联系!");
                return;
            }
            new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            #endregion

            MessageBox.ShowAndRedirect(this, "取消费用申请单成功!", "FeeApplyList.aspx");
        }
    }
コード例 #4
0
    private void BindBudgetInfo()
    {
        tr_BudgetInfo.Visible = true;
        int month        = (int)ViewState["AccountMonth"];
        int organizecity = (int)ViewState["OrganizeCity"];
        int feetype      = (int)ViewState["FeeType"];

        lb_BudgetAmount.Text    = FNA_BudgetBLL.GetSumBudgetAmount(month, organizecity, feetype).ToString("0.###");
        lb_BudgetBalance.Text   = FNA_BudgetBLL.GetUsableAmount(month, organizecity, feetype).ToString("0.###");
        lb_SubmitTotalCost.Text = FNA_FeeApplyBLL.GetApplyTotalCost(month, organizecity, feetype).ToString("0.###");

        if (decimal.Parse(lb_BudgetAmount.Text) != 0)
        {
            lb_TotalPercent.Text = (decimal.Parse(lb_SubmitTotalCost.Text) / decimal.Parse(lb_BudgetAmount.Text)).ToString("0.##%");
        }
        hl_ViewBudget.NavigateUrl = "~/SubModule/FNA/Budget/BudgetBalance.aspx?OrganizeCity=" + organizecity.ToString() + "&AccountMonth=" + month.ToString();

        if (feetype == ConfigHelper.GetConfigInt("GiftFeeType"))
        {
            if ((int)ViewState["GiftFeeClassify"] == 0)
            {
                MessageBox.ShowAndRedirect(this, "赠品费用请至赠品专项费用申请页面申请!", "FeeApply_GiftFeeApply.aspx");
                return;
            }

            GetGiftAmountBalance();
        }
    }
コード例 #5
0
    private decimal GetGiftAmountBalance()
    {
        int          id    = (int)ViewState["ID"];
        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;

        if (apply == null)
        {
            return(0);
        }

        decimal giftamountbalance = 0;
        IList <ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList(
            string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}",
                          apply.AccountMonth, apply.Client, apply.ProductBrand, (int)ViewState["GiftFeeClassify"]));

        if (giftamounts.Count > 0)
        {
            decimal budget  = decimal.Parse(lb_BudgetBalance.Text);
            decimal balance = giftamounts[0].BalanceAmount;

            giftamountbalance = budget > balance ? balance : budget;
        }

        lb_GiftAmountBalance.Visible = true;
        lb_GiftAmountBalance.Text    = string.Format("赠品费用可申请额度:{0:0.##}元", giftamountbalance);

        if (pn_FeeApply.FindControl("FNA_FeeApply_Client") != null)
        {
            ((MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client")).Enabled = false;
        }
        return(giftamountbalance);
    }
コード例 #6
0
 protected string GetISDelay(int FeeApplyDetailID)
 {
     if (FeeApplyDetailID == 0) return "";
     FNA_FeeApplyDetail detail = new FNA_FeeApplyBLL().GetDetailModel(FeeApplyDetailID);
     int month = int.Parse(ddl_Month.SelectedValue);
     return month > detail.LastWriteOffMonth ? "<font color=red>逾期" + (month - detail.LastWriteOffMonth).ToString() + "个月</font>" : "<font color=blue></font>";
 }
コード例 #7
0
    protected void cb_Selected_CheckedChanged(object sender, EventArgs e)
    {
        //81,80,82 常规导购管理费(月付类)临时导购管理费(工服工卡等费用项)兼职导购工资次次月核销10日核销
        //SuperID IN (176,73)陈列费 月付,季度付 次月10号才能核销

        CheckBox           t              = (CheckBox)sender;
        GridViewRow        drv            = (GridViewRow)t.NamingContainer;
        int                rowIndex       = drv.RowIndex;
        int                applydetailid  = (int)gv_FeeAplyList.DataKeys[rowIndex]["FNA_FeeApplyDetail_ID"];
        FNA_FeeApplyDetail applydetail    = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
        CM_ContractDetail  contractdetail = new CM_ContractBLL().GetDetailModel(applydetail.RelateContractDetail);

        try
        {
            if (applydetail.AccountTitle == 81 && applydetail.Remark.IndexOf("合同编号") >= 0)
            {
                return;
            }
            if (applydetail.AccountTitle >= 80 && applydetail.AccountTitle <= 82)
            {
                t.Checked = CheckLimitWriteOffDate(applydetail.BeginMonth + 2);
            }
            else if (AC_AccountTitleBLL.GetModelList("SuperID IN (176,73)").Where(p => p.ID == applydetail.AccountTitle).ToList().Count > 0 &&
                     contractdetail != null && contractdetail.PayMode != 12 && contractdetail.PayMode != 6 && contractdetail.BearMode == 1)
            {
                t.Checked = CheckLimitWriteOffDate(applydetail.BeginMonth + 1);
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
コード例 #8
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["FNA_FeeWriteOffDetail_ApplyDetailID"];
            if (applydetailid > 0)
            {
                Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode");
                if (lb_ApplySheetCode != null)
                    lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);

                Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand");
                if (lb_RelateBrand != null)
                {
                    string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split
                        (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    lb_RelateBrand.Text = "";

                    foreach (string b in brands)
                    {
                        lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ",";
                    }
                }
            }
        }
    }
コード例 #9
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["FNA_FeeWriteOffDetail_ApplyDetailID"];
            if (applydetailid > 0)
            {
                Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode");
                if (lb_ApplySheetCode != null)
                {
                    lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
                }

                Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand");
                if (lb_RelateBrand != null)
                {
                    string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split
                                          (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    lb_RelateBrand.Text = "";

                    foreach (string b in brands)
                    {
                        lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ",";
                    }
                }
            }
        }
    }
コード例 #10
0
    protected string GetPreApplyInfo(int detailid, decimal applycost)
    {
        string str = "";

        return("");

        FNA_FeeApplyDetail predetail = FNA_FeeApplyBLL.GetPreApplyInfoByClient(detailid);

        IsRed = false;
        if (predetail != null)
        {
            decimal preCost = predetail.ApplyCost + predetail.AdjustCost;
            if (preCost > 0)
            {
                FNA_FeeApply preApply = new FNA_FeeApplyBLL(predetail.ApplyID).Model;
                int          month    = new FNA_FeeApplyBLL().GetDetailModel(detailid).BeginMonth;
                if (month == predetail.BeginMonth)
                {
                    str   = "※当月重复※<br/>单号:" + preApply.SheetCode + "<br/>";
                    IsRed = true;
                }
                str += "金额:" + preCost.ToString("0.##元") + "   " + "与前次比例:" + (applycost / preCost).ToString("0%") + " <br/>" +
                       "月份:" + new AC_AccountMonthBLL(predetail.BeginMonth).Model.Name + " <br/>" +
                       "说明:" + predetail.Remark;
                if ((applycost / preCost) > 1.5m)
                {
                    IsRed = true;
                }
            }
        }

        return(str);
    }
コード例 #11
0
    protected string GetISDelay(int FeeApplyDetailID)
    {
        if (FeeApplyDetailID == 0)
        {
            return("");
        }
        FNA_FeeApplyDetail detail = new FNA_FeeApplyBLL().GetDetailModel(FeeApplyDetailID);
        int month = int.Parse(ddl_Month.SelectedValue);

        return(month > detail.LastWriteOffMonth ? "<font color=red>逾期" + (month - detail.LastWriteOffMonth).ToString() + "个月</font>" : "<font color=blue></font>");
    }
コード例 #12
0
    protected void bt_Copy_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            int forwarddays = ConfigHelper.GetConfigInt("FeeApplyForwardDays");
            int month       = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(forwarddays));

            int id = FNA_FeeApplyBLL.Copy((int)ViewState["ID"], (int)Session["UserID"], month);

            MessageBox.ShowAndRedirect(this, "申请单重新激活成功!", "FeeApplyDetail3.aspx?ID=" + id.ToString());
        }
    }
コード例 #13
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel((int)ViewState["ID"]);

        if (m.AccountTitle != 82 && decimal.Parse(tbx_ApproveCost.Text) > m.ApplyCost)
        {
            MessageBox.Show(this, "我司批复金额不能超过原申请金额!");
            return;
        }

        if (decimal.Parse(tbx_ApproveCost.Text) < 0)
        {
            MessageBox.Show(this, "我司批复金额不能小于0!");
            return;
        }
        if (m.AccountTitle == 82 && decimal.Parse(tbx_ApproveDICost.Text) < 0)
        {
            MessageBox.Show(this, "经销商批复金额不能小于0!");
            return;
        }
        decimal OldAdjustCost = m.AdjustCost;

        m.AdjustCost   = Math.Round(decimal.Parse(tbx_ApproveCost.Text) - m.ApplyCost, 1, MidpointRounding.AwayFromZero);
        m.AdjustReason = tbx_AdjustReason.Text;
        decimal OldDIAdjustCost = m.DIAdjustCost;

        if (m.AccountTitle == 82)
        {
            m.DIAdjustCost      = Math.Round(decimal.Parse(tbx_ApproveDICost.Text) - m.DICost, 1, MidpointRounding.AwayFromZero);
            m["DIAdjustReason"] = tbx_DIAdjustReason.Text.Trim();
        }
        if (m.AdjustCost != 0 && tbx_AdjustReason.Text.Trim() == "")
        {
            MessageBox.Show(this, "请填写我司调整原因!");
            return;
        }
        if (m.DIAdjustCost != 0 && tbx_DIAdjustReason.Text.Trim() == "")
        {
            MessageBox.Show(this, "请填写经销商调整原因!");
            return;
        }
        FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL(m.ApplyID);

        bll.UpdateDetail(m);

        //保存调整记录
        FNA_FeeApplyBLL.UpdateAdjustRecord(m.ApplyID, (int)Session["UserID"], m.AccountTitle, OldAdjustCost.ToString("0.##"), m.AdjustCost.ToString("0.##"), m.AdjustReason);

        Session["SuccessFlag"] = true;
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false);
    }
コード例 #14
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel((int)ViewState["ID"]);

        if (m.AccountTitle!=82&&decimal.Parse(tbx_ApproveCost.Text) > m.ApplyCost)
        {
            MessageBox.Show(this, "我司批复金额不能超过原申请金额!");
            return;
        }

        if (decimal.Parse(tbx_ApproveCost.Text) < 0)
        {
            MessageBox.Show(this, "我司批复金额不能小于0!");
            return;
        }
        if (m.AccountTitle == 82 && decimal.Parse(tbx_ApproveDICost.Text) < 0)
        {
            MessageBox.Show(this, "经销商批复金额不能小于0!");
            return;
        }
        decimal OldAdjustCost = m.AdjustCost;

        m.AdjustCost = Math.Round(decimal.Parse(tbx_ApproveCost.Text) - m.ApplyCost, 1, MidpointRounding.AwayFromZero);
        m.AdjustReason = tbx_AdjustReason.Text;
        decimal OldDIAdjustCost = m.DIAdjustCost;
        if (m.AccountTitle == 82)
        {

            m.DIAdjustCost =Math.Round(decimal.Parse(tbx_ApproveDICost.Text) - m.DICost, 1, MidpointRounding.AwayFromZero);
            m["DIAdjustReason"] = tbx_DIAdjustReason.Text.Trim();
        }
        if (m.AdjustCost != 0 && tbx_AdjustReason.Text.Trim() == "")
        {
            MessageBox.Show(this, "请填写我司调整原因!");
            return;
        }
        if (m.DIAdjustCost != 0 && tbx_DIAdjustReason.Text.Trim() == "")
        {
            MessageBox.Show(this, "请填写经销商调整原因!");
            return;
        }
        FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL(m.ApplyID);
        bll.UpdateDetail(m);

        //保存调整记录
        FNA_FeeApplyBLL.UpdateAdjustRecord(m.ApplyID, (int)Session["UserID"], m.AccountTitle, OldAdjustCost.ToString("0.##"), m.AdjustCost.ToString("0.##"), m.AdjustReason);

        Session["SuccessFlag"] = true;
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false);
    }
コード例 #15
0
    protected void bt_Export_Click(object sender, EventArgs e)
    {
        int       month        = int.Parse(ddl_Month.SelectedValue);
        int       organizecity = int.Parse(tr_OrganizeCity.SelectValue);
        int       state        = int.Parse(ddl_State.SelectedValue);
        int       RTChannel    = int.Parse(ddl_RTChannel.SelectedValue);
        int       RTType       = int.Parse(ddl_RTType.SelectedValue);
        DataTable dtSummary    = FNA_FeeApplyBLL.GetRTChannelDiaplayFee
                                     (month, organizecity, state, int.Parse(Session["UserID"].ToString()), RTChannel, ViewState["condition"].ToString(), RTType, ViewState["ATSuppierIDs"].ToString());

        if (dtSummary.Rows.Count > 0)
        {
            CreateExcel(dtSummary, HttpUtility.UrlEncode(Encoding.UTF8.GetBytes("费用申请汇总单导出_" + DateTime.Now.ToString("yyyyMMddHHmmss"))));
        }
    }
コード例 #16
0
    private void BindData()
    {
        FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel((int)ViewState["ID"]);
        if (m.AccountTitle == 82)
        {
            tb_DIFL.Visible = true;
        }

        lb_AccountTitle.Text = TreeTableBLL.GetFullPathName("MCS_Pub.dbo.AC_AccountTitle", m.AccountTitle);
        lb_ApplyCost.Text = m.ApplyCost.ToString("0.###");

        tbx_ApproveCost.Text = (m.ApplyCost + m.AdjustCost).ToString("0.###");

        lbl_DICost.Text = m.DICost.ToString("0.###");
        tbx_ApproveDICost.Text = (m.DICost + m.DIAdjustCost).ToString("0.###");
    }
コード例 #17
0
    private void BindData()
    {
        FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel((int)ViewState["ID"]);

        if (m.AccountTitle == 82)
        {
            tb_DIFL.Visible = true;
        }

        lb_AccountTitle.Text = TreeTableBLL.GetFullPathName("MCS_Pub.dbo.AC_AccountTitle", m.AccountTitle);
        lb_ApplyCost.Text    = m.ApplyCost.ToString("0.###");

        tbx_ApproveCost.Text = (m.ApplyCost + m.AdjustCost).ToString("0.###");

        lbl_DICost.Text        = m.DICost.ToString("0.###");
        tbx_ApproveDICost.Text = (m.DICost + m.DIAdjustCost).ToString("0.###");
    }
コード例 #18
0
    protected string GetISDelay(int FeeApplyDetailID)
    {
        if (FeeApplyDetailID == 0)
        {
            return("");
        }
        FNA_FeeApplyDetail detail = new FNA_FeeApplyBLL().GetDetailModel(FeeApplyDetailID);

        if (detail == null)
        {
            return("");
        }
        FNA_FeeApply feeapply = new FNA_FeeApplyBLL(detail.ApplyID).Model;
        int          month    = AC_AccountMonthBLL.GetMonthByDate(feeapply.InsertTime.AddDays(-ConfigHelper.GetConfigInt("FeeWriteDelayDays")));

        return(month > detail.LastWriteOffMonth ? "<font color=red>逾期" + (month - detail.LastWriteOffMonth).ToString() + "个月</font>" : "<font color=blue></font>");
    }
コード例 #19
0
    private void BindGrid()
    {
        if (select_Client.SelectValue != "")
        {
            DataTable dt = FNA_FeeApplyBLL.GetFeeApplyOrWriteoffByClient(int.Parse(select_Client.SelectValue), int.Parse(ddl_BeginMonth.SelectedValue), int.Parse(ddl_EndMonth.SelectedValue));

            decimal _SumAppCost = 0, _SumAvailCost = 0, _SumWriteOffCost = 0;
            int     _PreApplyDetailID = 0;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (_PreApplyDetailID != (int)dt.Rows[i]["ApplyDetailID"] && (int)dt.Rows[i]["ApplyState"] == 3)
                {
                    if (dt.Rows[i]["sumApplyCost"].ToString() != "")
                    {
                        _SumAppCost += (decimal)dt.Rows[i]["sumApplyCost"];
                    }

                    if (dt.Rows[i]["AvailCost"].ToString() != "")
                    {
                        _SumAvailCost += (decimal)dt.Rows[i]["AvailCost"];
                    }

                    _PreApplyDetailID = (int)dt.Rows[i]["ApplyDetailID"];
                }
                if (dt.Rows[i]["sumWriteOffCost"].ToString() != "")
                {
                    _SumWriteOffCost += (decimal)dt.Rows[i]["sumWriteOffCost"];
                }
            }
            DataRow dr = dt.NewRow();
            dr["FeeType"]         = "合计(仅批复通过)";
            dr["sumApplyCost"]    = _SumAppCost;
            dr["AvailCost"]       = _SumAvailCost;
            dr["sumWriteOffCost"] = _SumWriteOffCost;
            dt.Rows.Add(dr);
            DataView dv = dt.DefaultView;
            if (ddl_FeeType.SelectedValue != "0")
            {
                dv.RowFilter = " FeeType='" + ddl_FeeType.SelectedItem.ToString() + "'";
            }

            gv_List.DataSource = dv;
            gv_List.DataBind();
        }
    }
コード例 #20
0
    protected void bt_ExcludeApplyDetail_Click(object sender, EventArgs e)
    {
        string excludeids = tbx_SelectedApplyDetailIDs.Text;

        if (excludeids == "")
        {
            MessageBox.Show(this, "请勾选要扣除掉的费用项");
            BindGrid();
        }

        string[] ids = excludeids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string _id in ids)
        {
            int detailid = 0;
            if (int.TryParse(_id, out detailid) && detailid > 0)
            {
                FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel(detailid);

                decimal OldAdjustCost = m.AdjustCost;

                m.AdjustCost   = 0 - m.ApplyCost;
                m.DIAdjustCost = 0 - m.DICost;
                m.AdjustReason = "批量扣减";

                FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL(m.ApplyID);
                bll.UpdateDetail(m);

                if (m.Client > 0)
                {
                    CM_Client _c = new CM_ClientBLL(m.Client).Model;
                    if (_c != null)
                    {
                        m.AdjustReason += " 客户:" + _c.FullName;
                    }
                }

                //保存调整记录
                FNA_FeeApplyBLL.UpdateAdjustRecord(m.ApplyID, (int)Session["UserID"], m.AccountTitle, OldAdjustCost.ToString("0.##"), m.AdjustCost.ToString("0.##"), m.AdjustReason);
            }

            MessageBox.Show(this, "扣减成功!");
            BindGrid();
        }
    }
コード例 #21
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int         id        = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["FNA_FeeApply_ID"];
            UC_GridView gv_Detail = (UC_GridView)e.Row.FindControl("gv_Detail");
            if (gv_Detail != null)
            {
                IList <FNA_FeeApplyDetail> lists = new FNA_FeeApplyBLL(id).Items;

                //费用科目
                int accounttile = 0;
                int.TryParse(tr_AccountTitle.SelectValue, out accounttile);
                if (accounttile > 1)
                {
                    DataTable dt  = TreeTableBLL.GetAllChildByNodes("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", accounttile.ToString());
                    int[]     ids = new int[dt.Rows.Count + 1];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ids[i] = (int)dt.Rows[i]["ID"];
                    }
                    ids[ids.Length - 1] = accounttile;
                    lists = lists.Where(p => ids.Contains(p.AccountTitle)).ToList();
                }

                //申请金额判断
                decimal _cost = 0;
                decimal.TryParse(tbx_ApplyCost.Text, out _cost);
                if (_cost != 0)
                {
                    if (ddl_ApplyCostOP.SelectedValue == ">")
                    {
                        lists = lists.Where(p => p.ApplyCost + p.AdjustCost > _cost).ToList();
                    }
                    else if (ddl_ApplyCostOP.SelectedValue == "<")
                    {
                        lists = lists.Where(p => p.ApplyCost + p.AdjustCost < _cost).ToList();
                    }
                }

                gv_Detail.BindGrid(lists);
            }
        }
    }
コード例 #22
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["ApplyDetailID"];
            if (applydetailid > 0)
            {
                Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode");
                if (lb_ApplySheetCode != null)
                {
                    lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
                }
                FNA_FeeApplyDetail _detail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                Label lb_AllCost           = (Label)e.Row.FindControl("lb_AllCost");
                if (lb_AllCost != null)
                {
                    lb_AllCost.Text = Math.Round(decimal.Parse(_detail["DICost"] == "" ? "0" : _detail["DICost"]) + _detail.ApplyCost, 1).ToString("0.##");
                }

                Label lb_Remark = (Label)e.Row.FindControl("lb_Remark");
                if (lb_Remark != null)
                {
                    if (ViewState["FLPurchase"] != null)
                    {
                        lb_Remark.Text = "进货额:" + ((DataTable)ViewState["FLPurchase"]).Compute("Sum(PurchaseVolume)", "ID=" + gv_ListDetail.DataKeys[e.Row.RowIndex]["ID"]).ToString();
                    }
                }
                Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand");
                if (lb_RelateBrand != null)
                {
                    string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split
                                          (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    lb_RelateBrand.Text = "";

                    foreach (string b in brands)
                    {
                        lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ",";
                    }
                }
            }
        }
    }
コード例 #23
0
    private void BindFeeRateInfo()
    {
        tr_FeeRateInfo.Visible = true;
        int month        = (int)ViewState["AccountMonth"];
        int organizecity = (int)ViewState["OrganizeCity"];
        int feetype      = (int)ViewState["FeeType"];

        decimal forcastvolume = SVM_SalesForcastBLL.GetTotalVolume(month, organizecity, true);
        decimal balance       = FNA_BudgetBLL.GetUsableAmount(month, organizecity, feetype);
        decimal totalcost     = FNA_FeeApplyBLL.GetApplyTotalCost(month, organizecity, feetype);

        lb_ForcastVolume.Text    = forcastvolume.ToString("0.###");
        lb_BudgetBalance1.Text   = balance.ToString("0.###");
        lb_SubmitTotalCost1.Text = totalcost.ToString("0.###");

        if (forcastvolume != 0)
        {
            lb_FeeRate.Text = ((totalcost - balance) / forcastvolume).ToString("0.##%");
        }
    }
コード例 #24
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int id            = (int)gv_List.DataKeys[e.Row.RowIndex]["ID"];
            int applydetailid = (int)gv_List.DataKeys[e.Row.RowIndex]["ApplyDetailID"];

            ListTable <FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable <FNA_FeeWriteOffDetail>;
            FNA_FeeWriteOffDetail             m        = _details[id.ToString()];

            string sheetcode = "";

            FNA_FeeApplyDetail applydetail = new FNA_FeeApplyDetail();
            if (applydetailid > 0)
            {
                applydetail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                sheetcode   = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
            }

            HyperLink hy_ApplySheetCode = (HyperLink)e.Row.FindControl("hy_ApplySheetCode");
            hy_ApplySheetCode.Text        = sheetcode;
            hy_ApplySheetCode.NavigateUrl = "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applydetail.ApplyID;

            if (applydetail.Client > 0)
            {
                HyperLink hy_Client = (HyperLink)e.Row.FindControl("hy_Client");
                hy_Client.Text        = new CM_ClientBLL(applydetail.Client).Model.FullName;
                hy_Client.NavigateUrl = "~/SubModule/CM/RT/RetailerDetail.aspx?ClientID=" + m.Client;
            }

            DropDownList ddl_BalanceMode = (DropDownList)e.Row.FindControl("ddl_BalanceMode");
            if (ddl_BalanceMode != null)
            {
                ddl_BalanceMode.Enabled = m.WriteOffCost < m.ApplyCost;
                if (m.BalanceMode > 0)
                {
                    ddl_BalanceMode.SelectedValue = m.BalanceMode.ToString();
                }
            }
        }
    }
コード例 #25
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex >= 0 && gv_List.Rows.Count >= e.Row.RowIndex && gv_List.Columns.Count >= 1)
        {
            int id = (int)gv_List.DataKeys[e.Row.RowIndex][0];
            CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
            int month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddMonths(-1));
            IList <FNA_FeeApplyDetail> _list = new FNA_FeeApplyBLL().GetDetail("Client=" + bll.Model.Client.ToString()
                                                                               + " AND AccountTitle=82 AND BeginMonth=" + month.ToString()
                                                                               + "AND EXISTS(SELECT 1 FROM MCS_FNA.dbo.FNA_FeeApply WHERE FNA_FeeApply.ID=FNA_FeeApplyDetail.ApplyID AND State IN (1,2,3))");
            if (e.Row.RowType == DataControlRowType.DataRow && _list.Count > 0 || bll.Model.ISMYD == 2)
            {
                e.Row.Cells[0].Enabled = false; e.Row.Cells[gv_List.Columns.Count - 1].Enabled = false;

                if (e.Row.FindControl("tbx_RTCount") != null)
                {
                    (e.Row.FindControl("tbx_RTCount") as TextBox).Enabled = false;
                }
            }
        }
    }
コード例 #26
0
    protected void bt_ExcludeApplyDetail_Click(object sender, EventArgs e)
    {
        string excludeids = tbx_SelectedApplyDetailIDs.Text;
        if (excludeids == "")
        {
            MessageBox.Show(this, "请勾选要扣除掉的费用项");
            BindGrid();
        }

        string[] ids = excludeids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string _id in ids)
        {
            int detailid = 0;
            if (int.TryParse(_id, out detailid) && detailid > 0)
            {
                FNA_FeeApplyDetail m = new FNA_FeeApplyBLL().GetDetailModel(detailid);

                decimal OldAdjustCost = m.AdjustCost;

                m.AdjustCost = 0 - m.ApplyCost;
                m.DIAdjustCost = 0 - m.DICost;
                m.AdjustReason = "批量扣减";

                FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL(m.ApplyID);
                bll.UpdateDetail(m);

                if (m.Client > 0)
                {
                    CM_Client _c = new CM_ClientBLL(m.Client).Model;
                    if (_c != null) m.AdjustReason += " 客户:" + _c.FullName;
                }

                //保存调整记录
                FNA_FeeApplyBLL.UpdateAdjustRecord(m.ApplyID, (int)Session["UserID"], m.AccountTitle, OldAdjustCost.ToString("0.##"), m.AdjustCost.ToString("0.##"), m.AdjustReason);
            }

            MessageBox.Show(this, "扣减成功!");
            BindGrid();
        }
    }
コード例 #27
0
 protected void bt_CancelWriteOff_Click(object sender, EventArgs e)
 {
     FNA_FeeApplyBLL apply = new FNA_FeeApplyBLL((int)ViewState["ID"]);
     if (apply.Model.State == 3)
     {
         foreach (GridViewRow row in gv_List.Rows)
         {
             CheckBox cbx = row.FindControl("cb_Selected") == null ? null : row.FindControl("cb_Selected") as CheckBox;
             if (cbx.Visible && cbx.Checked)
             {
                 int detailid = (int)gv_List.DataKeys[row.RowIndex]["ID"];
                 FNA_FeeApplyDetail detail = apply.GetDetailModel(detailid);
                 detail.Flag = 3;
                 detail.Remark += "::取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 取消人:" + new Org_StaffBLL((int)Session["UserID"]).Model.RealName;
                 apply.UpdateDetail(detail);
             }
         }
         ListTable<FNA_FeeApplyDetail> _details = new ListTable<FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
         ViewState["Details"] = _details;
         BindGrid();
     }
 }
コード例 #28
0
    protected void bt_CancelWriteOff_Click(object sender, EventArgs e)
    {
        FNA_FeeApplyBLL apply = new FNA_FeeApplyBLL((int)ViewState["ID"]);

        if (apply.Model.State == 3)
        {
            foreach (GridViewRow row in gv_List.Rows)
            {
                CheckBox cbx = row.FindControl("cb_Selected") == null ? null : row.FindControl("cb_Selected") as CheckBox;
                if (cbx.Visible && cbx.Checked)
                {
                    int detailid = (int)gv_List.DataKeys[row.RowIndex]["ID"];
                    FNA_FeeApplyDetail detail = apply.GetDetailModel(detailid);
                    detail.Flag    = 3;
                    detail.Remark += "::取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 取消人:" + new Org_StaffBLL((int)Session["UserID"]).Model.RealName;
                    apply.UpdateDetail(detail);
                }
            }
            ListTable <FNA_FeeApplyDetail> _details = new ListTable <FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
            ViewState["Details"] = _details;
            BindGrid();
        }
    }
コード例 #29
0
    private void BindData()
    {
        int id = (int)ViewState["ID"];

        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;
        ViewState["AccountMonth"] = apply.AccountMonth;

        if (apply == null) Response.Redirect("FeeApplyList.aspx");

        pn_FeeApply.BindData(apply);

        Label lb_OrganizeCity = (Label)pn_FeeApply.FindControl("FNA_FeeApply_OrganizeCity");
        lb_OrganizeCity.Text = TreeTableBLL.GetFullPathName("MCS_Sys.dbo.Addr_OrganizeCity", apply.OrganizeCity);

        #region 将备注信息单独显示出来
        Label lb_remark = (Label)pn_FeeApply.FindControl("FNA_FeeApply_Remark");
        if (lb_remark != null)
        {
            lb_remark.Text = apply["Remark"].Replace("\r\n", "<br/>");
        }
        #endregion

        BindGrid();

        #region 获取流程审批意见
        int TaskID = 0;

        if (int.TryParse(apply["TaskID"], out TaskID) && TaskID > 0)
        {
            EWF_TaskBLL task = new EWF_TaskBLL(TaskID);
            if (task.Model != null)
            {
                lb_TaskApproveInfo.Text = task.Model.Remark;
            }
        }
        #endregion
    }
コード例 #30
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["ApplyDetailID"];
            if (applydetailid > 0)
            {
                Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode");
                if (lb_ApplySheetCode != null)
                    lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
                FNA_FeeApplyDetail _detail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                Label lb_AllCost = (Label)e.Row.FindControl("lb_AllCost");
                if (lb_AllCost != null)
                    lb_AllCost.Text = Math.Round(decimal.Parse(_detail["DICost"] == "" ? "0" : _detail["DICost"]) + _detail.ApplyCost, 1).ToString("0.##");

                Label lb_Remark = (Label)e.Row.FindControl("lb_Remark");
                if (lb_Remark != null)
                {
                    if (ViewState["FLPurchase"] != null)
                        lb_Remark.Text = "进货额:" + ((DataTable)ViewState["FLPurchase"]).Compute("Sum(PurchaseVolume)", "ID=" + gv_ListDetail.DataKeys[e.Row.RowIndex]["ID"]).ToString();
                }
                Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand");
                if (lb_RelateBrand != null)
                {
                    string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split
                        (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    lb_RelateBrand.Text = "";

                    foreach (string b in brands)
                    {
                        lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ",";
                    }
                }
            }
        }
    }
コード例 #31
0
    /// <summary>
    /// 删除已保存但未提交的申请单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void bt_Delete_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            ListTable <FNA_FeeApplyDetail> _details = ViewState["Details"] as ListTable <FNA_FeeApplyDetail>;
            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能删除!");
                return;
            }
            int activityid = 0;
            if (int.TryParse(bll.Model["ActivityID"], out activityid) && activityid > 0)
            {
                //CAT_ActivityBLL cat = new CAT_ActivityBLL(activityid);
                //cat.Model.FeeApply = 0;
            }
            bll.Items = _details.GetListItem(ItemState.Modified);
            bll.DeleteDetail();
            bll.Delete();

            Response.Redirect("~/SubModule/FNA/FeeApply/FeeApplyList.aspx");
        }
    }
コード例 #32
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        int count = 0;
        foreach (GridViewRow row in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[row.RowIndex]["ID"];
            TextBox tbx_BankVoucherNo = (TextBox)row.FindControl("tbx_BankVoucherNo");
            if (tbx_BankVoucherNo != null)
            {
                if (tbx_BankVoucherNo.Text != "")
                {
                    string No = tbx_BankVoucherNo.Text;
                    if (No == "空" || No == "无") No = "";

                    FNA_FeeApplyDetail d = new FNA_FeeApplyBLL().GetDetailModel(id);
                    d["BankVoucherNo"] = No;
                    new FNA_FeeApplyBLL(d.ApplyID).UpdateDetail(d);
                    count++;
                }
            }
        }

        if (sender != null) { MessageBox.Show(this, "成功更新" + count.ToString() + "行记录!"); BindGrid(); }
    }
コード例 #33
0
    private void BindData()
    {
        int id = (int)ViewState["ID"];

        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;
        if (apply == null) Response.Redirect("FeeApplyList.aspx");

        ViewState["AccountMonth"] = apply.AccountMonth;
        ViewState["OrganizeCity"] = apply.OrganizeCity;
        ViewState["FeeType"] = apply.FeeType;
        ViewState["AccountTitle2"] = string.IsNullOrEmpty(apply["AccountTitle2"]) ? 0 : int.Parse(apply["AccountTitle2"]);
        ViewState["DicFeeType"] = DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()];
        ViewState["RelateCar"] = string.IsNullOrEmpty(apply["RelateCar"]) ? 0 : int.Parse(apply["RelateCar"]);
        ViewState["GiftFeeClassify"] = string.IsNullOrEmpty(apply["GiftFeeClassify"]) ? 0 : int.Parse(apply["GiftFeeClassify"]);
        ViewState["FromGeneralFlow"] = string.IsNullOrEmpty(apply["FromGeneralFlow"]) ? "Y" : "N";

        pn_FeeApply.BindData(apply);

        if (apply.Client != 0) cbx_NoInsteadPayClient.Visible = false;

        UploadFile1.RelateID = (int)ViewState["ID"];

        if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
            BindBudgetInfo();
        else if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "FeeRateControl")
            BindFeeRateInfo();

        #region 根据审批状态控制页面
        bt_ViewWriteOff.Visible = false;
        if (apply.State == 1)
        {
            //未提交状态
            bt_ViewReport.Visible = false;

            tbx_Remark.Text = apply["Remark"];
            tbl_Remark.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = true;  //删除按钮
        }

        if (apply.State != 1)
        {
            //非 未提交 状态
            bt_Delete.Visible = false;
            bt_AddDetail.Visible = false;
            pn_FeeApply.SetPanelEnable("Panel_FNA_FeeApplyDetail_1", false);
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = false;
            bt_Save.Visible = false;
            bt_Submit.Visible = false;

            apply["Remark"] = apply["Remark"].Replace("\r", "<br/>");
            pn_Remark.BindData(apply);
            pn_Remark.Visible = true;

            cbx_NoInsteadPayClient.Visible = false;

            UploadFile1.CanDelete = false;

            if (apply.FeeType == 1)
                bt_ViewReport.OnClientClick = "PopReport(" + apply.ID.ToString() + ")";
            else
                bt_ViewReport.Visible = false;

            //可见调整金额及原因
            gv_List.Columns[gv_List.Columns.Count - 7].Visible = true;  //批复额
            gv_List.Columns[gv_List.Columns.Count - 10].Visible = true;  //调整原因
            gv_List.Columns[gv_List.Columns.Count - 11].Visible = true;  //调整金额
            if((ViewState["Details"] as ListTable<FNA_FeeApplyDetail>).GetListItem().FirstOrDefault(p=>p.AccountTitle==82)!=null)
            {
                gv_List.Columns[gv_List.Columns.Count - 6].Visible = true;  //批复额
                gv_List.Columns[gv_List.Columns.Count - 8].Visible = true;  //调整原因
                gv_List.Columns[gv_List.Columns.Count - 9].Visible = true;  //调整金额
            }
        }
        if ((ViewState["Details"] as ListTable<FNA_FeeApplyDetail>).GetListItem()[0].RelateContractDetail > 0)
        {
            gv_List.Columns[4].Visible = true;
        }

        if (apply.State == 2)
        {
            ///已提交状态,审批过程中,可以作金额调整
            ///审批过程中,可以作金额调整 Decision参数为在审批过程中传进来的参数
            if (Request.QueryString["Decision"] != "" && Request.QueryString["Decision"] == "Y")
            {
                gv_List.Columns[gv_List.Columns.Count - 2].Visible = true; //允许调整申请金额
                int fltype = ConfigHelper.GetConfigInt("ContractFeeType-FL");
                if (apply.FeeType == fltype)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_Pass').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_bt_SaveDecisionComment').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条处理", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_WaitProcess').disabled='disabled'; </script>");
                    string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 9).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                    if (!allowdays.Contains(DateTime.Now.Day.ToString()))
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "超时不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_NotPass').disabled='disabled'; </script>");
                    }
                }
            }
            bt_ViewWriteOff.Visible = false;
        }

        if (apply.State == 3)
        {
            //已审批
            bt_ViewWriteOff.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 3].Visible = true; //查看核销 链接
            gv_List.Columns[gv_List.Columns.Count - 4].Visible = true; //可报销额
            gv_List.Columns[gv_List.Columns.Count - 5].Visible = true; //报销标志

            bt_ViewWriteOff.OnClientClick = "PopWriteOffListByApplyID(" + id.ToString() + ")";
            if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1503, "CancelWirteOffDetail"))
            {
                bt_CancelWriteOff.Visible = true;
                bt_CancelWriteOff.OnClientClick = "return confirm('是否确定取消选中的费用,取消后,该费用不可再次核销!\n【若需要再次核销则需要重新发起申请!】')";
                gv_List.Columns[0].Visible = true;
            }
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State != 3)
        {
            bt_Cancel.Visible = false;
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State >= 3)
        {
            UploadFile1.CanUpload = false;
            UploadFile1.CanDelete = false;
        }

        if (apply.State != 8)
        {
            bt_Copy.Visible = false;    //只有审批未通过才可重新激活
        }

        #endregion

        if (apply["FromGeneralFlow"] == "N")
        {
            if (apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-KA") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-FL")
                )
                bt_AddDetail.Visible = false;
        }
        #region 增加客户后的详细内容按钮
        if (apply.Client != 0)
        {
            //MCSSelectControl sc_Client = (MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client");
            //if (sc_Client != null)
            //{
            //    HyperLink hy_clientdetail = new HyperLink();
            //    hy_clientdetail.ImageUrl = "~/Images/Gif/gif-0818.gif";
            //    hy_clientdetail.NavigateUrl = "~/SubModule/CM/RT/RetailerAnalysis.aspx?ClientID=" + apply.Client.ToString();
            //    hy_clientdetail.Target = "_blank";
            //    sc_Client.Parent.Controls.Add(hy_clientdetail);
            //}
        }
        #endregion

        #region 增加关联活动链接
        int activityid = 0;

        if (int.TryParse(apply["ActivityID"], out activityid) && activityid > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_ActivityID");
            if (label != null)
            {
                HyperLink hy_activitydetail = new HyperLink();
                hy_activitydetail.Text = " 查看活动详情";
                hy_activitydetail.ForeColor = System.Drawing.Color.Blue;
                hy_activitydetail.NavigateUrl = "~/SubModule/CAT/CAT_ActivityDetail.aspx?ID=" + activityid.ToString();
                hy_activitydetail.Target = "_blank";
                label.Parent.Controls.Add(hy_activitydetail);
            }
        }
        #endregion

        #region 增加关联HDM结算单链接
        int hdmbalance = 0;

        if (int.TryParse(apply["HDMBalance"], out hdmbalance) && hdmbalance > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_HDMBalance");
            if (label != null)
            {
                HyperLink hy_hdmbalance = new HyperLink();
                hy_hdmbalance.Text = " 查看结算单详情";
                hy_hdmbalance.ForeColor = System.Drawing.Color.Blue;
                hy_hdmbalance.NavigateUrl = "~/SubModule/CSO/CSO_OfferBalanceDetail.aspx?OfferBalanceID=" + hdmbalance.ToString();
                hy_hdmbalance.Target = "_blank";
                label.Parent.Controls.Add(hy_hdmbalance);
            }
        }
        #endregion
        BindGrid();
    }
コード例 #34
0
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            if (gv_List.Rows.Count == 0)
            {
                MessageBox.Show(this, "对不起, 必须添加相应的费用明细!");
                return;
            }

            bt_Save_Click(null, null);

            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能提交!");
                return;
            }

            if (bll.Model.Client == 0 && !cbx_NoInsteadPayClient.Checked)
            {
                MessageBox.Show(this, "请正确选择费用代垫客户,如果确认无代垫客户,请勾选【确认无代垫客户】复选框!");
                return;
            }

            if (cbx_NoInsteadPayClient.Checked && bll.Model.Client != 0)
            {
                MessageBox.Show(this, "您已选择了费用代垫客户,又请勾选【确认无代垫客户】复选框,两者只能选择其一,请确认!");
                return;
            }

            #region 判断预算额度余额是否够申请
            if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
            {
                decimal _balance = FNA_BudgetBLL.GetUsableAmount(bll.Model.AccountMonth, bll.Model.OrganizeCity, bll.Model.FeeType);
                decimal _applycost = decimal.Parse(lb_TotalCost.Text);
                lb_BudgetAmount.Text = _balance.ToString("0.###");

                if (bll.Model.FeeType == ConfigHelper.GetConfigInt("GiftFeeType"))
                {
                    _balance = GetGiftAmountBalance();
                }

                if (_balance < _applycost)
                {
                    MessageBox.Show(this, "对不起,您当前的预算余额不够申请该项费用!");
                    return;
                }
            }
            #endregion

            #region 发起工作流
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", ViewState["ID"].ToString());
            dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString());
            dataobjects.Add("AccountMonth", bll.Model.AccountMonth.ToString());
            dataobjects.Add("TotalFee", lb_TotalCost.Text);
            dataobjects.Add("BorrowFee", lb_BorrowTotal.Text);
            dataobjects.Add("FeeType", bll.Model.FeeType.ToString());
            dataobjects.Add("AccountTitleType", bll.Model["AccountTitle2"]);

            #region 组合审批任务主题
            string title = bll.Model["Title"] + ",申请备案号:" + bll.Model.SheetCode + ",总费用:" + lb_TotalCost.Text;
            #endregion

            string AppCode = "FNA_FeeApplyFlow";
            if (EWF_Flow_AppBLL.GetModelList("Code='" + AppCode + "_" + bll.Model.FeeType.ToString() +
                "' AND EnableFlag='Y'").Count > 0)
                AppCode = AppCode + "_" + bll.Model.FeeType.ToString();

            if (bll.Model["AccountTitle2"] =="81")//导购管理费
            {
                AppCode ="FNA_FeeApplyFlow_8";
            }

            int TaskID = EWF_TaskBLL.NewTask(AppCode, (int)Session["UserID"], title, "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString(), dataobjects);
            if (TaskID <= 0)
            {
                MessageBox.Show(this, "对不起,工作流发起失败,请与管理员联系!");
                return;
            }
            new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            #endregion

            bll.Submit((int)Session["UserID"], TaskID);

            MessageBox.ShowAndRedirect(this, "费用申请提交成功!", "FeeApplyList.aspx?FeeType=" + ViewState["FeeType"].ToString() + "&AccountMonth=" + ViewState["AccountMonth"].ToString());
        }
    }
コード例 #35
0
    protected string GetPreApplyInfo(int detailid, decimal applycost)
    {
        string str = "";
        return "";
        FNA_FeeApplyDetail predetail = FNA_FeeApplyBLL.GetPreApplyInfoByClient(detailid);
        IsRed = false;
        if (predetail != null)
        {
            decimal preCost = predetail.ApplyCost + predetail.AdjustCost;
            if (preCost > 0)
            {
                FNA_FeeApply preApply = new FNA_FeeApplyBLL(predetail.ApplyID).Model;
                int month = new FNA_FeeApplyBLL().GetDetailModel(detailid).BeginMonth;
                if (month == predetail.BeginMonth)
                {
                    str = "※当月重复※<br/>单号:" + preApply.SheetCode + "<br/>";
                    IsRed = true;
                }
                str += "金额:" + preCost.ToString("0.##元") + "   " + "与前次比例:" + (applycost / preCost).ToString("0%") + " <br/>" +
                    "月份:" + new AC_AccountMonthBLL(predetail.BeginMonth).Model.Name + " <br/>" +
                    "说明:" + predetail.Remark;
                if ((applycost / preCost) > 1.5m)
                {
                    IsRed = true;
                }
            }
        }

        return str;
    }
コード例 #36
0
    protected int DoApprove(int OrganizeCity, bool ApproveFlag)
    {
        int       month     = int.Parse(ddl_Month.SelectedValue);
        int       state     = 1;    //待我审批
        int       RTChannel = 0;    //所有渠道
        DataTable dtSummary = FNA_FeeApplyBLL.GetRTChannelDiaplayFee
                                  (month, OrganizeCity, state, int.Parse(Session["UserID"].ToString()), RTChannel);

        int counts = 0;

        if (dtSummary != null)
        {
            string TaskColumnName = "";
            foreach (DataColumn c in dtSummary.Columns)
            {
                if (c.ColumnName.EndsWith("→审批工作流"))
                {
                    TaskColumnName = c.ColumnName;
                    break;
                }
            }
            if (TaskColumnName == "")
            {
                MessageBox.Show(this, "未找到列名[审批工作流]的数据列!");
                return(-1);
            }

            IList <int> TaskIDs = new List <int>();
            foreach (DataRow row in dtSummary.Rows)
            {
                int taskid = (int)row[TaskColumnName];
                if (TaskIDs.Contains(taskid))
                {
                    continue;
                }

                TaskIDs.Add(taskid);

                int jobid = EWF_TaskBLL.StaffCanApproveTask(taskid, (int)Session["UserID"]);
                if (jobid > 0)
                {
                    EWF_Task_JobBLL job = new EWF_Task_JobBLL(jobid);
                    if (job != null)
                    {
                        int decisionid = job.StaffCanDecide((int)Session["UserID"]);
                        if (decisionid > 0)
                        {
                            if (ApproveFlag)
                            {
                                job.Decision(decisionid, (int)Session["UserID"], 2, "汇总单批量审批通过!");       //2:审批已通过
                            }
                            else
                            {
                                job.Decision(decisionid, (int)Session["UserID"], 3, "汇总单批量审批不通过!");       //3:审批不通过
                            }
                            counts++;
                        }
                    }
                }
            }
        }

        return(counts);
    }
コード例 #37
0
    protected void gv_ListDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_ListDetail.DataKeys[e.Row.RowIndex]["ApplyDetailID"];
            if (applydetailid > 0)
            {
                Label lb_ApplySheetCode = (Label)e.Row.FindControl("lb_ApplySheetCode");
                if (lb_ApplySheetCode != null)
                    lb_ApplySheetCode.Text = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
                FNA_FeeApplyDetail _detail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                FNA_FeeWriteOffDetail _writeoffdetail = new FNA_FeeWriteOffBLL().GetDetailModel((int)gv_ListDetail.DataKeys[e.Row.RowIndex]["ID"]);
                Label lb_AllCost = (Label)e.Row.FindControl("lb_AllCost");
                if (lb_AllCost != null)
                    lb_AllCost.Text = Math.Round(decimal.Parse(_detail["DICost"] == "" ? "0" : _detail["DICost"]) + _detail.ApplyCost, 1).ToString("0.##");
                Label lb_Remark = (Label)e.Row.FindControl("lb_Remark");

                if (lb_Remark != null)
                {
                    try
                    {
                        if (_detail.AccountTitle == 80) //导购工资
                        {
                            lb_Remark.Text = _detail.Remark.Replace("-", "<br/>");
                        }
                        else if (_detail.AccountTitle == 82)//无导返利
                        {
                            lb_Remark.Text = _detail["FLRemark"];
                            if (ViewState["FLPurchase"] != null)
                                lb_Remark.Text = "进货额:" + ((DataTable)ViewState["FLPurchase"]).Compute("Sum(PurchaseVolume)", "ID=" + _writeoffdetail.ID).ToString() + ";" + _detail["FLRemark"];
                        }
                        else
                        {
                            lb_Remark.Text = _writeoffdetail.Remark;
                        }
                    }
                    catch (Exception)
                    {
                        lb_Remark.Text = _writeoffdetail.Remark;
                    }
                }
                Label lb_RelateBrand = (Label)e.Row.FindControl("lb_RelateBrand");
                if (lb_RelateBrand != null)
                {
                    string[] brands = new FNA_FeeApplyBLL().GetDetailModel(applydetailid).RelateBrands.Split
                        (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    lb_RelateBrand.Text = "";

                    foreach (string b in brands)
                    {
                        lb_RelateBrand.Text += new PDT_BrandBLL(int.Parse(b)).Model.Name + ",";
                    }
                }
                int client = (int)((UC_GridView)sender).DataKeys[e.Row.RowIndex]["Client"];

                if (client > 0)
                {
                    Label lb_RTChannel = (Label)e.Row.FindControl("lb_RTChannel");
                    CM_Client c = new CM_ClientBLL(client).Model;
                    if (c != null && c.ClientType == 3 && c["RTChannel"] != "" && lb_RTChannel != null)
                    {
                        if (DictionaryBLL.GetDicCollections("CM_RT_Channel").Keys.Contains(c["RTChannel"]))
                            lb_RTChannel.Text = DictionaryBLL.GetDicCollections("CM_RT_Channel")[c["RTChannel"]].ToString();
                    }
                }

            }
        }
    }
コード例 #38
0
    protected void bt_Generate_Click(object sender, EventArgs e)
    {
        if (ddl_Contract.SelectedValue != "" && ddl_Contract.SelectedValue != "0")
        {
            #region 本次合同费用支付的开始及截止日期
            CM_ContractBLL contractbll = new CM_ContractBLL(int.Parse(ddl_Contract.SelectedValue));

            #region 获取最早的付款截止日期,再次获取,是防止同时打开多个该页面后,分别点申请费用
            DateTime begindate = GetMinPayDate(contractbll);

            if (begindate >= contractbll.Model.EndDate)
            {
                MessageBox.Show(this, "对不起,该合同没有需要付款的明细科目!");
                bt_Generate.Enabled = false;
                return;
            }

            lb_PayDateRegion.Text = begindate.ToString("yyyy年MM月dd日");
            #endregion

            DateTime enddate = contractbll.Model.EndDate;

            DateTime monthenddate = new AC_AccountMonthBLL(int.Parse(ddl_EndMonth.SelectedValue) + 1).Model.EndDate;
            while (enddate > monthenddate)
            {
                enddate = enddate.AddMonths(-1);
            }
            if (enddate <= begindate)
            {
                MessageBox.Show(this, "该合同所有范围的款项均已支付完成!" + enddate.ToString());
                return;
            }
            #endregion

            #region 求出当前客户的直销总经销商
            CM_Client client = new CM_ClientBLL((int)ViewState["ClientID"]).Model;
            if (client == null) return;
            int supplier = 0;

            while (client != null)
            {
                client = new CM_ClientBLL(client.Supplier).Model;
                if (client == null) break;
                if (client.ClientType == 2 && client["DIClassify"] == "1")
                {
                    supplier = client.ID;
                    break;
                }
            }
            #endregion

            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL();

            bll.Model.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
            bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue);
            bll.Model.Client = supplier;       //费用代垫客户
            bll.Model.State = 1;               //草稿
            bll.Model.ApproveFlag = 2;         //未审核
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model["Title"] = ddl_Month.SelectedItem.Text + " 合同费用提前预支付申请单" + " " + select_Client.SelectText + " " + Session["UserRealName"].ToString();

            #region 判断合同类型
            switch (contractbll.Model.Classify)
            {
                case 1:         //陈列合同
                    if (new CM_ClientBLL((int)ViewState["ClientID"]).Model["RTChannel"] == "1")
                        //NKA合同费用
                        bll.Model.FeeType = ConfigHelper.GetConfigInt("ContractFeeType-KA");
                    else
                        //非NKA合同费用
                        bll.Model.FeeType = ConfigHelper.GetConfigInt("ContractFeeType");
                    break;
                case 3:         //导购管理费
                    bll.Model.FeeType = ConfigHelper.GetConfigInt("ContractFeeType-PromotorCost");
                    break;
                case 21:        //租赁合同
                    bll.Model.FeeType = ConfigHelper.GetConfigInt("ContractFeeType-PD");
                    break;
                default:
                    MessageBox.Show(this, "对不起,该合同类型暂不支持费用申请!合同类别:" + contractbll.Model.Classify.ToString());
                    return;
            }
            if (contractbll.Model.Classify != 21)
            {
                if (contractbll.Items.Where(p => p.PayMode > 1).ToList().Count == 0)
                {
                    //非租赁费的合同,不可申请逐月支付的科目费用
                    MessageBox.Show(this, "对不起,付款方式为每月付的科目不可提前申请费用!");
                    return;
                }
            }
            #endregion

            foreach (CM_ContractDetail item in contractbll.Items)
            {
                if (contractbll.Model.Classify != 21)
                {
                    //非租赁费的合同,不可申请逐月支付的科目费用
                    if (item.PayMode == 1) continue;
                }

                DateTime d = begindate;
                while (d < enddate)
                {
                    FNA_FeeApplyDetail detail = new FNA_FeeApplyDetail();
                    detail.Client = (int)ViewState["ClientID"];
                    detail.AccountTitle = item.AccountTitle;
                    detail.BeginDate = d;

                    if (d.AddMonths(1).AddDays(-1) <= contractbll.Model.EndDate)
                    {
                        detail.EndDate = d.AddMonths(1).AddDays(-1);
                        detail.ApplyCost = item.ApplyLimit * item.BearPercent / 100;
                        detail.DICost = item.ApplyLimit * (100 - item.BearPercent) / 100;
                    }
                    else
                    {
                        #region 最后一个月不足一个月时的处理
                        detail.EndDate = contractbll.Model.EndDate;
                        int days = (detail.EndDate - detail.BeginDate).Days + 1;
                        detail.ApplyCost = Math.Round(item.ApplyLimit * days / 30, 1, MidpointRounding.AwayFromZero) * item.BearPercent / 100;
                        detail.DICost = Math.Round(item.ApplyLimit * days / 30, 1, MidpointRounding.AwayFromZero) * (100 - item.BearPercent) / 100;
                        #endregion
                    }
                    detail.BeginMonth = AC_AccountMonthBLL.GetMonthByDate(detail.BeginDate);
                    detail.EndMonth = detail.BeginMonth;
                    detail.LastWriteOffMonth = bll.Model.AccountMonth + 1;

                    #region 不可申请之前月的费用
                    if (detail.BeginMonth < bll.Model.AccountMonth)
                    {
                        d = d.AddMonths(1);
                        continue;
                    }
                    #endregion

                    #region 判断当月费用是否已申请过
                    string condition = "Client = " + detail.Client.ToString() + " AND RelateContractDetail = " + item.ID.ToString() + " AND Flag<>3";
                    if (item.PayMode != 20) condition += "AND BeginMonth=" + detail.BeginMonth.ToString();

                    if (new FNA_FeeApplyBLL().GetDetail(condition).Count > 0)
                    {
                        d = d.AddMonths(1);
                        continue;
                    }
                    #endregion

                    detail.RelateContractDetail = item.ID;
                    detail.Remark = "合同编号:" + contractbll.Model["Code"] + " 日期范围:" + detail.BeginDate.ToString("yyyy-MM-dd") + "~" + detail.EndDate.ToString("yyyy-MM-dd");
                    detail.RelateBrands = item["RelateBrand"];
                    if (string.IsNullOrEmpty(detail.RelateBrands))
                    {
                        foreach (PDT_Brand brand in PDT_BrandBLL.GetModelList("IsOpponent=1"))
                        {
                            detail.RelateBrands += brand.ID.ToString() + ",";
                        }
                    }
                    detail.Flag = 1;  //未报销
                    detail["FeeApplyType"] = (d == contractbll.Model.BeginDate ? "1" : "2");
                    bll.Items.Add(detail);

                    d = d.AddMonths(1);

                    #region 以协议里该科目付款周期为准
                    if (item.PayMode != 20)
                    {
                        DateTime maxpaydate = begindate.AddMonths(item.PayMode).AddDays(-1);
                        if (d > maxpaydate) break;
                    }
                    else
                    {
                        break;
                    }
                    #endregion
                }
            }

            bll.Model.SheetCode = FNA_FeeApplyBLL.GenerateSheetCode(bll.Model.OrganizeCity, bll.Model.AccountMonth);
            int applyid = bll.Add();

            MessageBox.ShowAndRedirect(this, "费用申请成功!", ResolveUrl("~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applyid.ToString()));
        }
    }
コード例 #39
0
    protected void bt_AddToWriteOffList_Click(object sender, EventArgs e)
    {
        ListTable<FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable<FNA_FeeWriteOffDetail>;
        int maxid = 0;
        if (_details != null)
            if (_details.GetListItem().Count > 0) maxid = _details.GetListItem().Max(p => p.ID);
        maxid++;

        foreach (GridViewRow row in gv_FeeAplyList.Rows)
        {
            CheckBox cb_Selected = (CheckBox)row.FindControl("cb_Selected");
            if (cb_Selected.Checked)
            {
                int applyid = (int)gv_FeeAplyList.DataKeys[row.RowIndex][0];
                int applydetialid = (int)gv_FeeAplyList.DataKeys[row.RowIndex][1];

                FNA_FeeApplyBLL applyBLL = new FNA_FeeApplyBLL(applyid);
                FNA_FeeApply apply = applyBLL.Model;
                FNA_FeeApplyDetail applydetail = applyBLL.GetDetailModel(applydetialid);

                #region 陈列、返利费用判断协议是否关联合同
                IList<CM_Contract> contractList;
                contractList = CM_ContractBLL.GetModelList(@"ContractCode!='' AND ContractCode=MCS_SYS.dbo.UF_Spilt('" + applydetail.Remark + "',':',2)");
                if (applydetail.RelateContractDetail != 0)
                {
                    int ID = 0;
                    CM_ContractDetail detail = new CM_ContractBLL().GetDetailModel(applydetail.RelateContractDetail);
                    if (detail != null)
                        ID = detail.ContractID;
                    contractList = CM_ContractBLL.GetModelList("ID=" + ID.ToString());
                }

                if (contractList.Count > 0 && contractList[0].Classify < 3 && ATMT_AttachmentBLL.GetModelList("RelateType=35 AND RelateID=" + contractList[0].ID.ToString()).Count == 0)
                {
                    MessageBox.Show(this, "陈列、返利费用操作费用核销申请时,门店协议必须上传附件,请上传后再核销!");
                    return;
                }
                #endregion

                FNA_FeeWriteOffDetail m = new FNA_FeeWriteOffDetail();
                m.ID = maxid++;
                m.ApplyDetailID = applydetialid;
                m.Client = applydetail.Client;
                m.AccountTitle = applydetail.AccountTitle;
                m.ProductBrand = apply.ProductBrand;
                m.ApplyCost = applydetail.AvailCost;
                m.BeginMonth = applydetail.BeginMonth;
                m.EndMonth = applydetail.EndMonth;
                m.BeginDate = applydetail.BeginDate;
                m.EndDate = applydetail.EndDate;
                m.WriteOffCost = applydetail.AvailCost;
                m.Remark = applydetail.Remark;
                if (applydetail["BankVoucherNo"] != "") m.Remark += ",凭证:" + applydetail["BankVoucherNo"];

                if (applydetail.Remark.IndexOf("是否CA") > 0)
                    m.Remark = applydetail.Remark.Substring(applydetail.Remark.IndexOf("是否CA") - 1);
                if (_details == null)
                    _details = new ListTable<FNA_FeeWriteOffDetail>(new List<FNA_FeeWriteOffDetail>(), "ID");
                _details.Add(m);
            }
        }

        BindGrid();
        gv_FeeAplyList.PageIndex = 0;
        BindFeeApplyNoWriteOff();
    }
コード例 #40
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int applydetailid = (int)gv_List.DataKeys[e.Row.RowIndex]["ApplyDetailID"];
            if (applydetailid > 0)
            {
                string sheetcode = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);
                FNA_FeeApplyDetail applydetail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                if (applydetail != null)
                {
                    HyperLink hy_ApplySheetCode = (HyperLink)e.Row.FindControl("hy_ApplySheetCode");
                    hy_ApplySheetCode.Text = sheetcode;
                    hy_ApplySheetCode.NavigateUrl = "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applydetail.ApplyID;
                    HyperLink hy_TaskApprove = (HyperLink)e.Row.FindControl("hy_TaskApprove");
                    FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL(applydetail.ApplyID);
                    if (hy_TaskApprove != null && bll.Model.ApproveTask > 0)
                    {
                        hy_TaskApprove.NavigateUrl = "~/SubModule/EWF/TaskDetail.aspx?TaskID=" + bll.Model.ApproveTask;
                        hy_TaskApprove.Visible = true;
                    }
                    if (applydetail.Client > 0)
                    {
                        HyperLink hy_Client = (HyperLink)e.Row.FindControl("hy_Client");
                        hy_Client.Text = new CM_ClientBLL(applydetail.Client).Model.FullName;
                        hy_Client.NavigateUrl = "~/SubModule/FNA/FeeApplyOrWriteoffByClientList.aspx?ClientID=" + applydetail.Client;
                    }
                    if (applydetail.AccountTitle == 82 && ViewState["ID"] != null && (int)ViewState["ID"] > 0)
                    {
                        Object obj_lab = e.Row.FindControl("lb_DeductReason");
                        if (obj_lab != null && ViewState["FLPurchase"] != null)
                            e.Row.Cells[7].Text = "总进货额:" + ((DataTable)ViewState["FLPurchase"]).Compute("Sum(PurchaseVolume)", "ID=" + gv_List.DataKeys[e.Row.RowIndex]["ID"]).ToString() + ";\n"
                                + e.Row.Cells[7].Text;
                    }
                }
            }
            int id = (int)gv_List.DataKeys[e.Row.RowIndex]["ID"];
            if (id > 0)
            {
                Button bt_OpenAdjust = e.Row.FindControl("bt_OpenAdjust") != null ? (Button)e.Row.FindControl("bt_OpenAdjust") : null;
                if (Request.QueryString["Decision"] != "" && Request.QueryString["Decision"] == "Y")
                {
                    bt_OpenAdjust.OnClientClick = "PopAdjust(" + id.ToString() + ")";
                    bt_OpenAdjust.Visible = true;
                }
                FNA_FeeWriteOffDetail writedetail = new FNA_FeeWriteOffBLL().GetDetailModel(id);
                if (applydetailid == 0)
                {
                    Button btn_Attachment = e.Row.FindControl("btn_Attachment") != null ? (Button)e.Row.FindControl("btn_Attachment") : null;
                    if (btn_Attachment != null) btn_Attachment.Visible = false;
                    HyperLink hy_Client = (HyperLink)e.Row.FindControl("hy_Client");
                    CM_Client client = new CM_ClientBLL(writedetail.Client).Model;
                    hy_Client.Text = client == null || string.IsNullOrEmpty(client.FullName) ? string.Empty : client.FullName;
                    hy_Client.NavigateUrl = "~/SubModule/FNA/FeeApplyOrWriteoffByClientList.aspx?ClientID=" + writedetail.Client;
                    bt_OpenAdjust.Visible = false;
                }
            }

        }
    }
コード例 #41
0
 protected string GetISDelay(int FeeApplyDetailID)
 {
     if (FeeApplyDetailID == 0) return "";
     FNA_FeeApplyDetail detail = new FNA_FeeApplyBLL().GetDetailModel(FeeApplyDetailID);
     if (detail == null) return "";
     FNA_FeeApply feeapply = new FNA_FeeApplyBLL(detail.ApplyID).Model;
     int month = AC_AccountMonthBLL.GetMonthByDate(feeapply.InsertTime.AddDays(-ConfigHelper.GetConfigInt("FeeWriteDelayDays")));
     return month > detail.LastWriteOffMonth ? "<font color=red>逾期" + (month - detail.LastWriteOffMonth).ToString() + "个月</font>" : "<font color=blue></font>";
 }
コード例 #42
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        #region 判断预算余额是否够申请该项费用
        //if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl" &&
        //    decimal.Parse(lb_BudgetBalance.Text) < decimal.Parse(lb_TotalCost.Text))
        //{
        //    MessageBox.Show(this, "对不起,您当前的预算余额不够申请该项费用!");
        //    return;
        //}
        #endregion

        if (gv_List.Rows.Count == 0)
        {
            MessageBox.Show(this, "对不起, 必须添加相应的费用明细!");
            return;
        }
        ListTable <FNA_FeeApplyDetail> _details = ViewState["Details"] as ListTable <FNA_FeeApplyDetail>;
        FNA_FeeApplyBLL bll;
        if ((int)ViewState["ID"] == 0)
        {
            bll = new FNA_FeeApplyBLL();
        }
        else
        {
            bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能修改!");
                return;
            }
        }
        pn_FeeApply.GetData(bll.Model);

        bll.Model["Remark"] = tbx_Remark.Text.Replace("|", "");

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.SheetCode          = FNA_FeeApplyBLL.GenerateSheetCode((int)ViewState["OrganizeCity"], (int)ViewState["AccountMonth"]); //自动产生备案号
            bll.Model.AccountMonth       = (int)ViewState["AccountMonth"];
            bll.Model.FeeType            = (int)ViewState["FeeType"];
            bll.Model.OrganizeCity       = (int)ViewState["OrganizeCity"];
            bll.Model["AccountTitle2"]   = ViewState["AccountTitle2"].ToString() == "0" ? "" : ViewState["AccountTitle2"].ToString();
            bll.Model["ActivityID"]      = ViewState["ActivityID"].ToString() == "0" ? "" : ViewState["ActivityID"].ToString();
            bll.Model["RelateCar"]       = ViewState["RelateCar"].ToString() == "0" ? "" : ViewState["RelateCar"].ToString();
            bll.Model["FromGeneralFlow"] = ViewState["FromGeneralFlow"].ToString();

            bll.Model.ApproveFlag = 1;
            bll.Model.State       = 1;
            bll.Model.InsertStaff = (int)Session["UserID"];

            bll.Items = _details.GetListItem();

            #region 费用申请时,一个申请单中只能申请一家店面费用时,将门店设置到Head表中
            try
            {
                if (!ConfigHelper.GetConfigBool("FeeApplyMutiClientsFee") && bll.Items.Count > 0)
                {
                    bll.Model.Client = bll.Items[0].Client;
                }
            }
            catch { }
            #endregion

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

            #region 修改明细
            bll.Items = _details.GetListItem(ItemState.Added);
            bll.AddDetail();

            foreach (FNA_FeeApplyDetail _deleted in _details.GetListItem(ItemState.Deleted))
            {
                bll.DeleteDetail(_deleted.ID);
            }

            bll.Items = _details.GetListItem(ItemState.Modified);
            bll.UpdateDetail();

            #endregion
        }

        if (sender != null)
        {
            MessageBox.ShowAndRedirect(this, "申请保存成功,请尽快点击“提交申请”按钮,否则本次申请未生效!", "FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString());
        }
        else
        {
            //明细保存成功后,重置明细里各记录的新增、修改状态,以免重复新增
            ViewState["Details"] = new ListTable <FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
        }
    }
コード例 #43
0
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            if (gv_List.Rows.Count == 0)
            {
                MessageBox.Show(this, "对不起, 必须添加相应的费用明细!");
                return;
            }

            bt_Save_Click(null, null);

            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能提交!");
                return;
            }

            if (bll.Model.Client == 0 && !cbx_NoInsteadPayClient.Checked)
            {
                MessageBox.Show(this, "请正确选择费用代垫客户,如果确认无代垫客户,请勾选【确认无代垫客户】复选框!");
                return;
            }

            if (cbx_NoInsteadPayClient.Checked && bll.Model.Client != 0)
            {
                MessageBox.Show(this, "您已选择了费用代垫客户,又请勾选【确认无代垫客户】复选框,两者只能选择其一,请确认!");
                return;
            }

            #region 判断预算额度余额是否够申请
            if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
            {
                decimal _balance   = FNA_BudgetBLL.GetUsableAmount(bll.Model.AccountMonth, bll.Model.OrganizeCity, bll.Model.FeeType);
                decimal _applycost = decimal.Parse(lb_TotalCost.Text);
                lb_BudgetAmount.Text = _balance.ToString("0.###");

                if (bll.Model.FeeType == ConfigHelper.GetConfigInt("GiftFeeType"))
                {
                    _balance = GetGiftAmountBalance();
                }

                if (_balance < _applycost)
                {
                    MessageBox.Show(this, "对不起,您当前的预算余额不够申请该项费用!");
                    return;
                }
            }
            #endregion

            #region 发起工作流
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", ViewState["ID"].ToString());
            dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString());
            dataobjects.Add("AccountMonth", bll.Model.AccountMonth.ToString());
            dataobjects.Add("TotalFee", lb_TotalCost.Text);
            dataobjects.Add("BorrowFee", lb_BorrowTotal.Text);
            dataobjects.Add("FeeType", bll.Model.FeeType.ToString());
            dataobjects.Add("AccountTitleType", bll.Model["AccountTitle2"]);

            #region 组合审批任务主题
            string title = bll.Model["Title"] + ",申请备案号:" + bll.Model.SheetCode + ",总费用:" + lb_TotalCost.Text;
            #endregion

            string AppCode = "FNA_FeeApplyFlow";
            if (EWF_Flow_AppBLL.GetModelList("Code='" + AppCode + "_" + bll.Model.FeeType.ToString() +
                                             "' AND EnableFlag='Y'").Count > 0)
            {
                AppCode = AppCode + "_" + bll.Model.FeeType.ToString();
            }

            if (bll.Model["AccountTitle2"] == "81")//导购管理费
            {
                AppCode = "FNA_FeeApplyFlow_8";
            }

            int TaskID = EWF_TaskBLL.NewTask(AppCode, (int)Session["UserID"], title, "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString(), dataobjects);
            if (TaskID <= 0)
            {
                MessageBox.Show(this, "对不起,工作流发起失败,请与管理员联系!");
                return;
            }
            new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            #endregion

            bll.Submit((int)Session["UserID"], TaskID);

            MessageBox.ShowAndRedirect(this, "费用申请提交成功!", "FeeApplyList.aspx?FeeType=" + ViewState["FeeType"].ToString() + "&AccountMonth=" + ViewState["AccountMonth"].ToString());
        }
    }
コード例 #44
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        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");

        FNA_FeeWriteOffBLL bll;

        if ((int)ViewState["ID"] == 0)
            bll = new FNA_FeeWriteOffBLL();
        else
        {
            bll = new FNA_FeeWriteOffBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.ShowAndRedirect(this, "对不起,当前核销单的状态不是“未提交”状态,不可保存!", "FeeWriteOffDetail.aspx?ID=" + ViewState["ID"].ToString());
                return;
            }
        }
        pn_FeeWriteOff.GetData(bll.Model);
        bll.Model["Remark"] = tbx_Remark.Text;

        #region 有效性校验
        // 判断是否选择了费用代垫客户或代垫员工
        {
            if (bll.Model["InsteadPaySystem"] == "0") bll.Model["InsteadPaySystem"] = "";
            if (bll.Model["InsteadPayStaff"] == "0") bll.Model["InsteadPayStaff"] = "";

            int insteadcount = 0;
            if (bll.Model.InsteadPayClient != 0) insteadcount++;
            if (!string.IsNullOrEmpty(bll.Model["InsteadPayStaff"])) insteadcount++;
            if (!string.IsNullOrEmpty(bll.Model["InsteadPaySystem"])) insteadcount++;

            if (insteadcount > 1)
            {
                MessageBox.Show(this, "代垫信息中,只能填写其中一个代垫信息!");
                return;
            }
            else if (insteadcount == 0)
            {
                MessageBox.Show(this, "代垫信息中,必须填写其中一个代垫信息!");
                return;
            }
        }
        #endregion

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.SheetCode = FNA_FeeWriteOffBLL.GenerateSheetCode((int)ViewState["OrganizeCity"]);   //自动产生报销单号
            bll.Model.AccountMonth = (int)ViewState["AccountMonth"];
            bll.Model.FeeType = (int)ViewState["FeeType"];
            bll.Model.OrganizeCity = (int)ViewState["OrganizeCity"];
            bll.Model.ApproveFlag = 1;
            bll.Model.State = 1;
            bll.Model["HasFeeApply"] = ViewState["HasFeeApply"].ToString();     //是否有申请单
            bll.Model["IsEvectionWriteOff"] = "N";                                               //非关联于差旅行程的报销
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model["InvoiceClassAB"] = ViewState["InvoiceClassAB"].ToString();
            bll.Model["FeeApplyClient"] = ViewState["FeeApplyClient"].ToString();
            bll.Model["FeeApplyStaff"] = ViewState["FeeApplyStaff"].ToString();
            bll.Items = _details.GetListItem();

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

            #region 修改明细

            #region 增加报销明细时,再次判断该项费用是否已报销
            bll.Items = new List<FNA_FeeWriteOffDetail>();
            foreach (FNA_FeeWriteOffDetail item in _details.GetListItem(ItemState.Added))
            {
                FNA_FeeApplyBLL apply = new FNA_FeeApplyBLL();
                if (apply.GetDetailModel(item.ApplyDetailID).Flag == 1)
                {
                    bll.Items.Add(item);
                }
            }
            bll.AddDetail();
            #endregion

            foreach (FNA_FeeWriteOffDetail _deleted in _details.GetListItem(ItemState.Deleted))
            {
                bll.DeleteDetail(_deleted.ID);
            }

            bll.Items = _details.GetListItem(ItemState.Modified);
            bll.UpdateDetail();

            #endregion
        }

        if (sender != null)
            Response.Redirect("FeeWriteOffDetail.aspx?ID=" + ViewState["ID"].ToString());
    }
コード例 #45
0
    private void BindData()
    {
        int id = (int)ViewState["ID"];

        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;

        if (apply == null)
        {
            Response.Redirect("FeeApplyList.aspx");
        }

        ViewState["AccountMonth"]    = apply.AccountMonth;
        ViewState["OrganizeCity"]    = apply.OrganizeCity;
        ViewState["FeeType"]         = apply.FeeType;
        ViewState["AccountTitle2"]   = string.IsNullOrEmpty(apply["AccountTitle2"]) ? 0 : int.Parse(apply["AccountTitle2"]);
        ViewState["DicFeeType"]      = DictionaryBLL.GetDicCollections("FNA_FeeType")[ViewState["FeeType"].ToString()];
        ViewState["RelateCar"]       = string.IsNullOrEmpty(apply["RelateCar"]) ? 0 : int.Parse(apply["RelateCar"]);
        ViewState["GiftFeeClassify"] = string.IsNullOrEmpty(apply["GiftFeeClassify"]) ? 0 : int.Parse(apply["GiftFeeClassify"]);
        ViewState["FromGeneralFlow"] = string.IsNullOrEmpty(apply["FromGeneralFlow"]) ? "Y" : "N";

        pn_FeeApply.BindData(apply);

        if (apply.Client != 0)
        {
            cbx_NoInsteadPayClient.Visible = false;
        }

        UploadFile1.RelateID = (int)ViewState["ID"];

        if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl")
        {
            BindBudgetInfo();
        }
        else if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "FeeRateControl")
        {
            BindFeeRateInfo();
        }

        #region 根据审批状态控制页面
        bt_ViewWriteOff.Visible = false;
        if (apply.State == 1)
        {
            //未提交状态
            bt_ViewReport.Visible = false;

            tbx_Remark.Text    = apply["Remark"];
            tbl_Remark.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = true;  //删除按钮
        }

        if (apply.State != 1)
        {
            //非 未提交 状态
            bt_Delete.Visible    = false;
            bt_AddDetail.Visible = false;
            pn_FeeApply.SetPanelEnable("Panel_FNA_FeeApplyDetail_1", false);
            gv_List.Columns[gv_List.Columns.Count - 1].Visible = false;
            bt_Save.Visible   = false;
            bt_Submit.Visible = false;

            apply["Remark"] = apply["Remark"].Replace("\r", "<br/>");
            pn_Remark.BindData(apply);
            pn_Remark.Visible = true;

            cbx_NoInsteadPayClient.Visible = false;

            UploadFile1.CanDelete = false;

            if (apply.FeeType == 1)
            {
                bt_ViewReport.OnClientClick = "PopReport(" + apply.ID.ToString() + ")";
            }
            else
            {
                bt_ViewReport.Visible = false;
            }


            //可见调整金额及原因
            gv_List.Columns[gv_List.Columns.Count - 7].Visible  = true; //批复额
            gv_List.Columns[gv_List.Columns.Count - 10].Visible = true; //调整原因
            gv_List.Columns[gv_List.Columns.Count - 11].Visible = true; //调整金额
            if ((ViewState["Details"] as ListTable <FNA_FeeApplyDetail>).GetListItem().FirstOrDefault(p => p.AccountTitle == 82) != null)
            {
                gv_List.Columns[gv_List.Columns.Count - 6].Visible = true;  //批复额
                gv_List.Columns[gv_List.Columns.Count - 8].Visible = true;  //调整原因
                gv_List.Columns[gv_List.Columns.Count - 9].Visible = true;  //调整金额
            }
        }
        if ((ViewState["Details"] as ListTable <FNA_FeeApplyDetail>).GetListItem()[0].RelateContractDetail > 0)
        {
            gv_List.Columns[4].Visible = true;
        }

        if (apply.State == 2)
        {
            ///已提交状态,审批过程中,可以作金额调整
            ///审批过程中,可以作金额调整 Decision参数为在审批过程中传进来的参数
            if (Request.QueryString["Decision"] != "" && Request.QueryString["Decision"] == "Y")
            {
                gv_List.Columns[gv_List.Columns.Count - 2].Visible = true; //允许调整申请金额
                int fltype = ConfigHelper.GetConfigInt("ContractFeeType-FL");
                if (apply.FeeType == fltype)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_Pass').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_bt_SaveDecisionComment').disabled='disabled'; </script>");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "返利不能单条处理", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_WaitProcess').disabled='disabled'; </script>");
                    string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 9).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                    if (!allowdays.Contains(DateTime.Now.Day.ToString()))
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "超时不能单独审批", " <script>window.parent.document.getElementById('ctl00_ContentPlaceHolder1_btn_NotPass').disabled='disabled'; </script>");
                    }
                }
            }
            bt_ViewWriteOff.Visible = false;
        }

        if (apply.State == 3)
        {
            //已审批
            bt_ViewWriteOff.Visible = true;
            gv_List.Columns[gv_List.Columns.Count - 3].Visible = true; //查看核销 链接
            gv_List.Columns[gv_List.Columns.Count - 4].Visible = true; //可报销额
            gv_List.Columns[gv_List.Columns.Count - 5].Visible = true; //报销标志

            bt_ViewWriteOff.OnClientClick = "PopWriteOffListByApplyID(" + id.ToString() + ")";
            if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1503, "CancelWirteOffDetail"))
            {
                bt_CancelWriteOff.Visible       = true;
                bt_CancelWriteOff.OnClientClick = "return confirm('是否确定取消选中的费用,取消后,该费用不可再次核销!\n【若需要再次核销则需要重新发起申请!】')";
                gv_List.Columns[0].Visible      = true;
            }
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State != 3)
        {
            bt_Cancel.Visible = false;
        }

        if (apply.InsertStaff != (int)Session["UserID"] || apply.State >= 3)
        {
            UploadFile1.CanUpload = false;
            UploadFile1.CanDelete = false;
        }

        if (apply.State != 8)
        {
            bt_Copy.Visible = false;    //只有审批未通过才可重新激活
        }

        #endregion

        if (apply["FromGeneralFlow"] == "N")
        {
            if (apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-KA") ||
                apply.FeeType == ConfigHelper.GetConfigInt("ContractFeeType-FL")
                )
            {
                bt_AddDetail.Visible = false;
            }
        }
        #region 增加客户后的详细内容按钮
        if (apply.Client != 0)
        {
            //MCSSelectControl sc_Client = (MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client");
            //if (sc_Client != null)
            //{
            //    HyperLink hy_clientdetail = new HyperLink();
            //    hy_clientdetail.ImageUrl = "~/Images/Gif/gif-0818.gif";
            //    hy_clientdetail.NavigateUrl = "~/SubModule/CM/RT/RetailerAnalysis.aspx?ClientID=" + apply.Client.ToString();
            //    hy_clientdetail.Target = "_blank";
            //    sc_Client.Parent.Controls.Add(hy_clientdetail);
            //}
        }
        #endregion

        #region 增加关联活动链接
        int activityid = 0;

        if (int.TryParse(apply["ActivityID"], out activityid) && activityid > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_ActivityID");
            if (label != null)
            {
                HyperLink hy_activitydetail = new HyperLink();
                hy_activitydetail.Text        = " 查看活动详情";
                hy_activitydetail.ForeColor   = System.Drawing.Color.Blue;
                hy_activitydetail.NavigateUrl = "~/SubModule/CAT/CAT_ActivityDetail.aspx?ID=" + activityid.ToString();
                hy_activitydetail.Target      = "_blank";
                label.Parent.Controls.Add(hy_activitydetail);
            }
        }
        #endregion

        #region 增加关联HDM结算单链接
        int hdmbalance = 0;

        if (int.TryParse(apply["HDMBalance"], out hdmbalance) && hdmbalance > 0)
        {
            Label label = (Label)pn_FeeApply.FindControl("FNA_FeeApply_HDMBalance");
            if (label != null)
            {
                HyperLink hy_hdmbalance = new HyperLink();
                hy_hdmbalance.Text        = " 查看结算单详情";
                hy_hdmbalance.ForeColor   = System.Drawing.Color.Blue;
                hy_hdmbalance.NavigateUrl = "~/SubModule/CSO/CSO_OfferBalanceDetail.aspx?OfferBalanceID=" + hdmbalance.ToString();
                hy_hdmbalance.Target      = "_blank";
                label.Parent.Controls.Add(hy_hdmbalance);
            }
        }
        #endregion
        BindGrid();
    }
コード例 #46
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
    }
コード例 #47
0
    protected void bt_Generate_Click(object sender, EventArgs e)
    {
        if (ddl_Contract.SelectedValue != "" && ddl_Contract.SelectedValue != "0")
        {
            CM_ContractBLL contractbll = new CM_ContractBLL(int.Parse(ddl_Contract.SelectedValue));

            DateTime begindate = DateTime.Parse(tbx_BeginDate.Text);
            DateTime enddate = DateTime.Parse(tbx_EndDate.Text);
            if (enddate <= begindate)
            {
                MessageBox.Show(this, "开始日期必需小于截止日期!");
                return;
            }

            if (enddate > contractbll.Model.EndDate)
            {
                MessageBox.Show(this, "截止日期不能大于租赁合同的截止日期" + contractbll.Model.EndDate.ToString("yyyy-MM-dd") + "!");
                return;
            }

            #region 判断该合同是否已生成过费用申请
            if (FNA_FeeApplyBLL.GetModelList(string.Format("State IN (1,2,3) AND FeeType=3 AND ID IN (SELECT ApplyID FROM FNA_FeeApplyDetail WHERE Client={0} AND RelateContractDetail={1} AND BeginDate='{2:yyyy-MM-dd}')",
        contractbll.Model.Client, contractbll.Items[0].ID, begindate)).Count > 0)
            {
                MessageBox.Show(this, "该租赁合同已申请过费用了,请勿重复申请!");
                return;
            }
            #endregion

            #region 计算开始日期及截止日期间月份及天数
            enddate = enddate.AddDays(1);
            DateTime tmpdate = begindate;
            int months = 0, days = 0;

            while (tmpdate.AddMonths(1) <= enddate)
            {
                tmpdate = tmpdate.AddMonths(1);
                months++;
            }
            if (tmpdate < enddate) days = (enddate - tmpdate).Days;
            enddate = enddate.AddDays(-1);
            #endregion

            #region 关联全品项
            string relatebrands = "";
            foreach (PDT_Brand brand in PDT_BrandBLL.GetModelList("IsOpponent=1"))
            {
                relatebrands += brand.ID + ",";
            }
            #endregion

            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL();

            bll.Model.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
            bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue);

            bll.Model.FeeType = 3;      //管理费-租赁费
            bll.Model.State = 1;        //草稿
            bll.Model.ApproveFlag = 2;  //未审核
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model["Title"] = ddl_Month.SelectedItem.Text + " 租赁费申请单" + " " + select_Client.SelectText + " " + Session["UserRealName"].ToString();

            foreach (CM_ContractDetail item in contractbll.Items)
            {
                FNA_FeeApplyDetail detail = new FNA_FeeApplyDetail();
                detail.Client = int.Parse(select_Client.SelectValue);
                detail.AccountTitle = item.AccountTitle;
                detail.ApplyCost = Math.Round(item.ApplyLimit * months + item.ApplyLimit * days / DateTime.DaysInMonth(enddate.Year, enddate.Month), 1, MidpointRounding.AwayFromZero);
                detail.BeginDate = begindate;
                detail.EndDate = enddate;
                detail.BeginMonth = AC_AccountMonthBLL.GetMonthByDate(begindate);
                detail.EndMonth = AC_AccountMonthBLL.GetMonthByDate(enddate);
                detail.RelateContractDetail = item.ID;
                detail.Remark = "合同编号:" + contractbll.Model["Code"] + " 日期范围:" + begindate.ToString("yyyy-MM-dd") + "~" + enddate.ToString("yyyy-MM-dd");
                detail.RelateBrands = relatebrands;
                detail.Flag = 1;  //未报销
                detail["FeeApplyType"] = (begindate == contractbll.Model.BeginDate ? "1" : "2");
                bll.Items.Add(detail);
            }

            bll.Model.SheetCode = FNA_FeeApplyBLL.GenerateSheetCode(bll.Model.OrganizeCity, bll.Model.AccountMonth);
            int applyid = bll.Add();

            MessageBox.ShowAndRedirect(this, "费用申请成功!", ResolveUrl("~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applyid.ToString()));
        }
    }
コード例 #48
0
    private void BindData()
    {
        if ((int)ViewState["DetailID"] != 0)
        {
            FNA_FeeWriteOffDetail _model = new FNA_FeeWriteOffBLL().GetDetailModel((int)ViewState["DetailID"]);
            if (_model == null)
            {
                MessageBox.ShowAndClose(this, "请先保存核销单后,再完善发票信息!");
                return;
            }
            FNA_FeeWriteOff writeoff = new FNA_FeeWriteOffBLL(_model.WriteOffID).Model;
            FNA_FeeApplyDetail _applydetail;

            if (_model.ApplyDetailID > 0)
            {
                _applydetail = new FNA_FeeApplyBLL().GetDetailModel(_model.ApplyDetailID);
                lbl_applyCode.Text = new FNA_FeeApplyBLL(_applydetail.ApplyID).Model.SheetCode;

                lb_AvailCost.Text = (_applydetail.AvailCost).ToString("0.00");
                ViewState["AvailCost"] = _applydetail.AvailCost;

            }

            lbl_Client.Text = _model.Client > 0 ? new CM_ClientBLL(_model.Client).Model.FullName : "";
            ViewState["ClientID"] = _model.Client;
            ViewState["Month"] = _model.BeginMonth;

            pn_Detail.BindData(_model);

            if (writeoff.State == 1)
            {
                if (tbx_RebateRate.Text == "" || tbx_RebateRate.Text == "0") tbx_RebateRate.Text = "100";
                if (tbx_DiscountRate.Text == "") tbx_DiscountRate.Text = "0";
                if (tbx_InvoiceCost.Text == "") tbx_InvoiceCost.Text = _model.WriteOffCost.ToString("0.00");
                if (tbx_WriteOffCost2.Text == "") tbx_WriteOffCost2.Text = "0.00";
            }
            ComputInvoiceCost();

            UploadFile1.RelateID = (int)ViewState["DetailID"];

            if (writeoff.State >= 2)
            {
                if (bt_ComputeMixRate != null) bt_ComputeMixRate.Visible = false;

                UploadFile1.CanDelete = false;
                pn_Detail.SetControlsEnable(false);
                bt_Save.Visible = false;
            }
            if (writeoff.State >= 3)
            {
                UploadFile1.CanUpload = false;
            }
        }
    }
コード例 #49
0
    private decimal GetGiftAmountBalance()
    {
        int id = (int)ViewState["ID"];
        FNA_FeeApply apply = new FNA_FeeApplyBLL(id).Model;
        if (apply == null) return 0;

        decimal giftamountbalance = 0;
        IList<ORD_GiftApplyAmount> giftamounts = ORD_GiftApplyAmountBLL.GetModelList(
            string.Format("AccountMonth={0} AND Client={1} AND Brand={2} AND Classify={3}",
            apply.AccountMonth, apply.Client, apply.ProductBrand, (int)ViewState["GiftFeeClassify"]));
        if (giftamounts.Count > 0)
        {
            decimal budget = decimal.Parse(lb_BudgetBalance.Text);
            decimal balance = giftamounts[0].BalanceAmount;

            giftamountbalance = budget > balance ? balance : budget;
        }

        lb_GiftAmountBalance.Visible = true;
        lb_GiftAmountBalance.Text = string.Format("赠品费用可申请额度:{0:0.##}元", giftamountbalance);

        if (pn_FeeApply.FindControl("FNA_FeeApply_Client") != null)
            ((MCSSelectControl)pn_FeeApply.FindControl("FNA_FeeApply_Client")).Enabled = false;
        return giftamountbalance;
    }
コード例 #50
0
    protected void bt_Generate_Click(object sender, EventArgs e)
    {
        decimal giftamountbalance = 0;
        int month = 0, city = 0, feetype = 0, client = 0, productbrand = 0, giftclassify = 0;
        feetype = (int)ViewState["GiftFeeType"];

        int.TryParse(ddl_ApplyMonth.SelectedValue, out month);
        int.TryParse(tr_OrganizeCity.SelectValue, out city);
        int.TryParse(select_Client.SelectValue, out client);
        int.TryParse(ddl_Brand.SelectedValue, out productbrand);
        int.TryParse(rbl_GiftClassify.SelectedValue, out giftclassify);

        #region 判断有效性
        if (city == 0)
        {
            MessageBox.Show(this, "请正确选择管理片区");
            return;
        }

        if (client == 0)
        {
            MessageBox.Show(this, "请正确选择经销商");
            return;
        }

        if (productbrand == 0)
        {
            MessageBox.Show(this, "请正确选择赠品费用归属品牌");
            return;
        }
        giftamountbalance = GetGiftAmountBalance();
        if (giftamountbalance == 0)
        {
            MessageBox.Show(this, "可申请赠品金额为0,不可申请赠品");
            return;
        }

        int AccountTitle = int.Parse(ddl_AccountTitle.SelectedValue);
        if (TreeTableBLL.GetChild("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", AccountTitle).Rows.Count > 0)
        {
            MessageBox.Show(this, "费用科目必须选择最底级会计科目!" + ddl_AccountTitle.SelectedItem.Text);
            return;
        }

        decimal applycost = 0;
        decimal.TryParse(tbx_ApplyCost.Text, out applycost);
        if (applycost == 0)
        {
            MessageBox.Show(this, "申请赠品金额不可为0");
            return;
        }

        if (applycost > giftamountbalance)
        {
            MessageBox.Show(this, "赠品申请金额:" + tbx_ApplyCost.Text + "不能大于可用申请赠品金额:" + lb_GiftAmountBalance.Text);
            return;
        }
        #endregion

        #region 创建费用申请单
        FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL();

        bll.Model.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
        bll.Model.AccountMonth = int.Parse(ddl_ApplyMonth.SelectedValue);
        bll.Model.Client = client;         //费用代垫客户
        bll.Model.State = 1;               //草稿
        bll.Model.ApproveFlag = 2;         //未审核
        bll.Model.InsertStaff = (int)Session["UserID"];
        bll.Model["Title"] = ddl_ApplyMonth.SelectedItem.Text + " 赠品费用申请单" + " " + select_Client.SelectText + " " + Session["UserRealName"].ToString();
        bll.Model.FeeType = feetype;
        bll.Model["GiftFeeClassify"] = giftclassify.ToString();
        bll.Model.ProductBrand = productbrand;

        AC_AccountMonth accountmonth = new AC_AccountMonthBLL(month).Model;
        FNA_FeeApplyDetail detail = new FNA_FeeApplyDetail();
        detail.Client = client;
        detail.AccountTitle = AccountTitle;
        detail.BeginMonth = month;
        detail.EndMonth = month;
        detail.BeginDate = accountmonth.BeginDate;
        detail.EndDate = accountmonth.EndDate;
        detail.ApplyCost = applycost * (100 - decimal.Parse(tbx_DIPercent.Text)) / 100;
        detail.DICost = applycost * decimal.Parse(tbx_DIPercent.Text) / 100;
        detail.SalesForcast = decimal.Parse(tbx_SalesForcast.Text);
        detail.Remark = tbx_Remark.Text;
        detail.RelateBrands = productbrand.ToString();
        detail.LastWriteOffMonth = int.Parse(ddl_LastWriteOffMonth.SelectedValue);
        detail.Flag = 1;  //未报销
        detail["FeeApplyType"] = "1";
        bll.Items.Add(detail);

        bll.Model.SheetCode = FNA_FeeApplyBLL.GenerateSheetCode(bll.Model.OrganizeCity, bll.Model.AccountMonth);
        int id = bll.Add();
        #endregion

        if (id > 0)
            Response.Redirect("FeeApplyDetail3.aspx?ID=" + id.ToString());
        else
            MessageBox.Show(this, "对不起,赠品费用申请单生成失败!错误码:" + id.ToString());
    }
コード例 #51
0
    protected void cb_Selected_CheckedChanged(object sender, EventArgs e)
    {
        //81,80,82 常规导购管理费(月付类)临时导购管理费(工服工卡等费用项)兼职导购工资次次月核销10日核销
        //SuperID IN (176,73)陈列费 月付,季度付 次月10号才能核销

        CheckBox t = (CheckBox)sender;
        GridViewRow drv = (GridViewRow)t.NamingContainer;
        int rowIndex = drv.RowIndex;
        int applydetailid = (int)gv_FeeAplyList.DataKeys[rowIndex]["FNA_FeeApplyDetail_ID"];
        FNA_FeeApplyDetail applydetail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
        CM_ContractDetail contractdetail= new CM_ContractBLL().GetDetailModel(applydetail.RelateContractDetail);
        try
        {
            if (applydetail.AccountTitle == 81 && applydetail.Remark.IndexOf("合同编号")>=0)
            {
                return;
            }
            if (applydetail.AccountTitle >= 80 && applydetail.AccountTitle <= 82)
            {
                t.Checked = CheckLimitWriteOffDate(applydetail.BeginMonth + 2);
            }
            else if (AC_AccountTitleBLL.GetModelList("SuperID IN (176,73)").Where(p => p.ID == applydetail.AccountTitle).ToList().Count > 0
                && contractdetail != null && contractdetail.PayMode != 12 && contractdetail.PayMode != 6 && contractdetail.BearMode==1)
            {
                t.Checked = CheckLimitWriteOffDate(applydetail.BeginMonth + 1);
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
コード例 #52
0
    /// <summary>
    /// 获取最早的付款截止日期
    /// </summary>
    /// <param name="bll"></param>
    /// <returns></returns>
    private DateTime GetMinPayDate(CM_ContractBLL bll)
    {
        DateTime minpaydate = bll.Model.EndDate;
        foreach (CM_ContractDetail item in bll.Items)
        {
            IList<FNA_FeeApplyDetail> feeapplydetails = new FNA_FeeApplyBLL().GetDetail
                ("Client = " + select_Client.SelectValue + " AND RelateContractDetail = " + item.ID.ToString() +
                " AND Flag<>3");
            if (feeapplydetails.Count == 0)
            {
                minpaydate = bll.Model.BeginDate;
                break;
            }
            else
            {
                DateTime _date = feeapplydetails.Max(p => p.EndDate).AddDays(1);
                if (_date < minpaydate) minpaydate = _date;
            }
        }

        return minpaydate;
    }
コード例 #53
0
    private void BindGrid()
    {
        ViewState["ClientID"] = int.Parse(select_Client.SelectValue);

        if (MCSTabControl1.SelectedIndex == 0)
        {
            DataTable dtSummary = FNA_FeeApplyBLL.GetSummaryTotalByDistributor((int)ViewState["ClientID"], int.Parse(ddl_BeginMonth.SelectedValue),
                                                                               int.Parse(ddl_EndMonth.SelectedValue), int.Parse(ddl_FeeType.SelectedValue));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "客户名称" },
                                           new string[] { "FeeTypeName", "AccountTitleName" }, "ApplyCost", true, true);
            dtSummary = MatrixTable.ColumnSummaryTotal(dtSummary, new int[] { 1 }, new string[] { "ApplyCost" });

            gv_List.DataSource = dtSummary;
            gv_List.DataBind();

            MatrixTable.GridViewMatric(gv_List);
        }
        else
        {
            string condition = " FNA_FeeApply.State =3 ";

            #region 组织查询条件
            //管理片区及所有下属管理片区
            CM_Client client = new CM_ClientBLL((int)ViewState["ClientID"]).Model;
            int       city   = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OrganizeCity", client.OrganizeCity, 2);
            if (city != 1)
            {
                Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(city);
                string orgcitys = orgcity.GetAllChildNodeIDs();
                if (orgcitys != "")
                {
                    orgcitys += ",";
                }
                orgcitys += city.ToString();

                condition += " AND FNA_FeeApply.OrganizeCity IN (" + orgcitys + ")";
            }

            //会计月条件
            condition += " AND FNA_FeeApply.AccountMonth BETWEEN " + ddl_BeginMonth.SelectedValue + " AND " + ddl_EndMonth.SelectedValue;

            //费用类型
            if (ddl_FeeType.SelectedValue != "0")
            {
                condition += " AND FNA_FeeApply.FeeType = " + ddl_FeeType.SelectedValue;
            }

            //指定经销商
            condition += " AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE MCS_CM.dbo.uf_GetDistributorIDByClient(FNA_FeeApplyDetail.Client) =" + ViewState["ClientID"].ToString() + ")";
            #endregion

            gv_ListDetail.ConditionString = condition;
            gv_ListDetail.BindGrid();
        }
    }
コード例 #54
0
    protected void bt_Cancel_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);

            #region 发起工作流
            NameValueCollection dataobjects = new NameValueCollection();
            dataobjects.Add("ID", ViewState["ID"].ToString());
            dataobjects.Add("OrganizeCity", bll.Model.OrganizeCity.ToString());
            dataobjects.Add("AccountMonth", bll.Model.AccountMonth.ToString());
            dataobjects.Add("FeeType", bll.Model.FeeType.ToString());

            #region 组合审批任务主题
            string title = "费用取消" + ",申请备案号:" + bll.Model.SheetCode;
            #endregion

            int TaskID = EWF_TaskBLL.NewTask("FNA_FeeApplyFlow_Cancel", (int)Session["UserID"], title, "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString(), dataobjects);
            if (TaskID <= 0)
            {
                MessageBox.Show(this, "对不起,工作流发起失败,请与管理员联系!");
                return;
            }
            new EWF_TaskBLL(TaskID).Start();        //直接启动流程
            #endregion

            MessageBox.ShowAndRedirect(this, "取消费用申请单成功!", "FeeApplyList.aspx");
        }
    }
コード例 #55
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int id = (int)gv_List.DataKeys[e.Row.RowIndex]["ID"];
            int applydetailid = (int)gv_List.DataKeys[e.Row.RowIndex]["ApplyDetailID"];

            ListTable<FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable<FNA_FeeWriteOffDetail>;
            FNA_FeeWriteOffDetail m = _details[id.ToString()];

            string sheetcode = "";

            FNA_FeeApplyDetail applydetail = new FNA_FeeApplyDetail();
            if (applydetailid > 0)
            {
                applydetail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                sheetcode = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid);

            }

            HyperLink hy_ApplySheetCode = (HyperLink)e.Row.FindControl("hy_ApplySheetCode");
            hy_ApplySheetCode.Text = sheetcode;
            hy_ApplySheetCode.NavigateUrl = "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applydetail.ApplyID;

            if (applydetail.Client > 0)
            {
                HyperLink hy_Client = (HyperLink)e.Row.FindControl("hy_Client");
                hy_Client.Text = new CM_ClientBLL(applydetail.Client).Model.FullName;
                hy_Client.NavigateUrl = "~/SubModule/CM/RT/RetailerDetail.aspx?ClientID=" + m.Client;
            }

            DropDownList ddl_BalanceMode = (DropDownList)e.Row.FindControl("ddl_BalanceMode");
            if (ddl_BalanceMode != null)
            {
                ddl_BalanceMode.Enabled = m.WriteOffCost < m.ApplyCost;
                if (m.BalanceMode > 0) ddl_BalanceMode.SelectedValue = m.BalanceMode.ToString();
            }
        }
    }
コード例 #56
0
    /// <summary>
    /// 删除已保存但未提交的申请单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void bt_Delete_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            ListTable<FNA_FeeApplyDetail> _details = ViewState["Details"] as ListTable<FNA_FeeApplyDetail>;
            FNA_FeeApplyBLL bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能删除!");
                return;
            }
            int activityid = 0;
            if (int.TryParse(bll.Model["ActivityID"], out activityid) && activityid > 0)
            {
                //CAT_ActivityBLL cat = new CAT_ActivityBLL(activityid);
                //cat.Model.FeeApply = 0;
            }
            bll.Items = _details.GetListItem(ItemState.Modified);
            bll.DeleteDetail();
            bll.Delete();

            Response.Redirect("~/SubModule/FNA/FeeApply/FeeApplyList.aspx");
        }
    }
コード例 #57
0
    private bool SaveGrid()
    {
        ListTable<FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable<FNA_FeeWriteOffDetail>;

        foreach (GridViewRow row in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[row.RowIndex]["ID"];
            int applydetailid = (int)gv_List.DataKeys[row.RowIndex]["ApplyDetailID"];
            FNA_FeeWriteOffDetail m = _details[id.ToString()];

            #region 保存核销开始日期
            TextBox tbx_BeginDate = (TextBox)row.FindControl("tbx_BeginDate");
            if (tbx_BeginDate != null && tbx_BeginDate.Text != "")
            {
                DateTime begin = new DateTime(1900, 1, 1);

                if (DateTime.TryParse(tbx_BeginDate.Text, out begin))
                {
                    FNA_FeeApplyDetail apply = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                    if (begin >= apply.BeginDate && begin <= apply.EndDate && begin <= m.EndDate)
                    {
                        m.BeginDate = begin;
                        m.BeginMonth = AC_AccountMonthBLL.GetMonthByDate(begin);
                        _details.Update(m);
                    }
                    else
                    {
                        tbx_BeginDate.Text = m.BeginDate.ToString("yyyy-MM-dd");
                        MessageBox.Show(this, "第" + (row.RowIndex + 1).ToString() + "行,报销开始日期必须在该费用申请时指定的日期范围之内!" +
                            apply.BeginDate.ToString("yyyy-MM-dd") + " — " + apply.EndDate.ToString("yyyy-MM-dd"));
                        return false;
                    }
                }
                else
                {
                    tbx_BeginDate.Text = m.BeginDate.ToString("yyyy-MM-dd");
                    MessageBox.Show(this, "开始日期填写格式必需为日期型!");
                    return false;
                }
            }
            #endregion

            #region 保存核销截止日期
            TextBox tbx_EndDate = (TextBox)row.FindControl("tbx_EndDate");
            if (tbx_EndDate != null && tbx_EndDate.Text != "")
            {
                DateTime end = new DateTime(1900, 1, 1);
                if (DateTime.TryParse(tbx_EndDate.Text, out end))
                {
                    FNA_FeeApplyDetail apply = new FNA_FeeApplyBLL().GetDetailModel(applydetailid);
                    if (end >= apply.BeginDate && end <= apply.EndDate && end >= m.BeginDate)
                    {
                        m.EndDate = end;
                        m.EndMonth = AC_AccountMonthBLL.GetMonthByDate(end);
                        _details.Update(m);
                    }
                    else
                    {
                        tbx_EndDate.Text = m.EndDate.ToString("yyyy-MM-dd");
                        MessageBox.Show(this, "第" + (row.RowIndex + 1).ToString() + "行,报销截止日期必须在该费用申请时指定的日期范围之内!" +
                            apply.BeginDate.ToString("yyyy-MM-dd") + " — " + apply.EndDate.ToString("yyyy-MM-dd"));
                        return false;
                    }
                }
                else
                {
                    tbx_EndDate.Text = m.BeginDate.ToString("yyyy-MM-dd");
                    MessageBox.Show(this, "截止日期填写格式必需为日期型!");
                    return false;
                }
            }
            #endregion
            m["DiscountRate"] = "0";
            m["RebateRate"] = "0";
            //m["VATInvoiceNO"] = "";
            m["AcceptanceNO"] = "";
            m["InvoiceDate"] = "";
            m["DeductReason"] = "";
            #region 结余方式
            //if (m.WriteOffCost < m.ApplyCost)
            //{
            //    DropDownList ddl_BalanceMode = (DropDownList)row.FindControl("ddl_BalanceMode");
            //    m.BalanceMode = int.Parse(ddl_BalanceMode.SelectedValue);
            //}
            //else
            m.BalanceMode = 2;//不允许多次核销
            #endregion

            #region  保存备注
            TextBox tbx_Remark = (TextBox)row.FindControl("tbx_Remark");
            m.Remark = tbx_Remark.Text;
            _details.Update(m);
            #endregion
        }

        return true;
    }
コード例 #58
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        #region 判断预算余额是否够申请该项费用
        //if (((Dictionary_Data)ViewState["DicFeeType"]).Description == "BudgetControl" &&
        //    decimal.Parse(lb_BudgetBalance.Text) < decimal.Parse(lb_TotalCost.Text))
        //{
        //    MessageBox.Show(this, "对不起,您当前的预算余额不够申请该项费用!");
        //    return;
        //}
        #endregion

        if (gv_List.Rows.Count == 0)
        {
            MessageBox.Show(this, "对不起, 必须添加相应的费用明细!");
            return;
        }
        ListTable<FNA_FeeApplyDetail> _details = ViewState["Details"] as ListTable<FNA_FeeApplyDetail>;
        FNA_FeeApplyBLL bll;
        if ((int)ViewState["ID"] == 0)
            bll = new FNA_FeeApplyBLL();
        else
        {
            bll = new FNA_FeeApplyBLL((int)ViewState["ID"]);
            if (bll.Model.State != 1)
            {
                MessageBox.Show(this, "对不起,该申请单不为草稿状态,不能修改!");
                return;
            }
        }
        pn_FeeApply.GetData(bll.Model);

        bll.Model["Remark"] = tbx_Remark.Text.Replace("|", "");

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.SheetCode = FNA_FeeApplyBLL.GenerateSheetCode((int)ViewState["OrganizeCity"], (int)ViewState["AccountMonth"]);   //自动产生备案号
            bll.Model.AccountMonth = (int)ViewState["AccountMonth"];
            bll.Model.FeeType = (int)ViewState["FeeType"];
            bll.Model.OrganizeCity = (int)ViewState["OrganizeCity"];
            bll.Model["AccountTitle2"] = ViewState["AccountTitle2"].ToString() == "0" ? "" : ViewState["AccountTitle2"].ToString();
            bll.Model["ActivityID"] = ViewState["ActivityID"].ToString() == "0" ? "" : ViewState["ActivityID"].ToString();
            bll.Model["RelateCar"] = ViewState["RelateCar"].ToString() == "0" ? "" : ViewState["RelateCar"].ToString();
            bll.Model["FromGeneralFlow"] = ViewState["FromGeneralFlow"].ToString();

            bll.Model.ApproveFlag = 1;
            bll.Model.State = 1;
            bll.Model.InsertStaff = (int)Session["UserID"];

            bll.Items = _details.GetListItem();

            #region 费用申请时,一个申请单中只能申请一家店面费用时,将门店设置到Head表中
            try
            {
                if (!ConfigHelper.GetConfigBool("FeeApplyMutiClientsFee") && bll.Items.Count > 0)
                {
                    bll.Model.Client = bll.Items[0].Client;
                }
            }
            catch { }
            #endregion

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

            #region 修改明细
            bll.Items = _details.GetListItem(ItemState.Added);
            bll.AddDetail();

            foreach (FNA_FeeApplyDetail _deleted in _details.GetListItem(ItemState.Deleted))
            {
                bll.DeleteDetail(_deleted.ID);
            }

            bll.Items = _details.GetListItem(ItemState.Modified);
            bll.UpdateDetail();

            #endregion
        }

        if (sender != null)
        {
            MessageBox.ShowAndRedirect(this, "申请保存成功,请尽快点击“提交申请”按钮,否则本次申请未生效!", "FeeApplyDetail3.aspx?ID=" + ViewState["ID"].ToString());
        }
        else
        {
            //明细保存成功后,重置明细里各记录的新增、修改状态,以免重复新增
            ViewState["Details"] = new ListTable<FNA_FeeApplyDetail>(new FNA_FeeApplyBLL((int)ViewState["ID"]).Items, "ID");
        }
    }
コード例 #59
0
    private void BindGrid()
    {
        int       month          = int.Parse(ddl_Month.SelectedValue);
        int       organizecity   = int.Parse(tr_OrganizeCity.SelectValue);
        DataTable dtSummary      = new DataTable();
        int       state          = int.Parse(ddl_State.SelectedValue);
        string    accountname    = ddl_Month.SelectedItem.Text;
        string    preaccountname = DateTime.Parse(accountname + "-01").AddMonths(-3).ToString("yyyy-MM");

        switch (MCSTabControl1.SelectedTabItem.Value)
        {
        case "0":
        {
            dtSummary = FNA_FeeApplyBLL.GetDiaplayFeeSummary(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员", "行政属性" },
                                           new string[] { "RTChannel", "DisplayFeeType", "Title" }, "Summary", true, false);
            MatrixTable.TableAddRowSubTotal_Matric(dtSummary, new string[] { "责任人员" }, 3, new string[] { "RTChannel", "DisplayFeeType", "Title" }, false);

            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计") || dr[2].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("费率%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→2.陈列费总计(元/月)→A.我司承担") &&
                                        dtSummary.Columns.Contains(title + "→3.销量及费率→C." + accountname + "预计销量(元/月)") &&
                                        (decimal)dr[title + "→3.销量及费率→C." + accountname + "预计销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→2.陈列费总计(元/月)→A.我司承担"] / (decimal)dr[title + "→3.销量及费率→C." + accountname + "预计销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                            if (dc.ColumnName.EndsWith("E.费率(较" + preaccountname + ")%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→2.陈列费总计(元/月)→A.我司承担") &&
                                        dtSummary.Columns.Contains(title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)") &&
                                        (decimal)dr[title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→2.陈列费总计(元/月)→A.我司承担"] / (decimal)dr[title + "→3.销量及费率→A." + preaccountname + "实际销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;

        case "1":
        {
            dtSummary = FNA_FeeApplyBLL.GetDiaplayFeeByDisplay(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员" },
                                           new string[] { "DisplayMode", "Title" }, "Summary", true, false);
            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("费率%"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→B.我司费用") &&
                                        dtSummary.Columns.Contains(title + "→D." + accountname + "预计销量(元/月)") &&
                                        (decimal)dr[title + "→D." + accountname + "预计销量(元/月)"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→B.我司费用"] / (decimal)dr[title + "→D." + accountname + "预计销量(元/月)"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;

        case "2":
        {
            dtSummary = FNA_FeeApplyBLL.GetByPayMode(month, organizecity, int.Parse(ddl_Level.SelectedValue), state, int.Parse(Session["UserID"].ToString()));
            if (dtSummary.Rows.Count == 0)
            {
                gv_List.DataBind();
                return;
            }

            dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "管理片区名称", "责任人员" },
                                           new string[] { "付款周期", "Title" }, "Summary", true, false);
            #region 重新计算总计行的费率
            if (dtSummary.Rows.Count > 1)
            {
                foreach (DataRow dr in dtSummary.Rows)
                {
                    if (dr[0].ToString().EndsWith("计"))
                    {
                        foreach (DataColumn dc in dtSummary.Columns)
                        {
                            if (dc.ColumnName.EndsWith("比"))
                            {
                                string title = dc.ColumnName;
                                int    pos   = title.IndexOf('→');
                                if (pos > 0)
                                {
                                    title = title.Substring(0, pos);
                                    if (dtSummary.Columns.Contains(title + "→我司费用") &&
                                        dtSummary.Columns.Contains("总计→我司费用") &&
                                        (decimal)dr["总计→我司费用"] != 0)
                                    {
                                        dr[dc.ColumnName] = Math.Round((decimal)dr[title + "→我司费用"] / (decimal)dr["总计→我司费用"] * 100, 1, MidpointRounding.AwayFromZero);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
        break;
        }


        gv_List.DataSource = dtSummary;
        gv_List.DataBind();

        if (dtSummary.Columns.Count >= 24)
        {
            gv_List.Width = new Unit(dtSummary.Columns.Count * 65);
        }
        else
        {
            gv_List.Width = new Unit(100, UnitType.Percentage);
        }

        MatrixTable.GridViewMatric(gv_List);

        MatrixTable.GridViewMergSampeValueRow(gv_List, 0);

        MatrixTable.GridViewMergSampeValueRow(gv_List, 1);

        #region 是否可以批量审批
        if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1509, "BatApproveFee"))
        {
            bt_Approve.Visible   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Visible = (ddl_State.SelectedValue == "1");
            bt_Approve.Enabled   = (ddl_State.SelectedValue == "1");
            bt_UnApprove.Enabled = (ddl_State.SelectedValue == "1");
            #region 判断费用申请进度
            if (ddl_State.SelectedValue == "1")
            {
                Org_StaffBLL _staff = new Org_StaffBLL((int)Session["UserID"]);
                DataTable    dt     = _staff.GetLowerPositionTask(1, organizecity, month);

                if (dt.Rows.Count > 0)
                {
                    bt_Approve.Enabled = false;
                    //bt_UnApprove.Enabled = false;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/Pop_ShowLowerPositionTask.aspx") +
                                                            "?Type=1&StaffID=0&Month=" + ddl_Month.SelectedValue + "&City=" + tr_OrganizeCity.SelectValue + "&tempid='+tempid, window, 'dialogWidth:520px;DialogHeight=600px;status:yes;resizable=no');</script>", false);
                }
            }
            #endregion
        }
        else
        {
            bt_Approve.Visible   = false;
            bt_UnApprove.Visible = false;
        }
        #endregion
    }
コード例 #60
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex >= 0 && gv_List.Rows.Count >= e.Row.RowIndex && gv_List.Columns.Count >= 1)
        {
            int id = (int)gv_List.DataKeys[e.Row.RowIndex][0];
            CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
            int month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddMonths(-1));
            IList<FNA_FeeApplyDetail> _list = new FNA_FeeApplyBLL().GetDetail("Client=" + bll.Model.Client.ToString()
                + " AND AccountTitle=82 AND BeginMonth=" + month.ToString()
                + "AND EXISTS(SELECT 1 FROM MCS_FNA.dbo.FNA_FeeApply WHERE FNA_FeeApply.ID=FNA_FeeApplyDetail.ApplyID AND State IN (1,2,3))");
            if (e.Row.RowType == DataControlRowType.DataRow && _list.Count > 0 || bll.Model.ISMYD == 2)
            {
                e.Row.Cells[0].Enabled = false; e.Row.Cells[gv_List.Columns.Count-1].Enabled = false;

                if (e.Row.FindControl("tbx_RTCount") != null)
                {
                    (e.Row.FindControl("tbx_RTCount") as TextBox).Enabled = false;
                }
            }
        }
    }