示例#1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_payment_list0", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            manager = GetAdminInfo();
            string        result = "";
            int           success = 0, error = 0;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    result = bll.Delete(Convert.ToInt32(id), manager);
                    if (result == "")
                    {
                        success++;
                    }
                    else
                    {
                        error++;
                        sb.Append(result + "<br/>");
                    }
                }
            }
            JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), backUrl(), "");
        }
示例#2
0
        private void ShowInfo(int _id)
        {
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            DataSet        ds  = bll.GetList(0, "rp_id=" + _id + "", "");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                txtCusName.Text = dr["c_name"].ToString();
                hCusId.Value    = dr["rp_cid"].ToString();
                txtMoney.Text   = dr["rp_money"].ToString();
                if (Utils.StrToFloat(dr["rp_money"].ToString(), 0) < 0)
                {
                    isFushu = true;
                }
                if (dr["rp_foredate"] != null)
                {
                    txtforedate.Text = Convert.ToDateTime(dr["rp_foredate"]).ToString("yyyy-MM-dd");
                }
                txtBank.Text  = Utils.ObjectToStr(dr["cb_bank"]) + "(" + Utils.ObjectToStr(dr["cb_bankName"]) + "/" + Utils.ObjectToStr(dr["cb_bankNum"]) + ")";
                hBankId.Value = Utils.ObjectToStr(dr["rp_cbid"]);

                ddlmethod.SelectedValue = dr["rp_method"].ToString();
                txtContent.Text         = dr["rp_content"].ToString();
                if (dr["pm_type"].ToString() == "True")
                {
                    isChongzhang = true;
                    //dlceDate.Visible = true;
                    //dlceNum.Visible = true;
                    txtCenum.Text  = dr["ce_num"].ToString();
                    txtCedate.Text = Utils.ObjectToDateTime(dr["ce_date"]).ToString("yyyy-MM-dd");
                }
            }
        }
示例#3
0
        /// <summary>
        /// 删除凭证
        /// </summary>
        /// <param name="id"></param>
        /// <param name="username"></param>
        /// <param name="realname"></param>
        /// <returns></returns>
        public string deleteCertificate(int id, string username, string realname)
        {
            Model.certificates model = GetModel(id);
            if (model == null)
            {
                return("凭证不存在");
            }
            if (model.ce_flag == 2)
            {
                return("审批通过的不能删除");
            }

            //判断是否被使用
            DataSet ds = new BLL.ReceiptPay().GetList(0, "rp_ceid=" + id, "");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return("该凭证已被使用,不能删除");
            }
            if (dal.Delete(id))
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_relateID    = id;
                logmodel.ol_title       = "删除凭证";
                logmodel.ol_content     = "凭证号:" + model.ce_num + "<br/>凭证日期:" + model.ce_date.Value.ToString("yyyy-MM-dd") + "";
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, username, realname);
                return("");
            }
            return("删除失败");
        }
        private void RptBind(string _strWhere, string _orderby)
        {
            manager = GetAdminInfo();
            DataTable dt = new BLL.ReceiptPay().GetList(0, "rp_id=" + rpid, "rp_id").Tables[0];

            if (dt == null || dt.Rows.Count == 0)
            {
                JscriptMsg("数据不存在!", "back");
                return;
            }
            dr = dt.Rows[0];
            BLL.ReceiptPayDetail bll = new BLL.ReceiptPayDetail();
            detailDT = bll.GetPayCertificationList(_strWhere).Tables[0];

            //if (dt!=null)
            //{
            //    labCusName.Text = dt.Rows[0]["c_name"].ToString();
            //    labPayStatus.Text = Utils.StrToBool(Utils.ObjectToStr(dt.Rows[0]["rp_isConfirm"]), false) ? "已付款" : "未付款";
            //    labPayDate.Text = Utils.StrToBool(Utils.ObjectToStr(dt.Rows[0]["rp_isConfirm"]), false) ? ConvertHelper.toDate(dt.Rows[0]["rp_date"]).Value.ToString("yyyy-MM-dd") : "无";
            //    labPayMethod.Text = Utils.StrToBool(Utils.ObjectToStr(dt.Rows[0]["rp_isConfirm"]), false) ? dt.Rows[0]["pm_name"].ToString() : "无";
            //    labText.Text = dt.Rows[0]["rp_money"].ToString();
            //    if (unMoney > 0)
            //    {
            //        labText.Text += ",其中未分配金额为:" + unMoney;
            //    }
            //}
        }
