frontaccounting api manual

Upload: suhermanto

Post on 02-Jun-2018

243 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/10/2019 FrontAccounting API Manual

    1/72

    Front Accounting

    0

    5 / 2 2 / 2 0 1 3

    ali syaifudin

    API Manual Reference

  • 8/10/2019 FrontAccounting API Manual

    2/72

    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

    Foratting Functions........................................................................................60

    !"aple Page.....................................................................................................61

    1

  • 8/10/2019 FrontAccounting API Manual

    3/72

    FrontAccounting API Manual

    Copyright 2007 by JH Global Consulting LLC

    When you are changing something inside FrontAccounting or you are riting an add!on

    module you typically need an o"er"ie o"er the #unctions you can use to get yourchanges$modules to loo% the same ay as FrontAccounting&

    'ou ill need some database routines( some )* routines hen creating #orms #or adaptingdata #rom your user( some routines #or displaying the data to the user& 'ou ill also need

    some date con"ersions #unctions( amount #ormatting #unctions that automatically #ollo theunderlying settings #or FrontAccounting&

    +he #unctions presented here are only a small selection o# the #unctions inside

    FrontAccounting& +hey are the most commonly used( hoe"er( please ha"e a closer loo%inside the re#erenced #iles& ,"en #or understanding the beha"ior o# the #unctions it is a good

    idea to study the routines care#ully&

    Table of Contents

    )* Functions

    o page

    o end-page

    o display-error

    o display-noti#ication

    o display-heading

    o display-heading2

    o display-note

    o start-#orm

    o end-#orm

    o start-table

    o end-table

    o table-header

    o start-ro

    2

    mailto:[email protected]:[email protected]
  • 8/10/2019 FrontAccounting API Manual

    4/72

    o alt-table-ro-color

    o end-ro

    o edit-lin%-cell

    o delete-lin%-cell

    o br

    o meta-#orard

    o hyperlin%-bac%

    o hyperlin%-params

    o hidden

    o submit

    o submit-cells

    o submit-ro

    o chec%

    o chec%-cells

    o chec%-ro

    o label-cell

    o amount-cell

    o .ty-cell

    o label-cells

    o label-ro

    o te/t-cells

    o te/t-cells-e/

    o te/t-ro

    o te/t-ro-e/

    o date-cells

    o date-ro

    o percent-ro

    o amount-cells

    3

  • 8/10/2019 FrontAccounting API Manual

    5/72

  • 8/10/2019 FrontAccounting API Manual

    6/72

    o stoc%-categories-list-cells

    o stoc%-categories-list-ro

    o ta/-types-list-cells

    o ta/-types-list-ro

    o ta/-groups-list-cells

    o ta/-groups-list-ro

    o item-ta/-types-list-cells

    o item-ta/-types-list-ro

    o shippers-list-cells

    o shippers-list-ro

    o sales-persons-list-cells

    o sales-persons-list-ro

    o sales-areas-list-cells

    o sales-areas-list-ro

    o or%orders-list-cells

    o or%orders-list-ro

    o payment-terms-list-cells

    o payment-terms-list-ro

    o credit-status-list-cells

    o credit-status-list-ro

    o sales-types-list-cells

    o sales-types-list-ro

    o mo"ements-types-list-cells

    o mo"ement-types-list-ro

    o ban%-trans-types-list-cells

    o ban%-trans-types-list-ro

    o or%center-list-cells

    o or%center-list-ro

    5

  • 8/10/2019 FrontAccounting API Manual

    7/72

    o ban%-accounts-list-cells

    o ban%-accounts-list-ro

    o class-list-cells

    o class-list-ro

    o gl-all-accounts-list-cells

    o gl-all-accounts-list-ro

    o yesno-list-cells

    o yesno-list-ro

    o languages-list-cells

    o languages-list-ro

    o number-list-cells

    o number-list-ro

    Ja"ascript Functions

    o get-s-go-bac%

    o get-s-open-indo

    o get-s-date-pic%er

    o alert

    1atabase Functions lo le"el3

    o db-.uery

    o db-#etch-ro

    o db-#etch

    o db-num-ros

    o db-num-#ields

    o db-insert-id

    o begin-transaction

    o commit-transaction

    o cancel-transaction

    1atabase Functions high le"el3

    6

  • 8/10/2019 FrontAccounting API Manual

    8/72

    1ate Functions

    o is-date

    o today

    o no

    o is-date-in-#iscalyear

    o begin-#iscalyear

    o end-#iscalyear

    o begin-month

    o end-month

    o add-days

    o add-months

    o add-years

    o s.l2date

    o date2s.l

    o date4-greater-date2

    Formatting Functions

    o number-#ormat2

    ,/ample 5age

  • 8/10/2019 FrontAccounting API Manual

    9/72

    UI Functions

    function page($title, $no_menu=false, $is_index=false, $onload="", $js="")Action#5rints the page title and the header o# the page&

    $eturn value#6one

    File#$includes$main&inc

    Paraeters#

    title +he page

    title

    no-menu *# true(no menuline is

    printed&8et to

    true #orpopup

    indos&

    is-inde/ *# true(

    no titleline is

    displayed

    onload *# set( thegi"en

    a"ascript

    code isrun on

    load&

    s *# set( the

    a"ascriptcode is

    includedin the

    header&

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

    Action#5rints the page #ooter o# the page&

    $eturn value#6one

    File#$includes$main&inc

    !

  • 8/10/2019 FrontAccounting API Manual

    10/72

    Paraeters#

    no-menu *# true(

    no poerurls are

    printed&8et to

    true #orpopup

    indos&

    is-inde/ 6ot used

    at themoment&

    function display_error($msg, $center=true)

    Action#5rints an error string in bold and ith bgcolor 9##cccc( optional centered&

    $eturn value#6one

    File#$includes$ui$ui-msg&inc

    Paraeters#

    msg +he error

    messagestring to

    beprinted&

    center *# true(the

    message

    iscentered&

    function display_notification($msg, $center=true)

    Action#5rints a noti#ications string in bold and ith bgcolor 9cc##cc( optional centered&

    $eturn value#6one

    File#$includes$ui$ui-msg&inc

    Paraeters#

    msg +henoti#ication

    message

    9

  • 8/10/2019 FrontAccounting API Manual

    11/72

    string to

    be printed&

    center *# true( the

    message is

    centered&

    function display_heading($msg)

    Action#5rints a centered heading string in bold&

    $eturn value#6one

    File#$includes$ui$ui-msg&inc

    Paraeters#

    msg +he

    headingstring

    to beprinted&

    function display_heading2($msg)

    Action#5rints a centered alternati"e heading string in bold&

    $eturn value#6one

    File#$includes$ui$ui-msg&inc

    Paraeters#

    msg +he

    headingstring

    to beprinted&

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

    Action#5rints a centered note in normal te/t ith optional brea% lines be#ore and a#ter&

    $eturn value#6one

    File#$includes$ui$ui-msg&inc

    Paraeters#

    msg +he

    10

  • 8/10/2019 FrontAccounting API Manual

    12/72

  • 8/10/2019 FrontAccounting API Manual

    13/72

    Action#5rints the end o# the #orm&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    brea%s 6umbero#

    brea%lines

    insidethe

    #orm

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

    Action#5rints the start o# a centered table&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    e/tra ,/traparameters

    e/& style

    padding +he "alue

    o# the cellpaddings(

    de#ault is 2

    spacing +he "alueo# the cell

    spacing(

    de#ault is 2

    function end_table($breas=0)

    Action#5rints the end o# a centered table&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    brea%s 6umber

    12

  • 8/10/2019 FrontAccounting API Manual

    14/72

    o#

    brea%lines

    a#terthe

    table

    function table_header($labels)

    Action#5rints the table headers #rom an array o# labels&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    labels Anarray

    o#labels

    #or thetable

    header

    function start_ro($param="")

    Action#5rints the start o# a table ro&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    param 5arametersto the table

    ro tr3

    function alt_table_ro_color(#$)

    Action#5rints the start o# a table ro and ith alternati"e bac%ground colors&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    % +he %

    13

  • 8/10/2019 FrontAccounting API Manual

    15/72

    "alue o#

    the ro&8et this

    "alue to 0be#ore the

    loop&

    function end_ro()

    Action#5rints the end o# a table ro&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    function edit_lin_cell($param)

    Action#5rints an edit lin% ith G,+ params&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    param 5rints the G,+ paramsthat is added to the

    -8,;5H5-8,LF>?&

    function delete_lin_cell($param)

    Action#5rints a delete lin% ith G,+ params&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    param 5rints the G,+ paramsthat is added to the

    -8,;5H5-8,LF>?&

    function br($num=)

    Action#5rints brea% lines( de#ault is 4&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    14

  • 8/10/2019 FrontAccounting API Manual

    16/72

    Paraeters#

    num 5rint a

    numbero#

    brea%lines(

    de#aultis 4

    function meta_forard($forard_to, $params="")

    Action#5rints the H+@L #or #orarding the user to another );L&

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    #orard-to +he );Lthat the

    user is

    #orardedto&

    params ptionalparameters

    G,+3added to

    the );L

    function hyperlin_bac($center=true)

    Action#5rints a bac% lin%

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    center +he lin%is

    centeredi# "alue

    is true

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

    15

  • 8/10/2019 FrontAccounting API Manual

    17/72

    Action#5rints a lin% and a label ith G,+ parameters

    $eturn value#6one

    File#$includes$ui$ui-controls&inc

    Paraeters#

    target +he);L!lin%

    label +helabel!

    "alue o#the lin%

    params +he G,+

    params

    to be

    added tothe );L!lin%

    center *# thelin%

    shouldbe

    centeredde#ault

    true3

    function hidden($name, $%alue)

    Action#5rints an input type hidden ith name and "alue&

    $eturn value#6one

    File#$includes$ui$ui-input&inc

    Paraeters#

    name +hename

    o# the

    hidden#ield&

    "alue +he

    "alue

    o# thehidden

    #ield&

    16

  • 8/10/2019 FrontAccounting API Manual

    18/72

    function submit($name, $%alue, $echo=true)

    Action#5rints a submit button or returns a string ith name and "alue and optional printed&

    $eturn value#*# echo is #alse the entire html string is returned instead&

    File#$includes$ui$ui-input&inc

    Paraeters#

    name +he

    name o#the

    submitbutton&

    "alue +he "alueo# the

    submit

    button&

    echo *# this"alue is

    true thesubmit

    button isprinted(

    otherisethe H+@L

    isreturned&

    function submit_cells($name, $%alue, $extra="")

    Action#5rints a submit button inside a +1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    name +he name

    o# thesubmit

    button&

    "alue +he "alue

    o# thesubmit

    button&

    e/tra 5arameters

    to the +1&

    1

  • 8/10/2019 FrontAccounting API Manual

    19/72

    function submit_ro($name, $%alue, $right=true, $extra="")

    Action#5rints a submit button inside a +;!+1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    name +he nameo# the

    submit

    button&

    "alue +he "alueo# the

    submit

    button&

    right *# this istrue( an

    e/tra(empty +1

    is printed&

    e/tra 5arameters

    to the +1&

    function chec($label, $name, $%alue, $submit_on_change=false)

    Action#5rints a chec%bo/ ith an optional label&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this is

    not null( alabel is

    printed in

    #ront o#the

    chec%bo/&

    name +he name

    o# thechec%bo/&

    "alue +he "alue

    1!

  • 8/10/2019 FrontAccounting API Manual

    20/72

    o# the

    chec%bo/&

    submit-on-change *# this is

    true( the

    #orm is

    submittedhen

    clic%ingthe

    chec%bo/&

    function chec_cells($label, $name, $%alue, $submit_on_change=false)function chec_ro($label, $name, $%alue, $submit_on_change=false)

    Action#5rints a chec%bo/ ith an optional label inside a +1 or +;!+1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this isnot null( a

    label is

    printed ina +1

    be#orethe

    chec%bo/&

    name +he name

    o# thechec%bo/&

    "alue +he "alue

    o# thechec%bo/&

    submit-on-change *# this is

    true( the#orm is

    submitted

    henclic%ingthe

    chec%bo/&

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

    Action#5rints a label te/t3 inside a +1&

    19

  • 8/10/2019 FrontAccounting API Manual

    21/72

  • 8/10/2019 FrontAccounting API Manual

    22/72

    in a +1&

    bold *# this istrue(

    the

    .uantity

    isprinted

    in bold&

    function label_cells($label, $%alue, $params="", $params2="")function label_ro($label, $%alue, $params="", $params2="")

    Action#5rints a "alue te/t3 inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this isnot null( a

    label isprinted in a

    +1&

    "alue +he "alueis printed

    in a +1&

    params 5arametersto the label+1&

    params2 5arametersto the

    "alue +1&

    function text_cells($label, $name, $%alue, $si'e="", $max="", $params="",$post_label="", $disabled="")function text_ro($label, $name, $%alue, $si'e, $max, $params="",$post_label="")

    Action#5rints an input te/t bo/ inside a +1 or +;!+1 ith an optional label +1 and optionalpost label and optional disabled&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    21

  • 8/10/2019 FrontAccounting API Manual

    23/72

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the inputte/t bo/&

    "alue *# "alue isnull and the

    58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    siBe *# siBe is

    not empty a

    siBe is set&

    ma/ *# ma/ is

    not empty ama/length is

    set&

    params 5arameters

    to the label+1&

    post-label *#post-label

    is not emptya label is

    printed a#terthe input

    bo/&

    disabled +he "alue o#

    disabled isprinted ust

    a#ter theinput& Can

    be used #ore/tra

    parameters

    #or the inputbo/&

    function text_cells_ex($label, $name, $si'e, $max=null, $init=null,$params=null, $post_label=null)

    22

  • 8/10/2019 FrontAccounting API Manual

    24/72

    function text_ro_ex($label, $name, $si'e, $max=null, $%alue=null,$params=null, $post_label=null)

    Action#Li%e te/t-cells( but i# init is not null( the 58+=name? is set to init( otherise58+=name? is set to an empty string& +he "alue is set to 58+=name?&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#the input

    te/t bo/&

    siBe *# siBe is notempty a siBe

    is set&

    ma/ *# ma/ is

    not set( thema/length is

    set to siBe&

    init *# init is not

    set( the58+=name?

    is set toinit(

    otherise58+=name?

    is set to anempty string&

    +he "alue isset to

    58+=name?&

    params 5arameters

    to the label

    +1&

    post-label *#post-label

    is not emptya label is

    printed a#terthe input

    bo/&

    23

  • 8/10/2019 FrontAccounting API Manual

    25/72

    function date_cells($label, $name, $init=null, $inc_days=0, $inc_months=0,$inc_years=0, $params=null)function date_ro($label, $name, $init=null, $inc_days=0, $inc_months=0,$inc_years=0, $params=null)

    Action#Li%e te/t-cells( but i# init is not null( the 58+=name? is set to init( otherise

    58+=name? is set to today>s date&

    +he "alue is set to 58+=name?& +he date "alues are user #ormatted& *# the global "ariable(use-date-pic%er( is set

    a date pic%er is is placed a#ter the input bo/( here you can alter the date "alues&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#the input

    te/t bo/&

    init *# init is not

    set( the58+=name?

    is set toinit(

    otherise

    58+=name?

    is set totoday>s date&

    +he "alue isset to

    58+=name?&

    inc-days *# init is not

    set( you canadd an initial

    day "alue&6egati"e

    "alues arealloed&

    inc-months *# init is not

    set( you can

    add an initialmonth "alue&

    6egati"e"alues are

    alloed&

    24

  • 8/10/2019 FrontAccounting API Manual

    26/72

    inc-years *# init is not

    set( you canadd an initial

    year "alue&6egati"e

    "alues are

    alloed&

    params 5arametersto the label

    +1&

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

    Action#5rints a percent input te/t bo/( ith a >> label a#ter( inside a +;!+1 ith an

    optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this is not

    null( a label

    is printed ina +1&

    name +he name o#

    the inputte/t bo/&

    init *# init isnull and the

    58+=name?is not set an

    empty "alueis set(

    otherise

    the58+=name?

    "alue is set&

    function amount_cells($label, $name, $init=null, $params=null,$post_label=null)function amount_ro($label, $name, $init=null, $params=null, $post_label=null)

    Action#5rints an amount input te/t bo/ ma/ 4D digits3 inside a +1 or +;!+1 ith an

    optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    25

  • 8/10/2019 FrontAccounting API Manual

    27/72

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the inputte/t bo/&

    init *# init isnull and the

    58+=name?

    is not set anempty "alue

    is set(

    otherise

    the58+=name?"alue is set&

    params +heparams to

    the label+1&

    post-label +he

    post-labela#ter the

    input bo/&

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

    Action#5rints an small amount input te/t bo/ ma/ 42 digits3 inside a +1 or +;!+1 ith an

    optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-input&inc

    Paraeters#

    label *# this is not

    null( a label

    is printed ina +1&

    name +he name o#

    the inputte/t bo/&

    26

  • 8/10/2019 FrontAccounting API Manual

    28/72

  • 8/10/2019 FrontAccounting API Manual

    29/72

    characters

    o# thete/tarea

    bo/&

    ros +he number

    o# ros inthe te/tarea

    bo/&

    params +he

    params tothe label

    +1&

    function supplier_list_cells($label, $name, $selected_id, $all_option=false,$submit_on_change=false)function supplier_list_ro($label, $name, $selected_id, $all_option=false,

    $submit_on_change=false)Action#5rints a supplier listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name

    ? is not setan empty

    "alue is set(

    otherisethe58+=name

    ? "alue isset&

    all-option *# true( All isthe #irst

    choice&

    2!

  • 8/10/2019 FrontAccounting API Manual

    30/72

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

    function customer_list_cells($label, $name, $selected_id, $all_option=false,$submit_on_change=false)function customer_list_ro($label, $name, $selected_id, $all_option=false,$submit_on_change=false)

    Action#5rints a customer listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name

    ? is not setan empty

    "alue is set(otherise

    the

    58+=name? "alue is

    set&

    all-option *# true( All isthe #irst

    choice&

    submit-on-change *# true( the#orm issubmitted

    on change&

    function customer_branches_list_cells($label, $name, $selected_id,$all_option=false, $enabled=true, $submit_on_change=false)

    29

  • 8/10/2019 FrontAccounting API Manual

    31/72

    function customer_branches_list_ro($label, $name, $selected_id,$all_option=false, $submit_on_change=false)

    Action#5rints a customer branch listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null andthe

    58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    all-option *# true( All is

    the #irstchoice&

    enabled *# true( only

    disable-trans : 0 are

    shon&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

    function locations_list_cells($label, $name, $selected_id, $all_option=false,$submit_on_change=false)function locations_list_ro($label, $name, $selected_id, $all_option=false,$submit_on_change=false)

    Action#5rints a locations listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    30

  • 8/10/2019 FrontAccounting API Manual

    32/72

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#selected-id

    is null and

    the58+=name

    ? is not set

    an empty

    "alue is set(otherisethe

    58+=name? "alue is

    set&

    all-option *# true( All

    locations isthe #irst

    choice&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

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

    Action#5rints a currencies listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed in

    a +1&

    name +he name o#

    31

  • 8/10/2019 FrontAccounting API Manual

    33/72

    the list bo/&

    selected-id *#selected-id

    is null and

    the

    58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

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

    Action#5rints a #iscal years listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#selected-id

    is null and

    the58+=name?

    is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    function dimensions_list_cells($label, $name, $selected_id, $no_option=false,$shoname=null, $shoclosed=false, $shotype=0)function dimensions_list_ro($label, $name, $selected_id, $no_option=false,$shoname=null, $shoclosed=false, $shotype=0)

    32

  • 8/10/2019 FrontAccounting API Manual

    34/72

    Action#5rints a dimensions listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#

    selected-id

    is null and

    the58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    no-option *# true( anAll

    1imensions

    is the #irstchoise&

    shoname *# true( the

    dimensionname is

    shon&

    shoclosed *# true( the

    closeddimensions

    are shonas ell&

    shotype Will onlysho the

    dimensiontype&

    function stoc_items_list_cells($label, $name, $selected_id,$all_option=false, $submit_on_change=false)

    33

  • 8/10/2019 FrontAccounting API Manual

    35/72

    function stoc_items_list_ro($label, $name, $selected_id, $all_option=false,$submit_on_change=false)

    Action#5rints a stoc% items listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null andthe

    58+=name? is not set

    an empty"alue is set(

    otherisethe

    58+=name? "alue is

    set&

    all-option *# true( Allstoc% itemsis the #irst

    choice&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

    function stoc_bom_items_list_cells($label, $name, $selected_id,$all_option=false, $submit_on_change=false)

    function stoc_bom_items_list_ro($label, $name, $selected_id,$all_option=false, $submit_on_change=false)

    Action#5rints a stoc% bom bill o# material3 items listbo/ inside a +1 or +;!+1 ith an

    optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    34

  • 8/10/2019 FrontAccounting API Manual

    36/72

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the

    58+=name? is not set

    an empty

    "alue is set(

    otherisethe58+=name

    ? "alue isset&

    all-option *# true( Allstoc% bom

    items is the#irst choice&

    submit-on-chang

    e

    *# true( the

    #orm is

    submittedon change&

    function stoc_manufactured_items_list_cells($label, $name, $selected_id,$all_option=false, $submit_on_change=false)function stoc_manufactured_items_list_ro($label, $name, $selected_id,$all_option=false, $submit_on_change=false)

    Action#5rints a stoc% manu#actured items listbo/ inside a +1 or +;!+1 ith an optionallabel +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    35

  • 8/10/2019 FrontAccounting API Manual

    37/72

    name +he name o#

    the list bo/&

    selected-id *#

    selected-id

    is null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    all-option *# true( All

    stoc%manu#acture

    d items isthe #irst

    choice&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted on

    change&

    function stoc_purchasable_items_list_cells($label, $name, $selected_id,$all_option=false, $submit_on_change=false)function stoc_purchasable_items_list_ro($label, $name, $selected_id,

    $all_option=false, $submit_on_change=false)Action#5rints a stoc% purchasable items listbo/ inside a +1 or +;!+1 ith an optional label

    +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#selected-id

    is null and

    36

  • 8/10/2019 FrontAccounting API Manual

    38/72

    the

    58+=name? is not set

    an empty"alue is set(

    otherise

    the58+=name? "alue is

    set&

    all-option *# true( All

    stoc%purchasable

    items is the#irst choice&

    submit-on-change

    *# true( the#orm is

    submittedon change&

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

    Action#5rints a stoc% item types listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the

    58+=name?is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    3

  • 8/10/2019 FrontAccounting API Manual

    39/72

    enabled *# true( the

    #orm issubmitted

    on change(else the

    listbo/ is

    disabled&

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

    Action#5rints a stoc% units listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    enabled *# true( the#orm is

    submitted

    on change(else the

    listbo/ isdisabled&

    function stoc_categories_list_cells($label, $name, $selected_id)function stoc_categories_list_ro($label, $name, $selected_id)

    Action#5rints a stoc% categories listbo/ inside a +1 or +;!+1 ith an optional label +1&

    3!

  • 8/10/2019 FrontAccounting API Manual

    40/72

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#

    selected-idis null and

    the

    58+=name?

    is not set anempty "alueis set(

    otherisethe

    58+=name?"alue 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_ro($label, $name, $selected_id, $all_option=false,$all_option_name=null, $submit_on_change=false)

    Action#5rints a ta/ type listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label is

    printed in a+1&

    name +he name o#the list bo/&

    selected-id *# selected-idis null and the

    58+=name? isnot set an

    empty "alue is

    39

  • 8/10/2019 FrontAccounting API Manual

    41/72

    set( otherise

    the58+=name?

    "alue is set&

    all-option *# true( All

    stoc%purchasable

    items is the#irst choice&

    all-option-name

    *# not null( theall-option-na

    me is printed&

    submit-on-cha

    nge

    *# true( the

    #orm issubmitted on

    change&

    function tax_groups_list_cells($label, $name, $selected_id,$submit_on_change=false)function tax_groups_list_ro($label, $name, $selected_id,$submit_on_change=false)

    Action#5rints a ta/ type listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the

    58+=name? is not set

    an empty

    "alue is set(otherise

    the58+=name

    ? "alue is

    40

  • 8/10/2019 FrontAccounting API Manual

    42/72

    set&

    submit-on-change

    *# true( the#orm is

    submitted

    on change&

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

    Action#5rints an item ta/ types listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed in

    a +1&

    name +he name o# the list bo/&

    selected-id *#selected-id

    is null andthe

    58+=name?

    is not set anempty "alueis set(

    otherisethe

    58+=name?

    "alue is set&

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

    Action#5rints a shippers listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    41

  • 8/10/2019 FrontAccounting API Manual

    43/72

    is printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

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

    Action#5rints a sales persons listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set an

    empty "alueis set(otherise

    the58+=name?

    "alue is set&

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

    42

  • 8/10/2019 FrontAccounting API Manual

    44/72

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

    Action#5rints a sales areas listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-id

    is null andthe58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    function ororders_list_cells($label, $name, $selected_id)function ororders_list_ro($label, $name, $selected_id)

    Action#5rints a or%orders listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the

    43

  • 8/10/2019 FrontAccounting API Manual

    45/72

    58+=name?

    is not set anempty "alue

    is set(otherise

    the

    58+=name?"alue is set&

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

    Action#5rints a payment terms listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

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

    function credit_status_list_ro($label, $name, $selected_id)Action#5rints a credit status listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    44

  • 8/10/2019 FrontAccounting API Manual

    46/72

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

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

    Action#5rints a sales types listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o# the list bo/&

    selected-id *#

    selected-idis null and

    the

    58+=name?is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    45

  • 8/10/2019 FrontAccounting API Manual

    47/72

    function mo%ements_types_list_cells($label, $name, $selected_id)function mo%ement_types_list_ro($label, $name, $selected_id)

    Action#5rints a mo"ements types listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null andthe

    58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    function ban_trans_types_list_cells($label, $name, $selected_id)function ban_trans_types_list_ro($label, $name, $selected_id)

    Action#5rints a ban% transaction types listbo/ inside a +1 or +;!+1 ith an optional label+1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o# the list bo/&

    selected-id *#

    selected-id

    46

  • 8/10/2019 FrontAccounting API Manual

    48/72

    is null and

    the58+=name?

    is not set anempty "alue

    is set(

    otherisethe58+=name?

    "alue is set&

    function orcenter_list_cells($label, $name, $selected_id, $all_option=false)function orcenter_list_ro($label, $name, $selected_id, $all_option=false)

    Action#5rints a or%center listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    all-option *# true( All is

    the #irstchoice&

    function ban_accounts_list_cells($label, $name, $selected_id,$submit_on_change=false)function ban_accounts_list_ro($label, $name, $selected_id,$submit_on_change=false)

    4

  • 8/10/2019 FrontAccounting API Manual

    49/72

    Action#5rints a ban% accounts listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#

    selected-id

    is null and

    the58+=name? is not set

    an empty"alue is set(

    otherisethe

    58+=name? "alue is

    set&

    submit-on-chang

    e

    *# true( the

    #orm is

    submittedon change&

    function class_list_cells($label, $name, $selected_id,$submit_on_change=false)function class_list_ro($label, $name, $selected_id, $submit_on_change=false)

    Action#5rints an account class listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed in

    a +1&

    name +he name o#

    4!

  • 8/10/2019 FrontAccounting API Manual

    50/72

    the list bo/&

    selected-id *#selected-id

    is null and

    the

    58+=name? is not set

    an empty"alue is set(

    otherisethe

    58+=name? "alue is

    set&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

    function gl_all_accounts_list_cells($label, $name, $selected_id,$sip_ban_accounts=false, $sho_group=false, $on_change="")function gl_all_accounts_list_ro($label, $name, $selected_id,$sip_ban_accounts=false, $sho_group=false, $on_change="")

    Action#5rints an account class listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is not

    null( a label

    is printed ina +1&

    name +he name

    o# the listbo/&

    selected-id *#

    selected-id is nulland the

    58+=name? is not set

    an empty"alue is set(

    otherise

    the

    49

  • 8/10/2019 FrontAccounting API Manual

    51/72

    58+=name

    ? "alue isset&

    s%ip-ban%-account

    s

    *# true( the

    ban%

    accountsare not

    shon&

    sho-group *# true( the

    ban%account

    groups areshon&

    on-change *# set( theon-change

    "alue is

    printed&

    function yesno_list_cells($label, $name, $selected_id, $name_yes="",$name_no="", $submit_on_change=false)function yesno_list_ro($label, $name, $selected_id, $name_yes="",$name_no="", $submit_on_change=false)

    Action#5rints a yesno listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o# the list bo/&

    selected-id *#selected-id

    is null and

    the58+=name

    ? is not set

    an empty"alue is set(

    otherisethe

    58+=name

    50

  • 8/10/2019 FrontAccounting API Manual

    52/72

    ? "alue is

    set&

    name-yes *# set( the

    "alue is

    printed( else

    >'es> isprinted&

    name-no *# set( the"alue is

    printed( else>6o> is

    printed&

    submit-on-chang

    e

    *# true( the

    #orm issubmitted

    on change&

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

    Action#5rints a languages listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a labelis printed in

    a +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null and

    the58+=name?

    is not set anempty "alue

    is set(otherise

    the58+=name?

    "alue is set&

    51

  • 8/10/2019 FrontAccounting API Manual

    53/72

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

    Action#5rints a numbered listbo/ inside a +1 or +;!+1 ith an optional label +1&

    $eturn value#6one&

    File#$includes$ui$ui-lists&inc

    Paraeters#

    label *# this is notnull( a label

    is printed ina +1&

    name +he name o#

    the list bo/&

    selected-id *#

    selected-idis null andthe

    58+=name?is not set an

    empty "alueis set(

    otherisethe

    58+=name?"alue is set&

    #rom From "alue

    included3&

    to +o "alueincluded3&

    52

  • 8/10/2019 FrontAccounting API Manual

    54/72

    Javascript Functions

    function get_js_go_bac()Action#Gets Ja"ascript code #or a >Eac%> lin%& 5opups are closed( normal indos are going

    bac%&

    $eturn value#Ja"ascript code&

    File#$includes$ui$ui-"ie&inc

    function get_js_open_indo($idth, $height)

    Action#Gets Ja"ascript code #or a centered 5opup indo&

    $eturn value#Ja"ascript code&

    File#$includes$ui$ui-"ie&inc

    Paraeters#

    idth +heidth o#

    the5opup

    indo&

    height +he

    heighto# the5opup

    indo&

    function get_js_date_picer()

    Action#Gets Ja"ascript code #or a date pic%er& *# the global "ariable use-date-pic%er is

    set( this code is needed&

    *# the global "ariable date-system is set to 0( the Gregorian Calendar is used& A "alue o# 4ill sho the Jalali Calendar

    and a "alue o# 2 ill sho the *slamic Calendar&

    $eturn value#Ja"ascript code&

    File#$includes$ui$ui-"ie&inc

    function alert($msg)

    Action#5rints Ja"ascript code #or an alert popup& Can be used as a debugging #eature&

    53

  • 8/10/2019 FrontAccounting API Manual

    55/72

    $eturn value#6one&

    File#$includes$ui$ui-"ie&inc

    Paraeters#

    msg 8hosthe

    messagein a

    a"ascriptalert bo/&

    54

  • 8/10/2019 FrontAccounting API Manual

    56/72

    Database Functions (low level)

    function db_&uery($s&l, $err_msg)Action#8end an 8L statement to @y8.l ser"er&

    $eturn value#A result set&

    File#$includes$db$connect-db&inc

    Paraeters#

    s.l An 8L

    statement(li%e

    8,L,C+(*68,;+(

    )51A+,(1,L,+,&

    err-msg 'ou cansupply an

    error

    message i#the action

    #ails&

    function db_fetch_ro($result)

    Action#Fetches the ne/t ro array #rom the result set in db-.uery&

    $eturn value#A ro array that is numeric( i&e& ro=0?( ro=4? ans so on&

    File#$includes$db$connect-db&inc

    Paraeters#

    result +he result

    setreturned

    #romdb-.uery&

    function db_fetch($result)

    Action#Fetches the ne/t ro array #rom the result set in db-.uery&

    $eturn value#A ro array that is #ield based( i&e& ro=>id>?( ro=>name>? ans so on&

    55

  • 8/10/2019 FrontAccounting API Manual

    57/72

    File#$includes$db$connect-db&inc

    Paraeters#

    result +he result

    setreturned

    #romdb-.uery&

    function db_num_ros($result)

    Action#Fetches the number o# ros in the result set in db-.uery&

    $eturn value#A number o# ros in the result set&

    File#$includes$db$connect-db&inc

    Paraeters#

    result +he resultset

    returned

    #romdb-.uery&

    function db_num_fields($result)

    Action#Fetches the number o# #ields in the result set in db-.uery&

    $eturn value#A number o# #ields in the result set&

    File#$includes$db$connect-db&inc

    Paraeters#

    result +he result

    set

    returned#rom

    db-.uery&

    function db_insert_id()

    Action#Gets the inserted id #rom the last *68,;+ *6+ statement&

    $eturn value#+he inserted id "alue&

    56

  • 8/10/2019 FrontAccounting API Manual

    58/72

    File#$includes$db$connect-db&inc

    function begin_transaction

    Action#Logs the transactions during a critical operation& )se transactions i# you need to%eep se"eral *68,;+( 1,L,+, or )51A+,

    statements tied together

    $eturn value#6one&

    File#$includes$db$s.l-#unctions&inc

    function commit_transaction

    Action#Commits the transactions since begin-transaction& )se transactions i# you need to%eep se"eral *68,;+( 1,L,+, or )51A+,

    statements tied together

    $eturn value#6one&

    File#$includes$db$s.l-#unctions&inc

    function cancel_transaction

    Action#Cancels rolls bac%3 the transactions since begin-transaction& )se transactions i#you need to %eep se"eral *68,;+( 1,L,+, or )51A+,

    statements tied together

    $eturn value#6one&

    File#$includes$db$s.l-#unctions&inc

    5

  • 8/10/2019 FrontAccounting API Manual

    59/72

    Database Functions (high level)

    5!

  • 8/10/2019 FrontAccounting API Manual

    60/72

    Date functions

    function is_date($date_)Action#Chec%s i# date- is a "alid date based on the current #ormatting&

    $eturn value#+rue i# date- is a "alid date( otherise #alse&

    File#$includes$date-#unctions&inc

    Paraeters#

    date

    -

    +he

    #ormatteddate

    "alue tobe

    tested&

    function today()

    Action#;eturns a #ormatted date "alue based on the current setting&

    $eturn value#;eturns a #ormatted date "alue based on the current setting&

    File#$includes$date-#unctions&inc

    function no()

    Action#;eturns a #ormatted time "alue based on the current setting&

    $eturn value#;eturns a #ormatted time "alue based on the current setting&

    File#$includes$date-#unctions&inc

    function is_date_in_fiscalyear($date, $con%ert=false)

    Action#Chec%s i# date is inside the current #iscal year&

    $eturn value#+rue i# date is inside the current #iscal year( otherise #alse&

    File#$includes$date-#unctions&inc

    Paraeters#

    date +he#ormatted

    date

    59

  • 8/10/2019 FrontAccounting API Manual

    61/72

    "alue to

    betested&

    con"ert 'ou can

    test a

    non!#ormatted

    8L"alue

    directly i#this "alue

    is true&

    function begin_fiscalyear()

    Action#;eturns the #ormatted beginning date o# the current #iscal year&

    $eturn value#;eturns the #ormatted beginning date o# the current #iscal year&

    File#$includes$date-#unctions&inc

    function end_fiscalyear()

    Action#;eturns the #ormatted ending date o# the current #iscal year&

    $eturn value#;eturns the #ormatted ending date o# the current #iscal year&

    File#$includes$date-#unctions&inc

    function begin_month($date)Action#;eturns the #ormatted #irst day o# the month based on the date "alue&

    $eturn value#;eturns the #ormatted #irst day o# the month based on the date "alue&

    File#$includes$date-#unctions&inc

    Paraeters#

    date +he#ormatted

    date

    "alue&

    function end_month($date)

    Action#;eturns the #ormatted last day o# the month based on the date "alue&

    $eturn value#;eturns the #ormatted last day o# the month based on the date "alue&

    File#$includes$date-#unctions&inc

    60

  • 8/10/2019 FrontAccounting API Manual

    62/72

    Paraeters#

    date +he

    #ormatteddate

    "alue&

    function add_days($date, $days)

    Action#;eturns the #ormatted ne date a#ter adding days& days can be negati"e&

    $eturn value#;eturns the #ormatted ne date a#ter adding days& days can be negati"e&

    File#$includes$date-#unctions&inc

    Paraeters#

    date +he#ormatted

    date

    "alue&

    days 6umbero# days to

    add&days

    can benegati"e&

    function add_months($date, $months)

    Action#;eturns the #ormatted ne date a#ter adding months& months can be negati"e&

    $eturn value#;eturns the #ormatted ne date a#ter adding months& months can be

    negati"e&

    File#$includes$date-#unctions&inc

    Paraeters#

    date +he

    #ormatteddate"alue&

    months 6umbero#

    monthsto add&

    months

    61

  • 8/10/2019 FrontAccounting API Manual

    63/72

    can be

    negati"e&

    function add_years($date, $years)

    Action#;eturns the #ormatted ne date a#ter adding years& years can be negati"e&

    $eturn value#;eturns the #ormatted ne date a#ter adding years& years can benegati"e&

    File#$includes$date-#unctions&inc

    Paraeters#

    date +he

    #ormatteddate

    "alue&

    years 6umber

    o# yearsto add&

    yearscan be

    negati"e&

    function s&l2date($date)

    Action#;eturns the #ormatted date #rom the @y8.l date "alue ''''$@@$11&

    $eturn value#;eturns the #ormatted date #rom the @y8.l date "alue ''''$@@$11&

    File#$includes$date-#unctions&inc

    Paraeters#

    date [email protected]

    date"alue&

    function date2s&l($date)Action#;eturns the @y8.l date "alue ''''$@@$11 #rom the #ormatted date&

    $eturn value#;eturns the @y8.l date "alue ''''$@@$11 #rom the #ormatted date&

    File#$includes$date-#unctions&inc

    Paraeters#

    62

  • 8/10/2019 FrontAccounting API Manual

    64/72

    date +he

    #ormatteddate

    "alue&

    function date_greater_date2($date, $date2)

    Action#;eturns true i# the #ormatted date4 "alue is greater than the #ormatted date2"alue&

    $eturn value#;eturns true i# the #ormatted date4 "alue is greater than the #ormatted

    date2 "alue&

    File#$includes$date-#unctions&inc

    Paraeters#

    date4

    +he #irst#ormatted

    date"alue&

    date2

    +hesecond

    #ormatted

    date"alue&

    63

  • 8/10/2019 FrontAccounting API Manual

    65/72

    Foratting Functions

    function number_format2($number, $decimals=0)Action#;eturns the #ormatted number "alue( based on the current user settings&

    $eturn value#;eturns the #ormatted number "alue( based on the current user settings&

    File#$includes$current-user&inc

    Paraeters#

    number +he

    number tobe

    #ormatted&

    decimals +he

    number o#decimals&

    64

  • 8/10/2019 FrontAccounting API Manual

    66/72

    !"aple Page

    php

    $page_security = *+$path_to_root="-"+include($path_to_root "-includes-sessioninc")+

    page(_(".ales /ersons"))+

    include($path_to_root "-includes-uiinc")+

    if (isset($_13!selected_id!4))5

    $selected_id = strtoupper($_13!selected_id!4)+

    6elseif (isset($_/7.3!selected_id!4))5

    $selected_id = strtoupper($_/7.3!selected_id!4)+6

    --888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

    if (isset($_/7.3!9::_;1/:91_;1

    --initialise no input errors assumed initially before e test$input_error = 0+

    if (strlen($_/7.3!salesman_name!4) == 0)5

    $input_error = +display_error(_("he sales person name cannot be empty"))+

    6

    if ($input_error ?= )5if (isset($selected_id))5

    -@selected_id could also exist if submit had not been clicedthis code ould not run in this case cos

    submit is false of course see the delete code belo@-

    $s&l = ">/:91 "A_/B1C"salesman .1 salesman_name=!" $_/7.3!salesman_name!4 "!,

    salesman_phone=!" $_/7.3!salesman_phone!4 "!,salesman_fax=!" $_/7.3!salesman_fax!4 "!,salesman_email=!" $_/7.3!salesman_email!4 "!DE1B1 salesman_code = !$selected_id!"+

    6else

    65

  • 8/10/2019 FrontAccounting API Manual

    67/72

    [email protected] group is null cos no item selected on first time

    round so must be adding a record must be submitting ne entries in the ne .ales8person form @-$s&l = ";F.1B ;F7 "A_/B1C"salesman (salesman_name,

    salesman_phone, salesman_fax, salesman_email)G9H>1. (!" $_/7.3!salesman_name!4 "!, !"

    $_/7.3!salesman_phone!4 "!,!" $_/7.3!salesman_fax!4 "!, !"

    $_/7.3!salesman_email!4 "!)"+6

    --run the s&l from either of the abo%e possibilitesdb_&uery($s&l,"he insert or update of the salesperson failed")+

    meta_forard($_.1BG1B3!/E/_.1HC!4)+6

    6if (isset($_13!delete!4))5

    --the lin to delete a selected record as cliced instead of thesubmit button

    -- /B1G1F :1H11. ;C :1/1F:1F B1I7B:. ;F !debtors_master!

    $s&l= ".1H1I I7>F(@) CB7< "A_/B1C"cust_branch DE1B1salesman=!$selected_id!"+

    $result = db_&uery($s&l,"chec failed")+$myro = db_fetch_ro($result)+if ($myro304 J 0)5

    display_error("Iannot delete this sales8person becausebranches are set up referring to this sales8person 8 "

    "first alter the branches concerned")+6else5

    $s&l=":1H11 CB7< "A_/B1C"salesman DE1B1salesman_code=!$selected_id!"+

    db_&uery($s&l,"he sales8person could not be deleted")+

    meta_forard($_.1BG1B3!/E/_.1HC!4)+6

    6

    --888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

    $s&l = ".1H1I @ CB7< "A_/B1C"salesman"+$result = db_&uery($s&l,"could not get sales persons")+

    start_table("$table_style idth=K0L")+$th = array(_("Fame"), _("/hone"), _("Cax"), _("1mail"), "", "")+table_header($th)+

    $ = 0+

    66

  • 8/10/2019 FrontAccounting API Manual

    68/72

    hile ($myro = db_fetch($result))5

    alt_table_ro_color($)+

    label_cell($myro3"salesman_name"4)+label_cell($myro3"salesman_phone"4)+label_cell($myro3"salesman_fax"4)+label_cell($myro3"salesman_email"4)+edit_lin_cell(.;: "selected_id=" $myro3"salesman_code"4)+delete_lin_cell(.;: "selected_id=" $myro3"salesman_code"4

    "#delete=")+end_ro()+

    6 --1F: DE;H1 H;. H77/

    end_table()+

    --888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

    hyperlin_no_params($_.1BG1B3!/E/_.1HC!4, _("Fe .ales /erson"))+

    --888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

    start_form()+

    if (isset($selected_id))5

    --editing an existing .ales8person$s&l = ".1H1I @ CB7< "A_/B1C"salesman DE1B1

    salesman_code=!$selected_id!"+

    $result = db_&uery($s&l,"could not get sales person")+$myro = db_fetch($result)+

    $_/7.3!salesman_name!4 = $myro3"salesman_name"4+$_/7.3!salesman_phone!4 = $myro3"salesman_phone"4+$_/7.3!salesman_fax!4 = $myro3"salesman_fax"4+$_/7.3!salesman_email!4 = $myro3"salesman_email"4+

    hidden(!selected_id!, $selected_id)+6

    start_table("$table_style2 idth=K0L")+

    text_ro_ex(_(".ales person nameM"), !salesman_name!, *0)+text_ro_ex(_("elephone numberM"), !salesman_phone!, 20)+text_ro_ex(_("Cax numberM"), !salesman_fax!, 20)+text_ro_ex(_("1mailM"), !salesman_email!, K0)+

    end_table()+

    submit_add_or_update_center(?isset($selected_id))+

    end_form()+

    6

  • 8/10/2019 FrontAccounting API Manual

    69/72

    end_page()+

    J

    6!

  • 8/10/2019 FrontAccounting API Manual

    70/72

    "re#ort"includes"re#orting.inc

    Fungsi $ %enentu&an #ara%eter re#ort %asing %asing %odul re#ort

    "re#ort"includes"re#orts'%ain.#(#

    Fungsi $ %ena%)a(an re#ort untu& %enun*u&&an #ara%eter yang diguna&an

    "re#ort"includes"re#orts'classes.inc

    Mena%)a(&an +A, -le $ "sales"includes"ui"sales'order'ui.inc list di des&ri#si&an di

    "includes"ui"ui'list.inc

    Penambahan applikasi

    Frontaccounting.php

    69

  • 8/10/2019 FrontAccounting API Manual

    71/72

    if /isset/#at('to'root isset/',7#at('to'root78

    isset/'P:,7#at('to'root78

    die/;Restricted access;

    sBitc( /ty#e

    >

    case :,'KHRAD $ return array/;;.,L'PRF.;gl'trans; ;ty#e; ;ty#e'no; null

    ;tran'date;