コード例 #1
0
ファイル: invoices.py プロジェクト: blippy/pypms
def enumerate_invoices(data):
    mans = data['ManualInvoices']

    job_codes = data['auto_invoices'].keys()
    job_codes.sort()
    autos = []
    for job in job_codes:
        inv = data['auto_invoices'][job]
        inv['JobCode'] = job
        inv['client'] = ''
        inv['irn'] = ''
        inv['desc'] = ''
        autos.append(inv)
    autos = filter(lambda x: x['net'] <> 0.0,  autos)

    the_invoices = mans + autos
    
    # augment vat rates
    jobs = data['jobs']
    for inv in the_invoices:
        job = jobs[inv['JobCode']]
        vatable = job['vatable']
        inv['vat_rate'] = tri(vatable, VAT, 0.0)
    
    net = common.summate(the_invoices, lambda x: x['net'])
    return the_invoices
コード例 #2
0
ファイル: recoveries.py プロジェクト: blippy/pypms
def create_recovery_text(job, camel_job_recoveries, db_job_recovery):
    job_code = job['job']
    wip = common.tri(job['WIP'], 'wip' , '') 
    weird = common.tri(job['Weird'], 'weird ', '')
    output = ['JOB %s %s %s' % (job_code, wip, weird)]    

    tweak_total = 0.0    
    for tweak in camel_job_recoveries:
        amount, comment = tweak
        tweak_total += amount
        output.append(line(amount, comment))
    output.append(line(tweak_total , 'TWEAK TOTAL'))

    output.append(line(db_job_recovery , 'PMS RECOVERY'))
    diff = tweak_total - db_job_recovery
    flag = common.tri(abs(diff) > 20.0, ' **** CHECK THIS', '')
    output.append(line(diff , 'DIFF' + flag))
    output += ['']
    return tweak_total, output