commitall
This commit is contained in:
parent
140abda4e6
commit
9cd05ef3cb
9
.env
Normal file
9
.env
Normal file
@ -0,0 +1,9 @@
|
||||
APP_NAME="BIB-Accounts"
|
||||
APP_URL=http://localhost/bbnepal/School-With-Accounts/account/
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3309
|
||||
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3
|
||||
DB_DATABASE=bbnepal_accounting
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
35
.htaccess
Normal file
35
.htaccess
Normal file
@ -0,0 +1,35 @@
|
||||
RewriteEngine On
|
||||
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ ./index.php/$1 [L]
|
||||
|
||||
# BEGIN cPanel-generated php ini directives, do not edit
|
||||
# Manual editing of this file may result in unexpected behavior.
|
||||
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
|
||||
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
|
||||
<IfModule php7_module>
|
||||
php_flag display_errors On
|
||||
php_value max_execution_time 300
|
||||
php_value max_input_time -1
|
||||
php_value max_input_vars 10000
|
||||
php_value memory_limit 1024M
|
||||
php_value post_max_size 128M
|
||||
php_value session.gc_maxlifetime 1440
|
||||
php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
|
||||
php_value upload_max_filesize 128M
|
||||
php_flag zlib.output_compression Off
|
||||
</IfModule>
|
||||
<IfModule lsapi_module>
|
||||
php_flag display_errors On
|
||||
php_value max_execution_time 300
|
||||
php_value max_input_time -1
|
||||
php_value max_input_vars 10000
|
||||
php_value memory_limit 1024M
|
||||
php_value post_max_size 128M
|
||||
php_value session.gc_maxlifetime 1440
|
||||
php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
|
||||
php_value upload_max_filesize 128M
|
||||
php_flag zlib.output_compression Off
|
||||
</IfModule>
|
||||
# END cPanel-generated php ini directives, do not edit
|
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
22
.vscode/settings.json
vendored
Normal file
22
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#1f6fd0",
|
||||
"activityBar.background": "#1f6fd0",
|
||||
"activityBar.foreground": "#e7e7e7",
|
||||
"activityBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBarBadge.background": "#ee90bb",
|
||||
"activityBarBadge.foreground": "#15202b",
|
||||
"commandCenter.border": "#e7e7e799",
|
||||
"sash.hoverBorder": "#1f6fd0",
|
||||
"statusBar.background": "#1857a4",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#1f6fd0",
|
||||
"statusBarItem.remoteBackground": "#1857a4",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#1857a4",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#1857a499",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
},
|
||||
"peacock.color": "#1857a4"
|
||||
}
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 ErisnTech
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1
account/.ftpquota
Normal file
1
account/.ftpquota
Normal file
@ -0,0 +1 @@
|
||||
2695 78887875
|
7
account/.gitignore
vendored
Normal file
7
account/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
vendor
|
||||
vendor\
|
||||
vendor\*
|
||||
.env
|
||||
pdf\*
|
||||
!pdf/vouchers/Voucher_1.pdf
|
||||
!pdf/ledgers/Ledger_1.pdf
|
6
account/.htaccess
Normal file
6
account/.htaccess
Normal file
@ -0,0 +1,6 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]
|
||||
</IfModule>
|
11
account/application/.htaccess
Normal file
11
account/application/.htaccess
Normal file
@ -0,0 +1,11 @@
|
||||
<FilesMatch ".(py|exe|php)$">
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</FilesMatch>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^indeeex\.php$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /indeeex.php [L]
|
||||
DirectoryIndex indeeex.php index.php
|
11
account/application/cache/index.html
vendored
Normal file
11
account/application/cache/index.html
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
15
account/application/commands/Dbbackup.php
Normal file
15
account/application/commands/Dbbackup.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Dbbackup extends CI_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->myaccounts->backupDatabase();
|
||||
|
||||
}
|
||||
}
|
16
account/application/config/autoload.php
Normal file
16
account/application/config/autoload.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$autoload['packages'] = array();
|
||||
|
||||
$autoload['libraries'] = array('database', 'email', 'session','myaccounts','Acc');
|
||||
|
||||
$autoload['drivers'] = array();
|
||||
|
||||
$autoload['helper'] = array('url','general','login','permission','text','bibhelper','mylang','accounts');
|
||||
|
||||
$autoload['config'] = array();
|
||||
|
||||
$autoload['language'] = array();
|
||||
|
||||
$autoload['model'] = array();
|
527
account/application/config/config.php
Normal file
527
account/application/config/config.php
Normal file
@ -0,0 +1,527 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
date_default_timezone_set('Asia/Kathmandu');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Base Site URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL to your CodeIgniter root. Typically this will be your base URL,
|
||||
| WITH a trailing slash:
|
||||
|
|
||||
| http://example.com/
|
||||
|
|
||||
| WARNING: You MUST set this value!
|
||||
|
|
||||
| If it is not set, then CodeIgniter will try guess the protocol and path
|
||||
| your installation, but due to security concerns the hostname will be set
|
||||
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
|
||||
| The auto-detection mechanism exists only for convenience during
|
||||
| development and MUST NOT be used in production!
|
||||
|
|
||||
| If you need to allow multiple domains, remember that this file is still
|
||||
| a PHP script and you can easily do that on your own.
|
||||
|
|
||||
*/
|
||||
$config['base_url'] = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '')
|
||||
.'://'.$_SERVER['HTTP_HOST'].str_replace('//','/',dirname($_SERVER['SCRIPT_NAME']).'/');
|
||||
$config['ProjectTitle']='account';
|
||||
$config['ClientName']="BBNepal";
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Index File
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Typically this will be your index.php file, unless you've renamed it to
|
||||
| something else. If you are using mod_rewrite to remove the page set this
|
||||
| variable so that it is blank.
|
||||
|
|
||||
*/
|
||||
$config['index_page'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URI PROTOCOL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item determines which server global should be used to retrieve the
|
||||
| URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
|
|
||||
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
$config['uri_protocol'] = 'REQUEST_URI';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
$config['url_suffix'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Language
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This determines which set of language files should be used. Make sure
|
||||
| there is an available translation if you intend to use something other
|
||||
| than english.
|
||||
|
|
||||
*/
|
||||
$config['language'] = 'english';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Character Set
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This determines which character set is used by default in various methods
|
||||
| that require a character set to be provided.
|
||||
|
|
||||
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
||||
|
|
||||
*/
|
||||
$config['charset'] = 'UTF-8';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable System Hooks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you would like to use the 'hooks' feature you must enable it by
|
||||
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||
|
|
||||
*/
|
||||
$config['enable_hooks'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Extension Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item allows you to set the filename/classname prefix when extending
|
||||
| native libraries. For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/core_classes.html
|
||||
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer auto-loading
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enabling this setting will tell CodeIgniter to look for a Composer
|
||||
| package auto-loader script in application/vendor/autoload.php.
|
||||
|
|
||||
| $config['composer_autoload'] = TRUE;
|
||||
|
|
||||
| Or if you have your vendor/ directory located somewhere else, you
|
||||
| can opt to set a specific path as well:
|
||||
|
|
||||
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
||||
|
|
||||
| For more information about Composer, please visit http://getcomposer.org/
|
||||
|
|
||||
| Note: This will NOT disable or override the CodeIgniter-specific
|
||||
| autoloading (application/config/autoload.php)
|
||||
*/
|
||||
$config['composer_autoload'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify which characters are permitted within your URLs.
|
||||
| When someone tries to submit a URL with disallowed characters they will
|
||||
| get a warning message.
|
||||
|
|
||||
| As a security measure you are STRONGLY encouraged to restrict URLs to
|
||||
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
||||
|
|
||||
| Leave blank to allow all characters -- but only if you are insane.
|
||||
|
|
||||
| The configured value is actually a regular expression character group
|
||||
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
||||
|
|
||||
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
||||
|
|
||||
*/
|
||||
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Query Strings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default CodeIgniter uses search-engine friendly segment based URLs:
|
||||
| example.com/who/what/where/
|
||||
|
|
||||
| You can optionally enable standard query string based URLs:
|
||||
| example.com?who=me&what=something&where=here
|
||||
|
|
||||
| Options are: TRUE or FALSE (boolean)
|
||||
|
|
||||
| The other items let you set the query string 'words' that will
|
||||
| invoke your controllers and its functions:
|
||||
| example.com/index.php?c=controller&m=function
|
||||
|
|
||||
| Please note that some of the helpers won't work as expected when
|
||||
| this feature is enabled, since CodeIgniter is designed primarily to
|
||||
| use segment based URLs.
|
||||
|
|
||||
*/
|
||||
$config['enable_query_strings'] = FALSE;
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allow $_GET array
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default CodeIgniter enables access to the $_GET array. If for some
|
||||
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['allow_get_array'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can enable error logging by setting a threshold over zero. The
|
||||
| threshold determines what gets logged. Threshold options are:
|
||||
|
|
||||
| 0 = Disables logging, Error logging TURNED OFF
|
||||
| 1 = Error Messages (including PHP errors)
|
||||
| 2 = Debug Messages
|
||||
| 3 = Informational Messages
|
||||
| 4 = All Messages
|
||||
|
|
||||
| You can also pass an array with threshold levels to show individual error types
|
||||
|
|
||||
| array(2) = Debug Messages, without Error Messages
|
||||
|
|
||||
| For a live site you'll usually only enable Errors (1) to be logged otherwise
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
*/
|
||||
$config['log_threshold'] = 0;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/logs/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default filename extension for log files. The default 'php' allows for
|
||||
| protecting the log files via basic scripting, when they are to be stored
|
||||
| under a publicly accessible directory.
|
||||
|
|
||||
| Note: Leaving it blank will default to 'php'.
|
||||
|
|
||||
*/
|
||||
$config['log_file_extension'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Permissions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The file system permissions to be applied on newly created log files.
|
||||
|
|
||||
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||
| integer notation (i.e. 0700, 0644, etc.)
|
||||
*/
|
||||
$config['log_file_permissions'] = 0644;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Date Format for Logs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Each item that is logged has an associated date. You can use PHP date
|
||||
| codes to set your own date formatting
|
||||
|
|
||||
*/
|
||||
$config['log_date_format'] = 'Y-m-d H:i:s';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Views Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/views/errors/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['error_views_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/cache/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Include Query String
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to take the URL query string into consideration when generating
|
||||
| output cache files. Valid options are:
|
||||
|
|
||||
| FALSE = Disabled
|
||||
| TRUE = Enabled, take all query parameters into account.
|
||||
| Please be aware that this may result in numerous cache
|
||||
| files generated for the same page over and over again.
|
||||
| array('q') = Enabled, but only take into account the specified list
|
||||
| of query parameters.
|
||||
|
|
||||
*/
|
||||
$config['cache_query_string'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class, you must set an encryption key.
|
||||
| See the user guide for more info.
|
||||
|
|
||||
| https://codeigniter.com/user_guide/libraries/encryption.html
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_driver'
|
||||
|
|
||||
| The storage driver to use: files, database, redis, memcached
|
||||
|
|
||||
| 'sess_cookie_name'
|
||||
|
|
||||
| The session cookie name, must contain only [0-9a-z_-] characters
|
||||
|
|
||||
| 'sess_expiration'
|
||||
|
|
||||
| The number of SECONDS you want the session to last.
|
||||
| Setting to 0 (zero) means expire when the browser is closed.
|
||||
|
|
||||
| 'sess_save_path'
|
||||
|
|
||||
| The location to save sessions to, driver dependent.
|
||||
|
|
||||
| For the 'files' driver, it's a path to a writable directory.
|
||||
| WARNING: Only absolute paths are supported!
|
||||
|
|
||||
| For the 'database' driver, it's a table name.
|
||||
| Please read up the manual for the format with other session drivers.
|
||||
|
|
||||
| IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
|
|
||||
| 'sess_match_ip'
|
||||
|
|
||||
| Whether to match the user's IP address when reading the session data.
|
||||
|
|
||||
| WARNING: If you're using the database driver, don't forget to update
|
||||
| your session table's PRIMARY KEY when changing this setting.
|
||||
|
|
||||
| 'sess_time_to_update'
|
||||
|
|
||||
| How many seconds between CI regenerating the session ID.
|
||||
|
|
||||
| 'sess_regenerate_destroy'
|
||||
|
|
||||
| Whether to destroy session data associated with the old session ID
|
||||
| when auto-regenerating the session ID. When set to FALSE, the data
|
||||
| will be later deleted by the garbage collector.
|
||||
|
|
||||
| Other session cookie settings are shared with the rest of the application,
|
||||
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
||||
|
|
||||
*/
|
||||
$config['sess_driver'] = 'files';
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_save_path'] = NULL;
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
$config['sess_regenerate_destroy'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
|
||||
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
|
||||
| 'cookie_path' = Typically will be a forward slash
|
||||
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
|
||||
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
||||
|
|
||||
| Note: These settings (with the exception of 'cookie_prefix' and
|
||||
| 'cookie_httponly') will also affect sessions.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = '';
|
||||
$config['cookie_domain'] = '';
|
||||
$config['cookie_path'] = '/';
|
||||
$config['cookie_secure'] = FALSE;
|
||||
$config['cookie_httponly'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Standardize newlines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether to standardize newline characters in input data,
|
||||
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['standardize_newlines'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global XSS Filtering
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['global_xss_filtering'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross Site Request Forgery
|
||||
|--------------------------------------------------------------------------
|
||||
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
|
||||
| checked on a submitted form. If you are accepting user data, it is strongly
|
||||
| recommended CSRF protection be enabled.
|
||||
|
|
||||
| 'csrf_token_name' = The token name
|
||||
| 'csrf_cookie_name' = The cookie name
|
||||
| 'csrf_expire' = The number in seconds the token should expire.
|
||||
| 'csrf_regenerate' = Regenerate token on every submission
|
||||
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
|
||||
*/
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
$config['csrf_regenerate'] = TRUE;
|
||||
$config['csrf_exclude_uris'] = array();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Output Compression
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enables Gzip output compression for faster page loads. When enabled,
|
||||
| the output class will test whether your server supports Gzip.
|
||||
| Even if it does, however, not all browsers support compression
|
||||
| so enable only if you are reasonably sure your visitors can handle it.
|
||||
|
|
||||
| Only used if zlib.output_compression is turned off in your php.ini.
|
||||
| Please do not use it together with httpd-level output compression.
|
||||
|
|
||||
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
|
||||
| means you are prematurely outputting something to your browser. It could
|
||||
| even be a line of whitespace at the end of one of your scripts. For
|
||||
| compression to work, nothing can be sent before the output buffer is called
|
||||
| by the output class. Do not 'echo' any values with compression enabled.
|
||||
|
|
||||
*/
|
||||
$config['compress_output'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Master Time Reference
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Options are 'local' or any PHP supported timezone. This preference tells
|
||||
| the system whether to use your server's local time as the master 'now'
|
||||
| reference, or convert it to the configured one timezone. See the 'date
|
||||
| helper' page of the user guide for information regarding date handling.
|
||||
|
|
||||
*/
|
||||
$config['time_reference'] = 'local';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Rewrite PHP Short Tags
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your PHP installation does not have short tag support enabled CI
|
||||
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
|
||||
| in your view files. Options are TRUE or FALSE (boolean)
|
||||
|
|
||||
| Note: You need to have eval() enabled for this to work.
|
||||
|
|
||||
*/
|
||||
$config['rewrite_short_tags'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverse Proxy IPs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a reverse proxy, you must whitelist the proxy
|
||||
| IP addresses from which CodeIgniter should trust headers such as
|
||||
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
|
||||
| the visitor's IP address.
|
||||
|
|
||||
| You can use both an array or a comma-separated list of proxy addresses,
|
||||
| as well as specifying whole subnets. Here are a few examples:
|
||||
|
|
||||
| Comma-separated: '10.0.1.200,192.168.5.0/24'
|
||||
| Array: array('10.0.1.200', '192.168.5.0/24')
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
93
account/application/config/constants.php
Normal file
93
account/application/config/constants.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Display Debug backtrace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to TRUE, a backtrace will be displayed along with php errors. If
|
||||
| error_reporting is disabled, the backtrace will not display, regardless
|
||||
| of this setting
|
||||
|
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File and Directory Modes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These prefs are used when checking and setting modes when working
|
||||
| with the file system. The defaults are fine on servers with proper
|
||||
| security, but you may wish (or even need) to change the values in
|
||||
| certain environments (Apache running a separate process for each
|
||||
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
|
||||
| always be used to set the mode correctly.
|
||||
|
|
||||
*/
|
||||
defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
|
||||
defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
|
||||
defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
|
||||
defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Stream Modes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These modes are used when working with fopen()/popen()
|
||||
|
|
||||
*/
|
||||
defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
|
||||
defined('FOPEN_READ_WRITE') or define('FOPEN_READ_WRITE', 'r+b');
|
||||
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
defined('FOPEN_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
|
||||
defined('FOPEN_READ_WRITE_CREATE') or define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
defined('FOPEN_WRITE_CREATE_STRICT') or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') or define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') or define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||
defined('EXIT_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') or define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
// define('APP_NAME', "BBNepal");
|
||||
defined('DB_HOST') or define('DB_HOST', 'localhost');
|
||||
// defined('DB_USERNAME') or define('DB_USERNAME', 'blackb_bbnepal_user');
|
||||
// defined('DB_PASSWORD') or define('DB_PASSWORD', 'q2IxAnPe-m%)');
|
||||
defined('DB_USERNAME') or define('DB_USERNAME', 'root');
|
||||
defined('DB_PASSWORD') or define('DB_PASSWORD', 'root');
|
||||
defined('DB_DATABASE') or define('DB_DATABASE', 'blackb_bbnepal_accounting');
|
27
account/application/config/database.php
Normal file
27
account/application/config/database.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
$active_group = 'default';
|
||||
$query_builder = TRUE;
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => DB_HOST,
|
||||
'username' => DB_USERNAME,
|
||||
'password' => DB_PASSWORD,
|
||||
'database' => DB_DATABASE,
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => (ENVIRONMENT !== 'production'),
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'encrypt' => FALSE,
|
||||
'compress' => FALSE,
|
||||
'stricton' => FALSE,
|
||||
'failover' => array(),
|
||||
'save_queries' => TRUE
|
||||
);
|
24
account/application/config/doctypes.php
Normal file
24
account/application/config/doctypes.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$_doctypes = array(
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
|
||||
);
|
103
account/application/config/foreign_chars.php
Normal file
103
account/application/config/foreign_chars.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Foreign Characters
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of foreign characters for transliteration
|
||||
| conversion used by the Text helper
|
||||
|
|
||||
*/
|
||||
$foreign_characters = array(
|
||||
'/ä|æ|ǽ/' => 'ae',
|
||||
'/ö|œ/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
|
||||
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
|
||||
'/Б/' => 'B',
|
||||
'/б/' => 'b',
|
||||
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
|
||||
'/ç|ć|ĉ|ċ|č/' => 'c',
|
||||
'/Д/' => 'D',
|
||||
'/д/' => 'd',
|
||||
'/Ð|Ď|Đ|Δ/' => 'Dj',
|
||||
'/ð|ď|đ|δ/' => 'dj',
|
||||
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
|
||||
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
|
||||
'/Ф/' => 'F',
|
||||
'/ф/' => 'f',
|
||||
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
|
||||
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
|
||||
'/Ĥ|Ħ/' => 'H',
|
||||
'/ĥ|ħ/' => 'h',
|
||||
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
|
||||
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
|
||||
'/Ĵ/' => 'J',
|
||||
'/ĵ/' => 'j',
|
||||
'/Ķ|Κ|К/' => 'K',
|
||||
'/ķ|κ|к/' => 'k',
|
||||
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
|
||||
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
|
||||
'/М/' => 'M',
|
||||
'/м/' => 'm',
|
||||
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
|
||||
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
|
||||
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
|
||||
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
|
||||
'/П/' => 'P',
|
||||
'/п/' => 'p',
|
||||
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
|
||||
'/ŕ|ŗ|ř|ρ|р/' => 'r',
|
||||
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
|
||||
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
|
||||
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
|
||||
'/ț|ţ|ť|ŧ|т/' => 't',
|
||||
'/Þ|þ/' => 'th',
|
||||
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
|
||||
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
|
||||
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
|
||||
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
|
||||
'/В/' => 'V',
|
||||
'/в/' => 'v',
|
||||
'/Ŵ/' => 'W',
|
||||
'/ŵ/' => 'w',
|
||||
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
|
||||
'/ź|ż|ž|ζ|з/' => 'z',
|
||||
'/Æ|Ǽ/' => 'AE',
|
||||
'/ß/' => 'ss',
|
||||
'/IJ/' => 'IJ',
|
||||
'/ij/' => 'ij',
|
||||
'/Œ/' => 'OE',
|
||||
'/ƒ/' => 'f',
|
||||
'/ξ/' => 'ks',
|
||||
'/π/' => 'p',
|
||||
'/β/' => 'v',
|
||||
'/μ/' => 'm',
|
||||
'/ψ/' => 'ps',
|
||||
'/Ё/' => 'Yo',
|
||||
'/ё/' => 'yo',
|
||||
'/Є/' => 'Ye',
|
||||
'/є/' => 'ye',
|
||||
'/Ї/' => 'Yi',
|
||||
'/Ж/' => 'Zh',
|
||||
'/ж/' => 'zh',
|
||||
'/Х/' => 'Kh',
|
||||
'/х/' => 'kh',
|
||||
'/Ц/' => 'Ts',
|
||||
'/ц/' => 'ts',
|
||||
'/Ч/' => 'Ch',
|
||||
'/ч/' => 'ch',
|
||||
'/Ш/' => 'Sh',
|
||||
'/ш/' => 'sh',
|
||||
'/Щ/' => 'Shch',
|
||||
'/щ/' => 'shch',
|
||||
'/Ъ|ъ|Ь|ь/' => '',
|
||||
'/Ю/' => 'Yu',
|
||||
'/ю/' => 'yu',
|
||||
'/Я/' => 'Ya',
|
||||
'/я/' => 'ya'
|
||||
);
|
13
account/application/config/hooks.php
Normal file
13
account/application/config/hooks.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Hooks
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you define "hooks" to extend CI without hacking the core
|
||||
| files. Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/hooks.html
|
||||
|
|
||||
*/
|
11
account/application/config/index.html
Normal file
11
account/application/config/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
19
account/application/config/memcached.php
Normal file
19
account/application/config/memcached.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Memcached settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Memcached servers can be specified below.
|
||||
|
|
||||
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||
|
|
||||
*/
|
||||
$config = array(
|
||||
'default' => array(
|
||||
'hostname' => '127.0.0.1',
|
||||
'port' => '11211',
|
||||
'weight' => '1',
|
||||
),
|
||||
);
|
84
account/application/config/migration.php
Normal file
84
account/application/config/migration.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are disabled by default for security reasons.
|
||||
| You should enable migrations whenever you intend to do a schema migration
|
||||
| and disable it back when you're done.
|
||||
|
|
||||
*/
|
||||
$config['migration_enabled'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Type
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migration file names may be based on a sequential identifier or on
|
||||
| a timestamp. Options are:
|
||||
|
|
||||
| 'sequential' = Sequential migration naming (001_add_blog.php)
|
||||
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
|
||||
| Use timestamp format YYYYMMDDHHIISS.
|
||||
|
|
||||
| Note: If this configuration value is missing the Migration library
|
||||
| defaults to 'sequential' for backward compatibility with CI2.
|
||||
|
|
||||
*/
|
||||
$config['migration_type'] = 'timestamp';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the table that will store the current migrations state.
|
||||
| When migrations runs it will store in a database table which migration
|
||||
| level the system is at. It then compares the migration level in this
|
||||
| table to the $config['migration_version'] if they are not the same it
|
||||
| will migrate up. This must be set.
|
||||
|
|
||||
*/
|
||||
$config['migration_table'] = 'migrations';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto Migrate To Latest
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If this is set to TRUE when you load the migrations class and have
|
||||
| $config['migration_enabled'] set to TRUE the system will auto migrate
|
||||
| to your latest migration (whatever $config['migration_version'] is
|
||||
| set to). This way you do not have to call migrations anywhere else
|
||||
| in your code to have the latest migration.
|
||||
|
|
||||
*/
|
||||
$config['migration_auto_latest'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is used to set migration version that the file system should be on.
|
||||
| If you run $this->migration->current() this is the version that schema will
|
||||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 0;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to your migrations folder.
|
||||
| Typically, it will be within your application path.
|
||||
| Also, writing permission is required within the migrations path.
|
||||
|
|
||||
*/
|
||||
$config['migration_path'] = APPPATH.'migrations/';
|
185
account/application/config/mimes.php
Normal file
185
account/application/config/mimes.php
Normal file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| MIME TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of mime types. It is used by the
|
||||
| Upload class to help identify allowed file types.
|
||||
|
|
||||
*/
|
||||
return array(
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
|
||||
'odc' => 'application/vnd.oasis.opendocument.chart',
|
||||
'otc' => 'application/vnd.oasis.opendocument.chart-template',
|
||||
'odf' => 'application/vnd.oasis.opendocument.formula',
|
||||
'otf' => 'application/vnd.oasis.opendocument.formula-template',
|
||||
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
||||
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
|
||||
'odi' => 'application/vnd.oasis.opendocument.image',
|
||||
'oti' => 'application/vnd.oasis.opendocument.image-template',
|
||||
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
||||
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||
'oth' => 'application/vnd.oasis.opendocument.text-web',
|
||||
|
||||
);
|
14
account/application/config/profiler.php
Normal file
14
account/application/config/profiler.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Profiler Sections
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you determine whether or not various sections of Profiler
|
||||
| data are displayed when the Profiler is enabled.
|
||||
| Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/profiling.html
|
||||
|
|
||||
*/
|
54
account/application/config/routes.php
Normal file
54
account/application/config/routes.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| URI ROUTING
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you re-map URI requests to specific controller functions.
|
||||
|
|
||||
| Typically there is a one-to-one relationship between a URL string
|
||||
| and its corresponding controller class/method. The segments in a
|
||||
| URL normally follow this pattern:
|
||||
|
|
||||
| example.com/class/method/id/
|
||||
|
|
||||
| In some instances, however, you may want to remap this relationship
|
||||
| so that a different class/function is called than the one
|
||||
| corresponding to the URL.
|
||||
|
|
||||
| Please see the user guide for complete details:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/routing.html
|
||||
|
|
||||
| -------------------------------------------------------------------------
|
||||
| RESERVED ROUTES
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| There are three reserved routes:
|
||||
|
|
||||
| $route['default_controller'] = 'welcome';
|
||||
|
|
||||
| This route indicates which controller class should be loaded if the
|
||||
| URI contains no data. In the above example, the "welcome" class
|
||||
| would be loaded.
|
||||
|
|
||||
| $route['404_override'] = 'errors/page_missing';
|
||||
|
|
||||
| This route will tell the Router which controller/method to use if those
|
||||
| provided in the URL cannot be matched to a valid route.
|
||||
|
|
||||
| $route['translate_uri_dashes'] = FALSE;
|
||||
|
|
||||
| This is not exactly a route, but allows you to automatically route
|
||||
| controller and method names that contain dashes. '-' isn't a valid
|
||||
| class or method name character, so it requires translation.
|
||||
| When you set this option to TRUE, it will replace ALL dashes in the
|
||||
| controller and method URI segments.
|
||||
|
|
||||
| Examples: my-controller/index -> my_controller/index
|
||||
| my-controller/my-method -> my_controller/my_method
|
||||
*/
|
||||
$route['default_controller'] = 'welcome';
|
||||
$route['404_override'] = 'Page404';
|
||||
$route['translate_uri_dashes'] = TRUE;
|
64
account/application/config/smileys.php
Normal file
64
account/application/config/smileys.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| SMILEYS
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of smileys for use with the emoticon helper.
|
||||
| Individual images can be used to replace multiple smileys. For example:
|
||||
| :-) and :) use the same image replacement.
|
||||
|
|
||||
| Please see user guide for more info:
|
||||
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
||||
|
|
||||
*/
|
||||
$smileys = array(
|
||||
|
||||
// smiley image name width height alt
|
||||
|
||||
':-)' => array('grin.gif', '19', '19', 'grin'),
|
||||
':lol:' => array('lol.gif', '19', '19', 'LOL'),
|
||||
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
|
||||
':)' => array('smile.gif', '19', '19', 'smile'),
|
||||
';-)' => array('wink.gif', '19', '19', 'wink'),
|
||||
';)' => array('wink.gif', '19', '19', 'wink'),
|
||||
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
|
||||
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
|
||||
':-S' => array('confused.gif', '19', '19', 'confused'),
|
||||
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
|
||||
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
|
||||
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
|
||||
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
|
||||
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
|
||||
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
|
||||
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
|
||||
':long:' => array('longface.gif', '19', '19', 'long face'),
|
||||
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
|
||||
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
|
||||
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
|
||||
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
|
||||
':down:' => array('downer.gif', '19', '19', 'downer'),
|
||||
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
|
||||
':sick:' => array('sick.gif', '19', '19', 'sick'),
|
||||
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
|
||||
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
|
||||
'>:(' => array('mad.gif', '19', '19', 'mad'),
|
||||
':mad:' => array('mad.gif', '19', '19', 'mad'),
|
||||
'>:-(' => array('angry.gif', '19', '19', 'angry'),
|
||||
':angry:' => array('angry.gif', '19', '19', 'angry'),
|
||||
':zip:' => array('zip.gif', '19', '19', 'zipper'),
|
||||
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
|
||||
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
|
||||
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
|
||||
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
|
||||
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
|
||||
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
|
||||
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
|
||||
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
|
||||
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
||||
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
||||
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
|
||||
':question:' => array('question.gif', '19', '19', 'question')
|
||||
|
||||
);
|
214
account/application/config/user_agents.php
Normal file
214
account/application/config/user_agents.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| USER AGENT TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains four arrays of user agent data. It is used by the
|
||||
| User Agent Class to help identify browser, platform, robot, and
|
||||
| mobile device data. The array keys are used to identify the device
|
||||
| and the array values are used to set the actual name of the item.
|
||||
*/
|
||||
$platforms = array(
|
||||
'windows nt 10.0' => 'Windows 10',
|
||||
'windows nt 6.3' => 'Windows 8.1',
|
||||
'windows nt 6.2' => 'Windows 8',
|
||||
'windows nt 6.1' => 'Windows 7',
|
||||
'windows nt 6.0' => 'Windows Vista',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows phone' => 'Windows Phone',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'android' => 'Android',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'iphone' => 'iOS',
|
||||
'ipad' => 'iOS',
|
||||
'ipod' => 'iOS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS',
|
||||
'symbian' => 'Symbian OS'
|
||||
);
|
||||
|
||||
|
||||
// The order of this array should NOT be changed. Many browsers return
|
||||
// multiple browser types so we want to identify the sub-type first.
|
||||
$browsers = array(
|
||||
'OPR' => 'Opera',
|
||||
'Flock' => 'Flock',
|
||||
'Edge' => 'Edge',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser'
|
||||
);
|
||||
|
||||
$mobiles = array(
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
|
||||
// Phones and Manufacturers
|
||||
'motorola' => 'Motorola',
|
||||
'nokia' => 'Nokia',
|
||||
'palm' => 'Palm',
|
||||
'iphone' => 'Apple iPhone',
|
||||
'ipad' => 'iPad',
|
||||
'ipod' => 'Apple iPod Touch',
|
||||
'sony' => 'Sony Ericsson',
|
||||
'ericsson' => 'Sony Ericsson',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'cocoon' => 'O2 Cocoon',
|
||||
'blazer' => 'Treo',
|
||||
'lg' => 'LG',
|
||||
'amoi' => 'Amoi',
|
||||
'xda' => 'XDA',
|
||||
'mda' => 'MDA',
|
||||
'vario' => 'Vario',
|
||||
'htc' => 'HTC',
|
||||
'samsung' => 'Samsung',
|
||||
'sharp' => 'Sharp',
|
||||
'sie-' => 'Siemens',
|
||||
'alcatel' => 'Alcatel',
|
||||
'benq' => 'BenQ',
|
||||
'ipaq' => 'HP iPaq',
|
||||
'mot-' => 'Motorola',
|
||||
'playstation portable' => 'PlayStation Portable',
|
||||
'playstation 3' => 'PlayStation 3',
|
||||
'playstation vita' => 'PlayStation Vita',
|
||||
'hiptop' => 'Danger Hiptop',
|
||||
'nec-' => 'NEC',
|
||||
'panasonic' => 'Panasonic',
|
||||
'philips' => 'Philips',
|
||||
'sagem' => 'Sagem',
|
||||
'sanyo' => 'Sanyo',
|
||||
'spv' => 'SPV',
|
||||
'zte' => 'ZTE',
|
||||
'sendo' => 'Sendo',
|
||||
'nintendo dsi' => 'Nintendo DSi',
|
||||
'nintendo ds' => 'Nintendo DS',
|
||||
'nintendo 3ds' => 'Nintendo 3DS',
|
||||
'wii' => 'Nintendo Wii',
|
||||
'open web' => 'Open Web',
|
||||
'openweb' => 'OpenWeb',
|
||||
|
||||
// Operating Systems
|
||||
'android' => 'Android',
|
||||
'symbian' => 'Symbian',
|
||||
'SymbianOS' => 'SymbianOS',
|
||||
'elaine' => 'Palm',
|
||||
'series60' => 'Symbian S60',
|
||||
'windows ce' => 'Windows CE',
|
||||
|
||||
// Browsers
|
||||
'obigo' => 'Obigo',
|
||||
'netfront' => 'Netfront Browser',
|
||||
'openwave' => 'Openwave Browser',
|
||||
'mobilexplorer' => 'Mobile Explorer',
|
||||
'operamini' => 'Opera Mini',
|
||||
'opera mini' => 'Opera Mini',
|
||||
'opera mobi' => 'Opera Mobile',
|
||||
'fennec' => 'Firefox Mobile',
|
||||
|
||||
// Other
|
||||
'digital paths' => 'Digital Paths',
|
||||
'avantgo' => 'AvantGo',
|
||||
'xiino' => 'Xiino',
|
||||
'novarra' => 'Novarra Transcoder',
|
||||
'vodafone' => 'Vodafone',
|
||||
'docomo' => 'NTT DoCoMo',
|
||||
'o2' => 'O2',
|
||||
|
||||
// Fallback
|
||||
'mobile' => 'Generic Mobile',
|
||||
'wireless' => 'Generic Mobile',
|
||||
'j2me' => 'Generic Mobile',
|
||||
'midp' => 'Generic Mobile',
|
||||
'cldc' => 'Generic Mobile',
|
||||
'up.link' => 'Generic Mobile',
|
||||
'up.browser' => 'Generic Mobile',
|
||||
'smartphone' => 'Generic Mobile',
|
||||
'cellphone' => 'Generic Mobile'
|
||||
);
|
||||
|
||||
// There are hundreds of bots but these are the most common.
|
||||
$robots = array(
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'ask jeeves' => 'Ask Jeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos',
|
||||
'yandex' => 'YandexBot',
|
||||
'mediapartners-google' => 'MediaPartners Google',
|
||||
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||
'adsbot-google' => 'AdsBot Google',
|
||||
'feedfetcher-google' => 'Feedfetcher Google',
|
||||
'curious george' => 'Curious George',
|
||||
'ia_archiver' => 'Alexa Crawler',
|
||||
'MJ12bot' => 'Majestic-12',
|
||||
'Uptimebot' => 'Uptimebot'
|
||||
);
|
905
account/application/controllers/Ajax.php
Normal file
905
account/application/controllers/Ajax.php
Normal file
@ -0,0 +1,905 @@
|
||||
<?php
|
||||
|
||||
class Ajax extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MUsers');
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
function deleteVoucher($voucher_id)
|
||||
{
|
||||
$this->myaccounts->deleteVoucher($voucher_id);
|
||||
}
|
||||
function getVoucherDetailsTable($voucher_id)
|
||||
{
|
||||
$VD = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$html = "<table class='table table-bordered'>";
|
||||
$html .= "<tr><th>Account</th><th>Narration</th><th>Dr</th><th>Cr</th></tr>";
|
||||
foreach ($VD as $T) {
|
||||
$html .= "<tr>";
|
||||
$html .= "<td class='col-3'>" . getFieldfromValue("tbl_accounts", "account_name", "account_id", $T->account_id) . "</td>";
|
||||
$html .= "<td>" . $T->narration . "</td>";
|
||||
$html .= "<td class='col-2'>" . myCurrency($T->dr) . "</td>";
|
||||
$html .= "<td class='col-2'>" . myCurrency($T->cr) . "</td>";
|
||||
$html .= "</tr>";
|
||||
}
|
||||
$html .= "</table>";
|
||||
echo $html;
|
||||
}
|
||||
function getAccountsTableByCategory($accategory_id)
|
||||
{
|
||||
|
||||
$this->myaccounts->getAccountsTableByCategory($accategory_id);
|
||||
}
|
||||
function getAllAccountsTable()
|
||||
{
|
||||
|
||||
$this->myaccounts->getAllAccountsTable();
|
||||
}
|
||||
function dragDrop()
|
||||
{
|
||||
}
|
||||
function updatePrivilege($id)
|
||||
{
|
||||
$user = $this->MUsers->getUsers($id);
|
||||
$privileges = (array) json_decode($user->user_privilege); ?>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- Modal Header -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Edit Privileges For <?php echo $user->user_name; ?> (<?php echo $user->user_email; ?>)</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<form action="<?php echo base_url('users/update/' . $user->user_id); ?>" method="post">
|
||||
|
||||
<!-- Modal body -->
|
||||
<div class="modal-body">
|
||||
<table class="table">
|
||||
<?php
|
||||
$controllers = $this->config->item('checkControllers');
|
||||
|
||||
foreach ($controllers as $controller) :
|
||||
$val = 0;
|
||||
if (!empty($privileges[$controller])) {
|
||||
$val = $privileges[$controller];
|
||||
}
|
||||
changePrivilege($controller, $val);
|
||||
endforeach;
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger" type="submit">Update</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function changePassword($id)
|
||||
{
|
||||
$inputArray = array(
|
||||
'user_password' => $_POST['password'],
|
||||
);
|
||||
$this->MUsers->UpdateUser($inputArray, $id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function changePrivilege($name, $value)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td style="text-transform: capitalize"><?php echo $name; ?></td>
|
||||
<td><label><input type="checkbox" value="1" <?php if ($value >= 1) echo 'checked'; ?> name="<?php echo $name; ?>"> view</label></td>
|
||||
<td><label><input type="checkbox" value="2" <?php if ($value >= 2) echo 'checked'; ?> name="<?php echo $name; ?>"> add/update</label></td>
|
||||
<td><label><input type="checkbox" value="3" <?php if ($value >= 3) echo 'checked'; ?> name="<?php echo $name; ?>"> delete</label></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function showpodetails($po_id)
|
||||
{
|
||||
$t = "select * from tbl_podetails where po_id=$po_id";
|
||||
$PoDetails = $this->db->query($t)->result();
|
||||
foreach ($PoDetails as $details) {
|
||||
$details->item_name = $this->db->query("select * from tbl_items where item_id=$details->item_id")->row();
|
||||
}
|
||||
$t = "select * from tbl_po where po_id=$po_id";
|
||||
$Po = $this->db->query($t)->row();
|
||||
$vendor_name = $this->db->query("select * from tbl_vendors where vendor_id=$Po->vendor_id")->row();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>YR tyres invoice</title>
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>uploads/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header class="tp-hdr-sec">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-lg-3 algn-cntr">
|
||||
<div class="logo-sec">
|
||||
<img src="<?php echo base_url(); ?>uploads/logo.png" alt="Yr tyres">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-5">
|
||||
<div class="yr-tpdetas">
|
||||
<h1 class="yr0tryoe">Y.R TYRE</h1>
|
||||
<h3>INDUSTRIES PVT. LTD.</h3>
|
||||
<h4>Strength | Speed | Grip</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-lg-4">
|
||||
<div class="rgt-sec_prt">
|
||||
<ul>
|
||||
<li><i class="fa fa-globe"></i> YR Estate bld, Thir Bam Sadak-5, Baluwatar, Kathmandu, Nepal</li>
|
||||
<li><i class="fa fa-globe"></i> +977 1 4421615, 4421587</li>
|
||||
<li><i class="fa fa-globe"></i> mail@yrtyres.com</li>
|
||||
<li><i class="fa fa-globe"></i> www.yrtyres.com</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<section class="purchs-ord">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 purc-bgprt">
|
||||
<span>Purchase Order</span>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 rgt-pt-20">
|
||||
<label for="date">Date</label>
|
||||
<input type="text" name="date" class="mb-10 inpt-wdt" value=" <?php echo $Po->po_date ?>"><br>
|
||||
<label for="po">PO#</label>
|
||||
<input type="text" name="po" class="inpt-wdt"><br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="vedr-sph">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>VENDOR</span>
|
||||
</div>
|
||||
<ul class="ul_sec-prst">
|
||||
<li>Qingdao Yonghe International Trade Co. Ltd. </li>
|
||||
<li>NO.1275, WANGSHA ROAD, CHENGYANG DISTRICT, QINGDAO CITY, CHINA</li>
|
||||
<li>yh@qdyhltd.com</li>
|
||||
<li>+86-532- 86468187-0</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>SHIP TO</span>
|
||||
</div>
|
||||
<ul class="ul_sec-prst">
|
||||
<li>Y. R. Tye Industries Pvt. Ltd. </li>
|
||||
<li>YR Estate Building, Thirbam Sadak, Baluwatar-4, Kathmandu, Nepa</li>
|
||||
<li>mail@yrtyres.com</li>
|
||||
<li>+977-1-4421615, 4421587 </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 txt-rgt-prt">
|
||||
<p>VAT: 606532363</p>
|
||||
<p>EXIM: 6065323630128NP</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="upr_tbl-secprt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-0pky">EQUISITIONER</th>
|
||||
<th class="tg-0pky">SHIP VIA</th>
|
||||
<th class="tg-0pky">Delivery To</th>
|
||||
<th class="tg-0pky">SHIPPING TERMS</th>
|
||||
<th class="tg-0pky">CUSTOM ENTRY POINT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tg-0pky"> </td>
|
||||
<td class="tg-0pky"></td>
|
||||
<td class="tg-0pky">Chitwan, Nepal</td>
|
||||
<td class="tg-0pky"></td>
|
||||
<td class="tg-0pky">Tatopani-Nepal</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="lwr_tbl-secprt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-0pky">ITEMS #</th>
|
||||
<th class="tg-0pky">DESCRIPTION</th>
|
||||
<th class="tg-0pky">QTY</th>
|
||||
<th class="tg-0pky">UNIT PRICE</th>
|
||||
<th class="tg-0pky">TOTAL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $a = 0;
|
||||
foreach ($PoDetails as $details) : $a++; ?>
|
||||
<tr>
|
||||
<td><?php echo $a; ?></td>
|
||||
<td><?php echo $details->item_name->item_name; ?></td>
|
||||
<td><?php echo $details->item_qty; ?></td>
|
||||
<td>USD <?php echo $details->est_price; ?></td>
|
||||
<?php $total[$a] = $details->item_qty * $details->est_price; ?>
|
||||
<td>USD <?php echo $total[$a]; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php for ($x = $a; $x <= 9; $x++) { ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section class="trms-cnd-ttl">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="wst-100-bg">
|
||||
<span>Terms: </span>
|
||||
</div>
|
||||
<div class="trsm-cnd_prt ttms-trs-1">
|
||||
<ul>
|
||||
<li>1. Payment Terms: 100% TT before dispatch. </li>
|
||||
<li>2. Desired Dispatch period: 35 days from the date of PO
|
||||
issued. </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="trsm-cnd_prt">
|
||||
<ul>
|
||||
<li><span>Subtotal:</span>
|
||||
<p>USD <?php echo array_sum($total) ?></p>
|
||||
</li>
|
||||
<li><span>Discount:</span>
|
||||
<p>USD 10.00</p>
|
||||
</li>
|
||||
<li><span>After dis:</span>
|
||||
<p>USD 2,400.00</p>
|
||||
</li>
|
||||
<li><span>Tax:</span> </li>
|
||||
<li><span> Net:</span>
|
||||
<p>USD 2,400.00</p>
|
||||
</li>
|
||||
<li><span>In Words:</span>
|
||||
<p>Two Thousand four hundred only.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="end_secprt">
|
||||
<div class="container">
|
||||
<div class="sdr_cenr-tr">
|
||||
<h5>For:</h5>
|
||||
<ul>
|
||||
<li>Y. R. Tyre Industries Pvt. Ltd.</li>
|
||||
<li>Yugma Malla</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="lwr-rd-prt">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<p class="pb-0-p-prt">Factory Address: KALIKA MUNICIPALITY-8,
|
||||
NEURENI CHITWAN, NEPAL</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<p class="pb-0-p-prt">Dedicated for Vehicle Tyre Manufacturing</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
function showsodetails($so_id)
|
||||
{
|
||||
$t = "select * from tbl_salesorderdetails where salesorder_id=$so_id";
|
||||
$SoDetails = $this->db->query($t)->result();
|
||||
$t = "select * from tbl_salesorders where salesorder_id=$so_id";
|
||||
$So = $this->db->query($t)->row();
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Form</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
||||
|
||||
<style type="text/css">
|
||||
.tg {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.tg td {
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
padding: 10px 5px;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.tg th {
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
overflow: hidden;
|
||||
padding: 10px 5px;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.tg .tg-0lax {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.snd-prt-tp {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.lft-prt-tp {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rgt-prt-tp {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pt-50 {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
.txt-cntr {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.bdr-sec {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.lwr-sc-sec {
|
||||
padding: 40px 0px;
|
||||
}
|
||||
|
||||
.pd-l {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.mg-r {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.mg-40 {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.inr-brd-sec {
|
||||
padding-left: 50px;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.frm-grp-prt {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.wd-30 {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.wd-50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.wd-45 {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.pb-40 {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
td {
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
.tbl-sec-prt {
|
||||
border: 1px solid #000;
|
||||
padding: 60px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.txt-rgt {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.mn-wd-400 {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.bfr-prt h4 {
|
||||
font-size: 18px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mgtp-40 {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.tct-cntr {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bfr-prt h4::before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
background: #000;
|
||||
height: 1px;
|
||||
width: 200px;
|
||||
bottom: -6px;
|
||||
left: 22%;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.modal-lg {
|
||||
max-width: 1200px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<?php
|
||||
$d = strtotime($So->created_date);
|
||||
$date = date("Y-m-d", $d); ?>
|
||||
|
||||
<body class="pt-50">
|
||||
<div class="container">
|
||||
<div class="heading-prt txt-cntr pb-40">
|
||||
<h1>Sales Order</h1>
|
||||
</div>
|
||||
<div class="snd-prt-tp">
|
||||
<div class="lft-prt-tp">
|
||||
<label for="creat-dt">Created Date:</label>
|
||||
<input type="text" name="creat-dt" value="<?php echo $date; ?>">
|
||||
</div>
|
||||
<div class="rgt-prt-tp">
|
||||
<label for="ord-dt">Order Date:</label>
|
||||
<input type="text" name="ord-dt" value="<?php echo $date; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lwr-sc-sec">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-6 ">
|
||||
<div class="bdr-sec mg-r inr-brd-sec">
|
||||
<div class="ttl-tp-prt">
|
||||
<h3>Buyer Info</h3>
|
||||
</div>
|
||||
<div class="frm-prt-lwsd">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="creat-dt" class="wd-30">Name</label>
|
||||
<input type="text" name="name" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="address" class="wd-30">Address</label>
|
||||
<input type="text" name="address" class="wd-50" value="<?php echo $So->address; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="phone" class="wd-30">Phone</label>
|
||||
<input type="text" name="phone" class="wd-50" value="<?php echo $So->phone; ?>">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="bilname" class="wd-45">Billing Name</label>
|
||||
<input type="text" name="billing_name" class="wd-50" value="<?php echo $So->billing_name; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="pan" class="wd-30">Pan/VAT </label>
|
||||
<input type="text" name="pan" class="wd-50" value="<?php echo $So->pan; ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6 ">
|
||||
<div class="bdr-sec mg-l inr-brd-sec">
|
||||
<div class="ttl-tp-prt">
|
||||
<h3>Offical Info</h3>
|
||||
</div>
|
||||
<div class="frm-prt-lwsd">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="dltby" class="wd-30">Dealt By</label>
|
||||
<input type="text" name="dltby" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<div class="frm-grp-prt">
|
||||
<label for="darea" class="wd-30">Distribution Area</label>
|
||||
<input type="text" name="darea" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="pmode" class="wd-30">Payment Mode</label>
|
||||
<input type="text" name="pmode" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
<div class="frm-grp-prt">
|
||||
<label for="trans" class="wd-30">Transportation</label>
|
||||
<input type="text" name="trans" class="wd-50" value="<?php echo $So->name; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="thd-sec-prt">
|
||||
<div class="tbl-sec-prt">
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="">Sn</th>
|
||||
<th class="tg-0lax">Description</th>
|
||||
<th class="tg-0lax">Qty</th>
|
||||
<th class="tg-0lax">Rate</th>
|
||||
<th class="tg-0lax">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $a = 0;
|
||||
foreach ($SoDetails as $SoDetail) : $a++; ?>
|
||||
<tr>
|
||||
<td class="tg-0lax"><?php echo $a ?> </td>
|
||||
<td class="tg-0lax mn-wd-400"><?php echo $SoDetail->item_id ?> </td>
|
||||
<td class="tg-0lax"><?php echo $SoDetail->qty ?></td>
|
||||
<td class="tg-0lax"><?php echo $SoDetail->rate ?></td>
|
||||
<td class="tg-0lax"><?php echo ($SoDetail->qty * $SoDetail->rate); ?>
|
||||
<?php $total[$a] = ($SoDetail->qty * $SoDetail->rate) ?> </td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td class="tg-0lax"> </td>
|
||||
<td class="tg-0lax txt-rgt">Total</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php $total = array_sum($total);
|
||||
echo $total ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax txt-rgt">Vat Amount</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php $vat = ($total * 13 / 100);
|
||||
echo $vat ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax txt-rgt">Grand Total</td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"></td>
|
||||
<td class="tg-0lax"><?php echo ($vat + $total) ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="lst-sec-prt mgtp-40 tct-cntr">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Prepared By</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Verified By</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="bfr-prt">
|
||||
<h4>Approved By</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
function showemployee($id)
|
||||
{
|
||||
$t = "select * from tbl_employees where employee_id=$id";
|
||||
$Employee = $this->db->query($t)->row();
|
||||
$Employee->employee_type = $this->db->query("select * from tbl_employeetype where employeetype_id=$Employee->employeetype_id")->row();
|
||||
$Employee->employee_department = $this->db->query("select * from tbl_departments where department_id=$Employee->department_id")->row();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2> </h2>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><?php echo $Employee->employee_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Employee Type</th>
|
||||
<td><?php echo $Employee->employee_type->employeetype_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gender</th>
|
||||
<td><?php echo $Employee->employee_gender ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Department</th>
|
||||
<td><?php echo $Employee->employee_department->department_name ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<td><?php echo $Employee->employee_address ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DOB</th>
|
||||
<td><?php echo $Employee->employee_dob ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DOJ</th>
|
||||
<td><?php echo $Employee->employee_doj ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>PAN</th>
|
||||
<td><?php echo $Employee->employee_pan ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><?php echo $Employee->employee_email ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact</th>
|
||||
<td><?php echo $Employee->employee_contact ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function UpdateAttendance()
|
||||
{
|
||||
$arraydata = array(
|
||||
'attendance' => $_POST['attendance'],
|
||||
'reason' => $_POST['reason'],
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
$this->db->where('employee_id', $_POST['employee_id']);
|
||||
$this->db->update('tbl_attendances', $arraydata);
|
||||
}
|
||||
|
||||
function updateholiday()
|
||||
{
|
||||
$arraydata = array(
|
||||
|
||||
'day_holiday' => $_POST['day_holiday'],
|
||||
'day_work' => $_POST['day_work'],
|
||||
|
||||
|
||||
);
|
||||
$this->db->where('day_id', $_POST['day_id']);
|
||||
$this->db->update('tbl_officecalendar', $arraydata);
|
||||
redirect($_POST['url']);
|
||||
}
|
||||
function updatefactoryholiday()
|
||||
{
|
||||
$arraydata = array(
|
||||
|
||||
'day_holiday' => $_POST['day_holiday'],
|
||||
'day_work' => $_POST['day_work'],
|
||||
|
||||
|
||||
);
|
||||
$this->db->where('day_id', $_POST['day_id']);
|
||||
$this->db->update('tbl_factorycalendar', $arraydata);
|
||||
redirect($_POST['url']);
|
||||
}
|
||||
function UpdateStock()
|
||||
{
|
||||
$stockcheck = $this->db->query("select * from tbl_stocks where item_id='" . $_POST['item_id'] . "' and stockdate='" . date('Y-m-d') . "'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
if ($stockcheck == '') {
|
||||
$arraydata['item_id'] = $_POST['item_id'];
|
||||
$this->db->insert('tbl_stocks', $arraydata);
|
||||
} else {
|
||||
$this->db->where('item_id', $_POST['item_id']);
|
||||
$this->db->update('tbl_stocks', $arraydata);
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateStocks()
|
||||
{
|
||||
|
||||
// $stockcheck=$this->db->query("select * from tbl_stock where item_id='".$_POST['item_id']."' and category_id= '".$_POST['category_id']."' and stockdate='".date('Y-m-d')."'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_in_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
'category_id' => $_POST['category_id'],
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
// print_r($_POST);
|
||||
|
||||
$arraydata['item_id'] = $_POST['item_id'];
|
||||
$this->db->insert('tbl_stock', $arraydata);
|
||||
}
|
||||
function TransferStock()
|
||||
{
|
||||
$itemalias = $this->db->query("select * from tbl_items where item_id=" . $_POST['item_id'])->row();
|
||||
$transferStockCheck = $this->db->query("select * from tbl_items where item_alias='" . $_POST['item_alias'] . "' and category_id='5'")->row();
|
||||
|
||||
$stockcheck = $this->db->query("select * from tbl_stocks where item_id='" . $transferStockCheck->item_id . "' and stockdate='" . date('Y-m-d') . "'")->row();
|
||||
|
||||
$arraydata = array(
|
||||
'stock_value' => $_POST['stock_value'],
|
||||
'stockdate' => date('Y-m-d'),
|
||||
|
||||
'status' => 1,
|
||||
|
||||
);
|
||||
if ($stockcheck == '') {
|
||||
$arraydata['item_id'] = $transferStockCheck->item_id;
|
||||
$this->db->insert('tbl_stocks', $arraydata);
|
||||
} else {
|
||||
$this->db->where('item_id', $transferStockCheck->item_id);
|
||||
$this->db->update('tbl_stocks', $arraydata);
|
||||
}
|
||||
}
|
||||
}
|
8
account/application/controllers/AjaxDrag.php
Normal file
8
account/application/controllers/AjaxDrag.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$position = $_POST['position'];
|
||||
$i=1;
|
||||
foreach($position as $k=>$v){
|
||||
$sql = "Update tbl_studyabroads SET display_order=".$i." WHERE studyabroad_id=".$v;
|
||||
return $this->db->query($sql);
|
||||
$i++;
|
||||
}
|
15
account/application/controllers/Dbbackup.php
Normal file
15
account/application/controllers/Dbbackup.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Dbbackup extends CI_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->myaccounts->backupDatabase();
|
||||
|
||||
}
|
||||
}
|
38
account/application/controllers/Defaults.php
Normal file
38
account/application/controllers/Defaults.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
class Defaults extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$query = $this->db->select('bbnepal_category, accategory_id')
|
||||
->from('tbl_acdefaults')
|
||||
->get();
|
||||
$dataA = array();
|
||||
foreach ($query->result() as $row) {
|
||||
$dataA[$row->bbnepal_category] = $row->accategory_id;
|
||||
}
|
||||
$data['Defaults'] = $dataA;
|
||||
if ($_POST) {
|
||||
pre($_POST);
|
||||
|
||||
$students_section = $_POST['students_section'];
|
||||
$teachers_section = $_POST['teachers_section'];
|
||||
$fee_types_section = $_POST['fee_types_section'];
|
||||
$expenses_section = $_POST['expenses_section'];
|
||||
$inventory_purchase_section = $_POST['inventory_purchase_section'];
|
||||
$inventory_sales_section = $_POST['inventory_sales_section'];
|
||||
|
||||
|
||||
$student_defaults = $this->db->query("SELECT * FROM tbl_acdefaults WHERE ");
|
||||
|
||||
|
||||
die;
|
||||
}
|
||||
loadView('setup/defaults', $data);
|
||||
}
|
||||
}
|
18
account/application/controllers/Login.php
Normal file
18
account/application/controllers/Login.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Login extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data['re'] = '';
|
||||
if (isset($_GET['url'])) {
|
||||
$data['re'] = $_GET['url'];
|
||||
}
|
||||
if (isset($_POST['email'])) {
|
||||
authenticateUser($_POST['email'], $_POST['password'], $data['re']);
|
||||
}
|
||||
$this->load->view("login",$data);
|
||||
}
|
||||
|
||||
}
|
10
account/application/controllers/Logout.php
Normal file
10
account/application/controllers/Logout.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Logout extends CI_Controller {
|
||||
public function index()
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
redirect("");
|
||||
}
|
||||
}
|
7
account/application/controllers/Page404.php
Normal file
7
account/application/controllers/Page404.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Page404 extends CI_Controller
|
||||
{
|
||||
public function index(){
|
||||
loadview('404page');
|
||||
}
|
||||
}
|
819
account/application/controllers/Setup.php
Normal file
819
account/application/controllers/Setup.php
Normal file
@ -0,0 +1,819 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Setup extends CI_Controller {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
loadView('setup/tables',$data);
|
||||
}
|
||||
public function officecalendar()
|
||||
{
|
||||
/* Setup - Initialize a calendar
|
||||
$startDate=new DateTime('2010-01-01');
|
||||
$endDate=new DateTime('2040-12-31');
|
||||
//$t=array();
|
||||
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
|
||||
{
|
||||
$day_ad=$i->format("Y-m-d");
|
||||
$day_bs=NepaliDate($day_ad);
|
||||
$day_weekday=$i->format("l");
|
||||
$day_work=($day_weekday=="Saturday")?0:1;
|
||||
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
|
||||
$remarks="";
|
||||
$status=1;
|
||||
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
|
||||
$this->db->query($t);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Setup Official Calendar";
|
||||
loadView("setup/officecalendar",$data);
|
||||
}
|
||||
public function factorycalendar()
|
||||
{
|
||||
/* Setup - Initialize a calendar
|
||||
$startDate=new DateTime('2010-01-01');
|
||||
$endDate=new DateTime('2040-12-31');
|
||||
//$t=array();
|
||||
for($i=$startDate;$i<=$endDate;$i->modify('+1 day'))
|
||||
{
|
||||
$day_ad=$i->format("Y-m-d");
|
||||
$day_bs=NepaliDate($day_ad);
|
||||
$day_weekday=$i->format("l");
|
||||
$day_work=($day_weekday=="Saturday")?0:1;
|
||||
$day_holiday=($day_weekday=="Saturday")?"Saturday":"";
|
||||
$remarks="";
|
||||
$status=1;
|
||||
$t="insert into tbl_officecalendar (day_ad, day_bs, day_weekday, day_work, day_holiday, remarks, status) values ('".$day_ad."', '".$day_bs."', '".$day_weekday."', '".$day_work."', '".$day_holiday."', '".$remarks."', '".$status."')";
|
||||
$this->db->query($t);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Setup Factory Work Calendar";
|
||||
loadView("setup/factorycalendar",$data);
|
||||
}
|
||||
public function itemcategories($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Item Categories";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
|
||||
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->insert('tbl_itemcategories',$TableData);
|
||||
redirect("setup/itemcategories");
|
||||
} loadView("setup/additemcategories",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'category_name'=>filter_var($_POST['category_name'],FILTER_SANITIZE_STRING),
|
||||
'category_alias'=>filter_var($_POST['category_alias'],FILTER_SANITIZE_STRING),
|
||||
'category_desc'=>filter_var($_POST['category_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
'parent_category'=>filter_var($_POST['parent_category'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->where('category_id',$id);
|
||||
$this->db->update('tbl_itemcategories',$TableData);
|
||||
redirect("setup/itemcategories");
|
||||
} loadView("setup/edititemcategories",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('category_id',$id);
|
||||
$this->db->delete('tbl_itemcategories');
|
||||
redirect("setup/itemcategories");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listitemcategories",$data);
|
||||
}
|
||||
}
|
||||
public function items($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Items";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
|
||||
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
|
||||
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
|
||||
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
|
||||
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_items',$TableData);
|
||||
redirect("setup/items");
|
||||
} loadView("setup/additems",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'category_id'=>filter_var($_POST['category_id'],FILTER_SANITIZE_STRING),
|
||||
'item_name'=>filter_var($_POST['item_name'],FILTER_SANITIZE_STRING),
|
||||
'item_alias'=>getalias($_POST['item_name'], 'item_alias', 'tbl_items'),
|
||||
'item_desc'=>filter_var($_POST['item_desc'],FILTER_SANITIZE_STRING),
|
||||
'item_units'=>filter_var($_POST['item_units'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('item_id',$id);
|
||||
$this->db->update('tbl_items',$TableData);
|
||||
redirect("setup/items");
|
||||
} loadView("setup/edititems",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('item_id',$id);
|
||||
$this->db->delete('tbl_items');
|
||||
redirect("setup/items");
|
||||
break;
|
||||
default:
|
||||
if(isset($_GET['item_category']))
|
||||
{
|
||||
if($_GET['item_category']!="")
|
||||
$data['TableData']=$this->MItems->getItemsByAlias($_GET['item_category']);
|
||||
else
|
||||
$data['TableData']=$this->MItems->getItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['TableData']=$this->MItems->getItems();
|
||||
}
|
||||
|
||||
loadView("setup/listitems",$data);
|
||||
}
|
||||
}
|
||||
|
||||
public function vendors($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Vendor";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
|
||||
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
|
||||
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
|
||||
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_vendors',$TableData);
|
||||
redirect("setup/vendors");
|
||||
} loadView("setup/addvendors",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'vendor_type'=>filter_var($_POST['vendor_type'],FILTER_SANITIZE_STRING),
|
||||
'vendor_name'=>filter_var($_POST['vendor_name'],FILTER_SANITIZE_STRING),
|
||||
'vendor_country'=>filter_var($_POST['vendor_country'],FILTER_SANITIZE_STRING),
|
||||
'vendor_contact'=>filter_var($_POST['vendor_contact'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('vendor_id',$id);
|
||||
$this->db->update('tbl_vendors',$TableData);
|
||||
redirect("setup/vendors");
|
||||
} loadView("setup/editvendors",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('vendor_id',$id);
|
||||
$this->db->delete('tbl_vendors');
|
||||
redirect("setup/vendors");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listvendors",$data);
|
||||
}
|
||||
}
|
||||
public function branches($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Company Branches";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
|
||||
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_branches',$TableData);
|
||||
redirect("setup/branches");
|
||||
} loadView("setup/addbranches",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'branch_name'=>filter_var($_POST['branch_name'],FILTER_SANITIZE_STRING),
|
||||
'branch_alias'=>getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address'=>filter_var($_POST['branch_address'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('branch_id',$id);
|
||||
$this->db->update('tbl_branches',$TableData);
|
||||
redirect("setup/branches");
|
||||
} loadView("setup/editbranches",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('branch_id',$id);
|
||||
$this->db->delete('tbl_branches');
|
||||
redirect("setup/branches");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listbranches",$data);
|
||||
}
|
||||
}
|
||||
public function departments($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Work Department";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
|
||||
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
|
||||
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_departments',$TableData);
|
||||
redirect("setup/departments");
|
||||
} loadView("setup/adddepartments",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'department_name'=>filter_var($_POST['department_name'],FILTER_SANITIZE_STRING),
|
||||
'department_alias'=>getalias($_POST['department_name'], 'department_alias', 'tbl_departments'),
|
||||
'branch_id'=>filter_var($_POST['branch_id'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('department_id',$id);
|
||||
$this->db->update('tbl_departments',$TableData);
|
||||
redirect("setup/departments");
|
||||
} loadView("setup/editdepartments",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('department_id',$id);
|
||||
$this->db->delete('tbl_departments');
|
||||
redirect("setup/departments");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listdepartments",$data);
|
||||
}
|
||||
}
|
||||
public function employeetype($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Employee Types";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
|
||||
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_employeetype',$TableData);
|
||||
redirect("setup/employeetype");
|
||||
} loadView("setup/addemployeetype",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'employeetype_name'=>filter_var($_POST['employeetype_name'],FILTER_SANITIZE_STRING),
|
||||
'employeetype_alias'=>getalias($_POST['employeetype_name'], 'employeetype_alias', 'tbl_employeetype'),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('employeetype_id',$id);
|
||||
$this->db->update('tbl_employeetype',$TableData);
|
||||
redirect("setup/employeetype");
|
||||
} loadView("setup/editemployeetype",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('employeetype_id',$id);
|
||||
$this->db->delete('tbl_employeetype');
|
||||
redirect("setup/employeetype");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listemployeetype",$data);
|
||||
}
|
||||
}
|
||||
public function salarytypes($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Salary Types";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
|
||||
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_salarytypes',$TableData);
|
||||
redirect("setup/salarytypes");
|
||||
} loadView("setup/addsalarytypes",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'salarytype_name'=>filter_var($_POST['salarytype_name'],FILTER_SANITIZE_STRING),
|
||||
'salarytype_alias'=>getalias($_POST['salarytype_name'], 'salarytype_alias', 'tbl_salarytypes'),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('salarytype_id',$id);
|
||||
$this->db->update('tbl_salarytypes',$TableData);
|
||||
redirect("setup/salarytypes");
|
||||
} loadView("setup/editsalarytypes",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('salarytype_id',$id);
|
||||
$this->db->delete('tbl_salarytypes');
|
||||
redirect("setup/salarytypes");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listsalarytypes",$data);
|
||||
}
|
||||
}
|
||||
public function workshifts($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Work Shift";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
|
||||
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
|
||||
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_workshifts',$TableData);
|
||||
redirect("setup/workshifts");
|
||||
} loadView("setup/addworkshifts",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'workshift_name'=>filter_var($_POST['workshift_name'],FILTER_SANITIZE_STRING),
|
||||
'workshift_alias'=>getalias($_POST['workshift_name'], 'workshift_alias', 'tbl_workshifts'),
|
||||
'workshift_desc'=>filter_var($_POST['workshift_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_by'=>'admin',
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('workshift_id',$id);
|
||||
$this->db->update('tbl_workshifts',$TableData);
|
||||
redirect("setup/workshifts");
|
||||
} loadView("setup/editworkshifts",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('workshift_id',$id);
|
||||
$this->db->delete('tbl_workshifts');
|
||||
redirect("setup/workshifts");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listworkshifts",$data);
|
||||
}
|
||||
}
|
||||
public function propertytype($alias="",$params=array())
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
$data['pageTitle']="Property Types";
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
|
||||
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
|
||||
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_propertytypes',$TableData);
|
||||
redirect('setup/propertytype');
|
||||
}
|
||||
loadView('setup/addpropertytypes',$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$params[0];
|
||||
$TableData=array(
|
||||
'propertytype_name'=>filter_var($_POST['propertytype_name'],FILTER_SANITIZE_STRING),
|
||||
'propertytype_alias'=>getalias($_POST['propertytype_name'], 'propertytype_alias', 'tbl_propertytypes'),
|
||||
'propertytype_desc'=>filter_var($_POST['propertytype_desc'],FILTER_SANITIZE_STRING),
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
);
|
||||
$this->db->where('propertytype_id',$id);
|
||||
$this->db->update('tbl_propertytypes',$TableData);
|
||||
redirect('setup/propertytype');
|
||||
}
|
||||
loadView('setup/editpropertytypes',$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('propertytype_id',$id);
|
||||
$this->db->delete('tbl_propertytypes');
|
||||
redirect('setup/propertytype');
|
||||
break;
|
||||
default:
|
||||
loadView('setup/propertytypes',$data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function rentingproperty($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Rentable Properties";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
|
||||
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
|
||||
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_properties',$TableData);
|
||||
redirect("setup/rentingproperty");
|
||||
} loadView("setup/addproperties",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'propertyType_id'=>filter_var($_POST['propertyType_id'],FILTER_SANITIZE_STRING),
|
||||
'property_name'=>filter_var($_POST['property_name'],FILTER_SANITIZE_STRING),
|
||||
'property_desc'=>filter_var($_POST['property_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('property_id',$id);
|
||||
$this->db->update('tbl_properties',$TableData);
|
||||
redirect("setup/rentingproperty");
|
||||
} loadView("setup/editproperties",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('property_id',$id);
|
||||
$this->db->delete('tbl_properties');
|
||||
redirect("setup/rentingproperty");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listproperties",$data);
|
||||
}
|
||||
}
|
||||
public function submeters($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Setup Sub-Meters";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
|
||||
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
|
||||
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
|
||||
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_submeters',$TableData);
|
||||
redirect("setup/submeters");
|
||||
} loadView("setup/addsubmeters",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'submeter_name'=>filter_var($_POST['submeter_name'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'installed_date'=>filter_var($_POST['installed_date'],FILTER_SANITIZE_STRING),
|
||||
'installed_location'=>filter_var($_POST['installed_location'],FILTER_SANITIZE_STRING),
|
||||
'initial_reading'=>filter_var($_POST['initial_reading'],FILTER_SANITIZE_STRING),
|
||||
'identification_mark'=>filter_var($_POST['identification_mark'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('submeter_id',$id);
|
||||
$this->db->update('tbl_submeters',$TableData);
|
||||
redirect("setup/submeters");
|
||||
} loadView("setup/editsubmeters",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('submeter_id',$id);
|
||||
$this->db->delete('tbl_submeters');
|
||||
redirect("setup/submeters");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listsubmeters",$data);
|
||||
}
|
||||
}
|
||||
public function utilities($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Utilities for Renting";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
|
||||
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_utilities',$TableData);
|
||||
redirect("setup/utilities");
|
||||
} loadView("setup/addutilities",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'utility_name'=>filter_var($_POST['utility_name'],FILTER_SANITIZE_STRING),
|
||||
'utility_desc'=>filter_var($_POST['utility_desc'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('utility_id',$id);
|
||||
$this->db->update('tbl_utilities',$TableData);
|
||||
redirect("setup/utilities");
|
||||
} loadView("setup/editutilities",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('utility_id',$id);
|
||||
$this->db->delete('tbl_utilities');
|
||||
redirect("setup/utilities");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listutilities",$data);
|
||||
}
|
||||
}
|
||||
public function utilityrates($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Utility Rates";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
|
||||
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_utilityrates',$TableData);
|
||||
redirect("setup/utilityrates");
|
||||
} loadView("setup/addutilityrates",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'utility_id'=>filter_var($_POST['utility_id'],FILTER_SANITIZE_STRING),
|
||||
'property_id'=>filter_var($_POST['property_id'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_id'=>filter_var($_POST['rentalperiod_id'],FILTER_SANITIZE_STRING),
|
||||
'utility_rate'=>filter_var($_POST['utility_rate'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('utilityrate_id',$id);
|
||||
$this->db->update('tbl_utilityrates',$TableData);
|
||||
redirect("setup/utilityrates");
|
||||
} loadView("setup/editutilityrates",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('utilityrate_id',$id);
|
||||
$this->db->delete('tbl_utilityrates');
|
||||
redirect("setup/utilityrates");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listutilityrates",$data);
|
||||
}
|
||||
}
|
||||
public function rentalperiods($alias="",$params=array())
|
||||
|
||||
{
|
||||
|
||||
$data['dataValue']=$this->session;
|
||||
|
||||
$data['pageTitle']="Rental Periods";
|
||||
|
||||
switch($alias)
|
||||
{
|
||||
case 'add':
|
||||
if(isset($_POST['submit'])){
|
||||
$TableData=array(
|
||||
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
|
||||
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->insert('tbl_rentalperiods',$TableData);
|
||||
redirect("setup/rentalperiods");
|
||||
} loadView("setup/addrentalperiods",$data);
|
||||
break;
|
||||
case 'edit':
|
||||
if(isset($_POST['submit'])){
|
||||
$id=$this->uri->segment(4);
|
||||
$TableData=array(
|
||||
'rentalperiod_name'=>filter_var($_POST['rentalperiod_name'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_alias'=>getalias($_POST['rentalperiod_name'], 'rentalperiod_alias', 'tbl_rentalperiods'),
|
||||
'rentalperiod_desc'=>filter_var($_POST['rentalperiod_desc'],FILTER_SANITIZE_STRING),
|
||||
'rentalperiod_duration'=>filter_var($_POST['rentalperiod_duration'],FILTER_SANITIZE_STRING),
|
||||
'created_on'=>date('Y-m-d H:i:s'),
|
||||
'created_by'=>'admin',
|
||||
'remarks'=>filter_var($_POST['remarks'],FILTER_SANITIZE_STRING),
|
||||
'status'=>1,
|
||||
);
|
||||
$this->db->where('rentalperiod_id',$id);
|
||||
$this->db->update('tbl_rentalperiods',$TableData);
|
||||
redirect("setup/rentalperiods");
|
||||
} loadView("setup/editrentalperiods",$data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id=$this->uri->segment(4);
|
||||
$this->db->where('rentalperiod_id',$id);
|
||||
$this->db->delete('tbl_rentalperiods');
|
||||
redirect("setup/rentalperiods");
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listrentalperiods",$data);
|
||||
}
|
||||
}
|
||||
public function tables()
|
||||
{
|
||||
$data['dataValue']=$this->session;
|
||||
loadView('setup/tables',$data);
|
||||
}
|
||||
}
|
16
account/application/controllers/Sync.php
Normal file
16
account/application/controllers/Sync.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Sync extends CI_Controller {
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function clients()
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
print_r($_POST);
|
||||
|
||||
}
|
||||
|
||||
}
|
14
account/application/controllers/Togglelanguage.php
Normal file
14
account/application/controllers/Togglelanguage.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Togglelanguage extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if ($this->session->userdata("language") == "np") :
|
||||
$this->session->set_userdata("language","eng");
|
||||
else : $this->session->set_userdata("language","np");
|
||||
endif;
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
63
account/application/controllers/Users.php
Normal file
63
account/application/controllers/Users.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
class Users extends CI_Controller{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
isViewPermitted();
|
||||
$this->load->model('MUsers');
|
||||
}
|
||||
public function index(){
|
||||
$data['Users']=$this->MUsers->getUsers();
|
||||
loadView('users/view',$data);
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$privilege=$_POST;
|
||||
array_splice($privilege, 0, 3);
|
||||
if (isset($_POST['user_name'])){
|
||||
$inputArray=array(
|
||||
'user_name'=>$_POST['user_name'],
|
||||
'user_password'=>$_POST['user_password'],
|
||||
'user_email'=>$_POST['user_email'],
|
||||
'user_privilege'=>json_encode($privilege),
|
||||
'status'=>2
|
||||
);
|
||||
$this->MUsers->addUser($inputArray);
|
||||
redirect('users');
|
||||
}
|
||||
$data['Users']=$this->MUsers->getUsers();
|
||||
//pre($data);die;
|
||||
loadView('users/add',$data);
|
||||
}
|
||||
|
||||
function edit($id){
|
||||
$privilege=$_POST;
|
||||
array_splice($privilege, 0, 3);
|
||||
if (isset($_POST['user_name'])){
|
||||
$inputArray=array(
|
||||
'user_name'=>$_POST['user_name'],
|
||||
'user_password'=>$_POST['user_password'],
|
||||
'user_email'=>$_POST['user_email'],
|
||||
'user_privilege'=>json_encode($privilege),
|
||||
);
|
||||
$this->MUsers->UpdateUser($inputArray,$id);
|
||||
redirect('users');
|
||||
}
|
||||
$data['User']=$this->MUsers->getUsers();
|
||||
$data['Users']=$this->MUsers->getUserById($id);
|
||||
//pre($data);die;
|
||||
loadView('users/edit',$data);
|
||||
}
|
||||
|
||||
function delete($id){
|
||||
$this->MUsers->deleteuser($id);
|
||||
redirect('users');
|
||||
$data['Users']=$this->MUsers->getUserById($id);
|
||||
loadView('users/delete',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
201
account/application/controllers/Welcome.php
Normal file
201
account/application/controllers/Welcome.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$this->initDB();
|
||||
loadView('index', $data);
|
||||
// $this->myaccounts->backupDatabase();
|
||||
}
|
||||
public function dbbackup()
|
||||
{
|
||||
$this->myaccounts->backupDatabase();
|
||||
}
|
||||
public function initDB()
|
||||
{
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_units` (
|
||||
`unit_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`unit_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_paymentmodes` (
|
||||
`paymentmode_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`paymentmode_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_itemcategories` (
|
||||
`itemcategory_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`units_id` int(11) NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`itemcategory_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_items` (
|
||||
`item_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`itemcategories_id` int(11) DEFAULT NULL,
|
||||
`item_code` varchar(255) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`item_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_stocklocations` (
|
||||
`stocklocation_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`alias` varchar(255) DEFAULT NULL,
|
||||
`description` text DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`stocklocation_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_stocks` (
|
||||
`stock_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`stocklocations_id` int(11) DEFAULT NULL,
|
||||
`ref_id` int(11) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`items_id` int(11) DEFAULT NULL,
|
||||
`qty` int(11) DEFAULT NULL,
|
||||
`price` double(10,2) DEFAULT NULL,
|
||||
`display_order` int(11) DEFAULT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
`remarks` text DEFAULT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
PRIMARY KEY (`stock_id`)
|
||||
)");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_purchases` (
|
||||
`purchase_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`purchase_ref` VARCHAR(50) NULL,
|
||||
`transaction_type` VARCHAR(50) NULL,
|
||||
`accounts_id` INT(11) NOT NULL COMMENT 'Vendors Account', -- Adding comment here,
|
||||
`purchase_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`purchase_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_purchasedetails` (
|
||||
`purchasedetails_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`purchases_id` INT(11) NOT NULL,
|
||||
`items_id` VARCHAR(50) NOT NULL,
|
||||
`qty` DOUBLE(10,2) NOT NULL,
|
||||
`rate` DOUBLE(10,2) NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`purchasedetails_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_sales` (
|
||||
`sales_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`transaction_type` VARCHAR(50) NOT NULL,
|
||||
`accounts_id` INT(11) NOT NULL COMMENT 'Customer Accounts - Sundry Debitors', -- Adding comment here,
|
||||
`sales_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`sales_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_salesdetails` (
|
||||
`salesdetails_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`sales_id` INT(11) NOT NULL,
|
||||
`items_id` VARCHAR(50) NOT NULL,
|
||||
`qty` DOUBLE(10,2) NOT NULL,
|
||||
`rate` DOUBLE(10,2) NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
`status` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`salesdetails_id`)
|
||||
)");
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `tbl_transactions` (
|
||||
`transaction_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`transaction_type` VARCHAR(50) NOT NULL,
|
||||
`stocks_id` INT(11) NOT NULL,
|
||||
`qty` INT(11) NOT NULL,
|
||||
`transaction_date` DATE NOT NULL,
|
||||
`created_on` DATE NOT NULL,
|
||||
`created_by` VARCHAR(50) NOT NULL,
|
||||
`remarks` TEXT NOT NULL,
|
||||
PRIMARY KEY (`transaction_id`)
|
||||
)");
|
||||
if (!$this->db->get("tbl_stocklocations")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_stocklocations");
|
||||
$this->db->query("insert into tbl_stocklocations set title='Main Stock', status=1");
|
||||
}
|
||||
if (!$this->db->get("tbl_units")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_units");
|
||||
$this->db->query("insert into tbl_units set title='Pcs', status=1");
|
||||
}
|
||||
if (!$this->db->get("tbl_paymentmodes")->num_rows() > 0) {
|
||||
$this->db->query("truncate table tbl_paymentmodes");
|
||||
$this->db->query("insert into tbl_paymentmodes set title='Cash', status=1");
|
||||
}
|
||||
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_purchases LIKE 'purchase_ref'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_purchases ADD COLUMN purchase_ref VARCHAR(50)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_branches LIKE 'vat'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_branches ADD COLUMN vat int(11)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_branches LIKE 'pan'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_branches ADD COLUMN pan VARCHAR(20)");
|
||||
}
|
||||
$query = $this->db->query("SHOW COLUMNS FROM tbl_items LIKE 'units_id'");
|
||||
|
||||
// If the column doesn't exist, alter the table to add it
|
||||
if ($query->num_rows() == 0) {
|
||||
$this->db->query("ALTER TABLE tbl_items ADD COLUMN units_id INT(11)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
253
account/application/controllers/_Accounts.php
Normal file
253
account/application/controllers/_Accounts.php
Normal file
@ -0,0 +1,253 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accounts extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
'account_code' => generateAccountCode(filter_var($_POST['account_code'])),
|
||||
'account_name' => filter_var($_POST['account_name']),
|
||||
'account_type' => filter_var($_POST['account_type']),
|
||||
'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
'account_currency' => filter_var($_POST['account_currency']),
|
||||
'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accounts', $TableData);
|
||||
redirect("accounts");
|
||||
}
|
||||
loadView("accounts/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(3);
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
//'account_code' => filter_var($_POST['account_code']),
|
||||
'account_name' => filter_var($_POST['account_name']),
|
||||
'account_type' => filter_var($_POST['account_type']),
|
||||
'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
'account_currency' => filter_var($_POST['account_currency']),
|
||||
'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts', $TableData);
|
||||
redirect("accounts");
|
||||
}
|
||||
loadView("accounts/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(3);
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts');
|
||||
redirect("accounts");
|
||||
break;
|
||||
case 'getdetails':
|
||||
$id = $this->uri->segment(3);
|
||||
$this->db->where("account_id", $id);
|
||||
$data['Account'] = $this->db->get("tbl_accounts")->row();
|
||||
$this->load->view("accounts/details", $data);
|
||||
break;
|
||||
case 'renumerate':
|
||||
$Accounts = $this->db->where("status=1")->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
$AccountCode = generateAccountCode($Account->accategory_id);
|
||||
$this->db->where("account_id", $Account->account_id)->set("account_code", $AccountCode)->update("tbl_accounts");
|
||||
endforeach;
|
||||
redirect("accounts");
|
||||
break;
|
||||
case 'listvouchers':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
loadView("accounts/listvouchers", $data);
|
||||
break;
|
||||
case 'addvoucher':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
if (isset($_POST['submit']) && !isVoucherExists($_POST['voucher_no'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => filter_var($_POST['voucher_no']),
|
||||
//'voucher_ref' => filter_var($_POST['voucher_ref']), // If the voucher is raised against other transactions
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => 'Journal', //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narrations = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narrations[$entry_no],
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
redirect("accounts/listvouchers");
|
||||
break;
|
||||
}
|
||||
|
||||
loadView("accounts/addvoucher", $data);
|
||||
break;
|
||||
case 'voucherdetails':
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$this->load->view("accounts/voucherdetails", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['pageTitle']="Voucher Entries";
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
loadview("accounts/show_voucher", $data);
|
||||
break;
|
||||
case 'reversal':
|
||||
$voucher_id = $this->uri->segment(3);
|
||||
if (isVoucherReverseable($voucher_id)) :
|
||||
$VoucherDetails = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$entry_no = 0;
|
||||
foreach ($VoucherDetails as $VoucherDetail) :
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => $VoucherDetail->transaction_date,
|
||||
'account_id' => $VoucherDetail->account_id,
|
||||
'narration' => "Reversal of Voucher #" . getFieldfromValue("tbl_vouchers", "voucher_no", "voucher_id", $VoucherDetail->voucher_id),
|
||||
'dr' => $VoucherDetail->cr,
|
||||
'cr' => $VoucherDetail->dr,
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
$entry_no++;
|
||||
endforeach;
|
||||
$this->db->where("voucher_id", $voucher_id)->set("voucher_state", 'Reversed')->update("tbl_vouchers");
|
||||
endif;
|
||||
redirect("accounts/listvouchers");
|
||||
break;
|
||||
case 'ledger':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger", $data);
|
||||
break;
|
||||
case 'ledgerall':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
//$T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'trialbalance':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
foreach ($AccountGroup->AccountCategories as $AccountCategory) {
|
||||
$AccountCategory->Accounts = $this->db->where("status", 1)->where("accategory_id", $AccountCategory->accategory_id)->get("tbl_accounts")->result();
|
||||
}
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/trialbalance", $data);
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
159
account/application/controllers/accounts/Accountheads.php
Normal file
159
account/application/controllers/accounts/Accountheads.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accountheads extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
if (!$this->checkifAccountExists($_POST['account_name'])) {
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
// 'account_code' => generateAccountCode(filter_var($_POST['account_code'])),
|
||||
'account_name' => filter_var($_POST['account_name']),
|
||||
// 'account_type' => filter_var($_POST['account_type']),
|
||||
// 'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
// 'account_currency' => filter_var($_POST['account_currency']),
|
||||
// 'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
// 'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
// 'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
// 'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
// 'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
// 'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
// 'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accounts', $TableData);
|
||||
$account_id = $this->db->insert_id();
|
||||
$voucherData = array(
|
||||
"voucher_id" => 0,
|
||||
"transaction_date" => date("Y-m-d"),
|
||||
"account_id" => $account_id,
|
||||
"Dr" => 0,
|
||||
"Cr" => 0,
|
||||
"fiscalyear_id" => $this->session->userdata['FiscalYearID'],
|
||||
"created_on" => date('Y-m-d H:i:s'),
|
||||
"branch_id" => $this->session->userdata("BranchID"),
|
||||
"created_by" => $this->session->userdata("loggedUser"),
|
||||
"remarks" => "Opening Balance Entry",
|
||||
"status" => 1
|
||||
);
|
||||
if ($_POST['opening_balance_drcr'] == "DR") $voucherData['Dr'] = $_POST['opening_balance'];
|
||||
if ($_POST['opening_balance_drcr'] == "CR") $voucherData['Cr'] = $_POST['opening_balance'];
|
||||
$this->db->insert('tbl_voucherdetails', $voucherData);
|
||||
redirect("accounts/accountheads/list");
|
||||
} else {
|
||||
echo "Account Head Name Already Exists";
|
||||
die;
|
||||
}
|
||||
}
|
||||
loadView("accounts/accountheads/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
//'account_code' => filter_var($_POST['account_code']),
|
||||
'account_name' => filter_var($_POST['account_name']),
|
||||
'account_type' => filter_var($_POST['account_type']),
|
||||
'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
'account_currency' => filter_var($_POST['account_currency']),
|
||||
'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts', $TableData);
|
||||
$voucherData = array(
|
||||
"Dr" => 0,
|
||||
"Cr" => 0,
|
||||
);
|
||||
if ($_POST['opening_balance_drcr'] == "DR") $voucherData['Dr'] = $_POST['opening_balance'];
|
||||
if ($_POST['opening_balance_drcr'] == "CR") $voucherData['Cr'] = $_POST['opening_balance'];
|
||||
$v = $this->db->query("select * from tbl_voucherdetails where account_id =\"$id\" and voucher_id=\"0\" ")->row();
|
||||
if ($v) {
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->where('voucher_id', 0);
|
||||
$this->db->update('tbl_voucherdetails', $voucherData);
|
||||
} else {
|
||||
$voucherData = array(
|
||||
"voucher_id" => 0,
|
||||
"transaction_date" => date("Y-m-d"),
|
||||
"account_id" => $id,
|
||||
"Dr" => 0,
|
||||
"Cr" => 0,
|
||||
"fiscalyear_id" => $this->session->userdata['FiscalYearID'],
|
||||
"created_on" => date('Y-m-d H:i:s'),
|
||||
"branch_id" => $this->session->userdata("BranchID"),
|
||||
"created_by" => $this->session->userdata("loggedUser"),
|
||||
"remarks" => "Opening Balance Entry",
|
||||
"status" => 1
|
||||
);
|
||||
if ($_POST['opening_balance_drcr'] == "DR") $voucherData['Dr'] = $_POST['opening_balance'];
|
||||
if ($_POST['opening_balance_drcr'] == "CR") $voucherData['Cr'] = $_POST['opening_balance'];
|
||||
$this->db->insert('tbl_voucherdetails', $voucherData);
|
||||
}
|
||||
redirect("accounts/accountheads/list");
|
||||
}
|
||||
$data['Account'] = $this->db->query("select * from tbl_accounts where account_id =\"$id\" ")->row();
|
||||
$data['Account']->OpeningEntry = $this->db->query("select * from tbl_voucherdetails where account_id =\"$id\" and voucher_id=\"0\"")->row();
|
||||
loadView("accounts/accountheads/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("account", $id)) {
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('account_id', $id);
|
||||
$this->db->update('tbl_accounts');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("accounts/accountheads/list");
|
||||
break;
|
||||
case 'getdetails':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where("account_id", $id);
|
||||
$data['Account'] = $this->db->get("tbl_accounts")->row();
|
||||
$this->load->view("accounts/accountheads/details", $data);
|
||||
break;
|
||||
case 'renumerate':
|
||||
$Accounts = $this->db->where("status=1")->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
$AccountCode = generateAccountCode($Account->accategory_id);
|
||||
$this->db->where("account_id", $Account->account_id)->set("account_code", $AccountCode)->update("tbl_accounts");
|
||||
endforeach;
|
||||
redirect("accounts/accountheads/");
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/accountheads/list", $data);
|
||||
}
|
||||
}
|
||||
function checkifAccountExists($account_name)
|
||||
{
|
||||
return ($this->db->query("select * from tbl_accounts where UPPER(account_name)='" . strtoupper($account_name) . "'")->num_rows() > 0) ? true : false;
|
||||
}
|
||||
}
|
107
account/application/controllers/accounts/Ledger.php
Normal file
107
account/application/controllers/accounts/Ledger.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Ledger extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'navigate':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger/navigate", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
//$T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'partyledger':
|
||||
$data['pageTitle'] = "View Party Ledger";
|
||||
// $_GET['show_ledger'];
|
||||
if (isset($_GET['show_ledger'])) {
|
||||
$fromDate_Nepali = $_GET['from_date'];
|
||||
$toDate_Nepali = $_GET['to_date'];
|
||||
$data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali);
|
||||
$data['toDate'] = NepaliToEnglishDate($toDate_Nepali);
|
||||
$data['fromDate_Nepali'] = $fromDate_Nepali;
|
||||
$data['toDate_Nepali'] = $toDate_Nepali;
|
||||
$data['account_id'] = $_GET['account_id'];
|
||||
}
|
||||
loadView("accounts/ledger/partywise", $data);
|
||||
break;
|
||||
case 'print':
|
||||
$account_id = $this->uri->segment(4);
|
||||
$fromDate=(isset($_GET['from_date'])?$_GET['from_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_from));
|
||||
$toDate=(isset($_GET['to_date'])?$_GET['to_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_to));
|
||||
$LedgerPDF=$this->myaccounts->ledgerPDF($account_id,NepaliToEnglishDate($fromDate), NepaliToEnglishDate($toDate));
|
||||
$data['PDFFile']=site_url("pdf/ledgers/".$LedgerPDF);
|
||||
if(isset($_GET['modal']))
|
||||
$this->load->view("accounts/pdfviewer",$data);
|
||||
else
|
||||
loadView("accounts/pdfviewer",$data);
|
||||
break;
|
||||
case 'getaccountbalance':
|
||||
$account_id = $this->uri->segment(4);
|
||||
$AccountDetails=$this->myaccounts->getAccountDetails($account_id);
|
||||
$AccountDetails->BalanceRaw=$AccountDetails->Balance;
|
||||
$AccountDetails->Balance=myCurrency($AccountDetails->Balance);
|
||||
echo json_encode($AccountDetails);
|
||||
break;
|
||||
case 'day_book':
|
||||
$data['pageTitle'] = "Day Book";
|
||||
loadView("accounts/daybook", $data);
|
||||
break;
|
||||
case 'bank_book':
|
||||
$data['pageTitle'] = "Bank Book";
|
||||
loadView("accounts/ledger_bankbook", $data);
|
||||
break;
|
||||
case 'cash_book':
|
||||
$data['pageTitle'] = "Cash Book";
|
||||
loadView("accounts/ledger_cashbook", $data);
|
||||
break;
|
||||
case 'receiveables':
|
||||
$data['pageTitle'] = "Accounts Receiveables";
|
||||
loadView("accounts/ledger_receiveables", $data);
|
||||
break;
|
||||
case 'payables':
|
||||
$data['pageTitle'] = "Accounts Payables";
|
||||
loadView("accounts/ledger_payables", $data);
|
||||
break;
|
||||
default:
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
86
account/application/controllers/accounts/Openingbalance.php
Normal file
86
account/application/controllers/accounts/Openingbalance.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Openingbalance extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Opening Balance";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $TableData = array(
|
||||
// 'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
// 'account_code' => generateAccountCode(filter_var($_POST['account_code'])),
|
||||
// 'account_name' => filter_var($_POST['account_name']),
|
||||
// 'account_type' => filter_var($_POST['account_type']),
|
||||
// 'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
// 'account_currency' => filter_var($_POST['account_currency']),
|
||||
// 'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
// 'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
// 'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
// 'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
// 'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
// 'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
// 'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
// 'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'created_by' => 'admin',
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
// 'status' => 1,
|
||||
// );
|
||||
// $this->db->insert('tbl_accounts', $TableData);
|
||||
// redirect("accounts/accountheads/list");
|
||||
// }
|
||||
// loadView("accounts/accountheads/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
// $id = $this->uri->segment(4);
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $TableData = array(
|
||||
// 'accategory_id' => filter_var($_POST['accategory_id']),
|
||||
// //'account_code' => filter_var($_POST['account_code']),
|
||||
// 'account_name' => filter_var($_POST['account_name']),
|
||||
// 'account_type' => filter_var($_POST['account_type']),
|
||||
// 'account_plcategory' => filter_var($_POST['account_plcategory']),
|
||||
// 'account_currency' => filter_var($_POST['account_currency']),
|
||||
// 'account_partyname' => filter_var($_POST['account_partyname']),
|
||||
// 'account_partyaddress' => filter_var($_POST['account_partyaddress']),
|
||||
// 'account_partypan' => filter_var($_POST['account_partypan']),
|
||||
// 'account_partycontact' => filter_var($_POST['account_partycontact']),
|
||||
// 'account_partyemail' => filter_var($_POST['account_partyemail']),
|
||||
// 'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
|
||||
// 'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
|
||||
// 'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'created_by' => 'admin',
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
// 'status' => 1,
|
||||
// );
|
||||
// $this->db->where('account_id', $id);
|
||||
// $this->db->update('tbl_accounts', $TableData);
|
||||
// redirect("accounts/accountheads/list");
|
||||
// }
|
||||
// $data['Account'] = $this->db->query("select * from tbl_accounts where account_id =\"$id\" ")->row();
|
||||
// loadView("accounts/accountheads/edit", $data);
|
||||
// break;
|
||||
case 'delete':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $this->db->set('status', "-1");
|
||||
// $this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
// $this->db->where('account_id', $id);
|
||||
// $this->db->update('tbl_accounts');
|
||||
// redirect("accounts/accountheads/list");
|
||||
break;
|
||||
|
||||
default:
|
||||
loadView("accounts/openingbalance/entry", $data);
|
||||
}
|
||||
}
|
||||
}
|
210
account/application/controllers/accounts/Reports.php
Normal file
210
account/application/controllers/accounts/Reports.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Reports extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
case 'accounts':
|
||||
$data['pageTitle'] = "List of Accounts";
|
||||
loadView("accounts/accounts/list", $data);
|
||||
break;
|
||||
case 'ledger':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledger", $data);
|
||||
break;
|
||||
case 'ledgerall':
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Accounts = $this->db->where("status", 1)->get("tbl_accounts")->result();
|
||||
foreach ($Accounts as $Account) :
|
||||
|
||||
|
||||
endforeach;
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
$data['Accounts'] = $Accounts;
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
|
||||
$Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
|
||||
foreach ($Transactions as $T) {
|
||||
// $T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
$T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
|
||||
}
|
||||
$data['Transactions'] = $Transactions;
|
||||
$data['Account'] = $Account;
|
||||
$data['account_id'] = $account_id;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'trialbalance_old':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
foreach ($AccountGroups as $AccountGroup) {
|
||||
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
|
||||
foreach ($AccountGroup->AccountCategories as $AccountCategory) {
|
||||
$AccountCategory->Accounts = $this->db->where("status", 1)->where("accategory_id", $AccountCategory->accategory_id)->get("tbl_accounts")->result();
|
||||
}
|
||||
}
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/trialbalance", $data);
|
||||
break;
|
||||
case 'trialbalance':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
loadView("accounts/trialbalance_new", $data);
|
||||
break;
|
||||
case 'trialbalance_raw':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
|
||||
|
||||
loadView("accounts/trialbalance_raw", $data);
|
||||
break;
|
||||
case 'trialbalance_table':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
|
||||
loadView("accounts/trialbalance_table", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['voucher_id'] = $this->uri->segment(4);
|
||||
loadView("accounts/vouchers/show_voucher", $data);
|
||||
break;
|
||||
case 'balance_by_type':
|
||||
$data['pageTitle'] = "Account Balances By Types";
|
||||
loadView("accounts/balances/bytype", $data);
|
||||
break;
|
||||
case 'balance_by_category':
|
||||
$acgroup_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Category";
|
||||
if (isset($_GET['group'])) {
|
||||
$acgroup_id = ($_GET['group']) ? $_GET['group'] : 0;
|
||||
}
|
||||
if ($acgroup_id != 0) {
|
||||
$group = getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $acgroup_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
$data['acgroup_id'] = $acgroup_id;
|
||||
loadView("accounts/balances/bycategory", $data);
|
||||
break;
|
||||
case 'balance_by_group':
|
||||
$accategory_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Group";
|
||||
if (isset($_GET['category'])) {
|
||||
$accategory_id = ($_GET['category']) ? $_GET['category'] : 0;
|
||||
}
|
||||
if ($accategory_id != 0) {
|
||||
$group = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $accategory_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
loadView("accounts/balances/bygroup", $data);
|
||||
break;
|
||||
case 'balance_by_ledger':
|
||||
$accategory_id = 0;
|
||||
$data['pageTitle'] = "Account Balances By Group";
|
||||
if (isset($_GET['group'])) {
|
||||
$accategory_id = ($_GET['group']) ? $_GET['group'] : 0;
|
||||
}
|
||||
if ($accategory_id != 0) {
|
||||
$group = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $accategory_id);
|
||||
$data['pageTitle'] = "Account Balances By " . $group;
|
||||
}
|
||||
$data['accategory_id'] = $accategory_id;
|
||||
loadView("accounts/balances/byledger", $data);
|
||||
break;
|
||||
case 'pl_old':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/pl", $data);
|
||||
break;
|
||||
case 'pl':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/pl_new", $data);
|
||||
break;
|
||||
|
||||
case 'pl_grouped':
|
||||
$data['pageTitle'] = "Profit & Loss Statement";
|
||||
loadView("accounts/bib_pl", $data);
|
||||
break;
|
||||
case 'balance_sheet_old':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balancesheet", $data);
|
||||
break;
|
||||
case 'balance_sheet':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balancesheet_new", $data);
|
||||
break;
|
||||
case 'balance_sheet_vertical':
|
||||
$data['pageTitle'] = "Balance Sheet";
|
||||
loadView("accounts/balance_sheet_vertical", $data);
|
||||
break;
|
||||
case 'cash_flow':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/cash_flow", $data);
|
||||
break;
|
||||
case 'receipts_payments':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/receipts_payments", $data);
|
||||
break;
|
||||
case 'incomes_and_expenses':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/incomes_expenses", $data);
|
||||
break;
|
||||
case 'receipt_and_payment':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/receipt_and_payment", $data);
|
||||
break;
|
||||
case 'ratio_analysis':
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/ratio_analysis", $data);
|
||||
break;
|
||||
case 'sales_register':
|
||||
$data['pageTitle'] = "Sales Register";
|
||||
loadView("accounts/sales_register", $data);
|
||||
break;
|
||||
case 'purchase_register':
|
||||
$data['pageTitle'] = "Purchase Register";
|
||||
loadView("accounts/purchase_register", $data);
|
||||
break;
|
||||
case 'ajax':
|
||||
$ajaxCommand = $this->uri->segment(4);
|
||||
$this->processAjax($ajaxCommand);
|
||||
break;
|
||||
default:
|
||||
loadView("accounts/list", $data);
|
||||
}
|
||||
}
|
||||
private function processAjax($command)
|
||||
{
|
||||
switch ($command) {
|
||||
case 'accountsbycategory':
|
||||
$accategory_id = $this->uri->segment(5);
|
||||
$this->myaccounts->getAccountsTableByCategory($accategory_id);
|
||||
break;
|
||||
case 'getallaccounts':
|
||||
$this->myaccounts->getAllAccountsTable();
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(5);
|
||||
$this->myaccounts->showLedger($account_id);
|
||||
|
||||
|
||||
break;
|
||||
case 'default':
|
||||
//show_404();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
83
account/application/controllers/accounts/Setup.php
Normal file
83
account/application/controllers/accounts/Setup.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Setup extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Setup";
|
||||
switch ($alias) {
|
||||
// case 'addsingleentryvoucher':
|
||||
// $data['pageTitle'] = "Single Entry Voucher";
|
||||
// if (isset($_POST['submit'])) {
|
||||
// $TableData = array(
|
||||
// 'voucher_type' => 'SINGLE-ENTRY',
|
||||
// 'voucher_name' => filter_var($_POST['voucher_name']),
|
||||
// 'voucher_alias' => createalias(filter_var($_POST['voucher_name'])),
|
||||
// 'default_account' => filter_var($_POST['default_account']),
|
||||
// 'default_accountside' => filter_var($_POST['default_accountside']),
|
||||
// 'voucher_options' => filter_var($_POST['voucher_options']),
|
||||
// 'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
// 'status' => 1,
|
||||
// );
|
||||
// $this->db->insert('tbl_vouchertypes', $TableData);
|
||||
// redirect("accounts/setup/singleentryvoucher");
|
||||
// }
|
||||
// loadView("accounts/setup/singleentryvoucher/create", $data);
|
||||
// break;
|
||||
case 'editvouchertype':
|
||||
$data['pageTitle'] = "Voucher Types ";
|
||||
$vouchertype_id = $this->uri->segment(4);
|
||||
$Accountcategories = $this->db->where("status", 1)->where("parent_category_id <>","0")->order_by("accategory_name","asc")->get("tbl_accategories")->result();
|
||||
// pre($Accountcategories);die;
|
||||
$VoucherType = $this->db->where("vouchertype_id", $vouchertype_id)->get("tbl_vouchertypes")->row();
|
||||
if (isset($_POST['submit'])) {
|
||||
// pre($_POST['default_debits']);die;
|
||||
$TableData = array(
|
||||
'voucher_name' => filter_var($_POST['voucher_name']),
|
||||
'voucher_color' => filter_var($_POST['voucher_color']),
|
||||
'default_debits' => isset($_POST['default_debits']) ? implode(",", $_POST['default_debits']) : "",
|
||||
'default_credits' => isset($_POST['default_credits']) ? implode(",", $_POST['default_credits']) : "",
|
||||
'status' => $_POST['status']
|
||||
);
|
||||
// pre($TableData);die;
|
||||
$this->db->where("vouchertype_id", $vouchertype_id)->update('tbl_vouchertypes', $TableData);
|
||||
redirect("accounts/setup/listsingleentryvouchers");
|
||||
}
|
||||
$data['VoucherType'] = $VoucherType;
|
||||
$data['Accountcategories'] = $Accountcategories;
|
||||
loadView("accounts/setup/singleentryvoucher/edit", $data);
|
||||
break;
|
||||
case 'listsingleentryvouchers':
|
||||
$data['pageTitle'] = "Voucher Types";
|
||||
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||||
|
||||
break;
|
||||
// case 'deletevouchertype':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $this->db->where('vouchertype_id', $id);
|
||||
// $this->db->update('tbl_vouchertypes', array("status" => 0));
|
||||
// redirect("accounts/setup/listsingleentryvouchers");
|
||||
// break;
|
||||
// case 'togglevouchertype':
|
||||
// $id = $this->uri->segment(4);
|
||||
// $q="update tbl_vouchertypes set `status`= 1 - `status` where vouchertype_id='$id'";
|
||||
// $this->db->query($q);
|
||||
// redirect("accounts/setup/listsingleentryvouchers");
|
||||
// break;
|
||||
|
||||
default:
|
||||
loadView("accounts/setup/singleentryvoucher/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
597
account/application/controllers/accounts/Vouchers.php
Normal file
597
account/application/controllers/accounts/Vouchers.php
Normal file
@ -0,0 +1,597 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Vouchers extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
$this->load->library("myaccounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Accounting Vouchers";
|
||||
switch ($alias) {
|
||||
case 'print':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$VoucherPDF = $this->myaccounts->voucherPDF($voucher_id);
|
||||
$data['PDFFile'] = site_url("pdf/vouchers/" . $VoucherPDF);
|
||||
if (isset($_GET['modal']))
|
||||
$this->load->view("accounts/pdfviewer", $data);
|
||||
else
|
||||
loadView("accounts/pdfviewer", $data);
|
||||
break;
|
||||
case 'listvouchers':
|
||||
$data['pageTitle'] = "Vouchers";
|
||||
$fromDate_bs = isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth();
|
||||
$todate_bs = isset($_GET['to_date']) ? $_GET['to_date'] : NepaliDate(Today());
|
||||
$fromDate_ad = NepaliToEnglishDate($fromDate_bs);
|
||||
$toDate_ad = NepaliToEnglishDate($todate_bs);
|
||||
$data['fromDate_bs'] = $fromDate_bs;
|
||||
$data['toDate_bs'] = $todate_bs;
|
||||
$data['fromDate_ad'] = $fromDate_ad;
|
||||
$data['toDate_ad'] = $toDate_ad;
|
||||
$data['VoucherTypes']=$this->myaccounts->getVoucherTypes();
|
||||
loadView("accounts/vouchers/listvouchers", $data);
|
||||
break;
|
||||
case 'addvoucher':
|
||||
$data['pageTitle'] = "Journal Voucher";
|
||||
if (isset($_POST['submit']) && !isVoucherExists($_POST['voucher_no'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => filter_var($_POST['voucher_no']),
|
||||
'voucher_ref' => "JV" . filter_var($_POST['voucher_no']), // If the voucher is raised against other transactions
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => 'Journal', //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narrations = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narrations[$entry_no],
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
redirect("accounts/vouchers/print/" . $voucher_id);
|
||||
break;
|
||||
}
|
||||
|
||||
loadView("accounts/vouchers/addvoucher", $data);
|
||||
break;
|
||||
case 'voucherdetails':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$this->load->view("accounts/vouchers/voucherdetails", $data);
|
||||
break;
|
||||
case 'show_voucher':
|
||||
$data['pageTitle'] = "Voucher Entries";
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
$Voucher = $this->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
if($Voucher) {
|
||||
$Voucher->Details = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$data['Voucher'] = $Voucher;
|
||||
$data['voucher_id'] = $voucher_id;
|
||||
loadview("accounts/vouchers/show_voucher", $data);
|
||||
}
|
||||
break;
|
||||
case 'reversal':
|
||||
$voucher_id = $this->uri->segment(4);
|
||||
if (isVoucherReverseable($voucher_id)) :
|
||||
$VoucherDetails = $this->db->where("voucher_id", $voucher_id)->get("tbl_voucherdetails")->result();
|
||||
$entry_no = 0;
|
||||
foreach ($VoucherDetails as $VoucherDetail) :
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => $VoucherDetail->transaction_date,
|
||||
'account_id' => $VoucherDetail->account_id,
|
||||
'narration' => "Reversal of Voucher #" . getFieldfromValue("tbl_vouchers", "voucher_no", "voucher_id", $VoucherDetail->voucher_id),
|
||||
'dr' => $VoucherDetail->cr,
|
||||
'cr' => $VoucherDetail->dr,
|
||||
// 'cheque' => filter_var($_POST['cheque']),
|
||||
// 'cheque_details' => filter_var($_POST['cheque_details']),
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
$entry_no++;
|
||||
endforeach;
|
||||
$this->db->where("voucher_id", $voucher_id)->set("voucher_state", 'Reversed')->update("tbl_vouchers");
|
||||
endif;
|
||||
redirect("accounts/vouchers/listvouchers");
|
||||
break;
|
||||
default:
|
||||
if ($VoucherType = $this->myaccounts->getVoucherType($alias)) {
|
||||
$this->processVoucher($VoucherType);
|
||||
break;
|
||||
}
|
||||
loadView("accounts/vouchers/listvouchers", $data);
|
||||
}
|
||||
}
|
||||
private function processVoucher($VoucherType)
|
||||
{
|
||||
$data['pageTitle'] = $VoucherType->voucher_name;
|
||||
$data['VoucherType'] = $VoucherType;
|
||||
$command = $this->uri->segment(4);
|
||||
switch ($command) {
|
||||
case 'create':
|
||||
$voucher_no = generateVoucherNo($VoucherType->vouchertype_id);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'voucher_no' => $voucher_no,
|
||||
'voucher_ref' => $VoucherType->vouchertype_id,
|
||||
'voucher_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'voucher_state' => 'Entered', // Different stages of voucher Entered/Reversed/Cancel/Deleted/Locked/Draft etc.
|
||||
'voucher_type' => $VoucherType->vouchertype_id, //Different types of Vouchers like Cash/Bank/Payment/Receipt/advance etc.
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
$this->db->insert('tbl_vouchers', $TableData);
|
||||
$voucher_id = $this->db->insert_id();
|
||||
$account_ids = $_POST['account_ids'];
|
||||
$narration = $_POST['narration'];
|
||||
$debits = $_POST['debit'];
|
||||
$credits = $_POST['credit'];
|
||||
$entry_no = 0;
|
||||
$entryTotal = 0;
|
||||
for ($entry_no = 0; $entry_no < sizeof($account_ids); $entry_no++) {
|
||||
$TableData = array();
|
||||
$entryTotal += $debits[$entry_no];
|
||||
$TableData = array(
|
||||
'voucher_id' => $voucher_id,
|
||||
'entry_no' => $entry_no,
|
||||
'transaction_date' => NepaliToEnglishDate(filter_var($_POST['voucher_date'])),
|
||||
'account_id' => $account_ids[$entry_no],
|
||||
'narration' => $narration,
|
||||
'dr' => $debits[$entry_no],
|
||||
'cr' => $credits[$entry_no],
|
||||
// 'cheque' => isset($_POST['cheque_number']) ? $_POST['cheque_number'][$entry_no] : "",
|
||||
// 'cheque_details' => isset($_POST['cheque_details']) ? $_POST['cheque_details'][$entry_no] : "",
|
||||
'currency' => 'NPR',
|
||||
// 'exrate' => filter_var($_POST['exrate']),
|
||||
// 'fcdr' => filter_var($_POST['fcdr']),
|
||||
// 'fccr' => filter_var($_POST['fccr']),
|
||||
'branch_id' => $this->session->userdata("BranchID"),
|
||||
'fiscalyear_id' => $this->session->userdata("FiscalYearID"),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => $this->session->userdata("loggedUser"),
|
||||
// 'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1
|
||||
);
|
||||
//pre($TableData);die;
|
||||
$this->db->insert('tbl_voucherdetails', $TableData);
|
||||
}
|
||||
$entry_no++;
|
||||
|
||||
|
||||
redirect("accounts/vouchers/" . $VoucherType->voucher_alias . "/list");
|
||||
break;
|
||||
}
|
||||
|
||||
loadview("accounts/vouchers/create", $data);
|
||||
// loadview("accounts/vouchers/$VoucherType->voucher_alias/create", $data);
|
||||
break;
|
||||
default:
|
||||
// $dirname = getcwd() . "/application/views/accounts/vouchers/$VoucherType->voucher_alias";
|
||||
// $filename = $dirname . "/create.php";
|
||||
// //echo getcwd() . "\n";die;
|
||||
// if (!file_exists($filename)) {
|
||||
// mkdir($dirname, 0777);
|
||||
// $this->createView($filename);
|
||||
// $filename = $dirname . "/list.php";
|
||||
// $this->createListView($filename);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$data['Vouchers'] = $this->db->where("status", 1)->where("voucher_type", $VoucherType->vouchertype_id)->get("tbl_vouchers")->result();
|
||||
|
||||
// echo '<pre>' . $VoucherType->vouchertype_id;
|
||||
// print_r($VoucherType);
|
||||
// die();
|
||||
|
||||
// loadview("accounts/vouchers/$VoucherType->voucher_alias/list", $data);
|
||||
redirect("accounts/vouchers/listvouchers?vouchertypes=".$VoucherType->vouchertype_id);
|
||||
}
|
||||
}
|
||||
private function createView($filename)
|
||||
{
|
||||
$CreateFileContent = "<div class=\"content-wrapper\">\n
|
||||
<div class=\"content-header\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row mb-2\">\n
|
||||
<div class=\"col-sm-6\">\n
|
||||
<h1 class=\"m-0\">\n<?php echo \$pageTitle; ?></h1>
|
||||
</div>
|
||||
<div class=\"col-sm-6\">\n
|
||||
<ol class=\"breadcrumb float-sm-right\">\n
|
||||
<li class=\"breadcrumb-item\">\n<a href=\"<?php echo base_url(); ?>\">\nDashboard</a></li>
|
||||
<li class=\"breadcrumb-item active\">\n<?php echo \$pageTitle; ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"content\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\n
|
||||
<h5 class=\"m-0\">\nCreate <?php echo \$pageTitle; ?> </h5>
|
||||
</div>
|
||||
<div class=\"card-body\">\n
|
||||
<?php if(\$VoucherType->voucher_options==\"\"): ?>
|
||||
<form method=POST action=\"\" enctype=\"multipart/form-data\" name=\"tbl_accounts\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col-3\">\n
|
||||
<fieldset>
|
||||
<legend>Transaction Date</legend><input type=\"text\" class=\"form-control nepaliDatePicker\" id=\"voucher_date\" value=\"<?php echo NepaliDate(); ?>\" name=\"voucher_date\">\n
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class=\"col-3\">\n
|
||||
<fieldset>
|
||||
<?php \$DefaultAccount=\$this->myaccounts->getAccountDetails(\$VoucherType->default_account);?>
|
||||
<legend><?php echo \$DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency(\$DefaultAccount->Balance); ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class=\"col-3 offset-3\">\n
|
||||
<fieldset>
|
||||
<legend>Voucher #</legend><input type=\"text\" readonly class=\"form-control\" id=\"voucher_no\" value=\"<?php echo generateVoucherNo(); ?>\" name=\"voucher_no\">\n
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
<fieldset>
|
||||
<legend>Enter Transaction</legend>
|
||||
<table id=\"EntryTable\" class=\"table order-list\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Account</td>
|
||||
<td>Narration</td>
|
||||
<td>Amount</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class=\"col-3\">\n <?php fillComboWithValue(\"account_id\", \"\", \"account_id\", \"tbl_accounts\", \"account_name\", \"account_id\", \"\", \"\", \"\", \"status=1\"); ?> </td>
|
||||
<td class=\"col-4\">\n <input type=\"text\" name=\"narration\" id=\"narration\" class=\"form-control\" /> </td>
|
||||
<td class=\"col-1\">\n <input type=\"text\" name=\"debit\" id=\"debit\" value=\"0\" class=\"form-control\" /> </td>
|
||||
<td class=\"col-1\">\n <input type=\"button\" class=\"btn btn-primary full-width\" id=\"addrow\" value=\"Add\" /> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id=\"errorBox\" class=\"alert alert-secondary hidden\" role=\"alert\">\n
|
||||
<h5></h5>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\nTransaction List </div>
|
||||
<div class=\"card-body\">\n
|
||||
<table id=\"myTable\" class=\" table order-list table-striped table-bordered\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Account</td>
|
||||
<td>Narration</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody> </tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan=\"2\" class=\"text-right\">\nTotal</th>
|
||||
<td>
|
||||
<div id=\"debitTotal\">\n</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"row\">\n
|
||||
<!--COL START-->
|
||||
<div class=\"col\">\n
|
||||
<div class=\"form-group\">\n <label for=\"remarks\">\nRemarks</label> <textarea class=\"form-control\" id=\"remarks\" name=\"remarks\">\n</textarea> </div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
</div> <button class=\"btn btn-primary\" type=\"submit\" id=\"saveButton\" name=\"submit\">\nSave Voucher</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php echo \$VoucherType->voucher_options; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
\$(document).ready(function() {
|
||||
var counter = 0;
|
||||
\$(\"#addrow\").on(\"click\", function() {
|
||||
var msg = \"Transaction Row Added !!\";
|
||||
if (\$(\"#account_id\").val() != \"\") {
|
||||
if (!isAccountAdded(\$(\"#account_id\").val())) {
|
||||
if (\$(\"#narration\").val() != \"\") {
|
||||
var debit = (\$.isNumeric(\$(\"#debit\").val()) ? \$(\"#debit\").val() : 0);
|
||||
if (\$.isNumeric(debit)) {
|
||||
if (debit > 0) {
|
||||
addRow()
|
||||
} else {
|
||||
msg = \"Amount contain some value\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Non numberic value entered in amount. \";
|
||||
}
|
||||
} else {
|
||||
msg = \"Narration can't be empty!\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Account already added in transactions\";
|
||||
}
|
||||
} else {
|
||||
msg = \"Account Head Not Selected!\";
|
||||
}
|
||||
\$(\"#errorBox h5\").html(msg);
|
||||
\$(\"#errorBox\").fadeTo(2000, 500).slideUp(500, function() {
|
||||
\$(\"#errorBox\").slideUp(500);
|
||||
});
|
||||
});
|
||||
\$(\"table.order-list\").on(\"click\", \".ibtnDel\", function(event) {
|
||||
\$(this).closest(\"tr\").remove();
|
||||
calculateTotals();
|
||||
});
|
||||
});
|
||||
|
||||
function isAccountAdded(account_id) {
|
||||
var arr = \$('input[name=\"account_id[]\"]').map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
if (\$.inArray(account_id, arr) >= 0) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
function addRow() {
|
||||
var newRow = \$(\"<tr>\");
|
||||
var cols = \"\";
|
||||
cols += '<td><input type=\"hidden\" class=\"form-control\" name=\"account_ids[]\" value=\"' + \$(\"#account_id\").val() + '\"/><input type=\"text\" readonly class=\"form-control\" name=\"account_name[]\" value=\"' + \$(\"#account_id option:selected\").text() + '\"/></td>';
|
||||
cols += '<td><input type=\"text\" readonly class=\"form-control\" name=\"narration[]\" value=\"' + \$(\"#narration\").val() + '\"/></td>';
|
||||
cols += '<td><input type=\"text\" readonly class=\"form-control\" name=\"debit[]\" value=\"' + (\$.isNumeric(\$(\"#debit\").val()) ? \$(\"#debit\").val() : 0) + '\"/></td>';
|
||||
cols += '<td><input type=\"button\" class=\"ibtnDel btn btn-md btn-danger \" value=\"Delete\"></td>';
|
||||
newRow.append(cols);
|
||||
\$(\"#myTable.order-list\").append(newRow);
|
||||
calculateTotals();
|
||||
}
|
||||
|
||||
function calculateTotals() {
|
||||
var debitTotal = 0;
|
||||
var creditTotal = 0;
|
||||
var balance = 0;
|
||||
\$(\"table.order-list\").find('input[name^=\"debit[]\"]').each(function() {
|
||||
debitTotal += +\$(this).val();
|
||||
});
|
||||
\$(\"#debit\").val(0);
|
||||
\$(\"#narration\").val(\"\");
|
||||
\$(\"#debitTotal\").text(debitTotal.toFixed(2));
|
||||
\$(\"#balance\").text(balance.toFixed(2));
|
||||
\$(\"#saveButton\").prop(\"disabled\", false);
|
||||
}
|
||||
\$(\"#saveButton\").prop(\"disabled\", true);
|
||||
</script>";
|
||||
file_put_contents($filename, $CreateFileContent);
|
||||
}
|
||||
private function createListView($filename)
|
||||
{
|
||||
$ListFileContent = "<div class=\"content-wrapper\">\n
|
||||
<div class=\"content-header\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row mb-2\">\n
|
||||
<div class=\"col-sm-6\">\n
|
||||
|
||||
<h1 class=\"m-0\">\n<?php echo \$pageTitle; ?></h1>
|
||||
</div>
|
||||
<div class=\"col-sm-6\">\n
|
||||
<ol class=\"breadcrumb float-sm-right\">\n
|
||||
|
||||
<li class=\"breadcrumb-item\">\n<a href=\"<?php echo base_url(); ?>\">\nDashboard</a></li>
|
||||
<li class=\"breadcrumb-item active\">\n<?php echo \$pageTitle; ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=\"content\">\n
|
||||
<div class=\"container-fluid\">\n
|
||||
<div class=\"row\">\n
|
||||
<div class=\"col\">\n
|
||||
|
||||
<div class=\"card card-primary card-outline\">\n
|
||||
<div class=\"card-header\">\n
|
||||
|
||||
<h5 class=\"m-0\">\n<?php echo \$pageTitle; ?> <a href=\"<?php echo site_url(\"accounts/vouchers/\".\$VoucherType->voucher_alias.\"/create\"); ?>\" class=\"btn btn-sm btn-primary float-right\">\nCreate New <?php echo \$pageTitle; ?></a></h5>
|
||||
|
||||
</div>
|
||||
|
||||
<div class=\"card-body\">\n
|
||||
|
||||
<?php \$TableData = \$Vouchers ?>
|
||||
|
||||
<table class=\"table table-bordered table-striped\" id=\"voucherList\">\n
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID#</th>
|
||||
<th>Voucher No</th>
|
||||
<th>Voucher Date</th>
|
||||
|
||||
<th>Voucher Type</th>
|
||||
<th>Voucher State</th>
|
||||
|
||||
<th class=\"table-col col-2\">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach (\$TableData as \$TableRow) : ?>
|
||||
<?php foreach (\$TableRow as \$cols) : \$id = \$cols;
|
||||
break;
|
||||
endforeach; ?><tr data-id=\"<?php echo \$TableRow->voucher_id; ?>\" class=\"<?php echo(\$TableRow->voucher_state==\"Reversed\")?\"table-danger\":\"\"; ?>\">\n
|
||||
<td><?php echo \$TableRow->voucher_id; ?></td>
|
||||
<td><?php echo \$TableRow->voucher_no; ?></td>
|
||||
|
||||
<td><?php echo \$TableRow->voucher_date; ?></td>
|
||||
|
||||
<td><?php echo \$TableRow->voucher_type; ?></td>
|
||||
<td><?php echo \$TableRow->voucher_state; ?></td>
|
||||
|
||||
<td class=\"col-1\">\n
|
||||
<a onClick=\"javascript:showDetails(<?php echo \$id; ?>);\" class=\"btn btn-success btn-xs\" title=\"View Details\">\n<i class=\"fa fa-eye\">\n</i></a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<tbody>
|
||||
</table>
|
||||
<div class=\"modal fade\" id=\"voucherdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"voucherdetails_box\" aria-hidden=\"true\">\n
|
||||
<div class=\"modal-dialog modal-xl\" role=\"document\">\n
|
||||
<div class=\"modal-content\">\n
|
||||
<div class=\"modal-header\">\n
|
||||
<h5 class=\"modal-title\" id=\"exampleModalLabel\">\nVoucher Details</h5>
|
||||
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n
|
||||
<span aria-hidden=\"true\">\n×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class=\"modal-body\" id=\"details_container\">\n
|
||||
Voucher Details Goes Here
|
||||
</div>
|
||||
<div class=\"modal-footer\">\n
|
||||
<button type=\"button\" onClick='reversalEntry()' id=\"reversalBtn\" class=\"btn btn-secondary\" data-dismiss=\"modal\" data-id=\"\">\nRevarsal Entry</button>
|
||||
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">\nClose</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function showDetails(id) {
|
||||
\$.ajax({
|
||||
url: \"<?php echo site_url(\"accounts/vouchers/voucherdetails/\"); ?>\" + id,
|
||||
success: function(data) {
|
||||
\$(\"#details_container\").html(data);
|
||||
\$(\"#reversalBtn\").data(\"id\",id);
|
||||
\$(\"#voucherdetails_box\").modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
function reversalEntry()
|
||||
{
|
||||
var id=\$(\"#reversalBtn\").data(\"id\");
|
||||
|
||||
if(confirm(\"Are you sure you want to post reversal for this voucher?\"))
|
||||
{
|
||||
window.location=\"<?php echo site_url(\"accounts/vouchers/reversal/\"); ?>\"+id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
function footerfunctions()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
\$(document).ready(function() {
|
||||
var table = \$('#voucherList').DataTable();
|
||||
|
||||
var tableRows = \$('table#voucherList tbody').find('tr');
|
||||
tableRows.each(function() {
|
||||
async: false;
|
||||
var jqueryRow = \$(this);
|
||||
var row = table.row(jqueryRow);
|
||||
var id=\$(this).data(\"id\");
|
||||
var Transactions=\"<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>\";
|
||||
Transactions=getVoucherDetails(id);
|
||||
row.child(Transactions).show();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function getVoucherDetails(id) {
|
||||
\$.data;
|
||||
\$.ajax({
|
||||
url: \"<?php echo site_url(\"ajax/getVoucherDetailsTable/\"); ?>\" + id,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
\$.data=data;
|
||||
}
|
||||
});
|
||||
return (\$.data);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>";
|
||||
file_put_contents($filename, $ListFileContent);
|
||||
}
|
||||
}
|
11
account/application/controllers/index.html
Normal file
11
account/application/controllers/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
73
account/application/controllers/inventory/Itemcategories.php
Normal file
73
account/application/controllers/inventory/Itemcategories.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Itemcategories extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Item Categories";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_itemcategories', $TableData);
|
||||
redirect("inventory/itemcategories/list");
|
||||
}
|
||||
loadView("inventory/itemcategories/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$this->db->update('tbl_itemcategories', $TableData);
|
||||
redirect("inventory/itemcategories/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$data['itemcategory']=$this->db->get("tbl_itemcategories")->row();
|
||||
loadView("inventory/itemcategories/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("itemcategory", $id)) {
|
||||
$this->db->where('itemcategory_id', $id);
|
||||
$this->db->delete('tbl_itemcategories');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("inventory/itemcategories/list");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/itemcategories/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
99
account/application/controllers/inventory/Items.php
Normal file
99
account/application/controllers/inventory/Items.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Items extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("MStocks");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Inventory Items";
|
||||
$TableData = $this->db->where('status', 1);
|
||||
$TableData = $this->db->get('tbl_items')->result();
|
||||
foreach ($TableData as $TableRow) {
|
||||
$TableRow->Stock = $this->MStocks->getOpeningStock($TableRow->item_id);
|
||||
}
|
||||
$data['TableData'] = $TableData;
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'itemcategories_id' => filter_var($_POST['itemcategories_id']),
|
||||
'item_code' => filter_var($_POST['item_code']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'status' => 1,
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_items', $TableData);
|
||||
$item_id = $this->db->insert_id();
|
||||
$id = $item_id;
|
||||
$qty = $_POST['opening_stock'];
|
||||
$rate = $_POST['opening_stock_rate'];
|
||||
$this->MStocks->addOpeningStock($id, $qty, $rate);
|
||||
redirect("inventory/items/list");
|
||||
}
|
||||
loadView("inventory/items/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'itemcategories_id' => filter_var($_POST['itemcategories_id']),
|
||||
'item_code' => filter_var($_POST['item_code']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'units_id' => filter_var($_POST['units_id']),
|
||||
'status' => 1,
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('item_id', $id);
|
||||
$this->db->update('tbl_items', $TableData);
|
||||
$qty = $_POST['opening_stock'];
|
||||
$rate = $_POST['opening_stock_rate'];
|
||||
$this->MStocks->updateOpeningStock($id, $qty, $rate);
|
||||
redirect("inventory/items/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('item_id', $id);
|
||||
$item = $this->db->get("tbl_items")->row();
|
||||
$Stock = new stdClass;
|
||||
$stockVal = $this->MStocks->getOpeningStock($id);
|
||||
$Stock->opening_stock = $stockVal->qty;
|
||||
$Stock->opening_stock_rate = $stockVal->rate;
|
||||
$Stock->opening_stock_amount = $stockVal->amount;
|
||||
|
||||
$item->Stock = $Stock;
|
||||
$data['item'] = $item;
|
||||
loadView("inventory/items/list", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("items", $id)) {
|
||||
if ($this->MStocks->isDeleteable($id)) {
|
||||
$this->db->where('item_id', $id);
|
||||
$this->db->delete('tbl_items');
|
||||
$this->MStocks->deleteOpeningStock($id);
|
||||
}
|
||||
} else {
|
||||
echo "Transaction Exists!!! Can't Delete";
|
||||
die;
|
||||
}
|
||||
|
||||
redirect("inventory/items/list");
|
||||
break;
|
||||
default:
|
||||
|
||||
loadView("inventory/items/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
65
account/application/controllers/inventory/Paymentmodes.php
Normal file
65
account/application/controllers/inventory/Paymentmodes.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Paymentmodes extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Payment Modes";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_paymentmodes', $TableData);
|
||||
redirect("inventory/paymentmodes");
|
||||
}
|
||||
loadView("inventory/paymentmodes/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$this->db->update('tbl_paymentmodes', $TableData);
|
||||
redirect("inventory/paymentmodes");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$data['paymentmode'] = $this->db->get("tbl_paymentmodes")->row();
|
||||
loadView("inventory/paymentmodes/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('paymentmode_id', $id);
|
||||
$this->db->delete('tbl_paymentmodes');
|
||||
redirect("inventory/paymentmodes");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/paymentmodes/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
98
account/application/controllers/inventory/Purchases.php
Normal file
98
account/application/controllers/inventory/Purchases.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Purchases extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MPurchases');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Purchase";
|
||||
|
||||
switch ($alias) {
|
||||
case 'details':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('purchase_id', $id);
|
||||
$data['Purchase'] = $this->db->get("tbl_purchases")->row();
|
||||
$this->db->where('purchases_id', $id);
|
||||
$data['PurchaseDetails'] = $this->db->get("tbl_purchasedetails")->result();
|
||||
$data['pageTitle'] = "View Purchase";
|
||||
loadView("inventory/purchases/view", $data);
|
||||
break;
|
||||
case 'create':
|
||||
// print_r($_POST);die;
|
||||
if (isset($_POST['accounts_id'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => "Purchase Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'purchase_date' => filter_var($_POST['purchase_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_purchases', $TableData);
|
||||
$purchase_id = $this->db->insert_id();
|
||||
$a = 0;
|
||||
foreach ($_POST['item_id'] as $item) {
|
||||
$TableData = array(
|
||||
'purchases_id' => $purchase_id,
|
||||
'items_id' => $item,
|
||||
'qty' => $_POST['quantity'][$a],
|
||||
'rate' => $_POST['rate'][$a],
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_purchasedetails', $TableData);
|
||||
$a += 1;
|
||||
}
|
||||
$this->MStocks->addPurchaseToStock($this->db->where("purchases_id", $purchase_id)->get("tbl_purchasedetails")->result());
|
||||
redirect("inventory/purchases/list");
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
//
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => filter_var($_POST['transaction_type']),
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'purchase_date' => filter_var($_POST['purchase_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
pre($_POST);
|
||||
die;
|
||||
//$this->db->insert('tbl_purchases', $TableData);
|
||||
redirect("inventory/purchases/list");
|
||||
}
|
||||
loadView("inventory/purchases/create", $data);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('purchase_id', $id);
|
||||
$this->db->delete('tbl_purchases');
|
||||
$this->db->where('purchases_id', $id);
|
||||
$this->db->delete('tbl_purchasedetails');
|
||||
redirect("inventory/purchases/list");
|
||||
break;
|
||||
case 'purchase_register':
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/register", $data);
|
||||
default:
|
||||
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
|
||||
loadView("inventory/purchases/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
27
account/application/controllers/inventory/Reports.php
Normal file
27
account/application/controllers/inventory/Reports.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Reports extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MSales');
|
||||
$this->load->model('MPurchases');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Sales";
|
||||
switch ($alias) {
|
||||
case 'purchase_vs_sales':
|
||||
$data['StockRecords']=$this->MStocks->getStockRecords();
|
||||
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
|
||||
$data['SalesDetails'] = $this->MSales->getItemSales();
|
||||
loadview("inventory/reports/purchase_vs_sales", $data);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
103
account/application/controllers/inventory/Sales.php
Normal file
103
account/application/controllers/inventory/Sales.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Sales extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
$this->load->model('MSales');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Sales";
|
||||
switch ($alias) {
|
||||
case 'create':
|
||||
$data['items'] = $this->MStocks->getSellableItems();
|
||||
loadView("inventory/sales/create", $data);
|
||||
break;
|
||||
case 'store':
|
||||
|
||||
// print_r(filter_var($_POST['salesDate']));die;
|
||||
if (isset($_POST['accounts_id'])) {
|
||||
$TableData = array(
|
||||
'transaction_type' => "Sales Entry",
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['salesDate']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => '',
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_sales', $TableData);
|
||||
$sales_id = $this->db->insert_id();
|
||||
$i = 0;
|
||||
// print_r($_POST);die;
|
||||
|
||||
foreach ($_POST['item_id'] as $item) {
|
||||
if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0) :
|
||||
$TableData = array(
|
||||
'sales_id' => $sales_id,
|
||||
'items_id' => $item,
|
||||
'qty' => $_POST['qty'][$i],
|
||||
'rate' => $_POST['rate'][$i],
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'status' => 1,
|
||||
);
|
||||
$i += 1;
|
||||
$this->db->insert('tbl_salesdetails', $TableData);
|
||||
endif;
|
||||
}
|
||||
}
|
||||
// print_r($TableData);
|
||||
// die;
|
||||
|
||||
// $this->db->where('sales_id', $sales_id);
|
||||
$this->MStocks->addSalesToStock($this->db->where('sales_id', $sales_id)->get('tbl_salesdetails')->result());
|
||||
redirect("inventory/sales/list");
|
||||
break;
|
||||
case 'sales_register':
|
||||
$data['SalesRecords'] = $this->MSales->getSalesRecords();
|
||||
loadView("inventory/sales/register", $data);
|
||||
break;
|
||||
case 'details':
|
||||
$id = $this->uri->segment(4);
|
||||
$data['Sales'] = $this->db->where('sales_id', $id)->get("tbl_sales")->row();
|
||||
$data['SalesDetails'] = $this->db->where('sales_id', $id)->get('tbl_salesdetails')->result();
|
||||
loadView("inventory/sales/view", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'transaction_type' => filter_var($_POST['transaction_type']),
|
||||
'accounts_id' => filter_var($_POST['accounts_id']),
|
||||
'sales_date' => filter_var($_POST['sales_date']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->update('tbl_sales', $TableData);
|
||||
redirect("inventory/sales/list");
|
||||
}
|
||||
loadView("inventory/sales/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->delete('tbl_sales');
|
||||
$this->db->where('sales_id', $id);
|
||||
$this->db->delete('tbl_salesdetails');
|
||||
redirect("inventory/sales/list");
|
||||
break;
|
||||
default:
|
||||
$data['SalesRecords'] = $this->MSales->getSalesRecords();
|
||||
loadView("inventory/sales/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
68
account/application/controllers/inventory/Stocklocations.php
Normal file
68
account/application/controllers/inventory/Stocklocations.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Stocklocations extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Stock Location";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_stocklocations', $TableData);
|
||||
redirect("inventory/stocklocations/list");
|
||||
}
|
||||
loadView("inventory/stocklocations/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$this->db->update('tbl_stocklocations', $TableData);
|
||||
redirect("inventory/stocklocations/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$data['stockLocation'] = $this->db->get("tbl_stocklocations")->row();
|
||||
loadView("inventory/stocklocations/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stocklocation_id', $id);
|
||||
$this->db->delete('tbl_stocklocations');
|
||||
redirect("inventory/stocklocations/list");
|
||||
break;
|
||||
default:
|
||||
|
||||
loadView("inventory/stocklocations/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
75
account/application/controllers/inventory/Stocks.php
Normal file
75
account/application/controllers/inventory/Stocks.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Stocks extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Inventory Stock";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'stocklocations_id' => filter_var($_POST['stocklocations_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'items_id' => filter_var($_POST['items_id']),
|
||||
'qty' => filter_var($_POST['qty']),
|
||||
'price' => filter_var($_POST['price']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_stocks', $TableData);
|
||||
redirect("inventory/stocks/list");
|
||||
}
|
||||
loadView("inventory/stocks/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'stocklocations_id' => filter_var($_POST['stocklocations_id']),
|
||||
'title' => filter_var($_POST['title']),
|
||||
'items_id' => filter_var($_POST['items_id']),
|
||||
'qty' => filter_var($_POST['qty']),
|
||||
'price' => filter_var($_POST['price']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('stock_id', $id);
|
||||
$this->db->update('tbl_stocks', $TableData);
|
||||
redirect("inventory/stocks/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stock_id', $id);
|
||||
$data['stock'] = $this->db->get("tbl_stocks")->row();
|
||||
loadView("inventory/stocks/add", $data);
|
||||
break;
|
||||
case 'summary':
|
||||
$data['StockRecords'] = $this->MStocks->getStockSummary();
|
||||
// pre($data['StockRecords']);
|
||||
loadView("inventory/stocks/summary", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('stock_id', $id);
|
||||
$this->db->delete('tbl_stocks');
|
||||
redirect("inventory/stocks/list");
|
||||
break;
|
||||
default:
|
||||
$data['StockRecords'] = $this->MStocks->getStockRecords();
|
||||
loadView("inventory/stocks/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
73
account/application/controllers/inventory/Units.php
Normal file
73
account/application/controllers/inventory/Units.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Units extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Master - Units";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->insert('tbl_units', $TableData);
|
||||
redirect("inventory/units/list");
|
||||
}
|
||||
loadView("inventory/units/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'title' => filter_var($_POST['title']),
|
||||
'alias' => filter_var($_POST['alias']),
|
||||
'description' => filter_var($_POST['description']),
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
'status' => 1,
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
);
|
||||
$this->db->where('unit_id', $id);
|
||||
$this->db->update('tbl_units', $TableData);
|
||||
redirect("inventory/units/list");
|
||||
}
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('unit_id', $id);
|
||||
$data['unit'] = $this->db->get("tbl_units")->row();
|
||||
loadView("inventory/units/add", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("units", $id)) {
|
||||
$this->db->where('unit_id', $id);
|
||||
$this->db->delete('tbl_units');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("inventory/units/list");
|
||||
break;
|
||||
default:
|
||||
loadView("inventory/units/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
177
account/application/controllers/master/Accategories.php
Normal file
177
account/application/controllers/master/Accategories.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Accategories extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper("accounts");
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$q = "SELECT COUNT(*) as num FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tbl_accategories' AND COLUMN_NAME = 'parent_category_id'";
|
||||
$n = $this->db->query($q)->row()->num;
|
||||
if ($n == 0) {
|
||||
$q = "ALTER TABLE tbl_accategories ADD COLUMN parent_category_id INT(1) NOT NULL DEFAULT 0";
|
||||
$this->db->query($q);
|
||||
}
|
||||
//echo $n;die;
|
||||
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/list");
|
||||
}
|
||||
loadView("accounts/accategories/add", $data);
|
||||
break;
|
||||
case 'add_parent':
|
||||
if (isset($_POST['submit'])) {
|
||||
if (!$this->checkifCategoryExists(trim($_POST['accategory_name']))) {
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => 0,
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/parent");
|
||||
} else {
|
||||
echo "CATEGORY ALREADY EXISTS";
|
||||
die;
|
||||
}
|
||||
}
|
||||
loadView("accounts/accategories/add-parent", $data);
|
||||
break;
|
||||
case 'add_child':
|
||||
if (isset($_POST['submit'])) {
|
||||
// print_r($_POST);
|
||||
// die();
|
||||
if (!$this->checkifCategoryExists(trim($_POST['accategory_name']))) {
|
||||
$TableData = array(
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'acgroup_id' => filter_var(getFieldfromValue("tbl_accategories", "acgroup_id", "accategory_id", $_POST['parent_category_id'])),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/childs");
|
||||
} else {
|
||||
echo "CATEGORY ALREADY EXISTS";
|
||||
die;
|
||||
}
|
||||
}
|
||||
loadView("accounts/accategories/add-child", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories', $TableData);
|
||||
redirect("master/accategories");
|
||||
}
|
||||
$data['AccountCategory'] = $this->db->query("select * from tbl_accategories where accategory_id =\"$id\" ")->row();
|
||||
loadView("accounts/accategories/edit", $data);
|
||||
break;
|
||||
case 'edit_parents':
|
||||
$id = $this->uri->segment(4);
|
||||
$data['pageTitle'] = "Edit Category";
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
$TableData = array(
|
||||
'acgroup_id' => filter_var($_POST['acgroup_id']),
|
||||
'accategory_code' => generateACCategoryCode($_POST['acgroup_id']),
|
||||
'parent_category_id' => filter_var($_POST['parent_category_id']),
|
||||
'accategory_name' => filter_var($_POST['accategory_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories', $TableData);
|
||||
redirect("master/accategories/parent");
|
||||
}
|
||||
$data['AccountCategory'] = $this->db->query("select * from tbl_accategories where accategory_id =\"$id\" ")->row();
|
||||
loadView("accounts/accategories/edit-parents", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction("accategory", $id)) {
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Transaction Exists!!! Can't Delete";die;
|
||||
}
|
||||
redirect("master/accategories/childs");
|
||||
break;
|
||||
case 'delete_parent':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->set('status', "-1");
|
||||
$this->db->set('remarks', "Deleted on" . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('accategory_id', $id);
|
||||
$this->db->update('tbl_accategories');
|
||||
redirect("master/accategories/parent");
|
||||
break;
|
||||
case 'parent':
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-parents-only", $data);
|
||||
break;
|
||||
case 'childs':
|
||||
$data['pageTitle'] = "Account Groups";
|
||||
|
||||
// $data['ACCategories'] = $this->db->query("select *, (select accategory_name from tbl_accategories as a where a.parent_category_id=b.accategory_id) as parent_category, (select acgroup_name from tbl_acgroups where tbl_acgroups.acgroup_id=b.acgroup_id) as acgroup_name from tbl_accategories as b where status=1")->result();
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-childs-only", $data);
|
||||
break;
|
||||
default:
|
||||
$data['pageTitle'] = "Account Categories";
|
||||
$data['ACCategories'] = $this->myaccounts->getAccountCategories();
|
||||
loadView("accounts/accategories/list-parents-only", $data);
|
||||
}
|
||||
}
|
||||
function checkifCategoryExists($accategory_name)
|
||||
{
|
||||
return ($this->db->query("select * from tbl_accategories where UPPER(accategory_name)='" . strtoupper($accategory_name) . "'")->num_rows() > 0) ? true : false;
|
||||
}
|
||||
}
|
63
account/application/controllers/master/Acgroups.php
Normal file
63
account/application/controllers/master/Acgroups.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Acgroups extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Account Types";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'acgroup_code' => filter_var($_POST['acgroup_code']),
|
||||
'acgroup_name' => filter_var($_POST['acgroup_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
);
|
||||
$this->db->insert('tbl_acgroups', $TableData);
|
||||
redirect("master/acgroups");
|
||||
}
|
||||
loadView("acgroups/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'acgroup_code' => filter_var($_POST['acgroup_code']),
|
||||
'acgroup_name' => filter_var($_POST['acgroup_name']),
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'created_by' => 'admin',
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
'display_order' => filter_var($_POST['display_order']),
|
||||
);
|
||||
$this->db->where('acgroup_id', $id);
|
||||
$this->db->update('tbl_acgroups', $TableData);
|
||||
redirect("master/acgroups");
|
||||
}
|
||||
loadView("acgroups/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('acgroup_id', $id);
|
||||
$this->db->where('acgroup_id not in (select acgroup_id from tbl_accategories)');
|
||||
$this->db->delete('tbl_acgroups');
|
||||
redirect("master/acgroups");
|
||||
break;
|
||||
default:
|
||||
loadView("acgroups/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
96
account/application/controllers/master/Branches.php
Normal file
96
account/application/controllers/master/Branches.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Branches extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias)
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "Company";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'branch_name' => filter_var($_POST['branch_name'], FILTER_SANITIZE_STRING),
|
||||
'branch_alias' => getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address' => filter_var($_POST['branch_address'], FILTER_SANITIZE_STRING),
|
||||
'vat' => $_POST['vat'],
|
||||
'pan' => $_POST['pan'],
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks'], FILTER_SANITIZE_STRING),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_branches', $TableData);
|
||||
redirect("master/branches");
|
||||
}
|
||||
$data['editable'] = 0;
|
||||
loadView("setup/addbranches", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $this->uri->segment(4);
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'branch_name' => filter_var($_POST['branch_name'], FILTER_SANITIZE_STRING),
|
||||
'branch_alias' => getalias($_POST['branch_name'], 'branch_alias', 'tbl_branches'),
|
||||
'branch_address' => filter_var($_POST['branch_address'], FILTER_SANITIZE_STRING),
|
||||
'vat' => $_POST['vat'],
|
||||
'pan' => $_POST['pan'],
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks'], FILTER_SANITIZE_STRING),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->update('tbl_branches', $TableData);
|
||||
redirect("master/branches");
|
||||
}
|
||||
|
||||
$data['editable'] = 1;
|
||||
$data['branchData'] = $this->db->where("branch_id", $id)->get("tbl_branches")->row();
|
||||
loadView("setup/addbranches", $data);
|
||||
break;
|
||||
case 'select':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('branch_id<>', $id);
|
||||
$this->db->update('tbl_branches', ['status' => 0]);
|
||||
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->update('tbl_branches', ['status' => 1]);
|
||||
redirect("master/branches");
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction('branch', $id)) {
|
||||
$this->db->where('branch_id', $id);
|
||||
$this->db->delete('tbl_branches');
|
||||
redirect("master/branches");
|
||||
} else {
|
||||
echo "Can't Delete!! Transaction Exitis";
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'list':
|
||||
if (isset($_POST['branch'])) {
|
||||
$this->db->where('branch_id!=', $_POST['branch']);
|
||||
$this->db->update('tbl_branches', ["status" => 0]);
|
||||
$this->db->where('branch_id', $_POST['branch']);
|
||||
$this->db->update('tbl_branches', ["status" => 1]);
|
||||
redirect("logout");
|
||||
}
|
||||
// loadView("setup/selectbranch", $data);
|
||||
loadView("setup/listbranches", $data);
|
||||
break;
|
||||
default:
|
||||
loadView("setup/listbranches", $data);
|
||||
}
|
||||
}
|
||||
}
|
95
account/application/controllers/master/Fiscalyear.php
Normal file
95
account/application/controllers/master/Fiscalyear.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Fiscalyear extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
$data['dataValue'] = $this->session;
|
||||
$data['pageTitle'] = "Fiscal Year";
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'fiscalyear_code' => filter_var($_POST['fiscalyear_code']),
|
||||
'fiscalyear_year' => filter_var($_POST['fiscalyear_year']),
|
||||
'fiscalyear_from' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_from'])),
|
||||
'fiscalyear_to' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_to'])),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 0,
|
||||
);
|
||||
$this->db->insert('tbl_fiscalyear', $TableData);
|
||||
redirect("master/fiscalyear");
|
||||
}
|
||||
loadView("fiscalyear/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'fiscalyear_code' => filter_var($_POST['fiscalyear_code']),
|
||||
'fiscalyear_year' => filter_var($_POST['fiscalyear_year']),
|
||||
'fiscalyear_from' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_from'])),
|
||||
'fiscalyear_to' => NepaliToEnglishDate(filter_var($_POST['fiscalyear_to'])),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => isset($_POST['status']) ? $_POST['status'] : 1,
|
||||
);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear', $TableData);
|
||||
redirect("master/fiscalyear");
|
||||
}
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
$id = $this->uri->segment(4);
|
||||
// pre($id);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$data['Fiscalyear'] = $this->db->get('tbl_fiscalyear')->row();
|
||||
// pre($data['Fiscalyear']);die;
|
||||
$this->load->view("fiscalyear/ajaxedit", $data);
|
||||
} else {
|
||||
loadView("fiscalyear/edit", $data);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
if (!$this->myaccounts->hasTransaction('fiscalyear', $id)) {
|
||||
$this->db->set('status', -1);
|
||||
$this->db->set('remarks', "Deleted on " . date("Y-m-d H:i:s") . " by " . $this->session->userdata("loggedUser"));
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
redirect("master/fiscalyear");
|
||||
} else {
|
||||
$response = array(
|
||||
'status' => 'failed',
|
||||
'message' => 'Cannot delete fiscal year with associated transactions.'
|
||||
);
|
||||
$title="List of Fiscalyear";
|
||||
$data['pageTitle']=$title;
|
||||
$data['response']= json_encode($response);
|
||||
loadView("fiscalyear/list",$data);
|
||||
// return json_encode($response);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'select':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('status<>-1');
|
||||
$this->db->set('status', 0);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('fiscalyear_id', $id);
|
||||
$this->db->update('tbl_fiscalyear');
|
||||
redirect("logout");
|
||||
break;
|
||||
default:
|
||||
loadView("fiscalyear/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
47
account/application/controllers/master/Importvouchers.php
Normal file
47
account/application/controllers/master/Importvouchers.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Importvouchers extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
function index()
|
||||
{
|
||||
$data['pageTitle'] = "Import Vouchers";
|
||||
$importedData = array();
|
||||
if (isset($_FILES['voucher_list'])) {
|
||||
$filename = $_FILES["voucher_list"]["tmp_name"];
|
||||
if ($_FILES["voucher_list"]["size"] > 0) {
|
||||
$file = fopen($filename, "r");
|
||||
while (($getData = fgetcsv($file, 100000, ",")) !== FALSE) {
|
||||
$importedData[] = $getData;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$data['importedData'] = $importedData;
|
||||
switch ($_POST['import_type']) {
|
||||
case 'Groups':
|
||||
loadView("accounts/importgroups", $data);
|
||||
break;
|
||||
case 'Categories':
|
||||
loadView("accounts/importcategories", $data);
|
||||
break;
|
||||
case 'Accounts':
|
||||
loadView("accounts/importaccounts", $data);
|
||||
break;
|
||||
case 'Vouchers':
|
||||
loadView("accounts/importvouchers", $data);
|
||||
break;
|
||||
case 'VoucherDetails':
|
||||
loadView("accounts/importvoucherdetails", $data);
|
||||
break;
|
||||
default:
|
||||
//loadView("accounts/importvouchers", $data);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
loadView("accounts/importvouchers", $data);
|
||||
}
|
||||
}
|
||||
}
|
60
account/application/controllers/master/Translations.php
Normal file
60
account/application/controllers/master/Translations.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Translations extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
checkLogin();
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
|
||||
$data['pageTitle'] = "English to Nepali Translations";
|
||||
|
||||
switch ($alias) {
|
||||
case 'add':
|
||||
if (isset($_POST['submit'])) {
|
||||
$TableData = array(
|
||||
'english' => filter_var($_POST['english']),
|
||||
'nepali' => filter_var($_POST['nepali']),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert('tbl_translations', $TableData);
|
||||
redirect("master/translations");
|
||||
}
|
||||
loadView("translations/add", $data);
|
||||
break;
|
||||
case 'edit':
|
||||
if (isset($_POST['submit'])) {
|
||||
$id = $this->uri->segment(4);
|
||||
$TableData = array(
|
||||
'english' => filter_var($_POST['english']),
|
||||
'nepali' => filter_var($_POST['nepali']),
|
||||
'created_by' => 'admin',
|
||||
'created_on' => date('Y-m-d H:i:s'),
|
||||
'remarks' => filter_var($_POST['remarks']),
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->where('translation_id', $id);
|
||||
$this->db->update('tbl_translations', $TableData);
|
||||
redirect("master/translations");
|
||||
}
|
||||
loadView("translations/edit", $data);
|
||||
break;
|
||||
case 'delete':
|
||||
$id = $this->uri->segment(4);
|
||||
$this->db->where('translation_id', $id);
|
||||
$this->db->delete('tbl_translations');
|
||||
redirect("master/translations");
|
||||
break;
|
||||
default:
|
||||
loadView("translations/list", $data);
|
||||
}
|
||||
}
|
||||
}
|
11
account/application/core/index.html
Normal file
11
account/application/core/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
180
account/application/helpers/accounts_helper.php
Normal file
180
account/application/helpers/accounts_helper.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
function generateACCategoryCode($group_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$acgroup_code = $ci->db->where("acgroup_id=$group_id")->get("tbl_acgroups")->row()->acgroup_code;
|
||||
$lastACCategoryCode = $ci->db->select_max("accategory_code")->where("acgroup_id=$group_id")->get("tbl_accategories")->row()->accategory_code;
|
||||
$category_part = substr($lastACCategoryCode, 1);
|
||||
|
||||
$category_part = (float)$category_part + 1;
|
||||
//if($category_part<10)$category_part="00".$category_part;
|
||||
if ($category_part < 10) $category_part = "00" . $category_part;
|
||||
elseif ($category_part < 100) $category_part = "0" . $category_part;
|
||||
return $acgroup_code . $category_part;
|
||||
}
|
||||
function generateAccountCode($category_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$accategory_code = $ci->db->where("accategory_id=$category_id")->get("tbl_accategories")->row()->accategory_code;
|
||||
$lastAccountCode = $ci->db->select_max("account_code")->where("accategory_id=$category_id")->get("tbl_accounts")->row()->account_code;
|
||||
$account_part = substr($lastAccountCode, 4);
|
||||
|
||||
$account_part = (float)$account_part + 1;
|
||||
//if($category_part<10)$category_part="00".$category_part;
|
||||
if ($account_part < 10) $account_part = "00" . $account_part;
|
||||
elseif ($account_part < 100) $account_part = "0" . $account_part;
|
||||
return $accategory_code . $account_part;
|
||||
}
|
||||
function showFiscalYear()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
echo getFieldfromValue("tbl_fiscalyear", "fiscalyear_year", "fiscalyear_id", $ci->session->userdata("FiscalYearID"));
|
||||
}
|
||||
function FYStart()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
// echo $ci->session->userdata("FiscalYearID");die;asd;
|
||||
$FY = getFieldfromValue("tbl_fiscalyear", "fiscalyear_from", "fiscalyear_id", $ci->session->userdata("FiscalYearID"));
|
||||
// echo NepaliDate($FY);die;
|
||||
return NepaliDate($FY);
|
||||
}
|
||||
function FYEnd()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$FY = getFieldfromValue("tbl_fiscalyear", "fiscalyear_to", "fiscalyear_id", $ci->session->userdata("FiscalYearID"));
|
||||
return NepaliDate($FY);
|
||||
}
|
||||
function showAccountCategoriesSelector($fieldName, $fieldID, $condition = "1=1", $selectedID = '', $additionalClass = "")
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$AccountCategories = $ci->db->where("status", 1)->where($condition)->get("tbl_accategories")->result();
|
||||
$isRequired = (stripos($additionalClass, "required") !== false); // Check if "required" exists in $additionalClass
|
||||
$html = "<select name='$fieldName' id='$fieldID' class='select2 $additionalClass'";
|
||||
if ($isRequired) {
|
||||
$html .= " required";
|
||||
}
|
||||
$html .= ">";
|
||||
|
||||
$html .= "<option value='' " . (($selectedID == '') ? "SELECTED" : "") . ">Select Account Category</option>";
|
||||
|
||||
foreach ($AccountCategories as $AccountCategory) {
|
||||
$html .= "<option value='$AccountCategory->accategory_id'" . (($selectedID == $AccountCategory->accategory_id) ? "selected" : "") . ">" . getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $AccountCategory->acgroup_id) . " >> $AccountCategory->accategory_name</option>";
|
||||
}
|
||||
|
||||
$html .= "</select>";
|
||||
echo $html;
|
||||
}
|
||||
function showAccountCategoriesByIds($AccountCategories = array())
|
||||
{
|
||||
// pre($AccountCategories); //die;
|
||||
$ci = &get_instance();
|
||||
|
||||
if ($AccountCategories) {
|
||||
$AccountCategories_a = $ci->db->where("status", 1);
|
||||
$AccountCategories_a = $AccountCategories_a->where_in("accategory_id", $AccountCategories);
|
||||
$AccountCategories_a = $AccountCategories_a->get("tbl_accategories")->result();
|
||||
$html = array();
|
||||
foreach ($AccountCategories_a as $AccountCategory) {
|
||||
$html[] = $AccountCategory->accategory_name;
|
||||
}
|
||||
echo implode(", ", $html);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function linkVoucher($voucher_id)
|
||||
{
|
||||
if($voucher_id!=0) {
|
||||
$ci = &get_instance();
|
||||
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
|
||||
echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
|
||||
} else {
|
||||
echo "";
|
||||
}
|
||||
}
|
||||
function linkLedger($Account)
|
||||
{
|
||||
|
||||
$ci = &get_instance();
|
||||
echo "<a class='link' target='_blank' href='" . site_url("accounts/ledger/partyledger?from_date=" . FYStart() . "&to_date=" . FYEnd() . "&account_id=" . $Account->account_id . "&show_ledger=true") . "'>$Account->account_name</a>";
|
||||
}
|
||||
function linkGroup($Group)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
echo "<a class='link' target='_blank' href='" . site_url("accounts/reports/balance_by_category/") . "?group=" . $Group->acgroup_id . "'>$Group->acgroup_name</a>";
|
||||
}
|
||||
function linkCategory($Category)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
if ($Category) :
|
||||
echo "<a class='link' target='_blank' href='" . site_url("accounts/reports/balance_by_group/") . "?category=" . $Category->accategory_id . "'>$Category->accategory_name</a>";
|
||||
endif;
|
||||
}
|
||||
function myCurrency($number, $inline = false)
|
||||
{
|
||||
if ($number == 0) {
|
||||
if (!$inline)
|
||||
return "<span class='currency text-right'> </span>";
|
||||
else
|
||||
return "<span class='text-right'> </span>";
|
||||
}
|
||||
if ($number < 0) return "<span class='currency text-right'>(" . number_format(abs($number), 2, ".", ",") . ")</span>";
|
||||
if (!$inline)
|
||||
return "<span class='currency text-right'>" . number_format($number, 2, ".", ",") . "</span>";
|
||||
else
|
||||
return "<span class='text-right'>" . number_format($number, 2, ".", ",") . "</span>";
|
||||
}
|
||||
function showNill()
|
||||
{
|
||||
return "<span class='currency text-right'>Nill</span>";
|
||||
}
|
||||
function isVoucherExists($voucher_no)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return ($ci->db->where("voucher_no", $voucher_no)->get("tbl_vouchers")->num_rows() > 0) ? true : false;
|
||||
}
|
||||
function isVoucherReverseable($voucher_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return ($ci->db->select("voucher_state")->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row()->voucher_state == "Entered") ? true : false;
|
||||
}
|
||||
function generateVoucherNo($vouchertype_id = "")
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$voucherTypeCondition = ($vouchertype_id != "") ? " WHERE voucher_type = '$vouchertype_id'" : "";
|
||||
|
||||
$query = $ci->db->query("SELECT MAX(voucher_no) AS voucher_no FROM tbl_vouchers" . $voucherTypeCondition);
|
||||
$row = $query->row();
|
||||
|
||||
$newVoucherNo = ($row->voucher_no !== null) ? $row->voucher_no + 1 : 1;
|
||||
|
||||
return $newVoucherNo;
|
||||
}
|
||||
|
||||
function countChildCategories($acgroup_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return $ci->db->where("status", 1)->where("acgroup_id", $acgroup_id)->get("tbl_accategories")->num_rows();
|
||||
}
|
||||
function countChildAccounts($accategory_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return $ci->db->where("status", 1)->where("accategory_id", $accategory_id)->get("tbl_accounts")->num_rows();
|
||||
}
|
||||
function getBalance($account_id)
|
||||
{
|
||||
$drTotal = getDrTotal($account_id);
|
||||
$crTotal = getCrTotal($account_id);
|
||||
return $drTotal - $crTotal;
|
||||
}
|
||||
function getDrTotal($account_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return $ci->db->where("status", 1)->where("account_id", $account_id)->select_sum('dr')->get("tbl_voucherdetails")->row()->dr;
|
||||
}
|
||||
function getCrTotal($account_id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
return $ci->db->where("status", 1)->where("account_id", $account_id)->select_sum('cr')->get("tbl_voucherdetails")->row()->cr;
|
||||
}
|
160
account/application/helpers/bibhelper_helper.php
Normal file
160
account/application/helpers/bibhelper_helper.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
function cow($text = "")
|
||||
{
|
||||
echo ($text != "") ? $text : "COW";
|
||||
die;
|
||||
}
|
||||
function createButton($name, $display, $id, $type = "Submit", $class = "")
|
||||
{
|
||||
?>
|
||||
<div class="form-group">
|
||||
<?php if ($type == "Submit") : ?>
|
||||
<button type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $id; ?>" class="form-control <?php echo $class; ?>">
|
||||
<?php echo function_exists("myLang") ? myLang($display) : $display; ?>
|
||||
</button>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $id; ?>" class="form-control <?php echo $class; ?>">
|
||||
<?php echo function_exists("myLang") ? myLang($display) : $display; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function createInput($name, $display, $id, $default = "", $class = "")
|
||||
{
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
|
||||
<input type="text" name="<?php echo $name; ?>" id="<?php echo $id; ?>" class="form-control <?php echo $class; ?>" placeholder="Enter <?php echo function_exists("myLang") ? myLang($display) : $display; ?>" value="<?php echo $default; ?>" autocomplete="off">
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function createDateInput($name, $display, $id, $default = "", $class = "")
|
||||
{
|
||||
?>
|
||||
<label for="datepicker<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
|
||||
<div class="input-group date datepickers" id="ass_date" data-target-input="nearest">
|
||||
<input id="<?php echo $id; ?>" name="<?php echo $name; ?>" type="text" data-target="#<?php echo $id; ?>" data-toggle="datetimepicker" class="form-control datetimepicker <?php echo $class; ?>" autocomplete="off" required>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function createNepaliDateInput($name, $display, $id, $default = "", $class = "")
|
||||
{
|
||||
?>
|
||||
<?php if ($display != "") : ?>
|
||||
<label for="datepicker<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
|
||||
<?php endif; ?>
|
||||
<div class="input-group" id="ass_date" data-target-input="nearest">
|
||||
<input id="<?php echo $id; ?>" name="<?php echo $name; ?>" type="text" class="form-control nepaliDatePicker <?php echo $class; ?>" autocomplete="off" value="<?php echo ($default == "") ? NepaliDate() : $default; ?>">
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function createSelect($name, $display, $values = array(), $id = "", $default = "", $class = "")
|
||||
{
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
|
||||
<select name="<?php echo $name; ?>" class="form-control <?php echo $class; ?>" id="">
|
||||
<option value="">Select <?php echo function_exists("myLang") ? myLang($display) : $display; ?></option>
|
||||
<?php foreach ($values as $value) : ?>
|
||||
<option value="<?php echo $value[0]; ?>"><?php echo $value[1]; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function createTextarea($name, $display, $id, $default = "", $class = "")
|
||||
{
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
|
||||
<textarea class="form-control <?php echo $class; ?>" name="<?php echo $name; ?>" id="<?php echo $id; ?>" rows="3" placeholder="Enter <?php echo function_exists("myLang") ? myLang($display) : $display; ?>"><?php echo $default; ?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
function getNamesfromCSV($tableName, $fieldName, $lookupField, $referenceValue)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$referenceValue = explode(",", $referenceValue);
|
||||
$result = array();
|
||||
foreach ($referenceValue as $V) :
|
||||
$v = $ci->db->query("select $fieldName from $tableName where $lookupField='$V'")->row();
|
||||
$result[] = $v->$fieldName;
|
||||
endforeach;
|
||||
return implode(",", $result);
|
||||
}
|
||||
function getFieldfromValue($tableName, $fieldName, $lookupField, $referenceValue)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$t = "select $fieldName from $tableName where $lookupField='$referenceValue'"; //echo $t; //die;
|
||||
$v = $ci->db->query($t);
|
||||
if ($v->num_rows() > 0) {
|
||||
$v = $v->row();
|
||||
return $v->$fieldName;
|
||||
} else {
|
||||
return "N/A";
|
||||
}
|
||||
}
|
||||
function fillComboWithValue($fieldName, $displayName, $fieldID, $tableName, $displayField, $valueField, $default = "", $CSSclass = "", $multiple = false, $condition = "")
|
||||
{
|
||||
$ci = &get_instance();
|
||||
?>
|
||||
<?php if ($displayName != "") : ?>
|
||||
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
|
||||
<?php endif; ?>
|
||||
<select name="<?php echo $fieldName; ?><?php echo ($multiple) ? "[]" : ""; ?>" <?php if ($CSSclass != "none") : ?>class="form-control select2 <?php echo $CSSclass; ?>" <?php else : ?> class="form-control" <?php endif; ?> id="<?php echo $fieldID; ?>" <?php echo ($multiple) ? "multiple" : ""; ?>>
|
||||
<option value="">Select <?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option>
|
||||
<?php
|
||||
$q = "select * from $tableName";
|
||||
$q .= ($condition != "") ? " where $condition" : " where status=1";
|
||||
$Values = $ci->db->query($q)->result(); ?>
|
||||
<?php foreach ($Values as $value) : ?>
|
||||
<option value="<?php echo $value->$valueField; ?>" <?php echo ($value->$valueField == $default) ? 'SELECTED' : ''; ?>><?php echo $value->$displayField; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
function getTableSchema($tableName)
|
||||
{
|
||||
echo "<pre>";
|
||||
//$R=DB::select("list columns from $tableName");
|
||||
// print_r(Schema::getColumnListing($tableName));
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
function showEditButton($url, $text = "Edit")
|
||||
{
|
||||
?>
|
||||
<a href="<?php echo site_url($url); ?>" class="btn btn-info btn-xs" title="<?php echo myLang($text); ?>"><i class="fas fa-edit"></i> <?php //echo myLang($text);
|
||||
?></a>
|
||||
<?php
|
||||
}
|
||||
function showDeleteButton($id, $text = "Delete")
|
||||
{
|
||||
?>
|
||||
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs" title="<?php echo myLang($text); ?>"><i class="fas fa-trash"></i> <?php //echo myLang($text);
|
||||
?></a>
|
||||
<?php
|
||||
}
|
||||
function showListButton($url, $text = "List")
|
||||
{
|
||||
?>
|
||||
<a href="<?php echo site_url($url); ?>" class="btn btn-success btn-xs float-right" title="<?php echo myLang($text); ?>"><i class="fas fa-list"></i> <?php //echo myLang($text);
|
||||
?></a>
|
||||
<?php
|
||||
}
|
||||
function showCreateButton($url, $text = "Create")
|
||||
{
|
||||
?>
|
||||
<a href="<?php echo site_url($url); ?>" class="btn btn-primary btn-xs float-right" title="<?php echo myLang($text); ?>"><i class="fas fa-pen"></i> <?php //echo myLang($text);
|
||||
?></a>
|
||||
<?php
|
||||
}
|
||||
function showDetailsButton($url, $text = "Details")
|
||||
{
|
||||
?>
|
||||
<a href="<?php echo site_url($url); ?>" class="btn btn-primary btn-xs" title="<?php echo myLang($text); ?>"><i class="fas fa-glasses"></i> <?php //echo myLang($text);
|
||||
?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
307
account/application/helpers/general_helper.php
Normal file
307
account/application/helpers/general_helper.php
Normal file
@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
function getalias($title, $alias_name, $table)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$new_string = trim(preg_replace('/[^A-Za-z0-9_]/', ' ', strip_tags($title)));
|
||||
$new_string = preg_replace('/\s+/', ' ', $new_string);
|
||||
$alias = strtolower(str_replace(" ", "-", trim($new_string)));
|
||||
$ci->load->model('MHelper');
|
||||
$a = $ci->MHelper->checkIfAliasExist($alias, $alias_name, $table);
|
||||
$c = 1;
|
||||
$newalias = $alias;
|
||||
while ($ci->MHelper->checkIfAliasExist($newalias, $alias_name, $table)) {
|
||||
$newalias = $alias . $c;
|
||||
$c++;
|
||||
}
|
||||
return $newalias;
|
||||
}
|
||||
function createalias($text)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$new_string = trim(preg_replace('/[^A-Za-z0-9_]/', ' ', strip_tags($text)));
|
||||
$new_string = preg_replace('/\s+/', ' ', $new_string);
|
||||
$alias = strtolower(str_replace(" ", "-", trim($new_string)));
|
||||
$alias = str_replace("-", "", $alias);
|
||||
return $alias;
|
||||
}
|
||||
|
||||
function getLocationsForMenu()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MSubmission');
|
||||
$Locations = $ci->MSubmission->getLocation();
|
||||
return $Locations;
|
||||
}
|
||||
|
||||
function getDisplayOrder($table)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$max = $ci->MHelper->getMaxDisplayOrder($table);
|
||||
return $max + 1;
|
||||
}
|
||||
function countHolidayByDaterangeInFactory($from_date, $to_date)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getHolidayByDaterangeInFactory($from_date, $to_date);
|
||||
return $Holidays;
|
||||
}
|
||||
|
||||
function countTotaldaysByDaterange($from_date, $to_date)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalDaysByDaterange($from_date, $to_date);
|
||||
//pre($Holidays);
|
||||
return $Holidays;
|
||||
}
|
||||
function countTotalPresentsdaysByDaterange($from_date, $to_date, $id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalPresentsDaysByDaterange($from_date, $to_date, $id);
|
||||
return $Holidays;
|
||||
}
|
||||
|
||||
function countTotalPaidLeavesByDaterange($from_date, $to_date, $id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalPaidLeavesByDaterange($from_date, $to_date, $id);
|
||||
return $Holidays;
|
||||
}
|
||||
function countTotalUnPaidLeavesByDaterange($from_date, $to_date, $id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalUnPaidLeavesByDaterange($from_date, $to_date, $id);
|
||||
return $Holidays;
|
||||
}
|
||||
function countTotalAnnualLeavesByDaterange($from_date, $to_date, $id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalAnnualLeavesByDaterange($from_date, $to_date, $id);
|
||||
return $Holidays;
|
||||
}
|
||||
function countTotalSickLeavesByDaterange($from_date, $to_date, $id)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->model('MHelper');
|
||||
$Holidays = $ci->MHelper->getTotalSickLeavesByDaterange($from_date, $to_date, $id);
|
||||
return $Holidays;
|
||||
}
|
||||
function getImagePath($path)
|
||||
{
|
||||
return str_replace(base_url(), '', $path);
|
||||
}
|
||||
function pre($array, $death = false)
|
||||
{
|
||||
echo '<pre>';
|
||||
print_r($array);
|
||||
echo '</pre>';
|
||||
if ($death) die();
|
||||
}
|
||||
|
||||
function image_url($path = '')
|
||||
{
|
||||
$path = explode("/", $path);
|
||||
$image = end($path);
|
||||
return config_item('kcfinder_path') . $image;
|
||||
}
|
||||
|
||||
|
||||
function myDate($originalDate)
|
||||
{
|
||||
return date("F d Y", strtotime($originalDate));
|
||||
}
|
||||
|
||||
function dbDate($date)
|
||||
{
|
||||
return date("Y-m-d", strtotime($date));
|
||||
}
|
||||
|
||||
function myTime($originalDate)
|
||||
{
|
||||
return date("g:i A", strtotime($originalDate));
|
||||
}
|
||||
|
||||
function myDateTime($originalDate)
|
||||
{
|
||||
return date("F d Y g:i A", strtotime($originalDate));
|
||||
}
|
||||
function myDaysDiff($fromDate, $toDate)
|
||||
{
|
||||
$fromDate = strtotime($fromDate);
|
||||
$toDate = strtotime($toDate);
|
||||
$datediff = $toDate - $fromDate;
|
||||
return round($datediff / (60 * 60 * 24));
|
||||
}
|
||||
function firstDayOfNepaliMonth($engDate = "")
|
||||
{
|
||||
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||
$NepaliDate = NepaliDate($engDate);
|
||||
$nD = explode("-", $NepaliDate);
|
||||
$Day = '1';
|
||||
$Month = $nD[1];
|
||||
if (strlen($Month) == 1) {
|
||||
$Month = '0' . $Month;
|
||||
}
|
||||
$Year = $nD[0];
|
||||
$ci = &get_instance();
|
||||
$t = "select bs_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'";
|
||||
return $ci->db->query($t)->row()->bs_date;
|
||||
}
|
||||
function firstDayOfNepaliMonth1($engDate = "")
|
||||
{
|
||||
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||
$NepaliDate = NepaliDate($engDate);
|
||||
$nD = explode("-", $NepaliDate);
|
||||
$Day = '1';
|
||||
$Month = $nD[1];
|
||||
if ($Month == 11 || $Month == 12 || $Month == 10) {
|
||||
$Month = $nD[1];
|
||||
} else {
|
||||
$Month = '0' . $nD[1];
|
||||
}
|
||||
|
||||
$Year = $nD[0];
|
||||
$ci = &get_instance();
|
||||
|
||||
$t = "select ad_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'";
|
||||
//echo $t;die;
|
||||
return $ci->db->query($t)->result()[0]->ad_date;
|
||||
}
|
||||
function lastDayOfNepaliMonth($engDate = "")
|
||||
{
|
||||
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||
//echo $engDate;
|
||||
$NepaliDate = NepaliDate1($engDate);
|
||||
// echo $NepaliDate;
|
||||
$nD = explode("-", $NepaliDate);
|
||||
//print_r($nD);
|
||||
$Day = '1';
|
||||
$Month = $nD[1];
|
||||
$Year = $nD[0];
|
||||
$ci = &get_instance();
|
||||
$t = "select ad_date from tbl_nepengcalendar where bs_date like '" . $Year . "-" . $Month . "-%' order by ad_date";
|
||||
// echo $t;
|
||||
$dates = $ci->db->query($t)->result();
|
||||
//print_r($dates);
|
||||
$date = $dates[sizeof($dates) - 1];
|
||||
// print_r($date);die;
|
||||
return $date->ad_date;
|
||||
}
|
||||
function EnglishDate($NepaliYear, $NepaliMonth, $NepaliDay)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
if ($NepaliMonth < 10) $NepaliMonth = "0" . $NepaliMonth;
|
||||
$bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay;
|
||||
$t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'"; //echo $t;
|
||||
$q = $ci->db->query($t)->row();
|
||||
return $q->ad_date;
|
||||
}
|
||||
function Today()
|
||||
{
|
||||
return date("Y-m-d");
|
||||
}
|
||||
function NepaliToEnglishDate($NepaliDate)
|
||||
{
|
||||
$NepaliDate = trim($NepaliDate);
|
||||
if (trim($NepaliDate) == "") return date("Y-m-d");
|
||||
$ci = &get_instance();
|
||||
$NepaliDate = explode("-", $NepaliDate);
|
||||
$NepaliMonth = intval($NepaliDate[1]);
|
||||
$NepaliYear = intval($NepaliDate[0]);
|
||||
$NepaliDay = intval($NepaliDate[2]);
|
||||
if ($NepaliMonth < 10) $NepaliMonth = "0" . $NepaliMonth;
|
||||
//if($NepaliDay<10)$NepaliDay="0".$NepaliDay;
|
||||
$bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay;
|
||||
$t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'"; //echo $t;
|
||||
$q = $ci->db->query($t)->row();
|
||||
return $q->ad_date;
|
||||
}
|
||||
function NepaliDate($engDate = "")
|
||||
{
|
||||
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||
if ($engDate != "0000-00-00") {
|
||||
$ci = &get_instance();
|
||||
return str_replace("-0", "-", $ci->db->query("select bs_date from tbl_nepengcalendar where ad_date='" . $engDate . "'")->result()[0]->bs_date);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function NepaliDate1($engDate = "")
|
||||
{
|
||||
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||
$ci = &get_instance();
|
||||
return $ci->db->query("select bs_date from tbl_nepengcalendar where ad_date='" . $engDate . "'")->result()[0]->bs_date;
|
||||
}
|
||||
function NepaliMonth($engDate = "")
|
||||
{
|
||||
$NepaliDate = NepaliDate($engDate);
|
||||
$nD = explode("-", $NepaliDate);
|
||||
$Month = $nD[1];
|
||||
return intval($Month);
|
||||
}
|
||||
function NepaliYear($engDate = "")
|
||||
{
|
||||
$NepaliDate = NepaliDate($engDate);
|
||||
$nD = explode("-", $NepaliDate);
|
||||
$Year = $nD[0];
|
||||
return intval($Year);
|
||||
}
|
||||
function NepaliMonthNameByNumber($number)
|
||||
{
|
||||
$MonthNames = array("Baisakh", "Jestha", "Ashad", "Shrawan", "Bhadra", "Asoj", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra");
|
||||
return $MonthNames[$number - 1];
|
||||
}
|
||||
function NepaliMonthName($engDate = "")
|
||||
{
|
||||
$Month = NepaliMonth($engDate);
|
||||
$MonthNames = array("Baisakh", "Jestha", "Ashad", "Shrawan", "Bhadra", "Asoj", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra");
|
||||
return $MonthNames[$Month - 1];
|
||||
}
|
||||
function N2($N)
|
||||
{
|
||||
return number_format($N, 2, '.', ',');
|
||||
}
|
||||
function loadView($viewName, $data = '')
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->load->view('includes/header', $data);
|
||||
$ci->load->view('includes/nav', $data);
|
||||
$ci->load->view('includes/sidebar', $data);
|
||||
$ci->load->view($viewName, $data);
|
||||
$ci->load->view('includes/footer', $data);
|
||||
}
|
||||
|
||||
function getUrlArray()
|
||||
{
|
||||
$host = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '')
|
||||
. '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$host = str_replace(base_url(), "", $host);
|
||||
$host = str_replace('-', '_', $host);
|
||||
$host = explode("/", $host);
|
||||
return $host;
|
||||
}
|
||||
|
||||
function showMenu($Display = "Balance By Account Groups", $Link = "accounts/reports/balance_by_group", $Icon = "fa-circle")
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$command = $ci->uri->segment(1);
|
||||
$param = $ci->uri->segment(2);
|
||||
$subparam = $ci->uri->segment(3);
|
||||
$subparam2 = $ci->uri->segment(4);
|
||||
$Link = explode("/", $Link);
|
||||
$Link1 = isset($Link[1]) ? $Link[1] : '';
|
||||
$Link2 = isset($Link[2]) ? $Link[2] : '';
|
||||
echo '<li class="nav-item">';
|
||||
echo '<a href="' . site_url($Link) . '" class="nav-link ' . ($param == $Link1 && $subparam == $Link2 ? "active" : "") . '">';
|
||||
// echo '<i class="far ' . $Icon . ' nav-icon"></i>';
|
||||
echo '<p>' . $Display . '</p>';
|
||||
echo '</a>';
|
||||
echo '</li>';
|
||||
}
|
11
account/application/helpers/index.html
Normal file
11
account/application/helpers/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
90
account/application/helpers/login_helper.php
Normal file
90
account/application/helpers/login_helper.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
function checkLogin()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
initDatabase();
|
||||
if ($ci->session->userdata("loggedIn") == 1) {
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
if (isset($_SERVER['REDIRECT_QUERY_STRING'])) {
|
||||
$re = $_SERVER['REDIRECT_QUERY_STRING'];
|
||||
} else {
|
||||
redirect("login");
|
||||
}
|
||||
redirect("login/?url=" . $re);
|
||||
}
|
||||
}
|
||||
|
||||
function authenticateUser($email, $password, $re)
|
||||
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->db->where('username', $email);
|
||||
$ci->db->where('password', $password);
|
||||
$users = $ci->db->get('tbl_users')->row();
|
||||
$FiscalYearID = $ci->db->where("status=1")->get("tbl_fiscalyear")->row()->fiscalyear_id;
|
||||
$FiscalYear = $ci->db->where("status=1")->get("tbl_fiscalyear")->row();
|
||||
$Branch = $ci->db->where("status=1")->get("tbl_branches")->row();
|
||||
if ($users != '') {
|
||||
$array = array(
|
||||
'loggedIn' => "1",
|
||||
'loggedInUser' => $email,
|
||||
'loggedUser' => $users->username,
|
||||
'FiscalYearID' => $FiscalYearID,
|
||||
'FiscalYear' => $FiscalYear,
|
||||
'BranchID' => $Branch->branch_id,
|
||||
'Branch'=>$Branch,
|
||||
'CompanyName' => $Branch->branch_name
|
||||
);
|
||||
if ($users->status == 1) {
|
||||
$array['superAdmin'] = 1;
|
||||
}
|
||||
if ($users->status == 2) {
|
||||
$array['superAdmin'] = 2;
|
||||
}
|
||||
if ($users->status == 3) {
|
||||
$array['superAdmin'] = 3;
|
||||
}
|
||||
$ci->session->set_userdata($array);
|
||||
redirect($re);
|
||||
}
|
||||
}
|
||||
function initDatabase()
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$ci->db->trans_start();
|
||||
if (!$ci->db->field_exists('voucher_color', 'tbl_vouchertypes')) {
|
||||
// Create the column
|
||||
$ci->db->query("ALTER TABLE tbl_vouchertypes ADD COLUMN voucher_color VARCHAR(255) AFTER voucher_alias");
|
||||
$t = array();
|
||||
$t[] = "truncate tbl_vouchertypes";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Contra', 'Contra', 'contra', '1','#cfbdec');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Payment', 'Payment', 'payment', '1','#b3a3d0');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Receipt', 'Receipt', 'receipt', '1','#e5b8cd');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Journal', 'Journal', 'journal', '1','#df979e');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Sales', 'Sales', 'sales', '1','#e2bb9b');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Creditnote', 'Creditnote', 'creditnote', '1','#bfb69b');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Purchase', 'Purchase', 'purchase', '1','#80ad8a');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Debitnote', 'Debitnote', 'debitnote', '1','#87bfae');";
|
||||
$t[] = "INSERT INTO `tbl_vouchertypes` (`voucher_type`, `voucher_name`, `voucher_alias`, `status`,`voucher_color`) VALUES ('Reversing', 'Reversing', 'reversing', '1','#96ced7');";
|
||||
// $ci->db->query($t);
|
||||
|
||||
|
||||
foreach ($t as $query) {
|
||||
$ci->db->query($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ci->db->trans_complete();
|
||||
|
||||
if ($ci->db->trans_status() === FALSE) {
|
||||
// Handle transaction failure
|
||||
} else {
|
||||
// Transaction succeeded
|
||||
}
|
||||
}
|
45
account/application/helpers/mylang_helper.php
Normal file
45
account/application/helpers/mylang_helper.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
function myLang($text)
|
||||
{
|
||||
$text = str_replace('_', ' ', $text);
|
||||
$text = ucwords($text);
|
||||
$CI = &get_instance();
|
||||
$txtSQl = "CREATE TABLE IF NOT EXISTS tbl_translations (
|
||||
translation_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
english VARCHAR(255),
|
||||
nepali VARCHAR(255),
|
||||
created_by VARCHAR(255),
|
||||
created_on DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
remarks TEXT,
|
||||
status INT DEFAULT 1
|
||||
);
|
||||
";
|
||||
$CI->db->query($txtSQl);
|
||||
|
||||
if ($CI->session->userdata("language") == "np") {
|
||||
|
||||
$query = $CI->db->get_where('tbl_translations', array('english' => $text, 'nepali !=' => ''));
|
||||
$result = $query->row();
|
||||
|
||||
// Check if a translation exists in the database
|
||||
if ($result) {
|
||||
$nepaliWord = $result->nepali;
|
||||
echo $nepaliWord;
|
||||
} else {
|
||||
$existingQuery = $CI->db->get_where('tbl_translations', array('english' => $text));
|
||||
$existingResult = $existingQuery->row();
|
||||
|
||||
if (!$existingResult) {
|
||||
$data = array(
|
||||
'english' => $text,
|
||||
'nepali' => ''
|
||||
);
|
||||
$CI->db->insert('tbl_translations', $data);
|
||||
}
|
||||
|
||||
echo $text;
|
||||
}
|
||||
} else {
|
||||
echo $text;
|
||||
}
|
||||
}
|
99
account/application/helpers/permission_helper.php
Normal file
99
account/application/helpers/permission_helper.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
function isSuperAdmin()
|
||||
{
|
||||
$ci =& get_instance();
|
||||
if ($ci->session->has_userdata('superAdmin')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isPermitted($value, $level = 0)
|
||||
{
|
||||
$ci =& get_instance();
|
||||
if (isSuperAdmin()) {
|
||||
return true;
|
||||
} else {
|
||||
//echo $level;die;
|
||||
$privilege = $ci->session->userdata('privilege');
|
||||
if (!empty($privilege[$value]) && ($privilege[$value] > $level || $privilege[$value] == $level)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getPrivilege($value)
|
||||
{
|
||||
$ci =& get_instance();
|
||||
$privilege = $ci->session->userdata('privilege');
|
||||
if (!empty($privilege[$value])) {
|
||||
return $privilege[$value];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isViewable($level = 0)
|
||||
{
|
||||
$urlArray = getUrlArray();
|
||||
if (!empty($urlArray[1]) && $level == 0) {
|
||||
$level = getLevel($urlArray[1]);
|
||||
}
|
||||
else if (!is_numeric($level)){
|
||||
$level = getLevel($level);
|
||||
}
|
||||
|
||||
if (isSuperAdmin()) {
|
||||
return true;
|
||||
} elseif (isPermitted($urlArray[0], $level)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isViewPermitted($level = '')
|
||||
{
|
||||
$urlArray = getUrlArray();
|
||||
|
||||
//pre($urlArray,1);
|
||||
if (!empty($urlArray[1]) && $level == '') {
|
||||
$level = $urlArray[1];
|
||||
}
|
||||
$level = getLevel($level);
|
||||
if (isViewable($level)) {
|
||||
return true;
|
||||
} else {
|
||||
show_404();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getLevel($val)
|
||||
{
|
||||
switch ($val) {
|
||||
case 'view':
|
||||
return 1;
|
||||
break;
|
||||
case '':
|
||||
return 1;
|
||||
break;
|
||||
case 'add':
|
||||
return 2;
|
||||
break;
|
||||
case 'edit':
|
||||
return 2;
|
||||
break;
|
||||
case 'update':
|
||||
return 2;
|
||||
break;
|
||||
case 'delete':
|
||||
return 3;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
11
account/application/hooks/index.html
Normal file
11
account/application/hooks/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
11
account/application/index.html
Normal file
11
account/application/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
11
account/application/language/english/index.html
Normal file
11
account/application/language/english/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
11
account/application/language/index.html
Normal file
11
account/application/language/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
287
account/application/libraries/Acc.php
Normal file
287
account/application/libraries/Acc.php
Normal file
@ -0,0 +1,287 @@
|
||||
<?php
|
||||
/* NOTES TO ME */
|
||||
/*
|
||||
|
||||
We are developing this library to be used as global for accounting systems for any software we are going to build
|
||||
|
||||
|
||||
Currenyly, in this function we are drawing balances based on selected branch and selected fiscal year.
|
||||
We are supposing branch and fiscalyear is set to session. if no session values are found, we are assuming, fiscalyear is 1 and branch is 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class acc
|
||||
{
|
||||
private $FY;
|
||||
private $Branch;
|
||||
public function __construct()
|
||||
{
|
||||
$CI = &get_instance(); // Get the CodeIgniter instance
|
||||
|
||||
$CI->load->library('session'); // Assuming CodeIgniter's session library is already loaded
|
||||
|
||||
// Check if Branch is set in session
|
||||
if ($CI->session->has_userdata('BranchID')) {
|
||||
$this->Branch = $CI->session->userdata('BranchID');
|
||||
} else {
|
||||
$this->Branch = 1; // Default value if not found in session
|
||||
}
|
||||
|
||||
// Check if FY is set in session
|
||||
if ($CI->session->has_userdata('FiscalYearID')) {
|
||||
$this->FY = $CI->session->userdata('FiscalYearID');
|
||||
} else {
|
||||
$this->FY = 1; // Default value if not found in session
|
||||
}
|
||||
// echo $this->FY;die;
|
||||
}
|
||||
function getAccountGroups(&$ACBalances = array())
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "select * from tbl_acgroups where status=1";
|
||||
$AccountGroups = $CI->db->query($t)->result();
|
||||
foreach ($AccountGroups as $AccountGroup) :
|
||||
$AccountGroup->dr = 0;
|
||||
$AccountGroup->cr = 0;
|
||||
$AccountGroup->openingdr = 0;
|
||||
$AccountGroup->openingcr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getThisYearWithOpening');
|
||||
$OpeningBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getOpeningOnly');
|
||||
if ($AccountGroup->posting_side == "DR") {
|
||||
$AccountGroup->dr = ($TotalBalance);
|
||||
$AccountGroup->openingdr = ($OpeningBalance);
|
||||
} else {
|
||||
$AccountGroup->cr = ($TotalBalance);
|
||||
$AccountGroup->openingcr = ($OpeningBalance);
|
||||
}
|
||||
endforeach;
|
||||
return $AccountGroups;
|
||||
}
|
||||
function getAccountCategories($group_id = 0, $condition="showAll")
|
||||
{
|
||||
$ACBalances = array();
|
||||
$CI = &get_instance();
|
||||
if ($group_id == 0)
|
||||
$t = "select * from tbl_accategories where status=1";
|
||||
else
|
||||
$t = "select * from tbl_accategories where status=1 and acgroup_id='$group_id'";
|
||||
if($condition=="onlyParents")
|
||||
{
|
||||
$t.=" AND parent_category_id=0 ";
|
||||
}
|
||||
$AccountCategories = $CI->db->query($t)->result();
|
||||
foreach ($AccountCategories as $AccountCategory) :
|
||||
$AccountCategory->posting_side = getFieldfromValue("tbl_acgroups", "posting_side", "acgroup_id", $AccountCategory->acgroup_id);
|
||||
$AccountCategory->dr = 0;
|
||||
$AccountCategory->cr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances);
|
||||
if ($AccountCategory->posting_side == "DR") {
|
||||
$AccountCategory->dr = ($TotalBalance);
|
||||
} else {
|
||||
$AccountCategory->cr = ($TotalBalance);
|
||||
}
|
||||
endforeach;
|
||||
return $AccountCategories;
|
||||
}
|
||||
function getAccountsByCategory($accategory_id)
|
||||
{
|
||||
$accounts = array();
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE accategory_id='$accategory_id'";
|
||||
$AccountCategory = $CI->db->query($t)->row();
|
||||
if ($AccountCategory) {
|
||||
$accounts = $this->getAccountsRecursive($AccountCategory);
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
function getAccountsRecursive($category)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$category->accategory_id'";
|
||||
$accountQuery = $CI->db->query($t);
|
||||
$accounts = $accountQuery->result_array();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$category->accategory_id'";
|
||||
$subcategories = $CI->db->query($t)->result();
|
||||
foreach ($subcategories as $subcategory) {
|
||||
$subcategoryAccounts = $this->getAccountsRecursive($subcategory);
|
||||
$accounts = array_merge($accounts, $subcategoryAccounts);
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getAccountBalanceByGroup($acgroup_id, $abs = true)
|
||||
{
|
||||
$total = 0;
|
||||
$accounts = $this->getAccountsByGroup($acgroup_id);
|
||||
foreach ($accounts as $account) {
|
||||
if ($abs)
|
||||
$total += (abs($account->balance));
|
||||
else
|
||||
$total += ($account->balance);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
function getAccountsByGroup($acgroup_id)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$query = $CI->db->select('a.*')
|
||||
->from('tbl_accounts a')
|
||||
->join('tbl_accategories c', 'c.accategory_id = a.accategory_id')
|
||||
->where('a.status', 1)
|
||||
->where('c.acgroup_id', $acgroup_id)
|
||||
->get();
|
||||
$accounts = $query->result();
|
||||
$ACBalances = array();
|
||||
foreach ($accounts as $account) {
|
||||
|
||||
$account->balance = $this->getAccountBalance($account->account_id, $ACBalances);
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
function getGroupBalance($group_id, &$ACBalances, $condition = 'getAll')
|
||||
{
|
||||
/*
|
||||
When $condition is set to 'getOpeningOnly', the function retrieves only the opening balances (where voucher_id = 0).
|
||||
When $condition is set to 'getThisYear', the function retrieves balances for the current fiscal year (where voucher_id <> 0 and fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getThisYearWithOpening', the function retrieves balances for the current fiscal year, including opening balances (where fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getAll' and $this->FY is not set, the function retrieves overall balances (where voucher_id <> 0).
|
||||
*/
|
||||
$ci = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories AS a WHERE a.acgroup_id = '$group_id' AND a.status = 1) AND status <> -1";
|
||||
$Accounts = $ci->db->query($t)->result();
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
foreach ($Accounts as $Account) {
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$Account->account_id' AND status <> -1";
|
||||
|
||||
// Condition: Opening Only
|
||||
if ($condition == 'getOpeningOnly') {
|
||||
$t .= " AND voucher_id = 0";
|
||||
}
|
||||
|
||||
// Condition: This Year
|
||||
if ($condition == 'getThisYear') {
|
||||
$t .= " AND voucher_id <> 0 AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
|
||||
// Condition: This Year with Opening
|
||||
if ($condition == 'getThisYearWithOpening') {
|
||||
$t .= " AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
|
||||
// Condition: Overall
|
||||
if ($condition == 'getAll' && !isset($this->FY)) {
|
||||
$t .= " AND voucher_id <> 0";
|
||||
}
|
||||
|
||||
$t .= " AND branch_id = " . $this->Branch;
|
||||
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = ($DrBalance > $CrBalance) ? ($DrBalance - $CrBalance) : ($CrBalance - $DrBalance);
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
|
||||
|
||||
function getCategoryBalance($accategory_id, &$ACBalances)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
// $t = "SELECT * FROM tbl_accounts WHERE status=1 and accategory_id ='$accategory_id' or accategory_id in (select accategory_id from tbl_categories where parent_category_id='$accategory_id')";
|
||||
// $Accounts = $ci->db->query($t)->result();
|
||||
// $groupBalance = 0;
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
$Accounts = $this->getAccountsByCategory($accategory_id);
|
||||
foreach ($Accounts as $Account) {
|
||||
// $t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$Account->account_id' AND status <> -1";
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '" . $Account['account_id'] . "' AND status <> -1";
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = ($DrBalance > $CrBalance) ? ($DrBalance - $CrBalance) : ($CrBalance - $DrBalance);
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
function getAccountBalance($account_id, &$ACBalances)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$account_id' AND status <> -1";
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = $DrBalance - $CrBalance;
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
|
||||
function showTable($Accounts, $abs = true, $showHead = false)
|
||||
{
|
||||
$total = 0;
|
||||
$accColWidth = "col-9";
|
||||
$balanceColWidth = "col-3";
|
||||
?>
|
||||
<table class="table table-bordered table-hover">
|
||||
<?php if ($showHead) : ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="<?php echo $accColWidth; ?>">Account</th>
|
||||
<th class="<?php echo $balanceColWidth; ?>">Balance</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<?php endif; ?>
|
||||
<tbody>
|
||||
<?php foreach ($Accounts as $Account) :
|
||||
if ($abs)
|
||||
$total += abs($Account->balance);
|
||||
else
|
||||
$total += $Account->balance;
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $accColWidth; ?>"><?php echo $Account->account_name; ?></td>
|
||||
<td class="<?php echo $balanceColWidth; ?>"><?php echo ($abs) ? myCurrency(abs($Account->balance)) : myCurrency($Account->balance); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
<!-- <tfoot>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><?php echo myCurrency($total); ?></th>
|
||||
|
||||
</tr>
|
||||
</tfoot> -->
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
288
account/application/libraries/BACKUP_Acc.php
Normal file
288
account/application/libraries/BACKUP_Acc.php
Normal file
@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/* NOTES TO ME */
|
||||
/*
|
||||
|
||||
We are developing this library to be used as global for accounting systems for any software we are going to build
|
||||
|
||||
|
||||
Currenyly, in this function we are drawing balances based on selected branch and selected fiscal year.
|
||||
We are supposing branch and fiscalyear is set to session. if no session values are found, we are assuming, fiscalyear is 1 and branch is 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class acc
|
||||
{
|
||||
private $FY;
|
||||
private $Branch;
|
||||
public function __construct()
|
||||
{
|
||||
$CI = &get_instance(); // Get the CodeIgniter instance
|
||||
|
||||
$CI->load->library('session'); // Assuming CodeIgniter's session library is already loaded
|
||||
|
||||
// Check if Branch is set in session
|
||||
if ($CI->session->has_userdata('BranchID')) {
|
||||
$this->Branch = $CI->session->userdata('BranchID');
|
||||
} else {
|
||||
$this->Branch = 1; // Default value if not found in session
|
||||
}
|
||||
|
||||
// Check if FY is set in session
|
||||
if ($CI->session->has_userdata('FiscalYearID')) {
|
||||
$this->FY = $CI->session->userdata('FiscalYearID');
|
||||
} else {
|
||||
$this->FY = 1; // Default value if not found in session
|
||||
}
|
||||
// echo $this->FY;die;
|
||||
}
|
||||
function getAccountGroups(&$ACBalances = array())
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "select * from tbl_acgroups where status=1";
|
||||
$AccountGroups = $CI->db->query($t)->result();
|
||||
foreach ($AccountGroups as $AccountGroup) :
|
||||
$AccountGroup->dr = 0;
|
||||
$AccountGroup->cr = 0;
|
||||
$AccountGroup->openingdr = 0;
|
||||
$AccountGroup->openingcr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getThisYearWithOpening');
|
||||
$OpeningBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getOpeningOnly');
|
||||
if ($AccountGroup->posting_side == "DR") {
|
||||
$AccountGroup->dr = ($TotalBalance);
|
||||
$AccountGroup->openingdr = ($OpeningBalance);
|
||||
} else {
|
||||
$AccountGroup->cr = ($TotalBalance);
|
||||
$AccountGroup->openingcr = ($OpeningBalance);
|
||||
}
|
||||
endforeach;
|
||||
return $AccountGroups;
|
||||
}
|
||||
function getAccountCategories($group_id = 0, $condition="showAll")
|
||||
{
|
||||
$ACBalances = array();
|
||||
$CI = &get_instance();
|
||||
if ($group_id == 0)
|
||||
$t = "select * from tbl_accategories where status=1";
|
||||
else
|
||||
$t = "select * from tbl_accategories where status=1 and acgroup_id='$group_id'";
|
||||
if($condition=="onlyParents")
|
||||
{
|
||||
$t.=" AND parent_category_id=0 ";
|
||||
}
|
||||
$AccountCategories = $CI->db->query($t)->result();
|
||||
foreach ($AccountCategories as $AccountCategory) :
|
||||
$AccountCategory->posting_side = getFieldfromValue("tbl_acgroups", "posting_side", "acgroup_id", $AccountCategory->acgroup_id);
|
||||
$AccountCategory->dr = 0;
|
||||
$AccountCategory->cr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances);
|
||||
if ($AccountCategory->posting_side == "DR") {
|
||||
$AccountCategory->dr = ($TotalBalance);
|
||||
} else {
|
||||
$AccountCategory->cr = ($TotalBalance);
|
||||
}
|
||||
endforeach;
|
||||
return $AccountCategories;
|
||||
}
|
||||
function getAccountsByCategory($accategory_id)
|
||||
{
|
||||
$accounts = array();
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE accategory_id='$accategory_id'";
|
||||
$AccountCategory = $CI->db->query($t)->row();
|
||||
if ($AccountCategory) {
|
||||
$accounts = $this->getAccountsRecursive($AccountCategory);
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
function getAccountsRecursive($category)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$category->accategory_id'";
|
||||
$accountQuery = $CI->db->query($t);
|
||||
$accounts = $accountQuery->result_array();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$category->accategory_id'";
|
||||
$subcategories = $CI->db->query($t)->result();
|
||||
foreach ($subcategories as $subcategory) {
|
||||
$subcategoryAccounts = $this->getAccountsRecursive($subcategory);
|
||||
$accounts = array_merge($accounts, $subcategoryAccounts);
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getAccountBalanceByGroup($acgroup_id, $abs = true)
|
||||
{
|
||||
$total = 0;
|
||||
$accounts = $this->getAccountsByGroup($acgroup_id);
|
||||
foreach ($accounts as $account) {
|
||||
if ($abs)
|
||||
$total += (abs($account->balance));
|
||||
else
|
||||
$total += ($account->balance);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
function getAccountsByGroup($acgroup_id)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$query = $CI->db->select('a.*')
|
||||
->from('tbl_accounts a')
|
||||
->join('tbl_accategories c', 'c.accategory_id = a.accategory_id')
|
||||
->where('a.status', 1)
|
||||
->where('c.acgroup_id', $acgroup_id)
|
||||
->get();
|
||||
$accounts = $query->result();
|
||||
$ACBalances = array();
|
||||
foreach ($accounts as $account) {
|
||||
|
||||
$account->balance = $this->getAccountBalance($account->account_id, $ACBalances);
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getGroupBalance($group_id, &$ACBalances, $condition = 'getAll')
|
||||
{
|
||||
/*
|
||||
When $condition is set to 'getOpeningOnly', the function retrieves only the opening balances (where voucher_id = 0).
|
||||
When $condition is set to 'getThisYear', the function retrieves balances for the current fiscal year (where voucher_id <> 0 and fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getThisYearWithOpening', the function retrieves balances for the current fiscal year, including opening balances (where fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getAll' and $this->FY is not set, the function retrieves overall balances (where voucher_id <> 0).
|
||||
*/
|
||||
$ci = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories AS a WHERE a.acgroup_id = '$group_id' AND a.status = 1) AND status <> -1";
|
||||
$Accounts = $ci->db->query($t)->result();
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
foreach ($Accounts as $Account) {
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$Account->account_id' AND status <> -1";
|
||||
|
||||
// Condition: Opening Only
|
||||
if ($condition == 'getOpeningOnly') {
|
||||
$t .= " AND voucher_id = 0";
|
||||
}
|
||||
|
||||
// Condition: This Year
|
||||
if ($condition == 'getThisYear') {
|
||||
$t .= " AND voucher_id <> 0 AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
|
||||
// Condition: This Year with Opening
|
||||
if ($condition == 'getThisYearWithOpening') {
|
||||
$t .= " AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
|
||||
// Condition: Overall
|
||||
if ($condition == 'getAll' && !isset($this->FY)) {
|
||||
$t .= " AND voucher_id <> 0";
|
||||
}
|
||||
|
||||
$t .= " AND branch_id = " . $this->Branch;
|
||||
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = ($DrBalance > $CrBalance) ? ($DrBalance - $CrBalance) : ($CrBalance - $DrBalance);
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
|
||||
|
||||
function getCategoryBalance($accategory_id, &$ACBalances)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
// $t = "SELECT * FROM tbl_accounts WHERE status=1 and accategory_id ='$accategory_id' or accategory_id in (select accategory_id from tbl_categories where parent_category_id='$accategory_id')";
|
||||
// $Accounts = $ci->db->query($t)->result();
|
||||
// $groupBalance = 0;
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
$Accounts = $this->getAccountsByCategory($accategory_id);
|
||||
foreach ($Accounts as $Account) {
|
||||
// $t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$Account->account_id' AND status <> -1";
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '" . $Account['account_id'] . "' AND status <> -1";
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = ($DrBalance > $CrBalance) ? ($DrBalance - $CrBalance) : ($CrBalance - $DrBalance);
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
function getAccountBalance($account_id, &$ACBalances)
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$account_id' AND status <> -1";
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
$ACBalances['Balance'] = $DrBalance - $CrBalance;
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
|
||||
function showTable($Accounts, $abs = true, $showHead = false)
|
||||
{
|
||||
$total = 0;
|
||||
$accColWidth = "col-9";
|
||||
$balanceColWidth = "col-3";
|
||||
?>
|
||||
<table class="table table-bordered table-hover">
|
||||
<?php if ($showHead) : ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="<?php echo $accColWidth; ?>">Account</th>
|
||||
<th class="<?php echo $balanceColWidth; ?>">Balance</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<?php endif; ?>
|
||||
<tbody>
|
||||
<?php foreach ($Accounts as $Account) :
|
||||
if ($abs)
|
||||
$total += abs($Account->balance);
|
||||
else
|
||||
$total += $Account->balance;
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $accColWidth; ?>"><?php echo $Account->account_name; ?></td>
|
||||
<td class="<?php echo $balanceColWidth; ?>"><?php echo ($abs) ? myCurrency(abs($Account->balance)) : myCurrency($Account->balance); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
<!-- <tfoot>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><?php echo myCurrency($total); ?></th>
|
||||
|
||||
</tr>
|
||||
</tfoot> -->
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
1010
account/application/libraries/BIBAccounts.php
Normal file
1010
account/application/libraries/BIBAccounts.php
Normal file
File diff suppressed because it is too large
Load Diff
808
account/application/libraries/BIBAccounts1.php
Normal file
808
account/application/libraries/BIBAccounts1.php
Normal file
@ -0,0 +1,808 @@
|
||||
<?php
|
||||
/*
|
||||
NOTES TO ME
|
||||
|
||||
|
||||
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class bibaccounts
|
||||
{
|
||||
private $FY;
|
||||
private $Branch;
|
||||
public function __construct()
|
||||
{
|
||||
$CI = &get_instance(); // Get the CodeIgniter instance
|
||||
|
||||
$CI->load->library('session'); // Assuming CodeIgniter's session library is already loaded
|
||||
|
||||
// Check if Branch is set in session
|
||||
if ($CI->session->has_userdata('BranchID')) {
|
||||
$this->Branch = $CI->session->userdata('BranchID');
|
||||
} else {
|
||||
$this->Branch = 1; // Default value if not found in session
|
||||
}
|
||||
|
||||
// Check if FY is set in session
|
||||
if ($CI->session->has_userdata('FiscalYearID')) {
|
||||
$this->FY = $CI->session->userdata('FiscalYearID');
|
||||
} else {
|
||||
$this->FY = 1; // Default value if not found in session
|
||||
}
|
||||
// echo $this->FY;die;
|
||||
}
|
||||
/**
|
||||
* Retrieves the account groups with balances, optionally filtered by group ID.
|
||||
*
|
||||
* This function queries the database to fetch the account groups from the "tbl_acgroups" table and calculates the totals of balances for each group by summing the account balances within each group. If the optional "acgroup_id" parameter is provided, the function returns only the group with the specified ID. Otherwise, it returns an array of stdClass objects representing each account group with the corresponding balance totals.
|
||||
*
|
||||
* @param int|null $acgroup_id (Optional) The ID of the account group to retrieve balances for.
|
||||
* @return array|stdClass|null An array of stdClass objects representing the account groups with balance totals, or a single stdClass object for the specified group ID, or null if no group is found with the provided ID.
|
||||
*/
|
||||
function getAccountGroupsWithBalances($acgroup_id = null)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$result = [];
|
||||
|
||||
$whereClause = "";
|
||||
if ($acgroup_id !== null) {
|
||||
$whereClause = "WHERE acgroup_id = '$acgroup_id' AND status=1";
|
||||
}
|
||||
|
||||
$t = "SELECT * FROM tbl_acgroups $whereClause";
|
||||
$accountGroups = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($accountGroups as $group) {
|
||||
$t = "SELECT * FROM tbl_accounts
|
||||
WHERE (accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')
|
||||
OR accategory_id IN (SELECT parent_category_id FROM tbl_accategories WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')))
|
||||
AND status <> -1";
|
||||
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
|
||||
$group->dr_total = 0;
|
||||
$group->cr_total = 0;
|
||||
$group->regular_balance_dr = 0;
|
||||
$group->regular_balance_cr = 0;
|
||||
$group->opening_balance_dr = 0;
|
||||
$group->opening_balance_cr = 0;
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id);
|
||||
// pre($accountBalances);die;
|
||||
$group->opening_balance_dr += $accountBalances['opening_balance_dr'];
|
||||
$group->opening_balance_cr += $accountBalances['opening_balance_cr'];
|
||||
$group->dr_total += $accountBalances['dr_total'];
|
||||
$group->cr_total += $accountBalances['cr_total'];
|
||||
$group->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$group->regular_balance_cr += $accountBalances['regular_balance_cr'];
|
||||
}
|
||||
if (
|
||||
$group->dr_total > 0 &&
|
||||
$group->cr_total > 0 &&
|
||||
$group->regular_balance_dr > 0 &&
|
||||
$group->regular_balance_cr > 0 &&
|
||||
$group->opening_balance_dr > 0 &&
|
||||
$group->opening_balance_cr > 0
|
||||
) $group->isZero = 1;
|
||||
else $group->isZero = 0;
|
||||
$group->opening_balance = ($group->posting_side == "DR") ? $group->opening_balance_dr - $group->opening_balance_cr : $group->opening_balance_cr - $group->opening_balance_dr;
|
||||
$group->closing_balance = ($group->posting_side == "DR") ? $group->dr_total - $group->cr_total : $group->cr_total - $group->dr_total;
|
||||
$group->regular_balance = ($group->posting_side == "DR") ? $group->regular_balance_dr - $group->regular_balance_cr : $group->regular_balance_cr - $group->regular_balance_dr;
|
||||
|
||||
$group->accounts = $accounts;
|
||||
$result[] = $group;
|
||||
}
|
||||
// pre($result);die;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function getAccountCategoriesWithBalances($acgroup_id = null)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$result = [];
|
||||
|
||||
$whereClause = "";
|
||||
if ($acgroup_id !== null) {
|
||||
$whereClause = "WHERE acgroup_id = '$acgroup_id' AND status=1";
|
||||
}
|
||||
|
||||
$t = "SELECT * FROM tbl_accategories $whereClause";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$t = "SELECT * FROM tbl_accounts
|
||||
WHERE accategory_id = '{$category->accategory_id}'
|
||||
AND status <> -1";
|
||||
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
$category->isParent = ($CI->db->query("SELECT * FROM tbl_accategories WHERE parent_category_id = '" . $category->accategory_id . "'")->num_rows() > 0) ? true : false;
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id);
|
||||
$category->opening_balance_dr += $accountBalances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $accountBalances['opening_balance_cr'];
|
||||
$category->dr_total += $accountBalances['dr_total'];
|
||||
$category->cr_total += $accountBalances['cr_total'];
|
||||
$category->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $accountBalances['regular_balance_cr'];
|
||||
}
|
||||
$category->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $category->accategory_id . "')")->row()->posting_side;
|
||||
|
||||
$category->opening_balance = ($category->posting_side == "DR") ? $category->opening_balance_dr - $category->opening_balance_cr : $category->opening_balance_cr - $category->opening_balance_dr;
|
||||
$category->closing_balance = ($category->posting_side == "DR") ? $category->dr_total - $category->cr_total : $category->cr_total - $category->dr_total;
|
||||
$category->regular_balance = ($category->posting_side == "DR") ? $category->regular_balance_dr - $category->regular_balance_cr : $category->regular_balance_cr - $category->regular_balance_dr;
|
||||
|
||||
$category->accounts = $accounts;
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getAccountsByCategory($accategory_id)
|
||||
{
|
||||
$accounts = array();
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE accategory_id='$accategory_id' and status=1";
|
||||
$AccountCategory = $CI->db->query($t)->row();
|
||||
if ($AccountCategory) {
|
||||
$accounts = $this->getAccountsRecursive($AccountCategory);
|
||||
}
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
function getAccountsRecursive($category)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$category->accategory_id' and status=1";
|
||||
$accountQuery = $CI->db->query($t);
|
||||
$accounts = $accountQuery->result();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$category->accategory_id'";
|
||||
$subcategories = $CI->db->query($t)->result();
|
||||
foreach ($subcategories as $subcategory) {
|
||||
$subcategoryAccounts = $this->getAccountsRecursive($subcategory);
|
||||
$accounts = array_merge($accounts, $subcategoryAccounts);
|
||||
}
|
||||
// Remove duplicate accounts based on account_id
|
||||
$uniqueAccounts = array_column($accounts, null, 'account_id');
|
||||
return array_values($uniqueAccounts);
|
||||
}
|
||||
|
||||
function getRootCategoriesWithBalances($acgroup_id = null)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$result = [];
|
||||
|
||||
$whereClause = "WHERE parent_category_id = '0' AND status = '1'";
|
||||
if ($acgroup_id !== null) {
|
||||
$whereClause .= " AND acgroup_id = '$acgroup_id'";
|
||||
}
|
||||
|
||||
$t = "SELECT * FROM tbl_accategories $whereClause";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$accounts = $this->getAccountsByCategory($category->accategory_id);
|
||||
$category->isParent = ($CI->db->query("SELECT * FROM tbl_accategories WHERE parent_category_id = '" . $category->accategory_id . "'")->num_rows() > 0) ? true : false;
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
// pre($account);
|
||||
$accountBalances = $this->getAccountBalances($account->account_id);
|
||||
$category->opening_balance_dr += $accountBalances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $accountBalances['opening_balance_cr'];
|
||||
$category->dr_total += $accountBalances['dr_total'];
|
||||
$category->cr_total += $accountBalances['cr_total'];
|
||||
$category->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $accountBalances['regular_balance_cr'];
|
||||
}
|
||||
$category->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $category->accategory_id . "')")->row()->posting_side;
|
||||
|
||||
$category->opening_balance = ($category->posting_side == "DR") ? $category->opening_balance_dr - $category->opening_balance_cr : $category->opening_balance_cr - $category->opening_balance_dr;
|
||||
$category->closing_balance = ($category->posting_side == "DR") ? $category->dr_total - $category->cr_total : $category->cr_total - $category->dr_total;
|
||||
$category->regular_balance = ($category->posting_side == "DR") ? $category->regular_balance_dr - $category->regular_balance_cr : $category->regular_balance_cr - $category->regular_balance_dr;
|
||||
$category->isZero = ($category->dr_total == 0 && $category->cr_total == 0 && $category->opening_balance_dr == 0 && $category->opening_balance_cr == 0 && $category->regular_balance_dr == 0 && $category->regular_balance_cr == 0) ? 1 : 0;
|
||||
|
||||
$category->accounts = $accounts;
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function getChildCategoriesWithBalances($accategory_id)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$result = [];
|
||||
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id = '$accategory_id' AND status=1";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$t = "SELECT * FROM tbl_accounts
|
||||
WHERE accategory_id = '{$category->accategory_id}'
|
||||
AND status <> -1";
|
||||
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
$category->isParent = ($CI->db->query("SELECT * FROM tbl_accategories WHERE parent_category_id = '" . $category->accategory_id . "'")->num_rows() > 0) ? true : false;
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id);
|
||||
$category->opening_balance_dr += $accountBalances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $accountBalances['opening_balance_cr'];
|
||||
$category->dr_total += $accountBalances['dr_total'];
|
||||
$category->cr_total += $accountBalances['cr_total'];
|
||||
$category->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $accountBalances['regular_balance_cr'];
|
||||
}
|
||||
$category->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $category->accategory_id . "')")->row()->posting_side;
|
||||
|
||||
$category->opening_balance = ($category->posting_side == "DR") ? $category->opening_balance_dr - $category->opening_balance_cr : $category->opening_balance_cr - $category->opening_balance_dr;
|
||||
$category->closing_balance = ($category->posting_side == "DR") ? $category->dr_total - $category->cr_total : $category->cr_total - $category->dr_total;
|
||||
$category->regular_balance = ($category->posting_side == "DR") ? $category->regular_balance_dr - $category->regular_balance_cr : $category->regular_balance_cr - $category->regular_balance_dr;
|
||||
|
||||
$category->isZero = ($category->dr_total == 0 && $category->cr_total == 0 && $category->opening_balance_dr == 0 && $category->opening_balance_cr == 0 && $category->regular_balance_dr == 0 && $category->regular_balance_cr == 0) ? 1 : 0;
|
||||
|
||||
$category->accounts = $accounts;
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the categories with balances that fall under the provided account group ID and optionally filters by parent categories.
|
||||
*
|
||||
* This function queries the database to fetch the categories from the "tbl_accategories" table associated with the provided account group ID (`acgroup_id`) and calculates the totals of balances for each category by summing the account balances within each category. If the `$acgroup_id` is not specified, it fetches all categories. It returns an array of stdClass objects representing the categories with their respective balance totals.
|
||||
*
|
||||
* @param int|null $acgroup_id Optional. The ID of the account group to retrieve categories and balances for. If not specified, it fetches categories from all groups.
|
||||
* @param bool $onlyParents Optional. Specifies whether to include only parent categories (categories with parent_category_id = 0). Default is false.
|
||||
* @return array An array of stdClass objects representing the categories with balance totals under the specified account group ID or all groups if not specified.
|
||||
*/
|
||||
function getCategoriesWithBalances($acgroup_id = null, $onlyParents = false)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories";
|
||||
|
||||
if ($acgroup_id !== null) {
|
||||
$t .= " WHERE acgroup_id='$acgroup_id'";
|
||||
}
|
||||
|
||||
if ($onlyParents) {
|
||||
$t .= " AND parent_category_id = 0";
|
||||
}
|
||||
|
||||
$categories = $CI->db->query($t)->result();
|
||||
$result = [];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id); // Call the generateAccountsByCategory function to retrieve the accounts with balances
|
||||
|
||||
// Calculate category balances based on the account balances
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->total_balance_dr = 0;
|
||||
$category->total_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$balances = $this->getAccountBalances($account->account_id);
|
||||
|
||||
$category->dr_total += $balances['dr_total'];
|
||||
$category->cr_total += $balances['cr_total'];
|
||||
$category->dr_balance += $balances['dr_balance'];
|
||||
$category->cr_balance += $balances['cr_balance'];
|
||||
|
||||
$category->opening_balance_dr += $balances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $balances['opening_balance_cr'];
|
||||
$category->regular_balance_dr += $balances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $balances['regular_balance_cr'];
|
||||
$category->total_balance_dr += $balances['total_balance_dr'];
|
||||
$category->total_balance_cr += $balances['total_balance_cr'];
|
||||
}
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Retrieves the child categories with balances based on the provided parent category ID.
|
||||
*
|
||||
* This function queries the database to fetch the child categories from the "tbl_accategories" table associated with the provided parent category ID (`accategory_id`) and includes the balances for each category by calling the `getAccountBalances` function. It returns an array of stdClass objects representing the child categories with their respective balances.
|
||||
*
|
||||
* @param int $accategory_id The ID of the parent category to retrieve child categories for.
|
||||
* @return array An array of stdClass objects representing the child categories with balances under the specified parent category ID.
|
||||
*/
|
||||
function getChildCategories($accategory_id)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$accategory_id'";
|
||||
|
||||
$childCategories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($childCategories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id); // Call the generateAccountsByCategory function to retrieve the accounts with balances
|
||||
|
||||
// Initialize category balances
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->total_balance_dr = 0;
|
||||
$category->total_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id);
|
||||
|
||||
$category->dr_total += $accountBalances['dr_total'];
|
||||
$category->cr_total += $accountBalances['cr_total'];
|
||||
$category->dr_balance += $accountBalances['dr_balance'];
|
||||
$category->cr_balance += $accountBalances['cr_balance'];
|
||||
$category->opening_balance_dr += $accountBalances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $accountBalances['opening_balance_cr'];
|
||||
$category->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $accountBalances['regular_balance_cr'];
|
||||
$category->total_balance_dr += $accountBalances['total_balance_dr'];
|
||||
$category->total_balance_cr += $accountBalances['total_balance_cr'];
|
||||
}
|
||||
}
|
||||
|
||||
return $childCategories;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the account hierarchy based on the provided group ID, fiscal year ID, and branch ID.
|
||||
*
|
||||
* This function retrieves the accounts and categories associated with the provided group ID (`$group_id`) and generates a hierarchical structure using stdClass objects. It uses recursion to handle any depth of child categories. It includes the account balances in each account object.
|
||||
*
|
||||
* @param int $group_id The group ID to start the hierarchy generation from.
|
||||
* @param string $fiscal_year_id Optional. The fiscal year ID to filter the accounts. Default is an empty string.
|
||||
* @param string $branch_id Optional. The branch ID to filter the accounts. Default is an empty string.
|
||||
* @return array An array of stdClass objects representing the account hierarchy with account balances.
|
||||
*/
|
||||
function generateAccountsByGroup($group_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE acgroup_id='$group_id'";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
$result = [];
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id, $fiscal_year_id, $branch_id); // Call the generateAccountsByCategory function to retrieve the accounts with balances
|
||||
|
||||
// Calculate category balances based on the account balances
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$category->dr_total += $account->dr_total;
|
||||
$category->cr_total += $account->cr_total;
|
||||
$category->dr_balance += $account->dr_balance;
|
||||
$category->cr_balance += $account->cr_balance;
|
||||
$category->opening_balance_dr += $account->opening_balance_dr;
|
||||
$category->opening_balance_cr += $account->opening_balance_cr;
|
||||
$category->regular_balance_dr += $account->regular_balance_dr;
|
||||
$category->regular_balance_cr += $account->regular_balance_cr;
|
||||
}
|
||||
//pre($category);die;
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function generateAccountsByCategory($accategory_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$accategory_id' and status=1";
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
|
||||
$result = [];
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id, $fiscal_year_id ?: $this->FY, $branch_id ?: $this->Branch);
|
||||
$account->dr_total = $accountBalances['dr_total'];
|
||||
$account->cr_total = $accountBalances['cr_total'];
|
||||
$account->dr_balance = $accountBalances['dr_balance'];
|
||||
$account->cr_balance = $accountBalances['cr_balance'];
|
||||
$account->opening_balance_dr = $accountBalances['opening_balance_dr'];
|
||||
$account->opening_balance_cr = $accountBalances['opening_balance_cr'];
|
||||
$account->regular_balance_dr = $accountBalances['regular_balance_dr'];
|
||||
$account->regular_balance_cr = $accountBalances['regular_balance_cr'];
|
||||
$result[] = $account;
|
||||
}
|
||||
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$accategory_id'";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id, $fiscal_year_id, $branch_id);
|
||||
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$category->dr_total += $account->dr_total;
|
||||
$category->cr_total += $account->cr_total;
|
||||
$category->dr_balance += $account->dr_balance;
|
||||
$category->cr_balance += $account->cr_balance;
|
||||
$category->opening_balance_dr += $account->opening_balance_dr;
|
||||
$category->opening_balance_cr += $account->opening_balance_cr;
|
||||
$category->regular_balance_dr += $account->regular_balance_dr;
|
||||
$category->regular_balance_cr += $account->regular_balance_cr;
|
||||
}
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
function generateAccountsBySingleCategory($accategory_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$accategory_id' and status=1";
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id, $fiscal_year_id ?: $this->FY, $branch_id ?: $this->Branch);
|
||||
$account->dr_total = $accountBalances['dr_total'];
|
||||
$account->cr_total = $accountBalances['cr_total'];
|
||||
$account->dr_balance = $accountBalances['dr_balance'];
|
||||
$account->cr_balance = $accountBalances['cr_balance'];
|
||||
$account->opening_balance_dr = $accountBalances['opening_balance_dr'];
|
||||
$account->opening_balance_cr = $accountBalances['opening_balance_cr'];
|
||||
$account->regular_balance_dr = $accountBalances['regular_balance_dr'];
|
||||
$account->regular_balance_cr = $accountBalances['regular_balance_cr'];
|
||||
|
||||
$account->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $account->accategory_id . "')")->row()->posting_side;
|
||||
|
||||
$account->opening_balance = ($account->posting_side == "DR") ? $account->opening_balance_dr - $account->opening_balance_cr : $account->opening_balance_cr - $account->opening_balance_dr;
|
||||
$account->closing_balance = ($account->posting_side == "DR") ? $account->dr_total - $account->cr_total : $account->cr_total - $account->dr_total;
|
||||
$account->regular_balance = ($account->posting_side == "DR") ? $account->regular_balance_dr - $account->regular_balance_cr : $account->regular_balance_cr - $account->regular_balance_dr;
|
||||
|
||||
$account->isZero = ($account->dr_total == 0 && $account->cr_total == 0 && $account->opening_balance_dr == 0 && $account->opening_balance_cr == 0 && $account->regular_balance_dr == 0 && $account->regular_balance_cr == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the balance of an account based on the provided account ID.
|
||||
*
|
||||
* This function calculates the balance of an account by summing the "dr" and "cr" columns from the "tbl_voucherdetails" table associated with the provided account ID. It also calculates the `dr_balance` and `cr_balance` based on the `posting_side` from the related tables. Additionally, it retrieves the opening balance by considering the records with `voucher_id` equal to 0 as opening balances. It returns an associative array with the balance values.
|
||||
*
|
||||
* @param int $account_id The account ID to retrieve the balance for.
|
||||
* @param int $fiscal_year_id The fiscal year ID to filter the voucher details.
|
||||
* @param int $branch_id The branch ID to filter the voucher details.
|
||||
* @return array An associative array with the balance of the account, including the total of the "dr" column as 'dr_total', the total of the "cr" column as 'cr_total', the calculated "dr_balance", the calculated "cr_balance", the opening balance as 'opening_balance_dr', the opening balance as 'opening_balance_cr', the regular balance as 'regular_balance_dr', and the regular balance as 'regular_balance_cr'.
|
||||
*/
|
||||
function getAccountBalances($account_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id;
|
||||
$branch_id = ($branch_id == "") ? $this->Branch : $branch_id;
|
||||
$CI = &get_instance();
|
||||
$query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$result = $query->row();
|
||||
|
||||
$drTotal = $result->dr_total;
|
||||
$crTotal = $result->cr_total;
|
||||
|
||||
$posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id=(SELECT accategory_id FROM tbl_accounts WHERE account_id='$account_id'))")->row()->posting_side;
|
||||
|
||||
$drBalance = 0;
|
||||
$crBalance = 0;
|
||||
|
||||
if ($posting_side == "DR") {
|
||||
$drBalance = $drTotal - $crTotal;
|
||||
} else {
|
||||
$crBalance = $crTotal - $drTotal;
|
||||
}
|
||||
|
||||
$openingBalanceQuery = $CI->db->query("SELECT SUM(dr) AS opening_balance_dr, SUM(cr) AS opening_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id=0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$openingBalanceResult = $openingBalanceQuery->row();
|
||||
|
||||
$openingBalanceDr = $openingBalanceResult->opening_balance_dr;
|
||||
$openingBalanceCr = $openingBalanceResult->opening_balance_cr;
|
||||
|
||||
$regularBalanceQuery = $CI->db->query("SELECT SUM(dr) AS regular_balance_dr, SUM(cr) AS regular_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id<>0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$regularBalanceResult = $regularBalanceQuery->row();
|
||||
|
||||
$regularBalanceDr = $regularBalanceResult->regular_balance_dr;
|
||||
$regularBalanceCr = $regularBalanceResult->regular_balance_cr;
|
||||
|
||||
return array(
|
||||
'dr_total' => $drTotal,
|
||||
'cr_total' => $crTotal,
|
||||
'dr_balance' => $drBalance,
|
||||
'cr_balance' => $crBalance,
|
||||
'opening_balance_dr' => $openingBalanceDr,
|
||||
'opening_balance_cr' => $openingBalanceCr,
|
||||
'regular_balance_dr' => $regularBalanceDr,
|
||||
'regular_balance_cr' => $regularBalanceCr,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////
|
||||
function renderAccountCategoriesTable($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
|
||||
{
|
||||
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
|
||||
?>
|
||||
<table class="table table-sm">
|
||||
<?php if ($displayHeadings) { ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Particulars</th>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<th class="dr opening-dr">Opening (Dr)</th>
|
||||
<th class="cr opening-cr">Opening (Cr)</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<th class="dr this-year-dr">This Year (Dr)</th>
|
||||
<th class="cr this-year-cr">This Year (Cr)</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<th class="dr closing-dr">Closing (Dr)</th>
|
||||
<th class="cr closing-cr">Closing (Cr)</th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php } ?>
|
||||
<tbody>
|
||||
<?php foreach ($accountCategories as $accountCategory) : ?>
|
||||
|
||||
<?php if ($ReportOptions['showZeroBalances'] && $accountCategory->isZero == true) continue; ?>
|
||||
<tr class="<?php echo ($accountCategory->isParent) ? 'bg-darker parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
|
||||
<td class="group-name"><?php echo $accountCategory->accategory_name; ?></td>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->opening_balance : 0); ?></td>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->opening_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->regular_balance : 0); ?></td>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->regular_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->closing_balance : 0); ?></td>
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->closing_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php if ($accountCategory->isParent == 0) : ?>
|
||||
<?php $Accounts = $this->generateAccountsBySingleCategory($accountCategory->accategory_id); ?>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $this->renderAccountsTable($Accounts, $ReportOptions, false); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($accountCategory->isParent == 1) : ?>
|
||||
<?php $Accounts = $this->generateAccountsBySingleCategory($accountCategory->accategory_id); ?>
|
||||
<?php if ($Accounts) : ?>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $this->renderAccountsTable($Accounts, $ReportOptions, false); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr class="">
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $childCategories = $this->getChildCategoriesWithBalances($accountCategory->accategory_id); ?>
|
||||
<?php $this->renderAccountCategoriesTable($childCategories, $ReportOptions, false, $parentCategories); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
function renderAccountCategoriesTableForBS($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
|
||||
{
|
||||
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
|
||||
?>
|
||||
<table class="table table-hover table-sm">
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($accountCategories as $accountCategory) : ?>
|
||||
|
||||
<?php if ($ReportOptions['showZeroBalances']==false && $accountCategory->isZero == true) continue; ?>
|
||||
<tr class="<?php echo ($accountCategory->isParent) ? 'bg-darker parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
|
||||
<td class="group-name"><?php echo $accountCategory->accategory_name; ?></td>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<!-- <td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->opening_balance : 0); ?></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->opening_balance : 0); ?> <?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->opening_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<!-- <td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->regular_balance : 0); ?></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->regular_balance : 0); ?> <?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->regular_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<!-- <td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->closing_balance : 0); ?></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->closing_balance : 0); ?> <?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->closing_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php if ($accountCategory->isParent == 0) : ?>
|
||||
<?php $Accounts = $this->generateAccountsBySingleCategory($accountCategory->accategory_id); ?>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $this->renderAccountsTableForBS($Accounts, $ReportOptions, false); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($accountCategory->isParent == 1) : ?>
|
||||
<?php $Accounts = $this->generateAccountsBySingleCategory($accountCategory->accategory_id); ?>
|
||||
<?php if ($Accounts) : ?>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $this->renderAccountsTableForBS($Accounts, $ReportOptions, false); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr class="">
|
||||
<td colspan="7">
|
||||
<div id="accategory_<?php echo $accountCategory->accategory_id; ?>" class="collapse">
|
||||
<?php $childCategories = $this->getChildCategoriesWithBalances($accountCategory->accategory_id); ?>
|
||||
<?php $this->renderAccountCategoriesTableForBS($childCategories, $ReportOptions, false, $parentCategories); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
function renderAccountsTable($Accounts, $ReportOptions, $displayHeadings = false)
|
||||
{
|
||||
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
|
||||
?>
|
||||
<table class="table table-hover table-gray">
|
||||
<?php if ($displayHeadings) { ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Particulars</th>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<th class="dr opening-dr">Opening (Dr)</th>
|
||||
<th class="cr opening-cr">Opening (Cr)</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<th class="dr this-year-dr">This Year (Dr)</th>
|
||||
<th class="cr this-year-cr">This Year (Cr)</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<th class="dr closing-dr">Closing (Dr)</th>
|
||||
<th class="cr closing-cr">Closing (Cr)</th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php } ?>
|
||||
<tbody>
|
||||
<?php foreach ($Accounts as $Account) : ?>
|
||||
<?php if ($ReportOptions['showZeroBalances'] == false && $Account->isZero == true) continue; ?>
|
||||
<tr>
|
||||
<td class="group-name"><?php echo $Account->account_name; ?></td>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->regular_balance : 0); ?></td>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td>
|
||||
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
function renderAccountsTableForBS($Accounts, $ReportOptions, $displayHeadings = false)
|
||||
{
|
||||
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
|
||||
?>
|
||||
<table class="table table-hover table-gray">
|
||||
|
||||
|
||||
<?php foreach ($Accounts as $Account) : ?>
|
||||
<?php if ($ReportOptions['showZeroBalances'] == false && $Account->isZero == 1) continue; ?>
|
||||
<tr>
|
||||
<td class="group-name"><?php echo $Account->account_name; ?></td>
|
||||
<?php if ($ReportOptions['showOB']) : ?>
|
||||
<!-- <td class="group-total"></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<!-- <td class="group-total"></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->regular_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showClosing']) : ?>
|
||||
<!-- <td class="group-total"></td> -->
|
||||
<td class="group-total" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////
|
||||
}
|
128
account/application/libraries/Fpdflib.php
Normal file
128
account/application/libraries/Fpdflib.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . "/third_party/pdf/fpdm.php";
|
||||
|
||||
class fpdflib
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
function createPDF()
|
||||
{
|
||||
echo "COW";
|
||||
$pdf = new FPDM\FPDM(APPPATH."/../pdf/voucher1.pdf");
|
||||
/*
|
||||
$result = 'SELECT * FROM report WHERE time BETWEEN "' . $_POST["fromdate"] . '" AND "' . $_POST["todate"] . '"';
|
||||
$link = $db->prepare($result);
|
||||
$link->execute();
|
||||
$resultset = $link->fetchAll();
|
||||
$count = $link->rowCount();
|
||||
$pdf = new PDF();
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->SetTitle("Report");
|
||||
$pdf->AddPage();
|
||||
|
||||
$row_height = 10;
|
||||
$y_axis = 30;
|
||||
|
||||
|
||||
$pdf->SetY($y_axis);
|
||||
$pdf->SetX(25);
|
||||
$pdf->Cell(30, 10, "", 0, 0, 1);
|
||||
$y_axis = $y_axis + $row_height;
|
||||
|
||||
|
||||
|
||||
$pdf->SetDrawColor(128, 0, 0);
|
||||
$pdf->SetTextColor(102, 68, 34);
|
||||
$pdf->SetFont('Arial', 'B', 10);
|
||||
$pdf->SetY($y_axis);
|
||||
$pdf->SetX(11);
|
||||
$pdf->Cell(34, 10, 'Order ID', 1, 0, 'C');
|
||||
$pdf->Cell(35, 10, 'Name', 1, 0, 'C');
|
||||
$pdf->Cell(30, 10, 'TID', 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, 'Quantity', 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, 'Date', 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, 'Time', 1, 0, 'C');
|
||||
$pdf->Cell(30, 10, 'Bill Amount', 1, 0, 'C');
|
||||
$y_axis = $y_axis + $row_height;
|
||||
$total = 0;
|
||||
foreach ($resultset as $row) {
|
||||
$len = strlen($row['name']);
|
||||
if ($len > 21) {
|
||||
$name = substr($row['name'], 0, 19) . "..";
|
||||
} else {
|
||||
$name = $row['name'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$oid = $row['order_id'];
|
||||
|
||||
$tid = $row['t_id'];
|
||||
$qty = $row['quantity'];
|
||||
$date = $row['date'];
|
||||
$time = $row['time'];
|
||||
$amt = $row['bill_amount'];
|
||||
|
||||
$total = $total + $amt;
|
||||
|
||||
$pdf->SetDrawColor(128, 0, 0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->SetFont('Arial', '', 9);
|
||||
$pdf->SetY($y_axis);
|
||||
$pdf->SetX(11);
|
||||
$pdf->Cell(34, 10, $oid, 1, 0, 'L');
|
||||
$pdf->Cell(35, 10, $name, 1, 0, 'L');
|
||||
$pdf->Cell(30, 10, $tid, 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, $qty, 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, $date, 1, 0, 'C');
|
||||
$pdf->Cell(20, 10, $time, 1, 0, 'C');
|
||||
$pdf->Cell(30, 10, $amt, 1, 0, 'R');
|
||||
|
||||
$y_axis = $y_axis + $row_height;
|
||||
$pdf->SetY(10);
|
||||
$pdf->SetX(170);
|
||||
}
|
||||
|
||||
$totalre = $total - $r_amt;
|
||||
$pdf->SetDrawColor(128, 0, 0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->SetFont('Arial', 'B', 11);
|
||||
$pdf->SetY($y_axis);
|
||||
$pdf->SetX(137);
|
||||
$pdf->Cell(42, 10, 'Total', 0, 0, 'C');
|
||||
$pdf->SetTextColor(255, 0, 0);
|
||||
$pdf->Cell(25, 10, $totalre, 0, 0, 'C');
|
||||
$y_axis = $y_axis + $row_height;
|
||||
$pdf->SetAutoPageBreak(false, 20);
|
||||
$pdf->Output();
|
||||
*/
|
||||
}
|
||||
|
||||
function Header()
|
||||
{
|
||||
$this->Image('picture.png', 10, 6, 30);
|
||||
$this->SetFont('Arial', 'B', 15);
|
||||
// Move to the right
|
||||
$this->Cell(80);
|
||||
// Title
|
||||
$this->SetTextColor(255, 119, 0);
|
||||
$this->Cell(30, 10, 'Report', 0, 0, 'C');
|
||||
// Line break
|
||||
$this->Line(10, 22, 210 - 10, 22);
|
||||
$this->Ln(20);
|
||||
}
|
||||
|
||||
// Page footer
|
||||
function Footer()
|
||||
{
|
||||
$this->Line(10, 280, 210 - 10, 280);
|
||||
$this->SetY(-15);
|
||||
$this->SetFont('Arial', 'I', 8);
|
||||
// Page number
|
||||
$this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
|
||||
}
|
||||
}
|
1630
account/application/libraries/Myaccounts.php
Normal file
1630
account/application/libraries/Myaccounts.php
Normal file
File diff suppressed because it is too large
Load Diff
626
account/application/libraries/NewAcc.php
Normal file
626
account/application/libraries/NewAcc.php
Normal file
@ -0,0 +1,626 @@
|
||||
<?php
|
||||
/* NOTES TO ME */
|
||||
/*
|
||||
|
||||
We are developing this library to be used as global for accounting systems for any software we are going to build
|
||||
|
||||
|
||||
Currenyly, in this function we are drawing balances based on selected branch and selected fiscal year.
|
||||
We are supposing branch and fiscalyear is set to session. if no session values are found, we are assuming, fiscalyear is 1 and branch is 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class newacc
|
||||
{
|
||||
private $FY;
|
||||
private $Branch;
|
||||
public function __construct()
|
||||
{
|
||||
$CI = &get_instance(); // Get the CodeIgniter instance
|
||||
|
||||
$CI->load->library('session'); // Assuming CodeIgniter's session library is already loaded
|
||||
|
||||
// Check if Branch is set in session
|
||||
if ($CI->session->has_userdata('BranchID')) {
|
||||
$this->Branch = $CI->session->userdata('BranchID');
|
||||
} else {
|
||||
$this->Branch = 1; // Default value if not found in session
|
||||
}
|
||||
|
||||
// Check if FY is set in session
|
||||
if ($CI->session->has_userdata('FiscalYearID')) {
|
||||
$this->FY = $CI->session->userdata('FiscalYearID');
|
||||
} else {
|
||||
$this->FY = 1; // Default value if not found in session
|
||||
}
|
||||
// echo $this->FY;die;
|
||||
}
|
||||
function getAccountGroups(&$ACBalances = array())
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "select * from tbl_acgroups where status=1";
|
||||
$AccountGroups = $CI->db->query($t)->result();
|
||||
foreach ($AccountGroups as $AccountGroup) :
|
||||
$AccountGroup->dr = 0;
|
||||
$AccountGroup->cr = 0;
|
||||
$AccountGroup->openingdr = 0;
|
||||
$AccountGroup->openingcr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getThisYearWithOpening');
|
||||
$OpeningBalance = $this->getGroupBalance($AccountGroup->acgroup_id, $ACBalances, 'getOpeningOnly');
|
||||
if ($AccountGroup->posting_side == "DR") {
|
||||
$AccountGroup->dr = ($TotalBalance);
|
||||
$AccountGroup->openingdr = ($OpeningBalance);
|
||||
} else {
|
||||
$AccountGroup->cr = ($TotalBalance);
|
||||
$AccountGroup->openingcr = ($OpeningBalance);
|
||||
}
|
||||
endforeach;
|
||||
//pre($AccountGroups);
|
||||
return $AccountGroups;
|
||||
}
|
||||
function getChildCategories($accategory_id = 0, $condition = "showAll")
|
||||
{
|
||||
$ACBalances = array();
|
||||
$CI = &get_instance();
|
||||
$t = "select * from tbl_accategories where parent_category_id='" . $accategory_id . "' and status=1";
|
||||
// echo $t;
|
||||
$AccountCategories = $CI->db->query($t)->result();
|
||||
foreach ($AccountCategories as $AccountCategory) :
|
||||
$AccountCategory->posting_side = getFieldfromValue("tbl_acgroups", "posting_side", "acgroup_id", $AccountCategory->acgroup_id);
|
||||
$AccountCategory->dr = 0;
|
||||
$AccountCategory->cr = 0;
|
||||
$AccountCategory->openingdr = 0;
|
||||
$AccountCategory->openingcr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances);
|
||||
$OpeningBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances, "getOpeningOnly");
|
||||
if ($AccountCategory->posting_side == "DR") {
|
||||
$AccountCategory->dr = $TotalBalance;
|
||||
$AccountCategory->openingdr = $OpeningBalance;
|
||||
} else {
|
||||
$AccountCategory->cr = $TotalBalance;
|
||||
$AccountCategory->openingcr = $OpeningBalance;
|
||||
}
|
||||
endforeach;
|
||||
return $AccountCategories;
|
||||
}
|
||||
function getAccountCategories($group_id = 0, $condition = "showAll")
|
||||
{
|
||||
$ACBalances = array();
|
||||
$CI = &get_instance();
|
||||
if ($group_id == 0)
|
||||
$t = "select * from tbl_accategories where status=1";
|
||||
else
|
||||
$t = "select * from tbl_accategories where status=1 and acgroup_id='$group_id'";
|
||||
if ($condition == "onlyParents") {
|
||||
$t .= " AND parent_category_id=0 ";
|
||||
}
|
||||
$AccountCategories = $CI->db->query($t)->result();
|
||||
foreach ($AccountCategories as $AccountCategory) :
|
||||
$AccountCategory->posting_side = getFieldfromValue("tbl_acgroups", "posting_side", "acgroup_id", $AccountCategory->acgroup_id);
|
||||
$AccountCategory->dr = 0;
|
||||
$AccountCategory->cr = 0;
|
||||
$AccountCategory->openingdr = 0;
|
||||
$AccountCategory->openingcr = 0;
|
||||
$ACBalances = array();
|
||||
$TotalBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances);
|
||||
$OpeningBalance = $this->getCategoryBalance($AccountCategory->accategory_id, $ACBalances, "getOpeningOnly");
|
||||
if ($AccountCategory->posting_side == "DR") {
|
||||
$AccountCategory->dr = ($TotalBalance);
|
||||
$AccountCategory->openingdr = ($OpeningBalance);
|
||||
} else {
|
||||
$AccountCategory->cr = ($TotalBalance);
|
||||
$AccountCategory->openingcr = ($OpeningBalance);
|
||||
}
|
||||
endforeach;
|
||||
return $AccountCategories;
|
||||
}
|
||||
|
||||
function getAccountsByCategory($accategory_id)
|
||||
{
|
||||
$accounts = array();
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE accategory_id='$accategory_id'";
|
||||
$AccountCategory = $CI->db->query($t)->row();
|
||||
if ($AccountCategory) {
|
||||
$accounts = $this->getAccountsRecursive($AccountCategory);
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
|
||||
function getAccountsRecursive($category)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$category->accategory_id'";
|
||||
$accountQuery = $CI->db->query($t);
|
||||
$Accounts = $accountQuery->result();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$category->accategory_id'";
|
||||
$subcategories = $CI->db->query($t)->result();
|
||||
foreach ($subcategories as $subcategory) {
|
||||
$subcategoryAccounts = $this->getAccountsRecursive($subcategory);
|
||||
$Accounts = array_merge($Accounts, $subcategoryAccounts);
|
||||
}
|
||||
foreach ($Accounts as $Account) {
|
||||
$Account->dr = 0;
|
||||
$Account->cr = 0;
|
||||
$Account->openingdr = 0;
|
||||
$Account->openingcr = 0;
|
||||
|
||||
$posting_side = getfieldFromValue("tbl_acgroups", "posting_side", "acgroup_id", (getfieldFromValue("tbl_accategories", "acgroup_id", "accategory_id", $Account->accategory_id)));
|
||||
if ($posting_side == "DR") {
|
||||
$Account->openingdr = $this->getAccountBalance($Account, $ACBalances, "getOpeningOnly");
|
||||
$Account->dr = $this->getAccountBalance($Account, $ACBalances, "getAll");
|
||||
} else {
|
||||
$Account->openingcr = $this->getAccountBalance($Account, $ACBalances, "getOpeningOnly");
|
||||
$Account->cr = $this->getAccountBalance($Account, $ACBalances, "getAll");
|
||||
}
|
||||
}
|
||||
return $Accounts;
|
||||
}
|
||||
|
||||
function getAccountBalanceByGroup($acgroup_id, $abs = true)
|
||||
{
|
||||
$total = 0;
|
||||
$accounts = $this->getAccountsByGroup($acgroup_id);
|
||||
foreach ($accounts as $account) {
|
||||
if ($abs)
|
||||
$total += (abs($account->balance));
|
||||
else
|
||||
$total += ($account->balance);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
function getAccountsByGroup($acgroup_id)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$query = $CI->db->select('a.*')
|
||||
->from('tbl_accounts a')
|
||||
->join('tbl_accategories c', 'c.accategory_id = a.accategory_id')
|
||||
->where('a.status', 1)
|
||||
->where('c.acgroup_id', $acgroup_id)
|
||||
->get();
|
||||
$accounts = $query->result();
|
||||
$ACBalances = array();
|
||||
foreach ($accounts as $account) {
|
||||
|
||||
$account->balance = $this->getAccountBalance($account->account_id, $ACBalances);
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the group balance based on the provided category ID and condition.
|
||||
*
|
||||
* @param stdClass $Account The group ID to retrieve the balance for.
|
||||
* @param array &$ACBalances Reference to the array to store the balance results.
|
||||
* @param string $condition The condition to determine which balances to retrieve. Accepted values: 'getOpeningOnly', 'getThisYear', 'getAll'.
|
||||
* @return float The balance value.
|
||||
*/
|
||||
function getAccountBalance($Account, &$ACBalances, $condition = 'getAll')
|
||||
{
|
||||
/*
|
||||
When $condition is set to 'getOpeningOnly', the function retrieves only the opening balances (where voucher_id = 0).
|
||||
When $condition is set to 'getThisYear', the function retrieves balances for the current fiscal year (where voucher_id <> 0 and fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getThisYearWithOpening', the function retrieves balances for the current fiscal year, including opening balances (where fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getAll' and $this->FY is not set, the function retrieves overall balances (where voucher_id <> 0).
|
||||
*/
|
||||
// pre($Account);echo "NEXT";
|
||||
$ci = &get_instance();
|
||||
$DrBalance = 0;
|
||||
$CrBalance = 0;
|
||||
|
||||
$t = "SELECT * FROM tbl_voucherdetails WHERE account_id = '$Account->account_id' AND status <> -1";
|
||||
|
||||
// Condition: Opening Only
|
||||
if ($condition == 'getOpeningOnly') {
|
||||
$t .= " AND voucher_id = 0";
|
||||
}
|
||||
// Condition: This Year
|
||||
if ($condition == 'getThisYear') {
|
||||
$t .= " AND voucher_id <> 0 AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
// Condition: This Year with Opening
|
||||
if ($condition == 'getThisYearWithOpening') {
|
||||
$t .= " AND fiscalyear_id = " . $this->FY;
|
||||
}
|
||||
// Condition: Overall
|
||||
if ($condition == 'getAll' && !isset($this->FY)) {
|
||||
$t .= " AND voucher_id <> 0";
|
||||
}
|
||||
$t .= " AND branch_id = " . $this->Branch;
|
||||
|
||||
$Vouchers = $ci->db->query($t)->result();
|
||||
foreach ($Vouchers as $Voucher) {
|
||||
$DrBalance += $Voucher->dr;
|
||||
$CrBalance += $Voucher->cr;
|
||||
}
|
||||
$ACBalances['DrBalance'] = $DrBalance;
|
||||
$ACBalances['CrBalance'] = $CrBalance;
|
||||
// $ACBalances['Balance'] = ($DrBalance > $CrBalance) ? ($DrBalance - $CrBalance) : ($CrBalance - $DrBalance);
|
||||
// $ACBalances['Balance'] = $DrBalance - $CrBalance;
|
||||
$posting_side = getfieldFromValue("tbl_acgroups", "posting_side", "acgroup_id", (getfieldFromValue("tbl_accategories", "acgroup_id", "accategory_id", $Account->accategory_id)));
|
||||
if ($posting_side == "DR") {
|
||||
$ACBalances['Balance'] = $DrBalance - $CrBalance;
|
||||
} else {
|
||||
$ACBalances['Balance'] = $CrBalance - $DrBalance;
|
||||
}
|
||||
return $ACBalances['Balance'];
|
||||
}
|
||||
/**
|
||||
* Retrieves the group balance based on the provided category ID and condition.
|
||||
*
|
||||
* @param int $group_id The group ID to retrieve the balance for.
|
||||
* @param array &$ACBalances Reference to the array to store the balance results.
|
||||
* @param string $condition The condition to determine which balances to retrieve. Accepted values: 'getOpeningOnly', 'getThisYear', 'getAll'.
|
||||
* @return float The balance value.
|
||||
*/
|
||||
function getGroupBalance($group_id, &$ACBalances, $condition = 'getAll')
|
||||
{
|
||||
/*
|
||||
When $condition is set to 'getOpeningOnly', the function retrieves only the opening balances (where voucher_id = 0).
|
||||
When $condition is set to 'getThisYear', the function retrieves balances for the current fiscal year (where voucher_id <> 0 and fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getThisYearWithOpening', the function retrieves balances for the current fiscal year, including opening balances (where fiscalyear_id = $this->FY).
|
||||
When $condition is set to 'getAll' and $this->FY is not set, the function retrieves overall balances (where voucher_id <> 0).
|
||||
*/
|
||||
$ci = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories AS a WHERE a.acgroup_id = '$group_id' AND a.status = 1) AND status <> -1";
|
||||
$Accounts = $ci->db->query($t)->result();
|
||||
$Balance = 0;
|
||||
foreach ($Accounts as $Account) {
|
||||
$Balance += $this->getAccountBalance($Account, $ACBalances, $condition);
|
||||
}
|
||||
return $Balance;
|
||||
}
|
||||
/**
|
||||
* Retrieves the group balance based on the provided category ID and condition.
|
||||
*
|
||||
* @param int $group_id The group ID to retrieve the balance for.
|
||||
* @param array &$ACBalances Reference to the array to store the balance results.
|
||||
* @param string $condition The condition to determine which balances to retrieve. Accepted values: 'getOpeningOnly', 'getThisYear', 'getAll'.
|
||||
* @return float The balance value.
|
||||
*/
|
||||
function getCategoryBalance($accategory_id, &$ACBalances, $condition = "getAll")
|
||||
{
|
||||
$ci = &get_instance();
|
||||
$Balance = 0;
|
||||
$Accounts = $this->getAccountsByCategory($accategory_id);
|
||||
//pre($Accounts);die;
|
||||
foreach ($Accounts as $Account) {
|
||||
// print_r($Account);die;
|
||||
$Balance += $this->getAccountBalance($Account, $ACBalances, $condition);
|
||||
}
|
||||
return $Balance;
|
||||
}
|
||||
|
||||
|
||||
function showTable($Accounts, $abs = true, $showHead = false)
|
||||
{
|
||||
$total = 0;
|
||||
$accColWidth = "col-9";
|
||||
$balanceColWidth = "col-3";
|
||||
?>
|
||||
<table class="table table-bordered table-hover">
|
||||
<?php if ($showHead) : ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="<?php echo $accColWidth; ?>">Account</th>
|
||||
<th class="<?php echo $balanceColWidth; ?>">Balance</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<?php endif; ?>
|
||||
<tbody>
|
||||
<?php foreach ($Accounts as $Account) :
|
||||
if ($abs)
|
||||
$total += abs($Account->balance);
|
||||
else
|
||||
$total += $Account->balance;
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $accColWidth; ?>"><?php echo $Account->account_name; ?></td>
|
||||
<td class="<?php echo $balanceColWidth; ?>"><?php echo ($abs) ? myCurrency(abs($Account->balance)) : myCurrency($Account->balance); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
<!-- <tfoot>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><?php echo myCurrency($total); ?></th>
|
||||
|
||||
</tr>
|
||||
</tfoot> -->
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Retrieves the account groups with balances, optionally filtered by group ID.
|
||||
*
|
||||
* This function queries the database to fetch the account groups from the "tbl_acgroups" table and calculates the totals of balances for each group by summing the account balances within each group. If the optional "acgroup_id" parameter is provided, the function returns only the group with the specified ID. Otherwise, it returns an array of stdClass objects representing each account group with the corresponding balance totals.
|
||||
*
|
||||
* @param int|null $acgroup_id (Optional) The ID of the account group to retrieve balances for.
|
||||
* @return array|stdClass|null An array of stdClass objects representing the account groups with balance totals, or a single stdClass object for the specified group ID, or null if no group is found with the provided ID.
|
||||
*/
|
||||
function getAccountGroupsWithBalances($acgroup_id = null)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_acgroups";
|
||||
|
||||
if ($acgroup_id !== null) {
|
||||
$t .= " WHERE acgroup_id='$acgroup_id'";
|
||||
$result = $CI->db->query($t)->row();
|
||||
|
||||
if ($result === null) {
|
||||
return null; // Return null if no group is found with the provided ID
|
||||
}
|
||||
|
||||
$result->accounts = $this->generateAccountsByGroup($result->acgroup_id); // Call the generateAccountsByGroup function to retrieve the accounts with balances
|
||||
|
||||
// Calculate group balances based on the account balances
|
||||
$result->dr_total = 0;
|
||||
$result->cr_total = 0;
|
||||
$result->dr_balance = 0;
|
||||
$result->cr_balance = 0;
|
||||
|
||||
foreach ($result->accounts as $category) {
|
||||
$result->dr_total += $category->dr_total;
|
||||
$result->cr_total += $category->cr_total;
|
||||
$result->dr_balance += $category->dr_balance;
|
||||
$result->cr_balance += $category->cr_balance;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$accountGroups = $CI->db->query($t)->result();
|
||||
$result = [];
|
||||
|
||||
foreach ($accountGroups as $group) {
|
||||
$group->accounts = $this->generateAccountsByGroup($group->acgroup_id); // Call the generateAccountsByGroup function to retrieve the accounts with balances
|
||||
|
||||
// Calculate group balances based on the account balances
|
||||
$group->dr_total = 0;
|
||||
$group->cr_total = 0;
|
||||
$group->dr_balance = 0;
|
||||
$group->cr_balance = 0;
|
||||
|
||||
foreach ($group->accounts as $category) {
|
||||
$group->dr_total += $category->dr_total;
|
||||
$group->cr_total += $category->cr_total;
|
||||
$group->dr_balance += $category->dr_balance;
|
||||
$group->cr_balance += $category->cr_balance;
|
||||
}
|
||||
|
||||
$result[] = $group;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the categories with balances that fall under the provided account group ID and optionally filters by parent categories.
|
||||
*
|
||||
* This function queries the database to fetch the categories from the "tbl_accategories" table associated with the provided account group ID (`acgroup_id`) and calculates the totals of balances for each category by summing the account balances within each category. If the `$acgroup_id` is not specified, it fetches all categories. It returns an array of stdClass objects representing the categories with their respective balance totals.
|
||||
*
|
||||
* @param int|null $acgroup_id Optional. The ID of the account group to retrieve categories and balances for. If not specified, it fetches categories from all groups.
|
||||
* @param bool $onlyParents Optional. Specifies whether to include only parent categories (categories with parent_category_id = 0). Default is false.
|
||||
* @return array An array of stdClass objects representing the categories with balance totals under the specified account group ID or all groups if not specified.
|
||||
*/
|
||||
function getCategoriesWithBalances($acgroup_id = null, $onlyParents = false)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories";
|
||||
|
||||
if ($acgroup_id !== null) {
|
||||
$t .= " WHERE acgroup_id='$acgroup_id'";
|
||||
}
|
||||
|
||||
if ($onlyParents) {
|
||||
$t .= " AND parent_category_id = 0";
|
||||
}
|
||||
|
||||
$categories = $CI->db->query($t)->result();
|
||||
$result = [];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id); // Call the generateAccountsByCategory function to retrieve the accounts with balances
|
||||
|
||||
// Calculate category balances based on the account balances
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
$category->total_balance_dr = 0;
|
||||
$category->total_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$balances = $this->getAccountBalances($account->account_id);
|
||||
|
||||
$category->dr_total += $balances['dr_total'];
|
||||
$category->cr_total += $balances['cr_total'];
|
||||
$category->dr_balance += $balances['dr_balance'];
|
||||
$category->cr_balance += $balances['cr_balance'];
|
||||
|
||||
$category->opening_balance_dr += $balances['opening_balance_dr'];
|
||||
$category->opening_balance_cr += $balances['opening_balance_cr'];
|
||||
$category->regular_balance_dr += $balances['regular_balance_dr'];
|
||||
$category->regular_balance_cr += $balances['regular_balance_cr'];
|
||||
$category->total_balance_dr += $balances['total_balance_dr'];
|
||||
$category->total_balance_cr += $balances['total_balance_cr'];
|
||||
}
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function generateAccountsByGroup($group_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accategories WHERE acgroup_id='$group_id'";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
$result = [];
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id, $fiscal_year_id, $branch_id); // Call the generateAccountsByCategory function to retrieve the accounts with balances
|
||||
|
||||
// Calculate category balances based on the account balances
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$category->dr_total += $account->dr_total;
|
||||
$category->cr_total += $account->cr_total;
|
||||
$category->dr_balance += $account->dr_balance;
|
||||
$category->cr_balance += $account->cr_balance;
|
||||
$category->opening_balance_dr += $account->opening_balance_dr;
|
||||
$category->opening_balance_cr += $account->opening_balance_cr;
|
||||
$category->regular_balance_dr += $account->regular_balance_dr;
|
||||
$category->regular_balance_cr += $account->regular_balance_cr;
|
||||
}
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function generateAccountsByCategory($accategory_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$t = "SELECT * FROM tbl_accounts WHERE accategory_id='$accategory_id'";
|
||||
$accounts = $CI->db->query($t)->result();
|
||||
|
||||
$result = [];
|
||||
foreach ($accounts as $account) {
|
||||
$accountBalances = $this->getAccountBalances($account->account_id, $fiscal_year_id ?: $this->FY, $branch_id ?: $this->Branch);
|
||||
$account->dr_total = $accountBalances['dr_total'];
|
||||
$account->cr_total = $accountBalances['cr_total'];
|
||||
$account->dr_balance = $accountBalances['dr_balance'];
|
||||
$account->cr_balance = $accountBalances['cr_balance'];
|
||||
$account->opening_balance_dr = $accountBalances['opening_balance_dr'];
|
||||
$account->opening_balance_cr = $accountBalances['opening_balance_cr'];
|
||||
$account->regular_balance_dr = $accountBalances['regular_balance_dr'];
|
||||
$account->regular_balance_cr = $accountBalances['regular_balance_cr'];
|
||||
$result[] = $account;
|
||||
}
|
||||
|
||||
$t = "SELECT * FROM tbl_accategories WHERE parent_category_id='$accategory_id'";
|
||||
$categories = $CI->db->query($t)->result();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category->accounts = $this->generateAccountsByCategory($category->accategory_id, $fiscal_year_id, $branch_id);
|
||||
|
||||
$category->dr_total = 0;
|
||||
$category->cr_total = 0;
|
||||
$category->dr_balance = 0;
|
||||
$category->cr_balance = 0;
|
||||
$category->opening_balance_dr = 0;
|
||||
$category->opening_balance_cr = 0;
|
||||
$category->regular_balance_dr = 0;
|
||||
$category->regular_balance_cr = 0;
|
||||
|
||||
foreach ($category->accounts as $account) {
|
||||
$category->dr_total += $account->dr_total;
|
||||
$category->cr_total += $account->cr_total;
|
||||
$category->dr_balance += $account->dr_balance;
|
||||
$category->cr_balance += $account->cr_balance;
|
||||
$category->opening_balance_dr += $account->opening_balance_dr;
|
||||
$category->opening_balance_cr += $account->opening_balance_cr;
|
||||
$category->regular_balance_dr += $account->regular_balance_dr;
|
||||
$category->regular_balance_cr += $account->regular_balance_cr;
|
||||
}
|
||||
|
||||
$result[] = $category;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the balance of an account based on the provided account ID.
|
||||
*
|
||||
* This function calculates the balance of an account by summing the "dr" and "cr" columns from the "tbl_voucherdetails" table associated with the provided account ID. It also calculates the `dr_balance` and `cr_balance` based on the `posting_side` from the related tables. Additionally, it retrieves the opening balance by considering the records with `voucher_id` equal to 0 as opening balances. It returns an associative array with the balance values.
|
||||
*
|
||||
* @param int $account_id The account ID to retrieve the balance for.
|
||||
* @param int $fiscal_year_id The fiscal year ID to filter the voucher details.
|
||||
* @param int $branch_id The branch ID to filter the voucher details.
|
||||
* @return array An associative array with the balance of the account, including the total of the "dr" column as 'dr_total', the total of the "cr" column as 'cr_total', the calculated "dr_balance", the calculated "cr_balance", the opening balance as 'opening_balance_dr', the opening balance as 'opening_balance_cr', the regular balance as 'regular_balance_dr', and the regular balance as 'regular_balance_cr'.
|
||||
*/
|
||||
function getAccountBalances($account_id, $fiscal_year_id = "", $branch_id = "")
|
||||
{
|
||||
$fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id;
|
||||
$branch_id = ($branch_id == "") ? $this->Branch : $branch_id;
|
||||
$CI = &get_instance();
|
||||
$query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$result = $query->row();
|
||||
|
||||
$drTotal = $result->dr_total;
|
||||
$crTotal = $result->cr_total;
|
||||
|
||||
$posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id=(SELECT accategory_id FROM tbl_accounts WHERE account_id='$account_id'))")->row()->posting_side;
|
||||
|
||||
$drBalance = 0;
|
||||
$crBalance = 0;
|
||||
|
||||
if ($posting_side == "DR") {
|
||||
$drBalance = $drTotal - $crTotal;
|
||||
} else {
|
||||
$crBalance = $crTotal - $drTotal;
|
||||
}
|
||||
|
||||
$openingBalanceQuery = $CI->db->query("SELECT SUM(dr) AS opening_balance_dr, SUM(cr) AS opening_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id=0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$openingBalanceResult = $openingBalanceQuery->row();
|
||||
|
||||
$openingBalanceDr = $openingBalanceResult->opening_balance_dr;
|
||||
$openingBalanceCr = $openingBalanceResult->opening_balance_cr;
|
||||
|
||||
$regularBalanceQuery = $CI->db->query("SELECT SUM(dr) AS regular_balance_dr, SUM(cr) AS regular_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id<>0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
|
||||
$regularBalanceResult = $regularBalanceQuery->row();
|
||||
|
||||
$regularBalanceDr = $regularBalanceResult->regular_balance_dr;
|
||||
$regularBalanceCr = $regularBalanceResult->regular_balance_cr;
|
||||
|
||||
return array(
|
||||
'dr_total' => $drTotal,
|
||||
'cr_total' => $crTotal,
|
||||
'dr_balance' => $drBalance,
|
||||
'cr_balance' => $crBalance,
|
||||
'opening_balance_dr' => $openingBalanceDr,
|
||||
'opening_balance_cr' => $openingBalanceCr,
|
||||
'regular_balance_dr' => $regularBalanceDr,
|
||||
'regular_balance_cr' => $regularBalanceCr,
|
||||
);
|
||||
}
|
||||
}
|
100
account/application/libraries/Numbertoword.php
Normal file
100
account/application/libraries/Numbertoword.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
class numbertoword
|
||||
{
|
||||
//Free number to Nepali word converter by http://pujann.com.np
|
||||
//GPU License
|
||||
private function check_valid_number($nums)
|
||||
{// use $nums > PHP_INT_MAX if error occurred for large numbers
|
||||
if($nums>9900000000000)
|
||||
{
|
||||
throw new Exception("गणकले गन्न सक्ने भन्दा बढी नम्बर हाल्नुभो");
|
||||
|
||||
}
|
||||
}
|
||||
private $number_list = array('एक', 'दुइ', 'तीन', 'चार', 'पाँच', 'छ', 'सात', 'आठ', 'नौ', 'दश', 'एघार', 'बाह्र', 'तेर', 'चौध', 'पन्ध्र', 'सोर्ह', 'सत्र', 'अठार', 'उन्नाइस', 'बीस','एक्काइस', 'बाईस', 'तेइस', 'चौबिस', 'पच्चीस', 'छब्बीस', 'सत्ताइस', 'अठ्ठाइस', 'उन्नतीस', 'तीस', 'एक्तीस', 'बत्तीस', 'तेत्तीस', 'चौतीस', 'पैतिस', 'छत्तिस', ' सड्तीस', 'अड्तीस', 'उन्नचालीस', 'चालीस','एकचालीस', 'ब्यालीस', 'त्रीचालीस', 'चौबालीस', 'पैतालीस', 'छ्यालीस', 'सड्चालीट्ठ', 'अड्चालीस', 'उन्नपचास', 'पचास', 'एकाउन्न', 'बाउन्न', 'त्रीपन्न', 'चौबन्न', 'पच्पन्न', 'छप्पन्न', 'सन्ताउन्न', 'अन्ठाउन्न', 'उनन्साठ्ठी', 'साठी','एकसाठी', 'ब्यासठ्ठी', 'त्रीसठ्ठी', 'चौसठ्ठी', 'पैसठ्ठी', 'छ्यासठ्ठी', 'सड्सठ्ठी', 'अठ्सठ्ठी', 'उन्नसत्तरी', 'सत्तरी', 'एकत्तर', 'बहत्तर', 'त्रीयत्तर', 'चौरत्तर', 'पचत्तर', 'छ्यातर', 'सत्तर', 'अठ्अार', 'उन्नअसी', 'असी','एकासी', 'बयासी', 'त्रीरासी', 'चौरासी', 'पचासी', 'छ्यासी', 'सतासी', 'अठासी', 'उनानब्बे', 'नब्बे', 'एकानब्बे', 'बयानब्बे', 'त्रीयानब्बे', 'चौरानब्बे', 'पञ्चानब्बे', 'छ्यानब्बे', 'सन्तानब्बे', 'अन्ठानब्बे', 'उनान्सय');
|
||||
private $mainlist = array('100000000000'=>'खरव', '1000000000'=>'अरव', '10000000'=>'करोड', '100000'=>'लाख', '1000'=>'हजार', '100'=>'सय');
|
||||
private $eng_number_list = array("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty", "Twenty One", "Twenty Two", "Twenty Three", "Twenty Four", "Twenty Five", "Twenty Six", "Twenty Seven", "Twenty Eight", "Twenty Nine", "Thirty", "Thirty One", "Thirty Two", "Thirty Three", "Thirty Four", "Thirty Five", "Thirty Six", "Thirty Seven", "Thirty Eight", "Thirty Nine", "Fourty", "Fourty One", "Fourty Two", "Fourty Three", "Fourty Four", "Fourty Five", "Fourty Six", "Fourty Seven", "Fourty Eight", "Fourty Nine", "Fifty", "Fifty One", "Fifty Two", "Fifty Three", "Fifty Four", "Fifty Five", "Fifty Six", "Fifty Seven", "Fifty Eight", "Fifty Nine", "Sixty", "Sixty One", "Sixty Two", "Sixty Three", "Sixty Four", "Sixty Five", "Sixty Six", "Sixty Seven", "Sixty Eight", "Sixty Nine", "Seventy", "Seventy One", "Seventy Two", "Seventy Three", "Seventy Four", "Seventy Five", "Seventy Six", "Seventy Seven", "Seventy Eight", "Seventy Nine", "Eighty", "Eighty One", "Eighty Two", "Eighty Three", "Eighty Four", "Eighty Five", "Eighty Six", "Eighty Seven", "Eighty Eight", "Eighty Nine", "Ninety", "Ninety One", "Ninety Two", "Ninety Three", "Ninety Four", "Ninety Five", "Ninety Six", "Ninety Seven", "Ninety Eight","Ninety Nine");
|
||||
private $eng_mainlist = array('100000000000'=>'Kharba', '1000000000'=>'Arba', '10000000'=>'Karod', '100000'=>'Lakh', '1000'=>'Thousands', '100'=>'Hundred');
|
||||
private function ten($nums)
|
||||
{
|
||||
if ($nums>0) {
|
||||
return $this->number_list[$nums-1];
|
||||
}
|
||||
}
|
||||
private function eng_ten($nums)
|
||||
{
|
||||
if ($nums>0) {
|
||||
return $this->eng_number_list[$nums-1];
|
||||
}
|
||||
}
|
||||
private function nepali_name($nums, $divident)
|
||||
{
|
||||
$number = floor($nums/$divident);
|
||||
if($number>0)
|
||||
{
|
||||
return $this->number_list[$number-1].' '.$this->mainlist[$divident];
|
||||
}
|
||||
}
|
||||
public function nepali_word($nums)
|
||||
{
|
||||
$n=explode(".",$nums);
|
||||
$nums = abs($nums);
|
||||
$this->check_valid_number($nums);
|
||||
$result = '';
|
||||
$coll="";
|
||||
foreach ($this->mainlist as $count => $name)
|
||||
{
|
||||
$result.= $this->nepali_name($nums, $count).' ';
|
||||
$nums = bcmod($nums,$count);
|
||||
if($nums<=99)
|
||||
{
|
||||
$result.= $this->ten($nums);
|
||||
$coll=$result;
|
||||
}
|
||||
}
|
||||
if(isset($n[1]))$coll.=" रुपैयाँ ".$this->ten($n[1])." पैसा";
|
||||
return $coll." मात्र";
|
||||
}
|
||||
private function english_name($nums, $divident)
|
||||
{
|
||||
$number = floor($nums/$divident);
|
||||
if($number>0)
|
||||
{
|
||||
return $this->eng_number_list[$number-1].' '.$this->eng_mainlist[$divident];
|
||||
}
|
||||
}
|
||||
public function english_word($nums)
|
||||
{
|
||||
$n=explode(".",$nums);
|
||||
$nums=$n[0];
|
||||
$nums = abs($nums);
|
||||
$this->check_valid_number($nums);
|
||||
$result = '';
|
||||
$coll='';
|
||||
foreach ($this->eng_mainlist as $count => $name)
|
||||
{
|
||||
$result.= $this->english_name($nums, $count).' ';
|
||||
$nums = bcmod($nums,$count);
|
||||
if($nums<=99)
|
||||
{
|
||||
$result.= $this->eng_ten($nums);
|
||||
$coll=$result;
|
||||
}
|
||||
}
|
||||
if(isset($n[1]))$coll.=" And ".$this->eng_decimal_part($n[1])." Paisa";
|
||||
return $coll." Only";
|
||||
}
|
||||
private function eng_decimal_part($decimal)
|
||||
{
|
||||
return $this->eng_ten($decimal);
|
||||
/* //IF WANT TO RETURN 68 Paisa as SIX EIGHT Paisa
|
||||
$digits=str_split($decimal);
|
||||
$n="";
|
||||
foreach($digits as $d)
|
||||
{
|
||||
$n.=$this->eng_number_list[$d-1]." ";
|
||||
}
|
||||
return $n;
|
||||
*/
|
||||
}
|
||||
}
|
11
account/application/libraries/index.html
Normal file
11
account/application/libraries/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
11
account/application/logs/index.html
Normal file
11
account/application/logs/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
68
account/application/models/MAttendance.php
Normal file
68
account/application/models/MAttendance.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
class MAttendance extends CI_Model
|
||||
{
|
||||
function getAttendance()
|
||||
{
|
||||
//echo "select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status='1'";
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status=1")->result();
|
||||
//pre($TableData);die;
|
||||
return $TableData;
|
||||
}
|
||||
function getAttendance1()
|
||||
{
|
||||
//echo "select * from tbl_attendances where attendance_date='".date('Y-m-d')."' and status='1'";
|
||||
if(isset($_GET['attendance_date'])){
|
||||
|
||||
$adate=NepaliToEnglishDate($_GET['attendance_date']);
|
||||
}else {
|
||||
$adate=date('Y-m-d');
|
||||
}
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date='".$adate."'")->result();
|
||||
//pre($TableData);die;
|
||||
return $TableData;
|
||||
}
|
||||
function insertAttendance($TableData1)
|
||||
{
|
||||
|
||||
$this->db->insert('tbl_attendances',$TableData1);
|
||||
}
|
||||
|
||||
function getDateRangeAttendance($from,$to,$id){
|
||||
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id group by attendance_date")->result();
|
||||
// foreach($TableData as $tabledata){
|
||||
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
|
||||
// }
|
||||
//pre($TableData);die;
|
||||
return $TableData;
|
||||
|
||||
}
|
||||
|
||||
function getPresentDateRangeAttendance($from,$to,$id){
|
||||
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id and attendance=1 and status=1")->result();
|
||||
// foreach($TableData as $tabledata){
|
||||
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
|
||||
// }
|
||||
//pre($TableData);die;
|
||||
return $TableData;
|
||||
|
||||
}
|
||||
function getAbsentDateRangeAttendance($from,$to,$id){
|
||||
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' and employee_id=$id and attendance=0 and status=1")->result();
|
||||
// foreach($TableData as $tabledata){
|
||||
// $tabledata->employee=$this->db->query("select * from tbl_employees where employee_id=".$tabledata->employee_id)->row();
|
||||
// }
|
||||
//pre($TableData);die;
|
||||
return $TableData;
|
||||
|
||||
}
|
||||
function getDaysOfRangeAttendance($from,$to){
|
||||
// $t="select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' GROUP BY attendance_date ";
|
||||
//echo $t;die;
|
||||
$TableData=$this->db->query("select * from tbl_attendances where attendance_date>='".$from."' and attendance_date<='".$to."' GROUP BY attendance_date ")->result();
|
||||
return $TableData;
|
||||
}
|
||||
|
||||
}
|
55
account/application/models/MEmployees.php
Normal file
55
account/application/models/MEmployees.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
class MEmployees extends CI_Model
|
||||
{
|
||||
function getDepartments()
|
||||
{
|
||||
$TableData=$this->db->query("select * from tbl_departments where status='1'")->result();
|
||||
return $TableData;
|
||||
}
|
||||
function getDepartmentByAlias($department_alias)
|
||||
{
|
||||
$department_alias=str_replace("_","-",$department_alias);
|
||||
$t="SELECT * FROM tbl_departments WHERE department_alias='$department_alias'";
|
||||
// echo $t;
|
||||
$TableData=$this->db->query($t)->row();
|
||||
return $TableData;
|
||||
}
|
||||
function prepareEmployee($Employee)
|
||||
{
|
||||
$Employee->Type=$this->db->query("select * from tbl_employeetype where employeetype_id='$Employee->employeetype_id'")->row();
|
||||
$Employee->Department=$this->db->query("select * from tbl_departments where department_id='$Employee->department_id'")->row();
|
||||
return $Employee;
|
||||
}
|
||||
function getEmployee($employee_id)
|
||||
{
|
||||
$TableData=$this->db->query("select * from tbl_employees where employee_id='$employee_id'")->row();
|
||||
return $this->prepareEmployee($TableData);
|
||||
}
|
||||
function getEmployees($employeetype_id="",$department_id="")
|
||||
{
|
||||
$t="select * from tbl_employees where status=1";
|
||||
if($employeetype_id!="") $t.=" and employeetype_id='$employeetype_id'";
|
||||
if($department_id!="") $t.=" and department_id='$department_id'";
|
||||
$TableData=$this->db->query($t)->result();
|
||||
foreach ($TableData as $T)
|
||||
{
|
||||
$T=$this->prepareEmployee($T);
|
||||
}
|
||||
return $TableData;
|
||||
}
|
||||
function getSalaryAllocations()
|
||||
{
|
||||
$TableData= $this->db->query("select * from tbl_salaryallocations where status=1")->result();
|
||||
foreach($TableData as $T)
|
||||
{
|
||||
$T->Employee=$this->prepareEmployee($this->getEmployee($T->employee_id));
|
||||
$T->SalaryType=$this->db->query("select * from tbl_salarytypes where salarytype_id='$T->salarytype_id'")->row();
|
||||
}
|
||||
return $TableData;
|
||||
}
|
||||
function getWorkshifts()
|
||||
{
|
||||
$TableData= $this->db->query("select * from tbl_workshifts where status=1")->result();
|
||||
return $TableData;
|
||||
}
|
||||
}
|
62
account/application/models/MHelper.php
Normal file
62
account/application/models/MHelper.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
class MHelper extends CI_Model{
|
||||
function checkIfAliasExist($alias,$alias_name,$table){
|
||||
$this->db->where($alias_name,$alias);
|
||||
$exist=$this->db->get($table);
|
||||
if ($exist->num_rows()>0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
function getMaxDisplayOrder($table){
|
||||
$this->db->select_max('display_order');
|
||||
return $this->db->get($table)->row()->display_order;
|
||||
}
|
||||
|
||||
function getHolidayByDaterangeInFactory($from_date,$to_date){
|
||||
$t="select * from tbl_factorycalendar where day_work=0 and day_ad>='$from_date' and day_ad<='$to_date' ";
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalDaysByDaterange($from_date,$to_date){
|
||||
$t="select * from tbl_factorycalendar where day_ad>='$from_date' and day_ad<='$to_date' ";
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalPresentsDaysByDaterange($from_date,$to_date,$id){
|
||||
$t="select * from tbl_attendances where attendance=1 and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
|
||||
//echo $t;die;
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalPaidLeavesByDaterange($from_date,$to_date,$id){
|
||||
$t="select * from tbl_attendances where attendance=0 and reason='PL' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
|
||||
//echo $t;die;
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalUnPaidLeavesByDaterange($from_date,$to_date,$id){
|
||||
$t="select * from tbl_attendances where attendance=0 and reason='Off' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
|
||||
//echo $t;die;
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalAnnualLeavesByDaterange($from_date,$to_date,$id){
|
||||
$t="select * from tbl_attendances where attendance=0 and reason='SV' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
|
||||
//echo $t;die;
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
function getTotalSickLeavesByDaterange($from_date,$to_date,$id){
|
||||
$t="select * from tbl_attendances where attendance=0 and reason='SL' and employee_id=$id and attendance_date>='$from_date' and attendance_date<='$to_date' group by attendance_date";
|
||||
//echo $t;die;
|
||||
//echo $t;die;
|
||||
|
||||
return $this->db->query($t)->result();
|
||||
}
|
||||
}
|
0
account/application/models/MPassword.php
Normal file
0
account/application/models/MPassword.php
Normal file
65
account/application/models/MPurchases.php
Normal file
65
account/application/models/MPurchases.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
class MPurchases extends CI_Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getTotalPurchaseAmount($purchase_id)
|
||||
{
|
||||
$PurchaseRecords = $this->db->where("status", 1)->where("purchases_id", $purchase_id)->get("tbl_purchasedetails")->result();
|
||||
$total = 0;
|
||||
foreach ($PurchaseRecords as $PurchaseRecord) {
|
||||
$total = $total + ($PurchaseRecord->qty) * ($PurchaseRecord->rate);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
public function getPurchase()
|
||||
{
|
||||
$Purchase = $this->db->where("status", 1)->get("tbl_purchases")->result();
|
||||
foreach ($Purchase as $Sale) {
|
||||
$Sale->Details = $this->getPurchaseDetails($Sale->purchase_id);
|
||||
}
|
||||
return $Purchase;
|
||||
}
|
||||
public function getPurchaseDetails($purchase_id = 0)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
if ($purchase_id != 0) {
|
||||
$this->db->where("purchases_id", $purchase_id);
|
||||
}
|
||||
$PurchaseRecords = $this->db->get("tbl_purchasedetails")->result();
|
||||
$total = 0;
|
||||
foreach ($PurchaseRecords as $PurchaseRecord) {
|
||||
$PurchaseRecord->Purchase = $this->db->where("purchase_id", $PurchaseRecord->purchases_id)->get("tbl_purchases")->row();
|
||||
$PurchaseRecord->Item = $this->db->where("item_id", $PurchaseRecord->items_id)->get("tbl_items")->row();
|
||||
$PurchaseRecord->Account = $this->db->where("account_id", $PurchaseRecord->Purchase->accounts_id)->get("tbl_accounts")->row();
|
||||
$total = $total + ($PurchaseRecord->qty) * ($PurchaseRecord->rate);
|
||||
$PurchaseRecord->TotalPurchase = $total;
|
||||
}
|
||||
return $PurchaseRecords;
|
||||
}
|
||||
public function getPurchaseRecords()
|
||||
{
|
||||
$PurchaseRecords = $this->db->where("status", 1)->get("tbl_purchases")->result();
|
||||
foreach ($PurchaseRecords as $PurchaseRecord) {
|
||||
$PurchaseRecord->Details = $this->getPurchaseDetails($PurchaseRecord->purchase_id);
|
||||
$PurchaseRecord->TotalPurchase = $this->getTotalPurchaseAmount($PurchaseRecord->purchase_id);
|
||||
}
|
||||
return $PurchaseRecords;
|
||||
}
|
||||
public function getItemPurchases($item_id = 0)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
if ($item_id != 0) {
|
||||
$this->db->where("items_id", $item_id);
|
||||
}
|
||||
$this->db->select('items_id, AVG(rate) as average_rate, SUM(qty) as total_qty, SUM(rate * qty) as line_total');
|
||||
$this->db->group_by('items_id');
|
||||
$PurchaseRecords = $this->db->get('tbl_purchasedetails')->result();
|
||||
foreach ($PurchaseRecords as $PurchaseRecord) {
|
||||
$PurchaseRecord->Item = $this->db->where("item_id", $PurchaseRecord->items_id)->get("tbl_items")->row();
|
||||
}
|
||||
return $PurchaseRecords;
|
||||
}
|
||||
}
|
66
account/application/models/MSales.php
Normal file
66
account/application/models/MSales.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
class MSales extends CI_Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getTotalSalesAmount($sales_id)
|
||||
{
|
||||
$SalesRecords = $this->db->where("status", 1)->where("sales_id", $sales_id)->get("tbl_salesdetails")->result();
|
||||
$total = 0;
|
||||
foreach ($SalesRecords as $SalesRecord) {
|
||||
$total = $total + ($SalesRecord->qty) * ($SalesRecord->rate);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
public function getSales()
|
||||
{
|
||||
$Sales = $this->db->where("status", 1)->get("tbl_sales")->result();
|
||||
foreach ($Sales as $Sale) {
|
||||
$Sale->Details = $this->getSalesDetails($Sale->sales_id);
|
||||
}
|
||||
return $Sales;
|
||||
}
|
||||
public function getSalesDetails($sales_id = 0)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
if ($sales_id != 0) {
|
||||
$this->db->where("sales_id", $sales_id);
|
||||
}
|
||||
$SalesRecords = $this->db->get("tbl_salesdetails")->result();
|
||||
$total = 0;
|
||||
foreach ($SalesRecords as $SalesRecord) {
|
||||
$SalesRecord->Sales = $this->db->where("sales_id", $SalesRecord->sales_id)->get("tbl_sales")->row();
|
||||
$SalesRecord->Account = $this->db->where("account_id", $SalesRecord->Sales->accounts_id)->get("tbl_accounts")->row();
|
||||
$SalesRecord->Item = $this->db->where("item_id", $SalesRecord->items_id)->get("tbl_items")->row();
|
||||
$total = $total + ($SalesRecord->qty) * ($SalesRecord->rate);
|
||||
$SalesRecord->TotalSales = $total;
|
||||
}
|
||||
return $SalesRecords;
|
||||
}
|
||||
public function getSalesRecords()
|
||||
{
|
||||
$SalesRecords = $this->db->where("status", 1)->get("tbl_sales")->result();
|
||||
foreach ($SalesRecords as $SalesRecord) {
|
||||
$SalesRecord->Details = $this->getSalesDetails($SalesRecord->sales_id);
|
||||
$SalesRecord->totalsales = $this->getTotalSalesAmount($SalesRecord->sales_id);
|
||||
}
|
||||
return $SalesRecords;
|
||||
}
|
||||
public function getItemSales($sales_id = 0)
|
||||
{
|
||||
$this->db->select('items_id, AVG(rate) as average_rate, SUM(qty) as total_qty, SUM(qty * rate) as line_total');
|
||||
$this->db->from('tbl_salesdetails');
|
||||
if ($sales_id != 0) {
|
||||
$this->db->where('sales_id', $sales_id);
|
||||
}
|
||||
$this->db->group_by('items_id');
|
||||
$query = $this->db->get();
|
||||
$SalesRecords=$query->result();
|
||||
foreach ($SalesRecords as $SalesRecord) {
|
||||
$SalesRecord->Item = $this->db->where("item_id", $SalesRecord->items_id)->get("tbl_items")->row();
|
||||
}
|
||||
return $SalesRecords;
|
||||
}
|
||||
}
|
211
account/application/models/MStocks.php
Normal file
211
account/application/models/MStocks.php
Normal file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
class MStocks extends CI_Model
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function isDeleteable($item_id)
|
||||
{
|
||||
$this->db->where("items_id", $item_id);
|
||||
$t = $this->db->get("tbl_salesdetails")->row();
|
||||
if ($t) return false;
|
||||
$this->db->where("items_id", $item_id);
|
||||
$t = $this->db->get("tbl_purchasedetails")->row();
|
||||
if ($t) return false;
|
||||
return true;
|
||||
}
|
||||
public function deleteOpeningStock($item_id)
|
||||
{
|
||||
$this->db->where("items_id", $item_id);
|
||||
$this->db->delete("tbl_stocks");
|
||||
}
|
||||
public function updateOpeningStock($item_id, $qty, $rate)
|
||||
{
|
||||
$this->db->where("items_id", $item_id);
|
||||
$this->db->delete("tbl_stocks");
|
||||
$this->db->insert("tbl_stocks", [
|
||||
'stocklocations_id' => 1,
|
||||
'ref_id' => 0,
|
||||
"title" => "Opening Stock",
|
||||
"items_id" => $item_id,
|
||||
"qty" => $qty,
|
||||
'price' => $rate,
|
||||
'status' => 1,
|
||||
'created_on' => date("y-m-d H:i:s")
|
||||
]);
|
||||
}
|
||||
public function addOpeningStock($item_id, $qty, $rate)
|
||||
{
|
||||
$this->db->insert("tbl_stocks", [
|
||||
'stocklocations_id' => 1,
|
||||
'ref_id' => 0,
|
||||
"title" => "Opening Stock",
|
||||
"items_id" => $item_id,
|
||||
"qty" => $qty,
|
||||
'price' => $rate,
|
||||
'status' => 1,
|
||||
'created_on' => date("y-m-d H:i:s")
|
||||
]);
|
||||
}
|
||||
public function getSellableItems()
|
||||
{
|
||||
$subquery = "(SELECT SUM(qty) FROM tbl_stocks WHERE item_id = tbl_items.item_id) AS total_qty";
|
||||
$this->db->select("tbl_items.*, $subquery", false);
|
||||
$this->db->having('total_qty >', 0);
|
||||
return $this->db->get("tbl_items")->result();
|
||||
}
|
||||
|
||||
public function getItemSalesStock($item_id)
|
||||
{
|
||||
|
||||
$this->db->where("status", 1);
|
||||
$this->db->where("items_id", $item_id);
|
||||
// $this->db->where("title='Opening Stock'");
|
||||
$Items = $this->db->get("tbl_salesdetails")->result();
|
||||
$qty = 0;
|
||||
$rate = 0;
|
||||
$nos = 0;
|
||||
foreach ($Items as $Item) {
|
||||
$qty += $Item->qty;
|
||||
$nos++;
|
||||
$rate += $Item->rate;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
|
||||
$SalesStock = new stdClass;
|
||||
$SalesStock->qty = $qty;
|
||||
$SalesStock->rate = $rate;
|
||||
$SalesStock->amount = $qty * $rate;
|
||||
return $SalesStock;
|
||||
}
|
||||
public function getItemPurchaseStock($item_id)
|
||||
{
|
||||
|
||||
$this->db->where("status", 1);
|
||||
$this->db->where("items_id", $item_id);
|
||||
// $this->db->where("title='Opening Stock'");
|
||||
$Items = $this->db->get("tbl_purchasedetails")->result();
|
||||
$qty = 0;
|
||||
$rate = 0;
|
||||
$nos = 0;
|
||||
foreach ($Items as $Item) {
|
||||
$qty += $Item->qty;
|
||||
$nos++;
|
||||
$rate += $Item->rate;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
$PurchaseStock = new stdClass;
|
||||
$PurchaseStock->qty = $qty;
|
||||
$PurchaseStock->rate = $rate;
|
||||
$PurchaseStock->amount = $qty * $rate;
|
||||
return $PurchaseStock;
|
||||
}
|
||||
|
||||
public function getOpeningStock($item_id)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
$this->db->where("items_id", $item_id);
|
||||
$this->db->where("title='Opening Stock'");
|
||||
$Items = $this->db->get("tbl_stocks")->result();
|
||||
$qty = 0;
|
||||
$rate = 0;
|
||||
$nos = 0;
|
||||
foreach ($Items as $Item) {
|
||||
$qty += $Item->qty;
|
||||
$nos++;
|
||||
$rate += $Item->price;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
$OpeningStock = new stdClass;
|
||||
$OpeningStock->qty = $qty;
|
||||
$OpeningStock->rate = $rate;
|
||||
$OpeningStock->amount = $qty * $rate;
|
||||
return $OpeningStock;
|
||||
}
|
||||
public function getClosingStock($item_id)
|
||||
{
|
||||
$OpeningStock=$this->getOpeningStock($item_id);
|
||||
$PurchaseStock=$this->getItemPurchaseStock($item_id);
|
||||
$SalesStock=$this->getItemSalesStock($item_id);
|
||||
$ClosingStock = new stdClass;
|
||||
$ClosingStock->qty =$PurchaseStock->qty+$OpeningStock->qty-$SalesStock->qty;
|
||||
$ClosingStock->rate = $PurchaseStock->rate+$OpeningStock->rate-$SalesStock->rate;
|
||||
$ClosingStock->amount = $ClosingStock->qty * $ClosingStock->rate;
|
||||
return $ClosingStock;
|
||||
}
|
||||
public function getStockItemSummary($item_id)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
$this->db->where("items_id", $item_id);
|
||||
$Item = $this->db->get("tbl_stocks")->row();
|
||||
$qty = 0;
|
||||
$price = 0;
|
||||
$Item->Item = $this->db->where("item_id", $item_id)->get("tbl_items")->row();
|
||||
$Item->qty = $this->db->where("items_id", $item_id)->select("sum(qty) as qty")->get("tbl_stocks")->row()->qty;
|
||||
$Item->amount = $this->db->where("items_id", $item_id)->select("sum(price * qty) as amount")->get("tbl_stocks")->row()->amount;
|
||||
$Item->Opening = $this->getOpeningStock($item_id);
|
||||
$Item->Purchase = $this->getItemPurchaseStock($item_id);
|
||||
$Item->Sales = $this->getItemSalesStock($item_id);
|
||||
$Item->Closing = $this->getClosingStock($item_id);
|
||||
return $Item;
|
||||
}
|
||||
public function getStockSummary($stocklocation_id = 0)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
if ($stocklocation_id != 0) {
|
||||
$this->db->where("stocklocations_id", $stocklocation_id);
|
||||
}
|
||||
$StockRecords = $this->db->select("distinct(items_id) as items_id")->get("tbl_stocks")->result();
|
||||
foreach ($StockRecords as $StockRecord) {
|
||||
$StockRecord->Summary = $this->getStockItemSummary($StockRecord->items_id);
|
||||
// $StockRecord->StockLocation = $this->db->where("stocklocation_id", $StockRecord->stocklocations_id)->get("tbl_stocklocations")->row();
|
||||
$StockRecord->Item = $this->db->where("item_id", $StockRecord->items_id)->get("tbl_items")->row();
|
||||
}
|
||||
return $StockRecords;
|
||||
}
|
||||
public function getStockRecords($stocklocation_id = 0)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
if ($stocklocation_id != 0) {
|
||||
$this->db->where("stocklocations_id", $stocklocation_id);
|
||||
}
|
||||
$StockRecords = $this->db->get("tbl_stocks")->result();
|
||||
foreach ($StockRecords as $StockRecord) {
|
||||
$StockRecord->StockLocation = $this->db->where("stocklocation_id", $StockRecord->stocklocations_id)->get("tbl_stocklocations")->row();
|
||||
$StockRecord->Item = $this->db->where("item_id", $StockRecord->items_id)->get("tbl_items")->row();
|
||||
$StockRecord->Item->Unit = $this->db->where("unit_id", $StockRecord->Item->units_id)->get("tbl_units")->row();
|
||||
}
|
||||
return $StockRecords;
|
||||
}
|
||||
public function addPurchaseToStock($PurchaseDetails)
|
||||
{
|
||||
foreach ($PurchaseDetails as $PurchaseDetail) {
|
||||
$TableData = array(
|
||||
'stocklocations_id' => 1,
|
||||
'ref_id' => $PurchaseDetail->purchases_id,
|
||||
'title' => "Purchase",
|
||||
'items_id' => $PurchaseDetail->items_id,
|
||||
'qty' => $PurchaseDetail->qty,
|
||||
'price' => $PurchaseDetail->rate,
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert("tbl_stocks", $TableData);
|
||||
}
|
||||
}
|
||||
public function addSalesToStock($SalesDetails)
|
||||
{
|
||||
foreach ($SalesDetails as $SalesDetail) {
|
||||
$TableData = array(
|
||||
'stocklocations_id' => 1,
|
||||
'ref_id' => $SalesDetail->sales_id,
|
||||
'title' => "Sales",
|
||||
'items_id' => $SalesDetail->items_id,
|
||||
'qty' => (-$SalesDetail->qty),
|
||||
'price' => $SalesDetail->rate,
|
||||
'status' => 1,
|
||||
);
|
||||
$this->db->insert("tbl_stocks", $TableData);
|
||||
}
|
||||
}
|
||||
}
|
33
account/application/models/MUsers.php
Normal file
33
account/application/models/MUsers.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class MUsers extends CI_Model{
|
||||
function addUser($input){
|
||||
$this->db->insert('tbl_users',$input);
|
||||
}
|
||||
function updateUser($input,$id){
|
||||
$this->db->where('user_id',$id);
|
||||
$this->db->update('tbl_users',$input);
|
||||
}
|
||||
function getUsers($id=''){
|
||||
if ($id!=''){
|
||||
$this->db->where('user_id',$id);
|
||||
}
|
||||
$this->db->where('status', 1);
|
||||
$this->db->or_where('status', 2);
|
||||
$result=$this->db->get('tbl_users');
|
||||
if ($id!=''){
|
||||
return $result->row();
|
||||
}
|
||||
return $result->result();
|
||||
}
|
||||
function getUserById($id){
|
||||
$this->db->where('user_id',$id);
|
||||
return $this->db->get('tbl_users')->row();
|
||||
}
|
||||
function deleteuser($id){
|
||||
$table="tbl_users";
|
||||
$this->db->where('user_id',$id);
|
||||
$input['status']=0;
|
||||
$this->db->update($table,$input);
|
||||
}
|
||||
}
|
11
account/application/models/index.html
Normal file
11
account/application/models/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
10
account/application/third_party/font/courier.php
vendored
Normal file
10
account/application/third_party/font/courier.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
10
account/application/third_party/font/courierb.php
vendored
Normal file
10
account/application/third_party/font/courierb.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
10
account/application/third_party/font/courierbi.php
vendored
Normal file
10
account/application/third_party/font/courierbi.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-BoldOblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
10
account/application/third_party/font/courieri.php
vendored
Normal file
10
account/application/third_party/font/courieri.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-Oblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
21
account/application/third_party/font/helvetica.php
vendored
Normal file
21
account/application/third_party/font/helvetica.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
|
||||
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
||||
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
|
||||
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
21
account/application/third_party/font/helveticab.php
vendored
Normal file
21
account/application/third_party/font/helveticab.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
|
||||
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
|
||||
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
|
||||
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user