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
Coordonnées dans l'emplacement sur le livre de cave
28/12/2007
Reply
Coordonnées dans l'emplacement sur le livre de cave
bugmenot314
6 posts
Bonjour,
Après avoir fait pas mal de recherches, je ne parviens pas à trouver comment imprimer les coordonnées d'une bouteille (A4 dans le casier 1 par exemple) sur le livre de cave.
Mon code actuel :
if(App.ActiveCellar == null)
{
MessageBox.Show("Aucune cave ouverte");
return;
}
App.SetCursor(true);
//
// Modifiez ici le titre du rapport
//
string reportName = "Liste des vins";
//
// Creation entete rapport
//
ReportTable rt = new ReportTable(reportName);
//
// Pays
//
//ReportColumn rcCountry = rt.NewColumn("Pays");
//rcCountry.Size = 60;
//
// Couleur
//
ReportColumn rcColor = rt.NewColumn("Couleur");
rcColor.Size = 50;
//
// Région
//
ReportColumn rcArea = rt.NewColumn("Region");
rcArea.Size = 100;
//
// Appellation
//
//ReportColumn rcApp = rt.NewColumn("Appellation");
//rcApp.Size = 130;
//
// Nom
//
ReportColumn rcName = rt.NewColumn("Nom");
rcName.Size = 215;
// Producteur
ReportColumn rcOwner = rt.NewColumn("Producteur");
rcOwner.Size = 150;
//
// Millésime
//
ReportColumn rcYear = rt.NewColumn("Mill.");
rcYear.Size = 35;
rcYear.ContentAlignment = ReportContentAlignment.Right;
rcYear.DataType = ReportColumnType.Numeric;
//
// Nombre de bouteilles
//
ReportColumn rcBottles = rt.NewColumn("Qte");
rcBottles.Size = 40;
rcBottles.ContentAlignment = ReportContentAlignment.Right;
rcBottles.DataType = ReportColumnType.Numeric;
// Format
//ReportColumn rcFormat = rt.NewColumn("Format");
//rcFormat.Size = 50;
//
// Localisation
//
ReportColumn rcLocalisation = rt.NewColumn("Empl.");
rcLocalisation.Size = 150;
// Create datasource
ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine);
for (int i = 0; i < wines.Count; i++)
{
Wine wine = (Wine)wines[i];
int qte = 0;
if(wine.ManualManagement)
{
qte = wine.Bottles;
}
else
{
qte = wine.RackItems.Count;
}
if(qte == 0)
{
continue;
}
ReportRow row = rt.NewRow();
//row[0] = wine.Country.Name;
row[0] = "Champagne";
if(wine.WineColor == ColorType.Red)
{
row[0] = "Rouge";
}
else if(wine.WineColor == ColorType.White)
{
row[0] = "Blanc";
}
else if(wine.WineColor == ColorType.Rosy)
{
row[0] = "Rosé";
}
else if(wine.WineColor == ColorType.Yellow)
{
row[0] = "Champagne";
}
else if(wine.WineColor == ColorType.LiqueurLike)
{
row[0] = "Liquoreux";
}
else if(wine.WineColor == ColorType.Misc)
{
row[0] = "Autre";
}
row[1] = wine.Area.Name;
//row[2] = wine.Appellation.Name;
row[2] = wine.Name;
row[3] = wine.Owner.Name;
if(wine.Year != 0)
{
row[4] = wine.Year.ToString();
}
row[5] = qte.ToString();
//row[7] = wine.BottleType.Name;
if(wine.ManualManagement)
{
//row[6] = wine.rack.Name.Trim();
System.Collections.Specialized.StringCollection racksList = new System.Collections.Specialized.StringCollection();
for (int counter = 0; counter < wine.RackItems.Count; counter++)
{
RackItem item = (RackItem)wine.RackItems[counter];
if(!racksList.Contains(item.Parent.Name.Trim()))
{
racksList.Add(item.Parent.Name.Trim());
}
}
for(int counter = 0; counter < racksList.Count; counter++){
row[6] += racksList[counter];
if((counter + 1) < racksList.Count) {
row[6]+= " - ";
}
}
}
}
// sort items
rt.Sort("0-0;1-0;2-0;3-0");
// GoOo
System.Collections.ArrayList list = new System.Collections.ArrayList();
list.Add(rt);
IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid);
string destFileName = App.Path + "Cache\\UserWinesGrid.pdf";
bool success = false;
try
{
report.Create(list, destFileName);
success = true;
}
catch(Exception ex)
{
MessageBox.Show("Error (1)");
}
// Show report
if(success)
{
IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null);
if(shellWindow != null)
{
shellWindow.Start(destFileName);
}
}
App.SetCursor(false);
App.StopAnimate();
Merci pour votre aide
29/12/2007
Reply
Re : Coordonnées dans l'emplacement sur le livre de cave
Administrateur
3099 posts
Bonjour,
Remplacez votre script par celui ci :
if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave ouverte"); return; } App.SetCursor(true); // // Modifiez ici le titre du rapport // string reportName = "Liste des vins"; // // Creation entete rapport // ReportTable rt = new ReportTable(reportName); // // Pays // //ReportColumn rcCountry = rt.NewColumn("Pays"); //rcCountry.Size = 60; // // Couleur // ReportColumn rcColor = rt.NewColumn("Couleur"); rcColor.Size = 50; // // Région // ReportColumn rcArea = rt.NewColumn("Region"); rcArea.Size = 100; // // Appellation // //ReportColumn rcApp = rt.NewColumn("Appellation"); //rcApp.Size = 130; // // Nom // ReportColumn rcName = rt.NewColumn("Nom"); rcName.Size = 215; // Producteur ReportColumn rcOwner = rt.NewColumn("Producteur"); rcOwner.Size = 150; // // Millésime // ReportColumn rcYear = rt.NewColumn("Mill."); rcYear.Size = 35; rcYear.ContentAlignment = ReportContentAlignment.Right; rcYear.DataType = ReportColumnType.Numeric; // // Nombre de bouteilles // ReportColumn rcBottles = rt.NewColumn("Qte"); rcBottles.Size = 40; rcBottles.ContentAlignment = ReportContentAlignment.Right; rcBottles.DataType = ReportColumnType.Numeric; // Format //ReportColumn rcFormat = rt.NewColumn("Format"); //rcFormat.Size = 50; // // Localisation // ReportColumn rcLocalisation = rt.NewColumn("Empl."); rcLocalisation.Size = 150; // Create datasource ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < wines.Count; i++) { Wine wine = (Wine)wines[i]; int qte = 0; if(wine.ManualManagement) { qte = wine.Bottles; } else { qte = wine.RackItems.Count; } if(qte == 0) { continue; } ReportRow row = rt.NewRow(); //row[0] = wine.Country.Name; row[0] = "Champagne"; if(wine.WineColor == ColorType.Red) { row[0] = "Rouge"; } else if(wine.WineColor == ColorType.White) { row[0] = "Blanc"; } else if(wine.WineColor == ColorType.Rosy) { row[0] = "Rosé"; } else if(wine.WineColor == ColorType.Yellow) { row[0] = "Champagne"; } else if(wine.WineColor == ColorType.LiqueurLike) { row[0] = "Liquoreux"; } else if(wine.WineColor == ColorType.Misc) { row[0] = "Autre"; } row[1] = wine.Area.Name; //row[2] = wine.Appellation.Name; row[2] = wine.Name; row[3] = wine.Owner.Name; if(wine.Year != 0) { row[4] = wine.Year.ToString(); } row[5] = qte.ToString(); row[6] = wine.Grid_RackItems; } // sort items rt.Sort("0-0;1-0;2-0;3-0"); // GoOo System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(rt); IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid); string destFileName = App.Path + "Cache\\UserWinesGrid.pdf"; bool success = false; try { report.Create(list, destFileName); success = true; } catch(Exception ex) { MessageBox.Show("Error (1)"); } // Show report if(success) { IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null); if(shellWindow != null) { shellWindow.Start(destFileName); } } App.SetCursor(false); App.StopAnimate();
Matthieu
29/12/2007
Reply
Re : Coordonnées dans l'emplacement sur le livre de cave
bugmenot314
6 posts
Génial.
Merci.
© 2006-2014
Matthieu DUCROCQ
- All rights reserved - Last update: january 2014 |
|
Support Open Cellar
|
Contact
|
About