Show
Ignore:
Timestamp:
02/10/06 22:28:01 (19 years ago)
Author:
jerome
Message:

pkinvoice now basically works. TODO : PDF generation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkinvoice

    r2661 r2662  
    7373                       to your native language if it is supported by PyKota. 
    7474   
    75   -V | --vat p         Sets the percent value of the applicable VAT. 
    76                        The default is 0.0, meaning no VAT information 
    77                        will be included. 
     75  -V | --vat p         Sets the percent value of the applicable VAT to be 
     76                       exposed. The default is 0.0, meaning no VAT 
     77                       information will be included. 
    7878                        
    7979  user1 through userN and group1 through groupN can use wildcards if  
     
    8787  Will generate a PDF document containing invoices for all users whose 
    8888  account balance is below 15.0 credits. For each user the amount due 
    89   will be (15.0 - AccountBalance) EURO. No VAT information will be  
    90   included. 
     89  will be (15.0 - AccountBalance) EURO when that value is positive.  
     90  No VAT information will be included. 
    9191""")  
    9292         
     
    127127        entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names)) 
    128128        nbtotal = len(entries) 
    129         self.printInfo("Not implemented yet !", "warn") 
    130129        for i in range(nbtotal) : 
    131             # TODO  
    132             percent = 100.0 * float(i) / float(nbtotal) 
     130            entry = entries[i] 
     131            amount = reference - entry.AccountBalance 
     132            if amount > 0.0 : 
     133                # There's something due ! 
     134                ht = ((amount * 10000.0) / (100.0 + vat)) / 100.0 
     135                sys.stderr.write("%s => Due : %.2f including %.2f VAT\n" % (entry.Name, amount, amount-ht)) 
     136                 
    133137            if outfname != "-" : 
     138                percent = 100.0 * float(i) / float(nbtotal) 
    134139                self.display("\r%.02f%%" % percent) 
     140                 
    135141        if outfname != "-" :         
    136142            self.display("\r100.00%%\r        ") 
     
    142148        defaults = { "reference" : "0.0", 
    143149                     "vat" : "0.0", 
    144                      "unit" : _("Credits"), 
     150                     "unit" : N_("Credits"), 
    145151                     "output" : "-", 
    146152                     "pagesize" : "a4", \ 
     
    148154                     "number" : "1", 
    149155                   } 
    150         short_options = "vho:gr:u:V:p:l:" 
     156        short_options = "vho:gr:u:V:p:l:n:" 
    151157        long_options = ["help", "version", \ 
    152158                        "groups", "reference=", "unit=", "output=", \ 
     
    158164         
    159165        # parse and checks the command line 
    160         (options, args) = invoiceGenerator.parseCommandline(sys.argv[1:], short_options, long_options) 
     166        (options, args) = invoiceGenerator.parseCommandline(sys.argv[1:], short_options, long_options, allownothing=True) 
    161167         
    162168        # sets long options