コード例 #1
0
def build_transaction(transaction):
    transaction_id = str(transaction["id"])
    transaction_date = transaction["transaction_date"].isoformat()
    transaction_value = transaction["transaction_value"]
    transaction_description = transaction["transaction_description"]

    trt = transaction["transaction_type"]
    if trt == "D": trtval = "D"
    if trt == "C": trtval = "C"
    tt = codelists("TransactionType")
    transaction_type = tt[trtval]

    t = et.Element("transaction")
    t.set("ref", transaction_id)

    t.append(el_with_code("transaction-type", transaction_type))

    tdate = et.Element("transaction-date")
    t.append(tdate)
    tdate.set("iso-date", transaction_date)

    tvalue = et.Element("value")
    t.append(tvalue)
    tvalue.text = unicode(transaction_value)
    tvalue.set("value-date", transaction_date)

    if transaction_description:
        t.append(el_with_narrative("description", transaction_description))

    return t
コード例 #2
0
ファイル: generate.py プロジェクト: markbrough/maedi-projects
def build_transaction(transaction):
    transaction_id = str(transaction["id"])
    transaction_date = transaction["transaction_date"].isoformat()
    transaction_value = transaction["transaction_value"]
    transaction_description = transaction["transaction_description"]

    trt = transaction["transaction_type"]
    if trt == "D":
        trtval = "D"
    if trt == "C":
        trtval = "C"
    tt = codelists("TransactionType")
    transaction_type = tt[trtval]

    t = et.Element("transaction")
    t.set("ref", transaction_id)

    t.append(el_with_code("transaction-type", transaction_type))

    tdate = et.Element("transaction-date")
    t.append(tdate)
    tdate.set("iso-date", transaction_date)

    tvalue = et.Element("value")
    t.append(tvalue)
    tvalue.text = unicode(transaction_value)
    tvalue.set("value-date", transaction_date)

    if transaction_description:
        t.append(el_with_narrative("description", transaction_description))

    return t
コード例 #3
0
def el_date(start_end, iso_date):
    adt = codelists("ActivityDateType")

    actual_planned = actual_or_planned(iso_date)
    date_type = adt[start_end][actual_or_planned(iso_date)]

    el = et.Element('activity-date')
    el.set("type", date_type)
    el.set("iso-date", iso_date)
    return el
コード例 #4
0
ファイル: generate.py プロジェクト: markbrough/maedi-projects
def el_date(start_end, iso_date):
    adt = codelists("ActivityDateType")

    actual_planned = actual_or_planned(iso_date)
    date_type = adt[start_end][actual_or_planned(iso_date)]

    el = et.Element("activity-date")
    el.set("type", date_type)
    el.set("iso-date", iso_date)
    return el
コード例 #5
0
def el_org_103(role, o_name, o_ref=None, o_type=None):
    if role == "reporting":
        el = et.Element("reporting-org")
    else:
        r = codelists("OrganisationRole")
        el = et.Element("participating-org")
        el.set("role", role)
    if o_ref: el.set("ref", o_ref)
    if o_type: el.set("type", o_type)
    el.text = o_name
    return el
コード例 #6
0
def el_org(role, o_name, o_ref=None, o_type=None):
    if role == "reporting":
        el = et.Element("reporting-org")
    else:
        r = codelists("OrganisationRole")
        el = et.Element("participating-org")
        el.set("role", r[role])
    if o_ref: el.set("ref", o_ref)
    if o_type: el.set("type", o_type)
    el_nar = et.Element("narrative")
    el.append(el_nar)
    el_nar.text = o_name
    return el
コード例 #7
0
ファイル: generate.py プロジェクト: markbrough/maedi-projects
def el_org_103(role, o_name, o_ref=None, o_type=None):
    if role == "reporting":
        el = et.Element("reporting-org")
    else:
        r = codelists("OrganisationRole")
        el = et.Element("participating-org")
        el.set("role", role)
    if o_ref:
        el.set("ref", o_ref)
    if o_type:
        el.set("type", o_type)
    el.text = o_name
    return el
コード例 #8
0
ファイル: generate.py プロジェクト: markbrough/maedi-projects
def el_org(role, o_name, o_ref=None, o_type=None):
    if role == "reporting":
        el = et.Element("reporting-org")
    else:
        r = codelists("OrganisationRole")
        el = et.Element("participating-org")
        el.set("role", r[role])
    if o_ref:
        el.set("ref", o_ref)
    if o_type:
        el.set("type", o_type)
    el_nar = et.Element("narrative")
    el.append(el_nar)
    el_nar.text = o_name
    return el