You are on page 1of 72

Front Accounting

ali syaifudin
API Manual Reference

5/22/2013

FrontAccounting API Manual................................................................................. 1


Table of Contents................................................................................................. 1
UI Functions......................................................................................................... 5
Javascript Functions.......................................................................................... 49
Database Functions (low level).......................................................................51
Database Functions (high level)......................................................................54
Date functions.................................................................................................... 55
Formatting Functions........................................................................................ 60
Example Page..................................................................................................... 61

FrontAccounting API Manual


Copyright 2007 by JH Global Consulting LLC

When you are changing something inside FrontAccounting or you are writing an add-on
module you typically need an overview over the functions you can use to get your
changes/modules to look the same way as FrontAccounting.
You will need some database routines, some UI routines when creating forms for adapting
data from your user, some routines for displaying the data to the user. You will also need
some date conversions functions, amount formatting functions that automatically follow the
underlying settings for FrontAccounting.
The functions presented here are only a small selection of the functions inside
FrontAccounting. They are the most commonly used, however, please have a closer look
inside the referenced files. Even for understanding the behavior of the functions it is a good
idea to study the routines carefully.

Table of Contents

UI Functions
o page
o

end_page

display_error

display_notification

display_heading

display_heading2

display_note

start_form

end_form

start_table

end_table

table_header

start_row
2

alt_table_row_color

end_row

edit_link_cell

delete_link_cell

br

meta_forward

hyperlink_back

hyperlink_params

hidden

submit

submit_cells

submit_row

check

check_cells

check_row

label_cell

amount_cell

qty_cell

label_cells

label_row

text_cells

text_cells_ex

text_row

text_row_ex

date_cells

date_row

percent_row

amount_cells

amount_row

small_amount_cells

textarea_cells

textarea_row

supplier_list_cells

supplier_list_row

customer_list_cells

customer_list_row

customer_branches_list_cells

customer_branches_list_row

locations_list_cells

locations_list_row

currencies_list_cells

currencies_list_row

fiscalyears_list_cells

fiscalyears_list_row

dimensions_list_cells

dimensions_list_row

stock_items_list_cells

stock_items_list_row

stock_bom_items_list_cells

stock_bom_items_list_row

stock_manufactured_items_list_cells

stock_manufactured_items_list_row

stock_purchasable_items_list_cells

stock_purchasable_items_list_row

stock_item_types_list_row

stock_units_list_row

stock_categories_list_cells

stock_categories_list_row

tax_types_list_cells

tax_types_list_row

tax_groups_list_cells

tax_groups_list_row

item_tax_types_list_cells

item_tax_types_list_row

shippers_list_cells

shippers_list_row

sales_persons_list_cells

sales_persons_list_row

sales_areas_list_cells

sales_areas_list_row

workorders_list_cells

workorders_list_row

payment_terms_list_cells

payment_terms_list_row

credit_status_list_cells

credit_status_list_row

sales_types_list_cells

sales_types_list_row

movements_types_list_cells

movement_types_list_row

bank_trans_types_list_cells

bank_trans_types_list_row

workcenter_list_cells

workcenter_list_row

bank_accounts_list_cells

bank_accounts_list_row

class_list_cells

class_list_row

gl_all_accounts_list_cells

gl_all_accounts_list_row

yesno_list_cells

yesno_list_row

languages_list_cells

languages_list_row

number_list_cells

number_list_row

Javascript Functions
o

get_js_go_back

get_js_open_window

get_js_date_picker

alert

Database Functions (low level)


o

db_query

db_fetch_row

db_fetch

db_num_rows

db_num_fields

db_insert_id

begin_transaction

commit_transaction

cancel_transaction

Database Functions (high level)

Date Functions
o

is_date

today

now

is_date_in_fiscalyear

begin_fiscalyear

end_fiscalyear

begin_month

end_month

add_days

add_months

add_years

sql2date

date2sql

date1_greater_date2

Formatting Functions
o

number_format2

Example Page

UI Functions
function page($title, $no_menu=false, $is_index=false, $onload="", $js="")
Action: Prints the page title and the header of the page.
Return value: None
File: /includes/main.inc
Parameters:
$title

The page
title

$no_menu

If true,
no menu
line is
printed.
Set to
true for
popup
windows.

$is_index

If true,
no title
line is
displayed

$onload

If set, the
given
javascript
code is
run on
load.

$js

If set, the
javascript
code is
included
in the
header.

function end_page($no_menu=false, $is_index=false)


Action: Prints the page footer of the page.
Return value: None
File: /includes/main.inc
8

Parameters:
$no_menu

If true,
no power
urls are
printed.
Set to
true for
popup
windows.

$is_index

Not used
at the
moment.

function display_error($msg, $center=true)


Action: Prints an error string in bold and with bgcolor #ffcccc, optional centered.
Return value: None
File: /includes/ui/ui_msg.inc
Parameters:
$msg

The error
message
string to
be
printed.

