예제 #1
0
def _make_payment_row(mop_cols, _, row):
    mop = row.get('mode_of_payment')
    amount = row.get('amount')

    for mop_col in mop_cols:
        mop_key = mop_col.replace(" ", "_").lower()
        if mop == mop_col:
            _[mop_key] = _[mop_key] + amount
            break

    if not _.get('invoice'):
        _['invoice'] = row.get('invoice')
    if not _.get('change'):
        _['change'] = row.get('change_amount')
    if not _.get('posting_date'):
        _['posting_date'] = row.get('posting_date')
    if not _.get('posting_time'):
        _['posting_time'] = row.get('posting_time')
    if not _.get('customer'):
        _['customer'] = row.get('customer')
    if not _.get('customer_name'):
        _['customer_name'] = row.get('customer_name')
    if not _.get('mobile_no'):
        _['mobile_no'] = row.get('mobile_no')

    return _
예제 #2
0
def _sum_timesheets(_, timesheet):
    compute_fields = [
        'normal_hours', 'ot1_hours', 'ot2_hours', 'normal_cost', 'ot1', 'ot2',
        'absent_hours', 'absent'
    ]

    if timesheet.status == 'Absent':
        timesheet['normal_hours'] = 0
        timesheet['absent_hours'] = 8
        timesheet['absent'] = 8 * timesheet.get('hourly_cost')

    for field in compute_fields:
        timesheet_value = timesheet.get(field) or 0
        _[field] = _.get(field) + timesheet_value

    return _