Exemplo n.º 1
0
        private void InitData()
        {
            //部门审批状态
            ddlcheck1.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck1.DataTextField  = "value";
            ddlcheck1.DataValueField = "key";
            ddlcheck1.DataBind();
            ddlcheck1.Items.Insert(0, new ListItem("不限", ""));
            //财务审批状态
            ddlcheck2.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck2.DataTextField  = "value";
            ddlcheck2.DataValueField = "key";
            ddlcheck2.DataBind();
            ddlcheck2.Items.Insert(0, new ListItem("不限", ""));
            //总经理审批状态
            ddlcheck3.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck3.DataTextField  = "value";
            ddlcheck3.DataValueField = "key";
            ddlcheck3.DataBind();
            ddlcheck3.Items.Insert(0, new ListItem("不限", ""));

            ddlcheck.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck.DataTextField  = "value";
            ddlcheck.DataValueField = "key";
            ddlcheck.DataBind();
            ddlcheck.Items.Insert(0, new ListItem("请选择", ""));

            ddlisConfirm.DataSource     = Common.BusinessDict.invoiceConfirmStatus();
            ddlisConfirm.DataTextField  = "value";
            ddlisConfirm.DataValueField = "key";
            ddlisConfirm.DataBind();
            ddlisConfirm.Items.Insert(0, new ListItem("不限", ""));

            ddlisConfirm1.DataSource     = Common.BusinessDict.invoiceConfirmStatus();
            ddlisConfirm1.DataTextField  = "value";
            ddlisConfirm1.DataValueField = "key";
            ddlisConfirm1.DataBind();
            ddlisConfirm1.Items.Insert(0, new ListItem("请选择", ""));
            ddlisConfirm1.SelectedValue = "True";

            ddlfarea.DataSource     = new BLL.department().getAreaDict();
            ddlfarea.DataTextField  = "value";
            ddlfarea.DataValueField = "key";
            ddlfarea.DataBind();
            ddlfarea.Items.Insert(0, new ListItem("不限", ""));

            ddldarea.DataSource     = new BLL.department().getAreaDict();
            ddldarea.DataTextField  = "value";
            ddldarea.DataValueField = "key";
            ddldarea.DataBind();
            ddldarea.Items.Insert(0, new ListItem("不限", ""));

            ddlinvType.DataSource     = BusinessDict.invType();
            ddlinvType.DataTextField  = "value";
            ddlinvType.DataValueField = "key";
            ddlinvType.DataBind();
            ddlinvType.Items.Insert(0, new ListItem("不限", ""));
        }
