Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-invoices
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-invoices
Commits
8251eb0d
Commit
8251eb0d
authored
Apr 05, 2004
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a project - invoice relationship
parent
61eabf30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
12 deletions
+173
-12
intranet-invoices-create.sql
sql/oracle/intranet-invoices-create.sql
+168
-3
intranet-invoices-drop.sql
sql/oracle/intranet-invoices-drop.sql
+1
-5
intranet-invoice-procs.tcl
tcl/intranet-invoice-procs.tcl
+2
-2
view.tcl
www/view.tcl
+2
-2
No files found.
sql/oracle/intranet-invoices-create.sql
View file @
8251eb0d
...
...
@@ -56,7 +56,9 @@ create sequence im_invoices_seq start with 1;
create
table
im_invoices
(
invoice_id
integer
constraint
im_invoices_pk
primary
key
,
primary
key
constraint
im_invoices_id_fk
references
acs_objects
,
-- who should pay?
customer_id
not
null
constraint
im_invoices_customer
...
...
@@ -87,7 +89,7 @@ create table im_invoices (
invoice_type_id
not
null
constraint
im_invoices_type
references
im_categories
,
payment_method_id
integer
payment_method_id
integer
constraint
im_invoices_payment
references
im_categories
,
payment_days
integer
,
...
...
@@ -101,6 +103,168 @@ create table im_invoices (
modified_ip_address
varchar
(
20
)
not
null
);
---------------------------------------------------------
-- Invoice Object
---------------------------------------------------------
-- Nothing spectactular, just to be able to use acs_rels
-- between projects and invoices and to add custom fields
-- later. We are not even going to use the permission
-- system right now.
begin
acs_object_type
.
create_type
(
supertype
=>
'acs_object'
,
object_type
=>
'im_invoice'
,
pretty_name
=>
'Invoice'
,
pretty_plural
=>
'Invoices'
,
table_name
=>
'im_invoices'
,
id_column
=>
'invoice_id'
,
package_name
=>
'im_invoice'
,
type_extension_table
=>
null
,
name_method
=>
'im_invoice.name'
);
end
;
/
show
errors
create
or
replace
package
im_invoice
is
function
new
(
invoice_id
in
integer
default
null
,
object_type
in
varchar
default
'im_invoice'
,
creation_date
in
date
default
sysdate
,
creation_user
in
integer
default
null
,
creation_ip
in
varchar
default
null
,
context_id
in
integer
default
null
,
invoice_nr
in
varchar
,
customer_id
in
integer
,
provider_id
in
integer
,
customer_contact_id
in
integer
default
null
,
invoice_date
in
date
default
sysdate
,
due_date
in
date
default
sysdate
+
30
,
invoice_currency
in
char
default
'EUR'
,
invoice_template_id
in
integer
default
null
,
invoice_status_id
in
integer
default
602
,
invoice_type_id
in
integer
default
700
,
payment_method_id
in
integer
default
null
,
payment_days
in
integer
default
30
,
vat
in
number
default
0
,
tax
in
number
default
0
,
note
in
varchar
default
null
)
return
im_invoices
.
invoice_id
%
TYPE
;
procedure
del
(
invoice_id
in
integer
);
function
name
(
invoice_id
in
integer
)
return
varchar
;
end
im_invoice
;
/
show
errors
create
or
replace
package
body
im_invoice
is
function
new
(
invoice_id
in
integer
default
null
,
object_type
in
varchar
default
'im_invoice'
,
creation_date
in
date
default
sysdate
,
creation_user
in
integer
default
null
,
creation_ip
in
varchar
default
null
,
context_id
in
integer
default
null
,
invoice_nr
in
varchar
,
customer_id
in
integer
,
provider_id
in
integer
,
customer_contact_id
in
integer
default
null
,
invoice_date
in
date
default
sysdate
,
due_date
in
date
default
sysdate
+
30
,
invoice_currency
in
char
default
'EUR'
,
invoice_template_id
in
integer
default
null
,
invoice_status_id
in
integer
default
602
,
invoice_type_id
in
integer
default
700
,
payment_method_id
in
integer
default
null
,
payment_days
in
integer
default
30
,
vat
in
number
default
0
,
tax
in
number
default
0
,
note
in
varchar
default
null
)
return
im_invoices
.
invoice_id
%
TYPE
is
v_invoice_id
im_invoices
.
invoice_id
%
TYPE
;
begin
v_invoice_id
:
=
acs_object
.
new
(
object_id
=>
invoice_id
,
object_type
=>
object_type
,
creation_date
=>
creation_date
,
creation_user
=>
creation_user
,
creation_ip
=>
creation_ip
,
context_id
=>
context_id
);
insert
into
im_invoices
(
invoice_id
,
customer_id
,
provider_id
,
customer_contact_id
,
invoice_nr
,
invoice_date
,
due_date
,
invoice_currency
,
invoice_template_id
,
invoice_status_id
,
invoice_type_id
,
payment_method_id
,
payment_days
,
vat
,
tax
,
note
,
creator_id
,
last_modified
,
last_modifying_user
,
modified_ip_address
)
values
(
v_invoice_id
,
new
.
customer_id
,
new
.
provider_id
,
new
.
customer_contact_id
,
new
.
invoice_nr
,
new
.
invoice_date
,
new
.
due_date
,
new
.
invoice_currency
,
new
.
invoice_template_id
,
new
.
invoice_status_id
,
new
.
invoice_type_id
,
new
.
payment_method_id
,
new
.
payment_days
,
new
.
vat
,
new
.
tax
,
new
.
note
,
new
.
creation_user
,
new
.
creation_date
,
new
.
creation_user
,
new
.
creation_ip
);
return
v_invoice_id
;
end
new
;
-- Delete a single invoice (if we know its ID...)
procedure
del
(
invoice_id
in
integer
)
is
begin
-- Erase the im_invoices item associated with the id
delete
from
im_invoices
where
invoice_id
=
del
.
invoice_id
;
-- Erase the object
acs_object
.
del
(
del
.
invoice_id
);
end
del
;
function
name
(
invoice_id
in
integer
)
return
varchar
is
v_name
varchar
(
40
);
begin
select
invoice_nr
into
v_name
from
im_invoices
where
invoice_id
=
name
.
invoice_id
;
return
v_name
;
end
name
;
end
im_invoice
;
/
show
errors
---------------------------------------------------------
-- Invoice Auditing
---------------------------------------------------------
-- Keep a trail of all changes
create
table
im_invoices_audit
(
invoice_id
integer
,
customer_id
integer
not
null
,
...
...
@@ -123,6 +287,7 @@ create table im_invoices_audit (
);
create
index
im_invoices_aud_id_idx
on
im_invoices_audit
(
invoice_id
);
create
or
replace
trigger
im_invoices_audit_tr
before
update
or
delete
on
im_invoices
for
each
row
...
...
@@ -538,7 +703,7 @@ begin
end
;
/
commit
;
-- Show the invoice component in project page
--
...
...
sql/oracle/intranet-invoices-drop.sql
View file @
8251eb0d
...
...
@@ -15,23 +15,19 @@ END;
/
commit
;
delete
from
acs_rels
r
where
r
.
object_id_two
in
(
select
invoice_id
from
im_invoices
;)
delete
from
acs_rels
r
where
r
.
object_id_two
in
(
select
invoice_id
from
im_invoices
);
delete
from
im_invoice_items
;
delete
from
im_invoices
;
delete
from
im_view_columns
where
view_id
>=
30
and
view_id
<=
39
;
delete
from
im_views
where
view_id
>=
30
and
view_id
<=
39
;
drop
sequence
im_prices_seq
;
drop
sequence
im_invoices_seq
;
drop
sequence
im_invoice_items_seq
;
drop
table
im_invoice_items
;
drop
table
im_invoices_audit
;
alter
table
im_trans_tasks
drop
column
invoice_id
;
drop
table
im_invoices
;
drop
table
im_prices
;
tcl/intranet-invoice-procs.tcl
View file @
8251eb0d
...
...
@@ -223,12 +223,12 @@ order by
incr ctr
}
if
{
""
!=
$customer
_id
}
{
if
{
""
!=
$customer
_id
&&
""
==
$project
_id
}
{
append invoice_html
"
<tr>
<td colspan=
$colspan
align=left>
<A href=/intranet-invoices/new?customer_id=
$customer
_id>
Create a new invoice f
rom scratch
Create a new invoice f
or this customer
</A>
</td>
</tr>
\n
"
...
...
www/view.tcl
View file @
8251eb0d
...
...
@@ -160,7 +160,7 @@ set receipient_html "
<tr>
<td class=rowodd>Company name</td>
<td class=rowodd>
<A href=/intranet/customers/view?
group
_id=
$customer
_id>
$customer
_name</A>
<A href=/intranet/customers/view?
customer
_id=
$customer
_id>
$customer
_name</A>
</td>
</tr>
<tr>
...
...
@@ -225,7 +225,7 @@ db_foreach project_list $project_list_sql {
append project_list_html
"
<tr>
<td class=rowodd>
<A href=/intranet/projects/view?
group_id=
$group
_id>
$project
_nr</A>
<A href=/intranet/projects/view?
project_id=
$project
_id>
$project
_nr</A>
</td>
<td class=rowodd>
$project
_name</td>
</tr>
...
...
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