$center

If true,
the
message
is
centered.

function display_notification($msg, $center=true)


Action: Prints a notifications string in bold and with bgcolor #ccffcc, optional centered.
Return value: None
File: /includes/ui/ui_msg.inc
Parameters:
$msg

The
notification
message

string to
be printed.
$center

If true, the
message is
centered.

function display_heading($msg)
Action: Prints a centered heading string in bold.
Return value: None
File: /includes/ui/ui_msg.inc
Parameters:
$msg

The
heading
string
to be
printed.

function display_heading2($msg)
Action: Prints a centered alternative heading string in bold.
Return value: None
File: /includes/ui/ui_msg.inc
Parameters:
$msg

The
heading
string
to be
printed.

function display_note($msg, $br=0, $br2=0, $extra="")


Action: Prints a centered note in normal text with optional break lines before and after.
Return value: None
File: /includes/ui/ui_msg.inc
Parameters:
$msg

The
10

heading
string to
be
printed.
$br

Number
of break
lines
before
the
message.

$br2

Number
of break
lines
after the
message.

$extra

Extra
values,
style or
class to
be put in
a span.

function start_form($multi=false, $sid=false, $action="", $name="")


Action: Prints the start of a form.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$multi

true = fields for


uploading, false =
normal form

$sid

true = SID (session id)


is included in the
action, false = nothing
is included

$action

The action URL when


submitted. Empty
string =
$_SERVER['PHP_SELF']

$name

The name of the form.

function end_form($breaks=0)
11

Action: Prints the end of the form.


Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$breaks

Number
of
break
lines
inside
the
form

function start_table($extra="", $padding='2', $spacing='0')


Action: Prints the start of a centered table.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$extra

Extra
parameters
ex. style

$padding

The value
of the cell
paddings,
default is 2

$spacing

The value
of the cell
spacing,
default is 2

function end_table($breaks=0)
Action: Prints the end of a centered table.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$breaks

Number

12

of
break
lines
after
the
table

function table_header($labels)
Action: Prints the table headers from an array of labels.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$labels

An
array
of
labels
for the
table
header

function start_row($param="")
Action: Prints the start of a table row.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$param

Parameters
to the table
row (tr)

function alt_table_row_color(&$k)
Action: Prints the start of a table row and with alternative background colors.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$k

The k
13

value of
the row.
Set this
value to 0
before the
loop.

function end_row()
Action: Prints the end of a table row.
Return value: None
File: /includes/ui/ui_controls.inc
function edit_link_cell($param)
Action: Prints an edit link with GET params.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$param

Prints the GET params


that is added to the
$_SERVER['PHP_SELF'].

function delete_link_cell($param)
Action: Prints a delete link with GET params.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$param

Prints the GET params


that is added to the
$_SERVER['PHP_SELF'].

function br($num=1)
Action: Prints break lines, default is 1.
Return value: None
File: /includes/ui/ui_controls.inc
14

Parameters:
$num

Print a
number
of
break
lines,
default
is 1

function meta_forward($forward_to, $params="")


Action: Prints the HTML for forwarding the user to another URL.
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$forward_to

The URL
that the
user is
forwarded
to.

$params

Optional
parameters
(GET)
added to
the URL

function hyperlink_back($center=true)
Action: Prints a back link
Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$center

The link
is
centered
if value
is true

function hyperlink_params($target, $label, $params, $center=true)


15

Action: Prints a link and a label with GET parameters


Return value: None
File: /includes/ui/ui_controls.inc
Parameters:
$target

The
URL-link

$label

The
labelvalue of
the link

$params

The GET
params
to be
added to
the URLlink

$center

If the
link
should
be
centered
(default
true)

function hidden($name, $value)


Action: Prints an input type hidden with name and value.
Return value: None
File: /includes/ui/ui_input.inc
Parameters:
$name

The
name
of the
hidden
field.

$value

The
value
of the
hidden
field.

16

function submit($name, $value, $echo=true)


Action: Prints a submit button or returns a string with name and value and optional printed.
Return value: If $echo is false the entire html string is returned instead.
File: /includes/ui/ui_input.inc
Parameters:
$name

The
name of
the
submit
button.

$value

The value
of the
submit
button.

$echo

If this
value is
true the
submit
button is
printed,
otherwise
the HTML
is
returned.

function submit_cells($name, $value, $extra="")


Action: Prints a submit button inside a TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$name

The name
of the
submit
button.

$value

The value
of the
submit
button.

$extra

Parameters
to the TD.
17

function submit_row($name, $value, $right=true, $extra="")


Action: Prints a submit button inside a TR-TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$name

The name
of the
submit
button.

$value

The value
of the
submit
button.

$right

If this is
true, an
extra,
empty TD
is printed.

$extra

Parameters
to the TD.

function check($label, $name, $value, $submit_on_change=false)


Action: Prints a checkbox with an optional label.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is
not null, a
label is
printed in
front of
the
checkbox.

$name

