Project

General

Profile

« Previous | Next » 

Revision 863f59f5

Added by Thomas Noël almost 12 years ago

b2: multiple batch in a B2 file

View differences:

calebasse/facturation/b2.py
122 122

  
123 123
    return invoice_lines
124 124

  
125
def b2(seq_id, batches):
126
    hc = batches[0].health_center
125
def b2(seq_id, hc, batches):
127 126
    to = hc.b2_000()
128 127
    total = sum(b.total for b in batches)
129 128
    first_batch = min(b.number for b in batches)
......
171 170
        nb_lines += 1
172 171
        nb_batches += 1
173 172

  
173
    if nb_lines > 990:
174
        # FIXME grouper les lots comme y fo pour que ca n'arrive jamais
175
        print "[FIXME] TROP DE LIGNES -- ", nb_lines
176
        raise
177

  
174 178
    end_999 = '999' +  TYPE_EMETTEUR + '00000' + NUMERO_EMETTEUR + \
175 179
            filler(6) + to + filler(6) + APPLICATION + \
176 180
            file_id + \
......
203 207
    print 'Facturation', invoicing.seq_id
204 208
    batches = build_batches(invoicing)
205 209
    for hc in batches:
206
        # XXX : pour l'instant, faire un fichier par batch...
210
        print 'pour', hc
207 211
        for b in batches[hc]:
208
            b2_filename, mail_filename = b2(invoicing.seq_id, [b])
209
            print '  B2    :', b2_filename
210
            print '  smime :', mail_filename
212
            print '  lot', b
213
        b2_filename, mail_filename = b2(invoicing.seq_id, hc, batches[hc])
214
        print '  B2    :', b2_filename
215
        print '  smime :', mail_filename
211 216

  
212 217

  

Also available in: Unified diff