FIX_RIA V1.2 IN CI4

This commit is contained in:
VE10-Sanjeev 2024-05-06 03:47:37 +00:00
parent d1c8f65800
commit 1c556921a0
6974 changed files with 602846 additions and 584677 deletions

82
.gitignore vendored Executable file
View File

@ -0,0 +1,82 @@
# IDE and editor files
.idea/
*.sublime-*
*.swp
.vscode/
# Unit test reports
TEST*.xml
# OS X
.DS_Store
.AppleDouble
.LSOverride
# Windows image file caches
Thumbs.db
ehthumbs.db
Desktop.ini
# Applications
*.app
*.exe
*.war
# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv
# Don't save phpunit under version control.
phpunit
phpunit*.xml
/.phpunit.*.cache
# Ignore system folder
/system/
#-------------------------
# Environment Files
#-------------------------
# These should never be under version control,
# as it poses a security risk.
.env
.vagrant
.env.*
#-------------------------
# Temporary Files
#-------------------------
writable/cache/*
!writable/cache/index.html
writable/logs/*
!writable/logs/index.html
writable/session/*
!writable/session/index.html
writable/uploads/*
!writable/uploads/index.html
writable/debugbar/*
!writable/debugbar/.gitkeep
writable/**/*.db
writable/**/*.sqlite
php_errors.log
public/uploads/*
!public/uploads/index.html
#-------------------------
# Composer
#-------------------------
!vendor/
composer.lock
tests

56
.htaccess Executable file → Normal file
View File

@ -1,7 +1,49 @@
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|img|css|downloads|jquery|js|grocery_curd|scss|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
# Disable directory browsing
Options -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>trunk</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
<nature>com.aptana.editor.php.phpNature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
{
"git.ignoreLimitWarning": true
}

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014-2019 British Columbia Institute of Technology
Copyright (c) 2019-2024 CodeIgniter Foundation
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.

61
README.md Executable file → Normal file
View File

@ -1,7 +1,60 @@
**Employee Account :**
# CodeIgniter 4 Framework
email : venbatechnologies@gmail.com
## What is CodeIgniter?
password : resicovenba
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
More information can be found at the [official site](https://codeigniter.com).
To clone this use "git clone https://saravanakumar_kandasami@bitbucket.org/venbainformationtechnology/siddharth_application.git (your own link)"
This repository holds the distributable version of the framework.
It has been built from the
[development repository](https://github.com/codeigniter4/CodeIgniter4).
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
You can read the [user guide](https://codeigniter.com/user_guide/)
corresponding to the latest version of the framework.
## Important Change with index.php
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
for better security and separation of components.
This means that you should configure your web server to "point" to your project's *public* folder, and
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
framework are exposed.
**Please** read the user guide for a better explanation of how CI4 works!
## Repository Management
We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
FEATURE REQUESTS.
This repository is a "distribution" one, built by our release preparation script.
Problems with it can be raised on our forum, or as issues in the main repository.
## Contributing
We welcome contributions from the community.
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/CONTRIBUTING.md) section in the development repository.
## Server Requirements
PHP version 8.1 or higher is required, with the following extensions installed:
- [intl](http://php.net/manual/en/intl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
> [!WARNING]
> The end of life date for PHP 7.4 was November 28, 2022.
> The end of life date for PHP 8.0 was November 26, 2023.
> If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
> The end of life date for PHP 8.1 will be November 25, 2024.
Additionally, make sure that the following extensions are enabled in your PHP:
- json (enabled by default - don't turn it off)
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library

6
app/.htaccess Normal file
View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

15
app/Common.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/

205
app/Config/App.php Normal file
View File

@ -0,0 +1,205 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\FileHandler;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL = 'http://localhost/ci4/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
// public string $indexPage = 'index.php';
public string $indexPage = '';
/**
* --------------------------------------------------------------------------
* 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!
*/
// public string $uriProtocol = 'REQUEST_URI';
public $uriProtocol = 'PATH_INFO';
/*
|--------------------------------------------------------------------------
| 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~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = false;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string>
*/
public array $supportedLocales = ['en'];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/
public $appTimezone = 'Asia/Kolkata';
/**
* --------------------------------------------------------------------------
* 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.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security (HSTS) header will be set.
*/
public bool $forceGlobalSecureRequests = 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
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false;
public $displayFrameworkIcon = false;
}

94
app/Config/Autoload.php Normal file
View File

@ -0,0 +1,94 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [ 'App' => APPPATH,
APP_NAMESPACE => APPPATH,
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = ['datetime','cias','purchaseorder'];
}

View File

@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

View File

@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,20 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

171
app/Config/Cache.php Normal file
View File

@ -0,0 +1,171 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, int|string|null>
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, bool|int|string>
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, int|string|null>
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: 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.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
}

380
app/Config/Constants.php Normal file
View File

@ -0,0 +1,380 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| 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') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);
define('FOPEN_READ','rb');
define('FOPEN_READ_WRITE','r+b');
define('FOPEN_WRITE_CREATE_DESTRUCTIVE','wb'); // truncates existing file data, use with care
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE','w+b'); // truncates existing file data, use with care
define('FOPEN_WRITE_CREATE','ab');
define('FOPEN_READ_WRITE_CREATE','a+b');
define('FOPEN_WRITE_CREATE_STRICT','xb');
define('FOPEN_READ_WRITE_CREATE_STRICT','x+b');
/* USER DEFINED CONSTANTS */
define('ROLE_ADMIN','1');
define('ROLE_MANAGER','2');
define('ROLE_EMPLOYEE','3');
/*
define('ROLE_PRODUCTION','4');
define('ROLE_QUALITY','5');
define('ROLE_SECURITY','6');
define('ROLE_SALES','7');
define('ROLE_ACCOUNTS','8');
*/
/* USER DESIGNATION */
//define('SECURITY','SECURITY');
define('SEGMENT',2);
/* Requistion Status code */
define('REQ_DRAFT','ST001');
define('REQ_PENDING_APPROVAL','ST002');
define('REQITEM_NEW','ST003');
define('REQ_APPROVED','ST004');
define('REQ_PO_CREATED','ST005');
define('REQ_REJECTED','ST006');
define('REQ_CLOSED','ST007');
define('REQ_ONHOLD','ST008');
define('REQITEM_ONHOLD','ST009');
define('REQITEM_PARTIALLY_DELIVERED','ST010');
define('REQITEM_DELIVERED','ST011');
define('REQ_DELETED','ST013');
define('REQITEM_POCREATED','ST022');
define('REQITEM_PARTIALLY_PO_CREATED','ST023');
define('REQITEM_Emergency_PO_CREATED','ST024');
define('POLINEITEM_IGR_CREATED','ST040');
define('REQ_READYFORDELIVERY','ST049');
define('REQ_DELIVERED','ST050');
/* IGR Status */
define('IGR_CREATED','ST027');
define('IGR_CLOSED','ST028');
define('IGR_CANCELLED','ST029');
define('POLINEITEM_IGRPARTIAL_CREATED','ST042');
/* MRIR Status */
define('MRIR_CREATED','ST041');
define('MRIR_APPROVED', 'ST044');
define('MRIR_REJECTED', 'ST045');
define('PARTIAL_MRIRAPPROVED','ST054');
define('REQUISTSTATUS', '0');
define('REQUISTITEMSTATUS','1');
/* Purchase Order Status */
define('PO_DRAFT','ST014');
define('PO_CREATED','ST015');
define('PO_INPROGRESS','ST016');
define('PO_DISPATCHED','ST017');
define('PO_DELIVERED','ST018');
define('PO_CANCELLED','ST019');
define('PO_ONHOLD','ST020');
define('PO_CLOSED','ST021');
define('PO_AMENDED','ST030');
define('PO_RELEASED','ST026');
define('PO_AWAITING_RELEASE','ST025');
define('PO_APPROVED','ST025');
define('PO_APPROVER_ONHOLD','ST051');
define('PO_RELEASER_ONHOLD','ST052');
define('SPECIAL_PO','ST056');
/* Store Status */
define('STORE_DRAFT','ST043');
define('STORE_CREATED','ST015');
/* Store Requisition */
define('STORE REQUISTION STATUS','6');
define('STORE_OPEN','ST034');
define('STORE_PENDINGAPPROVAL','ST035');
define('STORE_APPROVAL','ST036');
define('STORE_ISSUSED','ST037');
define('STORE_PARTIALLYISSUSED','ST055');
define('STORE_ONHOLD','ST038');
define('STORE_REJECT','ST039');
/* OGR status */
define('OGR_COMPLETE','ST063');
define('OGR_PARTIAL_COMPLETE','ST064');
define('OGR_CREATED','ST068');
define('ST044','ST044');
define('OGR_NOT_CREATED','ST069');
define('PO','PO');
/* PO Master status update */
define('AMOUNT_PAID','ST057');
define('NO_PAID','ST058');
define('PARTIALLY_PAID','ST059');
define('AMOUNT_RECEIVED','ST065');
define('NO_RECEIVED','ST066');
define('PARTIALLY_RECEIVED', 'ST067');
define('AMOUNT_PAIDIGR','ST070');
define('PARTIALLY_PAIDIGR','ST071');
define('NO_PAIDIGR','ST072');
define('OPEN_ORDER_PO','ST073');
/* Work status code */
define('SERVICE_COMPLETED','ST046');
define('PO_SERVICE_COMPLETED','ST053');
/* Department Code */
define('ADMIN','DEP01');
define('QUALITY','DEP02');
define('STORE','DEP03');
define('SALES','DEP04');
define('PRODUCTION','DEP05');
define('DELIVERY','DEP06');
define('TRP','DEP07');
define('COATING','DEP08');
define('MAINTENANANCE','DEP09');
define('FINANCE','DEP10');
define('PURCHASE','DEP11');
define('MANAGEMENT','DEP12');
define('HR','DEP13');
define('SECURITY','DEP14');
define('SYSTEM_ADMIN','1');
/* PO Type */
define('REVENUE','REVENUE');
define('SERVICE','SERVICE');
define('IMPORT','IMPORT');
define('CAPITAL','CAPITAL');
/* Tax Type */
define('PERCENTAGE','PERCENTAGE');
define('LUMPSUM','LUMP SUM');
define('NILTYPE','NIL');
/* Freight Type */
define('PERUOM','PER UOM');
define('PERTRIP','PER TRIP');
/* Formula for Tax calculation */
/* Discount */
define('DIS_PERCENTAGE','((Discountval/100) * basicValue)');
define('DIS_LUMPSUM','Discountval');
/* Packaging */
define('PACKAGING_PERCENTAGE_BYDISCOUNTVALUE', '((Packagingvalue/100) * (basicValue-AfterDiscount))');
define('PACKAGING_PERCENTAGE_BYBASICVALUE','(Packagingvalue/100) * basicValue');
define('PACKAGING_LUMPSUM_BYDISCOUNTVALUE', 'Packagingvalue');
define('PACKAGING_LUMPSUM_BYBASICVALUE','Packagingvalue');
/* Excise */
define('EXCISE_ONBASICVALUE','((ExciseDuty/100) * basicValue)');
define('EXCISE_ONBASIC_DISCOUNT','((ExciseDuty/100) * (basicValue-AfterDiscount))');
define('EXCISE_ONBASIC_DISCOUNT_PACKAGING','((ExciseDuty/100) * ((basicValue-AfterDiscount)+ AfterPackaging))');
define('EXCISE_ONBASIC_PACKAGING','((ExciseDuty/100) * (basicValue + AfterPackaging))');
/* Vat */
define('VAT_ONBASICVALUE','((vatValue/100) * basicValue)');
//define('VAT_ONEXICSEVALUE','((vatValue/100) * (basicValue+ExciseDuty))');
define('VAT_ONEXICSEVALUE','(((basicValue - discountValue) + (packageValue + ExciseDuty)) * (vatValue/100))');
/* CST */
define('CST_ONBASICVALUE','((CSTValue/100) * basicValue)');
//define('CST_ONEXICSEVALUE','((CSTValue/100) * (basicValue+ExciseDuty))');
define('CST_ONEXICSEVALUE','(((basicValue - discountValue) + (packageValue + ExciseDuty)) * (CSTValue/100))');
/* GST */
define('GSTTAX','((GSTValue/100) * basicValue)');
/* Other Tax */
define('OTHERTAX','((OtherTaxValue/100) * basicValue)');
/* Freight Tax */
define('FREIGHT_PERCENTAGE','((FreightValue/100) * basicValue)');
define('FREIGHT_PERCENTAGE_AFTER','((FreightValue/100) * (basicValue-AfterDiscount))');
define('FREIGHT_LUMPSUM','FreightValue');
define('FREIGHT_PERUOM','FreightValue * Quantity');
define('FREIGHT_PERTRIP','FreightValue');
/* SERVICE PO VARIABLES */
define('SERVICETAX_SERVICETAX_14PERCENT','((14/100) * basicValue)');
define('SERVICETAX_EDUCESS_2PERCENT','((2/100) * ServiceTaxAmount)');
define('SERVICETAX_HIGHEREDUCESS_1PERCENT','((1/100) * ServiceTaxAmount)');
define('SERVICETAX_KRISHIKALYAN','(((.5)/100) * basicValue)');
define('SERVICETAX_SWACHHBHARAT','(((.5)/100) * basicValue)');
/*IMPORT PO CALCULATIONS*/
define('LOADING_CHARGE','(txtlanding*txtbasicprice/100)');
define('HIGHSEAS_SALES','(totalhighsess*highsesspercentage/100)');
define('CUSTOM_DUTY','(sumcustom*txtcustompercentage)/100');
define('EXCISE_DUTY','(txtexcisesum*txtpercentage)/100');
define('EXCISE_ED','(txtexcise*txtexcisepercentage)/100');
define('EXCISE_SH','(excisetxt*exciseshcess)/100');
define('CUSTOM_ED','(totalval*txtedcesspercentage)/100');
define('CUSTOM_SH','(totcustomsh*txtshpercentage)/100');
define('ADDTNL_EXCISEDUTY','(totaddtnlexcise*addtnpercentage)/100');
define('GROSS_EXP','(txtgrossdutypayable-txtmodvat)');
define('AVL_MODVAT','txtexciseduty1+txtexciseedcess+txtexciseshcess+txtaddtnlexcise');
define('GROSS_DUTY','landingcha+highsesssalless+customcha+excisecha+exciseedcha+exciseshcha+customed+customsh+txtaddtnexciseduty');
define('PURCHASE_RATE','txtbasicinrprice/quantity');
define('CUSTOMDUTY_EXP','txtgrossexp/quantity');
define('RMC_CAL','txtpurchaserate+txtcustomdutyexp');
define('CALCULATE_TOTAL','(txtrmc*quantity)+basicprice');
/* Capital Po Calculations */
define('Capital_Landing_Charge','basicPrice*(landCharge/100)');
define('Capital_Highseas_Charge','((highSeas/100) * (basicPrice+afterLandingCharge))');
define('Capital_Customduty_Charge','((Customduty/100) * (basicPrice+afterLandingCharge+afterHighseas))');
define('Capital_Excise_Charge','((Excise/100) * (basicPrice+afterLandingCharge+afterHighseas+afterCustomduty))');
define('Capital_ExciseEDcess_Charge','(ExciseEDcessCharge/100) * ExciseDuty');
define('Capital_ExciseSHcess_Charge','(ExciseSHcessCharge/100) * ExciseDuty');
define('Capital_CustomEDcess_Charge','((CustomEDcess/100) * (afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess))');
define('Capital_CustomSHcess_Charge','((CustomSHcess/100) * (afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess))');
define('Capital_AdditionalExciseduty_Charge','((AdditionalExciseduty/100) * (basicPrices+afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterCustomEDcess+AfterCustomSHcess))');
define('Capital_Grossdutypayable_Charge','(AfterAdditionalExciseduty+afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterCustomEDcess+AfterCustomSHcess)');
define('Capital_ModvatCharge_Charge','(AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterAdditionalExciseduty)');
define('Capital_Grossexpenses_Charge','(Grossdutypayable-AvailableModvat)');
define('Capital_purchaserate_Charge','(AfterBasicPriceTax/PurQuantity)');
define('Capital_CustomDutyExpenses_Charge','(Grossexpenses/PurQuantity)');
define('Capital_RMCIncludingCustomers_Charge','(purchaserate+CustomDutyExpenses)');
/* Calculate cgst sgst igst for Service Tax */
define('SERVICETAX_CGST','((Cgst/100) * basicValue)');
define('SERVICETAX_SGST','((Sgst/100) * basicValue)');
define('SERVICETAX_IGST','((Igst/100) * basicValue)');
/* New import Calculation */
define('LOADING_CHARGE1', '(txtlanding*txtbasicprice/100)');
define('HIGHSEAS_SALES1','(totalhighsess*highsesspercentage/100)');
define('CUSTOM_DUTY1', '(accessible*txtcustompercentage)/100');
define('EXCISE_DUTY1','(txtexcisesum*txtpercentage)/100');
define('EXCISE_ED1','(txtexcise*txtexcisepercentage)/100');
define('EXCISE_SH1','(excisetxt*exciseshcess)/100');
define('CUSTOM_ED1','(txtcustomduty1*txtedcesspercentage)/100');
define('CUSTOM_SH1','(customch*txtshpercentage)/100');
define('ADDTNL_EXCISEDUTY1','(totaddtnlexcise*addtnpercentage)/100');
define('GROSS_EXP1','(txtgrossdutypayable-txtmodvat)');
define('AVL_MODVAT1', 'txtexciseduty1+txtexciseedcess+txtexciseshcess+txtaddtnlexcise');
define('GROSS_DUTY1', 'custom+customsh+customed+afterigst');
define('PURCHASE_RATE1','(dutyimpact)/quantity');
define('CUSTOMDUTY_EXP1', 'txtgrossexp/quantity');
define('RMC_CAL1','txtpurchaserate+txtcustomdutyexp');
define('CALCULATE_TOTAL1','(txtrmc*quantity)+basicprice');
define('IGST','(tot*igstpercentage)/100');
define('SUBTOTAL','((assessble)+(custom)+(customsh)+(customed))');
define('ASSESSBLE','(result+txtbasicprice)');
define('DUTYIMPACT','(totduty-igst)');
define('MATBYQTY','(basicqtyval)/qty');
define('CLEARINGQTY','(clearing/qty)');
define('NETTPERUOM', '(basicres+clear+customdutyexp)');
/* Capital Calculation */
define('Capital_Landing_Charge1','basicPrice*(landCharge/100)');
define('Capital_Highseas_Charge1','((highSeas/100) * (basicPrice+afterLandingCharge))');
define('Capital_Customduty_Charge1','((Customduty/100) *accessible)');
define('Capital_Excise_Charge1','((Excise/100) * (basicPrice+afterLandingCharge+afterHighseas+afterCustomduty))');
define('Capital_ExciseEDcess_Charge1','(ExciseEDcessCharge/100) * ExciseDuty');
define('Capital_ExciseSHcess_Charge1','(ExciseSHcessCharge/100) * ExciseDuty');
define('Capital_CustomEDcess_Charge1','((CustomEDcess* AfterCustomduty)/100)');
define('Capital_CustomSHcess_Charge1', '((CustomSHcess/100) * AfterCustomduty)');
define('Capital_AdditionalExciseduty_Charge1','((AdditionalExciseduty/100) * (basicPrices+afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterCustomEDcess+AfterCustomSHcess))');
define('Capital_Grossdutypayable_Charge1','(AfterAdditionalExciseduty+afterLandingCharge+AfterHighseas+AfterCustomduty+AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterCustomEDcess+AfterCustomSHcess)');
define('Capital_ModvatCharge_Charge1','(AfterExcisedutyTax+AfterExcisedutyEDcess+AfterExcisedutySHcess+AfterAdditionalExciseduty)');
define('Capital_Grossexpenses_Charge1','(Grossdutypayable-AvailableModvat)');
define('Capital_purchaserate_Charge1','(AfterBasicPriceTax/PurQuantity)');
define('Capital_CustomDutyExpenses_Charge1','(Grossexpenses/PurQuantity)');
define('Capital_RMCIncludingCustomers_Charge1','(purchaserate+CustomDutyExpenses)');
/* Stock Final Product */
define('Consumables','Consumables');
define('RawMaterial','Raw Material');
define('Packingmaterial','Packing material');
define('FinalProduct','Final Product');
/* Adavnce Payments and Receipts */
define('Apayment','0009');
define('AReceipt','0013');

View File

@ -0,0 +1,176 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// Sources allowed
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'self';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

107
app/Config/Cookie.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @phpstan-var 'None'|'Lax'|'Strict'|''
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

105
app/Config/Cors.php Normal file
View File

@ -0,0 +1,105 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}

202
app/Config/Database.php Normal file
View File

@ -0,0 +1,202 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strict' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
// /**
// * Sample database connection for SQLite3.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'database' => 'database.db',
// 'DBDriver' => 'SQLite3',
// 'DBPrefix' => '',
// 'DBDebug' => true,
// 'swapPre' => '',
// 'failover' => [],
// 'foreignKeys' => true,
// 'busyTimeout' => 1000,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for Postgre.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'public',
// 'DBDriver' => 'Postgre',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'failover' => [],
// 'port' => 5432,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for SQLSRV.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'dbo',
// 'DBDriver' => 'SQLSRV',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'encrypt' => false,
// 'failover' => [],
// 'port' => 1433,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for OCI8.
// *
// * You may need the following environment variables:
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => 'localhost:1521/XEPDB1',
// 'username' => 'root',
// 'password' => 'root',
// 'DBDriver' => 'OCI8',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'AL32UTF8',
// 'swapPre' => '',
// 'failover' => [],
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
/**
* This database connection is used when running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => '',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}

46
app/Config/DocTypes.php Executable file
View File

@ -0,0 +1,46 @@
<?php
namespace Config;
/**
* @immutable
*/
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'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">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

121
app/Config/Email.php Normal file
View File

@ -0,0 +1,121 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

92
app/Config/Encryption.php Normal file
View File

@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

55
app/Config/Events.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function () {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function () {
(new HotReloader())->run();
});
}
}
});

108
app/Config/Exceptions.php Normal file
View File

@ -0,0 +1,108 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* LOG DEPRECATIONS INSTEAD OF THROWING?
* --------------------------------------------------------------------------
* By default, CodeIgniter converts deprecations into exceptions. Also,
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
* Use this option to temporarily cease the warnings and instead log those.
* This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

29
app/Config/Feature.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the default legacy version.
*/
public bool $autoRoutesImproved = false;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
}

107
app/Config/Filters.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}

View File

@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

77
app/Config/Format.php Normal file
View File

@ -0,0 +1,77 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
}

44
app/Config/Generators.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config/Honeypot.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config/Images.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

65
app/Config/Kint.php Normal file
View File

@ -0,0 +1,65 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

150
app/Config/Logger.php Normal file
View File

@ -0,0 +1,150 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* 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
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of '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 'log'.
*/
'fileExtension' => '',
/*
* 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.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

50
app/Config/Migrations.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* 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
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
}

536
app/Config/Mimes.php Normal file
View File

@ -0,0 +1,536 @@
<?php
namespace Config;
/**
* Mimes
*
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*
* @immutable
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'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' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'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' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'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' => [
'application/x-php',
'application/x-httpd-php',
'application/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' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'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' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'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',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'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' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'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' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

84
app/Config/Modules.php Normal file
View File

@ -0,0 +1,84 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

32
app/Config/Optimize.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*
* @immutable
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}

37
app/Config/Pager.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}

80
app/Config/Paths.php Normal file
View File

@ -0,0 +1,80 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

306
app/Config/Routes.php Normal file
View File

@ -0,0 +1,306 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
// $routes->get('/', 'Home::index');
// $routes->setDefaultController('Login');
// $routes->set404Override('error');
// Application Login Routes
$routes->get('/', 'Login::index');
$routes->get('login', 'Login::index');
$routes->add('loginMe', 'Login::loginMe');
$routes->get('logout', 'User::logout');
$routes->match(['get', 'post', 'put', 'delete'], 'loadChangePass', 'User::loadChangePass');
$routes->match(['get', 'post', 'put', 'delete'], 'changePassword', 'User::changePassword');
$routes->match(['get', 'post', 'put', 'delete'],'pageNotFound', 'User::pageNotFound');
$routes->match(['get', 'post', 'put', 'delete'],'checkEmailExists', 'User::checkEmailExists');
$routes->match(['get', 'post', 'put', 'delete'],'forgotPassword', 'Login::forgotPassword');
$routes->match(['get', 'post', 'put', 'delete'],'resetPasswordUser', 'Login::resetPasswordUser');
$routes->match(['get', 'post', 'put', 'delete'],'resetPasswordConfirmUser', 'Login::resetPasswordConfirmUser');
// $routes->match(['get', 'post', 'put', 'delete'],'resetPasswordConfirmUser/(:any)', 'Login::resetPasswordConfirmUser/$1');
// $routes->match(['get', 'post', 'put', 'delete'],'resetPasswordConfirmUser/(:any)/(:any)', 'Login::resetPasswordConfirmUser/$1/$2');
// $routes->match(['get', 'post', 'put', 'delete'],'createPasswordUser', 'Login::createPasswordUser');
$routes->get('dashboard', 'User::index');
$routes->get('reports', 'Report::index');
// User Routes
$routes->get('addNew', 'User::addNew');
$routes->match(['get', 'post', 'put', 'delete'],'addNewUser', 'User::addNewUser');
$routes->match(['get', 'post', 'put', 'delete'],'userListing', 'User::userListing');
$routes->match(['get', 'post', 'put', 'delete'],'userListing/(:num)', 'User::userListing/$1');
$routes->get('user/editOld', 'User::editOld');
$routes->match(['get', 'post', 'put', 'delete'],'editUser', 'User::editUser');
$routes->post('user/Deleteuserdepartment','User::Deleteuserdepartment');
$routes->post('user/deleteUser', 'User::deleteUser');
// Supplier Routes
$routes->get('supplierlisting', 'Supplier::index'); // list supplier
$routes->add('addsupplier', 'Supplier::addsupplier');//load add supplier page
$routes->get('viewsupplier','Supplier::viewsupplier');// load edit supplier page
$routes->post('editsupplier', 'Supplier::updatesupplierdetails'); //save supplier details
$routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supplier details
$routes->post('supplierExist','Supplier::checksupplier');
$routes->post('supplierGSTExist','Supplier::checkGST');
$routes->post('supplierPANExist','Supplier::checkPAN');
// Material Master Routes
$routes->match(['get', 'post', 'put', 'delete'],'addRawmaterial', 'Rawmaterialdetails::addRawMaterial');
$routes->match(['get', 'post', 'put', 'delete'],'addNewRawmaterial', 'Rawmaterialdetails::addNewRawMaterial');
$routes->match(['get', 'post', 'put', 'delete'],'rawmaterialListing', 'Rawmaterialdetails::rawmaterialListing');
$routes->match(['get', 'post', 'put', 'delete'],'rawmaterialListing/(:num)', 'Rawmaterialdetails::rawmaterialListing/$1');
$routes->post('materialExist','Rawmaterialdetails::checkmaterial');
$routes->get('viewRawmaterial','Rawmaterialdetails::viewRawmaterial');
$routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial');
// Cost Center Routes
$routes->get('costListing', 'CostCenter::index');
$routes->get('addCostCenter', 'CostCenter::addCostCenter');
$routes->get('editCostCenter', 'CostCenter::editCostCenter');
$routes->post('saveCostCenter', 'CostCenter::saveCostCenter');
$routes->post('updateCostCenter', 'CostCenter::updateCostCenter');
$routes->post('CostCenter/AddCostDepartment','CostCenter::AddCostDepartment');
$routes->post('CostCenter/DeleteCostDepartment','CostCenter::DeleteCostDepartment');
$routes->match(['get', 'post', 'put', 'delete'],'CostCenter/GetBudgetForYear','CostCenter::GetBudgetForYear');
$routes->match(['get', 'post', 'put', 'delete'],'deletecost', 'CostCenter::deletecost');
// Asset Detail Routes
$routes->get('assetListing', 'Assetdetails::assetListing');
$routes->get('addasset', 'Assetdetails::addasset');
$routes->match(['get', 'post', 'put', 'delete'],'editOldasset', 'Assetdetails::editasset');
$routes->match(['get', 'post', 'put', 'delete'],'editOldasset/(:num)', 'Assetdetails::editasset/$1');
$routes->match(['get', 'post', 'put', 'delete'],'editasset', 'Assetdetails::editasset');
// Employee Detail Routes
$routes->add('addemployee', 'Employeedetails::addemployee');
$routes->post('addNewEmployee', 'Employeedetails::AddNewEmployee');
$routes->get('employeeListing', 'Employeedetails::index');
$routes->get('employeedetails/ViewEmployee', 'Employeedetails::ViewEmployee');
$routes->Post('employeedetails/UpdateEmployee', 'Employeedetails::UpdateEmployee');
$routes->post('employeeEmailExist','Employeedetails::CheckEmail');
$routes->post('employeePANExist','Employeedetails::checkPAN');
$routes->post('employeecheckAadharNoExist','Employeedetails::checkAadharNo');
// Company Information Routes
$routes->add('companyview', 'Companycontroller::index');
$routes->post('Updatecompany', 'Companycontroller::Updatecompany');
$routes->post('companycontroller/bankdtl', 'Companycontroller::bankdtl');
// Config Master Routes
$routes->get('configlisting', 'Configurationctrl::index');
$routes->get('addconfig', 'Configurationctrl::addconfig');
$routes->post('configurationctrl/saveconfig', 'Configurationctrl::saveconfig');
$routes->get('configurationctrl/editconfig', 'Configurationctrl::editconfig');
$routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig');
// Department Master Routes
$routes->get('departmentListing', 'Department::index');
$routes->get('adddepartment', 'Department::adddepartment');
$routes->post('savedepartment', 'Department::savedepartment');
$routes->get('editOlddepartment', 'Department::viewdepartment');
$routes->post('editdepartment', 'Department::editdepartment');
$routes->get('batchcard/getHistListing', 'Batchcard::getHistListing');
//Complaint Routes
$routes->get('purchaseorder/AddComplaint','Purchaseorder::AddComplaint');
$routes->post('purchaseorder/SaveComplaint','Purchaseorder::SaveComplaint');
$routes->get('purchaseorder/Nonconfirmativelist','Purchaseorder::Nonconfirmativelist');
// Application Payslip Routes
$routes->match(['get', 'post', 'put', 'delete'],'monthlyListings', 'Monthlypay::monthlyListing');
$routes->match(['get', 'post', 'put', 'delete'],'monthlyListings/(:num)', 'Monthlypay::monthlyListing/$1');
$routes->match(['get', 'post', 'put', 'delete'],'attendance', 'Monthlypay::attendanceLoad');
$routes->match(['get', 'post', 'put', 'delete'],'publicholidays', 'Monthlypay::loadPublicholidays');
$routes->match(['get', 'post', 'put', 'delete'],'permission', 'Monthlypay::permissionslip');
$routes->match(['get', 'post', 'put', 'delete'],'permissionlist', 'Monthlypay::permissionlist');
$routes->match(['get', 'post', 'put', 'delete'],'emppayListings', 'Emppaydate::emppayListing');
$routes->match(['get', 'post', 'put', 'delete'],'emppayListings/(:num)', 'Emppaydate::emppayListing/$1');
$routes->match(['get', 'post', 'put', 'delete'],'loanreports', 'Payslip::loadLoanReport');
$routes->match(['get', 'post', 'put', 'delete'],'bonusreports', 'Payslip::Bonusreport');
$routes->match(['get', 'post', 'put', 'delete'],'monthlypay', 'Payslip::monthlyInputs');
$routes->match(['get', 'post', 'put', 'delete'],'ExcelUpload2', 'Payslip::viewUpload2');
$routes->match(['get', 'post', 'put', 'delete'],'FileUpload', 'Payslip::uploadExcel');
$routes->match(['get', 'post', 'put', 'delete'],'FileUpload2', 'Payslip::uploadExcel2');
$routes->match(['get', 'post', 'put', 'delete'],'PrintPdf', 'Payslip::PrintPdf');
$routes->match(['get', 'post', 'put', 'delete'],'ViewPay', 'Payslip::viewGenerator');
$routes->match(['get', 'post', 'put', 'delete'],'updatepayroll', 'Payslip::updatepayroll');
$routes->match(['get', 'post', 'put', 'delete'],'BankReport', 'Payslip::loadBankreportScreen');
$routes->match(['get', 'post', 'put', 'delete'],'PaysilpListing', 'Payslip::payslipLisiting');
// Application Requisition Flow Routes
$routes->match(['get', 'post', 'put', 'delete'],'Requisition', 'Requisitionform::requisitionlisting');
$routes->match(['get', 'post', 'put', 'delete'],'RequisitionForm', 'Requisitionform::requisition');
$routes->match(['get', 'post', 'put', 'delete'],'ApproveRequisition', 'Requisitionform::requisitionlistApproval');
$routes->get('EditRequisitionForm', 'Requisitionform::EditRequisitionForm');
$routes->post('EditRequisition', 'Requisitionform::EditRequisition');
$routes->post('addNewRequisition', 'Requisitionform::addNewRequisition');
$routes->post('getMaterialCode', 'Requisitionform::getMaterialCode');
$routes->post('getMaterialDetails', 'Requisitionform::getMaterialDetails');
$routes->post('DeleteRequistionForm', 'Requisitionform::DeleteRequistionForm'); // recheck it used or not.
$routes->post('requisitionform/ApproveRequest', 'Requisitionform::ApproveRequest');
$routes->post('requisitionform/DeleteReqNo', 'Requisitionform::DeleteReqNo');
// Application PO Flow Routes
$routes->match(['get', 'post', 'put', 'delete'],'addPO', 'Purchaseorder::addPO');
$routes->match(['get', 'post', 'put', 'delete'],'addNewPO', 'Purchaseorder::addNewPO');
$routes->match(['get', 'post', 'put', 'delete'],'editOldPO', 'Purchaseorder::editOldPO');
$routes->match(['get', 'post', 'put', 'delete'],'editOldPO/(:num)', 'Purchaseorder::editOldPO/$1');
$routes->match(['get', 'post', 'put', 'delete'],'CreatePO', 'Purchaseorder::requisition');
$routes->match(['get', 'post', 'put', 'delete'],'purchaseOrder', 'Purchaseorder::CreatePurchaseOrder');
$routes->match(['get', 'post', 'put', 'delete'],'purchaseorderListing', 'Purchaseorder::PurchaseOrderList');
$routes->match(['get', 'post', 'put', 'delete'],'EmergencyPO', 'Emergencypurchaseorder::CreateEmergencyPO');
$routes->match(['get', 'post', 'put', 'delete'],'AdvanceRequest', 'Purchaseorder::advancerequest');
$routes->match(['get', 'post', 'put', 'delete'],'PORelease', 'Purchaseorder::porelease');
$routes->match(['get', 'post', 'put', 'delete'],'ViewPO', 'Purchaseorder::viewfullpurchaseorder');
// $routes->match(['get', 'post', 'put', 'delete'],'POApproval', 'Purchaseorder::poapproval');
$routes->get('amendmentpurchaseorder','Amendmentpurchaseorder::index');
$routes->get('EditAmendPO', 'Amendmentpurchaseorder::EditAmendPurchaseOrder');
$routes->post('amendmentpurchaseorder/EditRevenuePurchaseOrder', 'Amendmentpurchaseorder::EditRevenuePurchaseOrder');
$routes->post('emergencypurchaseorder/getMaterialCode','Emergencypurchaseorder::getMaterialCode');
$routes->post('emergencypurchaseorder/getCostCenterName','Emergencypurchaseorder::getCostCenterName');
$routes->post('emergencypurchaseorder/addNewServicePurchaseOrder','Emergencypurchaseorder::addNewServicePurchaseOrder');
$routes->post('emergencypurchaseorder/addNewRevenuePurchaseOrder','Emergencypurchaseorder::addNewRevenuePurchaseOrder');
$routes->post('purchaseorder/addNewPurchaseOrder', 'Purchaseorder::addNewPurchaseOrder');
$routes->post('purchaseorder/addNewCapitalPurchaseOrder', 'Purchaseorder::addNewCapitalPurchaseOrder');
$routes->post('purchaseorder/addNewImportPurchaseOrder', 'Purchaseorder::addNewImportPurchaseOrder');
$routes->post('servicepurchaseorder/addNewServicePurchaseOrder', 'Servicepurchaseorder::addNewServicePurchaseOrder');
$routes->get('EditPO', 'Purchaseorder::EditPurchaseOrder');
$routes->get('purchaseorder/CreatePOPrint', 'Purchaseorder::CreatePOPrint');
$routes->post('purchaseorder/ReleasePO', 'Purchaseorder::ReleasePO');
$routes->post('VerifyWithSupplierForPendingPO', 'Purchaseorder::VerifyWithSupplierForPendingPO');
// Application Store Requisition Flow Routes
$routes->match(['get', 'post', 'put', 'delete'],'storerequisition', 'Storerequisitioncontroller::addstore');
$routes->match(['get', 'post', 'put', 'delete'],'approvalstorerequisitionslip', 'Storerequisitioncontroller::SearchRequistLists');
$routes->match(['get', 'post', 'put', 'delete'],'storerequisitionlisting', 'Storerequisitioncontroller::addstorerequisitionlist');
$routes->match(['get', 'post', 'put', 'delete'],'EditStoreRequisition', 'Storerequisitioncontroller::EditStoreRequistion');
// Application IGR Routes
$routes->get('Addigr', 'Inwardgateregister::addinwardgateregister');
$routes->match(['get', 'post', 'put', 'delete'],'ViewigrDetails', 'Inwardgateregister::viewIGRDetails');
$routes->match(['get', 'post', 'put', 'delete'],'ViewMRIRBilling', 'MRIRcontroller::viewmrirforbilling');
$routes->post('inwardgateregister/IGRITEM', 'Inwardgateregister::IGRITEM');
$routes->post('inwardgateregister/addNewigr', 'Inwardgateregister::addNewigr');
$routes->get('inwardgateregister/viewIGRDetails','Inwardgateregister::viewIGRDetails');
$routes->post('inwardgateregister/ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
$routes->post('inwardgateregister/ViewIGR', 'Inwardgateregister::ViewIGR');
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
$routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile');
// Application OGR Page
$routes->match(['get', 'post', 'put', 'delete'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
$routes->match(['get', 'post', 'put', 'delete'],'ViewOgr', 'Inwardgateregister::ViewOgr');
$routes->match(['get', 'post', 'put', 'delete'],'EditOGR', 'Inwardgateregister::EditOGR');
// Application MRIR Routes
$routes->match(['get', 'post', 'put', 'delete'],'EditMRIR', 'MRIRcontroller::editmaterialinspectionreport');
$routes->match(['get', 'post', 'put', 'delete'],'ViewMRIR', 'MRIRcontroller::viewmaterialinspectionreport');
$routes->match(['get', 'post', 'put', 'delete'],'Viewigr', 'MRIRcontroller::viewinwardgateregister');
$routes->match(['get', 'post', 'put', 'delete'],'Distribution', 'MRIRcontroller::viewmMaterialDistributionList');
// Application Store Routes
$routes->match(['get', 'post', 'put', 'delete'],'Stock', 'Storestatus::storeavailability');
$routes->match(['get', 'post', 'put', 'delete'],'UpdatePOStatus', 'Servicepurchaseorder::UpdateServicePOStatus');
$routes->match(['get', 'post', 'put', 'delete'],'ServicePOBilling', 'Servicepurchaseorder::viewServicePOReportForBilling');
$routes->post('serviceAvilBudgetAmount', 'Servicepurchaseorder::AvilBudgetAmount');
$routes->post('servicepurchaseorder/UpdateServicePurchaseOrder', 'Servicepurchaseorder::UpdateServicePurchaseOrder');
// Application Cash book Routes
$routes->match(['get', 'post', 'put', 'delete'],'ViewIncomeExpense', 'Cashbook::incomeExpenseList');
// $routes->match(['get', 'post', 'put', 'delete'],'addNewIncomeExpense', 'Cashbook::addNewIncomeExpenseLoad');
$routes->match(['get', 'post', 'put', 'delete'],'addIncomeExpense', 'Cashbook::addIncomeExpense');
$routes->match(['get', 'post', 'put', 'delete'],'AdvanceList', 'Cashbook::AdvanceList');
// Application Bank book Routes
$routes->match(['get', 'post', 'put', 'delete'],'Bankingview', 'Cashbook::bankfileview');
$routes->match(['get', 'post', 'put', 'delete'],'Bankfiletostatement', 'Cashbook::bankfileupload');
$routes->match(['get', 'post', 'put', 'delete'],'Bankingstatement', 'Cashbook::bankdata');
$routes->match(['get', 'post', 'put', 'delete'],'Debitstatement', 'Cashbook::bankdebitdata');
$routes->match(['get', 'post', 'put', 'delete'],'Cashstatement', 'Cashbook::cashreceipt');
$routes->match(['get', 'post', 'put', 'delete'],'BankingFile', 'Cashbook::bankfileupload');
// $routes->match(['get', 'post', 'put', 'delete'],'Filelist', 'Cashbook::filelist');
// $routes->match(['get', 'post', 'put', 'delete'],'Bankingrecord', 'Cashbook::bankdata');;
$routes->match(['get', 'post', 'put', 'delete'],'Bankamountpaid', 'Cashbook::amountpaid');
$routes->match(['get', 'post', 'put', 'delete'],'Bankamountreceived', 'Cashbook::amountreceived');
$routes->match(['get', 'post', 'put', 'delete'],'Receipt', 'Cashbook::cashreceipt');
$routes->match(['get', 'post', 'put', 'delete'],'Payment', 'Cashbook::cashpayment');
$routes->match(['get', 'post', 'put', 'delete'],'Invoice', 'Cashbook::bankinvoice');
$routes->match(['get', 'post', 'put', 'delete'],'Bankcash', 'Cashbook::cashbanking');
$routes->match(['get', 'post', 'put', 'delete'],'DeleteInvoice', 'Cashbook::deletemappingiv');
$routes->match(['get', 'post', 'put', 'delete'],'DeletePo', 'Cashbook::Deletemappingporeport');
$routes->match(['get', 'post', 'put', 'delete'],'MappingInvoice', 'Cashbook::mappinginvoice');
// new added on cashbook controller
$routes->match(['get', 'post', 'put', 'delete'],'MappingPo', 'Cashbook::mappingpo');
$routes->match(['get', 'post', 'put', 'delete'],'Bankledgersupplier', 'Cashbook::supplierledger');
$routes->match(['get', 'post', 'put', 'delete'],'Bankledgercustomer', 'Cashbook::customerledger');
// $routes->match(['get', 'post', 'put', 'delete'],'Bankamountpaidsupplier', 'Cashbook::amountpaidsupplier');
$routes->match(['get', 'post', 'put', 'delete'],'Bankamountunpaid', 'Cashbook::amountunpaid');
$routes->match(['get', 'post', 'put', 'delete'],'Bankamountreceivedsupp', 'Cashbook::bankreceivedsupp');
$routes->match(['get', 'post', 'put', 'delete'],'Bankamountunreceived', 'Cashbook::bankunreceivedsupp');
$routes->match(['get', 'post', 'put', 'delete'],'Receiptamount', 'Cashbook::receipt');
$routes->match(['get', 'post', 'put', 'delete'],'Amountreceived', 'Cashbook::amountreceived');
// Application Reports Routes
$routes->match(['get', 'post'],'reportpending', 'Report::pending_report');
$routes->match(['get', 'post', 'put', 'delete'],'releasedpo', 'Report::releasedPO');
$routes->match(['get', 'post', 'put', 'delete'],'openOrder', 'Report::openorderPO');
$routes->match(['get', 'post', 'put', 'delete'],'TotalOrder', 'Report::TotalOrd');
$routes->match(['get', 'post', 'put', 'delete'],'Report_costcenter', 'Report::ccr');
$routes->match(['get', 'post', 'put', 'delete'],'Report_Material_Supplier', 'Report::MM_Supplier');
$routes->match(['get', 'post', 'put', 'delete'],'Report_Material_Item', 'Report::MM_Item');
$routes->match(['get', 'post', 'put', 'delete'],'Report_Material_ReceiptValue', 'Report::MM_ReceiptValue');
$routes->match(['get', 'post', 'put', 'delete'],'Report_purchase', 'Report::purchase');
$routes->match(['get', 'post', 'put', 'delete'],'Report_year_wise', 'Report::year_wise');
$routes->match(['get', 'post', 'put', 'delete'],'Report_supplier', 'Report::purchase_supplier');
$routes->match(['get', 'post', 'put', 'delete'],'Report_consolidate', 'Report::consolidate');
$routes->match(['get', 'post', 'put', 'delete'],'Report_cumulative', 'Report::cumulative');
$routes->match(['get', 'post', 'put', 'delete'],'cashbookreport', 'Report::cashbook');
$routes->match(['get', 'post', 'put', 'delete'],'cashbookcumulativereport', 'Report::cashbook_cumulative_report');
$routes->match(['get', 'post', 'put', 'delete'],'cashbookcumulativemonthreport', 'Report::cashbook_month_cumulative_report');
$routes->match(['get', 'post', 'put', 'delete'],'cashbookmonthlyexpenses', 'Report::monthexpenses');
$routes->match(['get', 'post', 'put', 'delete'],'cashbookyearlyexpenses', 'Report::yearexpenses');
$routes->match(['get', 'post', 'put', 'delete'],'Report_purchase_inward', 'Report::ipurchase');
$routes->match(['get', 'post', 'put', 'delete'],'Report_year_wise_inward', 'Report::iyear_wise');
$routes->match(['get', 'post', 'put', 'delete'],'Report_supplier_inward', 'Report::ipurchase_supplier');
$routes->match(['get', 'post', 'put', 'delete'],'Report_supplier_summary', 'Report::suppliersummary');
$routes->match(['get', 'post', 'put', 'delete'],'Report_consolidate_inward', 'Report::iconsolidate');
$routes->match(['get', 'post', 'put', 'delete'],'Report_cumulative_inward', 'Report::icumulative');
$routes->match(['get', 'post', 'put', 'delete'],'Report_cumulative_raw', 'Report::rawi_cumulative');
$routes->match(['get', 'post', 'put', 'delete'],'Report_consolidate_category', 'Report::rawi_consolidate');
$routes->match(['get', 'post'],'Report_pending_purchase', 'Report::pending_purchase');
$routes->match(['get', 'post'],'/Report_pending_purchase','Report::pending_purchase');
$routes->match(['get', 'post', 'put', 'delete'],'Report_purchase_attach', 'Report::iattach');
$routes->match(['get', 'post', 'put', 'delete'],'Report_monthly_gst', 'Report::monthly_gst');
$routes->match(['get', 'post', 'put', 'delete'],'Report_Material_inward_Register', 'User::getMaterialInwardRegister');
$routes->match(['get', 'post', 'put', 'delete'],'DeliveryPerformance', 'User::deliver_perform');
$routes->match(['get', 'post', 'put', 'delete'],'Empperform', 'Report::per');
$routes->get('qualityreportlist', 'Quality::reportList');
$routes->get('qualityreportlistinward', 'Quality::reportListInward');
$routes->get('shortagematerialListing', 'Rawmaterialdetails::shortagematerialListing');

140
app/Config/Routing.php Normal file
View File

@ -0,0 +1,140 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = false;
}

103
app/Config/Security.php Normal file
View File

@ -0,0 +1,103 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
}

32
app/Config/Services.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

127
app/Config/Session.php Normal file
View File

@ -0,0 +1,127 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is 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!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}

122
app/Config/Toolbar.php Normal file
View File

@ -0,0 +1,122 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}

252
app/Config/UserAgents.php Normal file
View File

@ -0,0 +1,252 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* 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.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'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',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => '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',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// 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',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'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',
];
}

46
app/Config/Validation.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
use App\Validation\CustomRules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
CustomRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

62
app/Config/View.php Normal file
View File

@ -0,0 +1,62 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,431 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\Assetdetails_model;
use CodeIgniter\Validation\Exceptions\ValidationException;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
/**
* Module : Asset
* Assetdetails Class to control all asset related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Assetdetails extends BaseController
{
protected $assetdetails_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->assetdetails_model = new Assetdetails_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
//
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Asset Details';
$this->loadViews("assetListing", $this->global, NULL, NULL);
}
/**
* This function is used to load the Supplier list
*/
function assetListing()
{
$data['userRecords'] = $this->assetdetails_model->assetListing();
$this->global['pageTitle'] = 'Asset List';
//print_r($data);die();
$this->loadViews("assetListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new supplier */
function addasset()
{
$data['AssetStatus'] = $this->assetdetails_model->getConfigValue('C015');
$data['po'] = $this->assetdetails_model->getPO();
//print_r($data);die();
$this->global['pageTitle'] = 'Add Asset';
$this->loadViews("addasset", $this->global, $data, NULL);
}
function getpodetails()
{
$PO = $this->request->getPost('PONO');
$data = $this->assetdetails_model->getpodetails($PO);
//print_r($data);die();
$HTML = "<option value='0'>SelectMaterialCode</option>";
if (count($data) > 0) {
for ($j = 0; $j < count($data); $j++) {
$Code = $data[$j]->LineItemNo;
$Name = $data[$j]->MaterialCode;
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
}
}
//echo $HTML;
die(json_encode(array($HTML)));
//echo json_encode($data);
//die();
}
function getline()
{
$line = $this->request->getPost('line');
$type = $this->assetdetails_model->gettyp($line);
$data = '';
if (!empty($type)) {
foreach ($type as $item) {
$data = $item->POType;
}
}
if ($data == 'SERVICE') {
$ser = $this->assetdetails_model->getlineitemser($line);
} elseif ($data == 'REVENUE') {
$ser = $this->assetdetails_model->getlineitemre($line);
} elseif ($data == 'IMPORT') {
$ser = $this->assetdetails_model->getlineitemimport($line);
} elseif ($data == 'CAPITAL') {
$ser = $this->assetdetails_model->getlineitemcap($line);
}
//print_r($ser);die();
//print_r($data);die();
//$data = get_date_time_format($data);
echo json_encode($ser);
die();
}
// function getlin(){
// $line = $this->request->getPost('line');
// }
/* Validation for Department Dropdown
*/
function Department_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
$this->validator->setError('Department_validate', 'Please Select Department.');
return false;
} else // user picked something
{
return true;
}
}
/* Validation for Supplier Dropdown
*/
function Supplier_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
$this->validator->setError('Supplier_validate', 'Please Select Supplier.');
return false;
} else // user picked something
{
return true;
}
}
/* Validation for Supplier Dropdown
*/
function Asset_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
$this->validator->setError('Asset_validate', 'Please Select Asset Status.');
return false;
} else // user picked something
{
return true;
}
}
/**
* This function is used to add new user to the system
*/
function addNewasset()
{
$this->validator->setRules([
'AssetName' => 'trim|required',
'Department' => 'trim|callback_Department_validate',
'Location' => 'trim|required',
'User' => 'trim|required',
'SupplierName' => 'trim|callback_Supplier_validate',
'DateOfCommission' => 'trim|required',
'Assetvalue' => 'trim|required',
'AssetStatus' => 'trim|callback_Asset_validate'
]);
$this->validator->setMessage([
'AssetName' => [
'required' => 'Please enter Asset Name.'
],
'Department' => [
'Department_validate' => 'Please select a valid Department.'
],
'Location' => [
'required' => 'Please enter Location.'
],
'User' => [
'required' => 'Please enter User.'
],
'SupplierName' => [
'Supplier_validate' => 'Please select a valid Supplier.'
],
'DateOfCommission' => [
'required' => 'Please enter Date of Commission.'
],
'Assetvalue' => [
'required' => 'Please enter Asset Value.'
],
'AssetStatus' => [
'Asset_validate' => 'Please select a valid Asset Status.'
]
]);
if (!$this->validator->run()) {
$this->addasset();
} else {
$assetName = $this->request->getPost('AssetName');
$AssetName = (!empty($assetName)) ? strtoupper($assetName) : "";
$Description = $this->request->getPost('Description');
$Department = $this->request->getPost('AssetDept');
$Location = $this->request->getPost('Location');
$User = $this->request->getPost('User');
$SupplierName = $this->request->getPost('SupplierName');
$DateOfCommission = $this->request->getPost('DateOfCommission');
$CreatedBy = $this->session->get('userId');
$DateOfPurchase = $this->request->getPost('DateOfPurchase');
if ($DateOfPurchase != '') {
$DOpurchase = get_date_time_format($DateOfPurchase);
}
$AssetValue = $this->request->getPost('Assetvalue');
if ($DateOfCommission != '') {
$DOCommission = get_date_time_format($DateOfCommission);
//$DOCommission= get_date_time_format($DateOfCommission);
}
$AssetStatus = $this->request->getPost('AssetStatus');
$Remarks = $this->request->getPost('Remarks');
$PONO = $this->request->getPost('PONO');
$lineitem = $this->request->getPost('lineitem');
$MaterialCode = $this->request->getPost('MaterialCode');
$Quantity = $this->request->getPost('Quantity');
$chked = $this->request->getPost('isactive');
if ($chked != '') {
$IsActive = '1';
} else {
$IsActive = '0';
}
$asset = array();
$asset = array('AssetName' => $AssetName, 'Description' => $Description, 'DEPCode' => $Department, 'Location' => $Location, 'UserName' => $User, 'SupplierCode' => $SupplierName, 'DateOfPurchase' => $DOpurchase, 'DateOfCommison' => $DOCommission, 'AssetValue' => $AssetValue, 'AssetStatus' => $AssetStatus, 'IsActive' => $IsActive, 'Remarks' => $Remarks, 'CreatedBy' => $CreatedBy, 'PONO' => $PONO, 'POLineItem' => $lineitem, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity);
$result = $this->assetdetails_model->addNewasset($asset);
if ($result > 0) {
// $this->session->set_flashdata('success', 'New Asset created successfully');
echo "<script>alert('Asset Created successfully!');</script>";
redirect('assetListing', 'refresh');
} else {
echo "<script>alert('Asset Not Created!');</script>";
redirect('assetListing', 'refresh');
}
}
}
/**
* This function is used load user edit information
* @param number $userId : Optional : This is user id
*/
/*function ech(){
echo $this->request->getPost('Asset_Code');
}*/
function editOldasset($AssetCode = '', $PO = '')
{
$SupplierName = $this->request->getPost('SupplierName');
$AssetStatus = $this->request->getPost('AssetStatus');
$Department = $this->request->getPost('Department');
if ($AssetCode == '') {
$AssetID = $_GET['AssetID'];
} else {
$AssetID = $AssetCode;
}
//echo $AssetID;
$data['assetList'] = $this->assetdetails_model->getAssetDetails($AssetID);
// $data['SupplierList'] = $this->assetdetails_model->getSupplierName($SupplierName);
// $data['DepartmentList'] = $this->assetdetails_model->getDepartment($Department);
$data['AssetStatusList'] = $this->assetdetails_model->getConfigValue('C015');
$data['PO'] = $this->assetdetails_model->getPO($PO);
//print_r($data);die();
$this->global['pageTitle'] = 'Edit Asset';
$this->loadViews("editOldasset", $this->global, $data, NULL);
}
/**
* This function is used to edit the user information
*/
function editasset()
{
$Asset_Code = $this->request->getPost('AssetCode');
$this->validator->setRules([
'AssetName' => 'trim|required',
'Description' => 'trim|required',
'Department' => 'trim|callback_Department_validate',
'Location' => 'trim|required',
'User' => 'trim|required',
'SupplierName' => 'trim|callback_Supplier_validate',
'DateOfCommission' => 'trim|required',
'Assetvalue' => 'trim|required',
'AssetStatus' => 'trim|callback_Asset_validate'
]);
$this->validator->setMessage([
'AssetName' => [
'required' => 'Please enter Asset Name.'
],
'Description' => [
'required' => 'Please enter Description.'
],
'Department' => [
'Department_validate' => 'Please select a valid Department.'
],
'Location' => [
'required' => 'Please enter Location.'
],
'User' => [
'required' => 'Please enter User.'
],
'SupplierName' => [
'Supplier_validate' => 'Please select a valid Supplier.'
],
'DateOfCommission' => [
'required' => 'Please enter Date of Commission.'
],
'Assetvalue' => [
'required' => 'Please enter Asset Value.'
],
'AssetStatus' => [
'Asset_validate' => 'Please select a valid Asset Status.'
]
]);
if ($this->validator->run() == FALSE) {
$this->editOldasset($Asset_Code);
} else {
$Asset_Code = $this->request->getPost('AssetCode');
$assetName = $this->request->getPost('AssetName');
$AssetName = (!empty($assetName)) ? strtoupper($assetName) : '';
$Description = $this->request->getPost('Description');
$Department = $this->request->getPost('AssetDept');
$Location = $this->request->getPost('Location');
$User = $this->request->getPost('User');
$SupplierName = $this->request->getPost('SupplierName');
$DateOfPurchase = $this->request->getPost('DateOfPurchase');
if ($DateOfPurchase != '') {
$DOpurchase = get_date_time_format($DateOfPurchase);
}
$DateOfCommission = $this->request->getPost('DateOfCommission');
$UpdatedBy = $this->session->get('userId');
$Assetvalue = $this->request->getPost('Assetvalue');
if ($DateOfCommission != '') {
$DOCommission = get_date_time_format($DateOfCommission);
}
$AssetStatus = $this->request->getPost('AssetStatus');
$Remarks = $this->request->getPost('Remarks');
$PONO = $this->request->getPost('PONO');
$lineitem = $this->request->getPost('lineitem');
$MaterialCode = $this->request->getPost('MaterialCode');
$Quantity = $this->request->getPost('Quantity');
$chked = $this->request->getPost('isactive');
if ($chked != '') {
$IsActive = '1';
} else {
$IsActive = '0';
}
$asset = array();
$asset = array('AssetName' => $AssetName, 'Description' => $Description, 'DEPCode' => $Department, 'Location' => $Location, 'UserName' => $User, 'SupplierCode' => $SupplierName, 'DateOfPurchase' => $DOpurchase, 'DateOfCommison' => $DOCommission, 'AssetValue' => $Assetvalue, 'AssetStatus' => $AssetStatus, 'IsActive' => $IsActive, 'Remarks' => $Remarks, 'UpdatedBy' => $UpdatedBy, 'PONO' => $PONO, 'POLineItem' => $lineitem, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity);
$result = $this->assetdetails_model->editasset($asset, $Asset_Code);
if ($result == true) {
echo "<script>alert('Asset updated successfully!');</script>";
redirect('assetListing', 'refresh');
} else {
echo "<script>alert('Asset Not updated !');</script>";
redirect('assetListing', 'refresh');
}
}
}
}

View File

@ -0,0 +1,194 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use CodeIgniter\Cache\CacheFactory;
/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
protected $role = '';
protected $vendorId = '';
protected $name = '';
protected $Designation = '';
protected $DEPCode = '';
protected $HeadDept = '';
protected $DepartmentName = '';
protected $roleText = '';
protected $CompanyName = '';
protected $EmpID = '';
protected $depaccess = '';
protected $profilepic = '';
protected $global = array();
protected $session;
public function __construct()
{
$this->session = \Config\Services::session();
}
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var list<string>
*/
protected $helpers = [];
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
}
/**
* This function used to check the user is logged in or not
*/
protected function isLoggedIn()
{
$isLoggedIn = $this->session->get('isLoggedIn');
if (!isset($isLoggedIn) || $isLoggedIn !== true) {
// if ($this->request->uri->getSegment(2) === 'zohobooks_api_fetch_all') {
// return redirect()->to('login/zohobooks_api_fetch_all');
// }
return redirect()->to('login');
} else {
log_message('error', '#####In BaseController - isLoggedIn function ci session: ' . $this->session->get('name'));
$this->role = $this->session->get('role');
$this->vendorId = $this->session->get('userId');
$this->name = $this->session->get('name');
$this->roleText = $this->session->get('roleText');
$this->Designation = $this->session->get('Designation');
$this->DEPCode = $this->session->get('DEPCode');
$this->HeadDept = $this->session->get('HeadDept');
$this->DepartmentName = $this->session->get('DepartmentName');
$this->EmpID = $this->session->get('EmpID');
$this->depaccess = $this->session->get('depaccess');
$this->profilepic = $this->session->get('ProfilePic');
$this->CompanyName = $this->session->get('CompanyName');
// Set data to global array
$this->global['name'] = $this->name;
$this->global['role'] = $this->role;
$this->global['role_text'] = $this->roleText;
$this->global['DEPCode'] = $this->DEPCode;
$this->global['Designation'] = $this->Designation;
$this->global['DepAccesslist'] = $this->depaccess;
$this->global['CompanyName'] = $this->CompanyName;
}
}
/**
* This function is used to check the access
*/
function isAdmin()
{
if ($this->role != ROLE_ADMIN) {
return true;
} else {
return false;
}
}
/**
* This function is used to check the access
*/
function isTicketter()
{
if ($this->role != ROLE_ADMIN || $this->role != ROLE_MANAGER) {
return true;
} else {
return false;
}
}
/**
* This function is used to load the set of views
*/
function loadThis()
{
$this->global['pageTitle'] = 'Resico : Access Denied';
$this->loadViews('access', $this->global);
}
/**
* This function is used to load the set of views
*/
function pageNotFound()
{
$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
/**
* This function is used to logged out user from system
*/
function logout()
{
$session = session()->destroy();
// $cacheFactory = new CacheFactory();
// $cache = $cacheFactory->getHandler();
// $cache->clean();
return redirect()->to('login');
}
/**
* This function used to load views
* @param {string} $viewName : This is view name
* @param {mixed} $headerInfo : This is array of header information
* @param {mixed} $pageInfo : This is array of page information
* @param {mixed} $footerInfo : This is array of footer information
* @return {null} $result : null
*/
function loadViews($viewName = "", $headerInfo = NULL, $pageInfo = NULL, $footerInfo = NULL)
{
$headerInfo['pageTitle'] = $this->CompanyName ." : ".$headerInfo['pageTitle'];
$header = view('includes/header', $headerInfo);
$content = view($viewName, $pageInfo);
$footer = view('includes/footer', $headerInfo);
echo $header . $content . $footer;
}
}

File diff suppressed because it is too large Load Diff

2093
app/Controllers/Cashbook.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,219 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\Companydetails_model;
use App\Models\Supplier_model;
/**
* Module : Company
* Companycontroller Class to control all Company related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 07 Apr 2017
* @example : Revised at 15th april 2024
*/
class Companycontroller extends BaseController
{
protected $companydetailsmodel;
protected $supplier_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->companydetailsmodel = new Companydetails_model();
$this->supplier_model = new Supplier_model();
$this->session = session();
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Company Details';
$data['userRecords'] = $this->companydetailsmodel->companylisting();
$data['payment'] = $this->companydetailsmodel->getPaymentTerms();
$data['filenames'] = $this->companydetailsmodel->filelist();
$data['bankdetails'] = $this->companydetailsmodel->getBankDetails();
//$data['filetype']=$this->companydetailsmodel->getfilename();
$data['filetype'] = $this->companydetailsmodel->getfilename();
$this->loadViews("companyview", $this->global, $data, NULL);
}
/* this function used to add and update the bank details*/
public function bankdtl()
{
//$bankname = $this->request->getPost('id1');
//$ifsccode = $this->request->getPost('id2');
//$bankaddress = $this->request->getPost('id3');
//$isactive = $this->request->getPost('');
$id = $this->request->getPost('id');
$tablevalue = json_decode((string)$id, true);
foreach ($tablevalue as $tv) {
$bankname = $tv['BankName'];
$ifsccode = $tv['IFSC'];
$bankaddress = $tv['BankAddress'];
$bankaccno = $tv['BankAccountNumber'];
$bankstate = $tv['IsActive'];
//echo $bankstate;
if (strtoupper($bankstate) == 'YES') {
$isactive = 1;
} else {
$isactive = 0;
}
$Bank = array('Bank_name' => $bankname, 'IFSC' => $ifsccode, 'Address' => $bankaddress, 'Is_Active' => $isactive, 'Bank_Accno' => $bankaccno);
$result = $this->companydetailsmodel->BankDetails($Bank);
}
echo " Bank Details Successfully Saved !";
//$Bank = array('Bank_name'=>$bankname,'IFSC'=>$ifsccode,'Address'=>$bankaddress);
//$result = $this->companydetailsmodel->AddBankDetails($Bank);
}
function companyadd()
{
$this->global['pageTitle'] = 'Company Details';
$this->loadViews("companyadd", $this->global, NULL);
}
function checkPanValidate()
{
$PanNo = $this->request->getPost('panno');
$query = $this->supplier_model->checkPAN($PanNo);
if (count($query) > 0) {
// $this->validator->setMessage('checkPanValidate', 'The Entered PAN Number is already exists in the Database.');
return false;
} else {
return true;
}
}
function deletefile()
{
$ID = $this->request->getPost('id');
$updatedDate = get_current_date_time();
$userInfo = array('isDeleted' => 1);
$result = $this->companydetailsmodel->deletefile($ID, $userInfo);
echo 'Succssfully change the user status to InActive';
}
function UpdateCompany()
{
//die();
// $data['payment'] = $this->companydetailsmodel->getpayment();
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$PictureName = $this->request->getPost('Image');
$ModifyPictureName = $this->request->getPost('ModifyImage');
$Picture = "";
$file = $this->request->getFile('ModifyImage');
if ($PictureName != '') {
if ($file !== null && $file->isValid() && !$file->hasMoved()) {
$file->move(ROOTPATH.'public/uploads/images/');
$Picture = $file->getName();
}else{
$Picture = $PictureName;
}
}
else {
if ($file !== null && $file->isValid() && !$file->hasMoved()) {
$file->move(ROOTPATH.'public/uploads/images/');
$Picture = $file->getName();
}
}
$CompID = $this->request->getPost('CompanyID');
$CompanyName = $this->request->getPost('CompanyName');
$Address = $this->request->getPost('Address');
$ContactNumber = $this->request->getPost('ContactNumber');
$AlternateContactNumber = $this->request->getPost('AlternateContactNumber');
$EmailAddress = $this->request->getPost('EmailAddress');
$Exiseregistration = $this->request->getPost('Exiseregistration1');
$TIN = $this->request->getPost('TIN');
$PAN = $this->request->getPost('PAN');
$GSTNO = $this->request->getPost('GSTNO');
$GSTRange = $this->request->getPost('GSTRange');
$CollectrateAddress = $this->request->getPost('CollectrateAddress');
$UANumber = $this->request->getPost('UANumber');
$PaymentId = $this->request->getPost('paymentid');
//$Payment = $this->request->getPost('PaymentTerms');
//$PaymentDays = $this->request->getPost('PaymentDays');
//$PayableAT = $this->request->getPost('PayableAT');
$createdby = $this->session->get('userId');
$createddt = get_current_date_time();
$updatedby = $this->session->get('userId');
$updateddt = get_current_date_time();
//$UpdatedBY = $this->session->get ( 'Userid' );
//$companywebsite = $this->request->getPost('companywebsite');
//$ceoname = $this->request->getPost('ceoname');
//$mdname = $this->request->getPost('mdname');
//$companystartedon = $this->request->getPost('companystartedon');
//$partnerdetails = $this->request->getPost ('partnerdetails');
$companywebsite = $this->request->getPost('companywebsite');
//$ProfilePic = $this->request->getPost ('ProfilePic');
//$files = $this->request->getPost('files');
$filedescription1 = $this->request->getPost('filedescription');
//$files = $this->request->getPost('filename');
//$financialstart=$this->request->getPost('financialstart');
//$financialend=$this->request->getPost('financialend');
$date = $this->request->getPost('financialstart');
$financialstart = get_date_time_format($date);
$date2 = $this->request->getPost('financialend');
$financialend = get_date_time_format($date2);
$ID = $this->request->getPost('ID');
//$createdDate=$this->request->getPost('createdDate');
//$Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'PaymentTerms'=>$Payment ,'PaymentDays'=>$PaymentDays ,'PayableAT'=>$PayableAT ,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend);
$Company = array('CompID' => $CompID, 'CompanyName' => $CompanyName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'TIN' => $TIN, 'PAN' => $PAN, 'GSTNO' => $GSTNO, 'GSTRange' => $GSTRange, 'UANumber' => $UANumber, 'Createdby' => $createdby, 'ProfilePic' => $Picture, 'Exiseregistration' => $Exiseregistration, 'CollectrateAddress' => $CollectrateAddress, 'FiscalYearStartOn' => $financialstart, 'FiscalYearEndsOn' => $financialend, 'paymentID' => $PaymentId, 'companyWebsite' => $companywebsite, 'UpdatedBY' => $updatedby, 'Updatedon' => $updateddt);
if (!empty($file)) {
$myfile = array('CompID' => $CompID, 'filename' => $file, 'ID' => $ID, 'filedescription' => $filedescription1, 'createdDate' => $createddt);
$result2 = $this->companydetailsmodel->filedetails($myfile);
}
$result = $this->companydetailsmodel->Updatecompany($Company, $CompID);
if ($result > 0) {
$this->session->setFlashdata('success', 'You Have Successfully updated the company Record!');
}else{
$this->session->setFlashdata('error', 'Company Record Not Updated!');
}
return redirect()->route('companyview');
//}
}
}

View File

@ -0,0 +1,130 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Config_model;
/**
* Module : Configuration
* Configurationctrl Class to control all Configuration related operations.
* @author : Surendar
* @version : 1.1
* @since : 26 July 2017
* @example : Revised at 15th april 2024
*/
class Configurationctrl extends BaseController
{
protected $configmodel;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
helper('form'); //$this->load->library('form_validation');
$this->configmodel = new Config_model();
$this->session = session();
$this->isLoggedIn();
}
public function index()
{
$searchText = $this->request->getPost('searchText');
$data['searchText'] = $searchText;
//$count = $this->configmodel->departmentListingCount($searchText);
//$returns = $this->paginationCompress ( "configlisting/", $count, 20 );
$data['userRecords'] = $this->configmodel->configlisting();
$this->global['pageTitle'] = 'Config Listing';
$this->loadViews("configlisting", $this->global, $data, NULL);
}
function addconfig()
{
$this->global['pageTitle'] = 'Add New Config';
$this->loadViews("addconfig", $this->global, [], NULL);
}
function saveconfig()
{
$ConfigName = $this->request->getPost('configurationname');
$Rowcount = $this->request->getPost('txtRowCount');
$Comments = $this->request->getPost('Comments');
$chked = $this->request->getPost('IsActive');
$config = array('ConfigName' => $ConfigName, 'Comments' => $Comments);
$id = $this->configmodel->addconfigmaster($config);
if($id){
for ($i = 1; $i <= $Rowcount; $i++) {
$ConfigValue = $this->request->getPost('ConfigValue' . $i);
$configvalue = array('Config_ID' => $id, 'ConfigValue' => $ConfigValue);
$result = $this->configmodel->addconfigdetails($configvalue);
}
$this->session->setFlashdata('success', 'New Configuration Created successfully!');
}else{
$this->session->setFlashdata('error', 'Configuration Record Not Created!');
}
return redirect()->route('configlisting');
}
function editconfig($ConfigID = '')
{
$ConfigID = $this->request->getVar('ConfigID');
$data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID);
$data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID);
$this->global['pageTitle'] = 'Edit Config';
$this->loadViews("editconfig", $this->global, $data, NULL);
}
function updateconfig()
{
$ConfigId = $this->request->getPost('ConfigId');
$ConfigName = $this->request->getPost('ConfigName');
$Comments = $this->request->getPost('Remarks');
$Rowcount = $this->request->getPost('txtRowCount');
$config = array('Config_ID' => $ConfigId, 'ConfigName' => $ConfigName, 'Comments' => $Comments);
$result = $this->configmodel->updateconfig($config, $ConfigId);
for ($i = 1; $i <= $Rowcount; $i++) {
$child_primary_key = $this->request->getPost('DbKey' . $i);
$config_value = $this->request->getPost('configVal' . $i);
$child_arr = array('ConfigValue' => $config_value);
if((int)$child_primary_key != 0){
$child_result = $this->configmodel->updateconfigdetails($child_arr, $child_primary_key);
}
if((int)$child_primary_key == 0){
$child_arr['Config_ID'] = $ConfigId;
$child_result = $this->configmodel->addconfigdetails($child_arr);
}
}
if ($result || $child_result) {
$this->session->setFlashdata('success', 'Configuration Updated successfully!');
} else {
$this->session->setFlashdata('error', 'Configuration Record Not Updated!');
}
return redirect()->route('configlisting');
}
}

View File

@ -0,0 +1,402 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Costcenter_model;
/**
* Module : Cost Center
* Cost Center Class to control all cost center related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class CostCenter extends BaseController
{
protected $costcenter_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->costcenter_model = new Costcenter_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$data['userRecords'] = $this->costcenter_model->CostListing();
$this->global['pageTitle'] = 'Cost List';
$this->loadViews("costListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new cost Center */
function addCostCenter()
{
$data['Department'] = $this->costcenter_model->getDepartment();
$data['BudgetType'] = $this->costcenter_model->getConfigValue('C004');
$data['Approver'] = $this->costcenter_model->getApproverName();
$data['FiscalYear'] = $this->costcenter_model->getFiscalYear();
$this->global['pageTitle'] = 'Add Cost Center';
$this->loadViews("addCostCenter", $this->global, $data, NULL);
}
function Dep_SelectedDepartment($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if (strlen($selectValue) <= 0) {
// $this->validator->setMessage('Dep_SelectedDepartment', 'Please Select Department.');
return false;
} else // user picked something
{
return true;
}
}
/**
* This function is used to add new Cost to the system
*/
function saveCostCenter()
{
// $this->validator->setRules([
// 'CostName' => 'trim|required',
// 'CostCode' => 'trim|required',
// ]);
// if ($this->validator->run() == FALSE) {
// $this->addCostCenter();
// } else {
$CostCode = $this->request->getPost('CostCode');
$CostCode = ($CostCode !== null && is_string($CostCode)) ? strtoupper(trim($CostCode)) :null;
$CostName = $this->request->getPost('CostName');
$CostName = ($CostName !== null && is_string($CostName)) ? strtoupper(trim($CostName)) :null;
$CreateBy = $this->session->get('userId');
$SelectedDepartment = $this->request->getPost('txtSelectedDepartment');
$ApproverName = $this->request->getPost('ApprovedBy');
$comma_separated = explode(':', (string)$SelectedDepartment);
// $comma_separated = $this->costcenter_model->getDepartment();
// print_r($comma_separated);die;
$createddt = get_current_date_time();
$CodeExists = $this->costcenter_model->checkCostDetailsExists($CostCode);
if (count($CodeExists) == 0) {
$Cost = array('CostCenterCode' => $CostCode, 'CostCenterName' => $CostName, 'ApprovedBy' => $ApproverName, 'CreatedBy' => $CreateBy, 'createdDate' => $createddt);
$this->costcenter_model->saveCostCenter($Cost);
}
for ($j = 0; $j < count($comma_separated); $j++) {
$DeptCode = $comma_separated[$j];
$this->costcenter_model->DeleteDepartment($DeptCode, $CostCode);
$Dept = array('CostCenterCode' => $CostCode, 'DEPCode' => $DeptCode, 'CreatedBy' => $CreateBy, 'createdDate' => $createddt);
$this->costcenter_model->addCostCenterDepartment($Dept);
}
$RowCount = $this->request->getPost('txtRowCount');
for ($i = 1; $i <= $RowCount; $i++) {
$BudgetType = $this->request->getPost('BudgetType' . $i);
$BudgetYear = $this->request->getPost('BudgetYear' . $i);
$BudgetAmount = $this->request->getPost('BudgetAmount' . $i);
$Remarks = $this->request->getPost('Remarks' . $i);
$this->costcenter_model->DeleteBudget($BudgetType, $BudgetYear, $CostCode);
$Budget = array('CostCenterCode' => $CostCode, 'BudgetType' => $BudgetType, 'BudgetYear' => $BudgetYear, 'BudgetAmount' => $BudgetAmount, 'Remarks' => $Remarks, 'CreatedBy' => $CreateBy, 'createdDate' => $createddt);
$this->costcenter_model->addBudget($Budget);
}
echo 'Successfully Created Cost details';
// }
}
/**
* This function is used load user edit information
* @param number $userId : Optional : This is user id
*/
function editCostCenter($CostCode = NULL)
{
if ($CostCode == '') {
$CostCenterID = $_GET['CostCode'];
} else {
$CostCenterID = $CostCode;
}
$data['CostMaster'] = $this->costcenter_model->GetCostCenterMaster($CostCenterID);
$data['CostDepts'] = $this->costcenter_model->GetCostCenterDepartment($CostCenterID);
$data['CostBudget'] = $this->costcenter_model->GetCostCenterBudget($CostCenterID);
$data['DeptList'] = $this->costcenter_model->GetDepartmentNotinCostCenter($CostCenterID);
$data['BudType'] = $this->costcenter_model->GetBudgetTypeNotinCostCenter($CostCenterID, 'C004');
$data['BudYear'] = $this->costcenter_model->GetBudgetYear($CostCenterID);
$data['FiscalYear'] = $this->costcenter_model->getFiscalYear();
//print_r(count($data['BudType']));
$this->global['pageTitle'] = 'Edit Cost';
$this->loadViews("editCostCenter", $this->global, $data, NULL);
}
function GetBudgetForYear()
{
//$id = $this->request->getPost('id');
$BudYear = $_GET['BudYear'];
$CostCenterID = $_GET['CostCode'];
$result = $this->costcenter_model->GetCostCenterBudgetByYear($CostCenterID, $BudYear);
$BudList = $this->costcenter_model->GetCostBudgetTypeByYear($CostCenterID, 'C004', $BudYear);
$HTML = "";
$HTML2 = "";
$index = 0;
// $HTML2 = $BudList[0]['ConfigValue'];
//if($BudList->num_rows() > 0){
for ($j = 0; $j < count($BudList); $j++) {
$ConfigValue = $BudList[$j]['ConfigValue'];
$HTML2 .= "<option value='" . $ConfigValue . "'>" . $ConfigValue . "</option>";
}
for ($i = 0; $i < count($result); $i++) {
$index = $index + 1;
$BudgetType = $result[$i]['BudgetType'];
$BudgetYear = $result[$i]['BudgetYear'];
$BudgetAmount = $result[$i]['BudgetAmount'];
$Remarks = $result[$i]['Remarks'];
$HTML .= "<tr id='" . $index . "'>
<td align='left'>" . $BudgetType . "</td>
<input type='hidden' name='BudgetType" . $index . "' id='BudgetType" . $index . "' value='" . $BudgetType . "'/>
<input type='hidden' name='BudgetYear" . $index . "' id='BudgetYear" . $index . "' value='" . $BudgetYear . "'/>
<input type='hidden' name='BudgetAmount" . $index . "' id='BudgetAmount" . $index . "' value='" . $BudgetAmount . "'/>
<input type='hidden' name='Remarks" . $index . "' id='Remarks" . $index . "' value='" . $Remarks . "'/>
<td align='left'>" . $BudgetYear . "</td>
<td align='left'>" . $BudgetAmount . "</td>
<td align='left'>" . $Remarks . "</td>
<td>
<a data-target='#Edit' data-id=" . $index . " data-userid=" . $index . " data-toggle='modal' href='#Edit'><i class='fa fa-pencil' data-toggle='tooltip' title='Click here to view/Edit the " . $BudgetType . " Budget details'></i>&nbsp;&nbsp;&nbsp;</a> </td></tr>
";
}
$HTML .= "<input type='hidden' name='txtRowCount' id='txtRowCount' value='" . $index . "'/>";
die(json_encode(array('Html' => $HTML, 'BudYear' => $HTML2)));
// echo $HTML2;
}
/**
* This function is used to edit the user information
*/
function updateCostCenter()
{
$CostCode = $this->request->getPost('CostCode');
$CostCode = ($CostCode !== null && is_string($CostCode)) ? strtoupper(trim($CostCode)) :null;
$CostName = $this->request->getPost('CostName');
$CostName = ($CostName !== null && is_string($CostName)) ? strtoupper(trim($CostName)) :null;
$updatedBy = $this->session->get('userId');
$SelectedDepartment = (string)$this->request->getPost('txtSelectedDepartment');
$ApproverName = $this->request->getPost('ApprovedBy');
$comma_separated = [];
print_r(strlen($SelectedDepartment));
if(strlen($SelectedDepartment)>0)
{
$comma_separated = explode(':', $SelectedDepartment);
}
$updateddt = get_current_date_time();
$Cost = array( 'CostCenterName'=>$CostName,'ApprovedBy'=>$ApproverName,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
$this->costcenter_model->EditCost($Cost,$CostCode);
if(count($comma_separated)>= 1)
{
for ($j = 0; $j < count($comma_separated); $j++)
{
// $DeptCode = $comma_separated[$j];
// $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode);
// $Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
// $this->costcenter_model->addCostCenterDepartment($Dept);
}
}
$RowCount = $this->request->getPost('txtRowCount');
if($RowCount){
for ($i = 1; $i <= $RowCount; $i++)
{
$BudgetType = $this->request->getPost('BudgetType'.$i);
$BudgetYear = $this->request->getPost('BudgetYear'.$i);
$BudgetAmount = $this->request->getPost('BudgetAmount'.$i);
$Remarks = $this->request->getPost('Remarks'.$i);
// $this->costcenter_model->DeleteBudget($BudgetType,$BudgetYear,$CostCode);
$Budget = array('CostCenterCode'=>$CostCode, 'BudgetType'=>$BudgetType,'BudgetYear'=>$BudgetYear,'BudgetAmount'=>$BudgetAmount,'Remarks'=>$Remarks,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
$ExistYearBudget = $this->costcenter_model->CheckExistBudget($BudgetType,$BudgetYear,$CostCode);
// print_r($Budget);
if($ExistYearBudget){
$this->costcenter_model->updateBudget($Budget,$BudgetType,$BudgetYear,$CostCode);
}
else{
$this->costcenter_model->addBudget($Budget);
}
}
}
echo('Successfully Updated Cost details');
}
function DeleteCostDepartment()
{
// echo "dasf";
// die();
$CostCode = $this->request->getPost('CostCode');
$CostCode = ($CostCode !== null && is_string($CostCode)) ? strtoupper(trim($CostCode)) :null;
$CostName = $this->request->getPost('CostName');
$CostName = ($CostName !== null && is_string($CostName)) ? strtoupper(trim($CostName)) :null;
$updatedBy = $this->session->get('userId');
$SelectedDepartment = $this->request->getPost('txtSelectedDepartment');
$this->costcenter_model->DeleteDepartment($SelectedDepartment, $CostCode);
echo ("Department Removed Successfully");
}
function AddCostDepartment()
{
$CostCode = $this->request->getPost('CostCode');
$CostCode = ($CostCode !== null && is_string($CostCode)) ? strtoupper(trim($CostCode)) :null;
$CostName = $this->request->getPost('CostName');
$CostName = ($CostName !== null && is_string($CostName)) ? strtoupper(trim($CostName)) :null;
$updatedBy = $this->session->get('userId');
$SelectedDepartment = $this->request->getPost('txtSelectedDepartment');
// $updatedBy = $this->session->get ( 'userId' );
$updateddt = get_current_date_time();
$Dept = array('CostCenterCode' => $CostCode, 'DEPCode' => $SelectedDepartment, 'CreatedBy' => $updatedBy, 'createdDate' => $updateddt, 'UpdatedBy' => $updatedBy, 'UpdatedDate' => $updateddt);
$this->costcenter_model->addCostCenterDepartment($Dept);
echo ("Department Added Successfully");
}
// function AddCostDepartment()
// {
// // echo "343";
// // die();
// $CostCode = strtoupper(trim($this->request->getPost('CostCode')));
// $CostName = strtoupper(trim($this->request->getPost('CostName')));
// $updatedBy = $this->session->get ( 'userId' );
// $SelectedDepartment = $this->request->getPost('txtSelectedDepartment');
// //echo $SelectedDepartment;
// //die();
// $ApproverName = $this->request->getPost('ApprovedBy');
// $comma_separated = "";
// //print_r(strlen($SelectedDepartment));
// if(strlen($SelectedDepartment)>0)
// {
// $comma_separated = explode(':', $SelectedDepartment);
// }
// //die();
// //echo count($comma_separated);
// $updateddt = get_current_date_time();
// if(count($comma_separated)>= 1)
// {
// for ($j = 0; $j < count($comma_separated); $j++)
// {
// $DeptCode = $comma_separated[$j];
// $this->costcenter_model->DeleteDepartment( $DeptCode,$CostCode);
// $Dept = array('CostCenterCode'=>$CostCode, 'DEPCode'=>$DeptCode,'CreatedBy'=>$updatedBy,'createdDate'=>$updateddt,'UpdatedBy'=>$updatedBy,'UpdatedDate'=>$updateddt);
// //print_r($Dept);
// $this->costcenter_model->addCostCenterDepartment($Dept);
// }
// echo "Updated";
// }
// }
function viewcost($CostCenterID = NULL)
{
if ($CostCenterID == null) {
redirect('costListing');
}
$data['Cost'] = $this->costcenter_model->getuserinfo($CostCenterID);
//$data['users'] = $this->purchaseorder_model->getusers();
$this->global['pageTitle'] = 'View Cost';
$this->loadViews("viewcost", $this->global, $data, NULL);
}
/**
* This function is used to delete the user using userId
* @return boolean $result : TRUE / FALSE
*/
function deletecost()
{
// if($this->isAdmin() == TRUE)
// {
// echo(json_encode(array('status'=>'access')));
// }
// else
// {
$CostCenterID = $this->request->getPost('CostCentreID');
$cost = array('CreateDate' => date('Y-m-d H:i:sa'));
$result = $this->costcenter_model->deletecost($cost, $CostCenterID);
if ($result > 0) {
echo (json_encode(array('status' => TRUE)));
} else {
echo (json_encode(array('status' => FALSE)));
}
//}
}
}

View File

@ -0,0 +1,158 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Department_model;
/**
* Module : Department
* Department Class to control all department related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 12 Apr 2017
* @example : Revised at 15th april 2024
*/
class Department extends BaseController
{
protected $department_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->department_model = new Department_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
// $this->load->library('Excel');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$this->department_model = new department_model();
//$searchText = $this->request->getPost('searchText');
//$data['searchText'] = $searchText;
//$count = $this->department_model->departmentListing($searchText);
//$returns = $this->paginationCompress ( "departmentListing/", $count, 20 );
$data['userRecords'] = $this->department_model->departmentListing(); //$searchText, $returns["page"], $returns["segment"]);
$this->global['pageTitle'] = 'Department Listing';
$this->loadViews("departmentListing", $this->global, $data, NULL);
//}
}
/**
* This function is used to load the add new supplier */
function adddepartment()
{
//$data['payment'] = $this->department_model->getpayment();
//$data['depcode'] = $this->department_model->getdepcode();
$data['depcode'] = $this->department_model->getdepcode();
$this->global['pageTitle'] = 'AddNew Department';
$this->loadViews("adddepartment", $this->global, $data, NULL);
}
function savedepartment()
{
$DepartmentName = $this->request->getPost('DepartmentName');
$DEPCode = $this->request->getPost('DEPCode');
$HeadDept = $this->request->getPost('HeadDept');
$Createdby = $this->session->get('userId');
$chked = $this->request->getPost('IsActive');
if ($chked != '') {
$IsActive = '1';
} else {
$IsActive = '0';
}
$department = array('DepartmentName' => $DepartmentName, 'DEPCode' => $DEPCode, 'HeadDept' => $HeadDept, 'Createdby' => $Createdby, 'IsActive' => $IsActive);
$result = $this->department_model->savedepartment($department);
if ($result > 0) {
$this->session->setFlashdata('success', 'Department Created successfully!');
}else{
$this->session->setFlashdata('error', 'Department Record Not Created!');
}
return redirect()->route('departmentListing');
}
/**
* This function is used to edit the department information
*/
function editdepartment()
{
$DepartmentName = $this->request->getPost('DepartmentName');
$DEPCode = $this->request->getPost('DEPCode');
$HeadDept = $this->request->getPost('HeadDept');
$Createdby = $this->session->get('userId');
$chked = $this->request->getPost('IsActive');
if ($chked != '') {
$IsActive = '1';
} else {
$IsActive = '0';
}
$department = array('DepartmentName' => $DepartmentName, 'DEPCode' => $DEPCode, 'HeadDept' => $HeadDept, 'IsActive' => $IsActive);
$result = $this->department_model->Updatedepartment($department, $DEPCode);
if ($result == True) {
$this->session->setFlashdata('success', 'Department Record Successfully Updated!');
}else{
$this->session->setFlashdata('error', 'Department Record Not Updated!');
}
return redirect()->route('departmentListing');
}
function viewdepartment($SID = '')
{
//print_r('hello');die();
if ($SID == '') {
$DepartmentID = $_GET['SID'];
} else {
$DepartmentID = $SID;
}
$data['department'] = $this->department_model->getDeptInfo($DepartmentID);
$data['depcode'] = $this->department_model->getdepcode();
$this->global['pageTitle'] = 'Edit Department';
$this->loadViews("editdepartment", $this->global, $data, NULL);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,706 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Companydetails_model;
use App\Models\Employeedetails_model;
/**
* Module : Employee
* Employeedetails Class to control all employee related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 07 Apr 2017
* @example : Revised at 15th april 2024
*/
class Employeedetails extends BaseController
{
protected $companydetailsmodel;
protected $employeedetails_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->employeedetails_model = new Employeedetails_model();
$this->companydetailsmodel = new Companydetails_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function is used to load the Employee details
*/
public function index()
{
$data['userRecords'] = $this->employeedetails_model->employeeListing();
$this->global['pageTitle'] = 'Employee Listing';
$this->loadViews("employeeListing", $this->global, $data, NULL);
}
/*
Validation for Gender status Dropdown
*/
function Gender_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('Gender_validate', 'Please Select Gender.');
echo "<script>alert('Please Select Gender.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/*
Validation for Martial status Dropdown
*/
function Martial_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('Martial_validate', 'Please Select Martial status.');
echo "<script>alert('Please Select Martial status.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/*
Validation for BloodGroup Dropdown
*/
function Blood_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('Blood_validate', 'Please Select Blood Group.');
echo "<script>alert('Please Select Blood Group.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/*
Validation for Qualification Dropdown
*/
function select_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('select_validate', 'Supplier Record Not updated!');
echo "<script>alert('Supplier Record Not updated!');</script>";
return false;
} else // user picked something
{
return true;
}
}
/*
Validation for Department Dropdown
*/
function Dep_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('Dep_validate', 'Please Select Department.');
echo "<script>alert('Please Select Department.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/*
Validation for Desigination Dropdown
*/
function Des_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('Des_validate', 'Please Select Desigination.');
echo "<script>alert('Please Select Desigination.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/* To Check the Pan Number is exists in the database or not */
function Pan_validate()
{
// alert('validation pan');
$PanNo = $this->request->getPost('panno');
$query = $this->employeedetails_model->checkPANExists($PanNo);
if (count($query) > 0) {
// $this->validator->setMessage('checkPanValidate', 'The Entered PAN Number is already exists in the Database.');
echo "<script>alert('The Entered PAN Number is already exists in the Database.');</script>";
return false;
} else {
return true;
}
}
/* To Check the Pan Number is exists in the database or not */
function Aadhar_validate()
{
$AadharNo = $this->request->getPost('aadharno');
$query = $this->employeedetails_model->checkAadharExists($AadharNo);
if (count($query) > 0) {
// $this->validator->setMessage('checkAadharValidate', 'The Entered Aadhar Number is already exists in the Database.');
echo "<script>alert('The Entered Aadhar Number is already exists in the Database.');</script>";
return false;
} else {
return true;
}
}
/**
* This function is used to save the new Employee form in the database
*/
function AddNewEmployee()
{
$validation = \Config\Services::validation();
// $this->validator->setRules([
// 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'emailid'=> 'trim|required|valid_email',
// 'gender'=> 'callback_Gender_validate',
// 'MartialStatus'=> 'callback_Martial_validate',
// 'bloodgroup'=>'callback_Blood_validate',
// 'emergencycontactnumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'desigination'=> 'callback_Des_validate',
// 'departmentname'=> 'callback_Dep_validate',
// 'eduqualifaction'=> 'callback_select_validate',
// 'referrercontno'=> 'trim|min_length[10]|max_length[10]',
// 'aadharno'=> 'trim|min_length[14]|max_length[14]',
// 'panno'=> 'trim|min_length[10]|max_length[10]',
// 'passportno'=> 'trim|min_length[9]|max_length[9]',
// 'accountno'=> 'trim|min_length[10]|max_length[20]',
// 'pfno'=> 'trim|min_length[22]|max_length[22]',
// 'esino'=> 'trim|min_length[10]|max_length[10]']);
// if ($this->validator->run() == FALSE) {
// $this->addemployee();
// //echo 'Validate method called';
// } else {
//echo 'Validate not method called';
$photo = $this->request->getFile('photo');
$Picture = "";
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($photo->getExtension(), $allowedTypes)) {
$newName = $photo->getRandomName();
$photo->move($uploadDir, $newName);
$Picture = $newName;
}
}
// $Profile = $this->request->getPost('photo');
$FirstName = $this->request->getPost('FirstName');
$LastName = $this->request->getPost('LastName');
$FatherName = $this->request->getPost('FatherName');
$DateofBirth = $this->request->getPost('DateofBirth');
$ContactNumber = $this->request->getPost('ContactNumber');
$EmailId = $this->request->getPost('emailid');
$comEmailId = $this->request->getPost('comemailid');
$Gender = $this->request->getPost('gender');
$MartialStatus = $this->request->getPost('MartialStatus');
$BloodGroup = $this->request->getPost('bloodgroup');
$CurrentAddress = $this->request->getPost('currentaddress');
$permanentaddress = $this->request->getPost('permanentaddress');
$emergencycontactname = $this->request->getPost('emergencycontactname');
$emergencycontactnumber = $this->request->getPost('emergencycontactnumber');
$desigination = $this->request->getPost('desigination');
$departmentCode = $this->request->getPost('departmentname');
$dateofjoining = $this->request->getPost('dateofjoining');
$pre_experience = $this->request->getPost('Previousexperience');
if ($pre_experience == '') {
$Previousexperience = null;
} else {
$Previousexperience = $pre_experience;
}
$eduqualifaction = $this->request->getPost('eduqualifaction');
$addqualification = $this->request->getPost('addqualification');
$referredby = $this->request->getPost('referredby');
$referrercontno = $this->request->getPost('referrercontno');
$accountno = $this->request->getPost('accountno');
$ifsccode = $this->request->getPost('ifsccode');
$bankbranchname = $this->request->getPost('bankbranchname');
$bankaddress = $this->request->getPost('bankaddress');
$aadharno = $this->request->getPost('aadharno');
$panno = $this->request->getPost('panno');
$panno = $panno !== null && is_string($panno) ? strtoupper($panno) : null;
$passportno = $this->request->getPost('passportno');
$passportno = $passportno !== null && is_string($passportno) ? strtoupper($passportno) : null;
$ValidTill = $this->request->getPost('ValidTill');
$addinfo = $this->request->getPost('addinfo');
$IsActive = '1';
$driverlicense = $this->request->getPost('driverlicense');
$driverlicense = $driverlicense !== null && is_string($driverlicense) ? strtoupper($driverlicense) : null;
$licenseExpiryDate = $this->request->getPost('licenseExpiryDate');
$VoterID = $this->request->getPost('voterID');
$VoterID = $VoterID !== null && is_string($VoterID) ? strtoupper($VoterID) : null;
$PFno = $this->request->getPost('pfno');
$ESIno = $this->request->getPost('esino');
$Nominee = $this->request->getPost('nomineename');
$createdby = $this->session->get('userId');
if ($licenseExpiryDate != '') {
//$License_ExpiryDate = get_date_format($licenseExpiryDate);
$License_ExpiryDate = get_date_time_format($licenseExpiryDate);
} else {
$License_ExpiryDate = null;
}
$DOB = get_date_time_format($DateofBirth);
$DOJ = get_date_time_format($dateofjoining);
if ($ValidTill != '') {
$Valid = get_date_time_format($ValidTill);
} else {
$Valid = null;
}
//echo $DOB;
$Employee = array(
'FirstName' => $FirstName, 'LastName' => $LastName, 'FatherName' => $FatherName,
'Gender' => $Gender, 'DateofBirth' => $DOB, 'ContactNumber' => $ContactNumber, 'EmailId' => $EmailId,
'BloodGroup' => $BloodGroup, 'MartialStatus' => $MartialStatus, 'DateofJoining' => $DOJ,
'PreviousYearsOfExp' => $Previousexperience, 'Designation' => $desigination,
'Departmentcode' => $departmentCode, 'PresentAddress' => $CurrentAddress,
'PermanentAddress' => $permanentaddress, 'EmergencyContactName' => $emergencycontactname,
'EmergencyContactNumber' => $emergencycontactnumber, 'Edu_Qualification' => $eduqualifaction,
'Additional_Qualification' => $addqualification, 'AadharNo' => $aadharno, 'PANNo' => $panno,
'BankAccountNo' => $accountno, 'IFSCCode' => $ifsccode, 'BankBranchName' => $bankbranchname,
'BankAddress' => $bankaddress, 'PassportNo' => $passportno, 'Passport_Valid_till' => $Valid,
'IsActive' => $IsActive, 'ProfilePic' => $Picture, 'Reference_Name' => $referredby,
'Reference_ContactNumber' => $referrercontno, 'Remarks' => $addinfo, 'CreatedBy' => $createdby,
'personalEmailId' => $comEmailId, 'DriverLicense' => $driverlicense,
'LicenseValidtill' => $License_ExpiryDate, 'VoterID' => $VoterID, 'PFNO' => $PFno, 'ESI' => $ESIno,
'NomineeDetails' => $Nominee
);
//print_r($Employee);die();
$result = $this->employeedetails_model->addNewemployee($Employee);
if ($result > 0) {
// $this->session->set_flashdata('Success', 'New Employee created successfully!');
$this->session->setFlashdata('success', 'New Employee created successfully!');
// echo "<script>alert('New Employee Created successfully!');</script>";
} else {
// $this->session->set_flashdata('Error', 'New Employee details not saved');
$this->session->setFlashdata('error', 'Record Not Saved!');
// echo "<script>alert('Record Not Saved!');</script>";
// redirect('employeeListing', 'refresh');
}
return redirect()->route('employeeListing');
// }
}
/**
* This function is used to load the add new Employee form with dropdown values */
function addemployee()
{
$GenderConfigID = 'C013';
$MartialConfigID = 'C012';
$QualificationConfigID = 'C014';
$DesignationConfigID = 'C010';
$BloodGroupConfigID = 'C011';
$data['Gender'] = $this->employeedetails_model->getConfigValue($GenderConfigID);
$data['Martial'] = $this->employeedetails_model->getConfigValue($MartialConfigID);
$data['bankdetails'] = $this->employeedetails_model->getBankDetails();
$data['Qualification'] = $this->employeedetails_model->getConfigValue($QualificationConfigID);
$data['Designation'] = $this->employeedetails_model->getConfigValue($DesignationConfigID);
$data['BloodGroup'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID);
$data['Department'] = $this->employeedetails_model->getDepartment();
$this->global['pageTitle'] = 'Add New Employee';
// if($this->role == ROLE_ADMIN || $this->DEPCode == HR)
// {
$this->loadViews("addEmployee", $this->global, $data, NULL);
// }
// else
// {
// $this->loadViews("access", $this->global, $data, NULL);
// }
}
/**
* This function is used to check whether the Employee is existing in the database or not */
function CheckEmail()
{
$id = $this->request->getPost('id');
//print_r($id);
$query = $this->employeedetails_model->checkMailExists($id);
$response = ($query !== null && !empty($query)) ? $query[0]['EmailId'] : null;
return $this->response->setJSON($response);
}
function checkPAN()
{
$id = $this->request->getPost('id');
//print_r($id);
$query = $this->employeedetails_model->checkPANExists($id);
$response = ($query !== null && !empty($query)) ? $query[0]['PANNo'] : null;
return $this->response->setJSON($response);
// print_r($query);
}
function checkAadharNo()
{
$id = $this->request->getPost('id');
//print_r($id);
$query = $this->employeedetails_model->checkAadharExists($id);
$response = ($query !== null && !empty($query)) ? $query[0]['AadharNo'] : null;
return $this->response->setJSON($response);
}
/* To Check the Pan Number is exists in the database or not for the selected Supplier */
function Pan_validate_emp()
{
//print_r($PanNo);
$Empid = $this->request->getPost('employeeid');
$PanNo = $this->request->getPost('panno');
$query = $this->employeedetails_model->checkPANExists($PanNo, $Empid);
if (count($query) > 0) {
// $this->validator->setMessage('Pan_validate_emp', 'The Entered PAN Number is already exists in the Database.');
echo "<script>alert('The Entered PAN Number is already exists in the Database.');</script>";
return false;
} else {
return true;
}
}
// To Check the Aadhar Number is exists in the database or not for the selected Employee
function Aadhar_validate_emp()
{
$Empid = $this->request->getPost('employeeid');
$AadharNo = $this->request->getPost('aadharno');
$query = $this->employeedetails_model->checkAadharExists($AadharNo, $Empid);
if (count($query) > 0) {
// $this->validator->setMessage('Aadhar_validate_emp', 'The Entered Aadhar Number is exists in the Database.');
echo "<script>alert('The Entered Aadhar Number is exists in the Database.');</script>";
return false;
} else {
return true;
}
}
public function add($photo)
{
$picture = '';
if ($photo->isValid() && !$photo->hasMoved()) {
// Define upload directory and allowed file types
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
// Validate file type
if (in_array($photo->getExtension(), $allowedTypes)) {
// Generate unique file name
$newName = $photo->getRandomName();
// Move the uploaded file to the upload directory
$photo->move($uploadDir, $newName);
$picture = $newName;
} else {
// Handle invalid file type
$picture = '';
}
}
return $picture;
}
function ViewEmployee($EmpNO = '')
{
if ($EmpNO == '') {
$EmpID = $_GET['EmpID'];
} else {
$EmpID = $EmpNO;
}
$GenderConfigID = 'C013';
$MartialConfigID = 'C012';
$QualificationConfigID = 'C014';
$DesignationConfigID = 'C010';
$BloodGroupConfigID = 'C011';
//print_r('hai');
$data['GenderList'] = $this->employeedetails_model->getConfigValue($GenderConfigID);
$data['MartialList'] = $this->employeedetails_model->getConfigValue($MartialConfigID);
$data['QualificationList'] = $this->employeedetails_model->getConfigValue($QualificationConfigID);
$data['DesignationList'] = $this->employeedetails_model->getConfigValue($DesignationConfigID);
$data['BloodGroupList'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID);
$data['bankdetails'] = $this->employeedetails_model->getBankDetails();
$data['DepartmentList'] = $this->employeedetails_model->getDepartment();
$data['EmpDetails'] = $this->employeedetails_model->viewemployee($EmpID);
$this->global['pageTitle'] = 'View Employee';
$this->loadViews("editEmployee", $this->global, $data, NULL);
}
/* To Check the email exists in the database or not for the employee*/
function checkMailEmp()
{
$Empid = $this->request->getPost('employeeid');
$EmailId = $this->request->getPost('emailid');
$query = $this->employeedetails_model->checkMailExists($EmailId, $Empid);
if (count($query) > 0) {
// $this->validator->setMessage('checkMailEmp', 'The Entered Email id is exists in the Database.');
echo "<script>alert('The Entered Email id is exists in the Database.');</script>";
return false;
} else {
return true;
}
}
/* To Update the employee details*/
function UpdateEmployee()
{
$EmpId = $this->request->getPost('employeeid');
//$mail = $this->this->.post('emailid');
// $this->validator->setRules([
// 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'emailid'=> 'trim|required|valid_email|callback_checkMailEmp',
// 'gender'=> 'callback_Gender_validate',
// 'MartialStatus'=> 'callback_Martial_validate',
// 'bloodgroup'=> 'callback_Blood_validate',
// 'emergencycontactnumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'desigination'=> 'callback_Des_validate',
// 'departmentname'=> 'callback_Dep_validate',
// 'eduqualifaction'=> 'callback_select_validate',
// 'referrercontno'=> 'trim|min_length[10]|max_length[10]',
// 'aadharno'=> 'trim|max_length[14]',
// 'panno'=> 'trim|max_length[10]',
// 'passportno'=> 'trim|min_length[9]|max_length[9]',
// 'accountno'=> 'trim|min_length[10]|max_length[20]',
// 'pfno'=> 'trim|min_length[22]|max_length[22]',
// 'esino'=> 'trim|min_length[10]|max_length[10]']);
// if ($this->validator->run() == FALSE) {
// $this->ViewEmployee($EmpId);
// } else {
$EmpId = $this->request->getPost('employeeid');
$PictureName = $this->request->getPost('Image');
$ModifyPictureName = $this->request->getPost('ModifyImage');
$Picture = "";
if ($PictureName != '') {
//echo 'Exists';
//$Picture = $PictureName;
if (strlen((string)$ModifyPictureName) == 0) {
//echo 'Exists But Not replace';
$Picture = $PictureName;
} else {
//echo 'Exists But Replace';
//$Picture = $ModifyPictureName;
//$Picture = $this->editimage($ModifyPictureName);
$photo = $this->request->getFile('ModifyImage');
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($photo->getExtension(), $allowedTypes)) {
$newName = $photo->getRandomName();
$photo->move($uploadDir, $newName);
$Picture = $newName;
}
}
}
} else {
//echo 'Not Exists';
$photo = $this->request->getFile('photo');
if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
if (in_array($photo->getExtension(), $allowedTypes)) {
$newName = $photo->getRandomName();
$photo->move($uploadDir, $newName);
$Picture = $newName;
}
}
}
//echo $Picture;
$FirstName = $this->request->getPost('FirstName');
$LastName = $this->request->getPost('LastName');
$FatherName = $this->request->getPost('FatherName');
$DateofBirth = $this->request->getPost('DateofBirth');
$ContactNumber = $this->request->getPost('ContactNumber');
$EmailId = $this->request->getPost('emailid');
$comEmailId = $this->request->getPost('comemailid');
$Gender = $this->request->getPost('gender');
$MartialStatus = $this->request->getPost('MartialStatus');
$BloodGroup = $this->request->getPost('bloodgroup');
$CurrentAddress = $this->request->getPost('currentaddress');
$permanentaddress = $this->request->getPost('permanentaddress');
$emergencycontactname = $this->request->getPost('emergencycontactname');
$emergencycontactnumber = $this->request->getPost('emergencycontactnumber');
$desigination = $this->request->getPost('desigination');
$departmentCode = $this->request->getPost('departmentname');
$dateofjoining = $this->request->getPost('dateofjoining');
//$Previousexperience = $this->request->getPost('Previousexperience');
$pre_experience = $this->request->getPost('Previousexperience');
if ($pre_experience == '') {
$Previousexperience = null;
} else {
$Previousexperience = $pre_experience;
}
$eduqualifaction = $this->request->getPost('eduqualifaction');
$addqualification = $this->request->getPost('addqualification');
$referredby = $this->request->getPost('referredby');
$referrercontno = $this->request->getPost('referrercontno');
$accountno = $this->request->getPost('accountno');
$ifsccode = $this->request->getPost('ifsccode');
$bankbranchname = $this->request->getPost('bankbranchname');
$bankaddress = $this->request->getPost('bankaddress');
$aadharno = $this->request->getPost('aadharno');
$panno = $this->request->getPost('panno');
$panno = $panno !== null && is_string($panno) ? strtoupper($panno) : null;
$passportno = $this->request->getPost('passportno');
$passportno = $passportno !== null && is_string($passportno) ? strtoupper($passportno) : null;
$ValidTill = $this->request->getPost('ValidTill');
$addinfo = $this->request->getPost('addinfo');
$driverlicense = $this->request->getPost('driverlicense');
$driverlicense = $driverlicense !== null && is_string($driverlicense) ? strtoupper($driverlicense) : null;
$licenseExpiryDate = $this->request->getPost('LicenseExpiryDate');
$VoterID = $this->request->getPost('voterID');
$VoterID = $VoterID !== null && is_string($VoterID) ? strtoupper($VoterID) : null;
$pfno = $this->request->getPost('pfno');
$pfno = $pfno !== null && is_string($pfno) ? strtoupper($pfno) : null;
//$uano = $this->request->getPost('uano');
$esino = $this->request->getPost('esino');
$Nominee = $this->request->getPost('nomineename');
$chked = $this->request->getPost('isactive');
// echo 'chkvalue'. $chked ;
if ($chked != '') {
$IsActive = '1';
} else {
$IsActive = '0';
}
// echo 'chkvalue'. $IsActive ;
$UpdatedBY = $this->session->get('userId');
//$licenseExpiryDate = get_date_time_format($licenseExpiryDate);
$DOB = get_date_format($DateofBirth);
$DOJ = get_date_format($dateofjoining);
if ($ValidTill != '') {
$Valid = get_date_format($ValidTill);
} else {
$Valid = null;
}
if ($licenseExpiryDate != '') {
$License_ExpiryDate = get_date_format($licenseExpiryDate);
} else {
$License_ExpiryDate = null;
}
//echo $DOB;
$Employee = array(
'FirstName' => $FirstName, 'LastName' => $LastName, 'FatherName' => $FatherName, 'Gender' => $Gender,
'DateofBirth' => $DOB, 'ContactNumber' => $ContactNumber, 'EmailId' => $EmailId,
'BloodGroup' => $BloodGroup, 'MartialStatus' => $MartialStatus, 'DateofJoining' => $DOJ,
'PreviousYearsOfExp' => $Previousexperience, 'Designation' => $desigination,
'Departmentcode' => $departmentCode, 'PresentAddress' => $CurrentAddress,
'PermanentAddress' => $permanentaddress, 'EmergencyContactName' => $emergencycontactname,
'EmergencyContactNumber' => $emergencycontactnumber, 'Edu_Qualification' => $eduqualifaction,
'Additional_Qualification' => $addqualification, 'AadharNo' => $aadharno, 'PANNo' => $panno,
'BankAccountNo' => $accountno, 'IFSCCode' => $ifsccode, 'BankBranchName' => $bankbranchname,
'BankAddress' => $bankaddress, 'PassportNo' => $passportno, 'Passport_Valid_till' => $Valid,
'IsActive' => $IsActive, 'ProfilePic' => $Picture, 'Reference_Name' => $referredby,
'Reference_ContactNumber' => $referrercontno, 'Remarks' => $addinfo, 'UpdatedBY' => $UpdatedBY,
'personalEmailId' => $comEmailId, 'DriverLicense' => $driverlicense, 'LicenseValidtill' => $License_ExpiryDate,
'VoterID' => $VoterID, 'PFNO' => $pfno, 'ESI' => $esino, 'NomineeDetails' => $Nominee
);
//print_r($Employee);die();
$result = $this->employeedetails_model->UpdateEmployee($Employee, $EmpId);
if ($result > 0) {
// $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
$this->session->setFlashdata('success', 'You Have Successfully updated the Employee Record!');
// echo "<script>alert('You Have Successfully updated the Employee Record!');</script>";
} else {
// $this->session->set_flashdata('Error', $EmpId . 'Employee details not saved');
$this->session->setFlashdata('error', 'Record Not Updated!');
// echo "<script>alert('Record Not Updated!');</script>";
}
return redirect()->route('employeeListing');
// redirect('employeeListing');
// }
}
}

View File

@ -0,0 +1,317 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Emppaydate_model;
use App\Models\Payroll_model;
/**
* Module : Payslip
* Emppaydate Class to control all Employee paydate related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
*/
class Emppaydate extends BaseController
{
protected $emppaydate_model;
protected $payroll_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->emppaydate_model = new Emppaydate_model();
$this->payroll_model = new payroll_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Employee Pay Details';
$this->loadViews("emppayListing", $this->global);
}
/**
* This function is used to load the payment list for a employee.
*/
function emppayListing()
{
$data['userRecords'] = $this->emppaydate_model->emppayListing();
$this->global['pageTitle'] = 'Employee Pay List';
$this->loadViews("emppayListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new payment for an employee.
*/
function addemppaydate()
{
$q = "addemppaydate";
$result['empdetails'] = $this->payroll_model->getEmpID($q);
$this->global['pageTitle'] = 'Add Employee Pay';
$this->loadViews("addemppaydate", $this->global, $result);
}
function addNewemppay()
{
helper('form'); //$this->load->library('form_validation');
$EmpID = $this->request->getPost('EmpID');
$this->validator->setRules([
'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
'EmpID'=> 'trim|required',
'HRA_Rate'=> 'trim|required',
'HRA_Amount'=> 'trim|required',
'Basic_Pay'=> 'trim|required',
'Total_salary'=> 'trim|required',
'Allowances'=> 'trim|required',
'PF_Rate'=> 'trim|required',
'ESI_Rate'=> 'trim|required',
'Food_Allowances'=> 'trim|required',
'Incentives'=> 'trim|required']);
if ($this->validator->run() == FALSE || $EmpID == -1) {
$this->addemppaydate();
} else {
$EmpID = $this->request->getPost('EmpID');
$Total_Salary = $this->request->getPost('Total_salary');
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
if (!empty($Load_Issued_date)) {
$Load_Issued_date = $Load_Issued_date = format_date($Load_Issued_date);
} else {
$Load_Issued_date = null;
}
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
if (!empty($Due_Started)) {
$Due_Started = $Due_Started = format_date($Due_Started);
} else {
$Due_Started = null;
}
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$CreateBy = $this->session->get('userId');
$chked = $this->request->getPost('is_Active');
$IsActive = '1';
$emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
$loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $CreateBy);
$result = $this->emppaydate_model->addNewemppay($emppay);
if ($Loan_Amount != 0) {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add');
if ($result2 > 0) {
echo "<script>alert('Loan Information Saved successfully!');</script>";
} else {
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
}
if ($result > 0) {
echo "<script>alert('Employee Pay List Created successfully!');</script>";
redirect('emppaydate/emppayListing', 'refresh');
} else {
echo "<script>alert('Employee Pay List Not Created!');</script>";
redirect('emppaydate/emppayListing', 'refresh');
}
//}
}
}
/**
* This function is used for editing purpose and it has oldest values only.
*/
function editOldemppay($paydataid = "")
{
$data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid);
$this->global['pageTitle'] = 'Edit Employee Pay Monthly Details ';
$this->loadViews("editOldemppay", $this->global, $data, NULL);
}
/**
* This function is used for stored new values after editing.
*/
function editemppay()
{
helper('form'); //$this->load->library('form_validation');
$Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
//'Pay_Data_ID'=>'trim|required';
$this->validator->setRules([
'EmpID'=> 'trim|required',
'Total_Salary'=> 'trim|required',
'Basic_Pay'=> 'trim|required',
'HRA_Rate'=> 'trim|required',
'Allowances'=> 'trim|required',
'PF_Rate'=> 'trim|required',
'ESI_Rate'=> 'trim|required',
'Food_Allowances'=> 'trim|required',
'Incentives'=> 'trim|required']);
if ($this->validator->run() == FALSE) {
$this->editOldemppay($Pay_Data_ID);
} else {
$Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
$EmpID = $this->request->getPost('EmpID');
$TotalSalary = $this->request->getPost('Total_Salary');
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$loan_ID = $this->request->getPost('loanid');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
if (!empty($Load_Issued_date)) {
$Load_Issued_date = format_date($Load_Issued_date);
} else {
$Load_Issued_date = null;
}
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
if (!empty($Due_Started)) {
$Due_Started = format_date($Due_Started);
} else {
$Due_Started = null;
}
//echo $Load_Issued_date. "-" . $Due_Started;die();
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$is_Active = $this->request->getPost('is_Active');
$Last_Mod_By = $this->session->get('userId');
$Last_Mod_Time = date('d-m-Y h:i:sa');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$emppay = array('Pay_Data_ID' => $Pay_Data_ID, 'EmpID' => $EmpID, 'TotalSalary' => $TotalSalary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Last_Mod_By' => $Last_Mod_By);
$loandetails = array('Loan_ID' => $loan_ID, 'EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Last_Mod_By' => $Last_Mod_By);
if ($Loan_Amount != 0 and $loan_ID != '') {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'update');
if ($result2 > 0) {
echo "<script>alert('Loan Information Saved successfully!');</script>";
} else {
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
} else if ($Loan_Amount != 0 and $loan_ID == '') {
$loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $Last_Mod_By);
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add');
if ($result2 > 0) {
echo "<script>alert('Loan Information Saved successfully!');</script>";
} else {
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
}
$result = $this->emppaydate_model->editemppay($emppay);
if ($result == true) {
echo "<script>alert('Employee Status Updated Sucessfully..!');</script>";
} else {
echo "<script>alert('Update Failed..!')</script>";
$this->session->set_flashdata('error', 'updation failed');
}
redirect('emppaydate/emppayListing');
}
}
function deleteEmpPay()
{
$EmpID = $this->request->getPost('id');
//echo $EmpID;
$result = $this->emppaydate_model->deleteEmployeePay($EmpID);
if ($result == 1) {
echo "Deleted Sucessfully..!";
} else {
echo "Something Went wrong. Try Later..!";
}
}
}

47
app/Controllers/Error.php Normal file
View File

@ -0,0 +1,47 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
/**
* Module : Error
* Error class to control to All type of Error.
* @author : Kishor
* @version : 1.1
* @since : 15 November 2016
* @example : Revised at 15th april 2024
*/
class Error extends BaseController
{
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->session = session();
}
/**
* Index Page for this controller.
*/
public function index()
{
$this->isLoggedIn();
}
/**
* This function used to check the user is logged in or not
*/
function isLoggedIn()
{
$isLoggedIn = $this->session->get('isLoggedIn');
if (!isset($isLoggedIn) || $isLoggedIn != TRUE) {
view('login');
} else {
redirect('pageNotFound');
}
}
}

11
app/Controllers/Home.php Executable file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index(): string
{
return view('login');
}
}

View File

@ -0,0 +1,932 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Inprocess_model;
use App\Models\Quality_model;
/**
* Module : Inprocess
* Inprocess Class to control all inprocess related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Inprocess extends BaseController
{
protected $quality_model;
protected $inprocess_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->isLoggedIn();
$this->quality_model = new Quality_model();
$this->inprocess_model = new Inprocess_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
//$this->load->library('dompdf_gen');
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$data['reportlist'] = $this->inprocess_model->getAllTestReports();
$this->global['pageTitle'] = 'Inprocess Test Reports List';
$this->loadViews("reportlist_inprocesstest", $this->global, $data, NULL);
}
public function addNewInprocessInspection()
{
$data['productsoutward'] = $this->quality_model->getAllprodcuts();
$data['customersoutward'] = $this->quality_model->getAllcustomers();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'New Inprcess Test Report ';
$this->loadViews("newinprocessreport", $this->global, $data, NULL);
}
function addNewNissanInprocessInspection()
{
$data['productsoutward'] = $this->quality_model->getAllprodcuts();
$data['customersoutward'] = $this->quality_model->getAllcustomers();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'New Inprcess Test Report ';
$this->loadViews("newnissaninprocessreport", $this->global, $data, NULL);
}
function editIndInprocessReport()
{
$uri = service('uri');
$rid = $uri->getSegment(3);
$data['reportdata'] = $this->inprocess_model->getIndividualInprocessReportData($rid);
$pspecid = null;
$psubtype = null;
$time = null;
$temparray = array();
$time = array();
$index = 0;
foreach ($data['reportdata']['masterreport'] as $key => $d) {
if ($pspecid != $d->specid) {
$index++;
$temparray[$index] = array('specid' => $d->specid, 'specname' => $d->testtype, 'smin' => $d->min, 'smax' => $d->max, 'suom' => $d->uom, 'stype' => $d->subtype, $d->ivalue);
$time = array_merge($time, array($d->itime));
} else {
array_push($temparray[$index], $d->ivalue);
$time = array_merge($time, array($d->itime));
}
$pspecid = $d->specid;
}
$data['reportdata']['masterreport'] = $temparray;
$data['timearray'] = $time;
$data['emplist'] = $this->quality_model->getEmplistforReport();
if ($data['reportdata']['master'][0]->test_type == 0) {
$this->global['pageTitle'] = 'Edit Inprocess Report';
$this->loadViews("editInprocessReport", $this->global, $data, NULL);
} else {
//echo "Under Developing";
$this->global['pageTitle'] = 'Edit Nissan Inprocess Report';
$this->loadViews("editNissanInprocessReport", $this->global, $data, NULL);
}
}
function getAllSpecforReport()
{
$productid = $this->request->getPost('param1');
$customerid = $this->request->getPost('param2');
//echo 'from cn'.$productid.'-'.$customerid;exit();
$res = $this->quality_model->getSpecifications($productid, $customerid);
echo json_encode($res);
}
function saveTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->request->getPost('param1');
$testjson2 = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$loijson = $this->request->getPost('param4');
$productid = $this->request->getPost('param5');
$customerid = $this->request->getPost('param6');
$batchno = $this->request->getPost('param7');
$batchdate = $this->request->getPost('param8');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param9');
$sanddesc = $this->request->getPost('param10');
$resindesc = $this->request->getPost('param11');
$qty = $this->request->getPost('param12');
$times = $this->request->getPost('param13');
$times = explode(",", $times);
$approvedby = $this->request->getPost('param14');
$remarks = $this->request->getPost('param15');
$testphpdata = json_decode($testjson, true);
$testphpdata2 = json_decode($testjson2, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = null;
if (!empty($_FILES['rfile']['name'])) {
$fs = $this->uploadFile();
$document = $fs;
}
$masterreportdata = array('productid' => $productid, 'customerid' => $customerid, 'batchno' => $batchno, 'batchdate' => $batchdate, 'plantname' => $plantname, 'sand_description' => $sanddesc, 'resin_description' => $resindesc, 'qty' => $qty, 'remarks' => $remarks, 'document' => $document, 'createdby' => $createby, 'approvedby' => $approvedby);
$MASTERID = $this->inprocess_model->saveMasterTestData($masterreportdata);
//$MASTERID = 1;
foreach ($testphpdata as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 0;
$actarray = array($data['ACT X1'], $data['ACT X2'], $data['ACT X3'], $data['ACT X4'], $data['ACT X5'], $data['ACT X6'], $data['ACT X7'], $data['ACT X8']);
for ($i = 1; $i <= 8; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 1], 'ivalue' => $actarray[$i - 1]);
}
$this->inprocess_model->saveTestReportData($temparray);
}
foreach ($testphpdata2 as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 1;
$cstarray = array($data['CST X1'], $data['CST X2'], $data['CST X3'], $data['CST X4'], $data['CST X5'], $data['CST X6'], $data['CST X7'], $data['CST X8']);
$rstarray = array($data['RST Y1'], $data['RST Y2'], $data['RST Y3']);
for ($i = 1; $i <= 3; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => '', 'ivalue' => $rstarray[$i - 1]);
}
for ($i = 4; $i <= 11; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 4], 'ivalue' => $cstarray[$i - 4]);
}
$this->inprocess_model->saveTestReportData($temparray);
}
$count = 0;
foreach ($afsphpdata as $afs) {
//print_r($afs);
$count++;
if ($count != 12) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'masterreport_id' => $MASTERID, 'sieve_size' => $ssize, 'factor' => $factor, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
//print_r($afstabledata);
$afsid = $this->inprocess_model->saveTestReportAFSData($afstabledata);
}
}
//die();
foreach ($loiphpdata as $loi) {
//print_r($loi);
$loidetails = $loi['Description'];
$spec = $loi['Spec'];
$rst1 = $loi['RST Y1'];
$rst2 = $loi['RST Y2'];
$rst3 = $loi['RST Y3'];
$cst1 = $loi['CST X1'];
$cst2 = $loi['CST X2'];
$cst3 = $loi['CST X3'];
$cst4 = $loi['CST X4'];
$cst5 = $loi['CST X5'];
$cst6 = $loi['CST X6'];
$cst7 = $loi['CST X7'];
$cst8 = $loi['CST X8'];
$loitabledata = array(
'masterreport_id' => $MASTERID, 'loidetails' => $loidetails, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
$loiid = $this->inprocess_model->saveTestReportLOIData($loitabledata);
}
echo "Report Data Saved Successfully!";
}
function updateTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->request->getPost('param1');
$testjson2 = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$loijson = $this->request->getPost('param4');
$productid = $this->request->getPost('param5');
$customerid = $this->request->getPost('param6');
$batchno = $this->request->getPost('param7');
$batchdate = $this->request->getPost('param8');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param9');
$sanddesc = $this->request->getPost('param10');
$resindesc = $this->request->getPost('param11');
$qty = $this->request->getPost('param12');
$times = $this->request->getPost('param13');
$times = explode(",", $times);
$approvedby = $this->request->getPost('param14');
$remarks = $this->request->getPost('param15');
$masterid = $this->request->getPost('param16');
$olddoc = $this->request->getPost('param17');
$testphpdata = json_decode($testjson, true);
$testphpdata2 = json_decode($testjson2, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = $olddoc;
if (!empty($_FILES['rfile']['name'])) {
if (!empty($document)) {
$file = getcwd() . "\\uploads\INPROCESS\\" . $document;
if (unlink($file)) {
//echo "sucess";
} else {
//echo "Failed";
}
}
$fs = $this->uploadFile();
$document = $fs;
}
$masterreportdata = array('productid' => $productid, 'customerid' => $customerid, 'batchno' => $batchno, 'batchdate' => $batchdate, 'plantname' => $plantname, 'sand_description' => $sanddesc, 'resin_description' => $resindesc, 'qty' => $qty, 'remarks' => $remarks, 'document' => $document, 'updatedby' => $createby, 'approvedby' => $approvedby);
$this->inprocess_model->updateMasterTestData($masterreportdata, $masterid);
foreach ($testphpdata as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 0;
$actarray = array($data['ACT X1'], $data['ACT X2'], $data['ACT X3'], $data['ACT X4'], $data['ACT X5'], $data['ACT X6'], $data['ACT X7'], $data['ACT X8']);
for ($i = 1; $i <= 8; $i++) {
//$temparray[$i] = array('itime'=>$times[$i-1],'ivalue'=>$actarray[$i-1]);
$temparray[$i] = array('masterreport_id' => $masterid, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 1], 'ivalue' => $actarray[$i - 1]);
}
$this->inprocess_model->updateTestReportData($temparray, $masterid, $specid);
}
foreach ($testphpdata2 as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 1;
$cstarray = array($data['CST X1'], $data['CST X2'], $data['CST X3'], $data['CST X4'], $data['CST X5'], $data['CST X6'], $data['CST X7'], $data['CST X8']);
$rstarray = array($data['RST Y1'], $data['RST Y2'], $data['RST Y3']);
for ($i = 1; $i <= 3; $i++) {
$temparray[$i] = array('masterreport_id' => $masterid, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => '', 'ivalue' => $rstarray[$i - 1]);
}
for ($i = 4; $i <= 11; $i++) {
$temparray[$i] = array('masterreport_id' => $masterid, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 4], 'ivalue' => $cstarray[$i - 4]);
}
$this->inprocess_model->updateTestReportData($temparray, $masterid, $specid);
}
$count = 0;
foreach ($afsphpdata as $afs) {
//print_r($afs);
$count++;
if ($count != 12) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
$this->inprocess_model->updateTestReportAFSData($afstabledata, $masterid, $ssize, $factor);
}
}
foreach ($loiphpdata as $loi) {
//print_r($loi);
$loidetails = $loi['Description'];
$spec = $loi['Spec'];
$rst1 = $loi['RST Y1'];
$rst2 = $loi['RST Y2'];
$rst3 = $loi['RST Y3'];
$cst1 = $loi['CST X1'];
$cst2 = $loi['CST X2'];
$cst3 = $loi['CST X3'];
$cst4 = $loi['CST X4'];
$cst5 = $loi['CST X5'];
$cst6 = $loi['CST X6'];
$cst7 = $loi['CST X7'];
$cst8 = $loi['CST X8'];
$loitabledata = array(
'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
$loiid = $this->inprocess_model->updateTestReportLOIData($loitabledata, $masterid, $loidetails);
}
echo "Report Data Saved Successfully!";
}
function printIndInprocessReport()
{
$rid = $this->request->getPost('masterreportid');
$data['reportdata'] = $this->inprocess_model->getIndividualInprocessReportData($rid);
$pspecid = null;
$psubtype = null;
$time = null;
$temparray = array();
$time = array();
$index = 0;
foreach ($data['reportdata']['masterreport'] as $key => $d) {
if ($pspecid != $d->specid) {
$index++;
$temparray[$index] = array('specid' => $d->specid, 'specname' => $d->testtype, 'smin' => $d->min, 'smax' => $d->max, 'suom' => $d->uom, 'stype' => $d->subtype, $d->ivalue);
$time = array_merge($time, array($d->itime));
} else {
array_push($temparray[$index], $d->ivalue);
$time = array_merge($time, array($d->itime));
}
$pspecid = $d->specid;
}
$data['reportdata']['masterreport'] = $temparray;
$data['timearray'] = $time;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Inprocess Report';
$html = view("viewindinprocesspdf", $data, true);
require APPPATH . '/third_party/mpdf/mpdf.php';
$mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output($filename . '.pdf', 'I');
}
function printIndNissanInprocessReport()
{
$rid = $this->request->getPost('masterreportid');
$data['reportdata'] = $this->inprocess_model->getIndividualInprocessReportData($rid);
//print_r($data['reportdata'] );die();
$pspecid = null;
$psubtype = null;
$time = null;
$temparray = array();
$time = array();
$index = 0;
foreach ($data['reportdata']['masterreport'] as $key => $d) {
if ($pspecid != $d->specid) {
$index++;
$temparray[$index] = array('specid' => $d->specid, 'specname' => $d->testtype, 'smin' => $d->min, 'smax' => $d->max, 'suom' => $d->uom, 'stype' => $d->subtype, $d->ivalue);
$time = array_merge($time, array($d->itime));
} else {
array_push($temparray[$index], $d->ivalue);
$time = array_merge($time, array($d->itime));
}
$pspecid = $d->specid;
}
$data['reportdata']['masterreport'] = $temparray;
$data['timearray'] = $time;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Inprocess Report';
$html = view("viewindnissaninprocesspdf", $data, true);
require APPPATH . '/third_party/mpdf/mpdf.php';
$mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output($filename . '.pdf', 'I');
}
function saveNissanTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->request->getPost('param1');
$testjson2 = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$loijson = $this->request->getPost('param4');
$productid = $this->request->getPost('param5');
$customerid = $this->request->getPost('param6');
$batchno = $this->request->getPost('param7');
$batchdate = $this->request->getPost('param8');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param9');
$sanddesc = $this->request->getPost('param10');
$resindesc = $this->request->getPost('param11');
$qty = $this->request->getPost('param12');
$times = $this->request->getPost('param13');
$times = explode(",", $times);
$approvedby = $this->request->getPost('param14');
$remarks = $this->request->getPost('param15');
$nissansubtype = $this->request->getPost('param16');
//echo $nissansubtype;
$testphpdata = json_decode($testjson, true);
$testphpdata2 = json_decode($testjson2, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = null;
if (!empty($_FILES['rfile']['name'])) {
$fs = $this->uploadFile();
$document = $fs;
}
$masterreportdata = array('productid' => $productid, 'customerid' => $customerid, 'batchno' => $batchno, 'batchdate' => $batchdate, 'plantname' => $plantname, 'sand_description' => $sanddesc, 'resin_description' => $resindesc, 'qty' => $qty, 'test_type' => 1, 'subtype' => $nissansubtype, 'remarks' => $remarks, 'document' => $document, 'createdby' => $createby, 'approvedby' => $approvedby);
$MASTERID = $this->inprocess_model->saveMasterTestData($masterreportdata);
//$MASTERID = 1;
foreach ($testphpdata as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 0;
$actarray = array($data['ACT X1'], $data['ACT X2'], $data['ACT X3'], $data['ACT X4'], $data['ACT X5'], $data['ACT X6'], $data['ACT X7'], $data['ACT X8']);
for ($i = 1; $i <= 8; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 1], 'ivalue' => $actarray[$i - 1]);
}
$this->inprocess_model->saveTestReportData($temparray);
}
foreach ($testphpdata2 as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 1;
$cstarray = array($data['CST X1'], $data['CST X2'], $data['CST X3'], $data['CST X4'], $data['CST X5'], $data['CST X6'], $data['CST X7'], $data['CST X8']);
$rstarray = array($data['RST Y1'], $data['RST Y2'], $data['RST Y3']);
for ($i = 1; $i <= 3; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => '', 'ivalue' => $rstarray[$i - 1]);
}
for ($i = 4; $i <= 11; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 4], 'ivalue' => $cstarray[$i - 4]);
}
$this->inprocess_model->saveTestReportData($temparray);
}
foreach ($afsphpdata as $key => $afs) {
if ($nissansubtype == 0) {
if (($key != 3) && ($key != 9) && ($key != 12) && ($key != 14)) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'masterreport_id' => $MASTERID, 'sieve_size' => $ssize, 'factor' => $factor, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
//print_r($afstabledata);
$afsid = $this->inprocess_model->saveTestReportAFSData($afstabledata);
}
} else {
if (($key != 6) && ($key != 9) && ($key != 12) && ($key != 14)) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'masterreport_id' => $MASTERID, 'sieve_size' => $ssize, 'factor' => $factor, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
//print_r($afstabledata);
$afsid = $this->inprocess_model->saveTestReportAFSData($afstabledata);
}
}
}
foreach ($loiphpdata as $loi) {
//print_r($loi);
$loidetails = $loi['Description'];
$spec = $loi['Spec'];
$rst1 = $loi['RST Y1'];
$rst2 = $loi['RST Y2'];
$rst3 = $loi['RST Y3'];
$cst1 = $loi['CST X1'];
$cst2 = $loi['CST X2'];
$cst3 = $loi['CST X3'];
$cst4 = $loi['CST X4'];
$cst5 = $loi['CST X5'];
$cst6 = $loi['CST X6'];
$cst7 = $loi['CST X7'];
$cst8 = $loi['CST X8'];
$loitabledata = array(
'masterreport_id' => $MASTERID, 'loidetails' => $loidetails, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
$loiid = $this->inprocess_model->saveTestReportLOIData($loitabledata);
}
echo "Report Data Saved Successfully!";
}
function uploadFile()
{
$pathinfo = pathinfo($_FILES['rfile']['name']);
$config['upload_path'] = 'public/uploads/INPROCESS/';
$config['allowed_types'] = '*';
$filename = $_FILES['rfile']['name'];
$ext = end(explode('.', $filename));
$ext = strtolower($ext);
$fn = 'inprocess' . get_current_date() . time() . '.' . $ext;
//print_r($fn);die();
$config['file_name'] = $fn;
//echo $config['file_name'];
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload('rfile')) {
$uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name'];
return $uploadfilename;
} else {
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
print_r($error);
return null;
}
}
function updateNissanInprocessTestReportData()
{
$testjson = $this->request->getPost('param1');
$testjson2 = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$loijson = $this->request->getPost('param4');
$productid = $this->request->getPost('param5');
$customerid = $this->request->getPost('param6');
$batchno = $this->request->getPost('param7');
$batchdate = $this->request->getPost('param8');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param9');
$sanddesc = $this->request->getPost('param10');
$resindesc = $this->request->getPost('param11');
$qty = $this->request->getPost('param12');
$times = $this->request->getPost('param13');
$times = explode(",",$times);
$approvedby = $this->request->getPost('param14');
$remarks = $this->request->getPost('param15');
$nissansubtype = $this->request->getPost('param16');
$masterid = $this->request->getPost('param17');
$olddoc = $this->request->getPost('param18');
//echo $nissansubtype;
$testphpdata = json_decode($testjson, true);
$testphpdata2 = json_decode($testjson2, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = $olddoc;
if (!empty($_FILES['rfile']['name'])) {
if (!empty($document)) {
$file = getcwd() . "\\uploads\INPROCESS\\" . $document;
if (unlink($file)) { //echo "success";
} else { // echo "Failed";
}
}
$fs = $this->uploadFile();
$document = $fs;
}
//echo 'From COn'.$masterid;
$masterreportdata = array('productid' => $productid, 'customerid' => $customerid, 'batchno' => $batchno, 'batchdate' => $batchdate, 'plantname' => $plantname, 'sand_description' => $sanddesc, 'resin_description' => $resindesc, 'qty' => $qty, 'test_type' => 1, 'subtype' => $nissansubtype, 'remarks' => $remarks, 'document' => $document, 'updatedby' => $createby, 'approvedby' => $approvedby);
//print_r($masterreportdata);
$this->inprocess_model->updateNissanMasterTestData($masterreportdata, $masterid);
$MASTERID = $masterid;
foreach ($testphpdata as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 0;
$actarray = array($data['ACT X1'], $data['ACT X2'], $data['ACT X3'], $data['ACT X4'], $data['ACT X5'], $data['ACT X6'], $data['ACT X7'], $data['ACT X8']);
for ($i = 1; $i <= 8; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 1], 'ivalue' => $actarray[$i - 1]);
}
$this->inprocess_model->updateNissanTestReportData($temparray, $masterid, $specid);
}
foreach ($testphpdata2 as $data) {
//print_r($data);
$temparray = array();
$specid = $data['SPECID'];
$subtype = 1;
$cstarray = array($data['CST X1'], $data['CST X2'], $data['CST X3'], $data['CST X4'], $data['CST X5'], $data['CST X6'], $data['CST X7'], $data['CST X8']);
$rstarray = array($data['RST Y1'], $data['RST Y2'], $data['RST Y3']);
for ($i = 1; $i <= 3; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => '', 'ivalue' => $rstarray[$i - 1]);
}
for ($i = 4; $i <= 11; $i++) {
$temparray[$i] = array('masterreport_id' => $MASTERID, 'specid' => $specid, 'subtype' => $subtype, 'iteration' => $i, 'itime' => $times[$i - 4], 'ivalue' => $cstarray[$i - 4]);
}
$this->inprocess_model->updateNissanTestReportData($temparray, $masterid, $specid);
}
foreach ($afsphpdata as $key => $afs) {
if ($nissansubtype == 0) {
if (($key != 3) && ($key != 9) && ($key != 12) && ($key != 14)) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'masterreport_id' => $MASTERID, 'sieve_size' => $ssize, 'factor' => $factor, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
//print_r($afstabledata);
$afsid = $this->inprocess_model->updateNissanTestReportAFSData($afstabledata, $masterid, $ssize, $factor);
}
} else {
if (($key != 6) && ($key != 9) && ($key != 12) && ($key != 14)) {
$ssize = $afs['Sieve Size µm'];
$spec = $afs['Spec'];
$factor = $afs['Factor'];
$rst1 = $afs['RST Y1'];
$rst2 = $afs['RST Y2'];
$rst3 = $afs['RST Y3'];
$cst1 = $afs['CST X1'];
$cst2 = $afs['CST X2'];
$cst3 = $afs['CST X3'];
$cst4 = $afs['CST X4'];
$cst5 = $afs['CST X5'];
$cst6 = $afs['CST X6'];
$cst7 = $afs['CST X7'];
$cst8 = $afs['CST X8'];
$afstabledata = array(
'masterreport_id' => $MASTERID, 'sieve_size' => $ssize, 'factor' => $factor, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
//print_r($afstabledata);
$afsid = $this->inprocess_model->updateNissanTestReportAFSData($afstabledata, $masterid, $ssize, $factor);
}
}
}
foreach ($loiphpdata as $loi) {
//print_r($loi);
$loidetails = $loi['Description'];
$spec = $loi['Spec'];
$rst1 = $loi['RST Y1'];
$rst2 = $loi['RST Y2'];
$rst3 = $loi['RST Y3'];
$cst1 = $loi['CST X1'];
$cst2 = $loi['CST X2'];
$cst3 = $loi['CST X3'];
$cst4 = $loi['CST X4'];
$cst5 = $loi['CST X5'];
$cst6 = $loi['CST X6'];
$cst7 = $loi['CST X7'];
$cst8 = $loi['CST X8'];
$loitabledata = array(
'masterreport_id' => $MASTERID, 'loidetails' => $loidetails, 'spec' => $spec, 'rst1' => $rst1, 'rst2' => $rst2, 'rst3' => $rst3,
'cst1' => $cst1, 'cst2' => $cst2, 'cst3' => $cst3, 'cst4' => $cst4, 'cst5' => $cst5, 'cst6' => $cst6, 'cst7' => $cst7, 'cst8' => $cst8,
);
$loiid = $this->inprocess_model->updateNissanTestReportLOIData($loitabledata, $masterid, $loidetails);
}
echo "Report Data Saved Successfully!";
}
}

View File

@ -0,0 +1,731 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Inwardgateregister_model;
/**
* Module : IGR (security)
* Inwardgateregister Class to control all igr related operations.
* @author : Saravana kumar
* @version : 1.1
* @since : 8 Jun 2017
* @example : Revised at 15th april 2024
*/
class Inwardgateregister extends BaseController
{
protected $inwardgateregister_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Inward Gate Register';
$this->loadViews("viewinwardgateregister", $this->global, NULL, NULL);
}
function viewIGRDetails()
{
$this->global['pageTitle'] = 'Inward Gate Register Details';
$data['IGR'] = $this->inwardgateregister_model->igrListing();
$this->loadViews("viewIGRDetails", $this->global, $data, NULL);
}
function addinwardgateregister()
{
$this->inwardgateregister_model = new inwardgateregister_model();
$this->global['pageTitle'] = 'Add Inward Gate Register';
$data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder();
// print_r($data['PO_NO']);
$this->loadViews("inwardgateregister", $this->global, $data, NULL);
}
function addoutwardgateregister()
{
$this->inwardgateregister_model = new inwardgateregister_model();
$this->global['pageTitle'] = 'Add Outward Gate Register';
$data['Customer'] = $this->inwardgateregister_model->getCustomer();
$data['Supplier'] = $this->inwardgateregister_model->getSupplier();
//$data['Invoice'] = $this->inwardgateregister_model->getInvoice();
$data['storedmaterialcode'] = $this->inwardgateregister_model->getstoredmaterialcode();
//print_r($data['PO_NO']);
$this->loadViews("ogr", $this->global, $data, NULL);
}
function ViewOgr()
{
$this->inwardgateregister_model = new inwardgateregister_model();
$this->global['pageTitle'] = 'View Outward Gate Register';
$data['OGR_Data'] = $this->inwardgateregister_model->getOGRData();
//print_r($data['OGR_Data']);
$this->loadViews("ogrlist", $this->global, $data, NULL);
}
function EditOGR()
{
$OGRNO = $_GET['OGRNO'];
$MRIRNO = $_GET['MRIRNO'];
$this->global['pageTitle'] = 'View Outward Gate Register';
$data['OGR_Data'] = $this->inwardgateregister_model->getOGRDataforedit($OGRNO);
$data['OGR_line'] = $this->inwardgateregister_model->getOGRlineDataforedit($OGRNO, $MRIRNO);
$this->loadViews("editogr", $this->global, $data, NULL);
}
function GetInvoices()
{
$CustomerId = $this->request->getPost('customerId');
$data = $this->inwardgateregister_model->getInvoice($CustomerId);
echo json_encode($data);
}
function GetPO()
{
$supplierId = $this->request->getPost('supplierId');
$data = $this->inwardgateregister_model->getPO($supplierId);
echo json_encode($data);
}
function getPODetails()
{
$PONO = $this->request->getPost('PONO');
$data = $this->inwardgateregister_model->getPODetails($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data);
}
function getMRIRDetails()
{
$MRIRno = $this->request->getPost('mrirno');
$PONO = $this->request->getPost('PONO');
$materialcode = $this->request->getPost('materialcode');
$data = $this->inwardgateregister_model->getPOMRIRDetails($MRIRno, $PONO, $materialcode);
//$data['outqty'] = $this->inwardgateregister_model->gettotalout($PONO,$materialcode);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data);
}
function getMRIR()
{
$MRIRno = $this->request->getPost('MRIRNO');
$PONO = $this->request->getPost('PONO');
$data = $this->inwardgateregister_model->getPOMRIRMaterial($MRIRno, $PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data);
}
function getPOmrir()
{
$PONO = $this->request->getPost('PONO');
$data = $this->inwardgateregister_model->getPOmrir($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data);
}
function getPOmaterialDetails()
{
$PONO = $this->request->getPost('PONO');
$materialcode = $this->request->getPost('materialcode');
$data = $this->inwardgateregister_model->getPOmaterialDetails($PONO, $materialcode);
echo json_encode($data);
}
function getPOmaterial()
{
$PONO = $this->request->getPost('PONO');
$data = $this->inwardgateregister_model->getPOmaterial($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data);
}
function IGRITEM()
{
$PO = $this->request->getPost('id');
$CreatedBy = $this->session->get('userId');
$this->inwardgateregister_model->UpdatePOMaster($PO, $CreatedBy);
$data = $this->inwardgateregister_model->viewpurchaseorder($PO);
echo json_encode($data);
}
function addloadfile()
{
$upfiles = '';
$pono = $this->request->getPost('PONO');
$igr = $this->request->getPost('igr');
$file = $this->request->getFile('file');
$requestfilename = $file->getName();
$files = $this->inwardgateregister_model->getfies($igr);
$fcount = 0;
foreach ($files as $value) {
$lastfile = $value->FilePath;// not a file path just file name only
if ($lastfile == $requestfilename) {
$fcount++;
}
}
if ($fcount == 0) {
if (!empty($requestfilename)) {
if ($file->isValid() && !$file->hasMoved()) {
$file->move(ROOTPATH.'public/uploads/Igrfiles/');
$Picture = $file->getName();
}else{
$Picture = "";
}
$myfiles = array('PONO' => $pono, 'IGRNO' => $igr, 'FilePath' => $Picture);
$upfiles = $this->inwardgateregister_model->fileupload($myfiles);
//print_r($upfiles);
}
}
//echo 'filename'.$upfiles;
if ($upfiles > 0) {
echo "file updated successfully!";
} else {
echo "File name already Exist";
}
}
function edituploadfile()
{
$bill = $this->request->getPost('param1');
$oldfile = $this->request->getPost('param2');
$newfile = $this->request->getFile('file');
if ($newfile->isValid() && !$newfile->hasMoved()) {
$newfilename = $newfile->getName();
$newfile->move(ROOTPATH . 'public/uploads/Igrfiles/');
$Picture = str_replace(" ", "", $newfilename);
} else {
$Picture = $oldfile;
}
$uploadfile = $this->inwardgateregister_model->updatefile($bill, $Picture, $oldfile);
// if($uploadfile > 0){
echo "updated successfully!";
// }
// else{
// echo "updated successfully!";
// }
}
function addNewigr()
{
// print_r($this->request->getPost());
$PONO = $this->request->getPost('PONO');
$DeliveryChellanOrInvoiceNo = $this->request->getPost('InvoiceNo');
$DeliveryChellan = $this->request->getPost('InvoiceDate');
$DeliveryChellanDate = get_date_time_format($DeliveryChellan);
$Mat_Rcvd_Dt = $this->request->getPost('MaterialRcvdDate');
$MaterialRcvdDt = get_date_time_format($Mat_Rcvd_Dt);
$VehicleNo = $this->request->getPost('VehicleNo');
$CourierNo = $this->request->getPost('CourierNo');
$CreatedBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$createddt = get_current_date_time();
$IGRStatus = IGR_CREATED;
$document = null;
$igr = array();
$paymentstatus = NO_PAIDIGR;
$constant = $this->request->getPost('hideconstants');
$arr = [];
$prefile = array();
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'CourierNo' => $CourierNo, 'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
$igrM = $this->inwardgateregister_model->addigrM($igr);
$IGRNO = !empty($igrM) ? $igrM : '';
for ($i = 1; $i <= $constant; $i++) {
$pathname = 'browseFiles' . $i;
$file = $this->request->getFile($pathname);
$requestfilename = $file->getName();
if (!empty($requestfilename)) {
$files = str_replace(" ", "", $_FILES[$pathname]['name']);
$fcount = 0;
foreach ($prefile as $value) {
if ($value == $files) { $fcount++; }
}
if ($fcount == 0) {
if ($file->isValid() && !$file->hasMoved()) {
$file->move(ROOTPATH.'public/uploads/Igrfiles/');
$Picture = $file->getName();
}
$arr[] = array($Picture);
}
$prefile[] = $files;
}
}
if (!empty($arr)) {
foreach ($arr as $ma) {
$index = 0;
foreach ($ma as $key => $value) {
$index++;
if ($index == 1) {
$filename = $value;
}
}
if (!empty($filename)) {
$myfile = array('FilePath' => $filename, 'PONO' => $PONO, 'IGRNO' => $IGRNO);
$this->inwardgateregister_model->fileupload($myfile);
}
}
}
$OGRStatus = IGR_CREATED;
$check_OGRPO = $this->inwardgateregister_model->update_OGR($PONO, $OGRStatus);
$IGRItemStatus = REQITEM_NEW;
$TotalPendingQty = '';
$TotalPendingQty = (int)$TotalPendingQty;
for ($i = 1; $i <= $RowCount; $i++) {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
$QuantityAsPerInvoice = $this->request->getPost('txtQuantityAsPerInvoice' . $i);
$QuantityAsPerInvoice = $QuantityAsPerInvoice !== null && is_string($QuantityAsPerInvoice) ? trim($QuantityAsPerInvoice) : null;
$OrderedQuantity = $this->request->getPost('OrderedQuantity' . $i);
$OrderedQuantity = $OrderedQuantity !== null && is_string($OrderedQuantity) ? trim($OrderedQuantity) : null;
$ReceivedQty = $this->request->getPost('txtReceivedQuantity' . $i);
$ReceivedQty = $ReceivedQty !== null && is_string($ReceivedQty) ? trim($ReceivedQty) : null;
$PendingQty = $this->request->getPost('txtPendingQty' . $i);
$TotalPendingQty = $TotalPendingQty + $PendingQty;
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
$Remarks = $this->request->getPost('txtRemarks' . $i);
$ItemStatus = '';
if ($PendingQty == 0.00) {
$ItemStatus = IGR_CREATED;
} else {
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
}
$CreatedBy = $this->session->get('userId');
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$igrlineno = !empty($igrD) ? $igrD : '';
$itemvalue = '';
$SupplierId = '';
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode);
foreach ($polineitemvalue as $it) {
$itemvalue = $it->Rate;
$SupplierId = $it->SupplierID;
}
$historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Add", 'Ref_Type' => "IGR", 'Ref_No' => $igrlineno, 'Quantity' => $QuantityAsPerInvoice, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'SupplierID' => $SupplierId, 'ItemValue' => $itemvalue);
$this->inwardgateregister_model->addmaterialhistory($historydetails);
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
$av_qty = 0;
if (!empty($get_pre_qty)) {
foreach ($get_pre_qty as $gt) {
$av_qty = $gt->Current_stock;
}
}
$currentav_qty = $QuantityAsPerInvoice + $av_qty;
$current_qty = array('Current_stock' => $currentav_qty);
$this->inwardgateregister_model->addmaterialmaster($current_qty, $MaterialCode);
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO, $MaterialCode);
$ReceivedQuantity = 0.00;
if (count($Recqty) > 0) {
foreach ($Recqty as $key) {
$ReceivedQuantity = $key->ReceivedQuantity;
}
}
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
}
}
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy);
if ($TotalPendingQty == 0.00) {
$Newstatus = array('Status' => IGR_CREATED);
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO, $Newstatus);
$this->inwardgateregister_model->pomasterupdatestatus($PONO, $Newstatus);
} else { /*echo 'error' ;*/
}
echo "<script>alert('Successfully Created IGR Number:$IGRNO'); window.location.href='viewIGRDetails';</script>";
}
function ViewIGR()
{
$IGRNO = $this->request->getPost('id');
$data = $this->inwardgateregister_model->viewigr($IGRNO);
// print_r( $data);die;
echo json_encode($data);
}
function ViewIGRfile()
{
$IGRNO = $this->request->getPost('id');
$igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
$data = array_merge($igrfile, $billfile);
echo json_encode($data);
}
function UpdateIGR()
{
$IGRNo = $this->request->getPost('igr');
$DeliveryChellan = $this->request->getPost('invdate');
$DeliveryChellanDate = get_date_time_format($DeliveryChellan);
$Mat_Rcvd_Dt = $this->request->getPost('mrc');
$MaterialRcvdDt = get_date_time_format($Mat_Rcvd_Dt);
$updateby = $this->session->get('userId');
$updatedon = get_date_time_format('Y-m-d H:i:s');
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'UpdateBY' => $updateby, 'UpdatedOn' => $updatedon);
$data = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
if ($data > 0) {
echo "Updated Succefully!";
} else {
echo "Not Updated!";
}
}
function AddOgr()
{
//echo "string";
$type = $this->request->getPost('type');
$Supplier = $this->request->getPost('sup');
$Date = $this->request->getPost('Date');
$vehicle = $this->request->getPost('Vehicle');
$driver = $this->request->getPost('drive');
if ($type == 1) {
$invoice = $this->request->getPost('invno');
$Otype = 'Invoice';
$Status = 'ST063';
$ogrmaster = array(
'OgrType' => $Otype, 'CreatedDate' => $Date, 'Driver' => $driver, 'PONO_INV' => $invoice, 'VehicleNo' => $vehicle, 'Status' => $Status
);
$addogrmaster = $this->inwardgateregister_model->AddOGR($ogrmaster);
$OGRNO = '';
if (count($addogrmaster) > 0) {
foreach ($addogrmaster as $add) {
$OGRNO = $add->OGRNO;
}
}
$itemcode = $this->request->getPost('itemcode');
$Description = $this->request->getPost('Description');
$invoutwardqty = $this->request->getPost('invoutwardqty');
$Ogrline = array('OGRNO' => $OGRNO, 'MaterialCode' => $itemcode, 'OutwardQty' => $invoutwardqty, 'Status' => $Status);
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
if ((count($addogrmaster) > 0) && (count($addOgrlines > 0))) {
echo "Saved Successfully OGR No is OGR" . $OGRNO;
}
} else if ($type == 2) {
$pono = $this->request->getPost('pono');
$MRIRNO = $this->request->getPost('mrirno');
$Otype = 'PO';
$row = $this->request->getPost('rowcount');
$ogrmaster = array(
'OgrType' => $Otype, 'CreatedDate' => $Date, 'Driver' => $driver, 'PONO_INV' => $pono, 'VehicleNo' => $vehicle, 'MRIRNO' => $MRIRNO
);
$addogrmaster = $this->inwardgateregister_model->AddOGR($ogrmaster);
$OGRNO = '';
if (count($addogrmaster) > 0) {
foreach ($addogrmaster as $add) {
$OGRNO = $add->OGRNO;
}
}
for ($i = 1; $i <= $row; $i++) {
$MaterialCode = $this->request->getPost('materialcode' . $i);
$OutwardQty = $this->request->getPost('outward' . $i);
$rejqty = $this->request->getPost('RejectedQty' . $i);
$pendingoutward = $this->request->getPost('pendingoutward' . $i);
$balance_Qty = $rejqty - $OutwardQty;
//$balance_Qty = $this->request->getPost('pendingoutward'.$i);
$Outwardtotal = $OutwardQty;
$allowed = $this->request->getPost('allowed' . $i);
if ($MaterialCode != '' && $OutwardQty != '') {
$polqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($pono, $MaterialCode);
$ReceivedQuantity = 0.00;
if (count($polqty) > 0) {
foreach ($polqty as $key) {
$ReceivedQuantity = $key->ReceivedQuantity;
}
}
$totalReceivedqty = $ReceivedQuantity - $Outwardtotal;
$POMStatus = OGR_CREATED;
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'OGR_Status' => $POMStatus);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $pono, $MaterialCode);
if ($pendingoutward == 0) {
$Status = OGR_COMPLETE;
} else {
$Status = OGR_PARTIAL_COMPLETE;
}
$Ogrline = array('OGRNO' => $OGRNO, 'MaterialCode' => $MaterialCode, 'OutwardQty' => $Outwardtotal, 'Status' => $Status, 'balance_Qty' => $balance_Qty);
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
//print_r($addOgrline);
$ogrlineno = '';
$itemvalue = '';
$SupplierId = '';
$CreatedBy = $this->session->get('userId');
$createddt = get_current_date_time();
if (count($addogrmaster) > 0) {
$ogrlinearray = $this->inwardgateregister_model->getlastogrline();
foreach ($ogrlinearray as $og) {
$ogrlineno = $og->OGRItemNO;
}
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($pono, $MaterialCode);
foreach ($polineitemvalue as $it) {
$itemvalue = $it->Rate;
$SupplierId = $it->SupplierID;
}
}
$historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Reduce", 'Ref_Type' => "OGR", 'Ref_No' => $ogrlineno, 'Quantity' => $Outwardtotal, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'ItemValue' => $itemvalue, 'SupplierID' => $SupplierId);
$this->inwardgateregister_model->addmaterialhistory($historydetails);
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
$av_qty = 0;
if (!empty($get_pre_qty)) {
foreach ($get_pre_qty as $gt) {
$av_qty = $gt->Current_stock;
}
}
$currentav_qty = $av_qty - $Outwardtotal;
$current_qty = array('Current_stock' => $currentav_qty);
$this->inwardgateregister_model->addmaterialmaster($current_qty, $MaterialCode);
$this->inwardgateregister_model->UpdateOGRMasterOGRStatus($OGRNO);
$this->inwardgateregister_model->UpdateMRIRMasterOGRStatus($MRIRNO, $OGRNO);
$mrirout = $this->inwardgateregister_model->GetMRIROutQty($MRIRNO, $MaterialCode);
$premrirout = 0;
if (!empty($mrirout)) {
foreach ($mrirout as $mr) {
$premrirout = $mr->Ogr_Out_Qty;
}
}
$totmrirout = $premrirout + $Outwardtotal;
$mrirarray = array('Ogr_Out_Qty' => $totmrirout);
$this->inwardgateregister_model->UpdateMRIROUTQty($mrirarray, $MRIRNO, $MaterialCode);
$POMasterStatus = array('Status' => PO_RELEASED);
$this->inwardgateregister_model->UpdatePOMasterOGRStatus($pono, $POMasterStatus);
}
}
if ((count($addogrmaster) > 0) && (count($addOgrline) > 0)) {
echo "Saved Successfully OGR No is OGR" . $OGRNO;
}
} else if ($type == 3) {
$Otype = 'SERVICE';
$Status = 'ST063';
$ogrmaster = array('OgrType' => $Otype, 'CreatedDate' => $Date, 'Driver' => $driver, 'VehicleNo' => $vehicle, 'Status' => $Status);
$addogrmaster = $this->inwardgateregister_model->AddOGR($ogrmaster);
//print_r($addogrmaster);
$OGRNO = '';
//echo count($addogrmaster);
if (count($addogrmaster) > 0) {
foreach ($addogrmaster as $add) {
$OGRNO = $add->OGRNO;
}
}
$material = $this->request->getPost('material');
$name = $this->request->getPost('name');
$pooutward = $this->request->getPost('pooutward');
$destination = $this->request->getPost('destination');
$Remarks = $this->request->getPost('Remark');
$Ogrline = array('OGRNO' => $OGRNO, 'MaterialCode' => $material, 'OutwardQty' => $pooutward, 'Destination' => $destination, 'Status' => $Status, 'SupplierID' => $name, 'Remark' => $Remarks);
//print_r($Ogrline);
//die();
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
if ((count($addogrmaster) > 0) && (count($addOgrline > 0))) {
echo "Saved Successfully OGR No is OGR" . $OGRNO;
}
}
}
}

169
app/Controllers/Login.php Normal file
View File

@ -0,0 +1,169 @@
<?php
namespace App\Controllers;
use App\Models\Login_model;
/**
* Class : Login (LoginController)
* Login class to control to authenticate user credentials and starts user's session.
* @author : Kishor
* @version : 1.1
* @since : 15 November 2016
* @example : Revised at 15th april 2024
*/
class Login extends BaseController
{
protected $login_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->login_model = new Login_model();
}
/**
* Index Page for this controller.
*/
public function index()
{
$isLoggedIn = session()->get('isLoggedIn');
if (!isset($isLoggedIn) || $isLoggedIn != TRUE) {
return view('login');
} else {
redirect('/dashboard');
}
}
/**
* This function used to check the user is logged in or not
*/
function isLoggedIn()
{
$isLoggedIn = session()->get('isLoggedIn');
if (!isset($isLoggedIn) || $isLoggedIn != TRUE) {
return view('login');
} else {
// return view('login');
redirect('/dashboard');
}
}
/**
* This function used to logged in user
*/
public function loginMe()
{
// return redirect()->to(site_url('/dashboard'));
helper(['form', 'url']);
$validationRules = [
'password' => 'required|max_length[32]'
];
if (!$this->validate($validationRules)) {
return redirect()->to(site_url('login'))->withInput();
}
$email = $this->request->getPost('email');
$password = $this->request->getPost('password');
$result = $this->login_model->loginMe($email, $password);
if (!empty($result)) {
foreach ($result as $res) {
log_message('error', '#####loggin_name : ' . $res->FirstName);
$sessionData = [
'userId' => $res->userId,
'role' => $res->roleId,
'roleText' => $res->role,
'name' => $res->FirstName,
'Designation' => $res->Designation,
'DEPCode' => $res->DEPCode,
'HeadDept' => $res->HeadDept,
'depaccess' => $this->login_model->Accessdep($res->EmpID),
'DepartmentName' => $res->DepartmentName,
'EmpID' => $res->EmpID,
'ProfilePic' => $res->ProfilePic,
'CompanyName' => $res->CompanyName,
'isLoggedIn' => true
];
session()->set($sessionData);
$role = $res->roleId;
$designation = $res->Designation;
$DEPCode = $res->DEPCode;
if ($DEPCode == SECURITY) {
return redirect()->to(site_url('/Addigr'));
} else {
return redirect()->to(site_url('/dashboard'));
}
}
} else {
session()->setFlashdata('error', 'Email or password mismatch');
return redirect()->to(site_url('login'));
}
}
/**
* This function used to load forgot password view
*/
function forgotPassword()
{
view('forgotPassword');
}
/**
* To reset password of the user (without one time code)
*/
public function resetPasswordUser()
{
$mobileno = $this->request->getPost('phno');
$emailid = $this->request->getPost('email');
$result = $this->login_model->getuserid($mobileno, $emailid);
if (!empty($result)) {
$string = "abcde" . rand(100000, 999999) . "lmnxyz";
$string_shuffled = str_shuffle($string);
$passcode = substr($string_shuffled, 1, 6);
$password = "RESICO@" . $passcode;
$mobile = "91" . $result[0]->ContactNumber;
$msg = "Hi " . $result[0]->FirstName . ",
\n Your password has been reset successfully.
\n Please login with your new password '" . $password . "'";
$message = urlencode($msg);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $mobile . "&SenderID=VNBAIT&Message=" . $message . "&ServiceName=PROMOTIONAL_HIGH");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($ch);
curl_close($ch);
$resetpassword = password_hash($password, PASSWORD_DEFAULT);
$updatepassword = $this->login_model->updatepassword($result[0]->userId, $resetpassword);
session()->setFlashdata('success', 'Password sent successfully. Please check your mobile.');
return redirect()->to('/loginMe');
} else {
session()->setFlashdata('error', 'This Mobile Number is not registered with us.');
return redirect()->to('/loginMe');
}
}
}

View File

@ -0,0 +1,416 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
// require APPPATH . '/third_party/mpdf/mpdf.php';
use App\Models\Inwardgateregister_model;
use App\Models\Mrir_model;
use App\Models\Purchaseorder_model;
use App\Models\Requistion_model;
/**
* Module : MRIR (security)
* MRIRcontroller Class to control all MRIR related operations.
* @author : Saravana kumar
* @version : 1.1
* @since : 10 Jun 2017
* @example : Revised at 15th april 2024
*/
class MRIRcontroller extends BaseController
{
protected $purchaseorder_model;
protected $inwardgateregister_model;
protected $mrir_model;
protected $requistion_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->purchaseorder_model = new Purchaseorder_model();
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->requistion_model = new Requistion_model();
$this->mrir_model = new Mrir_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'View material inspection report';
$this->loadViews("viewmaterialinspectionreport", $this->global, NULL, NULL);
}
/* For Entry MRIR Screen*/
function materialinspectionreport($mrir = '', $IGRNO = '')
{
$this->global['pageTitle'] = 'Material Inspection Report';
$data['IGRNOonly'] = $this->mrir_model->getIGRNOonly();
$this->loadViews("materialinspectionreport", $this->global, $data, NULL);
}
// Mrir pdf
public function MrirDetailsPrintPdf()
{
$MrirNo = $_GET['MRIRNO'];
$this->global['pageTitle'] = 'MRIR Pdf ';
$data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation();
$data['MRIRDetails'] = $this->mrir_model->edit_mrir($MrirNo);
//mpdf
$mpdf = new mPDF('utf-8', 'A4-P', 10, 10, 10, 10, 10, 38, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetHTMLHeader($HtmlHeading);
$html = view('Mrirprintpdf', $data, true);
$mpdf->SetDisplayMode('fullpage');
$mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output("MrirDetails" . $data . '.pdf', 'I', $php);
// Get output html
// $php = $this->output->get_output();
// // Load library
// $this->load->library('dompdf_gen');
// // Convert to PDF
// $this->dompdf->load_html($php);
// $this->dompdf->render();
// $data['Attachment'] = FALSE;
// $this->dompdf->stream("MrirDetails.pdf",$data,$php);
}
public function viewmrirforbilling()
{
$this->global['pageTitle'] = 'Billing ';
$data['Billing'] = $this->mrir_model->view_mrir_Billing();
$this->loadViews("viewmrirforbilling", $this->global, $data, NULL);
}
public function viewmMaterialDistributionList()
{
$this->global['pageTitle'] = 'Distribution list ';
$data['Distribution'] = $this->mrir_model->ViewDistributionList();
$data['status'] = $this->mrir_model->getStatus();
$this->loadViews("MaterialIssueList", $this->global, $data, NULL);
}
/*FOR Displaying IGR Values (view folder- IGR view page (button link)) */
function igrdatavalues()
{
$IgrNo = $_GET['IGRNO'];
$data['IGRDetails'] = $this->mrir_model->get_IGR($IgrNo);
$this->global['pageTitle'] = 'IGR Details ';
$this->loadViews("materialinspectionreport", $this->global, $data, NULL);
}
function viewinwardgateregister()
{
$this->global['pageTitle'] = 'View Inward Gate Register';
$data['IGR'] = $this->mrir_model->ViewigrListing();
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL);
}
/* For View MRIR Screen (view folder - view page)*/
function viewmaterialinspectionreport()
{
$this->mrir_model = new mrir_model();
$data['viewmrirdatas'] = $this->mrir_model->view_mrir();
//old name:mrirdatas2
$this->global['pageTitle'] = 'View Material Inspection Report';
//print_r( $data);
$this->loadViews("viewmaterialinspectionreport", $this->global, $data, NULL);
}
/* FOR Edit MRIR Screen (View folder - edit page)*/
function editmaterialinspectionreport()
{
$this->mrir_model = new mrir_model();
$MrirNo = $_GET['MRIRNO'];
$data['MRIRDetails'] = $this->mrir_model->edit_mrir($MrirNo); //get_MRIR_Values($MrirNo);
//print_r($data['MRIRDetails']);
$this->global['pageTitle'] = 'Edit Material Inspection Report';
$this->loadViews("Editmaterialinspectionreport", $this->global, $data, NULL);
}
/* NEW Values TO Stored in DB (for insert operation) */
function stored_db() //old name : displaying_values()
{
$this->mrir_model = new mrir_model();
$RowCount = $this->request->getPost('RowCount');
$igrno = $this->request->getPost('IGRNO');
$PONO = $this->request->getPost('PONO');
$CreatedBy = $this->session->get('userId');
$createddt = get_current_date_time();
$Remark = $this->request->getPost('Remark');
//this array to store the value in master table..
$mrirmastervalues = array('MRIRStatus' => MRIR_CREATED, 'IGRNO' => $igrno, 'PONO' => $PONO, 'CreatedBy' => $CreatedBy, 'Createdon' => $createddt);
$mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues);
$IGRDetails = array('IGRStatus' => MRIR_CREATED, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->mrir_model->UpdateIGRStatus($IGRDetails, $igrno);
// $OGRStatus=MRIR_CREATED;
// $check_OGRPO= $this->inwardgateregister_model->update_OGR($PONO,$OGRStatus);
$MRIRNO = '';
if (count($mrirmaster) > 0) {
foreach ($mrirmaster as $key) {
$MRIRNO = $key->MRIRNo;
}
}
for ($i = 1; $i <= $RowCount; $i++) {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
$ActualQuantityReceived = $this->request->getPost('ActualQuantity' . $i);
$ActualQuantityReceived = $ActualQuantityReceived !== null && is_string($ActualQuantityReceived) ? trim($ActualQuantityReceived) : null;
$QuantityAsPerInvoice = $this->request->getPost('Remark' . $i);
$QuantityAsPerInvoice = $QuantityAsPerInvoice !== null && is_string($QuantityAsPerInvoice) ? trim($QuantityAsPerInvoice) : null;
$Remarked = $this->request->getPost('OrderedQuantity' . $i);
$Remarked = $Remarked !== null && is_string($Remarked) ? trim($Remarked) : null;
$StoreIncharge = $this->session->get('userId');
//this array to store the value in child table..
$mrirdetailvalues = array('MRIRNO' => $MRIRNO, 'MaterialCode' => $MaterialCode, 'ActualQuantityReceived' => $ActualQuantityReceived, 'StoreInchargeID' => $StoreIncharge, 'Remarks' => $Remarked);
//print_r($mrirdetailvalues);
//die();
$mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues);
}
echo "successfully created : " . $MRIRNO;
}
/* Values To Stored in DB (for update operation) */
function updated_db()
{
$this->mrir_model = new mrir_model();
$mrir_no = $this->request->getPost('MRIRNO');
$RowCount = $this->request->getPost('RowCount');
$Status = $this->request->getPost('status');
$UPdateby = $this->session->get('userId');
$UPdateon = get_current_date_time();
$PONO = $this->request->getPost('PONO');
//this array to store the updated value in master table..
$strStatus = '';
$strStatus = '';
$ISRejected = 0;
for ($i = 1; $i <= $RowCount; $i++) {
$ActualQty = $this->request->getPost('ActualQuantityReceived' . $i);
$ActualQty = $ActualQty !== null && is_string($ActualQty) ? trim($ActualQty) : null;
$acceptquantity = $this->request->getPost('QuantityAccepted' . $i);
$acceptquantity = $acceptquantity !== null && is_string($acceptquantity) ? trim($acceptquantity) : null;
$rejectquantity = $this->request->getPost('QuantityRejected' . $i);
$rejectquantity = $rejectquantity !== null && is_string($rejectquantity) ? trim($rejectquantity) : null;
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$MaterialCode = $MaterialCode !== null && is_string($MaterialCode) ? trim($MaterialCode) : null;
$Lineitm = $this->request->getPost('Lineitm' . $i);
$Lineitm = $Lineitm !== null && is_string($Lineitm) ? trim($Lineitm) : null;
if ($acceptquantity != 0) {
$ISRejected = 1;
$strStatus = MRIR_APPROVED;
$avlQty = 0;
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode));
if (count($getAvailableqty) > 0) {
$avlQty = $getAvailableqty[0]['Quantity'];
}
$updatStock = array('Quantity' => ($acceptquantity + $avlQty), 'Status' => '0', 'UpdatedOn' => $UPdateon, 'UpdatedBy' => $UPdateby, 'Remarks' => 'Stock added for ' . $this->request->getPost('MRIRNO'));
$this->mrir_model->UpdateStock($updatStock, trim($MaterialCode));
} elseif ($rejectquantity != 0 && $acceptquantity == 0) {
$strStatus = MRIR_REJECTED;
}
$remark = $this->request->getPost('Remark' . $i);
$updateby = $this->session->get('userId');
$updateon = get_current_date_time();
if (strlen($acceptquantity) <= 0 && $acceptquantity == 0) {
$rejectquantity = $ActualQty;
}
//this array to store the update value in child table..
$updatedetailvalues = array('UpdateBy' => $updateby, 'UpdatedOn' => $updateon, 'QuantityAccepted' => $acceptquantity, 'QuantityRejected' => $rejectquantity, 'Remarks' => $remark, 'MRIRStatus' => $strStatus);
$updatedetails = $this->mrir_model->update_mrirdetail($updatedetailvalues, $Lineitm);
$POLineItem = array('Status' => $strStatus, 'UpdateBY' => $updateby, 'UpdatedOn' => $updateon);
$this->mrir_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
//$OGRStatus=MRIR_CREATED;
//$check_OGRPO= $this->inwardgateregister_model->update_OGR($PONO,$strStatus);
}
$OGRStatus = OGR_NOT_CREATED;
$PoMrirStatus = '';
if ($ISRejected == 1) {
$PoMrirStatus = MRIR_APPROVED;
} else {
$PoMrirStatus = MRIR_REJECTED;
}
$updatemastervalues = array('MRIRStatus' => $PoMrirStatus, 'UpdateBY' => $UPdateby, 'UpdatedOn' => $UPdateon, 'OGRstatus' => $OGRStatus);
$updatemaster = $this->mrir_model->update_mrirmaster($updatemastervalues, $mrir_no);
$this->mrir_model->UpdatePOMaster($PONO, $PoMrirStatus, $UPdateby);
echo "successfully updated :" . $mrir_no;
}
/*in view screen we display values for modal (viewmaterialinspectionreport.php)*/
function displaying_MRIRvalues()
{
$mrir = $this->request->getPost("mrirno");
$result = $this->mrir_model->get_MRIRs($mrir);
$obj = json_encode($result);
echo $obj;
}
function displaying_IGRvalues()
{
$igr = $this->request->getPost("igrno");
$result = $this->mrir_model->get_IGRs($igr);
$obj = json_encode($result);
echo $obj;
}
function UpdateReqItemStatus()
{
$Values = $this->request->getPost('id');
$StatusCode = trim($Values[0]);
$MaterialCode = trim($Values[1]);
$ReqNumber = trim($Values[2]);
$Remarks = trim($Values[3]);
$ReqQuantity = trim($Values[4]);
$AceptedQty = trim($Values[5]);
$UpdatedBy = $this->session->get('userId');
$updatedDt = get_current_date_time();
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock($MaterialCode);
$avlQty = 0;
if (count($getAvailableqty) > 0) {
$avlQty = $getAvailableqty[0]['Quantity'];
}
$BalanceQty = 0;
if ($avlQty > 0 && $avlQty >= $AceptedQty) {
$BalanceQty = $avlQty - $AceptedQty;
}
$ReqDetails = array('Status' => $StatusCode, 'remarks' => $Remarks, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDt, 'DeliveredQuantity' => $ReqQuantity);
$this->requistion_model->UpdateRequistionLineItem($ReqDetails, $ReqNumber, $MaterialCode);
$StoreDetails = array('Remarks' => 'Stock Dedeucted for ' . $ReqNumber . ' from ' . $avlQty, 'Quantity' => $BalanceQty);
$this->requistion_model->UpdateAvlQty($StoreDetails, $MaterialCode);
echo "Material Issued Successfully for the Requistion: " . $ReqNumber;
}
}

View File

@ -0,0 +1,882 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
// require APPPATH . '/third_party/mpdf/mpdf.php';
use App\Models\Monthlypay_model;
/**
* Module : Payslip
* Monthlypay Class to control all monthly pay related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Monthlypay extends BaseController
{
protected $monthlypay_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->monthlypay_model = new Monthlypay_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Monthly Pay Details';
$this->loadviews('monthlyListing', $this->global);
}
function loadPublicholidays()
{
$data['days'] = $this->monthlypay_model->getPublicHoldays();
$this->global['pageTitle'] = 'Public Holidays';
$this->loadviews('publicholidays', $this->global, $data, NULL);
}
function deletePublicHoliday()
{
$d = $this->request->getPost('param1');
$res = $this->monthlypay_model->deleteHoliday($d);
if ($res == 1) {
echo "Deleted Successfully..!";
} else {
echo "Something Wrong, Try Later...!";
}
}
function savePublicHolidays()
{
$jsondata = $this->request->getPost('param1');
$phpdata = json_decode($jsondata);
$total = 0;
foreach ($phpdata as $d) {
if (!empty($d->Holiday_Name)) {
$hname = $d->Holiday_Name;
$hdate = format_date($d->Date);//3rd
$tostore = array('H_Name' => $hname, 'H_Date' => $hdate);
$isExist = $this->monthlypay_model->checkHoliday($hdate);
if ($isExist[0]['count'] == 0) {
$count = $this->monthlypay_model->saveHolidays($tostore, 'i');
$total = $total + $count;
} else {
$count = $this->monthlypay_model->saveHolidays($tostore, 'u');
$total = $total + $count;
}
}
}
echo $total . "-Holiday(s) Saved Successfully..!";
}
function attendanceLoad()
{
$month['month'] = '';
$monthdays = 0;
$begin = 0;
$end = 0;
if ($this->request->getPost('month')) {
$current = $this->request->getPost('month');
$month = substr($current, 0, 3);
$year = substr($current, 4);
$month = date_parse($month);
$current = $year . "-" . $month['month'] . '-01';
$monthdays = cal_days_in_month(CAL_GREGORIAN, $month['month'], $year);
$begin = new DateTime($year . '-' . $month['month'] . '-01');
$end = new DateTime($year . '-' . $month['month'] . '-' . $monthdays);
}
if (empty($current)) {
// echo "fresh";
$current = date("Y-m");
$year = date("Y");
$month = date("m");
$current = $current . "-01";
$monthdays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
$begin = new DateTime($year . '-' . $month . '-01');
$end = new DateTime($year . '-' . $month . '-' . $monthdays);
}
$sundayarray = array();
while ($begin <= $end) {
if ($begin->format("D") == "Sun") {
array_push($sundayarray, $begin->format("d"));
}
$begin->modify('+1 day');
}
$noofsundays = count($sundayarray);
$publicholidaysarray = $this->monthlypay_model->getPublicHoldays($current);
$string = "attendance";
$data['noofsundays'] = $noofsundays;
$data['noofpublicholidays'] = count($publicholidaysarray);
$data['publicholidaysarray'] = $publicholidaysarray;
$data['sundayarray'] = $sundayarray;
$data['monthdays'] = $monthdays;
$data['datefordropdown'] = $current;
$data['attendance'] = $this->monthlypay_model->monthlyAttendance($current);
$data['emppay'] = $this->monthlypay_model->getEmpPayDetails($current, $string);
$this->global['pageTitle'] = 'Monthly Attendance';
$this->loadViews("attendance", $this->global, $data, NULL);
}
function saveAttendance()
{
$total = 0;
$jsondata = $this->request->getPost('param1');
$phpdata = json_decode($jsondata, true);
$date = $this->request->getPost('param2');
$NoofDays = $this->request->getPost('param3');
$Month_Year = format_date($date);
$CreateBy = $this->session->get('userId');
// echo 'from COn' . $date;
// print_r($phpdata);die();[Paid Leave
// echo count($phpdata);
//echo $NoofDays.'sdjksjh';
$EmpID = 'temp';
foreach ($phpdata as $data) {
$EmpID = $data['Employee ID'];
$W1H = $data['1W'];
$W1OT = $data['1OT'];
$W2H = $data['2W'];
$W2OT = $data['2OT'];
$W3H = $data['3W'];
$W3OT = $data['3OT'];
$W4H = $data['4W'];
$W4OT = $data['4OT'];
$W5H = $data['5W'];
$W5OT = $data['5OT'];
$W6H = $data['6W'];
$W6OT = $data['6OT'];
$W7H = $data['7W'];
$W7OT = $data['7OT'];
$W8H = $data['8W'];
$W8OT = $data['8OT'];
$W9H = $data['9W'];
$W9OT = $data['9OT'];
$W10H = $data['10W'];
$W10OT = $data['10OT'];
$W11H = $data['11W'];
$W11OT = $data['11OT'];
$W12H = $data['12W'];
$W12OT = $data['12OT'];
$W13H = $data['13W'];
$W13OT = $data['13OT'];
$W14H = $data['14W'];
$W14OT = $data['14OT'];
$W15H = $data['15W'];
$W15OT = $data['15OT'];
$W16H = $data['16W'];
$W16OT = $data['16OT'];
$W17H = $data['17W'];
$W17OT = $data['17OT'];
$W18H = $data['18W'];
$W18OT = $data['18OT'];
$W19H = $data['19W'];
$W19OT = $data['19OT'];
$W20H = $data['20W'];
$W20OT = $data['20OT'];
$W21H = $data['21W'];
$W21OT = $data['21OT'];
$W22H = $data['22W'];
$W22OT = $data['22OT'];
$W23H = $data['23W'];
$W23OT = $data['23OT'];
$W24H = $data['24W'];
$W24OT = $data['24OT'];
$W25H = $data['25W'];
$W25OT = $data['25OT'];
$W26H = $data['26W'];
$W26OT = $data['26OT'];
$W27H = $data['27W'];
$W27OT = $data['27OT'];
$W28H = $data['28W'];
$W28OT = $data['28OT'];
if (!empty($data['29W'])) {
$W29H = $data['29W'];
} else {
$W29H = null;
}
if (!empty($data['29OT'])) {
$W29OT = $data['29OT'];
} else {
$W29OT = null;
}
if (!empty($data['30W'])) {
$W30H = $data['30W'];
} else {
$W30H = null;
}
if (!empty($data['30OT'])) {
$W30OT = $data['30OT'];
} else {
$W30OT = null;
}
if (!empty($data['31W'])) {
$W31H = $data['31W'];
} else {
$W31H = null;
}
if (!empty($data['31OT'])) {
$W31OT = $data['31OT'];
} else {
$W31OT = null;
}
$totalworkinghrs = $data['Total Hrs'];
$totalothrs = $data['OT Hrs'];
$paidleave = $data['Paid Leave'];
$daysworked = $data['Days Worked'];
$absent = $data['Absent'];
$monthattendance = array(
'Month_Year' => $Month_Year, 'NoofDays' => $NoofDays, 'EmpID' => $EmpID, 'WH1' => $W1H, 'OT1' => $W1OT, 'WH2' => $W2H, 'OT2' => $W2OT, 'WH3' => $W3H, 'OT3' => $W3OT,
'WH4' => $W4H, 'OT4' => $W4OT, 'WH5' => $W5H, 'OT5' => $W5OT, 'WH6' => $W6H, 'OT6' => $W6OT, 'WH7' => $W7H, 'OT7' => $W7OT, 'WH8' => $W8H, 'OT8' => $W8OT, 'WH9' => $W9H, 'OT9' => $W9OT, 'WH10' => $W10H, 'OT10' => $W10OT,
'WH11' => $W11H, 'OT11' => $W11OT, 'WH12' => $W12H, 'OT12' => $W12OT, 'WH13' => $W13H, 'OT13' => $W13OT, 'WH14' => $W14H, 'OT14' => $W14OT, 'WH15' => $W15H, 'OT15' => $W15OT, 'WH16' => $W16H, 'OT16' => $W16OT,
'WH17' => $W17H, 'OT17' => $W17OT, 'WH18' => $W18H, 'OT18' => $W18OT, 'WH19' => $W19H, 'OT19' => $W19OT, 'WH20' => $W20H, 'OT20' => $W20OT, 'WH21' => $W21H, 'OT21' => $W21OT, 'WH22' => $W22H, 'OT22' => $W22OT,
'WH23' => $W23H, 'OT23' => $W23OT, 'WH24' => $W24H, 'OT24' => $W24OT, 'WH25' => $W25H, 'OT25' => $W25OT, 'WH26' => $W26H, 'OT26' => $W26OT, 'WH27' => $W27H, 'OT27' => $W27OT, 'WH28' => $W28H, 'OT28' => $W28OT,
'WH29' => $W29H, 'OT29' => $W29OT, 'WH30' => $W30H, 'OT30' => $W30OT, 'WH31' => $W31H, 'OT31' => $W31OT, 'Total_WHrs' => $totalworkinghrs, 'Total_OTHrs' => $totalothrs, 'Paid_Leave' => $paidleave,
'Days_Worked' => $daysworked, 'Absent' => $absent, 'Created_by' => $CreateBy
);
$res = $this->monthlypay_model->saveAttendance($monthattendance, $Month_Year, $EmpID);
// echo $res;
$total = $total + $res;
// die();
}
echo $total . "-Employee(s) Attendance saved Successfully..!";
}
function monthlyListing()
{
$this->monthlypay_model = new monthlypay_model();
$data['userRecords'] = $this->monthlypay_model->monthlyListing();
$this->global['pageTitle'] = 'Monthly Pay List';
$this->loadViews("monthlyListing", $this->global, $data, NULL);
}
/**
* This function is used to load the filtering monthly list
*/
/**
* This function is used to load the add new monthlypay
*/
function addmonthly()
{
//$data['emp_id'] = $this->monthlypay_model->getmonthlypay();
$this->global['pageTitle'] = 'Add Monthly Pay';
$this->loadviews('addMontly', $this->global, NULL);
}
function addNewmonthly()
{
$this->validator->setRules(['month_year'=> 'trim|required',
'emp_id'=> 'trim|required',
'LOP_days'=> 'trim|required',
'OT_Hrs_Worked'=> 'trim|required',
'Loan_Recovered'=> 'trim|required',
'Incentives'=> 'trim|required',
'Other_Deductions'=> 'trim|required']);
if ($this->validator->run() == FALSE) {
$this->addmonthly();
} else {
$month_year = $this->request->getPost('month_year');
$emp_id = $this->request->getPost('emp_id');
$LOP_days = $this->request->getPost('LOP_days');
$OT_Hrs_Worked = $this->request->getPost('OT_Hrs_Worked');
$Loan_Recovered = $this->request->getPost('Loan_Recovered');
$Incentives = $this->request->getPost('Incentives');
$Other_Deductions = $this->request->getPost('Other_Deductions');
$CreateBy = $this->session->get('userId');
$createddt = get_current_date_time();
$monthlypayExists = $this->monthlypay_model->checkmonthlypayExists($monthlypay);
if (count($CodeExists) == 0) {
$montlypay = array('month_year' => $month_year, 'emp_id' => $emp_id, 'LOP_days' => $LOP_days, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Loan_Recovered' => $Loan_Recovered, 'Incentives' => $Incentives, 'Other_Deductions' => $Other_Deductions, 'CreatedBy' => $CreateBy, 'createdDate' => $createddt);
$this->monthlypay_model->addNewmonthly($monthlypay);
}
Print_r('Successfully Created Monthly pay details');
}
}
/**
* This function is used for editing purpose and it has oldest values.
*/
function editOldmonthly($EmpID = '', $month_year = '')
{
/*if($employeeid == null)
{
redirect('monthlypay/monthlyListing');
}*/
$data['monthly'] = $this->monthlypay_model->getUserInfo($EmpID, $month_year);
//$data['monthly_pay_inputs'] = $this->monthlylisting_model->getUserInfo($employeeid);
$this->global['pageTitle'] = 'Edit Monthly Listing';
$this->loadViews("editOldmonthly", $this->global, $data, NULL);
}
/**
* This function is used for stored new values after editing.
*/
function editmonthly()
{
helper('form'); //$this->load->library('form_validation');
$EmpID = $this->request->getPost('EmpID');
$month_year = $this->request->getPost('Month_Year');
$this->validator->setRules([
'month_year'=> 'trim|required',
'EmpID'=> 'trim|required',
'LOP_Days'=> 'trim|required',
'OT_Hrs_Worked'=> 'trim|required',
'Loan_Recovered'=> 'trim|required',
//'Loan_Balance'=>'trim|required',
'Incentives'=> 'trim|required',
'Other_Deductions'=> 'trim|required']);
if ($this->validator->run() == FALSE) {
$this->editOldmonthly($EmpID, $month_year);
} else {
$month_year = $this->request->getPost('Month_Year');
$EmpID = $this->request->getPost('EmpID');
$LOP_Days = $this->request->getPost('LOP_Days');
$OT_Hrs_Worked = $this->request->getPost('OT_Hrs_Worked');
$Loan_Recovered = $this->request->getPost('Loan_Recovered');
$Incentives = $this->request->getPost('Incentives');
$Other_Deductions = $this->request->getPost('Other_Deductions');
$LastModBy = $this->session->get('userId');
$LastModTime = get_current_date_time();
$monthdata = array();
$monthdata = array('Month_Year' => $month_year, 'EmpID' => $EmpID, 'LOP_Days' => $LOP_Days, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Loan_Recovered' => $Loan_Recovered, 'Incentives' => $Incentives, 'Other_Deductions' => $Other_Deductions, 'Last_Mod_By' => $LastModBy, 'Last_Mod_Time' => $LastModTime);
$result = $this->monthlypay_model->editmonth($monthdata, $EmpID);
if ($result == true) {
$this->session->set_flashdata('success', 'updated successfully');
} else {
$this->session->set_flashdata('error', 'updation failed');
}
//echo success;
redirect('monthlyListings');
}
}
/* this function used to permission page*/
function permissionslip()
{
$this->global['pageTitle'] = 'Monthly Pay Details';
$data['emplists'] = $this->monthlypay_model->emplist();
$this->loadviews('permission', $this->global, $data, NULL);
}
/*this function used to view page value get database move it now*/
function addper()
{
$EmpID = $this->request->getPost('emp');
$Date = $this->request->getPost('date');
$CUR = format_date($Date);
// print_r($CUR);die;
$From = $this->request->getPost('timepicker1');
$To = $this->request->getPost('timepicker2');
$Shift = $this->request->getPost('shift');
$Permission = $this->request->getPost('Pretime');
$Reason = $this->request->getPost('Reason');
$Createdby = $this->session->get('userId');
//$Remarks = $this->request->getPost('Remarks');
$Createdtime = get_current_date_time();
if (!empty($EmpID)) {
$Permissiondata = array('EmpID' => $EmpID, 'Date' => $CUR, 'From' => $From, 'To' => $To, 'Shift' => $Shift, 'Permission' => $Permission, 'Reason' => $Reason, 'Createby' => $Createdby, 'Createdtime' => $Createdtime);
}
//print_r($Permissiondata);exit;
$result = $this->monthlypay_model->addper($Permissiondata);
// print_r($result);die;
if (!empty($result)) {
echo "<script type='text/javascript'>alert('Successfully Created Permission Form');
window.location = 'Permissionlist';
</script>";
} else {
echo "<script type='text/javascript'>alert('Not Created Permission Form');
window.location = 'Permission';
</script>";
//redirect('permission');
}
}
//this function used to database value get listing page view that values//
function permissionlist()
{
$this->global['pageTitle'] = 'Monthly Pay Details';
$data['permissionlist'] = $this->monthlypay_model->perlist();
//print_r($data);die;
$this->loadviews('permissionlist', $this->global, $data, NULL);
}
//this function used to pdf value display //
function permissionpdf($SNO)
{
$data['per'] = $this->monthlypay_model->pdf($SNO);
$id = '';
$name = '';
$permissionpdf = '';
$date = '';
foreach ($data['per'] as $record) {
$id = $record->EmpID;
$name = $record->FirstName;
$date = format_date($record->date, 0, 'd-m-Y');
}
$permissionpdf = $id . '-' . $name . '-' . $date;
view($this->config->item('admin_folder') . '/permissionpdf', $data);
$mpdf = new mPDF('utf-8', 'A4-P', 10, 10, 10, 10, 10, 38, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetHTMLHeader($HtmlHeading);
$mpdf->SetTitle('Permission');
$html = view('permissionpdf', $data, true);
$mpdf->SetDisplayMode('fullpage');
//$mpdf->setFooter($HTMLFooter . "Page {PAGENO} of {nb}");
//$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output('Permissionslip' . $permissionpdf . '.pdf', 'I', $php);
}
//this function used to Production salary Details
function productionsalary()
{
$this->global['pageTitle'] = 'ProductionSalary';
$data['productionsalary'] = $this->monthlypay_model->productionsalarycost();
$this->loadviews('salarycostforproduction', $this->global, $data, NULL);
}
function addnew()
{
$date = $this->request->getPost('datepick');
$date = format_date($date);
$prod = $this->request->getPost('pton');
// echo $prod;
$mper = $this->request->getPost('today_abs');
// echo $mper;
$ttl = $this->request->getPost('today_salary');
// echo $ttl;
$salary = $this->request->getPost('calc');
//echo $salary;
$Createdby = $this->session->get('userId');
$acc_createddt = get_current_date_time();
$productions = array(
'date' => $date,
'production' => $prod,
'emppresent' => $mper,
'totalsalary ' => $ttl,
'salaryton' => $salary,
'createdon' => $acc_createddt,
'createdby' => $Createdby
);
//print_r($productions);
// die;
$result = $this->monthlypay_model->productionsalarycosts($productions);
if ($result >= 0) {
echo "<script type='text/javascript'>alert('Successfully Saved!');
</script>";
redirect('monthlypay/productionsalary', 'refresh');
}
}
function edited()
{
$sno = $this->request->getPost('sno');
// echo $sno;
$date = $this->request->getPost('date');
$date = format_date($date);
// echo $date;
$prod = $this->request->getPost('prod');
// echo $prod;
$mper = $this->request->getPost('pra');
// echo $mper;
$ttl = $this->request->getPost('sal');
// echo $ttl;
$salary = $this->request->getPost('ast');
// echo $salary;
$updatedby = $this->session->get('userId');
$acc_createddt = get_current_date_time();
$productions = array(
'date' => $date,
'production' => $prod,
'emppresent' => $mper,
'totalsalary ' => $ttl,
'salaryton' => $salary,
'updatedon' => $acc_createddt,
'updatedby' => $updatedby
);
//print_r($productions);
$result = $this->monthlypay_model->updateproduction($productions, $sno);
if ($result >= 0) {
echo "Updated Successfully Saved";
redirect('monthlypay/productionsalary', 'refresh');
}
}
/*date click on day salary,absent name, total absent display*/
function dateFunctionChangeVales()
{
$date = $this->request->getPost("id");
// echo $date;
$daydate = date('Y-m', strtotime($date));
//echo $date; die;
$daydate = $daydate . '-01';
//$dat = date('d');
// echo $daydate; echo "";
$WH = 'WH' . date('j', strtotime($date));
// echo $WH;
$yesterday = $this->monthlypay_model->attyesterday($WH, $daydate);
// print_r($yesterday);die;
$values = 0;
$absEmp = array();
//echo $value; die;
foreach ($yesterday as $weekda => $value) {
if ($value[$WH] != 0) {
$values++;
$absendId = $value['EmpID'];
$absendName = $value['FirstName'];
$absEmp[] = $absendId . "-" . $absendName; //absend empid and name list
}
}
//print_r($absentName);die;
$data['today'] = $values;
$OT = 'OT' . date('j', strtotime($date));
$CUR_month = date('t');
$toDayEmployee = $this->monthlypay_model->dayAllPersentEmpSalary($WH, $OT, $daydate);
$EmpID = 0;
$employeeSalary = 0;
foreach ($toDayEmployee as $value) {
$values = 0;
$totalothour = 0;
if ($value[$WH] != 0) {
$totalothour = $value[$OT];
//echo $totalothour;die;
$values = 1;
//print_r($values); die;
$Empid = $value['EmpID'];
//print_r($value['EmpID']);
$totalEmployeePersent = $this->monthlypay_model->persentEmployeeDetails($Empid);
$HRA_Amount = $totalEmployeePersent[0]->HRA_Amount;
$Basic_Pay = $totalEmployeePersent[0]->Basic_Pay;
$totalsalary = $totalEmployeePersent[0]->TotalSalary;
$dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances;
//$allowances =$totalEmployeePersent[0]->Allowances;
//echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
//$Allowances = $allowances * $values;
$Food_Allowances = $dayFoodAmt * $values;
$daySalary = $Basic_Pay / $CUR_month;
/**per day salary working hour**/
//echo $daySalary.'<br/>';
$dayHra = $HRA_Amount / $CUR_month;
/** per day hra amount **/
//echo $dayHra.'<br/>';
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($totalothour != 0)
/** if ot not equal zero **/
{
$totSalayOT = $totalothour * $onehoursSalary;
} else {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $values;
/** current day salary working days calculation**/
$currentDayHra = $dayHra * $values;
/** total working days hra calculations**/
// echo $currentDayHra.'<br/>';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
if ($totalsalary <= 20000) {
$esiAmount = $currentDatePF * 1.75 / 100;
/** esiamount not elgiable for 20000 **/
} else {
$esiAmount = 0;
}
$pfAmount = $currentDaySalary * 12 / 100;
/** pf amount per day**/
//echo $totalothour;die;
$salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances;
$salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount);
$employeeSalary += round($salaryInCurrentday);
// echo $employeeSalary;
}
}
//$salaryInCurrentday++;
$data['employeeSalary'] = $employeeSalary;
//print_r($data);
// }
echo json_encode($data);
}
// function forreport()
// {
// $da =$this->request->getPost('term');
// //$ab = format_date($da);
// //echo strtotime($da);
// $da = '01-'.$da;
// //echo $da;
// $ab = format_date($da);
// //strtotime(str_replace('/', '-', '27/05/1990')
// //echo $ab; die;
// $result = $this->monthlypay_model->cost($ab);
// echo json_encode($result);
// }
// function salarycost()
// {
// $this->global['pageTitle'] = $this->CompanyName.' : ProductionSalary';
// // $da =$this->request->getPost('term');
// $da=$this->request->getPost('datepi');
// //$ab = format_date($da);
// //echo $da;
// $da= '01-'.$da;
// //echo $d;
// $ab = format_date($da);
// //strtotime(str_replace('/', '-', '27/05/1990')
// //echo $ab; die;
// $data['productionsalary'] = $this->monthlypay_model->cost($ab);
// //print_r( $data['$productionsalary']); die;
// //echo json_encode($result);
// // $this->loadviews('salarycostforproduction',$this->$data,NULL);
// $this->loadviews('salarycostforproduction',$this->global,$data,NULL);
// }
function salarycost()
{
$this->global['pageTitle'] = 'ProductionSalary';
$da = $this->request->getPost('datepi');
if (!empty($da)) {
$da = '01-' . $da;
}
$from_date = $this->request->getPost('from_date');
// echo $from_date;
$to_date = $this->request->getPost('to_date');
//echo $to_date;
$ab = empty($da) ? "" : format_date($da);
// echo $ab;
$from = empty($from_date) ? "" : format_date($from_date);
//echo $from;
$to = empty($to_date) ? "" : format_date($to_date);
//echo $to;
$data['productionsalary'] = $this->monthlypay_model->cost($ab, $from, $to);
$this->loadviews('salarycostforproduction', $this->global, $data, NULL);
}
}

1503
app/Controllers/Payslip.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

503
app/Controllers/Quality.php Normal file
View File

@ -0,0 +1,503 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
// require APPPATH . '/third_party/mpdf/mpdf.php';
use App\Models\Quality_model;
/**
* Module : Quality
* Quality Class to control all Quality related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Quality extends BaseController
{
protected $quality_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->quality_model = new Quality_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
//$this->load->library('dompdf_gen');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$data['products'] = $this->quality_model->getAllprodcuts();
$data['customers'] = $this->quality_model->getAllcustomers();
$data['existspec'] = $this->quality_model->getAllspec();
$data['existspecinward'] = $this->quality_model->getAllspecInward();
$this->global['pageTitle'] = 'Quality Master';
$this->loadViews("qualitymasterlistview", $this->global, $data, NULL);
}
public function reportList()
{
$data['records'] = $this->quality_model->getTestMasterforList();
$this->global['pageTitle'] = 'Prodcut Report List ';
$this->loadViews("reportmasterlist", $this->global, $data, NULL);
}
public function reportListInward()
{
$data['records'] = $this->quality_model->getTestMasterforListInward();
$this->global['pageTitle'] = 'Report List Inward';
$this->loadViews("reportmasterlist_inward", $this->global, $data, NULL);
}
function addNewPage()
{
$data['productsoutward'] = $this->quality_model->getAllprodcuts();
$data['customersoutward'] = $this->quality_model->getAllcustomers();
$data['productsinward'] = $this->quality_model->getAllprodcutsInward();
$data['customersinward'] = $this->quality_model->getAllcustomersInward();
$this->global['pageTitle'] = 'Quality Master';
$this->loadViews("qualitymaster", $this->global, $data, NULL);
}
function saveSpectficationData()
{
$product = $this->request->getPost('param2');
$customer = $this->request->getPost('param3');
$jsondata = $this->request->getPost('param1');
$type = $this->request->getPost('param4');
//echo $type;die();
$createdby = $this->session->get('userId');
$phpdata = json_decode($jsondata, true);
$total = 0;
// echo $product .'-'. $customer;
//print_r($phpdata);die();
foreach ($phpdata as $data) {
$name = $data['Name'];
$name = strtoupper($name);
$uom = $data['UOM'];
$min = $data['Min'];
$max = $data['Max'];
$temp = $data['Temp'];
$rawsandtest = $data['Raw Sand Test'];
$res = 0;
if (strtolower($rawsandtest) == 'yes') {
$rawsandtest = 1;
} else {
$rawsandtest = 0;
}
$isExist = $this->quality_model->checkExist($product, $customer, $name, $type);
//echo $isExist[0]->count;die();
if ($isExist[0]->count == 0) {
$tostore = array('customer_id' => $customer, 'product_id' => $product, 'testtype' => $name, 'uom' => $uom, 'min' => $min, 'max' => $max, 'temp' => $temp, 'type' => $type, 'subtype' => $rawsandtest, 'created_by' => $createdby);
//print_r($tostore);
$res = $this->quality_model->addSpecMast($tostore);
//echo 'i'.$res;
} else if ($isExist[0]->count == 1) {
$tostore = array('uom' => $uom, 'min' => $min, 'max' => $max, 'temp' => $temp, 'type' => $type, 'subtype' => $rawsandtest, 'updated_by' => $createdby);
$res = $this->quality_model->updateSpecMast($tostore, $product, $customer, $name, $type);
//echo 'u'.$res;
}
$total += $res;
}
echo $total . '- Specification Saved Successfully';
}
function deleteSpecification()
{
$spname = $this->request->getPost('param1');
$product = $this->request->getPost('param2');
$customer = $this->request->getPost('param3');
$type = $this->request->getPost('param4');
$res = $this->quality_model->deleteSpecification($spname, $product, $customer, $type);
if ($res == 1) {
echo "Deleted Successfully..!";
} else {
echo "Something Went Wrong..!Try later";
}
}
function report()
{
$data['records'] = $this->quality_model->getDataforReport();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Inspection Report Screen';
$this->loadViews("qualityreport", $this->global, $data, NULL);
}
function viewSpec()
{
$uri = service('uri');
$prodcutid = $uri->getSegment(3);
$customerid = $uri->getSegment(4);
$type = $uri->getSegment(5);
$data['specifications'] = $this->quality_model->getIndividualSpec($prodcutid, $customerid, $type);
$this->global['pageTitle'] = ' View reports Lists';
$this->loadViews("viewIndSpec", $this->global, $data, NULL);
}
function viewIndReport()
{
$uri = service('uri');
$reportid = $uri->getSegment(3);
$data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
$this->global['pageTitle'] = 'View Individual Report';
$this->loadViews("viewindreport", $this->global, $data, NULL);
}
function viewIndInwardReport()
{
$uri = service('uri');
$reportid = $uri->getSegment(3);
$data['reportdata'] = $this->quality_model->getIndividualInwardReportData($reportid);
$this->global['pageTitle'] = 'View Individual Report';
$this->loadViews("viewindInwardreport", $this->global, $data, NULL);
}
function printReportPDF()
{
$type = '';
$html = '';
$filename = '';
if ($this->request->getPost('type')) {
$type = $this->request->getPost('type');
}
$reportid = $this->request->getPost('rid');
if ($type != 'INWARD' or $type == '') {
$data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
$filename = 'PRE DESPATCH INSPECTION REPORT' . $reportid;
$html = view("viewindreportpdf", $data, true);
} else if ($type == 'INWARD') {
$data['reportdata'] = $this->quality_model->getIndividualInwardReportData($reportid);
$filename = 'INWARD MATERIAL INSPECTION REPORT' . $reportid;
$html = view("viewindinwardreportpdf", $data, true);
}
ob_end_clean();
$mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output($filename . '.pdf', 'I');
}
function getAllSpecforReport()
{
$productid = $this->request->getPost('param1');
$customerid = $this->request->getPost('param2');
$res = '';
if ($this->request->getPost('param3')) {
$ttype = $this->request->getPost('param3');
$res = $this->quality_model->getSpecifications($productid, $customerid, $ttype);
} else {
$res = $this->quality_model->getSpecifications($productid, $customerid);
}
echo json_encode($res);
}
function saveTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->request->getPost('param1');
$loijson = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$invoiceno = $this->request->getPost('param4');
$batchno = $this->request->getPost('param5');
$chart = $this->request->getPost('param7');
$batchno = format_date($batchno);//3rd
$approver = $this->request->getPost('param6');
$testphpdata = json_decode($testjson, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = null;
if (!empty($_FILES['rfile']['name'])) {
$fs = $this->uploadFile();
$document = $fs;
}
$masterreportdata = array('invoiceid' => $invoiceno, 'batchdate' => $batchno, 'createdby' => $createby, 'createdon' => $createdon, 'approvedby' => $approver, 'chartdata' => $chart, 'document' => $document);
$MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
$descrition = '';
$min = '';
$max = '';
$uom = '';
$act1 = '';
$act2 = '';
$act3 = '';
$average = '';
$results = '';
$remarks1 = '';
foreach ($testphpdata as $data) {
//print_r($data);die();
$descrition = $data['Description'];
$min = $data['SpecificationMin'];
$max = $data['SpecificationMax'];
$uom = $data['SpecificationUOM'];
$act1 = $data['ACT X1'];
$act2 = $data['ACT X2'];
$act3 = $data['ACT X3'];
$average = $data['Average'];
$results = $data['Results'];
$remarks1 = $data['Remarks'];
$testreportdata = array('testreport_id' => $MASTERID, 'description' => $descrition, 'min' => $min, 'max' => $max, 'UOM' => $uom, 'act1' => $act1, 'act2' => $act2, 'act3' => $act3, 'average' => $average, 'result' => $results, 'remarks' => $remarks1);
$reportid = $this->quality_model->saveTestReportData($testreportdata);
}
$start = '';
$end = '';
$temp = '';
$w1 = '';
$w2 = '';
$w3 = '';
$loip = '';
$remark = '';
foreach ($loiphpdata as $loi) {
$start = $loi['Heating Timestart'];
$end = $loi['Heating Timeend'];
$temp = $loi['Temp *c'];
$w1 = $loi['Crucible Weight w1(g)'];
$w2 = $loi['Before Heatingw2(g)'];
$w3 = $loi['After Heatingw3(g)'];
$loip = $loi['L.O.I %'];
$remark = $loi['Remarks'];
//echo $loip;
//echo $remark;die();
$loitabledata = array('testreport_id' => $MASTERID, 'start_time' => $start, 'end_time' => $end, 'temp' => $temp, 'w1' => $w1, 'w2' => $w2, 'w3' => $w3, 'loi_percentage' => $loip, 'remarks' => $remark);
$loiid = $this->quality_model->saveTestReportLOIData($loitabledata);
}
$count = 0;
foreach ($afsphpdata as $afs) {
$count++;
if ($count != 12) {
$ssize = $afs['Sieve Size µm'];
$sandweight = $afs['Sand Weight'];
$Percentage = $afs['Percentage'];
$Multiplier = $afs['Multiplier'];
$Product = $afs['Product'];
$afstabledata = array('testreport_id' => $MASTERID, 'sieve_size' => $ssize, 'sandweight' => $sandweight, 'percentage' => $Percentage, 'multiplier' => $Multiplier, 'product' => $Product);
$afsid = $this->quality_model->saveTestReportAFSData($afstabledata);
}
}
echo "Report Data Saved Successfully!";
}
function saveInwardTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->request->getPost('param1');
$loijson = $this->request->getPost('param2');
$afsjson = $this->request->getPost('param3');
$igrno = $this->request->getPost('param4');
$igrlineitemno = $this->request->getPost('param5');
$chart = $this->request->getPost('param7');
$report_date = $this->request->getPost('param8');
$report_date = format_date($report_date, 0, 'Y-m-d');
$approver = $this->request->getPost('param6');
$testphpdata = json_decode($testjson, true);
$loiphpdata = json_decode($loijson, true);
$afsphpdata = json_decode($afsjson, true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->get('userId');
$document = null;
if (!empty($_FILES['rfile']['name'])) {
$fs = $this->uploadFile();
$document = $fs;
}
$masterreportdata = array('igrno' => $igrno, 'igrlineitemno' => $igrlineitemno, 'batchdate' => $report_date, 'createdby' => $createby, 'createdon' => $createdon, 'approvedby' => $approver, 'chartdata' => $chart, 'document' => $document);
//print_r($masterreportdata);die;
$MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
foreach ($testphpdata as $data) {
//print_r($data);die();
$descrition = $data['Description'];
$min = $data['SpecificationMin'];
$max = $data['SpecificationMax'];
$uom = $data['SpecificationUOM'];
$act1 = $data['ACT X1'];
$act2 = $data['ACT X2'];
$act3 = $data['ACT X3'];
$average = $data['Average'];
$results = $data['Results'];
$remarks1 = $data['Remarks'];
$testreportdata = array('testreport_id' => $MASTERID, 'description' => $descrition, 'min' => $min, 'max' => $max, 'UOM' => $uom, 'act1' => $act1, 'act2' => $act2, 'act3' => $act3, 'average' => $average, 'result' => $results, 'remarks' => $remarks1);
$reportid = $this->quality_model->saveTestReportData($testreportdata);
}
// $start = '';
// $end = '';
// $temp = '';
// $w1 = '';
// $w2 = '';
// $w3 = '';
// $loip = '';
// $remark = '';
foreach ($loiphpdata as $loi) {
$start = $loi['Heating Timestart'];
$end = $loi['Heating Timeend'];
$temp = $loi['Temp *c'];
$w1 = $loi['Crucible Weight w1(g)'];
$w2 = $loi['Before Heatingw2(g)'];
$w3 = $loi['After Heatingw3(g)'];
$loip = $loi['L.O.I %'];
$remark = $loi['Remarks'];
//echo $loip;
//echo $remark;die();
$loitabledata = array('testreport_id' => $MASTERID, 'start_time' => $start, 'end_time' => $end, 'temp' => $temp, 'w1' => $w1, 'w2' => $w2, 'w3' => $w3, 'loi_percentage' => $loip, 'remarks' => $remark);
$loiid = $this->quality_model->saveTestReportLOIData($loitabledata);
}
$count = 0;
foreach ($afsphpdata as $afs) {
$count++;
if ($count != 12) {
$ssize = $afs['Sieve Size µm'];
$mesh_size = $afs['Mesh Size'];
$sandweight = $afs['Sand Weight'];
$Percentage = $afs['Percentage'];
$Multiplier = $afs['Multiplier'];
$Product = $afs['Product'];
$afstabledata = array('testreport_id' => $MASTERID, 'sieve_size' => $ssize, 'mesh_size' => $mesh_size, 'sandweight' => $sandweight, 'percentage' => $Percentage, 'multiplier' => $Multiplier, 'product' => $Product);
$afsid = $this->quality_model->saveTestReportAFSData($afstabledata);
}
}
echo "Report Data Saved Successfully!";
}
function addNewInward_Report()
{
$data['records'] = $this->quality_model->getIGRNOforReport();
$data['reports'] = $this->quality_model->getIGRNOReport();;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Inward Inspection';
$this->loadViews("inward_report_create", $this->global, $data, NULL);
}
function getIGRLineItemNo()
{
$igrno = $this->request->getPost('param1');
$data['igrdetails'] = $this->quality_model->getIGRLineItemNo($igrno);
//print_r($data['igrdetails']);
echo json_encode($data['igrdetails']);
}
function getIGRDetails()
{
$igrno = $this->request->getPost('param1');
$igrlineitemno = $this->request->getPost('param2');
$data['igrdetails'] = $this->quality_model->getIGRDataforReport($igrno, $igrlineitemno);
//print_r($data['igrdetails']);
echo json_encode($data['igrdetails']);
}
function uploadFile()
{
$pathinfo = pathinfo($_FILES['rfile']['name']);
$config['upload_path'] = 'public/uploads/QAD/';
$config['allowed_types'] = '*';
$filename = $_FILES['rfile']['name'];
$ext = end(explode('.', $filename));
$ext = strtolower($ext);
$fn = 'qad' . get_current_date() . time() . '.' . $ext;
//print_r($fn);die();
$config['file_name'] = $fn;
//echo $config['file_name'];
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload('rfile')) {
$uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name'];
return $uploadfilename;
} else {
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
print_r($error);
return null;
}
}
}

View File

@ -0,0 +1,338 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Rawmaterialdetails_model;
/**
* Module : Material Master details
* Rawmaterialdetails Class to control all Rawmaterialdetails related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 12 Apr 2017
* @example : Revised at 15th april 2024
*/
class Rawmaterialdetails extends BaseController
{
protected $rawmaterialdetails_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->rawmaterialdetails_model = new Rawmaterialdetails_model();;
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
// $this->load->library('Excel');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'RawMaterialDetails';
$this->loadViews("rawmaterialListing", $this->global, NULL, NULL);
}
/**
* This function is used to load the RawMaterialDetails list
*/
function rawmaterialListing()
{
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
$data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing();
$this->global['pageTitle'] = 'RawMaterial Listing';
$this->loadViews("rawmaterialListing", $this->global, $data, NULL);
}
function shortagematerialListing()
{
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
$data['Records'] = $this->rawmaterialdetails_model->reOrderListing();
$this->global['pageTitle'] = 'ReOrderLevel Listing';
$this->loadViews("shortagematerialListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new cost */
function addRawMaterial()
{
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
$data['material'] = $this->rawmaterialdetails_model->getmaterialType();
$data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory();
$data['UOM'] = $this->rawmaterialdetails_model->getUOM();
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['costcentercode'] = $this->rawmaterialdetails_model->getcostcentercode();
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
$this->global['pageTitle'] = 'AddNew RawMaterial';
$this->loadViews("addRawMaterial", $this->global, $data, NULL);
}
/* Validation for Material Type Dropdown */
function MaterialType_validate($selectValue)
{
//echo 'select_validate method called';
//'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('MaterialType_validate', 'Please Select Material Type.');
echo "<script>alert('Please Select Material Type.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/* Validation for Material Type Dropdown */
function UOM_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if ($selectValue == '-1') {
// $this->validator->setMessage('UOM_validate', 'Please Select UOM.');
echo "<script>alert('Please Select UOM.');</script>";
return false;
} else // user picked something
{
return true;
}
}
/* Validation for Material Category Dropdown */
function materialcategory_validate($selectValue)
{
if ($selectValue == '0') {
// $this->validator->setMessage('materialcategory_validate', 'Please Select Material Category.');
echo "<script>alert('Please Select Material Category.');</script>";
return false;
} else {
return true;
}
}
function addNewRawMaterial()
{
//echo "HI";die();
$TempArr = [];
$MaterialName = $this->request->getPost('MaterialName');
$MaterialType = $this->request->getPost('MaterialType');
$UOM = $this->request->getPost('UOM');
$MaterialCategory = $this->request->getPost('MatCate');
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
foreach ($materialcategoryarray as $mc) {
$TempArr[] = $mc->ConfigValue;
}
//print_r($TempArr);
if (in_array($MaterialCategory, $TempArr)) {
//echo "Match found";
} else {
//echo "Match not found";
$configcode = 'C023';
$config = array('Config_ID' => $configcode, 'ConfigValue' => $MaterialCategory);
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
}
$Remarks = $this->request->getPost('remarks');
$HSN = $this->request->getPost('HSNcode');
$CreatedBy = $this->session->get('userId');
$stock = $this->request->getPost('openstock');
$reorder = $this->request->getPost('reorder');
$stockdate = $this->request->getPost('Date');
$currentstock = '';
$today_dt = get_current_date();
if (empty($stockdate)) {
// $stockdate = NULL;
$stockdate = get_current_date();
$currentstock = $stock;
} else {
$stockdate = format_date($stockdate,0,"Y-m-d");
$todaydateyear = format_date($today_dt,0,"Y");
$openstockdateyear = format_date($stockdate,0,"Y");
$parts = explode('-', $stockdate);
$openstockdatemonth = $parts[1];
$openstockdatedate = $parts[2];
if ($openstockdateyear == $todaydateyear) {
if ($openstockdatemonth <= 03) {
$currentstock = 0;
} else {
$currentstock = $stock;
}
} else if ($openstockdateyear < $todaydateyear) {
//$total= $y;
$currentstock = 0;
} else if ($openstockdateyear > $todaydateyear) {
$currentstock = $stock;
}
}
$chked = $this->request->getPost('isactive');
$IsActive = ($chked != '') ? '1' : '0';
$HSNcode = ($HSN == '') ? null : $HSN;
$RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UOM' => $UOM, 'Category' => $MaterialCategory, 'CreatedBy' => $CreatedBy, 'IsActive' => $IsActive, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder, 'Current_stock' => $currentstock);
//print_r($RawMaterial);die();
$result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial);
if ($result > 0) {
$this->session->setFlashdata('success', 'RawMaterial Created successfully!');
} else {
$this->session->setFlashdata('error', 'RawMaterial Not Created!');
}
return redirect()->route('rawmaterialListing');
}
function viewRawmaterial($RID = '')
{
$MaterialType = '';
$UOM = '';
$MaterialCategory = '';
if ($RID == '') {
$RawMaterialID = $_GET['RID'];
$MaterialType = $_GET['MType'];
$UOM = $_GET['UOM'];
$currentdate = $_GET['date1'];
} else {
$RawMaterialID = $RID;
}
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
$data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate);
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType);
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
$data['costcentercode'] = $this->rawmaterialdetails_model->getCostCenterCode();
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID);
//print_r($data['avg_price']);die();
$this->global['pageTitle'] = 'Edit Material Master';
$this->loadViews("editRawmaterial", $this->global, $data, NULL);
}
/**
* This function is used to edit the user information
*/
function editRawmaterial()
{
$RawmaterialID = $this->request->getPost('MaterialCode');
$MaterialCode = $this->request->getPost('MaterialCode');
$MaterialName = $this->request->getPost('MaterialName');
$MaterialType = $this->request->getPost('MaterialType');
$MaterialCategory = $this->request->getPost('MaterialCategory');
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
foreach ($materialcategoryarray as $mc) {
$TempArr[] = $mc->ConfigValue;
}
//print_r($TempArr);
if (in_array($MaterialCategory, $TempArr)) {
//echo "Match found";
} else {
//echo "Match not found";
$configcode = 'C023';
$config = array('Config_ID' => $configcode, 'ConfigValue' => $MaterialCategory);
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
}
$UOM = $this->request->getPost('UOM');
$Remarks = $this->request->getPost('remarks');
$HSN = $this->request->getPost('HSNcode');
$UpdatedBy = $this->session->get('userId');
$stock = $this->request->getPost('openstock');
$reorder = $this->request->getPost('reorder');
$stockdate = $this->request->getPost('Date');
$stockdate = (empty($stockdate)) ? NULL : format_date($stockdate,0,"Y-m-d");
$chked = $this->request->getPost('isactive');
$IsActive = ($chked != '') ? '1' : '0';
$HSNcode = ($HSN == '') ? null : $HSN;
$RawMaterial = array();
$RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UpdatedBy' => $UpdatedBy, 'UOM' => $UOM, 'IsActive' => $IsActive, 'Category' => $MaterialCategory, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder); //,'RMCode'=>$rmcode);
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
if ($result == true) {
$this->session->setFlashdata('success', 'RawMaterial Updated successfully!');
} else {
echo "<script>alert('RawMaterial Record Not updated!');</script>";
$this->session->setFlashdata('error', 'RawMaterial Record Not updated!');
}
return redirect()->route('rawmaterialListing');
}
function autocomplete()
{
$mc = $this->request->getGet('query');
//echo $mc;die;
$query = $this->rawmaterialdetails_model->checkMaterialCategory($mc);
echo json_encode($query);
// foreach($query->result() as $row):
// echo "<li id='$row->id'>".$row->Category."</li>";
// endforeach;
}
function insertvalueintoconfig()
{
$mc = $this->request->getPost('id');
$configcode = 'C023';
$config = array('Config_ID' => $configcode, 'ConfigValue' => $mc);
$query = $this->rawmaterialdetails_model->insertvalueintoconfig($config);
}
function checkmaterial()
{
$material = $this->request->getPost('id');
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
$query = $this->rawmaterialdetails_model->checkMaterialExists($material);
return $this->response->setJSON($query);
//if(!empty($material)){
// echo json_encode($query);
//}
}
}

1549
app/Controllers/Report.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,604 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Costcenter_model;
use App\Models\Purchaseorder_model;
use App\Models\Requistion_model;
/**
* Module : requisition
* Requisitionform Class to control all Requisition related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Requisitionform extends BaseController
{
protected $requistion_model;
protected $costcenter_model;
protected $purchaseorder_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->requistion_model = new Requistion_model();
$this->costcenter_model = new Costcenter_model();
$this->purchaseorder_model = new Purchaseorder_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the Requistion
*/
function requisitionlisting()
{
$this->global['pageTitle'] = 'Requisition Listing';
$userID = $this->session->get('userId');
// $data['ReqList'] = $this->requistion_model->getRequistListUserID($userID);
$data['Status'] = $this->requistion_model->CheckDraftStatus($userID);
$data['TotNoOfLine'] = $this->requistion_model->getRequistionList($userID);
$this->loadViews("requisitionlisting", $this->global, $data, NULL);
}
/**
* This function used to load the first screen of the requisition Form
*/
function requisition()
{
$this->global['pageTitle'] = 'Raise Requisition';
$data['RequestType'] = $this->requistion_model->getConfigValue('C020');
$data['EmpList'] = $this->requistion_model->getAllEmployees();
$data['ServiceOption'] = $this->requistion_model->getConfigValue('C022');
$userID = $this->session->get('userId');
$data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID);
$data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID);
$this->loadViews("requisitionform", $this->global, $data, null);
}
/**
* This function used to load the first screen of the Requistion List Approval Screen
*/
function requisitionlistApproval()
{
$this->global['pageTitle'] = 'Requisition Approval';
$data['Status'] = $this->requistion_model->getStatus();
$userID = $this->session->get('userId');
$data['AppList'] = $this->requistion_model->getApproverRequistList($userID);
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/**
* This function used to load the Edit Requistion Form
*/
function EditRequisitionForm()
{
$this->global['pageTitle'] = 'Edit Requisition';
$ReqNo = $_GET['ReqNo'];
$ReqType = $_GET['ReqType'];
$userID = $this->session->get('userId');
$data['ReqDetails'] = $this->requistion_model->getRequistDetails($ReqNo, 'Yes');
//print_r($data['ReqDetails']);
$POType = $this->purchaseorder_model->GetPOType($ReqNo);
$ReqPOType = '';
if (count($POType) > 0) {
for ($i = 0; $i < count($POType); $i++) {
if ($POType[$i]['POType'] == $ReqType) {
$ReqPOType = '';
break;
} else {
$ReqPOType = $POType[$i]['POType'];
}
}
}
//print_r($POType);
// echo 'ReqType'.$ReqPOType;
$data['ReqPOType'] = $ReqPOType == '' ? $ReqType : $ReqPOType;
$data['LineItem'] = $this->requistion_model->getEditRequistItemList($ReqNo);
// print_r($data['LineItem']);die;
$data['description'] = '';
foreach ($data['LineItem'] as $line) {
$description = isset($line->MaterialDescription) ? $line->MaterialDescription : null;
//echo $description;
}
$data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID);
$data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo, $ReqType);
$data['ServiceOption'] = $this->requistion_model->getConfigValue('C022');
$this->loadViews("editrequisitionform", $this->global, $data, NULL);
}
/**
* This function used to load the Delete the Requistion Items
*/
function DeleteRequistionForm()
{
$ReqList = $this->request->getPost('id');
$ReqNo = '';
$MaterialCode = '';
if (count($ReqList) > 0) {
$ReqNo = $ReqList[0];
$MaterialCode = $ReqList[1];
}
$this->requistion_model->DeleteRequistionLineItem($ReqNo, $MaterialCode);
return $this->response->setJSON("Successfully Deleted the Line item" . $ReqNo);
}
/**
* This function used to load the Delete the Requistion Items
*/
function DeleteReqNo()
{
$ReqNo = $this->request->getPost('id');
$updateddt = get_current_date_time();
$Request = array('Status' => REQ_DELETED, 'updatedOn' => $updateddt);
$this->requistion_model->UpdateRequistion($Request, $ReqNo);
return $this->response->setJSON(['message' => "Successfully Deleted the " . $ReqNo]);
}
function SearchRequistList()
{
$userID = $this->session->get('userId');
$ReqValue = $this->request->getPost('SearchDate');
$Dt = (is_string($ReqValue)) ? explode("-", $ReqValue) : [];
$FromDate = '';
$ToDate = '';
$Status = '';
if (count($Dt) > 1) {
$FDate = $Dt[0] . "-" . $Dt[1] . "-" . $Dt[2];
$TDate = $Dt[3] . "-" . $Dt[4] . "-" . $Dt[5];
$FromDate = get_date_time_format($FDate);
$ToDate = get_date_time_format($TDate);
}
$St = $this->request->getPost('RequisitionStatus');
if ($St == "-1") {
$Status = '';
} else {
$Status = $St;
}
$data['AppList'] = $this->requistion_model->getApproverRequistList($userID, $Status, $FromDate, $ToDate);
$this->global['pageTitle'] = 'Requisition Approval';
$data['Status'] = $this->requistion_model->getStatus();
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/**
* This function used to load the Employee details based on the EmpID selection
*/
function GetSelectedEmpDetails()
{
$ReqType = $_GET['ReqType'];
$EmpID = $this->request->getPost('id');
$empDetails = $this->requistion_model->GetEmployeeDetails($EmpID);
$DeptCode = $empDetails[0]['DEPCode'];
$CostList = $this->requistion_model->GetCostCenterByDept($DeptCode);
$HTML = "<option value='-1'>Select Cost center</option>";
$BudAmount = "";
if (count($CostList) > 0) {
for ($j = 0; $j < count($CostList); $j++) {
$Code = $CostList[$j]['CostCenterCode'];
$Name = $CostList[$j]['CostCenterName'];
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
}
}
if (count($CostList) == 1) {
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
//print_r($result);
$AvilBudAmt = '0';
if (count($result) > 0) {
$BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
}
}
die(json_encode(array('emp' => $empDetails, 'Cost' => $HTML, 'AvlAmount' => $BudAmount)));
}
function getAvailableBudAmount()
{
$ReqType = $_GET['ReqType'];
$CostCode = $this->request->getPost('id');
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$this->purchaseorder_model = new purchaseorder_model();
$Cost = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
//$Cost = $this->requistion_model->GetAvailableBudgetAmount( $CostCode,$Year,$ReqType);
die(json_encode(array('Cost' => $Cost)));
}
// To get the Material code based on the Request type
function getMaterialCode()
{
$ReqType = $this->request->getPost('id');
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType);
$MaterialName = "";
$UOM = "";
$HTML = "<option value='-1'>Select Material Type</option>";
if (count($MaterialCode) > 0) {
for ($j = 0; $j < count($MaterialCode); $j++) {
$Code = $MaterialCode[$j]['MaterialCode'];
$Name = $MaterialCode[$j]['MaterialName'];
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
}
$MaterialName = $MaterialCode[0]['MaterialName'];
$UOM = $MaterialCode[0]['UOM'];
}
$response = ['Material' => $HTML, 'MaterialName' => $MaterialName, 'UOM' => $UOM];
return $this->response->setJSON($response);
}
// To get the Material value based on the MaterialCode
function getMaterialDetails()
{
$Material = $this->request->getPost('id');
$MaterialDetails = $this->requistion_model->getRawMaterialList($Material);
return $this->response->setJSON(['MatDetail' => $MaterialDetails]);
}
/**
* To Insert the Requistion Details to Database
*/
function addNewRequisition()
{
// print_r($this->request->getPost());die();
log_message('error', " add new Requisition Fns Called");
// $this->validator->setRules(['RequestType'=> 'trim|required',
// 'EmpID'=> 'trim|required']);
// if ($this->validator->run() == FALSE) {
// $this->requisition();
// } else {}
$Status = $this->request->getPost('ID');
$RequestType = $this->request->getPost('RequestType');
$RequestType = (is_string($RequestType)) ? strtoupper(trim($RequestType)) : null;
$Requestedby = $this->request->getPost('EmpID');
$Requestedby = (is_string($Requestedby)) ? strtoupper(trim($Requestedby)) : null;
log_message('error', " add new Requisition empid " . $Requestedby);
$RequestedbyDept = $this->session->get('DEPCode');
$CostCenter = $this->request->getPost('CostCenter');
$CreateBy = $this->session->get('userId');
$UpdatedBy = $this->session->get('userId');
$createddt = get_current_date_time();
$RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = ($DeletedRow !== null && is_string($DeletedRow))
? explode(':', $DeletedRow)
: [];
$serviceSchedule = $this->request->getPost('serviceSchedule');
$servicePeriod = $this->request->getPost('serviceSchedule');
// $noOfService = $this->request->getPost('noOfService');
$noOfService = 1;
$IsExists = $this->requistion_model->RequistionIsExists($Requestedby);
$Request = array('ReqType' => $RequestType, 'Requestedby' => $Requestedby, 'ReqDate' => $createddt, 'CostCenterCode' => $CostCenter, 'Status' => $Status, 'CreatedDate' => $createddt, 'CreatedBy' => $CreateBy, 'Schedule_Type' => $serviceSchedule, 'NumberOfService' => $noOfService, 'Service_Period' => $servicePeriod, 'RequestedDept' => $RequestedbyDept);
if ($Status == REQ_APPROVED) {
$Request['Comments'] = "Default Approved";
$Request['Approvedby'] = $this->session->get('userId');
$Request['ApprovedOn'] = get_current_date_time();
}
if (count($IsExists) == 0) {
$Req = $this->requistion_model->addRequisition($Request);
} else {
$UpdateReq = $this->requistion_model->UpdateRequistion($Request, $IsExists[0]['ReqNo']);
}
$ReqNumber = (count($Req) > 0) ? $Req[0]['ReqNo']
: $IsExists[0]['ReqNo'];
$SkipInsert = "false";
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "false";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "true";
break;
}
}
}
if ($SkipInsert == "false") {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$Quantity = $this->request->getPost('Quantity' . $i);
$OtherD = $this->request->getPost('otherD' . $i);
$ReqDetails = array('ReqNo' => $ReqNumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'MaterialDescription' => $OtherD, 'UpdatedBy' => $UpdatedBy);
$this->requistion_model->addRequistionDetails($ReqDetails, $ReqNumber);
}
}
if ($Status == REQ_DRAFT) {
$display_message = 'Successfully Saved the Requistion details.Requistion No is ' . $ReqNumber;
} else {
$display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber;
}
return $this->response->setJSON([$display_message]);
// return redirect()->route('supplierlisting')->with('success', $display_message);
}
function EditRequisition()
{
$Status = $this->request->getPost('txtStatus');
$ReqNumber = $this->request->getPost('txtReqNo');
$CostCenter = $this->request->getPost('CostCenter');
$UpdatedBy = $this->session->get('userId');
$updatedDate = get_current_date_time();
$DeletedRow = $this->request->getPost('txtDeletedRow');
$RowCount = $this->request->getPost('txtRowCount');
$serviceSchedule = $this->request->getPost('serviceSchedule');
$servicePeriod = $this->request->getPost('serviceSchedule');
// $noOfService = $this->request->getPost('noOfService');
$noOfService = 1;
if (is_string($Status) && strlen($Status) > 1) {
$Request = array('Status' => $Status, 'CreatedDate' => $updatedDate, 'CreatedBy' => $UpdatedBy, 'CostCenterCode' => $CostCenter, 'Schedule_Type' => $serviceSchedule, 'NumberOfService' => $noOfService, 'Service_Period' => $servicePeriod);
$UpdateReq = $this->requistion_model->UpdateRequistion($Request, $ReqNumber);
} else {
$Request = array('Status' => REQ_PENDING_APPROVAL, 'updatedOn' => $updatedDate, 'CostCenterCode' => $CostCenter, 'Schedule_Type' => $serviceSchedule, 'NumberOfService' => $noOfService, 'Service_Period' => $servicePeriod);
$UpdateReq = $this->requistion_model->UpdateRequistion($Request, $ReqNumber);
}
$comma_separated = ($DeletedRow !== null && is_string($DeletedRow))
? explode(':', $DeletedRow)
: [];
/* Table value update and Insert in the table */
//echo "RowCOunt:" .$RowCount;
$SkipInsert = "false";
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "false";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "true";
break;
}
}
}
if ($SkipInsert == "false") {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$Quantity = $this->request->getPost('Quantity' . $i);
$OtherD = $this->request->getPost('otherD' . $i);
$IsExists = $this->requistion_model->LineItemIsExists($ReqNumber, $MaterialCode);
if ($IsExists === null || count($IsExists) == 0) {
$ReqDetails = array('ReqNo' => $ReqNumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'MaterialDescription' => $OtherD, 'UpdatedBy' => $UpdatedBy);
$this->requistion_model->addRequistionDetails($ReqDetails, $ReqNumber);
}
else {
$ReqDetails = array('ReqNo' => $ReqNumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDate, 'MaterialDescription' => $OtherD);
$this->requistion_model->UpdateRequistionLineItem($ReqDetails, $ReqNumber, $MaterialCode);
}
}
}
$display_message = 'Successfully Updated the Requistion details.Requistion No is ' . $ReqNumber;
return $this->response->setJSON([$display_message]);
}
/* To Edit the request*/
function ViewRequest()
{
$ReqNo = $this->request->getPost('id');
$result = $this->requistion_model->getRequistItemList($ReqNo);
$ReqList = $this->requistion_model->getRequistDetails($ReqNo);
$DepNo = $ReqList[0]['DEPCode'];
//$CostList = $this->requistion_model->GetCostCenterByDept($DepNo);
$HTML = "";
for ($i = 0; $i < count($result); $i++) {
$SNo = $i + 1;
$MaterialCode = $result[$i]['MaterialCode'];
$MaterialName = $result[$i]['MaterialName'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['Quantity'];
$Quantity = $result[$i]['Quantity'];
$POQTY = $result[$i]['POQTY'];
$StatusName = $result[$i]['StatusName'];
$HTML .= "<tr id='" . $i . "'>
<td align='left'>" . $SNo . "</td>
<td align='left'>" . $MaterialCode . "</td>
<td align='left'>" . $MaterialName . "</td>
<td align='left'>" . $UOM . "</td>
<td align='left'>" . $Quantity . "</td>
<td align='left'>" . $POQTY . "</td>
<td align='left'>" . $StatusName . "</td>
</tr>";
//$index = $index + 1;
}
$CostCode = '';
$ReqType = '';
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$this->purchaseorder_model = new purchaseorder_model();
if (count($ReqList) > 0) {
$ReqType = $ReqList[0]['ReqType'];
$CostCode = $ReqList[0]['CostCenterCode'];
}
$POType = $this->purchaseorder_model->GetPOType($ReqNo);
$ReqPOType = '';
if (count($POType) > 0) {
for ($i = 0; $i < count($POType); $i++) {
if ($POType[$i]['POType'] == $ReqType) {
$ReqPOType = '';
break;
} else {
$ReqPOType = $POType[$i]['POType'];
}
}
}
$RequestType = '';
$RequestType = $ReqPOType == '' ? $ReqType : $ReqPOType;
$AvlBudget = array();
// if($ReqType== CAPITAL&&$RequestType!=IMPORT )
// {
// $AvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType);
// }
if ($ReqType == CAPITAL && $RequestType != IMPORT) {
$AvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode, $FYdt, $RequestType);
}
// else if($ReqType== CAPITAL&&$RequestType==IMPORT)
// {
// $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$RequestType);
// }
// else if($ReqType== IMPORT)
// {
// $AvlBudget = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode,$FYdt,$RequestType);
// }
else {
$AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
}
// $AvlBudget = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$FYdt,$ReqType);
//print_r($result);
$AvilBudAmt = '0';
if (count($AvlBudget) > 0) {
$AvilBudAmt = $AvlBudget[0]['BudgetAmount'] - $AvlBudget[0]['Totalvalue'];
}
//echo $AvilBudAmt;
die(json_encode(array('Items' => $HTML, 'Requist' => $ReqList, 'AvilBudAmount' => number_format($AvilBudAmt, 2))));
}
/** This function used approve or reject request - Ajax Call*/
function ApproveRequest()
{
$Status = $this->request->getVar('Status');
$ReqNo = $this->request->getVar('ReqNo');
$Remarks = $this->request->getVar('Remarks');
$ApprovedBy = $this->session->get('userId');
$ApprovedDate = get_current_date_time();
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->requistion_model->UpdateRequistion($Request, $ReqNo);
return $this->response->setJSON(['message' => "Successfully Updated the Requisition No: " . $ReqNo]);
}
}

View File

@ -0,0 +1,464 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Quality_model;
/**
* Module : Batch Card
* Resinbatchcard Class to control all Resinbatchcard related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Resinbatchcard extends BaseController
{
protected $quality_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->quality_model = new Quality_model();
helper('form'); //$this->load->library('form_validation');
$this->session = session();
//$this->load->library('dompdf_gen');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
function addNewResinBatchCard()
{
$data['productsoutward'] = $this->quality_model->getAllprodcuts();
$data['customersoutward'] = $this->quality_model->getAllcustomers();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$data['operatorslist'] = $this->quality_model->getOperatorsListforReport();
$data['machinelist'] = $this->quality_model->getMachineList();
$data['trpbatchcardnos'] = $this->quality_model->getTRPBatchcardNos();
$data['igrno'] = $this->quality_model->getIGRNos();
$this->global['pageTitle'] = 'Resin Batch Card';
$this->loadViews("newresinbatchcard", $this->global, $data, NULL);
}
function getIGRLineNo()
{
$igrno = $this->request->getPost('param1');
$sql = 'select IGRItemNo from T_IGR_Details where IGRNO = ?';
$res = $db->query($sql, array($igrno));
echo json_encode($res->result());
}
function resinBatchCardLisitng()
{
$data['records'] = $this->quality_model->getResinBatchCardTestMasterList();
$this->global['pageTitle'] = 'Prodcut Report List ';
$this->loadViews("resinbatchcardreportlist", $this->global, $data, NULL);
}
function saveTestReportData()
{
//echo "system soft";
date_default_timezone_get('Asia/Kolkata');
$productid = $this->request->getPost('param1');
$customerid = $this->request->getPost('param2');
$batchdate = $this->request->getPost('param3');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param4');
$macinecode = $this->request->getPost('param5');
$trpbatchcard = $this->request->getPost('param6');
$igrnos = $this->request->getPost('param7');
$igrlinenos = $this->request->getPost('param8');
$remarks = $this->request->getPost('param9');
$approvedby = $this->request->getPost('param10');
$masterdata = $this->request->getPost('param11');
$totaldata = $this->request->getPost('param12');
$masterdata = json_decode($masterdata, true);
$totaldata = json_decode($totaldata, true);
$createby = $this->session->get('userId');
$document = null;
$resinname = $this->request->getPost('param13');
$oplist = $this->request->getPost('param14');
$oplist = json_decode($oplist);
$operator = $this->request->getPost('param15');
$sandigrnos = $this->request->getPost('param16');
$Resinigrnos = $this->request->getPost('param17');
$Hexamineigrnos = $this->request->getPost('param18');
$CSigrnos = $this->request->getPost('param19');
$Catalystigrno = $this->request->getPost('param20');
$bagsigrnos = $this->request->getPost('param21');
$tonigrnos = $this->request->getPost('param22');
if (!empty($_FILES['rfile']['name'])) {
$fs = $this->uploadFile();
$document = $fs;
}
$sandtotal = 0;
$resintotal = 0;
$catalysttotal = 0;
$hextotal = 0;
$cstotal = 0;
$bags50total = 0;
$ton1bagstotal = 0;
$producitonloss = 0;
$finishedproduct = 0;
foreach ($totaldata as $key => $tot) {
if ($key != 0) {
$sandtotal = $tot['Sand'];
$resintotal = $tot['Resin'];
$hextotal = $tot['Hexamine'];
$catalysttotal = $tot['Catalyst'];
$cstotal = $tot['CS'];
$bags50total = $tot['50 Bags'];
$ton1bagstotal = $tot['1 ton Bag'];
$producitonloss = $tot['Production Loss Lump'];
$finishedproduct = $tot['Finished Prodcut PCS'];
}
}
$masterreportdata = array(
'productid' => $productid,
'customerid' => $customerid,
'batchdate' => $batchdate,
'plantname' => $plantname,
'resinname' => $resinname,
'machinecode' => $macinecode,
'trpbatchcardno' => $trpbatchcard,
'igrno' => $igrnos,
'igrlineno' => $igrlinenos,
'remarks' => $remarks,
'createdby' => $createby,
'approvedby' => $approvedby,
'document' => $document,
'sandtotal' => $sandtotal,
'resintotal' => $resintotal,
'hextotal' => $hextotal,
'cstotal' => $cstotal,
'catalysttotal' => $catalysttotal,
'bags50total' => $bags50total,
'ton1bagstotal' => $ton1bagstotal,
'producitonloss' => $producitonloss,
'finishedproduct' => $finishedproduct,
'operatedby' => $operator,
'igrno_for_sand' => $sandigrnos,
'igrno_for_resin' => $Resinigrnos,
'igrno_for_haxamine' => $Hexamineigrnos,
'igrno_for_cs' => $CSigrnos,
'igrno_for_catalyst' => $Catalystigrno,
'igrno_for_bags' => $bagsigrnos,
'igrno_for_tonbags' => $tonigrnos
);
// print_r($masterreportdata);
// die();
$MASTERID = $this->quality_model->saveResinBatchCardMasterTestData($masterreportdata);
// echo $MASTERID;die();
//$MASTERID = 56;
foreach ($masterdata as $key => $mas) {
if ($key > 2) {
$t = array_pop($mas);
array_pop($mas);
foreach ($mas as $key => $m) {
$newArray = array('master_report_id' => $MASTERID, 'i_time' => $t, 'spec_id' => $key, 'spec_value' => $m);
$res = $this->quality_model->saveResinBatchCardChildTestData($newArray);
//print_r($newArray);
}
}
}
foreach ($oplist as $op) {
$nArray = array('master_id' => $MASTERID, 'EmpID' => $op);
$this->db->insert('T_ResinBatchCard_Operators', $nArray);
}
echo "Report Data Saved Successfully!";
}
function updateTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$productid = $this->request->getPost('param1');
$customerid = $this->request->getPost('param2');
$batchdate = $this->request->getPost('param3');
$batchdate = format_date($batchdate);//3rd
$plantname = $this->request->getPost('param4');
$machines = $this->request->getPost('param5');
$trpbatchcardno = $this->request->getPost('param6');
$igrnos = $this->request->getPost('param7');
$igrlinenos = $this->request->getPost('param8');
$remarks = $this->request->getPost('param9');
$approvedby = $this->request->getPost('param10');
$masterdata = $this->request->getPost('param11');
$totaldata = $this->request->getPost('param12');
$masterdata = json_decode($masterdata, true);
$totaldata = json_decode($totaldata, true);
$createby = $this->session->get('userId');
$document = $this->request->getPost('param13');
$MASTERID = $this->request->getPost('param14');
$opstoinsert = $this->request->getPost('param15');
$opstodelete = $this->request->getPost('param16');
$operatedby = $this->request->getPost('param17');
$sandigrnos = $this->request->getPost('param18');
$Resinigrnos = $this->request->getPost('param19');
$Hexamineigrnos = $this->request->getPost('param20');
$CSigrnos = $this->request->getPost('param21');
$Catalystigrno = $this->request->getPost('param22');
$bagsigrnos = $this->request->getPost('param23');
$tonigrnos = $this->request->getPost('param24');
$resinname = $this->request->getPost('param25');
$opstoinsert = json_decode($opstoinsert);
$opstodelete = json_decode($opstodelete);
// print_r($opstodelete);
// echo count($opstodelete);
//die();
//$oplist = json_decode($oplist);
if (!empty($_FILES['rfile']['name'])) {
if (!empty($document)) {
$file = getcwd() . "\\uploads\QAD\\" . $document;
if (unlink($file)) {
//echo "sucess";
} else {
//echo "Failed";
}
}
$fs = $this->uploadFile();
$document = $fs;
}
$sandtotal = 0;
$resintotal = 0;
$hextotal = 0;
$cstotal = 0;
$catalysttotal = 0;
$bags50total = 0;
$ton1bagstotal = 0;
$producitonloss = 0;
$finishedproduct = 0;
foreach ($totaldata as $key => $tot) {
if ($key != 0) {
$sandtotal = $tot['Sand'];
$resintotal = $tot['Resin'];
$hextotal = $tot['Hexamine'];
$cstotal = $tot['CS'];
$catalysttotal = $tot['Catalyst'];
$bags50total = $tot['50 Bags'];
$ton1bagstotal = $tot['1 ton Bag'];
$producitonloss = $tot['Production Loss Lump'];
$finishedproduct = $tot['Finished Prodcut PCS'];
}
}
$masterreportdata = array(
'batchdate' => $batchdate, 'plantname' => $plantname, 'machinecode' => $machines, 'trpbatchcardno' => $trpbatchcardno, 'igrno' => $igrnos, 'igrlineno' => $igrlinenos, 'resinname' => $resinname, 'remarks' => $remarks, 'updatedby' => $createby, 'approvedby' => $approvedby, 'document' => $document, 'sandtotal' => $sandtotal, 'resintotal' => $resintotal, 'hextotal' => $hextotal, 'cstotal' => $cstotal, 'catalysttotal' => $catalysttotal, 'bags50total' => $bags50total, 'ton1bagstotal' => $ton1bagstotal, 'producitonloss' => $producitonloss, 'finishedproduct' => $finishedproduct, 'operatedby' => $operatedby,
'igrno_for_sand' => $sandigrnos,
'igrno_for_resin' => $Resinigrnos,
'igrno_for_haxamine' => $Hexamineigrnos,
'igrno_for_cs' => $CSigrnos,
'igrno_for_catalyst' => $Catalystigrno,
'igrno_for_bags' => $bagsigrnos,
'igrno_for_tonbags' => $tonigrnos
);
//print_r($masterreportdata);
$this->quality_model->updateResinBatchCardMasterTestData($masterreportdata, $MASTERID);
//echo $MASTERID;die();
//$MASTERID = 56;
foreach ($masterdata as $key => $mas) {
if ($key > 2) {
$t = array_pop($mas);
array_pop($mas);
foreach ($mas as $key => $m) {
$newArray = array('master_report_id' => $MASTERID, 'i_time' => $t, 'spec_id' => $key, 'spec_value' => $m);
$res = $this->quality_model->updateResinBatchCardChildTestData($newArray);
//print_r($newArray);
}
}
}
if (!empty($opstoinsert)) {
foreach ($opstoinsert as $opstins) {
$tArray = array('master_id' => $MASTERID, 'EmpID' => $opstins);
$this->db->insert('T_ResinBatchCard_Operators', $tArray);
//print_r($tArray);
}
}
if (!empty($opstodelete)) {
foreach ($opstodelete as $key => $opstdel) {
//echo 'FROM CON'.'-'.$MASTERID.'-'.$opstdel[0];
$this->db->where('master_id', $MASTERID);
$this->db->where('EmpID', $opstdel[0]);
$this->db->delete('T_ResinBatchCard_Operators');
//print_r($tArray);
}
}
echo "Report Data Saved Successfully!";
}
function printReportPDF()
{
$type = '';
$html = '';
$filename = '';
if ($this->request->getPost('type')) {
$type = $this->request->getPost('type');
}
$reportid = $this->request->getPost('rid');
if ($type != 'INWARD' or $type == '') {
$data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
$filename = 'PRE DESPATCH INSPECTION REPORT' . $reportid;
$html = view("viewindreportpdf", $data, true);
} else if ($type == 'INWARD') {
$data['reportdata'] = $this->quality_model->getIndividualInwardReportData($reportid);
$filename = 'INWARD MATERIAL INSPECTION REPORT' . $reportid;
$html = view("viewindinwardreportpdf", $data, true);
}
require APPPATH . '/third_party/mpdf/mpdf.php';
$mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output($filename . '.pdf', 'I');
}
function uploadFile()
{
$pathinfo = pathinfo($_FILES['rfile']['name']);
$config['upload_path'] = 'public/uploads/QAD/';
$config['allowed_types'] = '*';
$filename = $_FILES['rfile']['name'];
$ext = end(explode('.', $filename));
$ext = strtolower($ext);
$fn = 'RESINBCARD' . get_current_date() . time() . '.' . $ext;
//print_r($fn);die();
$config['file_name'] = $fn;
//echo $config['file_name'];
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload('rfile')) {
$uploadData = $this->upload->data();
$uploadfilename = $uploadData['file_name'];
return $uploadfilename;
} else {
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
print_r($error);
return null;
}
}
function viewIndReport()
{$uri = service('uri');
$rbcid = $uri->getSegment(3);
//echo $rbcid;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$data['records'] = $this->quality_model->getResinBatchCardDetails($rbcid);
//print_r($data['records']);
$data['machinelist'] = $this->quality_model->getMachineList();
$data['igrno'] = $this->quality_model->getIGRNos();
$data['igrlineitem'] = $this->quality_model->getIGRItemNos();
$data['trpbatchcardnos'] = $this->quality_model->getTRPBatchcardNos();
$data['operatorslist'] = $this->quality_model->getOperatorsListforReport();
$data['existoperatorslist'] = $this->quality_model->getExistOperatorsListforReport($rbcid);
//print_r($data['records']);die();
$this->global['pageTitle'] = 'Edit Resin Batch Card';
$this->loadViews("editresinbatchcard", $this->global, $data, NULL);
}
//this function used to edit resinbatch card pdf
function printResinBatchReport()
{$uri = service('uri');
$rbcid = $uri->getSegment(3);
$data['records'] = $this->quality_model->getResinBatchCardDetails($rbcid);
//print_r( $data['records']);
$productid = $data['records']['masterdata'][0]->productid;
$customerid = $data['records']['masterdata'][0]->customerid;
$ttype = 'RESINBATCHCARD';
// echo $productid1;
// echo $customerid1;
$data['recordsheader'] = $this->quality_model->getSpecifications($productid, $customerid, $ttype);
//print_r($data['recordsheader']);
$data['existspec'] = $this->quality_model->getAllspec(); // values max 15 pdf include
$data['existoperatorslist'] = $this->quality_model->getExistOperatorsListforReport($rbcid);
// print_r( $data['existspec']);
// $filename = 'Siddharth :ResinBatchCard'.$rbcid;
$data['reportdata']['masterreport'] = $temparray;
$data['timearray'] = $time;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'ResinBatchCardPDF';
$html = view("viewresinbatchpdf", $data, true);
require APPPATH . '/third_party/mpdf/mpdf.php';
$mpdf = new mPDF('utf-8', 'A4-P', 7, 10, 10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetTitle(' :ResinBatchCard' . $rbcid);
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
//$mpdf->SetJS('print();');
$mpdf->Output($filename . '.pdf', 'I');
}
}

View File

@ -0,0 +1,643 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Costcenter_model;
use App\Models\Purchaseorder_model;
use App\Models\Requistion_model;
/**
* Module : Purchaseorder
* Servicepurchaseorder Class to control all Servicepurchaseorder related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Servicepurchaseorder extends BaseController
{
protected $session;
protected $purchaseorder_model;
protected $requistion_model;
protected $costcenter_model;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->purchaseorder_model = new Purchaseorder_model();
$this->requistion_model = new Requistion_model();
$this->costcenter_model = new Costcenter_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
function viewServicePOReportForBilling()
{
$this->global['pageTitle'] = 'Service Purchase Order for Billing';
$data["Billing"] = $this->purchaseorder_model->GetServicePOListforBilling();
//print_r($data["Billing"]);
$this->loadViews("serviceporeport", $this->global, $data, null);
}
function UpdateServicePOStatus()
{
$this->global['pageTitle'] = 'Update Service PO Status';
$data['PO'] = $this->purchaseorder_model->GetServicePOListforStatusUpdate();
$data['WorkStatus'] = $this->purchaseorder_model->getStatus(7);
$this->loadViews("statusofservicepurchaseorder", $this->global, $data, Null);
}
function getPODetails()
{
$PONO = $this->request->getPost('id');
$PO = $PONO;
$result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO);
$HTML = "";
for ($i = 0; $i < count($result); $i++) {
$SNo = $i + 1;
$ReqNo = $result[$i]['ReqNo'];
$Reqedby = $result[$i]['FirstName'];
$ReqDate = $result[$i]['ReqDate'];
$SupplierID = $result[$i]['SupplierName'];
$Workstatus = $result[$i]['WorkStatus'];
$MaterialCode = $result[$i]['MaterialCode'];
$Description = $result[$i]['ServiceMaterialDescription'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['Quantity'];
$Rate = $result[$i]['Rate'];
$ReqDate = format_date($result[$i]['ReqDate'], 0,'d-m-Y');
$HTML .= "<tr id='" . $SNo . "'>
<td align='left'>" . $ReqNo . "</td>
<td align='left'>" . $Reqedby . "</td>
<td align='left'>" . $ReqDate . "</td>
<td align='left'>" . $SupplierID . "</td>
<td align='left'>" . $MaterialCode . "</td>
<td align='left' >" . $Description . "</td>
<td align='left'>" . $UOM . "</td>
<td align='left'>" . $Quantity . "</td>
<td align='left'>" . $Rate . "</td>
<td align='left'>" . $Workstatus . "</td>
</tr>";
}
echo $HTML;
}
function UpdateServiceStatus()
{
$PONO = $this->request->getPost('PONO');
$WorkStatus = $this->request->getPost('WorkStatus');
$Remarks = $this->request->getPost('Remarks');
$updatedBy = $this->session->get('userId');
$updateddt = get_current_date_time();
if ($WorkStatus == SERVICE_COMPLETED) {
$POStatus = PO_SERVICE_COMPLETED;
$POList = array('UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'ServiceWorkStatusRemarks' => $Remarks, 'ServiceWorkStatus' => $WorkStatus, 'Status' => $POStatus);
$PO = $PONO;
$result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO);
for ($i = 0; $i < count($result); $i++) {
$MaterialCode = $result[$i]['MaterialCode'];
$ReqList = $this->purchaseorder_model->updateReqDetail($PONO, $POStatus, $MaterialCode);
}
// $ReqList = $this->purchaseorder_model->updateReqDetail($PONO,$POStatus);
$this->purchaseorder_model->UpdateReceivedQtyforServicePO($PONO, $updateddt, $updatedBy);
} else {
$POList = array('UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'ServiceWorkStatusRemarks' => $Remarks, 'ServiceWorkStatus' => $WorkStatus);
}
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO, $POList);
$this->UpdateServicePOStatus();
echo "<script>alert('Successfully Updated the workStatus of the PO " . $PONO . "')</script>";
}
// To get the available Budget Amount
function AvilBudgetAmount()
{
$CostCode = $this->request->getPost('id');
$ReqType = $this->request->getPost('type');
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$result = array();
if ($ReqType == CAPITAL) {
$result = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode, $FYdt, $ReqType);
} else if ($ReqType == IMPORT) {
$result = $this->purchaseorder_model->GetAvailableImportBudgetAmount($CostCode, $FYdt, $ReqType);
} else {
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
}
$AvilBudAmt = '0';
if (count($result) > 0) {
$AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
}
return $this->response->setJSON($AvilBudAmt);
}
//This used to Create Service Purchase Order
function addNewServicePurchaseOrder()
{
$POdt = $this->request->getPost('PODate');
$PODate = get_date_time_format($POdt);
$SupplierID = $this->request->getPost('drpSupplier');
$DeliveryAddr = $this->request->getPost('DeliveryAddr');
$dt = $this->request->getPost('Deliverydt');
//$Deliverydt = get_date_time_format($dt);
$DeliveryOption = $this->request->getPost('DateRange');
if ($DeliveryOption == 1) {
$Deliverydt = '';
$DeliverySchedule = $this->request->getPost('Scheduleby');
} else {
$Deliverydt = get_date_time_format($dt);
$DeliverySchedule = '';
}
$ModeOfShipment = $this->request->getPost('addmodeofshipment');
$SupplierReference = $this->request->getPost('addsupplierreference');
$SuppliersOfferNo = $this->request->getPost('addsupplierofferno');
$OtherReferences = $this->request->getPost('addotherreference');
$Fincap = $this->request->getPost('addfincap');
$InsuranceOptions = $this->request->getPost('insuranceStatus');
$InsuranceNo = $this->request->getPost('insuranceNo');
$ServiceTypeOptions = $this->request->getPost('PoTypeOptions');
$DescriptionOfPo = $this->request->getPost('descofpo');
$PaymentTerms = $this->request->getPost('PaymentTerms');
$OtherPayment = $this->request->getPost('Otherpayment');
$POType = $this->request->getPost('POType');
$BudgetType = $this->request->getPost('Budget');
$SpcialInstruction = $this->request->getPost('ScopeOfWork');
$TotalOrderValueSummary = $this->request->getPost('txtTotalOrderValueSummary');
$POStatus = $this->request->getPost('txtStatus');
$CreateBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = explode(':', (string)$DeletedRow);
$createddt = get_current_date_time();
$WorkStatus = $this->request->getPost('workstatus');
$VaildUpto = ($this->request->getPost('VaildUpto') !== null && !empty($this->request->getPost('VaildUpto'))) ? $this->request->getPost('VaildUpto') : null;
$lastPONO = $this->purchaseorder_model->lastPONO();
$newPONO = generate_po_number($lastPONO);
// PO Master
$POList = array('PONO'=>$newPONO,'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'POType' => $POType, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNo, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType,'VaildUpto'=>$VaildUpto);
$POMaster = $this->purchaseorder_model->addPOMaster($POList, $POType, $ServiceTypeOptions);
$PONO = $POMaster ? $newPONO : "";
// $PONO = '';
// if (count($POMaster) > 0) {
// $PONO = $POMaster[0]['PONO'];
// }
// PO Line Items
$LineItemStatus = REQITEM_NEW;
for ($i = 1; $i <= $RowCount; $i++) {
$Per = $this->request->getPost('per' . $i);
$MaterialCode = $this->request->getPost('materialCode' . $i);
$Quantity = $this->request->getPost('quantity' . $i);
$Reqnumber = $this->request->getPost('Reqnumber' . $i);
$itemRate = $this->request->getPost('itemRate' . $i);
$Cgst = $this->request->getPost('Cgst' . $i);
$Sgst = $this->request->getPost('Sgst' . $i);
$Igst = $this->request->getPost('Igst' . $i);
$AfterCgst = $this->request->getPost('AfterCgst' . $i);
$AfterSgst = $this->request->getPost('AfterSgst' . $i);
$AfterIgst = $this->request->getPost('AfterIgst' . $i);
$CostCenter = $this->request->getPost('costCode' . $i);
$ServiceFrequency = $this->request->getPost('Frequency' . $i);
$ItemDescription = $this->request->getPost('ItemDescription' . $i);
$OtherAmt = $this->request->getPost('OtherAmt' . $i);
$TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i);
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
$this->requistion_model = new requistion_model();
$RetItemNo = $this->requistion_model->getItemNumber($Reqnumber, $MaterialCode);
$ItemNo = '';
if (count($RetItemNo) > 0) {
$ItemNo = $RetItemNo[0]['ItemNo'];
}
$POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ServiceMaterialDescription' => $ItemDescription, 'Per' => $Per, 'ItemNo' => $ItemNo);
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
$LineItemNo = '';
if (count($POLineItem) > 0) {
$LineItemNo = $POLineItem[0]['LineItemNo'];
}
//echo $LineItemNo;
/*---------*/
// $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo);
// $addlog= $this->purchaseorder_model->newlogpo($logpo);
/*---------*/
if (trim((string)$POType) == SERVICE) {
// echo 'Success';
$ServiceTaxList = array('LineItemNo' => $LineItemNo, 'CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'otherallowance' => $OtherAmt);
$ServiceTax = $this->purchaseorder_model->addServiceTax($ServiceTaxList);
}
}
}
echo 'Service Purchase Order Created Successfully!The PO NO Is: ' . $PONO;
}
//update service po
function UpdateServicePurchaseOrder()
{
$PONO = $this->request->getPost('txtPONO');
$newsup = $this->request->getPost('newsup');
// $newSupId = split("[ - ]+", $newsup);
$newSupId = preg_split('[-]', (string)$newsup);
$POdt = $this->request->getPost('PODate');
$PODate = get_date_time_format($POdt);
/*-----------------------------------*/
$b4supplier = $this->request->getPost('b4supplier');
$b4date = $this->request->getPost('b4podate');
$b4podate = get_date_time_format($b4date);
/*-----------------------------------*/
$SupplierID = $this->request->getPost('drpSupplier');
$DeliveryAddr = $this->request->getPost('txtDeliveryAddress');
$dt = $this->request->getPost('Deliverydt');
$DeliveryOption = $this->request->getPost('DateRange');
if ($DeliveryOption == 1) {
$Deliverydt = '';
$DeliverySchedule = $this->request->getPost('Scheduleby');
} else {
$Deliverydt = get_date_time_format($dt);
$DeliverySchedule = '';
}
$ModeOfShipment = $this->request->getPost('editmodeofshipment');
$SupplierReference = $this->request->getPost('editsupplierreference');
$SuppliersOfferNo = $this->request->getPost('editsupplierofferno');
$OtherReferences = $this->request->getPost('editotherreference');
$Fincap = $this->request->getPost('editfincap');
$InsuranceOptions = $this->request->getPost('insuranceStatus');
$InsuranceNo = $this->request->getPost('insuranceNo');
$ServiceTypeOptions = $this->request->getPost('PoTypeOptions');
$DescriptionOfPo = $this->request->getPost('editdescofpo');
$PaymentTerms = $this->request->getPost('PaymentTerms');
$OtherPayment = $this->request->getPost('Otherpayment');
$POType = $this->request->getPost('POType');
$BudgetType = $this->request->getPost('Budget');
$SpcialInstruction = $this->request->getPost('ScopeofWork');
$TotalOrderValueSummary = $this->request->getPost('txtTotalOrderValueSummary');
$POStatus = $this->request->getPost('txtStatus');
$updatedBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$comma_separated = explode(':', (string)$DeletedRow);
$updateddt = get_current_date_time();
$WorkStatus = $this->request->getPost('workstatus');
$VaildUpto = ($this->request->getPost('VaildUpto') !== null && !empty($this->request->getPost('VaildUpto'))) ? $this->request->getPost('VaildUpto') : null;
// $lastPONO = $this->purchaseorder_model->lastPONO();
// $newPONO = generate_po_number($lastPONO);
// PO Master
$POList = array('SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'UpdateBY' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $WorkStatus, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNo, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType,'VaildUpto'=>$VaildUpto);
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO, $POList);
$LineItemStatus = REQITEM_NEW;
if ($PODate != $b4podate) {
$logpo = array('PONO' => $PONO, 'LineItemNos' => '-', 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4podate, 'newValue' => $PODate, 'entity' => 'PO DateChanged');
$this->purchaseorder_model->insertlogpo($logpo);
}
if (!empty($newSupId[0])) {
if ($newSupId[0] != $b4supplier) {
//$newsupname = $newSupId[0].'-'.$newSupId[1];
//echo $newsup;die;
$logpo = array('PONO' => $PONO, 'LineItemNos' => '-', 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4supplier, 'newValue' => $newsup, 'entity' => 'Supplier Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
}
for ($i = 1; $i <= $RowCount; $i++) {
$MaterialCode = $this->request->getPost('materialCode' . $i);
$Quantity = $this->request->getPost('quantity' . $i);
/*-----------------------------------*/
$b4qty = $this->request->getPost('b4qty' . $i);
$b4rate = $this->request->getPost('b4rate' . $i);
/*-----------------------------------*/
$Reqnumber = $this->request->getPost('Reqnumber' . $i);
$itemRate = $this->request->getPost('itemRate' . $i);
$Cgst = $this->request->getPost('Cgst' . $i);
$Sgst = $this->request->getPost('Sgst' . $i);
$Igst = $this->request->getPost('Igst' . $i);
$AfterCgst = $this->request->getPost('AfterCgst' . $i);
$AfterSgst = $this->request->getPost('AfterSgst' . $i);
$AfterIgst = $this->request->getPost('AfterIgst' . $i);
$CostCenter = $this->request->getPost('costCode' . $i);
$ServiceFrequency = $this->request->getPost('Frequency' . $i);
$POLineItemNo = $this->request->getPost('LineItemNo' . $i);
$TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i);
$ItemDescription = $this->request->getPost('ItemDescription' . $i);
$OtherAmt = $this->request->getPost('OtherAmt' . $i);
$Per = $this->request->getPost('per' . $i);
/*------------------------------*/
//if($MaterialCode!= ''){
$ReqDetails = array('Quantity' => $Quantity, 'UpdatedBy' => $updatedBy, 'UpdatedOn' => $updateddt);
//print_r($ReqDetails);
$this->purchaseorder_model->updateReqDetails($Reqnumber, $MaterialCode, $ReqDetails);
// }
/*------------------------------*/
/*---------start---------------------*/
// if(($PODate != $b4podate )||($SupplierID != $b4supplier) || ($itemRate!=$b4rate) ||
// ($Quantity != $b4qty ))
// {
// $logpo =array('UpdateBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
// $this->purchaseorder_model->updatelogpo($MaterialCode,$POLineItemNo,$logpo);
// }
if ($Quantity != $b4qty) {
$logpo = array('PONO' => $PONO, 'LineItemNos' => $POLineItemNo, 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4qty, 'newValue' => $Quantity, 'entity' => 'Quantity Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
if ($itemRate != $b4rate) {
$logpo = array('PONO' => $PONO, 'LineItemNos' => $POLineItemNo, 'UpdateBy' => $updatedBy, 'UpdatedOn' => $updateddt, 'oldValue' => $b4rate, 'newValue' => $itemRate, 'entity' => 'Rate Changed');
$this->purchaseorder_model->insertlogpo($logpo);
}
/*----------end--------------------*/
$POLineItem = array();
$LineItemNo = '';
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
if (strlen((string)$POLineItemNo) == 0) {
$this->requistion_model = new requistion_model();
$RetItemNo = $this->requistion_model->getItemNumber($Reqnumber, $MaterialCode);
$ItemNo = '';
if (count($RetItemNo) > 0) {
$ItemNo = $RetItemNo[0]['ItemNo'];
}
$POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ServiceMaterialDescription' => $ItemDescription, 'Per' => $Per, 'ItemNo' => $ItemNo);
$POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList);
if (count($POLineItem) > 0) {
$LineItemNo = $POLineItem[0]['LineItemNo'];
}
} else {
$LineItemNo = $POLineItemNo;
$POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceMaterialDescription' => $ItemDescription, 'Per' => $Per);
$POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $POLineItemNo, $POLineItemList);
}
if (trim((string)$POType) == SERVICE) {
$isExists = $this->purchaseorder_model->LineItemExists($LineItemNo);
if (count($isExists) == 0) {
$ServiceTaxList = array('LineItemNo' => $LineItemNo, 'CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'otherallowance' => $OtherAmt);
$this->purchaseorder_model->addServiceTax($ServiceTaxList);
} else {
$ServiceTaxList1 = array('CGST' => $Cgst, 'After_CGST' => $AfterCgst, 'SGST' => $Sgst, 'After_SGST' => $AfterSgst, 'IGST' => $Igst, 'After_IGST' => $AfterIgst, 'TotalValue' => $TotalOrderValue, 'UpdateBY' => $updatedBy, 'UpdatedOn' => $updateddt, 'otherallowance' => $OtherAmt);
$this->purchaseorder_model->updateServiceTax($LineItemNo, $ServiceTaxList1);
}
}
}
}
echo 'Purchase Order Updated Successfully! PO Number Is: ' . $PONO;
}
/*-----------------------------------*/
function uploadfile()
{
$bill = $this->request->getPost('param1');
$oldfile = $this->request->getPost('param2');
// $new_file_name =$_FILES['file']['name'];
$new_file_name = $_FILES['file']['name'];
$new_file_name = str_replace(" ", "", $new_file_name);
if (!empty($new_file_name)) {
$file = $this->request->getFile('file');
if ($file && $file->isValid()) {
$uploadPath = base_url() . 'public/uploads/BillFiles/';
$file->move($uploadPath);
$Picture = $file->getName();
} else {
$Picture = '';
}
}
$uploadfile = $this->purchaseorder_model->updatefile($bill, $Picture, $oldfile);
if ($uploadfile > 0) {
echo "file updated successfully!";
} else {
echo "file not updated!";
}
}
/*-----------------------------------*/
function addfileuplod()
{
$pono = $this->request->getPost('PONO');
$new_file_name = $_FILES['file']['name'];
$new_file_name = str_replace(" ", "", $new_file_name);
$files = $this->purchaseorder_model->getfies($pono);
$fcount = 0;
foreach ($files as $value) {
$lastfile = $value->FilePath;
if ($lastfile == $new_file_name) {
$fcount++;
}
}
$upfile = '';
if ($fcount == 0) {
if (!empty($new_file_name)) {
$Picture = $this->adfile();
$filelist = array('PONO' => $pono, 'FilePath' => $Picture);
$upfile = $this->purchaseorder_model->insertfile($filelist);
}
}
if ($upfile > 0) {
echo "file updated successfully!";
} else {
echo " No File Choose or File name already Exist";
}
}
public function adfile()
{
$picture = '';
$file = $this->request->getFile('file');
if ($file && $file->isValid()) {
$uploadPath = base_url() . 'public/uploads/BillFiles/';
$file->move($uploadPath);
$picture = $file->getName();
} else {
$picture = '';
}
return $picture;
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Assetdetails_model;
use App\Models\Batchcard_model;
use App\Models\Cashbook_model;
use App\Models\Companydetails_model;
use App\Models\Config_model;
use App\Models\Costcenter_model;
use App\Models\Dashboard_Model;
use App\Models\Department_model;
use App\Models\Employeedetails_model;
use App\Models\Emppaydate_model;
use App\Models\Inwardgateregister_model;
use App\Models\Login_model;
use App\Models\Monthlypay_model;
use App\Models\Mrir_model;
use App\Models\Payroll_model;
use App\Models\Purchaseorder_model;
use App\Models\Quality_model;
use App\Models\Rawmaterialdetails_model;
use App\Models\Requistion_model;
use App\Models\Store_model;
use App\Models\Storerequistion_model;
use App\Models\Supplier_model;
use App\Models\User_model;
use App\Models\Zohobook_api_model;
/**
* Module : Store
* Storerequisition Class to control all Storerequisition related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Storerequisition extends BaseController
{
protected $session;
protected $monthlypay_model;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->monthlypay_model = new Monthlypay_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
//$this->global['pageTitle'] = $this->CompanyName.' : storesrequisitionslip';
//$this->loadviews('storesrequisitionslip',$this->global);
}
function addstorerequisitionslip()
{
$this->global['pageTitle'] = 'Add Store Requisition';
$this->loadviews('addstorerequisitionslip', $this->global);
}
function storerequisitionlist()
{
$this->global['pageTitle'] = 'Store Requisition List';
$this->loadviews('storerequisitionlist', $this->global);
}
function storerequisitionlisting()
{
$this->global['pageTitle'] = 'Store Requisition Listing';
$this->loadviews('storerequisitionlisting', $this->global);
}
function approvalstorerequisition()
{
$this->global['pageTitle'] = 'Approval Store Requisition';
$this->loadviews('approvalstorerequisitionslip', $this->global);
}
}

View File

@ -0,0 +1,467 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Storerequistion_model;
/**
* Module : Store And Stock list details
* Storerequisitioncontroller Class to control all Store's-stock related operations.
* @author : Venba
* @version : 1.1
* @since : 18 November 2017
* @example : Revised at 15th april 2024
*/
class Storerequisitioncontroller extends BaseController
{
protected $storerequistion_model;
protected $session;
/**
* Default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->storerequistion_model = new Storerequistion_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* For Store requisition listing (NOTE : this listing descripted - what are the store requistion)
**/
function addstores()
{
$this->global['pageTitle'] = 'Raise Store Requisition';
$userId = $this->session->get('userId');
$data['DEPCode'] = $this->session->get('DEPCode');
$data['DepName'] = $this->session->get('DepartmentName');
$data['cost'] = $this->storerequistion_model->getCostUser($userId);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList();
$this->loadViews("addstorerequisitionslip", $this->global, $data, null);
}
/**
* Store requisition listing is under Draft status (this hide the raise StoreRequisition button).
**/
function addstore()
{
$this->global['pageTitle'] = 'Store Requisition Details';
$userId = $this->session->get('userId');
$data['Store'] = $this->storerequistion_model->Storeall($userId);
$this->loadViews("storerequisition", $this->global, $data, null);
}
/**
* Its handles Store Requistion Delete Operations ( in Store Requistion listing )
*/
function DeleteReqNo()
{
$StoreReqNo = $this->request->getPost('id');
$updateddt = get_current_date_time();
$Request = array('Status' => REQ_DELETED, 'updatedOn' => $updateddt);
$this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
echo "Successfully Deleted the " . $StoreReqNo;
}
/**
* For editing purpose and it has oldest all store requistion.
*/
function EditStoreRequistion()
{
$StoreReqNo = $_GET['StoreReqNo'];
$this->global['pageTitle'] = 'Edit StoreRequisition';
$data['cost'] = $this->storerequistion_model->editRequistDetails($StoreReqNo);
$data['Status'] = $this->storerequistion_model->getStoreRequistionStatus($StoreReqNo);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList();
$data['DepName'] = $this->session->get('DepartmentName');
$data['LineItem'] = $this->storerequistion_model->editstorerequistions($StoreReqNo);
$this->loadViews("editstorerequisition", $this->global, $data, null);
}
/**
* To convert the dateformat (date with time) and store to DB
*/
function getDateformat($Val)
{
$date = new DateTime($Val);
$retDate = $date->format('Y-m-d H:i:s');
return $retDate;
}
/**
* For new StoreRequestion values inserted into DB
*/
function addNewRequistion()
{
$CostCenter = $this->request->getPost('CostCenter');
$DEPCode = $this->request->getPost('txtDepCode');
$CreateBy = $this->session->get('userId');
$createddt = get_current_date_time();
$DeletedRow = $this->request->getPost('txtDeletedRow');
$RowCount = $this->request->getPost('txtRowCount');
$Status = $this->request->getPost('txtStatus');
$Requestedby = $this->session->get('EmpID');
$comma_separated = explode(':', $DeletedRow);
$StoreReqNo = '';
$StoreItemStatus = STORE_OPEN;
$Request = array('Requestedby' => $Requestedby, 'DepartmentCode' => $DEPCode, 'ReqDate' => $createddt, 'CostCenterCode' => $CostCenter, 'Status' => $Status, 'CreatedDate' => $createddt, 'CreatedBy' => $CreateBy);
$Req = $this->storerequistion_model->addRequistion($Request);
if (count($Req) > 0) {
$StoreReqNo = $Req[0]['StoreReqNo'];
}
$SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$QuantityRequired = $this->request->getPost('Quantity' . $i);
$Remarks = $this->request->getPost('Remarks' . $i);
$Request = array('MaterialCode' => $MaterialCode, 'Status' => $StoreItemStatus, 'QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'StoreReqNo' => $StoreReqNo);
$addReq = $this->storerequistion_model->addstoreRequistion($Request);
}
}
if ($Status == STORE_DRAFT) {
echo 'Successfully Saved the Store Requistion details';
} else {
echo 'Successfully Created the Store Requistion details';
}
}
/**
* For Store requisition listing (NOTE : this listing descripted - only approved store requistion)
*/
function addstorerequisitionlist()
{
$this->global['pageTitle'] = 'Store Requisition Listing';
$data['Status'] = $this->storerequistion_model->getStatus();
$data['TotNoOfLine'] = $this->storerequistion_model->getRequistionList();
$this->loadViews("storerequisitionlisting", $this->global, $data, null);
}
/**
* To issue Store Requistion
**/
function issuestorerequisition()
{
$this->global['pageTitle'] = 'Issue StoreRequisition';
$StoreReqNo = $_GET['ReqNo'];
$data['ReqItem'] = $this->storerequistion_model->getRequistItemList($StoreReqNo);
$data['ReqListDetails'] = $this->storerequistion_model->getRequistDetails($StoreReqNo);
$this->loadViews("issueStoreRequistion", $this->global, $data, null);
}
/**
* To Update with existing one with new one (Issued Requistion)
* */
function UpdateIssueRequistion()
{
$ReqNO = $this->request->getPost('txtReqNo');
$RowCount = $this->request->getPost('txtRowCount');
$createddt = get_current_date_time();
$UPdateby = $this->session->get('userId');
$UPdateon = get_current_date_time();
for ($i = 1; $i <= $RowCount; $i++) {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$IssuedQuantity = $this->request->getPost('txtIssuedQuantity' . $i);
$Reqqty = $this->request->getPost('txtqty' . $i);
$savedqty = $this->storerequistion_model->getSavedQty($ReqNO, $MaterialCode);
$Qtyissued = 0;
foreach ($savedqty as $Qty) {
$Qtyissued = $Qty->QuantityIssued;
}
$ActQty = $Qtyissued + $IssuedQuantity;
if ($Reqqty > $ActQty) {
$ItemStatus = STORE_PARTIALLYISSUSED;
} else {
$ItemStatus = STORE_ISSUSED;
}
if (strlen($IssuedQuantity) > 0) {
$Remarks = $this->request->getPost('txtRemarks' . $i);
$CreatedBy = $this->session->get('userId');
$storerequisition = array('StoreReqNo' => $ReqNO, 'MaterialCode' => $MaterialCode, 'QuantityIssued' => $ActQty, 'Status' => $ItemStatus, 'StoreComments' => $Remarks, 'UpdatedOn' => $createddt, 'UpdatedBy' => $CreatedBy);
$this->storerequistion_model->UpdateStoreRequistionItem($storerequisition, $ReqNO, $MaterialCode);
$getAvailableqty = $this->storerequistion_model->getItemQuantityFromStock(trim($MaterialCode));
if (count($getAvailableqty) > 0) {
$avlQty = $getAvailableqty[0]['Quantity'];
}
$BalanceQty = $avlQty - $IssuedQuantity;
$updatStock = array(
'Quantity' => $BalanceQty, 'Status' => '0',
'Remarks' => 'Stock Deducted For' . $ReqNO, 'UpdatedOn' => $UPdateon, 'UpdatedBy' => $UPdateby
);
$this->storerequistion_model->UpdateStock($updatStock, trim($MaterialCode));
$StoreReqNo = $ReqNO;
$reqstatus = $this->storerequistion_model->getstatuscount('ST037', $ReqNO);
$reqstatuscount = 0;
foreach ($reqstatus as $Req) {
$reqstatuscount = $Req->SCount;
}
if ($reqstatuscount == $RowCount) {
$reqStatus = STORE_ISSUSED;
} else {
$reqStatus = STORE_PARTIALLYISSUSED;
}
$updatestatus = array('Status' => $reqStatus);
$this->storerequistion_model->updatestoremaster($updatestatus, $StoreReqNo);
}
}
echo "<script>alert('Updated Successfully!');</script>";
redirect('storerequisitionlisting', 'refresh');
}
/**
* For Store Requisition listing (Note: this listing descripted - Approve the store requisition )
**/
function SearchRequistLists()
{
$userID = $this->session->get('userId');
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID);
$this->global['pageTitle'] = 'Approval Store Requisition Listing';
$data['Status'] = $this->storerequistion_model->getStatus();
$this->loadViews("approvalstorerequisitionslip", $this->global, $data, NULL);
}
/**
* To change the approval storerequisition status ( Approve Completed are not)
*/
function ApproveRequest()
{
$Status = Trim($_GET['Status']);
$StoreReqNo = trim($this->request->getPost('id'));
$Remarks = trim($this->request->getPost('newcomments'));
$ApprovedBy = $this->session->get('userId');
$ApprovedDate = get_current_date_time();
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
echo "Successfully Updated the Requistion No: " . $StoreReqNo;
}
/*to load the first screen of the Requistion List Approval Screen*/
function requisitionlistApproval()
{
$this->global['pageTitle'] = 'Approvalstorerequisitionlist';
$userID = $this->session->get('userId');
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID);
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/* To Edit the view store request*/
function ViewRequest()
{
$StoreReqNo = $this->request->getPost('id');
$result = $this->storerequistion_model->getRequistItemListApproval($StoreReqNo);
$ReqList = $this->storerequistion_model->getRequistDetails($StoreReqNo);
$HTML = "";
for ($i = 0; $i < count($result); $i++) {
$SNo = $i + 1;
$MaterialCode = $result[$i]['MaterialCode'];
$MaterialName = $result[$i]['MaterialName'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['QuantityRequired'];
$IssuedQty = $result[$i]['QuantityIssued'];
$Status = $result[$i]['StatusName'];
$Remarks = $result[$i]['Remarks'];
$HTML .= "<tr id='" . $i . "'>
<td align='left'>" . $SNo . "</td>
<td align='left'>" . $MaterialCode . "</td>
<td align='left'>" . $MaterialName . "</td>
<td align='left'>" . $UOM . "</td>
<td align='left'>" . $Quantity . "</td>
<td align='left'>" . $IssuedQty . "</td>
<td align='left'>" . $Status . "</td>
<td align='left'>" . $Remarks . "</td>
</tr>";
}
die(json_encode(array('Items' => $HTML, 'Requist' => $ReqList)));
}
/**
* For stored new values after edited StoreRequistion information.
*/
function UpdateStoreRequistion()
{
$CostCenter = $this->request->getPost('CostCenter');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$RowCount = $this->request->getPost('txtRowCount');
$Status = $this->request->getPost('txtStatus');
$Requestedby = $this->session->get('EmpID');
$comma_separated = explode(':', $DeletedRow);
$StoreReqNo = $this->request->getPost('txtReqNo');
$Requestedby = $this->request->getPost('RequestedBy');
$UpdatedBy = $this->session->get('userId');
$updatedDate = get_current_date_time();
if (strlen($Status) > 1) {
$Request = array('CostCenterCode' => $CostCenter, 'Status' => $Status, 'updatedOn' => $updatedDate);
$UpdateReq = $this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
}
$SkipInsert = False;
$StoreItemStatus = STORE_OPEN;
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$QuantityRequired = $this->request->getPost('Quantity' . $i);
$Remarks = $this->request->getPost('Remarks' . $i);
$IsExists = $this->storerequistion_model->LineItemIsExists($StoreReqNo, $MaterialCode);
if (count($IsExists) == 0) {
$ReqDetails = array('StoreReqNo' => $StoreReqNo, 'MaterialCode' => $MaterialCode, 'QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'Status' => $StoreItemStatus, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDate);
$this->storerequistion_model->addstoreRequistion($ReqDetails);
} else {
$ReqDetails = array('QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'Status' => $StoreItemStatus, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDate);
$this->storerequistion_model->UpdateRequistionLineItem($ReqDetails, $StoreReqNo, $MaterialCode);
}
}
}
echo 'Successfully updated the Requistion details';
}
/**
* Its handles Store Requistion Line item Delete Operations ( add & edit Store Requistion screen)
*/
function DeleteRequistionForm()
{
$ReqList = $this->request->getPost('id');
$StoreReqNo = '';
$MaterialCode = '';
if (count($ReqList) > 0) {
$StoreReqNo = $ReqList[0];
$MaterialCode = $ReqList[1];
}
$this->storerequistion_model->DeleteRequistionLineItem($StoreReqNo, $MaterialCode);
echo "Successfully Deleted the Line item" . $StoreReqNo;
}
}

View File

@ -0,0 +1,536 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Assetdetails_model;
use App\Models\Batchcard_model;
use App\Models\Cashbook_model;
use App\Models\Companydetails_model;
use App\Models\Config_model;
use App\Models\Costcenter_model;
use App\Models\Dashboard_Model;
use App\Models\Department_model;
use App\Models\Employeedetails_model;
use App\Models\Emppaydate_model;
use App\Models\Inwardgateregister_model;
use App\Models\Login_model;
use App\Models\Monthlypay_model;
use App\Models\Mrir_model;
use App\Models\Payroll_model;
use App\Models\Purchaseorder_model;
use App\Models\Quality_model;
use App\Models\Rawmaterialdetails_model;
use App\Models\Requistion_model;
use App\Models\Store_model;
use App\Models\Storerequistion_model;
use App\Models\Supplier_model;
use App\Models\User_model;
use App\Models\Zohobook_api_model;
/**
* Module - Store
* Storerequisitionlist Class to control all Storerequisitionlist related operations.
* @author : Venba
* @version : 1.1
* @since : 15 Feb 2016
* @example : Revised at 15th april 2024
*/
class Storerequisitionlist extends BaseController
{
protected $storerequistion_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->storerequistion_model = new Storerequistion_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/*ADD Store requisition line item
*/
function addstores()
{
$this->global['pageTitle'] = 'StoreRequisition Listing';
$userId = $this->session->get('userId');
$data['DEPCode'] = $this->session->get('DEPCode');
$data['DepName'] = $this->session->get('DepartmentName');
$data['cost'] = $this->storerequistion_model->getCostUser($userId);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList();
$this->loadViews("addstorerequisitionslip", $this->global, $data, null);
}
function addstore()
{
$this->global['pageTitle'] = 'StoreRequisition Listing';
$userId = $this->session->get('userId');
$data['Store'] = $this->storerequistion_model->Storeall($userId);
$this->loadViews("storerequisition", $this->global, $data, null);
}
/**
* This function used to load the Delete the StoreRequistion Items
*/
function DeleteReqNo()
{
$StoreReqNo = $this->request->getPost('id');
$updateddt = get_current_date_time();
$Request = array('Status' => REQ_DELETED, 'updatedOn' => $updateddt);
$this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
echo "Successfully Deleted the " . $StoreReqNo;
}
/* The Function Edit Store Requistion list */
function EditStoreRequistion()
{
$StoreReqNo = $_GET['StoreReqNo'];
//$StoreReqNo= $this->request->getPost('id');
$this->global['pageTitle'] = 'StoreRequisition Listing';
$data['cost'] = $this->storerequistion_model->editRequistDetails($StoreReqNo);
$data['Status'] = $this->storerequistion_model->getStoreRequistionStatus($StoreReqNo);
$data['MaterialList'] = $this->storerequistion_model->getRawMaterialList();
$data['DepName'] = $this->session->get('DepartmentName');
$data['LineItem'] = $this->storerequistion_model->editstorerequistions($StoreReqNo);
$this->loadViews("editstorerequisition", $this->global, $data, null);
}
/**This function is used to add new StoreRequestion to the system */
function addNewRequistion()
{
$CostCenter = $this->request->getPost('CostCenter');
$DEPCode = $this->request->getPost('txtDepCode');
$CreateBy = $this->session->get('userId');
$createddt = get_current_date_time();
$DeletedRow = $this->request->getPost('txtDeletedRow');
$RowCount = $this->request->getPost('txtRowCount');
// echo $RowCount;
// die();
$Status = $this->request->getPost('txtStatus');
$Requestedby = $this->session->get('EmpID');
$comma_separated = explode(':', $DeletedRow);
//echo 'done';
$StoreReqNo = '';
$StoreItemStatus = STORE_OPEN;
$Request = array('Requestedby' => $Requestedby, 'DepartmentCode' => $DEPCode, 'ReqDate' => $createddt, 'CostCenterCode' => $CostCenter, 'Status' => $Status, 'CreatedDate' => $createddt, 'CreatedBy' => $CreateBy);
//print_r($Request);
$Req = $this->storerequistion_model->addRequistion($Request);
if (count($Req) > 0) {
$StoreReqNo = $Req[0]['StoreReqNo'];
//printf_r($ReqNumber);
}
//echo $StoreReqNo;
$SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$QuantityRequired = $this->request->getPost('Quantity' . $i);
$Remarks = $this->request->getPost('Remarks' . $i);
$Request = array('MaterialCode' => $MaterialCode, 'Status' => $StoreItemStatus, 'QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'StoreReqNo' => $StoreReqNo);
$addReq = $this->storerequistion_model->addstoreRequistion($Request);
}
}
if ($Status == STORE_DRAFT) {
echo 'Successfully Saved the Store Requistion details';
} else {
echo 'Successfully Created the Store Requistion details';
}
}
function addstorerequisitionlist()
{
$this->global['pageTitle'] = 'StoreRequisition Listing';
$data['Status'] = $this->storerequistion_model->getStatus();
$data['TotNoOfLine'] = $this->storerequistion_model->getRequistionList();
//print_r($data['TotNoOfLine']);
$this->loadViews("storerequisitionlisting", $this->global, $data, null);
}
//To issue Store Requistion
function issuestorerequisition()
{
$this->global['pageTitle'] = 'Issue StoreRequisition';
$StoreReqNo = $_GET['ReqNo'];
$data['ReqItem'] = $this->storerequistion_model->getRequistItemList($StoreReqNo);
$data['ReqListDetails'] = $this->storerequistion_model->getRequistDetails($StoreReqNo);
//print_r($data['ReqItem']);
$this->loadViews("issueStoreRequistion", $this->global, $data, null);
}
function UpdateIssueRequistion()
{
//echo 'ffd';
// die();
$ReqNO = $this->request->getPost('txtReqNo');
$RowCount = $this->request->getPost('txtRowCount');
//echo $RowCount;
//die();
$createddt = get_current_date_time();
$UPdateby = $this->session->get('userId');
$UPdateon = get_current_date_time();
//$ItemStatus = STORE_ISSUSED;
for ($i = 1; $i <= $RowCount; $i++) {
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
// echo $MaterialCode;
$IssuedQuantity = $this->request->getPost('txtIssuedQuantity' . $i);
$Reqqty = $this->request->getPost('txtqty' . $i);
// echo $Reqqty;
// die();
$savedqty = $this->storerequistion_model->getSavedQty($ReqNO, $MaterialCode);
// if($reqstatus==)
// print_r($savedqty);
// die();
$Qtyissued = 0;
foreach ($savedqty as $Qty) {
$Qtyissued = $Qty->QuantityIssued;
}
$ActQty = $Qtyissued + $IssuedQuantity;
// echo $ActQty;
// die();
if ($Reqqty > $ActQty) {
$ItemStatus = STORE_PARTIALLYISSUSED;
} else {
$ItemStatus = STORE_ISSUSED;
}
//echo $ItemStatus;
//die();
// echo'Material issed';
if (strlen($IssuedQuantity) > 0) {
$Remarks = $this->request->getPost('txtRemarks' . $i);
//echo $IssuedQuantity;
//die ();
$CreatedBy = $this->session->get('userId');
$storerequisition = array('StoreReqNo' => $ReqNO, 'MaterialCode' => $MaterialCode, 'QuantityIssued' => $ActQty, 'Status' => $ItemStatus, 'StoreComments' => $Remarks, 'UpdatedOn' => $createddt, 'UpdatedBy' => $CreatedBy);
//print_r($storerequisition);
//die();
$this->storerequistion_model->UpdateStoreRequistionItem($storerequisition, $ReqNO, $MaterialCode);
$getAvailableqty = $this->storerequistion_model->getItemQuantityFromStock(trim($MaterialCode));
if (count($getAvailableqty) > 0) {
$avlQty = $getAvailableqty[0]['Quantity'];
}
$BalanceQty = $avlQty - $IssuedQuantity;
// echo $BalanceQty;
// die();
$updatStock = array(
'Quantity' => $BalanceQty, 'Status' => '0',
'Remarks' => 'Stock Deducted For' . $ReqNO, 'UpdatedOn' => $UPdateon, 'UpdatedBy' => $UPdateby
);
$this->storerequistion_model->UpdateStock($updatStock, trim($MaterialCode));
$StoreReqNo = $ReqNO;
$reqstatus = $this->storerequistion_model->getstatuscount('ST037', $ReqNO);
$reqstatuscount = 0;
//print_r($reqstatus);
foreach ($reqstatus as $Req) {
$reqstatuscount = $Req->SCount;
}
if ($reqstatuscount == $RowCount) {
$reqStatus = STORE_ISSUSED;
} else {
$reqStatus = STORE_PARTIALLYISSUSED;
}
// echo $reqstatuscount;
$updatestatus = array('Status' => $reqStatus);
$this->storerequistion_model->updatestoremaster($updatestatus, $StoreReqNo);
}
}
//die();
echo "<script>alert('Updated Successfully!');</script>";
redirect('storerequisitionlisting', 'refresh');
}
/* this function use to search StoreRequistlist*/
function SearchRequistLists()
{
$userID = $this->session->get('userId');
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID);
//print_r($data['AppList']);
$this->global['pageTitle'] = ' ApprovalStoreRequisitionSlip';
$data['Status'] = $this->storerequistion_model->getStatus();
if ($this->Designation != SECURITY && $this->DEPCode != HR) {
$this->loadViews("approvalstorerequisitionslip", $this->global, $data, NULL);
} else {
$this->loadViews("access", $this->global, $data, NULL);
}
}
/*Approve Completed*/
function ApproveRequest()
{
$Status = Trim($_GET['Status']);
//$StoreReqNo=$this->request->getPost('StoreReqNo');
$StoreReqNo = trim($this->request->getPost('id'));
$Remarks = trim($this->request->getPost('newcomments'));
$ApprovedBy = $this->session->get('userId');
$ApprovedDate = get_current_date_time();
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
echo "Successfully Updated the Requistion No: " . $StoreReqNo;
}
/**
* This function used to load the first screen of the Requistion List Approval Screen
*/
function requisitionlistApproval()
{
$this->global['pageTitle'] = 'Approvalstorerequisitionlist';
//$data['Status']= $this->storerequistion_model->getStatus();
$userID = $this->session->get('userId');
$data['AppList'] = $this->storerequistion_model->getApproverRequistList($userID);
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/* To Edit the view store request*/
function ViewRequest()
{
$StoreReqNo = $this->request->getPost('id');
$result = $this->storerequistion_model->getRequistItemListApproval($StoreReqNo);
$ReqList = $this->storerequistion_model->getRequistDetails($StoreReqNo);
// $DepNo = $ReqList[0]['DepartmentName'];
$HTML = "";
for ($i = 0; $i < count($result); $i++) {
$SNo = $i + 1;
$MaterialCode = $result[$i]['MaterialCode'];
$MaterialName = $result[$i]['MaterialName'];
$UOM = $result[$i]['UOM'];
$Quantity = $result[$i]['QuantityRequired'];
$IssuedQty = $result[$i]['QuantityIssued'];
$Status = $result[$i]['StatusName'];
$Remarks = $result[$i]['Remarks'];
$HTML .= "<tr id='" . $i . "'>
<td align='left'>" . $SNo . "</td>
<td align='left'>" . $MaterialCode . "</td>
<td align='left'>" . $MaterialName . "</td>
<td align='left'>" . $UOM . "</td>
<td align='left'>" . $Quantity . "</td>
<td align='left'>" . $IssuedQty . "</td>
<td align='left'>" . $Status . "</td>
<td align='left'>" . $Remarks . "</td>
</tr>";
//$index = $index + 1;
}
//print_r($ReqList);
die(json_encode(array('Items' => $HTML, 'Requist' => $ReqList)));
}
//not completed
function UpdateStoreRequistion()
{
$CostCenter = $this->request->getPost('CostCenter');
$DeletedRow = $this->request->getPost('txtDeletedRow');
$RowCount = $this->request->getPost('txtRowCount');
$Status = $this->request->getPost('txtStatus');
$Requestedby = $this->session->get('EmpID');
$comma_separated = explode(':', $DeletedRow);
$StoreReqNo = $this->request->getPost('txtReqNo');
$Requestedby = $this->request->getPost('RequestedBy');
//echo $CostCenter;
$UpdatedBy = $this->session->get('userId');
$updatedDate = get_current_date_time();
if (strlen($Status) > 1) {
$Request = array('CostCenterCode' => $CostCenter, 'Status' => $Status, 'updatedOn' => $updatedDate);
$UpdateReq = $this->storerequistion_model->UpdateRequistion($StoreReqNo, $Request);
}
$SkipInsert = False;
$StoreItemStatus = STORE_OPEN;
for ($i = 1; $i <= $RowCount; $i++) {
$SkipInsert = "False";
if (count($comma_separated) > 0) {
for ($j = 1; $j < count($comma_separated); $j++) {
$deletedRow = $comma_separated[$j];
if ($deletedRow == $i) {
$SkipInsert = "True";
break;
}
}
}
if ($SkipInsert == "False") {
//echo "string"; die();
$MaterialCode = $this->request->getPost('MaterialCode' . $i);
$QuantityRequired = $this->request->getPost('Quantity' . $i);
$Remarks = $this->request->getPost('Remarks' . $i);
$IsExists = $this->storerequistion_model->LineItemIsExists($StoreReqNo, $MaterialCode);
if (count($IsExists) == 0) {
$ReqDetails = array('StoreReqNo' => $StoreReqNo, 'MaterialCode' => $MaterialCode, 'QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'Status' => $StoreItemStatus, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDate);
//print_r($ReqDetails);
//die();
$this->storerequistion_model->addstoreRequistion($ReqDetails);
} else {
$ReqDetails = array('QuantityRequired' => $QuantityRequired, 'Remarks' => $Remarks, 'Status' => $StoreItemStatus, 'UpdatedBy' => $UpdatedBy, 'UpdatedOn' => $updatedDate);
$this->storerequistion_model->UpdateRequistionLineItem($ReqDetails, $StoreReqNo, $MaterialCode);
}
}
}
echo 'Successfully updated the Requistion details';
}
/**
* This function used to load the Delete the Requistion Items
*/
function DeleteRequistionForm()
{
$ReqList = $this->request->getPost('id');
$StoreReqNo = '';
$MaterialCode = '';
if (count($ReqList) > 0) {
$StoreReqNo = $ReqList[0];
$MaterialCode = $ReqList[1];
}
$this->storerequistion_model->DeleteRequistionLineItem($StoreReqNo, $MaterialCode);
echo "Successfully Deleted the Line item" . $StoreReqNo;
}
}

View File

@ -0,0 +1,178 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Assetdetails_model;
use App\Models\Batchcard_model;
use App\Models\Cashbook_model;
use App\Models\Companydetails_model;
use App\Models\Config_model;
use App\Models\Costcenter_model;
use App\Models\Dashboard_Model;
use App\Models\Department_model;
use App\Models\Employeedetails_model;
use App\Models\Emppaydate_model;
use App\Models\Inwardgateregister_model;
use App\Models\Login_model;
use App\Models\Monthlypay_model;
use App\Models\Mrir_model;
use App\Models\Payroll_model;
use App\Models\Purchaseorder_model;
use App\Models\Quality_model;
use App\Models\Rawmaterialdetails_model;
use App\Models\Requistion_model;
use App\Models\Store_model;
use App\Models\Storerequistion_model;
use App\Models\Supplier_model;
use App\Models\User_model;
use App\Models\Zohobook_api_model;
/**
* Module - Store
* Storestatus Class to control all Storestatus related operations.
* @author : Saravana kumar
* @version : 1.1
* @since : 4 July 2017
* @example : Revised at 15th april 2024
*/
class Storestatus extends BaseController
{
protected $supplier_model;
protected $store_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$store_model = new Store_model();
$this->session = session();
// $this->supplier_model = new Supplier_model();
helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$this->global['pageTitle'] = 'Store Status';
$this->loadViews("storestatus", $this->global, NULL, NULL);
}
/**
* This function is used to load the Supplier list
*/
function storeavailability()
{
//$data['userRecords'] = $this->supplier_model->supplierlisting();
$this->global['pageTitle'] = 'Store Status';
//viewStock
$data['Stock'] = $this->store_model->viewStock();
// print_r($data['Stock']);
$data['MaterialList'] = $this->store_model->GetAllMaterialList();
$data['StockStatus'] = $this->store_model->GetConfigValue('C021');
$this->loadViews("storestatus", $this->global, $data, null);
}
/**
* This function is used to load the Supplier list
*/
function AddStock()
{
$MaterialCode = $this->request->getPost('MaterialCode');
$AvailableQty = $this->request->getPost('AddAvailableStock');
$AvailbilityStatus = $this->request->getPost('StockAvail');
$Remarks = $this->request->getPost('Remarks');
$CreatedBy = $this->session->get('EmpID');
$createddt = get_current_date_time();
$Status = 1;
if (trim($AvailbilityStatus) == 'YES') {
$Status = 0;
}
//this array to store the value in master table..
$Stockdetails = array('MaterialCode' => $MaterialCode, 'Quantity' => $AvailableQty, 'Status' => $Status, 'Remarks' => $Remarks, 'CreatedBy' => $CreatedBy, 'Createdon' => $createddt);
$data['Stock'] = $this->store_model->addStock($Stockdetails);
echo 'Stock Added successfully';
}
function UpdateStock()
{
$MaterialCode = $this->request->getPost('EditMaterialCode');
$AvailableQty = $this->request->getPost('EditAvailableStock');
$AvailbilityStatus = $this->request->getPost('EditStockAvail');
$Remarks = $this->request->getPost('EditRemarks');
$CreatedBy = $this->session->get('EmpID');
$createddt = get_current_date_time();
$Status = 1;
if (trim($AvailbilityStatus) == 'YES') {
$Status = 0;
}
//this array to store the value in master table..
$Stockdetails = array('Quantity' => $AvailableQty, 'Status' => $Status, 'Remarks' => $Remarks, 'UpdatedBy' => $CreatedBy, 'updatedOn' => $createddt);
$data['Stock'] = $this->store_model->UpdateStock($Stockdetails, $MaterialCode);
echo 'Stock updated successfully';
}
function viewStockHistory()
{
$MaterialCode = $this->request->getPost('id');
$result = $this->store_model->GetStockHisory($MaterialCode);
$TotalStock = 0;
$HTML = "";
for ($i = 0; $i < count($result); $i++) {
$SNo = $i + 1;
$AvailableQty = $result[$i]['Quantity'];
$UpdatedStock = $result[$i]['ActualQuantity'];
$Remarks = $result[$i]['Remarks'];
$Updatedon = new DateTime($result[$i]['updatedOn']);
$HTML .= "<tr id='" . $i . "'>
<td align='left'>" . $SNo . "</td>
<td align='left'>" . $AvailableQty . "</td>
<td align='left'>" . $UpdatedStock . "</td>
<td align='left'>" . $Updatedon->format('d-m-Y') . "</td>
<td align='left'>" . $Remarks . "</td>
</tr>";
$TotalStock = $TotalStock + $UpdatedStock;
//$index = $index + 1;
}
//print_r($HTML);
//echo $AvilBudAmt;
die(json_encode(array('History' => $HTML, 'AvalStock' => $TotalStock)));
}
}

View File

@ -0,0 +1,327 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Assetdetails_model;
use App\Models\Batchcard_model;
use App\Models\Cashbook_model;
use App\Models\Companydetails_model;
use App\Models\Config_model;
use App\Models\Costcenter_model;
use App\Models\Dashboard_Model;
use App\Models\Department_model;
use App\Models\Employeedetails_model;
use App\Models\Emppaydate_model;
use App\Models\Inwardgateregister_model;
use App\Models\Login_model;
use App\Models\Monthlypay_model;
use App\Models\Mrir_model;
use App\Models\Payroll_model;
use App\Models\Purchaseorder_model;
use App\Models\Quality_model;
use App\Models\Rawmaterialdetails_model;
use App\Models\Requistion_model;
use App\Models\Store_model;
use App\Models\Storerequistion_model;
use App\Models\Supplier_model;
use App\Models\User_model;
use App\Models\Zohobook_api_model;
/**
* Module : Supplier
* Supplier Class to control all supplier related operations.
* @author : Gandhimathi
* @version : 1.1
* @since : 12 Apr 2017
* @example : Revised at 15th april 2024
*/
class Supplier extends BaseController
{
protected $supplier_model;
protected $session;
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->supplier_model = new Supplier_model();
$this->session = session();
helper('form'); //$this->load->library('form_validation');
// $this->load->library('pagination');
// $this->load->library('Excel');
$this->isLoggedIn();
}
/**
* This function is used to load the Supplier list
*/
public function index()
{
$data['userRecords'] = $this->supplier_model->supplierlisting();
$this->global['pageTitle'] = 'Supplier Listing';
$this->loadViews("supplierListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new supplier */
function addsupplier()
{
$data['validation'] = session()->getFlashdata('validation_errors');
//$data['payment'] = $this->supplier_model->getpayment();
$data['payment'] = $this->supplier_model->getPaymentTerms();
//$data['users'] = $this->purchaseorder_model->getusers();
$this->global['pageTitle'] = 'Add New Supplier';
$this->loadViews("addSupplier", $this->global, $data, NULL);
}
/**
* This function is used to check whether PAN already exist or not
*/
function CheckPAN()
{
$id = $this->request->getPost('id');
$query = $this->supplier_model->checkPAN($id);
$response = ($query !== null && !empty($query)) ? $query[0]['PAN'] : null;
return $this->response->setJSON($response);
}
/* To Check the Pan Number is exists in the database or not */
public function checkPanValidate($PanNo)
{
$query = $this->supplier_model->checkPAN($PanNo);
if (count($query) > 0) {
return 'The Entered PAN Number is already exists in the Database.';
} else {
return true;
}
}
public function checkGST()
{
$id = $this->request->getPost('id');
$query = $this->supplier_model->checkGST($id);
$response = ($query !== null && !empty($query)) ? $query[0]['GSTNO'] : null;
return $this->response->setJSON($response);
}
/* To Check the GST Number is exists in the database or not */
public function checkGstValidate($GstNo)
{
$query = $this->supplier_model->checkGST($GstNo);
if (count($query) > 0) {
// $this->validator->setMessage('checkGstValidate', 'The Entered GST Number is already exists in the Database.');
// echo "<script>alert('The Entered GST Number is already exists in the Database.');</script>";
// return false;
return 'The Entered GST Number already exists in the Database.';
} else {
return true;
}
}
/**
* This function is used to add new Supplier to the system
*/
function savesupplierdetails()
{
$PAN = $this->request->getPost('panno');
$GSTNo = $this->request->getPost('GSTNo');
$validation = \Config\Services::validation();
$rules = [
'SupplierName' => [
'label' => 'Supplier Name',
'rules' => 'trim|required'
],
'Address' => [
'label' => 'Address',
'rules' => 'trim|required'
],
'ContactNumber' => [
'label' => 'Contact Number',
'rules' => 'trim|required|max_length[13]'
],
'AlternateContactNumber' => [
'label' => 'Alternate Contact Number',
'rules' => 'trim|max_length[13]'
],
'emailid' => [
'label' => 'Email',
'rules' => 'valid_email|max_length[128]|required'
]
];
// $rules['panno'] = ($PAN=='') ? ['label' => 'panno','rules' => 'trim|max_length[10]']
// : ['label' => 'panno','rules' => 'trim|max_length[10]|checkPanValidate['.$PAN.']'];
// $rules['GSTNo'] = ($GSTNo=='') ? ['label' => 'GSTNo','rules' => 'trim|max_length[15]']
// : ['label' => 'GSTNo', 'rules' => 'trim|max_length[15]|checkGstValidate[' . $GSTNo . ']'];
$messages = [
'SupplierName' => [
'required' => 'Please enter a supplier name.'
],
'Address' => [
'required' => 'Please enter an address.'
],
'ContactNumber' => [
'required' => 'Please enter a contact number.',
'max_length' => 'The contact number cannot exceed {param} characters.'
],
'AlternateContactNumber' => [
'max_length' => 'The alternate contact number cannot exceed {param} characters.'
],
'emailid' => [
'required' => 'Please enter an email address.',
'valid_email' => 'Please enter a valid email address.',
'max_length' => 'The email address cannot exceed {param} characters.'
]
// 'panno' => [
// 'required' => 'Please enter an panno address.',
// 'max_length' => 'The panno cannot exceed {param} characters.'
// ]
];
$validation->setRules($rules, $messages);
if (!$validation->withRequest($this->request)->run()) {
// $data['validation'] = $validation->getErrors();
session()->setFlashdata('validation_errors', $validation->getErrors());
return redirect()->route('addsupplier');
} else {
$SupplierName = $this->request->getPost('SupplierName');
$Address = $this->request->getPost('Address');
$ContactNumber = $this->request->getPost('ContactNumber');
$AlternateContactNumber = $this->request->getPost('AlternateContactNumber');
$EmailAddress = $this->request->getPost('emailid');
$PAN = (is_string($PAN)) ? strtoupper($PAN) : null ;
$GSTNo = (is_string($GSTNo)) ? strtoupper($GSTNo) : null ;
$MSMENo = $this->request->getPost('MSMENo');
$accno = $this->request->getPost('accno');
$ifsc = $this->request->getPost('ifsc');
$branchname = $this->request->getPost('branchname');
$bankaddress = $this->request->getPost('bankaddress');
$Createdby = $this->session->get('userId');
$service = $this->request->getPost('service');
$rawmaterial = $this->request->getPost('rawmaterial');
$maintenance = $this->request->getPost('maintanance');
$PaymentId = $this->request->getPost('paymentid');
$supplier = array('SupplierName' => $SupplierName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'PAN' => $PAN, 'GSTNo' => $GSTNo, 'PaymentID' => $PaymentId, 'Cert_MSME' => $MSMENo, 'BankAcNumber' => $accno, 'IFSCCode' => $ifsc, 'BranchName' => $branchname, 'BankAddress' => $bankaddress, 'Createdby' => $Createdby, 'IsService' => $service, 'IsMaintanance' => $maintenance, 'IsRawMaterial' => $rawmaterial); //,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT);
$result = $this->supplier_model->addNewsupplier($supplier);
if ($result > 0) {
$this->session->setFlashdata('success', 'New Supplier Created successfully!');
// echo '<script>alert("New Supplier Created successfully!");</script>';
} else {
$this->session->setFlashdata('error', 'Supplier Record Not Created!');
// echo '<script>alert("Supplier Record Not Created!");</script>';
}
return redirect()->route('supplierlisting');
}
}
/**
* This function is used to edit the Supplier information
*/
public function updatesupplierdetails()
{
$SupplierID = $this->request->getPost('SupplierID');
$SupplierName = $this->request->getPost('SupplierName');
$Address = $this->request->getPost('Address');
$ContactNumber = $this->request->getPost('ContactNumber');
$AlternateContactNumber = $this->request->getPost('AlternateContactNumber');
$EmailAddress = $this->request->getPost('emailid');$PAN = $this->request->getPost('panno');
$PAN = (is_string($PAN)) ? strtoupper($PAN) : null ;
$GSTNo = $this->request->getPost('GSTNo');
$GSTNo = (is_string($GSTNo)) ? strtoupper($GSTNo) : null ;
$MSMENo = $this->request->getPost('MSMENo');
$PaymentTerms = $this->request->getPost('paymentname');
//print_r($PaymentTerms);
$UpdatedBy = $this->session->get('userId');
$chked = $this->request->getPost('isactive');
$IsActive = ($chked != '') ? '1' : '0';
$accno = $this->request->getPost('accno');
$ifsc = $this->request->getPost('ifsc');
$branchname = $this->request->getPost('branchname');
$bankaddress = $this->request->getPost('bankaddress');
$service = $this->request->getPost('service');
$rawmaterial = $this->request->getPost('rawmaterial');
$maintanance = $this->request->getPost('maintanance');
$PaymentId = $this->request->getPost('paymentid');
$supplier = array();
$supplier = array('SupplierName' => $SupplierName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'PaymentID' => $PaymentId, 'Cert_MSME' => $MSMENo, 'BankAcNumber' => $accno, 'IFSCCode' => $ifsc, 'BranchName' => $branchname, 'BankAddress' => $bankaddress, 'UpdatedBy' => $UpdatedBy, 'IsActive' => $IsActive, 'IsService' => $service, 'IsMaintanance' => $maintanance, 'IsRawMaterial' => $rawmaterial); //'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment);
//SupplierID, SupplierName, Address, ContactNumber, AlternateContactNumber, EmailAddress, Exiseregistration, TIN, PAN, CSTNO, CSTDate, GSTNO, GSTRange, CollectrateAddress, UANumber, PaymentTerms, PaymentDays, PayableAT, Cert_EMS, Cert_TS, Cert_IMS, Cert_ISO, Cert_OSHAS, BankAcNumber, IFSCCode, BranchName, BankAddress, Createdby, UpdatedBy, Updatedon, CreatedOn, IsActive);
$result = $this->supplier_model->UpdateSupplier($supplier, $SupplierID);
if ($result == True) {
$this->session->setFlashdata('success', 'Supplier Updated successfully!');
// echo "<script>alert('Supplier updated successfully!');</script>";
} else {
$this->session->setFlashdata('error', 'Supplier Not Udated!');
// echo "<script>alert('Supplier Record Not updated!');</script>";
}
return redirect()->route('supplierlisting');
}
function viewsupplier($SID = ''){
$Payment = '';
if ($SID == '') {
$supplierID = $_GET['SID'];
$Payment = $_GET['Payment'];
} else {
$supplierID = $SID;
}
$data['supplier'] = $this->supplier_model->getSupplierInfo($supplierID);
//$data['payment'] = $this->supplier_model->getpayment($Payment );
$data['payment'] = $this->supplier_model->getPaymentTerms($Payment);
$this->global['pageTitle'] = 'Edit Supplier';
$this->loadViews("editSupplier", $this->global, $data, NULL);
}
function checksupplier()
{
$supp_name = $this->request->getPost('id');
$query = $this->supplier_model->checkSupplierExists($supp_name);
return $this->response->setJSON($query);
}
}

1578
app/Controllers/User.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
<?php
if (!function_exists('pre')) {
function pre($data)
{
echo "<pre>";
print_r($data);
echo "</pre>";
}
}
if (!function_exists('getHashedPassword')) {
function getHashedPassword($plainPassword)
{
return password_hash($plainPassword, PASSWORD_DEFAULT);
}
}
if (!function_exists('verifyHashedPassword')) {
function verifyHashedPassword($plainPassword, $hashedPassword)
{
return password_verify($plainPassword, $hashedPassword) ? true : false;
}
}
if (!function_exists('get_fav')) {
function get_fav($user)
{
$db = db_connect();
$user = (int)$user;
$query = $db->table('t_fav_add')->where('Created_BY', $user)->where('Status', 1)->get();
return $query->getResult();
}
}
if (!function_exists('reOrderListing')) {
function reOrderListing()
{
$db = db_connect();
$subQuery = 'SELECT * FROM t_materialmaster WHERE Current_stock < reorder?';
$query = $db->query($subQuery);
return $query->getResult();
}
}
if (!function_exists('generateCopyrightNotice')) {
function generateCopyrightNotice()
{
$current_year = date('Y');
if ($current_year > 2024) {
return " Copyright &copy; 2024 - $current_year ";
} else {
return " Copyright &copy; $current_year ";
}
}
}

View File

@ -0,0 +1,156 @@
<?php
if (!function_exists('get_current_date_time')) {
function get_current_date_time()
{
$datetime = new \DateTime('now');
return $datetime->format('Y-m-d H:i:s');
}
}
// if (!function_exists('get_current_date')) {
// function get_current_date()
// {
// return date("Y-m-d");
// }
// }
if (!function_exists('get_current_date')) {
function get_current_date($format = null)
{
$format = $format ?: "Y-m-d";
return date($format);
}
}
if (!function_exists('get_date_time_format')) {
function get_date_time_format($val)
{
$date = new \DateTime($val, new \DateTimeZone('Asia/Kolkata'));
return $date->format('Y-m-d H:i:s');
}
}
if (!function_exists('get_date_format')) {
function get_date_format($DateValue)
{
$date = \DateTime::createFromFormat('d/m/Y', $DateValue);
if ($date === false) {
return false;
}
$retDate = $date->format('Y-m-d');
return $retDate;
}
}
// if (!function_exists('format_date')) {
// function format_date($dateString)
// {
// return date('Y-m-d', strtotime($dateString));
// }
// }
// if (!function_exists('format_date')) {
// function format_date($dateString, $days = 0)
// {
// $date = strtotime($dateString);
// // Subtract the specified number of days from the current date if $days is provided
// if ($days != 0) {
// $date = strtotime("-$days day", $date);
// }
// return date('Y-m-d', $date);
// }
// }
if (!function_exists('format_date')) {
function format_date($dateString, $days = 0,$format = 'Y-m-d')
{
// Check if the input is already a Unix timestamp
if (is_numeric($dateString) && (string) (int) $dateString === $dateString) {
$date = strtotime($dateString);
} else {
// Use date_create() to create a DateTime object
$date = date_create($dateString);
}
// If $date is false, meaning parsing failed, return null
if (!$date) {
return null;
}
// Subtract the specified number of days from the date if $days is provided
if ($days != 0) {
// If $date is a Unix timestamp, modify it using strtotime()
if (is_numeric($dateString) && (string) (int) $dateString === $dateString) {
$date = strtotime("-$days day", $date);
} else {
// If $date is a DateTime object, modify it using DateTime::modify()
date_modify($date, "-$days day");
}
}
// If $date is a Unix timestamp, format it using date()
if (is_numeric($dateString) && (string) (int) $dateString === $dateString) {
return date($format, $date);
} else {
// If $date is a DateTime object, format it using DateTime::format()
return date_format($date, $format);
}
}
}
if (!function_exists('get_financial_year')) {
function get_financial_year($date = null)
{
// If no date is provided, use the current date
$date = $date ?: date('Y-m-d');
// Extract the year from the date
$year = date('Y', strtotime($date));
// Determine the financial year based on your business logic
// Adjust this logic according to your organization's financial year cycle
if (date('n', strtotime($date)) < 4) {
// If the month is before April, use the previous year
$financialYear = ($year - 1) . '-' . $year;
} else {
// If the month is April or later, use the current year
$financialYear = $year . '-' . ($year + 1);
}
return $financialYear;
}
}
if (!function_exists('generate_pos_number')) {
function generate_pos_number($last_pono)
{
$currentYear = date("Y");
$finYear = get_financial_year(); // Get it From DateTime Helper
// if(here have to check fin year if there is a change means both are same means ){
// $counter = $counter + 1;
// }else{
// $counter = 1;
// }
$result = explode('/', $last_pono);
$requestedFinYear = $result[1];
$leftPad = $result[0];
$digit = 5;
if($requestedFinYear == $finYear){
$number = ((int)$result[2])+1;
$PoNo = $leftPad . '/' . $finYear . '/' . $number;
}else{
$counter = 1;
$PoNo = $leftPad . '/' . $finYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT);
}
return $PoNo;
}
}

View File

@ -0,0 +1,31 @@
<?php
if (!function_exists('generate_po_number')) {
function generate_po_number($last_pono)
{
$currentYear = date("Y");
$finYear = get_financial_year(); // Get it From DateTime Helper
// if(here have to check fin year if there is a change means both are same means ){
// $counter = $counter + 1;
// }else{
// $counter = 1;
// }
$result = explode('/', $last_pono);
$requestedFinYear = $result[1];
$leftPad = $result[0];
$digit = 5;
if($requestedFinYear == $finYear){
$number = ((int)$result[2])+1;
$PoNo = $leftPad . '/' . $finYear . '/' . str_pad($number, $digit, '0', STR_PAD_LEFT);
}else{
$counter = 1;
$PoNo = $leftPad . '/' . $finYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT);
}
return $PoNo;
}
}
?>

View File

@ -0,0 +1,118 @@
<?php
if (!function_exists('is_session_active')) {
function is_session_active()
{
$session = \Config\Services::session();
// echo "i am in helper ...".$session->get('user_id');die();
return $session->get('user_id');
}
}
if (!function_exists('get_logged_user_id')) {
function get_logged_user_id()
{
$session = \Config\Services::session();
return $session->get('user_id');
}
}
if (!function_exists('set_logged_user_id')) {
function set_logged_user_id($userId)
{
$session = \Config\Services::session();
$session->set('user_id', $userId);
}
}
if (!function_exists('unset_logged_user')) {
function unset_logged_user()
{
$session = \Config\Services::session();
$session->remove('user_id');
}
}
if (!function_exists('get_logged_name')) {
function get_logged_name()
{
$session = \Config\Services::session();
return $session->get('user_name');
}
}
if (!function_exists('set_logged_name')) {
function set_logged_name($userName)
{
$session = \Config\Services::session();
$session->set('user_name', $userName);
}
}
if (!function_exists('set_user_role')) {
function set_user_role($userRole)
{
$session = \Config\Services::session();
$session->set('user_role', $userRole);
}
}
if (!function_exists('get_user_role')) {
function get_user_role()
{
$session = \Config\Services::session();
return $session->get('user_role');
}
}
if (!function_exists('set_business_id')) {
function set_business_id($businessId)
{
$session = \Config\Services::session();
$session->set('business_id', $businessId);
}
}
if (!function_exists('get_business_id')) {
function get_business_id()
{
$session = \Config\Services::session();
return $session->get('business_id');
}
}
if (!function_exists('is_session_destroy')) {
function is_session_destroy()
{
$session = \Config\Services::session();
$session->destroy();
}
}
if (!function_exists('set_session_locked')) {
function set_session_locked()
{
$session = \Config\Services::session();
$session->set('session_locked', true);
}
}
if (!function_exists('get_session_locked')) {
function get_session_locked()
{
$session = \Config\Services::session();
return $session->get('session_locked');
}
}
if (!function_exists('remove_session_locked')) {
function remove_session_locked()
{
$session = \Config\Services::session();
$session->remove('session_locked');
}
}
?>

110
app/Helpers/zoho_helper.php Normal file
View File

@ -0,0 +1,110 @@
<?php
// Define namespace
namespace App\Helpers;
// Import required libraries
use Config\Services;
if (! function_exists('generateNewToken')) {
function generateNewToken()
{
// Initialize cURL
$ch = curl_init();
// Zoho API credentials
$organization_id = '776847408';
$client_id = '1000.0WMDLCXAZV5DR60IKE9P49YTYGVL6C';
$refresh_token = '1000.0fcf314cc7b7b598df6e519461bbe9b8.f77688a2254137532ae33ad5e152a064';
$client_secret = '99da3a05cfa13cf91eb6476a3c44cfa3e21b6106a8';
$redirect_uri = 'https://resicoindustries.com/RIA/';
$accesstoken = '1000.095b66fc95fc81874c1cfc7d15b0904e.10bc9956d9b9ec14cce1350ee0cf8254';
// Construct URL to get the authentication token
$url_getauthtoken = 'https://accounts.zoho.com/oauth/v2/token?refresh_token='.$refresh_token.'&client_id='.$client_id.'&client_secret='.$client_secret.'&redirect_uri='.$redirect_uri.'&grant_type=refresh_token';
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url_getauthtoken);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL request
$res_token = curl_exec($ch);
// Decode the response
$ress = json_decode($res_token);
// Return access token
return $ress->access_token;
}
}
if (! function_exists('getheringInvoiceDetails')) {
function getheringInvoiceDetails($date_today, $date_yesterday, $accesstoken)
{
// Initialize cURL
$ch = curl_init();
// Zoho API credentials
$organization_id = '776847408';
$url_org = "https://books.zoho.com/api/v3/invoices?";
// Construct query parameters
$fields = array(
"usestate" => "true",
"organization_id" => $organization_id,
"date_start" => $date_yesterday,
"date_end" => $date_today
);
$data_all = http_build_query($fields);
// Set headers
$headers = array(
'Authorization: Zoho-oauthtoken '.$accesstoken,
'Content-Type: application/json'
);
// Construct URL
$data_access = $url_org.$data_all;
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url_org.$data_access);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL request
$result = curl_exec($ch);
// Store headers and data
$data['headers_new'] = $headers;
$data['data'] = curl_exec($ch);
// Return data
return $data;
}
}
if (! function_exists('getheringInvoiceSubDetails')) {
function getheringInvoiceSubDetails($invoice_id, $organization_id, $headers)
{
// Initialize cURL
$ch = curl_init();
// Construct URL for invoice sub-details
$url2 = 'https://books.zoho.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL request and return response
return curl_exec($ch);
}
}
?>

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

View File

@ -0,0 +1,269 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class Assetdetails_model extends Model
{
/**
* This function is used to get the user listing count
* @param string $searchText : This is optional search text
* @param number $page : This is pagination offset
* @param number $segment : This is pagination limit
* @return array $result : This is result
*/
function assetListing()
{
$builder = $this->db->table('T_Asset_Details asd')
->select('asd.*,dep.DepartmentName,sup.SupplierName')
->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode', 'left')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = asd.SupplierCode', 'left');
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function getDepartment($Department = '')
{
$builder = $this->db->table('T_DepartmentDetails')
->select('DEPCode,DepartmentName')
->where('IsActive', 1);
if ($Department != '') {
$builder->where('DEPCode !=', $Department);
}
$query = $builder->get();
return $query->getResult();
}
function getSupplierName($SupplierID = '')
{
$builder = $this->db->table('T_SupplierDetailsN')
->select('SupplierID, SupplierName')
->where('IsActive', 1);
if ($SupplierID != '') {
$builder->where('SupplierID !=', $SupplierID);
}
$query = $builder->get();
return $query->getResult();
}
function getpodetails($PO)
{
$builder = $this->db->table('T_PurchaseOrder_Master POM')
->distinct()
->select('POM.PONO,POM.SupplierID,POL.MaterialCode,DeliveryDate,PODate,sup.SupplierName,POL.LineItemNo')
->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID')
->where('POM.status', MRIR_APPROVED);
if (!empty($PO)) {
$builder->where('POM.PONO', $PO);
}
$query = $builder->get();
return $query->getResult();
}
function getPO($PO = '')
{
$builder = $this->db->table('T_PurchaseOrder_Master POM')
->distinct()
->select(' POM.PONO'); //,DeliveryDate,PODate,sup.SupplierName,POM.SupplierID');
//->join ('T_PurchaseOrder_LineItem POL ',' POL.PONO = POM.PONO');
//->join ('T_SupplierDetailsN sup ',' sup.SupplierID = POM.SupplierID');
$builder->where('POM.status', MRIR_APPROVED);
if (!empty($PO)) {
$builder->where('POM.PONO', $PO);
}
$query = $builder->get();
return $query->getResult();
}
function getlineitemre($line)
{
$builder = $this->db->table('T_PurchaseOrder_LineItem POL')
->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID')
->join('T_Requestion_Master req', 'req.ReqNo = POL.ReqNo', 'left')
->join('T_PurchaseOrder_Master POM', 'POM.PONO=POL.PONO', 'left')
->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode', 'left')
->join('T_Employee_Details emp', 'emp.EmpID = req.Requestedby', 'left')
->join('T_DepartmentDetails dep', 'dep.DEPCode = emp.Departmentcode', 'left')
->join('T_Revenue_Tax re', 're.LineItemNo = POL.LineItemNo', 'left')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID', 'left')
->where('POL.LineItemNo', $line);
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function getlineitemser($line)
{
$builder = $this->db->table('T_PurchaseOrder_LineItem POL')
->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID')
->join('T_Requestion_Master req', 'req.ReqNo = POL.ReqNo', 'left')
->join('T_PurchaseOrder_Master POM', 'POM.PONO=POL.PONO', 'left')
->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode', 'left')
->join('T_Employee_Details emp', 'emp.EmpID = req.Requestedby', 'left')
->join('T_DepartmentDetails dep', 'dep.DEPCode = emp.Departmentcode', 'left')
->join('T_Service_Tax ser', 'ser.LineItemNo = POL.LineItemNo', 'left')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID', 'left')
->where('POL.LineItemNo', $line);
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function getlineitemimport($line)
{
$builder = $this->db->table('T_PurchaseOrder_LineItem POL')
->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID')
->join('T_Requestion_Master req', 'req.ReqNo = POL.ReqNo', 'left')
->join('T_PurchaseOrder_Master POM', 'POM.PONO=POL.PONO', 'left')
->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode', 'left')
->join('T_Employee_Details emp', 'emp.EmpID = req.Requestedby', 'left')
->join('T_DepartmentDetails dep', 'dep.DEPCode = emp.Departmentcode', 'left')
->join('T_Import_Tax ser', 'ser.LineItemNo = POL.LineItemNo', 'left')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID', 'left')
->where('POL.LineItemNo', $line);
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function getlineitemcap($line)
{
$builder = $this->db->table('T_PurchaseOrder_LineItem POL')
->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(ser.TotalValue+imp.TotalValue) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID')
->join('T_Requestion_Master req', 'req.ReqNo = POL.ReqNo', 'left')
->join('T_PurchaseOrder_Master POM', 'POM.PONO=POL.PONO', 'left')
->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode', 'left')
->join('T_Employee_Details emp', 'emp.EmpID = req.Requestedby', 'left')
->join('T_DepartmentDetails dep', 'dep.DEPCode = emp.Departmentcode', 'left')
->join('T_Import_Tax imp', 'imp.LineItemNo = POL.LineItemNo', 'left')
->join('T_Service_Tax ser', 'ser.LineItemNo = POL.LineItemNo', 'left')
->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID', 'left')
->where('POL.LineItemNo', $line);
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function gettyp($type)
{
$builder = $this->db->table('T_PurchaseOrder_LineItem POL')
->select('POM.POType,POL.LineItemNo')
->join('T_PurchaseOrder_Master POM', 'POM.PONO=POL.PONO')
->where('POL.LineItemNo', $type);
$query = $builder->get();
$result = $query->getResult();
return $result;
}
/**
* This function is used to get the Config value from configuration table
* @return array $result : This is result of the query
*/
function getConfigValue($ConfigID, $ConfigValue = '')
{
$builder = $this->db->table('T_ConfigDetails')
->select('ConfigValue')
->where('Config_id ', $ConfigID);
if ($ConfigValue != '') {
$builder->where('ConfigValue != ', $ConfigValue);
}
$query = $builder->get();
return $query->getResult();
}
/**
* This function used to get user information by id
* @param number $userId : This is user id
* @return array $result : This is user information
*/
function addNewasset($asset)
{
$this->db->transBegin();
$this->db->table('T_Asset_Details')->insert($asset);
$affectedRows = $this->db->affectedRows();
if ($this->db->transStatus() === false) {
$this->db->transRollback();
return false;
} else {
$this->db->transCommit();
return $affectedRows;
}
}
/**
* This function used to get Asset details by Asset Code
* @param number $Asset_Code : This is AssetCode
* @return array $result : This is Asset information
*/
function getAssetDetails($Asset_Code)
{
$builder = $this->db->table('T_Asset_Details Asset')
//echo $Asset_Code;
->select('Asset.*,POM.DeliveryDate,Dep.DepartmentName as DepartmentName,MM.MaterialName,MM.UOM,Supp.SupplierName as SupplierName')
->join('T_DepartmentDetails Dep', 'Asset.DEPCode = Dep.DEPCode', 'left')
->join('T_SupplierDetailsN Supp', 'Asset.SupplierCode = Supp.SupplierID', 'left')
->join('T_MaterialMaster MM ', 'MM.MaterialCode = Asset.MaterialCode', 'left')
->join('T_PurchaseOrder_Master POM', 'POM.PONO = Asset.PONO', 'left')
->where('Asset.AssetCode', $Asset_Code);
$query = $builder->get();
return $query->getResult();
}
function editasset($asset, $Asset_Code)
{
$this->db->table('T_Asset_Details')
->where('AssetCode', $Asset_Code)
->update($asset);
$count = $this->db->affectedRows();
return $count;
}
function viewasset($asset, $Asset_Code)
{
$this->db->table('T_Asset_Details')
->where('AssetCode', $Asset_Code)
->update($asset);
$count = $this->db->affectedRows();
return $count;
}
function export_excel()
{
$builder = $this->db->table('T_Asset_Details as det')
->select('det.*,dep.DepartmentName as DEPCode,sup.SupplierName,MM.MaterialName,emp.firstname,emp1.firstname as Updated_By')
->join('tbl_users as tbl', ' det.createdby = tbl.userid', 'left')
->join('T_DepartmentDetails as dep', 'dep.DEPCode=det.DEPCode', 'left')
->join('T_Employee_Details as emp', 'emp.empid=tbl.empid', 'left')
->join('T_SupplierDetailsN as sup', 'sup.SupplierID=det.SupplierCode', 'left')
->join('T_MaterialMaster MM ', 'MM.MaterialCode = det.MaterialCode', 'left')
->join('tbl_users as tbl1', ' det.UpdatedBy = tbl1.userid', 'left')
->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid', 'left');
$query = $builder->get();
return $query->getResult();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class Companydetails_model extends Model
{
/**
* This function is used to get the user listing count
* @param string $searchText : This is optional search text
* @return number $count : This is row count
*/
//inserted data into companydetails table//
function Companyadd($Company)
{
$builder = $this->db->table('T_Company_Details');
$builder->insert($Company);
$res = $this->db->affectedRows();
return $res;
}
//inserted data into file table//
function filedetails($myfile)
{
$builder = $this->db->table('file');
$builder->insert($myfile);
$res = $this->db->affectedRows();
return $res;
}
//for listing file//
function filelist()
{
$sql = " select ID,filename,filedescription,createdDate from file where isDeleted IS NULL OR isDeleted=0";
$query = $this->db->query($sql);
return $query->getResult();
}
//for deleting file//
function deletefile($ID, $userInfo)
{
$this->db->table('file')
->where('ID', $ID)
->update($userInfo);
$res = $this->db->affectedRows();
return $res;
}
function Updatecompany($Comp, $CompID)
{
$this->db->table('T_Company_Details')
->where('CompID', $CompID)
->update($Comp);
$res = $this->db->affectedRows();
return $res;
}
function checkPhotoExists($Pic)
{
$builder = $this->db->table('T_Company_Details')
->select('ProfilePic')
->where($Pic);
$query = $builder->get();
if ($query->getNumRows() > 0) {
return $query->getResultArray();
}
}
// updated by //
function companylisting()
{
$builder = $this->db->table('T_Company_Details com')
->select('com.*,emp.firstname,pmt.PaymentTerms')
->join('T_PaymentTerms pmt', 'com.paymentID = pmt.PaymentID', 'left')
->join('tbl_users as tbl', ' com.createdby = tbl.userid', 'left')
->join('T_Employee_Details as emp', 'emp.empid=tbl.empid', 'left');
$query = $builder->get();
$result = $query->getResult();
return $result;
}
// dropdown for payaple terms @ companydetails//
// function getpayment($Configvalue = '')
// {
// $ConfigID = 'C009';
// ->select('ConfigValue');
// $builder = $this->db->table('T_ConfigDetails');
// $this->db->where('Config_ID ',$ConfigID );
// $query =$builder->get();
// return $query->getResult();
// }
function getPaymentTerms()
{
$builder = $this->db->table('T_PaymentTerms')->select('*');
$query = $builder->get();
$result = $query->getResult();
return $result;
}
// dropdown for file description @ companydetails//
function getfilename($Configvalue = '')
{
$ConfigID = 'C025';
$builder = $this->db->table('T_ConfigDetails')->select('ConfigValue')
->where('Config_ID ', $ConfigID);
$query = $builder->get();
return $query->getResult();
}
// for display the bankdetails//
function getBankDetails()
{
$builder = $this->db->table('T_Bank_Details')->select('*');
$query = $builder->get();
$result = $query->getResult();
return $result;
}
// for add and update the bankdetails//
function BankDetails($Bank)
{
$bankname = $Bank['Bank_name'];
$bankifsc = $Bank['IFSC'];
$count = 0;
$builder = $this->db->table('T_Bank_Details')->select('count(*) as count')
->where('Bank_name', $bankname)
->where('IFSC', $bankifsc);
$isExits = $builder->get();
$res = $isExits->getResultArray();
if (!empty($res)) {
$count = $res[0]['count'];
}
if ($count == 0) {
$builder = $this->db->table('T_Bank_Details');
$builder->insert($Bank);
$res = $this->db->affectedRows();
return $res;
} elseif ($count == 1) {
$this->db->table('T_Bank_Details')
->where('Bank_name', $bankname)
->where('IFSC', $bankifsc)
->update($Bank);
$res = $this->db->affectedRows();
return $res;
}
}
}

Some files were not shown because too many files have changed in this diff Show More