示例#5
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            manager = GetAdminInfo();
            string        result = "";
            int           success = 0, error = 0;
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    result = bll.Delete(Convert.ToInt32(id), manager);
                    if (result == "")
                    {
                        success++;
                    }
                    else
                    {
                        error++;
                        sb.Append(result + "<br/>");
                    }
                }
            }
            JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), Utils.CombUrlTxt("selfReceipt_list.aspx", "page={0}&ddlmethod={1}&ddlisConfirm={2}&txtsforedate={3}&txteforedate={4}&txtsdate={5}&txtedate={6}&txtNum={7}&txtCusName={8}&hCusId={9}&txtChk={10}&txtNumDate={11}", "__id__", _method, _isconfirm, _sforedate, _eforedate, _sdate, _edate, _num, _cusName, _cid, _chk, _numdate), "");
        }
示例#6
0
        private void RptBind()
        {
            if (!this.isSearch)
            {
                this.page = DTRequest.GetQueryInt("page", 1);
            }
            else
            {
                this.page = 1;
            }
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            Dictionary <string, string> dict = getDict();

            this.rptList.DataSource = bll.GetDistributionList(dict, pageSize, page, out totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("rpDistribution.aspx", "page={0}&id={1}&tag={2}&txtOrderId={3}&ddlMoneyType={4}&ddlsign={5}&txtMoney={6}&txtChk={7}&txtsDate={8}&txteDate={9}&txtsDate1={10}&txteDate1={11}&txtPerson={12}", "__id__", rpID.ToString(), _tag.ToString(), _orderId, _moneyType, _sign, _money, _chk, _sdate, _edate, _sdate1, _edate1, _person);

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);

            decimal _hasDistribute = bll.getDistributeMoney(rpID);

            labHasDistribute.Text = _hasDistribute.ToString();
            labLeftMoney.Text     = (model.rp_money - _hasDistribute).ToString();
        }
示例#7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            if (!this.isSearch)
            {
                this.page = DTRequest.GetQueryInt("page", 1);
            }
            else
            {
                this.page = 1;
            }
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            DataTable      dt  = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount, out _tmoney, out _tunmoney).Tables[0];

            this.rptList.DataSource = dt;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = backUrl();

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);

            pCount.Text = dt.Rows.Count.ToString();
            decimal _pmoney = 0, _punmoney = 0;

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    _pmoney   += Utils.ObjToDecimal(dr["rp_money"], 0);
                    _punmoney += Utils.ObjToDecimal(dr["undistribute"], 0);
                }
            }
            pMoney.Text   = _pmoney.ToString();
            pUnMoney.Text = _punmoney.ToString();
            tCount.Text   = totalCount.ToString();
            tMoney.Text   = _tmoney.ToString();
            tUnMoney.Text = _tunmoney.ToString();

            txtCusName.Text            = _cusName;
            hCusId.Value               = _cid;
            ddlmethod.SelectedValue    = _method;
            ddlcheck.SelectedValue     = _check;
            ddlcheck2.SelectedValue    = _check2;
            ddlisConfirm.SelectedValue = _isconfirm;
            txtsforedate.Text          = _sforedate;
            txteforedate.Text          = _eforedate;
            txtsdate.Text              = _sdate;
            txtedate.Text              = _edate;
            txtNum.Text                = _num;
            txtChk.Text                = _chk;
            txtNumDate.Text            = _numdate;
            ddlsign.SelectedValue      = _sign;
            txtMoney.Text              = _money;
            ddlmoneyType.SelectedValue = _moneyType;

            ddlchecktype.SelectedValue = _flag;
            txtAddPerson.Text          = _addperson;
        }
示例#8
0
        private string DoAdd(out int rpid)
        {
            rpid = 0;
            Model.ReceiptPay model = new Model.ReceiptPay();
            BLL.ReceiptPay   bll   = new BLL.ReceiptPay();

            manager           = GetAdminInfo();
            model.rp_type     = true;
            model.rp_cid      = Utils.StrToInt(hCusId.Value, 0);
            model.rp_money    = Utils.StrToDecimal(txtMoney.Text.Trim(), 0);
            model.rp_foredate = ConvertHelper.toDate(txtforedate.Text.Trim());
            model.rp_method   = Utils.StrToInt(ddlmethod.SelectedValue, 0);
            model.rp_content  = txtContent.Text.Trim();
            model.rp_cbid     = 0;
            if (model.rp_money < 0)
            {
                model.rp_cbid = Utils.StrToInt(hBankId.Value, 0);
            }
            //在客户对账明细的账单打包时不是预收款
            bool flag = true;

            if (!string.IsNullOrEmpty(oidStr))
            {
                flag = false;
            }
            string result = bll.Add(model, manager, txtCenum.Text.Trim(), txtCedate.Text.Trim(), out rpid, flag);

            if (string.IsNullOrEmpty(result))
            {
                if (!string.IsNullOrEmpty(oidStr) && model.rp_money == Utils.StrToDecimal(_tMoney, 0))
                {
                    JArray ja = JArray.Parse(oidStr);
                    foreach (JObject item in ja)
                    {
                        Model.ReceiptPayDetail rpdModel = new Model.ReceiptPayDetail();
                        rpdModel.rpd_type       = true;
                        rpdModel.rpd_rpid       = rpid;
                        rpdModel.rpd_oid        = item["oid"].ToString();
                        rpdModel.rpd_cid        = Utils.StrToInt(_cid, 0);
                        rpdModel.rpd_num        = _chk;
                        rpdModel.rpd_money      = Utils.StrToDecimal(item["money"].ToString(), 0);
                        rpdModel.rpd_foredate   = model.rp_foredate;
                        rpdModel.rpd_method     = model.rp_method;
                        rpdModel.rpd_personName = manager.real_name;
                        rpdModel.rpd_personNum  = manager.user_name;
                        rpdModel.rpd_flag1      = 2;
                        rpdModel.rpd_flag2      = 2;
                        rpdModel.rpd_flag3      = 2;
                        rpdModel.rpd_adddate    = DateTime.Now;
                        rpdModel.rpd_content    = "";
                        rpdModel.rpd_cbid       = model.rp_cbid;
                        new BLL.ReceiptPayDetail().AddOrCancleDistribution(rpdModel, manager);
                    }
                }
            }
            return(result);
        }
