Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-ubl
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-ubl
Commits
f0e4c9fa
Commit
f0e4c9fa
authored
Nov 18, 2007
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial Import
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
199 additions
and
0 deletions
+199
-0
intranet-ubl.info
intranet-ubl.info
+26
-0
invoice.xml.tcl
www/invoice.xml.tcl
+173
-0
No files found.
intranet-ubl.info
0 → 100644
View file @
f0e4c9fa
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package
key=
"intranet-ubl"
url=
"http://openacs.org/repository/apm/packages/intranet-ubl"
type=
"apm_application"
>
<package-name>
]project-open[ Universal Business Language XML Interface
</package-name>
<pretty-plural>
]project-open[ Universal Business Language XML Interface
</pretty-plural>
<initial-install-p>
f
</initial-install-p>
<singleton-p>
t
</singleton-p>
<auto-mount>
intranet-ubl
</auto-mount>
<version
name=
"3.3.1.1"
url=
"http://openacs.org/repository/download/apm/intranet-ubl-3.3.1.1.apm"
>
<owner
url=
"mailto:frank.bergmann@project-open.com"
>
Frank Bergmann
</owner>
<summary>
Includes export functionality from ]po[ financial documents to the Oasis UBL Universal Business Language XML format
</summary>
<vendor
url=
"http://www.project-open.com/"
>
]project-open[
</vendor>
<description
format=
"text/plain"
>
Includes export functionality from ]po[ financial documents to the Oasis UBL Universal Business Language XML format
</description>
<!-- No dependency information -->
<callbacks>
</callbacks>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
www/invoice.xml.tcl
0 → 100755
View file @
f0e4c9fa
# /packages/intranet-ubl/www/invoice.xml.tcl
#
# Copyright (c
)
2003-2007 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
# ---------------------------------------------------------------
# Page Contract
# ---------------------------------------------------------------
ad_page_contract
{
Creates a UBL Universal Business Language XML structure for a financial document
@author frank.bergmann@project-open.com
}
{
{
invoice_id:integer 90763
}
}
# ---------------------------------------------------------------
# Defaults & Security
# ---------------------------------------------------------------
set
user_id
[
ad_maybe_redirect_for_registration
]
set
today
[
db_string today
"select to_char(now(), 'YYYY-MM-DD')"
]
# ---------------------------------------------------------------
# Get information about the financial document ("invoice"
)
# ---------------------------------------------------------------
if
{
!
[
db_0or1row project_info
"
select c.*,
i.*,
o.creation_date as issue_date,
cust.company_name as customer_name,
ocust.address_line1 as customer_address_line1,
ocust.address_line2 as customer_address_line2,
ocust.address_city as customer_address_city,
ocust.address_state as customer_address_state,
ocust.address_postal_code as customer_address_postal_code,
ocust.address_country_code as customer_address_country_code,
prov.company_name as provider_name,
oprov.address_line1 as provider_address_line1,
oprov.address_line2 as provider_address_line2,
oprov.address_city as provider_address_city,
oprov.address_state as provider_address_state,
oprov.address_postal_code as provider_address_postal_code,
oprov.address_country_code as provider_address_country_code,
im_name_from_user_id(i.company_contact_id) as customer_contact_name,
cust_contact.work_phone as customer_contact_work_phone,
im_name_from_user_id(i.company_contact_id) as provider_contact_name,
prov_contact.work_phone as provider_contact_work_phone,
paymeth.category_description as payment_method_desc
from
im_costs c,
im_invoices i
LEFT OUTER JOIN im_categories paymeth ON (i.payment_method_id = paymeth.category_id),
acs_objects o,
im_companies cust,
im_companies prov,
im_offices ocust,
im_offices oprov,
users_contact cust_contact,
users_contact prov_contact
where
i.invoice_id = :invoice_id
and i.invoice_id = c.cost_id
and i.invoice_id = o.object_id
and c.customer_id = cust.company_id
and c.provider_id = prov.company_id
and ocust.office_id = i.invoice_office_id
and oprov.office_id = prov.main_office_id
and i.company_contact_id = cust_contact.user_id
and prov.accounting_contact_id = prov_contact.user_id
"
]}
{
ad_return_complaint 1
[
lang::message::lookup
""
intranet-ubl.Financial_Document_Not_Found
"Didn't find financial document
\#
%project_id%"
]
return
}
set
invoice_url
"/intranet-invoices/view?invoice_id=
$invoice
_id"
# ---------------------------------------------------------------
# Create the XML
# ---------------------------------------------------------------
set
version
"1.12"
set
view_index 0
# ---------------------------------------------------------------
# Main Document Node
set
doc
[
dom createDocument invoice
]
set
main_node
[
$doc
documentElement
]
$main
_node setAttribute xmlns:cbc
"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-1.0"
$main
_node setAttribute xmlns:cac
"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0"
$main
_node setAttribute xmlns:cur
"urn:oasis:names:specification:ubl:schema:xsd:CurrencyCode-1.0"
$main
_node setAttribute xmlns:xsi
"http://www.w3.org/2001/XMLSchema-instance"
$main
_node setAttribute xmlns
"urn:oasis:names:specification:ubl:schema:xsd:Invoice-1.0"
$main
_node setAttribute xsi:schemaLocation
"urn:oasis:names:specification:ubl:schema:xsd:Invoice-1.0 ../../xsd/maindoc/UBL-Invoice-1.0.xsd"
$main
_node appendXML
"<ID>
$cost
_id</ID>"
$main
_node appendXML
"<cbc:IssueDate>
$issue
_date</cbc:IssueDate>"
$main
_node appendXML
"<TaxPointDate>
$issue
_date</TaxPointDate>"
$main
_node appendXML
"
<cac:OrderReference>
<cac:BuyersID>
$customer
_id</cac:BuyersID>
<cac:SellersID>
$provider
_id</cac:SellersID>
<cbc:IssueDate>
$issue
_date</cbc:IssueDate>
</cac:OrderReference>"
$main
_node appendXML
"
<cac:BuyerParty>
<cac:Party>
<cac:PartyName>
<cbc:Name>
$customer
_name</cbc:Name>
</cac:PartyName>
<cac:Address>
<cbc:StreetName>
$customer
_address_line1
$customer
_address_line2</cbc:StreetName>
<cbc:CityName>
$customer
_address_city</cbc:CityName>
<cbc:PostalZone>
$customer
_address_postal_code</cbc:PostalZone>
<cac:CountrySubentityCode>
$customer
_address_state</cac:CountrySubentityCode>
</cac:Address>
</cac:Party>
<cac:AccountsContact>
<cbc:Name>
$customer
_contact_name</cbc:Name>
<cbc:Telephone>
$customer
_contact_work_phone</cbc:Telephone>
</cac:AccountsContact>
</cac:BuyerParty>
"
$main
_node appendXML
"
<cac:SellerParty>
<cac:Party>
<cac:PartyName>
<cbc:Name>
$provider
_name</cbc:Name>
</cac:PartyName>
<cac:Address>
<cbc:StreetName>
$provider
_address_line1
$provider
_address_line2</cbc:StreetName>
<cbc:CityName>
$provider
_address_city</cbc:CityName>
<cbc:PostalZone>
$provider
_address_postal_code</cbc:PostalZone>
<cac:CountrySubentityCode>
$provider
_address_state</cac:CountrySubentityCode>
</cac:Address>
</cac:Party>
<cac:AccountsContact>
<cbc:Name>
$provider
_contact_name</cbc:Name>
<cbc:Telephone>
$provider
_contact_work_phone</cbc:Telephone>
</cac:AccountsContact>
</cac:SellerParty>
"
$main
_node appendXML
"
<cac:PaymentTerms>
<cbc:Note>
$payment
_method_desc</cbc:Note>
<cac:ReferenceEventCode>!</cac:ReferenceEventCode>
</cac:PaymentTerms>
"
ns_return 200 text/xxx
[
$doc
asXML -indent 2 -escapeNonASCII
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment