public OutAndInDepotDetail(OutAndInDepot condition) : this() { this.lblCompanyName.Text = BL.Settings.CompanyChineseName; this.lblReportName.Text = Properties.Resources.OutAndInDepot; this.lblDateRange.Text = "日期区间:" + condition.StartDate.ToString("yyyy-MM-dd") + "-" + condition.EndDate.ToString("yyyy-MM-dd"); this.lblPrintDate.Text = "列印日期:" + DateTime.Now.ToString("yyyy-MM-dd"); DataTable details = this.manager.SelectOutAndInDepot(condition.StartDate, condition.EndDate, condition.DepotStart, condition.DepotEnd, condition.ProduceCategoryStart, condition.ProductCategoryEnd, condition.ProductIdStart, condition.ProductIdEnd); if (details == null || details.Rows.Count == 0) { throw new Helper.InvalidValueException("无记录"); } this.DataSource = details; this.xrTableCellDate.DataBindings.Add("Text", this.DataSource, "Date", "{0:yyyy-MM-dd}"); this.xrTableCellOutDepotId.DataBindings.Add("Text", this.DataSource, "InvoiceId"); this.xrTableCellDepot.DataBindings.Add("Text", this.DataSource, "DepotName"); this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "ProductName"); this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, "ProductUnit"); this.xrTableCellHuoWei.DataBindings.Add("Text", this.DataSource, "DepotPositionName"); this.xrTableCellOutNum.DataBindings.Add("Text", this.DataSource, "Quantity", "{0:0.##}"); this.lblTotalNum.Summary.FormatString = "{0:0.##}"; this.lblTotalNum.Summary.Func = SummaryFunc.Sum; this.lblTotalNum.Summary.IgnoreNullValues = true; this.lblTotalNum.Summary.Running = SummaryRunning.Report; this.lblTotalNum.DataBindings.Add("Text", this.DataSource, "Quantity", "{0:0.##}"); }
private void btn_ExportExcel_Click(object sender, EventArgs e) { if (this.condition == null) { this.condition = new OutAndInDepot(); } if (global::Helper.DateTimeParse.DateTimeEquls(this.date_Start.DateTime, new DateTime())) { this.condition.StartDate = global::Helper.DateTimeParse.NullDate; } else { this.condition.StartDate = this.date_Start.DateTime; } if (global::Helper.DateTimeParse.DateTimeEquls(this.date_End.DateTime, new DateTime())) { this.condition.EndDate = global::Helper.DateTimeParse.EndDate; } else { this.condition.EndDate = this.date_End.DateTime; } this.condition.DepotEnd = this.lookUpEditDepotEnd.EditValue == null ? null : this.lookUpEditDepotEnd.EditValue.ToString(); this.condition.DepotStart = this.lookUpEditDepotStar.EditValue == null ? null : this.lookUpEditDepotStar.EditValue.ToString(); this.condition.ProduceCategoryStart = this.LookUpProductCategoryStart.EditValue == null ? null : this.LookUpProductCategoryStart.EditValue.ToString(); this.condition.ProductCategoryEnd = this.lookUpProductCategoryEnd.EditValue == null ? null : this.lookUpProductCategoryEnd.EditValue.ToString(); this.condition.ProductIdStart = (this.btn_ProductNameStart.EditValue == null ? "" : (this.btn_ProductNameStart.EditValue as Model.Product).Id); this.condition.ProductIdEnd = (this.btn_ProductNameEnd.EditValue == null ? "" : (this.btn_ProductNameEnd.EditValue as Model.Product).Id); System.Data.DataTable dt = this.manager.SelectOutAndInDepot(condition.StartDate, condition.EndDate, condition.DepotStart, condition.DepotEnd, condition.ProduceCategoryStart, condition.ProductCategoryEnd, condition.ProductIdStart, condition.ProductIdEnd); ExportExcel(dt); }
protected override void OnOK() { if (this.condition == null) { this.condition = new OutAndInDepot(); } if (global::Helper.DateTimeParse.DateTimeEquls(this.date_Start.DateTime, new DateTime())) { this.condition.StartDate = global::Helper.DateTimeParse.NullDate; } else { this.condition.StartDate = this.date_Start.DateTime; } if (global::Helper.DateTimeParse.DateTimeEquls(this.date_End.DateTime, new DateTime())) { this.condition.EndDate = global::Helper.DateTimeParse.EndDate; } else { this.condition.EndDate = this.date_End.DateTime; } //this.condition.OutDepotIdStart = this.txt_DepotOutIdStart.Text; //this.condition.OutDepotIdEnd = this.txt_DepotOutIdEnd.Text; this.condition.DepotEnd = this.lookUpEditDepotEnd.EditValue == null ? null : this.lookUpEditDepotEnd.EditValue.ToString(); this.condition.DepotStart = this.lookUpEditDepotStar.EditValue == null ? null : this.lookUpEditDepotStar.EditValue.ToString(); //this.condition.ProductNameStart = this.btn_ProductNameStart.Text; //this.condition.ProductNameEnd = this.btn_ProductNameEnd.Text; this.condition.ProduceCategoryStart = this.LookUpProductCategoryStart.EditValue == null ? null : this.LookUpProductCategoryStart.EditValue.ToString(); this.condition.ProductCategoryEnd = this.lookUpProductCategoryEnd.EditValue == null ? null : this.lookUpProductCategoryEnd.EditValue.ToString(); this.condition.ProductIdStart = (this.btn_ProductNameStart.EditValue == null ? "" : (this.btn_ProductNameStart.EditValue as Model.Product).Id); this.condition.ProductIdEnd = (this.btn_ProductNameEnd.EditValue == null ? "" : (this.btn_ProductNameEnd.EditValue as Model.Product).Id); }