示例#9
0
        private void ShowInfo(int _id)
        {
            btnAudit.Visible = false;
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            DataSet        ds  = bll.GetList(0, "rp_id=" + _id + "", "");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                txtCusName.Text = dr["c_name"].ToString();
                hCusId.Value    = dr["rp_cid"].ToString();

                txtBank.Text  = Utils.ObjectToStr(dr["cb_bank"]) + "(" + Utils.ObjectToStr(dr["cb_bankName"]) + "/" + Utils.ObjectToStr(dr["cb_bankNum"]) + ")";
                hBankId.Value = Utils.ObjectToStr(dr["rp_cbid"]);

                txtMoney.Text = dr["rp_money"].ToString();
                if (dr["rp_foredate"] != null)
                {
                    txtforedate.Text = Convert.ToDateTime(dr["rp_foredate"]).ToString("yyyy-MM-dd");
                }
                ddlmethod.SelectedValue = dr["rp_method"].ToString();
                txtContent.Text         = dr["rp_content"].ToString();
                if (Utils.ObjToInt(dr["rp_method"], 0) > 0 && new BLL.payMethod().GetModel(Utils.ObjToInt(dr["rp_method"], 0)).pm_type.Value)
                {
                    isChongzhang = true;
                    //dlceDate.Visible = true;
                    //dlceNum.Visible = true;
                    //dlBank.Visible = false;

                    txtCenum.Text  = Utils.ObjectToStr(dr["ce_num"]);
                    txtCedate.Text = ConvertHelper.toDate(dr["ce_date"]).Value.ToString("yyyy-MM-dd");
                }

                if (new MettingSys.BLL.permission().checkHasPermission(manager, "0402,0601"))
                {
                    btnAudit.Visible       = true;
                    ddlflag.DataSource     = Common.BusinessDict.checkStatus();
                    ddlflag.DataTextField  = "value";
                    ddlflag.DataValueField = "key";
                    ddlflag.DataBind();
                    ddlflag.Items.Insert(0, new ListItem("请选择", ""));

                    if (new BLL.permission().checkHasPermission(manager, "0402"))//财务审批
                    {
                        ddlchecktype.SelectedValue = "1";
                        ddlflag.SelectedValue      = dr["rp_flag"].ToString();
                        txtCheckRemark.Text        = dr["rp_checkRemark"].ToString();
                    }
                    else if (new BLL.permission().checkHasPermission(manager, "0601"))//总经理审批
                    {
                        ddlchecktype.SelectedValue = "2";
                        ddlflag.SelectedValue      = dr["rp_flag1"].ToString();
                        txtCheckRemark.Text        = dr["rp_checkRemark1"].ToString();
                    }
                }
            }
        }