Exemplo n.º 2
0
        private void InitData(byte?key = null)
        {
            ddltype.DataSource     = BusinessDict.unBusinessNature(key);
            ddltype.DataTextField  = "value";
            ddltype.DataValueField = "key";
            ddltype.DataBind();

            //绑定支付用途
            ddlfunction.DataSource     = BusinessDict.unBusinessPayFunction(key);
            ddlfunction.DataTextField  = "value";
            ddlfunction.DataValueField = "key";
            ddlfunction.DataBind();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public string Delete(int id, Model.manager manager)
        {
            Model.unBusinessApply model = GetModel(id);
            if (model == null)
            {
                return("数据不存在");
            }
            //非本人不能删除
            if (manager.user_name != model.uba_PersonNum.ToUpper() && !new permission().checkHasPermission(manager, "0403"))
            {
                return("非申请人或没有删除他人数据权限不能删除");
            }
            if (model.uba_flag3 == 2)
            {
                return("最终审批通过不能再编辑");
            }
            if (dal.Delete(id))
            {
                //删除图片附件
                new BLL.payPic().deleteFileByid(id, 2);

                Model.business_log log = new Model.business_log();
                log.ol_title = "删除非业务支付申请";
                if (model.uba_type == 0)
                {
                    log.ol_oid = model.uba_oid;
                }
                log.ol_relateID = model.uba_id.Value;
                log.ol_content  = "支付类别:" + BusinessDict.unBusinessNature()[model.uba_type.Value] + "</br>"
                                  + "支付用途:" + model.uba_function + "</br>"
                                  + "用途说明:" + model.uba_instruction + "</br>"
                                  + "收款账户名称:" + model.uba_receiveBankName + "</br>"
                                  + "收款账号:" + model.uba_receiveBankNum + "</br>"
                                  + "收款银行:" + model.uba_receiveBank + "</br>"
                                  + "金额:" + model.uba_money + "</br>"
                                  + "预付日期:" + model.uba_foreDate.Value.ToString("yyyy-MM-dd") + "</br>"
                                  + "备注:" + model.uba_remark + "</br>";
                new business_log().Add(DTEnums.ActionEnum.Delete.ToString(), log, manager.user_name, manager.real_name);
                return("");
            }
            return("删除失败");
        }
Exemplo n.º 4
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            flag           = DTRequest.GetFormString("flag");
            _type          = DTRequest.GetFormString("type");
            _orderid       = DTRequest.GetFormString("txtOrderID");
            _cusName       = DTRequest.GetFormString("txtCusName");
            _cid           = DTRequest.GetFormString("hCusId");
            _contractPrice = DTRequest.GetFormString("ddlContractPrice");
            _status        = DTRequest.GetFormString("ddlstatus");
            _dstatus       = DTRequest.GetFormString("ddldstatus");
            _pushstatus    = DTRequest.GetFormString("ddlispush");
            _flag          = DTRequest.GetFormString("ddlflag");
            _lockstatus    = DTRequest.GetFormString("ddllock");
            _content       = DTRequest.GetFormString("txtContent");
            _address       = DTRequest.GetFormString("txtAddress");
            _sign          = DTRequest.GetFormString("ddlsign");
            _money         = DTRequest.GetFormString("txtMoney");
            _person1       = DTRequest.GetFormString("txtPerson1");
            _person2       = DTRequest.GetFormString("txtPerson2");
            _person3       = DTRequest.GetFormString("txtPerson3");
            _person4       = DTRequest.GetFormString("txtPerson4");
            _person5       = DTRequest.GetFormString("txtPerson5");
            _sdate         = DTRequest.GetFormString("txtsDate");
            _edate         = DTRequest.GetFormString("txteDate");
            _sdate1        = DTRequest.GetFormString("txtsDate1");
            _edate1        = DTRequest.GetFormString("txteDate1");
            _sdate2        = DTRequest.GetFormString("txtsDate2");
            _edate2        = DTRequest.GetFormString("txteDate2");
            _area          = DTRequest.GetFormString("ddlarea");
            _orderarea     = DTRequest.GetFormString("ddlorderarea");
            BLL.Order bll = new BLL.Order();
            DataTable dt  = bll.GetList(this.pageSize, this.page, "1=1" + CombSqlTxt(), whereOrderBy, out this.totalCount, false, "", false, orderType, currentUser).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.CreateCell(13).SetCellValue("策划人员");
            headRow.CreateCell(14).SetCellValue("设计人员");
            headRow.CreateCell(15).SetCellValue("应收款");
            headRow.CreateCell(16).SetCellValue("未收款");
            headRow.CreateCell(17).SetCellValue("业绩利润");
            headRow.CreateCell(18).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;
            headRow.GetCell(13).CellStyle = titleCellStyle;
            headRow.GetCell(14).CellStyle = titleCellStyle;
            headRow.GetCell(15).CellStyle = titleCellStyle;
            headRow.GetCell(16).CellStyle = titleCellStyle;
            headRow.GetCell(17).CellStyle = titleCellStyle;
            headRow.GetCell(18).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, 30 * 256);
            sheet.SetColumnWidth(6, 20 * 256);
            sheet.SetColumnWidth(7, 20 * 256);
            sheet.SetColumnWidth(8, 20 * 256);
            sheet.SetColumnWidth(9, 20 * 256);
            sheet.SetColumnWidth(10, 15 * 256);
            sheet.SetColumnWidth(11, 15 * 256);
            sheet.SetColumnWidth(12, 15 * 256);
            sheet.SetColumnWidth(13, 15 * 256);
            sheet.SetColumnWidth(14, 15 * 256);
            sheet.SetColumnWidth(15, 15 * 256);
            sheet.SetColumnWidth(16, 15 * 256);
            sheet.SetColumnWidth(17, 15 * 256);
            sheet.SetColumnWidth(18, 25 * 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]["o_id"].ToString());
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_content"]));
                    row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_address"]));
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"]));
                    row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_contractPrice"]));
                    row.CreateCell(5).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["o_sdate"]).Value.ToString("yyyy-MM-dd") + "/" + ConvertHelper.toDate(dt.Rows[i]["o_sdate"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(6).SetCellValue(new BLL.department().getAreaText(Utils.ObjectToStr(dt.Rows[i]["o_place"])));
                    row.CreateCell(7).SetCellValue(BusinessDict.fStatus()[Utils.ObjToByte(dt.Rows[i]["o_status"])]);
                    row.CreateCell(8).SetCellValue(BusinessDict.pushStatus()[Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["o_isPush"]), false)]);
                    row.CreateCell(9).SetCellValue(BusinessDict.checkStatus()[Utils.ObjToByte(dt.Rows[i]["o_flag"])]);
                    row.CreateCell(10).SetCellValue(BusinessDict.lockStatus()[Utils.ObjToByte(dt.Rows[i]["o_lockStatus"])]);
                    row.CreateCell(11).SetCellValue(dt.Rows[i]["op_name"].ToString());
                    row.CreateCell(12).SetCellValue(dt.Rows[i]["person2"].ToString());
                    row.CreateCell(13).SetCellValue(dt.Rows[i]["person3"].ToString());
                    row.CreateCell(14).SetCellValue(dt.Rows[i]["person4"].ToString());
                    row.CreateCell(15).SetCellValue(dt.Rows[i]["finMoney"].ToString());
                    row.CreateCell(16).SetCellValue(dt.Rows[i]["unMoney"].ToString());
                    row.CreateCell(17).SetCellValue(dt.Rows[i]["profit"].ToString());
                    row.CreateCell(18).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["o_statusTime"]) == ""?"":Utils.ObjectToDateTime(dt.Rows[i]["o_statusTime"]).ToString("yyyy-MM-dd HH:mm:ss"));

                    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;
                    row.GetCell(13).CellStyle = cellStyle;
                    row.GetCell(14).CellStyle = cellStyle;
                    row.GetCell(15).CellStyle = cellStyle;
                    row.GetCell(16).CellStyle = cellStyle;
                    row.GetCell(17).CellStyle = cellStyle;
                    row.GetCell(18).CellStyle = cellStyle;
                }
            }

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

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 5
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _cusName   = DTRequest.GetString("txtCusName");
            _cid       = DTRequest.GetString("hCusId");
            _oID       = DTRequest.GetFormString("txtorderid");
            _area      = DTRequest.GetFormString("ddlarea");
            _sforedate = DTRequest.GetFormString("txtsforedate");
            _eforedate = DTRequest.GetFormString("txteforedate");
            _method    = DTRequest.GetFormString("ddlmethod");
            _person1   = DTRequest.GetFormString("txtPerson1");
            _sdate     = DTRequest.GetFormString("txtsdate");
            _edate     = DTRequest.GetFormString("txtedate");
            _addperson = DTRequest.GetFormString("txtAddPerson");
            _num       = DTRequest.GetFormString("txtnum");
            BLL.ReceiptPayDetail bll = new BLL.ReceiptPayDetail();
            DataTable            dt  = bll.GetList(this.pageSize, this.page, "rpd_type=1" + CombSqlTxt(), "rpd_adddate desc,rpd_id desc", manager, out this.totalCount, out decimal _tmoney, false, 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.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;

            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);

            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]["rpd_oid"].ToString());
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"]));
                    row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_content"]));
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_money"]));
                    row.CreateCell(4).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rpd_foredate"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"]));
                    row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_personNum"]) + "-" + Utils.ObjectToStr(dt.Rows[i]["rpd_personName"]));
                    row.CreateCell(7).SetCellValue(BusinessDict.checkStatus()[Utils.ObjToByte(dt.Rows[i]["rpd_flag1"])]);
                    row.CreateCell(8).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rp_confirmerName"]));
                    row.CreateCell(9).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["rp_date"]) == null?"":ConvertHelper.toDate(dt.Rows[i]["rp_date"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(10).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["rpd_num"]));

                    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;
                }
            }

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

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 6
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _cusName = DTRequest.GetFormString("txtCusName");
            _cid     = DTRequest.GetFormString("hCusId");
            _check1  = DTRequest.GetFormString("ddlcheck1");
            _type    = DTRequest.GetFormString("ddltype");
            _isUse   = DTRequest.GetFormString("ddlisUse");
            BLL.Customer bll = new BLL.Customer();
            DataTable    dt  = bll.GetList(this.pageSize, this.page, "c_id>0" + CombSqlTxt(), "c_isUse desc,c_addDate desc,c_id desc", manager, out this.totalCount, 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("客户ID");
            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.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;

            sheet.SetColumnWidth(0, 15 * 256);
            sheet.SetColumnWidth(1, 20 * 256);
            sheet.SetColumnWidth(2, 20 * 256);
            sheet.SetColumnWidth(3, 30 * 256);
            sheet.SetColumnWidth(4, 20 * 256);
            sheet.SetColumnWidth(5, 20 * 256);
            sheet.SetColumnWidth(6, 15 * 256);
            sheet.SetColumnWidth(7, 20 * 256);
            sheet.SetColumnWidth(8, 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_id"].ToString());
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"]));
                    row.CreateCell(2).SetCellValue(BusinessDict.customerType()[Utils.ObjToByte(dt.Rows[i]["c_type"])]);
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_business"]));
                    row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_num"]));
                    row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_ownerName"]));
                    row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["co_name"]));
                    row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "0"?"待审批": Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "1"?"审批未通过":"审批通过");
                    row.CreateCell(8).SetCellValue(BusinessDict.isUseStatus(1)[Convert.ToBoolean(dt.Rows[i]["c_isUse"])]);

                    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;
                }
            }

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

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 7
0
        private void ShowInfo(int _id)
        {
            BLL.unBusinessApply   bll   = new BLL.unBusinessApply();
            Model.unBusinessApply model = bll.GetModel(_id);

            manager = GetAdminInfo();
            //ddltype.SelectedValue = model.uba_type.ToString();
            ddltype.Visible     = false;
            ddlfunction.Visible = false;
            txtfunction.Visible = false;
            btnAudit.Visible    = false;
            labtype.Text        = BusinessDict.unBusinessNature()[model.uba_type.Value];
            if (model.uba_type == 0)
            {
                ddlfunction.Visible = true;
                if (model.uba_function == "业务活动执行备用金借款")
                {
                    isShowCheckMoney = true;
                    InitData(0);
                }
                else
                {
                    InitData(1);
                }
                ddlfunction.SelectedValue = model.uba_function;
            }
            else
            {
                txtfunction.Visible = true;
                txtfunction.Text    = model.uba_function;
            }
            txtinstruction.Text = model.uba_instruction;
            txtbank.Text        = model.uba_receiveBank;
            txtbankname.Text    = model.uba_receiveBankName;
            txtbanknum.Text     = model.uba_receiveBankNum;
            txtmoney.Text       = model.uba_money.ToString();
            txtforedate.Text    = model.uba_foreDate.Value.ToString("yyyy-MM-dd");
            txtRemark.Text      = model.uba_remark;

            rptAlbumList.DataSource = new BLL.payPic().GetList(2, "pp_type=2 and pp_rid=" + _id + "", "pp_addDate desc");
            rptAlbumList.DataBind();

            if ((manager.area == model.uba_area && new BLL.permission().checkHasPermission(manager, "0603")) || new 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, "0603"))//部门审批
                {
                    ddlchecktype.SelectedValue = "1";
                    ddlflag.SelectedValue      = model.uba_flag1.ToString();
                    txtCheckRemark.Text        = model.uba_checkRemark1;
                }
                else if (new BLL.permission().checkHasPermission(manager, "0402"))//财务审批
                {
                    ddlchecktype.SelectedValue = "2";
                    ddlflag.SelectedValue      = model.uba_flag2.ToString();
                    txtCheckRemark.Text        = model.uba_checkRemark2;
                }
                else if (new BLL.permission().checkHasPermission(manager, "0601"))//总经理审批
                {
                    ddlchecktype.SelectedValue = "3";
                    ddlflag.SelectedValue      = model.uba_flag3.ToString();
                    txtCheckRemark.Text        = model.uba_checkRemark3;
                }
            }
        }
