private void btnPrintBill_Click(object sender, EventArgs e) { PurchaseHeaderInfo headInfo = new PurchaseHeaderInfo(); headInfo.CreateDate = txtCreateDate.DateTime; headInfo.Creator = this.txtCreator.Text; headInfo.HandNo = this.txtHandNo.Text; headInfo.Manufacture = this.txtManufacture.Text; headInfo.Note = this.txtNote.Text; headInfo.OperationType = "入库"; headInfo.WareHouse = this.txtWareHouse.Text; headInfo.CreateYear = DateTime.Now.Year; headInfo.CreateMonth = DateTime.Now.Month; List <PurchaseDetailInfo> detailList = new List <PurchaseDetailInfo>(); for (int i = 0; i < this.lvwDetail.Items.Count; i++) { PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo; if (detailInfo != null) { StockInfo stockInfo = BLLFactory <Stock> .Instance.FindByItemNo(detailInfo.ItemNo, this.txtWareHouse.Text); if (stockInfo != null) { int oldQuantity = stockInfo.StockQuantity; decimal oldPrice = 0M; ItemDetailInfo info = BLLFactory <ItemDetail> .Instance.FindByItemNo(detailInfo.ItemNo); if (info != null) { oldPrice = info.Price; decimal newPrice = ((Convert.ToInt32(detailInfo.Quantity) * detailInfo.Price) + (oldQuantity * oldPrice)) / (Convert.ToInt32(detailInfo.Quantity) + oldQuantity); detailInfo.Price = newPrice; } } detailList.Add(detailInfo); } } ReportViewerDialog dlg = new ReportViewerDialog(); dlg.DataSourceDict.Add("PurchaseHeaderInfo", new List <PurchaseHeaderInfo>() { headInfo }); dlg.DataSourceDict.Add("PurchaseDetailInfo", detailList); dlg.ReportFilePath = "Report/WHC.WareHouseMis.PurchaseReport.rdlc"; dlg.Parameters.Add("CompanyName", this.AppInfo.AppUnit); dlg.ShowDialog(); }
private void btnPrintBill_Click(object sender, EventArgs e) { PurchaseHeaderInfo headInfo = new PurchaseHeaderInfo(); headInfo.CreatorTime = txtCreateDate.DateTime; headInfo.CreatorId = this.txtCreator.Text.ToInt32(); headInfo.OrderNo = this.txtHandNo.Text; headInfo.Manufacture = this.txtManufacture.Text; headInfo.Remark = this.txtNote.Text; headInfo.OperationType = (short)OperationType.新增; headInfo.WareHouseId = this.txtWareHouse.GetComboBoxStrValue().ToInt32(); headInfo.CreatorYear = DateTimeHelper.GetServerDateTime2().Year; headInfo.CreatorMonth = (short)DateTimeHelper.GetServerDateTime2().Month; List <PurchaseDetailInfo> detailList = new List <PurchaseDetailInfo>(); for (int i = 0; i < this.lvwDetail.gridView1.RowCount; i++) { PurchaseDetailInfo detailInfo = lvwDetail.gridView1.GetRow(i) as PurchaseDetailInfo; if (detailInfo != null) { WareInfo wareInfo = BLLFactory <Stock> .Instance.FindByItemNo(detailInfo.ItemNo, this.txtWareHouse.GetComboBoxStrValue()); if (wareInfo != null) { int oldQuantity = wareInfo.Amount; double oldPrice = 0; ItemDetailInfo info = BLLFactory <ItemDetail> .Instance.FindByItemNo(detailInfo.ItemNo); if (info != null) { oldPrice = info.Price; double newPrice = ((Convert.ToInt32(detailInfo.Amount) * detailInfo.Price) + (oldQuantity * oldPrice)) / (Convert.ToInt32(detailInfo.Amount) + oldQuantity); detailInfo.Price = newPrice; } } detailList.Add(detailInfo); } } ReportViewerDialog dlg = new ReportViewerDialog(); dlg.DataSourceDict.Add("PurchaseHeaderInfo", new List <PurchaseHeaderInfo>() { headInfo }); dlg.DataSourceDict.Add("PurchaseDetailInfo", detailList); dlg.ReportFilePath = "Report/WHC.WareHouseMis.PurchaseReport.rdlc"; dlg.Parameters.Add("CompanyName", this.AppInfo.AppUnit); dlg.ShowDialog(); }
internal static void Init() { if (Core.GuiThread.InvokeRequired) { Core.GuiThread.InvokeFast(new MethodInvoker(Init)); } else { dialog = new ReportViewerDialog(RuntimeCore.Reports); dialog.FormClosing += new FormClosingEventHandler(dialog_FormClosing); dialog.CreateWindow(); } }
internal static void RegisterPhoenix() { RuntimeObjectsLoader rol = new RuntimeObjectsLoader(); rol.AssemblyList.Add(typeof(Core).Assembly); rol.Report.Name = "Phoenix " + GetCurrentTimeString(); reports.Add(rol.Report); rol.Run(); if (rol.Report.AnalyzerErrors.Count > 0) { using (ReportViewerDialog viewer = new ReportViewerDialog(reports)) { viewer.SelectedReport = rol.Report; viewer.ShowDialog(); } } }
private void btnPrintBill_Click(object sender, EventArgs e) { PurchaseHeaderInfo headInfo = new PurchaseHeaderInfo(); headInfo.CreateDate = txtCreateDate.DateTime; headInfo.Creator = this.txtCreator.Text; headInfo.HandNo = this.txtHandNo.Text; headInfo.Manufacture = this.txtManufacture.Text; headInfo.Note = this.txtNote.Text; headInfo.OperationType = "出库"; headInfo.WareHouse = this.txtWareHouse.Text; headInfo.CostCenter = this.txtCostCenter.Text; headInfo.CreateYear = DateTime.Now.Year; headInfo.CreateMonth = DateTime.Now.Month; headInfo.PickingPeople = this.txtPickingPeople.Text;//领料人 List <PurchaseDetailInfo> detailList = new List <PurchaseDetailInfo>(); for (int i = 0; i < this.lvwDetail.Items.Count; i++) { PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo; if (detailInfo != null) { detailList.Add(detailInfo); } } //WHC.WareHouseMis.TakeOutReport.rdlc ReportViewerDialog dlg = new ReportViewerDialog(); dlg.DataSourceDict.Add("PurchaseHeaderInfo", new List <PurchaseHeaderInfo>() { headInfo }); dlg.DataSourceDict.Add("PurchaseDetailInfo", detailList); dlg.ReportFilePath = "Report/WHC.WareHouseMis.TakeOutReport.rdlc"; dlg.Parameters.Add("CompanyName", Portal.gc.gAppUnit); dlg.ShowDialog(); }