private void ReadDetailReportBand(XtraReportBase xtraReport, DetailReportBand band, StiPage page) { detailLevel++; StiPage tempPage = new StiPage(report); string storeDataSourceName = currentDataSourceName; currentDataSourceName = band.DataMember; ProcessBands(band, band.Controls, tempPage); //StiDataBand masterBand = page.Components[page.Components.Count - 1] as StiDataBand; //if (masterBand != null) //{ // foreach (StiComponent comp in tempPage.Components) // { // StiDataBand dataBand = comp as StiDataBand; // if (dataBand != null) // { // dataBand.MasterComponent = masterBand; // } // } //} //page.Components.AddRange(tempPage.Components); SortBands(tempPage); page.Components.Add(tempPage); currentDataSourceName = storeDataSourceName; detailLevel--; }
private void btnprint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("(select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_CreditNote1 where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union (select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_DebitNote where Company_ID='" + NewCompany.company_id + "' and DeleteData='1') union (select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_DeliveryChallan where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' )union(select TableName,PartyName,BillDate as InvoiceDate,Total,Paid,RemainingBal,Status from tbl_PurchaseBill where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,OrderDate As InvoiceDate,Total,Paid as Received,RemainingBal,Status from tbl_PurchaseOrder where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_SaleInvoice where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,OrderDate as InvoiceDate,Total,Received,RemainingBal,Status from tbl_SaleOrder where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"AllTransactionDataReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("AllTransaction", "AllTransaction", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); // bcomment string Query = string.Format("Select a.CompanyName,a.AddLogo,a.GSTNumber,a.EmailID,a.PhoneNo,a.Address,b.ItemName,b.TaxForSale,b.SaleTaxAmount,b.TaxForPurchase,b.PurchaseTaxAmount from tbl_ItemMaster as b,tbl_CompanyMaster as a where b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1'"); string Query = String.Format("Select ItemName,TaxForSale,SaleTaxAmount,TaxForPurchase,PurchaseTaxAmount from tbl_ItemMaster where Company_ID='" + NewCompany.company_id + "' and DeleteData='1'"); //string Query = string.Format("SELECT a.CompanyID,a.CompanyName, a.Address, a.PhoneNo, a.EmailID,a.GSTNumber,a.AddLogo,b.PartyName,b.InvoiceID,b.PaymentType,b.Company_ID,b.Received,b.RemainingBal,b.Total,b.InvoiceDate FROM tbl_CompanyMaster as a, tbl_SaleInvoice as b where b.InvoiceDate='{0}' and a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "'",date1); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"TaxRateReport1.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("TaxRateReport", "TaxRateReport", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnprint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("(select TableName, InvoiceDate as Date, InvoiceID as Number, PartyName, PaymentType, Feild1, Total, Received, RemainingBal, Status from tbl_SaleInvoice where Feild1 IS NOT Null and Company_ID = '" + NewCompany.company_id + "' and DeleteData = '1')union all(select TableName, OrderDate as Date, OrderNo as Number, PartyName, PaymentType, Feild1, Total, Received, RemainingBal, Status from tbl_SaleOrder where Feild1 IS NOT Null and Company_ID = '" + NewCompany.company_id + "' and DeleteData = '1')", con); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"ChequeReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("Cheque", "Cheque", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = String.Format("(select InvoiceDate as InvoiceDate,PartyName,TableName as Type,Received as 'CashIn/CashOut' from tbl_saleinvoice where Company_ID='" + NewCompany.company_id + "' and DeleteData='1') union (select BillDate as InvoiceDate,PartyName,TableName as Type,Paid from tbl_purchaseBill where Company_ID='" + NewCompany.company_id + "' and DeleteData='1')"); // string Query = string.Format(""); //string Query = string.Format("SELECT a.CompanyID,a.CompanyName, a.Address, a.PhoneNo, a.EmailID,a.GSTNumber,a.AddLogo,b.PartyName,b.InvoiceID,b.PaymentType,b.Company_ID,b.Received,b.RemainingBal,b.Total,b.InvoiceDate FROM tbl_CompanyMaster as a, tbl_SaleInvoice as b where b.InvoiceDate='{0}' and a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "'",date1); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"CashFlow.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("CashFlow", "CashFlow", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select ItemName,SalePrice,PurchasePrice,OpeningQty,MinimumStock from tbl_ItemMaster where Company_ID='" + NewCompany.company_id + "' and DeleteData='1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"StockSummaryReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("StockSummary", "StockSummary", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select a.ItemName,a.OpeningQty,a.MinimumStock,a.atPrice,c.CompanyName,c.CompanyID,c.Address,c.PhoneNo,c.EmailID,c.AddLogo,c.GSTNumber from tbl_ItemMaster as a,tbl_CompanyMaster as c where a.OpeningQty >= a.MinimumStock and a.Company_ID='" + NewCompany.company_id + "' and a.DeleteData='1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"StockSummaryReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("StockSummary", "StockSummary", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select c.CompanyID,c.CompanyName,c.Address,c.AddLogo,c.PhoneNo,c.GSTNumber,c.EmailID,b.IncomeCategory,b.Received,b.Company_ID from tbl_OtherIncome as b,tbl_CompanyMaster as c where b.Company_ID = '" + NewCompany.company_id + "' and c.CompanyID='" + NewCompany.company_id + "' and b.DeleteData = '1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"OtherIncomeCategoryData.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("IncomeCategoryData", "IncomeCategoryData", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = String.Format("select InvoiceDate as Date,TableName as Type,Received as 'Profit/Loss' from tbl_saleinvoice where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' union select BillDate as Date,TableName as Type,Paid as 'Profit/Loss' from tbl_PurchaseBill where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' union select Date as Date,TableName as Type,Received as 'Profit/Loss'from tbl_OtherIncome where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' union select Date as Date,TableName as Type,Paid as 'Profit/Loss' from tbl_Expenses where Company_ID='" + NewCompany.company_id + "' and DeleteData='1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"Profit&Loss.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("Profit&Loss", "Profit&Loss", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { // MessageBox.Show(ex.Message); } } }
private void btnprint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select a.TableName,a.PartyName,b.ItemName,b.Qty,b.ItemAmount from tbl_PurchaseBillInner as b,tbl_PurchaseBill as a where b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1'union ( select a.TableName,a.PartyName,b.ItemName,b.Qty,b.ItemAmount from tbl_SaleInvoiceInner as b,tbl_saleinvoice as a where b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1')"); //string Query = string.Format("(select a.TableName,a.PartyName,b.Qty,b.ItemAmount from tbl_PurchaseBillInner as b,tbl_PurchaseBill as a where b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1' and a.Company_ID='" + NewCompany.company_id + "' and a.DeleteData='1') union ( select a.TableName,a.PartyName,b.Qty,b.ItemAmount from tbl_SaleInvoiceInner as b,tbl_saleinvoice as a where b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1' and a.Company_ID='" + NewCompany.company_id + "' and a.DeleteData='1')",cmbparty.Text); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"ItemReportByParty.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("ItemReportByParty", "ItemReportByParty", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); // string Query = String.Format("select TableName,PartyName, ContactNo,Received as 'Recived/Paid' from tbl_SaleInvoice where PartyName='{0}'union all select TableName,PartyName, ContactNo,Received as 'Recived/Paid' from tbl_SaleOrder where PartyName='{0}'union all select TableName,PartyName, ContactNo,Paid as 'Recived/Paid' from tbl_PurchaseBill where PartyName='{0}'union all select TableName,PartyName, ContactNo,Paid as 'Recived/Paid' from tbl_PurchaseOrder where PartyName = '{0}' and Company_ID='" + NewCompany.company_id + "'", cmballparties.Text); string Query = string.Format("select a.LoanAmount,a.CurrentBal,a.Interest,a.AccountName,a.Company_ID,a.DeleteData,b.CompanyName,b.Address,b.GSTNumber,b.PhoneNo,b.EmailID,b.AddLogo,b.CompanyID from tbl_LoanBank as a,tbl_CompanyMaster as b where a.AccountName='{0}' and a.Company_ID='" + NewCompany.company_id + "' and b.CompanyID='" + NewCompany.company_id + "' and a.DeleteData='1'", cmbAccount.Text); // string Query = string.Format("select c.CompanyID,c.CompanyName,c.PhoneNo,c.EmailID,c.GSTNumber,b.PartyName ,b.ContactNo,b.Received From tbl_PurchaseBill as b,tbl_CompanyMaster as c where CompanyID='" + NewCompany.company_id + "' and b.PartyName='{0}'",cmballparties.Text); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"BankStatementData.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("BankStatement", "BankStatement", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private static void AddPageHeader(ref StiPage page, ref StiText headerText) { #region Header //Create TitleBand StiPageHeaderBand pageHeaderBand = new StiPageHeaderBand(); pageHeaderBand.Height = 0.5; pageHeaderBand.Name = "pageHeaderBand"; pageHeaderBand.Enabled = true; page.Components.Add(pageHeaderBand); //Create Title text on header headerText.Text = DateTime.Now.ToString(); // Common.Date.GetGregorianDate(currentDateTime, Common.Date.DateStringType.Short); headerText.Height = 0.5; headerText.HorAlignment = StiTextHorAlignment.Right; headerText.Name = "TitleHeader"; //headerText.Font = new System.Drawing.Font("Nazanin", 12F); pageHeaderBand.Components.Add(headerText); // Create Title text on header StiText pageNumberText = new StiText(new RectangleD(0, 0, page.Width, 0.5)); headerText.Height = 0.5; pageNumberText.Text = "{PageNumber}" + "-" + "{TotalPageCount}"; pageNumberText.HorAlignment = StiTextHorAlignment.Left; pageNumberText.Name = "pageNumberText"; //headerText.Font = new System.Drawing.Font("Nazanin", 12F); pageHeaderBand.Components.Add(pageNumberText); #endregion }
private void Print_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("SELECT a.CompanyID,a.CompanyName, a.Address, a.PhoneNo, a.EmailID,a.GSTNumber,a.AddLogo, a.AdditinalFeild1,a.AdditinalFeild2,a.AdditinalFeild3,b.ID1, b.Date, b.ExpenseCategory, b.Paid,b.Balance,b.DeleteData,b.Status,b.Total,b.Company_ID,c.ID1,c.ItemName,c.SalePrice,c.Qty,c.ItemAmount,c.DeleteData,c.Company_ID FROM tbl_CompanyMaster as a, tbl_Expenses as b,tbl_ExpensesInner as c where b.ID1='{0}' and c.ID1='{1}' and a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "'and c.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1' and c.DeleteData='1' ", txtReturnNo.Text, txtReturnNo.Text); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"ExpenceReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("Expences", "Expences", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnprint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select a.Date,a.ToBank, a.Descripition,a.Amount,b.BankName,b.OpeningBal from tbl_BankToBankTransfer as a,tbl_BankAccount as b where a.Company_ID = '" + NewCompany.company_id + "' and b.Company_ID = '" + NewCompany.company_id + "' and a.DeleteData = '1' and b.DeleteData = '1'"); //string Query = string.Format("select Company_ID,BillDate, BillNo, PartyName, PaymentType, Total, Paid, RemainingBal, Status from tbl_PurchaseBill where Company_ID = '" + NewCompany.company_id + "' and DeleteData = '1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"BankStatementData.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("BankStatement", "BankStatement", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void Print_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select c.AdditinalFeild1,c.AdditinalFeild2,c.AdditinalFeild3,a.Id,a.ItemName,a.SalePrice,a.DeleteData,a.Qty,a.ItemAmount,b.Id,b.IncomeCategory,b.Date,b.Balance,b.Received,b.Status,b.Company_ID,b.DeleteData,c.CompanyName,c.CompanyID,c.Address,c.PhoneNo,c.EmailID,c.AddLogo,c.GSTNumber from tbl_OtherIncomeInner3 as a,tbl_OtherIncome as b,tbl_CompanyMaster as c where a.Id={0} and b.Id={1} and c.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1' and a.DeleteData='1'", txtReturnNo.Text, txtReturnNo.Text); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"OtherIncomeReport1.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("OtherIncome", "OtherIncome", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); //string Query = string.Format("SELECT a.CompanyID,a.CompanyName, a.Address, a.PhoneNo, a.EmailID,a.GSTNumber,a.AddLogo,b.Company_ID,b.OrderNo,b.PartyName,b.ContactNo,b.OrderDate,b.Total,b.Paid,b.RemainingBal,b.Status,b.DeleteData FROM tbl_CompanyMaster as a, tbl_PurchaseOrder as b where a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData = '1' "); string Query = string.Format("select ItemName, Qty,freeQty, ItemAmount from tbl_PurchaseOrderInner union all select ItemName,Qty,freeQty,ItemAmount from tbl_SaleOrderInner where Company_ID='" + NewCompany.company_id + "' and DeleteData='1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"SalePurchaseOrderItemReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("SalePurchaseOrderItem", "SalePurchaseOrderItem", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select TableName,OrderDate,OrderNo,PartyName,PaymentType,Total,DueDate,Status from tbl_SaleOrder where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' union all select TableName,OrderDate,OrderNo,PartyName,PaymentType,Total,DueDate,Status from tbl_PurchaseOrder where Company_ID='" + NewCompany.company_id + "' and DeleteData='1' "); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"SalePurchaseOrderReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("SalePurchase", "SalePurchase", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { DataSet ds = new DataSet(); string Query = string.Format("select a.CompanyName,a.PhoneNo,a.Address,a.EmailID,a.GSTNumber,a.AddLogo,b.PartyName,b.TotalCgst,b.TotalSgst,b.TotalIgst,b.CalTotal,b.Total,b.TaxAmountShow from tbl_companymaster as a,tbl_saleinvoice as b where a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "' and b.DeleteData='1'"); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"GST9DataReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("GST9Data", "GST9Data", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public ActionResult PrintFormDataList(Guid formId) { try { var source = FormGeneratorComponent.Instance.FormDataFacade.ReportFormDataForExcel(formId, SessionParameters.Culture); StiReport report = new StiReport { ScriptLanguage = StiReportLanguageType.CSharp }; report.Dictionary.Synchronize(); report.Load(Server.MapPath("~/Areas/FormGenerator/Reports/RptFormDataList.mrt")); StiPage page = report.Pages.Items[0]; var pageConponents = page.GetComponents(); StiTable table = (StiTable)pageConponents[0]; table.ColumnCount = source.Columns.Count; table.RowCount = source.Rows.Count + 1; table.HeaderRowsCount = 1; table.Width = page.Width; table.Height = page.GridSize * 12; table.CreateCell(); int indexHeaderCell = 0; foreach (DataColumn column in source.Columns) { var headerCell = table.Components[indexHeaderCell] as StiTableCell; if (headerCell != null) { headerCell.Text.Value = column.Caption; headerCell.HorAlignment = StiTextHorAlignment.Center; headerCell.VertAlignment = StiVertAlignment.Center; headerCell.Border = new StiBorder(StiBorderSides.All, Color.FromArgb(32, 178, 170), 1, StiPenStyle.Solid); } indexHeaderCell++; } foreach (DataRow row in source.Rows) { foreach (DataColumn column in source.Columns) { var headerCell = table.Components[indexHeaderCell] as StiTableCell; if (headerCell != null) { headerCell.Text.Value = row[column].ToString(); headerCell.HorAlignment = StiTextHorAlignment.Center; headerCell.VertAlignment = StiVertAlignment.Center; headerCell.Border = new StiBorder(StiBorderSides.All, Color.FromArgb(32, 178, 170), 1, StiPenStyle.Solid); } indexHeaderCell++; } } SessionParameters.Report = report; return(Content("true")); } catch (Exception ex) { ShowExceptionMessage(ex); return(Content("false")); } }
private void btnPrint_Click(object sender, EventArgs e) { if (MessageBox.Show("DO YOU WANT PRINT??", "PRINT", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { date = DateTime.Now.ToString("yyyy/MM/dd"); todaydate = DateTime.Now.ToString("yyyy/MM/dd"); DataSet ds = new DataSet(); string Query = string.Format("(select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_CreditNote1 where InvoiceDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union (select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_DebitNote where InvoiceDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1') union (select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_DeliveryChallan where InvoiceDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1' )union(select TableName,PartyName,BillDate as InvoiceDate,Total,Paid,RemainingBal,Status from tbl_PurchaseBill where BillDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,OrderDate As InvoiceDate,Total,Paid,RemainingBal,Status from tbl_PurchaseOrder where OrderDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,InvoiceDate,Total,Received,RemainingBal,Status from tbl_SaleInvoice where InvoiceDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,PartyName,OrderDate as InvoiceDate,Total,Received,RemainingBal,Status from tbl_SaleOrder where OrderDate='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,IncomeCategory as PartyName,Date as InvoiceDate,Total,Received,Balance,Status from tbl_OtherIncome where Date='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')union(select TableName,ExpenseCategory as PartyName,Date as InvoiceDate,Total,Paid,Balance,Status from tbl_Expenses where Date='" + dtpdate.Value.ToString("MM/dd/yyyy") + "' and Company_ID='" + NewCompany.company_id + "' and DeleteData='1')"); //string Query = string.Format("SELECT a.CompanyID,a.CompanyName, a.Address, a.PhoneNo, a.EmailID,a.GSTNumber,a.AddLogo,b.PartyName,b.InvoiceID,b.PaymentType,b.Company_ID,b.Received,b.RemainingBal,b.Total,b.InvoiceDate FROM tbl_CompanyMaster as a, tbl_SaleInvoice as b where b.InvoiceDate='{0}' and a.CompanyID='" + NewCompany.company_id + "' and b.Company_ID='" + NewCompany.company_id + "'",date1); SqlDataAdapter SDA = new SqlDataAdapter(Query, con); SDA.Fill(ds); StiReport report = new StiReport(); report.Load(@"DayBookReport.mrt"); report.Compile(); StiPage page = report.Pages[0]; report.RegData("DayBookSale", "DayBookSale", ds.Tables[0]); report.Dictionary.Synchronize(); report.Render(); report.Show(false); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private static void OnPagePainted(StiPage sender, StiPagePaintEventArgs e) { if (copyrightPosition == Position.Front) { var page = sender as StiPage; DrawCopyright(page, e); } }
private void ReadGroupFooterBand(XmlNode node, StiPage page) { StiGroupFooterBand band = new StiGroupFooterBand(); page.Components.Add(band); ReadBand(node, band); }
private void ReadReportTitleBand(XmlNode node, StiPage page) { StiReportTitleBand band = new StiReportTitleBand(); page.Components.Add(band); ReadBand(node, band); }
private static void OnPagePainting(StiPage sender, StiPagePaintEventArgs e) { if (copyrightPosition == Position.Behind) { StiPage page = sender as StiPage; DrawCopyright(page, e); } }
private void ReadColumnHeaderBand(XmlNode node, StiPage page) { StiColumnHeaderBand band = new StiColumnHeaderBand(); page.Components.Add(band); ReadBand(node, band); }
private static void DrawCopyright(StiPage page, StiPagePaintEventArgs e) { if (e.IsPrinting && (!printer)) { return; } if (e.IsDesigning && (!designer)) { return; } if ((!e.IsDesigning) && (!e.IsPrinting) && (!preview)) { return; } var rect = e.FullRectangle; if (rectClient) { rect = e.ClientRectangle; } using (Font font = new Font("Arial", 20 * (float)page.Zoom)) using (StringFormat sf = new StringFormat()) { switch (copyrightPlace) { case Place.TopLeft: sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; break; case Place.TopRight: sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Near; break; case Place.Center: sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; break; case Place.BottomLeft: sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Far; break; case Place.BottomRight: sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Far; break; } e.Graphics.DrawString(copyrightString, font, Brushes.Red, rect, sf); } }
private void ReadReportSummaryBand(XmlNode node, StiPage page) { StiReportSummaryBand band = new StiReportSummaryBand(); page.Components.Add(band); ReadBand(node, band); band.KeepReportSummaryTogether = ReadBool(node, "KeepWithData", band, false); }
private void ReadDataFooterBand(XmlNode node, StiPage page, StiBand masterBand) { StiFooterBand band = new StiFooterBand(); page.Components.Add(band); ReadBand(node, band); band.KeepFooterTogether = ReadBool(node, "KeepWithData", band, false); }
protected void CreateReport(StiPageOrientation orientation) { Report = new StiReport { ReportUnit = StiReportUnitType.Inches }; Page = Report.Pages[0]; Page.PaperSize = PaperKind.A4; Page.ReportUnit = StiUnit.Inches; SetOrientation(orientation); }
private static void AddHasHeaderBand(ref StiText headerText, ref StiPage page, ref StiHeaderBand headerBand) { //Create HeaderBand headerBand.Height = 0.5; headerBand.CanGrow = true; headerBand.CanShrink = true; headerText.HorAlignment = StiTextHorAlignment.Right; headerBand.Name = "HeaderBand"; page.Components.Add(headerBand); }
protected void Generate(GenerationMode generationMode, AsyncOperation asyncOp) { System.DateTime time2; System.TimeSpan span2; this.IsBusy = true; int num = 0; logger.Info("Запущена операция формирования извещений"); System.Exception ex = null; System.DateTime now = System.DateTime.Now; if (generationMode != GenerationMode.GenerateOnly) { ObjectList<NoticeNoticeTemplate> list = new ObjectList<NoticeNoticeTemplate> { this.Template }; this.Templates = list; } this.InitNoticeRenderer(); this.m_RenderedNoticeQueue.IsClosed = false; this.m_SaveRenderedNoticeQueue.IsClosed = false; this.m_RenderingNoticeQueue.IsClosed = false; this.m_ThreadExceptions.IsClosed = false; this.m_GeneratedReport = null; this.m_RenderingNoticeQueue.Clear(); this.m_RenderedNoticeQueue.Clear(); this.m_SaveRenderedNoticeQueue.Clear(); this.m_ThreadExceptions.Clear(); this.m_ProcessedNoticeCount = this.AccountListStatistics.RenderedCount; this.m_RenderThreads = null; this.m_ReportGenerationThreads = null; logger.Info("Запуск потоков"); try { this.m_RenderThreads = new System.Threading.Thread[Constants.NoticeRenderThreads]; for (int i = 0; i < this.m_RenderThreads.Length; i = (int) (i + 1)) { this.m_RenderThreads[i] = new System.Threading.Thread(new System.Threading.ThreadStart(this.RenderThread)); this.m_RenderThreads[i].Start(); logger.Info("Запуск потока рендера " + (i + 1)); } if (generationMode != GenerationMode.GenerateOnly) { this.m_ReportGenerationThreads = new System.Threading.Thread[Constants.NoticeReportGenerationThreads]; for (int j = 0; j < this.m_ReportGenerationThreads.Length; j = (int) (j + 1)) { this.m_ReportGenerationThreads[j] = new System.Threading.Thread(new System.Threading.ThreadStart(this.ReportGenerationThread)); this.m_ReportGenerationThreads[j].Start(); logger.Info("Запуск потока экспорта " + (j + 1)); } } } catch (System.OutOfMemoryException exception2) { ex = new NoticeGenerationException("Недостаточно памяти для создания потоков.", exception2); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } catch (System.ApplicationException exception3) { ex = new NoticeGenerationException("Ошибка при выполнении запроса в базу данных для получения константы", exception3); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } catch (System.Data.SqlClient.SqlException exception4) { ex = new NoticeGenerationException("Ошибка при выполнении запроса в базу данных для получения константы", exception4); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } catch (System.Exception exception5) { ex = new NoticeGenerationException("Ошибка при создании потоков", exception5); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } if (Constants.MaxAccountsInGeneratingBlock > 0) { time2 = System.DateTime.Now; logger.Info("AccountCount: " + ((long) this.AccountListStatistics.AccountCount)); for (int k = 0; k < System.Math.Ceiling((decimal) (this.AccountListStatistics.AccountCount / System.Convert.ToDecimal(Constants.MaxAccountsInGeneratingBlock))); k = (int) (k + 1)) { if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } foreach (NoticeNoticeTemplate template in this.Templates) { bool flag; int indexPart = (int) (k + 1); logger.Info("Получение блока извещений для пачки " + ((int) indexPart)); System.Data.DataTable table = null; do { flag = false; } while (flag && (num <= 5)); this.ReportPercentage(asyncOp); ObjectList<NoticeNotice> list2 = new ObjectList<NoticeNotice>(); logger.Info("Разбор полученного блока. Кол-во: " + ((int) table.Rows.get_Count())); foreach (System.Data.DataRow row in table.Rows) { if (!row.IsNull("renderedNoticeId") && (generationMode != GenerationMode.GenerateOnly)) { long id = (long) ((long) row.get_Item("renderedNoticeId")); NoticeRenderedNotice item = null; num = 0; do { flag = false; try { item = NoticeRenderedNotice.GetById(id); this.m_RenderedNoticeQueue.Enqueue(item); } catch (System.ApplicationException exception9) { if (exception9.InnerException is System.Data.SqlClient.SqlException) { num = (int) (num + 1); flag = true; logger.Warn("Потеря соединения. Переподключение."); } else { ex = new NoticeGenerationException("Ошибка при получении сформированного извещения из базы данных", exception9); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } catch (System.Exception exception11) { ex = new NoticeGenerationException("Ошибка при получении сформированного извещения из базы данных", exception11); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } while (flag && (num <= 5)); } else if (!row.IsNull("noticeId") && row.IsNull("renderedNoticeId")) { NoticeNotice notice2 = new NoticeNotice(); try { long num7 = (long) ((long) row.get_Item("noticeId")); notice2.Id = num7; notice2.Period = (System.DateTime) row.get_Item("period"); notice2.AccountId = (long) ((long) row.get_Item("accountId")); notice2.HouseHolderId = row.IsNull("houseHolderId") ? NoticeNotice.Null.Id : ((long) ((long) row.get_Item("houseHolderId"))); notice2.Barcode = row.IsNull("barcode") ? string.Empty : ((string) ((string) row.get_Item("barcode"))); } catch (System.Exception exception12) { ex = new NoticeGenerationException("Ошибка заполнении объекта извещения данными из БД", exception12); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } list2.Add(notice2); } } table.Clear(); table.Dispose(); this.ReportPercentage(asyncOp); if (list2.get_Count() > 0) { logger.Info("Получение данных для блока извещений из " + ((int) list2.get_Count())); System.Data.DataTable table2 = null; num = 0; do { flag = false; try { table2 = NoticeNotice.GetHeader(this.AreaId, this.Adapter.Filter.Period.Value, indexPart, template.Id); } catch (System.ApplicationException exception13) { if (exception13.InnerException is System.Data.SqlClient.SqlException) { num = (int) (num + 1); flag = true; logger.Warn("Потеря соединения. Переподключение."); } else { ex = new NoticeGenerationException("Ошибка при получении заголовков для блока извещений", exception13); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } catch (System.Exception exception15) { ex = new NoticeGenerationException("Ошибка при получении заголовков для блока извещений", exception15); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } while (flag && (num <= 5)); table2.set_TableName("header"); this.ReportPercentage(asyncOp); if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } System.Data.DataSet set = null; num = 0; do { flag = false; try { set = NoticeNotice.GetReport(this.AreaId, this.Adapter.Filter.Period.Value, indexPart, template.Sql, template.Id); if ((this.AdditionDataTable != null) && (set != null)) { set.Tables.Add(this.AdditionDataTable); } } catch (System.ApplicationException exception16) { if (exception16.InnerException is System.Data.SqlClient.SqlException) { num = (int) (num + 1); flag = true; logger.Warn("Потеря соединения. Переподключение."); } else { ex = new NoticeGenerationException("Ошибка при получении данных для блока извещений", exception16); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } catch (System.Exception exception18) { ex = new NoticeGenerationException("Ошибка при получении данных для блока извещений", exception18); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } while (flag && (num <= 5)); set.Tables.get_Item(0).set_TableName("pays"); set.Tables.get_Item(1).set_TableName("counter"); for (int m = 2; m < set.Tables.get_Count(); m = (int) (m + 1)) { int num15 = (int) (m - 1); set.Tables.get_Item(m).set_TableName("data" + ((int) num15).ToString()); } if (template.IdentityName == "Счет на оплату Ульяновск вариант 3") { if (set.Tables.get_Count() > 2) { set.Tables.get_Item(2).set_TableName("organizations"); } if (set.Tables.get_Count() > 3) { set.Tables.get_Item(3).set_TableName("rates"); } } logger.Info("Отправка группы извещений {0} на рендер", indexPart); this.m_RenderingNoticeQueue.IsWaiting = true; foreach (NoticeNotice notice3 in list2) { System.Data.DataTable headerTable = table2.Clone(); foreach (System.Data.DataRow row2 in table2.Rows) { bool flag2 = false; foreach (System.Data.DataRow row3 in set.Tables.get_Item(0).Rows) { if (((long) row3.get_Item("id")) == notice3.Id) { flag2 = true; break; } } if (!flag2) { break; } if (((long) row2.get_Item("id")) == notice3.Id) { headerTable.ImportRow(row2); break; } } RenderingNotice notice4 = new RenderingNotice(notice3, headerTable, set.Copy(), template.Template, template.Id); this.m_RenderingNoticeQueue.Enqueue(notice4); logger.Info("Отправлено на рендер " + ((long) notice3.Id)); this.ReportPercentage(asyncOp); } table2.Clear(); table2.Dispose(); set.Clear(); set.Dispose(); this.m_RenderingNoticeQueue.IsWaiting = false; this.m_RetreivedNoticeBlocksCount = (int) (this.m_RetreivedNoticeBlocksCount + 1); } this.ReportPercentage(asyncOp); if (this.m_RetreivedNoticeBlocksCount >= Constants.MaxRenderingBlocks) { logger.Info("Достигнуто максимальное количество одновременно обрабатываемых блоков"); while (true) { if (((this.m_SaveRenderedNoticeQueue.Count == 0) && (this.m_RenderingNoticeQueue.Count == 0)) && (this.m_RenderingNoticeCount == 0)) { logger.Info("Очереди обработаны."); this.m_RetreivedNoticeBlocksCount = 0; continue; } this.SaveRenderedNotices(asyncOp, now); this.ReportPercentage(asyncOp); if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } System.Threading.Thread.Sleep(10); } } this.SaveRenderedNotices(asyncOp, now); this.ReportPercentage(asyncOp); span2 = (System.TimeSpan) (System.DateTime.Now - time2); if (span2.get_TotalMinutes() >= 3.0) { time2 = System.DateTime.Now; logger.Info("Сборка мусора"); System.GC.Collect(); } if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } } this.m_RenderingNoticeQueue.IsClosed = true; logger.Info("Ожидание и обработка очереди оставшихся отрендеренных извещений"); while (!this.m_SaveRenderedNoticeQueue.IsClosed || (this.m_SaveRenderedNoticeQueue.Count != 0)) { if (this.m_SaveRenderedNoticeQueue.Count == 0) { System.Threading.Thread.Sleep(10); } span2 = (System.TimeSpan) (System.DateTime.Now - time2); if (span2.get_TotalMinutes() >= 3.0) { time2 = System.DateTime.Now; logger.Info("Сборка мусора"); System.GC.Collect(); } this.ReportPercentage(asyncOp); if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } this.SaveRenderedNotices(asyncOp, now); } } else { ex = new NoticeGenerationException("Неверное значение константы MaxAccountsInGeneratingBlock"); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } this.m_RenderedNoticeQueue.IsClosed = true; logger.Info("Ожидание завершения запущенных потоков рендеринга и экспорта"); while ((this.m_RenderingNoticeQueue.Count > 0) || (this.m_RenderingNoticeCount > 0)) { System.Threading.Thread.Sleep(10); if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } this.ReportPercentage(asyncOp); } while ((this.m_RenderedNoticeQueue.Count > 0) || (this.m_ExportingNoticeCount > 0)) { System.Threading.Thread.Sleep(10); if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } this.ReportPercentage(asyncOp); } span2 = (System.TimeSpan) (System.DateTime.Now - time2); if (span2.get_TotalMinutes() >= 3.0) { time2 = System.DateTime.Now; logger.Info("Сборка мусора"); System.GC.Collect(); } NoticeReport report = null; if (generationMode == GenerationMode.GenerateReport) { logger.Info("Объединение извещений в один отчёт для показа"); System.Collections.Generic.List<NoticeRenderedNotice> renderedNotices = new System.Collections.Generic.List<NoticeRenderedNotice>(); foreach (NoticeReport report2 in this.m_NoticeReports) { renderedNotices.AddRange(report2.RenderedNotices); report2.Dispose(); } report = new NoticeReport(renderedNotices); this.m_GeneratedReport = report; } if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled) { ex = null; this.m_ThreadExceptions.TryDequeue(out ex); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); } else { if ((this.m_NoticeCache.get_Count() > 0) && (this.m_Exporter != null)) { logger.Info("Экспорт по домам управляющих компаний"); int num9 = (int) ((this.m_Exporter.MaxPageCount * this.m_Template.AccountsInTemplate) / this.m_Template.PageCount); CachedNoticeInfoComparer comparer = new CachedNoticeInfoComparer(); try { foreach (string str in this.m_NoticeCache.Keys) { this.m_NoticeCache[str].Sort(comparer); logger.Info("Экспорт домов УК " + str); for (int n = 0; n < this.m_NoticeCache[str].get_Count(); n = (int) (n + num9)) { System.Text.StringBuilder builder = new System.Text.StringBuilder(); int num11 = this.m_NoticeCache[str].get_Count(); if (num11 != 0) { int maxPageCount = this.m_Exporter.MaxPageCount; int num13 = (int) (num11 - (n + maxPageCount)); num13 = (num13 < 1) ? ((int) 0) : num13; using (StiReport report3 = new StiReport()) { report3.IsRendered = true; report3.NeedsCompiling = false; report3.RenderedPages.Clear(); System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.m_Exporter.DestinationPath, str)); if (!info.get_Exists()) { info.Create(); } string file = System.IO.Path.Combine(info.get_FullName(), string.Format("{0}_{1}.pdf", str, n / num9)); for (int num14 = n; num14 < (num11 - num13); num14 = (int) (num14 + 1)) { System.IO.FileInfo info2 = new System.IO.FileInfo(this.m_NoticeCache[str].get_Item(num14).CacheFilePath); if (info2.get_Exists()) { byte[] bytes = System.IO.File.ReadAllBytes(info2.get_FullName()); StiReport report4 = new StiReport(); report4.LoadPackedDocument(bytes); report4.ReportUnit = report3.ReportUnit; foreach (StiPage page in report4.RenderedPages) { page.Report = report3; page.Guid = System.Guid.NewGuid().ToString().Replace("-", ""); report3.RenderedPages.Add(page); } if (this.m_Exporter.DualPageExportMode && ((report4.RenderedPages.get_Count() % 2) != 0)) { StiPage page2 = new StiPage(report3) { IsRendered = true, Orientation = report4.RenderedPages[0].Orientation, Guid = System.Guid.NewGuid().ToString().Replace("-", "") }; report3.RenderedPages.Add(page2); } builder.AppendLine(this.m_NoticeCache[str].get_Item(num14).FullAddress); } } report3.ExportDocument(StiExportFormat.Pdf, file); System.IO.File.WriteAllText(file + ".txt", builder.ToString()); } } } } logger.Info("Очистка дискового кэша"); System.IO.Directory.Delete(System.IO.Path.Combine(this.m_Exporter.DestinationPath, this.m_ExportCacheDirectoryName), true); } catch (System.Exception exception19) { ex = new NoticeGenerationException("Ошибка при экспорте извещений, сгруппированных по УК", exception19); this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now)); return; } } System.TimeSpan timeSpent = (System.TimeSpan) (System.DateTime.Now - now); logger.Info("Операция успешно завершена. Время выполнения " + timeSpent.ToString()); logger.Info("Всего отрендерено: " + ((int) this.m_TotalRendered)); if (asyncOp != null) { GenerationCompletedEventArgs args = new GenerationCompletedEventArgs(timeSpent, null, false, asyncOp.get_UserSuppliedState()) { GeneratedReport = report }; asyncOp.PostOperationCompleted(this.onCompletedDelegate, args); } this.Reset(); } }