using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;
namespace FastReport
{
public class ReportScript
{
private void Page1_StartPage(object sender, EventArgs e)
{
bool isGyermekJoleti;
Boolean.TryParse(Report.Parameters.FindByName("isGyermekJoleti").Value.ToString(), out isGyermekJoleti);
if (isGyermekJoleti)
{
Text5.Text = "Gyermekjóléti szolgálat";
}
else
{
Text5.Text = "Gyermekvédelmi szolgálat";
}
string tagintezmenyCim = (string)Report.GetParameterValue("TagintezmenyCim");
if(!string.IsNullOrWhiteSpace(tagintezmenyCim))
{
Text25.Text = tagintezmenyCim + Environment.NewLine + "[Kelt]";
}
string alulirottMegnevezese = Report.Parameters.FindByName("AlulirottMegnevezese").Value.ToString();
int index = alulirottMegnevezese.IndexOf(" - ");
Text26.Text = alulirottMegnevezese.Substring(0, index).Trim();
Text27.Text = alulirottMegnevezese.Substring(index + " - ".Length).Trim();
// Főtábla: MulasztasokFej
DataSourceBase masterData = Data1.DataSource;
// Fő tábla inicializálása
masterData.Init();
// Gyerek tábla: gondviselők
DataSourceBase rowData = Report.GetDataSource("GondviseloAdatok");
Data3.DataSource = rowData;
// Gyerek tábla inicializálása
rowData.Init();
// Kacsolat beállítása a fő és a gyerek tábla között
Relation rel = new Relation();
rel.Name = "Tanulo_Gondviselo";
rel.ParentDataSource = masterData;
rel.ChildDataSource = rowData;
rel.ParentColumns = new string[] { "TanuloId" };
rel.ChildColumns = new string[] { "TanuloId" };
Report.Dictionary.Relations.Add(rel);
}
private void Table4_BeforePrint(object sender, EventArgs e)
{
int hozottIgazolatlan = (int)Report.GetColumnValue("MulasztasFej.HozottIgazolatlan");
int hozottIgazolatlanKeses = (int)Report.GetColumnValue("MulasztasFej.HozottIgazolatlanKeses");
if ((hozottIgazolatlan == 0) && (hozottIgazolatlanKeses == 0))
{
Row12.Visible = false;
DataHeader1.Height = 75.6f;
}
else
{
Row12.Visible = true;
DataHeader1.Height = 103.95f;
}
}
}
}