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
Modifier un rapport pour ne prendre que les vins en stock ...
11/09/2009
Reply
Modifier un rapport pour ne prendre que les vins en stock ...
fidol
1 posts
Bonjour,
Je tente désespéremment de modifier un rapport créé avec l'assistant pour ne prendre en compte que les vins dont la quantité de bouteilles est différente de 0. En vain !
Merci de me dire ce que je n'ai pas compris !!
Voici le script généré par l'assistant de la version 1.2 PC Windows :
// Script généré automatiquement le 10/09/2009 14:10
// Ma Cave Perso V2
if(App.ActiveCellar == null) {
return;
}
GridReportWrapper grw = new GridReportWrapper(App);
IWindow window = App.GetWindow(WindowType.WineList);
window.Show();
grw.SelectedWindow = window;
if(grw.SelectedWindow == null) {
return;
}
grw.Name = "Ma Cave Perso V2";
GridColumnPref pref0 = new GridColumnPref("Nom", 24);
grw.SelectedColumns.Add(pref0);
GridColumnPref pref1 = new GridColumnPref("Année", 4);
grw.SelectedColumns.Add(pref1);
GridColumnPref pref2 = new GridColumnPref("Bouteilles", 3);
grw.SelectedColumns.Add(pref2);
GridColumnPref pref3 = new GridColumnPref("Classement", 6);
grw.SelectedColumns.Add(pref3);
GridColumnPref pref4 = new GridColumnPref("Cuvée", 5);
grw.SelectedColumns.Add(pref4);
GridColumnPref pref5 = new GridColumnPref("Couleur", 5);
grw.SelectedColumns.Add(pref5);
GridColumnPref pref6 = new GridColumnPref("Format", 4);
grw.SelectedColumns.Add(pref6);
GridColumnPref pref7 = new GridColumnPref("Emplacements", 41);
grw.SelectedColumns.Add(pref7);
GridColumnPref pref8 = new GridColumnPref("Apogée de", 4);
grw.SelectedColumns.Add(pref8);
GridColumnPref pref9 = new GridColumnPref("Apogée à", 4);
grw.SelectedColumns.Add(pref9);
grw.SortBy = "Nom";
grw.GroupBy = "";
ReportTable rt = grw.GenerateReport();
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(rt);
IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid);
string destFileName = Utility.GetUniqueFileName(App.Path + "Cache\\", "GRW", null);
bool success = false;
try
{
report.Create(list, destFileName);
success = true;
}
catch(Exception ex)
{
EventLog.Write(ex);
App.ShowMessage(App.GetResourceString(LanguageConstants.DEFAULT_MSG_CAPTION),
App.GetResourceString(LanguageConstants.MSG_REPORT_ERROR),
System.Windows.Forms.MessageBoxIcon.Error,
System.Windows.Forms.MessageBoxButtons.OK);
}
if(success)
{
IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null);
if(shellWindow != null)
{
shellWindow.Start(destFileName);
}
}
11/09/2009
Reply
Re : Modifier un rapport pour ne prendre que les vins en stock ...
Administrateur
3099 posts
Bonjour,
Le script généré par l'assistant imprime la liste des vins qui sont présents sur cette grille.
Si vous ne l'avez pas ouvert avant l'execution il prendra par tous les les vins.
Voici une version modifiée qui vous imprimera uniquement les vins en stock:
if(App.ActiveCellar == null) { return; } IWineListWindow listWindow = (IWineListWindow)App.GetWindow(WindowType.WineList); if(listWindow != null) { BindingList theList = new BindingList(); ObjectCollection oc = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < oc.Count; i++) { Wine w = (Wine)oc[i]; if((!w.ManualManagement) && (w.RackItems.Count == 0)) { continue; } if((w.ManualManagement) && (w.Bottles == 0)) { continue; } theList.Add(w); } listWindow.Wines = theList; listWindow.Show(); } GridReportWrapper grw = new GridReportWrapper(App); IWindow window = App.GetWindow(WindowType.WineList); window.Show(); grw.SelectedWindow = window; if(grw.SelectedWindow == null) { return; } grw.Name = "Ma Cave Perso V2"; GridColumnPref pref0 = new GridColumnPref("Nom", 24); grw.SelectedColumns.Add(pref0); GridColumnPref pref1 = new GridColumnPref("Année", 4); grw.SelectedColumns.Add(pref1); GridColumnPref pref2 = new GridColumnPref("Bouteilles", 3); grw.SelectedColumns.Add(pref2); GridColumnPref pref3 = new GridColumnPref("Classement", 6); grw.SelectedColumns.Add(pref3); GridColumnPref pref4 = new GridColumnPref("Cuvée", 5); grw.SelectedColumns.Add(pref4); GridColumnPref pref5 = new GridColumnPref("Couleur", 5); grw.SelectedColumns.Add(pref5); GridColumnPref pref6 = new GridColumnPref("Format", 4); grw.SelectedColumns.Add(pref6); GridColumnPref pref7 = new GridColumnPref("Emplacements", 41); grw.SelectedColumns.Add(pref7); GridColumnPref pref8 = new GridColumnPref("Apogée de", 4); grw.SelectedColumns.Add(pref8); GridColumnPref pref9 = new GridColumnPref("Apogée à", 4); grw.SelectedColumns.Add(pref9); grw.SortBy = "Nom"; grw.GroupBy = ""; ReportTable rt = grw.GenerateReport(); System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(rt); IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid); string destFileName = Utility.GetUniqueFileName(App.Path + "Cache\\", "GRW", null); bool success = false; try { report.Create(list, destFileName); success = true; } catch(Exception ex) { EventLog.Write(ex); App.ShowMessage(App.GetResourceString(LanguageConstants.DEFAULT_MSG_CAPTION), App.GetResourceString(LanguageConstants.MSG_REPORT_ERROR), System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxButtons.OK); } if(success) { IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null); if(shellWindow != null) { shellWindow.Start(destFileName); } }
Matthieu
© 2006-2014
Matthieu DUCROCQ
- All rights reserved - Last update: january 2014 |
|
Support Open Cellar
|
Contact
|
About