The name
of the
checkbox.

$value

The value

18

of the
checkbox.
$submit_on_change

If this is
true, the
form is
submitted
when
clicking
the
checkbox.

function check_cells($label, $name, $value, $submit_on_change=false)


function check_row($label, $name, $value, $submit_on_change=false)
Action: Prints a checkbox with an optional label inside a TD or TR-TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is
not null, a
label is
printed in
a TD
before
the
checkbox.

$name

The name
of the
checkbox.

$value

The value
of the
checkbox.

$submit_on_change

If this is
true, the
form is
submitted
when
clicking
the
checkbox.

function label_cell($label, $params="")


Action: Prints a label (text) inside a TD.

19

Return value: None.


File: /includes/ui/ui_input.inc
Parameters:
$label

A label is
printed in a
TD.

$params

Parameters
to the TD.

function amount_cell($label, $bold=false)


Action: Prints a user formatted, right aligned amount inside a TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

The
amount
to be
printed
in a TD.

$bold

If this
is true,
the
amount
is
printed
in bold.

function qty_cell($label, $bold=false)


Action: Prints a user formatted, right aligned quantity inside a TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

The
quantity
to be
printed

20

in a TD.
$bold

If this is
true,
the
quantity
is
printed
in bold.

function label_cells($label, $value, $params="", $params2="")


function label_row($label, $value, $params="", $params2="")
Action: Prints a value (text) inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is
not null, a
label is
printed in a
TD.

$value

The value
is printed
in a TD.

$params

Parameters
to the label
TD.

$params2

Parameters
to the
value TD.

function text_cells($label, $name, $value, $size="", $max="", $params="",


$post_label="", $disabled="")
function text_row($label, $name, $value, $size, $max, $params="",
$post_label="")
Action: Prints an input text box inside a TD or TR-TD with an optional label TD and optional
post label and optional disabled.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:

21

$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

$value

If $value is
null and the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$size

If $size is
not empty a
size is set.

$max

If $max is
not empty a
maxlength is
set.

$params

Parameters
to the label
TD.

$post_label

If
$post_label
is not empty
a label is
printed after
the input
box.

$disabled

The value of
$disabled is
printed just
after the
input. Can
be used for
extra
parameters
for the input
box.

function text_cells_ex($label, $name, $size, $max=null, $init=null,


$params=null, $post_label=null)
22

function text_row_ex($label, $name, $size, $max=null, $value=null,


$params=null, $post_label=null)
Action: Like text_cells, but if $init is not null, the POST[name] is set to $init, otherwise
POST[name] is set to an empty string. The value is set to POST[name].
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

$size

If $size is not
empty a size
is set.

$max

If $max is
not set, the
maxlength is
set to $size.

$init

If $init is not
set, the
POST[name]
is set to
$init,
otherwise
POST[name]
is set to an
empty string.
The value is
set to
POST[name].

$params

Parameters
to the label
TD.

$post_label

If
$post_label
is not empty
a label is
printed after
the input
box.

23

function date_cells($label, $name, $init=null, $inc_days=0, $inc_months=0,


$inc_years=0, $params=null)
function date_row($label, $name, $init=null, $inc_days=0, $inc_months=0,
$inc_years=0, $params=null)
Action: Like text_cells, but if $init is not null, the POST[name] is set to $init, otherwise
POST[name] is set to today's date.
The value is set to POST[name]. The date values are user formatted. If the global variable,
$use_date_picker, is set
a date picker is is placed after the input box, where you can alter the date values.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

$init

If $init is not
set, the
POST[name]
is set to
$init,
otherwise
POST[name]
is set to
today's date.
The value is
set to
POST[name].

$inc_days

If $init is not
set, you can
add an initial
day value.
Negative
values are
allowed.

$inc_months

If $init is not
set, you can
add an initial
month value.
Negative
values are
allowed.

24

$inc_years

If $init is not
set, you can
add an initial
year value.
Negative
values are
allowed.

$params

Parameters
to the label
TD.

function percent_row($label, $name, $init=null)


Action: Prints a percent input text box, with a '%' label after, inside a TR-TD with an
optional label TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

$init

If $init is
null and the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function amount_cells($label, $name, $init=null, $params=null,


$post_label=null)
function amount_row($label, $name, $init=null, $params=null, $post_label=null)
Action: Prints an amount input text box (max 15 digits) inside a TD or TR-TD with an
optional label TD.
Return value: None.
File: /includes/ui/ui_input.inc
25

Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

$init

If $init is
null and the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$params

The
$params to
the $label
TD.

$post_label

The
$post_label
after the
input box.

function small_amount_cells($label, $name, $init=null, $params=null,


$post_label=null)
Action: Prints an small amount input text box (max 12 digits) inside a TD or TR-TD with an
optional label TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the input
text box.

26

$init

If $init is
null and the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$params

The
$params to
the $label
TD.

$post_label

The
$post_label
after the
input box.

