Suivez et participez au développement du nouvel OpenCellar : PLOC.co
> Open Cellar for Windows
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> Open Cellar for Mobile
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Open Cellar for Mac/Linux
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> My Account
> My Live services
> My pages
> My library
> My published wines
> My labels
> My posted messages
> Write a page
> Open Cellar Forum Index
> Windows Forum
> Mac/Linux Forum
> Mobile Forum
> Search for and import wines
> Search for labels
> Compare prices (Sniffer)
Search:
> Search with all engines
> Search in forums
> Search in personal pages
> Search on open-cellar.com
> Search in wine cards
> Search in labels
> Search in price comparison tool (Sniffer)
Welcome (
connect
-
create an account
)
Home
»
The forum
»
Open Cellar Home Edition (Windows)
Nuage de tags
Open Cellar
Scripts
Etiquette
PPP
Cellar book
Mac
Vista
Synchronisation
Excel export
vinoXml
usb
sniffer
backup
import
printing
chardonnet
palm
statistics
Linux
Imprimerla liste des emplacements
21/01/2009
Reply
Imprimerla liste des emplacements
Jean-Pierre VARNIER
189 posts
Bonjour Mathieu,
Le script suivant imprime la liste des emplacements en indiquant pour chacun l'espace occupé et l'espace total :
// // RackSpaceUsed // Mai 2007 // Ce script calcule le nombre de bouteille par emplacement // et l'espace occupé //Mathieu Ducrocq // if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave ouverte"); return; } App.Animate(AnimationType.Work, true); App.SetCursor(true); // // Modifiez ici le titre du report // string reportName = "Espace occupé"; // // Creation entete report // ReportTable rt = new ReportTable(reportName); // // Emplacement // ReportColumn rcRack = rt.NewColumn("Emplacement"); rcRack.Size = 350; // // Occupée // ReportColumn rcUsed = rt.NewColumn("Espace occupé"); rcUsed.Size = 90; rcUsed.ContentAlignment = ReportContentAlignment.Right; rcUsed.DataType = ReportColumnType.Numeric; // // Total // ReportColumn rcTotal = rt.NewColumn("Espace total"); rcTotal.Size = 90; rcTotal.ContentAlignment = ReportContentAlignment.Right; rcTotal.DataType = ReportColumnType.Numeric; // // Alimentation de la source // ObjectCollection racks = App.ActiveCellar.GetCollection((ushort)ObjectType.Rack); for (int i = 0; i < racks.Count; i++) { Rack rack = (Rack)racks[i]; ReportRow row = rt.NewRow(); row[0] = rack.Name.Trim(); int used = 0; int total = 0; for (byte rowZ = 0; rowZ < rack.Rows; rowZ++) { for(byte column = 0; column < rack.Columns; column++) { RackItem ri = rack.Get((byte)column, (byte)rowZ); if(ri != null){ total++; if(ri.Wine != null) { used++; } } } } row[1] = used.ToString(); row[2] = total.ToString(); } // // Tri des éléments // rt.Sort("2-0;1-0;0-0"); // // 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\\SpaceUsed.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(); // Fin
Comment le modifier pour ajouter l'espace occupé et l'espace total pour l'ensemble des emplacements.
Jean-Pierre
23/01/2009
Reply
Re : Imprimerla liste des emplacements
Administrateur
3099 posts
Bonjour bonjour
Voici le script modifié :
// // RackSpaceUsed // Mai 2007 // Ce script calcule le nombre de bouteille par emplacement // et l'espace occupé //Mathieu Ducrocq // if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave ouverte"); return; } App.Animate(AnimationType.Work, true); App.SetCursor(true); // // Modifiez ici le titre du report // string reportName = "Espace occupé"; // // Creation entete report // ReportTable rt = new ReportTable(reportName); // // Emplacement // ReportColumn rcRack = rt.NewColumn("Emplacement"); rcRack.Size = 350; // // Occupée // ReportColumn rcUsed = rt.NewColumn("Espace occupé"); rcUsed.Size = 90; rcUsed.ContentAlignment = ReportContentAlignment.Right; rcUsed.DataType = ReportColumnType.Numeric; // // Total // ReportColumn rcTotal = rt.NewColumn("Espace total"); rcTotal.Size = 90; rcTotal.ContentAlignment = ReportContentAlignment.Right; rcTotal.DataType = ReportColumnType.Numeric; // // Alimentation de la source // ObjectCollection racks = App.ActiveCellar.GetCollection((ushort)ObjectType.Rack); int __used = 0; int __total = 0; for (int i = 0; i < racks.Count; i++) { Rack rack = (Rack)racks[i]; ReportRow row = rt.NewRow(); row[0] = rack.Name.Trim(); int used = 0; int total = 0; for (byte rowZ = 0; rowZ < rack.Rows; rowZ++) { for(byte column = 0; column < rack.Columns; column++) { RackItem ri = rack.Get((byte)column, (byte)rowZ); if(ri != null){ total++; __total++; if(ri.Wine != null) { used++; __used++; } } } } row[1] = used.ToString(); row[2] = total.ToString(); } // // Tri des éléments // rt.Sort("2-0;1-0;0-0"); ReportRow row2 = rt.NewRow(); row2[0] = "Grand Total"; row2[1] = __used.ToString(); row2[2] = __total.ToString(); // // 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\\SpaceUsed.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(); // Fin
Matthieu
23/01/2009
Reply
Re : Imprimerla liste des emplacements
Jean-Pierre VARNIER
189 posts
Bonjour Mathieu,
Merci, le script fonctionne.
Jean-Pierre
© 2006-2014
Matthieu DUCROCQ
- All rights reserved - Last update: january 2014 |
|
Support Open Cellar
|
Contact
|
About