示例#10
0
        private void RptBind(string _strWhere, string _orderby)
        {
            if (!this.isSearch)
            {
                this.page = DTRequest.GetQueryInt("page", 1);
            }
            else
            {
                this.page = 1;
            }
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            DataTable      dt  = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount, out _tmoney, out _tunmoney).Tables[0];

            this.rptList.DataSource = dt;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("selfReceipt_list.aspx", "page={0}&ddlmethod={1}&ddlisConfirm={2}&txtsforedate={3}&txteforedate={4}&txtsdate={5}&txtedate={6}&txtNum={7}&txtCusName={8}&hCusId={9}&txtChk={10}&txtNumDate={11}", "__id__", _method, _isconfirm, _sforedate, _eforedate, _sdate, _edate, _num, _cusName, _cid, _chk, _numdate);

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);

            pCount.Text = dt.Rows.Count.ToString();
            decimal _pmoney = 0, _punmoney = 0;

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    _pmoney   += Utils.ObjToDecimal(dr["rp_money"], 0);
                    _punmoney += Utils.ObjToDecimal(dr["undistribute"], 0);
                }
            }
            pMoney.Text   = _pmoney.ToString();
            pUnMoney.Text = _punmoney.ToString();
            tCount.Text   = totalCount.ToString();
            tMoney.Text   = _tmoney.ToString();
            tUnMoney.Text = _tunmoney.ToString();

            txtCusName.Text            = _cusName;
            hCusId.Value               = _cid;
            ddlmethod.SelectedValue    = _method;
            ddlisConfirm.SelectedValue = _isconfirm;
            txtsforedate.Text          = _sforedate;
            txteforedate.Text          = _eforedate;
            txtsdate.Text              = _sdate;
            txtedate.Text              = _edate;
            txtNum.Text     = _num;
            txtChk.Text     = _chk;
            txtNumDate.Text = _numdate;
        }
示例#11
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public string Delete(int id, Model.manager manager)
        {
            Model.ReceiptPay model = new BLL.ReceiptPay().GetModel(id);
            if (model == null)
            {
                return("数据不存在");
            }
            if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务
            {
                return("无权限删除");
            }
            else
            {
                if (model.rp_personNum != manager.user_name && !new BLL.permission().checkHasPermission(manager, "0403"))
                {
                    return("无权限删除");
                }
            }
            string typeText = "收款";
            bool   flag     = false;

            if (model.rp_type.Value)
            {
                if (model.rp_isConfirm.Value)
                {
                    return("已经确认收款,不能删除");
                }
                flag = dal.deleteReceipt(id);
            }
            else
            {
                typeText = "付款";
                if (model.rp_isExpect.Value && model.rp_flag1 == 2 && model.rp_money >= 0 && (model.rp_method == 0 || !new BLL.payMethod().GetModel(model.rp_method.Value).pm_type.Value))
                {
                    return("最终审批通过不能删除");
                }
                flag = dal.deletePay(model);
            }
            if (flag)
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_relateID    = id;
                logmodel.ol_title       = "删除收款";
                logmodel.ol_content     = typeText + "ID:" + id + ",金额:" + model.rp_money;
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name);
                return("");
            }
            return("删除失败");
        }
示例#12
0
        private string DoEdit(int _id)
        {
            BLL.ReceiptPay   bll   = new BLL.ReceiptPay();
            Model.ReceiptPay model = bll.GetModel(_id);
            manager = GetAdminInfo();
            string _content = string.Empty;

            if (model.rp_cid.ToString() != hCusId.Value)
            {
                _content += "收款对象ID:" + model.rp_cid + "→<font color='red'>" + hCusId.Value + "</font><br/>";
            }
            model.rp_cid = Utils.StrToInt(hCusId.Value, 0);
            if (model.rp_money.ToString() != txtMoney.Text.Trim())
            {
                _content += "收款金额:" + model.rp_money + "→<font color='red'>" + txtMoney.Text.Trim() + "</font><br/>";
            }
            model.rp_money = Utils.StrToDecimal(txtMoney.Text.Trim(), 0);
            if (model.rp_foredate.Value.ToString("yyyy-MM-dd") != txtforedate.Text.Trim())
            {
                _content += "预收日期:" + model.rp_foredate.Value.ToString("yyyy-MM-dd") + "→<font color='red'>" + txtforedate.Text.Trim() + "</font><br/>";
            }
            model.rp_foredate = ConvertHelper.toDate(txtforedate.Text.Trim());
            if (model.rp_method.ToString() != ddlmethod.SelectedValue)
            {
                _content += "收款方式ID:" + model.rp_method.ToString() + "→<font color='red'>" + ddlmethod.SelectedValue + "</font><br/>";
            }
            model.rp_method = Utils.StrToInt(ddlmethod.SelectedValue, 0);
            if (model.rp_content != txtContent.Text.Trim())
            {
                _content += "收款内容:" + model.rp_content + "→<font color='red'>" + txtContent.Text.Trim() + "</font><br/>";
            }
            model.rp_content = txtContent.Text.Trim();
            if (model.rp_cbid != Utils.StrToInt(hBankId.Value, 0))
            {
                _content += "客户银行账号:" + model.rp_cbid + "→<font color='red'>" + hBankId.Value + "</font><br/>";
            }
            model.rp_cbid = Utils.StrToInt(hBankId.Value, 0);
            return(bll.Update(model, _content, manager, txtCenum.Text.Trim(), txtCedate.Text.Trim()));
        }