Exemplo n.º 8
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _cusName    = DTRequest.GetFormString("txtCusName");
            _cid        = DTRequest.GetFormString("hCusId");
            _customer   = DTRequest.GetFormString("txtCustomer");
            _hcustomer  = DTRequest.GetFormString("hCustomer");
            _type       = DTRequest.GetFormString("ddltype");
            _sign       = DTRequest.GetFormString("ddlsign");
            _money1     = DTRequest.GetFormString("txtMoney1");
            _nature     = DTRequest.GetFormString("ddlnature");
            _sdate      = DTRequest.GetFormString("txtsDate");
            _edate      = DTRequest.GetFormString("txteDate");
            _sdate1     = DTRequest.GetFormString("txtsDate1");
            _edate1     = DTRequest.GetFormString("txteDate1");
            _name       = DTRequest.GetFormString("txtName");
            _address    = DTRequest.GetFormString("txtAddress");
            _sign1      = DTRequest.GetFormString("ddlsign1");
            _money2     = DTRequest.GetFormString("txtMoney2");
            _person1    = DTRequest.GetFormString("txtPerson1");
            _person2    = DTRequest.GetFormString("txtPerson2");
            _person3    = DTRequest.GetFormString("txtPerson3");
            _person4    = DTRequest.GetFormString("txtPerson4");
            _person5    = DTRequest.GetFormString("txtPerson5");
            _oid        = DTRequest.GetFormString("txtOrderID");
            _chk        = DTRequest.GetFormString("txtChk");
            _status     = DTRequest.GetFormString("ddlstatus");
            _lockstatus = DTRequest.GetFormString("ddllock");
            _area       = DTRequest.GetFormString("ddlarea");
            _sdate2     = DTRequest.GetFormString("txtsDate2");
            _edate2     = DTRequest.GetFormString("txteDate2");
            _check      = DTRequest.GetFormString("ddlcheck");
            _self       = DTRequest.GetFormString("self");
            _detail     = DTRequest.GetFormString("txtDetails");
            string _where = "";
            Dictionary <string, string> dict = getDict(out _where);
            DataTable dt = new BLL.finance().getReconciliationDetail(dict, this.pageSize, this.page, "o_id asc", out this.totalCount, out _p24, out _p25, out _p26, out _p13, out _p14, 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((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "对账金额/") + (_type == "True" ? "应收" : "应付"));
            headRow.CreateCell(11).SetCellValue((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "对账金额/") + (_type == "True" ? "已收" : "已付"));
            headRow.CreateCell(12).SetCellValue((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "对账金额/") + (_type == "True" ? "未收" : "未付"));

            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, 10 * 256);
            sheet.SetColumnWidth(6, 20 * 256);
            sheet.SetColumnWidth(7, 15 * 256);
            sheet.SetColumnWidth(8, 15 * 256);
            sheet.SetColumnWidth(9, 20 * 256);
            sheet.SetColumnWidth(10, 15 * 256);
            sheet.SetColumnWidth(11, 15 * 256);
            sheet.SetColumnWidth(12, 15 * 256);

            if (dt != null)
            {
                int       rowIndex = 1;
                DataTable finDt    = null;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataSet ds = new BLL.finance().GetList(0, "fin_oid='" + dt.Rows[i]["o_id"] + "'" + _where, _chk, "");
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        finDt = ds.Tables[0];
                        if (finDt != null && finDt.Rows.Count > 0)
                        {
                            for (int j = 0; j < finDt.Rows.Count; j++)
                            {
                                IRow row = sheet.CreateRow(rowIndex);
                                row.HeightInPoints = 22;
                                row.CreateCell(0).SetCellValue(dt.Rows[i]["o_id"].ToString());
                                row.CreateCell(1).SetCellValue(dt.Rows[i]["c_name"].ToString());
                                row.CreateCell(2).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["o_sdate"]).Value.ToString("yyyy-MM-dd") + "/" + ConvertHelper.toDate(dt.Rows[i]["o_edate"]).Value.ToString("yyyy-MM-dd"));
                                row.CreateCell(3).SetCellValue(dt.Rows[i]["o_address"].ToString() + "/" + dt.Rows[i]["o_content"].ToString());
                                row.CreateCell(4).SetCellValue(finDt.Rows[j]["chk"].ToString());
                                row.CreateCell(5).SetCellValue(finDt.Rows[j]["chkMoney"].ToString());
                                row.CreateCell(6).SetCellValue(finDt.Rows[j]["na_name"] + "/" + finDt.Rows[j]["fin_detail"]);
                                row.CreateCell(7).SetCellValue(finDt.Rows[j]["fin_illustration"].ToString());
                                row.CreateCell(8).SetCellValue(finDt.Rows[j]["fin_expression"] + "=" + finDt.Rows[j]["fin_money"]);
                                row.CreateCell(9).SetCellValue(BusinessDict.checkStatus()[Utils.ObjToByte(finDt.Rows[j]["fin_flag"])]);
                                row.CreateCell(10).SetCellValue((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "" + dt.Rows[i]["fcMoney"] + "/") + dt.Rows[i]["fin_money"]);
                                row.CreateCell(11).SetCellValue((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "" + dt.Rows[i]["chkMoney"] + "/") + dt.Rows[i]["rpd_money"]);
                                row.CreateCell(12).SetCellValue((string.IsNullOrEmpty(_chk) || _chk == "空" ? "" : "" + dt.Rows[i]["unChkMoney"] + "/") + dt.Rows[i]["unReceiptPay"]);

                                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;
                                rowIndex++;
                            }
                        }
                    }
                }
            }

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

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 9
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _check     = DTRequest.GetFormString("check");
            _check1    = DTRequest.GetFormString("ddlcheck1");
            _check2    = DTRequest.GetFormString("ddlcheck2");
            _check3    = DTRequest.GetFormString("ddlcheck3");
            _payStatus = DTRequest.GetFormString("ddlConfirm");
            _sforedate = DTRequest.GetFormString("txtsforedate");
            _eforedate = DTRequest.GetFormString("txteforedate");
            _sdate     = DTRequest.GetFormString("txtsdate");
            _edate     = DTRequest.GetFormString("txtedate");
            _area      = DTRequest.GetFormString("ddlarea");
            BLL.unBusinessApply bll = new BLL.unBusinessApply();
            DataTable           dt  = bll.GetList(this.pageSize, this.page, "uba_id>0" + CombSqlTxt(), "isnull(uba_date,'3000-01-01') desc,isnull(pm_sort,-1) asc,uba_id desc", manager, out this.totalCount, out _tmoney, 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.CreateCell(13).SetCellValue("财务审批");
            headRow.CreateCell(14).SetCellValue("总经理审批");
            headRow.CreateCell(15).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;
            headRow.GetCell(13).CellStyle = titleCellStyle;
            headRow.GetCell(14).CellStyle = titleCellStyle;
            headRow.GetCell(15).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, 15 * 256);
            sheet.SetColumnWidth(11, 20 * 256);
            sheet.SetColumnWidth(12, 20 * 256);
            sheet.SetColumnWidth(13, 20 * 256);
            sheet.SetColumnWidth(14, 20 * 256);
            sheet.SetColumnWidth(15, 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(BusinessDict.unBusinessNature()[Utils.ObjToByte(dt.Rows[i]["uba_type"])]);
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_function"]));
                    row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_oid"]));
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_instruction"]));
                    row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBankName"]));
                    row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBankNum"]));
                    row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_receiveBank"]));
                    row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_money"]));
                    row.CreateCell(8).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["uba_foreDate"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(9).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["uba_Date"]) == null?"":ConvertHelper.toDate(dt.Rows[i]["uba_Date"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(10).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["pm_name"]));
                    row.CreateCell(11).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["uba_personName"]));
                    row.CreateCell(12).SetCellValue(dt.Rows[i]["uba_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag1"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(13).SetCellValue(dt.Rows[i]["uba_flag2"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag2"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(14).SetCellValue(dt.Rows[i]["uba_flag3"].ToString() == "0" ? "待审批" : dt.Rows[i]["uba_flag3"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(15).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["uba_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;
                    row.GetCell(13).CellStyle = cellStyle;
                    row.GetCell(14).CellStyle = cellStyle;
                    row.GetCell(15).CellStyle = cellStyle;
                }
            }

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

            HttpContext.Current.Response.BinaryWrite(file.GetBuffer());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 10
0
        private void InitData()
        {
            //部门审批状态
            ddlcheck1.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck1.DataTextField  = "value";
            ddlcheck1.DataValueField = "key";
            ddlcheck1.DataBind();
            ddlcheck1.Items.Insert(0, new ListItem("不限", ""));
            //财务审批状态
            ddlcheck2.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck2.DataTextField  = "value";
            ddlcheck2.DataValueField = "key";
            ddlcheck2.DataBind();
            ddlcheck2.Items.Insert(0, new ListItem("不限", ""));
            //总经理审批状态
            ddlcheck3.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck3.DataTextField  = "value";
            ddlcheck3.DataValueField = "key";
            ddlcheck3.DataBind();
            ddlcheck3.Items.Insert(0, new ListItem("不限", ""));

            ddlcheck.DataSource     = Common.BusinessDict.checkStatus();
            ddlcheck.DataTextField  = "value";
            ddlcheck.DataValueField = "key";
            ddlcheck.DataBind();
            ddlcheck.Items.Insert(0, new ListItem("请选择", ""));
            //收付款方式
            //判断是否是财务来显示不同的收付款方式
            string sqlwhere = "";

            if (!new BLL.permission().checkHasPermission(manager, "0401"))
            {
                sqlwhere = " and pm_type=0";
            }
            ddlPayMethod.DataSource     = new BLL.payMethod().GetList(0, "pm_isUse=1 " + sqlwhere + "", "pm_sort asc,pm_id asc");
            ddlPayMethod.DataTextField  = "pm_name";
            ddlPayMethod.DataValueField = "pm_id";
            ddlPayMethod.DataBind();
            ddlPayMethod.Items.Insert(0, new ListItem("请选择", ""));

            ddlPayMethod1.DataSource     = new BLL.payMethod().GetList(0, "pm_isUse=1 " + sqlwhere + "", "pm_sort asc,pm_id asc");
            ddlPayMethod1.DataTextField  = "pm_name";
            ddlPayMethod1.DataValueField = "pm_id";
            ddlPayMethod1.DataBind();
            ddlPayMethod1.Items.Insert(0, new ListItem("不限", ""));

            ddlConfirm.DataSource     = Common.BusinessDict.financeConfirmStatus();
            ddlConfirm.DataTextField  = "value";
            ddlConfirm.DataValueField = "key";
            ddlConfirm.DataBind();
            ddlConfirm.Items.Insert(0, new ListItem("不限", ""));

            ddlPayStatus.DataSource     = Common.BusinessDict.financeConfirmStatus();
            ddlPayStatus.DataTextField  = "value";
            ddlPayStatus.DataValueField = "key";
            ddlPayStatus.DataBind();
            ddlPayStatus.Items.Insert(0, new ListItem("请选择", ""));

            ddlarea.DataSource     = new BLL.department().getAreaDict();
            ddlarea.DataTextField  = "value";
            ddlarea.DataValueField = "key";
            ddlarea.DataBind();
            ddlarea.Items.Insert(0, new ListItem("不限", ""));

            ddltype.DataSource     = BusinessDict.unBusinessNature(1);
            ddltype.DataTextField  = "value";
            ddltype.DataValueField = "key";
            ddltype.DataBind();
            ddltype.Items.Insert(0, new ListItem("不限", ""));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(Model.unBusinessApply model, Model.manager manager, out int id)
        {
            id = 0;
            //如果添加的是员工往来,要判断添加人是否是订单的相关人员
            if (model.uba_type == 0 && model.uba_function == "业务活动执行备用金借款")
            {
                //验证权限:财务,订单的业务员、报账人员、执行人员,才能添加应收应付
                Model.Order order = new BLL.Order().GetModel(model.uba_oid);
                if (order == null)
                {
                    return("订单不存在");
                }
                if (order.o_lockStatus == 1)
                {
                    return("订单已锁单,不能再添加非业务支付申请");
                }
                if (!new BLL.permission().checkHasPermission(manager, "0401"))//如果不是财务
                {
                    if (order.personlist.Where(p => p.op_number == manager.user_name && p.op_type != 3).ToArray().Length == 0)
                    {
                        return("无权限添加");
                    }
                }
            }
            if (string.IsNullOrWhiteSpace(model.uba_function))
            {
                return("请选择或填写支付用途");
            }
            if (string.IsNullOrWhiteSpace(model.uba_receiveBank))
            {
                return("请填写收款银行");
            }
            if (string.IsNullOrWhiteSpace(model.uba_receiveBankName))
            {
                return("请填写账户名称");
            }
            if (string.IsNullOrWhiteSpace(model.uba_receiveBankNum))
            {
                return("请填写收款账号");
            }
            if (model.uba_foreDate == null)
            {
                return("请选择预付日期");
            }
            model.uba_addDate   = DateTime.Now;
            model.uba_flag1     = 0;
            model.uba_flag2     = 0;
            model.uba_flag3     = 0;
            model.uba_isConfirm = false;
            id = dal.Add(model);
            if (id > 0)
            {
                Model.business_log log = new Model.business_log();
                log.ol_title = "添加非业务支付申请";
                if (model.uba_type == 0 && model.uba_function == "业务活动执行备用金借款")
                {
                    log.ol_oid = model.uba_oid;
                }
                log.ol_relateID = id;
                log.ol_content  = "支付类别:" + BusinessDict.unBusinessNature()[model.uba_type.Value] + "</br>"
                                  + "支付用途:" + model.uba_function + "</br>"
                                  + "用途说明:" + model.uba_instruction + "</br>"
                                  + "收款账户名称:" + model.uba_receiveBankName + "</br>"
                                  + "收款账号:" + model.uba_receiveBankNum + "</br>"
                                  + "收款银行:" + model.uba_receiveBank + "</br>"
                                  + "金额:" + model.uba_money + "</br>"
                                  + "预付日期:" + model.uba_foreDate.Value.ToString("yyyy-MM-dd") + "</br>"
                                  + "备注:" + model.uba_remark + "</br>";
                new business_log().Add(DTEnums.ActionEnum.Add.ToString(), log, manager.user_name, manager.real_name);

                //钉钉通知
                DataTable userDt = new BLL.manager().getUserByPermission("0603", model.uba_area).Tables[0];
                if (userDt != null)
                {
                    string replaceContent = model.uba_money + "," + model.uba_function;
                    string replaceUser    = model.uba_PersonNum + "," + model.uba_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("添加失败");
        }