Beispiel #1
0
        /// <summary>
        /// 水晶报表
        /// </summary>
        /// <param name="bsgridPage"></param>
        /// <returns></returns>
        ///
        public ActionResult ShuiJIngBaoBiao(int quFenLeiXingID)
        {
            //进仓、员工、类型、合同、供货商、结算方式
            var Linq = (from tbWaerHouse in myModels.B_WareHouseList
                        join tbStall in myModels.B_StaffList on tbWaerHouse.StaffID equals tbStall.StaffID                                                           //员工
                        join tbQuFen in myModels.S_QuFenLeiXingList on tbWaerHouse.QuFenLeiXingID equals tbQuFen.QuFenLeiXingID                                      //区分类型

                        join tbHeTong in myModels.B_OrderFormPactList on tbWaerHouse.OrderFormPactID equals tbHeTong.OrderFormPactID                                 //合同
                        join tbSupplier in myModels.B_SupplierList on tbHeTong.SupplierID equals tbSupplier.SupplierID                                               //供货商
                        join tbJieSuan in myModels.S_MethodOfSettlingAccountsList on tbHeTong.MethodOfSettlingAccountsID equals tbJieSuan.MethodOfSettlingAccountsID //结算
                        orderby tbWaerHouse.Remember descending
                        select new LY.GongHuoShang
            {
                Remember = tbWaerHouse.Remember,                               //进仓编号

                ContractNumber = tbHeTong.ContractNumber,                      //合同编号
                MethodOfSettlingAccounts = tbJieSuan.MethodOfSettlingAccounts, //结算方式
                SupplierCHName = tbSupplier.SupplierCHName,                    //供货商名称
                StaffCode = tbStall.StaffCode,                                 //员工编号
                StaffName = tbStall.StaffName,                                 //姓名
                RegisterTime = tbWaerHouse.RegisterTime.ToString(),            //登记时间
                ExamineNot = tbWaerHouse.ExamineNot.ToString(),                //审核状态
                Status = tbWaerHouse.Status.ToString(),                        //生效状态
                CrushRedNot = tbWaerHouse.CrushRedNot.ToString(),              //冲红状态
                QuFenLeiXingID = tbQuFen.QuFenLeiXingID,                       //区分ID
                QuFenLeiXingMC = tbQuFen.QuFenLeiXingMC                        //区分
            }).ToList();

            List <GongHuoShang> listWareHouseDeitaLL = new List <GongHuoShang>();

            for (int i = 0; i < Linq.Count; i++)
            {
                GongHuoShang myWareHouseDeitaLL = new GongHuoShang();
                if (Convert.ToBoolean(Linq[i].ExamineNot) == true)
                {
                    myWareHouseDeitaLL.ExamineNot = "已审核";
                }
                else
                {
                    myWareHouseDeitaLL.ExamineNot = "未审核";
                }

                if (Convert.ToBoolean(Linq[i].Status) == true)
                {
                    myWareHouseDeitaLL.Status = "已生效";
                }
                else
                {
                    myWareHouseDeitaLL.Status = "未生效";
                }

                if (Convert.ToBoolean(Linq[i].CrushRedNot) == true)
                {
                    myWareHouseDeitaLL.CrushRedNot = "冲红单";
                }
                else
                {
                    myWareHouseDeitaLL.CrushRedNot = "正常有效使用单";
                }

                myWareHouseDeitaLL.Remember                 = Linq[i].Remember;
                myWareHouseDeitaLL.ContractNumber           = Linq[i].ContractNumber;
                myWareHouseDeitaLL.MethodOfSettlingAccounts = Linq[i].MethodOfSettlingAccounts;
                myWareHouseDeitaLL.SupplierCHName           = Linq[i].SupplierCHName;
                myWareHouseDeitaLL.StaffCode                = Linq[i].StaffCode;
                myWareHouseDeitaLL.StaffName                = Linq[i].StaffName;
                myWareHouseDeitaLL.RegisterTime             = Linq[i].RegisterTime;
                myWareHouseDeitaLL.QuFenLeiXingID           = Linq[i].QuFenLeiXingID;
                myWareHouseDeitaLL.QuFenLeiXingMC           = Linq[i].QuFenLeiXingMC;
                listWareHouseDeitaLL.Add(myWareHouseDeitaLL);
            }


            //查询数据
            List <GongHuoShang> listExaminee = listWareHouseDeitaLL;

            //实例table
            DataTable dt = new DataTable();

            //给table添加列
            dt.Columns.Add("Remember");
            dt.Columns.Add("ContractNumber");
            dt.Columns.Add("MethodOfSettlingAccounts");
            dt.Columns.Add("SupplierCHName");
            dt.Columns.Add("StaffCode");
            dt.Columns.Add("StaffName");
            dt.Columns.Add("RegisterTime");
            dt.Columns.Add("ExamineNot");//如果出错bit 类型,去数据集改类型
            dt.Columns.Add("Status");
            dt.Columns.Add("CrushRedNot");
            dt.Columns.Add("QuFenLeiXingMC");


            foreach (GongHuoShang item in listExaminee)
            {
                DataRow dr = dt.NewRow();
                dr["Remember"]                 = item.Remember;
                dr["ContractNumber"]           = item.ContractNumber;
                dr["MethodOfSettlingAccounts"] = item.MethodOfSettlingAccounts;
                dr["SupplierCHName"]           = item.SupplierCHName;
                dr["StaffCode"]                = item.StaffCode;
                dr["StaffName"]                = item.StaffName;
                dr["RegisterTime"]             = item.RegisterTime;
                dr["ExamineNot"]               = item.ExamineNot;
                dr["Status"]         = item.Status;
                dr["CrushRedNot"]    = item.CrushRedNot;
                dr["QuFenLeiXingMC"] = item.QuFenLeiXingMC;
                dt.Rows.Add(dr);
            }


            //1、实例数据集
            CRP.DataSWareHou dtAchievement = new CRP.DataSWareHou();

            //2、合并:
            dtAchievement.Tables["DataWareHouer"].Merge(dt);

            ReportDocument rd = new ReportDocument();

            string strRptPath = System.Web.HttpContext.Current.Server.MapPath("~/") + "Areas\\CRP\\CrystalReWareHour.rpt";

            rd.Load(strRptPath);
            rd.SetDataSource(dtAchievement); //设置报表数据源

            //最后(IO 流形式)
            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            return(File(stream, "application/pdf"));
        }
Beispiel #2
0
        /// <summary>
        /// 浏览器打印
        /// </summary>
        /// <returns></returns>
        public ActionResult WidowesDaYin()
        {
            var Linq = (from tbWaerHouse in myModels.B_WareHouseList
                        join tbStall in myModels.B_StaffList on tbWaerHouse.StaffID equals tbStall.StaffID                                                           //员工
                        join tbQuFen in myModels.S_QuFenLeiXingList on tbWaerHouse.QuFenLeiXingID equals tbQuFen.QuFenLeiXingID                                      //区分类型

                        join tbHeTong in myModels.B_OrderFormPactList on tbWaerHouse.OrderFormPactID equals tbHeTong.OrderFormPactID                                 //合同
                        join tbSupplier in myModels.B_SupplierList on tbHeTong.SupplierID equals tbSupplier.SupplierID                                               //供货商
                        join tbJieSuan in myModels.S_MethodOfSettlingAccountsList on tbHeTong.MethodOfSettlingAccountsID equals tbJieSuan.MethodOfSettlingAccountsID //结算
                        orderby tbWaerHouse.Remember descending
                        select new LY.GongHuoShang
            {
                Remember = tbWaerHouse.Remember,                               //进仓编号
                ContractNumber = tbHeTong.ContractNumber,                      //合同编号
                MethodOfSettlingAccounts = tbJieSuan.MethodOfSettlingAccounts, //结算方式
                SupplierCHName = tbSupplier.SupplierCHName,                    //供货商名称
                StaffCode = tbStall.StaffCode,                                 //员工编号
                StaffName = tbStall.StaffName,                                 //姓名
                RegisterTime = tbWaerHouse.RegisterTime.ToString(),            //登记时间
                ExamineNot = tbWaerHouse.ExamineNot.ToString(),                //审核状态
                Status = tbWaerHouse.Status.ToString(),                        //生效状态
                CrushRedNot = tbWaerHouse.CrushRedNot.ToString(),              //冲红状态
                QuFenLeiXingID = tbQuFen.QuFenLeiXingID,                       //区分ID
                QuFenLeiXingMC = tbQuFen.QuFenLeiXingMC                        //区分
            }).ToList();
            List <GongHuoShang> listWareHouseDeitaLL = new List <GongHuoShang>();

            for (int i = 0; i < Linq.Count; i++)
            {
                GongHuoShang myWareHouseDeitaLL = new GongHuoShang();
                if (Convert.ToBoolean(Linq[i].ExamineNot) == true)
                {
                    myWareHouseDeitaLL.ExamineNot = "已审核";
                }
                else
                {
                    myWareHouseDeitaLL.ExamineNot = "未审核";
                }

                if (Convert.ToBoolean(Linq[i].Status) == true)
                {
                    myWareHouseDeitaLL.Status = "已生效";
                }
                else
                {
                    myWareHouseDeitaLL.Status = "未生效";
                }

                if (Convert.ToBoolean(Linq[i].CrushRedNot) == true)
                {
                    myWareHouseDeitaLL.CrushRedNot = "冲红单";
                }
                else
                {
                    myWareHouseDeitaLL.CrushRedNot = "正常有效使用单";
                }

                myWareHouseDeitaLL.Remember                 = Linq[i].Remember;
                myWareHouseDeitaLL.ContractNumber           = Linq[i].ContractNumber;
                myWareHouseDeitaLL.MethodOfSettlingAccounts = Linq[i].MethodOfSettlingAccounts;
                myWareHouseDeitaLL.SupplierCHName           = Linq[i].SupplierCHName;
                myWareHouseDeitaLL.StaffCode                = Linq[i].StaffCode;
                myWareHouseDeitaLL.StaffName                = Linq[i].StaffName;
                myWareHouseDeitaLL.RegisterTime             = Linq[i].RegisterTime;
                myWareHouseDeitaLL.QuFenLeiXingID           = Linq[i].QuFenLeiXingID;
                myWareHouseDeitaLL.QuFenLeiXingMC           = Linq[i].QuFenLeiXingMC;
                listWareHouseDeitaLL.Add(myWareHouseDeitaLL);
            }

            return(PartialView(listWareHouseDeitaLL));
        }