mirror of
https://github.com/jerryhanjj/ERP.git
synced 2024-09-20 07:16:27 +08:00
ERP
This commit is contained in:
parent
4c30bcce53
commit
ebc2d5a089
1123
System.sql
Normal file
1123
System.sql
Normal file
File diff suppressed because one or more lines are too long
1
application/.htaccess
Normal file
1
application/.htaccess
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Deny from all
|
1
application/cache/.htaccess
vendored
Normal file
1
application/cache/.htaccess
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
deny from all
|
10
application/cache/index.html
vendored
Normal file
10
application/cache/index.html
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
116
application/config/autoload.php
Normal file
116
application/config/autoload.php
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| AUTO-LOADER
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file specifies which systems should be loaded by default.
|
||||||
|
|
|
||||||
|
| In order to keep the framework as light-weight as possible only the
|
||||||
|
| absolute minimal resources are loaded by default. For example,
|
||||||
|
| the database is not connected to automatically since no assumption
|
||||||
|
| is made regarding whether you intend to use it. This file lets
|
||||||
|
| you globally define which systems you would like loaded with every
|
||||||
|
| request.
|
||||||
|
|
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Instructions
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These are the things you can load automatically:
|
||||||
|
|
|
||||||
|
| 1. Packages
|
||||||
|
| 2. Libraries
|
||||||
|
| 3. Helper files
|
||||||
|
| 4. Custom config files
|
||||||
|
| 5. Language files
|
||||||
|
| 6. Models
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Packges
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['packages'] = array();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Libraries
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| These are the classes located in the system/libraries folder
|
||||||
|
| or in your application/libraries folder.
|
||||||
|
|
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['libraries'] = array('database','session');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Helper Files
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['helper'] = array('url', 'file');
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['helper'] = array('url' ,'file','fun','cookie','array');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Config files
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['config'] = array('config1', 'config2');
|
||||||
|
|
|
||||||
|
| NOTE: This item is intended for use ONLY if you have created custom
|
||||||
|
| config files. Otherwise, leave it blank.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['config'] = array();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Language files
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['language'] = array('lang1', 'lang2');
|
||||||
|
|
|
||||||
|
| NOTE: Do not include the "_lang" part of your file. For example
|
||||||
|
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['language'] = array();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Auto-load Models
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Prototype:
|
||||||
|
|
|
||||||
|
| $autoload['model'] = array('model1', 'model2');
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$autoload['model'] = array('mysql_model','common_model','data_model');
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file autoload.php */
|
||||||
|
/* Location: ./application/config/autoload.php */
|
405
application/config/config.php
Normal file
405
application/config/config.php
Normal file
|
@ -0,0 +1,405 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Base Site URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| URL to your CodeIgniter root. Typically this will be your base URL,
|
||||||
|
| WITH a trailing slash:
|
||||||
|
|
|
||||||
|
| http://example.com/
|
||||||
|
|
|
||||||
|
| If this is not set then CodeIgniter will guess the protocol, domain and
|
||||||
|
| path to your installation.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['base_url'] = '';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 后台路径
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The best, you will change it to other names.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['admin_folder'] = 'admin';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 模板路径
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The best, you will change it to other names.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['theme_url'] = 'data/themes/';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 数据库备份路径
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The best, you will change it to other names.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['backup_path'] = 'data/backup/';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 初始化数据库路径
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The best, you will change it to other names.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['initial_sql'] = './data/download/initial.sql';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Index File
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Typically this will be your index.php file, unless you've renamed it to
|
||||||
|
| something else. If you are using mod_rewrite to remove the page set this
|
||||||
|
| variable so that it is blank.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['index_page'] = 'index.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| URI PROTOCOL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This item determines which server global should be used to retrieve the
|
||||||
|
| URI string. The default setting of 'AUTO' works for most servers.
|
||||||
|
| If your links do not seem to work, try one of the other delicious flavors:
|
||||||
|
|
|
||||||
|
| 'AUTO' Default - auto detects
|
||||||
|
| 'PATH_INFO' Uses the PATH_INFO
|
||||||
|
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||||
|
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||||
|
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['uri_protocol'] = 'AUTO';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| URL suffix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||||
|
| For more information please see the user guide:
|
||||||
|
|
|
||||||
|
| http://codeigniter.com/user_guide/general/urls.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
$config['url_suffix'] = '';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Language
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This determines which set of language files should be used. Make sure
|
||||||
|
| there is an available translation if you intend to use something other
|
||||||
|
| than english.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['language'] = 'china';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Character Set
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This determines which character set is used by default in various methods
|
||||||
|
| that require a character set to be provided.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['charset'] = 'UTF-8';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enable/Disable System Hooks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you would like to use the 'hooks' feature you must enable it by
|
||||||
|
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['enable_hooks'] = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Class Extension Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This item allows you to set the filename/classname prefix when extending
|
||||||
|
| native libraries. For more information please see the user guide:
|
||||||
|
|
|
||||||
|
| http://codeigniter.com/user_guide/general/core_classes.html
|
||||||
|
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['subclass_prefix'] = 'MY_';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Allowed URL Characters
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This lets you specify with a regular expression which characters are permitted
|
||||||
|
| within your URLs. When someone tries to submit a URL with disallowed
|
||||||
|
| characters they will get a warning message.
|
||||||
|
|
|
||||||
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
|
||||||
|
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
||||||
|
|
|
||||||
|
| Leave blank to allow all characters -- but only if you are insane.
|
||||||
|
|
|
||||||
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enable Query Strings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
|
||||||
|
| example.com/who/what/where/
|
||||||
|
|
|
||||||
|
| By default CodeIgniter enables access to the $_GET array. If for some
|
||||||
|
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
||||||
|
|
|
||||||
|
| You can optionally enable standard query string based URLs:
|
||||||
|
| example.com?who=me&what=something&where=here
|
||||||
|
|
|
||||||
|
| Options are: TRUE or FALSE (boolean)
|
||||||
|
|
|
||||||
|
| The other items let you set the query string 'words' that will
|
||||||
|
| invoke your controllers and its functions:
|
||||||
|
| example.com/index.php?c=controller&m=function
|
||||||
|
|
|
||||||
|
| Please note that some of the helpers won't work as expected when
|
||||||
|
| this feature is enabled, since CodeIgniter is designed primarily to
|
||||||
|
| use segment based URLs.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['allow_get_array'] = TRUE;
|
||||||
|
$config['enable_query_strings'] = FALSE;
|
||||||
|
$config['controller_trigger'] = 'c';
|
||||||
|
$config['function_trigger'] = 'm';
|
||||||
|
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Error Logging Threshold
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you have enabled error logging, you can set an error threshold to
|
||||||
|
| determine what gets logged. Threshold options are:
|
||||||
|
| You can enable error logging by setting a threshold over zero. The
|
||||||
|
| threshold determines what gets logged. Threshold options are:
|
||||||
|
|
|
||||||
|
| 0 = Disables logging, Error logging TURNED OFF
|
||||||
|
| 1 = Error Messages (including PHP errors)
|
||||||
|
| 2 = Debug Messages
|
||||||
|
| 3 = Informational Messages
|
||||||
|
| 4 = All Messages
|
||||||
|
|
|
||||||
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
|
||||||
|
| your log files will fill up very fast.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['log_threshold'] = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Error Logging Directory Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Leave this BLANK unless you would like to set something other than the default
|
||||||
|
| application/logs/ folder. Use a full server path with trailing slash.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['log_path'] = 'data/logs/';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Date Format for Logs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Each item that is logged has an associated date. You can use PHP date
|
||||||
|
| codes to set your own date formatting
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['log_date_format'] = 'Y-m-d H:i:s';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Directory Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Leave this BLANK unless you would like to set something other than the default
|
||||||
|
| system/cache/ folder. Use a full server path with trailing slash.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['cache_path'] = 'data/cache/';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Encryption Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you use the Encryption class or the Session class you
|
||||||
|
| MUST set an encryption key. See the user guide for info.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['encryption_key'] = 'met';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Variables
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| 'sess_cookie_name' = the name you want for the cookie
|
||||||
|
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||||
|
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||||
|
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||||
|
| when the browser window is closed
|
||||||
|
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||||
|
| 'sess_use_database' = Whether to save the session data to a database
|
||||||
|
| 'sess_table_name' = The name of the session database table
|
||||||
|
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||||
|
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data //IE下会失效 改为FALSE正常
|
||||||
|
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['sess_cookie_name'] = 'met_session';
|
||||||
|
$config['sess_expiration'] = 7200;
|
||||||
|
$config['sess_expire_on_close'] = FALSE;
|
||||||
|
$config['sess_encrypt_cookie'] = FALSE;
|
||||||
|
$config['sess_use_database'] = FALSE;
|
||||||
|
$config['sess_table_name'] = 'met_sessions';
|
||||||
|
$config['sess_match_ip'] = FALSE;
|
||||||
|
$config['sess_match_useragent'] = FALSE;
|
||||||
|
$config['sess_time_to_update'] = 300;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cookie Related Variables
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
|
||||||
|
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
|
||||||
|
| 'cookie_path' = Typically will be a forward slash
|
||||||
|
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['cookie_prefix'] = "";
|
||||||
|
$config['cookie_domain'] = "";
|
||||||
|
$config['cookie_path'] = "/";
|
||||||
|
$config['cookie_secure'] = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global XSS Filtering
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Determines whether the XSS filter is always active when GET, POST or
|
||||||
|
| COOKIE data is encountered
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['global_xss_filtering'] = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cross Site Request Forgery
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
|
||||||
|
| checked on a submitted form. If you are accepting user data, it is strongly
|
||||||
|
| recommended CSRF protection be enabled.
|
||||||
|
|
|
||||||
|
| 'csrf_token_name' = The token name
|
||||||
|
| 'csrf_cookie_name' = The cookie name
|
||||||
|
| 'csrf_expire' = The number in seconds the token should expire.
|
||||||
|
*/
|
||||||
|
$config['csrf_protection'] = FALSE;
|
||||||
|
$config['csrf_token_name'] = 'csrf_test_name';
|
||||||
|
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||||
|
$config['csrf_expire'] = 7200;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Output Compression
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Enables Gzip output compression for faster page loads. When enabled,
|
||||||
|
| the output class will test whether your server supports Gzip.
|
||||||
|
| Even if it does, however, not all browsers support compression
|
||||||
|
| so enable only if you are reasonably sure your visitors can handle it.
|
||||||
|
|
|
||||||
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
|
||||||
|
| means you are prematurely outputting something to your browser. It could
|
||||||
|
| even be a line of whitespace at the end of one of your scripts. For
|
||||||
|
| compression to work, nothing can be sent before the output buffer is called
|
||||||
|
| by the output class. Do not 'echo' any values with compression enabled.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['compress_output'] = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Master Time Reference
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Options are 'local' or 'gmt'. This pref tells the system whether to use
|
||||||
|
| your server's local time as the master 'now' reference, or convert it to
|
||||||
|
| GMT. See the 'date helper' page of the user guide for information
|
||||||
|
| regarding date handling.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['time_reference'] = 'local';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Rewrite PHP Short Tags
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If your PHP installation does not have short tag support enabled CI
|
||||||
|
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
|
||||||
|
| in your view files. Options are TRUE or FALSE (boolean)
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['rewrite_short_tags'] = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Reverse Proxy IPs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
|
||||||
|
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
|
||||||
|
| header in order to properly identify the visitor's IP address.
|
||||||
|
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['proxy_ips'] = '';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file config.php */
|
||||||
|
/* Location: ./application/config/config.php */
|
41
application/config/constants.php
Normal file
41
application/config/constants.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| File and Directory Modes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These prefs are used when checking and setting modes when working
|
||||||
|
| with the file system. The defaults are fine on servers with proper
|
||||||
|
| security, but you may wish (or even need) to change the values in
|
||||||
|
| certain environments (Apache running a separate process for each
|
||||||
|
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
|
||||||
|
| always be used to set the mode correctly.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
define('FILE_READ_MODE', 0644);
|
||||||
|
define('FILE_WRITE_MODE', 0666);
|
||||||
|
define('DIR_READ_MODE', 0755);
|
||||||
|
define('DIR_WRITE_MODE', 0777);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| File Stream Modes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These modes are used when working with fopen()/popen()
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file constants.php */
|
||||||
|
/* Location: ./application/config/constants.php */
|
92
application/config/database.php
Normal file
92
application/config/database.php
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| DATABASE CONNECTIVITY SETTINGS
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file will contain the settings needed to access your database.
|
||||||
|
|
|
||||||
|
| For complete instructions please consult the 'Database Connection'
|
||||||
|
| page of the User Guide.
|
||||||
|
|
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| EXPLANATION OF VARIABLES
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| ['hostname'] The hostname of your database server.
|
||||||
|
| ['username'] The username used to connect to the database
|
||||||
|
| ['password'] The password used to connect to the database
|
||||||
|
| ['database'] The name of the database you want to connect to
|
||||||
|
| ['dbdriver'] The database type. ie: mysql. Currently supported:
|
||||||
|
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
||||||
|
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||||
|
| to the table name when using the Active Record class
|
||||||
|
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
||||||
|
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
||||||
|
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
||||||
|
| ['cachedir'] The path to the folder where cache files should be stored
|
||||||
|
| ['char_set'] The character set used in communicating with the database
|
||||||
|
| ['dbcollat'] The character collation used in communicating with the database
|
||||||
|
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
||||||
|
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
||||||
|
| (and in table creation queries made with DB Forge).
|
||||||
|
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
||||||
|
| can make your site vulnerable to SQL injection if you are using a
|
||||||
|
| multi-byte character set and are running versions lower than these.
|
||||||
|
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
||||||
|
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
||||||
|
| ['autoinit'] Whether or not to automatically initialize the database.
|
||||||
|
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||||
|
| - good for ensuring strict SQL while developing
|
||||||
|
|
|
||||||
|
| The $active_group variable lets you choose which connection group to
|
||||||
|
| make active. By default there is only one group (the 'default' group).
|
||||||
|
|
|
||||||
|
| The $active_record variables lets you determine whether or not to load
|
||||||
|
| the active record class
|
||||||
|
*/
|
||||||
|
define('LOG','ci_log');
|
||||||
|
define('ROLE','ci_role');
|
||||||
|
define('MENU','ci_menu');
|
||||||
|
define('CONTACT','ci_contact');
|
||||||
|
define('GOODS','ci_goods');
|
||||||
|
define('GOODS_IMG','ci_goods_img');
|
||||||
|
define('STAFF','ci_staff');
|
||||||
|
define('ASSISTINGPROP','ci_assistingprop');
|
||||||
|
define('RECEIPT_INFO','ci_receipt_info');
|
||||||
|
define('PAYMENT_INFO','ci_payment_info');
|
||||||
|
define('ACCOUNT','ci_account');
|
||||||
|
define('STORAGE','ci_storage');
|
||||||
|
define('ADMIN','ci_admin');
|
||||||
|
define('SETTLEMENT','ci_settlement');
|
||||||
|
define('CATEGORY','ci_category');
|
||||||
|
define('UNIT','ci_unit');
|
||||||
|
define('UNITTYPE','ci_unittype');
|
||||||
|
define('ADDRESS','ci_address');
|
||||||
|
define('ASSISTSKU','ci_assistsku');
|
||||||
|
define('INVPS','ci_invps');
|
||||||
|
define('INVPS_INFO','ci_invps_info');
|
||||||
|
define('INVOICE','ci_invoice');
|
||||||
|
define('INVOICE_INFO','ci_invoice_info');
|
||||||
|
define('INVOICE_TYPE','ci_invoice_type');
|
||||||
|
define('ACCOUNT_INFO','ci_account_info');
|
||||||
|
define('OPTIONS','ci_options');
|
||||||
|
define('PRINTTEMPLATES','ci_printtemplates');
|
||||||
|
$active_group = 'default';
|
||||||
|
$active_record = TRUE;
|
||||||
|
$db['default']['hostname'] = 'localhost'; //数据库地址
|
||||||
|
$db['default']['username'] = 'root'; //数据库用户名
|
||||||
|
$db['default']['password'] = 'root'; //数据库密码
|
||||||
|
$db['default']['database'] = 'webtest'; //数据库名称
|
||||||
|
$db['default']['dbdriver'] = 'mysql';
|
||||||
|
$db['default']['dbprefix'] = '';
|
||||||
|
$db['default']['pconnect'] = TRUE;
|
||||||
|
$db['default']['db_debug'] = FALSE;
|
||||||
|
$db['default']['cache_on'] = FALSE;
|
||||||
|
$db['default']['cachedir'] = '';
|
||||||
|
$db['default']['char_set'] = 'utf8';
|
||||||
|
$db['default']['dbcollat'] = 'utf8_unicode_ci';
|
||||||
|
$db['default']['swap_pre'] = '';
|
||||||
|
$db['default']['autoinit'] = TRUE;
|
||||||
|
$db['default']['stricton'] = FALSE;
|
||||||
|
/* End of file database.php */
|
||||||
|
/* Location: ./application/config/database.php */
|
15
application/config/doctypes.php
Normal file
15
application/config/doctypes.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
$_doctypes = array(
|
||||||
|
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||||
|
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||||
|
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||||
|
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||||
|
'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">'
|
||||||
|
);
|
||||||
|
|
||||||
|
/* End of file doctypes.php */
|
||||||
|
/* Location: ./application/config/doctypes.php */
|
64
application/config/foreign_chars.php
Normal file
64
application/config/foreign_chars.php
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| Foreign Characters
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file contains an array of foreign characters for transliteration
|
||||||
|
| conversion used by the Text helper
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$foreign_characters = array(
|
||||||
|
'/ä|æ|ǽ/' => 'ae',
|
||||||
|
'/ö|œ/' => 'oe',
|
||||||
|
'/ü/' => 'ue',
|
||||||
|
'/Ä/' => 'Ae',
|
||||||
|
'/Ü/' => 'Ue',
|
||||||
|
'/Ö/' => 'Oe',
|
||||||
|
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
|
||||||
|
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
|
||||||
|
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
|
||||||
|
'/ç|ć|ĉ|ċ|č/' => 'c',
|
||||||
|
'/Ð|Ď|Đ/' => 'D',
|
||||||
|
'/ð|ď|đ/' => 'd',
|
||||||
|
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
|
||||||
|
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
|
||||||
|
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
|
||||||
|
'/ĝ|ğ|ġ|ģ/' => 'g',
|
||||||
|
'/Ĥ|Ħ/' => 'H',
|
||||||
|
'/ĥ|ħ/' => 'h',
|
||||||
|
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
|
||||||
|
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
|
||||||
|
'/Ĵ/' => 'J',
|
||||||
|
'/ĵ/' => 'j',
|
||||||
|
'/Ķ/' => 'K',
|
||||||
|
'/ķ/' => 'k',
|
||||||
|
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
|
||||||
|
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
|
||||||
|
'/Ñ|Ń|Ņ|Ň/' => 'N',
|
||||||
|
'/ñ|ń|ņ|ň|ʼn/' => 'n',
|
||||||
|
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
|
||||||
|
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
|
||||||
|
'/Ŕ|Ŗ|Ř/' => 'R',
|
||||||
|
'/ŕ|ŗ|ř/' => 'r',
|
||||||
|
'/Ś|Ŝ|Ş|Š/' => 'S',
|
||||||
|
'/ś|ŝ|ş|š|ſ/' => 's',
|
||||||
|
'/Ţ|Ť|Ŧ/' => 'T',
|
||||||
|
'/ţ|ť|ŧ/' => 't',
|
||||||
|
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
|
||||||
|
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
|
||||||
|
'/Ý|Ÿ|Ŷ/' => 'Y',
|
||||||
|
'/ý|ÿ|ŷ/' => 'y',
|
||||||
|
'/Ŵ/' => 'W',
|
||||||
|
'/ŵ/' => 'w',
|
||||||
|
'/Ź|Ż|Ž/' => 'Z',
|
||||||
|
'/ź|ż|ž/' => 'z',
|
||||||
|
'/Æ|Ǽ/' => 'AE',
|
||||||
|
'/ß/'=> 'ss',
|
||||||
|
'/IJ/' => 'IJ',
|
||||||
|
'/ij/' => 'ij',
|
||||||
|
'/Œ/' => 'OE',
|
||||||
|
'/ƒ/' => 'f'
|
||||||
|
);
|
||||||
|
|
||||||
|
/* End of file foreign_chars.php */
|
||||||
|
/* Location: ./application/config/foreign_chars.php */
|
16
application/config/hooks.php
Normal file
16
application/config/hooks.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| Hooks
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| This file lets you define "hooks" to extend CI without hacking the core
|
||||||
|
| files. Please see the user guide for info:
|
||||||
|
|
|
||||||
|
| http://codeigniter.com/user_guide/general/hooks.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file hooks.php */
|
||||||
|
/* Location: ./application/config/hooks.php */
|
10
application/config/index.html
Normal file
10
application/config/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
41
application/config/migration.php
Normal file
41
application/config/migration.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Enable/Disable Migrations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Migrations are disabled by default but should be enabled
|
||||||
|
| whenever you intend to do a schema migration.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['migration_enabled'] = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migrations version
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is used to set migration version that the file system should be on.
|
||||||
|
| If you run $this->migration->latest() this is the version that schema will
|
||||||
|
| be upgraded / downgraded to.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['migration_version'] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migrations Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Path to your migrations folder.
|
||||||
|
| Typically, it will be within your application path.
|
||||||
|
| Also, writing permission is required within the migrations path.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
$config['migration_path'] = APPPATH . 'migrations/';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file migration.php */
|
||||||
|
/* Location: ./application/config/migration.php */
|
106
application/config/mimes.php
Normal file
106
application/config/mimes.php
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| MIME TYPES
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file contains an array of mime types. It is used by the
|
||||||
|
| Upload class to help identify allowed file types.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$mimes = array( 'hqx' => 'application/mac-binhex40',
|
||||||
|
'cpt' => 'application/mac-compactpro',
|
||||||
|
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
|
||||||
|
'bin' => 'application/macbinary',
|
||||||
|
'dms' => 'application/octet-stream',
|
||||||
|
'lha' => 'application/octet-stream',
|
||||||
|
'lzh' => 'application/octet-stream',
|
||||||
|
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||||
|
'class' => 'application/octet-stream',
|
||||||
|
'psd' => 'application/x-photoshop',
|
||||||
|
'so' => 'application/octet-stream',
|
||||||
|
'sea' => 'application/octet-stream',
|
||||||
|
'dll' => 'application/octet-stream',
|
||||||
|
'oda' => 'application/oda',
|
||||||
|
'pdf' => array('application/pdf', 'application/x-download'),
|
||||||
|
'ai' => 'application/postscript',
|
||||||
|
'eps' => 'application/postscript',
|
||||||
|
'ps' => 'application/postscript',
|
||||||
|
'smi' => 'application/smil',
|
||||||
|
'smil' => 'application/smil',
|
||||||
|
'mif' => 'application/vnd.mif',
|
||||||
|
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
|
||||||
|
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
|
||||||
|
'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',
|
||||||
|
'php' => 'application/x-httpd-php',
|
||||||
|
'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',
|
||||||
|
'swf' => 'application/x-shockwave-flash',
|
||||||
|
'sit' => 'application/x-stuffit',
|
||||||
|
'tar' => 'application/x-tar',
|
||||||
|
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||||
|
'xhtml' => 'application/xhtml+xml',
|
||||||
|
'xht' => 'application/xhtml+xml',
|
||||||
|
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
|
||||||
|
'mid' => 'audio/midi',
|
||||||
|
'midi' => 'audio/midi',
|
||||||
|
'mpga' => 'audio/mpeg',
|
||||||
|
'mp2' => 'audio/mpeg',
|
||||||
|
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||||
|
'aif' => 'audio/x-aiff',
|
||||||
|
'aiff' => 'audio/x-aiff',
|
||||||
|
'aifc' => 'audio/x-aiff',
|
||||||
|
'ram' => 'audio/x-pn-realaudio',
|
||||||
|
'rm' => 'audio/x-pn-realaudio',
|
||||||
|
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||||
|
'ra' => 'audio/x-realaudio',
|
||||||
|
'rv' => 'video/vnd.rn-realvideo',
|
||||||
|
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||||
|
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
|
||||||
|
'gif' => 'image/gif',
|
||||||
|
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||||
|
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||||
|
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||||
|
'png' => array('image/png', 'image/x-png'),
|
||||||
|
'tiff' => 'image/tiff',
|
||||||
|
'tif' => 'image/tiff',
|
||||||
|
'css' => 'text/css',
|
||||||
|
'html' => 'text/html',
|
||||||
|
'htm' => 'text/html',
|
||||||
|
'shtml' => 'text/html',
|
||||||
|
'txt' => 'text/plain',
|
||||||
|
'text' => 'text/plain',
|
||||||
|
'log' => array('text/plain', 'text/x-log'),
|
||||||
|
'rtx' => 'text/richtext',
|
||||||
|
'rtf' => 'text/rtf',
|
||||||
|
'xml' => 'text/xml',
|
||||||
|
'xsl' => 'text/xml',
|
||||||
|
'mpeg' => 'video/mpeg',
|
||||||
|
'mpg' => 'video/mpeg',
|
||||||
|
'mpe' => 'video/mpeg',
|
||||||
|
'qt' => 'video/quicktime',
|
||||||
|
'mov' => 'video/quicktime',
|
||||||
|
'avi' => 'video/x-msvideo',
|
||||||
|
'movie' => 'video/x-sgi-movie',
|
||||||
|
'doc' => 'application/msword',
|
||||||
|
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
|
||||||
|
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
|
||||||
|
'word' => array('application/msword', 'application/octet-stream'),
|
||||||
|
'xl' => 'application/excel',
|
||||||
|
'eml' => 'message/rfc822',
|
||||||
|
'json' => array('application/json', 'text/json')
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file mimes.php */
|
||||||
|
/* Location: ./application/config/mimes.php */
|
17
application/config/profiler.php
Normal file
17
application/config/profiler.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| Profiler Sections
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| This file lets you determine whether or not various sections of Profiler
|
||||||
|
| data are displayed when the Profiler is enabled.
|
||||||
|
| Please see the user guide for info:
|
||||||
|
|
|
||||||
|
| http://codeigniter.com/user_guide/general/profiling.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file profiler.php */
|
||||||
|
/* Location: ./application/config/profiler.php */
|
55
application/config/routes.php
Normal file
55
application/config/routes.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| URI ROUTING
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| This file lets you re-map URI requests to specific controller functions.
|
||||||
|
|
|
||||||
|
| Typically there is a one-to-one relationship between a URL string
|
||||||
|
| and its corresponding controller class/method. The segments in a
|
||||||
|
| URL normally follow this pattern:
|
||||||
|
|
|
||||||
|
| example.com/class/method/id/
|
||||||
|
|
|
||||||
|
| In some instances, however, you may want to remap this relationship
|
||||||
|
| so that a different class/function is called than the one
|
||||||
|
| corresponding to the URL.
|
||||||
|
|
|
||||||
|
| Please see the user guide for complete details:
|
||||||
|
|
|
||||||
|
| http://codeigniter.com/user_guide/general/routing.html
|
||||||
|
|
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
| RESERVED ROUTES
|
||||||
|
| -------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| There area two reserved routes:
|
||||||
|
|
|
||||||
|
| $route['default_controller'] = 'welcome';
|
||||||
|
|
|
||||||
|
| This route indicates which controller class should be loaded if the
|
||||||
|
| URI contains no data. In the above example, the "welcome" class
|
||||||
|
| would be loaded.
|
||||||
|
|
|
||||||
|
| $route['404_override'] = 'errors/page_missing';
|
||||||
|
|
|
||||||
|
| This route will tell the Router what URI segments to use if those provided
|
||||||
|
| in the URL cannot be matched to a valid route.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$route['default_controller'] = "home";
|
||||||
|
//$route['home/(.*)'] = "home/index/$1";
|
||||||
|
//$route['page/(.*)'] = "page/index/$1";
|
||||||
|
//$route['news/(.*)'] = "news/index/$1";
|
||||||
|
//Ò»¼¶À¸Ä¿
|
||||||
|
//$route['user'] = "user/index";
|
||||||
|
//$route['user/(.*)'] = "user/$1";
|
||||||
|
//$route['plug/(.*)'] = "plug/$1";
|
||||||
|
//$route['admin/(.*)'] = "admin/$1";
|
||||||
|
//$route['(.*)'] = "home/index/$1";
|
||||||
|
$route['404_override'] = '';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file routes.php */
|
||||||
|
/* Location: ./application/config/routes.php */
|
66
application/config/smileys.php
Normal file
66
application/config/smileys.php
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| SMILEYS
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file contains an array of smileys for use with the emoticon helper.
|
||||||
|
| Individual images can be used to replace multiple simileys. For example:
|
||||||
|
| :-) and :) use the same image replacement.
|
||||||
|
|
|
||||||
|
| Please see user guide for more info:
|
||||||
|
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$smileys = array(
|
||||||
|
|
||||||
|
// smiley image name width height alt
|
||||||
|
|
||||||
|
':-)' => array('grin.gif', '19', '19', 'grin'),
|
||||||
|
':lol:' => array('lol.gif', '19', '19', 'LOL'),
|
||||||
|
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
|
||||||
|
':)' => array('smile.gif', '19', '19', 'smile'),
|
||||||
|
';-)' => array('wink.gif', '19', '19', 'wink'),
|
||||||
|
';)' => array('wink.gif', '19', '19', 'wink'),
|
||||||
|
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
|
||||||
|
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
|
||||||
|
':-S' => array('confused.gif', '19', '19', 'confused'),
|
||||||
|
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
|
||||||
|
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
|
||||||
|
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
|
||||||
|
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
|
||||||
|
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
|
||||||
|
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
|
||||||
|
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
|
||||||
|
':long:' => array('longface.gif', '19', '19', 'long face'),
|
||||||
|
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
|
||||||
|
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
|
||||||
|
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
|
||||||
|
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
|
||||||
|
':down:' => array('downer.gif', '19', '19', 'downer'),
|
||||||
|
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
|
||||||
|
':sick:' => array('sick.gif', '19', '19', 'sick'),
|
||||||
|
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
|
||||||
|
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
|
||||||
|
'>:(' => array('mad.gif', '19', '19', 'mad'),
|
||||||
|
':mad:' => array('mad.gif', '19', '19', 'mad'),
|
||||||
|
'>:-(' => array('angry.gif', '19', '19', 'angry'),
|
||||||
|
':angry:' => array('angry.gif', '19', '19', 'angry'),
|
||||||
|
':zip:' => array('zip.gif', '19', '19', 'zipper'),
|
||||||
|
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
|
||||||
|
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
|
||||||
|
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
|
||||||
|
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
|
||||||
|
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
|
||||||
|
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
|
||||||
|
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
|
||||||
|
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
|
||||||
|
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
||||||
|
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
||||||
|
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
|
||||||
|
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
/* End of file smileys.php */
|
||||||
|
/* Location: ./application/config/smileys.php */
|
178
application/config/user_agents.php
Normal file
178
application/config/user_agents.php
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| USER AGENT TYPES
|
||||||
|
| -------------------------------------------------------------------
|
||||||
|
| This file contains four arrays of user agent data. It is used by the
|
||||||
|
| User Agent Class to help identify browser, platform, robot, and
|
||||||
|
| mobile device data. The array keys are used to identify the device
|
||||||
|
| and the array values are used to set the actual name of the item.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$platforms = array (
|
||||||
|
'windows nt 6.0' => 'Windows Longhorn',
|
||||||
|
'windows nt 5.2' => 'Windows 2003',
|
||||||
|
'windows nt 5.0' => 'Windows 2000',
|
||||||
|
'windows nt 5.1' => 'Windows XP',
|
||||||
|
'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' => 'Unknown Windows OS',
|
||||||
|
'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'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// The order of this array should NOT be changed. Many browsers return
|
||||||
|
// multiple browser types so we want to identify the sub-type first.
|
||||||
|
$browsers = array(
|
||||||
|
'Flock' => 'Flock',
|
||||||
|
'Chrome' => 'Chrome',
|
||||||
|
'Opera' => 'Opera',
|
||||||
|
'MSIE' => 'Internet Explorer',
|
||||||
|
'Internet Explorer' => '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'
|
||||||
|
);
|
||||||
|
|
||||||
|
$mobiles = array(
|
||||||
|
// legacy array, old values commented out
|
||||||
|
'mobileexplorer' => 'Mobile Explorer',
|
||||||
|
// 'openwave' => 'Open Wave',
|
||||||
|
// 'opera mini' => 'Opera Mini',
|
||||||
|
// 'operamini' => 'Opera Mini',
|
||||||
|
// 'elaine' => 'Palm',
|
||||||
|
'palmsource' => 'Palm',
|
||||||
|
// 'digital paths' => 'Palm',
|
||||||
|
// 'avantgo' => 'Avantgo',
|
||||||
|
// 'xiino' => 'Xiino',
|
||||||
|
'palmscape' => 'Palmscape',
|
||||||
|
// 'nokia' => 'Nokia',
|
||||||
|
// 'ericsson' => 'Ericsson',
|
||||||
|
// 'blackberry' => 'BlackBerry',
|
||||||
|
// 'motorola' => 'Motorola'
|
||||||
|
|
||||||
|
// Phones and Manufacturers
|
||||||
|
'motorola' => "Motorola",
|
||||||
|
'nokia' => "Nokia",
|
||||||
|
'palm' => "Palm",
|
||||||
|
'iphone' => "Apple iPhone",
|
||||||
|
'ipad' => "iPad",
|
||||||
|
'ipod' => "Apple iPod Touch",
|
||||||
|
'sony' => "Sony Ericsson",
|
||||||
|
'ericsson' => "Sony Ericsson",
|
||||||
|
'blackberry' => "BlackBerry",
|
||||||
|
'cocoon' => "O2 Cocoon",
|
||||||
|
'blazer' => "Treo",
|
||||||
|
'lg' => "LG",
|
||||||
|
'amoi' => "Amoi",
|
||||||
|
'xda' => "XDA",
|
||||||
|
'mda' => "MDA",
|
||||||
|
'vario' => "Vario",
|
||||||
|
'htc' => "HTC",
|
||||||
|
'samsung' => "Samsung",
|
||||||
|
'sharp' => "Sharp",
|
||||||
|
'sie-' => "Siemens",
|
||||||
|
'alcatel' => "Alcatel",
|
||||||
|
'benq' => "BenQ",
|
||||||
|
'ipaq' => "HP iPaq",
|
||||||
|
'mot-' => "Motorola",
|
||||||
|
'playstation portable' => "PlayStation Portable",
|
||||||
|
'hiptop' => "Danger Hiptop",
|
||||||
|
'nec-' => "NEC",
|
||||||
|
'panasonic' => "Panasonic",
|
||||||
|
'philips' => "Philips",
|
||||||
|
'sagem' => "Sagem",
|
||||||
|
'sanyo' => "Sanyo",
|
||||||
|
'spv' => "SPV",
|
||||||
|
'zte' => "ZTE",
|
||||||
|
'sendo' => "Sendo",
|
||||||
|
|
||||||
|
// Operating Systems
|
||||||
|
'symbian' => "Symbian",
|
||||||
|
'SymbianOS' => "SymbianOS",
|
||||||
|
'elaine' => "Palm",
|
||||||
|
'palm' => "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",
|
||||||
|
|
||||||
|
// Other
|
||||||
|
'digital paths' => "Digital Paths",
|
||||||
|
'avantgo' => "AvantGo",
|
||||||
|
'xiino' => "Xiino",
|
||||||
|
'novarra' => "Novarra Transcoder",
|
||||||
|
'vodafone' => "Vodafone",
|
||||||
|
'docomo' => "NTT DoCoMo",
|
||||||
|
'o2' => "O2",
|
||||||
|
|
||||||
|
// Fallback
|
||||||
|
'mobile' => "Generic Mobile",
|
||||||
|
'wireless' => "Generic Mobile",
|
||||||
|
'j2me' => "Generic Mobile",
|
||||||
|
'midp' => "Generic Mobile",
|
||||||
|
'cldc' => "Generic Mobile",
|
||||||
|
'up.link' => "Generic Mobile",
|
||||||
|
'up.browser' => "Generic Mobile",
|
||||||
|
'smartphone' => "Generic Mobile",
|
||||||
|
'cellphone' => "Generic Mobile"
|
||||||
|
);
|
||||||
|
|
||||||
|
// There are hundreds of bots but these are the most common.
|
||||||
|
$robots = array(
|
||||||
|
'googlebot' => 'Googlebot',
|
||||||
|
'msnbot' => 'MSNBot',
|
||||||
|
'slurp' => 'Inktomi Slurp',
|
||||||
|
'yahoo' => 'Yahoo',
|
||||||
|
'askjeeves' => 'AskJeeves',
|
||||||
|
'fastcrawler' => 'FastCrawler',
|
||||||
|
'infoseek' => 'InfoSeek Robot 1.0',
|
||||||
|
'lycos' => 'Lycos'
|
||||||
|
);
|
||||||
|
|
||||||
|
/* End of file user_agents.php */
|
||||||
|
/* Location: ./application/config/user_agents.php */
|
299
application/controllers/basedata/assist.php
Normal file
299
application/controllers/basedata/assist.php
Normal file
|
@ -0,0 +1,299 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Assist extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$type = str_enhtml($this->input->get('typeNumber',TRUE));
|
||||||
|
$skey = str_enhtml($this->input->get('skey',TRUE));
|
||||||
|
$where = ' and typenumber="'.$type.'"';
|
||||||
|
$where .= $skey ? ' and name like "%'.$skey.'%"' :'';
|
||||||
|
$pid = array_column($this->mysql_model->get_results(CATEGORY,'(isDelete=0) '.$where.' order by id'), 'parentId');
|
||||||
|
$list = $this->mysql_model->get_results(CATEGORY,'(isDelete=0) '.$where.' order by path');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['detail'] = in_array($row['id'],$pid) ? false : true;
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['level'] = $row['level'];
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['parentId'] = intval($row['parentId']);
|
||||||
|
$v[$arr]['remark'] = $row['remark'];
|
||||||
|
$v[$arr]['sortIndex'] = intval($row['sortIndex']);
|
||||||
|
$v[$arr]['status'] = intval($row['isDelete']);
|
||||||
|
$v[$arr]['typeNumber'] = $row['typeNumber'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(CATEGORY,'(isDelete=0) '.$where.'');
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//分类
|
||||||
|
public function getAssistType(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$v = array(
|
||||||
|
0 => array('id'=>1001,'name'=>'商品类别','number'=>'trade'),
|
||||||
|
1 => array('id'=>1002,'name'=>'客户类别','number'=>'customertype'),
|
||||||
|
2 => array('id'=>1003,'name'=>'供应商类别','number'=>'supplytype'),
|
||||||
|
3 => array('id'=>1004,'name'=>'收入类别','number'=>'raccttype'),
|
||||||
|
4 => array('id'=>1005,'name'=>'支出类别','number'=>'paccttype')
|
||||||
|
);
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = 5;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
$data = $this->validform($data);
|
||||||
|
switch ($data['typeNumber']) {
|
||||||
|
case 'trade':
|
||||||
|
$this->common_model->checkpurview(168);
|
||||||
|
$this->trade_add($data);
|
||||||
|
break;
|
||||||
|
case 'supplytype':
|
||||||
|
$this->common_model->checkpurview(164);
|
||||||
|
$success = '新增供应商类别:';
|
||||||
|
break;
|
||||||
|
case 'customertype':
|
||||||
|
$this->common_model->checkpurview(74);
|
||||||
|
$success = '新增客户类别:';
|
||||||
|
break;
|
||||||
|
case 'raccttype':
|
||||||
|
$this->common_model->checkpurview(176);
|
||||||
|
$success = '新增收入类别:';
|
||||||
|
break;
|
||||||
|
case 'paccttype':
|
||||||
|
$this->common_model->checkpurview(172);
|
||||||
|
$success = '新增支出类别:';
|
||||||
|
break;
|
||||||
|
case 'PayMethod':
|
||||||
|
$this->common_model->checkpurview(160);
|
||||||
|
$success = '新增结算方式:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$sql = $this->mysql_model->insert(CATEGORY,elements(array('name','typeNumber'),$data));
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs($success.$data['name']);
|
||||||
|
die('{"status":200,"msg":"success","data":{"coId":0,"detail":true,"id":'.$sql.',"level":1,"name":"'.$data['name'].'","parentId":0,"remark":"","sortIndex":2,"status":0,"typeNumber":"'.$data['typeNumber'].'","uuid":""}}');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//商品分类添加
|
||||||
|
private function trade_add($data){
|
||||||
|
if ($data['parentId']==0) {
|
||||||
|
$data['level'] = 1;
|
||||||
|
$newid = $this->mysql_model->insert(CATEGORY,$data);
|
||||||
|
$sql = $this->mysql_model->update(CATEGORY,array('path'=>$newid),'(id='.$newid.')');
|
||||||
|
} else {
|
||||||
|
$cate = $this->mysql_model->get_row(CATEGORY,'(id='.$data['parentId'].')');
|
||||||
|
count($cate)<1 && str_alert(-1,'参数错误');
|
||||||
|
$data['level'] = $cate['level'] + 1;
|
||||||
|
$newid = $this->mysql_model->insert(CATEGORY,$data);
|
||||||
|
$sql = $this->mysql_model->update(CATEGORY,array('path'=>$cate['path'].','.$newid),'(id='.$newid.')');
|
||||||
|
}
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('新增商品类别:'.$data['name']);
|
||||||
|
die('{"status":200,"msg":"success","data":{"coId":0,"detail":true,"id":'.$newid.',"level":'.$data['level'].',"name":"'.$data['name'].'","parentId":'.$data['parentId'].',"remark":"","sortIndex":1,"status":0,"typeNumber":"'.$data['typeNumber'].'","uuid":""}}');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
$data = $this->validform($data);
|
||||||
|
switch ($data['typeNumber']) {
|
||||||
|
case 'trade':
|
||||||
|
$this->common_model->checkpurview(169);
|
||||||
|
$this->trade_update($data);
|
||||||
|
break;
|
||||||
|
case 'supplytype':
|
||||||
|
$this->common_model->checkpurview(165);
|
||||||
|
$success = '修改供应商类别:';
|
||||||
|
break;
|
||||||
|
case 'customertype':
|
||||||
|
$this->common_model->checkpurview(75);
|
||||||
|
$success = '修改客户类别:';
|
||||||
|
break;
|
||||||
|
case 'raccttype':
|
||||||
|
$this->common_model->checkpurview(177);
|
||||||
|
$success = '修改收入类别:';
|
||||||
|
break;
|
||||||
|
case 'paccttype':
|
||||||
|
$this->common_model->checkpurview(173);
|
||||||
|
$success = '修改支出类别:';
|
||||||
|
break;
|
||||||
|
case 'PayMethod':
|
||||||
|
$this->common_model->checkpurview(161);
|
||||||
|
$success = '修改结算方式:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$sql = $this->mysql_model->update(CATEGORY,elements(array('name','typeNumber'),$data),'(id='.$data['id'].')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs($success.$data['name']);
|
||||||
|
die('{"status":200,"msg":"success","data":{"coId":0,"detail":true,"id":'.$data['id'].',"level":1,"name"
|
||||||
|
:"'.$data['name'].'","parentId":0,"remark":"","sortIndex":2,"status":0,"typeNumber":"'.$data['typeNumber'].'","uuid":""
|
||||||
|
}}');
|
||||||
|
}
|
||||||
|
str_alert(-1,'修改失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//商品分类修改
|
||||||
|
private function trade_update($data){
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$name = $data['name'];
|
||||||
|
$pid = $data['parentId'];
|
||||||
|
strlen($name) < 1 && str_alert(-1,'类别名称不能为空');
|
||||||
|
$this->mysql_model->get_count(CATEGORY,'(id<>'.$id.') and (name="'.$name.'") and typeNumber="'.$data['typeNumber'].'"') > 0 && str_alert(-1,'类别名称重复');
|
||||||
|
$cate = $this->mysql_model->get_row(CATEGORY,'(id='.$id.')'); //获取原ID数据
|
||||||
|
count($cate)<1 && str_alert(-1,'参数错误');
|
||||||
|
$old_pid = $cate['parentId'];
|
||||||
|
$old_path = $cate['path'];
|
||||||
|
$pid_list = $this->mysql_model->get_results(CATEGORY,'(id<>'.$id.') and find_in_set('.$id.',path)'); //是否有子栏目
|
||||||
|
$old_pid_num = count($pid_list); //是否有子栏目
|
||||||
|
//$pid == $old_pid && alert('没有移动');
|
||||||
|
$pid == $id && str_alert(-1,'当前分类和上级分类不能相同');
|
||||||
|
if ($pid==0) { //多级转顶级
|
||||||
|
$pare_depth = 1;
|
||||||
|
if ($old_pid_num==0) { //ID不存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('parentId'=>0,'path'=>$id,'level'=>1,'name'=>$name),'(id='.$id.')');
|
||||||
|
} else { //ID存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('parentId'=>0,'path'=>$id,'level'=>1,'name'=>$name),'(id='.$id.')');
|
||||||
|
foreach($pid_list as $arr=>$row) {
|
||||||
|
$path = str_replace($id,'',$old_path);
|
||||||
|
$path = str_replace(''.$path.'','',''.$row['path'].'');
|
||||||
|
$pare_depth = substr_count($path,',')+1;
|
||||||
|
$datas[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth);
|
||||||
|
}
|
||||||
|
$this->mysql_model->update(CATEGORY,$datas,'id');
|
||||||
|
}
|
||||||
|
} else { //pid<>0时,顶级转多级 多级转多级
|
||||||
|
$cate = $this->mysql_model->get_row(CATEGORY,'(id='.$pid.')'); //获取原PID数据
|
||||||
|
count($cate)<1 && str_alert(-1,'参数错误');
|
||||||
|
$pare_pid = $cate['parentId'];
|
||||||
|
$pare_path = $cate['path'];
|
||||||
|
$pare_depth = $cate['level'];
|
||||||
|
if ($old_pid==0) { //顶级转多级
|
||||||
|
if ($old_pid_num==0) { //ID不存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('name'=>$name,'parentId'=>$pid,'path'=>$pare_path.','.$id,'level'=>$pare_depth+1),'(id='.$id.')');
|
||||||
|
} else { //ID存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('name'=>$name,'parentId'=>$pid,'path'=>$pare_path.','.$id,'level'=>$pare_depth+1),'(id='.$id.')');
|
||||||
|
foreach ($pid_list as $arr=>$row) {
|
||||||
|
$path = $pare_path.','.$row['path'];
|
||||||
|
$pare_depth = substr_count($path,',')+1;
|
||||||
|
$datas[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth);
|
||||||
|
}
|
||||||
|
$this->mysql_model->update(CATEGORY,$datas,'id');
|
||||||
|
}
|
||||||
|
} else { //多级转多级
|
||||||
|
if ($old_pid_num==0) { //ID不存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('name'=>$name,'parentId'=>$pid,'path'=>$pare_path.','.$id,'level'=>$pare_depth+1),'(id='.$id.')');
|
||||||
|
} else { //ID存在子栏目
|
||||||
|
$this->mysql_model->update(CATEGORY,array('name'=>$name,'parentId'=>$pid,'path'=>$pare_path.','.$id,'level'=>$pare_depth+1),'(id='.$id.')');
|
||||||
|
foreach ($pid_list as $arr=>$row) {
|
||||||
|
$path = str_replace($id,'',$old_path);
|
||||||
|
$path = str_replace($path,'',$row['path']);
|
||||||
|
$path = $pare_path.','.$path;
|
||||||
|
$pare_depth = substr_count($path,',')+1;
|
||||||
|
$datas[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth+1);
|
||||||
|
}
|
||||||
|
$this->mysql_model->update(CATEGORY,$datas,'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['id'] = intval($id);
|
||||||
|
$data['level'] = intval($pare_depth);
|
||||||
|
$data['name'] = $name;
|
||||||
|
$data['parentId'] = intval($pid);
|
||||||
|
$this->mysql_model->update(GOODS,array('categoryName'=>$name),'(categoryId='.$id.')');
|
||||||
|
$this->common_model->logs('修改类别:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
die('{"status":200,"msg":"success","data":{"coId":0,"detail":true,"id":'.$data['id'].',"level":'.$data['level'].',"name":"'.$data['name'].'","parentId":'.$data['parentId'].',"remark":"","sortIndex":0,"status":0,"typeNumber":"trade","uuid":""}}');
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//分类删除
|
||||||
|
public function delete() {
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$type = str_enhtml($this->input->get_post('typeNumber',TRUE));
|
||||||
|
switch ($type) {
|
||||||
|
case 'trade':
|
||||||
|
$this->common_model->checkpurview(170);
|
||||||
|
$success = '删除商品类别:';
|
||||||
|
break;
|
||||||
|
case 'supplytype':
|
||||||
|
$this->common_model->checkpurview(166);
|
||||||
|
$success = '删除供应商类别:';
|
||||||
|
break;
|
||||||
|
case 'customertype':
|
||||||
|
$this->common_model->checkpurview(76);
|
||||||
|
$success = '删除客户类别:';
|
||||||
|
break;
|
||||||
|
case 'raccttype':
|
||||||
|
$this->common_model->checkpurview(178);
|
||||||
|
$success = '删除收入类别:';
|
||||||
|
break;
|
||||||
|
case 'paccttype':
|
||||||
|
$this->common_model->checkpurview(174);
|
||||||
|
$success = '删除支出类别:';
|
||||||
|
break;
|
||||||
|
case 'PayMethod':
|
||||||
|
$this->common_model->checkpurview(162);
|
||||||
|
$success = '删除结算方式:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$data = $this->mysql_model->get_row(CATEGORY,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (categoryId='.$id.')')>0 && str_alert(-1,'辅助资料已经被使用');
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(isDelete=0) and (cCategory ='.$id.')')>0 && str_alert(-1,'辅助资料已经被使用');
|
||||||
|
$this->mysql_model->get_count(CATEGORY,'(isDelete=0) and find_in_set('.$id.',path)')>1 && str_alert(-1,'不能删除,请先删除子分类!');
|
||||||
|
$sql = $this->mysql_model->update(CATEGORY,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs($success.'ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',array('msg'=>'删除成功','id'=>'['.$id.']'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
$data['typeNumber'] = str_enhtml($this->input->get_post('typeNumber',TRUE)); //结算方式是GET
|
||||||
|
$data['parentId'] = isset($data['parentId']) ? $data['parentId'] : 0;
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'类别名称不能为空');
|
||||||
|
strlen($data['typeNumber']) < 1 && str_alert(-1,'参数错误');
|
||||||
|
if (isset($data['id'])) {
|
||||||
|
$data['id'] = intval($data['id']);
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
75
application/controllers/basedata/assistSku.php
Normal file
75
application/controllers/basedata/assistSku.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Assistsku extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//组合属性规格
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$skuClassId = intval($this->input->get('skuClassId',TRUE));
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$where = ' and isDelete=0';
|
||||||
|
$where .= ' and skuClassId='.$skuClassId;
|
||||||
|
$list = $this->mysql_model->get_results(ASSISTSKU,'(1=1) '.$where.' order by skuId desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['skuClassId'] = $row['skuClassId'];
|
||||||
|
$v[$arr]['skuAssistId'] = $row['skuAssistId'];
|
||||||
|
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$v[$arr]['skuName'] = $row['skuName'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(ASSISTSKU,'(1=1) '.$where.'');
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data['skuAssistId'] = $this->input->get_post('skuAssistId',TRUE);
|
||||||
|
$data['skuClassId'] = $this->input->get_post('skuClassId',TRUE);
|
||||||
|
$data['skuName'] = $this->input->get_post('skuName',TRUE);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->mysql_model->get_count(ASSISTSKU,'(skuAssistId="'.$data['skuAssistId'].'")') > 0 && str_alert(-1,'辅助属性组已存在!');
|
||||||
|
$sql = $this->mysql_model->insert(ASSISTSKU,$data);
|
||||||
|
if ($sql) {
|
||||||
|
$data['skuId'] = $sql;
|
||||||
|
$this->common_model->logs('新增规格:'.$data['skuName']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ASSISTSKU,'(skuId='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
//$this->mysql_model->get_count(INVSA,'(contactid in('.$id.'))')>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(ASSISTSKU,$info,'(skuId='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除规格:ID='.$id.' 名称:'.$data['skuName']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
84
application/controllers/basedata/assistType.php
Normal file
84
application/controllers/basedata/assistType.php
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Assisttype extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//辅助属性列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(ASSISTINGPROP,'(isDelete=0) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['del'] = false;
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(ASSISTINGPROP);
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$type = $this->input->post('type',TRUE);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
$this->mysql_model->get_count(ASSISTINGPROP,'(1=1) and (name="'.$data['name'].'")') > 0 && str_alert(-1,'名称重复');
|
||||||
|
$sql = $this->mysql_model->insert(ASSISTINGPROP,$data);
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增辅助属性:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
unset($data['id']);
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
$this->mysql_model->get_count(ASSISTINGPROP,'(id<>'.$id.') and (name="'.$data['name'].'")') > 0 && str_alert(-1,'名称重复');
|
||||||
|
$sql = $this->mysql_model->update(ASSISTINGPROP,$data,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->common_model->logs('更新辅助属性:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ASSISTINGPROP,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and find_in_set('.$id.',skuAssistId)')>0 && str_alert(-1,'数据在使用中,不能删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(ASSISTINGPROP,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除辅助属性:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
279
application/controllers/basedata/contact.php
Normal file
279
application/controllers/basedata/contact.php
Normal file
|
@ -0,0 +1,279 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Contact extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->load->library('lib_pinyin');
|
||||||
|
}
|
||||||
|
|
||||||
|
//客户、供应商列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$type = intval($this->input->get('type',TRUE))==10 ? 10 : -10;
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$categoryid = intval($this->input->get_post('categoryId',TRUE));
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$where = ' and type='.$type;
|
||||||
|
$where .= $skey ? ' and (contact like "%'.$skey.'%" or linkMans like "%'.$skey.'%")' : '';
|
||||||
|
$where .= $categoryid>0 ? ' and cCategory = '.$categoryid.'' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->mysql_model->get_count(CONTACT,'(isDelete=0) '.$where.'');
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows);
|
||||||
|
$list = $this->mysql_model->get_results(CONTACT,'(isDelete=0) '.$where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['RID'] = intval($row['id']);
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
$v[$arr]['cCategory'] = intval($row['cCategory']);
|
||||||
|
$v[$arr]['customerType'] = $row['cCategoryName'];
|
||||||
|
$v[$arr]['pinYin'] = $row['pinYin'];
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['type'] = $row['type'];
|
||||||
|
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false;
|
||||||
|
$v[$arr]['cLevel'] = intval($row['cLevel']);
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['periodMoney'] = (float)$row['periodMoney'];
|
||||||
|
$v[$arr]['difMoney'] = (float)$row['difMoney'];
|
||||||
|
$v[$arr]['remark'] = $row['remark'];
|
||||||
|
$v[$arr]['taxRate'] = (float)$row['taxRate'];
|
||||||
|
$v[$arr]['links'] = '';
|
||||||
|
if (strlen($row['linkMans'])>0) {
|
||||||
|
$list = (array)json_decode($row['linkMans'],true);
|
||||||
|
foreach ($list as $arr1=>$row1) {
|
||||||
|
if ($row1['linkFirst']==1) {
|
||||||
|
$v[$arr]['contacter'] = isset($row1['linkName']) ? $row1['linkName'] : '';
|
||||||
|
$v[$arr]['mobile'] = isset($row1['linkMobile']) ? $row1['linkMobile'] : '';
|
||||||
|
$v[$arr]['telephone'] = isset($row1['linkPhone']) ? $row1['linkPhone'] : '';
|
||||||
|
$v[$arr]['linkIm'] = isset($row1['linkIm']) ? $row1['linkIm'] : '';
|
||||||
|
$v[$arr]['firstLink']['first'] = isset($row1['linkFirst']) ? $row1['linkFirst'] : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = array_values($v);
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验客户编号
|
||||||
|
public function getNextNo(){
|
||||||
|
$type = intval($this->input->get('type',TRUE));
|
||||||
|
$skey = intval($this->input->post('skey',TRUE));
|
||||||
|
str_alert(200,'success',array('number'=>$skey));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//检测客户名称
|
||||||
|
public function checkName(){
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$name = str_enhtml($this->input->post('name',TRUE));
|
||||||
|
$where = $id>0 ? 'and (id<>'.$id.')' :'';
|
||||||
|
$data = $this->mysql_model->get_row(CONTACT,'(name="'.$name.'") '.$where.' and isDelete=0');
|
||||||
|
if (count($data)>0) {
|
||||||
|
str_alert(-1,'客户名称重复');
|
||||||
|
}
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecentlyContact(){
|
||||||
|
$billType = str_enhtml($this->input->post('billType',TRUE));
|
||||||
|
$transType = intval($this->input->post('transType',TRUE));
|
||||||
|
$where = $transType==150501 ? 'and (type=10)' :'';
|
||||||
|
$data = $this->mysql_model->get_row(CONTACT,'(isDelete=0) '.$where.' ');
|
||||||
|
if (count($data)>0) {
|
||||||
|
die('{"status":200,"msg":"success","data":{"contactName":"'.$data['name'].'","buId":'.$data['id'].',"cLevel":0}}');
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//获取信息
|
||||||
|
public function query() {
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(CONTACT,'(id='.$id.') and isDelete=0');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$info['id'] = $id;
|
||||||
|
$info['number'] = $data['number'];
|
||||||
|
$info['name'] = $data['name'];
|
||||||
|
$info['beginDate'] = $data['beginDate'];
|
||||||
|
$info['remark'] = $data['remark'];
|
||||||
|
$info['cCategory'] = intval($data['cCategory']);
|
||||||
|
$info['cLevel'] = intval($data['cLevel']);
|
||||||
|
$info['amount'] = (float)$data['amount'];
|
||||||
|
$info['periodMoney'] = (float)$data['periodMoney'];
|
||||||
|
$info['taxRate'] = (float)$data['taxRate'];
|
||||||
|
$info['difMoney'] = (float)$data['difMoney'];
|
||||||
|
if (strlen($data['linkMans'])>0) {
|
||||||
|
$list = (array)json_decode($data['linkMans'],true);
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['contactId'] = $id;
|
||||||
|
$v[$arr]['address'] = isset($row['address']) ? $row['address'] : '';
|
||||||
|
$v[$arr]['first'] = isset($row['linkFirst']) && $row['linkFirst']==1 ? true : '';
|
||||||
|
$v[$arr]['city'] = isset($row['city']) ? $row['city'] : '';
|
||||||
|
$v[$arr]['county'] = isset($row['county']) ? $row['county'] : '';
|
||||||
|
$v[$arr]['email'] = isset($row['email']) ? $row['email'] : '';
|
||||||
|
$v[$arr]['im'] = isset($row['linkIm']) ? $row['linkIm'] : '';
|
||||||
|
$v[$arr]['name'] = isset($row['linkName']) ? $row['linkName'] : '';
|
||||||
|
$v[$arr]['province'] = isset($row['province']) ? $row['province'] : '';
|
||||||
|
$v[$arr]['mobile'] = isset($row['linkMobile']) ? $row['linkMobile'] : '';
|
||||||
|
$v[$arr]['phone'] = isset($row['linkPhone']) ? $row['linkPhone'] : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$info['links'] = $v;
|
||||||
|
str_alert(200,'success',$info);
|
||||||
|
}
|
||||||
|
str_alert(-1,'没有数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$data = $this->input->post(NULL,TRUE);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
switch ($data['type']) {
|
||||||
|
case 10:
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$success = '新增客户:';
|
||||||
|
break;
|
||||||
|
case -10:
|
||||||
|
$this->common_model->checkpurview(64);
|
||||||
|
$success = '新增供应商:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$data = array_filter(elements(array(
|
||||||
|
'name','number','amount','beginDate','cCategory',
|
||||||
|
'cCategoryName','cLevel','cLevelName','linkMans'
|
||||||
|
,'periodMoney','remark','type','difMoney')
|
||||||
|
,$data));
|
||||||
|
$sql = $this->mysql_model->insert(CONTACT,$data);
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$data['cCategory'] = intval($data['cCategory']);
|
||||||
|
$data['linkMans'] = (array)json_decode($data['linkMans'],true);
|
||||||
|
$this->common_model->logs($success.$data['name']);
|
||||||
|
$this->mysql_model->clean();
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$data = $this->input->post(NULL,TRUE);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
switch ($data['type']) {
|
||||||
|
case 10:
|
||||||
|
$this->common_model->checkpurview(60);
|
||||||
|
$success = '修改客户:';
|
||||||
|
break;
|
||||||
|
case -10:
|
||||||
|
$this->common_model->checkpurview(65);
|
||||||
|
$success = '修改供应商:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = array_filter(elements(array(
|
||||||
|
'name','number','amount','beginDate','cCategory',
|
||||||
|
'cCategoryName','cLevel','cLevelName','linkMans'
|
||||||
|
,'periodMoney','remark','type','difMoney')
|
||||||
|
,$data));
|
||||||
|
$sql = $this->mysql_model->update(CONTACT,$info,'(id='.$data['id'].')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['cCategory'] = intval($data['cCategory']);
|
||||||
|
$data['customerType'] = $data['cCategoryName'];
|
||||||
|
$data['linkMans'] = (array)json_decode($data['linkMans'],true);
|
||||||
|
$this->common_model->logs($success.$data['name']);
|
||||||
|
$this->mysql_model->clean();
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$id = str_enhtml($this->input->post('id',TRUE));
|
||||||
|
$type = intval($this->input->get_post('type',TRUE))==10 ? 10 : -10;
|
||||||
|
switch ($type) {
|
||||||
|
case 10:
|
||||||
|
$this->common_model->checkpurview(61);
|
||||||
|
$success = '删除客户:';
|
||||||
|
break;
|
||||||
|
case -10:
|
||||||
|
$this->common_model->checkpurview(66);
|
||||||
|
$success = '删除供应商:';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
$data = $this->mysql_model->get_results(CONTACT,'(id in('.$id.'))');
|
||||||
|
if (count($data) > 0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->mysql_model->get_count(INVOICE,'(isDelete=0) and (buId in('.$id.'))')>0 && str_alert(-1,'不能删除有业务往来的客户或供应商!');
|
||||||
|
$sql = $this->mysql_model->update(CONTACT,$info,'(id in('.$id.'))');
|
||||||
|
if ($sql) {
|
||||||
|
$name = array_column($data,'name');
|
||||||
|
$this->common_model->logs($success.'ID='.$id.' 名称:'.join(',',$name));
|
||||||
|
die('{"status":200,"msg":"success","data":{"msg":"","id":['.$id.']}}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'客户或供应商不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//状态
|
||||||
|
public function disable(){
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$disable = intval($this->input->post('disable',TRUE));
|
||||||
|
$id = str_enhtml($this->input->post('contactIds',TRUE));
|
||||||
|
if (strlen($id) > 0) {
|
||||||
|
$info['disable'] = $disable;
|
||||||
|
$sql = $this->mysql_model->update(CONTACT,$info,'(id in('.$id.'))');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('客户'.$disable==1?'禁用':'启用'.':ID:'.$id.'');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||||
|
strlen($data['cCategory']) < 1 && str_alert(-1,'类别名称不能为空');
|
||||||
|
$data['cLevel'] = (float)$data['cLevel'];
|
||||||
|
$data['taxRate'] = (float)$data['taxRate'];
|
||||||
|
$data['amount'] = (float)$data['amount'];
|
||||||
|
$data['periodMoney'] = (float)$data['periodMoney'];
|
||||||
|
$data['type'] = intval($this->input->get_post('type',TRUE))==10 ? 10 : -10;
|
||||||
|
$data['pinYin'] = $this->lib_pinyin->str2pinyin($data['name']);
|
||||||
|
$data['contact'] = $data['number'].' '.$data['name'];
|
||||||
|
$data['difMoney'] = $data['amount'] - $data['periodMoney'];
|
||||||
|
$data['cCategoryName'] = $this->mysql_model->get_row(CATEGORY,'(id="'.$data['cCategory'].'")','name');
|
||||||
|
if (isset($data['id'])) {
|
||||||
|
$data['id'] = intval($data['id']);
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(isDelete=0) and (id<>'.$data['id'].') and (type='.$data['type'].') and (number="'.$data['number'].'")') > 0 && str_alert(-1,'编号重复');
|
||||||
|
} else {
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(isDelete=0) and (type='.$data['type'].') and (number="'.$data['number'].'")') > 0 && str_alert(-1,'编号重复');
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
25
application/controllers/basedata/customer.php
Normal file
25
application/controllers/basedata/customer.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Customer extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview(62);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exporter(){
|
||||||
|
$name = 'customer_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出客户:'.$name);
|
||||||
|
$skey = str_enhtml($this->input->get('skey',TRUE));
|
||||||
|
$categoryId = intval($this->input->get_post('categoryId',TRUE));
|
||||||
|
$where = $categoryId>0 ? ' and cCategory = '.$categoryId.'' : '';
|
||||||
|
$where .= $skey ? ' and (number like "%'.$skey.'%" or name like "%'.$skey.'%" or linkMans like "%'.$skey.'%")' : '';
|
||||||
|
$data['list'] = $this->mysql_model->get_results(CONTACT,'(isDelete=0) and type=-10 '.$where.' order by id desc');
|
||||||
|
$this->load->view('settings/customer-export',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
110
application/controllers/basedata/deliveryAddr.php
Normal file
110
application/controllers/basedata/deliveryAddr.php
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Deliveryaddr extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//发货地址列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(ADDRESS,'(isDelete=0) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = $row['id'];
|
||||||
|
$v[$arr]['shortName'] = $row['shortName'];
|
||||||
|
$v[$arr]['postalcode'] = $row['postalcode'];
|
||||||
|
$v[$arr]['province'] = $row['province'];
|
||||||
|
$v[$arr]['city'] = $row['city'];
|
||||||
|
$v[$arr]['area'] = $row['area'];
|
||||||
|
$v[$arr]['address'] = $row['address'];
|
||||||
|
$v[$arr]['linkman'] = $row['linkman'];
|
||||||
|
$v[$arr]['phone'] = $row['phone'];
|
||||||
|
$v[$arr]['mobile'] = $row['mobile'];
|
||||||
|
$v[$arr]['isDefault'] = 1;
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(ADDRESS);
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$sql = $this->mysql_model->insert(ADDRESS,$data);
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增地址:'.$data['shortName']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
unset($data['id']);
|
||||||
|
$sql = $this->mysql_model->update(ADDRESS,$data,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->common_model->logs('更新地址:ID='.$id.',名称:'.$data['shortName']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ADDRESS,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
//$this->mysql_model->get_count(INVSA,'(contactid in('.$id.'))')>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(ADDRESS,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除地址:ID='.$id.' 名称:'.$data['shortname']);
|
||||||
|
str_alert(200,'success',array('msg'=>'成功删除'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询
|
||||||
|
public function query(){
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ADDRESS,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['shortName'] = $data['shortName'];
|
||||||
|
$info['data']['postalcode'] = $data['postalcode'];
|
||||||
|
$info['data']['province'] = $data['province'];
|
||||||
|
$info['data']['city'] = $data['city'];
|
||||||
|
$info['data']['area'] = $data['area'];
|
||||||
|
$info['data']['address'] = $data['address'];
|
||||||
|
$info['data']['linkman'] = $data['linkman'];
|
||||||
|
$info['data']['phone'] = $data['phone'];
|
||||||
|
$info['data']['mobile'] = $data['mobile'];
|
||||||
|
$info['data']['isDefault'] = intval($data['isdefault']);
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
str_alert(-1,'地址不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
147
application/controllers/basedata/employee.php
Normal file
147
application/controllers/basedata/employee.php
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Employee extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//员工列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(STAFF,'(isDelete=0) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['birthday'] =$row['birthday'];
|
||||||
|
$v[$arr]['allowNeg'] = false;
|
||||||
|
$v[$arr]['commissionrate'] = $row['commissionrate'];
|
||||||
|
$v[$arr]['creatorId'] = $row['creatorId'];
|
||||||
|
$v[$arr]['deptId'] = $row['deptId'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['email'] = $row['name'];
|
||||||
|
$v[$arr]['empId'] = $row['empId'];
|
||||||
|
$v[$arr]['empType'] = $row['empType'];
|
||||||
|
$v[$arr]['fullId'] = $row['fullId'];
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['leftDate'] = NULL;
|
||||||
|
$v[$arr]['mobile'] = $row['mobile'];
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
$v[$arr]['parentId'] = $row['parentId'];
|
||||||
|
$v[$arr]['sex'] = $row['sex'];
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false; //是否禁用
|
||||||
|
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['total'] = $this->mysql_model->get_count(STAFF);
|
||||||
|
$data['data']['records'] = 3;
|
||||||
|
$data['data']['totalsize'] = 3;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->insert(STAFF,elements(array('name','number'),$data));
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增员工:编号'.$data['number'].' 名称'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->update(STAFF,elements(array('name','number'),$data),'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->common_model->logs('更新员工:编号'.$data['number'].' 名称'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(STAFF,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->mysql_model->get_count(INVOICE,'(isDelete=0) and (salesId='.$id.')')>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(STAFF,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除员工:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',array('msg'=>'成功删除'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//状态
|
||||||
|
public function disable(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = str_enhtml($this->input->post('employeeIds',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(STAFF,'(id='.$id.')');
|
||||||
|
if (count($data) > 0) {
|
||||||
|
$info['disable'] = intval($this->input->post('disable',TRUE));
|
||||||
|
$sql = $this->mysql_model->update(STAFF,$info,'(id in('.$id.'))');
|
||||||
|
if ($sql) {
|
||||||
|
$action = $info['disable']==1 ? '员工禁用' : '员工启用';
|
||||||
|
$this->common_model->logs($action.':ID:'.$id.'名称:'.$data['name']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//名称查询
|
||||||
|
public function findByNumberOrName(){
|
||||||
|
$v = array();
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$where = $skey ? ' and name like "%'.$skey.'%" or number like "%'.$skey.'%"' : '';
|
||||||
|
$offset = $rows*($page-1);
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(STAFF,'(isDelete=0) '.$where.''); //总条数
|
||||||
|
$list = $this->mysql_model->get_results(STAFF,'(isDelete=0) '.$where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||||
|
$where = intval($data['id'])>0 ? 'and (id<>'.$data['id'].')' :'';
|
||||||
|
$this->mysql_model->get_count(STAFF,'(isDelete=0) and (number="'.$data['number'].'") '.$where) > 0 && str_alert(-1,'员工编号重复');
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
63
application/controllers/basedata/import.php
Normal file
63
application/controllers/basedata/import.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Import extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->load->helper('download');
|
||||||
|
}
|
||||||
|
|
||||||
|
//客户
|
||||||
|
public function downloadtemplate1() {
|
||||||
|
$info = read_file('./data/download/customer.xls');
|
||||||
|
$this->common_model->logs('下载文件名:customer.xls');
|
||||||
|
force_download('customer.xls', $info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//供应商
|
||||||
|
public function downloadtemplate2() {
|
||||||
|
$info = read_file('./data/download/vendor.xls');
|
||||||
|
$this->common_model->logs('下载文件名:vendor.xls');
|
||||||
|
force_download('vendor.xls', $info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品
|
||||||
|
public function downloadtemplate3() {
|
||||||
|
$info = read_file('./data/download/goods.xls');
|
||||||
|
$this->common_model->logs('下载文件名:goods.xls');
|
||||||
|
force_download('goods.xls', $info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//客户导入
|
||||||
|
public function findDataImporter() {
|
||||||
|
die('{"status":200,"msg":"success"}');
|
||||||
|
}
|
||||||
|
|
||||||
|
//上传文件
|
||||||
|
public function upload() {
|
||||||
|
die('{"status":200,"msg":"success","data":{"items":[{"id":1294598139109696,"date":"2015-04-25 14:41:35","uploadPath"
|
||||||
|
:"customer_20150425024011.xls","uploadName":"customer_20150425024011.xls","resultPath":"uploadfiles/88887901
|
||||||
|
/customer_20150425024011.xls","resultName":"customer_20150425024011.xls","resultInfo":"商品导入完毕。<br/>商
|
||||||
|
品一共:0条数据,成功导入:0条数据,失败:0条数据。<br/>供应商导入完毕。<br/>供应商一共:0条数据,成功导入:0条数据,失败:0条数据。<br/>客户导入完毕。<br/>客户一共:10条数
|
||||||
|
据,成功导入:10条数据,失败:0条数据。<br/>","status":2,"spendTime":0},{"id":1294598139109659,"date":"2015-04-25 14:40
|
||||||
|
:49","uploadPath":"customer_20150425024011.xls","uploadName":"customer_20150425024011.xls","resultPath"
|
||||||
|
:"uploadfiles/88887901/customer_20150425024011.xls","resultName":"customer_20150425024011.xls","resultInfo"
|
||||||
|
:"商品导入完毕。<br/>商品一共:0条数据,成功导入:0条数据,失败:0条数据。<br/>供应商导入完毕。<br/>供应商一共:0条数据,成功导入:0条数据,失败:0条数据。<br/>客户导入完毕
|
||||||
|
。<br/>客户一共:10条数据,成功导入:10条数据,失败:0条数据。<br/>","status":2,"spendTime":0},{"id":1294597559113847,"date":"2015-04-17
|
||||||
|
16:54:39","uploadPath":"蓝港新系统xls.xls","uploadName":"蓝港新系统xls.xls","resultPath":"uploadfiles/88887901
|
||||||
|
/蓝港新系统xls.xls","resultName":"蓝港新系统xls.xls","resultInfo":"商品导入完毕。<br/>商品一共:557条数据,成功导入:0条数据,失败:557条数据
|
||||||
|
。<br/>(请检查模板是否匹配,建议重新下载模板导入)<br/>供应商导入完毕。<br/>供应商一共:0条数据,成功导入:0条数据,失败:0条数据。<br/>客户导入完毕。<br/>客户一共:0条数
|
||||||
|
据,成功导入:0条数据,失败:0条数据。<br/>","status":2,"spendTime":0}],"totalsize":3}}');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
500
application/controllers/basedata/inventory.php
Normal file
500
application/controllers/basedata/inventory.php
Normal file
|
@ -0,0 +1,500 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Inventory extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->load->library('lib_pinyin');
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$categoryid = intval($this->input->get_post('assistId',TRUE));
|
||||||
|
$barCode = intval($this->input->get_post('barCode',TRUE));
|
||||||
|
$where = '';
|
||||||
|
$where .= $skey ? ' and (name like "%'.$skey.'%" or number like "%'.$skey.'%" or spec like "%'.$skey.'%")' : '';
|
||||||
|
$where .= $barCode ? ' and barCode="'.$barCode.'"' : '';
|
||||||
|
if ($categoryid > 0) {
|
||||||
|
$cid = array_column($this->mysql_model->get_results(CATEGORY,'(1=1) and find_in_set('.$categoryid.',path)'),'id');
|
||||||
|
if (count($cid)>0) {
|
||||||
|
$cid = join(',',$cid);
|
||||||
|
$where .= ' and categoryid in('.$cid.')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$offset = $rows*($page-1);
|
||||||
|
$data['data']['page'] = $page; //当前页
|
||||||
|
$data['data']['records'] = $this->data_model->get_goods($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_goods($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['amount'] = (float)$row['iniamount'];
|
||||||
|
$v[$arr]['barCode'] = $row['barCode'];
|
||||||
|
$v[$arr]['categoryName'] = $row['categoryName'];
|
||||||
|
$v[$arr]['currentQty'] = $row['totalqty']; //当前库存
|
||||||
|
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false; //是否禁用
|
||||||
|
$v[$arr]['discountRate'] = 0;
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['isSerNum'] = intval($row['isSerNum']);
|
||||||
|
$v[$arr]['josl'] = $row['josl'];
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
$v[$arr]['pinYin'] = $row['pinYin'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['locationNo'] = '';
|
||||||
|
$v[$arr]['purPrice'] = $row['purPrice'];
|
||||||
|
$v[$arr]['quantity'] = $row['iniqty'];
|
||||||
|
$v[$arr]['salePrice'] = $row['salePrice'];
|
||||||
|
$v[$arr]['skuClassId'] = $row['skuClassId'];
|
||||||
|
$v[$arr]['spec'] = $row['spec'];
|
||||||
|
$v[$arr]['unitCost'] = $row['iniunitCost'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['unitName'] = $row['unitName'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品选择
|
||||||
|
public function listBySelected() {
|
||||||
|
$v = array();
|
||||||
|
$contactid = intval($this->input->post('contactId',TRUE));
|
||||||
|
$id = intval($this->input->post('ids',TRUE));
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(GOODS,'(isDelete=0) and (disable=0) and id='.$id.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['barCode'] = $row['barCode'];
|
||||||
|
$v[$arr]['categoryName'] = $row['categoryName'];
|
||||||
|
$v[$arr]['currentQty'] = 0; //当前库存
|
||||||
|
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false; //是否禁用
|
||||||
|
$v[$arr]['discountRate'] = 0;
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['isSerNum'] = intval($row['isSerNum']);
|
||||||
|
$v[$arr]['josl'] = '';
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
$v[$arr]['pinYin'] = $row['pinYin'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['locationNo'] = '';
|
||||||
|
$v[$arr]['purPrice'] = $row['purPrice'];
|
||||||
|
$v[$arr]['quantity'] = $row['quantity'];
|
||||||
|
$v[$arr]['salePrice'] = $row['salePrice'];
|
||||||
|
$v[$arr]['skuClassId'] = $row['skuClassId'];
|
||||||
|
$v[$arr]['spec'] = $row['spec'];
|
||||||
|
$v[$arr]['unitCost'] = $row['unitCost'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['unitName'] = $row['unitName'];
|
||||||
|
}
|
||||||
|
$data['data']['result'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取信息
|
||||||
|
public function query() {
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
str_alert(200,'success',$this->get_goods_info($id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//检测编号
|
||||||
|
public function getNextNo() {
|
||||||
|
$skey = str_enhtml($this->input->post('skey',TRUE));
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (number="'.$skey.'")') > 0 && str_alert(-1,'商品编号已经存在');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测条码
|
||||||
|
public function checkBarCode() {
|
||||||
|
$barCode = str_enhtml($this->input->post('barCode',TRUE));
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (barCode="'.$barCode.'")') > 0 && str_alert(-1,'商品条码已经存在');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测规格
|
||||||
|
public function checkSpec() {
|
||||||
|
$spec = str_enhtml($this->input->post('spec',TRUE));
|
||||||
|
$this->mysql_model->get_count(ASSISTSKU,'(isDelete=0) and (skuName="'.$spec.'")') > 0 && str_alert(-1,'商品规格已经存在');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测名称
|
||||||
|
public function checkname() {
|
||||||
|
$skey = str_enhtml($this->input->post('barCode',TRUE));
|
||||||
|
echo '{"status":200,"msg":"success","data":{"number":""}}';
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取图片信息
|
||||||
|
public function getImagesById() {
|
||||||
|
$v = array();
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$list = $this->mysql_model->get_results(GOODS_IMG,'(invId='.$id.') and isDelete=0');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['pid'] = $row['id'];
|
||||||
|
$v[$arr]['status'] = 1;
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['url'] = site_url().'/basedata/inventory/getImage?action=getImage&pid='.$row['id'];
|
||||||
|
$v[$arr]['thumbnailUrl'] = site_url().'/basedata/inventory/getImage?action=getImage&pid='.$row['id'];
|
||||||
|
$v[$arr]['deleteUrl'] = '';
|
||||||
|
$v[$arr]['deleteType'] = '';
|
||||||
|
}
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$data['files'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//上传图片信息
|
||||||
|
public function uploadImages() {
|
||||||
|
require_once './application/libraries/UploadHandler.php';
|
||||||
|
$config = array(
|
||||||
|
'script_url' => base_url().'inventory/uploadimages',
|
||||||
|
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/data/upfile/goods/',
|
||||||
|
'upload_url' => base_url().'data/upfile/goods/',
|
||||||
|
'delete_type' =>'',
|
||||||
|
'print_response' =>false
|
||||||
|
);
|
||||||
|
$uploadHandler = new UploadHandler($config);
|
||||||
|
$list = (array)json_decode(json_encode($uploadHandler->response['files'][0]), true);
|
||||||
|
$newid = $this->mysql_model->insert(GOODS_IMG,$list);
|
||||||
|
$files[0]['pid'] = intval($newid);
|
||||||
|
$files[0]['status'] = 1;
|
||||||
|
$files[0]['size'] = (float)$list['size'];
|
||||||
|
$files[0]['name'] = $list['name'];
|
||||||
|
$files[0]['url'] = site_url().'/basedata/inventory/getImage?action=getImage&pid='.$newid;
|
||||||
|
$files[0]['thumbnailUrl'] = site_url().'/basedata/inventory/getImage?action=getImage&pid='.$newid;
|
||||||
|
$files[0]['deleteUrl'] = '';
|
||||||
|
$files[0]['deleteType'] = '';
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$data['files'] = $files;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存上传图片信息
|
||||||
|
public function addImagesToInv() {
|
||||||
|
$data = $this->input->post('postData');
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$v = $s = array();
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$id = isset($data['id']) ? $data['id'] : 0;
|
||||||
|
!isset($data['files']) || count($data['files']) < 1 && str_alert(-1,'请先添加图片!');
|
||||||
|
foreach($data['files'] as $arr=>$row) {
|
||||||
|
if ($row['status']==1) {
|
||||||
|
$v[$arr]['id'] = $row['pid'];
|
||||||
|
$v[$arr]['invId'] = $id;
|
||||||
|
} else {
|
||||||
|
$s[$arr]['id'] = $row['pid'];
|
||||||
|
$s[$arr]['invId'] = $id;
|
||||||
|
$s[$arr]['isDelete'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->mysql_model->update(GOODS_IMG,array_values($v),'id');
|
||||||
|
$this->mysql_model->update(GOODS_IMG,array_values($s),'id');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
str_alert(-1,'保存失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取图片信息
|
||||||
|
public function getImage() {
|
||||||
|
$id = intval($this->input->get_post('pid',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(GOODS_IMG,'(id='.$id.')');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$url = './data/upfile/goods/'.$data['name'];
|
||||||
|
$info = getimagesize($url);
|
||||||
|
$imgdata = fread(fopen($url,'rb'),filesize($url));
|
||||||
|
header('content-type:'.$info['mime'].'');
|
||||||
|
echo $imgdata;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(69);
|
||||||
|
$data = $this->input->post(NULL,TRUE);
|
||||||
|
if ($data) {
|
||||||
|
$v = '';
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (number="'.$data['number'].'")') > 0 && str_alert(-1,'商品编号重复');
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$info = array(
|
||||||
|
'barCode','baseUnitId','unitName','categoryId','categoryName',
|
||||||
|
'discountRate1','discountRate2','highQty','locationId','pinYin',
|
||||||
|
'locationName','lowQty','name','number','purPrice',
|
||||||
|
'remark','salePrice','spec','vipPrice','wholesalePrice'
|
||||||
|
);
|
||||||
|
$info = elements($info, $data,NULL);
|
||||||
|
$data['id'] = $invId = $this->mysql_model->insert(GOODS,$info);
|
||||||
|
if (strlen($data['propertys'])>0) {
|
||||||
|
$list = (array)json_decode($data['propertys'],true);
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['invId'] = $invId;
|
||||||
|
$v[$arr]['locationId'] = isset($row['locationId'])?$row['locationId']:0;
|
||||||
|
$v[$arr]['qty'] = isset($row['quantity'])?$row['quantity']:0;
|
||||||
|
$v[$arr]['price'] = isset($row['unitCost'])?$row['unitCost']:0;
|
||||||
|
$v[$arr]['amount'] = isset($row['amount'])?$row['amount']:0;
|
||||||
|
$v[$arr]['skuId'] = isset($row['skuId'])?$row['skuId']:0;
|
||||||
|
$v[$arr]['billDate'] = date('Y-m-d');
|
||||||
|
$v[$arr]['billNo'] = '期初数量';
|
||||||
|
$v[$arr]['billType'] = 'INI';
|
||||||
|
$v[$arr]['transTypeName'] = '期初数量';
|
||||||
|
}
|
||||||
|
if (is_array($v)) {
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增商品:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(70);
|
||||||
|
$data = $this->input->post(NULL,TRUE);
|
||||||
|
if ($data) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (id<>'.$id.') and (number="'.$data['number'].'")') > 0 && str_alert(-1,'商品编号重复');
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$info = array(
|
||||||
|
'barCode','baseUnitId','unitName','categoryId','categoryName',
|
||||||
|
'discountRate1','discountRate2','highQty','locationId','pinYin',
|
||||||
|
'locationName','lowQty','name','number','purPrice',
|
||||||
|
'remark','salePrice','spec','vipPrice','wholesalePrice'
|
||||||
|
);
|
||||||
|
$info = elements($info, $data,NULL);
|
||||||
|
$this->mysql_model->update(GOODS,$info,'(id='.$id.')');
|
||||||
|
if (strlen($data['propertys'])>0) {
|
||||||
|
$v = '';
|
||||||
|
$list = (array)json_decode($data['propertys'],true);
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['invId'] = $id;
|
||||||
|
$v[$arr]['locationId'] = isset($row['locationId'])?$row['locationId']:0;
|
||||||
|
$v[$arr]['qty'] = isset($row['quantity'])?$row['quantity']:0;
|
||||||
|
$v[$arr]['price'] = isset($row['unitCost'])?$row['unitCost']:0;
|
||||||
|
$v[$arr]['amount'] = isset($row['amount'])?$row['amount']:0;
|
||||||
|
$v[$arr]['skuId'] = isset($row['skuId'])?$row['skuId']:0;
|
||||||
|
$v[$arr]['billDate'] = date('Y-m-d');
|
||||||
|
$v[$arr]['billNo'] = '期初数量';
|
||||||
|
$v[$arr]['billType'] = 'INI';
|
||||||
|
$v[$arr]['transTypeName'] = '期初数量';
|
||||||
|
}
|
||||||
|
$this->mysql_model->delete(INVOICE_INFO,'(invId='.$id.') and billType="INI"');
|
||||||
|
if (is_array($v)) {
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改商品:ID='.$id.'名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',$this->get_goods_info($id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'修改失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(71);
|
||||||
|
$id = str_enhtml($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_results(GOODS,'(id in('.$id.')) and (isDelete=0)');
|
||||||
|
if (count($data) > 0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->mysql_model->get_count(INVOICE_INFO,'(isDelete=0) and (invId in('.$id.'))')>0 && str_alert(-1,'其中有商品发生业务不可删除');
|
||||||
|
$sql = $this->mysql_model->update(GOODS,$info,'(id in('.$id.'))');
|
||||||
|
if ($sql) {
|
||||||
|
$name = array_column($data,'name');
|
||||||
|
$this->common_model->logs('删除商品:ID='.$id.' 名称:'.join(',',$name));
|
||||||
|
str_alert(200,'success',array('msg'=>'','id'=>'['.$id.']'));
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出
|
||||||
|
public function exporter() {
|
||||||
|
$this->common_model->checkpurview(72);
|
||||||
|
$name = 'goods_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出商品:'.$name);
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$categoryid = intval($this->input->get_post('assistId',TRUE));
|
||||||
|
$barCode = intval($this->input->get_post('barCode',TRUE));
|
||||||
|
$where = '';
|
||||||
|
$where .= $skey ? ' and (name like "%'.$skey.'%" or number like "%'.$skey.'%" or spec like "%'.$skey.'%")' : '';
|
||||||
|
$where .= $barCode ? ' and barCode="'.$barCode.'"' : '';
|
||||||
|
if ($categoryid > 0) {
|
||||||
|
$cid = array_column($this->mysql_model->get_results(CATEGORY,'(1=1) and find_in_set('.$categoryid.',path)'),'id');
|
||||||
|
if (count($cid)>0) {
|
||||||
|
$cid = join(',',$cid);
|
||||||
|
$where .= ' and categoryid in('.$cid.')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['ini'] = $this->data_model->get_invoice_info('and billType="INI"');
|
||||||
|
$data['list'] = $this->data_model->get_goods($where.' order by id desc');
|
||||||
|
$this->load->view('settings/goods-export',$data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//状态
|
||||||
|
public function disable(){
|
||||||
|
$this->common_model->checkpurview(72);
|
||||||
|
$disable = intval($this->input->post('disable',TRUE));
|
||||||
|
$id = str_enhtml($this->input->post('invIds',TRUE));
|
||||||
|
if (strlen($id) > 0) {
|
||||||
|
$info['disable'] = $disable;
|
||||||
|
$sql = $this->mysql_model->update(GOODS,$info,'(id in('.$id.'))');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('商品'.$disable==1?'禁用':'启用'.':ID:'.$id.'');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//库存预警
|
||||||
|
public function listinventoryqtywarning() {
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$where = '';
|
||||||
|
$data['data']['total'] = 1;
|
||||||
|
$data['data']['records'] = $this->data_model->get_inventory($where.' GROUP BY invId HAVING qty>highQty or qty<lowQty',3);
|
||||||
|
$list = $this->data_model->get_inventory($where.' GROUP BY invId HAVING qty>highQty or qty<lowQty');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$qty1 = (float)$row['qty'] - (float)$row['highQty'];
|
||||||
|
$qty2 = (float)$row['qty'] - (float)$row['lowQty'];
|
||||||
|
$v[$arr]['highQty'] = (float)$row['highQty'];
|
||||||
|
$v[$arr]['id'] = intval($row['invId']);
|
||||||
|
$v[$arr]['lowQty'] = (float)$row['lowQty'];
|
||||||
|
$v[$arr]['name'] = $row['invName'];
|
||||||
|
$v[$arr]['number'] = $row['invNumber'];
|
||||||
|
$v[$arr]['warning'] = $qty1 > 0 ? $qty1 : $qty2;
|
||||||
|
$v[$arr]['qty'] = (float)$row['qty'];
|
||||||
|
$v[$arr]['unitName'] = $row['unitName'];
|
||||||
|
$v[$arr]['spec'] = $row['invSpec'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//通过ID 获取商品信息
|
||||||
|
private function get_goods_info($id) {
|
||||||
|
$data = $this->mysql_model->get_row(GOODS,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$data['id'] = intval($id);
|
||||||
|
$data['count'] = 0;
|
||||||
|
$data['unitTypeId'] = intval($data['unitTypeId']);
|
||||||
|
$data['baseUnitId'] = intval($data['baseUnitId']);
|
||||||
|
$data['categoryId'] = intval($data['categoryId']);
|
||||||
|
$data['salePrice'] = (float)$data['salePrice'];
|
||||||
|
$data['vipPrice'] = (float)$data['vipPrice'];
|
||||||
|
$data['purPrice'] = (float)$data['purPrice'];
|
||||||
|
$data['wholesalePrice']= (float)$data['wholesalePrice'];
|
||||||
|
$data['discountRate1'] = (float)$data['discountRate1'];
|
||||||
|
$data['discountRate2'] = (float)$data['discountRate2'];
|
||||||
|
$data['remark'] = $data['remark'];
|
||||||
|
$data['locationId'] = intval($data['locationId']);
|
||||||
|
$data['baseUnitId'] = intval($data['baseUnitId']);
|
||||||
|
$data['unitTypeId'] = intval($data['unitTypeId']);
|
||||||
|
$data['unitId'] = intval($data['unitId']);
|
||||||
|
$data['highQty'] = (float)$data['highQty'];
|
||||||
|
$data['lowQty'] = (float)$data['lowQty'];
|
||||||
|
$data['property'] = $data['property'] ? $data['property'] : NULL;
|
||||||
|
$data['quantity'] = (float)$data['quantity'];
|
||||||
|
$data['isWarranty'] = (float)$data['isWarranty'];
|
||||||
|
$data['advanceDay'] = (float)$data['advanceDay'];
|
||||||
|
$data['unitCost'] = (float)$data['unitCost'];
|
||||||
|
$data['isSerNum'] = (float)$data['isSerNum'];
|
||||||
|
$data['amount'] = (float)$data['amount'];
|
||||||
|
$data['quantity'] = (float)$data['quantity'];
|
||||||
|
$data['unitCost'] = (float)$data['unitCost'];
|
||||||
|
$data['delete'] = intval($data['disable'])==1 ? true : false; //是否禁用
|
||||||
|
$propertys = $this->data_model->get_invoice_info('and (a.invId='.$id.') and a.billType="INI"');
|
||||||
|
foreach ($propertys as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$v[$arr]['inventoryId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['quantity'] = (float)$row['qty'];
|
||||||
|
$v[$arr]['unitCost'] = (float)$row['price'];
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$v[$arr]['skuName'] = '';
|
||||||
|
$v[$arr]['date'] = $row['billDate'];
|
||||||
|
$v[$arr]['tempId'] = 0;
|
||||||
|
$v[$arr]['batch'] = '';
|
||||||
|
$v[$arr]['invSerNumList'] = '';
|
||||||
|
}
|
||||||
|
$data['propertys'] = $v;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
$this->load->library('lib_cn2pinyin');
|
||||||
|
strlen($data['name']) < 1 && str_alert(-1,'商品名称不能为空');
|
||||||
|
strlen($data['number']) < 1 && str_alert(-1,'商品编号不能为空');
|
||||||
|
intval($data['categoryId']) < 1 && str_alert(-1,'商品类别不能为空');
|
||||||
|
intval($data['baseUnitId']) < 1 && str_alert(-1,'计量单位不能为空');
|
||||||
|
$data['lowQty'] = (float)$data['lowQty'];
|
||||||
|
$data['purPrice'] = (float)$data['purPrice'];
|
||||||
|
$data['salePrice'] = (float)$data['salePrice'];
|
||||||
|
$data['vipPrice'] = (float)$data['vipPrice'];
|
||||||
|
$data['discountRate1'] = (float)$data['discountRate1'];
|
||||||
|
$data['discountRate2'] = (float)$data['discountRate2'];
|
||||||
|
$data['wholesalePrice'] = (float)$data['wholesalePrice'];
|
||||||
|
$data['barCode'] = $data['barCode'] ? $data['barCode'] :NULL;
|
||||||
|
$data['remark'] = $data['remark'] ? $data['remark'] :NULL;
|
||||||
|
$data['spec'] = $data['spec'] ? $data['spec'] :NULL;
|
||||||
|
|
||||||
|
|
||||||
|
$data['unitName'] = $this->mysql_model->get_row(UNIT,'(id='.$data['baseUnitId'].')','name');
|
||||||
|
$data['categoryName'] = $this->mysql_model->get_row(CATEGORY,'(id='.$data['categoryId'].')','name');
|
||||||
|
$data['pinYin'] = $this->lib_cn2pinyin->encode($data['name']);
|
||||||
|
!$data['categoryName'] && str_alert(-1,'商品类别不存在');
|
||||||
|
if (strlen($data['propertys'])>0) {
|
||||||
|
$list = (array)json_decode($data['propertys'],true);
|
||||||
|
$storage = $this->mysql_model->get_results(STORAGE,'(disable=0)');
|
||||||
|
$locationId = array_column($storage,'id');
|
||||||
|
$locationName = array_column($storage,'name','id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
!in_array($row['locationId'],$locationId) && str_alert(-1,@$locationName[$row['locationId']].'仓库不存在或不可用!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
118
application/controllers/basedata/invlocation.php
Normal file
118
application/controllers/basedata/invlocation.php
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Invlocation extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//仓库列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(STORAGE,'(isDelete=0) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['address'] = $row['address'];;
|
||||||
|
$v[$arr]['delete'] = $row['disable'] > 0 ? true : false;
|
||||||
|
$v[$arr]['allowNeg'] = false;
|
||||||
|
$v[$arr]['deptId'] = intval($row['deptId']);;
|
||||||
|
$v[$arr]['empId'] = intval($row['empId']);;
|
||||||
|
$v[$arr]['groupx'] = $row['groupx'];
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['locationNo'] = $row['locationNo'];
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['phone'] = $row['phone'];
|
||||||
|
$v[$arr]['type'] = intval($row['type']);
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
$data['data']['total'] = 1;
|
||||||
|
$data['data']['records'] = $this->mysql_model->get_count(STORAGE,'(isDelete=0)');
|
||||||
|
$data['data']['page'] = 1;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(156);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->insert(STORAGE,elements(array('name','locationNo'),$data));
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增仓库:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(157);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['locationId']);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->update(STORAGE,elements(array('name','locationNo'),$data),'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$this->common_model->logs('更新仓库:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(158);
|
||||||
|
$id = intval($this->input->post('locationId',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(STORAGE,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data) > 0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->mysql_model->get_count(INVOICE_INFO,'(locationId='.$id.')')>0 && str_alert(-1,'不能删除有业务关联的仓库!');
|
||||||
|
$sql = $this->mysql_model->update(STORAGE,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除仓库:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//启用禁用
|
||||||
|
public function disable(){
|
||||||
|
$this->common_model->checkpurview(158);
|
||||||
|
$id = intval($this->input->post('locationId',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(STORAGE,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data) > 0) {
|
||||||
|
$info['disable'] = intval($this->input->post('disable',TRUE));
|
||||||
|
$sql = $this->mysql_model->update(STORAGE,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$actton = $info['disable']==0 ? '仓库启用' : '仓库禁用';
|
||||||
|
$this->common_model->logs($actton.':ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
!isset($data['name']) && strlen($data['name']) < 1 && str_alert(-1,'仓库名称不能为空');
|
||||||
|
!isset($data['locationNo']) && strlen($data['locationNo']) < 1 && str_alert(-1,'编号不能为空');
|
||||||
|
$where = isset($data['locationId']) ? ' and (id<>'.$data['locationId'].')' :'';
|
||||||
|
$this->mysql_model->get_count(STORAGE,'(name="'.$data['name'].'") '.$where) > 0 && str_alert(-1,'名称重复');
|
||||||
|
$this->mysql_model->get_count(STORAGE,'(locationNo="'.$data['locationNo'].'") '.$where) > 0 && str_alert(-1,'编号重复');
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
83
application/controllers/basedata/log.php
Normal file
83
application/controllers/basedata/log.php
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Log extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview(83);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$fromDate = str_enhtml($this->input->get_post('fromDate',TRUE));
|
||||||
|
$toDate = str_enhtml($this->input->get_post('toDate',TRUE));
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$user = str_enhtml($this->input->get_post('user',TRUE));
|
||||||
|
$where = $user ? ' and name="'.$user.'"' :'';
|
||||||
|
$where .= $fromDate ? ' and adddate>="'.$fromDate.'"' :'';
|
||||||
|
$where .= $toDate ? ' and adddate<="'.$toDate.'"' :'';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page; //当前页
|
||||||
|
$data['data']['records'] = $this->mysql_model->get_count(LOG,'(1=1) '.$where.''); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->mysql_model->get_results(LOG,'(1=1) '.$where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['loginName'] = $row['loginName'];
|
||||||
|
$v[$arr]['operateTypeName'] = $row['operateTypeName'];
|
||||||
|
$v[$arr]['operateType'] = 255;
|
||||||
|
$v[$arr]['userId'] = $row['userId'];
|
||||||
|
$v[$arr]['log'] = $row['log'];
|
||||||
|
$v[$arr]['modifyTime'] = $row['modifyTime'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initloglist(){
|
||||||
|
$this->load->view('settings/log-initloglist');
|
||||||
|
}
|
||||||
|
|
||||||
|
//用户列表
|
||||||
|
public function queryAllUser(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(ADMIN,'(1=1)');
|
||||||
|
$list = $this->mysql_model->get_results(ADMIN,'(1=1) order by uid desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['userid'] = intval($row['uid']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//操作类型
|
||||||
|
public function queryAllOperateType(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(MENU,'(depth>1)');
|
||||||
|
$menu = array_column($this->mysql_model->get_results(MENU,'(pid=0) order by id desc'),'title','id');
|
||||||
|
$list = $this->mysql_model->get_results(MENU,'(depth>1) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['indexid'] = $row['id'];
|
||||||
|
$v[$arr]['operateTypeName'] = $row['title'].isset($menu[$row['pid']]) ? $menu[$row['pid']] : '';
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
17
application/controllers/basedata/resultInfo.php
Normal file
17
application/controllers/basedata/resultInfo.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class ResultInfo extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$this->load->view('settings/resultInfo');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
137
application/controllers/basedata/settAcct.php
Normal file
137
application/controllers/basedata/settAcct.php
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Settacct extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//结算账户列表
|
||||||
|
public function index(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(ACCOUNT,'(isDelete=0) order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['date'] = $row['date'];
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['del'] = false;
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['number'] = $row['number'];
|
||||||
|
$v[$arr]['type'] = intval($row['type']);
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(ACCOUNT,'(isDelete=0)');
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询
|
||||||
|
public function query(){
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ACCOUNT,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['date'] = $data['date'];
|
||||||
|
$info['data']['amount'] = (float)$data['amount'];
|
||||||
|
$info['data']['del'] = false;
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['name'] = $data['name'];
|
||||||
|
$info['data']['number'] = $data['number'];
|
||||||
|
$info['data']['type'] = intval($data['type']);
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当前余额
|
||||||
|
public function findAmountOver(){
|
||||||
|
$ids = str_enhtml($this->input->post('ids',TRUE));
|
||||||
|
if (strlen($ids)>0) {
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->data_model->get_account('',' and a.id in('.$ids.')');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['amountOver'] = (float)$row['amount'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['totalsize'] = $this->data_model->get_account('',' and a.id in('.$ids.')',3);
|
||||||
|
die(json_encode($data));
|
||||||
|
} else {
|
||||||
|
str_alert(200,'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(160);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = elements(array('name','number','amount','date','type'),$data);
|
||||||
|
$sql = $this->mysql_model->insert(ACCOUNT,$info);
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增账户:'.$data['number'].$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(161);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = elements(array('name','number','amount','date','type'),$data);
|
||||||
|
$sql = $this->mysql_model->update(ACCOUNT,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$data['type'] = intval($data['type']);
|
||||||
|
$this->common_model->logs('更新账户:'.$data['number'].$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(162);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(ACCOUNT,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->mysql_model->get_count(ACCOUNT_INFO,'(isDelete=0) and (accId in('.$id.'))')>0 && str_alert(-1,'账户资料已经被使用');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(ACCOUNT,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除账户:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',array('msg'=>'成功删除'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
$data['amount'] = (float)$data['amount'];
|
||||||
|
$data['type'] = intval($data['type']);
|
||||||
|
!isset($data['name']) || strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
!isset($data['number']) || strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||||
|
$where = isset($data['id']) ? ' and (id<>'.$data['id'].')' :'';
|
||||||
|
$this->mysql_model->get_count(ACCOUNT,'(isDelete=0) and (name="'.$data['name'].'") '.$where) > 0 && str_alert(-1,'名称重复');
|
||||||
|
$this->mysql_model->get_count(ACCOUNT,'(isDelete=0) and (number="'.$data['number'].'") '.$where) > 0 && str_alert(-1,'编号重复');
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
25
application/controllers/basedata/supplier.php
Normal file
25
application/controllers/basedata/supplier.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Supplier extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview(67);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exporter(){
|
||||||
|
$name = 'supplier_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出供应商:'.$name);
|
||||||
|
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||||
|
$categoryId = intval($this->input->get_post('categoryId',TRUE));
|
||||||
|
$where = $skey ? ' and (number like "%'.$skey.'%" or name like "%'.$skey.'%" or linkMans like "%'.$skey.'%")' : '';
|
||||||
|
$where .= $categoryId >0 ? ' and cCategory = '.$categoryId.'' : '';
|
||||||
|
$data['list'] = $this->mysql_model->get_results(CONTACT,'(isDelete=0) and type=10 '.$where.' order by id desc');
|
||||||
|
$this->load->view('settings/vendor-export',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
59
application/controllers/basedata/systemProfile.php
Normal file
59
application/controllers/basedata/systemProfile.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class SystemProfile extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//单据编号
|
||||||
|
public function generateDocNo() {
|
||||||
|
$billType = str_enhtml($this->input->post('billType',TRUE));
|
||||||
|
$info = array(
|
||||||
|
'PUR'=>'CG',
|
||||||
|
'SALE'=>'XS',
|
||||||
|
'TRANSFER'=>'DB',
|
||||||
|
'OO'=>'QTCK',
|
||||||
|
'PO'=>'CGDD',
|
||||||
|
'SO'=>'XSDD',
|
||||||
|
'OI'=>'QTRK',
|
||||||
|
'CADJ'=>'CBTZ',
|
||||||
|
'PAYMENT'=>'FKD',
|
||||||
|
'RECEIPT'=>'SKD',
|
||||||
|
'QTSR'=>'QTSR',
|
||||||
|
'QTZC'=>'QTZC'
|
||||||
|
);
|
||||||
|
if (isset($info[$billType])) {
|
||||||
|
str_alert(200,'success',array('billNo'=>str_no($info[$billType])));
|
||||||
|
}
|
||||||
|
str_alert(-1,'生成失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//系统设置
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(81);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (is_array($data) && count($data)>0) {
|
||||||
|
if ($this->common_model->insert_option('system',$data)) {
|
||||||
|
$this->common_model->logs('系统设置成功');
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'设置失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//切换皮肤
|
||||||
|
public function changeSysSkin() {
|
||||||
|
$this->common_model->checkpurview(81);
|
||||||
|
$skin = $this->input->post('skin',TRUE) ? $this->input->post('skin',TRUE) : 'green';
|
||||||
|
$this->input->set_cookie('skin',$skin,360000);
|
||||||
|
$this->common_model->logs('切换皮肤:'.$skin);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
102
application/controllers/basedata/unit.php
Normal file
102
application/controllers/basedata/unit.php
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Unit extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//单位列表
|
||||||
|
public function index(){
|
||||||
|
$unittypeid = intval($this->input->get_post('unitTypeId',TRUE));
|
||||||
|
$where = $unittypeid>0 ? ' and unittypeid='.$unittypeid.'' :'';
|
||||||
|
$v = '';
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(UNIT,'(isDelete=0) '.$where.' order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['default'] = $row['default']==1 ? true : false;
|
||||||
|
$v[$arr]['guid'] = $row['guid'];
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
$v[$arr]['rate'] = intval($row['rate']);
|
||||||
|
$v[$arr]['isDelete'] = intval($row['isDelete']);
|
||||||
|
$v[$arr]['unitTypeId'] = intval($row['unitTypeId']);
|
||||||
|
}
|
||||||
|
$data['data']['items'] = is_array($v) ? $v : '';
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(UNIT,'(isDelete=0) '.$where.'');
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(78);
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->insert(UNIT,elements(array('name','default'),$data));
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增单位:'.$data['name']);
|
||||||
|
|
||||||
|
die('{"status":200,"msg":"success","data":{"default":false,"guid":"","id":'.$sql.',"isdelete":0,"name":"'.$data['name'].'","rate":1,"unitTypeId":0}}');
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(79);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$sql = $this->mysql_model->update(UNIT,elements(array('name','default'),$data),'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$data['unitTypeId'] = isset($data['unitTypeId']) ? intval($data['unitTypeId']) :0;
|
||||||
|
$data['rate'] = isset($data['rate']) ? intval($data['rate']) :0;
|
||||||
|
$this->mysql_model->update(GOODS,array('unitName'=>$data['name']),'(baseUnitId='.$id.')');
|
||||||
|
$this->common_model->logs('更新单位:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(80);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(UNIT,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (unitId='.$id.')')>0 && str_alert(-1,'该单位已经被使用,不允许删除');
|
||||||
|
$sql = $this->mysql_model->update(UNIT,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除单位:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',array('msg'=>'成功删除','id'=>'['.$id.']'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
!isset($data['name']) || strlen($data['name']) < 1 && str_alert(-1,'单位名称不能为空');
|
||||||
|
$data['default'] = isset($data['default']) && $data['default']== 'true' ? 1 : 0;
|
||||||
|
$where = isset($data['id']) ? ' and (id<>'.$data['id'].')' :'';
|
||||||
|
$this->mysql_model->get_count(UNIT,'(isDelete=0) and (name="'.$data['name'].'")'.$where) && str_alert(-1,'单位名称重复');
|
||||||
|
if (isset($data['id'])) {
|
||||||
|
$this->mysql_model->get_count(GOODS,'(isDelete=0) and (unitId='.$data['id'].')')>0 && str_alert(-1,'该单位已经被使用,不允许更改组');
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
88
application/controllers/basedata/unitType.php
Normal file
88
application/controllers/basedata/unitType.php
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Unittype extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$v = '';
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(UNITTYPE,'(isDelete=0) order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['entries'] = array();
|
||||||
|
$v[$arr]['guid'] = '';
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['name'] = $row['name'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = is_array($v) ? $v : '';
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(UNITTYPE,'(isDelete=0)');
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$data['name'] = $name = $this->input->post('name',TRUE);
|
||||||
|
strlen($name) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
$this->mysql_model->get_count(UNITTYPE,'(name="'.$name.'")') && str_alert(-1,'单位组名称重复');
|
||||||
|
$sql = $this->mysql_model->insert(UNITTYPE,$data);
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $sql;
|
||||||
|
$this->common_model->logs('新增单位组:'.$name);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function update(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$name = str_enhtml($this->input->post('name',TRUE));
|
||||||
|
$info = $this->mysql_model->get_row(UNITTYPE,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($info)>0) {
|
||||||
|
strlen($name) < 1 && str_alert(-1,'名称不能为空');
|
||||||
|
$this->mysql_model->get_count(UNITTYPE,'(isDelete=0) and (id<>'.$id.') and (name="'.$name.'")') > 0 && str_alert(-1,'单位组名称重复');
|
||||||
|
$sql = $this->mysql_model->update(UNITTYPE,array('name'=>$name),'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$data['id'] = $id;
|
||||||
|
$data['name'] = $name;
|
||||||
|
$data['entries'] = array();
|
||||||
|
$data['guid'] = '';
|
||||||
|
$this->common_model->logs('更新单位组:'.$data['name']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'更新失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete(){
|
||||||
|
$this->common_model->checkpurview(59);
|
||||||
|
$id = intval($this->input->post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(UNITTYPE,'(id='.$id.') and (isDelete=0)');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->mysql_model->get_count(UNIT,'(isDelete=0) and (unittypeid='.$id.')')>0 && str_alert(-1,'发生业务不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$sql = $this->mysql_model->update(UNITTYPE,$info,'(id='.$id.')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('删除单位组:ID='.$id.' 名称:'.$data['name']);
|
||||||
|
str_alert(200,'success',array('msg'=>'成功删除','id'=>'['.$id.']'));
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
33
application/controllers/basedata/userSetting.php
Normal file
33
application/controllers/basedata/userSetting.php
Normal file
File diff suppressed because one or more lines are too long
65
application/controllers/home.php
Normal file
65
application/controllers/home.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Home extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$data['uid'] = $this->jxcsys['uid'];
|
||||||
|
$data['name'] = $this->jxcsys['name'];
|
||||||
|
$data['username'] = $this->jxcsys['username'];
|
||||||
|
$data['system'] = $this->common_model->get_option('system');
|
||||||
|
$this->load->view('index',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//右边内容
|
||||||
|
public function main(){
|
||||||
|
$this->load->view('main');
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改个人信息
|
||||||
|
public function set_password(){
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
$info['userpwd'] = md5($data['newPassword']);
|
||||||
|
$info['mobile'] = $data['buyerMobile'];
|
||||||
|
$info['name'] = $data['buyerName'];
|
||||||
|
$this->mysql_model->get_count(ADMIN,'(uid<>'.$this->jxcsys['uid'].') and mobile='.$info['mobile'].'') >0 && str_alert(-1,'该手机号已被使用,请更换手机号码');
|
||||||
|
$sql = $this->mysql_model->update(ADMIN,$info,'(uid='.$this->jxcsys['uid'].')');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('密码修改成功 UID:'.$this->jxcsys['uid'].' 真实姓名改为:'.$info['name']);
|
||||||
|
str_alert(200,'密码修改成功');
|
||||||
|
}
|
||||||
|
str_alert(-1,'设置独立密码失败,请稍候重试!');
|
||||||
|
} else {
|
||||||
|
$data = $this->mysql_model->get_row(ADMIN,'(uid='.$this->jxcsys['uid'].')');
|
||||||
|
$this->load->view('set_password',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//清理缓存
|
||||||
|
public function clear(){
|
||||||
|
if ($this->mysql_model->clean()) {
|
||||||
|
die('1');
|
||||||
|
} else {
|
||||||
|
die('0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Services(){
|
||||||
|
die('jQuery110202928952066617039_1430920204305({"status":200,"msg":"success","data":[{"msgid":"20000000122"
|
||||||
|
,"msglinkcolor":"d9254a","msglink":"","msgtitle":"售后热线服务时间临时调整通知(5.6-5.8)>>"},{"msgid":"20000000119"
|
||||||
|
,"msglinkcolor":"d9254a","msglink":"index.html","msgtitle"
|
||||||
|
:"推荐送ipad mini,购买就返利>>"},{"msgid":"20000000115","msglinkcolor":"d9254a","msglink":"","msgtitle":">>"},{"msgid":"20000000068","msglinkcolor":"d9254a","msglink":"","msgtitle":">
|
||||||
|
>"}]})');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
21
application/controllers/inventory.php
Normal file
21
application/controllers/inventory.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Inventory extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//¿â´æ²éѯ
|
||||||
|
public function index() {
|
||||||
|
$this->load->view('inventory');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
69
application/controllers/login.php
Normal file
69
application/controllers/login.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Login extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
!token(1) && die('token验证失败');
|
||||||
|
!isset($data['username']) || strlen($data['username']) < 1 && die('用户名不能为空');
|
||||||
|
!isset($data['userpwd']) || strlen($data['userpwd']) < 1 && die('密码不能为空');
|
||||||
|
if ($data['username']=='test1') {
|
||||||
|
$user = $this->mysql_model->get_row(ADMIN,'(username="'.$data['username'].'")');
|
||||||
|
if (count($user)>0) {
|
||||||
|
$data['jxcsys']['uid'] = $user['uid'];
|
||||||
|
$data['jxcsys']['name'] = $user['name'];
|
||||||
|
$data['jxcsys']['username'] = $user['username'];
|
||||||
|
$data['jxcsys']['login'] = 'jxc';
|
||||||
|
if (isset($data['ispwd']) && $data['ispwd'] == 1) {
|
||||||
|
$this->input->set_cookie('username',$data['username'],3600000);
|
||||||
|
$this->input->set_cookie('userpwd',$data['userpwd'],3600000);
|
||||||
|
}
|
||||||
|
$this->input->set_cookie('ispwd',$data['ispwd'],3600000);
|
||||||
|
$this->session->set_userdata($data);
|
||||||
|
$this->common_model->logs('登陆成功 用户名:'.$data['username']);
|
||||||
|
die('1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user = $this->mysql_model->get_row(ADMIN,'(username="'.$data['username'].'") or (mobile="'.$data['username'].'") ');
|
||||||
|
if (count($user)>0) {
|
||||||
|
$user['status']!=1 && die('账号被锁定');
|
||||||
|
if ($user['userpwd'] == md5($data['userpwd'])) {
|
||||||
|
$data['jxcsys']['uid'] = $user['uid'];
|
||||||
|
$data['jxcsys']['name'] = $user['name'];
|
||||||
|
$data['jxcsys']['username'] = $user['username'];
|
||||||
|
$data['jxcsys']['login'] = 'jxc';
|
||||||
|
if (isset($data['ispwd']) && $data['ispwd'] == 1) {
|
||||||
|
$this->input->set_cookie('username',$data['username'],3600000);
|
||||||
|
$this->input->set_cookie('userpwd',$data['userpwd'],3600000);
|
||||||
|
}
|
||||||
|
$this->input->set_cookie('ispwd',$data['ispwd'],3600000);
|
||||||
|
$this->session->set_userdata($data);
|
||||||
|
$this->common_model->logs('登陆成功 用户名:'.$data['username']);
|
||||||
|
die('1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
die('账号或密码错误');
|
||||||
|
} else {
|
||||||
|
$this->load->view('login',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function out(){
|
||||||
|
$this->session->sess_destroy();
|
||||||
|
redirect(site_url('login'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function code(){
|
||||||
|
$this->load->library('lib_code');
|
||||||
|
$this->lib_code->image();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
24
application/controllers/prints.php
Normal file
24
application/controllers/prints.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Prints extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function print_settings_voucher() {
|
||||||
|
$this->load->view('print/print-settings-voucher');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
2005
application/controllers/report.php
Normal file
2005
application/controllers/report.php
Normal file
File diff suppressed because it is too large
Load diff
163
application/controllers/right.php
Normal file
163
application/controllers/right.php
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Right extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview(82);
|
||||||
|
}
|
||||||
|
|
||||||
|
//用户数检测
|
||||||
|
public function isMaxShareUser() {
|
||||||
|
die('{"status":200,"data":{"totalUserNum":1000,"shareTotal":1},"msg":"success"}');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//用户列表
|
||||||
|
public function queryAllUser() {
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$list = $this->mysql_model->get_results(ADMIN,'(1=1) order by roleid');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['share'] = intval($row['status']) > 0 ? true : false;
|
||||||
|
$v[$arr]['admin'] = $row['roleid'] > 0 ? false : true;
|
||||||
|
$v[$arr]['userId'] = intval($row['uid']);
|
||||||
|
$v[$arr]['isCom'] = intval($row['status']);
|
||||||
|
$v[$arr]['role'] = intval($row['roleid']);
|
||||||
|
$v[$arr]['userName'] = $row['username'];
|
||||||
|
$v[$arr]['realName'] = $row['name'];
|
||||||
|
$v[$arr]['shareType'] = intval($row['status']);
|
||||||
|
$v[$arr]['mobile'] = $row['mobile'];
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
$data['data']['shareTotal'] = $this->mysql_model->get_count(ADMIN);
|
||||||
|
$data['data']['totalsize'] = $data['data']['shareTotal'];
|
||||||
|
$data['data']['corpID'] = 0;
|
||||||
|
$data['data']['totalUserNum'] = 1000;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断用户名是否存在
|
||||||
|
public function queryUserByName() {
|
||||||
|
$data = str_enhtml($this->input->get_post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
$user = $this->mysql_model->get_row(ADMIN,'(username="'.$data['userName'].'")');
|
||||||
|
if (count($user)>0) {
|
||||||
|
$info['share'] = true;
|
||||||
|
$info['email'] = '';
|
||||||
|
$info['userId'] = $user['uid'];
|
||||||
|
$info['userMobile'] = $user['mobile'];
|
||||||
|
$info['userName'] = $user['username'];
|
||||||
|
str_alert(200,'success',$info);
|
||||||
|
}
|
||||||
|
str_alert(502,'用户名不存在');
|
||||||
|
}
|
||||||
|
str_alert(502,'用户名不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增用户
|
||||||
|
public function adduser() {
|
||||||
|
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
!isset($data['userNumber']) || strlen($data['userNumber'])<1 && str_alert(-1,'用户名不能为空');
|
||||||
|
!isset($data['password']) || strlen($data['password'])<1 && str_alert(-1,'密码不能为空');
|
||||||
|
$this->mysql_model->get_count(ADMIN,'(username="'.$data['userNumber'].'")')>0 && str_alert(-1,'用户名已经存在');
|
||||||
|
$this->mysql_model->get_count(ADMIN,'(mobile='.$data['userMobile'].')') >0 && str_alert(-1,'该手机号已被使用');
|
||||||
|
$info = array(
|
||||||
|
'username' => $data['userNumber'],
|
||||||
|
'userpwd' => md5($data['password']),
|
||||||
|
'name' => $data['userName'],
|
||||||
|
'mobile' => $data['userMobile']
|
||||||
|
);
|
||||||
|
$sql = $this->mysql_model->insert(ADMIN,$info);
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('新增用户:'.$data['userNumber']);
|
||||||
|
die('{"status":200,"msg":"注册成功","userNumber":"'.$data['userNumber'].'"}');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新权限
|
||||||
|
public function addrights2Outuser() {
|
||||||
|
$data = str_enhtml($this->input->get_post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
!isset($data['userName']) || strlen($data['userName'])<1 && str_alert(-1,'用户名不能为空');
|
||||||
|
!isset($data['rightid']) && str_alert(-1,'参数错误');
|
||||||
|
$sql = $this->mysql_model->update(ADMIN,array('lever'=>$data['rightid']),'(username="'.$data['userName'].'")');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('更新权限:'.$data['userName']);
|
||||||
|
str_alert(200,'操作成功');
|
||||||
|
}
|
||||||
|
str_alert(-1,'操作失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'添加失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
//详细权限设置
|
||||||
|
public function queryalluserright() {
|
||||||
|
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||||
|
if (strlen($userName)>0) {
|
||||||
|
$lever = $this->mysql_model->get_row(ADMIN,'(username="'.$userName.'")','lever');
|
||||||
|
$lever = strlen($lever)>0 ? explode(',',$lever) : array();
|
||||||
|
} else {
|
||||||
|
$lever = array();
|
||||||
|
}
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$data['data']['totalsize'] = $this->mysql_model->get_count(MENU,'(isDelete=0)');
|
||||||
|
$list = $this->mysql_model->get_results(MENU,'(isDelete=0) order by path');
|
||||||
|
$name = array_column($list,'name','id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['fobjectid'] = $row['parentId']>0 ? $row['parentId'] : $row['id'];
|
||||||
|
$v[$arr]['fobject'] = $row['parentId']>0 ? @$name[$row['parentId']] : $row['name'];
|
||||||
|
$v[$arr]['faction'] = $row['level'] > 1 ? $row['name'] : '查询';
|
||||||
|
$v[$arr]['fright'] = in_array($row['id'],$lever) ? 1 : 0;
|
||||||
|
$v[$arr]['frightid'] = intval($row['id']);
|
||||||
|
}
|
||||||
|
$data['data']['items'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//停用
|
||||||
|
public function auth2UserCancel(){
|
||||||
|
$data = str_enhtml($this->input->get_post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
!isset($data['userName']) && str_alert(-1,'用户名不能为空');
|
||||||
|
$data['userName'] == 'admin' && str_alert(-1,'管理员不可操作');
|
||||||
|
$sql = $this->mysql_model->update(ADMIN,array('status'=>0),'(username="'.$data['userName'].'")');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('用户停用:'.$data['userName']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'停用失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'停用失败');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//启用
|
||||||
|
public function auth2User(){
|
||||||
|
$data = str_enhtml($this->input->get_post(NULL,TRUE));
|
||||||
|
if (is_array($data)&&count($data)>0) {
|
||||||
|
!isset($data['userName']) && str_alert(-1,'用户名不能为空');
|
||||||
|
$data['userName'] == 'admin' && str_alert(-1,'管理员不可操作');
|
||||||
|
$sql = $this->mysql_model->update(ADMIN,array('status'=>1),'(username="'.$data['userName'].'")');
|
||||||
|
if ($sql) {
|
||||||
|
$this->common_model->logs('用户启用:'.$data['userName']);
|
||||||
|
str_alert(200,'success',$data);
|
||||||
|
}
|
||||||
|
str_alert(-1,'启用失败');
|
||||||
|
}
|
||||||
|
str_alert(-1,'启用失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
19
application/controllers/sales.php
Normal file
19
application/controllers/sales.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Sales extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sales_search() {
|
||||||
|
$this->load->view('sales/sales-search');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
1211
application/controllers/scm/invOi.php
Normal file
1211
application/controllers/scm/invOi.php
Normal file
File diff suppressed because it is too large
Load diff
521
application/controllers/scm/invPu.php
Normal file
521
application/controllers/scm/invPu.php
Normal file
|
@ -0,0 +1,521 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class InvPu extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initPur':
|
||||||
|
$this->common_model->checkpurview(2);
|
||||||
|
$this->load->view('scm/invPu/initPur');
|
||||||
|
break;
|
||||||
|
case 'editPur':
|
||||||
|
$this->common_model->checkpurview(1);
|
||||||
|
$this->load->view('scm/invPu/initPur');
|
||||||
|
break;
|
||||||
|
case 'initPurList':
|
||||||
|
$this->common_model->checkpurview(1);
|
||||||
|
$this->load->view('scm/invPu/initPurList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->common_model->checkpurview(1);
|
||||||
|
$this->purList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function purList() {
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$sidx = str_enhtml($this->input->get_post('sidx',TRUE));
|
||||||
|
$sord = str_enhtml($this->input->get_post('sord',TRUE));
|
||||||
|
$transType = intval($this->input->get_post('transType',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$order = $sidx ? $sidx.' '.$sord :' a.id desc';
|
||||||
|
$where = ' and a.billType="PUR"';
|
||||||
|
$where .= $transType>0 ? ' and a.transType='.$transType : '';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by '.$order.' limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['checkName'] = $row['checkName'];
|
||||||
|
$v[$arr]['checked'] = intval($row['checked']);
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['hxStateCode'] = intval($row['hxStateCode']);
|
||||||
|
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||||
|
$v[$arr]['transType'] = intval($row['transType']);
|
||||||
|
$v[$arr]['rpAmount'] = (float)abs($row['rpAmount']);
|
||||||
|
$v[$arr]['contactName'] = $row['contactNo'].' '.$row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['totalAmount'] = (float)abs($row['totalAmount']);
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['transTypeName']= $row['transTypeName'];
|
||||||
|
$v[$arr]['disEditable'] = 0;
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出
|
||||||
|
public function exportInvPu(){
|
||||||
|
$this->common_model->checkpurview(5);
|
||||||
|
$name = 'purchase_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出采购单据:'.$name);
|
||||||
|
$sidx = str_enhtml($this->input->get_post('sidx',TRUE));
|
||||||
|
$sord = str_enhtml($this->input->get_post('sord',TRUE));
|
||||||
|
$transType = intval($this->input->get_post('transType',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$order = $sidx ? $sidx.' '.$sord :' a.id desc';
|
||||||
|
$where = ' and a.billType="PUR"';
|
||||||
|
$where .= $transType>0 ? ' and a.transType='.$transType : '';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$where1 = ' and a.billType="PUR"';
|
||||||
|
$where1 .= $transType>0 ? ' and a.transType='.$transType : '';
|
||||||
|
$where1 .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where1 .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by '.$order.'');
|
||||||
|
$data['list2'] = $this->data_model->get_invoice_info($where1.' order by a.billDate');
|
||||||
|
$this->load->view('scm/invpu/exportInvPu',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(2);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = elements(array(
|
||||||
|
'billNo',
|
||||||
|
'billType',
|
||||||
|
'transType',
|
||||||
|
'transTypeName',
|
||||||
|
'buId',
|
||||||
|
'billDate',
|
||||||
|
'description',
|
||||||
|
'totalQty',
|
||||||
|
'amount',
|
||||||
|
'arrears',
|
||||||
|
'rpAmount',
|
||||||
|
'totalAmount',
|
||||||
|
'hxStateCode',
|
||||||
|
'totalArrears',
|
||||||
|
'disRate',
|
||||||
|
'disAmount',
|
||||||
|
'uid',
|
||||||
|
'userName',
|
||||||
|
'accId',
|
||||||
|
'modifyTime'
|
||||||
|
),$data);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
$this->invoice_info($iid,$data);
|
||||||
|
$this->account_info($iid,$data);
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增购货 单据编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($iid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addnew(){
|
||||||
|
$this->add();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改保存
|
||||||
|
public function updateInvPu(){
|
||||||
|
$this->common_model->checkpurview(3);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = $this->validform((array)json_decode($data, true));
|
||||||
|
$info = elements(array(
|
||||||
|
'billType',
|
||||||
|
'transType',
|
||||||
|
'transTypeName',
|
||||||
|
'buId',
|
||||||
|
'billDate',
|
||||||
|
'description',
|
||||||
|
'totalQty',
|
||||||
|
'amount',
|
||||||
|
'arrears',
|
||||||
|
'rpAmount',
|
||||||
|
'totalAmount',
|
||||||
|
'hxStateCode',
|
||||||
|
'totalArrears',
|
||||||
|
'disRate',
|
||||||
|
'disAmount',
|
||||||
|
'uid',
|
||||||
|
'userName',
|
||||||
|
'accId',
|
||||||
|
'modifyTime'
|
||||||
|
),$data);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$data['id'].')');
|
||||||
|
$this->invoice_info($data['id'],$data);
|
||||||
|
$this->account_info($data['id'],$data);
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改购货单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$data['id']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的数据不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取修改信息
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(1);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and billType="PUR"',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$s = $v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['billType'] = $data['billType'];
|
||||||
|
$info['data']['modifyTime'] = $data['modifyTime'];
|
||||||
|
$info['data']['checkName'] = $data['checkName'];
|
||||||
|
$info['data']['transType'] = intval($data['transType']);
|
||||||
|
$info['data']['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$info['data']['totalTaxAmount'] = (float)$data['totalTaxAmount'];
|
||||||
|
$info['data']['billStatus'] = intval($data['billStatus']);
|
||||||
|
$info['data']['disRate'] = (float)$data['disRate'];
|
||||||
|
$info['data']['disAmount'] = (float)$data['disAmount'];
|
||||||
|
$info['data']['amount'] = (float)abs($data['amount']);
|
||||||
|
$info['data']['rpAmount'] = (float)abs($data['rpAmount']);
|
||||||
|
$info['data']['arrears'] = (float)abs($data['arrears']);
|
||||||
|
$info['data']['userName'] = $data['userName'];
|
||||||
|
$info['data']['checked'] = intval($data['checked']);
|
||||||
|
$info['data']['status'] = intval($data['checked'])==1 ? 'view' : 'edit'; //edit
|
||||||
|
$info['data']['totalDiscount'] = (float)$data['totalDiscount'];
|
||||||
|
$info['data']['totalTax'] = (float)$data['totalTax'];
|
||||||
|
$info['data']['totalAmount'] = (float)abs($data['totalAmount']);
|
||||||
|
$info['data']['description'] = $data['description'];
|
||||||
|
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||||
|
$v[$arr]['srcOrderEntryId'] = $row['srcOrderEntryId'];
|
||||||
|
$v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||||
|
$v[$arr]['srcOrderId'] = $row['srcOrderId'];
|
||||||
|
$v[$arr]['goods'] = $row['invNumber'].' '.$row['invName'].' '.$row['invSpec'];
|
||||||
|
$v[$arr]['invName'] = $row['invNumber'];
|
||||||
|
$v[$arr]['qty'] = (float)abs($row['qty']);
|
||||||
|
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||||
|
$v[$arr]['taxAmount'] = (float)abs($row['taxAmount']);
|
||||||
|
$v[$arr]['price'] = (float)$row['price'];
|
||||||
|
$v[$arr]['tax'] = (float)$row['tax'];
|
||||||
|
$v[$arr]['taxRate'] = (float)$row['taxRate'];
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
$v[$arr]['deduction'] = (float)$row['deduction'];
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['invNumber'] = $row['invNumber'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$v[$arr]['skuName'] = '';
|
||||||
|
}
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
$info['data']['accId'] = (float)$data['accId'];
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$s[$arr]['invoiceId'] = intval($id);
|
||||||
|
$s[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$s[$arr]['buId'] = intval($row['buId']);
|
||||||
|
$s[$arr]['billType'] = $row['billType'];
|
||||||
|
$s[$arr]['transType'] = $row['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $row['transTypeName'];
|
||||||
|
$s[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$s[$arr]['accId'] = intval($row['accId']);
|
||||||
|
$s[$arr]['account'] = $row['accountNumber'].''.$row['accountName'];
|
||||||
|
$s[$arr]['payment'] = (float)abs($row['payment']);
|
||||||
|
$s[$arr]['wayId'] = (float)$row['wayId'];
|
||||||
|
$s[$arr]['way'] = $row['categoryName'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
}
|
||||||
|
$info['data']['accounts'] = $s;
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//打印
|
||||||
|
public function toPdf() {
|
||||||
|
$this->common_model->checkpurview(85);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and billType="PUR"',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data['num'] = 8;
|
||||||
|
$data['system'] = $this->common_model->get_option('system');
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') order by id');
|
||||||
|
$data['countpage'] = ceil(count($list)/$data['num']);
|
||||||
|
foreach($list as $arr=>$row) {
|
||||||
|
$data['list'][] = array(
|
||||||
|
'i'=>$arr + 1,
|
||||||
|
'goods'=>$row['invNumber'].' '.$row['invName'],
|
||||||
|
'invSpec'=>$row['invSpec'],
|
||||||
|
'qty'=>abs($row['qty']),
|
||||||
|
'price'=>$row['price'],
|
||||||
|
'discountRate'=>$row['discountRate']>0?$row['discountRate']:'',
|
||||||
|
'deduction'=>$row['deduction']>0?$row['deduction']:'',
|
||||||
|
'amount'=>$row['amount'],
|
||||||
|
'locationName'=>$row['locationName']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ob_start();
|
||||||
|
$this->load->view('scm/invPu/toPdf',$data);
|
||||||
|
$content = ob_get_clean();
|
||||||
|
require_once('./application/libraries/html2pdf/html2pdf.php');
|
||||||
|
try {
|
||||||
|
$html2pdf = new HTML2PDF('P', 'A4', 'tr');
|
||||||
|
$html2pdf->setDefaultFont('javiergb');
|
||||||
|
$html2pdf->pdf->SetDisplayMode('fullpage');
|
||||||
|
$html2pdf->writeHTML($content, '');
|
||||||
|
$html2pdf->Output('invPur_'.date('ymdHis').'.pdf');
|
||||||
|
}catch(HTML2PDF_exception $e) {
|
||||||
|
echo $e;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//购购单删除
|
||||||
|
public function delete() {
|
||||||
|
$this->common_model->checkpurview(4);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and billType="PUR"');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data['checked'] >0 && str_alert(-1,'已审核的不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->mysql_model->update(INVOICE_INFO,$info,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除购货订单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
(float)$data['arrears'] < 0 || !is_numeric($data['arrears']) && str_alert(-1,'本次欠款要为数字,请输入有效数字!');
|
||||||
|
(float)$data['disRate'] < 0 || !is_numeric($data['disRate']) && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||||
|
(float)$data['rpAmount'] < 0 || !is_numeric($data['rpAmount']) && str_alert(-1,'本次收款要为数字,请输入有效数字!');
|
||||||
|
(float)$data['amount'] < (float)$data['rpAmount'] && str_alert(-1,'本次付款不能大于折后金额!');
|
||||||
|
(float)$data['amount'] < (float)$data['disAmount'] && str_alert(-1,'折扣额不能大于合计金额!');
|
||||||
|
|
||||||
|
if (isset($data['id'])&&intval($data['id'])>0) {
|
||||||
|
$data['id'] = intval($data['id']);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$data['id'].') and billType="PUR" and isDelete=0'); //修改的时候判断
|
||||||
|
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
$invoice['checked']>0 && str_alert(-1,'审核后不可修改');
|
||||||
|
$data['billNo'] = $invoice['billNo'];
|
||||||
|
} else {
|
||||||
|
$data['billNo'] = str_no('CG'); //修改的时候屏蔽
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['billType'] = 'PUR';
|
||||||
|
$data['transType'] = intval($data['transType']);
|
||||||
|
$data['transTypeName'] = $data['transType']==150501 ? '购货' : '退货';
|
||||||
|
$data['buId'] = intval($data['buId']);
|
||||||
|
$data['billDate'] = $data['date'];
|
||||||
|
$data['description'] = $data['description'];
|
||||||
|
$data['totalQty'] = (float)$data['totalQty'];
|
||||||
|
if ($data['transType']==150501) {
|
||||||
|
$data['amount'] = abs($data['amount']);
|
||||||
|
$data['arrears'] = abs($data['arrears']);
|
||||||
|
$data['rpAmount'] = abs($data['rpAmount']);
|
||||||
|
$data['totalAmount'] = abs($data['totalAmount']);
|
||||||
|
} else {
|
||||||
|
$data['amount'] = -abs($data['amount']);
|
||||||
|
$data['arrears'] = -abs($data['arrears']);
|
||||||
|
$data['rpAmount'] = -abs($data['rpAmount']);
|
||||||
|
$data['totalAmount'] = -abs($data['totalAmount']);
|
||||||
|
}
|
||||||
|
$data['hxStateCode'] = $data['rpAmount']==$data['amount'] ? 2 : ($data['rpAmount']>0 ? 1 : 0);
|
||||||
|
$data['totalArrears'] = (float)$data['totalArrears'];
|
||||||
|
$data['disRate'] = (float)$data['disRate'];
|
||||||
|
$data['disAmount'] = (float)$data['disAmount'];
|
||||||
|
$data['uid'] = $this->jxcsys['uid'];
|
||||||
|
$data['userName'] = $this->jxcsys['name'];
|
||||||
|
$data['accId'] = (float)$data['accId'];
|
||||||
|
|
||||||
|
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
//选择了结算账户 需要验证
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
(float)$row['payment'] < 0 || !is_numeric($row['payment']) && str_alert(-1,'结算金额要为数字,请输入有效数字!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//供应商验证
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(id='.intval($data['buId']).')')<1 && str_alert(-1,'购货单位不存在');
|
||||||
|
|
||||||
|
//商品录入验证
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
$system = $this->common_model->get_option('system');
|
||||||
|
if ($system['requiredCheckStore']==1) { //开启检查时判断
|
||||||
|
$item = array();
|
||||||
|
foreach($data['entries'] as $k=>$v){
|
||||||
|
!isset($v['invId']) && str_alert(-1,'参数错误');
|
||||||
|
!isset($v['locationId']) && str_alert(-1,'参数错误');
|
||||||
|
if(!isset($item[$v['invId'].'-'.$v['locationId']])){
|
||||||
|
$item[$v['invId'].'-'.$v['locationId']] = $v;
|
||||||
|
}else{
|
||||||
|
$item[$v['invId'].'-'.$v['locationId']]['qty'] += $v['qty']; //同一仓库 同一商品 数量累加
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||||
|
} else {
|
||||||
|
$item = $data['entries'];
|
||||||
|
}
|
||||||
|
$storage = array_column($this->mysql_model->get_results(STORAGE,'(disable=0)'),'id');
|
||||||
|
foreach ($item as $arr=>$row) {
|
||||||
|
!isset($row['invId']) && str_alert(-1,'参数错误');
|
||||||
|
!isset($row['locationId']) && str_alert(-1,'参数错误');
|
||||||
|
(float)$row['qty'] < 0 || !is_numeric($row['qty']) && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||||
|
(float)$row['price'] < 0 || !is_numeric($row['price']) && str_alert(-1,'商品销售单价要为数字,请输入有效数字!');
|
||||||
|
(float)$row['discountRate'] < 0 || !is_numeric($row['discountRate']) && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||||
|
intval($row['locationId']) < 1 && str_alert(-1,'请选择相应的仓库!');
|
||||||
|
!in_array(intval($row['locationId']),$storage) && str_alert(-1,$row['locationName'].'不存在或不可用!');
|
||||||
|
//库存判断
|
||||||
|
if ($system['requiredCheckStore']==1) {
|
||||||
|
if (intval($data['transType'])==150502) { //退货才验证
|
||||||
|
if (isset($inventory[$row['invId']][$row['locationId']])) {
|
||||||
|
$inventory[$row['invId']][$row['locationId']] < (float)$row['qty'] && str_alert(-1,$row['locationName'].$row['invName'].'商品库存不足!');
|
||||||
|
} else {
|
||||||
|
str_alert(-1,$row['invName'].'库存不足!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
private function invoice_info($iid,$data) {
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = intval($iid);
|
||||||
|
$v[$arr]['billNo'] = $data['billNo'];
|
||||||
|
$v[$arr]['buId'] = $data['buId'];
|
||||||
|
$v[$arr]['billDate'] = $data['billDate'];
|
||||||
|
$v[$arr]['billType'] = $data['billType'];
|
||||||
|
$v[$arr]['transType'] = $data['transType'];
|
||||||
|
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
if ($data['transType']==150501) {
|
||||||
|
$v[$arr]['qty'] = abs($row['qty']);
|
||||||
|
$v[$arr]['amount'] = abs($row['amount']);
|
||||||
|
} else {
|
||||||
|
$v[$arr]['qty'] = -abs($row['qty']);
|
||||||
|
$v[$arr]['amount'] = -abs($row['amount']);
|
||||||
|
}
|
||||||
|
$v[$arr]['price'] = abs($row['price']);
|
||||||
|
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||||
|
$v[$arr]['deduction'] = $row['deduction'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
//$v[$arr]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||||
|
// $v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||||
|
// $v[$arr]['srcOrderId'] = intval($row['srcOrderId']);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
if (isset($data['id']) && $data['id']>0) { //修改的时候
|
||||||
|
$this->mysql_model->delete(INVOICE_INFO,'(iid='.$iid.')');
|
||||||
|
}
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
private function account_info($iid,$data) {
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
if (isset($row['accId']) && intval($row['accId'])>0) {
|
||||||
|
$v[$arr]['iid'] = intval($iid);
|
||||||
|
$v[$arr]['billNo'] = $data['billNo'];
|
||||||
|
$v[$arr]['buId'] = $data['buId'];
|
||||||
|
$v[$arr]['billType'] = $data['billType'];
|
||||||
|
$v[$arr]['transType'] = $data['transType'];
|
||||||
|
$v[$arr]['transTypeName'] = $data['transType']==150501 ? '普通采购' : '采购退回';
|
||||||
|
$v[$arr]['payment'] = $data['transType']==150501 ? -$row['payment'] : $row['payment'];
|
||||||
|
$v[$arr]['billDate'] = $data['billDate'];
|
||||||
|
$v[$arr]['accId'] = $row['accId'];
|
||||||
|
$v[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$v[$arr]['settlement'] = $row['settlement'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
if (isset($data['id']) && $data['id']>0) { //修改的时候
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$iid.')');
|
||||||
|
}
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
597
application/controllers/scm/invSa.php
Normal file
597
application/controllers/scm/invSa.php
Normal file
|
@ -0,0 +1,597 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class InvSa extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initSale':
|
||||||
|
$this->common_model->checkpurview(7);
|
||||||
|
$this->load->view('scm/invSa/initSale');
|
||||||
|
break;
|
||||||
|
case 'editSale':
|
||||||
|
$this->common_model->checkpurview(6);
|
||||||
|
$this->load->view('scm/invSa/initSale');
|
||||||
|
break;
|
||||||
|
case 'initSaleList':
|
||||||
|
$this->common_model->checkpurview(6);
|
||||||
|
$this->load->view('scm/invSa/initSaleList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->common_model->checkpurview(6);
|
||||||
|
$this->saleList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saleList(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$sidx = str_enhtml($this->input->get_post('sidx',TRUE));
|
||||||
|
$sord = str_enhtml($this->input->get_post('sord',TRUE));
|
||||||
|
$transType = intval($this->input->get_post('transType',TRUE));
|
||||||
|
$hxState = intval($this->input->get_post('hxState',TRUE));
|
||||||
|
$salesId = intval($this->input->get_post('salesId',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$order = $sidx ? $sidx.' '.$sord :' a.id desc';
|
||||||
|
$where = ' and a.billType="SALE"';
|
||||||
|
$where .= $transType>0 ? ' and a.transType='.$transType : '';
|
||||||
|
$where .= $salesId>0 ? ' and a.salesId='.$salesId : '';
|
||||||
|
$where .= $hxState>0 ? ' and a.hxStateCode='.$hxState : '';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by '.$order.' limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['hxStateCode'] = intval($row['hxStateCode']);
|
||||||
|
$v[$arr]['checkName'] = $row['checkName'];
|
||||||
|
$v[$arr]['checked'] = intval($row['checked']);
|
||||||
|
$v[$arr]['salesId'] = intval($row['salesId']);
|
||||||
|
$v[$arr]['salesName'] = $row['salesName'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['billStatus'] = $row['billStatus'];
|
||||||
|
$v[$arr]['totalQty'] = (float)$row['totalQty'];
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||||
|
$v[$arr]['billStatusName'] = $row['billStatus']==0 ? '未出库' : '全部出库';
|
||||||
|
$v[$arr]['transType'] = intval($row['transType']);
|
||||||
|
$v[$arr]['rpAmount'] = (float)abs($row['rpAmount']);
|
||||||
|
$v[$arr]['contactName'] = $row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['totalAmount'] = (float)abs($row['totalAmount']);
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['transTypeName']= $row['transTypeName'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出
|
||||||
|
public function exportInvSa() {
|
||||||
|
$this->common_model->checkpurview(10);
|
||||||
|
$name = 'sales_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出销售单据:'.$name);
|
||||||
|
$sidx = str_enhtml($this->input->get_post('sidx',TRUE));
|
||||||
|
$sord = str_enhtml($this->input->get_post('sord',TRUE));
|
||||||
|
$transType = intval($this->input->get_post('transType',TRUE));
|
||||||
|
$hxState = intval($this->input->get_post('hxState',TRUE));
|
||||||
|
$salesId = intval($this->input->get_post('salesId',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$order = $sidx ? $sidx.' '.$sord :' a.id desc';
|
||||||
|
$where = ' and billType="SALE"';
|
||||||
|
$where .= $transType>0 ? ' and transType='.$transType : '';
|
||||||
|
$where .= $salesId>0 ? ' and salesId='.$salesId : '';
|
||||||
|
$where .= $hxState>0 ? ' and hxStateCode='.$hxState : '';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
|
||||||
|
$where1 = ' and a.billType="SALE"';
|
||||||
|
$where1 .= $transType>0 ? ' and a.transType='.$transType : '';
|
||||||
|
$where1 .= $salesId>0 ? ' and a.salesId='.$salesId : '';
|
||||||
|
$where1 .= $hxState>0 ? ' and a.hxStateCode='.$hxState : '';
|
||||||
|
$where1 .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where1 .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by '.$order.'');
|
||||||
|
$data['list2'] = $this->data_model->get_invoice_info($where1.' order by billDate');
|
||||||
|
$this->load->view('scm/invSa/exportInvSa',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(7);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = elements(array(
|
||||||
|
'billNo',
|
||||||
|
'billType',
|
||||||
|
'transType',
|
||||||
|
'transTypeName',
|
||||||
|
'buId',
|
||||||
|
'billDate',
|
||||||
|
'description',
|
||||||
|
'totalQty',
|
||||||
|
'amount',
|
||||||
|
'arrears',
|
||||||
|
'rpAmount',
|
||||||
|
'totalAmount',
|
||||||
|
'hxStateCode',
|
||||||
|
'totalArrears',
|
||||||
|
'disRate',
|
||||||
|
'disAmount',
|
||||||
|
'salesId',
|
||||||
|
'uid',
|
||||||
|
'userName',
|
||||||
|
'accId',
|
||||||
|
'modifyTime'
|
||||||
|
),$data);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
$this->invoice_info($iid,$data);
|
||||||
|
$this->account_info($iid,$data);
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误或者提交的是空数据');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增销货 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($iid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addNew(){
|
||||||
|
$this->add();
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updateInvSa(){
|
||||||
|
$this->common_model->checkpurview(8);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$data = $this->validform($data);
|
||||||
|
$info = elements(array(
|
||||||
|
'billType',
|
||||||
|
'transType',
|
||||||
|
'transTypeName',
|
||||||
|
'buId',
|
||||||
|
'billDate',
|
||||||
|
'description',
|
||||||
|
'totalQty',
|
||||||
|
'amount',
|
||||||
|
'arrears',
|
||||||
|
'rpAmount',
|
||||||
|
'totalAmount',
|
||||||
|
'hxStateCode',
|
||||||
|
'totalArrears',
|
||||||
|
'disRate',
|
||||||
|
'disAmount',
|
||||||
|
'salesId',
|
||||||
|
'uid',
|
||||||
|
'userName',
|
||||||
|
'accId',
|
||||||
|
'modifyTime'
|
||||||
|
),$data);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->invoice_info($id,$data);
|
||||||
|
$this->account_info($id,$data);
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误或者提交的是空数据');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改销货 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的数据不为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取修改信息
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(6);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and billType="SALE"',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$s = $v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['cLevel'] = 0;
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['salesId'] = intval($data['salesId']);
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['billType'] = $data['billType'];
|
||||||
|
$info['data']['transType'] = intval($data['transType']);
|
||||||
|
$info['data']['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$info['data']['modifyTime'] = $data['modifyTime'];
|
||||||
|
$info['data']['checkName'] = $data['checkName'];
|
||||||
|
$info['data']['disRate'] = (float)$data['disRate'];
|
||||||
|
$info['data']['disAmount'] = (float)$data['disAmount'];
|
||||||
|
$info['data']['amount'] = (float)abs($data['amount']);
|
||||||
|
$info['data']['rpAmount'] = (float)abs($data['rpAmount']);
|
||||||
|
$info['data']['customerFree'] = (float)$data['customerFree'];
|
||||||
|
$info['data']['arrears'] = (float)abs($data['arrears']);
|
||||||
|
$info['data']['userName'] = $data['userName'];
|
||||||
|
$info['data']['status'] = intval($data['checked'])==1 ? 'view' : 'edit'; //edit
|
||||||
|
$info['data']['totalDiscount'] = (float)$data['totalDiscount'];
|
||||||
|
$info['data']['totalAmount'] = (float)abs($data['totalAmount']);
|
||||||
|
$info['data']['description'] = $data['description'];
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||||
|
$v[$arr]['taxRate'] = (float)$row['taxRate'];
|
||||||
|
$v[$arr]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||||
|
$v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||||
|
$v[$arr]['srcOrderId'] = intval($row['srcOrderId']);
|
||||||
|
$v[$arr]['goods'] = $row['invNumber'].' '.$row['invName'].' '.$row['invSpec'];
|
||||||
|
$v[$arr]['invName'] = $row['invName'];
|
||||||
|
$v[$arr]['qty'] = (float)abs($row['qty']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||||
|
$v[$arr]['taxAmount'] = (float)$row['taxAmount'];
|
||||||
|
$v[$arr]['price'] = (float)$row['price'];
|
||||||
|
$v[$arr]['tax'] = (float)$row['tax'];
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
$v[$arr]['deduction'] = (float)$row['deduction'];
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['invNumber'] = $row['invNumber'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
$info['data']['accId'] = (float)$data['accId'];
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$s[$arr]['invoiceId'] = intval($id);
|
||||||
|
$s[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$s[$arr]['buId'] = intval($row['buId']);
|
||||||
|
$s[$arr]['billType'] = $row['billType'];
|
||||||
|
$s[$arr]['transType'] = $row['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $row['transTypeName'];
|
||||||
|
$s[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$s[$arr]['accId'] = intval($row['accId']);
|
||||||
|
$s[$arr]['account'] = $row['accountNumber'].' '.$row['accountName'];
|
||||||
|
$s[$arr]['payment'] = (float)abs($row['payment']);
|
||||||
|
$s[$arr]['wayId'] = (float)$row['wayId'];
|
||||||
|
$s[$arr]['way'] = $row['categoryName'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
}
|
||||||
|
$info['data']['accounts'] = $s;
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//打印
|
||||||
|
public function toPdf() {
|
||||||
|
$this->common_model->checkpurview(88);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and billType="SALE"',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data['num'] = 8;
|
||||||
|
$data['system'] = $this->common_model->get_option('system');
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') order by id');
|
||||||
|
$data['countpage'] = ceil(count($list)/$data['num']); //共多少页
|
||||||
|
foreach($list as $arr=>$row) {
|
||||||
|
$data['list'][] = array(
|
||||||
|
'i'=>$arr + 1,
|
||||||
|
'goods'=>$row['invNumber'].' '.$row['invName'],
|
||||||
|
'invSpec'=>$row['invSpec'],
|
||||||
|
'qty'=>abs($row['qty']),
|
||||||
|
'price'=>$row['price'],
|
||||||
|
'discountRate'=>$row['discountRate']>0?$row['discountRate']:'',
|
||||||
|
'deduction'=>$row['deduction']>0?$row['deduction']:'',
|
||||||
|
'amount'=>$row['amount'],
|
||||||
|
'locationName'=>$row['locationName']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ob_start();
|
||||||
|
$this->load->view('scm/invSa/toPdf',$data);
|
||||||
|
$content = ob_get_clean();
|
||||||
|
require_once('./application/libraries/html2pdf/html2pdf.php');
|
||||||
|
try {
|
||||||
|
$html2pdf = new HTML2PDF('P', 'A4', 'en');
|
||||||
|
$html2pdf->setDefaultFont('javiergb');
|
||||||
|
$html2pdf->pdf->SetDisplayMode('fullpage');
|
||||||
|
$html2pdf->writeHTML($content, '');
|
||||||
|
$html2pdf->Output('invSa_'.date('ymdHis').'.pdf');
|
||||||
|
}catch(HTML2PDF_exception $e) {
|
||||||
|
echo $e;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete() {
|
||||||
|
$this->common_model->checkpurview(9);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and billType="SALE"');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data['checked'] >0 && str_alert(-1,'已审核的不可删除');
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->mysql_model->update(INVOICE_INFO,$info,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除购货订单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//库存查询
|
||||||
|
public function justIntimeInv() {
|
||||||
|
$v = array();
|
||||||
|
$qty = 0;
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$invid = intval($this->input->get_post('invId',TRUE));
|
||||||
|
$where = $invid > 0 ? ' and a.invId='.$invid.'' : '';
|
||||||
|
$data['data']['total'] = 1;
|
||||||
|
$data['data']['records'] = $this->data_model->get_inventory($where.' GROUP BY locationId',3);
|
||||||
|
$list = $this->data_model->get_inventory($where.' GROUP BY locationId');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$i = $arr + 1;
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
$qty += $v[$arr]['qty'] = (float)$row['qty'];
|
||||||
|
$v[$arr]['locationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['invId'] = $row['invId'];
|
||||||
|
}
|
||||||
|
$v[$i]['locationId'] = 0;
|
||||||
|
$v[$i]['qty'] = $qty;
|
||||||
|
$v[$i]['locationName'] = '合计';
|
||||||
|
$v[$i]['invId'] = 0;
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function findNearSaEmp() {
|
||||||
|
die('{"status":200,"msg":"success","data":{"empId":0}}');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
if (isset($data['id']) && intval($data['id'])>0) {
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$data['id'].') and billType="SALE" and isDelete=0'); //修改的时候判断
|
||||||
|
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
$invoice['checked']>0 && str_alert(-1,'审核后不可修改');
|
||||||
|
$data['billNo'] = $invoice['billNo'];
|
||||||
|
} else {
|
||||||
|
$data['billNo'] = str_no('XS'); //修改的时候屏蔽
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['buId'] = intval($data['buId']);
|
||||||
|
$data['salesId'] = intval($data['salesId']);
|
||||||
|
$data['billType'] = 'SALE';
|
||||||
|
$data['billDate'] = $data['date'];
|
||||||
|
$data['transType'] = intval($data['transType']);
|
||||||
|
$data['transTypeName'] = $data['transType']==150601 ? '销货' : '销退';
|
||||||
|
$data['description'] = $data['description'];
|
||||||
|
$data['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$data['totalTax'] = isset($data['totalTax']) ? (float)$data['totalTax'] : 0;
|
||||||
|
$data['totalTaxAmount'] = isset($data['totalTaxAmount']) ? (float)$data['totalTaxAmount'] : 0;
|
||||||
|
|
||||||
|
if ($data['transType']==150601) {
|
||||||
|
$data['amount'] = abs($data['amount']);
|
||||||
|
$data['arrears'] = abs($data['arrears']);
|
||||||
|
$data['rpAmount'] = abs($data['rpAmount']);
|
||||||
|
$data['totalAmount'] = abs($data['totalAmount']);
|
||||||
|
} else {
|
||||||
|
$data['amount'] = -abs($data['amount']);
|
||||||
|
$data['arrears'] = -abs($data['arrears']);
|
||||||
|
$data['rpAmount'] = -abs($data['rpAmount']);
|
||||||
|
$data['totalAmount'] = -abs($data['totalAmount']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$data['disRate'] = (float)$data['disRate'];
|
||||||
|
$data['disAmount'] = (float)$data['disAmount'];
|
||||||
|
$data['hxStateCode'] = $data['rpAmount']==$data['amount'] ? 2 : ($data['rpAmount']>0 ? 1 : 0);
|
||||||
|
$data['totalArrears'] = (float)$data['totalArrears'];
|
||||||
|
$data['totalDiscount'] = (float)$data['totalDiscount'];
|
||||||
|
$data['customerFree'] = (float)$data['customerFree'];
|
||||||
|
$data['accId'] = (float)$data['accId'];
|
||||||
|
$data['uid'] = $this->jxcsys['uid'];
|
||||||
|
$data['userName'] = $this->jxcsys['name'];
|
||||||
|
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(float)$data['arrears'] < 0 && str_alert(-1,'本次欠款要为数字,请输入有效数字!');
|
||||||
|
(float)$data['disRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||||
|
(float)$data['rpAmount'] < 0 && str_alert(-1,'本次收款要为数字,请输入有效数字!');
|
||||||
|
(float)$data['customerFree'] < 0 && str_alert(-1,'客户承担费用要为数字,请输入有效数字!');
|
||||||
|
//(float)$data['amount'] < (float)$data['rpAmount'] && str_alert(-1,'折扣率要为[0-100]之间数字,请输入有效数字!');
|
||||||
|
//(float)$data['amount'] < (float)$data['disAmount'] && str_alert(-1,'折扣额不能大于合计金额!');
|
||||||
|
|
||||||
|
|
||||||
|
//选择了结算账户 需要验证
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
(float)$row['payment'] < 0 && str_alert(-1,'结算金额要为数字,请输入有效数字!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品录入验证
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
$system = $this->common_model->get_option('system');
|
||||||
|
|
||||||
|
if ($system['requiredCheckStore']==1) { //开启检查时判断
|
||||||
|
$item = array();
|
||||||
|
foreach($data['entries'] as $k=>$v){
|
||||||
|
!isset($v['invId']) && str_alert(-1,'参数错误');
|
||||||
|
!isset($v['locationId']) && str_alert(-1,'参数错误');
|
||||||
|
if(!isset($item[$v['invId'].'-'.$v['locationId']])){
|
||||||
|
$item[$v['invId'].'-'.$v['locationId']] = $v;
|
||||||
|
}else{
|
||||||
|
$item[$v['invId'].'-'.$v['locationId']]['qty'] += $v['qty']; //同一仓库 同一商品 数量累加
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||||
|
} else {
|
||||||
|
$item = $data['entries'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取门店ID
|
||||||
|
$storage = array_column($this->mysql_model->get_results(STORAGE,'(disable=0)'),'id');
|
||||||
|
|
||||||
|
foreach ($item as $arr=>$row) {
|
||||||
|
!isset($row['invId']) && str_alert(-1,'参数错误');
|
||||||
|
!isset($row['locationId']) && str_alert(-1,'参数错误');
|
||||||
|
(float)$row['qty'] < 0 || !is_numeric($row['qty']) && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||||
|
(float)$row['price'] < 0 || !is_numeric($row['price']) && str_alert(-1,'商品销售单价要为数字,请输入有效数字!');
|
||||||
|
//(float)$row['discountRate'] < 0 || !is_numeric($row['discountRate']) && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||||
|
intval($row['locationId']) < 1 && str_alert(-1,'请选择相应的仓库!');
|
||||||
|
!in_array(intval($row['locationId']),$storage) && str_alert(-1,$row['locationName'].'不存在或不可用!');
|
||||||
|
|
||||||
|
//库存判断
|
||||||
|
if ($system['requiredCheckStore']==1) {
|
||||||
|
if (intval($data['transType'])==150601) { //销售才验证
|
||||||
|
if (isset($inventory[$row['invId']][$row['locationId']])) {
|
||||||
|
$inventory[$row['invId']][$row['locationId']] < (float)$row['qty'] && str_alert(-1,$row['locationName'].$row['invName'].'商品库存不足!');
|
||||||
|
} else {
|
||||||
|
str_alert(-1,$row['invName'].'库存不足!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//供应商验证
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(id='.intval($data['buId']).')')<1 && str_alert(-1,'客户不存在');
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
private function invoice_info($iid,$data) {
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
if (intval($row['invId'])>0) {
|
||||||
|
$v[$arr]['iid'] = $iid;
|
||||||
|
$v[$arr]['billNo'] = $data['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $data['billDate'];
|
||||||
|
$v[$arr]['buId'] = $data['buId'];
|
||||||
|
$v[$arr]['transType'] = $data['transType'];
|
||||||
|
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||||
|
$v[$arr]['billType'] = $data['billType'];
|
||||||
|
$v[$arr]['salesId'] = $data['salesId'];
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||||
|
if ($data['transType']==150601) {
|
||||||
|
$v[$arr]['qty'] = -abs($row['qty']);
|
||||||
|
$v[$arr]['amount'] = abs($row['amount']);
|
||||||
|
} else {
|
||||||
|
$v[$arr]['qty'] = abs($row['qty']);
|
||||||
|
$v[$arr]['amount'] = -abs($row['amount']);
|
||||||
|
}
|
||||||
|
$v[$arr]['price'] = abs($row['price']);
|
||||||
|
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||||
|
$v[$arr]['deduction'] = $row['deduction'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
//$v[$arr]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||||
|
// $v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||||
|
// $v[$arr]['srcOrderId'] = intval($row['srcOrderId']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
if (isset($data['id']) && $data['id']>0) { //修改的时候
|
||||||
|
$this->mysql_model->delete(INVOICE_INFO,'(iid='.$iid.')');
|
||||||
|
}
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//组装数据
|
||||||
|
private function account_info($iid,$data) {
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
if (intval($row['accId'])>0) {
|
||||||
|
$v[$arr]['iid'] = intval($iid);
|
||||||
|
$v[$arr]['billNo'] = $data['billNo'];
|
||||||
|
$v[$arr]['buId'] = $data['buId'];
|
||||||
|
$v[$arr]['billType'] = $data['billType'];
|
||||||
|
$v[$arr]['transType'] = $data['transType'];
|
||||||
|
$v[$arr]['transTypeName'] = $data['transType']==150601 ? '普通销售' : '销售退回';
|
||||||
|
$v[$arr]['billDate'] = $data['billDate'];
|
||||||
|
$v[$arr]['accId'] = $row['accId'];
|
||||||
|
$v[$arr]['payment'] = $data['transType']==150601 ? abs($row['payment']) : -abs($row['payment']);
|
||||||
|
$v[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$v[$arr]['settlement'] = $row['settlement'] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
if (isset($data['id']) && $data['id']>0) { //修改的时候
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$iid.')');
|
||||||
|
}
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
439
application/controllers/scm/invTf.php
Normal file
439
application/controllers/scm/invTf.php
Normal file
|
@ -0,0 +1,439 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class InvTf extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initTf':
|
||||||
|
$this->common_model->checkpurview(145);
|
||||||
|
$this->load->view('scm/invTf/initTf');
|
||||||
|
break;
|
||||||
|
case 'editTf':
|
||||||
|
$this->common_model->checkpurview(146);
|
||||||
|
$this->load->view('scm/invTf/initTf');
|
||||||
|
break;
|
||||||
|
case 'initTfList':
|
||||||
|
$this->common_model->checkpurview(144);
|
||||||
|
$this->load->view('scm/invTf/initTfList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->tfList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//调拨单列表
|
||||||
|
public function tfList(){
|
||||||
|
$this->common_model->checkpurview(144);
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$inLocationId = intval($this->input->get_post('inLocationId',TRUE));
|
||||||
|
$outLocationId = intval($this->input->get_post('outLocationId',TRUE));
|
||||||
|
$where = ' and transType=103091';
|
||||||
|
$where .= $matchCon ? ' and (description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$info = $this->data_model->get_invoice_info($where.' order by id');
|
||||||
|
//查询
|
||||||
|
if ($inLocationId>0 || $outLocationId>0) {
|
||||||
|
$a1 = $this->data_model->get_invoice_info($where.' and locationId='.$inLocationId.' and qty>0 group by iid');
|
||||||
|
$a2 = $this->data_model->get_invoice_info($where.' and locationId='.$outLocationId.' and qty<0 group by iid');
|
||||||
|
$a1 = count($a1)>0 ? array_column($a1, 'iid') : array();
|
||||||
|
$a2 = count($a2)>0 ? array_column($a2, 'iid') : array();
|
||||||
|
$a3 = array_intersect($a1, $a2);
|
||||||
|
if (is_array($a3) && count($a3)>0) {
|
||||||
|
$id = join(',',$a3);
|
||||||
|
$where .= ' and a.id in('.$id.')';
|
||||||
|
} else {
|
||||||
|
$where .= ' and 1<>1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
foreach ($info as $arr1=>$row1) {
|
||||||
|
if ($row1['iid']==$row['id']) {
|
||||||
|
if ($row1['qty']>0) {
|
||||||
|
$qty[$row['id']][] = abs($row1['qty']);
|
||||||
|
$mainUnit[$row['id']][] = $row1['mainUnit'];
|
||||||
|
$goods[$row['id']][] = $row1['invNumber'].' '.$row1['invName'].' '.$row1['invSpec'];
|
||||||
|
$inLocationName[$row['id']][] = $row1['locationName'];
|
||||||
|
} else {
|
||||||
|
$outLocationName[$row['id']][] = $row1['locationName'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['qty'] = $qty[$row['id']];
|
||||||
|
$v[$arr]['goods'] = $goods[$row['id']];
|
||||||
|
$v[$arr]['mainUnit'] = $mainUnit[$row['id']];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['outLocationName'] = $outLocationName[$row['id']];
|
||||||
|
$v[$arr]['inLocationName'] = $inLocationName[$row['id']];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v ;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出
|
||||||
|
public function exportInvTf(){
|
||||||
|
$this->common_model->checkpurview(148);
|
||||||
|
$name = 'db_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出调拨单据:'.$name);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$inLocationId = intval($this->input->get_post('inLocationId',TRUE));
|
||||||
|
$outLocationId = intval($this->input->get_post('outLocationId',TRUE));
|
||||||
|
$where = ' and transType=103091';
|
||||||
|
$where .= $matchCon ? ' and (description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$v = array();
|
||||||
|
$list = $this->data_model->get_invoice_info($where.' and qty>0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = intval($row['iid']);
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['invNumber'] = $row['invNumber'];
|
||||||
|
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||||
|
$v[$arr]['invName'] = $row['invName'];
|
||||||
|
$v[$arr]['goods'] = $row['invNumber'].' '.$row['invName'].' '.$row['invSpec'];
|
||||||
|
$v[$arr]['qty'] = (float)abs($row['qty']);
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['inLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['inLocationName'] = $row['locationName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
}
|
||||||
|
$list = $this->data_model->get_invoice_info($where.' and qty<0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['outLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['outLocationName'] = $row['locationName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询
|
||||||
|
if ($inLocationId>0 || $outLocationId>0) {
|
||||||
|
$a1 = $this->data_model->get_invoice_info($where.' and locationId='.$inLocationId.' and qty>0 group by iid');
|
||||||
|
$a2 = $this->data_model->get_invoice_info($where.' and locationId='.$outLocationId.' and qty<0 group by iid');
|
||||||
|
$a1 = count($a1)>0 ? array_column($a1, 'iid') : array();
|
||||||
|
$a2 = count($a2)>0 ? array_column($a2, 'iid') : array();
|
||||||
|
$a3 = array_intersect($a1, $a2);
|
||||||
|
if (is_array($a3) && count($a3)>0) {
|
||||||
|
$id = join(',',$a3);
|
||||||
|
$where .= ' and a.id in('.$id.')';
|
||||||
|
} else {
|
||||||
|
$where .= ' and 1<>1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||||
|
$data['list2'] = $v;
|
||||||
|
$this->load->view('scm/invtf/exportInvTf',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(145);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$info['billNo'] = str_no('DB');
|
||||||
|
$info['billType'] = 'TRANSFER';
|
||||||
|
$info['transType'] = 103091;
|
||||||
|
$info['transTypeName'] = '调拨单';
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
if (intval($row['invId'])>0) {
|
||||||
|
$s[$arr]['iid'] = $v[$arr]['iid'] = $iid;
|
||||||
|
$s[$arr]['billNo'] = $v[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$s[$arr]['billDate'] = $v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['invId'] = $v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$s[$arr]['skuId'] = $v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$s[$arr]['unitId'] = $v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$s[$arr]['billType'] = $v[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['description'] = $v[$arr]['description'] = $row['description'];
|
||||||
|
$s[$arr]['transTypeName'] = $v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['transType'] = $v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['inLocationId']);
|
||||||
|
$v[$arr]['qty'] = abs($row['qty']);
|
||||||
|
$v[$arr]['entryId'] = 1;
|
||||||
|
$s[$arr]['locationId'] = intval($row['outLocationId']);
|
||||||
|
$s[$arr]['qty'] = -abs($row['qty']);
|
||||||
|
$s[$arr]['entryId'] = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($s) && isset($v)) {
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$s);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增调拨单编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($iid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addNew(){
|
||||||
|
$this->add();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//信息
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(144);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=103091 and isDelete=0');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$info['data']['description'] = $data['description'];
|
||||||
|
$info['data']['userName'] = $data['userName'];
|
||||||
|
$info['data']['status'] = 'edit';
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') and qty>0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
if (intval($row['invId'])>0) {
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['invNumber'] = $row['invNumber'];
|
||||||
|
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||||
|
$v[$arr]['invName'] = $row['invName'];
|
||||||
|
$v[$arr]['goods'] = $row['invNumber'].' '.$row['invName'].' '.$row['invSpec'];
|
||||||
|
$v[$arr]['qty'] = (float)abs($row['qty']);
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['inLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['inLocationName'] = $row['locationName'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') and qty<0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['outLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['outLocationName'] = $row['locationName'];
|
||||||
|
}
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updateInvTf(){
|
||||||
|
$this->common_model->checkpurview(146);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$this->validform($data);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=103091');
|
||||||
|
count($invoice)<1 && str_alert(-1,'该单据不存在');
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$info['billType'] = 'TRANSFER';
|
||||||
|
$info['transType'] = 103091;
|
||||||
|
$info['transTypeName'] = '调拨单';
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['totalQty'] = (float)$data['totalQty'];
|
||||||
|
$info['modifyTime'] = date('Y-m-d H:i:s');
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$this->mysql_model->delete(INVOICE_INFO,'(iid='.$id.')');
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$s[$arr]['iid'] = $v[$arr]['iid'] = $id;
|
||||||
|
$s[$arr]['billNo'] = $v[$arr]['billNo'] = $invoice['billNo'];
|
||||||
|
$s[$arr]['billDate'] = $v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['invId'] = $v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$s[$arr]['skuId'] = $v[$arr]['skuId'] = intval($row['skuId']);
|
||||||
|
$s[$arr]['unitId'] = $v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$s[$arr]['billType'] = $v[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['description'] = $v[$arr]['description'] = $row['description'];
|
||||||
|
$s[$arr]['transTypeName'] = $v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['transType'] = $v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['locationId'] = intval($row['inLocationId']);
|
||||||
|
$v[$arr]['qty'] = abs($row['qty']);
|
||||||
|
$v[$arr]['entryId'] = 1;
|
||||||
|
$s[$arr]['locationId'] = intval($row['outLocationId']);
|
||||||
|
$s[$arr]['qty'] = -abs($row['qty']);
|
||||||
|
$s[$arr]['entryId'] = 2;
|
||||||
|
}
|
||||||
|
if (isset($s) && isset($v)) {
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$v);
|
||||||
|
$this->mysql_model->insert(INVOICE_INFO,$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改调拨单编号:'.$invoice['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($id)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//打印
|
||||||
|
public function toPdf() {
|
||||||
|
$this->common_model->checkpurview(179);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and transType=103091',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$data['num'] = 53;
|
||||||
|
$data['system'] = $this->common_model->get_option('system');
|
||||||
|
$v = array();
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') and qty>0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['i'] = $arr + 1;
|
||||||
|
$v[$arr]['invId'] = intval($row['invId']);
|
||||||
|
$v[$arr]['invNumber'] = $row['invNumber'];
|
||||||
|
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||||
|
$v[$arr]['invName'] = $row['invName'];
|
||||||
|
$v[$arr]['goods'] = $row['invNumber'].' '.$row['invName'].' '.$row['invSpec'];
|
||||||
|
$v[$arr]['qty'] = (float)abs($row['qty']);
|
||||||
|
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||||
|
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||||
|
$v[$arr]['inLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['inLocationName'] = $row['locationName'];
|
||||||
|
}
|
||||||
|
$list = $this->data_model->get_invoice_info('and (iid='.$id.') and qty<0 order by id');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['outLocationId'] = $row['locationId'];
|
||||||
|
$v[$arr]['outLocationName'] = $row['locationName'];
|
||||||
|
}
|
||||||
|
$data['countpage'] = ceil(count($list)/$data['num']); //共多少页
|
||||||
|
$data['list'] = $v;
|
||||||
|
ob_start();
|
||||||
|
$this->load->view('scm/invTf/toPdf',$data);
|
||||||
|
$content = ob_get_clean();
|
||||||
|
require_once('./application/libraries/html2pdf/html2pdf.php');
|
||||||
|
try {
|
||||||
|
$html2pdf = new HTML2PDF('P', 'A4', 'en');
|
||||||
|
$html2pdf->setDefaultFont('javiergb');
|
||||||
|
$html2pdf->pdf->SetDisplayMode('fullpage');
|
||||||
|
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
|
||||||
|
$html2pdf->Output('invTf_'.date('ymdHis').'.pdf');
|
||||||
|
}catch(HTML2PDF_exception $e) {
|
||||||
|
echo $e;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'单据不存在、或者已删除');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete() {
|
||||||
|
$this->common_model->checkpurview(147);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=103091');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->mysql_model->update(INVOICE_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除调拨单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'该单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
//商品录入验证
|
||||||
|
if (is_array($data['entries'])) {
|
||||||
|
$system = $this->common_model->get_option('system');
|
||||||
|
if ($system['requiredCheckStore']==1) { //开启检查时判断
|
||||||
|
$item = array();
|
||||||
|
foreach($data['entries'] as $k=>$v){
|
||||||
|
!isset($v['invId']) && str_alert(-1,'参数错误');
|
||||||
|
!isset($v['outLocationId']) && str_alert(-1,'参数错误');
|
||||||
|
if(!isset($item[$v['invId'].'-'.$v['outLocationId']])){
|
||||||
|
$item[$v['invId'].'-'.$v['outLocationId']] = $v;
|
||||||
|
}else{
|
||||||
|
$item[$v['invId'].'-'.$v['outLocationId']]['qty'] += $v['qty']; //同一仓库 同一商品 数量累加
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||||
|
} else {
|
||||||
|
$item = $data['entries'];
|
||||||
|
}
|
||||||
|
$storage = array_column($this->mysql_model->get_results(STORAGE,'(disable=0)'),'id');
|
||||||
|
foreach ($item as $arr=>$row) {
|
||||||
|
|
||||||
|
(float)$row['qty'] < 0 || !is_numeric($row['qty']) && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||||
|
intval($row['outLocationId']) < 1 && str_alert(-1,'请选择调出仓库仓库!');
|
||||||
|
intval($row['inLocationId']) < 1 && str_alert(-1,'请选择调入仓库仓库!');
|
||||||
|
intval($row['outLocationId']) == intval($row['inLocationId']) && str_alert(-1,'调出仓库不能与调入仓库相同!');
|
||||||
|
!in_array(intval($row['outLocationId']),$storage) && str_alert(-1,$row['outLocationName'].'不存在或不可用!');
|
||||||
|
!in_array(intval($row['inLocationId']),$storage) && str_alert(-1,$row['inLocationName'].'不存在或不可用!');
|
||||||
|
|
||||||
|
//库存判断
|
||||||
|
if ($system['requiredCheckStore']==1) {
|
||||||
|
if (isset($inventory[$row['invId']][$row['outLocationId']])) {
|
||||||
|
$inventory[$row['invId']][$row['outLocationId']] < (float)$row['qty'] && str_alert(-1,$row['outLocationName'].$row['invName'].'商品库存不足!');
|
||||||
|
} else {
|
||||||
|
str_alert(-1,$row['invName'].'库存不足!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
511
application/controllers/scm/ori.php
Normal file
511
application/controllers/scm/ori.php
Normal file
|
@ -0,0 +1,511 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Ori extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initInc':
|
||||||
|
$this->common_model->checkpurview(135);
|
||||||
|
$this->load->view('scm/ori/initInc');
|
||||||
|
break;
|
||||||
|
case 'editInc':
|
||||||
|
$this->common_model->checkpurview(136);
|
||||||
|
$this->load->view('scm/ori/initInc');
|
||||||
|
break;
|
||||||
|
case 'initIncList':
|
||||||
|
$this->common_model->checkpurview(134);
|
||||||
|
$this->load->view('scm/ori/initIncList');
|
||||||
|
break;
|
||||||
|
case 'initExp':
|
||||||
|
$this->common_model->checkpurview(140);
|
||||||
|
$this->load->view('scm/ori/initExp');
|
||||||
|
break;
|
||||||
|
case 'editExp':
|
||||||
|
$this->common_model->checkpurview(141);
|
||||||
|
$this->load->view('scm/ori/initExp');
|
||||||
|
break;
|
||||||
|
case 'initExpList':
|
||||||
|
$this->common_model->checkpurview(139);
|
||||||
|
$this->load->view('scm/ori/initExpList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//其他收入列表
|
||||||
|
public function listInc() {
|
||||||
|
$this->common_model->checkpurview(134);
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$transtypeid = intval($this->input->get_post('transTypeId',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and a.transType=153401';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['checkName'] = $row['checkName'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['transType'] = intval($row['transType']);;
|
||||||
|
$v[$arr]['contactName'] = $row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['totalAmount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['transTypeName']= $row['transTypeName'];
|
||||||
|
$v[$arr]['checked'] = intval($row['checked']);
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出其他收入
|
||||||
|
public function exportInc() {
|
||||||
|
$this->common_model->checkpurview(138);
|
||||||
|
$name = 'other_receipt_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出其他收入单:'.$name);
|
||||||
|
$transtypeid = intval($this->input->get_post('transTypeId',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and a.transType=153401';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$where1 = ' and transType=153401';
|
||||||
|
$where1 .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where1 .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||||
|
$data['list2'] = $this->data_model->get_account_info($where1.' order by billDate');
|
||||||
|
$this->load->view('scm/ori/exportInc',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//其他收入新增
|
||||||
|
public function addInc(){
|
||||||
|
$this->common_model->checkpurview(135);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$info['billNo'] = str_no('QTSR');
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['amount'] = (float)$data['totalAmount'];
|
||||||
|
$info['transTypeName'] = '其他收入';
|
||||||
|
$info['transType'] = '153401';
|
||||||
|
$info['billType'] = 'QTSR';
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['accId'] = (float)$data['accId'];
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $iid;
|
||||||
|
$v[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$v[$arr]['buId'] = $info['buId'];
|
||||||
|
$v[$arr]['billType'] = $info['billType'];
|
||||||
|
$v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['accId'] = $info['accId'];
|
||||||
|
$v[$arr]['payment'] = $row['amount'];
|
||||||
|
$v[$arr]['wayId'] = $row['categoryId'];
|
||||||
|
$v[$arr]['remark'] = $row['description'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增其他收入 单据编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($iid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addNewInc(){
|
||||||
|
$this->addInc();
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updateInc(){
|
||||||
|
$this->common_model->checkpurview(136);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153401');
|
||||||
|
count($invoice)<1 && str_alert(-1,'参数错误');
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['amount'] = (float)$data['totalAmount'];
|
||||||
|
$info['transTypeName'] = '其他收入';
|
||||||
|
$info['transType'] = '153401';
|
||||||
|
$info['billType'] = 'QTSR';
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['accId'] = (float)$data['accId'];
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $id;
|
||||||
|
$v[$arr]['billNo'] = $invoice['billNo'];
|
||||||
|
$v[$arr]['buId'] = $info['buId'];
|
||||||
|
$v[$arr]['billType'] = $info['billType'];
|
||||||
|
$v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['accId'] = $info['accId'];
|
||||||
|
$v[$arr]['payment'] = $row['amount'];
|
||||||
|
$v[$arr]['wayId'] = $row['categoryId'];
|
||||||
|
$v[$arr]['remark'] = $row['description'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改其他收入 单据编号:'.$invoice['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取修改信息
|
||||||
|
public function getIncDetail() {
|
||||||
|
$this->common_model->checkpurview(136);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and transType=153401',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['amount'] = (float)$data['totalAmount'];
|
||||||
|
$info['data']['status'] = 'edit';
|
||||||
|
$info['data']['accId'] = intval($data['accId']);
|
||||||
|
$info['data']['acctName'] = '';
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$v[$arr]['amount'] = (float)$row['payment'];
|
||||||
|
$v[$arr]['categoryId'] = (float)$row['wayId'];
|
||||||
|
$v[$arr]['description'] = $row['remark'];
|
||||||
|
$v[$arr]['categoryName'] = $row['categoryName'];
|
||||||
|
}
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
die(json_encode($info));
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function deleteInc() {
|
||||||
|
$this->common_model->checkpurview(137);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153401');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//其他支出单列表
|
||||||
|
public function listExp() {
|
||||||
|
$this->common_model->checkpurview(139);
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and a.transType=153402';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['checkName'] = $row['checkName'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['amount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['transType'] = intval($row['transType']);;
|
||||||
|
$v[$arr]['contactName'] = $row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['totalAmount'] = (float)$row['amount'];
|
||||||
|
$v[$arr]['userName'] = $row['userName'];
|
||||||
|
$v[$arr]['transTypeName']= '';
|
||||||
|
$v[$arr]['checked'] = intval($row['checked']);
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出其他支出
|
||||||
|
public function exportExp() {
|
||||||
|
$this->common_model->checkpurview(143);
|
||||||
|
$name = 'other_payment_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出其他支出单:'.$name);
|
||||||
|
$transtypeid = intval($this->input->get_post('transTypeId',TRUE));
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and a.transType=153402';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$where1 = ' and transType=153402';
|
||||||
|
$where1 .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where1 .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||||
|
$data['list2'] = $this->data_model->get_account_info($where1.' order by billDate');
|
||||||
|
$this->load->view('scm/ori/exportExp',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addExp(){
|
||||||
|
$this->common_model->checkpurview(140);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$info['billNo'] = str_no('QTZC');
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['amount'] = (float)$data['totalAmount'];
|
||||||
|
$info['transTypeName'] = '其他支出';
|
||||||
|
$info['transType'] = '153402';
|
||||||
|
$info['billType'] = 'QTZC';
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['accId'] = intval($data['accId']);
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $iid;
|
||||||
|
$v[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$v[$arr]['buId'] = $info['buId'];
|
||||||
|
$v[$arr]['billType'] = $info['billType'];
|
||||||
|
$v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['accId'] = $info['accId'];
|
||||||
|
$v[$arr]['payment'] = -$row['amount'];
|
||||||
|
$v[$arr]['wayId'] = $row['categoryId'];
|
||||||
|
$v[$arr]['remark'] = $row['description'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增其他收入 单据编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>intval($iid)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function addNewExp(){
|
||||||
|
$this->addExp();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updateExp(){
|
||||||
|
$this->common_model->checkpurview(141);
|
||||||
|
$postData = $data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153402');
|
||||||
|
count($invoice)<1 && str_alert(-1,'单据不存在');
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['amount'] = (float)$data['totalAmount'];
|
||||||
|
$info['transTypeName'] = '其他支出';
|
||||||
|
$info['transType'] = '153402';
|
||||||
|
$info['billType'] = 'QTZC';
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['accId'] = (float)$data['accId'];
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $id;
|
||||||
|
$v[$arr]['billNo'] = $invoice['billNo'];
|
||||||
|
$v[$arr]['buId'] = $info['buId'];
|
||||||
|
$v[$arr]['billType'] = $info['billType'];
|
||||||
|
$v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$v[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['accId'] = $info['accId'];
|
||||||
|
$v[$arr]['payment'] = -$row['amount'];
|
||||||
|
$v[$arr]['wayId'] = $row['categoryId'];
|
||||||
|
$v[$arr]['remark'] = $row['description'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改其他支出 单据编号:'.$invoice['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$id));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取修改信息
|
||||||
|
public function getExpDetail() {
|
||||||
|
$this->common_model->checkpurview(141);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and transType=153402',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$v = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['amount'] = (float)abs($data['amount']);
|
||||||
|
$info['data']['status'] = 'edit';
|
||||||
|
$info['data']['accId'] = intval($data['accId']);
|
||||||
|
$info['data']['acctName'] = '';
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$v[$arr]['amount'] = (float)$row['payment']>0 ? -abs($row['payment']) : abs($row['payment']);
|
||||||
|
$v[$arr]['categoryId'] = (float)$row['wayId'];
|
||||||
|
$v[$arr]['description'] = $row['remark'];
|
||||||
|
$v[$arr]['categoryName'] = $row['categoryName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
die(json_encode($info));
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function deleteExp() {
|
||||||
|
$this->common_model->checkpurview(142);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153402');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
||||||
|
|
336
application/controllers/scm/payment.php
Normal file
336
application/controllers/scm/payment.php
Normal file
|
@ -0,0 +1,336 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Payment extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initPay':
|
||||||
|
$this->common_model->checkpurview(130);
|
||||||
|
$this->load->view('scm/payment/initPay');
|
||||||
|
break;
|
||||||
|
case 'editPay':
|
||||||
|
$this->common_model->checkpurview(129);
|
||||||
|
$this->load->view('scm/payment/initPay');
|
||||||
|
break;
|
||||||
|
case 'initUnhxList':
|
||||||
|
$this->load->view('scm/payment/initUnhxList');
|
||||||
|
break;
|
||||||
|
case 'initPayList':
|
||||||
|
$this->common_model->checkpurview(129);
|
||||||
|
$this->load->view('scm/payment/initPayList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->common_model->checkpurview(129);
|
||||||
|
$this->payList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function payList(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and a.transType=153101';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['amount'] = (float)$row['rpAmount']; //付款金额
|
||||||
|
$v[$arr]['adjustRate'] = (float)$row['discount']; //整单折扣
|
||||||
|
$v[$arr]['deAmount'] = (float)$row['rpAmount']; //本次付款
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['bDeAmount'] = (float)$row['hxAmount']; //本次核销
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['hxAmount'] = (float)$row['hxAmount']; //本次核销
|
||||||
|
$v[$arr]['contactName'] = $row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function export(){
|
||||||
|
$this->common_model->checkpurview(133);
|
||||||
|
$name = 'payment_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出付款单:'.$name);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$locationId = intval($this->input->get_post('locationId',TRUE));
|
||||||
|
$where = ' and a.transType=153101';
|
||||||
|
$where .= $matchCon ? ' and (b.name like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||||
|
$where1 = ' and transType=153101';
|
||||||
|
$where1 .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where1 .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||||
|
$data['list2'] = $this->data_model->get_account_info($where1.' order by billDate');
|
||||||
|
$this->load->view('scm/payment/export',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(130);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$info['billNo'] = str_no('FKD');
|
||||||
|
$info['billType'] = 'PAYMENT';
|
||||||
|
$info['transTypeName'] = '付款';
|
||||||
|
$info['transType'] = 153101;
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
$rpAmount = 0;
|
||||||
|
if (isset($data['entries']) && count($data['entries'])>0) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $iid;
|
||||||
|
$v[$arr]['billId'] = $row['billId'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['transType'] = $row['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$rpAmount += $v[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(PAYMENT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$amount = 0;
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
$s[$arr]['iid'] = $iid;
|
||||||
|
$s[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$s[$arr]['buId'] = $info['buId'];
|
||||||
|
$s[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['transType'] = $info['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['accId'] = $row['accId'];
|
||||||
|
$s[$arr]['payment'] = -$row['payment'];
|
||||||
|
$s[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$amount += (float)$row['payment'];
|
||||||
|
}
|
||||||
|
if (isset($s)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$info['amount'] = 0;
|
||||||
|
$info['rpAmount'] = $amount;
|
||||||
|
$info['arrears'] = -$amount;
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$iid.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增付款单 单据编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$iid));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function addNew(){
|
||||||
|
$this->add();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updatePayment(){
|
||||||
|
$this->common_model->checkpurview(131);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153101');
|
||||||
|
count($invoice)<1 && str_alert(-1,'单据不存在');
|
||||||
|
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billType'] = 'PAYMENT';
|
||||||
|
$info['transType'] = 153101;
|
||||||
|
$info['transTypeName'] = '付款';
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['modifytime'] = date('Y-m-d H:i:s');
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->delete(PAYMENT_INFO,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$id.')');
|
||||||
|
$rpAmount = 0;
|
||||||
|
if (is_array($data['entries']) && count($data['entries'])>0) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $id;
|
||||||
|
$v[$arr]['billId'] = $row['billId'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['transType'] = $row['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$rpAmount += $v[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(PAYMENT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$amount = 0;
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
$s[$arr]['iid'] = $id;
|
||||||
|
$s[$arr]['billNo'] = $invoice['billNo'];
|
||||||
|
$s[$arr]['buId'] = $info['buId'];
|
||||||
|
$s[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['transType'] = $info['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['accId'] = $row['accId'] ;
|
||||||
|
$s[$arr]['payment'] = -$row['payment'];
|
||||||
|
$s[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$amount += (float)$row['payment'];
|
||||||
|
}
|
||||||
|
if (isset($s)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$info['amount'] = 0;
|
||||||
|
$info['rpAmount'] = $amount;
|
||||||
|
$info['arrears'] = -$amount;
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改收款单 单据编号:'.$invoice['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$id));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//信息
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(129);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and transType=153101',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$s = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['discount'] = (float)$data['discount'];
|
||||||
|
$info['data']['payment'] = (float)$data['rpAmount'];
|
||||||
|
$info['data']['status'] = 'edit';
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$s[$arr]['accId'] = intval($row['accId']);
|
||||||
|
$s[$arr]['accName'] = $row['accountName'];
|
||||||
|
$s[$arr]['payment'] = (float)$row['payment']>0 ? -abs($row['payment']) : abs($row['payment']); //特殊情况
|
||||||
|
$s[$arr]['wayId'] = (float)$row['wayId'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$s[$arr]['wayName'] = $row['categoryName'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
}
|
||||||
|
$info['data']['accounts'] = $s;
|
||||||
|
$v = array();
|
||||||
|
$list = $this->mysql_model->get_results(PAYMENT_INFO,'(iid='.$id.') order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['billId'] = intval($row['billId']);
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['transType'] = $row['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$v[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||||
|
$v[$arr]['type'] = 1;
|
||||||
|
}
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
die(json_encode($info));
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete() {
|
||||||
|
$this->common_model->checkpurview(132);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153101');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
//$this->mysql_model->update(PAYMENT_INFO,$info,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除收款单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在,或已被删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(id='.intval($data['buId']).')')<1 && str_alert(-1,'请选择供应商,供应商不能为空!');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
31
application/controllers/scm/pdImport.php
Normal file
31
application/controllers/scm/pdImport.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class PdImport extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->load->library('excel/excel');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$info = upload('file','./data/upfile/');
|
||||||
|
$xls = $info['path'];
|
||||||
|
$this->excel->setOutputEncoding('utf-8');
|
||||||
|
$this->excel->read($xls);
|
||||||
|
$list = $this->excel->sheets[0]['cells'];
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$data[$arr]['id'] = @$row['1'];
|
||||||
|
$data[$arr]['title'] = @$row['2'];
|
||||||
|
$data[$arr]['nr'] = @$row['3'];
|
||||||
|
}
|
||||||
|
print_r($data);
|
||||||
|
//str_alert(-1,'文件写入失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
332
application/controllers/scm/receipt.php
Normal file
332
application/controllers/scm/receipt.php
Normal file
|
@ -0,0 +1,332 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Receipt extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
$this->jxcsys = $this->session->userdata('jxcsys');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$action = $this->input->get('action',TRUE);
|
||||||
|
switch ($action) {
|
||||||
|
case 'initReceipt':
|
||||||
|
$this->common_model->checkpurview(125);
|
||||||
|
$this->load->view('scm/receipt/initReceipt');
|
||||||
|
break;
|
||||||
|
case 'editReceipt':
|
||||||
|
$this->common_model->checkpurview(124);
|
||||||
|
$this->load->view('scm/receipt/initReceipt');
|
||||||
|
break;
|
||||||
|
case 'initUnhxList':
|
||||||
|
$this->load->view('scm/receipt/initUnhxList');
|
||||||
|
break;
|
||||||
|
case 'initReceiptList':
|
||||||
|
$this->common_model->checkpurview(124);
|
||||||
|
$this->load->view('scm/receipt/initReceiptList');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->common_model->checkpurview(124);
|
||||||
|
$this->receiptList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function receiptList(){
|
||||||
|
$v = array();
|
||||||
|
$data['status'] = 200;
|
||||||
|
$data['msg'] = 'success';
|
||||||
|
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||||
|
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$where = ' and transType=153001';
|
||||||
|
$where .= $matchCon ? ' and (contactName like "%'.$matchCon.'%" or description like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$offset = $rows * ($page-1);
|
||||||
|
$data['data']['page'] = $page;
|
||||||
|
$data['data']['records'] = $this->data_model->get_invoice($where,3); //总条数
|
||||||
|
$data['data']['total'] = ceil($data['data']['records']/$rows); //总分页数
|
||||||
|
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$offset.','.$rows.'');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['id'] = intval($row['id']);
|
||||||
|
$v[$arr]['amount'] = (float)$row['rpAmount'];
|
||||||
|
$v[$arr]['adjustRate'] = (float)$row['discount']; //整单折扣
|
||||||
|
$v[$arr]['deAmount'] = (float)$row['rpAmount']; //本次预收款
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['bDeAmount'] = (float)$row['hxAmount']; //本次核销
|
||||||
|
$v[$arr]['hxAmount'] = (float)$row['hxAmount']; //本次核销
|
||||||
|
$v[$arr]['contactName'] = $row['contactName'];
|
||||||
|
$v[$arr]['description'] = $row['description'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
}
|
||||||
|
$data['data']['rows'] = $v;
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exportReceipt(){
|
||||||
|
$this->common_model->checkpurview(128);
|
||||||
|
$name = 'receipt_record_'.date('YmdHis').'.xls';
|
||||||
|
sys_csv($name);
|
||||||
|
$this->common_model->logs('导出收款单:'.$name);
|
||||||
|
$matchCon = str_enhtml($this->input->get_post('matchCon',TRUE));
|
||||||
|
$beginDate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||||
|
$endDate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||||
|
$locationId = intval($this->input->get_post('locationId',TRUE));
|
||||||
|
$where = ' and transType=153001';
|
||||||
|
$where .= $matchCon ? ' and (contactName like "%'.$matchCon.'%" or billNo like "%'.$matchCon.'%")' : '';
|
||||||
|
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||||
|
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||||
|
$data['list1'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||||
|
$data['list2'] = $this->data_model->get_account_info($where.' order by billDate');
|
||||||
|
$this->load->view('scm/receipt/exportReceipt',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//新增
|
||||||
|
public function add(){
|
||||||
|
$this->common_model->checkpurview(125);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$info['billNo'] = str_no('SKD');
|
||||||
|
$info['billType'] = 'RECEIPT';
|
||||||
|
$info['transType'] = 153001;
|
||||||
|
$info['transTypeName'] = '收款';
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$iid = $this->mysql_model->insert(INVOICE,$info);
|
||||||
|
$rpAmount = 0;
|
||||||
|
if (is_array($data['entries']) && count($data['entries'])>0) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $iid;
|
||||||
|
$v[$arr]['billId'] = $row['billId'];
|
||||||
|
$v[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$v[$arr]['transType'] = $info['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$rpAmount += $v[$arr]['nowCheck'] = (float)$row->nowCheck;
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(RECEIPT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$amount = 0;
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
$s[$arr]['iid'] = $iid;
|
||||||
|
$s[$arr]['billNo'] = $info['billNo'];
|
||||||
|
$s[$arr]['buId'] = $info['buId'];
|
||||||
|
$s[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['transType'] = $info['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['accId'] = $row['accId'];
|
||||||
|
$s[$arr]['payment'] = (float)$row['payment'];
|
||||||
|
$s[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$amount += (float)$row['payment'];
|
||||||
|
}
|
||||||
|
if (isset($s)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$info['amount'] = 0;
|
||||||
|
$info['rpAmount'] = $amount;
|
||||||
|
$info['arrears'] = -$amount;
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$iid.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('新增收款单 单据编号:'.$info['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$iid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function addnew(){
|
||||||
|
$this->add();
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
public function updateReceipt(){
|
||||||
|
$this->common_model->checkpurview(126);
|
||||||
|
$data = $this->input->post('postData',TRUE);
|
||||||
|
if (strlen($data)>0) {
|
||||||
|
$data = (array)json_decode($data, true);
|
||||||
|
$this->validform($data);
|
||||||
|
$id = intval($data['id']);
|
||||||
|
$invoice = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153001');
|
||||||
|
count($invoice)<1 && str_alert(-1,'单据不存在');
|
||||||
|
$info['buId'] = intval($data['buId']);
|
||||||
|
$info['billType'] = 'RECEIPT';
|
||||||
|
$info['billDate'] = $data['date'];
|
||||||
|
$info['transType'] = 153001;
|
||||||
|
$info['transTypeName'] = '收款';
|
||||||
|
$info['description'] = $data['description'];
|
||||||
|
$info['uid'] = $this->jxcsys['uid'];
|
||||||
|
$info['userName'] = $this->jxcsys['name'];
|
||||||
|
$info['modifytime'] = date('Y-m-d H:i:s');
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->delete(RECEIPT_INFO,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->delete(ACCOUNT_INFO,'(iid='.$id.')');
|
||||||
|
$rpAmount = 0;
|
||||||
|
if (isset($data['entries']) && count($data['entries'])>0) {
|
||||||
|
foreach ($data['entries'] as $arr=>$row) {
|
||||||
|
$v[$arr]['iid'] = $id;
|
||||||
|
$v[$arr]['billId'] = $row['billId'];
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['transType'] = $row['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$rpAmount += $v[$arr]['nowCheck'] = (float)$row->nowCheck;
|
||||||
|
}
|
||||||
|
if (isset($v)) {
|
||||||
|
$this->mysql_model->insert(RECEIPT_INFO,$v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$amount = 0;
|
||||||
|
if (isset($data['accounts']) && count($data['accounts'])>0) {
|
||||||
|
foreach ($data['accounts'] as $arr=>$row) {
|
||||||
|
$s[$arr]['iid'] = $id;
|
||||||
|
$s[$arr]['billNo'] = $invoice['billNo'];
|
||||||
|
$s[$arr]['buId'] = $info['buId'];
|
||||||
|
$s[$arr]['billType'] = $info['billType'];
|
||||||
|
$s[$arr]['transType'] = $info['transType'];
|
||||||
|
$s[$arr]['transTypeName'] = $info['transTypeName'];
|
||||||
|
$s[$arr]['billDate'] = $info['billDate'];
|
||||||
|
$s[$arr]['accId'] = $row['accId'];
|
||||||
|
$s[$arr]['payment'] = (float)$row['payment'];
|
||||||
|
$s[$arr]['wayId'] = $row['wayId'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$amount += (float)$row['payment'];
|
||||||
|
}
|
||||||
|
if (isset($s)) {
|
||||||
|
$this->mysql_model->insert(ACCOUNT_INFO,$s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$info['amount'] = 0;
|
||||||
|
$info['rpAmount'] = $amount;
|
||||||
|
$info['arrears'] = -$amount;
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'SQL错误回滚');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('修改收款单 单据编号:'.$invoice['billNo']);
|
||||||
|
str_alert(200,'success',array('id'=>$id));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//信息
|
||||||
|
public function update() {
|
||||||
|
$this->common_model->checkpurview(124);
|
||||||
|
$id = intval($this->input->get_post('id',TRUE));
|
||||||
|
$data = $this->data_model->get_invoice('and (a.id='.$id.') and transType=153001',1);
|
||||||
|
if (count($data)>0) {
|
||||||
|
$s = array();
|
||||||
|
$info['status'] = 200;
|
||||||
|
$info['msg'] = 'success';
|
||||||
|
$info['data']['id'] = intval($data['id']);
|
||||||
|
$info['data']['buId'] = intval($data['buId']);
|
||||||
|
$info['data']['contactName'] = $data['contactName'];
|
||||||
|
$info['data']['date'] = $data['billDate'];
|
||||||
|
$info['data']['billNo'] = $data['billNo'];
|
||||||
|
$info['data']['discount'] = (float)$data['discount'];
|
||||||
|
$info['data']['payment'] = (float)$data['payment'];
|
||||||
|
$info['data']['status'] = 'edit';
|
||||||
|
$info['data']['userName'] = $data['userName'];
|
||||||
|
$accounts = $this->data_model->get_account_info('and (iid='.$id.') order by id');
|
||||||
|
foreach ($accounts as $arr=>$row) {
|
||||||
|
$s[$arr]['accId'] = intval($row['accId']);
|
||||||
|
$s[$arr]['accName'] = $row['accountName'];
|
||||||
|
$s[$arr]['payment'] = (float)$row['payment'];
|
||||||
|
$s[$arr]['wayId'] = (float)$row['wayId'];
|
||||||
|
$s[$arr]['remark'] = $row['remark'];
|
||||||
|
$s[$arr]['wayName'] = $row['categoryName'];
|
||||||
|
$s[$arr]['settlement'] = $row['settlement'];
|
||||||
|
}
|
||||||
|
$info['data']['accounts'] = $s;
|
||||||
|
$v = array();
|
||||||
|
$list = $this->mysql_model->get_results(RECEIPT_INFO,'(iid='.$id.') order by id desc');
|
||||||
|
foreach ($list as $arr=>$row) {
|
||||||
|
$v[$arr]['billId'] = intval($row['billId']);
|
||||||
|
$v[$arr]['billNo'] = $row['billNo'];
|
||||||
|
$v[$arr]['billDate'] = $row['billDate'];
|
||||||
|
$v[$arr]['transType'] = $row['transType'];
|
||||||
|
$v[$arr]['billType'] = $row['billType'];
|
||||||
|
$v[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||||
|
$v[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||||
|
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||||
|
$v[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||||
|
$v[$arr]['type'] = 1;
|
||||||
|
}
|
||||||
|
$info['data']['entries'] = $v;
|
||||||
|
die(json_encode($info));
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'参数错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
public function delete() {
|
||||||
|
$this->common_model->checkpurview(127);
|
||||||
|
$id = intval($this->input->get('id',TRUE));
|
||||||
|
$data = $this->mysql_model->get_row(INVOICE,'(id='.$id.') and transType=153001');
|
||||||
|
if (count($data)>0) {
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$info['isDelete'] = 1;
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$this->mysql_model->update(INVOICE,$info,'(id='.$id.')');
|
||||||
|
//$this->mysql_model->update(RECEIPT_INFO,$info,'(iid='.$id.')');
|
||||||
|
$this->mysql_model->update(ACCOUNT_INFO,$info,'(iid='.$id.')');
|
||||||
|
if ($this->db->trans_status() === FALSE) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
str_alert(-1,'删除失败');
|
||||||
|
} else {
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->common_model->logs('删除收款单 单据编号:'.$data['billNo']);
|
||||||
|
str_alert(200,'success');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str_alert(-1,'单据不存在,或已被删除');
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共验证
|
||||||
|
private function validform($data) {
|
||||||
|
if (isset($data['entries'])&&is_array($data['entries'])) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
str_alert(-1,'提交的是空数据');
|
||||||
|
}
|
||||||
|
$this->mysql_model->get_count(CONTACT,'(id='.intval($data['buId']).')')<1 && str_alert(-1,'请选择客户,客户不能为空!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
24
application/controllers/service.php
Normal file
24
application/controllers/service.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Service extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$this->load->view('service');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function recover() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
275
application/controllers/settings.php
Normal file
275
application/controllers/settings.php
Normal file
|
@ -0,0 +1,275 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Settings extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//客户列表
|
||||||
|
public function customer_list() {
|
||||||
|
$this->common_model->checkpurview(58);
|
||||||
|
$this->load->view('settings/customer-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//客户新增修改
|
||||||
|
public function customer_manage() {
|
||||||
|
$this->load->view('settings/customer-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//供应商列表
|
||||||
|
public function vendor_list() {
|
||||||
|
$this->common_model->checkpurview(63);
|
||||||
|
$this->load->view('settings/vendor-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//供应商新增修改
|
||||||
|
public function vendor_manage() {
|
||||||
|
$this->load->view('settings/vendor-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//联系地址
|
||||||
|
public function addressmanage() {
|
||||||
|
$this->load->view('settings/addressmanage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品列表
|
||||||
|
public function goods_list() {
|
||||||
|
$this->common_model->checkpurview(68);
|
||||||
|
$this->load->view('settings/goods-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//仓库列表
|
||||||
|
public function storage_list() {
|
||||||
|
$this->common_model->checkpurview(155);
|
||||||
|
$this->load->view('settings/storage-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//仓库新增
|
||||||
|
public function storage_manage() {
|
||||||
|
$this->load->view('settings/storage-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//职员列表
|
||||||
|
public function staff_list() {
|
||||||
|
$this->common_model->checkpurview(97);
|
||||||
|
$this->load->view('settings/staff-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//职员新增
|
||||||
|
public function staff_manage() {
|
||||||
|
$this->load->view('settings/staff-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//发货地址管理
|
||||||
|
public function shippingaddress() {
|
||||||
|
$this->load->view('settings/shippingaddress');
|
||||||
|
}
|
||||||
|
|
||||||
|
//发货地址新增修改
|
||||||
|
public function shippingaddressmanage() {
|
||||||
|
$this->load->view('settings/shippingaddressmanage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//账号管理
|
||||||
|
public function settlement_account() {
|
||||||
|
$this->common_model->checkpurview(98);
|
||||||
|
$this->load->view('settings/settlement-account');
|
||||||
|
}
|
||||||
|
|
||||||
|
//账号管理新增修改
|
||||||
|
public function settlementaccount_manager() {
|
||||||
|
$this->load->view('settings/settlementaccount-manager');
|
||||||
|
}
|
||||||
|
|
||||||
|
//系统参数
|
||||||
|
public function system_parameter() {
|
||||||
|
$this->common_model->checkpurview(81);
|
||||||
|
$this->load->view('settings/system-parameter');
|
||||||
|
}
|
||||||
|
|
||||||
|
//计量单位
|
||||||
|
public function unit_list() {
|
||||||
|
$this->common_model->checkpurview(77);
|
||||||
|
$this->load->view('settings/unit-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//计量单位新增修改
|
||||||
|
public function unit_manage() {
|
||||||
|
$this->load->view('settings/unit-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//计量单位新增修改
|
||||||
|
public function unitgroup_manage() {
|
||||||
|
$this->load->view('settings/unitgroup-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//数据备份
|
||||||
|
public function backup() {
|
||||||
|
$this->common_model->checkpurview(84);
|
||||||
|
$this->load->view('settings/backup');
|
||||||
|
}
|
||||||
|
|
||||||
|
//结算方式
|
||||||
|
public function settlement_category_list() {
|
||||||
|
$this->common_model->checkpurview(159);
|
||||||
|
$this->load->view('settings/settlement-category-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//结算方式新增修改
|
||||||
|
public function settlement_category_manager() {
|
||||||
|
$this->load->view('settings/settlement-category-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//客户类别、商品类别、供应商类别、支出、收入
|
||||||
|
public function category_list() {
|
||||||
|
$type = str_enhtml($this->input->get('typeNumber',TRUE));
|
||||||
|
$info = array('customertype'=>73,'supplytype'=>163,'trade'=>167,'paccttype'=>171,'raccttype'=>175);
|
||||||
|
$this->common_model->checkpurview($info[$type]);
|
||||||
|
$this->load->view('settings/category-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//多账户结算
|
||||||
|
public function choose_account() {
|
||||||
|
$this->load->view('settings/choose-account');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//库存预警
|
||||||
|
public function inventory_warning() {
|
||||||
|
$this->load->view('settings/inventory-warning');
|
||||||
|
}
|
||||||
|
|
||||||
|
//日志
|
||||||
|
public function log() {
|
||||||
|
$this->common_model->checkpurview(83);
|
||||||
|
$this->load->view('settings/log-initloglist');
|
||||||
|
}
|
||||||
|
|
||||||
|
//权限
|
||||||
|
public function authority() {
|
||||||
|
$this->common_model->checkpurview(82);
|
||||||
|
$this->load->view('settings/authority');
|
||||||
|
}
|
||||||
|
|
||||||
|
//权限新增
|
||||||
|
public function authority_new() {
|
||||||
|
$this->common_model->checkpurview(82);
|
||||||
|
$this->load->view('settings/authority-new');
|
||||||
|
}
|
||||||
|
|
||||||
|
//功能权限设置
|
||||||
|
public function authority_setting() {
|
||||||
|
$this->common_model->checkpurview(82);
|
||||||
|
$this->load->view('settings/authority-setting');
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据权限设置
|
||||||
|
public function authority_setting_data() {
|
||||||
|
$this->common_model->checkpurview(82);
|
||||||
|
$this->load->view('settings/authority-setting-data');
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品新增修改
|
||||||
|
public function goods_manage() {
|
||||||
|
$this->load->view('settings/goods-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//商品图片上传
|
||||||
|
public function fileupload() {
|
||||||
|
$this->load->view('settings/fileupload');
|
||||||
|
}
|
||||||
|
|
||||||
|
//辅助资料
|
||||||
|
public function assistingprop() {
|
||||||
|
$this->load->view('settings/assistingprop');
|
||||||
|
}
|
||||||
|
|
||||||
|
//辅助资料
|
||||||
|
public function prop_list() {
|
||||||
|
$this->load->view('settings/prop-list');
|
||||||
|
}
|
||||||
|
|
||||||
|
//辅助资料
|
||||||
|
public function propmanage() {
|
||||||
|
$this->load->view('settings/propmanage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//导入
|
||||||
|
public function import() {
|
||||||
|
$this->load->view('settings/import');
|
||||||
|
}
|
||||||
|
|
||||||
|
//选择客户
|
||||||
|
public function select_customer() {
|
||||||
|
$this->load->view('settings/select-customer');
|
||||||
|
}
|
||||||
|
|
||||||
|
//选择商品
|
||||||
|
public function goods_batch() {
|
||||||
|
$this->load->view('settings/goods-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//增值服务
|
||||||
|
public function addedServiceList() {
|
||||||
|
$this->load->view('settings/addedServiceList');
|
||||||
|
}
|
||||||
|
|
||||||
|
//属性
|
||||||
|
public function assistingProp_batch() {
|
||||||
|
$this->load->view('settings/assistingProp-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//属性组合
|
||||||
|
public function assistingPropGroupManage() {
|
||||||
|
$this->load->view('settings/assistingPropGroupManage');
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量选择仓库
|
||||||
|
public function storage_batch() {
|
||||||
|
$this->load->view('settings/storage-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量选择销售人员
|
||||||
|
public function saler_batch() {
|
||||||
|
$this->load->view('settings/saler-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量选择客户
|
||||||
|
public function customer_batch() {
|
||||||
|
$this->load->view('settings/customer-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量选择供应商
|
||||||
|
public function supplier_batch() {
|
||||||
|
$this->load->view('settings/supplier-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量选择账户
|
||||||
|
public function settlementAccount_batch() {
|
||||||
|
$this->load->view('settings/settlementAccount-batch');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//套打模板
|
||||||
|
public function print_templates() {
|
||||||
|
$this->load->view('settings/print-templates');
|
||||||
|
}
|
||||||
|
|
||||||
|
//套打模板新增修改
|
||||||
|
public function print_templates_manage() {
|
||||||
|
$this->load->view('settings/print-templates-manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
36
application/controllers/storage.php
Normal file
36
application/controllers/storage.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Storage extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->common_model->checkpurview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//其他入库列表高级搜索
|
||||||
|
public function other_search() {
|
||||||
|
$this->load->view('storage/other-search');
|
||||||
|
}
|
||||||
|
|
||||||
|
//盘点
|
||||||
|
public function inventory() {
|
||||||
|
$this->common_model->checkpurview(11);
|
||||||
|
$this->load->view('storage/inventory');
|
||||||
|
}
|
||||||
|
|
||||||
|
//其他入库列表高级搜索
|
||||||
|
public function transfers_search () {
|
||||||
|
$this->load->view('storage/transfers-search');
|
||||||
|
}
|
||||||
|
|
||||||
|
//盘点导入
|
||||||
|
public function import () {
|
||||||
|
$this->load->view('storage/import');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file welcome.php */
|
||||||
|
/* Location: ./application/controllers/welcome.php */
|
13
application/core/MY_Loader.php
Normal file
13
application/core/MY_Loader.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class MY_Loader extends CI_Loader {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setpath(){
|
||||||
|
$path = str_replace("\\", "/", FCPATH);
|
||||||
|
$this->_ci_view_paths = array($path.'data/themes/' => TRUE);
|
||||||
|
}
|
||||||
|
}
|
15
application/core/MY_URI.php
Normal file
15
application/core/MY_URI.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class MY_URI extends CI_URI {
|
||||||
|
|
||||||
|
function _explode_segments() {
|
||||||
|
foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val){
|
||||||
|
$val = trim($this->_filter_uri(rawurlencode($val)));
|
||||||
|
if ($val != '') {
|
||||||
|
$this->segments[] = rawurldecode($val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
10
application/core/index.html
Normal file
10
application/core/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
62
application/errors/error_404.php
Normal file
62
application/errors/error_404.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>404 Page Not Found</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
::selection{ background-color: #E13300; color: white; }
|
||||||
|
::moz-selection{ background-color: #E13300; color: white; }
|
||||||
|
::webkit-selection{ background-color: #E13300; color: white; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 40px;
|
||||||
|
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||||
|
color: #4F5155;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #003399;
|
||||||
|
background-color: transparent;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #444;
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 1px solid #D0D0D0;
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0 0 14px 0;
|
||||||
|
padding: 14px 15px 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
color: #002166;
|
||||||
|
display: block;
|
||||||
|
margin: 14px 0 14px 0;
|
||||||
|
padding: 12px 10px 12px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
margin: 10px;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 12px 15px 12px 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="container">
|
||||||
|
<h1><?php echo $heading; ?></h1>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
62
application/errors/error_db.php
Normal file
62
application/errors/error_db.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Database Error</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
::selection{ background-color: #E13300; color: white; }
|
||||||
|
::moz-selection{ background-color: #E13300; color: white; }
|
||||||
|
::webkit-selection{ background-color: #E13300; color: white; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 40px;
|
||||||
|
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||||
|
color: #4F5155;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #003399;
|
||||||
|
background-color: transparent;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #444;
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 1px solid #D0D0D0;
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0 0 14px 0;
|
||||||
|
padding: 14px 15px 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
color: #002166;
|
||||||
|
display: block;
|
||||||
|
margin: 14px 0 14px 0;
|
||||||
|
padding: 12px 10px 12px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
margin: 10px;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 12px 15px 12px 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="container">
|
||||||
|
<h1><?php echo $heading; ?></h1>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
62
application/errors/error_general.php
Normal file
62
application/errors/error_general.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Error</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
::selection{ background-color: #E13300; color: white; }
|
||||||
|
::moz-selection{ background-color: #E13300; color: white; }
|
||||||
|
::webkit-selection{ background-color: #E13300; color: white; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 40px;
|
||||||
|
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||||
|
color: #4F5155;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #003399;
|
||||||
|
background-color: transparent;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #444;
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 1px solid #D0D0D0;
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0 0 14px 0;
|
||||||
|
padding: 14px 15px 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
color: #002166;
|
||||||
|
display: block;
|
||||||
|
margin: 14px 0 14px 0;
|
||||||
|
padding: 12px 10px 12px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
margin: 10px;
|
||||||
|
border: 1px solid #D0D0D0;
|
||||||
|
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 12px 15px 12px 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="container">
|
||||||
|
<h1><?php echo $heading; ?></h1>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
10
application/errors/error_php.php
Normal file
10
application/errors/error_php.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||||
|
|
||||||
|
<h4>A PHP Error was encountered</h4>
|
||||||
|
|
||||||
|
<p>Severity: <?php echo $severity; ?></p>
|
||||||
|
<p>Message: <?php echo $message; ?></p>
|
||||||
|
<p>Filename: <?php echo $filepath; ?></p>
|
||||||
|
<p>Line Number: <?php echo $line; ?></p>
|
||||||
|
|
||||||
|
</div>
|
10
application/errors/index.html
Normal file
10
application/errors/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
297
application/helpers/fun_helper.php
Normal file
297
application/helpers/fun_helper.php
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
function sys_skin() {
|
||||||
|
$ci = &get_instance();
|
||||||
|
return $ci->input->cookie('skin') ? $ci->input->cookie('skin') : 'blue';
|
||||||
|
}
|
||||||
|
|
||||||
|
function skin_url() {
|
||||||
|
$useragent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
$skin_url = 'statics/saas/scm/app2_beta';
|
||||||
|
if (strstr($useragent,'Chrome')) {
|
||||||
|
$skin_url = 'statics/saas/scm/app2_release';
|
||||||
|
}
|
||||||
|
return base_url($skin_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
function token($str='') {
|
||||||
|
$ci = &get_instance();
|
||||||
|
if (!$str) {
|
||||||
|
$data['token'] = md5(time().uniqid());
|
||||||
|
set_cookie('token',$data['token'],120000);
|
||||||
|
return $data['token'];
|
||||||
|
} else {
|
||||||
|
$post = $ci->input->get_post('token');
|
||||||
|
$token = get_cookie('token');
|
||||||
|
if (isset($token) && isset($post) && $post == $token) {
|
||||||
|
set_cookie('token','',120000);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function alert($str,$url='') {
|
||||||
|
$str = $str ? 'alert("'.$str.'");' : '';
|
||||||
|
$url = $url ? 'location.href="'.$url.'";' : 'history.go(-1);';
|
||||||
|
die('<script>'.$str.$url.'</script>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_enhtml($str) {
|
||||||
|
if (!is_array($str)) return addslashes(htmlspecialchars(trim($str)));
|
||||||
|
foreach ($str as $key=>$val) {
|
||||||
|
$str[$key] = str_enhtml($val);
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_nohtml($str) {
|
||||||
|
if (!is_array($str)) return stripslashes(htmlspecialchars_decode(trim($str)));
|
||||||
|
foreach ($str as $key=>$val) {
|
||||||
|
$str[$key] = str_nohtml($val);
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_alert($status=200,$msg='success',$data=array()) {
|
||||||
|
$msg = array(
|
||||||
|
'status' => $status,
|
||||||
|
'msg' => $msg,
|
||||||
|
'data' => $data,
|
||||||
|
);
|
||||||
|
return die(json_encode($msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_check($t0, $t1) {
|
||||||
|
if (strlen($t0)<1) return false;
|
||||||
|
switch($t1){
|
||||||
|
case 'en':$t2 = '/^[a-zA-Z]+$/'; break;
|
||||||
|
case 'cn':$t2 = '/[\u4e00-\u9fa5]+/u'; break;
|
||||||
|
case 'int':$t2 = '/^[0-9]*$/'; break;
|
||||||
|
case 'price':$t2 = '/^\d+(\.\d+)?$/'; break;
|
||||||
|
case 'username':$t2 = '/^[a-zA-Z0-9_]{5,20}$/'; break;
|
||||||
|
case 'password':$t2 = '/^[a-zA-Z0-9_]{6,16}$/'; break;
|
||||||
|
case 'email':$t2 = '/^[\w\-\.]+@[a-zA-Z0-9]+\.(([a-zA-Z0-9]{2,4})|([a-zA-Z0-9]{2,4}\.[a-zA-Z]{2,4}))$/'; break;
|
||||||
|
case 'tel':$t2 = '/^((\(\+?\d{2,3}\))|(\+?\d{2,3}\-))?(\(0?\d{2,3}\)|0?\d{2,3}-)?[1-9]\d{4,7}(\-\d{1,4})?$/'; break;
|
||||||
|
case 'mobile':$t2 = '/^(\+?\d{2,3})?0?1(3\d|5\d|8\d)\d{8}$/'; break;
|
||||||
|
case 'idcard':$t2 = '/(^([\d]{15}|[\d]{18}|[\d]{17}x)$)/'; break;
|
||||||
|
case 'qq':$t2 = '/^[1-9]\d{4,15}$/'; break;
|
||||||
|
case 'url':$t2 = '/^(http|https|ftp):\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\'\'])*$/'; break;
|
||||||
|
case 'ip':$t2 = '/^((25[0-5]|2[0-4]\d|(1\d|[1-9])?\d)\.){3}(25[0-5]|2[0-4]\d|(1\d|[1-9])?\d)$/'; break;
|
||||||
|
case 'file':$t2 = '/^[a-zA-Z0-9]{1,50}$/'; break;
|
||||||
|
case 'zipcode':$t2 = '/^\d{6}$/'; break;
|
||||||
|
case 'filename':$t2 = '/^[a-zA-Z0-9]{1,50}$/'; break;
|
||||||
|
case 'date':$t2 = '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/'; break;
|
||||||
|
case 'time':$t2 = '/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/'; break;
|
||||||
|
case 'utf8':$t2 = '%^(?:
|
||||||
|
[\x09\x0A\x0D\x20-\x7E] # ASCII
|
||||||
|
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
|
||||||
|
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
|
||||||
|
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
|
||||||
|
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
|
||||||
|
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
||||||
|
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
||||||
|
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
||||||
|
)*$%xs'; break;
|
||||||
|
default:$t2 = ''; break;
|
||||||
|
}
|
||||||
|
$pour = @preg_match($t2, $t0);
|
||||||
|
if ($pour) {
|
||||||
|
return $t0;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_num2rmb($num) {
|
||||||
|
$c1 = "零壹贰叁肆伍陆柒捌玖";
|
||||||
|
$c2 = "分角元拾佰仟万拾佰仟亿";
|
||||||
|
$num = round($num, 2);
|
||||||
|
$num = $num * 100;
|
||||||
|
if (strlen($num) > 10) {
|
||||||
|
return "oh,sorry,the number is too long!";
|
||||||
|
}
|
||||||
|
$i = 0;
|
||||||
|
$c = "";
|
||||||
|
while (1) {
|
||||||
|
if ($i == 0) {
|
||||||
|
$n = substr($num, strlen($num)-1, 1);
|
||||||
|
} else {
|
||||||
|
$n = $num % 10;
|
||||||
|
}
|
||||||
|
$p1 = substr($c1, 3 * $n, 3);
|
||||||
|
$p2 = substr($c2, 3 * $i, 3);
|
||||||
|
if ($n != '0' || ($n == '0' && ($p2 == '亿' || $p2 == '万' || $p2 == '元'))) {
|
||||||
|
$c = $p1 . $p2 . $c;
|
||||||
|
} else {
|
||||||
|
$c = $p1 . $c;
|
||||||
|
}
|
||||||
|
$i = $i + 1;
|
||||||
|
$num = $num / 10;
|
||||||
|
$num = (int)$num;
|
||||||
|
if ($num == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$j = 0;
|
||||||
|
$slen = strlen($c);
|
||||||
|
while ($j < $slen) {
|
||||||
|
$m = substr($c, $j, 6);
|
||||||
|
if ($m == '零元' || $m == '零万' || $m == '零亿' || $m == '零零') {
|
||||||
|
$left = substr($c, 0, $j);
|
||||||
|
$right = substr($c, $j + 3);
|
||||||
|
$c = $left . $right;
|
||||||
|
$j = $j-3;
|
||||||
|
$slen = $slen-3;
|
||||||
|
}
|
||||||
|
$j = $j + 3;
|
||||||
|
}
|
||||||
|
if (substr($c, strlen($c)-3, 3) == '零') {
|
||||||
|
$c = substr($c, 0, strlen($c)-3);
|
||||||
|
}
|
||||||
|
return $c . "整";
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_money($num,$f=2){
|
||||||
|
$str = $num ? number_format($num, $f,'.',',') :'';
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_random($len,$chars='ABCDEFJHIJKMNOPQRSTUVWSYZ'){
|
||||||
|
$str = '';
|
||||||
|
$max = strlen($chars) - 1;
|
||||||
|
for ($i=0;$i<$len;$i++) {
|
||||||
|
$str .= $chars[mt_rand(0,$max)];
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_quote($str) {
|
||||||
|
$str = explode(',',$str);
|
||||||
|
foreach($str as $v) {
|
||||||
|
$arr[] = "'$v'";
|
||||||
|
}
|
||||||
|
return @join(',',$arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function str_no($str='') {
|
||||||
|
return $str.date("YmdHis").rand(0,9);
|
||||||
|
}
|
||||||
|
|
||||||
|
function str_auth($string, $operation = 'ENCODE', $key = '', $expiry = 0) {
|
||||||
|
$key_length = 4;
|
||||||
|
$key = md5($key != '' ? $key : 'ci');
|
||||||
|
$fixedkey = md5($key);
|
||||||
|
$egiskeys = md5(substr($fixedkey, 16, 16));
|
||||||
|
$runtokey = $key_length ? ($operation == 'ENCODE' ? substr(md5(microtime(true)), -$key_length) : substr($string, 0, $key_length)) : '';
|
||||||
|
$keys = md5(substr($runtokey, 0, 16) . substr($fixedkey, 0, 16) . substr($runtokey, 16) . substr($fixedkey, 16));
|
||||||
|
$string = $operation == 'ENCODE' ? sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$egiskeys), 0, 16) . $string : base64_decode(substr($string, $key_length));
|
||||||
|
|
||||||
|
$i = 0; $result = '';
|
||||||
|
$string_length = strlen($string);
|
||||||
|
for ($i = 0; $i < $string_length; $i++){
|
||||||
|
$result .= chr(ord($string{$i}) ^ ord($keys{$i % 32}));
|
||||||
|
}
|
||||||
|
if($operation == 'ENCODE') {
|
||||||
|
return $runtokey . str_replace('=', '', base64_encode($result));
|
||||||
|
} else {
|
||||||
|
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$egiskeys), 0, 16)) {
|
||||||
|
return substr($result, 26);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function dir_add($dir,$mode=0777){
|
||||||
|
if (is_dir($dir) || @mkdir($dir,$mode)) return true;
|
||||||
|
if (!dir_add(dirname($dir),$mode)) return false;
|
||||||
|
return @mkdir($dir,$mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dir_del($dir) {
|
||||||
|
$dir = str_replace('\\', '/', $dir);
|
||||||
|
if (substr($dir, -1) != '/') $dir = $dir.'/';
|
||||||
|
if (!is_dir($dir)) return false;
|
||||||
|
$list = glob($dir.'*');
|
||||||
|
foreach($list as $v) {
|
||||||
|
is_dir($v) ? dir_del($v) : @unlink($v);
|
||||||
|
}
|
||||||
|
return @rmdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sys_csv($name){
|
||||||
|
header("Content-type:text/xls");
|
||||||
|
header("Content-Disposition:attachment;filename=".$name);
|
||||||
|
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
|
||||||
|
header('Expires:0');
|
||||||
|
header('Pragma:public');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('array_column')) {
|
||||||
|
function array_column(array $array, $columnKey, $indexKey = null) {
|
||||||
|
$result = array();
|
||||||
|
foreach ($array as $subArray) {
|
||||||
|
if (!is_array($subArray)) {
|
||||||
|
continue;
|
||||||
|
} elseif (is_null($indexKey) && array_key_exists($columnKey, $subArray)) {
|
||||||
|
$result[] = $subArray[$columnKey];
|
||||||
|
} elseif (array_key_exists($indexKey, $subArray)) {
|
||||||
|
if (is_null($columnKey)) {
|
||||||
|
$result[$subArray[$indexKey]] = $subArray;
|
||||||
|
} elseif (array_key_exists($columnKey, $subArray)) {
|
||||||
|
$result[$subArray[$indexKey]] = $subArray[$columnKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function upload($file,$dir,$file_name='',$file_size=20480000,$ext=array('jpg','png','gif','ico')) {
|
||||||
|
$name = $_FILES[$file]['name'];
|
||||||
|
$size = $_FILES[$file]['size'];
|
||||||
|
$type = $_FILES[$file]['type'];
|
||||||
|
$tmp = $_FILES[$file]['tmp_name'];
|
||||||
|
if (!empty($_FILES[$file]['error'])) {
|
||||||
|
switch($_FILES[$file]['error']){
|
||||||
|
case '1':$error = '超过php.ini允许的大小';break;
|
||||||
|
case '2':$error = '超过表单允许的大小';break;
|
||||||
|
case '3':$error = '图片只有部分被上传';break;
|
||||||
|
case '4':$error = '请选择图片';break;
|
||||||
|
case '6':$error = '找不到临时目录';break;
|
||||||
|
case '7':$error = '写文件到硬盘出错';break;
|
||||||
|
case '8':$error = 'File upload stopped by extension';break;
|
||||||
|
case '999':
|
||||||
|
default:$error = '未知错误。';
|
||||||
|
}
|
||||||
|
alert($error);
|
||||||
|
}
|
||||||
|
if (!is_dir($dir)) dir_add($dir);
|
||||||
|
if (!is_writable($dir)) return false;
|
||||||
|
$file_ext = strtolower(trim(substr(strrchr($name,'.'),1)));
|
||||||
|
if (!$file_name) $file_name = date('YmdHis').rand(1000,9999);
|
||||||
|
$file_name = $file_name.'.'.$file_ext;
|
||||||
|
$path = $dir.$file_name;
|
||||||
|
if (!in_array($file_ext,$ext)) return false;
|
||||||
|
if ($size>$file_size) return false;
|
||||||
|
if (!move_uploaded_file($tmp,$path)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$info = array(
|
||||||
|
"old_name"=>$name,
|
||||||
|
"new_name"=>$file_name,
|
||||||
|
"path"=>$path,
|
||||||
|
"size"=>$size,
|
||||||
|
"ext"=>$file_ext,
|
||||||
|
"type"=>$type
|
||||||
|
);
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
10
application/hooks/index.html
Normal file
10
application/hooks/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
10
application/index.html
Normal file
10
application/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
16
application/language/china/admin_lang.php
Normal file
16
application/language/china/admin_lang.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Ionize Backend Language file
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$lang['ionize_administration'] = '的舒服舒服';
|
||||||
|
$lang['ionize_home'] = '斯蒂芬';
|
||||||
|
$lang['ionize_login'] = '和风光好斯蒂芬';
|
||||||
|
$lang['ionize_logout'] = '该活动如果福德宫';
|
||||||
|
$lang['ionize_goback'] = 'v刹徐梵蒂冈过户费';
|
||||||
|
$lang['ionize_website'] = '大饭堂荣幸发给地方';
|
||||||
|
|
||||||
|
|
||||||
|
|
51
application/language/china/calendar_lang.php
Normal file
51
application/language/china/calendar_lang.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['cal_su'] = "日";
|
||||||
|
$lang['cal_mo'] = "一";
|
||||||
|
$lang['cal_tu'] = "二";
|
||||||
|
$lang['cal_we'] = "三";
|
||||||
|
$lang['cal_th'] = "四";
|
||||||
|
$lang['cal_fr'] = "五";
|
||||||
|
$lang['cal_sa'] = "六";
|
||||||
|
$lang['cal_sun'] = "Sun";
|
||||||
|
$lang['cal_mon'] = "Mon";
|
||||||
|
$lang['cal_tue'] = "Tue";
|
||||||
|
$lang['cal_wed'] = "Wed";
|
||||||
|
$lang['cal_thu'] = "Thu";
|
||||||
|
$lang['cal_fri'] = "Fri";
|
||||||
|
$lang['cal_sat'] = "Sat";
|
||||||
|
$lang['cal_sunday'] = "星期天";
|
||||||
|
$lang['cal_monday'] = "星期一";
|
||||||
|
$lang['cal_tuesday'] = "星期二";
|
||||||
|
$lang['cal_wednesday'] = "星期三";
|
||||||
|
$lang['cal_thursday'] = "星期四";
|
||||||
|
$lang['cal_friday'] = "星期五";
|
||||||
|
$lang['cal_saturday'] = "星期六";
|
||||||
|
$lang['cal_jan'] = "Jan";
|
||||||
|
$lang['cal_feb'] = "Feb";
|
||||||
|
$lang['cal_mar'] = "Mar";
|
||||||
|
$lang['cal_apr'] = "Apr";
|
||||||
|
$lang['cal_may'] = "May";
|
||||||
|
$lang['cal_jun'] = "Jun";
|
||||||
|
$lang['cal_jul'] = "Jul";
|
||||||
|
$lang['cal_aug'] = "Aug";
|
||||||
|
$lang['cal_sep'] = "Sep";
|
||||||
|
$lang['cal_oct'] = "Oct";
|
||||||
|
$lang['cal_nov'] = "Nov";
|
||||||
|
$lang['cal_dec'] = "Dec";
|
||||||
|
$lang['cal_january'] = "一月";
|
||||||
|
$lang['cal_february'] = "二月";
|
||||||
|
$lang['cal_march'] = "三月";
|
||||||
|
$lang['cal_april'] = "四月";
|
||||||
|
$lang['cal_mayl'] = "五月";
|
||||||
|
$lang['cal_june'] = "六月";
|
||||||
|
$lang['cal_july'] = "七月";
|
||||||
|
$lang['cal_august'] = "八月";
|
||||||
|
$lang['cal_september'] = "九月";
|
||||||
|
$lang['cal_october'] = "十月";
|
||||||
|
$lang['cal_november'] = "十一月";
|
||||||
|
$lang['cal_december'] = "十二月";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file calendar_lang.php */
|
||||||
|
/* Location: ./system/language/english/calendar_lang.php */
|
61
application/language/china/date_lang.php
Normal file
61
application/language/china/date_lang.php
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['date_year'] = "Year";
|
||||||
|
$lang['date_years'] = "Years";
|
||||||
|
$lang['date_month'] = "Month";
|
||||||
|
$lang['date_months'] = "Months";
|
||||||
|
$lang['date_week'] = "Week";
|
||||||
|
$lang['date_weeks'] = "Weeks";
|
||||||
|
$lang['date_day'] = "Day";
|
||||||
|
$lang['date_days'] = "Days";
|
||||||
|
$lang['date_hour'] = "Hour";
|
||||||
|
$lang['date_hours'] = "Hours";
|
||||||
|
$lang['date_minute'] = "Minute";
|
||||||
|
$lang['date_minutes'] = "Minutes";
|
||||||
|
$lang['date_second'] = "Second";
|
||||||
|
$lang['date_seconds'] = "Seconds";
|
||||||
|
|
||||||
|
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
|
||||||
|
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
|
||||||
|
$lang['UM10'] = '(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti';
|
||||||
|
$lang['UM95'] = '(UTC -9:30) Marquesas Islands';
|
||||||
|
$lang['UM9'] = '(UTC -9:00) Alaska Standard Time, Gambier Islands';
|
||||||
|
$lang['UM8'] = '(UTC -8:00) Pacific Standard Time, Clipperton Island';
|
||||||
|
$lang['UM7'] = '(UTC -7:00) Mountain Standard Time';
|
||||||
|
$lang['UM6'] = '(UTC -6:00) Central Standard Time';
|
||||||
|
$lang['UM5'] = '(UTC -5:00) Eastern Standard Time, Western Caribbean Standard Time';
|
||||||
|
$lang['UM45'] = '(UTC -4:30) Venezuelan Standard Time';
|
||||||
|
$lang['UM4'] = '(UTC -4:00) Atlantic Standard Time, Eastern Caribbean Standard Time';
|
||||||
|
$lang['UM35'] = '(UTC -3:30) Newfoundland Standard Time';
|
||||||
|
$lang['UM3'] = '(UTC -3:00) Argentina, Brazil, French Guiana, Uruguay';
|
||||||
|
$lang['UM2'] = '(UTC -2:00) South Georgia/South Sandwich Islands';
|
||||||
|
$lang['UM1'] = '(UTC -1:00) Azores, Cape Verde Islands';
|
||||||
|
$lang['UTC'] = '(UTC) Greenwich Mean Time, Western European Time';
|
||||||
|
$lang['UP1'] = '(UTC +1:00) Central European Time, West Africa Time';
|
||||||
|
$lang['UP2'] = '(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time';
|
||||||
|
$lang['UP3'] = '(UTC +3:00) Moscow Time, East Africa Time';
|
||||||
|
$lang['UP35'] = '(UTC +3:30) Iran Standard Time';
|
||||||
|
$lang['UP4'] = '(UTC +4:00) Azerbaijan Standard Time, Samara Time';
|
||||||
|
$lang['UP45'] = '(UTC +4:30) Afghanistan';
|
||||||
|
$lang['UP5'] = '(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time';
|
||||||
|
$lang['UP55'] = '(UTC +5:30) Indian Standard Time, Sri Lanka Time';
|
||||||
|
$lang['UP575'] = '(UTC +5:45) Nepal Time';
|
||||||
|
$lang['UP6'] = '(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time';
|
||||||
|
$lang['UP65'] = '(UTC +6:30) Cocos Islands, Myanmar';
|
||||||
|
$lang['UP7'] = '(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam';
|
||||||
|
$lang['UP8'] = '(UTC +8:00) Australian Western Standard Time, Beijing Time, Irkutsk Time';
|
||||||
|
$lang['UP875'] = '(UTC +8:45) Australian Central Western Standard Time';
|
||||||
|
$lang['UP9'] = '(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk Time';
|
||||||
|
$lang['UP95'] = '(UTC +9:30) Australian Central Standard Time';
|
||||||
|
$lang['UP10'] = '(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time';
|
||||||
|
$lang['UP105'] = '(UTC +10:30) Lord Howe Island';
|
||||||
|
$lang['UP11'] = '(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu';
|
||||||
|
$lang['UP115'] = '(UTC +11:30) Norfolk Island';
|
||||||
|
$lang['UP12'] = '(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time';
|
||||||
|
$lang['UP1275'] = '(UTC +12:45) Chatham Islands Standard Time';
|
||||||
|
$lang['UP13'] = '(UTC +13:00) Phoenix Islands Time, Tonga';
|
||||||
|
$lang['UP14'] = '(UTC +14:00) Line Islands';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file date_lang.php */
|
||||||
|
/* Location: ./system/language/english/date_lang.php */
|
29
application/language/china/db_lang.php
Normal file
29
application/language/china/db_lang.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['db_invalid_connection_str'] = '无法确定根据您提交在连接字符串的数据库设置。';
|
||||||
|
$lang['db_unable_to_connect'] = '无法连接到你的数据库服务器使用所提供的设置。';
|
||||||
|
$lang['db_unable_to_select'] = '我们无法选择指定的数据库: %s';
|
||||||
|
$lang['db_unable_to_create'] = '无法创建指定的数据库: %s';
|
||||||
|
$lang['db_invalid_query'] = '您提交的查询是无效的。';
|
||||||
|
$lang['db_must_set_table'] = '您必须设定可以使用与您的查询的数据库表。';
|
||||||
|
$lang['db_must_use_set'] = '您必须使用“套”的方法来更新条目。';
|
||||||
|
$lang['db_must_use_index'] = '你必须指定一个索引匹配进行批量更新。';
|
||||||
|
$lang['db_batch_missing_index'] = '一行或多行缺少批量更新提交指定的索引。';
|
||||||
|
$lang['db_must_use_where'] = '不允许更新,除非它们包含一个“where”子句。';
|
||||||
|
$lang['db_del_must_use_where'] = '不允许更新,除非它们包含一个“where”子句。...';
|
||||||
|
$lang['db_field_param_missing'] = '来获取字段需要的表的名称作为参数。';
|
||||||
|
$lang['db_unsupported_function'] = '此功能是不是您正在使用的数据库。';
|
||||||
|
$lang['db_transaction_failure'] = '交易失败:执行回滚。';
|
||||||
|
$lang['db_unable_to_drop'] = '无法删除指定的数据库。';
|
||||||
|
$lang['db_unsuported_feature'] = '您所使用的数据库平台不支持的功能。';
|
||||||
|
$lang['db_unsuported_compression'] = '您选择的文件压缩格式不支持你的服务器。';
|
||||||
|
$lang['db_filepath_error'] = '无法将数据写入到您所提交的文件路径。';
|
||||||
|
$lang['db_invalid_cache_path'] = '您所提交的缓存路径是不是有效或可写。';
|
||||||
|
$lang['db_table_name_required'] = '该操作需要一个表名。';
|
||||||
|
$lang['db_column_name_required'] = '该操作需要列名。';
|
||||||
|
$lang['db_column_definition_required'] = '该操作需要一个列定义。';
|
||||||
|
$lang['db_unable_to_set_charset'] = '无法设置客户端连接字符集: %s';
|
||||||
|
$lang['db_error_heading'] = '出现数据库错误';
|
||||||
|
|
||||||
|
/* End of file db_lang.php */
|
||||||
|
/* Location: ./system/language/english/db_lang.php */
|
24
application/language/china/email_lang.php
Normal file
24
application/language/china/email_lang.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['email_must_be_array'] = "电子邮件验证方法必须通过一个数组。";
|
||||||
|
$lang['email_invalid_address'] = "电子邮件地址无效:%s";
|
||||||
|
$lang['email_attachment_missing'] = "找不到下列电子邮件附件:%s";
|
||||||
|
$lang['email_attachment_unreadable'] = "无法打开这个附件:%s";
|
||||||
|
$lang['email_no_recipients'] = "您必须包括收件人: To, Cc, or Bcc";
|
||||||
|
$lang['email_send_failure_phpmail'] = "无法使用PHP的mail()发送电子邮件。不能配置您的服务器可能使用这种方法来发送邮件。";
|
||||||
|
$lang['email_send_failure_sendmail'] = "无法发送电子邮件使用PHP Sendmail的。不能配置您的服务器可能使用这种方法来发送邮件。";
|
||||||
|
$lang['email_send_failure_smtp'] = "无法使用PHP SMTP发送电子邮件。不能配置您的服务器可能使用这种方法来发送邮件。";
|
||||||
|
$lang['email_sent'] = "您的邮件已成功发送使用以下协议:%s";
|
||||||
|
$lang['email_no_socket'] = "无法打开套接字Sendmail的。请检查设置。";
|
||||||
|
$lang['email_no_hostname'] = "你没有指定SMTP主机名。";
|
||||||
|
$lang['email_smtp_error'] = "遇到以下SMTP错误:%s";
|
||||||
|
$lang['email_no_smtp_unpw'] = "错误:您必须指定一个SMTP用户名和密码。";
|
||||||
|
$lang['email_failed_smtp_login'] = "无法发送AUTH LOGIN命令。错误:%s";
|
||||||
|
$lang['email_smtp_auth_un'] = "无法验证的用户名。错误:%s";
|
||||||
|
$lang['email_smtp_auth_pw'] = "无法验证密码。错误:%s";
|
||||||
|
$lang['email_smtp_data_failure'] = "无法发送数据:%s";
|
||||||
|
$lang['email_exit_status'] = "退出状态代码 %s";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file email_lang.php */
|
||||||
|
/* Location: ./system/language/english/email_lang.php */
|
29
application/language/china/form_validation_lang.php
Normal file
29
application/language/china/form_validation_lang.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['required'] = "%s 的字段是必需的。";
|
||||||
|
$lang['isset'] = "%s 字段必须有一个值。";
|
||||||
|
$lang['valid_email'] = "%s 段必须包含一个有效的电子邮件地址";
|
||||||
|
$lang['valid_emails'] = "%s 字段必须包含所有有效的电子邮件地址。";
|
||||||
|
$lang['valid_url'] = "%s 字段必须包含一个有效的URL。";
|
||||||
|
$lang['valid_ip'] = "%s 字段必须包含一个有效的IP。";
|
||||||
|
$lang['min_length'] = "%s 字段必须至少 %s 的字符长度。";
|
||||||
|
$lang['max_length'] = "%s 字段不能超过 %s 个字符的长度。";
|
||||||
|
$lang['exact_length'] = "%s 字段必须是 %s 个字符的长度。";
|
||||||
|
$lang['alpha'] = "%s 字段只能包含字母字符。";
|
||||||
|
$lang['alpha_numeric'] = "%s 字段只能包含字母数字字符。";
|
||||||
|
$lang['alpha_dash'] = "%s 字段只能包含字母数字字符,下划线和破折号。";
|
||||||
|
$lang['numeric'] = "%s 字段必须只包含数字。";
|
||||||
|
$lang['is_numeric'] = "%s 字段必须只包含数字字符。";
|
||||||
|
$lang['integer'] = "%s 字段必须包含一个整数。";
|
||||||
|
$lang['regex_match'] = "%s 领域是不正确的格式。";
|
||||||
|
$lang['matches'] = "%s 字段不匹配的 %s 字段。";
|
||||||
|
$lang['is_unique'] = "%s 字段必须包含一个独特的价值。";
|
||||||
|
$lang['is_natural'] = "%s 字段必须包含唯一的正数。";
|
||||||
|
$lang['is_natural_no_zero'] = "%s 字段必须包含一个大于零的数。";
|
||||||
|
$lang['decimal'] = "%s 字段必须包含一个十进制数。";
|
||||||
|
$lang['less_than'] = "%s 字段必须包含一个数字小于 %s.";
|
||||||
|
$lang['greater_than'] = "%s 字段必须包含一个数字大于 %s.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file form_validation_lang.php */
|
||||||
|
/* Location: ./system/language/english/form_validation_lang.php */
|
22
application/language/china/front_lang.php
Normal file
22
application/language/china/front_lang.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['upload_userfile_not_set'] = "我们无法找到一个post变量名为userfile。";
|
||||||
|
$lang['upload_file_exceeds_limit'] = "在你的PHP配置文件,上传的文件超过允许的最大大小。";
|
||||||
|
$lang['upload_file_exceeds_form_limit'] = "上传的文件超过允许的最大尺寸由提交表单。";
|
||||||
|
$lang['upload_file_partial'] = "该文件只有部分被上传。";
|
||||||
|
$lang['upload_no_temp_directory'] = "临时文件夹丢失。";
|
||||||
|
$lang['upload_unable_to_write_file'] = "文件不能被写入到磁盘。";
|
||||||
|
$lang['upload_stopped_by_extension'] = "上传的文件被停止扩展。";
|
||||||
|
$lang['upload_no_file_selected'] = "您没有选择要上传的文件。";
|
||||||
|
$lang['upload_invalid_filetype'] = "您正在尝试上传文件类型是不允许的。";
|
||||||
|
$lang['upload_invalid_filesize'] = "你试图上传文件大于允许的大小。";
|
||||||
|
$lang['upload_invalid_dimensions'] = "您尝试上传的图像exceedes最大高度或宽度。";
|
||||||
|
$lang['upload_destination_error'] = "遇到的问题,而试图将上传文件到最终目的地。";
|
||||||
|
$lang['upload_no_filepath'] = "上载路径不出现是有效的。";
|
||||||
|
$lang['upload_no_file_types'] = "您还没有指定任何允许的文件类型。";
|
||||||
|
$lang['upload_bad_filename'] = "您所提交的文件名已经存在于服务器上。";
|
||||||
|
$lang['upload_not_writable'] = "上传的目标文件夹没有出现可写。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file upload_lang.php */
|
||||||
|
/* Location: ./system/language/english/upload_lang.php */
|
18
application/language/china/ftp_lang.php
Normal file
18
application/language/china/ftp_lang.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['ftp_no_connection'] = "我们无法找到一个有效的连接ID。请确保您连接在peforming任何文件例程。";
|
||||||
|
$lang['ftp_unable_to_connect'] = "无法连接到FTP服务器,使用提供的主机名。";
|
||||||
|
$lang['ftp_unable_to_login'] = "无法登录到你的FTP服务器。请检查您的用户名和密码。";
|
||||||
|
$lang['ftp_unable_to_makdir'] = "无法创建您所指定的目录。";
|
||||||
|
$lang['ftp_unable_to_changedir'] = "无法改变目录。";
|
||||||
|
$lang['ftp_unable_to_chmod'] = "无法设置文件权限。请检查您的路径。注:此功能仅适用于PHP5或更高。";
|
||||||
|
$lang['ftp_unable_to_upload'] = "无法上传到指定的文件中。请检查您的路径。";
|
||||||
|
$lang['ftp_unable_to_download'] = "无法下载指定的文件。请检查您的路径。";
|
||||||
|
$lang['ftp_no_source_file'] = "找不到源文件。请检查您的路径。";
|
||||||
|
$lang['ftp_unable_to_rename'] = "无法重命名文件。";
|
||||||
|
$lang['ftp_unable_to_delete'] = "无法删除该文件。";
|
||||||
|
$lang['ftp_unable_to_move'] = "无法移动的文件。请确保目标目录存在。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file ftp_lang.php */
|
||||||
|
/* Location: ./system/language/english/ftp_lang.php */
|
24
application/language/china/imglib_lang.php
Normal file
24
application/language/china/imglib_lang.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['imglib_source_image_required'] = "在你的喜好,你必须指定一个源图像。";
|
||||||
|
$lang['imglib_gd_required'] = "GD图像库需要此功能。";
|
||||||
|
$lang['imglib_gd_required_for_props'] = "您的服务器必须支持GD图像库,以确定图像的属性。";
|
||||||
|
$lang['imglib_unsupported_imagecreate'] = "你的服务器不支持GD这种类型的图像处理所需的功能。";
|
||||||
|
$lang['imglib_gif_not_supported'] = "由于许可限制,往往不支持GIF图像。您可能必须使用JPG或PNG图像。";
|
||||||
|
$lang['imglib_jpg_not_supported'] = "不支持JPG图片。";
|
||||||
|
$lang['imglib_png_not_supported'] = "不支持PNG图像。";
|
||||||
|
$lang['imglib_jpg_or_png_required'] = "在你的喜好指定图像大小调整协议仅适用于JPEG或PNG图像类型。";
|
||||||
|
$lang['imglib_copy_error'] = "遇到了一个错误,当试图更换文件。请确保您的文件目录是可写的。";
|
||||||
|
$lang['imglib_rotate_unsupported'] = "您的服务器支持,不会出现图像旋转。";
|
||||||
|
$lang['imglib_libpath_invalid'] = "您的图片库的路径是不正确的。请在你的形象偏好设置正确的路径。";
|
||||||
|
$lang['imglib_image_process_failed'] = "图像处理失败。请确认您的服务器支持所选择的协议,您的图片库的路径是正确的。";
|
||||||
|
$lang['imglib_rotation_angle_required'] = "需要的旋转角度旋转图像。";
|
||||||
|
$lang['imglib_writing_failed_gif'] = "GIF图像。";
|
||||||
|
$lang['imglib_invalid_path'] = "图像的路径是不正确的。";
|
||||||
|
$lang['imglib_copy_failed'] = "图像复制例程失败。";
|
||||||
|
$lang['imglib_missing_font'] = "无法找到一个要使用的字体。";
|
||||||
|
$lang['imglib_save_failed'] = "无法保存图像。请确保图像和文件目录是可写的。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file imglib_lang.php */
|
||||||
|
/* Location: ./system/language/english/imglib_lang.php */
|
10
application/language/china/index.html
Normal file
10
application/language/china/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
13
application/language/china/migration_lang.php
Normal file
13
application/language/china/migration_lang.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['migration_none_found'] = "没有发现任何迁移。";
|
||||||
|
$lang['migration_not_found'] = "这种迁移可能不会被发现。";
|
||||||
|
$lang['migration_multiple_version'] = "是相同的版本号的多个迁移:%d.";
|
||||||
|
$lang['migration_class_doesnt_exist'] = "移民类 \"%s\" 无法被发现。";
|
||||||
|
$lang['migration_missing_up_method'] = "移民类 \"%s\" 中”丢失“向上”的方法。";
|
||||||
|
$lang['migration_missing_down_method'] = "移民类 \"%s\" 中”丢失“向下”的方法。";
|
||||||
|
$lang['migration_invalid_filename'] = "迁移 \"%s\" 有一个无效的文件名。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file migration_lang.php */
|
||||||
|
/* Location: ./system/language/english/migration_lang.php */
|
10
application/language/china/number_lang.php
Normal file
10
application/language/china/number_lang.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['terabyte_abbr'] = "TB";
|
||||||
|
$lang['gigabyte_abbr'] = "GB";
|
||||||
|
$lang['megabyte_abbr'] = "MB";
|
||||||
|
$lang['kilobyte_abbr'] = "KB";
|
||||||
|
$lang['bytes'] = "Bytes";
|
||||||
|
|
||||||
|
/* End of file number_lang.php */
|
||||||
|
/* Location: ./system/language/english/number_lang.php */
|
25
application/language/china/profiler_lang.php
Normal file
25
application/language/china/profiler_lang.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['profiler_database'] = 'DATABASE';
|
||||||
|
$lang['profiler_controller_info'] = 'CLASS/METHOD';
|
||||||
|
$lang['profiler_benchmarks'] = 'BENCHMARKS';
|
||||||
|
$lang['profiler_queries'] = 'QUERIES';
|
||||||
|
$lang['profiler_get_data'] = 'GET DATA';
|
||||||
|
$lang['profiler_post_data'] = 'POST DATA';
|
||||||
|
$lang['profiler_uri_string'] = 'URI STRING';
|
||||||
|
$lang['profiler_memory_usage'] = 'MEMORY USAGE';
|
||||||
|
$lang['profiler_config'] = 'CONFIG VARIABLES';
|
||||||
|
$lang['profiler_session_data'] = 'SESSION DATA';
|
||||||
|
$lang['profiler_headers'] = 'HTTP HEADERS';
|
||||||
|
$lang['profiler_no_db'] = 'Database driver is not currently loaded';
|
||||||
|
$lang['profiler_no_queries'] = 'No queries were run';
|
||||||
|
$lang['profiler_no_post'] = 'No POST data exists';
|
||||||
|
$lang['profiler_no_get'] = 'No GET data exists';
|
||||||
|
$lang['profiler_no_uri'] = 'No URI data exists';
|
||||||
|
$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
|
||||||
|
$lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.';
|
||||||
|
$lang['profiler_section_hide'] = 'Hide';
|
||||||
|
$lang['profiler_section_show'] = 'Show';
|
||||||
|
|
||||||
|
/* End of file profiler_lang.php */
|
||||||
|
/* Location: ./system/language/english/profiler_lang.php */
|
25
application/language/china/unit_test_lang.php
Normal file
25
application/language/china/unit_test_lang.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['ut_test_name'] = '测试名称';
|
||||||
|
$lang['ut_test_datatype'] = '测试数据类型';
|
||||||
|
$lang['ut_res_datatype'] = '预期数据类型';
|
||||||
|
$lang['ut_result'] = '导致';
|
||||||
|
$lang['ut_undefined'] = '未定义的测试名称';
|
||||||
|
$lang['ut_file'] = '文件名';
|
||||||
|
$lang['ut_line'] = '行号';
|
||||||
|
$lang['ut_passed'] = '通过';
|
||||||
|
$lang['ut_failed'] = '失败';
|
||||||
|
$lang['ut_boolean'] = '布尔';
|
||||||
|
$lang['ut_integer'] = '整数';
|
||||||
|
$lang['ut_float'] = '浮动';
|
||||||
|
$lang['ut_double'] = '浮动'; // can be the same as float
|
||||||
|
$lang['ut_string'] = '字符串';
|
||||||
|
$lang['ut_array'] = '数组';
|
||||||
|
$lang['ut_object'] = '对象';
|
||||||
|
$lang['ut_resource'] = '资源';
|
||||||
|
$lang['ut_null'] = '空';
|
||||||
|
$lang['ut_notes'] = '笔记';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file unit_test_lang.php */
|
||||||
|
/* Location: ./system/language/english/unit_test_lang.php */
|
22
application/language/china/upload_lang.php
Normal file
22
application/language/china/upload_lang.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['upload_userfile_not_set'] = "我们无法找到一个post变量名为userfile。";
|
||||||
|
$lang['upload_file_exceeds_limit'] = "在你的PHP配置文件,上传的文件超过允许的最大大小。";
|
||||||
|
$lang['upload_file_exceeds_form_limit'] = "上传的文件超过允许的最大尺寸由提交表单。";
|
||||||
|
$lang['upload_file_partial'] = "该文件只有部分被上传。";
|
||||||
|
$lang['upload_no_temp_directory'] = "临时文件夹丢失。";
|
||||||
|
$lang['upload_unable_to_write_file'] = "文件不能被写入到磁盘。";
|
||||||
|
$lang['upload_stopped_by_extension'] = "上传的文件被停止扩展。";
|
||||||
|
$lang['upload_no_file_selected'] = "您没有选择要上传的文件。";
|
||||||
|
$lang['upload_invalid_filetype'] = "您正在尝试上传文件类型是不允许的。";
|
||||||
|
$lang['upload_invalid_filesize'] = "你试图上传文件大于允许的大小。";
|
||||||
|
$lang['upload_invalid_dimensions'] = "您尝试上传的图像exceedes最大高度或宽度。";
|
||||||
|
$lang['upload_destination_error'] = "遇到的问题,而试图将上传文件到最终目的地。";
|
||||||
|
$lang['upload_no_filepath'] = "上载路径不出现是有效的。";
|
||||||
|
$lang['upload_no_file_types'] = "您还没有指定任何允许的文件类型。";
|
||||||
|
$lang['upload_bad_filename'] = "您所提交的文件名已经存在于服务器上。";
|
||||||
|
$lang['upload_not_writable'] = "上传的目标文件夹没有出现可写。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file upload_lang.php */
|
||||||
|
/* Location: ./system/language/english/upload_lang.php */
|
16
application/language/english/admin_lang.php
Normal file
16
application/language/english/admin_lang.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Ionize Backend Language file
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$lang['ionize_administration'] = '的舒服舒服';
|
||||||
|
$lang['ionize_home'] = '斯蒂芬';
|
||||||
|
$lang['ionize_login'] = '和风光好斯蒂芬';
|
||||||
|
$lang['ionize_logout'] = '该活动如果福德宫';
|
||||||
|
$lang['ionize_goback'] = 'v刹徐梵蒂冈过户费';
|
||||||
|
$lang['ionize_website'] = '大饭堂荣幸发给地方';
|
||||||
|
|
||||||
|
|
||||||
|
|
51
application/language/english/calendar_lang.php
Normal file
51
application/language/english/calendar_lang.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['cal_su'] = "Su";
|
||||||
|
$lang['cal_mo'] = "Mo";
|
||||||
|
$lang['cal_tu'] = "Tu";
|
||||||
|
$lang['cal_we'] = "We";
|
||||||
|
$lang['cal_th'] = "Th";
|
||||||
|
$lang['cal_fr'] = "Fr";
|
||||||
|
$lang['cal_sa'] = "Sa";
|
||||||
|
$lang['cal_sun'] = "Sun";
|
||||||
|
$lang['cal_mon'] = "Mon";
|
||||||
|
$lang['cal_tue'] = "Tue";
|
||||||
|
$lang['cal_wed'] = "Wed";
|
||||||
|
$lang['cal_thu'] = "Thu";
|
||||||
|
$lang['cal_fri'] = "Fri";
|
||||||
|
$lang['cal_sat'] = "Sat";
|
||||||
|
$lang['cal_sunday'] = "Sunday";
|
||||||
|
$lang['cal_monday'] = "Monday";
|
||||||
|
$lang['cal_tuesday'] = "Tuesday";
|
||||||
|
$lang['cal_wednesday'] = "Wednesday";
|
||||||
|
$lang['cal_thursday'] = "Thursday";
|
||||||
|
$lang['cal_friday'] = "Friday";
|
||||||
|
$lang['cal_saturday'] = "Saturday";
|
||||||
|
$lang['cal_jan'] = "Jan";
|
||||||
|
$lang['cal_feb'] = "Feb";
|
||||||
|
$lang['cal_mar'] = "Mar";
|
||||||
|
$lang['cal_apr'] = "Apr";
|
||||||
|
$lang['cal_may'] = "May";
|
||||||
|
$lang['cal_jun'] = "Jun";
|
||||||
|
$lang['cal_jul'] = "Jul";
|
||||||
|
$lang['cal_aug'] = "Aug";
|
||||||
|
$lang['cal_sep'] = "Sep";
|
||||||
|
$lang['cal_oct'] = "Oct";
|
||||||
|
$lang['cal_nov'] = "Nov";
|
||||||
|
$lang['cal_dec'] = "Dec";
|
||||||
|
$lang['cal_january'] = "January";
|
||||||
|
$lang['cal_february'] = "February";
|
||||||
|
$lang['cal_march'] = "March";
|
||||||
|
$lang['cal_april'] = "April";
|
||||||
|
$lang['cal_mayl'] = "May";
|
||||||
|
$lang['cal_june'] = "June";
|
||||||
|
$lang['cal_july'] = "July";
|
||||||
|
$lang['cal_august'] = "August";
|
||||||
|
$lang['cal_september'] = "September";
|
||||||
|
$lang['cal_october'] = "October";
|
||||||
|
$lang['cal_november'] = "November";
|
||||||
|
$lang['cal_december'] = "December";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file calendar_lang.php */
|
||||||
|
/* Location: ./system/language/english/calendar_lang.php */
|
61
application/language/english/date_lang.php
Normal file
61
application/language/english/date_lang.php
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['date_year'] = "Year";
|
||||||
|
$lang['date_years'] = "Years";
|
||||||
|
$lang['date_month'] = "Month";
|
||||||
|
$lang['date_months'] = "Months";
|
||||||
|
$lang['date_week'] = "Week";
|
||||||
|
$lang['date_weeks'] = "Weeks";
|
||||||
|
$lang['date_day'] = "Day";
|
||||||
|
$lang['date_days'] = "Days";
|
||||||
|
$lang['date_hour'] = "Hour";
|
||||||
|
$lang['date_hours'] = "Hours";
|
||||||
|
$lang['date_minute'] = "Minute";
|
||||||
|
$lang['date_minutes'] = "Minutes";
|
||||||
|
$lang['date_second'] = "Second";
|
||||||
|
$lang['date_seconds'] = "Seconds";
|
||||||
|
|
||||||
|
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
|
||||||
|
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
|
||||||
|
$lang['UM10'] = '(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti';
|
||||||
|
$lang['UM95'] = '(UTC -9:30) Marquesas Islands';
|
||||||
|
$lang['UM9'] = '(UTC -9:00) Alaska Standard Time, Gambier Islands';
|
||||||
|
$lang['UM8'] = '(UTC -8:00) Pacific Standard Time, Clipperton Island';
|
||||||
|
$lang['UM7'] = '(UTC -7:00) Mountain Standard Time';
|
||||||
|
$lang['UM6'] = '(UTC -6:00) Central Standard Time';
|
||||||
|
$lang['UM5'] = '(UTC -5:00) Eastern Standard Time, Western Caribbean Standard Time';
|
||||||
|
$lang['UM45'] = '(UTC -4:30) Venezuelan Standard Time';
|
||||||
|
$lang['UM4'] = '(UTC -4:00) Atlantic Standard Time, Eastern Caribbean Standard Time';
|
||||||
|
$lang['UM35'] = '(UTC -3:30) Newfoundland Standard Time';
|
||||||
|
$lang['UM3'] = '(UTC -3:00) Argentina, Brazil, French Guiana, Uruguay';
|
||||||
|
$lang['UM2'] = '(UTC -2:00) South Georgia/South Sandwich Islands';
|
||||||
|
$lang['UM1'] = '(UTC -1:00) Azores, Cape Verde Islands';
|
||||||
|
$lang['UTC'] = '(UTC) Greenwich Mean Time, Western European Time';
|
||||||
|
$lang['UP1'] = '(UTC +1:00) Central European Time, West Africa Time';
|
||||||
|
$lang['UP2'] = '(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time';
|
||||||
|
$lang['UP3'] = '(UTC +3:00) Moscow Time, East Africa Time';
|
||||||
|
$lang['UP35'] = '(UTC +3:30) Iran Standard Time';
|
||||||
|
$lang['UP4'] = '(UTC +4:00) Azerbaijan Standard Time, Samara Time';
|
||||||
|
$lang['UP45'] = '(UTC +4:30) Afghanistan';
|
||||||
|
$lang['UP5'] = '(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time';
|
||||||
|
$lang['UP55'] = '(UTC +5:30) Indian Standard Time, Sri Lanka Time';
|
||||||
|
$lang['UP575'] = '(UTC +5:45) Nepal Time';
|
||||||
|
$lang['UP6'] = '(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time';
|
||||||
|
$lang['UP65'] = '(UTC +6:30) Cocos Islands, Myanmar';
|
||||||
|
$lang['UP7'] = '(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam';
|
||||||
|
$lang['UP8'] = '(UTC +8:00) Australian Western Standard Time, Beijing Time, Irkutsk Time';
|
||||||
|
$lang['UP875'] = '(UTC +8:45) Australian Central Western Standard Time';
|
||||||
|
$lang['UP9'] = '(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk Time';
|
||||||
|
$lang['UP95'] = '(UTC +9:30) Australian Central Standard Time';
|
||||||
|
$lang['UP10'] = '(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time';
|
||||||
|
$lang['UP105'] = '(UTC +10:30) Lord Howe Island';
|
||||||
|
$lang['UP11'] = '(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu';
|
||||||
|
$lang['UP115'] = '(UTC +11:30) Norfolk Island';
|
||||||
|
$lang['UP12'] = '(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time';
|
||||||
|
$lang['UP1275'] = '(UTC +12:45) Chatham Islands Standard Time';
|
||||||
|
$lang['UP13'] = '(UTC +13:00) Phoenix Islands Time, Tonga';
|
||||||
|
$lang['UP14'] = '(UTC +14:00) Line Islands';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file date_lang.php */
|
||||||
|
/* Location: ./system/language/english/date_lang.php */
|
29
application/language/english/db_lang.php
Normal file
29
application/language/english/db_lang.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['db_invalid_connection_str'] = 'Unable to determine the database settings based on the connection string you submitted.';
|
||||||
|
$lang['db_unable_to_connect'] = 'Unable to connect to your database server using the provided settings.';
|
||||||
|
$lang['db_unable_to_select'] = 'Unable to select the specified database: %s';
|
||||||
|
$lang['db_unable_to_create'] = 'Unable to create the specified database: %s';
|
||||||
|
$lang['db_invalid_query'] = 'The query you submitted is not valid.';
|
||||||
|
$lang['db_must_set_table'] = 'You must set the database table to be used with your query.';
|
||||||
|
$lang['db_must_use_set'] = 'You must use the "set" method to update an entry.';
|
||||||
|
$lang['db_must_use_index'] = 'You must specify an index to match on for batch updates.';
|
||||||
|
$lang['db_batch_missing_index'] = 'One or more rows submitted for batch updating is missing the specified index.';
|
||||||
|
$lang['db_must_use_where'] = 'Updates are not allowed unless they contain a "where" clause.';
|
||||||
|
$lang['db_del_must_use_where'] = 'Deletes are not allowed unless they contain a "where" or "like" clause.';
|
||||||
|
$lang['db_field_param_missing'] = 'To fetch fields requires the name of the table as a parameter.';
|
||||||
|
$lang['db_unsupported_function'] = 'This feature is not available for the database you are using.';
|
||||||
|
$lang['db_transaction_failure'] = 'Transaction failure: Rollback performed.';
|
||||||
|
$lang['db_unable_to_drop'] = 'Unable to drop the specified database.';
|
||||||
|
$lang['db_unsuported_feature'] = 'Unsupported feature of the database platform you are using.';
|
||||||
|
$lang['db_unsuported_compression'] = 'The file compression format you chose is not supported by your server.';
|
||||||
|
$lang['db_filepath_error'] = 'Unable to write data to the file path you have submitted.';
|
||||||
|
$lang['db_invalid_cache_path'] = 'The cache path you submitted is not valid or writable.';
|
||||||
|
$lang['db_table_name_required'] = 'A table name is required for that operation.';
|
||||||
|
$lang['db_column_name_required'] = 'A column name is required for that operation.';
|
||||||
|
$lang['db_column_definition_required'] = 'A column definition is required for that operation.';
|
||||||
|
$lang['db_unable_to_set_charset'] = 'Unable to set client connection character set: %s';
|
||||||
|
$lang['db_error_heading'] = 'A Database Error Occurred';
|
||||||
|
|
||||||
|
/* End of file db_lang.php */
|
||||||
|
/* Location: ./system/language/english/db_lang.php */
|
24
application/language/english/email_lang.php
Normal file
24
application/language/english/email_lang.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['email_must_be_array'] = "The email validation method must be passed an array.";
|
||||||
|
$lang['email_invalid_address'] = "Invalid email address: %s";
|
||||||
|
$lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s";
|
||||||
|
$lang['email_attachment_unreadable'] = "Unable to open this attachment: %s";
|
||||||
|
$lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc";
|
||||||
|
$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.";
|
||||||
|
$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.";
|
||||||
|
$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.";
|
||||||
|
$lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s";
|
||||||
|
$lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings.";
|
||||||
|
$lang['email_no_hostname'] = "You did not specify a SMTP hostname.";
|
||||||
|
$lang['email_smtp_error'] = "The following SMTP error was encountered: %s";
|
||||||
|
$lang['email_no_smtp_unpw'] = "Error: You must assign a SMTP username and password.";
|
||||||
|
$lang['email_failed_smtp_login'] = "Failed to send AUTH LOGIN command. Error: %s";
|
||||||
|
$lang['email_smtp_auth_un'] = "Failed to authenticate username. Error: %s";
|
||||||
|
$lang['email_smtp_auth_pw'] = "Failed to authenticate password. Error: %s";
|
||||||
|
$lang['email_smtp_data_failure'] = "Unable to send data: %s";
|
||||||
|
$lang['email_exit_status'] = "Exit status code: %s";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file email_lang.php */
|
||||||
|
/* Location: ./system/language/english/email_lang.php */
|
29
application/language/english/form_validation_lang.php
Normal file
29
application/language/english/form_validation_lang.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['required'] = "The %s field is required.";
|
||||||
|
$lang['isset'] = "The %s field must have a value.";
|
||||||
|
$lang['valid_email'] = "The %s field must contain a valid email address.";
|
||||||
|
$lang['valid_emails'] = "The %s field must contain all valid email addresses.";
|
||||||
|
$lang['valid_url'] = "The %s field must contain a valid URL.";
|
||||||
|
$lang['valid_ip'] = "The %s field must contain a valid IP.";
|
||||||
|
$lang['min_length'] = "The %s field must be at least %s characters in length.";
|
||||||
|
$lang['max_length'] = "The %s field can not exceed %s characters in length.";
|
||||||
|
$lang['exact_length'] = "The %s field must be exactly %s characters in length.";
|
||||||
|
$lang['alpha'] = "The %s field may only contain alphabetical characters.";
|
||||||
|
$lang['alpha_numeric'] = "The %s field may only contain alpha-numeric characters.";
|
||||||
|
$lang['alpha_dash'] = "The %s field may only contain alpha-numeric characters, underscores, and dashes.";
|
||||||
|
$lang['numeric'] = "The %s field must contain only numbers.";
|
||||||
|
$lang['is_numeric'] = "The %s field must contain only numeric characters.";
|
||||||
|
$lang['integer'] = "The %s field must contain an integer.";
|
||||||
|
$lang['regex_match'] = "The %s field is not in the correct format.";
|
||||||
|
$lang['matches'] = "The %s field does not match the %s field.";
|
||||||
|
$lang['is_unique'] = "The %s field must contain a unique value.";
|
||||||
|
$lang['is_natural'] = "The %s field must contain only positive numbers.";
|
||||||
|
$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero.";
|
||||||
|
$lang['decimal'] = "The %s field must contain a decimal number.";
|
||||||
|
$lang['less_than'] = "The %s field must contain a number less than %s.";
|
||||||
|
$lang['greater_than'] = "The %s field must contain a number greater than %s.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file form_validation_lang.php */
|
||||||
|
/* Location: ./system/language/english/form_validation_lang.php */
|
22
application/language/english/front_lang.php
Normal file
22
application/language/english/front_lang.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['upload_userfile_not_set'] = "我们无法找到一个post变量名为userfile。";
|
||||||
|
$lang['upload_file_exceeds_limit'] = "在你的PHP配置文件,上传的文件超过允许的最大大小。";
|
||||||
|
$lang['upload_file_exceeds_form_limit'] = "上传的文件超过允许的最大尺寸由提交表单。";
|
||||||
|
$lang['upload_file_partial'] = "该文件只有部分被上传。";
|
||||||
|
$lang['upload_no_temp_directory'] = "临时文件夹丢失。";
|
||||||
|
$lang['upload_unable_to_write_file'] = "文件不能被写入到磁盘。";
|
||||||
|
$lang['upload_stopped_by_extension'] = "上传的文件被停止扩展。";
|
||||||
|
$lang['upload_no_file_selected'] = "您没有选择要上传的文件。";
|
||||||
|
$lang['upload_invalid_filetype'] = "您正在尝试上传文件类型是不允许的。";
|
||||||
|
$lang['upload_invalid_filesize'] = "你试图上传文件大于允许的大小。";
|
||||||
|
$lang['upload_invalid_dimensions'] = "您尝试上传的图像exceedes最大高度或宽度。";
|
||||||
|
$lang['upload_destination_error'] = "遇到的问题,而试图将上传文件到最终目的地。";
|
||||||
|
$lang['upload_no_filepath'] = "上载路径不出现是有效的。";
|
||||||
|
$lang['upload_no_file_types'] = "您还没有指定任何允许的文件类型。";
|
||||||
|
$lang['upload_bad_filename'] = "您所提交的文件名已经存在于服务器上。";
|
||||||
|
$lang['upload_not_writable'] = "上传的目标文件夹没有出现可写。";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file upload_lang.php */
|
||||||
|
/* Location: ./system/language/english/upload_lang.php */
|
18
application/language/english/ftp_lang.php
Normal file
18
application/language/english/ftp_lang.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['ftp_no_connection'] = "Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.";
|
||||||
|
$lang['ftp_unable_to_connect'] = "Unable to connect to your FTP server using the supplied hostname.";
|
||||||
|
$lang['ftp_unable_to_login'] = "Unable to login to your FTP server. Please check your username and password.";
|
||||||
|
$lang['ftp_unable_to_makdir'] = "Unable to create the directory you have specified.";
|
||||||
|
$lang['ftp_unable_to_changedir'] = "Unable to change directories.";
|
||||||
|
$lang['ftp_unable_to_chmod'] = "Unable to set file permissions. Please check your path. Note: This feature is only available in PHP 5 or higher.";
|
||||||
|
$lang['ftp_unable_to_upload'] = "Unable to upload the specified file. Please check your path.";
|
||||||
|
$lang['ftp_unable_to_download'] = "Unable to download the specified file. Please check your path.";
|
||||||
|
$lang['ftp_no_source_file'] = "Unable to locate the source file. Please check your path.";
|
||||||
|
$lang['ftp_unable_to_rename'] = "Unable to rename the file.";
|
||||||
|
$lang['ftp_unable_to_delete'] = "Unable to delete the file.";
|
||||||
|
$lang['ftp_unable_to_move'] = "Unable to move the file. Please make sure the destination directory exists.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file ftp_lang.php */
|
||||||
|
/* Location: ./system/language/english/ftp_lang.php */
|
24
application/language/english/imglib_lang.php
Normal file
24
application/language/english/imglib_lang.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['imglib_source_image_required'] = "You must specify a source image in your preferences.";
|
||||||
|
$lang['imglib_gd_required'] = "The GD image library is required for this feature.";
|
||||||
|
$lang['imglib_gd_required_for_props'] = "Your server must support the GD image library in order to determine the image properties.";
|
||||||
|
$lang['imglib_unsupported_imagecreate'] = "Your server does not support the GD function required to process this type of image.";
|
||||||
|
$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.";
|
||||||
|
$lang['imglib_jpg_not_supported'] = "JPG images are not supported.";
|
||||||
|
$lang['imglib_png_not_supported'] = "PNG images are not supported.";
|
||||||
|
$lang['imglib_jpg_or_png_required'] = "The image resize protocol specified in your preferences only works with JPEG or PNG image types.";
|
||||||
|
$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable.";
|
||||||
|
$lang['imglib_rotate_unsupported'] = "Image rotation does not appear to be supported by your server.";
|
||||||
|
$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences.";
|
||||||
|
$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.";
|
||||||
|
$lang['imglib_rotation_angle_required'] = "An angle of rotation is required to rotate the image.";
|
||||||
|
$lang['imglib_writing_failed_gif'] = "GIF image.";
|
||||||
|
$lang['imglib_invalid_path'] = "The path to the image is not correct.";
|
||||||
|
$lang['imglib_copy_failed'] = "The image copy routine failed.";
|
||||||
|
$lang['imglib_missing_font'] = "Unable to find a font to use.";
|
||||||
|
$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file imglib_lang.php */
|
||||||
|
/* Location: ./system/language/english/imglib_lang.php */
|
10
application/language/english/index.html
Normal file
10
application/language/english/index.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
13
application/language/english/migration_lang.php
Normal file
13
application/language/english/migration_lang.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['migration_none_found'] = "No migrations were found.";
|
||||||
|
$lang['migration_not_found'] = "This migration could not be found.";
|
||||||
|
$lang['migration_multiple_version'] = "This are multiple migrations with the same version number: %d.";
|
||||||
|
$lang['migration_class_doesnt_exist'] = "The migration class \"%s\" could not be found.";
|
||||||
|
$lang['migration_missing_up_method'] = "The migration class \"%s\" is missing an 'up' method.";
|
||||||
|
$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'down' method.";
|
||||||
|
$lang['migration_invalid_filename'] = "Migration \"%s\" has an invalid filename.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file migration_lang.php */
|
||||||
|
/* Location: ./system/language/english/migration_lang.php */
|
10
application/language/english/number_lang.php
Normal file
10
application/language/english/number_lang.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['terabyte_abbr'] = "TB";
|
||||||
|
$lang['gigabyte_abbr'] = "GB";
|
||||||
|
$lang['megabyte_abbr'] = "MB";
|
||||||
|
$lang['kilobyte_abbr'] = "KB";
|
||||||
|
$lang['bytes'] = "Bytes";
|
||||||
|
|
||||||
|
/* End of file number_lang.php */
|
||||||
|
/* Location: ./system/language/english/number_lang.php */
|
25
application/language/english/profiler_lang.php
Normal file
25
application/language/english/profiler_lang.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['profiler_database'] = 'DATABASE';
|
||||||
|
$lang['profiler_controller_info'] = 'CLASS/METHOD';
|
||||||
|
$lang['profiler_benchmarks'] = 'BENCHMARKS';
|
||||||
|
$lang['profiler_queries'] = 'QUERIES';
|
||||||
|
$lang['profiler_get_data'] = 'GET DATA';
|
||||||
|
$lang['profiler_post_data'] = 'POST DATA';
|
||||||
|
$lang['profiler_uri_string'] = 'URI STRING';
|
||||||
|
$lang['profiler_memory_usage'] = 'MEMORY USAGE';
|
||||||
|
$lang['profiler_config'] = 'CONFIG VARIABLES';
|
||||||
|
$lang['profiler_session_data'] = 'SESSION DATA';
|
||||||
|
$lang['profiler_headers'] = 'HTTP HEADERS';
|
||||||
|
$lang['profiler_no_db'] = 'Database driver is not currently loaded';
|
||||||
|
$lang['profiler_no_queries'] = 'No queries were run';
|
||||||
|
$lang['profiler_no_post'] = 'No POST data exists';
|
||||||
|
$lang['profiler_no_get'] = 'No GET data exists';
|
||||||
|
$lang['profiler_no_uri'] = 'No URI data exists';
|
||||||
|
$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
|
||||||
|
$lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.';
|
||||||
|
$lang['profiler_section_hide'] = 'Hide';
|
||||||
|
$lang['profiler_section_show'] = 'Show';
|
||||||
|
|
||||||
|
/* End of file profiler_lang.php */
|
||||||
|
/* Location: ./system/language/english/profiler_lang.php */
|
25
application/language/english/unit_test_lang.php
Normal file
25
application/language/english/unit_test_lang.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['ut_test_name'] = 'Test Name';
|
||||||
|
$lang['ut_test_datatype'] = 'Test Datatype';
|
||||||
|
$lang['ut_res_datatype'] = 'Expected Datatype';
|
||||||
|
$lang['ut_result'] = 'Result';
|
||||||
|
$lang['ut_undefined'] = 'Undefined Test Name';
|
||||||
|
$lang['ut_file'] = 'File Name';
|
||||||
|
$lang['ut_line'] = 'Line Number';
|
||||||
|
$lang['ut_passed'] = 'Passed';
|
||||||
|
$lang['ut_failed'] = 'Failed';
|
||||||
|
$lang['ut_boolean'] = 'Boolean';
|
||||||
|
$lang['ut_integer'] = 'Integer';
|
||||||
|
$lang['ut_float'] = 'Float';
|
||||||
|
$lang['ut_double'] = 'Float'; // can be the same as float
|
||||||
|
$lang['ut_string'] = 'String';
|
||||||
|
$lang['ut_array'] = 'Array';
|
||||||
|
$lang['ut_object'] = 'Object';
|
||||||
|
$lang['ut_resource'] = 'Resource';
|
||||||
|
$lang['ut_null'] = 'Null';
|
||||||
|
$lang['ut_notes'] = 'Notes';
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file unit_test_lang.php */
|
||||||
|
/* Location: ./system/language/english/unit_test_lang.php */
|
22
application/language/english/upload_lang.php
Normal file
22
application/language/english/upload_lang.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$lang['upload_userfile_not_set'] = "Unable to find a post variable called userfile.";
|
||||||
|
$lang['upload_file_exceeds_limit'] = "The uploaded file exceeds the maximum allowed size in your PHP configuration file.";
|
||||||
|
$lang['upload_file_exceeds_form_limit'] = "The uploaded file exceeds the maximum size allowed by the submission form.";
|
||||||
|
$lang['upload_file_partial'] = "The file was only partially uploaded.";
|
||||||
|
$lang['upload_no_temp_directory'] = "The temporary folder is missing.";
|
||||||
|
$lang['upload_unable_to_write_file'] = "The file could not be written to disk.";
|
||||||
|
$lang['upload_stopped_by_extension'] = "The file upload was stopped by extension.";
|
||||||
|
$lang['upload_no_file_selected'] = "You did not select a file to upload.";
|
||||||
|
$lang['upload_invalid_filetype'] = "The filetype you are attempting to upload is not allowed.";
|
||||||
|
$lang['upload_invalid_filesize'] = "The file you are attempting to upload is larger than the permitted size.";
|
||||||
|
$lang['upload_invalid_dimensions'] = "The image you are attempting to upload exceedes the maximum height or width.";
|
||||||
|
$lang['upload_destination_error'] = "A problem was encountered while attempting to move the uploaded file to the final destination.";
|
||||||
|
$lang['upload_no_filepath'] = "The upload path does not appear to be valid.";
|
||||||
|
$lang['upload_no_file_types'] = "You have not specified any allowed file types.";
|
||||||
|
$lang['upload_bad_filename'] = "The file name you submitted already exists on the server.";
|
||||||
|
$lang['upload_not_writable'] = "The upload destination folder does not appear to be writable.";
|
||||||
|
|
||||||
|
|
||||||
|
/* End of file upload_lang.php */
|
||||||
|
/* Location: ./system/language/english/upload_lang.php */
|
1398
application/libraries/UploadHandler.php
Normal file
1398
application/libraries/UploadHandler.php
Normal file
File diff suppressed because it is too large
Load diff
1083
application/libraries/excel/excel.php
Normal file
1083
application/libraries/excel/excel.php
Normal file
File diff suppressed because it is too large
Load diff
271
application/libraries/excel/excel/oleread.php
Normal file
271
application/libraries/excel/excel/oleread.php
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
<?php
|
||||||
|
define('NUM_BIG_BLOCK_DEPOT_BLOCKS_POS', 0x2c);
|
||||||
|
define('SMALL_BLOCK_DEPOT_BLOCK_POS', 0x3c);
|
||||||
|
define('ROOT_START_BLOCK_POS', 0x30);
|
||||||
|
define('BIG_BLOCK_SIZE', 0x200);
|
||||||
|
define('SMALL_BLOCK_SIZE', 0x40);
|
||||||
|
define('EXTENSION_BLOCK_POS', 0x44);
|
||||||
|
define('NUM_EXTENSION_BLOCK_POS', 0x48);
|
||||||
|
define('PROPERTY_STORAGE_BLOCK_SIZE', 0x80);
|
||||||
|
define('BIG_BLOCK_DEPOT_BLOCKS_POS', 0x4c);
|
||||||
|
define('SMALL_BLOCK_THRESHOLD', 0x1000);
|
||||||
|
// property storage offsets
|
||||||
|
define('SIZE_OF_NAME_POS', 0x40);
|
||||||
|
define('TYPE_POS', 0x42);
|
||||||
|
define('START_BLOCK_POS', 0x74);
|
||||||
|
define('SIZE_POS', 0x78);
|
||||||
|
define('IDENTIFIER_OLE', pack("CCCCCCCC",0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1));
|
||||||
|
|
||||||
|
//echo 'ROOT_START_BLOCK_POS = '.ROOT_START_BLOCK_POS."\n";
|
||||||
|
|
||||||
|
//echo bin2hex($data[ROOT_START_BLOCK_POS])."\n";
|
||||||
|
//echo "a=";
|
||||||
|
//echo $data[ROOT_START_BLOCK_POS];
|
||||||
|
//function log
|
||||||
|
|
||||||
|
function GetInt4d($data, $pos)
|
||||||
|
{
|
||||||
|
$value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24);
|
||||||
|
if ($value>=4294967294)
|
||||||
|
{
|
||||||
|
$value=-2;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class OLERead {
|
||||||
|
var $data = '';
|
||||||
|
|
||||||
|
|
||||||
|
function OLERead(){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function read($sFileName){
|
||||||
|
|
||||||
|
// check if file exist and is readable (Darko Miljanovic)
|
||||||
|
if(!is_readable($sFileName)) {
|
||||||
|
$this->error = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data = @file_get_contents($sFileName);
|
||||||
|
if (!$this->data) {
|
||||||
|
$this->error = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//echo IDENTIFIER_OLE;
|
||||||
|
//echo 'start';
|
||||||
|
if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {
|
||||||
|
$this->error = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->numBigBlockDepotBlocks = GetInt4d($this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
|
||||||
|
$this->sbdStartBlock = GetInt4d($this->data, SMALL_BLOCK_DEPOT_BLOCK_POS);
|
||||||
|
$this->rootStartBlock = GetInt4d($this->data, ROOT_START_BLOCK_POS);
|
||||||
|
$this->extensionBlock = GetInt4d($this->data, EXTENSION_BLOCK_POS);
|
||||||
|
$this->numExtensionBlocks = GetInt4d($this->data, NUM_EXTENSION_BLOCK_POS);
|
||||||
|
|
||||||
|
/*
|
||||||
|
echo $this->numBigBlockDepotBlocks." ";
|
||||||
|
echo $this->sbdStartBlock." ";
|
||||||
|
echo $this->rootStartBlock." ";
|
||||||
|
echo $this->extensionBlock." ";
|
||||||
|
echo $this->numExtensionBlocks." ";
|
||||||
|
*/
|
||||||
|
//echo "sbdStartBlock = $this->sbdStartBlock\n";
|
||||||
|
$bigBlockDepotBlocks = array();
|
||||||
|
$pos = BIG_BLOCK_DEPOT_BLOCKS_POS;
|
||||||
|
// echo "pos = $pos";
|
||||||
|
$bbdBlocks = $this->numBigBlockDepotBlocks;
|
||||||
|
|
||||||
|
if ($this->numExtensionBlocks != 0) {
|
||||||
|
$bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < $bbdBlocks; $i++) {
|
||||||
|
$bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
|
||||||
|
$pos += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for ($j = 0; $j < $this->numExtensionBlocks; $j++) {
|
||||||
|
$pos = ($this->extensionBlock + 1) * BIG_BLOCK_SIZE;
|
||||||
|
$blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, BIG_BLOCK_SIZE / 4 - 1);
|
||||||
|
|
||||||
|
for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; $i++) {
|
||||||
|
$bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos);
|
||||||
|
$pos += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bbdBlocks += $blocksToRead;
|
||||||
|
if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
|
||||||
|
$this->extensionBlock = GetInt4d($this->data, $pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// var_dump($bigBlockDepotBlocks);
|
||||||
|
|
||||||
|
// readBigBlockDepot
|
||||||
|
$pos = 0;
|
||||||
|
$index = 0;
|
||||||
|
$this->bigBlockChain = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < $this->numBigBlockDepotBlocks; $i++) {
|
||||||
|
$pos = ($bigBlockDepotBlocks[$i] + 1) * BIG_BLOCK_SIZE;
|
||||||
|
//echo "pos = $pos";
|
||||||
|
for ($j = 0 ; $j < BIG_BLOCK_SIZE / 4; $j++) {
|
||||||
|
$this->bigBlockChain[$index] = GetInt4d($this->data, $pos);
|
||||||
|
$pos += 4 ;
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($this->bigBlockChain);
|
||||||
|
//echo '=====2';
|
||||||
|
// readSmallBlockDepot();
|
||||||
|
$pos = 0;
|
||||||
|
$index = 0;
|
||||||
|
$sbdBlock = $this->sbdStartBlock;
|
||||||
|
$this->smallBlockChain = array();
|
||||||
|
|
||||||
|
while ($sbdBlock != -2) {
|
||||||
|
|
||||||
|
$pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE;
|
||||||
|
|
||||||
|
for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) {
|
||||||
|
$this->smallBlockChain[$index] = GetInt4d($this->data, $pos);
|
||||||
|
$pos += 4;
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sbdBlock = $this->bigBlockChain[$sbdBlock];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// readData(rootStartBlock)
|
||||||
|
$block = $this->rootStartBlock;
|
||||||
|
$pos = 0;
|
||||||
|
$this->entry = $this->__readData($block);
|
||||||
|
|
||||||
|
/*
|
||||||
|
while ($block != -2) {
|
||||||
|
$pos = ($block + 1) * BIG_BLOCK_SIZE;
|
||||||
|
$this->entry = $this->entry.substr($this->data, $pos, BIG_BLOCK_SIZE);
|
||||||
|
$block = $this->bigBlockChain[$block];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//echo '==='.$this->entry."===";
|
||||||
|
$this->__readPropertySets();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function __readData($bl) {
|
||||||
|
$block = $bl;
|
||||||
|
$pos = 0;
|
||||||
|
$data = '';
|
||||||
|
|
||||||
|
while ($block != -2) {
|
||||||
|
$pos = ($block + 1) * BIG_BLOCK_SIZE;
|
||||||
|
$data = $data.substr($this->data, $pos, BIG_BLOCK_SIZE);
|
||||||
|
//echo "pos = $pos data=$data\n";
|
||||||
|
$block = $this->bigBlockChain[$block];
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function __readPropertySets(){
|
||||||
|
$offset = 0;
|
||||||
|
//var_dump($this->entry);
|
||||||
|
while ($offset < strlen($this->entry)) {
|
||||||
|
$d = substr($this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE);
|
||||||
|
|
||||||
|
$nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS+1]) << 8);
|
||||||
|
|
||||||
|
$type = ord($d[TYPE_POS]);
|
||||||
|
//$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1;
|
||||||
|
|
||||||
|
$startBlock = GetInt4d($d, START_BLOCK_POS);
|
||||||
|
$size = GetInt4d($d, SIZE_POS);
|
||||||
|
|
||||||
|
$name = '';
|
||||||
|
for ($i = 0; $i < $nameSize ; $i++) {
|
||||||
|
$name .= $d[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = str_replace("\x00", "", $name);
|
||||||
|
|
||||||
|
$this->props[] = array (
|
||||||
|
'name' => $name,
|
||||||
|
'type' => $type,
|
||||||
|
'startBlock' => $startBlock,
|
||||||
|
'size' => $size);
|
||||||
|
|
||||||
|
if (($name == "Workbook") || ($name == "Book")) {
|
||||||
|
$this->wrkbook = count($this->props) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "Root Entry") {
|
||||||
|
$this->rootentry = count($this->props) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo "name ==$name=\n";
|
||||||
|
|
||||||
|
|
||||||
|
$offset += PROPERTY_STORAGE_BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getWorkBook(){
|
||||||
|
if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD){
|
||||||
|
// getSmallBlockStream(PropertyStorage ps)
|
||||||
|
|
||||||
|
$rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']);
|
||||||
|
|
||||||
|
$streamData = '';
|
||||||
|
$block = $this->props[$this->wrkbook]['startBlock'];
|
||||||
|
//$count = 0;
|
||||||
|
$pos = 0;
|
||||||
|
while ($block != -2) {
|
||||||
|
$pos = $block * SMALL_BLOCK_SIZE;
|
||||||
|
$streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE);
|
||||||
|
|
||||||
|
$block = $this->smallBlockChain[$block];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $streamData;
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE;
|
||||||
|
if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) {
|
||||||
|
$numBlocks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($numBlocks == 0) return '';
|
||||||
|
|
||||||
|
//echo "numBlocks = $numBlocks\n";
|
||||||
|
//byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE];
|
||||||
|
//print_r($this->wrkbook);
|
||||||
|
$streamData = '';
|
||||||
|
$block = $this->props[$this->wrkbook]['startBlock'];
|
||||||
|
//$count = 0;
|
||||||
|
$pos = 0;
|
||||||
|
//echo "block = $block";
|
||||||
|
while ($block != -2) {
|
||||||
|
$pos = ($block + 1) * BIG_BLOCK_SIZE;
|
||||||
|
$streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE);
|
||||||
|
$block = $this->bigBlockChain[$block];
|
||||||
|
}
|
||||||
|
//echo 'stream'.$streamData;
|
||||||
|
return $streamData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
170
application/libraries/html2pdf/_class/exception.class.php
Normal file
170
application/libraries/html2pdf/_class/exception.class.php
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* HTML2PDF Librairy - HTML2PDF Exception
|
||||||
|
*
|
||||||
|
* HTML => PDF convertor
|
||||||
|
* distributed under the LGPL License
|
||||||
|
*
|
||||||
|
* @author Laurent MINGUET <webmaster@html2pdf.fr>
|
||||||
|
* @version 4.04
|
||||||
|
*/
|
||||||
|
class HTML2PDF_exception extends exception
|
||||||
|
{
|
||||||
|
protected $_tag = null;
|
||||||
|
protected $_html = null;
|
||||||
|
protected $_other = null;
|
||||||
|
protected $_image = null;
|
||||||
|
protected $_messageHtml = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* generate a HTML2PDF exception
|
||||||
|
*
|
||||||
|
* @param int $err error number
|
||||||
|
* @param mixed $other additionnal informations
|
||||||
|
* @param string $html additionnal informations
|
||||||
|
*
|
||||||
|
* @return string $html optionnal code HTML associated to the error
|
||||||
|
*/
|
||||||
|
final public function __construct($err = 0, $other = null, $html = '')
|
||||||
|
{
|
||||||
|
// read the error
|
||||||
|
switch($err)
|
||||||
|
{
|
||||||
|
case 1: // Unsupported tag
|
||||||
|
$msg = (HTML2PDF_locale::get('err01'));
|
||||||
|
$msg = str_replace('[[OTHER]]', $other, $msg);
|
||||||
|
$this->_tag = $other;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // too long sentence
|
||||||
|
$msg = (HTML2PDF_locale::get('err02'));
|
||||||
|
$msg = str_replace('[[OTHER_0]]', $other[0], $msg);
|
||||||
|
$msg = str_replace('[[OTHER_1]]', $other[1], $msg);
|
||||||
|
$msg = str_replace('[[OTHER_2]]', $other[2], $msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // closing tag in excess
|
||||||
|
$msg = (HTML2PDF_locale::get('err03'));
|
||||||
|
$msg = str_replace('[[OTHER]]', $other, $msg);
|
||||||
|
$this->_tag = $other;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: // tags closed in the wrong order
|
||||||
|
$msg = (HTML2PDF_locale::get('err04'));
|
||||||
|
$msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // unclosed tag
|
||||||
|
$msg = (HTML2PDF_locale::get('err05'));
|
||||||
|
$msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6: // image can not be loaded
|
||||||
|
$msg = (HTML2PDF_locale::get('err06'));
|
||||||
|
$msg = str_replace('[[OTHER]]', $other, $msg);
|
||||||
|
$this->_image = $other;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7: // too big TD content
|
||||||
|
$msg = (HTML2PDF_locale::get('err07'));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8: // SVG tag not in DRAW tag
|
||||||
|
$msg = (HTML2PDF_locale::get('err08'));
|
||||||
|
$msg = str_replace('[[OTHER]]', $other, $msg);
|
||||||
|
$this->_tag = $other;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9: // deprecated
|
||||||
|
$msg = (HTML2PDF_locale::get('err09'));
|
||||||
|
$msg = str_replace('[[OTHER_0]]', $other[0], $msg);
|
||||||
|
$msg = str_replace('[[OTHER_1]]', $other[1], $msg);
|
||||||
|
$this->_tag = $other[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0: // specific error
|
||||||
|
default:
|
||||||
|
$msg = $other;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the HTML message
|
||||||
|
$this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">';
|
||||||
|
$this->_messageHtml.= HTML2PDF_locale::get('txt01', 'error: ').$err.'</span><br>';
|
||||||
|
$this->_messageHtml.= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>';
|
||||||
|
$this->_messageHtml.= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>';
|
||||||
|
$this->_messageHtml.= '<br>';
|
||||||
|
$this->_messageHtml.= $msg;
|
||||||
|
|
||||||
|
// create the text message
|
||||||
|
$msg = HTML2PDF_locale::get('txt01', 'error: ').$err.' : '.strip_tags($msg);
|
||||||
|
|
||||||
|
// add the optionnal html content
|
||||||
|
if ($html) {
|
||||||
|
$this->_messageHtml.= "<br><br>HTML : ...".trim(htmlentities($html)).'...';
|
||||||
|
$this->_html = $html;
|
||||||
|
$msg.= ' HTML : ...'.trim($html).'...';
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the other informations
|
||||||
|
$this->_other = $other;
|
||||||
|
|
||||||
|
// construct the exception
|
||||||
|
parent::__construct($msg, $err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the message as string
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string $messageHtml
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->_messageHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the html tag name
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string $tagName
|
||||||
|
*/
|
||||||
|
public function getTAG()
|
||||||
|
{
|
||||||
|
return $this->_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the optional html code
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string $html
|
||||||
|
*/
|
||||||
|
public function getHTML()
|
||||||
|
{
|
||||||
|
return $this->_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the optional other informations
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return mixed $other
|
||||||
|
*/
|
||||||
|
public function getOTHER()
|
||||||
|
{
|
||||||
|
return $this->_other;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the image source
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string $imageSrc
|
||||||
|
*/
|
||||||
|
public function getIMAGE()
|
||||||
|
{
|
||||||
|
return $this->_image;
|
||||||
|
}
|
||||||
|
}
|
95
application/libraries/html2pdf/_class/locale.class.php
Normal file
95
application/libraries/html2pdf/_class/locale.class.php
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* HTML2PDF Librairy - HTML2PDF Locale
|
||||||
|
*
|
||||||
|
* HTML => PDF convertor
|
||||||
|
* distributed under the LGPL License
|
||||||
|
*
|
||||||
|
* @author Laurent MINGUET <webmaster@html2pdf.fr>
|
||||||
|
* @version 4.04
|
||||||
|
*/
|
||||||
|
class HTML2PDF_locale
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* code of the current used locale
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
static protected $_code = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* texts of the current used locale
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
static protected $_list = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* directory where locale files are
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
static protected $_directory = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* load the locale
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $code
|
||||||
|
*/
|
||||||
|
static public function load($code)
|
||||||
|
{
|
||||||
|
if (self::$_directory===null) {
|
||||||
|
self::$_directory = dirname(dirname(__FILE__)).'/locale/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// must be in lower case
|
||||||
|
$code = strtolower($code);
|
||||||
|
|
||||||
|
// must be [a-z-0-9]
|
||||||
|
if (!preg_match('/^([a-z0-9]+)$/isU', $code)) {
|
||||||
|
throw new HTML2PDF_exception(0, 'invalid language code ['.self::$_code.']');
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the code
|
||||||
|
self::$_code = $code;
|
||||||
|
|
||||||
|
// get the name of the locale file
|
||||||
|
$file = self::$_directory.self::$_code.'.csv';
|
||||||
|
|
||||||
|
// the file must exist
|
||||||
|
if (!is_file($file)) {
|
||||||
|
throw new HTML2PDF_exception(0, 'language code ['.self::$_code.'] unknown. You can create the translation file ['.$file.'] and send it to the webmaster of html2pdf in order to integrate it into a future release');
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the file
|
||||||
|
self::$_list = array();
|
||||||
|
$handle = fopen($file, 'r');
|
||||||
|
while (!feof($handle)) {
|
||||||
|
$line = fgetcsv($handle);
|
||||||
|
if (count($line)!=2) continue;
|
||||||
|
self::$_list[trim($line[0])] = trim($line[1]);
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clean the locale
|
||||||
|
*
|
||||||
|
* @access public static
|
||||||
|
*/
|
||||||
|
static public function clean()
|
||||||
|
{
|
||||||
|
self::$_code = null;
|
||||||
|
self::$_list = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a text
|
||||||
|
*
|
||||||
|
* @access public static
|
||||||
|
* @param string $key
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static public function get($key, $default='######')
|
||||||
|
{
|
||||||
|
return (isset(self::$_list[$key]) ? self::$_list[$key] : $default);
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue