コード例 #1
0
        private void RenderSheet(StackOutSheet sheet)
        {
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("CompanyName", UserSettings.Current.CompanyName));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("ForeignName", UserSettings.Current.ForeignName));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("MyAddress", UserSettings.Current.Address));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("MyTelphone", UserSettings.Current.TelPhone));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("MyFax", UserSettings.Current.Fax));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("MyWeb", UserSettings.Current.Website));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("SheetNo", sheet.ID));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("ShipDate", sheet.LastActiveDate.ToString("yyyy年MM月dd日")));
            CompanyInfo customer = (new CompanyBLL(AppSettings.Current.ConnStr)).GetByID(sheet.CustomerID).QueryObject;

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("Customer", customer != null ? customer.Name : sheet.CustomerID));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("Linker", sheet.Linker));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("LinkerPhone", sheet.LinkerPhoneCall));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("Address", sheet.Address));
            StackOutRecordSearchCondition con = new StackOutRecordSearchCondition();

            con.SheetNo = new List <string>();
            con.SheetNo.Add(sheet.ID);
            List <StackOutRecord> items = (new StackOutSheetBLL(AppSettings.Current.ConnStr)).GetDeliveryRecords(con).QueryObjects;

            items.ForEach(item => { item.Price = item.Price.Trim(); item.Count = item.Count.Trim(); item.Amount = item.Amount.Trim(); });
            ReportDataSource sr = new ReportDataSource();

            sr.Name  = "Items";
            sr.Value = items;
            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(sr);
            this.reportViewer1.RefreshReport();
            //设置打印布局模式,显示物理页面大小
            this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            //缩放模式为百分比,以100%方式显示
            this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.FullPage;
        }
コード例 #2
0
        private void FrmProductInventoryRecordsView_Load(object sender, EventArgs e)
        {
            StackOutRecordSearchCondition con1 = new StackOutRecordSearchCondition();

            con1.LastActiveDate = new DateTimeRange(DateTime.Today.AddMonths(-1), DateTime.Now);
            con1.States         = new List <SheetState>();
            con1.States.Add(SheetState.Shipped);
            con1.ProductID   = ProductInventory.ProductID;
            con1.WareHouseID = ProductInventory.WareHouseID;
            List <StackOutRecord> item1 = new StackOutSheetBLL(AppSettings.Current.ConnStr).GetDeliveryRecords(con1).QueryObjects;

            StackInRecordSearchCondition con2 = new StackInRecordSearchCondition();

            con2.LastActiveDate = new DateTimeRange(DateTime.Today.AddMonths(-1), DateTime.Now);
            con2.States         = new List <SheetState>();
            con2.States.Add(SheetState.Inventory);
            con2.ProductID   = ProductInventory.ProductID;
            con2.WareHouseID = ProductInventory.WareHouseID;
            List <StackInRecord> item2 = new StackInSheetBLL(AppSettings.Current.ConnStr).GetInventoryRecords(con2).QueryObjects;

            List <ProductInventoryRecord> items = new List <ProductInventoryRecord>();

            items.AddRange(item1.Select(item => new ProductInventoryRecord()
            {
                Date = item.LastActiveDate, ProductID = item.ProductID, ProductName = item.Product.Name, Out = item.Count, SheetNo = item.SheetNo
            }));
            items.AddRange(item2.Select(item => new ProductInventoryRecord()
            {
                Date = item.LastActiveDate, ProductID = item.ProductID, ProductName = item.Product.Name, In = item.Count, SheetNo = item.SheetNo
            }));
            items = (from item in items
                     orderby item.Date descending
                     select item).ToList();
            ShowItemsInGrid(items);
        }
コード例 #3
0
        protected override List <object> GetDataSource()
        {
            StackOutRecordSearchCondition con = new StackOutRecordSearchCondition();

            con.LastActiveDate = new DateTimeRange(ucDateTimeInterval1.StartDateTime, ucDateTimeInterval1.EndDateTime);
            con.States         = new List <SheetState>();
            con.States.Add(SheetState.Shipped);
            con.SheetTypes = new List <StackOutSheetType>();
            con.SheetTypes.Add(StackOutSheetType.DeliverySheet);
            if (txtCustomer.Tag != null)
            {
                con.CustomerID = (txtCustomer.Tag as CompanyInfo).ID;
            }
            if (txtProductCategory.Tag != null)
            {
                con.CategoryID = (txtProductCategory.Tag as ProductCategory).ID;
            }
            if (txtProduct.Tag != null)
            {
                con.ProductID = (txtProduct.Tag as Product).ID;
            }
            List <StackOutRecord> items = (new StackOutSheetBLL(AppSettings.Current.ConnStr)).GetDeliveryRecords(con).QueryObjects;

            if (items != null && items.Count > 0)
            {
                return((from item in items orderby item.LastActiveDate ascending, item.ProductID ascending select(object) item).ToList());
            }
            return(base.GetDataSource());
        }
コード例 #4
0
        private List <StackOutRecord> GetItems()
        {
            StackOutRecordSearchCondition con = new StackOutRecordSearchCondition();

            con.LastActiveDate = new DateTimeRange(ucDateTimeInterval1.StartDateTime, ucDateTimeInterval1.EndDateTime);
            con.SheetTypes     = new List <StackOutSheetType>();
            con.SheetTypes.Add(StackOutSheetType.DeliverySheet);
            con.States = new List <SheetState>();
            con.States.Add(SheetState.Shipped);
            if (txtCustomer.Tag != null)
            {
                con.CustomerID = (txtCustomer.Tag as CompanyInfo).ID;
            }
            if (txtProductCategory.Tag != null)
            {
                con.CategoryID = (txtProductCategory.Tag as ProductCategory).ID;
            }
            if (txtProduct.Tag != null)
            {
                con.ProductID = (txtProduct.Tag as Product).ID;
            }
            return((new StackOutSheetBLL(AppSettings.Current.ConnStr)).GetDeliveryRecords(con).QueryObjects);
        }
コード例 #5
0
        protected override List <StackOutRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <StackOutRecord>(item => item.Customer);
            opt.LoadWith <StackOutRecord>(item => item.WareHouse);
            opt.LoadWith <StackOutRecord>(item => item.Product);
            opt.LoadWith <Product>(item => item.Category);
            dc.LoadOptions = opt;
            IQueryable <StackOutRecord> ret = dc.GetTable <StackOutRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.SheetNo));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is StackOutSheetSearchCondition)
            {
                StackOutSheetSearchCondition con = search as StackOutSheetSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (!string.IsNullOrEmpty(con.WareHouseID))
                {
                    ret = ret.Where(item => item.WareHouseID == con.WareHouseID);
                }
                if (con.SheetTypes != null && con.SheetTypes.Count > 0)
                {
                    ret = ret.Where(item => con.SheetTypes.Contains(item.ClassID));
                }
            }
            if (search is StackOutRecordSearchCondition)
            {
                StackOutRecordSearchCondition con = search as StackOutRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.ProductID))
                {
                    ret = ret.Where(item => item.ProductID == con.ProductID);
                }
                if (!string.IsNullOrEmpty(con.CategoryID))
                {
                    ret = ret.Where(item => item.Product.CategoryID == con.CategoryID);
                }
                if (!string.IsNullOrEmpty(con.OrderID))
                {
                    ret = ret.Where(item => item.OrderID == con.OrderID);
                }
                if (con.OrderItem != null)
                {
                    ret = ret.Where(item => item.OrderItem == con.OrderItem);
                }
            }
            List <StackOutRecord> items = ret.ToList();

            return(items);
        }