-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchart_of_accounts.php
executable file
·112 lines (101 loc) · 4.92 KB
/
chart_of_accounts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
require_once 'conf/smarty-conf.php';
include 'functions/chart_of_accounts_functions.php';
include 'functions/user_functions.php';
$module_no = 8;
if ($_SESSION ['login'] == 1) {
if (check_access ( $module_no, $_SESSION ['user_id'] ) == 1) {
if ($_REQUEST ['job'] == "chart_of_accounts_form") {
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'page', "Chart Of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
}
elseif ($_REQUEST ['job'] == "add") {
if ($_REQUEST ['ok'] == 'Update') {
$id = $_SESSION ['id'];
$info = get_account_info_by_id ( $id );
$account_name = $_POST ['account_name'];
$account_code = $_POST ['account_code'];
$parent_account = $_POST ['parent_account'];
$category = $_POST ['category'];
$address = addslashes ( $_POST ['address'] );
$contact_person = $_POST ['contact_person'];
$telephone = $_POST ['telephone'];
$fax = $_POST ['fax'];
$email = $_POST ['email'];
$account_status = $_POST ['account_status'];
$opening_balance = $_POST ['opening_balance'];
$opening_balance_date = $_POST ['opening_balance_date'];
$credit_limit = $_POST ['credit_limit'];
$credit_period = $_POST ['credit_period'];
update_account ( $id, $account_name, $account_code, $parent_account, $category, $address, $contact_person, $telephone, $fax, $email, $account_status, $opening_balance, $opening_balance_date, $credit_limit, $credit_period );
} else {
$account_name = $_POST ['account_name'];
$account_cde = $_POST ['account_code'];
$parent_account = $_POST ['parent_accunt'];
$category = $_POST ['category'];
$address = addslashes ( $_POST ['address'] );
$contact_person = $_POST ['contact_person'];
$telephone = $_POST ['telephone'];
$fax = $_POST ['fax'];
$email = $_POST ['email'];
$account_status = $_POST ['account_status'];
$opening_balance = $_POST ['opening_balance'];
$opening_balance_date = $_POST ['opening_balance_date'];
$credit_limit = $_POST ['credit_limit'];
$credit_period = $_POST ['credit_period'];
save_account ( $account_name, $account_code, $parent_account, $category, $address, $contact_person, $telephone, $fax, $email, $account_status, $opening_balance, $opening_balance_date, $credit_limit, $credit_period );
}
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'page', "Chart of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
} elseif ($_REQUEST ['job'] == "edit") {
$_SESSION ['id'] = $id = $_REQUEST ['id'];
$info = get_account_info_by_id ( $id );
$smarty->assign ( 'account_name', $info ['account_name'] );
$smarty->assign ( 'account_code', $info ['account_code'] );
$smarty->assign ( 'parent_account', $info ['parent_account'] );
$smarty->assign ( 'category', $info ['account_catagory'] );
$smarty->assign ( 'address', $info ['address'] );
$smarty->assign ( 'telephone', $info ['telephone'] );
$smarty->assign ( 'fax', $info ['fax'] );
$smarty->assign ( 'email', $info ['email'] );
$smarty->assign ( 'contact_person', $info ['contact_person'] );
$smarty->assign ( 'account_status', $info ['account_status'] );
$smarty->assign ( 'opening_balance', $info ['opening_balance'] );
$smarty->assign ( 'opening_balance_date', $info ['opening_balance_date'] );
$smarty->assign ( 'credit_limit', $info ['credit_limit'] );
$smarty->assign ( 'credit_period', $info ['credit_period'] );
$smarty->assign ( 'edit_mode', 'on' );
$smarty->assign ( 'edit', 'Accounts' );
$smarty->assign ( 'page', "Chart of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
} elseif ($_REQUEST ['job'] == 'search') {
$_SESSION ['search'] = $_POST ['search'];
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'search', "$_SESSION[search]" );
$smarty->assign ( 'search_mode', "on" );
$smarty->assign ( 'page', "Chart of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
} elseif ($_REQUEST ['job'] == "delete") {
cancel_account ( $_REQUEST ['id'] );
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'page', "Chart of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
} else {
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'page', "Chart of Accounts" );
$smarty->display ( 'chart_of_accounts/chart_of_accounts.tpl' );
}
} else {
$user_name = $_SESSION ['user_name'];
$smarty->assign ( 'org_name', "$_SESSION[org_name]" );
$smarty->assign ( 'error_report', "on" );
$smarty->assign ( 'error_message', "Dear $user_name, you don't have permission to access CHART OF ACCOUNTS." );
$smarty->assign ( 'page', "Access Error" );
$smarty->display ( 'user_home/access_error.tpl' );
}
} else {
$smarty->assign ( 'page', "Home" );
$smarty->display ( 'index.tpl' );
}