function textarea_cells($label, $name, $value, $cols, $rows, $params="")


function textarea_row($label, $name, $value, $cols, $rows, $params="")
Action: Prints a multi line text box inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_input.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the textarea
box.

$value

If $value is
null and the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$cols

The width in

27

characters
of the
textarea
box.
$rows

The number
of rows in
the textarea
box.

$params

The
$params to
the $label
TD.

function supplier_list_cells($label, $name, $selected_id, $all_option=false,


$submit_on_change=false)
function supplier_list_row($label, $name, $selected_id, $all_option=false,
$submit_on_change=false)
Action: Prints a supplier listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$all_option

If true, All is
the first
choice.

28

$submit_on_chang
e

If true, the
form is
submitted
on change.

function customer_list_cells($label, $name, $selected_id, $all_option=false,


$submit_on_change=false)
function customer_list_row($label, $name, $selected_id, $all_option=false,
$submit_on_change=false)
Action: Prints a customer listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$all_option

If true, All is
the first
choice.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function customer_branches_list_cells($label, $name, $selected_id,


$all_option=false, $enabled=true, $submit_on_change=false)

29

function customer_branches_list_row($label, $name, $selected_id,


$all_option=false, $submit_on_change=false)
Action: Prints a customer branch listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$all_option

If true, All is
the first
choice.

$enabled

If true, only
disable_tran
s = 0 are
shown.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function locations_list_cells($label, $name, $selected_id, $all_option=false,


$submit_on_change=false)
function locations_list_row($label, $name, $selected_id, $all_option=false,
$submit_on_change=false)
Action: Prints a locations listbox inside a TD or TR-TD with an optional label TD.
Return value: None.

30

File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$all_option

If true, All
locations is
the first
choice.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function currencies_list_cells($label, $name, $selected_id)


function currencies_list_row($label, $name, $selected_id)
Action: Prints a currencies listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of

31

the list box.


$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function fiscalyears_list_cells($label, $name, $selected_id)


function fiscalyears_list_row($label, $name, $selected_id)
Action: Prints a fiscal years listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function dimensions_list_cells($label, $name, $selected_id, $no_option=false,


$showname=null, $showclosed=false, $showtype=0)
function dimensions_list_row($label, $name, $selected_id, $no_option=false,
$showname=null, $showclosed=false, $showtype=0)

32

Action: Prints a dimensions listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$no_option

If true, an
All
Dimensions
is the first
choise.

$showname

If true, the
dimension
name is
shown.

$showclosed

If true, the
closed
dimensions
are shown
as well.

$showtype

Will only
show the
dimension
type.

function stock_items_list_cells($label, $name, $selected_id,


$all_option=false, $submit_on_change=false)
33

function stock_items_list_row($label, $name, $selected_id, $all_option=false,


$submit_on_change=false)
Action: Prints a stock items listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$all_option

If true, All
stock items
is the first
choice.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function stock_bom_items_list_cells($label, $name, $selected_id,


$all_option=false, $submit_on_change=false)
function stock_bom_items_list_row($label, $name, $selected_id,
$all_option=false, $submit_on_change=false)
Action: Prints a stock bom (bill of material) items listbox inside a TD or TR-TD with an
optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc

34

Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$all_option

If true, All
stock bom
items is the
first choice.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function stock_manufactured_items_list_cells($label, $name, $selected_id,


$all_option=false, $submit_on_change=false)
function stock_manufactured_items_list_row($label, $name, $selected_id,
$all_option=false, $submit_on_change=false)
Action: Prints a stock manufactured items listbox inside a TD or TR-TD with an optional
label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.
35

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$all_option

If true, All
stock
manufacture
d items is
the first
choice.

$submit_on_chang
e

If true, the
form is
submitted on
change.

function stock_purchasable_items_list_cells($label, $name, $selected_id,


$all_option=false, $submit_on_change=false)
function stock_purchasable_items_list_row($label, $name, $selected_id,
$all_option=false, $submit_on_change=false)
Action: Prints a stock purchasable items listbox inside a TD or TR-TD with an optional label
TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and

36

the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.
$all_option

If true, All
stock
purchasable
items is the
first choice.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function stock_item_types_list_row($label, $name, $selected_id, $enabled=true)


Action: Prints a stock item types listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

37

$enabled

If true, the
form is
submitted
on change,
else the
listbox is
disabled.

function stock_units_list_row($label, $name, $selected_id, $enabled=true)


Action: Prints a stock units listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$enabled

If true, the
form is
submitted
on change,
else the
listbox is
disabled.

function stock_categories_list_cells($label, $name, $selected_id)


function stock_categories_list_row($label, $name, $selected_id)
Action: Prints a stock categories listbox inside a TD or TR-TD with an optional label TD.

38

Return value: None.


File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function tax_type_list_cells($label, $name, $selected_id, $all_option=false,


$all_option_name=null, $submit_on_change=false)
function tax_type_list_row($label, $name, $selected_id, $all_option=false,
$all_option_name=null, $submit_on_change=false)
Action: Prints a tax type listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label is
printed in a
TD.