示例#13
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _cusName   = DTRequest.GetString("txtCusName");
            _cid       = DTRequest.GetString("hCusId");
            _method    = DTRequest.GetFormString("ddlmethod");
            _check     = DTRequest.GetFormString("ddlcheck");
            _check2    = DTRequest.GetFormString("ddlcheck2");
            _isconfirm = DTRequest.GetFormString("ddlisConfirm");
            _sforedate = DTRequest.GetFormString("txtsforedate");
            _eforedate = DTRequest.GetFormString("txteforedate");
            _sdate     = DTRequest.GetFormString("txtsdate");
            _edate     = DTRequest.GetFormString("txtedate");
            _num       = DTRequest.GetFormString("txtNum");
            _chk       = DTRequest.GetFormString("txtChk");
            _numdate   = DTRequest.GetFormString("txtNumDate");
            _sign      = DTRequest.GetFormString("ddlsign");
            _money     = DTRequest.GetFormString("txtMoney");
            _moneyType = DTRequest.GetFormString("ddlmoneyType");
            _type      = DTRequest.GetFormString("ddlType");
            _addperson = DTRequest.GetFormString("txtAddPerson");
            BLL.ReceiptPay bll = new BLL.ReceiptPay();
            DataTable      dt  = bll.GetList(this.pageSize, this.page, "rp_type=0 " + CombSqlTxt(), "isnull(rp_date,'3000-01-01') desc,isnull(pm_sort,-1) asc,rp_id desc", out this.totalCount, out _tmoney, out _tunmoney, false).Tables[0];

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=付款通知列表.xlsx"); //HttpUtility.UrlEncode(fileName));
            HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";

            HSSFWorkbook hssfworkbook = new HSSFWorkbook();
            ISheet       sheet        = hssfworkbook.CreateSheet("明细");
            IFont        font         = hssfworkbook.CreateFont();

            font.Boldweight         = short.MaxValue;
            font.FontHeightInPoints = 11;

            #region 表格样式
            //设置单元格的样式:水平垂直对齐居中
            ICellStyle cellStyle = hssfworkbook.CreateCellStyle();
            cellStyle.Alignment         = HorizontalAlignment.Center;
            cellStyle.VerticalAlignment = VerticalAlignment.Center;
            cellStyle.BorderBottom      = BorderStyle.Thin;
            cellStyle.BorderLeft        = BorderStyle.Thin;
            cellStyle.BorderRight       = BorderStyle.Thin;
            cellStyle.BorderTop         = BorderStyle.Thin;
            cellStyle.BottomBorderColor = HSSFColor.Black.Index;
            cellStyle.LeftBorderColor   = HSSFColor.Black.Index;
            cellStyle.RightBorderColor  = HSSFColor.Black.Index;
            cellStyle.TopBorderColor    = HSSFColor.Black.Index;
            cellStyle.WrapText          = true;//自动换行

            //设置表头的样式:水平垂直对齐居中,加粗
            ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle();
            titleCellStyle.Alignment           = HorizontalAlignment.Center;
            titleCellStyle.VerticalAlignment   = VerticalAlignment.Center;
            titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色
            titleCellStyle.FillPattern         = FillPattern.SparseDots;        //图案样式
            titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色
            //设置边框
            titleCellStyle.BorderBottom      = BorderStyle.Thin;
            titleCellStyle.BorderLeft        = BorderStyle.Thin;
            titleCellStyle.BorderRight       = BorderStyle.Thin;
            titleCellStyle.BorderTop         = BorderStyle.Thin;
            titleCellStyle.BottomBorderColor = HSSFColor.Black.Index;
            titleCellStyle.LeftBorderColor   = HSSFColor.Black.Index;
            titleCellStyle.RightBorderColor  = HSSFColor.Black.Index;
            titleCellStyle.TopBorderColor    = HSSFColor.Black.Index;
            //设置字体
            titleCellStyle.SetFont(font);
            #endregion
            //表头
            IRow headRow = sheet.CreateRow(0);
            headRow.HeightInPoints = 25;

            headRow.CreateCell(0).SetCellValue("付款对象");
            headRow.CreateCell(1).SetCellValue("凭证");
            headRow.CreateCell(2).SetCellValue("付款内容");
            headRow.CreateCell(3).SetCellValue("客户银行账号");
            headRow.CreateCell(4).SetCellValue("付款金额");
            headRow.CreateCell(5).SetCellValue("未分配金额");
            headRow.CreateCell(6).SetCellValue("预付日期");
            headRow.CreateCell(7).SetCellValue("付款方式");
            headRow.CreateCell(8).SetCellValue("实付日期");
            headRow.CreateCell(9).SetCellValue("申请人");
            headRow.CreateCell(10).SetCellValue("财务审批");
            headRow.CreateCell(11).SetCellValue("总经理审批");
            headRow.CreateCell(12).SetCellValue("确认收款");

            headRow.GetCell(0).CellStyle  = titleCellStyle;
            headRow.GetCell(1).CellStyle  = titleCellStyle;
            headRow.GetCell(2).CellStyle  = titleCellStyle;
            headRow.GetCell(3).CellStyle  = titleCellStyle;
            headRow.GetCell(4).CellStyle  = titleCellStyle;
            headRow.GetCell(5).CellStyle  = titleCellStyle;
            headRow.GetCell(6).CellStyle  = titleCellStyle;
            headRow.GetCell(7).CellStyle  = titleCellStyle;
            headRow.GetCell(8).CellStyle  = titleCellStyle;
            headRow.GetCell(9).CellStyle  = titleCellStyle;
            headRow.GetCell(10).CellStyle = titleCellStyle;
            headRow.GetCell(11).CellStyle = titleCellStyle;
            headRow.GetCell(12).CellStyle = titleCellStyle;

            sheet.SetColumnWidth(0, 15 * 256);
            sheet.SetColumnWidth(1, 20 * 256);
            sheet.SetColumnWidth(2, 20 * 256);
            sheet.SetColumnWidth(3, 20 * 256);
            sheet.SetColumnWidth(4, 20 * 256);
            sheet.SetColumnWidth(5, 15 * 256);
            sheet.SetColumnWidth(6, 20 * 256);
            sheet.SetColumnWidth(7, 20 * 256);
            sheet.SetColumnWidth(8, 20 * 256);
            sheet.SetColumnWidth(9, 20 * 256);
            sheet.SetColumnWidth(10, 20 * 256);
            sheet.SetColumnWidth(11, 20 * 256);
            sheet.SetColumnWidth(12, 20 * 256);

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    IRow row = sheet.CreateRow(i + 1);
                    row.HeightInPoints = 22;
                    row.CreateCell(0).SetCellValue(dt.Rows[i]["c_name"].ToString() + (Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isExpect"]), false) ? "[预]" : ""));
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["ce_num"]));
                    row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_content"]));
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bankName"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bankNum"]) + "\r\n" + Utils.ObjectToStr(dt.Rows[i]["cb_bank"]));
                    row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_money"]));
                    row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["undistribute"]));
                    row.CreateCell(6).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_foredate"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"]));
                    row.CreateCell(8).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_date"]) == null ? "" : ConvertHelper.toDate(dt.Rows[i]["rp_date"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(9).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_personName"]));
                    row.CreateCell(10).SetCellValue(dt.Rows[i]["rp_flag"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(11).SetCellValue(dt.Rows[i]["rp_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["rp_flag1"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(12).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["rp_isConfirm"]), false) ? "已收款" : "待收款");

                    row.GetCell(0).CellStyle  = cellStyle;
                    row.GetCell(1).CellStyle  = cellStyle;
                    row.GetCell(2).CellStyle  = cellStyle;
                    row.GetCell(3).CellStyle  = cellStyle;
                    row.GetCell(4).CellStyle  = cellStyle;
                    row.GetCell(5).CellStyle  = cellStyle;
                    row.GetCell(6).CellStyle  = cellStyle;
                    row.GetCell(7).CellStyle  = cellStyle;
                    row.GetCell(8).CellStyle  = cellStyle;
                    row.GetCell(9).CellStyle  = cellStyle;
                    row.GetCell(10).CellStyle = cellStyle;
                    row.GetCell(11).CellStyle = cellStyle;
                    row.GetCell(12).CellStyle = cellStyle;
                }
            }

            MemoryStream file = new MemoryStream();
            hssfworkbook.Write(file);

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
示例#14
0
        /// <summary>
        /// 删除收付款明细
        /// </summary>
        public string Delete(int id, Model.manager manager)
        {
            Model.ReceiptPayDetail model = GetModel(id);
            if (model == null)
            {
                return("数据不存在");
            }
            Model.Order order = new BLL.Order().GetModel(model.rpd_oid);
            if (order == null)
            {
                return("订单不存在");
            }
            if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务
            {
                //验证权限:在同一个订单里,业务员与业务报账员可以对未审核地接进行编辑与删除!执行人员只能对自己地址进行编辑与删除操作!
                if (model.rpd_personNum != manager.user_name && order.personlist.Where(p => p.op_number == manager.user_name && (p.op_type == 3 || p.op_type == 4)).ToArray().Length > 0)
                {
                    return("无权限删除");
                }
            }
            else
            {
                if (model.rpd_personNum != manager.user_name && !new BLL.permission().checkHasPermission(manager, "0403"))
                {
                    return("非申请人或没有删除他人数据权限不能删除");
                }
            }
            bool flag = false;

            if (model.rpd_type.Value)
            {
                if (model.rpd_rpid > 0)
                {
                    Model.ReceiptPay rp = new BLL.ReceiptPay().GetModel(model.rpd_rpid.Value);
                    if (rp.rp_isConfirm.Value)
                    {
                        return("已确认收款,不能再删除");
                    }
                }
                flag = dal.DeleteReceiptDetail(model);
            }
            else
            {
                if (model.rpd_flag3 == 2 && model.rpd_money >= 0)
                {
                    return("最终审批通过不能再编辑");
                }
                flag = dal.Delete(id);
                if (flag)
                {
                    //删除图片附件
                    new BLL.payPic().deleteFileByid(id, 1);
                }
            }

            string typeText = "收款";

            if (!model.rpd_type.Value)
            {
                typeText = "付款";
            }
            if (flag)
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_oid         = model.rpd_oid;
                logmodel.ol_relateID    = model.rpd_id.Value;
                logmodel.ol_cid         = model.rpd_cid.Value;
                logmodel.ol_title       = "删除" + typeText + "明细";
                logmodel.ol_content     = "记录ID:" + id + ",金额:" + model.rpd_money + "";
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志
                return("");
            }
            return("删除失败");
        }
示例#15
0
        /// <summary>
        /// 编辑收付款明细
        /// </summary>
        /// <param name="model"></param>
        /// <param name="content"></param>
        /// <param name="manager"></param>
        /// <param name="updateMoney">是否修改了收款明细的金额</param>
        /// <returns></returns>
        public string Update(Model.ReceiptPayDetail model, string content, Model.manager manager, bool updateMoney = false, bool updateMethod = false)
        {
            if (model == null)
            {
                return("数据不存在");
            }
            Model.Order order = new BLL.Order().GetModel(model.rpd_oid);
            if (order == null)
            {
                return("订单不存在");
            }
            if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务
            {
                //验证权限:在同一个订单里,业务员与业务报账员可以对未审核地接进行编辑与删除!执行人员只能对自己地址进行编辑与删除操作!
                if (model.rpd_personNum != manager.user_name && order.personlist.Where(p => p.op_number == manager.user_name && (p.op_type == 3 || p.op_type == 4)).ToArray().Length > 0)
                {
                    return("无权限编辑");
                }
            }
            else
            {
                if (model.rpd_personNum != manager.user_name && !new BLL.permission().checkHasPermission(manager, "0403"))
                {
                    return("无权限编辑");
                }
            }
            string typeText = "收款";

            if (!model.rpd_type.Value)
            {
                typeText = "付款";
            }

            if (model.rpd_cid == 0)
            {
                return("请选择" + typeText + "对象");
            }
            if (model.rpd_money == 0)
            {
                return("请填写" + typeText + "金额");
            }
            if (model.rpd_foredate == null)
            {
                return("请选择" + (model.rpd_type.Value ? "预收" : "预付") + "日期");
            }
            bool flag = false;

            if (model.rpd_type.Value)
            {
                if (model.rpd_method == 0)
                {
                    return("请选择收款方式");
                }
                if (model.rpd_rpid > 0)
                {
                    Model.ReceiptPay rp = new BLL.ReceiptPay().GetModel(model.rpd_rpid.Value);
                    if (rp.rp_isConfirm.Value)
                    {
                        return("已确认收款,不能再编辑");
                    }
                }
                flag = UpdateReceiptDetail(model, updateMoney);
            }
            else
            {
                if (updateMethod)
                {
                    if (model.rpd_rpid > 0)
                    {
                        return("已经汇总的不能修改付款方式");
                    }
                }
                else if (updateMoney)
                {
                    if (model.rpd_money >= 0)
                    {
                        model.rpd_flag1        = 0;
                        model.rpd_checkNum1    = "";
                        model.rpd_checkName1   = "";
                        model.rpd_checkRemark1 = "";
                        model.rpd_checkTime1   = null;
                        model.rpd_flag2        = 0;
                        model.rpd_checkNum2    = "";
                        model.rpd_checkName2   = "";
                        model.rpd_checkRemark2 = "";
                        model.rpd_checkTime2   = null;
                        model.rpd_flag3        = 0;
                        model.rpd_checkNum3    = "";
                        model.rpd_checkName3   = "";
                        model.rpd_checkRemark3 = "";
                        model.rpd_checkTime3   = null;
                    }
                    else
                    {
                        model.rpd_flag1      = 2;
                        model.rpd_checkTime1 = DateTime.Now;
                        model.rpd_flag2      = 2;
                        model.rpd_checkTime2 = DateTime.Now;
                        model.rpd_flag3      = 2;
                        model.rpd_checkTime3 = DateTime.Now;
                    }
                }
                else if (model.rpd_money >= 0 && model.rpd_flag1 == 2 && model.rpd_flag2 != 1 && model.rpd_flag3 != 1)
                {
                    return("部门审批已通过,不能再编辑");
                }
                //编辑后清空审批内容,如果只是修改付款方式则不需要情况 2020-05-30
                if ((model.rpd_flag1 == 1 || model.rpd_flag2 == 1 || model.rpd_flag3 == 1) && !updateMethod)
                {
                    model.rpd_flag1        = 0;
                    model.rpd_checkNum1    = "";
                    model.rpd_checkName1   = "";
                    model.rpd_checkRemark1 = "";
                    model.rpd_checkTime1   = null;
                    model.rpd_flag2        = 0;
                    model.rpd_checkNum2    = "";
                    model.rpd_checkName2   = "";
                    model.rpd_checkRemark2 = "";
                    model.rpd_checkTime2   = null;
                    model.rpd_flag3        = 0;
                    model.rpd_checkNum3    = "";
                    model.rpd_checkName3   = "";
                    model.rpd_checkRemark3 = "";
                    model.rpd_checkTime3   = null;
                }
                flag = dal.Update(model);
            }

            if (flag)
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_oid         = model.rpd_oid;
                logmodel.ol_relateID    = model.rpd_id.Value;
                logmodel.ol_cid         = model.rpd_cid.Value;
                logmodel.ol_title       = "编辑" + typeText + "明细";
                logmodel.ol_content     = content.ToString();
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), logmodel, manager.user_name, manager.real_name); //记录日志

                //钉钉通知
                if (!model.rpd_type.Value && !string.IsNullOrEmpty(content))
                {
                    DataTable userDt = new BLL.manager().getUserByPermission("0603", model.rpd_area).Tables[0];
                    if (userDt != null)
                    {
                        string replaceContent = model.rpd_oid + "," + model.rpd_money + "," + model.rpd_content;
                        string replaceUser    = model.rpd_personNum + "," + model.rpd_personName;
                        foreach (DataRow dr in userDt.Rows)
                        {
                            //钉钉推送通知
                            if (!string.IsNullOrEmpty(Utils.ObjectToStr(dr["oauth_userid"])))
                            {
                                new BLL.selfMessage().sentDingMessage("添加付款通知", dr["oauth_userid"].ToString(), replaceContent, replaceUser);
                            }
                        }
                    }
                }

                return("");
            }
            return("编辑失败");
        }
