Index: pykota/trunk/bin/pkinvoice
===================================================================
--- pykota/trunk/bin/pkinvoice (revision 2660)
+++ pykota/trunk/bin/pkinvoice (revision 2661)
@@ -48,4 +48,15 @@
   -g | --groups        Generate invoices for users groups instead of users.
   
+  -l | --logo img      Use the image as the banner's logo. The logo will
+                       be drawn at the center top of the page. The default
+                       logo is /usr/share/pykota/logos/pykota.jpeg
+                       
+  -p | --pagesize sz   Sets sz as the page size. Most well known
+                       page sizes are recognized, like 'A4' or 'Letter'
+                       to name a few. The default size is A4.
+                       
+  -n | --number N      Sets the number of the first invoice. This number
+                       will automatically be incremented for each invoice.
+                       
   -r | --reference v   Uses v as the initial reference value : an invoice
                        will be generated for any account balance's value
@@ -87,7 +98,29 @@
             raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))
         
-        self.display("%s...\n" % _("Processing"))
+        try :    
+            vat = float(options["vat"])
+            if not (0.0 <= vat < 100.0) :
+                raise ValueError
+        except :    
+            raise PyKotaCommandLineError, _("Incorrect value '%s' for the --vat command line option") % options["vat"]
+            
+        try :    
+            reference = float(options["reference"])
+        except :    
+            raise PyKotaCommandLineError, _("Incorrect value '%s' for the --reference command line option") % options["reference"]
+            
+        try :    
+            number = float(options["number"])
+            if number <= 0 :
+                raise ValueError
+        except :    
+            raise PyKotaCommandLineError, _("Incorrect value '%s' for the --number command line option") % options["number"]
+            
         if not names :
             names = [ "*" ]
+            
+        outfname = options["output"]    
+        if outfname != "-" :
+            self.display("%s...\n" % _("Processing"))
             
         suffix = (options["groups"] and "Group") or "User"        
@@ -98,7 +131,9 @@
             # TODO 
             percent = 100.0 * float(i) / float(nbtotal)
-            self.display("\r%.02f%%" % percent)
-        self.display("\r100.00%%\r        ")
-        self.display("\r%s\n" % _("Done."))
+            if outfname != "-" :
+                self.display("\r%.02f%%" % percent)
+        if outfname != "-" :        
+            self.display("\r100.00%%\r        ")
+            self.display("\r%s\n" % _("Done."))
                      
 if __name__ == "__main__" : 
@@ -109,9 +144,12 @@
                      "unit" : _("Credits"),
                      "output" : "-",
+                     "pagesize" : "a4", \
+                     "logo" : "/usr/share/pykota/logos/pykota.jpeg",
+                     "number" : "1",
                    }
-        short_options = "vho:gr:u:V:"
+        short_options = "vho:gr:u:V:p:l:"
         long_options = ["help", "version", \
                         "groups", "reference=", "unit=", "output=", \
-                        "vat=", ]
+                        "pagesize=", "logo=", "vat=", "number="]
         
         # Initializes the command line tool
@@ -131,4 +169,9 @@
         options["unit"] = options["u"] or options["unit"] or defaults["unit"]
         options["output"] = options["o"] or options["output"] or defaults["output"]
+        options["pagesize"] = options["p"] or options["pagesize"] or defaults["pagesize"]
+        options["number"] = options["n"] or options["number"] or defaults["number"]
+        options["logo"] = options["l"] or options["logo"]
+        if options["logo"] is None : # Allows --logo="" to disable the logo entirely
+            options["logo"] = defaults["logo"]  
         
         if options["help"] :
