static string GenerateTableHeaderRow(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); ReportDimensions padding = new ReportDimensions(); if (columns == null) return ""; string strTableRow = ""; strTableRow = @"<TablixRow> <Height>0.6cm</Height> <TablixCells>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; padding = columns[i].HeaderColumnPadding; strTableRow += @"<TablixCell> <CellContents> " + GenerateTextBox("txtHeader_" + table.ReportName + "_", ColumnCell.Name, columns[i].HeaderText == null || columns[i].HeaderText.Trim() == "" ? ColumnCell.Name : columns[i].HeaderText, false, padding) + @" </CellContents> </TablixCell>"; } strTableRow += @"</TablixCells></TablixRow>"; return strTableRow; }
static string GenerateTableRow(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); ReportScale colHeight = ColumnCell.Size; ReportDimensions padding = new ReportDimensions(); if (columns == null) return ""; string strTableRow = ""; strTableRow = @"<TablixRow> <Height>0.6cm</Height> <TablixCells>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; padding = ColumnCell.Padding; strTableRow += @"<TablixCell> <CellContents> " + GenerateTextBox("txtCell_" + table.ReportName + "_", ColumnCell.Name, "", true, padding) + @" </CellContents> </TablixCell>"; } strTableRow += @"</TablixCells></TablixRow>"; return strTableRow; }
static string GetSortingDetails(ReportBuilder reportBuilder) { //return ""; ReportTable[] tables = reportBuilder.Body.ReportControlItems.ReportTable; ReportColumns[] columns = reportBuilder.Body.ReportControlItems.ReportTable[0].ReportDataColumns; ReportTextBoxControl sortColumn = new ReportTextBoxControl(); if (columns == null) return ""; string strSorting = ""; strSorting = @" <SortExpressions>"; for (int i = 0; i < columns.Length; i++) { sortColumn = columns[i].ColumnCell; strSorting += "<SortExpression><Value>=Fields!" + sortColumn.Name + @".Value</Value>"; if (columns[i].SortDirection == ReportSort.Descending) strSorting += "<Direction>Descending</Direction>"; strSorting += @"</SortExpression>"; } strSorting += "</SortExpressions>"; return strSorting; }
static string GetTableColumns(ReportBuilder reportBuilder, ReportTable table) { ReportColumns[] columns = table.ReportDataColumns; ReportTextBoxControl ColumnCell = new ReportTextBoxControl(); if (columns == null) return ""; string strColumnHeirarchy = ""; strColumnHeirarchy = @" <TablixColumns>"; for (int i = 0; i < columns.Length; i++) { ColumnCell = columns[i].ColumnCell; strColumnHeirarchy += @" <TablixColumn> <Width>" + ColumnCell.Size.Width.ToString() + @"cm</Width> </TablixColumn>"; } strColumnHeirarchy += @"</TablixColumns>"; return strColumnHeirarchy; }
private void btnRechargeCardView_Click(object sender, EventArgs e) { if (!ValidateDataCardInput()) { return; } dgvRechargeCardHistory.DataSource = null; DateTime date_begin = new DateTime(dtpSaleGasBegin.Value.Year, dtpSaleGasBegin.Value.Month, dtpSaleGasBegin.Value.Day, 0, 0, 0); DateTime date_end = new DateTime(dtpSaleGasEnd.Value.Date.Year, dtpSaleGasEnd.Value.Month, dtpSaleGasEnd.Value.Day, 23, 59, 59); String customerId = (cboRechargeCardCustomer.SelectedItem as ComboboxItem).Value.ToString(); Task<String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask( () => { return m_service.SGMSaleGas_GetCardReport(customerId, date_begin, date_end, txtRechargeCardID.Text.Trim()); }); SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () => { String stResponse = task.Result as String; DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse); if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS) { if (dataResponse.ResponseDataSet != null) { dgvRechargeCardHistory.DataSource = dataResponse.ResponseDataSet.Tables[0]; cardReportViewer.Reset(); String tableName = dataResponse.ResponseDataSet.Tables[0].TableName; DataTable data = dataResponse.ResponseDataSet.Tables[0]; cardReportViewer.LocalReport.DataSources.Add(new ReportDataSource(tableName, data)); ReportBuilder reportBuilder = new ReportBuilder(); reportBuilder.DataSource = dataResponse.ResponseDataSet; reportBuilder.Page = new ReportPage(); ReportSections reportHeader = new ReportSections(); reportHeader.Size = new ReportScale(); reportHeader.Size.Height = 0.1; ReportItems reportHeaderItems = new ReportItems(); ReportTextBoxControl[] headerTxt = new ReportTextBoxControl[1]; headerTxt[0] = new ReportTextBoxControl() { Name = "txtReportTitle", ValueOrExpression = new string[] { string.Format("Sales Report: {0}", DateTime.Now) } }; reportHeaderItems.TextBoxControls = headerTxt; reportHeader.ReportControlItems = reportHeaderItems; reportBuilder.Page.ReportHeader = reportHeader; cardReportViewer.LocalReport.LoadReportDefinition(ReportEngine.GenerateReport(reportBuilder)); cardReportViewer.RefreshReport(); } else frmMsg.ShowMsg(SGMText.SGM_INFO, SGMText.REPORT_NO_DATA, SGMMessageType.SGM_MESSAGE_TYPE_INFO); } else { frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR); } }, SynchronizationContext.Current); }