Suivez et participez au développement du nouvel OpenCellar : PLOC.co
Home Page
 
Français  English  
Open Cellar Home Edition - 1.2 - Windows 98, Me, 2000, XP and Vista. The free Windows wine cellar management software. Open Cellar Mobile Edition - Beta 2 (French version) - Pocket PC. The free Pocket PC wine cellar management software. Open Cellar Cross Platform - Beta 1 (French version) - Mac OSX and Linux. The free MacOS/Linux wine cellar management software. My Open Cellar Open Cellar Forums Place des vins
Search: Welcome (connect - create an account )
Page settings

Nuage de tags
Imprimer la liste des producteurs
Le script suivant imprime la liste des producteurs
Pour l'éxécuter allez dans le menu "Préférences" -> "Editeurs de scripts"

if(App.ActiveCellar == null)
{
   MessageBox.Show("Aucune cave n'est ouverte");
   return;
}

App.Animate(AnimationType.Work, true);
App.SetCursor(true);


// Modifiez ici le titre du report
string reportName = "Liste des producteurs";

// Creation entete report
ReportTable rt = new ReportTable(reportName);

// Producteur
ReportColumn rcProducer = rt.NewColumn("Producteur");
rcProducer.Size = 200;

// Adresse 1
ReportColumn rcAddress1 = rt.NewColumn("Adresse");
rcAddress1.Size = 160;

// Zip
ReportColumn rcZip = rt.NewColumn("CP");
rcZip.Size = 60;

// Ville
ReportColumn rcCity = rt.NewColumn("Ville");
rcCity.Size = 120;

// Tel
ReportColumn rcPhone = rt.NewColumn("Tél");
rcPhone.Size = 90;

// Fax
ReportColumn rcFax = rt.NewColumn("Fax");
rcFax.Size = 90;


//
// Alimentation de la source
//
ObjectCollection owners = App.ActiveCellar.GetCollection((ushort)ObjectType.Owner);

for (int i = 0; i < owners.Count; i++)
{
	Owner owner = (Owner)owners[i];

	ReportRow row = rt.NewRow();

	row[0] = owner.Name.Trim();
	row[1] = owner.Address1.Trim() + " " + owner.Address2.Trim();
	row[2] = owner.ZipCode.Trim();
	row[3] = owner.City.Trim();
	row[4] = owner.Phone.Trim();
	row[5] = owner.Fax.Trim();

}


//
// Génération
//
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(rt);

IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid);

string destFileName = App.Path + "Cache\\InOut.pdf";
bool success = false;
try
{
	report.Create(list, destFileName);
	success = true;
}
catch(Exception ex)
{
	MessageBox.Show("Erreur (1)" + ex.ToString());
}

//
// Affichage du report
//
if(success)
{
	IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null);
	if(shellWindow != null)
	{
		shellWindow.Start(destFileName);
	}
}

App.SetCursor(false);
App.StopAnimate();

© 2006-2014 Matthieu DUCROCQ  Open Cellar official blog - All rights reserved - Last update: january 2014 | twitter