Exemple #1
0
        private void RptBind(string _strWhere, string _orderby)
        {
            if (!this.isSearch)
            {
                this.page = DTRequest.GetQueryInt("page", 1);
            }
            else
            {
                this.page = 1;
            }
            BLL.invoices bll = new BLL.invoices();
            DataTable    dt  = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, manager, out this.totalCount, out _tmoney).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;

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

            txtCusName.Text            = _cusName;
            hCusId.Value               = _cid;
            ddlchecktype.SelectedValue = this._check;
            ddlcheck1.SelectedValue    = _check1;
            ddlcheck2.SelectedValue    = _check2;
            ddlcheck3.SelectedValue    = _check3;
            ddlisConfirm.SelectedValue = _isconfirm;
            txtOid.Text              = _oid;
            ddlsign.SelectedValue    = _sign;
            txtMoney.Text            = _money;
            txtsDate.Text            = _sdate;
            txteDate.Text            = _edate;
            ddlfarea.SelectedValue   = _farea;
            ddldarea.SelectedValue   = _darea;
            ddlinvType.SelectedValue = _invType;
            txtName.Text             = _name;
            txtUnit.Text             = _unit;
            txtpurchaserName.Text    = _purchaserName;
        }
Exemple #2
0
        private void ShowInfo(int _id)
        {
            btnAudit.Visible = false;
            BLL.invoices bll = new BLL.invoices();
            DataSet      ds  = bll.GetList(0, "inv_id=" + _id + "", "");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                oID                      = dr["inv_oid"].ToString();
                txtCusName.Text          = dr["c_name"].ToString();
                hCusId.Value             = dr["inv_cid"].ToString();
                labCusName.Text          = dr["c_name"].ToString();
                txtpurchaserName.Text    = dr["inv_purchaserName"].ToString();
                txtpurchaserNum.Text     = dr["inv_purchaserNum"].ToString();
                txtpurchaserAddress.Text = dr["inv_purchaserAddress"].ToString();
                txtpurchaserPhone.Text   = dr["inv_purchaserPhone"].ToString();
                txtpurchaserBank.Text    = dr["inv_purchaserBank"].ToString();
                txtpurchaserBankNum.Text = dr["inv_purchaserBankNum"].ToString();
                txtmoney.Text            = dr["inv_money"].ToString();
                labOverMoney.Text        = dr["inv_overmoney"].ToString();
                txtreceiveName.Text      = dr["inv_receiveName"].ToString();
                txtreceivePhone.Text     = dr["inv_receivePhone"].ToString();
                txtreceiveAddress.Text   = dr["inv_receiveAddress"].ToString();
                txtremark.Text           = dr["inv_remark"].ToString();
                Dictionary <byte?, string> stype = Common.BusinessDict.taxableType();
                byte?_type = 0;
                foreach (var item in stype.Keys)
                {
                    if (stype[item].ToString() == dr["inv_serviceType"].ToString())
                    {
                        ddlserviceType.SelectedValue = item.ToString();
                        _type = Utils.ObjToByte(item);
                        break;
                    }
                }
                if (_type == 4)
                {
                    ddlserviceName.Visible = false;
                    txtserviceName.Visible = true;
                    txtserviceName.Text    = dr["inv_serviceName"].ToString();
                }
                else
                {
                    ddlserviceName.Visible = true;
                    txtserviceName.Visible = false;
                    Dictionary <byte?, string> sname = Common.BusinessDict.serviceName(_type);
                    ddlserviceName.DataSource     = sname;
                    ddlserviceName.DataTextField  = "value";
                    ddlserviceName.DataValueField = "key";
                    ddlserviceName.DataBind();
                    ddlserviceName.Items.Insert(0, new ListItem("请选择", ""));
                    foreach (var item in sname.Keys)
                    {
                        if (sname[item].ToString() == dr["inv_serviceName"].ToString())
                        {
                            ddlserviceName.SelectedValue = item.ToString();
                            break;
                        }
                    }
                }
                Dictionary <byte?, string> smethod = Common.BusinessDict.sentMethod();
                foreach (var item in smethod.Keys)
                {
                    if (smethod[item].ToString() == dr["inv_sentWay"].ToString())
                    {
                        ddlsentWay.SelectedValue = item.ToString();
                        break;
                    }
                }
                ddldarea.SelectedValue = dr["inv_darea"].ToString();
                BindUnit(ddldarea.SelectedValue);
                ddlunit.SelectedValue    = dr["inv_unit"].ToString();
                ddlinvType.SelectedValue = dr["inv_type"].ToString();

                if (((manager.area == dr["inv_farea"].ToString() || manager.area == dr["inv_darea"].ToString()) && new MettingSys.BLL.permission().checkHasPermission(manager, "0603")) || new MettingSys.BLL.permission().checkHasPermission(manager, "0402"))
                {
                    btnAudit.Visible       = true;
                    ddlflag.DataSource     = Common.BusinessDict.checkStatus();
                    ddlflag.DataTextField  = "value";
                    ddlflag.DataValueField = "key";
                    ddlflag.DataBind();
                    ddlflag.Items.Insert(0, new ListItem("请选择", ""));

                    if (new MettingSys.BLL.permission().checkHasPermission(manager, "0603"))
                    {
                        if (dr["inv_farea"].ToString() == dr["inv_darea"].ToString())
                        {
                            if (dr["inv_flag1"].ToString() != "2")
                            {
                                ddlchecktype.SelectedValue = "1";
                                ddlflag.SelectedValue      = dr["inv_flag1"].ToString();
                                txtCheckRemark.Text        = dr["inv_checkRemark1"].ToString();
                            }
                            if (dr["inv_flag2"].ToString() == "2")
                            {
                                ddlchecktype.SelectedValue = "2";
                                ddlflag.SelectedValue      = dr["inv_flag2"].ToString();
                                txtCheckRemark.Text        = dr["inv_checkRemark2"].ToString();
                            }
                        }
                        else
                        {
                            if (manager.area == dr["inv_farea"].ToString())
                            {
                                ddlchecktype.SelectedValue = "1";
                                ddlflag.SelectedValue      = dr["inv_flag1"].ToString();
                                txtCheckRemark.Text        = dr["inv_checkRemark1"].ToString();
                            }
                            if (manager.area == dr["inv_darea"].ToString())
                            {
                                ddlchecktype.SelectedValue = "2";
                                ddlflag.SelectedValue      = dr["inv_flag2"].ToString();
                                txtCheckRemark.Text        = dr["inv_checkRemark2"].ToString();
                            }
                        }
                    }
                    if (new MettingSys.BLL.permission().checkHasPermission(manager, "0402"))
                    {
                        ddlchecktype.SelectedValue = "3";
                        ddlflag.SelectedValue      = dr["inv_flag3"].ToString();
                        txtCheckRemark.Text        = dr["inv_checkRemark3"].ToString();
                    }
                }
            }
            txtCusName.Visible = false;
        }