示例#16
0
        private string DoEdit(int _id)
        {
            BLL.certificates   bll   = new BLL.certificates();
            Model.certificates model = bll.GetModel(_id);
            if (model.ce_flag == 2)
            {
                return("凭证号已经审批通过,不能编辑");
            }
            if (string.IsNullOrEmpty(txtNum.Text.Trim()))
            {
                return("请填写凭证号");
            }
            if (string.IsNullOrEmpty(txtDate.Text.Trim()))
            {
                return("请填写凭证日期");
            }
            string _content = string.Empty;
            bool   _update  = false;

            if (model.ce_num != txtNum.Text.Trim())
            {
                _update   = true;
                _content += "凭证号:" + model.ce_num + "→<font color='red'>" + txtNum.Text.Trim() + "</font><br/>";
            }
            model.ce_num = txtNum.Text.Trim();
            if (model.ce_date != Convert.ToDateTime(txtDate.Text.Trim()))
            {
                _update   = true;
                _content += "凭证日期:" + model.ce_date.Value.ToString("yyyy-MM-dd") + "→<font color='red'>" + txtNum.Text.Trim() + "</font><br/>";
            }
            model.ce_date = Convert.ToDateTime(txtDate.Text.Trim());
            if (_update)
            {
                //判断是否被使用
                DataSet ds = new BLL.ReceiptPay().GetList(0, "rp_ceid=" + id, "");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    return("该凭证已被使用,不能修改凭证号和凭证日期,只能修改备注");
                }
            }

            if (model.ce_remark != txtRemark.Text.Trim())
            {
                _content += "备注:" + model.ce_remark + "→<font color='red'>" + txtRemark.Text.Trim() + "</font><br/>";
            }
            model.ce_remark = txtRemark.Text.Trim();
            if (bll.Exists(model.ce_num, model.ce_date, _id))
            {
                return("凭证号、凭证日期重复");
            }
            if (bll.Update(model))
            {
                if (!string.IsNullOrEmpty(_content))
                {
                    logmodel                = new Model.business_log();
                    logmodel.ol_relateID    = _id;
                    logmodel.ol_title       = "修改凭证";
                    logmodel.ol_content     = _content;
                    logmodel.ol_operateDate = DateTime.Now;
                    AddBusinessLog(DTEnums.ActionEnum.Edit.ToString(), logmodel); //记录日志
                }
                return("");
            }

            return("修改失败");
        }