$name

The name of
the list box.

$selected_id

If $selected_id
is null and the
POST[name] is
not set an
empty value is
39

set, otherwise
the
POST[name]
value is set.
$all_option

If true, All
stock
purchasable
items is the
first choice.

$all_option_nam
e

If not null, the


$all_option_na
me is printed.

$submit_on_cha
nge

If true, the
form is
submitted on
change.

function tax_groups_list_cells($label, $name, $selected_id,


$submit_on_change=false)
function tax_groups_list_row($label, $name, $selected_id,
$submit_on_change=false)
Action: Prints a tax type listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is

40

set.
$submit_on_chang
e

If true, the
form is
submitted
on change.

function item_tax_types_list_cells($label, $name, $selected_id)


function item_tax_types_list_row($label, $name, $selected_id)
Action: Prints an item tax types listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function shippers_list_cells($label, $name, $selected_id)


function shippers_list_row($label, $name, $selected_id)
Action: Prints a shippers listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
41

is printed in
a TD.
$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function sales_persons_list_cells($label, $name, $selected_id)


function sales_persons_list_row($label, $name, $selected_id)
Action: Prints a sales persons listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function sales_areas_list_cells($label, $name, $selected_id)


42

function sales_areas_list_row($label, $name, $selected_id)


Action: Prints a sales areas listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function workorders_list_cells($label, $name, $selected_id)


function workorders_list_row($label, $name, $selected_id)
Action: Prints a workorders listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
43

POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function payment_terms_list_cells($label, $name, $selected_id)


function payment_terms_list_row($label, $name, $selected_id)
Action: Prints a payment terms listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function credit_status_list_cells($label, $name, $selected_id)


function credit_status_list_row($label, $name, $selected_id)
Action: Prints a credit status listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:

44

$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function sales_types_list_cells($label, $name, $selected_id)


function sales_types_list_row($label, $name, $selected_id)
Action: Prints a sales types listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

45

function movements_types_list_cells($label, $name, $selected_id)


function movement_types_list_row($label, $name, $selected_id)
Action: Prints a movements types listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function bank_trans_types_list_cells($label, $name, $selected_id)


function bank_trans_types_list_row($label, $name, $selected_id)
Action: Prints a bank transaction types listbox inside a TD or TR-TD with an optional label
TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
46

is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

function workcenter_list_cells($label, $name, $selected_id, $all_option=false)


function workcenter_list_row($label, $name, $selected_id, $all_option=false)
Action: Prints a workcenter listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$all_option

If true, All is
the first
choice.

function bank_accounts_list_cells($label, $name, $selected_id,


$submit_on_change=false)
function bank_accounts_list_row($label, $name, $selected_id,
$submit_on_change=false)

47

Action: Prints a bank accounts listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function class_list_cells($label, $name, $selected_id,


$submit_on_change=false)
function class_list_row($label, $name, $selected_id, $submit_on_change=false)
Action: Prints an account class listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
48

the list box.


$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name
] value is
set.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function gl_all_accounts_list_cells($label, $name, $selected_id,


$skip_bank_accounts=false, $show_group=false, $on_change="")
function gl_all_accounts_list_row($label, $name, $selected_id,
$skip_bank_accounts=false, $show_group=false, $on_change="")
Action: Prints an account class listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name
of the list
box.

$selected_id

If
$selected_i
d is null
and the
POST[name
] is not set
an empty
value is set,
otherwise
the
49

POST[name
] value is
set.
$skip_bank_account
s

If true, the
bank
accounts
are not
shown.

$show_group

If true, the
bank
account
groups are
shown.

$on_change

If set, the
on_change
value is
printed.

function yesno_list_cells($label, $name, $selected_id, $name_yes="",


$name_no="", $submit_on_change=false)
function yesno_list_row($label, $name, $selected_id, $name_yes="",
$name_no="", $submit_on_change=false)
Action: Prints a yesno listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name
] is not set
an empty
value is set,
otherwise
the
POST[name

50

] value is
set.
$name_yes

If set, the
value is
printed, else
'Yes' is
printed.

$name_no

If set, the
value is
printed, else
'No' is
printed.

$submit_on_chang
e

If true, the
form is
submitted
on change.

function languages_list_cells($label, $name, $selected_id)


function languages_list_row($label, $name, $selected_id)
Action: Prints a languages listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

51

function number_list_cells($label, $name, $selected_id, $from, $to)


function number_list_row($label, $name, $selected_id, $from, $to)
Action: Prints a numbered listbox inside a TD or TR-TD with an optional label TD.
Return value: None.
File: /includes/ui/ui_lists.inc
Parameters:
$label

If this is not
null, a label
is printed in
a TD.

$name

The name of
the list box.

$selected_id

If
$selected_id
is null and
the
POST[name]
is not set an
empty value
is set,
otherwise
the
POST[name]
value is set.

$from

From value
(included).

$to

To value
(included).

52

Javascript Functions
function get_js_go_back()
Action: Gets Javascript code for a 'Back' link. Popups are closed, normal windows are going
back.
Return value: Javascript code.
File: /includes/ui/ui_view.inc
function get_js_open_window($width, $height)
Action: Gets Javascript code for a centered Popup window.
Return value: Javascript code.
File: /includes/ui/ui_view.inc
Parameters:
$width

The
width of
the
Popup
window.

$height

The
height
of the
Popup
window.

function get_js_date_picker()
Action: Gets Javascript code for a date picker. If the global variable $use_date_picker is
set, this code is needed.
If the global variable $date_system is set to 0, the Gregorian Calendar is used. A value of 1
will show the Jalali Calendar
and a value of 2 will show the Islamic Calendar.
Return value: Javascript code.
File: /includes/ui/ui_view.inc
function alert($msg)
Action: Prints Javascript code for an alert popup. Can be used as a debugging feature.

53

Return value: None.


File: /includes/ui/ui_view.inc
Parameters:
$msg

Shows
the
message
in a
javascript
alert box.

54

Database Functions (low level)


function db_query($sql, $err_msg)
Action: Send an SQL statement to MySql server.
Return value: A result set.
File: /includes/db/connect_db.inc
Parameters:
$sql

An SQL
statement,
like
SELECT,
INSERT,
UPDATE,
DELETE.

$err_msg

You can
supply an
error
message if
the action
fails.

function db_fetch_row($result)
Action: Fetches the next row array from the result set in db_query.
Return value: A row array that is numeric, i.e. $row[0], $row[1] ans so on.
File: /includes/db/connect_db.inc
Parameters:
$result

The result
set
returned
from
db_query.

function db_fetch($result)
Action: Fetches the next row array from the result set in db_query.
Return value: A row array that is field based, i.e. $row['id'], $row['name'] ans so on.
55

File: /includes/db/connect_db.inc
Parameters:
$result

The result
set
returned
from
db_query.

function db_num_rows($result)
Action: Fetches the number of rows in the result set in db_query.
Return value: A number of rows in the result set.
File: /includes/db/connect_db.inc
Parameters:
$result

The result
set
returned
from
db_query.

function db_num_fields($result)
Action: Fetches the number of fields in the result set in db_query.
Return value: A number of fields in the result set.
File: /includes/db/connect_db.inc
Parameters:
$result

The result
set
returned
from
db_query.

function db_insert_id()
Action: Gets the inserted id from the last INSERT INTO statement.
Return value: The inserted id value.

56

File: /includes/db/connect_db.inc
function begin_transaction
Action: Logs the transactions during a critical operation. Use transactions if you need to
keep several INSERT, DELETE or UPDATE
statements tied together
Return value: None.
File: /includes/db/sql_functions.inc
function commit_transaction
Action: Commits the transactions since begin_transaction. Use transactions if you need to
keep several INSERT, DELETE or UPDATE
statements tied together
Return value: None.
File: /includes/db/sql_functions.inc
function cancel_transaction
Action: Cancels (rolls back) the transactions since begin_transaction. Use transactions if
you need to keep several INSERT, DELETE or UPDATE
statements tied together
Return value: None.
File: /includes/db/sql_functions.inc

57

Database Functions (high level)

58

Date functions
function is_date($date_)
Action: Checks if $date_ is a valid date based on the current formatting.
Return value: True if $date_ is a valid date, otherwise false.
File: /includes/date_functions.inc
Parameters:
$date
_

The
formatted
date
value to
be
tested.

function today()
Action: Returns a formatted date value based on the current setting.
Return value: Returns a formatted date value based on the current setting.
File: /includes/date_functions.inc
function now()
Action: Returns a formatted time value based on the current setting.
Return value: Returns a formatted time value based on the current setting.
File: /includes/date_functions.inc
function is_date_in_fiscalyear($date, $convert=false)
Action: Checks if $date is inside the current fiscal year.
Return value: True if $date is inside the current fiscal year, otherwise false.
File: /includes/date_functions.inc
Parameters:
$date

The
formatted
date
59

value to
be
tested.
$convert

You can
test a
nonformatted
SQL
value
directly if
this value
is true.

function begin_fiscalyear()
Action: Returns the formatted beginning date of the current fiscal year.
Return value: Returns the formatted beginning date of the current fiscal year.
File: /includes/date_functions.inc
function end_fiscalyear()
Action: Returns the formatted ending date of the current fiscal year.
Return value: Returns the formatted ending date of the current fiscal year.
File: /includes/date_functions.inc
function begin_month($date)
Action: Returns the formatted first day of the month based on the $date value.
Return value: Returns the formatted first day of the month based on the $date value.
File: /includes/date_functions.inc
Parameters:
$date

The
formatted
date
value.

function end_month($date)
Action: Returns the formatted last day of the month based on the $date value.
Return value: Returns the formatted last day of the month based on the $date value.
File: /includes/date_functions.inc
60

Parameters:
$date

The
formatted
date
value.

function add_days($date, $days)


Action: Returns the formatted new date after adding $days. $days can be negative.
Return value: Returns the formatted new date after adding $days. $days can be negative.
File: /includes/date_functions.inc
Parameters:
$date

The
formatted
date
value.

$days

Number
of days to
add.
$days
can be
negative.

function add_months($date, $months)


Action: Returns the formatted new date after adding $months. $months can be negative.
Return value: Returns the formatted new date after adding $months. $months can be
negative.
File: /includes/date_functions.inc
Parameters:
$date

The
formatted
date
value.

$months

Number
of
months
to add.
$months

61

can be
negative.

function add_years($date, $years)


Action: Returns the formatted new date after adding $years. $years can be negative.
Return value: Returns the formatted new date after adding $years. $years can be
negative.
File: /includes/date_functions.inc
Parameters:
$date

The
formatted
date
value.

$years

Number
of years
to add.
$years
can be
negative.

function sql2date($date)
Action: Returns the formatted date from the MySql date value YYYY/MM/DD.
Return value: Returns the formatted date from the MySql date value YYYY/MM/DD.
File: /includes/date_functions.inc
Parameters:
$date

The
MySql
date
value.

function date2sql($date)
Action: Returns the MySql date value YYYY/MM/DD from the formatted date.
Return value: Returns the MySql date value YYYY/MM/DD from the formatted date.
File: /includes/date_functions.inc
Parameters:

62

$date

The
formatted
date
value.

function date1_greater_date2($date1, $date2)


Action: Returns true if the formatted $date1 value is greater than the formatted $date2
value.
Return value: Returns true if the formatted $date1 value is greater than the formatted
$date2 value.
File: /includes/date_functions.inc
Parameters:
$date
1

The first
formatted
date
value.

$date
2

The
second
formatted
date
value.

63

Formatting Functions
function number_format2($number, $decimals=0)
Action: Returns the formatted number value, based on the current user settings.
Return value: Returns the formatted number value, based on the current user settings.
File: /includes/current_user.inc
Parameters:
$number

The
number to
be
formatted.

$decimals

The
number of
decimals.

64

Example Page
<?php
$page_security = 3;
$path_to_root="../..";
include($path_to_root . "/includes/session.inc");
page(_("Sales Persons"));
include($path_to_root . "/includes/ui.inc");
if (isset($_GET['selected_id']))
{
$selected_id = strtoupper($_GET['selected_id']);
}
elseif (isset($_POST['selected_id']))
{
$selected_id = strtoupper($_POST['selected_id']);
}
//----------------------------------------------------------------------------------------------if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
{
//initialise no input errors assumed initially before we test
$input_error = 0;
if (strlen($_POST['salesman_name']) == 0)
{
$input_error = 1;
display_error(_("The sales person name cannot be empty."));
}
if ($input_error != 1)
{
if (isset($selected_id))
{
/*selected_id could also exist if submit had not been clicked
this code would not run in this case cos
submit is false of course see the delete code below*/
$sql = "UPDATE ".TB_PREF."salesman SET salesman_name='" .
$_POST['salesman_name'] . "',
salesman_phone='" . $_POST['salesman_phone'] . "',
salesman_fax='" . $_POST['salesman_fax'] . "',
salesman_email='" . $_POST['salesman_email'] . "'
WHERE salesman_code = '$selected_id'";
}
else
65

/*Selected group is null cos no item selected on first time


round so must be adding a record must be
submitting new entries in the new Sales-person form */
$sql = "INSERT INTO ".TB_PREF."salesman (salesman_name,
salesman_phone, salesman_fax, salesman_email)
VALUES ('" . $_POST['salesman_name'] . "', '" .
$_POST['salesman_phone'] . "',
'" . $_POST['salesman_fax'] . "', '" .
$_POST['salesman_email'] . "')";
}
//run the sql from either of the above possibilites
db_query($sql,"The insert or update of the salesperson failed");
meta_forward($_SERVER['PHP_SELF']);
}

}
if (isset($_GET['delete']))
{
//the link to delete a selected record was clicked instead of the
submit button
// PREVENT DELETES IF DEPENDENT RECORDS IN 'debtors_master'
$sql= "SELECT COUNT(*) FROM ".TB_PREF."cust_branch WHERE
salesman='$selected_id'";
$result = db_query($sql,"check failed");
$myrow = db_fetch_row($result);
if ($myrow[0] > 0)
{
display_error("Cannot delete this sales-person because
branches are set up referring to this sales-person - ".
"first alter the branches concerned.");
}
else
{
$sql="DELETE FROM ".TB_PREF."salesman WHERE
salesman_code='$selected_id'";
db_query($sql,"The sales-person could not be deleted");
meta_forward($_SERVER['PHP_SELF']);
}

//----------------------------------------------------------------------------------------------$sql = "SELECT * FROM ".TB_PREF."salesman";


$result = db_query($sql,"could not get sales persons");
start_table("$table_style width=40%");
$th = array(_("Name"), _("Phone"), _("Fax"), _("Email"), "", "");
table_header($th);
$k = 0;
66

while ($myrow = db_fetch($result))


{
alt_table_row_color($k);
label_cell($myrow["salesman_name"]);
label_cell($myrow["salesman_phone"]);
label_cell($myrow["salesman_fax"]);
label_cell($myrow["salesman_email"]);
edit_link_cell(SID . "selected_id=" . $myrow["salesman_code"]);
delete_link_cell(SID . "selected_id=" . $myrow["salesman_code"].
"&delete=1");
end_row();
} //END WHILE LIST LOOP
end_table();
//----------------------------------------------------------------------------------------------hyperlink_no_params($_SERVER['PHP_SELF'], _("New Sales Person"));
//----------------------------------------------------------------------------------------------start_form();
if (isset($selected_id))
{
//editing an existing Sales-person
$sql = "SELECT * FROM ".TB_PREF."salesman WHERE
salesman_code='$selected_id'";
$result = db_query($sql,"could not get sales person");
$myrow = db_fetch($result);
$_POST['salesman_name'] = $myrow["salesman_name"];
$_POST['salesman_phone'] = $myrow["salesman_phone"];
$_POST['salesman_fax'] = $myrow["salesman_fax"];
$_POST['salesman_email'] = $myrow["salesman_email"];
}

hidden('selected_id', $selected_id);

start_table("$table_style2 width=40%");
text_row_ex(_("Sales person name:"), 'salesman_name', 30);
text_row_ex(_("Telephone number:"), 'salesman_phone', 20);
text_row_ex(_("Fax number:"), 'salesman_fax', 20);
text_row_ex(_("Email:"), 'salesman_email', 40);
end_table(1);
submit_add_or_update_center(!isset($selected_id));
end_form();
67

end_page();
?>

68

/report/includes/reporting.inc
Fungsi : menentukan parameter report masing masing modul report
/report/includes/reports_main.php
Fungsi : menambahan report untuk menunjukkan parameter yang digunakan
/report/includes/reports_classes.inc
Menambahkan VAT file : /sales/includes/ui/sales_order_ui.inc, list di deskripsikan di
/includes/ui/ui_list.inc

Penambahan applikasi
Frontaccounting.php
69

if (!isset($path_to_root) || isset($_GET['path_to_root']) ||
isset($_POST['path_to_root']))
die("Restricted access");
include_once($path_to_root . '/applications/application.php');
include_once($path_to_root . '/applications/customers.php');
// include_once($path_to_root . '/applications/suppliers.php');
include_once($path_to_root . '/applications/inventory.php');
// include_once($path_to_root . '/applications/manufacturing.php');
.
.
.
function init()
{

//

$this->menu = new menu(_("Main Menu"));


$this->menu->add_item(_("Main Menu"), "index.php");
$this->menu->add_item(_("Logout"), "/account/access/logout.php");
$this->applications = array();
$this->add_application(new customers_app());
$this->add_application(new suppliers_app());

Includes/access_level.inc
define('SS_SADMIN', 1<<8);
define('SS_SETUP',
2<<8);
define('SS_SPEC',
3<<8);
Includes/systypes.inc
Cart di sediakan di :
Includes/ui/._cart.inc

// site admin
// company level setup
// special administration

Includes/systypes.inc
function get_systype_db_info($type)
{
switch ($type)
{
case
ST_JOURNAL
: return array("".TB_PREF."gl_trans", "type", "type_no", null,
"tran_date");
case
ST_BANKPAYMENT : return array("".TB_PREF."bank_trans", "type", "trans_no", "ref",
"trans_date");
case
ST_BANKDEPOSIT : return array("".TB_PREF."bank_trans", "type", "trans_no", "ref",
"trans_date");

Includes/types.inc
//
FrontAccounting system transaction types
//
define('ST_JOURNAL', 0);

70

define('ST_BANKPAYMENT', 1);
define('ST_BANKDEPOSIT', 2);
define('ST_BANKTRANSFER', 4);

// Don't include these defines in the $systypes_array.


// They are used for documents only.
define ('ST_STATEMENT', 91);
define ('ST_CHEQUE', 92);
// document inheritance
$document_child_types = array(
ST_SALESQUOTE => ST_SALESORDER,
ST_SALESORDER => ST_CUSTDELIVERY,

Includes/sysnames.inc
global $systypes_array, $bank_account_types, $bank_transfer_types,
$payment_person_types, $wo_types_array, $wo_cost_types, $class_types,
$quick_actions, $quick_entry_types, $stock_types, $tag_types;
$systypes_array = array (
ST_JOURNAL => _("Journal Entry"),
ST_BANKPAYMENT => _("Bank Payment"),

71

You might also like