public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptActVozvr rpt = new rptActVozvr(); rpt.Site = this.Site; return(rpt); }
private void PrintActVozvr() { if ((dtPrintResult != null) && (dtPrintResult.Rows.Count > 0)) { rptActVozvr rptReport = new rptActVozvr(); DataTable dtEq = new DataTable(); if (dtEquipment != null) { if (dtEquipment.Rows.Count > 0) { dtEq = dtEquipment.Copy(); } else { dtEq.Columns.Add("equipment", typeof(string)); dtEq.Columns.Add("count", typeof(string)); DataRow new_dr = dtEq.NewRow(); new_dr["equipment"] = "__________"; new_dr["count"] = "___"; dtEq.Rows.Add(new_dr); dtEq.AcceptChanges(); } } else { dtEq.Columns.Add("equipment", typeof(string)); dtEq.Columns.Add("count", typeof(string)); DataRow new_dr = dtEq.NewRow(); new_dr["equipment"] = "__________"; new_dr["count"] = "___"; dtEq.Rows.Add(new_dr); dtEq.AcceptChanges(); } rptReport.SetDataSource((DataTable)dtEq); //--- //переменные исходные string object_address = (dtPrintResult.DefaultView[0]["object_address"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["object_address"].ToString()); string date_act = (dtPrintResult.DefaultView[0]["date_doc"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["date_doc"].ToString()); string date_con = (dtPrintResult.DefaultView[0]["date_con"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["date_con"].ToString()); string Landlord_post = (dtPrintResult.DefaultView[0]["Landlord_post"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_post"].ToString()); string Landlord_FIO = (dtPrintResult.DefaultView[0]["Landlord_FIO"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_FIO"].ToString()); string Landlord_type_full = (dtPrintResult.DefaultView[0]["Landlord_type_full"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_type_full"].ToString()); string Landlord_name = (dtPrintResult.DefaultView[0]["Landlord_name"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_name"].ToString()); string Landlord_type = (dtPrintResult.DefaultView[0]["Landlord_type"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_type"].ToString()); string Tenant_type_full = (dtPrintResult.DefaultView[0]["Tenant_type_full"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_type_full"].ToString()); string Tenant_name = (dtPrintResult.DefaultView[0]["Tenant_name"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_name"].ToString()); string Tenant_post = (dtPrintResult.DefaultView[0]["Tenant_post"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_post"].ToString()); string Tenant_FIO = (dtPrintResult.DefaultView[0]["Tenant_FIO"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_FIO"].ToString()); string Tenant_type = (dtPrintResult.DefaultView[0]["Tenant_type"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_type"].ToString()); string section = (dtPrintResult.DefaultView[0]["section"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["section"].ToString()); string floors = (dtPrintResult.DefaultView[0]["floors"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["floors"].ToString()); string object_area = (dtPrintResult.DefaultView[0]["object_area"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["object_area"].ToString()); //переменные составные // ------------- string Landlord_basement = ","; if (dtPrintResult.DefaultView[0]["Landlord_basement"].ToString().Trim().Length != 0) { Landlord_basement = ", действующего на основании " + (dtPrintResult.DefaultView[0]["Landlord_basement"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_basement"].ToString()); } if (dtPrintResult.DefaultView[0]["Landlord_number_base"].ToString().Trim().Length != 0) { Landlord_basement += (dtPrintResult.DefaultView[0]["Landlord_number_base"].ToString().Trim().Length == 0 ? "" : " № " + dtPrintResult.DefaultView[0]["Landlord_number_base"].ToString()); } if (dtPrintResult.DefaultView[0]["Landlord_date_base"].ToString().Trim().Length != 0) { Landlord_basement += " от " + (dtPrintResult.DefaultView[0]["Landlord_date_base"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_date_base"].ToString()); } if (Landlord_basement != ",") { Landlord_basement += ","; } string Tenant_basement = ","; if (dtPrintResult.DefaultView[0]["Tenant_basement"].ToString().Trim().Length != 0) { Tenant_basement = ", действующего на основании " + (dtPrintResult.DefaultView[0]["Tenant_basement"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_basement"].ToString()); } if (dtPrintResult.DefaultView[0]["Tenant_number_base"].ToString().Trim().Length != 0) { Tenant_basement += (dtPrintResult.DefaultView[0]["Tenant_number_base"].ToString().Trim().Length == 0 ? "" : " № " + dtPrintResult.DefaultView[0]["Tenant_number_base"].ToString()); } if (dtPrintResult.DefaultView[0]["Tenant_date_base"].ToString().Trim().Length != 0) { Tenant_basement += " от " + (dtPrintResult.DefaultView[0]["Tenant_date_base"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_date_base"].ToString()); } if (Tenant_basement != ",") { Tenant_basement += ","; } // ------------- string arendodatel_str = Landlord_type_full + " " + Landlord_name; string arendodatel_str_full = "в лице " + Landlord_post + " " + Landlord_FIO + Landlord_basement + " именуемое в дальнейшем «Арендодатель», и "; string arendator_str = Tenant_type_full + " " + Tenant_name; string arendator_str_full = "в лице " + Tenant_post + " " + Tenant_FIO + Tenant_basement + " именуемое в дальнейшем «Арендатор», составили настоящий Акт о нижеследующем:"; string punkt1 = "1. Во исполнении Договора аренды объекта нежилого фонда, расположенного по адресу: " + object_address + ", № " + number + " от " + date_con + ", заключенного между " + Landlord_type + " " + Landlord_name + " («Арендодатель») и " + Tenant_type + " " + Tenant_name + " («Арендатор»), " + Tenant_type + " " + Tenant_name + " произвело перед подписанием настоящего Акта возврата объекта нежилого фонда, расположенного по адресу: " + object_address + ", сек. №" + section + " (" + floors + ") общей площадью " + object_area + " кв.м., именуемое далее «Объект»."; string count_lamps = " - Имущества: светильники в кол-ве " + (dtPrintResult.DefaultView[0]["lamps_count"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["lamps_count"].ToString()) + " шт."; string count_phone = " - Телефонные линии в количестве " + (dtPrintResult.DefaultView[0]["tel_count"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["tel_count"].ToString()) + " шт."; string FIO_arendodatel = (dtPrintResult.DefaultView[0]["Landlord_FIO2"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Landlord_FIO2"].ToString()); string FIO_arendator = (dtPrintResult.DefaultView[0]["Tenant_FIO2"].ToString().Trim().Length == 0 ? " - " : dtPrintResult.DefaultView[0]["Tenant_FIO2"].ToString()); rptReport.DataDefinition.FormulaFields["adress"].Text = "\"" + RQuotes(object_address) + "\""; //rptReport.DataDefinition.FormulaFields["num"].Text = "\"" + RQuotes(num) + "\""; rptReport.DataDefinition.FormulaFields["date_act"].Text = "\"" + RQuotes(date_act) + "\""; rptReport.DataDefinition.FormulaFields["arendodatel_str"].Text = "\"" + RQuotes(arendodatel_str) + "\""; rptReport.DataDefinition.FormulaFields["arendodatel_str_full"].Text = "\"" + RQuotes(arendodatel_str_full) + "\""; rptReport.DataDefinition.FormulaFields["arendator_str"].Text = "\"" + RQuotes(arendator_str) + "\""; rptReport.DataDefinition.FormulaFields["arendator_str_full"].Text = "\"" + RQuotes(arendator_str_full) + "\""; rptReport.DataDefinition.FormulaFields["punkt1"].Text = "\"" + RQuotes(punkt1) + "\""; rptReport.DataDefinition.FormulaFields["count_lamps"].Text = "\"" + RQuotes(count_lamps) + "\""; rptReport.DataDefinition.FormulaFields["count_phone"].Text = "\"" + RQuotes(count_phone) + "\""; rptReport.DataDefinition.FormulaFields["FIO_arendator"].Text = "\"" + RQuotes(FIO_arendator) + "\""; rptReport.DataDefinition.FormulaFields["FIO_arendodatel"].Text = "\"" + RQuotes(FIO_arendodatel) + "\""; //rptReport.DataDefinition.FormulaFields["date"].Text = "\"" + "Дата: " + DateTime.Parse(dtHead.Rows[0]["date"].ToString()).ToString("dd.MM.yyyy") + "\""; //rptReport.DataDefinition.FormulaFields["credit"].Text = "\"" + dtHead.Rows[0]["credit"].ToString() + "\""; //rptReport.DataDefinition.FormulaFields["SummaCrPlan"].Text = "\"" + summaCrPlan.ToString("### ### ##0.00") + "\""; //rptReport.DataDefinition.FormulaFields["SummaCrFact"].Text = "\"" + summaCrFact.ToString("### ### ##0.00") + "\""; crystalReportViewer1.ReportSource = rptReport; crystalReportViewer1.Refresh(); } }