Exemple #3
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            _cusName       = DTRequest.GetFormString("txtCusName");
            _cid           = DTRequest.GetFormString("hCusId");
            _check1        = DTRequest.GetFormString("ddlcheck1");
            _check2        = DTRequest.GetFormString("ddlcheck2");
            _check3        = DTRequest.GetFormString("ddlcheck3");
            _isconfirm     = DTRequest.GetFormString("ddlisConfirm");
            _oid           = DTRequest.GetFormString("txtOid");
            _sign          = DTRequest.GetFormString("ddlsign");
            _money         = DTRequest.GetFormString("txtMoney");
            _sdate         = DTRequest.GetFormString("txtsDate");
            _edate         = DTRequest.GetFormString("txteDate");
            _farea         = DTRequest.GetFormString("ddlfarea");
            _darea         = DTRequest.GetFormString("ddldarea");
            _invType       = DTRequest.GetFormString("ddlinvType");
            _name          = DTRequest.GetFormString("txtName");
            _unit          = DTRequest.GetFormString("txtUnit");
            _purchaserName = DTRequest.GetFormString("txtpurchaserName");
            _self          = DTRequest.GetFormString("self");//self=1表示个人页面
            BLL.invoices bll = new BLL.invoices();
            DataTable    dt  = bll.GetList(this.pageSize, this.page, "inv_id>0" + CombSqlTxt(), "inv_addDate desc,inv_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, 20 * 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(dt.Rows[i]["c_name"].ToString());
                    row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_oid"]));
                    row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_serviceType"]) + "/" + Utils.ObjectToStr(dt.Rows[i]["inv_serviceName"]));
                    row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_money"]));
                    row.CreateCell(4).SetCellValue("0");
                    row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_sentWay"]));
                    row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["de_subname"]));
                    row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_personName"]));
                    row.CreateCell(8).SetCellValue(dt.Rows[i]["inv_flag1"].ToString() == "0" ? "待审批" : dt.Rows[i]["inv_flag1"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(9).SetCellValue(dt.Rows[i]["inv_flag2"].ToString() == "0" ? "待审批" : dt.Rows[i]["inv_flag2"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(10).SetCellValue(dt.Rows[i]["inv_flag3"].ToString() == "0" ? "待审批" : dt.Rows[i]["inv_flag3"].ToString() == "1" ? "审批未通过" : "审批通过");
                    row.CreateCell(11).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["inv_isConfirm"]), false) ? "已开票" : "未开票");
                    row.CreateCell(12).SetCellValue(ConvertHelper.toDate(dt.Rows[i]["inv_date"]) == null ? "" : ConvertHelper.toDate(dt.Rows[i]["inv_date"]).Value.ToString("yyyy-MM-dd"));
                    row.CreateCell(13).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_type"]));
                    row.CreateCell(14).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["invU_name"]));
                    row.CreateCell(15).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["inv_purchaserName"]));

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