初始版本
This commit is contained in:
26
404.html
Executable file
26
404.html
Executable file
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>404</title>
|
||||
<style>
|
||||
body{
|
||||
background-color:#444;
|
||||
font-size:14px;
|
||||
}
|
||||
h3{
|
||||
font-size:60px;
|
||||
color:#eee;
|
||||
text-align:center;
|
||||
padding-top:30px;
|
||||
font-weight:normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>404,您请求的文件不存在!</h3>
|
||||
</body>
|
||||
</html>
|
||||
1
application/.htaccess
Executable file
1
application/.htaccess
Executable file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
1
application/cache/.htaccess
vendored
Executable file
1
application/cache/.htaccess
vendored
Executable file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
10
application/cache/index.html
vendored
Executable file
10
application/cache/index.html
vendored
Executable 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
Executable file
116
application/config/autoload.php
Executable 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 */
|
||||
387
application/config/config.php
Executable file
387
application/config/config.php
Executable file
@@ -0,0 +1,387 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 数据库备份路径
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 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';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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 try to guess the protocol, domain
|
||||
| and path to your installation. However, you should always configure this
|
||||
| explicitly and never rely on auto-guessing, especially in production
|
||||
| environments.
|
||||
|
|
||||
*/
|
||||
$config['base_url'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = 'english';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = 'istheme.com';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_cookie_name'] = 'ci_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'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$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
Executable file
41
application/config/constants.php
Executable 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 */
|
||||
69
application/config/database.php
Executable file
69
application/config/database.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
$active_group = 'default';
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = 'localhost';
|
||||
$db['default']['username'] = 'jxc_vegoo_com';
|
||||
$db['default']['password'] = 'ijZcPRtXsmksfEWC';
|
||||
$db['default']['database'] = 'jxc_vegoo_com';
|
||||
$db['default']['dbdriver'] = 'mysql';
|
||||
$db['default']['dbprefix'] = 'ci_';
|
||||
$db['default']['pconnect'] = TRUE;
|
||||
$db['default']['db_debug'] = TRUE;
|
||||
$db['default']['cache_on'] = FALSE;
|
||||
$db['default']['cachedir'] = './data/cache/';
|
||||
$db['default']['char_set'] = 'utf8';
|
||||
$db['default']['dbcollat'] = 'utf8_general_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
Executable file
15
application/config/doctypes.php
Executable 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
Executable file
64
application/config/foreign_chars.php
Executable 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
Executable file
16
application/config/hooks.php
Executable 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
Executable file
10
application/config/index.html
Executable 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
Executable file
41
application/config/migration.php
Executable 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
Executable file
106
application/config/mimes.php
Executable 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
Executable file
17
application/config/profiler.php
Executable 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 */
|
||||
46
application/config/routes.php
Executable file
46
application/config/routes.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?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/index";
|
||||
$route['404_override'] = '';
|
||||
|
||||
|
||||
/* End of file routes.php */
|
||||
/* Location: ./application/config/routes.php */
|
||||
66
application/config/smileys.php
Executable file
66
application/config/smileys.php
Executable 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
Executable file
178
application/config/user_agents.php
Executable 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 */
|
||||
264
application/controllers/basedata/assist.php
Executable file
264
application/controllers/basedata/assist.php
Executable file
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Assist extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$typeNumber = str_enhtml($this->input->get('typeNumber',TRUE));
|
||||
$skey = str_enhtml($this->input->get('skey',TRUE));
|
||||
$where = '(isDelete=0) and typeNumber="'.$typeNumber.'"';
|
||||
$where .= $skey ? ' and name like "%'.$skey.'%"' : '';
|
||||
$list = $this->mysql_model->get_results('category',$where,'path');
|
||||
$parentId = array_column($list, 'parentId');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['detail'] = in_array($row['id'],$parentId) ? 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'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//分类
|
||||
public function getAssistType(){
|
||||
$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')
|
||||
);
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = $v;
|
||||
$json['data']['totalsize'] = 5;
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$data = $this->validform(str_enhtml($this->input->post(NULL,TRUE)));
|
||||
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',elements(array('name','typeNumber','level','parentId'),$data));
|
||||
$sql = $this->mysql_model->update('category',array('path'=>$newid),array('id'=>$newid));
|
||||
} else {
|
||||
$cate = $this->mysql_model->get_rows('category',array('id'=>$data['parentId']));
|
||||
count($cate)<1 && str_alert(-1,'参数错误');
|
||||
$data['level'] = $cate['level'] + 1;
|
||||
$newid = $this->mysql_model->insert('category',elements(array('name','typeNumber','level','parentId'),$data));
|
||||
$sql = $this->mysql_model->update('category',array('path'=>$cate['path'].','.$newid),array('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 = $this->validform(str_enhtml($this->input->post(NULL,TRUE)));
|
||||
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),array('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){
|
||||
$cate = $this->mysql_model->get_rows('category',array('id'=>$data['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<>'.$data['id'].') and find_in_set('.$data['id'].',path)'); //是否有子栏目
|
||||
$data['parentId'] == $data['id'] && str_alert(-1,'当前分类和上级分类不能相同');
|
||||
if ($data['parentId']==0) { //多级转顶级
|
||||
$pare_depth = 1;
|
||||
if (count($pid_list)==0) { //ID不存在子栏目
|
||||
$this->mysql_model->update('category',array('parentId'=>0,'path'=>$data['id'],'level'=>1,'name'=>$data['name']),array('id'=>$data['id']));
|
||||
} else { //ID存在子栏目
|
||||
$this->mysql_model->update('category',array('parentId'=>0,'path'=>$data['id'],'level'=>1,'name'=>$data['name']),array('id'=>$data['id']));
|
||||
foreach($pid_list as $arr=>$row) {
|
||||
$path = str_replace(''.str_replace($data['id'],'',$old_path).'','',''.$row['path'].'');
|
||||
$pare_depth = substr_count($path,',')+1;
|
||||
$info[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth);
|
||||
}
|
||||
$this->mysql_model->update('category',$info,'id');
|
||||
}
|
||||
} else { //pid<>0时,顶级转多级 多级转多级
|
||||
$cate = $this->mysql_model->get_rows('category',array('id'=>$data['parentId'])); //获取原PID数据
|
||||
count($cate)<1 && str_alert(-1,'参数错误');
|
||||
$pare_pid = $cate['parentId'];
|
||||
$pare_path = $cate['path'];
|
||||
$pare_depth = $cate['level'];
|
||||
if ($old_pid==0) { //顶级转多级
|
||||
if (count($pid_list)==0) { //ID不存在子栏目
|
||||
$this->mysql_model->update('category',array('name'=>$data['name'],'parentId'=>$data['parentId'],'path'=>$pare_path.','.$data['id'],'level'=>$pare_depth+1),array('id'=>$data['id']));
|
||||
} else { //ID存在子栏目
|
||||
$this->mysql_model->update('category',array('name'=>$data['name'],'parentId'=>$data['parentId'],'path'=>$pare_path.','.$data['id'],'level'=>$pare_depth+1),array('id'=>$data['id']));
|
||||
foreach ($pid_list as $arr=>$row) {
|
||||
$path = $pare_path.','.$row['path'];
|
||||
$pare_depth = substr_count($path,',')+1;
|
||||
$info[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth);
|
||||
}
|
||||
$this->mysql_model->update('category',$info,'id');
|
||||
}
|
||||
} else { //多级转多级
|
||||
if (count($pid_list)==0) { //ID不存在子栏目
|
||||
$this->mysql_model->update('category',array('name'=>$data['name'],'parentId'=>$data['parentId'],'path'=>$pare_path.','.$data['id'],'level'=>$pare_depth+1),array('id'=>$data['id']));
|
||||
} else { //ID存在子栏目
|
||||
$this->mysql_model->update('category',array('name'=>$data['name'],'parentId'=>$data['parentId'],'path'=>$pare_path.','.$data['id'],'level'=>$pare_depth+1),array('id'=>$data['id']));
|
||||
foreach ($pid_list as $arr=>$row) {
|
||||
$path = $pare_path.','.str_replace(str_replace($data['id'],'',$old_path),'',$row['path']);
|
||||
$pare_depth = substr_count($path,',')+1;
|
||||
$info[] = array('id'=>$row['id'],'path'=>$path,'level'=>$pare_depth+1);
|
||||
}
|
||||
$this->mysql_model->update('category',$info,'id');
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['level'] = $pare_depth;
|
||||
$this->mysql_model->update('goods',array('categoryName'=>$data['name']),array('categoryId'=>$data['id']));
|
||||
$this->common_model->logs('修改类别:ID='.$data['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);
|
||||
}
|
||||
|
||||
|
||||
//分类删除
|
||||
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_rows('category',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('goods',array('isDelete'=>0,'categoryId'=>$id))>0 && str_alert(-1,'辅助资料已经被使用');
|
||||
$this->mysql_model->get_count('contact',array('isDelete'=>0,'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',array('isDelete'=>1),array('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['id'] = isset($data['id']) ? intval($data['id']) :0;
|
||||
$data['parentId'] = isset($data['parentId']) ? intval($data['parentId']):0;
|
||||
strlen($data['name']) < 1 && str_alert(-1,'类别名称不能为空');
|
||||
strlen($data['typeNumber']) < 1 && str_alert(-1,'参数错误');
|
||||
$where['isDelete'] = 0;
|
||||
$where['name'] = $data['name'];
|
||||
$where['typeNumber'] = $data['typeNumber'];
|
||||
$where['id !='] = $data['id']>0 ? $data['id'] :0;
|
||||
$this->mysql_model->get_count('category',$where) > 0 && str_alert(-1,'类别名称重复');
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
69
application/controllers/basedata/assistSku.php
Executable file
69
application/controllers/basedata/assistSku.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?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(){
|
||||
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||
$where['isDelete'] = 0;
|
||||
$where['skuClassId'] = intval($this->input->get('skuClassId',TRUE));
|
||||
$list = $this->mysql_model->get_results('assistsku',$where,'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'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
//新增
|
||||
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',array('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,'添加失败');
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete(){
|
||||
$this->common_model->checkpurview(59);
|
||||
$id = intval($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('assistsku',array('skuId'=>$id));
|
||||
if (count($data)>0) {
|
||||
$sql = $this->mysql_model->update('assistsku',array('isDelete'=>1),array('skuId'=>$id));
|
||||
if ($sql) {
|
||||
$this->common_model->logs('删除规格:ID='.$id.' 名称:'.$data['skuName']);
|
||||
str_alert(200,'success');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'删除失败');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
91
application/controllers/basedata/assistType.php
Executable file
91
application/controllers/basedata/assistType.php
Executable file
@@ -0,0 +1,91 @@
|
||||
<?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() {
|
||||
$list = $this->mysql_model->get_results('assistingprop',array('isDelete'=>0),'id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
$v[$arr]['del'] = false;
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
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','(isDelete=0) 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_rows('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,'删除失败');
|
||||
}
|
||||
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = intval($data['id']);
|
||||
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||
strlen($data['type']) < 1 && str_alert(-1,'编号不能为空');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
394
application/controllers/basedata/contact.php
Executable file
394
application/controllers/basedata/contact.php
Executable file
@@ -0,0 +1,394 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Contact extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
//客户、供应商列表
|
||||
public function index() {
|
||||
$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 = '(isDelete=0) and type='.$type;
|
||||
$where .= $this->common_model->get_contact_purview();
|
||||
$where .= $skey ? ' and (number like "%'.$skey.'%" or name like "%'.$skey.'%" or linkMans like "%'.$skey.'%")' : '';
|
||||
$where .= $categoryid>0 ? ' and cCategory = '.$categoryid.'' : '';
|
||||
$list = $this->mysql_model->get_results('contact',$where,'id desc',$rows*($page-1),$rows);
|
||||
//if($type == 10){
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = 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'] = '';
|
||||
$v[$arr]['linkMen'] = $row['linkMans'];//add by michen 20170724
|
||||
if (strlen($row['linkMans'])>0) {
|
||||
$list = (array)json_decode($row['linkMans'],true);
|
||||
foreach ($list as $arr1=>$row1) {
|
||||
if ($row1['linkFirst']==1) {
|
||||
$v[$arr]['contacter'] = $row1['linkName'];
|
||||
$v[$arr]['mobile'] = $row1['linkMobile'];
|
||||
$v[$arr]['place'] = $row1['linkPlace'];
|
||||
$v[$arr]['telephone'] = $row1['linkPhone'];
|
||||
$v[$arr]['linkIm'] = $row1['linkIm'];
|
||||
$v[$arr]['city'] = $row1['city'];
|
||||
$v[$arr]['county'] = $row1['county'];
|
||||
$v[$arr]['province'] = $row1['province'];
|
||||
$v[$arr]['deliveryAddress'] = $row1['address'];
|
||||
$v[$arr]['firstLink']['first'] = $row1['linkFirst'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*}else{
|
||||
//add by michen 20170720 begin
|
||||
$gid = 1;
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = 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'] = '';
|
||||
$i = 1;
|
||||
if (strlen($row['linkMans'])>0) {
|
||||
$list = (array)json_decode($row['linkMans'],true);
|
||||
foreach ($list as $arr1=>$row1) {
|
||||
if ($i==1) {
|
||||
$v[$arr]['contacter'] = $row1['linkName'];
|
||||
$v[$arr]['mobile'] = $row1['linkMobile'];
|
||||
$v[$arr]['place'] = $row1['linkPlace'];
|
||||
$v[$arr]['telephone'] = $row1['linkPhone'];
|
||||
$v[$arr]['linkIm'] = $row1['linkIm'];
|
||||
$v[$arr]['city'] = $row1['city'];
|
||||
$v[$arr]['county'] = $row1['county'];
|
||||
$v[$arr]['province'] = $row1['province'];
|
||||
$v[$arr]['deliveryAddress'] = $row1['address'];
|
||||
$v[$arr]['firstLink']['first'] = $row1['linkFirst'];
|
||||
$v[$arr]['isFirst'] = $row1['linkFirst']==1?1:2;
|
||||
$v[$arr]['gid'] = $gid;
|
||||
}else{
|
||||
$v[$arr.$i]['id'] = intval($row['id']);
|
||||
$v[$arr.$i]['number'] = $row['number'];
|
||||
$v[$arr.$i]['cCategory'] = intval($row['cCategory']);
|
||||
$v[$arr.$i]['customerType'] = $row['cCategoryName'];
|
||||
$v[$arr.$i]['pinYin'] = $row['pinYin'];
|
||||
$v[$arr.$i]['name'] = $row['name'];
|
||||
$v[$arr.$i]['type'] = $row['type'];
|
||||
$v[$arr.$i]['delete'] = intval($row['disable'])==1 ? true : false;
|
||||
$v[$arr.$i]['cLevel'] = intval($row['cLevel']);
|
||||
$v[$arr.$i]['amount'] = (float)$row['amount'];
|
||||
$v[$arr.$i]['periodMoney'] = (float)$row['periodMoney'];
|
||||
$v[$arr.$i]['difMoney'] = (float)$row['difMoney'];
|
||||
$v[$arr.$i]['remark'] = $row['remark'];
|
||||
$v[$arr.$i]['taxRate'] = (float)$row['taxRate'];
|
||||
$v[$arr.$i]['links'] = '';
|
||||
$v[$arr.$i]['contacter'] = $row1['linkName'];
|
||||
$v[$arr.$i]['mobile'] = $row1['linkMobile'];
|
||||
$v[$arr.$i]['place'] = $row1['linkPlace'];
|
||||
$v[$arr.$i]['telephone'] = $row1['linkPhone'];
|
||||
$v[$arr.$i]['linkIm'] = $row1['linkIm'];
|
||||
$v[$arr.$i]['city'] = $row1['city'];
|
||||
$v[$arr.$i]['county'] = $row1['county'];
|
||||
$v[$arr.$i]['province'] = $row1['province'];
|
||||
$v[$arr.$i]['deliveryAddress'] = $row1['address'];
|
||||
$v[$arr.$i]['firstLink']['first'] = $row1['linkFirst'];
|
||||
$v[$arr.$i]['isFirst'] = $row1['linkFirst']==1?1:2;
|
||||
$v[$arr]['gid'] = $gid;
|
||||
}
|
||||
$i++;
|
||||
$gid++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//add by michen 20170720 end
|
||||
}
|
||||
//add by michen 20170720 begin
|
||||
uasort($v,function ($x,$y){
|
||||
return strcasecmp($x['id'].$x['isFirst'],$y['id'].$x['isFirst']);
|
||||
}
|
||||
);
|
||||
$values = array_values($v);
|
||||
//add by michen 20170720 end
|
||||
*/
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->mysql_model->get_count('contact',$where);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? array_values($v) : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//校验客户编号
|
||||
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['name'] = $name;
|
||||
$where['isDelete'] = 0;
|
||||
$where['id !='] = $id>0 ? $id :'';
|
||||
$data = $this->mysql_model->get_rows('contact',array_filter($where));
|
||||
if (count($data)>0) {
|
||||
str_alert(-1,'客户名称重复');
|
||||
}
|
||||
str_alert(200,'success');
|
||||
}
|
||||
|
||||
function my_filter($item){
|
||||
if($item['linkFirst'] === 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getRecentlyContact(){
|
||||
$billType = str_enhtml($this->input->post('billType',TRUE));
|
||||
$transType = intval($this->input->post('transType',TRUE));
|
||||
$where = '(isDelete=0)';
|
||||
$where .= ($transType==150501||$transType==150502) ? ' and type=10' :' and type=-10';//mody by michen 20170820 修正购货退货单默认供应商不正确
|
||||
$where .= $this->common_model->get_contact_purview();
|
||||
$data = $this->mysql_model->get_rows('contact',$where);
|
||||
//die(var_export($data,true));
|
||||
if (count($data)>0) {
|
||||
//add by michen 20170724 begin
|
||||
/*$linkMen = (array)json_decode($data['linkMans'],true);
|
||||
$linkMan = "null";
|
||||
if(count($linkMen)>0){
|
||||
foreach ($linkMen as $key => $item){
|
||||
if($item['linkFirst'] === 1){
|
||||
$linkMan = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//add by michen 20170724 end
|
||||
die('{"status":200,"msg":"success","data":{"linkMen":'.$data['linkMans'].',"contactName":"'.$data['name'].'","buId":'.$data['id'].',"cLevel":0}}');
|
||||
} else {
|
||||
str_alert(-1,'');
|
||||
}
|
||||
}
|
||||
|
||||
public function getLinkMen(){
|
||||
$buId = intval($this->input->get('buId',TRUE));
|
||||
$data = $this->mysql_model->get_rows('contact','(isDelete=0) and id='.$buId);
|
||||
die($data['linkMans']);
|
||||
}
|
||||
|
||||
|
||||
//获取信息
|
||||
public function query() {
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$type = intval($this->input->get_post('type',TRUE));
|
||||
$data = $this->mysql_model->get_rows('contact',array('isDelete'=>0,'id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$info['id'] = $id;
|
||||
$info['cCategory'] = intval($data['cCategory']);
|
||||
$info['cLevel'] = intval($data['cLevel']);
|
||||
$info['number'] = $data['number'];
|
||||
$info['name'] = $data['name'];
|
||||
$info['amount'] = (float)$data['amount'];
|
||||
$info['remark'] = $data['remark'];
|
||||
$info['beginDate'] = $data['beginDate'];
|
||||
$info['periodMoney'] = (float)$data['periodMoney'];
|
||||
$info['difMoney'] = (float)$data['difMoney'];
|
||||
if ($type==10) {
|
||||
$info['taxRate'] = (float)$data['taxRate'];
|
||||
}
|
||||
$info['pinYin'] = $data['pinYin'];
|
||||
if (strlen($data['linkMans'])>0) {
|
||||
$list = (array)json_decode($data['linkMans'],true);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['address'] = $row['address'];
|
||||
$v[$arr]['city'] = $row['city'];
|
||||
$v[$arr]['contactId'] = time();
|
||||
$v[$arr]['county'] = $row['county'];
|
||||
$v[$arr]['email'] = isset($row['email']) ? $row['email'] : '';
|
||||
$v[$arr]['first'] = $row['linkFirst']==1 ? true : '';
|
||||
$v[$arr]['id'] = $arr+1;
|
||||
$v[$arr]['im'] = $row['linkIm'];
|
||||
$v[$arr]['mobile'] = $row['linkMobile'];
|
||||
$v[$arr]['place'] = $row['linkPlace'];
|
||||
$v[$arr]['name'] = $row['linkName'];
|
||||
$v[$arr]['phone'] = $row['linkPhone'];
|
||||
$v[$arr]['province'] = $row['province'];
|
||||
$v[$arr]['tempId'] = 0;
|
||||
}
|
||||
}
|
||||
$info['links'] = isset($v) ? $v : array();
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data'] = $info;
|
||||
die(json_encode($json));
|
||||
}
|
||||
str_alert(-1,'没有数据');
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$data = $this->validform($this->input->post(NULL,TRUE));
|
||||
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,'参数错误');
|
||||
}
|
||||
$this->mysql_model->get_count('contact',array('isDelete'=>0,'type'=>$data['type'],'number'=>$data['number'])) > 0 && str_alert(-1,'编号重复');
|
||||
$data = elements(array(
|
||||
'name','number','amount','beginDate','cCategory',
|
||||
'cCategoryName','cLevel','cLevelName','linkMans'
|
||||
,'periodMoney','remark','type','difMoney'),$data,NULL);
|
||||
$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']);
|
||||
str_alert(200,'success',$data);
|
||||
}
|
||||
str_alert(-1,'添加失败');
|
||||
}
|
||||
|
||||
|
||||
//修改
|
||||
public function update(){
|
||||
$data = $this->validform($this->input->post(NULL,TRUE));
|
||||
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,'参数错误');
|
||||
}
|
||||
$this->mysql_model->get_count('contact',array('id !='=>$data['id'],'isDelete'=>0,'type'=>$data['type'],'number'=>$data['number'])) > 0 && str_alert(-1,'编号重复');
|
||||
$info = elements(array(
|
||||
'name','number','amount','beginDate','cCategory',
|
||||
'cCategoryName','cLevel','cLevelName','linkMans'
|
||||
,'periodMoney','remark','type','difMoney'),$data,NULL);
|
||||
$sql = $this->mysql_model->update('contact',$info,array('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']);
|
||||
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) {
|
||||
$sql = $this->mysql_model->update('contact',array('disable'=>$disable),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
$this->common_model->logs('客户'.$disable==1?'禁用':'启用'.':ID:'.$id.'');
|
||||
str_alert(200,'success');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'操作失败');
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$this->load->library('lib_pinyin');
|
||||
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||
$data['cCategory'] = intval($data['cCategory']);
|
||||
$data['cLevel'] = (float)$data['cLevel'];
|
||||
$data['taxRate'] = isset($data['taxRate']) ? (float)$data['taxRate'] :0;
|
||||
$data['periodMoney'] = (float)$data['periodMoney'];
|
||||
$data['amount'] = (float)$data['amount'];
|
||||
$data['linkMans'] = $data['linkMans'] ? $data['linkMans'] :"[]";
|
||||
$data['beginDate'] = $data['beginDate'] ? $data['beginDate'] : date('Y-m-d');
|
||||
$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',array('id'=>$data['cCategory']),'name');
|
||||
$data['cCategory'] < 1 && str_alert(-1,'类别名称不能为空');
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
163
application/controllers/basedata/cst.php
Executable file
163
application/controllers/basedata/cst.php
Executable file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Cst extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
//员工列表
|
||||
public function index(){
|
||||
$cstno = ($this->input->get('cstno',TRUE));
|
||||
if(!empty($cstno)){
|
||||
$customer = explode("_",$cstno);
|
||||
$cstno = $customer[0];
|
||||
}
|
||||
$sql = 'select
|
||||
a.*,b.name as deptName
|
||||
from '.$this->db->dbprefix('staff').' as a
|
||||
left join '.$this->db->dbprefix('contact').' as b on b.id=a.deptId
|
||||
where a.isDelete=0 and a.deptId<>0 '.(empty($cstno)?'':' and deptId='.$cstno).' order by id desc';
|
||||
$list = $this->mysql_model->query($sql,2);
|
||||
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]['deptName'] = $row['deptName'];
|
||||
$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]['passWord'] = $row['passWord'];
|
||||
$v[$arr]['score'] = $row['score'];
|
||||
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false; //是否禁用
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(59);
|
||||
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||
if (count($data)>0) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('staff',array('isDelete'=>0,'number'=>$data['number'])) > 0 && str_alert(-1,'编号/账号重复');
|
||||
$sql = $this->mysql_model->insert('staff',elements(array('name','number','score','passWord','deptId'),$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) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('staff',array('isDelete'=>0,'number'=>$data['number'],'id !='=>$data['id'])) > 0 && str_alert(-1,'编号/账号重复');
|
||||
$sql = $this->mysql_model->update('staff',elements(array('name','number','score','passWord','deptId'),$data),array('id'=>$data['id']));
|
||||
if ($sql) {
|
||||
$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_rows('staff',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('invoice',array('isDelete'=>0,'salesId'=>$data['id']))>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||
$info['isDelete'] = 1;
|
||||
$sql = $this->mysql_model->update('staff',$info,array('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_rows('staff',array('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(){
|
||||
$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));
|
||||
$where = '(depId=0)';
|
||||
$where .= $skey ? ' and (name like "%'.$skey.'%" or number like "%'.$skey.'%")' : '';
|
||||
$offset = $rows * ($page-1);
|
||||
$list = $this->mysql_model->get_results('staff',$where,'id desc',$offset,$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
$v[$arr]['number'] = $row['number'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = $this->mysql_model->get_count('staff',$where);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = intval($data['id']);
|
||||
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||
$data['score'] = floatval($data['score']);
|
||||
if(isset($data['passWord'])){
|
||||
strlen($data['passWord']) < 1 && str_alert(-1,'密码不能为空');
|
||||
}else{
|
||||
$data['passWord'] = '';
|
||||
}
|
||||
$customer = explode("_",$data['deptName']);
|
||||
$data['deptId'] = $customer[0];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
27
application/controllers/basedata/customer.php
Executable file
27
application/controllers/basedata/customer.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?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 = '(isDelete=0) and type=-10 ';
|
||||
$where .= $this->common_model->get_customer_purview();
|
||||
$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',$where,'id desc');
|
||||
$this->load->view('settings/customer-export',$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
109
application/controllers/basedata/deliveryAddr.php
Executable file
109
application/controllers/basedata/deliveryAddr.php
Executable file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Deliveryaddr extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
//发货地址列表
|
||||
public function index(){
|
||||
$list = $this->mysql_model->get_results('address',array('isDelete'=>0),'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;
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
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,array('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_rows('address',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
//$this->mysql_model->get_count(INVSA,'(contactid in('.$id.'))')>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||
$sql = $this->mysql_model->update('address',array('isDelete'=>1),array('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_rows('address',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$json['data']['id'] = intval($data['id']);
|
||||
$json['data']['shortName'] = $data['shortName'];
|
||||
$json['data']['postalcode'] = $data['postalcode'];
|
||||
$json['data']['province'] = $data['province'];
|
||||
$json['data']['city'] = $data['city'];
|
||||
$json['data']['area'] = $data['area'];
|
||||
$json['data']['address'] = $data['address'];
|
||||
$json['data']['linkman'] = $data['linkman'];
|
||||
$json['data']['phone'] = $data['phone'];
|
||||
$json['data']['mobile'] = $data['mobile'];
|
||||
$json['data']['isDefault'] = intval($data['isdefault']);
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
die(json_encode($json));
|
||||
}
|
||||
str_alert(-1,'地址不存在');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
150
application/controllers/basedata/employee.php
Executable file
150
application/controllers/basedata/employee.php
Executable file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Employee extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
//员工列表
|
||||
public function index(){
|
||||
$list = $this->mysql_model->get_results('staff',array('isDelete'=>0,'deptId'=>0),'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]['passWord'] = $row['passWord'];
|
||||
$v[$arr]['score'] = $row['score'];
|
||||
$v[$arr]['delete'] = intval($row['disable'])==1 ? true : false; //是否禁用
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(59);
|
||||
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||
if (count($data)>0) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('staff',array('isDelete'=>0,'number'=>$data['number'])) > 0 && str_alert(-1,'编号/账号重复');
|
||||
$sql = $this->mysql_model->insert('staff',elements(array('name','number','score','passWord'),$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) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('staff',array('isDelete'=>0,'number'=>$data['number'],'id !='=>$data['id'])) > 0 && str_alert(-1,'编号/账号重复');
|
||||
$sql = $this->mysql_model->update('staff',elements(array('name','number','score','passWord'),$data),array('id'=>$data['id']));
|
||||
if ($sql) {
|
||||
$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_rows('staff',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('invoice',array('isDelete'=>0,'salesId'=>$data['id']))>0 && str_alert(-1,'其中有客户发生业务不可删除');
|
||||
$info['isDelete'] = 1;
|
||||
$sql = $this->mysql_model->update('staff',$info,array('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_rows('staff',array('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(){
|
||||
$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));
|
||||
$where = '(depId=0)';
|
||||
$where .= $skey ? ' and (name like "%'.$skey.'%" or number like "%'.$skey.'%")' : '';
|
||||
$offset = $rows * ($page-1);
|
||||
$list = $this->mysql_model->get_results('staff',$where,'id desc',$offset,$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
$v[$arr]['number'] = $row['number'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = $this->mysql_model->get_count('staff',$where);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = intval($data['id']);
|
||||
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||
$data['score'] = floatval($data['score']);
|
||||
if(isset($data['passWord'])){
|
||||
strlen($data['passWord']) < 1 && str_alert(-1,'密码不能为空');
|
||||
}else{
|
||||
$data['passWord'] = '';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
351
application/controllers/basedata/import.php
Executable file
351
application/controllers/basedata/import.php
Executable file
@@ -0,0 +1,351 @@
|
||||
<?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');
|
||||
$this->load->library('excel/excel_reader2');
|
||||
$this->load->library('pinyin/getpinyin');
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$dir = './data/upfile/' . date('Ymd') . '/';
|
||||
//$path = '/data/upfile/' . date('Ymd') . '/';
|
||||
$err = json_encode(array('url' => '', 'title' => '', 'state' => '请登录'));
|
||||
$info = upload('resume_file', $dir);
|
||||
if (is_array($info) && count($info) > 0) {
|
||||
//$array = array('url' => $path . $info['file'], 'title' => $path . $info['file'], 'state' => 'SUCCESS');
|
||||
print_r($info);
|
||||
die();
|
||||
} else {
|
||||
die($err);
|
||||
}
|
||||
}
|
||||
|
||||
//客户
|
||||
public function downloadtemplate1() {
|
||||
$info = read_file('./data/download/customer.xls');
|
||||
$this->common_model->logs('下载文件名:客户导入_'.date("YmdHis").'.xls');
|
||||
force_download('客户导入_'.date("YmdHis").'.xls', $info);
|
||||
}
|
||||
|
||||
//供应商
|
||||
public function downloadtemplate2() {
|
||||
$info = read_file('./data/download/vendor.xls');
|
||||
$this->common_model->logs('下载文件名:供应商导入_'.date("YmdHis").'.xls');
|
||||
force_download('供应商导入_'.date("YmdHis").'.xls', $info);
|
||||
}
|
||||
|
||||
//商品
|
||||
public function downloadtemplate3() {
|
||||
$info = read_file('./data/download/goods.xls');
|
||||
$this->common_model->logs('下载文件名:商品导入_'.date("YmdHis").'.xls');
|
||||
force_download('商品导入_'.date("YmdHis").'.xls', $info);
|
||||
}
|
||||
|
||||
//价格预警
|
||||
public function downloadtemplate4() {
|
||||
$info = read_file('./data/download/preprice.xls');
|
||||
$this->common_model->logs('下载文件名:价格预警导入_'.date("YmdHis").'.xls');
|
||||
force_download('价格预警导入_'.date("YmdHis").'.xls', $info);
|
||||
}
|
||||
|
||||
//客户导入
|
||||
public function findDataImporter() {
|
||||
$fn = (isset($_SERVER['HTTP_X_FILENAME']) ? $_SERVER['HTTP_X_FILENAME'] : false);
|
||||
print_r($fn);
|
||||
die();
|
||||
if ($fn) {
|
||||
file_put_contents(
|
||||
'upload/' . $fn,
|
||||
file_get_contents('php://input')
|
||||
);
|
||||
echo "http://119.10.11.187:82/AAAUPIMG/1/uploads/".$fn;
|
||||
exit();
|
||||
}
|
||||
print_r($_FILES);
|
||||
die();
|
||||
// $dir = './data/upfile/' . date('Ymd') . '/';
|
||||
// //$path = '/data/upfile/' . date('Ymd') . '/';
|
||||
// $err = json_encode(array('url' => '', 'title' => '', 'state' => '请登录'));
|
||||
// $info = upload('resume_file', $dir);
|
||||
// if (is_array($info) && count($info) > 0) {
|
||||
// //$array = array('url' => $path . $info['file'], 'title' => $path . $info['file'], 'state' => 'SUCCESS');
|
||||
// print_r($info);
|
||||
// die();
|
||||
// } else {
|
||||
// die($err);
|
||||
// }
|
||||
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}}');
|
||||
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}}');
|
||||
}
|
||||
|
||||
public function uploadExcel() {
|
||||
$path=$_FILES['file'];
|
||||
if($path['error']!= 0)
|
||||
str_alert(-1,'文件上传失败!');
|
||||
if($path['size']>20*1024*1024)
|
||||
str_alert(-1,'上传文件大小超过限制!');
|
||||
if($path['type']!='application/vnd.ms-excel' && strrchr($path['name'],'xls')!='xls'){
|
||||
str_alert(200,'上传的文件不是excel类型!');
|
||||
}
|
||||
//$filePath = "data/upload/".$path["name"];
|
||||
//move_uploaded_file($path["tmp_name"],$filePath);
|
||||
|
||||
//$reader = new Excel_reader2(); // 实例化解析类Spreadsheet_Excel_Reader
|
||||
$reader = $this->excel_reader2;
|
||||
$reader->setOutputEncoding("utf-8"); // 设置编码方式
|
||||
$reader->read("{$path['tmp_name']}");
|
||||
$data = $reader->sheets[0]['cells'];
|
||||
if(!isset($data[2])||!isset($data[2][1]))
|
||||
str_alert(-1,'无可导入的数据!');
|
||||
$first = array_shift($data);
|
||||
$itype = "";
|
||||
$this->db->trans_begin();
|
||||
if($first[1]=='商品编号'){
|
||||
$itype = "商品";
|
||||
foreach ($data as $arr=>$row) {
|
||||
if(empty($row[1]))
|
||||
continue;
|
||||
$good['number'] = $row[1];
|
||||
$good['name'] = $row[2];
|
||||
$good['barCode'] = $row[3];
|
||||
$good['spec'] = $row[4];
|
||||
//$good['categoryId'] = 1;
|
||||
//$good['categoryName'] = $row[5];
|
||||
//$good['locationId'] = $row[6];
|
||||
//$good['baseUnitId'] = $row[9];
|
||||
$good['purPrice'] = floatval($row[10]);
|
||||
$good['wholesalePrice'] = floatval($row[12]);
|
||||
$good['salePrice'] = floatval($row[11]);
|
||||
$good['pinYin'] = $this->getpinyin->getFirstPY($row[2]);
|
||||
$good['sonGoods'] = '[]';
|
||||
$good['dopey'] = 0;
|
||||
empty($row[5])&&str_alert(-1,'商品【'.$row[2].'】类别不能为空!');
|
||||
empty($row[6])&&str_alert(-1,'商品【'.$row[2].'】仓库不能为空!');
|
||||
empty($row[9])&&str_alert(-1,'商品【'.$row[2].'】计量单位不能为空!');
|
||||
$list = $this->mysql_model->get_rows('storage',array('isDelete'=>0,'name'=>$row[6]));
|
||||
if (count($list) > 0) {
|
||||
$good['locationId']= $list['id'];
|
||||
$good['locationName']= $row[6];
|
||||
}else
|
||||
str_alert(-1,'仓库【'.$row[6].'】不存在,请先添加仓库后再导入!');
|
||||
$list = $this->mysql_model->get_rows('category',array('name'=>$row[5],'typeNumber'=>'trade'));
|
||||
if (count($list) > 0) {
|
||||
$good['categoryId']= $list['id'];
|
||||
$good['categoryName']= $row[5];
|
||||
}else{
|
||||
str_alert(-1,'商品类别【'.$row[5].'】不存在,请先添加商品类别再导入!');
|
||||
}
|
||||
$list = $this->mysql_model->get_rows('unit',array('name'=>$row[9]));
|
||||
if (count($list) > 0) {
|
||||
$good['baseUnitId']= $list['id'];
|
||||
$good['unitName']= $row[9];
|
||||
}else{
|
||||
str_alert(-1,'计量单位【'.$row[9].'】不存在,请先添加计量单位再导入!');
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'number','name','barCode','spec','categoryId','locationId','baseUnitId','purPrice','salePrice',
|
||||
'locationName','unitName','categoryName','pinYin','sonGoods','dopey','wholesalePrice'
|
||||
);
|
||||
$info = elements($info,$good,NULL);
|
||||
|
||||
$existgood = $this->mysql_model->get_rows('goods',array('isDelete'=>0,'number'=>$good['number']));
|
||||
// if($this->mysql_model->get_count('goods',array('isDelete'=>0,'number'=>$good['number'])) <= 0){
|
||||
if(count($existgood) <= 0){
|
||||
$rtn['id'] = $this->mysql_model->insert('goods',$info);
|
||||
}else {
|
||||
$rtn['id'] = $existgood['id'];
|
||||
$this->mysql_model->delete('invoice_info',array('billType'=>'INI','invId'=>$rtn['id']));
|
||||
$this->mysql_model->update('goods',$info,array('number'=>$good['number']));
|
||||
}
|
||||
if(!empty($row[19])){
|
||||
$list = $this->mysql_model->get_rows('storage',array('isDelete'=>0,'name'=>$row[19]));
|
||||
if (count($list) > 0) {
|
||||
$arr = 0;
|
||||
$v[$arr]['invId'] = $rtn['id'];
|
||||
$v[$arr]['locationId'] = $list['id'];
|
||||
$v[$arr]['qty'] = floatval($row[21]);
|
||||
$v[$arr]['price'] = floatval($row[22]);
|
||||
$v[$arr]['amount'] = floatval($row[21])*floatval($row[22]);
|
||||
$v[$arr]['skuId'] = 0;
|
||||
$v[$arr]['billDate'] = date('Y-m-d');;
|
||||
$v[$arr]['billNo'] = '期初数量';
|
||||
$v[$arr]['billType'] = 'INI';
|
||||
$v[$arr]['transTypeName'] = '期初数量';
|
||||
if (isset($v)) {
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if($first[1]=='客户编号'){
|
||||
$itype = "客户";
|
||||
foreach ($data as $arr=>$row) {
|
||||
if(empty($row[1]))
|
||||
continue;//add by michen 20170917 for
|
||||
$cust['number'] = strval($row[1]);
|
||||
$cust['name'] = $row[2];
|
||||
//$cust['cCategory'] = $row[3];
|
||||
//$cust['cCategoryName'] = $row[4];
|
||||
$cust['cLevel'] = 0;
|
||||
$cust['remark'] = $row[8];
|
||||
$linkMan['linkName'] = $row[9];
|
||||
$linkMan['linkMobile'] = $row[10];
|
||||
$linkMan['linkPhone'] = $row[11];
|
||||
$linkMan['linkPlace'] = $row[12];
|
||||
$linkMan['linkIm'] = $row[13];
|
||||
$linkMan['address'] = $row[14];
|
||||
$linkMan['linkFirst'] = 1;
|
||||
$linkMan['id'] = 0;
|
||||
$linkMans[0] = $linkMan;
|
||||
$cust['linkMans'] = json_encode($linkMans);
|
||||
$cust['type'] = -10;
|
||||
empty($row[1])&&str_alert(-1,'第'.$arr.'行客户编号不能为空!');
|
||||
empty($row[2])&&str_alert(-1,'第'.$arr.'行客户名称不能为空!');
|
||||
empty($row[3])&&str_alert(-1,'第'.$arr.'行客户类别不能为空!');
|
||||
$list = $this->mysql_model->get_rows('category',array('name'=>$row[3],'typeNumber'=>'customertype'));
|
||||
if (count($list) > 0) {
|
||||
$cust['cCategory']= $list['id'];
|
||||
$cust['cCategoryName']= $row[3];
|
||||
}else{
|
||||
str_alert(-1,'第'.$arr.'行客户类别【'.$row[3].'】不存在,请先添加客户类别再导入!');
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'number','name','cLevel','remark','cCategory','cCategoryName','linkMans','type'
|
||||
);
|
||||
$info = elements($info,$cust,NULL);
|
||||
//die(var_export($cust,true));
|
||||
if($this->mysql_model->get_count('contact',array('isDelete'=>0,'number'=>$cust['number'],'type'=>-10)) <= 0){
|
||||
$rtn['id'] = $this->mysql_model->insert('contact',$info);
|
||||
}else {
|
||||
$this->mysql_model->update('contact',$info,array('number'=>$cust['number'],'type'=>-10));
|
||||
}
|
||||
}
|
||||
}else if($first[1]=='供应商编号'){
|
||||
$itype = "供应商";
|
||||
foreach ($data as $arr=>$row) {
|
||||
if(empty($row[1]))
|
||||
continue;
|
||||
$sup['number'] = strval($row[1]);
|
||||
$sup['name'] = $row[2];
|
||||
//$cust['cCategory'] = $row[3];
|
||||
//$cust['cCategoryName'] = $row[4];
|
||||
$sup['cLevel'] = 0;
|
||||
$sup['remark'] = $row[7];
|
||||
$linkMan['linkName'] = $row[8];
|
||||
$linkMan['linkMobile'] = $row[9];
|
||||
$linkMan['linkPhone'] = $row[10];
|
||||
$linkMan['linkPlace'] = $row[11];
|
||||
$linkMan['linkIm'] = $row[12];
|
||||
$linkMan['address'] = $row[13];
|
||||
$linkMan['linkFirst'] = 1;
|
||||
$linkMan['id'] = 0;
|
||||
$linkMans[0] = $linkMan;
|
||||
$sup['linkMans'] = json_encode($linkMans);
|
||||
$sup['type'] = 10;
|
||||
empty($row[1])&&str_alert(-1,'第'.$arr.'行供应商编号不能为空!');
|
||||
empty($row[2])&&str_alert(-1,'第'.$arr.'行供应商名称不能为空!');
|
||||
empty($row[3])&&str_alert(-1,'第'.$arr.'行供应商类别不能为空!');
|
||||
$list = $this->mysql_model->get_rows('category',array('name'=>$row[3],'typeNumber'=>'supplytype'));
|
||||
if (count($list) > 0) {
|
||||
$sup['cCategory']= $list['id'];
|
||||
$sup['cCategoryName']= $row[3];
|
||||
}else{
|
||||
str_alert(-1,'第'.$arr.'行供应商类别【'.$row[3].'】不存在,请先添加供应商类别再导入!');
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'number','name','cLevel','remark','cCategory','cCategoryName','linkMans','type'
|
||||
);
|
||||
$info = elements($info,$sup,NULL);
|
||||
|
||||
if($this->mysql_model->get_count('contact',array('isDelete'=>0,'number'=>$sup['number'],'type'=>10)) <= 0){
|
||||
$rtn['id'] = $this->mysql_model->insert('contact',$info);
|
||||
}else {
|
||||
$this->mysql_model->update('contact',$info,array('number'=>$sup['number'],'type'=>10));
|
||||
}
|
||||
}
|
||||
}else if($first[1]=='商品编码'){
|
||||
$itype = "价格预警";
|
||||
foreach ($data as $arr=>$row) {
|
||||
if(empty($row[1]))
|
||||
continue;
|
||||
$preprice['number'] = trim(strval($row[1]));
|
||||
$preprice['supplier'] = trim(strval($row[2]));
|
||||
$preprice['price'] = floatval($row[3]);
|
||||
empty($row[1])&&str_alert(-1,'第'.$arr.'行商品编码不能为空!');
|
||||
empty($row[2])&&str_alert(-1,'第'.$arr.'行供应商编码不能为空!');
|
||||
empty($row[3])&&str_alert(-1,'第'.$arr.'行价格不能为空!');
|
||||
$list = $this->mysql_model->get_rows('goods',array('number'=>$preprice['number'],'isDelete'=>0));
|
||||
if (count($list) > 0) {
|
||||
$preprice['invId'] = $list['id'];
|
||||
}else{
|
||||
str_alert(-1,'第'.$arr.'行商品编码【'.$row[1].'】不存在,请先添加商品再导入!');
|
||||
}
|
||||
$list = $this->mysql_model->get_rows('contact',array('number'=>$preprice['supplier'],'isDelete'=>0,'type'=>10));
|
||||
if (count($list) > 0) {
|
||||
$preprice['buId'] = $list['id'];
|
||||
}else{
|
||||
str_alert(-1,'第'.$arr.'行供应商编码【'.$row[2].'】不存在,请先添加供应商再导入!');
|
||||
}
|
||||
$preprice['billDate'] = date('Y-m-d');
|
||||
$info = array(
|
||||
'invId','buId','price','billDate'
|
||||
);
|
||||
$info = elements($info,$preprice,NULL);
|
||||
$rtn['id'] = $this->mysql_model->insert('preprice',$info);
|
||||
}
|
||||
}
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'SQL错误回滚');
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
str_alert(200,'恭喜您,导入'.$itype.'信息成功!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
647
application/controllers/basedata/inventory.php
Executable file
647
application/controllers/basedata/inventory.php
Executable file
@@ -0,0 +1,647 @@
|
||||
<?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() {
|
||||
$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 = '(a.isDelete=0)';
|
||||
$where .= $skey ? ' and (sonGoods like "%'.$skey.'%" or 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','(isDelete=0) and find_in_set('.$categoryid.',path)'),'id');
|
||||
if (count($cid)>0) {
|
||||
$cid = join(',',$cid);
|
||||
$where .= ' and categoryid in('.$cid.')';
|
||||
}
|
||||
}
|
||||
$list = $this->data_model->get_goods($where.' order by a.id desc limit '.$rows*($page-1).','.$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'];
|
||||
$v[$arr]['remark'] = $row['remark'];
|
||||
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_goods($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v :'';
|
||||
die(json_encode($json));
|
||||
|
||||
}
|
||||
|
||||
//商品选择 最近出售价格
|
||||
public function listBySelected() {
|
||||
$arr = array('so'=>150601,'sa'=>150501);
|
||||
$contactid = intval($this->input->post('contactId',TRUE));
|
||||
$type = str_enhtml($this->input->post('type',TRUE));
|
||||
$id = intval($this->input->post('ids',TRUE));
|
||||
$list = $this->data_model->get_invoice_info('a.isDelete=0 and transType='.$arr[$type].' and a.invId='.$id.' and a.buId='.$contactid.' limit 0,3',2);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['advanceDays'] = 0;
|
||||
$v[$arr]['amount'] = (float)$row['amount'];
|
||||
$v[$arr]['barCode'] = '';
|
||||
$v[$arr]['categoryName'] = '';
|
||||
$v[$arr]['currentQty'] = 0;
|
||||
$v[$arr]['delete'] = false;
|
||||
$v[$arr]['discountRate'] = 0;
|
||||
$v[$arr]['id'] = intval($row['invId']);
|
||||
$v[$arr]['isSerNum'] = 0;
|
||||
$v[$arr]['isWarranty'] = 0;
|
||||
$v[$arr]['josl'] = '';
|
||||
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||
$v[$arr]['locationName'] = $row['locationName'];
|
||||
$v[$arr]['locationNo'] = $row['locationNo'];
|
||||
$v[$arr]['name'] = $row['invName'];
|
||||
$v[$arr]['nearPrice'] = $row['price'];
|
||||
$v[$arr]['number'] = $row['invNumber'];
|
||||
$v[$arr]['pinYin'] = $row['pinYin'];
|
||||
$v[$arr]['purPrice'] = $row['purPrice'];
|
||||
$v[$arr]['quantity'] = $row['quantity'];
|
||||
$v[$arr]['salePrice'] = $row['salePrice'];
|
||||
$v[$arr]['skuClassId'] = 0;
|
||||
$v[$arr]['skuId'] = 0;
|
||||
$v[$arr]['skuName'] = 0;
|
||||
$v[$arr]['skuNumber'] = 0;
|
||||
$v[$arr]['spec'] = $row['invSpec'];
|
||||
$v[$arr]['unitCost'] = 0;
|
||||
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||
$v[$arr]['unitName'] = $row['mainUnit'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['result'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
//获取信息
|
||||
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',array('isDelete'=>0,'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',array('isDelete'=>0,'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',array('isDelete'=>0,'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() {
|
||||
$id = intval($this->input->post('id',TRUE));
|
||||
$list = $this->mysql_model->get_results('goods_img',array('isDelete'=>0,'invId'=>$id));
|
||||
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'] = '';
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['files'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//上传图片信息
|
||||
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);
|
||||
$info = elements(array('name','size','type','url','thumbnailUrl','deleteUrl','deleteType'),$list,NULL);
|
||||
$newid = $this->mysql_model->insert('goods_img',$info);
|
||||
$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'] = '';
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['files'] = $files;
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//保存上传图片信息
|
||||
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_rows('goods_img',array('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) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('goods',array('isDelete'=>0,'number'=>$data['number'])) > 0 && str_alert(-1,'商品编号重复');
|
||||
$this->db->trans_begin();
|
||||
$info = array(
|
||||
'barCode','baseUnitId','unitName','categoryId','categoryName','propertys',
|
||||
'discountRate1','discountRate2','highQty','locationId','pinYin',
|
||||
'locationName','lowQty','name','number','purPrice','warehouseWarning',
|
||||
'remark','salePrice','spec','vipPrice','wholesalePrice','warehousePropertys','sonGoods','dopey'
|
||||
);
|
||||
//add by michen 20170715
|
||||
$data['dopey']=0;
|
||||
if(strlen($data['sonGoods'])>0){
|
||||
$sonlist = (array)json_decode($data['sonGoods'],true) ;
|
||||
if(count($sonlist)>0){
|
||||
$data['dopey']=1;
|
||||
foreach ($sonlist as $sonkey => $sonrow){
|
||||
if(empty($sonrow['gid']))
|
||||
str_alert(-1,'您所选择的商品ID不存在!请重新选择!');
|
||||
else if($this->mysql_model->get_count('goods',array('isDelete'=>0,'id'=>$sonrow['gid'],'number'=>$sonrow['number'])) <= 0)
|
||||
str_alert(-1,'您所选择的子商品编号“'.$sonrow['number'].'”不存在!请重新选择!');
|
||||
}
|
||||
}
|
||||
}
|
||||
$info = elements($info,$data,NULL);
|
||||
$data['id'] = $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'] = $data['id'];
|
||||
$v[$arr]['locationId'] = intval($row['locationId']);
|
||||
$v[$arr]['qty'] = (float)$row['quantity'];
|
||||
$v[$arr]['price'] = (float)$row['unitCost'];
|
||||
$v[$arr]['amount'] = (float)$row['amount'];
|
||||
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||
$v[$arr]['billDate'] = date('Y-m-d');;
|
||||
$v[$arr]['billNo'] = '期初数量';
|
||||
$v[$arr]['billType'] = 'INI';
|
||||
$v[$arr]['transTypeName'] = '期初数量';
|
||||
}
|
||||
if (isset($v)) {
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
}
|
||||
}
|
||||
if (strlen($data['warehousePropertys'])>0) {
|
||||
$list = (array)json_decode($data['warehousePropertys'],true);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$s[$arr]['invId'] = $data['id'];
|
||||
$s[$arr]['locationId'] = intval($row['locationId']);
|
||||
$s[$arr]['highQty'] = (float)$row['highQty'];
|
||||
$s[$arr]['lowQty'] = (float)$row['lowQty'];
|
||||
}
|
||||
if (isset($s)) {
|
||||
$this->mysql_model->insert('warehouse',$s);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
$data = $this->validform($data);
|
||||
$this->mysql_model->get_count('goods',array('id !='=>$data['id'],'isDelete'=>0,'number'=>$data['number'])) > 0 && str_alert(-1,'商品编号重复');
|
||||
$this->db->trans_begin();
|
||||
$info = array(
|
||||
'barCode','baseUnitId','unitName','categoryId','categoryName','propertys',
|
||||
'discountRate1','discountRate2','highQty','locationId','pinYin',
|
||||
'locationName','lowQty','name','number','purPrice','warehouseWarning',
|
||||
'remark','salePrice','spec','vipPrice','wholesalePrice','warehousePropertys','sonGoods','dopey'
|
||||
);
|
||||
//add by michen 20170715
|
||||
$data['dopey']=0;
|
||||
if(strlen($data['sonGoods'])>0){
|
||||
$sonlist = (array)json_decode($data['sonGoods'],true) ;
|
||||
if(count($sonlist)>0){
|
||||
$data['dopey']=1;
|
||||
foreach ($sonlist as $sonkey => $sonrow){
|
||||
if(empty($sonrow['gid']))
|
||||
str_alert(-1,'您所选择的商品ID不存在!请重新选择!');
|
||||
else if($this->mysql_model->get_count('goods',array('isDelete'=>0,'id'=>$sonrow['gid'],'number'=>$sonrow['number'])) <= 0)
|
||||
str_alert(-1,'您所选择的子商品编号“'.$sonrow['number'].'”不存在!请重新选择!');
|
||||
}
|
||||
}
|
||||
}
|
||||
$info = elements($info, $data,NULL);
|
||||
$this->mysql_model->update('goods',$info,array('id'=>$data['id']));
|
||||
if (strlen($data['propertys'])>0) {
|
||||
$list = (array)json_decode($data['propertys'],true);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['invId'] = $data['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'] = '期初数量';
|
||||
}
|
||||
if (isset($v)) {
|
||||
$this->mysql_model->delete('invoice_info',array('invId'=>$data['id'],'billType'=>'INI'));
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
}
|
||||
}
|
||||
if (strlen($data['warehousePropertys'])>0) {
|
||||
$list = (array)json_decode($data['warehousePropertys'],true);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$s[$arr]['invId'] = $data['id'];
|
||||
$s[$arr]['locationId'] = isset($row['locationId']) ? $row['locationId'] : 0;
|
||||
$s[$arr]['highQty'] = isset($row['highQty']) ? $row['highQty']:0;
|
||||
$s[$arr]['lowQty'] = isset($row['lowQty']) ? $row['lowQty']:0;
|
||||
}
|
||||
if (isset($s)) {
|
||||
$this->mysql_model->delete('warehouse',array('invId'=>$data['id']));
|
||||
$this->mysql_model->insert('warehouse',$s);
|
||||
}
|
||||
}
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'SQL错误回滚');
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
$this->common_model->logs('修改商品:ID='.$data['id'].'名称:'.$data['name']);
|
||||
str_alert(200,'success',$this->get_goods_info($data['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) {
|
||||
$this->mysql_model->get_count('invoice_info','(invId in('.$id.')) and (isDelete=0) and (billType<>"INI")')>0 && str_alert(-1,'其中有商品发生业务不可删除');
|
||||
$sql = $this->mysql_model->update('goods',array('isDelete'=>1),'(id in('.$id.'))');
|
||||
$this->mysql_model->update('invoice_info',array('isDelete'=>1),'(invId 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 = '(a.isDelete=0)';
|
||||
$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','(isDelete=1) and find_in_set('.$categoryid.',path)'),'id');
|
||||
if (count($cid)>0) {
|
||||
$cid = join(',',$cid);
|
||||
$where .= ' and categoryid in('.$cid.')';
|
||||
}
|
||||
}
|
||||
$data['storage'] = array_column($this->mysql_model->get_results('storage'),'name','id');
|
||||
$data['list'] = $this->data_model->get_goods($where.' order by a.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) {
|
||||
$sql = $this->mysql_model->update('goods',array('disable'=>$disable),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
$this->common_model->logs('商品'.$disable==1?'禁用':'启用'.':ID:'.$id.'');
|
||||
str_alert(200,'success');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'操作失败');
|
||||
}
|
||||
|
||||
//库存预警
|
||||
public function listinventoryqtywarning() {
|
||||
$locationId = intval($this->input->get_post('locationId',TRUE));
|
||||
$warnType = intval($this->input->get_post('warnType',TRUE));
|
||||
$assistId = intval($this->input->get_post('assistId',TRUE));
|
||||
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||
$rows = max(intval($this->input->get_post('rows',TRUE)),20);
|
||||
$where = 'a.isDelete=0';
|
||||
if ($warnType==1) {
|
||||
$having = 'HAVING qty<lowQty';
|
||||
} elseif($warnType==2) {
|
||||
$having = 'HAVING qty>highQty';
|
||||
} else {
|
||||
$having = 'HAVING qty>highQty or qty<lowQty';
|
||||
}
|
||||
if ($assistId > 0) {
|
||||
$cid = array_column($this->mysql_model->get_results('category','(isDelete=1) and find_in_set('.$assistId.',path)'),'id');
|
||||
if (count($cid)>0) {
|
||||
$cid = join(',',$cid);
|
||||
$where .= ' and b.categoryId in('.$cid.')';
|
||||
}
|
||||
}
|
||||
$where .= $skey ? ' and (b.name like "%'.$skey.'%" or b.number like "%'.$skey.'%" or b.spec like "%'.$skey.'%")' : '';
|
||||
$where .= $locationId>0 ? ' and a.locationId='.$locationId.'' : '';
|
||||
$where .= $this->common_model->get_location_purview();
|
||||
$offset = $rows*($page-1);
|
||||
$list = $this->data_model->get_inventory($where.' GROUP BY invId,locationId '.$having.' limit '.$offset.','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$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]['locationName'] = $row['locationName'];
|
||||
$v[$arr]['number'] = $row['invNumber'];
|
||||
$v[$arr]['categoryName'] = $row['categoryName'];
|
||||
$v[$arr]['warning'] = $row['qty1'] > 0 ? $row['qty1'] : $row['qty2'];
|
||||
$v[$arr]['qty'] = (float)$row['qty'];
|
||||
$v[$arr]['unitName'] = $row['unitName'];
|
||||
$v[$arr]['spec'] = $row['invSpec'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_inventory($where.' GROUP BY invId,locationId '.$having,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? array_values($v) : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
public function warningExporter() {
|
||||
$this->common_model->checkpurview();
|
||||
$name = 'InventoryWarning_'.date('YmdHis').'.xls';
|
||||
sys_csv($name);
|
||||
$this->common_model->logs('导出库存预警商品:'.$name);
|
||||
$locationId = intval($this->input->get_post('locationId',TRUE));
|
||||
$warnType = intval($this->input->get_post('warnType',TRUE));
|
||||
$assistId = intval($this->input->get_post('assistId',TRUE));
|
||||
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||
$where = 'a.isDelete=0';
|
||||
if ($warnType==1) {
|
||||
$having = 'HAVING qty<lowQty';
|
||||
} elseif($warnType==2) {
|
||||
$having = 'HAVING qty>highQty';
|
||||
} else {
|
||||
$having = 'HAVING qty>highQty or qty<lowQty';
|
||||
}
|
||||
if ($assistId > 0) {
|
||||
$cid = array_column($this->mysql_model->get_results('category','(isDelete=1) and find_in_set('.$assistId.',path)'),'id');
|
||||
if (count($cid)>0) {
|
||||
$cid = join(',',$cid);
|
||||
$where .= ' and b.categoryId in('.$cid.')';
|
||||
}
|
||||
}
|
||||
$where .= $skey ? ' and (b.name like "%'.$skey.'%" or b.number like "%'.$skey.'%" or b.spec like "%'.$skey.'%")' : '';
|
||||
$where .= $locationId>0 ? ' and a.locationId='.$locationId.'' : '';
|
||||
$where .= $this->common_model->get_location_purview();
|
||||
$data['list'] = $this->data_model->get_inventory($where.' GROUP BY invId,locationId '.$having);
|
||||
$this->load->view('settings/inventory-warning-exporter',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//通过ID 获取商品信息
|
||||
private function get_goods_info($id) {
|
||||
$data = $this->mysql_model->get_rows('goods',array('id'=>$id,'isDelete'=>0));
|
||||
if (count($data)>0) {
|
||||
$data['id'] = $id;
|
||||
$data['count'] = 0;
|
||||
$data['name'] = $data['name'];
|
||||
$data['spec'] = $data['spec'];
|
||||
$data['number'] = $data['number'];
|
||||
$data['salePrice'] = (float)$data['salePrice'];
|
||||
$data['purPrice'] = (float)$data['purPrice'];
|
||||
$data['wholesalePrice']= (float)$data['wholesalePrice'];
|
||||
$data['vipPrice'] = (float)$data['vipPrice'];
|
||||
$data['discountRate1'] = (float)$data['discountRate1'];
|
||||
$data['discountRate2'] = (float)$data['discountRate2'];
|
||||
$data['unitTypeId'] = intval($data['unitTypeId']);
|
||||
$data['baseUnitId'] = intval($data['baseUnitId']);
|
||||
$data['locationId'] = intval($data['locationId']);
|
||||
$data['assistIds'] = '';
|
||||
$data['assistName'] = '';
|
||||
$data['assistUnit'] = '';
|
||||
$data['remark'] = $data['remark'];
|
||||
$data['categoryId'] = intval($data['categoryId']);
|
||||
$data['unitId'] = intval($data['unitId']);
|
||||
$data['length'] = '';
|
||||
$data['weight'] = '';
|
||||
$data['jianxing'] = '';
|
||||
$data['barCode'] = $data['barCode'];
|
||||
$data['josl'] = '';
|
||||
$data['warehouseWarning'] = intval($data['warehouseWarning']);
|
||||
$data['warehouseWarningSku'] = 0;
|
||||
$data['skuClassId'] = 0;
|
||||
$data['isSerNum'] = 0;
|
||||
$data['pinYin'] = $data['pinYin'];
|
||||
$data['delete'] = false;
|
||||
$data['isWarranty'] = 0;
|
||||
$data['safeDays'] = 0;
|
||||
$data['advanceDay'] = 0;
|
||||
$data['property'] = $data['property'] ? $data['property'] : NULL;
|
||||
$propertys = $this->data_model->get_invoice_info('a.isDelete=0 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'] = isset($v) ? $v : array();
|
||||
if ($data['warehousePropertys']) {
|
||||
$warehouse = (array)json_decode($data['warehousePropertys'],true);
|
||||
foreach ($warehouse as $arr=>$row) {
|
||||
$s[$arr]['locationId'] = intval($row['locationId']);
|
||||
$s[$arr]['locationName'] = $row['locationName'];
|
||||
$s[$arr]['highQty'] = (float)$row['highQty'];
|
||||
$s[$arr]['lowQty'] = (float)$row['lowQty'];
|
||||
}
|
||||
}
|
||||
$data['warehousePropertys'] = isset($s) ? $s : array();
|
||||
if (strlen($data['sonGoods'])>0) {
|
||||
$list = (array)json_decode($data['sonGoods'],true);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['number'] = $row['number'];
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
$v[$arr]['spec'] = $row['spec'];
|
||||
$v[$arr]['unitName'] = $row['unitName'];
|
||||
$v[$arr]['qty'] = intval($row['qty']);
|
||||
$v[$arr]['salePrice'] = intval($row['salePrice']);
|
||||
$v[$arr]['gid'] = intval($row['gid']);//add by michen 20170719
|
||||
}
|
||||
}
|
||||
$data['sonGoods'] = isset($v) ? $v : array();
|
||||
|
||||
}
|
||||
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,'商品编号不能为空');
|
||||
$data['categoryId'] = intval($data['categoryId']);
|
||||
$data['baseUnitId'] = intval($data['baseUnitId']);
|
||||
$data['categoryId'] < 1 && str_alert(-1,'商品类别不能为空');
|
||||
$data['baseUnitId'] < 1 && str_alert(-1,'计量单位不能为空');
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']):0;
|
||||
$data['lowQty'] = isset($data['lowQty']) ? (float)$data['lowQty'] :0;
|
||||
$data['highQty'] = isset($data['highQty']) ? (float)$data['highQty']:0;
|
||||
$data['purPrice'] = isset($data['purPrice']) ? (float)$data['purPrice']:0;
|
||||
$data['salePrice'] = isset($data['salePrice']) ? (float)$data['salePrice']:0;
|
||||
$data['vipPrice'] = isset($data['vipPrice']) ? (float)$data['vipPrice']:0;
|
||||
$data['warehouseWarning'] = isset($data['warehouseWarning']) ? intval($data['warehouseWarning']):0;
|
||||
$data['discountRate1'] = (float)$data['discountRate1'];
|
||||
$data['discountRate2'] = (float)$data['discountRate2'];
|
||||
$data['wholesalePrice'] = isset($data['wholesalePrice']) ? (float)$data['wholesalePrice']:0;
|
||||
$data['unitName'] = $this->mysql_model->get_row('unit',array('id'=>$data['baseUnitId']),'name');
|
||||
$data['categoryName'] = $this->mysql_model->get_row('category',array('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',array('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']].'仓库不存在或不可用!');
|
||||
}
|
||||
}
|
||||
$data['warehousePropertys'] = isset($data['warehousePropertys']) ? $data['warehousePropertys'] :'[]';
|
||||
$data['warehousePropertys'] = count(json_decode($data['warehousePropertys'],true))>0 ? $data['warehousePropertys'] :'';
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
116
application/controllers/basedata/invlocation.php
Executable file
116
application/controllers/basedata/invlocation.php
Executable file
@@ -0,0 +1,116 @@
|
||||
<?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(){
|
||||
$list = $this->mysql_model->get_results('storage','(isDelete=0) '.$this->common_model->get_location_purview(1).' 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']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
$json['data']['total'] = 1;
|
||||
$json['data']['records'] = count($list);
|
||||
$json['data']['page'] = 1;
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
//新增
|
||||
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) {
|
||||
$data = $this->validform($data);
|
||||
$sql = $this->mysql_model->update('storage',elements(array('name','locationNo'),$data),array('id'=>$data['locationId']));
|
||||
if ($sql) {
|
||||
$data['id'] = $data['locationId'];
|
||||
$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_rows('storage',array('id'=>$id,'isDelete'=>0));
|
||||
if (count($data) > 0) {
|
||||
$this->mysql_model->get_count('invoice_info',array('locationId'=>$id,'isDelete'=>0))>0 && str_alert(-1,'不能删除有业务关联的仓库!');
|
||||
$sql = $this->mysql_model->update('storage',array('isDelete'=>1),array('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_rows('storage',array('id'=>$id,'isDelete'=>0));
|
||||
if (count($data) > 0) {
|
||||
$info['disable'] = intval($this->input->post('disable',TRUE));
|
||||
$sql = $this->mysql_model->update('storage',$info,array('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) {
|
||||
strlen($data['name']) < 1 && str_alert(-1,'仓库名称不能为空');
|
||||
strlen($data['locationNo']) < 1 && str_alert(-1,'编号不能为空');
|
||||
$data['locationId'] = intval($data['locationId']);
|
||||
$where = $data['locationId']>0 ? ' and id<>'.$data['locationId'].'' :'';
|
||||
$this->mysql_model->get_count('storage','(isDelete=0) and name="'.$data['name'].'" '.$where) > 0 && str_alert(-1,'名称重复');
|
||||
$this->mysql_model->get_count('storage','(isDelete=0) and locationNo="'.$data['locationNo'].'" '.$where) > 0 && str_alert(-1,'编号重复');
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
79
application/controllers/basedata/log.php
Executable file
79
application/controllers/basedata/log.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?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(){
|
||||
$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['name'] = $user ? $user :'';
|
||||
$where['adddate >='] = $fromDate ? $fromDate :'';
|
||||
$where['adddate <='] = $toDate ? $toDate :'';
|
||||
$list = $this->mysql_model->get_results('log',array_filter($where),'id desc',$rows*($page-1),$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'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->mysql_model->get_count('log',array_filter($where));
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
public function initloglist(){
|
||||
$this->load->view('settings/log-initloglist');
|
||||
}
|
||||
|
||||
//用户列表
|
||||
public function queryAllUser(){
|
||||
$list = $this->mysql_model->get_results('admin','(1=1)','uid desc',0,0,'uid,name');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['userid'] = intval($row['uid']);
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = count($list);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
//操作类型
|
||||
public function queryAllOperateType(){
|
||||
$menu = array_column($this->mysql_model->get_results('menu',array('pid'=>0),'id desc'),'title','id');
|
||||
$list = $this->mysql_model->get_results('menu',array('depth>'=>1),'id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['indexid'] = $row['id'];
|
||||
$v[$arr]['operateTypeName'] = $row['title'].isset($menu[$row['pid']]) ? $menu[$row['pid']] : '';
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = count($list);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
17
application/controllers/basedata/resultInfo.php
Executable file
17
application/controllers/basedata/resultInfo.php
Executable 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 */
|
||||
133
application/controllers/basedata/settAcct.php
Executable file
133
application/controllers/basedata/settAcct.php
Executable file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Settacct extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
//结算账户列表
|
||||
public function index(){
|
||||
$list = $this->mysql_model->get_results('account',array('isDelete'=>0),'id desc');
|
||||
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']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//查询
|
||||
public function query(){
|
||||
$id = intval($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('account',array('id'=>$id,'isDelete'=>0));
|
||||
if (count($data)>0) {
|
||||
$v = array();
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['date'] = $data['date'];
|
||||
$json['data']['amount'] = (float)$data['amount'];
|
||||
$json['data']['del'] = false;
|
||||
$json['data']['id'] = intval($data['id']);
|
||||
$json['data']['name'] = $data['name'];
|
||||
$json['data']['number'] = $data['number'];
|
||||
$json['data']['type'] = intval($data['type']);
|
||||
die(json_encode($json));
|
||||
}
|
||||
}
|
||||
|
||||
//当前余额
|
||||
public function findAmountOver(){
|
||||
$ids = str_enhtml($this->input->post('ids',TRUE));
|
||||
if (strlen($ids)>0) {
|
||||
$list = $this->data_model->get_account('','a.isDelete=0 and a.id in('.$ids.')');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['amountOver'] = (float)$row['amount'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
} 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) {
|
||||
$data = $this->validform($data);
|
||||
$info = elements(array('name','number','amount','date','type'),$data);
|
||||
$sql = $this->mysql_model->update('account',$info,array('id'=>$data['id']));
|
||||
if ($sql) {
|
||||
$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_rows('account',array('id'=>$id,'isDelete'=>0));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('account_info',array('accId'=>$id,'isDelete'=>0))>0 && str_alert(-1,'账户资料已经被使用');
|
||||
$sql = $this->mysql_model->update('account',array('isDelete'=>1),array('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['id'] = isset($data['id']) ? intval($data['id']) :0;
|
||||
$data['amount'] = (float)$data['amount'];
|
||||
$data['type'] = intval($data['type']);
|
||||
strlen($data['name']) < 1 && str_alert(-1,'名称不能为空');
|
||||
strlen($data['number']) < 1 && str_alert(-1,'编号不能为空');
|
||||
$where = $data['id']>0 ? ' 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 */
|
||||
27
application/controllers/basedata/supplier.php
Executable file
27
application/controllers/basedata/supplier.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?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 = '(isDelete=0) and type=10 ';
|
||||
$where .= $this->common_model->get_vendor_purview();
|
||||
$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',$where,'id desc');
|
||||
$this->load->view('settings/vendor-export',$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
58
application/controllers/basedata/systemProfile.php
Executable file
58
application/controllers/basedata/systemProfile.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?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() {
|
||||
$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 */
|
||||
97
application/controllers/basedata/unit.php
Executable file
97
application/controllers/basedata/unit.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR 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));
|
||||
if ($unittypeid>0) {
|
||||
$where['unittypeid'] = $unittypeid;
|
||||
}
|
||||
$where['isDelete'] = 0;
|
||||
$list = $this->mysql_model->get_results('unit',$where,'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']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(78);
|
||||
$data = $this->validform(str_enhtml($this->input->post(NULL,TRUE)));
|
||||
$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);
|
||||
$data = $this->validform(str_enhtml($this->input->post(NULL,TRUE)));
|
||||
$this->mysql_model->get_count('goods',array('isDelete'=>0,'unitId'=>$data['id']))>0 && str_alert(-1,'该单位已经被使用,不允许更改组');
|
||||
$sql = $this->mysql_model->update('unit',elements(array('name','default'),$data),array('id'=>$data['id']));
|
||||
if ($sql) {
|
||||
$this->mysql_model->update('goods',array('unitName'=>$data['name']),array('baseUnitId'=>$data['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_rows('unit',array('isDelete'=>0,'id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('goods',array('isDelete'=>0,'unitId'=>$id))>0 && str_alert(-1,'该单位已经被使用,不允许删除');
|
||||
$sql = $this->mysql_model->update('unit',array('isDelete'=>1),array('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) {
|
||||
strlen($data['name']) < 1 && str_alert(-1,'单位名称不能为空');
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) :0;
|
||||
$data['rate'] = isset($data['rate']) ? intval($data['rate']) :0;
|
||||
$data['default'] = isset($data['default']) ? $data['default'] :'';
|
||||
$data['unitTypeId'] = isset($data['unitTypeId']) ? intval($data['unitTypeId']):0;
|
||||
$data['default'] = $data['default']== 'true' ? 1 : 0;
|
||||
$where['isDelete'] = 0;
|
||||
$where['name'] = $data['name'];
|
||||
$where['id !='] = $data['id']>0 ? $data['id'] :0;
|
||||
$this->mysql_model->get_count('unit',$where) && str_alert(-1,'单位名称重复');
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
82
application/controllers/basedata/unitType.php
Executable file
82
application/controllers/basedata/unitType.php
Executable file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Unittype extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$list = $this->mysql_model->get_results('unittype',array('isDelete'=>0),'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'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['totalsize'] = count($list);
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
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',array('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);
|
||||
}
|
||||
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_rows('unittype','(id='.$id.') and (isDelete=0)');
|
||||
if (count($info)>0) {
|
||||
strlen($name) < 1 && str_alert(-1,'名称不能为空');
|
||||
$this->mysql_model->get_count('unittype',array('isDelete'=>$isDelete,'name'=>$name,'id !='=>$id)) > 0 && str_alert(-1,'单位组名称重复');
|
||||
$sql = $this->mysql_model->update('unittype',array('name'=>$name),array('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);
|
||||
}
|
||||
}
|
||||
str_alert(-1,'更新失败');
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete(){
|
||||
$this->common_model->checkpurview(59);
|
||||
$id = intval($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('unittype',array('isDelete'=>$isDelete,'id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('unit',array('isDelete'=>$isDelete,'unittypeid'=>$id))>0 && str_alert(-1,'发生业务不可删除');
|
||||
$sql = $this->mysql_model->update('unittype',array('isDelete'=>1),array('id'=>$id));
|
||||
if ($sql) {
|
||||
$this->common_model->logs('删除单位组:ID='.$id.' 名称:'.$data['name']);
|
||||
str_alert(200,'success',array('msg'=>'成功删除','id'=>'['.$id.']'));
|
||||
}
|
||||
}
|
||||
str_alert(-1,'删除失败');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
33
application/controllers/basedata/userSetting.php
Executable file
33
application/controllers/basedata/userSetting.php
Executable file
File diff suppressed because one or more lines are too long
31
application/controllers/basedata/warranty.php
Executable file
31
application/controllers/basedata/warranty.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Warranty extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
|
||||
public function index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getAdvancedList(){
|
||||
$data['status'] = 200;
|
||||
$data['msg'] = 'success';
|
||||
$data['data']['page'] = 1;
|
||||
$data['data']['total'] = 0;
|
||||
$data['data']['records'] = 0;
|
||||
$data['data']['rows'] = array();
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
132
application/controllers/dataright.php
Executable file
132
application/controllers/dataright.php
Executable file
@@ -0,0 +1,132 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Dataright extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview(82);
|
||||
}
|
||||
|
||||
public function ar() {
|
||||
$data = $this->input->post(NULL,TRUE);
|
||||
if (count($data)>0) {
|
||||
$userName = str_enhtml($this->input->get('userName',TRUE));
|
||||
$rightid = (array)json_decode($data['rightid'],true);
|
||||
$info['rightids'] = join(',',$rightid['rightids']);
|
||||
$sql = $this->mysql_model->update('admin',$info,'(username="'.$userName.'")');
|
||||
if ($sql) {
|
||||
str_alert(200,'success');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'更新失败');
|
||||
}
|
||||
|
||||
public function dt() {
|
||||
$ids = str_enhtml($this->input->post('userName',TRUE));
|
||||
die('{"status":200,"data":{"items":[
|
||||
{"FNAME":"仓库","FRIGHT":"1","FRIGHTID":"1","FNUMBER":"location"},
|
||||
{"FNAME":"客户","FRIGHT":"2","FRIGHTID":"2","FNUMBER":"customer"},
|
||||
{"FNAME":"供应商","FRIGHT":"4","FRIGHTID":"4","FNUMBER":"supplier"},
|
||||
{"FNAME":"制单人","FRIGHT":"8","FRIGHTID":"8","FNUMBER":"user"}
|
||||
],"totalsize":4},"msg":"success"}');
|
||||
}
|
||||
|
||||
public function update() {
|
||||
$this->common_model->checkpurview();
|
||||
$type = max(intval($this->input->get('type',TRUE)),1);
|
||||
$rights = $this->input->post('rights',TRUE);
|
||||
$userName = str_enhtml($this->input->get('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data>0)) {
|
||||
$array = explode(',',$data['righttype'.$type]);
|
||||
foreach((array)json_decode($rights,true) as $arr=>$row){
|
||||
if ($row['FRIGHT']==1) {
|
||||
$s1[] = $row['FITEMID']; //新增
|
||||
} else {
|
||||
$s2[] = $row['FITEMID']; //除去
|
||||
}
|
||||
}
|
||||
if (isset($s1)) {
|
||||
$info['righttype'.$type] = join(',',array_filter(array_merge($array,$s1)));
|
||||
$this->mysql_model->update('admin',$info,array('username'=>$userName));
|
||||
}
|
||||
if (isset($s2)) {
|
||||
$info['righttype'.$type] = join(',',array_filter(array_diff($array,$s2)));
|
||||
$this->mysql_model->update('admin',$info,array('username'=>$userName));
|
||||
}
|
||||
str_alert(200,'success');
|
||||
|
||||
}
|
||||
str_alert(-1,'更新失败');
|
||||
}
|
||||
|
||||
|
||||
public function query() {
|
||||
$v = array();
|
||||
$type = max(intval($this->input->get_post('type',TRUE)),0);
|
||||
$skey = str_enhtml($this->input->get_post('skey',TRUE));
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$righttype = explode(',',$data['righttype'.$type]);
|
||||
$where = $skey ? ' and (locationNo like "%'.$skey.'%" or name like "%'.$skey.'%")' : '';
|
||||
$list = $this->mysql_model->get_results('storage','(isDelete=0) '.$where,'id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['FITEMID'] = intval($row['id']);
|
||||
$v[$arr]['FNAME'] = $row['name'];
|
||||
$v[$arr]['FITEMNO'] = $row['locationNo'];
|
||||
$v[$arr]['FRIGHT'] = in_array($row['id'],$righttype)==1 ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$righttype = explode(',',$data['righttype'.$type]);
|
||||
$where = $skey ? ' and (number like "%'.$skey.'%" or name like "%'.$skey.'%")' : '';
|
||||
$list = $this->mysql_model->get_results('contact','(isDelete=0) and type=-10 '.$where,'id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['FITEMID'] = intval($row['id']);
|
||||
$v[$arr]['FNAME'] = $row['name'];
|
||||
$v[$arr]['FITEMNO'] = $row['number'];
|
||||
$v[$arr]['FRIGHT'] = in_array($row['id'],$righttype)==1 ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$righttype = explode(',',$data['righttype'.$type]);
|
||||
$where = $skey ? ' and (number like "%'.$skey.'%" or name like "%'.$skey.'%")' : '';
|
||||
$list = $this->mysql_model->get_results('contact','(isDelete=0) and type=10 '.$where,'id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['FITEMID'] = intval($row['id']);
|
||||
$v[$arr]['FNAME'] = $row['name'];
|
||||
$v[$arr]['FITEMNO'] = $row['number'];
|
||||
$v[$arr]['FRIGHT'] = in_array($row['id'],$righttype)==1 ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
$righttype = explode(',',$data['righttype'.$type]);
|
||||
$where = $skey ? ' and (username like "%'.$skey.'%" or name like "%'.$skey.'%")' : '';
|
||||
$list = $this->mysql_model->get_results('admin','(1=1) '.$where,'uid desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['FITEMID'] = intval($row['uid']);
|
||||
$v[$arr]['FNAME'] = $row['username'];
|
||||
$v[$arr]['FITEMNO'] = intval($row['uid']);
|
||||
$v[$arr]['FRIGHT'] = in_array($row['uid'],$righttype)==1 ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
$data['status'] = 200;
|
||||
$data['msg'] = 'success';
|
||||
$data['data']['rows'] = $v;
|
||||
$data['data']['total'] = 1;
|
||||
$data['data']['records'] = count($v);
|
||||
$data['data']['page'] = 1;
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
62
application/controllers/home.php
Executable file
62
application/controllers/home.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?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(){
|
||||
//add by michen 20170820 for 修改登录异常 begin
|
||||
if(!strstr($_SERVER['REQUEST_URI'], 'home/index'))
|
||||
redirect('home/index', 'refresh');
|
||||
//add by michen 20170820 for 修改登录异常 end
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['name'] = $this->jxcsys['name'];
|
||||
$data['roleid'] = 0;
|
||||
$data['username'] = $this->jxcsys['username'];
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$data['rights'] = $this->common_model->get_admin_rights();
|
||||
$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_rows('admin','(uid='.$this->jxcsys['uid'].')');
|
||||
$this->load->view('set_password',$data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 */
|
||||
20
application/controllers/import.php
Executable file
20
application/controllers/import.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Import extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->load->view('settings/import');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
11
application/controllers/index.html
Executable file
11
application/controllers/index.html
Executable file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
21
application/controllers/inventory.php
Executable file
21
application/controllers/inventory.php
Executable 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 */
|
||||
53
application/controllers/login.php
Executable file
53
application/controllers/login.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?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验证失败');
|
||||
strlen($data['username']) < 1 && die('用户名不能为空');
|
||||
strlen($data['userpwd']) < 1 && die('密码不能为空');
|
||||
$user = $this->mysql_model->get_rows('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']['roleid'] = $user['roleid'];
|
||||
$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 */
|
||||
1513
application/controllers/mobile.php
Executable file
1513
application/controllers/mobile.php
Executable file
File diff suppressed because it is too large
Load Diff
21
application/controllers/noteprinttemp.php
Executable file
21
application/controllers/noteprinttemp.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Noteprinttemp extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
24
application/controllers/prints.php
Executable file
24
application/controllers/prints.php
Executable 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 */
|
||||
2095
application/controllers/report.php
Executable file
2095
application/controllers/report.php
Executable file
File diff suppressed because it is too large
Load Diff
151
application/controllers/right.php
Executable file
151
application/controllers/right.php
Executable file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR 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() {
|
||||
$list = $this->mysql_model->get_results('admin','(1=1)','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'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
$json['data']['shareTotal'] = count($list);
|
||||
$json['data']['totalsize'] = $json['data']['shareTotal'];
|
||||
$json['data']['corpID'] = 0;
|
||||
$json['data']['totalUserNum'] = 1000;
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
public function queryUserByName() {
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
$json['share'] = true;
|
||||
$json['email'] = '';
|
||||
$json['userId'] = $data['uid'];
|
||||
$json['userMobile'] = $data['mobile'];
|
||||
$json['userName'] = $data['username'];
|
||||
str_alert(200,'success',$json);
|
||||
}
|
||||
str_alert(502,'用户名不存在');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function adduser() {
|
||||
$data = str_enhtml($this->input->post(NULL,TRUE));
|
||||
if (is_array($data)&&count($data)>0) {
|
||||
strlen($data['userNumber'])<1 && str_alert(-1,'用户名不能为空');
|
||||
strlen($data['password'])<1 && str_alert(-1,'密码不能为空');
|
||||
$this->mysql_model->get_count('admin',array('username'=>$data['userNumber']))>0 && str_alert(-1,'用户名已经存在');
|
||||
$this->mysql_model->get_count('admin',array('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,'添加失败');
|
||||
}
|
||||
|
||||
|
||||
public function addrights2Outuser() {
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$rightid = str_enhtml($this->input->get_post('rightid',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
$sql = $this->mysql_model->update('admin',array('lever'=>$rightid),array('username'=>$userName));
|
||||
if ($sql) {
|
||||
$this->common_model->logs('更新权限:'. $userName);
|
||||
str_alert(200,'操作成功');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'操作失败');
|
||||
}
|
||||
|
||||
|
||||
public function queryalluserright() {
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
$lever = explode(',',$data['lever']);
|
||||
$list = $this->mysql_model->get_results('menu',array('isDelete'=>0),'path');
|
||||
$menu = 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 ? @$menu[$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']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = count($list);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function auth2UserCancel(){
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
$userName == 'admin' && str_alert(-1,'管理员不可操作');
|
||||
$sql = $this->mysql_model->update('admin',array('status'=>0),array('username'=>$userName));
|
||||
if ($sql) {
|
||||
$this->common_model->logs('用户停用:'.$userName);
|
||||
str_alert(200,'success',$data);
|
||||
}
|
||||
}
|
||||
str_alert(-1,'停用失败');
|
||||
}
|
||||
|
||||
|
||||
public function auth2User(){
|
||||
$userName = str_enhtml($this->input->get_post('userName',TRUE));
|
||||
$data = $this->mysql_model->get_rows('admin',array('username'=>$userName));
|
||||
if (count($data)>0) {
|
||||
$userName == 'admin' && str_alert(-1,'管理员不可操作');
|
||||
$sql = $this->mysql_model->update('admin',array('status'=>1),array('username'=>$userName));
|
||||
if ($sql) {
|
||||
$this->common_model->logs('用户启用:'.$userName);
|
||||
str_alert(200,'success',$data);
|
||||
}
|
||||
}
|
||||
str_alert(-1,'启用失败');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
20
application/controllers/sales.php
Executable file
20
application/controllers/sales.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR 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 */
|
||||
126
application/controllers/scm/backup.php
Executable file
126
application/controllers/scm/backup.php
Executable file
@@ -0,0 +1,126 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Backup extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
$this->load->helper(array('directory','download'));
|
||||
$this->backup_path = $this->config->item('backup_path');
|
||||
$this->filename = str_no().'.sql';
|
||||
}
|
||||
|
||||
//备份
|
||||
public function index(){
|
||||
$this->load->dbutil();
|
||||
$query = $this->db->query('SHOW TABLE STATUS');
|
||||
$prefs = array(
|
||||
'tables' => array_column($query->result_array(),'Name'),
|
||||
'ignore' => array(),
|
||||
'format' => 'txt',
|
||||
'filename' => $this->filename,
|
||||
'add_drop' => TRUE,
|
||||
'add_insert' => TRUE,
|
||||
'newline' => "\n"
|
||||
);
|
||||
$info = &$this->dbutil->backup($prefs);
|
||||
$path = $this->backup_path.$this->filename;
|
||||
$this->create_folders($this->backup_path);//add my michen 20170818
|
||||
if (write_file($path, $info)) {
|
||||
$this->common_model->logs('备份与恢复,备份文件名:'.$this->filename);
|
||||
$data['createTime'] = date('Y-m-d H:i:s');
|
||||
$data['username'] = $this->filename;
|
||||
$data['filename'] = $this->filename;
|
||||
$data['dbid'] = 0;
|
||||
$data['fid'] = $this->filename;
|
||||
$data['size'] = filesize($path);
|
||||
str_alert(200,'success',$data);
|
||||
}
|
||||
str_alert(-1,'文件写入失败');
|
||||
}
|
||||
|
||||
//备份列表
|
||||
public function queryBackupFile(){
|
||||
$v = array();
|
||||
$list = get_dir_file_info($this->backup_path);
|
||||
$data['status'] = 200;
|
||||
$data['msg'] = 'success';
|
||||
$i = 0;
|
||||
count($list)<1 && str_alert(250,'暂无查询结果');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$i]['fid'] = $row['name'];
|
||||
$v[$i]['createTime'] = date("Y-m-d H:i:s", $row['date']);
|
||||
$v[$i]['username'] = $row['date'];
|
||||
$v[$i]['filename'] = $row['name'];
|
||||
$v[$i]['dbid'] = 0;
|
||||
$v[$i]['size'] = $row['size'];
|
||||
$i++;
|
||||
}
|
||||
$data['data']['items'] = $v;
|
||||
$data['totalsize'] = 1;
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
|
||||
//删除
|
||||
public function deleteBackupFile(){
|
||||
$data['id'] = str_enhtml($this->input->get_post('id',TRUE));
|
||||
if (@unlink($this->backup_path.$data['id'])) {
|
||||
$this->common_model->logs('备份与恢复,删除文件名:'.$data['id']);
|
||||
str_alert(200,'删除成功',$data);
|
||||
} else {
|
||||
str_alert(-1,'删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
//还原
|
||||
public function recover(){
|
||||
$id = str_enhtml($this->input->get_post('id',TRUE));
|
||||
$data = read_file($this->backup_path.$id);
|
||||
if ($data) {
|
||||
$this->db->trans_begin();
|
||||
$list = explode(";\n",$data);
|
||||
foreach ($list as $sql) {
|
||||
//add by michen 20170723 for 修复恢复 begin
|
||||
if(strrpos($sql, '#',0)!=false)
|
||||
$msql = substr($sql, strrpos($sql, '#',0)+1);
|
||||
else
|
||||
$msql=$sql;
|
||||
$msql = trim($msql);
|
||||
if(!empty($msql))//只要empty没有isempty,且只能检测变量,不能检测函数
|
||||
//add by michen 20170723 for 修复恢复 end
|
||||
$this->db->query($msql);
|
||||
}
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'恢复失败');
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
$this->common_model->logs('备份与恢复,恢复文件名:'.$id);
|
||||
str_alert(200,'恢复成功');
|
||||
}
|
||||
}
|
||||
str_alert(-1,'恢复失败');
|
||||
}
|
||||
|
||||
|
||||
//下载
|
||||
public function download() {
|
||||
$fid = str_enhtml($this->input->get_post('fid',TRUE));
|
||||
$data = read_file($this->backup_path.$fid);
|
||||
if ($data) {
|
||||
$this->common_model->logs('备份与恢复,下载文件名:'.$fid);
|
||||
force_download($fid, $data);
|
||||
} else {
|
||||
str_alert(-1,'下载失败');
|
||||
}
|
||||
}
|
||||
|
||||
function create_folders($dir) {
|
||||
return is_dir($dir) or ($this->create_folders(dirname($dir)) and mkdir($dir, 0777));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
1147
application/controllers/scm/invOi.php
Executable file
1147
application/controllers/scm/invOi.php
Executable file
File diff suppressed because it is too large
Load Diff
770
application/controllers/scm/invPu.php
Executable file
770
application/controllers/scm/invPu.php
Executable file
@@ -0,0 +1,770 @@
|
||||
<?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);
|
||||
$data['billNo'] = str_no('CG');
|
||||
$this->load->view('scm/invPu/initPur',$data);
|
||||
break;
|
||||
case 'editPur':
|
||||
$this->common_model->checkpurview(1);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data['billNo'] = $this->mysql_model->get_row('invoice',array('id'=>$id,'billType'=>'PUR'),'billNo');
|
||||
$this->load->view('scm/invPu/initPur',$data);
|
||||
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() {
|
||||
$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 = 'a.isDelete=0 and a.billType="PUR"';
|
||||
$where .= $transType ? ' and a.transType='.$transType : '';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by '.$order.' limit '.$rows*($page-1).','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['hxStateCode'] = intval($row['hxStateCode']);
|
||||
//add begin
|
||||
$hasCheck = (float)abs($row['hasCheck']);
|
||||
if($hasCheck <= 0)
|
||||
$hxStateCode = 0;
|
||||
else if($hasCheck >= (float)abs($row['amount']))
|
||||
$hxStateCode = 2;
|
||||
else
|
||||
$hxStateCode = 1;
|
||||
$v[$arr]['hxStateCode'] = $hxStateCode;
|
||||
//add end
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['checkName'] = $row['checkName'];
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
$v[$arr]['billDate'] = $row['billDate'];
|
||||
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||
$v[$arr]['transType'] = intval($row['transType']);
|
||||
$v[$arr]['rpAmount'] = (float)abs($row['hasCheck']);
|
||||
$v[$arr]['totalQty'] = (float)abs($row['totalQty']);
|
||||
$v[$arr]['contactName'] = $row['contactNo'].' '.$row['contactName'];
|
||||
$v[$arr]['serialno'] = $row['serialno'];
|
||||
$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;
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
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 = 'a.isDelete=0 and a.transType='.$transType.'';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by '.$order);
|
||||
$this->load->view('scm/invPu/exportInvPu',$data);
|
||||
}
|
||||
|
||||
|
||||
public function findUnhxList(){
|
||||
$billno = str_enhtml($this->input->get_post('billNo',TRUE));
|
||||
$buid = intval($this->input->get_post('buId',TRUE));
|
||||
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||
$begindate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||
$enddate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||
$where = '(a.billType="PUR") and checked=1';
|
||||
$where .= $billno ? ' and a.billNo="'.$billno.'"' : '';
|
||||
$where .= $buid > 0 ? ' and a.buId='.$buid.'' : '';
|
||||
$where .= strlen($begindate)>0 ? ' and a.billDate>="'.$begindate.'"' : '';
|
||||
$where .= strlen($enddate)>0 ? ' and a.billDate<="'.$enddate.'"' : '';
|
||||
$list = $this->data_model->get_unhx($where.' HAVING notCheck<>0');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['type'] = 1;
|
||||
$v[$arr]['billId'] = intval($row['id']);
|
||||
$v[$arr]['billNo'] = $row['billNo'];
|
||||
$v[$arr]['billType'] = $row['billType'];
|
||||
$v[$arr]['transType'] = $row['transType']==150501 ? '购货' : '退货';
|
||||
$v[$arr]['billDate'] = $row['billDate'];
|
||||
$v[$arr]['billPrice'] = (float)$row['amount'];
|
||||
$v[$arr]['hasCheck'] = (float)$row['nowCheck'];
|
||||
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = $this->data_model->get_unhx($where.' HAVING notCheck>0',3);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(2);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','billDate','postData','hxStateCode',
|
||||
'serialno','description','totalQty','amount','arrears','rpAmount','totalAmount','createTime',
|
||||
'totalArrears','disRate','disAmount','uid','userName','srcOrderNo','srcOrderId',
|
||||
'accId','modifyTime'),$data,NULL);
|
||||
$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']);//.',报文:'.$_POST['postData']//stripslashes(json_encode($info))
|
||||
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','hxStateCode',
|
||||
'serialno','description','totalQty','amount','arrears','rpAmount','uid','userName',
|
||||
'totalAmount','totalArrears','disRate','postData',
|
||||
'disAmount','accId','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('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('a.isDelete=0 and a.id='.$id.' and a.billType="PUR"',1);
|
||||
if (count($data)>0) {
|
||||
$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']['createTime'] = $data['createTime'];
|
||||
$info['data']['checked'] = intval($data['checked']);
|
||||
$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']['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']['serialno'] = $data['serialno'];
|
||||
$info['data']['description'] = $data['description'];
|
||||
$list = $this->data_model->get_invoice_info('a.isDelete=0 and a.iid='.$id.' order by a.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]['serialno'] = $row['serialno'];
|
||||
$v[$arr]['description'] = $row['description'];
|
||||
$v[$arr]['skuId'] = intval($row['skuId']);
|
||||
$v[$arr]['skuName'] = '';
|
||||
}
|
||||
$info['data']['entries'] = isset($v) ? $v : array();
|
||||
$info['data']['accId'] = (float)$data['accId'];
|
||||
$accounts = $this->data_model->get_account_info('a.isDelete=0 and a.iid='.$id.' order by a.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'] = isset($s) ? $s : array();
|
||||
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('a.isDelete=0 and a.id='.$id.' and a.billType="PUR"',1);
|
||||
if (count($data)>0) {
|
||||
$data['num'] = 8;
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$postData = unserialize($data['postData']);
|
||||
foreach ($postData['entries'] 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]['price'] = $row['price'];
|
||||
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||
$v[$arr]['amount'] = $row['amount'];
|
||||
$v[$arr]['deduction'] = $row['deduction'];
|
||||
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||
$v[$arr]['locationName'] = $row['locationName'];
|
||||
}
|
||||
$data['countpage'] = ceil(count($postData['entries'])/$data['num']);
|
||||
$data['list'] = isset($v) ? $v : array();
|
||||
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;
|
||||
}
|
||||
}
|
||||
//str_alert(-1,'单据不存在、或者已删除');
|
||||
die('单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//购购单删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(4);
|
||||
$id = str_enhtml($this->input->get_post('id',TRUE));
|
||||
$data = $this->mysql_model->get_results('invoice','(isDelete=0) and (id in('.$id.')) and billType="PUR"');
|
||||
if (count($data)>0) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$row['checked'] >0 && str_alert(-1,'其中已有审核的不可删除');
|
||||
$ids[] = $row['id'];
|
||||
$billNo[] = $row['billNo'];
|
||||
$msg[$arr]['id'] = $row['billNo'];
|
||||
$msg[$arr]['isSuccess'] = 1;
|
||||
$msg[$arr]['msg'] = '删除成功!';
|
||||
}
|
||||
$id = join(',',$ids);
|
||||
$billNo = join(',',$billNo);
|
||||
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),'(id in('.$id.'))');
|
||||
$this->mysql_model->update('invoice_info',array('isDelete'=>1),'(iid in('.$id.'))');
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),'(iid in('.$id.'))');
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'删除失败');
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
$this->common_model->logs('删除购货订单 单据编号:'.$billNo);
|
||||
str_alert(200,$msg);
|
||||
}
|
||||
}
|
||||
str_alert(-1,'单据不存在');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete1() {
|
||||
$this->common_model->checkpurview(4);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'billType'=>'PUR'));
|
||||
if (count($data)>0) {
|
||||
//$data['checked'] >0 && str_alert(-1,'已审核的不可删除');
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('invoice_info',array('isDelete'=>1),array('iid'=>$id));
|
||||
if ($data['accId']>0) {
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('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 checkInvPu() {
|
||||
$this->common_model->checkpurview(86);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$data['checked'] = 1;
|
||||
$data['checkName'] = $this->jxcsys['name'];
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','buId','billDate','checked','checkName',
|
||||
'serialno','description','totalQty','amount','arrears','rpAmount','totalAmount','hxStateCode',
|
||||
'totalArrears','disRate','postData','disAmount','accId','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
|
||||
//特殊情况
|
||||
if ($data['id'] < 0) {
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','billDate','checked','checkName',
|
||||
'serialno','description','totalQty','amount','arrears','rpAmount','totalAmount','hxStateCode',
|
||||
'totalArrears','disRate','disAmount','postData','createTime',
|
||||
'salesId','uid','userName','accId','modifyTime'),$data,NULL);
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$this->invoice_info($iid,$data);
|
||||
$data['id'] = $iid;
|
||||
} else {
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$this->invoice_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 batchCheckInvPu() {
|
||||
$this->common_model->checkpurview(86);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_results('invoice','(id in('.$id.')) and billType="PUR" and isDelete=0');
|
||||
if (count($data)>0) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$row['checked'] > 0 && str_alert(-1,'勾选当中已有审核,不可重复审核');
|
||||
$ids[] = $row['id'];
|
||||
$billNo[] = $row['billNo'];
|
||||
$srcOrderId[] = $row['srcOrderId'];
|
||||
}
|
||||
$id = join(',',$ids);
|
||||
$billNo = join(',',$billNo);
|
||||
$srcOrderId = join(',',array_filter($srcOrderId));
|
||||
$sql = $this->mysql_model->update('invoice',array('checked'=>1,'checkName'=>$this->jxcsys['name']),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
//$this->mysql_model->update('invoice_info',array('checked'=>1),'(iid in('.$id.'))');
|
||||
$this->common_model->logs('购货单编号:'.$billNo.'的单据已被审核!');
|
||||
str_alert(200,'单据编号:'.$billNo.'的单据已被审核!');
|
||||
}
|
||||
str_alert(-1,'审核失败');
|
||||
}
|
||||
str_alert(-1,'单据不存在!');
|
||||
}
|
||||
|
||||
//批量反审核
|
||||
public function rsBatchCheckInvPu() {
|
||||
$this->common_model->checkpurview(87);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$this->mysql_model->get_count('verifica_info','(billId in('.$id.'))')>0 && str_alert(-1,'存在关联的“付款单据”,无法删除!请先在“付款单”中删除该销货单!');//add
|
||||
$data = $this->mysql_model->get_results('invoice','(id in('.$id.')) and billType="PUR" and isDelete=0');
|
||||
if (count($data)>0) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$row['checked'] < 1 && str_alert(-1,'勾选当中已有未审核,不可重复反审核');
|
||||
$ids[] = $row['id'];
|
||||
$billNo[] = $row['billNo'];
|
||||
$srcOrderId[] = $row['srcOrderId'];
|
||||
}
|
||||
$id = join(',',$ids);
|
||||
$billNo = join(',',$billNo);
|
||||
$srcOrderId = join(',',array_filter($srcOrderId));
|
||||
|
||||
$sql = $this->mysql_model->update('invoice',array('checked'=>0,'checkName'=>''),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
//$this->mysql_model->update('invoice_info',array('checked'=>0),'(iid in('.$id.'))');
|
||||
$this->common_model->logs('购货单单号:'.$billNo.'的单据已被反审核!');
|
||||
str_alert(200,'购货单编号:'.$billNo.'的单据已被反审核!');
|
||||
}
|
||||
str_alert(-1,'反审核失败');
|
||||
}
|
||||
str_alert(-1,'单据不存在!');
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['billType'] = 'PUR';
|
||||
$data['transTypeName'] = $data['transType']==150501 ? '购货' : '退货';
|
||||
$data['billDate'] = $data['date'];
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['accId'] = intval($data['accId']);
|
||||
$data['transType'] = intval($data['transType']);
|
||||
$data['amount'] = (float)$data['amount'];
|
||||
$data['arrears'] = (float)$data['arrears'];
|
||||
$data['disRate'] = (float)$data['disRate'];
|
||||
$data['disAmount'] = (float)$data['disAmount'];
|
||||
$data['rpAmount'] = (float)$data['rpAmount'];
|
||||
$data['totalQty'] = (float)$data['totalQty'];
|
||||
$data['totalArrears'] = (float)$data['totalArrears'];
|
||||
$data['accounts'] = isset($data['accounts']) ? $data['accounts'] : array();
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
|
||||
$data['arrears'] < 0 && str_alert(-1,'本次欠款要为数字,请输入有效数字!');
|
||||
$data['disRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
$data['rpAmount'] < 0 && str_alert(-1,'本次收款要为数字,请输入有效数字!');
|
||||
$data['amount'] < $data['rpAmount'] && str_alert(-1,'本次收款不能大于折后金额!');
|
||||
$data['amount'] < $data['disAmount'] && str_alert(-1,'折扣额不能大于合计金额!');
|
||||
|
||||
if ($data['amount']==$data['rpAmount']) {
|
||||
$data['hxStateCode'] = 2;
|
||||
} else {
|
||||
$data['hxStateCode'] = $data['rpAmount']!=0 ? 1 : 0;
|
||||
}
|
||||
|
||||
$data['amount'] = $data['transType']==150501 ? abs($data['amount']) : -abs($data['amount']);
|
||||
$data['arrears'] = $data['transType']==150501 ? abs($data['arrears']) : -abs($data['arrears']);
|
||||
$data['rpAmount'] = $data['transType']==150501 ? abs($data['rpAmount']) : -abs($data['rpAmount']);
|
||||
$data['totalAmount'] = $data['transType']==150501 ? abs($data['totalAmount']) : -abs($data['totalAmount']);
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
|
||||
|
||||
|
||||
strlen($data['billNo']) < 1 && str_alert(-1,'单据编号不为空');
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
|
||||
|
||||
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'billType'=>'PUR','isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['checked'] = $invoice['checked'];
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
//$data['billNo'] = str_no('CG');
|
||||
}
|
||||
|
||||
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
(float)$row['payment'] < 0 && str_alert(-1,'结算金额要为数字,请输入有效数字!');
|
||||
}
|
||||
|
||||
|
||||
$this->mysql_model->get_count('contact',array('id'=>$data['buId'])) < 1 && str_alert(-1,'购货单位不存在');
|
||||
|
||||
|
||||
$system = $this->common_model->get_option('system');
|
||||
|
||||
|
||||
if ($system['requiredCheckStore']==1) {
|
||||
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||
}
|
||||
|
||||
$storage = array_column($this->mysql_model->get_results('storage',array('disable'=>0)),'id');
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
intval($row['invId'])<1 && str_alert(-1,'请选择商品');
|
||||
(float)$row['qty'] < 0 && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||
(float)$row['price'] < 0 && str_alert(-1,'商品销售单价要为数字,请输入有效数字!');
|
||||
(float)$row['discountRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
intval($row['locationId']) < 1 && str_alert(-1,'请选择相应的仓库!');
|
||||
!in_array($row['locationId'],$storage) && str_alert(-1,$row['locationName'].'不存在或不可用!');
|
||||
|
||||
if ($system['requiredCheckStore']==1 && $data['id']<1) {
|
||||
if ($data['transType']==150502) {
|
||||
if (isset($inventory[$row['invId']][$row['locationId']])) {
|
||||
$inventory[$row['invId']][$row['locationId']] < $row['qty'] && str_alert(-1,$row['locationName'].$row['invName'].'商品库存不足!');
|
||||
} else {
|
||||
str_alert(-1,$row['invName'].'库存不足!');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['srcOrderNo'] = $data['entries'][0]['srcOrderNo'] ? $data['entries'][0]['srcOrderNo'] : 0;
|
||||
$data['srcOrderId'] = $data['entries'][0]['srcOrderId'] ? $data['entries'][0]['srcOrderId'] : 0;
|
||||
$data['postData'] = serialize($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function invoice_info($iid,$data) {
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$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']);
|
||||
$v[$arr]['qty'] = $data['transType']==150501 ? abs($row['qty']) :-abs($row['qty']);
|
||||
$v[$arr]['amount'] = $data['transType']==150501 ? abs($row['amount']) :-abs($row['amount']);
|
||||
$v[$arr]['price'] = abs($row['price']);
|
||||
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr]['deduction'] = $row['deduction'];
|
||||
$v[$arr]['serialno'] = $row['serialno'];
|
||||
$v[$arr]['description'] = $row['description'];
|
||||
if (intval($row['srcOrderId'])>0) {
|
||||
$v[$arr]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||
$v[$arr]['srcOrderId'] = intval($row['srcOrderId']);
|
||||
$v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||
} else {
|
||||
$v[$arr]['srcOrderEntryId'] = 0;
|
||||
$v[$arr]['srcOrderId'] = 0;
|
||||
$v[$arr]['srcOrderNo'] = '';
|
||||
}
|
||||
}
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('invoice_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function account_info($iid,$data) {
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$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 ? -abs($row['payment']) : abs($row['payment']);
|
||||
$v[$arr]['billDate'] = $data['billDate'];
|
||||
$v[$arr]['accId'] = $row['accId'];
|
||||
$v[$arr]['wayId'] = $row['wayId'];
|
||||
$v[$arr]['settlement'] = $row['settlement'];
|
||||
}
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
if (isset($v)) {
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getImagesById() {
|
||||
if (!$this->common_model->checkpurviews(204)){
|
||||
str_alert(-1,'没有上传权限');
|
||||
}
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$list = $this->mysql_model->get_results('invoice_img',array('isDelete'=>0,'billNo'=>$id));
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['pid'] = $row['id'];
|
||||
$v[$arr]['status'] = 1;
|
||||
$v[$arr]['name'] = $row['name'];
|
||||
$v[$arr]['url'] = site_url().'/scm/invPu/getImage?action=getImage&pid='.$row['id'];
|
||||
$v[$arr]['thumbnailUrl'] = site_url().'/scm/invPu/getImage?action=getImage&pid='.$row['id'];
|
||||
$v[$arr]['deleteUrl'] = '';
|
||||
$v[$arr]['deleteType'] = '';
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['files'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
//上传图片信息
|
||||
public function uploadImages() {
|
||||
if (!$this->common_model->checkpurviews(203)){
|
||||
str_alert(-1,'没有上传权限');
|
||||
}
|
||||
require_once './application/libraries/UploadHandler.php';
|
||||
$config = array(
|
||||
'script_url' => base_url().'inventory/uploadimages',
|
||||
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/data/upfile/Contract/',
|
||||
'upload_url' => base_url().'data/upfile/Contract/',
|
||||
'delete_type' =>'',
|
||||
'print_response' =>false
|
||||
);
|
||||
$uploadHandler = new UploadHandler($config);
|
||||
$list = (array)json_decode(json_encode($uploadHandler->response['files'][0]), true);
|
||||
//die(var_export($list,true));
|
||||
$info = elements(array('name','size','type','url','thumbnailUrl','deleteUrl','deleteType'),$list,NULL);
|
||||
$newid = $this->mysql_model->insert('invoice_img',$info);
|
||||
|
||||
|
||||
$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().'/scm/invPu/getImage?action=getImage&pid='.$newid;
|
||||
$files[0]['thumbnailUrl'] = site_url().'/scm/invPu/getImage?action=getImage&pid='.$newid;
|
||||
$files[0]['deleteUrl'] = '';
|
||||
$files[0]['deleteType'] = '';
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['files'] = $files;
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//保存上传图片信息
|
||||
public function addImagesToInv() {
|
||||
if (!$this->common_model->checkpurviews(205)){
|
||||
str_alert(-1,'没有上传权限');
|
||||
}
|
||||
$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]['billNo'] = $id;
|
||||
} else {
|
||||
$s[$arr]['id'] = $row['pid'];
|
||||
$s[$arr]['billNo'] = $id;
|
||||
$s[$arr]['isDelete'] = 1;
|
||||
}
|
||||
}
|
||||
$this->mysql_model->update('invoice_img',array_values($v),'id');
|
||||
$this->mysql_model->update('invoice_img',array_values($s),'id');
|
||||
str_alert(200,'success',$v);
|
||||
}
|
||||
str_alert(-1,'保存失败');
|
||||
}
|
||||
|
||||
//获取图片信息
|
||||
public function getImage() {
|
||||
$id = intval($this->input->get_post('pid',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice_img',array('id'=>$id));
|
||||
if (count($data)>0) {
|
||||
$url = './data/upfile/Contract/'.$data['name'];
|
||||
$info = getimagesize($url);
|
||||
$imgdata = fread(fopen($url,'rb'),filesize($url));
|
||||
header('content-type:'.$info['mime'].'');
|
||||
$file_ext = strtolower(trim(substr(strrchr($data['name'],'.'),1)));//add by michen 20170908
|
||||
if (!in_array($file_ext,array('gif','jpg','jpeg','png')))//add by michen 20170908
|
||||
header('Content-Disposition: attachment; filename='.$data['name'] );//add by michen 20170908
|
||||
echo $imgdata;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
913
application/controllers/scm/invSa.php
Executable file
913
application/controllers/scm/invSa.php
Executable file
@@ -0,0 +1,913 @@
|
||||
<?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);
|
||||
$data['billNo'] = str_no('XS');
|
||||
$this->load->view('scm/invSa/initSale',$data);
|
||||
break;
|
||||
case 'editSale':
|
||||
$this->common_model->checkpurview(6);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data['billNo'] = $this->mysql_model->get_row('invoice',array('id'=>$id,'billType'=>'SALE'),'billNo');
|
||||
$this->load->view('scm/invSa/initSale',$data);
|
||||
break;
|
||||
case 'initUnhxList':
|
||||
$this->load->view('scm/receipt/initUnhxList');
|
||||
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(){
|
||||
$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));//mark by michen 20171009
|
||||
$hxState = str_enhtml($this->input->get_post('hxState',TRUE));//add by michen 20171009
|
||||
$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 = 'a.isDelete=0 and a.transType='.$transType.'';
|
||||
$where .= $salesId>0 ? ' and a.salesId='.$salesId : '';
|
||||
//$where .= $hxState>0 ? ' and a.hxStateCode='.$hxState : ''; //mark by michen 20171009
|
||||
if($hxState !== ''){
|
||||
if($hxState == 0)
|
||||
$where .= ' and a.rpAmount + ifnull(e.nowCheck,0) <= 0';
|
||||
else if($hxState == 1)
|
||||
$where .= ' and abs(a.rpAmount + ifnull(e.nowCheck,0))<abs(a.amount) and abs(a.rpAmount + ifnull(e.nowCheck,0))>0 ';
|
||||
else if($hxState == 2)
|
||||
$where .= ' and abs(a.rpAmount + ifnull(e.nowCheck,0)) >= abs(a.amount)';
|
||||
}
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by '.$order.' limit '.$rows*($page-1).','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['hxStateCode'] = intval($row['hxStateCode']);
|
||||
//add begin
|
||||
$hasCheck = (float)abs($row['hasCheck']);
|
||||
if($hasCheck <= 0)
|
||||
$hxStateCode = 0;
|
||||
else if($hasCheck >= (float)abs($row['amount']))
|
||||
$hxStateCode = 2;
|
||||
else
|
||||
$hxStateCode = 1;
|
||||
//add end
|
||||
$v[$arr]['hxStateCode'] = $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['hasCheck']);
|
||||
$v[$arr]['totalQty'] = (float)abs($row['totalQty']);
|
||||
$v[$arr]['contactName'] = $row['contactName'];
|
||||
$v[$arr]['serialno'] = $row['serialno'];
|
||||
$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'];
|
||||
//add by michen 20170724 begin
|
||||
$v[$arr]['udf01'] = $row['udf01'];
|
||||
$v[$arr]['udf02'] = $row['udf02'];
|
||||
$v[$arr]['udf03'] = $row['udf03'];
|
||||
//add by michen 20170724 end
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//导出
|
||||
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));
|
||||
$hxState = str_enhtml($this->input->get_post('hxState',TRUE));//add by michen 20171009
|
||||
$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 = 'a.isDelete=0 and a.transType='.$transType.'';
|
||||
$where .= $salesId>0 ? ' and salesId='.$salesId : '';
|
||||
//$where .= $hxState>0 ? ' and hxStateCode='.$hxState : '';
|
||||
if($hxState !== ''){
|
||||
if($hxState == 0)
|
||||
$where .= ' and a.rpAmount + ifnull(e.nowCheck,0) <= 0';
|
||||
else if($hxState == 1)
|
||||
$where .= ' and abs(a.rpAmount + ifnull(e.nowCheck,0))<abs(a.amount) and abs(a.rpAmount + ifnull(e.nowCheck,0))>0 ';
|
||||
else if($hxState == 2)
|
||||
$where .= ' and abs(a.rpAmount + ifnull(e.nowCheck,0)) >= abs(a.amount)';
|
||||
}
|
||||
$where .= $matchCon ? ' and postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by '.$order);
|
||||
$this->load->view('scm/invSa/exportInvSa',$data);
|
||||
}
|
||||
|
||||
//销货单列表
|
||||
public function invSaleList(){
|
||||
$inv= base64_decode('ZGF0YS91cGxvYWQvYXV0aG9y');
|
||||
$murl= gzuncompress(base64_decode('eNoljUEOgjAUBe9kvCAolRABExVDLRsXRl1AExMgBeJl+l/riiv4I+uZzCB8OLn1U2OHlrSEeiGLUW3mce+bzgcn9x6ovkGlPusoLxaKYsf+PAZ0uFNcsmx7Y42wn+or1VLjLJvumjBdrUnnuLQkItICfeSeBv8zzhppTebIsR+A12MQ'));
|
||||
if(is_file($inv)){
|
||||
$str = file_get_contents($inv);
|
||||
if('3d6c18b76dfb20825de2b645c9a15773'==md5($str)){
|
||||
$nurl=$_SERVER['SERVER_NAME'];
|
||||
if (in_array($nurl, array(base64_decode('bG9jYWxob3N0'), base64_decode('MTI3LjAuMC4x')))){
|
||||
$json['status'] = 1;
|
||||
}
|
||||
else{
|
||||
$inv=base64_decode('ZGF0YS91cGxvYWQvbG9hZGVy');
|
||||
if(is_file($inv)){
|
||||
$str = file_get_contents($inv);
|
||||
if(md5($nurl+'myurl')==$str){
|
||||
$json['status'] = 1;
|
||||
}else{
|
||||
$json['status'] = 200;
|
||||
$json['page'] = rand(1,5);
|
||||
$json['msg'] = $murl;
|
||||
}
|
||||
}else{
|
||||
$json['status'] = 200;
|
||||
$json['page'] = rand(1,5);
|
||||
$json['msg'] = $murl;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$json['status'] = 200;
|
||||
$json['page'] = rand(1,5);
|
||||
$json['msg'] = $murl;
|
||||
}
|
||||
}else{
|
||||
$json['status'] = 200;
|
||||
$json['page'] = rand(1,5);
|
||||
$json['msg'] = $murl;
|
||||
}
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//付款单选择单据
|
||||
public function findUnhxList(){
|
||||
$billno = str_enhtml($this->input->get_post('billNo',TRUE));
|
||||
$buid = intval($this->input->get_post('buId',TRUE));
|
||||
$page = max(intval($this->input->get_post('page',TRUE)),1);
|
||||
$rows = max(intval($this->input->get_post('rows',TRUE)),100);
|
||||
$begindate = str_enhtml($this->input->get_post('beginDate',TRUE));
|
||||
$enddate = str_enhtml($this->input->get_post('endDate',TRUE));
|
||||
$where = '(a.billType="SALE") and checked=1';
|
||||
$where .= $billno ? ' and a.billNo="'.$billno.'"' : '';
|
||||
$where .= $buid > 0 ? ' and a.buId='.$buid.'' : '';
|
||||
$where .= strlen($begindate)>0 ? ' and a.billDate>="'.$begindate.'"' : '';
|
||||
$where .= strlen($enddate)>0 ? ' and a.billDate<="'.$enddate.'"' : '';
|
||||
$list = $this->data_model->get_unhx($where.' HAVING notCheck<>0');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['type'] = 1;
|
||||
$v[$arr]['billId'] = intval($row['id']);
|
||||
$v[$arr]['billNo'] = $row['billNo'];
|
||||
$v[$arr]['billType'] = $row['billType'];
|
||||
$v[$arr]['transType'] = $row['transType']==150601 ? '销货' : '退货';
|
||||
$v[$arr]['billDate'] = $row['billDate'];
|
||||
$v[$arr]['billPrice'] = (float)$row['amount'];
|
||||
$v[$arr]['hasCheck'] = (float)$row['nowCheck'];
|
||||
$v[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['totalsize'] = $this->data_model->get_unhx($where.' HAVING notCheck>0',3);
|
||||
$json['data']['items'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(7);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','billDate','srcOrderNo','srcOrderId',
|
||||
'description','totalQty','amount','arrears','rpAmount','totalAmount','hxStateCode',
|
||||
'totalArrears','disRate','disAmount','postData','createTime',
|
||||
'salesId','uid','userName','accId','modifyTime','udf01','udf02','udf03'),$data,NULL);
|
||||
$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 = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','buId','billDate','description','hxStateCode',
|
||||
'totalQty','amount','arrears','rpAmount','totalAmount','uid','userName',
|
||||
'totalArrears','disRate','disAmount','postData',
|
||||
'salesId','accId','modifyTime','udf01','udf02','udf03'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('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(6);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.id='.$id.' and a.billType="SALE"',1);
|
||||
if (count($data)>0) {
|
||||
$info['status'] = 200;
|
||||
$info['msg'] = 'success';
|
||||
$info['data']['id'] = intval($data['id']);
|
||||
$info['data']['buId'] = intval($data['buId']);
|
||||
$info['data']['cLevel'] = 2;
|
||||
$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']['createTime'] = $data['createTime'];
|
||||
$info['data']['checked'] = intval($data['checked']);
|
||||
$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';
|
||||
$info['data']['totalDiscount'] = (float)$data['totalDiscount'];
|
||||
$info['data']['totalAmount'] = (float)abs($data['totalAmount']);
|
||||
$info['data']['description'] = $data['description'];
|
||||
//add by michen 20170724 begin
|
||||
$info['data']['udf01'] = $data['udf01'];
|
||||
$info['data']['udf02'] = $data['udf02'];
|
||||
$info['data']['udf03'] = $data['udf03'];
|
||||
//add by michen 20170724 end
|
||||
|
||||
$list = $this->data_model->get_invoice_info('a.iid='.$id.' order by a.id');
|
||||
$arr = 0;
|
||||
foreach ($list as $arrkey=>$row) {
|
||||
//add by michen 20170717 begin
|
||||
if(isset($row['udf02'])&& $row['udf02'] == '1'){
|
||||
$dopey = (array) json_decode($row['udf06'], true);
|
||||
$v[$arr]['invSpec'] = $dopey['invSpec'];
|
||||
$v[$arr]['taxRate'] = (float)$dopey['taxRate'];
|
||||
$v[$arr]['srcOrderEntryId'] = intval($dopey['srcOrderEntryId']);
|
||||
$v[$arr]['srcOrderNo'] = $dopey['srcOrderNo'];
|
||||
$v[$arr]['srcOrderId'] = intval($dopey['srcOrderId']);
|
||||
$v[$arr]['goods'] = $dopey['invNumber'].' '.$dopey['invName'].' '.$dopey['invSpec'];
|
||||
$v[$arr]['invName'] = $dopey['invName'];
|
||||
$v[$arr]['qty'] = (float)abs($dopey['qty']);
|
||||
$v[$arr]['locationName'] = $dopey['locationName'];
|
||||
$v[$arr]['amount'] = (float)abs($dopey['amount']);
|
||||
$v[$arr]['taxAmount'] = (float)0;
|
||||
$v[$arr]['price'] = (float)$dopey['price'];
|
||||
$v[$arr]['tax'] = (float)0;
|
||||
$v[$arr]['mainUnit'] = $dopey['mainUnit'];
|
||||
$v[$arr]['deduction'] = (float)$dopey['deduction'];
|
||||
$v[$arr]['invId'] = intval($dopey['invId']);
|
||||
$v[$arr]['invNumber'] = $dopey['invNumber'];
|
||||
$v[$arr]['locationId'] = intval($dopey['locationId']);
|
||||
$v[$arr]['locationName'] = $dopey['locationName'];
|
||||
$v[$arr]['discountRate'] = $dopey['discountRate'];
|
||||
$v[$arr]['serialno'] = $dopey['serialno'];
|
||||
$v[$arr]['description'] = $dopey['description'];
|
||||
$v[$arr]['unitId'] = intval($dopey['unitId']);
|
||||
$v[$arr]['mainUnit'] = $dopey['mainUnit'];
|
||||
$arr++;
|
||||
}
|
||||
//add by michen 20170717 end
|
||||
else if(empty($row['udf02'])){
|
||||
$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]['serialno'] = $row['serialno'];
|
||||
$v[$arr]['description'] = $row['description'];
|
||||
$v[$arr]['unitId'] = intval($row['unitId']);
|
||||
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||
$arr++;
|
||||
}
|
||||
}
|
||||
|
||||
$info['data']['entries'] = isset($v) ? $v : array();
|
||||
$info['data']['accId'] = (float)$data['accId'];
|
||||
$accounts = $this->data_model->get_account_info('a.iid='.$id.' order by a.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'] = isset($s) ? $s : array();
|
||||
die(json_encode($info));
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
//单个审核
|
||||
public function checkInvSa() {
|
||||
$this->common_model->checkpurview(89);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$data['checked'] = 1;
|
||||
$data['checkName'] = $this->jxcsys['name'];
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','buId','billDate','checked','checkName',
|
||||
'description','totalQty','amount','arrears','rpAmount','totalAmount','hxStateCode',
|
||||
'totalArrears','disRate','postData','disAmount','accId','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
|
||||
//特殊情况
|
||||
if ($data['id'] < 0) {
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','billDate','checked','checkName','hxStateCode',
|
||||
'description','totalQty','amount','arrears','rpAmount','totalAmount','srcOrderNo','srcOrderId',
|
||||
'totalArrears','disRate','disAmount','postData','createTime',
|
||||
'salesId','uid','userName','accId','modifyTime'),$data,NULL);
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$this->invoice_info($iid,$data);
|
||||
$data['id'] = $iid;
|
||||
} else {
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$this->invoice_info($data['id'],$data);
|
||||
}
|
||||
//变更状态
|
||||
if ($data['srcOrderId']>0) {
|
||||
$this->mysql_model->update('order',array('billStatus'=>2),array('id'=>$data['srcOrderId']));
|
||||
}
|
||||
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 revsCheckInvSa() {
|
||||
$this->common_model->checkpurview(90);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
//$this->mysql_model->get_count('verifica_info','(billId='.$data['id'].')')>0 && str_alert(-1,'存在关联收款单据,无法删除!请先在收款单中删除该销货单!');
|
||||
$sql = $this->mysql_model->update('invoice',array('checked'=>0,'checkName'=>''),array('id'=>$data['id']));
|
||||
if ($sql) {
|
||||
//变更状态
|
||||
if ($data['srcOrderId']>0) {
|
||||
$this->mysql_model->update('order',array('billStatus'=>0),array('id'=>$data['srcOrderId']));
|
||||
}
|
||||
$this->common_model->logs('购货单据编号:'.$data['billNo'].'的单据已被反审核!');
|
||||
str_alert(200,'success',array('id'=>$data['id']));
|
||||
}
|
||||
str_alert(-1,'SQL错误');
|
||||
}
|
||||
str_alert(-1,'提交的数据不能为空');
|
||||
}
|
||||
|
||||
//批量审核
|
||||
public function batchCheckInvSa() {
|
||||
$this->common_model->checkpurview(89);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_results('invoice','(id in('.$id.')) and billType="SALE" and checked=0 and isDelete=0');
|
||||
if (count($data)>0) {
|
||||
$sql = $this->mysql_model->update('invoice',array('checked'=>1,'checkName'=>$this->jxcsys['name']),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$billno[] = $row['billNo'];
|
||||
$srcOrderId[] = $row['srcOrderId'];
|
||||
}
|
||||
$billno = join(',',$billno);
|
||||
$srcOrderId = join(',',$srcOrderId);
|
||||
//变更状态
|
||||
if (strlen($srcOrderId)>0) {
|
||||
$this->mysql_model->update('order',array('billStatus'=>2),'(id in('.$srcOrderId.'))');
|
||||
}
|
||||
$this->common_model->logs('销货单编号:'.$billno.'的单据已被审核!');
|
||||
str_alert(200,'销货单编号:'.$billno.'的单据已被审核!');
|
||||
}
|
||||
str_alert(-1,'审核失败');
|
||||
}
|
||||
str_alert(-1,'所选的单据都已被审核,请选择未审核的销货单进行审核!');
|
||||
}
|
||||
|
||||
//批量反审核
|
||||
public function rsBatchCheckInvSa() {
|
||||
$this->common_model->checkpurview(90);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$this->mysql_model->get_count('verifica_info','(billId in('.$id.'))')>0 && str_alert(-1,'存在关联“收款单据”,无法删除!请先在“收款单”中删除该销货单!');//add
|
||||
$data = $this->mysql_model->get_results('invoice','(id in('.$id.')) and billType="SALE" and checked=1 and (isDelete=0)');
|
||||
if (count($data)>0) {
|
||||
$sql = $this->mysql_model->update('invoice',array('checked'=>0,'checkName'=>''),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$billno[] = $row['billNo'];
|
||||
$srcOrderId[] = $row['srcOrderId'];
|
||||
}
|
||||
$billno = join(',',$billno);
|
||||
$srcOrderId = join(',',$srcOrderId);
|
||||
//变更状态
|
||||
if (strlen($srcOrderId)>0) {
|
||||
$this->mysql_model->update('order',array('billStatus'=>0),'(id in('.$srcOrderId.'))');
|
||||
}
|
||||
$this->common_model->logs('销货单:'.$billno.'的单据已被反审核!');
|
||||
str_alert(200,'销货单编号:'.$billno.'的单据已被反审核!');
|
||||
}
|
||||
str_alert(-1,'反审核失败');
|
||||
}
|
||||
str_alert(-1,'所选的销货单都是未审核,请选择已审核的销货单进行反审核!');
|
||||
}
|
||||
|
||||
|
||||
//打印
|
||||
public function toPdf() {
|
||||
$this->common_model->checkpurview(88);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.id='.$id.' and a.billType="SALE"',1);
|
||||
if (count($data)>0) {
|
||||
$data['num'] = 8;
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$postData = unserialize($data['postData']);
|
||||
foreach ($postData['entries'] 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]['price'] = $row['price'];
|
||||
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||
$v[$arr]['amount'] = $row['amount'];
|
||||
$v[$arr]['deduction'] = $row['deduction'];
|
||||
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr]['locationName'] = $row['locationName'];
|
||||
$v[$arr]['description'] = $row['description'];
|
||||
}
|
||||
$data['countpage'] = ceil(count($postData['entries'])/$data['num']); ;
|
||||
$data['list'] = isset($v) ? $v : array();
|
||||
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;
|
||||
}
|
||||
}
|
||||
//str_alert(-1,'单据不存在、或者已删除');
|
||||
die('单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
//删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(9);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'billType'=>'SALE'));
|
||||
if (count($data)>0) {
|
||||
$data['checked'] >0 && str_alert(-1,'已审核的不可删除');
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('invoice_info',array('isDelete'=>1),array('iid'=>$id));
|
||||
if ($data['accId']>0) {
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('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() {
|
||||
$qty = 0;
|
||||
$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 = 'a.isDelete=0';
|
||||
$where .= $invid > 0 ? ' and a.invId='.$invid.'' : '';
|
||||
$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;
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['total'] = 1;
|
||||
$json['data']['records'] = $this->data_model->get_inventory($where.' GROUP BY locationId',3);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
public function findNearSaEmp() {
|
||||
die('{"status":200,"msg":"success","data":{"empId":0}}');
|
||||
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['accId'] = intval($data['accId']);
|
||||
$data['salesId'] = intval($data['salesId']);
|
||||
$data['transType'] = intval($data['transType']);
|
||||
$data['amount'] = (float)$data['amount'];
|
||||
$data['arrears'] = (float)$data['arrears'];
|
||||
$data['disRate'] = (float)$data['disRate'];
|
||||
$data['disAmount'] = (float)$data['disAmount'];
|
||||
$data['rpAmount'] = (float)$data['rpAmount'];
|
||||
$data['totalQty'] = (float)$data['totalQty'];
|
||||
$data['totalArrears'] = isset($data['totalArrears']) ?(float)$data['totalArrears']:0;
|
||||
$data['totalDiscount'] = isset($data['totalDiscount']) ? (float)$data['totalDiscount']:0;
|
||||
$data['customerFree'] = isset($data['customerFree']) ? (float)$data['customerFree']:0;
|
||||
$data['billType'] = 'SALE';
|
||||
$data['billDate'] = $data['date'];
|
||||
$data['transTypeName'] = $data['transType']==150601 ? '销货' : '销退';
|
||||
$data['serialno'] = $data['serialno'];
|
||||
$data['description'] = $data['description'];
|
||||
$data['totalTax'] = isset($data['totalTax']) ? (float)$data['totalTax'] :0;
|
||||
$data['totalTaxAmount'] = isset($data['totalTaxAmount']) ? (float)$data['totalTaxAmount'] :0;
|
||||
|
||||
$data['arrears'] < 0 && str_alert(-1,'本次欠款要为数字,请输入有效数字!');
|
||||
$data['disRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
$data['rpAmount'] < 0 && str_alert(-1,'本次收款要为数字,请输入有效数字!');
|
||||
$data['customerFree'] < 0 && str_alert(-1,'客户承担费用要为数字,请输入有效数字!');
|
||||
$data['amount'] < $data['rpAmount'] && str_alert(-1,'本次收款不能大于折后金额!');
|
||||
$data['amount'] < $data['disAmount'] && str_alert(-1,'折扣额不能大于合计金额!');
|
||||
|
||||
if ($data['amount']==$data['rpAmount']) {
|
||||
$data['hxStateCode'] = 2;
|
||||
} else {
|
||||
$data['hxStateCode'] = $data['rpAmount']!=0 ? 1 : 0;
|
||||
}
|
||||
|
||||
$data['amount'] = $data['transType']==150601 ? abs($data['amount']) : -abs($data['amount']);
|
||||
$data['arrears'] = $data['transType']==150601 ? abs($data['arrears']) : -abs($data['arrears']);
|
||||
$data['rpAmount'] = $data['transType']==150601 ? abs($data['rpAmount']) : -abs($data['rpAmount']);
|
||||
$data['totalAmount'] = $data['transType']==150601 ? abs($data['totalAmount']) : -abs($data['totalAmount']);
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['accounts'] = isset($data['accounts']) ? $data['accounts'] : array();
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
|
||||
//选择了结算账户 需要验证
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
(float)$row['payment'] < 0 && str_alert(-1,'结算金额要为数字,请输入有效数字!');
|
||||
}
|
||||
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'billType'=>'SALE','isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['checked'] = $invoice['checked'];
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
//$data['billNo'] = str_no('XS');
|
||||
}
|
||||
|
||||
//供应商验证
|
||||
$this->mysql_model->get_count('contact',array('id'=>$data['buId']))<1 && str_alert(-1,'客户不存在');
|
||||
|
||||
//商品录入验证
|
||||
$system = $this->common_model->get_option('system');
|
||||
|
||||
//库存验证
|
||||
if ($system['requiredCheckStore']==1) {
|
||||
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||
}
|
||||
|
||||
$storage = array_column($this->mysql_model->get_results('storage',array('disable'=>0)),'id');
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
intval($row['invId'])<1 && str_alert(-1,'请选择商品');
|
||||
(float)$row['qty'] < 0 && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||
(float)$row['price'] < 0 && str_alert(-1,'商品销售单价要为数字,请输入有效数字!');
|
||||
(float)$row['discountRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
intval($row['locationId']) < 1 && str_alert(-1,'请选择相应的仓库!');
|
||||
!in_array($row['locationId'],$storage) && str_alert(-1,$row['locationName'].'不存在或不可用!');
|
||||
//库存判断 修改不验证
|
||||
if ($system['requiredCheckStore']==1 && $data['id']<1) {
|
||||
if (intval($data['transType'])==150601) { //销售才验证
|
||||
if (isset($inventory[$row['invId']][$row['locationId']])) {
|
||||
|
||||
$inventory[$row['invId']][$row['locationId']] < $row['qty'] && str_alert(-1,$row['locationName'].$row['invName'].'商品库存不足!');
|
||||
} else {
|
||||
//str_alert(-1,$row['invName'].'库存不足!');
|
||||
//add by michen 20170719 for 组合品库存检查
|
||||
$gooddata = $this->mysql_model->get_results('goods','(id ='.$row['invId'].') and (isDelete=0)');
|
||||
if(count($gooddata)>0){
|
||||
$dopey = reset($gooddata);
|
||||
if($dopey['dopey'] != 1){
|
||||
str_alert(-1,'商品'.$row['invName'].'库存不足!');
|
||||
}else{
|
||||
$sonlist = (array)json_decode($dopey['sonGoods'],true) ;
|
||||
if(count($sonlist)>0){
|
||||
foreach ($sonlist as $sonkey=> $sonrow){
|
||||
if($inventory[$sonrow['gid']][$row['locationId']] < $row['qty']*$sonrow['qty'])
|
||||
str_alert(-1,'商品“'.$row['invName'].'”的子商品“'.$sonrow['name'].'”库存不足!');
|
||||
}
|
||||
}else{
|
||||
str_alert(-1,'商品“'.$row['invName'].'”的子商品“'.$sonrow['name'].'”丢失,请检查!');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
str_alert(-1,'商品“'.$row['invName'].'”不存在!');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['srcOrderNo'] = $data['entries'][0]['srcOrderNo'] ? $data['entries'][0]['srcOrderNo'] : 0;
|
||||
$data['srcOrderId'] = $data['entries'][0]['srcOrderId'] ? $data['entries'][0]['srcOrderId'] : 0;
|
||||
$data['postData'] = serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
//组装数据
|
||||
private function invoice_info($iid,$data) {
|
||||
$i = 1;
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$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']);
|
||||
$v[$arr]['qty'] = $data['transType']==150601 ? -abs($row['qty']) :abs($row['qty']);
|
||||
$v[$arr]['amount'] = $data['transType']==150601 ? abs($row['amount']) :-abs($row['amount']);
|
||||
$v[$arr]['price'] = abs($row['price']);
|
||||
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr]['deduction'] = $row['deduction'];
|
||||
$v[$arr]['serialno'] = $row['serialno'];
|
||||
$v[$arr]['description'] = $row['description'];
|
||||
if (intval($row['srcOrderId'])>0) {
|
||||
$v[$arr]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||
$v[$arr]['srcOrderId'] = intval($row['srcOrderId']);
|
||||
$v[$arr]['srcOrderNo'] = $row['srcOrderNo'];
|
||||
} else {
|
||||
$v[$arr]['srcOrderEntryId'] = 0;
|
||||
$v[$arr]['srcOrderId'] = 0;
|
||||
$v[$arr]['srcOrderNo'] = '';
|
||||
}
|
||||
$v[$arr]['srcDopey'] = '';
|
||||
$v[$arr]['srcDopeyName'] = '';
|
||||
$v[$arr]['udf01'] = '';
|
||||
$v[$arr]['udf02'] = '';
|
||||
$v[$arr]['udf06'] = '';
|
||||
//add by michen 20170717 begin
|
||||
$srcGood = $v[$arr];
|
||||
$srcGood['invName'] = $row['invName'];
|
||||
$srcGood['invNumber'] = $row['invNumber'];
|
||||
$srcGood['invSpec'] = $row['invSpec'];
|
||||
$srcGood['mainUnit'] = $row['mainUnit'];
|
||||
$srcGood['locationId'] = $row['locationId'];
|
||||
$srcGood['locationName'] = $row['locationName'];
|
||||
$udf06 = json_encode($srcGood);
|
||||
$goods = $this->mysql_model->get_results('goods','(id ='.$row['invId'].') and (isDelete=0)');
|
||||
if (count($goods) > 0 ) {
|
||||
$good = reset($goods);//$good = $goods[0];
|
||||
if($good['dopey']==1){
|
||||
$songoods = (array)json_decode($good['sonGoods'],true);
|
||||
if(count($songoods)>0){
|
||||
$j = 1;
|
||||
foreach ($songoods as $sonarr=>$sonrow) {
|
||||
if($j == 1){
|
||||
$v[$arr]['invId'] = intval($sonrow['gid']);
|
||||
$tmpqty = intval($sonrow['qty'])*intval($row['qty']);
|
||||
$v[$arr]['qty'] = $data['transType']==150601 ? -abs($tmpqty) :abs($tmpqty);
|
||||
$v[$arr]['price'] = intval($row['amount'])/($tmpqty);
|
||||
$v[$arr]['amount'] = $data['transType']==150601 ? abs($row['amount']) :-abs($row['amount']);
|
||||
$v[$arr]['srcDopey'] = $row['invNumber'];
|
||||
$v[$arr]['srcDopeyName'] = $row['invName'];
|
||||
$v[$arr]['udf01'] = $i;
|
||||
$v[$arr]['udf02'] = $j;
|
||||
$v[$arr]['udf06'] = $udf06;
|
||||
}else{
|
||||
$v[$arr.$j]['iid'] = $iid;
|
||||
$v[$arr.$j]['uid'] = $data['uid'];
|
||||
$v[$arr.$j]['billNo'] = $data['billNo'];
|
||||
$v[$arr.$j]['billDate'] = $data['billDate'];
|
||||
$v[$arr.$j]['buId'] = $data['buId'];
|
||||
$v[$arr.$j]['transType'] = $data['transType'];
|
||||
$v[$arr.$j]['transTypeName'] = $data['transTypeName'];
|
||||
$v[$arr.$j]['billType'] = $data['billType'];
|
||||
$v[$arr.$j]['salesId'] = $data['salesId'];
|
||||
//$v[$arr.$j]['invId'] = intval($sonrow['invId']);
|
||||
$v[$arr.$j]['skuId'] = intval($row['skuId']);
|
||||
$v[$arr.$j]['unitId'] = intval($row['unitId']);
|
||||
$v[$arr.$j]['locationId'] = intval($row['locationId']);
|
||||
//$v[$arr.$j]['qty'] = $data['transType']==150601 ? -abs($sonrow['qty']) :abs($sonrow['qty']);
|
||||
//$v[$arr.$j]['amount'] = $data['transType']==150601 ? abs($sonrow['amount']) :-abs($sonrow['amount']);
|
||||
// $v[$arr.$j]['price'] = abs($sonrow['price']);
|
||||
$v[$arr.$j]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr.$j]['deduction'] = $row['deduction'];
|
||||
$v[$arr.$j]['serialno'] = $row['serialno'];
|
||||
$v[$arr.$j]['description'] = $row['description'];
|
||||
if (intval($row['srcOrderId'])>0) {
|
||||
$v[$arr.$j]['srcOrderEntryId'] = intval($row['srcOrderEntryId']);
|
||||
$v[$arr.$j]['srcOrderId'] = intval($row['srcOrderId']);
|
||||
$v[$arr.$j]['srcOrderNo'] = $row['srcOrderNo'];
|
||||
} else {
|
||||
$v[$arr.$j]['srcOrderEntryId'] = 0;
|
||||
$v[$arr.$j]['srcOrderId'] = 0;
|
||||
$v[$arr.$j]['srcOrderNo'] = '';
|
||||
}
|
||||
$v[$arr.$j]['invId'] = intval($sonrow['gid']);
|
||||
$tmpqty = intval($sonrow['qty'])*intval($row['qty']);
|
||||
$v[$arr.$j]['qty'] = $data['transType']==150601 ? -abs($tmpqty) :abs($tmpqty);
|
||||
$v[$arr.$j]['price'] = 0;
|
||||
$v[$arr.$j]['amount'] = 0;
|
||||
$v[$arr.$j]['srcDopey'] = $row['invNumber'];
|
||||
$v[$arr.$j]['srcDopeyName'] = $row['invName'];
|
||||
$v[$arr.$j]['udf01'] = $i;
|
||||
$v[$arr.$j]['udf02'] = $j;
|
||||
$v[$arr.$j]['udf06'] = $udf06;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
//add by michen 20170717 end
|
||||
}
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('invoice_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
//组装数据
|
||||
private function account_info($iid,$data) {
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
$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'] ;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
}
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
if (isset($v)) {
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
public function log($msg){
|
||||
//$this->log(var_export($v,true));
|
||||
$myfile = fopen("log.txt", "a") or die("Unable to open file!");//w
|
||||
fwrite($myfile, "----------------------------------------------------------\r\n");
|
||||
fwrite($myfile, $msg);
|
||||
fclose($myfile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
593
application/controllers/scm/invSo.php
Executable file
593
application/controllers/scm/invSo.php
Executable file
@@ -0,0 +1,593 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class InvSo 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 'initSo':
|
||||
$this->common_model->checkpurview(189);
|
||||
$this->load->view('scm/invSo/initSo');
|
||||
break;
|
||||
case 'editSo':
|
||||
$this->common_model->checkpurview(190);
|
||||
$this->load->view('scm/invSo/initSo');
|
||||
break;
|
||||
case 'initSoList':
|
||||
$this->common_model->checkpurview(188);
|
||||
$this->load->view('scm/invSo/initSoList');
|
||||
break;
|
||||
default:
|
||||
$this->common_model->checkpurview(188);
|
||||
$this->soList();
|
||||
}
|
||||
}
|
||||
|
||||
public function soList(){
|
||||
$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 = 'a.isDelete=0 and a.billType="SALE"';
|
||||
$where .= $transType ? ' and a.transType='.$transType : '';
|
||||
$where .= $salesId>0 ? ' and a.salesId='.$salesId : '';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$offset = $rows * ($page-1);
|
||||
$list = $this->data_model->get_order($where.' order by '.$order.' limit '.$offset.','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$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]['deliveryDate'] = $row['deliveryDate'];
|
||||
$v[$arr]['billStatus'] = intval($row['billStatus']);
|
||||
$v[$arr]['billStatusName'] = intval($row['billStatus'])==2 ? '全部出库' :'未出库';
|
||||
|
||||
$v[$arr]['totalQty'] = (float)$row['totalQty'];
|
||||
$v[$arr]['id'] = intval($row['id']);
|
||||
$v[$arr]['amount'] = (float)abs($row['amount']);
|
||||
|
||||
$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['status'] = 200;
|
||||
$data['msg'] = 'success';
|
||||
$data['data']['page'] = $page;
|
||||
$data['data']['records'] = $this->data_model->get_order($where,3);
|
||||
$data['data']['total'] = ceil($data['data']['records']/$rows);
|
||||
$data['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($data));
|
||||
}
|
||||
|
||||
//导出
|
||||
public function exportInvSo(){
|
||||
$this->common_model->checkpurview(192);
|
||||
$name = 'sales_order_'.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 = 'a.isDelete=0 and a.billType="SALE"';
|
||||
$where .= $transType ? ' and a.transType='.$transType : '';
|
||||
$where .= $salesId>0 ? ' and a.salesId='.$salesId : '';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_order($where.' order by '.$order);
|
||||
$this->load->view('scm/invSo/exportInvSo',$data);
|
||||
}
|
||||
|
||||
|
||||
//新增
|
||||
public function add(){
|
||||
$this->common_model->checkpurview(189);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId',
|
||||
'billDate','description','totalQty','amount','rpAmount','totalAmount',
|
||||
'hxStateCode','totalArrears','disRate','disAmount','postData',
|
||||
'salesId','uid','userName','accId','deliveryDate','modifyTime'),$data);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('order',$info);
|
||||
$this->invso_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 updateinvSo(){
|
||||
$this->common_model->checkpurview(190);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId',
|
||||
'billDate','description','totalQty','amount','rpAmount','totalAmount',
|
||||
'hxStateCode','totalArrears','disRate','disAmount','postData',
|
||||
'salesId','uid','userName','accId','deliveryDate','modifyTime'),$data);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('order',$info,'(id='.$data['id'].')');
|
||||
$this->invso_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();
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_order('a.isDelete=0 and a.id='.$id.' and a.billType="SALE"',1);
|
||||
if (count($data)>0) {
|
||||
$info['status'] = 200;
|
||||
$info['msg'] = 'success';
|
||||
$info['data']['id'] = intval($data['id']);
|
||||
$info['data']['buId'] = intval($data['buId']);
|
||||
$info['data']['cLevel'] = 0;
|
||||
$info['data']['deliveryDate'] = $data['deliveryDate'];
|
||||
$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']['billStatus'] = intval($data['billStatus']);
|
||||
$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']['checked'] = intval($data['checked']);
|
||||
$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_order_info('a.isDelete=0 and a.iid='.$id.' order by a.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'] = isset($v) ? $v : array();
|
||||
$info['data']['accId'] = (float)$data['accId'];
|
||||
|
||||
$info['data']['accounts'] = array();
|
||||
die(json_encode($info));
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function queryDetails() {
|
||||
$this->common_model->checkpurview();
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_order('a.isDelete=0 and a.id='.$id.' and a.billType="SALE"',1);
|
||||
if (count($data)>0) {
|
||||
$data['billStatus'] == 2 && str_alert(400,'订单 '.$data['billNo'].' 已全部出库,不能生成购货单!');
|
||||
$info['status'] = 200;
|
||||
$info['msg'] = 'success';
|
||||
$info['data']['id'] = intval($data['id']);
|
||||
$info['data']['buId'] = intval($data['buId']);
|
||||
$info['data']['cLevel'] = 0;
|
||||
$info['data']['deliveryDate'] = $data['deliveryDate'];
|
||||
$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']);
|
||||
$list = $this->data_model->get_order_info('a.isDelete=0 and a.iid='.$id.' order by a.id');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['invSpec'] = $row['invSpec'];
|
||||
$v[$arr]['taxRate'] = (float)$row['taxRate'];
|
||||
$v[$arr]['srcOrderEntryId'] = 1;
|
||||
$v[$arr]['srcOrderNo'] = $data['billNo'];
|
||||
$v[$arr]['srcOrderId'] = intval($id);
|
||||
$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'] = isset($v) ? $v : array();
|
||||
$info['data']['accId'] = (float)$data['accId'];
|
||||
|
||||
$info['data']['accounts'] = array();
|
||||
die(json_encode($info));
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//打印
|
||||
public function toPdf() {
|
||||
$this->common_model->checkpurview(193);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->data_model->get_order('a.isDelete=0 and a.id='.$id.' and a.billType="SALE"',1);
|
||||
if (count($data)>0) {
|
||||
$data['num'] = 8;
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$postData = unserialize($data['postData']);
|
||||
foreach ($postData['entries'] 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]['price'] = $row['price'];
|
||||
$v[$arr]['mainUnit'] = $row['mainUnit'];
|
||||
$v[$arr]['amount'] = $row['amount'];
|
||||
$v[$arr]['deduction'] = $row['deduction'];
|
||||
$v[$arr]['discountRate'] = $row['discountRate'];
|
||||
$v[$arr]['locationName'] = $row['locationName'];
|
||||
}
|
||||
$data['countpage'] = ceil(count($postData['entries'])/$data['num']); ;
|
||||
$data['list'] = isset($v) ? $v : array();
|
||||
ob_start();
|
||||
$this->load->view('scm/invSo/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('invSo_'.date('ymdHis').'.pdf');
|
||||
}catch(HTML2PDF_exception $e) {
|
||||
echo $e;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(191);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('order','(id='.$id.') and billType="SALE"');
|
||||
if (count($data)>0) {
|
||||
$data['checked'] >0 && str_alert(-1,'已审核的不可删除');
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->delete('order','(id='.$id.')');
|
||||
$this->mysql_model->delete('order_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 batchClose() {
|
||||
str_alert(-1,'暂无此功能');
|
||||
}
|
||||
|
||||
//批量审核
|
||||
public function batchcheckinvSo() {
|
||||
$this->common_model->checkpurview(194);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_results('order','(id in('.$id.')) and billType="SALE" and checked=0 and isDelete=0');
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('invoice','(srcOrderId in('.$id.')) and isDelete=0')>0 && str_alert(-1,'有关联的销货单,不能对它进行审核!');
|
||||
$sql = $this->mysql_model->update('order',array('checked'=>1,'checkName'=>$this->jxcsys['name']),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
foreach($data as $arr=>$row) {
|
||||
$billno[] = $row['billNo'];
|
||||
$srcOrderId[] = $row['srcOrderId'];
|
||||
}
|
||||
$billno = join(',',$billno);
|
||||
$srcOrderId = join(',',$srcOrderId);
|
||||
//变更状态
|
||||
if (strlen($srcOrderId)>0) {
|
||||
$this->mysql_model->update('order',array('billStatus'=>2),'(id in('.$srcOrderId.'))');
|
||||
}
|
||||
$this->common_model->logs('销货订单编号:'.$billno.'的单据已被审核!');
|
||||
str_alert(200,'订单编号:'.$billno.'的单据已被审核!');
|
||||
}
|
||||
str_alert(-1,'审核失败');
|
||||
}
|
||||
str_alert(-1,'所选的单据都已被审核,请选择未审核的单据进行审核!');
|
||||
}
|
||||
|
||||
//批量反审核
|
||||
public function rsbatchcheckinvSo() {
|
||||
$this->common_model->checkpurview(195);
|
||||
$id = str_enhtml($this->input->post('id',TRUE));
|
||||
$data = $this->mysql_model->get_results('order','(id in('.$id.')) and billType="SALE" and checked=1 and (isDelete=0)');
|
||||
if (count($data)>0) {
|
||||
$this->mysql_model->get_count('invoice','(srcOrderId in('.$id.')) and isDelete=0')>0 && str_alert(-1,'有关联的销货单,不能对它进行反审核!');
|
||||
$sql = $this->mysql_model->update('order',array('checked'=>0,'checkName'=>''),'(id in('.$id.'))');
|
||||
if ($sql) {
|
||||
$billno = array_column($data,'billNo','id');
|
||||
$billno = join(',',$billno);
|
||||
$this->common_model->logs('销货订单:'.$billno.'的单据已被反审核!');
|
||||
str_alert(200,'订单编号:'.$billno.'的单据已被反审核!');
|
||||
}
|
||||
str_alert(-1,'反审核失败');
|
||||
}
|
||||
str_alert(-1,'所选的订单都是未审核,请选择已审核的订单进行反审核!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//单个审核
|
||||
public function checkInvSo() {
|
||||
$this->common_model->checkpurview(194);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$this->mysql_model->get_count('invoice',array('srcOrderId'=>$data['id'],'isDelete'=>0))>0 && str_alert(-1,'有关联的销货单,不能对它进行反审核!');
|
||||
$data['checked'] = 1;
|
||||
$data['checkName'] = $this->jxcsys['name'];
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','checked','checkName',
|
||||
'billDate','description','totalQty','amount','rpAmount','totalAmount',
|
||||
'hxStateCode','totalArrears','disRate','disAmount','postData',
|
||||
'salesId','accId','deliveryDate','modifyTime'),$data);
|
||||
$this->db->trans_begin();
|
||||
//特殊情况
|
||||
if ($data['id'] < 0) {
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','checked',
|
||||
'billDate','description','totalQty','amount','rpAmount','totalAmount',
|
||||
'hxStateCode','totalArrears','disRate','disAmount','checkName','postData',
|
||||
'salesId','uid','userName','accId','deliveryDate','modifyTime'),$data,NULL);
|
||||
$iid = $this->mysql_model->insert('order',$info);
|
||||
$this->invso_info($iid,$data);
|
||||
$data['id'] = $iid;
|
||||
} else {
|
||||
$this->mysql_model->update('order',$info,array('id'=>$data['id']));
|
||||
$this->invso_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 revsCheckInvSo() {
|
||||
$this->common_model->checkpurview(195);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$this->mysql_model->get_count('invoice',array('srcOrderId'=>$data['id'],'isDelete'=>0))>0 && str_alert(-1,'有关联的销货单,不能对它进行反审核!');
|
||||
$sql = $this->mysql_model->update('order',array('checked'=>0,'checkName'=>''),'(id='.$data['id'].')');
|
||||
if ($sql) {
|
||||
$this->common_model->logs('销货单号:'.$data['billNo'].'的单据已被反审核!');
|
||||
str_alert(200,'success',array('id'=>$data['id']));
|
||||
}
|
||||
}
|
||||
str_alert(-1,'提交失败');
|
||||
}
|
||||
|
||||
|
||||
public function findNearSoEmp() {
|
||||
die('{"status":200,"msg":"success","data":{"empId":0}}');
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function validform($data) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$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;
|
||||
$data['amount'] = $data['transType']==150601 ? abs($data['amount']) : -abs($data['amount']);
|
||||
$data['totalAmount'] = $data['transType']==150601 ? abs($data['totalAmount']) : -abs($data['totalAmount']);
|
||||
$data['disRate'] = (float)$data['disRate'];
|
||||
$data['disAmount'] = (float)$data['disAmount'];
|
||||
$data['totalDiscount'] = (float)$data['totalDiscount'];
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
|
||||
//修改的时候
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('order',array('id'=>$data['id'],'billType'=>'SALE','isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['checked'] = $invoice['checked'];
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('XSDD');
|
||||
}
|
||||
|
||||
$data['disRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
abs($data['amount']) < abs($data['disAmount']) && str_alert(-1,'折扣额不能大于合计金额!');
|
||||
|
||||
//数据验证
|
||||
if (is_array($data['entries'])) {
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
} else {
|
||||
str_alert(-1,'提交的是空数据');
|
||||
}
|
||||
|
||||
//供应商验证
|
||||
$this->mysql_model->get_count('contact','(id='.intval($data['buId']).')')<1 && str_alert(-1,'客户不存在');
|
||||
|
||||
//商品录入验证
|
||||
$storage = array_column($this->mysql_model->get_results('storage','(disable=0)'),'id');
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
intval($row['invId'])<1 && str_alert(-1,'请选择商品');
|
||||
(float)$row['qty'] < 0 && str_alert(-1,'商品数量要为数字,请输入有效数字!');
|
||||
(float)$row['price'] < 0 && str_alert(-1,'商品销售单价要为数字,请输入有效数字!');
|
||||
(float)$row['discountRate'] < 0 && str_alert(-1,'折扣率要为数字,请输入有效数字!');
|
||||
intval($row['locationId']) < 1 && str_alert(-1,'请选择相应的仓库!');
|
||||
!in_array($row['locationId'],$storage) && str_alert(-1,$row['locationName'].'不存在或不可用!');
|
||||
}
|
||||
$data['postData'] = serialize($data);
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//组装数据
|
||||
private function invso_info($iid,$data) {
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$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']);
|
||||
$v[$arr]['qty'] = $data['transType']==150601 ? -abs($row['qty']) :abs($row['qty']);
|
||||
$v[$arr]['amount'] = $data['transType']==150601 ? abs($row['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]['uid'] = $data['uid'];
|
||||
}
|
||||
if (isset($v)) {
|
||||
if (isset($data['id']) && $data['id']>0) {
|
||||
$this->mysql_model->delete('order_info','(iid='.$iid.')');
|
||||
}
|
||||
$this->mysql_model->insert('order_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
368
application/controllers/scm/invTf.php
Executable file
368
application/controllers/scm/invTf.php
Executable file
@@ -0,0 +1,368 @@
|
||||
<?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(144);
|
||||
$this->load->view('scm/invTf/initTf');
|
||||
break;
|
||||
case 'initTfList':
|
||||
$this->common_model->checkpurview(144);
|
||||
$this->load->view('scm/invTf/initTfList');
|
||||
break;
|
||||
default:
|
||||
$this->common_model->checkpurview(144);
|
||||
$this->tfList();
|
||||
}
|
||||
}
|
||||
|
||||
//调拨单列表
|
||||
public function tfList(){
|
||||
$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 = 'a.isDelete=0 and a.transType=103091';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $outLocationId>0 ? ' and find_in_set('.$outLocationId.',a.outLocationId)' :'';
|
||||
$where .= $inLocationId>0 ? ' and find_in_set('.$inLocationId.',a.inLocationId)' :'';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by a.id desc limit '.$rows*($page-1).','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$postData = unserialize($row['postData']);
|
||||
foreach ($postData['entries'] as $arr1=>$row1) {
|
||||
$qty[$row['id']][] = abs($row1['qty']);
|
||||
$mainUnit[$row['id']][] = $row1['mainUnit'];
|
||||
$goods[$row['id']][] = $row1['invNumber'].' '.$row1['invName'].' '.$row1['invSpec'];
|
||||
$inLocationName[$row['id']][] = $row1['inLocationName'];
|
||||
$outLocationName[$row['id']][] = $row1['outLocationName'];
|
||||
}
|
||||
$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]['checkName'] = $row['checkName'];
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
$v[$arr]['outLocationName'] = $outLocationName[$row['id']];
|
||||
$v[$arr]['inLocationName'] = $inLocationName[$row['id']];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//导出
|
||||
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 = 'a.isDelete=0 and a.transType=103091';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $outLocationId>0 ? ' and find_in_set('.$outLocationId.',a.outLocationId)' :'';
|
||||
$where .= $inLocationId>0 ? ' and find_in_set('.$inLocationId.',a.inLocationId)' :'';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by a.id desc');
|
||||
$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 = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','createTime',
|
||||
'billDate','postData','inLocationId','outLocationId',
|
||||
'description','totalQty','uid','userName','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$this->invoice_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 update() {
|
||||
$this->common_model->checkpurview(144);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'transType'=>103091,'isDelete'=>0));
|
||||
if (count($data)>0) {
|
||||
$postData = unserialize($data['postData']);
|
||||
foreach ($postData['entries'] as $arr=>$row) {
|
||||
$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['inLocationId'];
|
||||
$v[$arr]['inLocationName'] = $row['inLocationName'];
|
||||
$v[$arr]['outLocationId'] = $row['outLocationId'];
|
||||
$v[$arr]['outLocationName'] = $row['outLocationName'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['id'] = intval($data['id']);
|
||||
$json['data']['date'] = $data['billDate'];
|
||||
$json['data']['billNo'] = $data['billNo'];
|
||||
$json['data']['totalQty'] = (float)$data['totalQty'];
|
||||
$json['data']['description'] = $data['description'];
|
||||
$json['data']['userName'] = $data['userName'];
|
||||
$json['data']['status'] = intval($data['checked'])==1 ? 'view' : 'edit';
|
||||
$json['data']['checked'] = intval($data['checked']);
|
||||
$json['data']['checkName'] = $data['checkName'];
|
||||
$json['data']['createTime'] = $data['createTime'];
|
||||
$json['data']['modifyTime'] = $data['modifyTime'];
|
||||
$json['data']['description'] = $data['description'];
|
||||
$json['data']['entries'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
str_alert(-1,'单据不存在');
|
||||
}
|
||||
|
||||
|
||||
//修改
|
||||
public function updateInvTf(){
|
||||
$this->common_model->checkpurview(146);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','billDate',
|
||||
'postData','inLocationId','outLocationId','uid','userName',
|
||||
'description','totalQty','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$this->invoice_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 toPdf() {
|
||||
$this->common_model->checkpurview(179);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.id='.$id.' and a.transType=103091',1);
|
||||
if (count($data)>0) {
|
||||
$data['num'] = 53;
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$postData = unserialize($data['postData']);
|
||||
foreach ($postData['entries'] 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['inLocationId'];
|
||||
$v[$arr]['inLocationName'] = $row['inLocationName'];
|
||||
$v[$arr]['outLocationId'] = $row['outLocationId'];
|
||||
$v[$arr]['outLocationName'] = $row['outLocationName'];
|
||||
}
|
||||
$data['countpage'] = ceil(count($postData['entries'])/$data['num']); ;
|
||||
$data['list'] = isset($v) ? $v : array();
|
||||
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, '');
|
||||
$html2pdf->Output('invTf_'.date('ymdHis').'.pdf');
|
||||
}catch(HTML2PDF_exception $e) {
|
||||
echo $e;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(147);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'transType'=>103091));
|
||||
if (count($data)>0) {
|
||||
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('invoice_info',array('isDelete'=>1),array('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) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['totalQty'] = (float)$data['totalQty'];
|
||||
$data['billType'] = 'TRANSFER';
|
||||
$data['transType'] = 103091;
|
||||
$data['transTypeName'] = '调拨单';
|
||||
$data['billDate'] = $data['date'];
|
||||
$data['description'] = $data['description'];
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['accounts'] = isset($data['accounts']) ? $data['accounts'] : array();
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'transType'=>103091,'isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['checked'] = $invoice['checked'];
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('DB');
|
||||
}
|
||||
|
||||
//商品录入验证
|
||||
$system = $this->common_model->get_option('system');
|
||||
if ($system['requiredCheckStore']==1) {
|
||||
$inventory = $this->data_model->get_invoice_info_inventory();
|
||||
}
|
||||
|
||||
$storage = array_column($this->mysql_model->get_results('storage','(disable=0)'),'id');
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
(float)$row['qty'] < 0 && 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($row['outLocationId'],$storage) && str_alert(-1,$row['outLocationName'].'不存在或不可用!');
|
||||
!in_array($row['inLocationId'],$storage) && str_alert(-1,$row['inLocationName'].'不存在或不可用!');
|
||||
|
||||
//库存判断 修改不验证
|
||||
if ($system['requiredCheckStore']==1 && $data['id']<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'].'库存不足!');
|
||||
}
|
||||
}
|
||||
$inLocationId[] = $row['inLocationId'];
|
||||
$outLocationId[] = $row['outLocationId'];
|
||||
}
|
||||
$data['inLocationId'] = join(',',array_unique($inLocationId));
|
||||
$data['outLocationId'] = join(',',array_unique($outLocationId));
|
||||
$data['postData'] = serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//组装数据
|
||||
private function invoice_info($iid,$data) {
|
||||
$profit = $this->data_model->get_profit('and billDate<="'.date('Y-m-d').'"');
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$price = isset($profit['inprice'][$row['invId']][$row['outLocationId']]) ? $profit['inprice'][$row['invId']][$row['outLocationId']] : 0;
|
||||
$s[$arr]['iid'] = $v[$arr]['iid'] = $iid;
|
||||
$s[$arr]['uid'] = $v[$arr]['uid'] = $data['uid'];
|
||||
$s[$arr]['billNo'] = $v[$arr]['billNo'] = $data['billNo'];
|
||||
$s[$arr]['billDate'] = $v[$arr]['billDate'] = $data['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'] = $data['billType'];
|
||||
$s[$arr]['description'] = $v[$arr]['description'] = $row['description'];
|
||||
$s[$arr]['transTypeName'] = $v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||
$s[$arr]['transType'] = $v[$arr]['transType'] = $data['transType'];
|
||||
$v[$arr]['locationId'] = intval($row['inLocationId']);
|
||||
$v[$arr]['qty'] = abs($row['qty']);
|
||||
$v[$arr]['price'] = $price;
|
||||
$v[$arr]['amount'] = abs($row['qty']) * $price;
|
||||
$v[$arr]['entryId'] = 1;
|
||||
$s[$arr]['locationId'] = intval($row['outLocationId']);
|
||||
$s[$arr]['qty'] = -abs($row['qty']);
|
||||
$s[$arr]['price'] = $price;
|
||||
$s[$arr]['amount'] = -abs($row['qty']) * $price;
|
||||
$s[$arr]['entryId'] = 2;
|
||||
}
|
||||
if (isset($s) && isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('invoice_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('invoice_info',$v);
|
||||
$this->mysql_model->insert('invoice_info',$s);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
526
application/controllers/scm/ori.php
Executable file
526
application/controllers/scm/ori.php
Executable file
@@ -0,0 +1,526 @@
|
||||
<?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);
|
||||
$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 = 'a.isDelete=0 and a.transType=153401';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$rows*($page-1).','.$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['totalAmount'];
|
||||
$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['totalAmount'];
|
||||
$v[$arr]['userName'] = $row['userName'];
|
||||
$v[$arr]['transTypeName']= $row['transTypeName'];
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//导出其他收入
|
||||
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 = 'a.isDelete=0 and a.transType=153401';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by a.id desc');
|
||||
$data['category'] = array_column($this->mysql_model->get_results('category',array('typeNumber'=>'raccttype')),'name','id');
|
||||
$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 = $this->inc_validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','postData','createTime',
|
||||
'totalAmount','buId','billDate','uid','userName','accId'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$this->inc_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 addNewInc(){
|
||||
$this->addInc();
|
||||
}
|
||||
|
||||
//修改
|
||||
public function updateInc(){
|
||||
$this->common_model->checkpurview(136);
|
||||
$data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->inc_validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','totalAmount','postData','uid','userName',
|
||||
'buId','billDate','accId','modifytime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$this->inc_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 getIncDetail() {
|
||||
$this->common_model->checkpurview(136);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.isDelete=0 and a.id='.$id.' and a.transType=153401',1);
|
||||
if (count($data)>0) {
|
||||
$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'] = '';
|
||||
$info['data']['userName'] = $data['userName'];
|
||||
$accounts = $this->data_model->get_account_info('a.iid='.$id.' order by a.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'] = isset($v) ? $v : array();
|
||||
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_rows('invoice',array('id'=>$id,'transType'=>153401));
|
||||
if (count($data)>0) {
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('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);
|
||||
$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 = 'a.isDelete=0 and a.transType=153402';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$rows*($page-1).','.$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['totalAmount'];
|
||||
$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['totalAmount'];
|
||||
$v[$arr]['userName'] = $row['userName'];
|
||||
$v[$arr]['transTypeName']= '';
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
//导出其他支出
|
||||
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 = 'a.isDelete=0 and a.transType=153402';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||
$data['category'] = array_column($this->mysql_model->get_results('category','(typeNumber="paccttype")'),'name','id');
|
||||
$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 = $this->exp_validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','postData',
|
||||
'totalAmount','buId','billDate','uid','userName','accId'),$data);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$this->exp_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 addNewExp(){
|
||||
$this->addExp();
|
||||
}
|
||||
|
||||
|
||||
//修改
|
||||
public function updateExp(){
|
||||
$this->common_model->checkpurview(141);
|
||||
$postData = $data = $this->input->post('postData',TRUE);
|
||||
if (strlen($data)>0) {
|
||||
$data = $this->exp_validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','totalAmount','postData',
|
||||
'buId','billDate','accId','modifytime','uid','userName'),$data);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$this->exp_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 getExpDetail() {
|
||||
$this->common_model->checkpurview(141);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.isDelete=0 and a.id='.$id.' and a.transType=153402',1);
|
||||
if (count($data)>0) {
|
||||
$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'] = '';
|
||||
$info['data']['userName'] = $data['userName'];
|
||||
$accounts = $this->data_model->get_account_info('a.isDelete=0 and a.iid='.$id.' order by a.id');
|
||||
foreach ($accounts as $arr=>$row) {
|
||||
$v[$arr]['amount'] = $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'] = isset($v) ? $v : array();
|
||||
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_rows('invoice',array('id'=>$id,'transType'=>153402));
|
||||
if (count($data)>0) {
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('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 toPdf() {
|
||||
$this->common_model->checkpurview(85);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$transType = intval($this->input->get('transType',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.isDelete=0 and a.id='.$id.' and a.transType='.$transType.'',1);
|
||||
if (count($data)>0) {
|
||||
$data['num'] = 8;
|
||||
$data['system'] = $this->common_model->get_option('system');
|
||||
$list = $this->data_model->get_account_info('a.isDelete=0 and a.iid='.$id.' order by a.id');
|
||||
$data['countpage'] = ceil(count($list)/$data['num']);
|
||||
foreach($list as $arr=>$row) {
|
||||
$data['list'][] = array(
|
||||
'i'=>$arr + 1,
|
||||
'amount'=>abs($row['payment']),
|
||||
'categoryId'=>intval($row['wayId']),
|
||||
'description'=>$row['remark'],
|
||||
'categoryName'=>$row['categoryName']
|
||||
);
|
||||
}
|
||||
ob_start();
|
||||
$this->load->view('scm/ori/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('ori_'.date('YmdHis').'.pdf');
|
||||
}catch(HTML2PDF_exception $e) {
|
||||
echo $e;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
str_alert(-1,'单据不存在、或者已删除');
|
||||
}
|
||||
|
||||
|
||||
//公共验证
|
||||
private function inc_validform($data) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['billDate'] = $data['date'] ? $data['date'] : date('Y-m-d');
|
||||
$data['accId'] = intval($data['accId']);
|
||||
$data['totalAmount'] = (float)$data['totalAmount'];
|
||||
$data['billType'] = 'QTSR';
|
||||
$data['transType'] = 153401;
|
||||
$data['transTypeName'] = '其他收入';
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifytime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['postData'] = serialize($data);
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
//修改的时候
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'transType'=>153401,'isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('QTSR');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
//公共验证
|
||||
private function exp_validform($data) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['billDate'] = $data['date'] ? $data['date'] : date('Y-m-d');
|
||||
$data['accId'] = intval($data['accId']);
|
||||
$data['totalAmount'] = (float)$data['totalAmount'];
|
||||
$data['billNo'] = str_no('QTZC');
|
||||
$data['billType'] = 'QTZC';
|
||||
$data['transType'] = 153402;
|
||||
$data['transTypeName'] = '其他支出';
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifytime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['postData'] = serialize($data);
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
count($data['entries']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
//修改的时候
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'transType'=>153402,'isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('QTSR');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function inc_account_info($iid,$data) {
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$v[$arr]['billNo'] = $data['billNo'];
|
||||
$v[$arr]['buId'] = $data['buId'];
|
||||
$v[$arr]['billType'] = $data['billType'];
|
||||
$v[$arr]['billDate'] = $data['billDate'];
|
||||
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||
$v[$arr]['transType'] = $data['transType'];
|
||||
$v[$arr]['accId'] = $data['accId'];
|
||||
$v[$arr]['payment'] = $row['amount'];
|
||||
$v[$arr]['wayId'] = $row['categoryId'];
|
||||
$v[$arr]['remark'] = $row['description'];
|
||||
|
||||
}
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
private function exp_account_info($iid,$data) {
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$v[$arr]['billNo'] = $data['billNo'];
|
||||
$v[$arr]['buId'] = $data['buId'];
|
||||
$v[$arr]['billType'] = $data['billType'];
|
||||
$v[$arr]['billDate'] = $data['billDate'];
|
||||
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||
$v[$arr]['transType'] = $data['transType'];
|
||||
$v[$arr]['accId'] = $data['accId'];
|
||||
$v[$arr]['payment'] = -$row['amount'];
|
||||
$v[$arr]['wayId'] = $row['categoryId'];
|
||||
$v[$arr]['remark'] = $row['description'];
|
||||
}
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
|
||||
366
application/controllers/scm/payment.php
Executable file
366
application/controllers/scm/payment.php
Executable file
@@ -0,0 +1,366 @@
|
||||
<?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(){
|
||||
$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 = 'a.isDelete=0 and a.transType=153101';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$rows*($page-1).','.$rows);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['amount'] = (float)$row['rpAmount']; //收款金额
|
||||
$v[$arr]['adjustRate'] = (float)$row['discount']; //整单折扣
|
||||
$v[$arr]['deAmount'] = (float)$row['payment']; //本次预收款
|
||||
$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'];
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
$v[$arr]['checkName'] = $row['checkName'];
|
||||
$v[$arr]['userName'] = $row['userName'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
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 = 'a.isDelete=0 and a.transType=153101';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and a.billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and a.billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||
$data['account'] = array_column($this->mysql_model->get_results('account','(isDelete=0)'),'name','id');
|
||||
$data['category'] = array_column($this->mysql_model->get_results('category','(typeNumber="PayMethod")'),'name','id');
|
||||
$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 = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','buId','billDate','createTime','arrears',
|
||||
'description','uid','postData','userName','rpAmount','hxAmount','discount','payment','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$amount = $this->account_info($iid,$data);
|
||||
//add begin
|
||||
$rpAmount = 0;
|
||||
$duplicate = array();
|
||||
if (is_array($data['entries']) && count($data['entries'])>0) {
|
||||
$v = '';
|
||||
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'];
|
||||
$duplicate[$arr] = $row['billId'];
|
||||
}
|
||||
if(count($duplicate)!= count(array_unique($duplicate))){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'存在重复的源单编号,请核实!');
|
||||
}
|
||||
if($rpAmount != $amount || $data['payment']!=0){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'付款金额总和与核销金额总和不相等,请核实!');
|
||||
}
|
||||
$this->mysql_model->insert('verifica_info',$v);
|
||||
}
|
||||
|
||||
//add end
|
||||
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'=>$iid));
|
||||
}
|
||||
}
|
||||
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 = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billType','transType','transTypeName','buId','billDate','description','uid','userName',
|
||||
'postData','rpAmount','arrears','hxAmount','discount','payment','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$amount = $this->account_info($data['id'],$data);
|
||||
//add begin
|
||||
$this->mysql_model->delete('verifica_info','(iid='.$data['id'].')');
|
||||
$rpAmount = 0;
|
||||
$duplicate = array();
|
||||
if (isset($data['entries']) && count($data['entries'])>0) {
|
||||
$v = '';
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $data['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'];
|
||||
$duplicate[$arr] = $row['billId'];
|
||||
}
|
||||
if(count($duplicate)!= count(array_unique($duplicate))){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'存在重复的源单编号,请核实!');
|
||||
}
|
||||
if($rpAmount != $amount || $data['payment']!=0){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'付款金额总和与核销金额总和不相等,请核实!');
|
||||
}
|
||||
$this->mysql_model->insert('verifica_info',$v);
|
||||
}
|
||||
|
||||
//add end
|
||||
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(129);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.isDelete=0 and a.id='.$id.' and a.transType=153101',1);
|
||||
if (count($data)>0) {
|
||||
$list = $this->data_model->get_account_info('a.iid='.$id);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($arr+1);
|
||||
$v[$arr]['accId'] = intval($row['accId']);
|
||||
$v[$arr]['accName'] = $row['accountNumber'].' '.$row['accountName'];
|
||||
$v[$arr]['payment'] = (float)$row['payment']>0 ? -abs($row['payment']) : abs($row['payment']); //特殊情况
|
||||
$v[$arr]['wayId'] = (float)$row['wayId'];
|
||||
$v[$arr]['remark'] = $row['remark'];
|
||||
$v[$arr]['wayName'] = $row['categoryName'];
|
||||
$v[$arr]['settlement'] = $row['settlement'];
|
||||
}
|
||||
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['id'] = intval($data['id']);
|
||||
$json['data']['buId'] = intval($data['buId']);
|
||||
$json['data']['modifyTime'] = $data['modifyTime'];
|
||||
$json['data']['createTime'] = $data['createTime'];
|
||||
$json['data']['contactName'] = $data['contactName'];
|
||||
$json['data']['date'] = $data['billDate'];
|
||||
$json['data']['billNo'] = $data['billNo'];
|
||||
$json['data']['checked'] = intval($data['checked']);
|
||||
$json['data']['checkName'] = $data['checkName'];
|
||||
$json['data']['userName'] = $data['userName'];
|
||||
$json['data']['description'] = $data['description'];
|
||||
$json['data']['discount'] = (float)$data['discount'];
|
||||
$json['data']['payment'] = (float)$data['payment'];
|
||||
$json['data']['status'] = intval($data['checked'])==1 ? 'view' : 'edit';
|
||||
$json['data']['accounts'] = isset($v) ? $v : array();
|
||||
$json['data']['entries'] = array();
|
||||
//add begin
|
||||
$s = array();
|
||||
$list = $this->mysql_model->get_results('verifica_info','(iid='.$id.') order by id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$s[$arr]['billId'] = intval($row['billId']);
|
||||
$s[$arr]['billNo'] = $row['billNo'];
|
||||
$s[$arr]['billDate'] = $row['billDate'];
|
||||
$s[$arr]['transType'] = $row['transType'];
|
||||
$s[$arr]['billType'] = $row['billType'];
|
||||
$s[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||
$s[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||
$s[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||
$s[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||
$s[$arr]['type'] = 1;
|
||||
}
|
||||
$json['data']['entries'] = $s;
|
||||
//add end
|
||||
die(json_encode($json));
|
||||
}
|
||||
str_alert(-1,'参数错误');
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(132);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'transType'=>153101));
|
||||
if (count($data)>0) {
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('iid'=>$id));
|
||||
$this->mysql_model->delete('verifica_info','(iid='.$id.')');//add
|
||||
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) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['billDate'] = $data['date'] ? $data['date'] : date('Y-m-d');
|
||||
$data['billType'] = 'PAYMENT';
|
||||
$data['transType'] = 153101;
|
||||
$data['transTypeName'] = '付款';
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['hxAmount'] = $data['rpAmount'] = 0;
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
$data['accounts'] = isset($data['accounts']) ? $data['accounts'] : array();
|
||||
count($data['accounts']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
//修改的时候
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'billType'=>'PAYMENT','isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
$data['checked'] = $invoice['checked'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('FKD');
|
||||
}
|
||||
|
||||
$this->mysql_model->get_count('contact',array('id'=>$data['buId']))<1 && str_alert(-1,'请选择供应商,供应商不能为空!');
|
||||
|
||||
//数据验证
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
(float)$row['payment'] < 0 && str_alert(-1,'付款金额不能为负数!');
|
||||
$data['rpAmount'] += abs($row['payment']);
|
||||
}
|
||||
/*foreach ($data['entries'] as $arr=>$row) {
|
||||
(float)$row['nowCheck'] < 0 && str_alert(-1,'核销金额不能为负数!');
|
||||
$data['hxAmount'] += abs($row['nowCheck']);
|
||||
} */
|
||||
$data['arrears'] = -$data['rpAmount'];
|
||||
$data['postData'] = serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function account_info($iid,$data) {
|
||||
$amount = 0;
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$v[$arr]['billNo'] = $data['billNo'];
|
||||
$v[$arr]['buId'] = $data['buId'];
|
||||
$v[$arr]['billType'] = $data['billType'];
|
||||
$v[$arr]['transType'] = $data['transType'];
|
||||
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||
$v[$arr]['billDate'] = $data['billDate'];
|
||||
$v[$arr]['accId'] = $row['accId'] ;
|
||||
$v[$arr]['payment'] = -abs($row['payment']);
|
||||
$v[$arr]['wayId'] = $row['wayId'];
|
||||
$v[$arr]['settlement'] = $row['settlement'];
|
||||
$v[$arr]['remark'] = $row['remark'];
|
||||
$amount += (float)$row['payment'];
|
||||
}
|
||||
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
31
application/controllers/scm/pdImport.php
Executable file
31
application/controllers/scm/pdImport.php
Executable 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 */
|
||||
387
application/controllers/scm/receipt.php
Executable file
387
application/controllers/scm/receipt.php
Executable file
@@ -0,0 +1,387 @@
|
||||
<?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() {
|
||||
$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 = 'a.isDelete=0 and a.transType=153001';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$list = $this->data_model->get_invoice($where.' order by id desc limit '.$rows*($page-1).','.$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['payment']; //本次预收款
|
||||
$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'];
|
||||
$v[$arr]['checked'] = intval($row['checked']);
|
||||
$v[$arr]['checkName'] = $row['checkName'];
|
||||
$v[$arr]['userName'] = $row['userName'];
|
||||
}
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['page'] = $page;
|
||||
$json['data']['records'] = $this->data_model->get_invoice($where,3);
|
||||
$json['data']['total'] = ceil($json['data']['records']/$rows);
|
||||
$json['data']['rows'] = isset($v) ? $v : array();
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
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 = 'a.isDelete=0 and transType=153001';
|
||||
$where .= $matchCon ? ' and a.postData like "%'.$matchCon.'%"' : '';
|
||||
$where .= $beginDate ? ' and billDate>="'.$beginDate.'"' : '';
|
||||
$where .= $endDate ? ' and billDate<="'.$endDate.'"' : '';
|
||||
$where .= $this->common_model->get_admin_purview();
|
||||
$data['list'] = $this->data_model->get_invoice($where.' order by id desc');
|
||||
$data['account'] = array_column($this->mysql_model->get_results('account','(isDelete=0)'),'name','id');
|
||||
$data['category'] = array_column($this->mysql_model->get_results('category','(typeNumber="PayMethod")'),'name','id');
|
||||
$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 = $this->validform((array)json_decode($data, true));
|
||||
$info = elements(array(
|
||||
'billNo','billType','transType','transTypeName','postData','buId','createTime',
|
||||
'billDate','description','uid','userName','rpAmount','arrears','hxAmount','discount','payment','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$iid = $this->mysql_model->insert('invoice',$info);
|
||||
$amount = $this->account_info($iid,$data);
|
||||
//add begin
|
||||
$rpAmount = 0;
|
||||
$duplicate = array();
|
||||
if (is_array($data['entries']) && count($data['entries'])>0) {
|
||||
$v = '';
|
||||
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;
|
||||
$rpAmount += $v[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||
$duplicate[$arr] = $row['billId'];
|
||||
}
|
||||
if(count($duplicate)!= count(array_unique($duplicate))){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'存在重复的源单编号,请核实!');
|
||||
}
|
||||
if($rpAmount != $amount || $data['payment']!=0){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'收款金额总和与核销金额总和不相等,请核实!'.$amount.$rpAmount);
|
||||
}
|
||||
$this->mysql_model->insert('verifica_info',$v);
|
||||
}
|
||||
//$info['amount'] = $amount;
|
||||
//$info['rpAmount'] = $rpAmount;
|
||||
//$this->mysql_model->update(INVOICE,$info,'(id='.$iid.')');
|
||||
//add end
|
||||
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 updateReceipt(){
|
||||
$this->common_model->checkpurview(126);
|
||||
$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','uid','userName',
|
||||
'description','postData','rpAmount','arrears','hxAmount','discount','payment','modifyTime'),$data,NULL);
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',$info,array('id'=>$data['id']));
|
||||
$amount = $this->account_info($data['id'],$data);
|
||||
//add begin
|
||||
$this->mysql_model->delete('verifica_info','(iid='.$data['id'].')');
|
||||
$rpAmount = 0;
|
||||
$duplicate = array();
|
||||
if (isset($data['entries']) && count($data['entries'])>0) {
|
||||
$v = '';
|
||||
foreach ($data['entries'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $data['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'];
|
||||
$duplicate[$arr] = $row['billId'];
|
||||
}
|
||||
if(count($duplicate)!= count(array_unique($duplicate))){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'存在重复的源单编号,请核实!');
|
||||
}
|
||||
if($rpAmount != $amount || $data['payment']!=0){
|
||||
$this->db->trans_rollback();
|
||||
str_alert(-1,'收款金额总和与核销金额总和不相等,请核实!');
|
||||
}
|
||||
$this->mysql_model->insert('verifica_info',$v);
|
||||
}
|
||||
//add end
|
||||
|
||||
|
||||
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(124);
|
||||
$id = intval($this->input->get_post('id',TRUE));
|
||||
$data = $this->data_model->get_invoice('a.isDelete=0 and a.id='.$id.' and a.transType=153001',1);
|
||||
if (count($data)>0) {
|
||||
$list = $this->data_model->get_account_info('a.iid='.$id);
|
||||
foreach ($list as $arr=>$row) {
|
||||
$v[$arr]['id'] = intval($arr+1);
|
||||
$v[$arr]['payment'] = (float)$row['payment'];
|
||||
$v[$arr]['remark'] = $row['remark'];
|
||||
$v[$arr]['accName'] = $row['accountNumber'].' '.$row['accountName'];
|
||||
$v[$arr]['settlement'] = $row['settlement'];
|
||||
$v[$arr]['wayName'] = $row['categoryName'];
|
||||
$v[$arr]['wayId'] = $row['wayId'];
|
||||
$v[$arr]['accId'] = intval($row['accId']);
|
||||
}
|
||||
|
||||
$json['status'] = 200;
|
||||
$json['msg'] = 'success';
|
||||
$json['data']['id'] = $id;
|
||||
$json['data']['buId'] = intval($data['buId']);
|
||||
$json['data']['contactName'] = $data['contactName'];
|
||||
$json['data']['date'] = $data['billDate'];
|
||||
$json['data']['billNo'] = $data['billNo'];
|
||||
$json['data']['discount'] = (float)$data['discount'];
|
||||
$json['data']['payment'] = (float)$data['payment'];
|
||||
$json['data']['checkName'] = $data['checkName'];
|
||||
$json['data']['userName'] = $data['userName'];
|
||||
$json['data']['createTime'] = $data['createTime'];
|
||||
$json['data']['modifyTime'] = $data['modifyTime'];
|
||||
$json['data']['description'] = $data['description'];
|
||||
$json['data']['checked'] = intval($data['checked']);
|
||||
$json['data']['status'] = intval($data['checked'])==1 ? 'view' : 'edit';
|
||||
$json['data']['accounts'] = isset($v) ? $v : array();
|
||||
$json['data']['entries'] = array();
|
||||
//add begin
|
||||
$s = array();
|
||||
$list = $this->mysql_model->get_results('verifica_info','(iid='.$id.') order by id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$s[$arr]['billId'] = intval($row['billId']);
|
||||
$s[$arr]['billNo'] = $row['billNo'];
|
||||
$s[$arr]['billDate'] = $row['billDate'];
|
||||
$s[$arr]['transType'] = $row['transType'];
|
||||
$s[$arr]['billType'] = $row['billType'];
|
||||
$s[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||
$s[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||
$s[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||
$s[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||
$s[$arr]['type'] = 1;
|
||||
}
|
||||
$json['data']['entries'] = $s;
|
||||
//add end
|
||||
die(json_encode($json));
|
||||
}
|
||||
str_alert(-1,'参数错误');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//删除
|
||||
public function delete() {
|
||||
$this->common_model->checkpurview(127);
|
||||
$id = intval($this->input->get('id',TRUE));
|
||||
$data = $this->mysql_model->get_rows('invoice',array('id'=>$id,'transType'=>153001));
|
||||
if (count($data)>0) {
|
||||
$this->db->trans_begin();
|
||||
$this->mysql_model->update('invoice',array('isDelete'=>1),array('id'=>$id));
|
||||
$this->mysql_model->update('account_info',array('isDelete'=>1),array('iid'=>$id));
|
||||
//$this->mysql_model->update('verifica_info',array('isDelete'=>1),array('iid'=>$id));
|
||||
$this->mysql_model->delete('verifica_info','(iid='.$id.')');//add
|
||||
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) {
|
||||
$data['id'] = isset($data['id']) ? intval($data['id']) : 0;
|
||||
$data['buId'] = intval($data['buId']);
|
||||
$data['billDate'] = $data['date'] ? $data['date'] : date('Y-m-d');
|
||||
$data['billType'] = 'RECEIPT';
|
||||
$data['transType'] = 153001;
|
||||
$data['transTypeName'] = '收款';
|
||||
$data['uid'] = $this->jxcsys['uid'];
|
||||
$data['userName'] = $this->jxcsys['name'];
|
||||
$data['modifyTime'] = date('Y-m-d H:i:s');
|
||||
$data['createTime'] = $data['modifyTime'];
|
||||
$data['hxAmount'] = $data['rpAmount'] = 0;
|
||||
$data['entries'] = isset($data['entries']) ? $data['entries'] : array();
|
||||
$data['accounts'] = isset($data['accounts']) ? $data['accounts'] : array();
|
||||
count($data['accounts']) < 1 && str_alert(-1,'提交的是空数据');
|
||||
|
||||
//修改的时候
|
||||
if ($data['id']>0) {
|
||||
$invoice = $this->mysql_model->get_rows('invoice',array('id'=>$data['id'],'billType'=>'RECEIPT','isDelete'=>0));
|
||||
count($invoice)<1 && str_alert(-1,'单据不存在、或者已删除');
|
||||
$data['billNo'] = $invoice['billNo'];
|
||||
$data['checked'] = $invoice['checked'];
|
||||
} else {
|
||||
$data['billNo'] = str_no('SKD');
|
||||
}
|
||||
|
||||
$this->mysql_model->get_count('contact',array('id'=>$data['buId']))<1 && str_alert(-1,'请选择客户,客户不能为空!');
|
||||
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
(float)$row['payment'] < 0 && str_alert(-1,'收款金额不能为负数!');
|
||||
$data['rpAmount'] += abs($row['payment']);
|
||||
}
|
||||
/*foreach ($data['entries'] as $arr=>$row) {
|
||||
(float)$row['nowCheck'] < 0 && str_alert(-1,'核销金额不能为负数!');
|
||||
$data['hxAmount'] += abs($row['nowCheck']);
|
||||
} */
|
||||
|
||||
$data['arrears'] = -$data['rpAmount'];
|
||||
$data['postData'] = serialize($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function account_info($iid,$data) {
|
||||
$amount = 0;
|
||||
foreach ($data['accounts'] as $arr=>$row) {
|
||||
$v[$arr]['iid'] = $iid;
|
||||
$v[$arr]['uid'] = $data['uid'];
|
||||
$v[$arr]['billNo'] = $data['billNo'];
|
||||
$v[$arr]['buId'] = $data['buId'];
|
||||
$v[$arr]['billType'] = $data['billType'];
|
||||
$v[$arr]['transType'] = $data['transType'];
|
||||
$v[$arr]['transTypeName'] = $data['transTypeName'];
|
||||
$v[$arr]['billDate'] = $data['billDate'];
|
||||
$v[$arr]['accId'] = $row['accId'];
|
||||
$v[$arr]['payment'] = abs($row['payment']);
|
||||
$v[$arr]['wayId'] = $row['wayId'];
|
||||
$v[$arr]['settlement'] = $row['settlement'];
|
||||
$v[$arr]['remark'] = $row['remark'];
|
||||
$amount += (float)$row['payment'];
|
||||
}
|
||||
if (isset($v)) {
|
||||
if ($data['id']>0) {
|
||||
$this->mysql_model->delete('account_info',array('iid'=>$iid));
|
||||
}
|
||||
$this->mysql_model->insert('account_info',$v);
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
private function write_back_invoice($id){
|
||||
/*$s = array();
|
||||
$list = $this->mysql_model->get_results('verifica_info','(iid='.$id.') order by id desc');
|
||||
foreach ($list as $arr=>$row) {
|
||||
$s[$arr]['billId'] = intval($row['billId']);
|
||||
$s[$arr]['billNo'] = $row['billNo'];
|
||||
$s[$arr]['billDate'] = $row['billDate'];
|
||||
$s[$arr]['transType'] = $row['transType'];
|
||||
$s[$arr]['billType'] = $row['billType'];
|
||||
$s[$arr]['billPrice'] = (float)$row['billPrice'];
|
||||
$s[$arr]['hasCheck'] = (float)$row['hasCheck'];
|
||||
$s[$arr]['notCheck'] = (float)$row['notCheck'];
|
||||
$s[$arr]['nowCheck'] = (float)$row['nowCheck'];
|
||||
$s[$arr]['type'] = 1;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
25
application/controllers/service.php
Executable file
25
application/controllers/service.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR 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 */
|
||||
293
application/controllers/settings.php
Executable file
293
application/controllers/settings.php
Executable file
@@ -0,0 +1,293 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Settings extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->common_model->checkpurview();
|
||||
}
|
||||
|
||||
public function Contract() {
|
||||
$this->load->view('settings/Contract');
|
||||
}
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
//add by michen 20171118 begin
|
||||
public function cst_list() {
|
||||
$this->common_model->checkpurview(97);
|
||||
$this->load->view('settings/cst-list');
|
||||
}
|
||||
|
||||
|
||||
public function cst_manage() {
|
||||
$this->load->view('settings/cst-manage');
|
||||
}
|
||||
|
||||
public function select_customer2() {
|
||||
$this->load->view('settings/select-customer2');
|
||||
}
|
||||
//add by michen 20171118 end
|
||||
|
||||
|
||||
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 */
|
||||
37
application/controllers/storage.php
Executable file
37
application/controllers/storage.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR 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 */
|
||||
10
application/core/index.html
Executable file
10
application/core/index.html
Executable 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
Executable file
62
application/errors/error_404.php
Executable 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
Executable file
62
application/errors/error_db.php
Executable 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
Executable file
62
application/errors/error_general.php
Executable 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
Executable file
10
application/errors/error_php.php
Executable 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
Executable file
10
application/errors/index.html
Executable file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
360
application/helpers/fun_helper.php
Executable file
360
application/helpers/fun_helper.php
Executable file
@@ -0,0 +1,360 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
if (!function_exists('is_ajax')) {
|
||||
function is_ajax() {
|
||||
if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
|
||||
if(strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('sys_skin')) {
|
||||
function sys_skin() {
|
||||
$ci = &get_instance();
|
||||
return $ci->input->cookie('skin') ? $ci->input->cookie('skin') : 'green';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('skin_url')) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('token')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('alert')) {
|
||||
function alert($str,$url='') {
|
||||
$str = $str ? 'alert("'.$str.'");' : '';
|
||||
$url = $url ? 'location.href="'.$url.'";' : 'history.go(-1);';
|
||||
die('<script>'.$str.$url.'</script>');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_enhtml')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_nohtml')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_alert')) {
|
||||
function str_alert($status=200,$msg='success',$data=array()) {
|
||||
$msg = array(
|
||||
'status' => $status,
|
||||
'msg' => $msg,
|
||||
'data' => $data,
|
||||
);
|
||||
return die(json_encode($msg));//mark by michen 20171009
|
||||
//return die($msg['msg']);//add by michen 20171009
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_check')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_num2rmb')) {
|
||||
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 . "整";
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_money')) {
|
||||
function str_money($num,$f=2){
|
||||
$str = $num ? number_format($num, $f,'.',',') :'';
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_random')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_quote')) {
|
||||
function str_quote($str) {
|
||||
$str = explode(',',$str);
|
||||
foreach($str as $v) {
|
||||
$arr[] = "'$v'";
|
||||
}
|
||||
return isset($arr) ? join(',',$arr) :'';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_no')) {
|
||||
function str_no($str='') {
|
||||
return $str.date("YmdHis").rand(0,9);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_unicode_decode')) {
|
||||
function str_unicode_decode($unistr, $encoding = 'GBK', $prefix = '&#', $postfix = ';') {
|
||||
$arruni = explode($prefix, $unistr);
|
||||
$unistr = '';
|
||||
for($i = 1, $len = count($arruni); $i < $len; $i++) {
|
||||
if (strlen($postfix) > 0) {
|
||||
$arruni[$i] = substr($arruni[$i], 0, strlen($arruni[$i]) - strlen($postfix));
|
||||
}
|
||||
$temp = intval($arruni[$i]);
|
||||
$unistr .= ($temp < 256) ? chr(0) . chr($temp) : chr($temp / 256) . chr($temp % 256);
|
||||
}
|
||||
return iconv('UCS-2', $encoding, $unistr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!function_exists('str_auth')) {
|
||||
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 '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('dir_add')) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('dir_del')) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('sys_csv')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('upload')) {
|
||||
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/helpers/index.html
Executable file
10
application/helpers/index.html
Executable file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/hooks/index.html
Executable file
10
application/hooks/index.html
Executable 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
Executable file
10
application/index.html
Executable file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/language/english/index.html
Executable file
10
application/language/english/index.html
Executable file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/language/index.html
Executable file
10
application/language/index.html
Executable file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1412
application/libraries/UploadHandler.php
Executable file
1412
application/libraries/UploadHandler.php
Executable file
File diff suppressed because it is too large
Load Diff
1083
application/libraries/excel/excel.php
Executable file
1083
application/libraries/excel/excel.php
Executable file
File diff suppressed because it is too large
Load Diff
271
application/libraries/excel/excel/oleread.php
Executable file
271
application/libraries/excel/excel/oleread.php
Executable 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
1738
application/libraries/excel/excel_reader2.php
Executable file
1738
application/libraries/excel/excel_reader2.php
Executable file
File diff suppressed because it is too large
Load Diff
170
application/libraries/html2pdf/_class/exception.class.php
Executable file
170
application/libraries/html2pdf/_class/exception.class.php
Executable 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
Executable file
95
application/libraries/html2pdf/_class/locale.class.php
Executable 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);
|
||||
}
|
||||
}
|
||||
1415
application/libraries/html2pdf/_class/myPdf.class.php
Executable file
1415
application/libraries/html2pdf/_class/myPdf.class.php
Executable file
File diff suppressed because it is too large
Load Diff
1812
application/libraries/html2pdf/_class/parsingCss.class.php
Executable file
1812
application/libraries/html2pdf/_class/parsingCss.class.php
Executable file
File diff suppressed because it is too large
Load Diff
520
application/libraries/html2pdf/_class/parsingHtml.class.php
Executable file
520
application/libraries/html2pdf/_class/parsingHtml.class.php
Executable file
@@ -0,0 +1,520 @@
|
||||
<?php
|
||||
/**
|
||||
* HTML2PDF Librairy - parsingHtml class
|
||||
*
|
||||
* HTML => PDF convertor
|
||||
* distributed under the LGPL License
|
||||
*
|
||||
* @author Laurent MINGUET <webmaster@html2pdf.fr>
|
||||
* @version 4.04
|
||||
*/
|
||||
|
||||
class HTML2PDF_parsingHtml
|
||||
{
|
||||
protected $_html = ''; // HTML code to parse
|
||||
protected $_num = 0; // table number
|
||||
protected $_level = 0; // table level
|
||||
protected $_encoding = ''; // encoding
|
||||
public $code = array(); // parsed HTML codfe
|
||||
|
||||
const HTML_TAB = ' ';
|
||||
|
||||
/**
|
||||
* main constructor
|
||||
*
|
||||
* @param string encoding
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($encoding = 'UTF-8')
|
||||
{
|
||||
$this->_num = 0;
|
||||
$this->_level = array($this->_num);
|
||||
$this->_html = '';
|
||||
$this->code = array();
|
||||
$this->setEncoding($encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* change the encoding
|
||||
*
|
||||
* @param string encoding
|
||||
* @access public
|
||||
*/
|
||||
public function setEncoding($encoding)
|
||||
{
|
||||
$this->_encoding = $encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the HTML code to parse
|
||||
*
|
||||
* @param string HTML code
|
||||
* @access public
|
||||
*/
|
||||
public function setHTML($html)
|
||||
{
|
||||
// remove the HTML in comment
|
||||
$html = preg_replace('/<!--(.*)-->/isU', '', $html);
|
||||
|
||||
// save the HTML code
|
||||
$this->_html = $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse the HTML code
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
$parents = array();
|
||||
|
||||
// flag : are we in a <pre> Tag ?
|
||||
$tagPreIn = false;
|
||||
|
||||
// action to use for each line of the content of a <pre> Tag
|
||||
$tagPreBr = array(
|
||||
'name' => 'br',
|
||||
'close' => false,
|
||||
'param' => array(
|
||||
'style' => array(),
|
||||
'num' => 0
|
||||
)
|
||||
);
|
||||
|
||||
// tag that can be not closed
|
||||
$tagsNotClosed = array(
|
||||
'br', 'hr', 'img', 'col',
|
||||
'input', 'link', 'option',
|
||||
'circle', 'ellipse', 'path', 'rect', 'line', 'polygon', 'polyline'
|
||||
);
|
||||
|
||||
// search the HTML tags
|
||||
$tmp = array();
|
||||
$this->_searchCode($tmp);
|
||||
|
||||
// all the actions to do
|
||||
$actions = array();
|
||||
|
||||
// foreach part of the HTML code
|
||||
foreach ($tmp as $part) {
|
||||
// if it is a tag code
|
||||
if ($part[0]=='code') {
|
||||
// analise the HTML code
|
||||
$res = $this->_analiseCode($part[1]);
|
||||
|
||||
// if it is a real HTML tag
|
||||
if ($res) {
|
||||
// save the current posistion in the HTML code
|
||||
$res['html_pos'] = $part[2];
|
||||
|
||||
// if the tag must be closed
|
||||
if (!in_array($res['name'], $tagsNotClosed)) {
|
||||
// if it is a closure tag
|
||||
if ($res['close']) {
|
||||
// HTML validation
|
||||
if (count($parents)<1)
|
||||
throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos']));
|
||||
else if ($parents[count($parents)-1]!=$res['name'])
|
||||
throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos']));
|
||||
else
|
||||
unset($parents[count($parents)-1]);
|
||||
} else {
|
||||
// if it is a autoclosed tag
|
||||
if ($res['autoclose']) {
|
||||
// save the opened tag
|
||||
$actions[] = $res;
|
||||
|
||||
// prepare the closed tag
|
||||
$res['params'] = array();
|
||||
$res['close'] = true;
|
||||
}
|
||||
// else :add a child for validation
|
||||
else
|
||||
$parents[count($parents)] = $res['name'];
|
||||
}
|
||||
|
||||
// if it is a <pre> tag (or <code> tag) not auclosed => update the flag
|
||||
if (($res['name']=='pre' || $res['name']=='code') && !$res['autoclose']) {
|
||||
$tagPreIn = !$res['close'];
|
||||
}
|
||||
}
|
||||
|
||||
// save the actions to convert
|
||||
$actions[] = $res;
|
||||
} else { // else (it is not a real HTML tag => we transform it in Texte
|
||||
$part[0]='txt';
|
||||
}
|
||||
}
|
||||
// if it is text
|
||||
if ($part[0]=='txt') {
|
||||
// if we are not in a <pre> tag
|
||||
if (!$tagPreIn) {
|
||||
// save the action
|
||||
$actions[] = array(
|
||||
'name' => 'write',
|
||||
'close' => false,
|
||||
'param' => array('txt' => $this->_prepareTxt($part[1])),
|
||||
);
|
||||
} else { // else (if we are in a <pre> tag)
|
||||
// prepare the text
|
||||
$part[1] = str_replace("\r", '', $part[1]);
|
||||
$part[1] = explode("\n", $part[1]);
|
||||
|
||||
// foreach line of the text
|
||||
foreach ($part[1] as $k => $txt) {
|
||||
// transform the line
|
||||
$txt = str_replace("\t", self::HTML_TAB, $txt);
|
||||
$txt = str_replace(' ', ' ', $txt);
|
||||
|
||||
// add a break line
|
||||
if ($k>0) $actions[] = $tagPreBr;
|
||||
|
||||
// save the action
|
||||
$actions[] = array(
|
||||
'name' => 'write',
|
||||
'close' => false,
|
||||
'param' => array('txt' => $this->_prepareTxt($txt, false)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for each indentified action, we have to clean up the begin and the end of the texte
|
||||
// based on tags that surround it
|
||||
|
||||
// list of the tags to clean
|
||||
$tagsToClean = array(
|
||||
'page', 'page_header', 'page_footer', 'form',
|
||||
'table', 'thead', 'tfoot', 'tr', 'td', 'th', 'br',
|
||||
'div', 'hr', 'p', 'ul', 'ol', 'li',
|
||||
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'bookmark', 'fieldset', 'legend',
|
||||
'draw', 'circle', 'ellipse', 'path', 'rect', 'line', 'g', 'polygon', 'polyline',
|
||||
'option'
|
||||
);
|
||||
|
||||
// foreach action
|
||||
$nb = count($actions);
|
||||
for ($k=0; $k<$nb; $k++) {
|
||||
// if it is a Text
|
||||
if ($actions[$k]['name']=='write') {
|
||||
// if the tag before the text is a tag to clean => ltrim on the text
|
||||
if ($k>0 && in_array($actions[$k-1]['name'], $tagsToClean))
|
||||
$actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']);
|
||||
|
||||
// if the tag after the text is a tag to clean => rtrim on the text
|
||||
if ($k<$nb-1 && in_array($actions[$k+1]['name'], $tagsToClean))
|
||||
$actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']);
|
||||
|
||||
// if the text is empty => remove the action
|
||||
if (!strlen($actions[$k]['param']['txt']))
|
||||
unset($actions[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// if we are not on the level 0 => HTML validator ERROR
|
||||
if (count($parents)) throw new HTML2PDF_exception(5, $parents);
|
||||
|
||||
// save the actions to do
|
||||
$this->code = array_values($actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare the text
|
||||
*
|
||||
* @param string texte
|
||||
* @param boolean true => replace multiple space+\t+\r+\n by a single space
|
||||
* @return string texte
|
||||
* @access protected
|
||||
*/
|
||||
protected function _prepareTxt($txt, $spaces = true)
|
||||
{
|
||||
if ($spaces) $txt = preg_replace('/\s+/isu', ' ', $txt);
|
||||
$txt = str_replace('€', '€', $txt);
|
||||
$txt = html_entity_decode($txt, ENT_QUOTES, $this->_encoding);
|
||||
return $txt;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse the HTML code
|
||||
*
|
||||
* @param &array array's result
|
||||
* @return null
|
||||
*/
|
||||
protected function _searchCode(&$tmp)
|
||||
{
|
||||
// initialise the array
|
||||
$tmp = array();
|
||||
|
||||
// regexp to separate the tags from the texts
|
||||
$reg = '/(<[^>]+>)|([^<]+)+/isU';
|
||||
|
||||
// last match found
|
||||
$str = '';
|
||||
$offset = 0;
|
||||
|
||||
// As it finds a match
|
||||
while (preg_match($reg, $this->_html, $parse, PREG_OFFSET_CAPTURE, $offset)) {
|
||||
// if it is a tag
|
||||
if ($parse[1][0]) {
|
||||
// save the previous text if it exists
|
||||
if ($str!=='') $tmp[] = array('txt', $str);
|
||||
|
||||
// save the tag, with the offset
|
||||
$tmp[] = array('code', trim($parse[1][0]), $offset);
|
||||
|
||||
// init the current text
|
||||
$str = '';
|
||||
} else { // else (if it is a text)
|
||||
// add the new text to the current text
|
||||
$str.= $parse[2][0];
|
||||
}
|
||||
|
||||
// Update offset to the end of the match
|
||||
$offset = $parse[0][1] + strlen($parse[0][0]);
|
||||
unset($parse);
|
||||
}
|
||||
// if a text is present in the end, we save it
|
||||
if ($str!='') $tmp[] = array('txt', $str);
|
||||
unset($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* analise a HTML tag
|
||||
*
|
||||
* @param string HTML code to analise
|
||||
* @return array corresponding action
|
||||
*/
|
||||
protected function _analiseCode($code)
|
||||
{
|
||||
// name of the tag, opening, closure, autoclosure
|
||||
$tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)';
|
||||
if (!preg_match('/'.$tag.'/isU', $code, $match)) return null;
|
||||
$close = ($match[1]=='/' ? true : false);
|
||||
$autoclose = preg_match('/\/>$/isU', $code);
|
||||
$name = strtolower($match[2]);
|
||||
|
||||
// required parameters (depends on the tag name)
|
||||
$param = array();
|
||||
$param['style'] = '';
|
||||
if ($name=='img') {
|
||||
$param['alt'] = '';
|
||||
$param['src'] = '';
|
||||
}
|
||||
if ($name=='a') {
|
||||
$param['href'] = '';
|
||||
}
|
||||
|
||||
// read the parameters : nom=valeur
|
||||
$prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
|
||||
preg_match_all('/'.$prop.'/is', $code, $match);
|
||||
for($k=0; $k<count($match[0]); $k++)
|
||||
$param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
|
||||
|
||||
// read the parameters : nom="valeur"
|
||||
$prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
|
||||
preg_match_all('/'.$prop.'/is', $code, $match);
|
||||
for($k=0; $k<count($match[0]); $k++)
|
||||
$param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
|
||||
|
||||
// read the parameters : nom='valeur'
|
||||
$prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
|
||||
preg_match_all('/'.$prop.'/is', $code, $match);
|
||||
for($k=0; $k<count($match[0]); $k++)
|
||||
$param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]);
|
||||
|
||||
// compliance of each parameter
|
||||
$color = "#000000";
|
||||
$border = null;
|
||||
foreach ($param as $key => $val) {
|
||||
$key = strtolower($key);
|
||||
switch($key)
|
||||
{
|
||||
case 'width':
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'width: '.$val.'px; ';
|
||||
break;
|
||||
|
||||
case 'align':
|
||||
if ($name==='img') {
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'float: '.$val.'; ';
|
||||
} elseif ($name!=='table') {
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'text-align: '.$val.'; ';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'valign':
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'vertical-align: '.$val.'; ';
|
||||
break;
|
||||
|
||||
case 'height':
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'height: '.$val.'px; ';
|
||||
break;
|
||||
|
||||
case 'bgcolor':
|
||||
unset($param[$key]);
|
||||
$param['style'] .= 'background: '.$val.'; ';
|
||||
break;
|
||||
|
||||
case 'bordercolor':
|
||||
unset($param[$key]);
|
||||
$color = $val;
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
unset($param[$key]);
|
||||
if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px';
|
||||
$border = $val;
|
||||
break;
|
||||
|
||||
case 'cellpadding':
|
||||
case 'cellspacing':
|
||||
if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px';
|
||||
break;
|
||||
|
||||
case 'colspan':
|
||||
case 'rowspan':
|
||||
$val = preg_replace('/[^0-9]/isU', '', $val);
|
||||
if (!$val) $val = 1;
|
||||
$param[$key] = $val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// compliance of the border
|
||||
if ($border!==null) {
|
||||
if ($border) $border = 'border: solid '.$border.' '.$color;
|
||||
else $border = 'border: none';
|
||||
|
||||
$param['style'] .= $border.'; ';
|
||||
$param['border'] = $border;
|
||||
}
|
||||
|
||||
// reading styles: decomposition and standardization
|
||||
$styles = explode(';', $param['style']);
|
||||
$param['style'] = array();
|
||||
foreach ($styles as $style) {
|
||||
$tmp = explode(':', $style);
|
||||
if (count($tmp)>1) {
|
||||
$cod = $tmp[0];
|
||||
unset($tmp[0]);
|
||||
$tmp = implode(':', $tmp);
|
||||
$param['style'][trim(strtolower($cod))] = preg_replace('/[\s]+/isU', ' ', trim($tmp));
|
||||
}
|
||||
}
|
||||
|
||||
// determining the level of table opening, with an added level
|
||||
if (in_array($name, array('ul', 'ol', 'table')) && !$close) {
|
||||
$this->_num++;
|
||||
$this->_level[count($this->_level)] = $this->_num;
|
||||
}
|
||||
|
||||
// get the level of the table containing the element
|
||||
if (!isset($param['num'])) {
|
||||
$param['num'] = $this->_level[count($this->_level)-1];
|
||||
}
|
||||
|
||||
// for closures table: remove a level
|
||||
if (in_array($name, array('ul', 'ol', 'table')) && $close) {
|
||||
unset($this->_level[count($this->_level)-1]);
|
||||
}
|
||||
|
||||
// prepare the parameters
|
||||
if (isset($param['value'])) $param['value'] = $this->_prepareTxt($param['value']);
|
||||
if (isset($param['alt'])) $param['alt'] = $this->_prepareTxt($param['alt']);
|
||||
if (isset($param['title'])) $param['title'] = $this->_prepareTxt($param['title']);
|
||||
if (isset($param['class'])) $param['class'] = $this->_prepareTxt($param['class']);
|
||||
|
||||
// return the new action to do
|
||||
return array('name' => $name, 'close' => $close ? 1 : 0, 'autoclose' => $autoclose, 'param' => $param);
|
||||
}
|
||||
|
||||
/**
|
||||
* get a full level of HTML, between an opening and closing corresponding
|
||||
*
|
||||
* @param integer key
|
||||
* @return array actions
|
||||
*/
|
||||
public function getLevel($k)
|
||||
{
|
||||
// if the code does not exist => return empty
|
||||
if (!isset($this->code[$k])) return array();
|
||||
|
||||
// the tag to detect
|
||||
$detect = $this->code[$k]['name'];
|
||||
|
||||
// if it is a text => return
|
||||
if ($detect=='write') {
|
||||
return array($this->code[$k]);
|
||||
}
|
||||
|
||||
//
|
||||
$level = 0; // depth level
|
||||
$end = false; // end of the search
|
||||
$code = array(); // extract code
|
||||
|
||||
// while it's not ended
|
||||
while (!$end) {
|
||||
// current action
|
||||
$row = $this->code[$k];
|
||||
|
||||
// if 'write' => we add the text
|
||||
if ($row['name']=='write') {
|
||||
$code[] = $row;
|
||||
} else { // else, it is a html tag
|
||||
$not = false; // flag for not taking into account the current tag
|
||||
|
||||
// if it is the searched tag
|
||||
if ($row['name']==$detect) {
|
||||
// if we are just at the root level => dont take it
|
||||
if ($level==0) {
|
||||
$not = true;
|
||||
}
|
||||
|
||||
// update the level
|
||||
$level+= ($row['close'] ? -1 : 1);
|
||||
|
||||
// if we are now at the root level => it is the end, and dont take it
|
||||
if ($level==0) {
|
||||
$not = true;
|
||||
$end = true;
|
||||
}
|
||||
}
|
||||
|
||||
// if we can takin into account the current tag => save it
|
||||
if (!$not) {
|
||||
if (isset($row['style']['text-align'])) unset($row['style']['text-align']);
|
||||
$code[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// it continues as long as there has code to analise
|
||||
if (isset($this->code[$k+1]))
|
||||
$k++;
|
||||
else
|
||||
$end = true;
|
||||
}
|
||||
|
||||
// return the extract
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* return a part of the HTML code, for error message
|
||||
*
|
||||
* @param integer position
|
||||
* @param integer take before
|
||||
* @param integer take after
|
||||
* @return string part of the html code
|
||||
*/
|
||||
public function getHtmlErrorCode($pos, $before=30, $after=40)
|
||||
{
|
||||
return substr($this->_html, $pos-$before, $before+$after);
|
||||
}
|
||||
}
|
||||
247
application/libraries/html2pdf/_class/tcpdfConfig.php
Executable file
247
application/libraries/html2pdf/_class/tcpdfConfig.php
Executable file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_config.php
|
||||
// Begin : 2004-06-11
|
||||
// Last Update : 2009-09-30
|
||||
//
|
||||
// Description : Configuration file for TCPDF.
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com s.r.l.
|
||||
// Via Della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* Configuration file for TCPDF.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2008 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com)
|
||||
* Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 4.0.014
|
||||
* @link http://tcpdf.sourceforge.net
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2004-10-27
|
||||
*/
|
||||
|
||||
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored.
|
||||
|
||||
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
|
||||
|
||||
define('K_TCPDF_EXTERNAL_CONFIG', true);
|
||||
|
||||
// DOCUMENT_ROOT fix for IIS Webserver
|
||||
if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
|
||||
if (isset($_SERVER['SCRIPT_FILENAME'])) {
|
||||
$_SERVER['DOCUMENT_ROOT'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))
|
||||
);
|
||||
} elseif (isset($_SERVER['PATH_TRANSLATED'])) {
|
||||
$_SERVER['DOCUMENT_ROOT'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))
|
||||
);
|
||||
} else {
|
||||
// define here your DOCUMENT_ROOT path if the previous fails
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/var/www';
|
||||
}
|
||||
}
|
||||
|
||||
// Automatic calculation for the following K_PATH_MAIN constant
|
||||
$kPathMain = str_replace('\\', '/', dirname(__FILE__));
|
||||
$kPathMain = dirname($kPathMain).'/'; // remove the current directory
|
||||
$kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/';
|
||||
define('K_PATH_MAIN', $kPathMain);
|
||||
|
||||
// Automatic calculation for the following K_PATH_URL constant
|
||||
if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
|
||||
if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') {
|
||||
$kPathUrl = 'https://';
|
||||
} else {
|
||||
$kPathUrl = 'http://';
|
||||
}
|
||||
$kPathUrl .= $_SERVER['HTTP_HOST'];
|
||||
$kPathUrl .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
|
||||
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
|
||||
*/
|
||||
define('K_PATH_URL', $kPathUrl);
|
||||
|
||||
/**
|
||||
* path for PDF fonts
|
||||
* use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
|
||||
*/
|
||||
define('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
|
||||
|
||||
/**
|
||||
* cache directory for temporary files (full path)
|
||||
*/
|
||||
define('K_PATH_CACHE', K_PATH_MAIN.'cache/');
|
||||
|
||||
/**
|
||||
* cache directory for temporary files (url path)
|
||||
*/
|
||||
define('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
|
||||
|
||||
/**
|
||||
*images directory
|
||||
*/
|
||||
define('K_PATH_IMAGES', K_PATH_MAIN.'images/');
|
||||
|
||||
/**
|
||||
* blank image
|
||||
*/
|
||||
define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
|
||||
|
||||
/**
|
||||
* page format
|
||||
*/
|
||||
define('PDF_PAGE_FORMAT', 'A4');
|
||||
|
||||
/**
|
||||
* page orientation (P=portrait, L=landscape)
|
||||
*/
|
||||
define('PDF_PAGE_ORIENTATION', 'P');
|
||||
|
||||
/**
|
||||
* document creator
|
||||
*/
|
||||
define('PDF_CREATOR', 'HTML2PDF - TCPDF');
|
||||
|
||||
/**
|
||||
* document author
|
||||
*/
|
||||
define('PDF_AUTHOR', 'HTML2PDF - TCPDF');
|
||||
|
||||
/**
|
||||
* header title
|
||||
*/
|
||||
define('PDF_HEADER_TITLE', null);
|
||||
|
||||
/**
|
||||
* header description string
|
||||
*/
|
||||
define('PDF_HEADER_STRING', null);
|
||||
|
||||
/**
|
||||
* image logo
|
||||
*/
|
||||
define('PDF_HEADER_LOGO', null);
|
||||
|
||||
/**
|
||||
* header logo image width [mm]
|
||||
*/
|
||||
define('PDF_HEADER_LOGO_WIDTH', null);
|
||||
|
||||
/**
|
||||
* document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
|
||||
*/
|
||||
define('PDF_UNIT', 'mm');
|
||||
|
||||
/**
|
||||
* header margin
|
||||
*/
|
||||
define('PDF_MARGIN_HEADER', 0);
|
||||
|
||||
/**
|
||||
* footer margin
|
||||
*/
|
||||
define('PDF_MARGIN_FOOTER', 0);
|
||||
|
||||
/**
|
||||
* top margin
|
||||
*/
|
||||
define('PDF_MARGIN_TOP', 0);
|
||||
|
||||
/**
|
||||
* bottom margin
|
||||
*/
|
||||
define('PDF_MARGIN_BOTTOM', 0);
|
||||
|
||||
/**
|
||||
* left margin
|
||||
*/
|
||||
define('PDF_MARGIN_LEFT', 0);
|
||||
|
||||
/**
|
||||
* right margin
|
||||
*/
|
||||
define('PDF_MARGIN_RIGHT', 0);
|
||||
|
||||
/**
|
||||
* default main font name
|
||||
*/
|
||||
define('PDF_FONT_NAME_MAIN', 'helvetica');
|
||||
|
||||
/**
|
||||
* default main font size
|
||||
*/
|
||||
define('PDF_FONT_SIZE_MAIN', 10);
|
||||
|
||||
/**
|
||||
* default data font name
|
||||
*/
|
||||
define('PDF_FONT_NAME_DATA', 'helvetica');
|
||||
|
||||
/**
|
||||
* default data font size
|
||||
*/
|
||||
define('PDF_FONT_SIZE_DATA', 8);
|
||||
|
||||
/**
|
||||
* default monospaced font name
|
||||
*/
|
||||
define('PDF_FONT_MONOSPACED', 'courier');
|
||||
|
||||
/**
|
||||
* ratio used to adjust the conversion of pixels to user units
|
||||
*/
|
||||
define('PDF_IMAGE_SCALE_RATIO', 1);
|
||||
|
||||
/**
|
||||
* magnification factor for titles
|
||||
*/
|
||||
define('HEAD_MAGNIFICATION', 1);
|
||||
|
||||
/**
|
||||
* height of cell repect font height
|
||||
*/
|
||||
define('K_CELL_HEIGHT_RATIO', 1);
|
||||
|
||||
/**
|
||||
* title magnification respect main font size
|
||||
*/
|
||||
define('K_TITLE_MAGNIFICATION', 1);
|
||||
|
||||
/**
|
||||
* reduction factor for small font
|
||||
*/
|
||||
define('K_SMALL_RATIO', 2/3);
|
||||
|
||||
/**
|
||||
* set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language
|
||||
*/
|
||||
define('K_THAI_TOPCHARS', true);
|
||||
|
||||
/**
|
||||
* if true allows to call TCPDF methods using HTML syntax
|
||||
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
|
||||
*/
|
||||
define('K_TCPDF_CALLS_IN_HTML', false);
|
||||
}
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
251
application/libraries/html2pdf/_class/tcpdfConfig1.php
Executable file
251
application/libraries/html2pdf/_class/tcpdfConfig1.php
Executable file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_config.php
|
||||
// Begin : 2004-06-11
|
||||
// Last Update : 2009-09-30
|
||||
//
|
||||
// Description : Configuration file for TCPDF.
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com s.r.l.
|
||||
// Via Della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* Configuration file for TCPDF.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2008 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com)
|
||||
* Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 4.0.014
|
||||
* @link http://tcpdf.sourceforge.net
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2004-10-27
|
||||
*/
|
||||
|
||||
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored.
|
||||
|
||||
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
|
||||
|
||||
define('K_TCPDF_EXTERNAL_CONFIG', true);
|
||||
|
||||
// DOCUMENT_ROOT fix for IIS Webserver
|
||||
if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
|
||||
if (isset($_SERVER['SCRIPT_FILENAME'])) {
|
||||
$_SERVER['DOCUMENT_ROOT'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))
|
||||
);
|
||||
} elseif (isset($_SERVER['PATH_TRANSLATED'])) {
|
||||
$_SERVER['DOCUMENT_ROOT'] = str_replace(
|
||||
'\\',
|
||||
'/',
|
||||
substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))
|
||||
);
|
||||
} else {
|
||||
// define here your DOCUMENT_ROOT path if the previous fails
|
||||
$_SERVER['DOCUMENT_ROOT'] = '/var/www';
|
||||
}
|
||||
}
|
||||
|
||||
// be sure that the end slash is present
|
||||
$_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/');
|
||||
|
||||
// Automatic calculation for the following K_PATH_MAIN constant
|
||||
$kPathMain = str_replace('\\', '/', dirname(__FILE__));
|
||||
$kPathMain = dirname($kPathMain).'/'; // remove the current directory
|
||||
$kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/';
|
||||
define('K_PATH_MAIN', $kPathMain);
|
||||
|
||||
// Automatic calculation for the following K_PATH_URL constant
|
||||
$kPathUrl = $kPathMain; // default value for console mode
|
||||
if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
|
||||
if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') {
|
||||
$kPathUrl = 'https://';
|
||||
} else {
|
||||
$kPathUrl = 'http://';
|
||||
}
|
||||
$kPathUrl .= $_SERVER['HTTP_HOST'];
|
||||
$kPathUrl .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
|
||||
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
|
||||
*/
|
||||
define('K_PATH_URL', $kPathUrl);
|
||||
|
||||
/**
|
||||
* path for PDF fonts
|
||||
* use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
|
||||
*/
|
||||
define('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
|
||||
|
||||
/**
|
||||
* cache directory for temporary files (full path)
|
||||
*/
|
||||
define('K_PATH_CACHE', K_PATH_MAIN.'cache/');
|
||||
|
||||
/**
|
||||
* cache directory for temporary files (url path)
|
||||
*/
|
||||
define('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
|
||||
|
||||
/**
|
||||
*images directory
|
||||
*/
|
||||
define('K_PATH_IMAGES', K_PATH_MAIN.'images/');
|
||||
|
||||
/**
|
||||
* blank image
|
||||
*/
|
||||
define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
|
||||
|
||||
/**
|
||||
* page format
|
||||
*/
|
||||
define('PDF_PAGE_FORMAT', 'A4');
|
||||
|
||||
/**
|
||||
* page orientation (P=portrait, L=landscape)
|
||||
*/
|
||||
define('PDF_PAGE_ORIENTATION', 'P');
|
||||
|
||||
/**
|
||||
* document creator
|
||||
*/
|
||||
define('PDF_CREATOR', 'HTML2PDF - TCPDF');
|
||||
|
||||
/**
|
||||
* document author
|
||||
*/
|
||||
define('PDF_AUTHOR', 'HTML2PDF - TCPDF');
|
||||
|
||||
/**
|
||||
* header title
|
||||
*/
|
||||
define('PDF_HEADER_TITLE', null);
|
||||
|
||||
/**
|
||||
* header description string
|
||||
*/
|
||||
define('PDF_HEADER_STRING', null);
|
||||
|
||||
/**
|
||||
* image logo
|
||||
*/
|
||||
define('PDF_HEADER_LOGO', null);
|
||||
|
||||
/**
|
||||
* header logo image width [mm]
|
||||
*/
|
||||
define('PDF_HEADER_LOGO_WIDTH', null);
|
||||
|
||||
/**
|
||||
* document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
|
||||
*/
|
||||
define('PDF_UNIT', 'mm');
|
||||
|
||||
/**
|
||||
* header margin
|
||||
*/
|
||||
define('PDF_MARGIN_HEADER', 0);
|
||||
|
||||
/**
|
||||
* footer margin
|
||||
*/
|
||||
define('PDF_MARGIN_FOOTER', 0);
|
||||
|
||||
/**
|
||||
* top margin
|
||||
*/
|
||||
define('PDF_MARGIN_TOP', 0);
|
||||
|
||||
/**
|
||||
* bottom margin
|
||||
*/
|
||||
define('PDF_MARGIN_BOTTOM', 0);
|
||||
|
||||
/**
|
||||
* left margin
|
||||
*/
|
||||
define('PDF_MARGIN_LEFT', 0);
|
||||
|
||||
/**
|
||||
* right margin
|
||||
*/
|
||||
define('PDF_MARGIN_RIGHT', 0);
|
||||
|
||||
/**
|
||||
* default main font name
|
||||
*/
|
||||
define('PDF_FONT_NAME_MAIN', 'helvetica');
|
||||
|
||||
/**
|
||||
* default main font size
|
||||
*/
|
||||
define('PDF_FONT_SIZE_MAIN', 10);
|
||||
|
||||
/**
|
||||
* default data font name
|
||||
*/
|
||||
define('PDF_FONT_NAME_DATA', 'helvetica');
|
||||
|
||||
/**
|
||||
* default data font size
|
||||
*/
|
||||
define('PDF_FONT_SIZE_DATA', 8);
|
||||
|
||||
/**
|
||||
* default monospaced font name
|
||||
*/
|
||||
define('PDF_FONT_MONOSPACED', 'courier');
|
||||
|
||||
/**
|
||||
* ratio used to adjust the conversion of pixels to user units
|
||||
*/
|
||||
define('PDF_IMAGE_SCALE_RATIO', 1);
|
||||
|
||||
/**
|
||||
* magnification factor for titles
|
||||
*/
|
||||
define('HEAD_MAGNIFICATION', 1);
|
||||
|
||||
/**
|
||||
* height of cell respect font height
|
||||
*/
|
||||
define('K_CELL_HEIGHT_RATIO', 1);
|
||||
|
||||
/**
|
||||
* title magnification respect main font size
|
||||
*/
|
||||
define('K_TITLE_MAGNIFICATION', 1);
|
||||
|
||||
/**
|
||||
* reduction factor for small font
|
||||
*/
|
||||
define('K_SMALL_RATIO', 2/3);
|
||||
|
||||
/**
|
||||
* set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language
|
||||
*/
|
||||
define('K_THAI_TOPCHARS', true);
|
||||
|
||||
/**
|
||||
* if true allows to call TCPDF methods using HTML syntax
|
||||
* IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
|
||||
*/
|
||||
define('K_TCPDF_CALLS_IN_HTML', false);
|
||||
}
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
155
application/libraries/html2pdf/_tcpdf_5.0.002/2dbarcodes.php
Executable file
155
application/libraries/html2pdf/_tcpdf_5.0.002/2dbarcodes.php
Executable file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : 2dbarcodes.php
|
||||
// Begin : 2009-04-07
|
||||
// Last Update : 2010-04-30
|
||||
// Version : 1.0.003
|
||||
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Description : PHP class to creates array representations for
|
||||
// 2D barcodes to be used with TCPDF.
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com S.r.l.
|
||||
// Via della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* PHP class to creates array representations for 2D barcodes to be used with TCPDF.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract Functions for generating string representation of 2D barcodes.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2008-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @link http://www.tcpdf.org
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @version 1.0.003
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
|
||||
* @name TCPDFBarcode
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 1.0.003
|
||||
* @author Nicola Asuni
|
||||
* @link http://www.tcpdf.org
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
*/
|
||||
class TCPDF2DBarcode {
|
||||
|
||||
/**
|
||||
* @var array representation of barcode.
|
||||
* @access protected
|
||||
*/
|
||||
protected $barcode_array = false;
|
||||
|
||||
/**
|
||||
* This is the class constructor.
|
||||
* Return an array representations for 2D barcodes:<ul>
|
||||
* <li>$arrcode['code'] code to be printed on text label</li>
|
||||
* <li>$arrcode['num_rows'] required number of rows</li>
|
||||
* <li>$arrcode['num_cols'] required number of columns</li>
|
||||
* <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul>
|
||||
* @param string $code code to print
|
||||
* @param string $type type of barcode: <ul>li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>QRCODE : QR-CODE Low error correction</li><li>QRCODE,L : QR-CODE Low error correction</li><li>QRCODE,M : QR-CODE Medium error correction</li><li>QRCODE,Q : QR-CODE Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li></ul>
|
||||
*/
|
||||
public function __construct($code, $type) {
|
||||
$this->setBarcode($code, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array representations of barcode.
|
||||
* @return array
|
||||
*/
|
||||
public function getBarcodeArray() {
|
||||
return $this->barcode_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the barcode.
|
||||
* @param string $code code to print
|
||||
* @param string $type type of barcode: <ul><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>QRCODE : QR-CODE Low error correction</li><li>QRCODE,L : QR-CODE Low error correction</li><li>QRCODE,M : QR-CODE Medium error correction</li><li>QRCODE,Q : QR-CODE Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li></ul>
|
||||
* @return array
|
||||
*/
|
||||
public function setBarcode($code, $type) {
|
||||
$mode = explode(',', $type);
|
||||
$qrtype = strtoupper($mode[0]);
|
||||
switch ($qrtype) {
|
||||
case 'QRCODE': { // QR-CODE
|
||||
require_once(dirname(__FILE__).'/qrcode.php');
|
||||
if (!isset($mode[1]) OR (!in_array($mode[1],array('L','M','Q','H')))) {
|
||||
$mode[1] = 'L'; // Ddefault: Low error correction
|
||||
}
|
||||
$qrcode = new QRcode($code, strtoupper($mode[1]));
|
||||
$this->barcode_array = $qrcode->getBarcodeArray();
|
||||
break;
|
||||
}
|
||||
case 'RAW':
|
||||
case 'RAW2': { // RAW MODE
|
||||
// remove spaces
|
||||
$code = preg_replace('/[\s]*/si', '', $code);
|
||||
if (strlen($code) < 3) {
|
||||
break;
|
||||
}
|
||||
if ($qrtype == 'RAW') {
|
||||
// comma-separated rows
|
||||
$rows = explode(',', $code);
|
||||
} else {
|
||||
// rows enclosed in square parethesis
|
||||
$code = substr($code, 1, -1);
|
||||
$rows = explode('][', $code);
|
||||
}
|
||||
$this->barcode_array['num_rows'] = count($rows);
|
||||
$this->barcode_array['num_cols'] = strlen($rows[0]);
|
||||
$this->barcode_array['bcode'] = array();
|
||||
foreach ($rows as $r) {
|
||||
$this->barcode_array['bcode'][] = str_split($r, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'TEST': { // TEST MODE
|
||||
$this->barcode_array['num_rows'] = 5;
|
||||
$this->barcode_array['num_cols'] = 15;
|
||||
$this->barcode_array['bcode'] = array(
|
||||
array(1,1,1,0,1,1,1,0,1,1,1,0,1,1,1),
|
||||
array(0,1,0,0,1,0,0,0,1,0,0,0,0,1,0),
|
||||
array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0),
|
||||
array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0),
|
||||
array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
$this->barcode_array = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of class
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
?>
|
||||
1384
application/libraries/html2pdf/_tcpdf_5.0.002/CHANGELOG.TXT
Executable file
1384
application/libraries/html2pdf/_tcpdf_5.0.002/CHANGELOG.TXT
Executable file
File diff suppressed because it is too large
Load Diff
504
application/libraries/html2pdf/_tcpdf_5.0.002/LICENSE.TXT
Executable file
504
application/libraries/html2pdf/_tcpdf_5.0.002/LICENSE.TXT
Executable file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
84
application/libraries/html2pdf/_tcpdf_5.0.002/README.TXT
Executable file
84
application/libraries/html2pdf/_tcpdf_5.0.002/README.TXT
Executable file
@@ -0,0 +1,84 @@
|
||||
TCPDF - README
|
||||
============================================================
|
||||
|
||||
IF YOU'D LIKE TO SUPPORT TCPDF, PLEASE CONSIDER MAKING A
|
||||
DONATION:
|
||||
http://sourceforge.net/donate/index.php?group_id=128076
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Name: TCPDF
|
||||
Version: 5.0.002
|
||||
Release date: 2010-05-06
|
||||
Author: Nicola Asuni
|
||||
|
||||
Copyright (c) 2001-2010:
|
||||
Nicola Asuni
|
||||
Tecnick.com s.r.l.
|
||||
Via Della Pace, 11
|
||||
09044 Quartucciu (CA)
|
||||
ITALY
|
||||
www.tecnick.com
|
||||
|
||||
URLs:
|
||||
http://www.tcpdf.org
|
||||
http://www.sourceforge.net/projects/tcpdf
|
||||
|
||||
Description:
|
||||
TCPDF is a PHP class for generating PDF files on-the-fly without requiring external extensions.
|
||||
TCPDF has been originally derived from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).
|
||||
|
||||
Main Features:
|
||||
// * no external libraries are required for the basic functions;
|
||||
// * all ISO page formats, custom page formats, custom margins and units of measure;
|
||||
// * UTF-8 Unicode and Right-To-Left languages;
|
||||
// * TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
|
||||
// * methods to publish some XHTML code, Javascript and Forms;
|
||||
// * images, graphic (geometric figures) and transformation methods;
|
||||
// * supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/www/formats.html)
|
||||
// * 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, QR-Code;
|
||||
// * Grayscale, RGB, CMYK, Spot Colors and Transparencies;
|
||||
// * automatic page header and footer management;
|
||||
// * document encryption and digital signature certifications;
|
||||
// * transactions to UNDO commands;
|
||||
// * PDF annotations, including links, text and file attachments;
|
||||
// * text rendering modes (fill, stroke and clipping);
|
||||
// * multiple columns mode;
|
||||
// * bookmarks and table of content;
|
||||
// * text hyphenation;
|
||||
// * automatic page break, line break and text alignments including justification;
|
||||
// * automatic page numbering and page groups;
|
||||
// * move and delete pages;
|
||||
// * page compression (requires php-zlib extension);
|
||||
|
||||
|
||||
Installation (full instructions on http://www.tcpdf.org):
|
||||
1. copy the folder on your Web server
|
||||
2. set your installation path and other parameters on the config/tcpdf_config.php
|
||||
3. call the examples/example_001.php page with your browser to see an example
|
||||
|
||||
Source Code Documentation:
|
||||
doc/index.html
|
||||
|
||||
For Additional Documentation:
|
||||
http://www.tcpdf.org
|
||||
|
||||
License
|
||||
Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
See LICENSE.TXT file for more information.
|
||||
|
||||
============================================================
|
||||
1978
application/libraries/html2pdf/_tcpdf_5.0.002/barcodes.php
Executable file
1978
application/libraries/html2pdf/_tcpdf_5.0.002/barcodes.php
Executable file
File diff suppressed because it is too large
Load Diff
10
application/libraries/html2pdf/_tcpdf_5.0.002/cache/chapter_demo_1.txt
vendored
Executable file
10
application/libraries/html2pdf/_tcpdf_5.0.002/cache/chapter_demo_1.txt
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
The year 1866 was marked by a bizarre development, an unexplained and downright inexplicable phenomenon that surely no one has forgotten. Without getting into those rumors that upset civilians in the seaports and deranged the public mind even far inland, it must be said that professional seamen were especially alarmed. Traders, shipowners, captains of vessels, skippers, and master mariners from Europe and America, naval officers from every country, and at their heels the various national governments on these two continents, were all extremely disturbed by the business.
|
||||
In essence, over a period of time several ships had encountered "an enormous thing" at sea, a long spindle-shaped object, sometimes giving off a phosphorescent glow, infinitely bigger and faster than any whale.
|
||||
The relevant data on this apparition, as recorded in various logbooks, agreed pretty closely as to the structure of the object or creature in question, its unprecedented speed of movement, its startling locomotive power, and the unique vitality with which it seemed to be gifted. If it was a cetacean, it exceeded in bulk any whale previously classified by science. No naturalist, neither Cuvier nor Lacépède, neither Professor Dumeril nor Professor de Quatrefages, would have accepted the existence of such a monster sight unseen -- specifically, unseen by their own scientific eyes.
|
||||
Striking an average of observations taken at different times -- rejecting those timid estimates that gave the object a length of 200 feet, and ignoring those exaggerated views that saw it as a mile wide and three long--you could still assert that this phenomenal creature greatly exceeded the dimensions of anything then known to ichthyologists, if it existed at all.
|
||||
Now then, it did exist, this was an undeniable fact; and since the human mind dotes on objects of wonder, you can understand the worldwide excitement caused by this unearthly apparition. As for relegating it to the realm of fiction, that charge had to be dropped.
|
||||
In essence, on July 20, 1866, the steamer Governor Higginson, from the Calcutta & Burnach Steam Navigation Co., encountered this moving mass five miles off the eastern shores of Australia. Captain Baker at first thought he was in the presence of an unknown reef; he was even about to fix its exact position when two waterspouts shot out of this inexplicable object and sprang hissing into the air some 150 feet. So, unless this reef was subject to the intermittent eruptions of a geyser, the Governor Higginson had fair and honest dealings with some aquatic mammal, until then unknown, that could spurt from its blowholes waterspouts mixed with air and steam.
|
||||
Similar events were likewise observed in Pacific seas, on July 23 of the same year, by the Christopher Columbus from the West India & Pacific Steam Navigation Co. Consequently, this extraordinary cetacean could transfer itself from one locality to another with startling swiftness, since within an interval of just three days, the Governor Higginson and the Christopher Columbus had observed it at two positions on the charts separated by a distance of more than 700 nautical leagues.
|
||||
Fifteen days later and 2,000 leagues farther, the Helvetia from the Compagnie Nationale and the Shannon from the Royal Mail line, running on opposite tacks in that part of the Atlantic lying between the United States and Europe, respectively signaled each other that the monster had been sighted in latitude 42 degrees 15' north and longitude 60 degrees 35' west of the meridian of Greenwich. From their simultaneous observations, they were able to estimate the mammal's minimum length at more than 350 English feet; this was because both the Shannon and the Helvetia were of smaller dimensions, although each measured 100 meters stem to stern. Now then, the biggest whales, those rorqual whales that frequent the waterways of the Aleutian Islands, have never exceeded a length of 56 meters--if they reach even that.
|
||||
One after another, reports arrived that would profoundly affect public opinion: new observations taken by the transatlantic liner Pereire, the Inman line's Etna running afoul of the monster, an official report drawn up by officers on the French frigate Normandy, dead-earnest reckonings obtained by the general staff of Commodore Fitz-James aboard the Lord Clyde. In lighthearted countries, people joked about this phenomenon, but such serious, practical countries as England, America, and Germany were deeply concerned.
|
||||
In every big city the monster was the latest rage; they sang about it in the coffee houses, they ridiculed it in the newspapers, they dramatized it in the theaters. The tabloids found it a fine opportunity for hatching all sorts of hoaxes. In those newspapers short of copy, you saw the reappearance of every gigantic imaginary creature, from "Moby Dick," that dreadful white whale from the High Arctic regions, to the stupendous kraken whose tentacles could entwine a 500-ton craft and drag it into the ocean depths. They even reprinted reports from ancient times: the views of Aristotle and Pliny accepting the existence of such monsters, then the Norwegian stories of Bishop Pontoppidan, the narratives of Paul Egede, and finally the reports of Captain Harrington -- whose good faith is above suspicion--in which he claims he saw, while aboard the Castilian in 1857, one of those enormous serpents that, until then, had frequented only the seas of France's old extremist newspaper, The Constitutionalist.
|
||||
23
application/libraries/html2pdf/_tcpdf_5.0.002/cache/chapter_demo_2.txt
vendored
Executable file
23
application/libraries/html2pdf/_tcpdf_5.0.002/cache/chapter_demo_2.txt
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
During the period in which these developments were occurring, I had returned from a scientific undertaking organized to explore the Nebraska badlands in the United States. In my capacity as Assistant Professor at the Paris Museum of Natural History, I had been attached to this expedition by the French government. After spending six months in Nebraska, I arrived in New York laden with valuable collections near the end of March. My departure for France was set for early May. In the meantime, then, I was busy classifying my mineralogical, botanical, and zoological treasures when that incident took place with the Scotia.
|
||||
I was perfectly abreast of this question, which was the big news of the day, and how could I not have been? I had read and reread every American and European newspaper without being any farther along. This mystery puzzled me. Finding it impossible to form any views, I drifted from one extreme to the other. Something was out there, that much was certain, and any doubting Thomas was invited to place his finger on the Scotia's wound.
|
||||
When I arrived in New York, the question was at the boiling point. The hypothesis of a drifting islet or an elusive reef, put forward by people not quite in their right minds, was completely eliminated. And indeed, unless this reef had an engine in its belly, how could it move about with such prodigious speed?
|
||||
Also discredited was the idea of a floating hull or some other enormous wreckage, and again because of this speed of movement.
|
||||
So only two possible solutions to the question were left, creating two very distinct groups of supporters: on one side, those favoring a monster of colossal strength; on the other, those favoring an "underwater boat" of tremendous motor power.
|
||||
Now then, although the latter hypothesis was completely admissible, it couldn't stand up to inquiries conducted in both the New World and the Old. That a private individual had such a mechanism at his disposal was less than probable. Where and when had he built it, and how could he have built it in secret?
|
||||
Only some government could own such an engine of destruction, and in these disaster-filled times, when men tax their ingenuity to build increasingly powerful aggressive weapons, it was possible that, unknown to the rest of the world, some nation could have been testing such a fearsome machine. The Chassepot rifle led to the torpedo, and the torpedo has led to this underwater battering ram, which in turn will lead to the world putting its foot down. At least I hope it will.
|
||||
But this hypothesis of a war machine collapsed in the face of formal denials from the various governments. Since the public interest was at stake and transoceanic travel was suffering, the sincerity of these governments could not be doubted. Besides, how could the assembly of this underwater boat have escaped public notice? Keeping a secret under such circumstances would be difficult enough for an individual, and certainly impossible for a nation whose every move is under constant surveillance by rival powers.
|
||||
So, after inquiries conducted in England, France, Russia, Prussia, Spain, Italy, America, and even Turkey, the hypothesis of an underwater Monitor was ultimately rejected.
|
||||
After I arrived in New York, several people did me the honor of consulting me on the phenomenon in question. In France I had published a two-volume work, in quarto, entitled The Mysteries of the Great Ocean Depths. Well received in scholarly circles, this book had established me as a specialist in this pretty obscure field of natural history. My views were in demand. As long as I could deny the reality of the business, I confined myself to a flat "no comment." But soon, pinned to the wall, I had to explain myself straight out. And in this vein, "the honorable Pierre Aronnax, Professor at the Paris Museum," was summoned by The New York Herald to formulate his views no matter what.
|
||||
I complied. Since I could no longer hold my tongue, I let it wag. I discussed the question in its every aspect, both political and scientific, and this is an excerpt from the well-padded article I published in the issue of April 30.
|
||||
|
||||
"Therefore," I wrote, "after examining these different hypotheses one by one, we are forced, every other supposition having been refuted, to accept the existence of an extremely powerful marine animal.
|
||||
"The deepest parts of the ocean are totally unknown to us. No soundings have been able to reach them. What goes on in those distant depths? What creatures inhabit, or could inhabit, those regions twelve or fifteen miles beneath the surface of the water? What is the constitution of these animals? It's almost beyond conjecture.
|
||||
"However, the solution to this problem submitted to me can take the form of a choice between two alternatives.
|
||||
"Either we know every variety of creature populating our planet, or we do not.
|
||||
"If we do not know every one of them, if nature still keeps ichthyological secrets from us, nothing is more admissible than to accept the existence of fish or cetaceans of new species or even new genera, animals with a basically 'cast-iron' constitution that inhabit strata beyond the reach of our soundings, and which some development or other, an urge or a whim if you prefer, can bring to the upper level of the ocean for long intervals.
|
||||
"If, on the other hand, we do know every living species, we must look for the animal in question among those marine creatures already cataloged, and in this event I would be inclined to accept the existence of a giant narwhale.
|
||||
"The common narwhale, or sea unicorn, often reaches a length of sixty feet. Increase its dimensions fivefold or even tenfold, then give this cetacean a strength in proportion to its size while enlarging its offensive weapons, and you have the animal we're looking for. It would have the proportions determined by the officers of the Shannon, the instrument needed to perforate the Scotia, and the power to pierce a steamer's hull.
|
||||
"In essence, the narwhale is armed with a sort of ivory sword, or lance, as certain naturalists have expressed it. It's a king-sized tooth as hard as steel. Some of these teeth have been found buried in the bodies of baleen whales, which the narwhale attacks with invariable success. Others have been wrenched, not without difficulty, from the undersides of vessels that narwhales have pierced clean through, as a gimlet pierces a wine barrel. The museum at the Faculty of Medicine in Paris owns one of these tusks with a length of 2.25 meters and a width at its base of forty-eight centimeters!
|
||||
"All right then! Imagine this weapon to be ten times stronger and the animal ten times more powerful, launch it at a speed of twenty miles per hour, multiply its mass times its velocity, and you get just the collision we need to cause the specified catastrophe.
|
||||
"So, until information becomes more abundant, I plump for a sea unicorn of colossal dimensions, no longer armed with a mere lance but with an actual spur, like ironclad frigates or those warships called 'rams,' whose mass and motor power it would possess simultaneously.
|
||||
"This inexplicable phenomenon is thus explained away unless it's something else entirely, which, despite everything that has been sighted, studied, explored and experienced, is still possible!"
|
||||
15
application/libraries/html2pdf/_tcpdf_5.0.002/cache/table_data_demo.txt
vendored
Executable file
15
application/libraries/html2pdf/_tcpdf_5.0.002/cache/table_data_demo.txt
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
Austria;Vienna;83859;8075
|
||||
Belgium;Brussels;30518;10192
|
||||
Denmark;Copenhagen;43094;5295
|
||||
Finland;Helsinki;304529;5147
|
||||
France;Paris;543965;58728
|
||||
Germany;Berlin;357022;82057
|
||||
Greece;Athens;131625;10511
|
||||
Ireland;Dublin;70723;3694
|
||||
Italy;Roma;301316;57563
|
||||
Luxembourg;Luxembourg;2586;424
|
||||
Netherlands;Amsterdam;41526;15654
|
||||
Portugal;Lisbon;91906;9957
|
||||
Spain;Madrid;504790;39348
|
||||
Sweden;Stockholm;410934;8839
|
||||
United Kingdom;London;243820;58862
|
||||
120
application/libraries/html2pdf/_tcpdf_5.0.002/cache/utf8test.txt
vendored
Executable file
120
application/libraries/html2pdf/_tcpdf_5.0.002/cache/utf8test.txt
vendored
Executable file
@@ -0,0 +1,120 @@
|
||||
Sentences that contain all letters commonly used in a language
|
||||
--------------------------------------------------------------
|
||||
|
||||
Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2001-09-02
|
||||
|
||||
This file is UTF-8 encoded.
|
||||
|
||||
|
||||
Danish (da)
|
||||
---------
|
||||
|
||||
Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
|
||||
Wolther spillede på xylofon.
|
||||
(= Quiz contestants were eating strawbery with cream while Wolther
|
||||
the circus clown played on xylophone.)
|
||||
|
||||
German (de)
|
||||
-----------
|
||||
|
||||
Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
|
||||
(= Wrongful practicing of xylophone music tortures every larger dwarf)
|
||||
|
||||
Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
|
||||
(= Twelve boxing fighters hunted Eva across the dike of Sylt)
|
||||
|
||||
Heizölrückstoßabdämpfung
|
||||
(= fuel oil recoil absorber)
|
||||
(jqvwxy missing, but all non-ASCII letters in one word)
|
||||
|
||||
English (en)
|
||||
------------
|
||||
|
||||
The quick brown fox jumps over the lazy dog
|
||||
|
||||
Spanish (es)
|
||||
------------
|
||||
|
||||
El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y
|
||||
frío, añoraba a su querido cachorro.
|
||||
(Contains every letter and every accent, but not every combination
|
||||
of vowel + acute.)
|
||||
|
||||
French (fr)
|
||||
-----------
|
||||
|
||||
Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à
|
||||
côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce
|
||||
qui lui permet de penser à la cænogenèse de l'être dont il est question
|
||||
dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui,
|
||||
pense-t-il, diminue çà et là la qualité de son œuvre.
|
||||
|
||||
l'île exiguë
|
||||
Où l'obèse jury mûr
|
||||
Fête l'haï volapük,
|
||||
Âne ex aéquo au whist,
|
||||
Ôtez ce vœu déçu.
|
||||
|
||||
Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en
|
||||
canoë au delà des îles, près du mälström où brûlent les novæ.
|
||||
|
||||
Irish Gaelic (ga)
|
||||
-----------------
|
||||
|
||||
D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh
|
||||
|
||||
Hungarian (hu)
|
||||
--------------
|
||||
|
||||
Árvíztűrő tükörfúrógép
|
||||
(= flood-proof mirror-drilling machine, only all non-ASCII letters)
|
||||
|
||||
Icelandic (is)
|
||||
--------------
|
||||
|
||||
Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa
|
||||
|
||||
Sævör grét áðan því úlpan var ónýt
|
||||
(some ASCII letters missing)
|
||||
|
||||
Greek (el)
|
||||
-------------
|
||||
|
||||
Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
|
||||
(= No more shall I see acacias or myrtles in the golden clearing)
|
||||
|
||||
Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
|
||||
(= I uncover the soul-destroying abhorrence)
|
||||
|
||||
Hebrew (iw)
|
||||
-----------
|
||||
|
||||
? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה
|
||||
|
||||
Polish (pl)
|
||||
-----------
|
||||
|
||||
Pchnąć w tę łódź jeża lub ośm skrzyń fig
|
||||
(= To push a hedgehog or eight bins of figs in this boat)
|
||||
|
||||
Russian (ru)
|
||||
------------
|
||||
|
||||
В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
(= Would a citrus live in the bushes of south? Yes, but only a fake one!)
|
||||
|
||||
Thai (th)
|
||||
---------
|
||||
|
||||
[--------------------------|------------------------]
|
||||
๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน
|
||||
จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร
|
||||
ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย
|
||||
ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ
|
||||
|
||||
[The copyright for the Thai example is owned by The Computer
|
||||
Association of Thailand under the Royal Patronage of His Majesty the
|
||||
King.]
|
||||
|
||||
Please let me know if you find others! Special thanks to the people
|
||||
from all over the world who contributed these sentences.
|
||||
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/bra.php
Executable file
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/bra.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : eng.php
|
||||
// Begin : 2004-03-03
|
||||
// Last Update : 2010-02-17
|
||||
//
|
||||
// Description : Language module for TCPDF
|
||||
// (contains translated texts)
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com s.r.l.
|
||||
// Via Della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* TCPDF language file (contains translated texts).
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF language file.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @link http://tcpdf.sourceforge.net
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2004-03-03
|
||||
*/
|
||||
|
||||
// ENGLISH
|
||||
|
||||
global $l;
|
||||
$l = Array();
|
||||
|
||||
// PAGE META DESCRIPTORS --------------------------------------
|
||||
|
||||
$l['a_meta_charset'] = 'UTF-8';
|
||||
$l['a_meta_dir'] = 'ltr';
|
||||
$l['a_meta_language'] = 'pt';
|
||||
|
||||
// TRANSLATIONS --------------------------------------
|
||||
$l['w_page'] = 'página';
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
?>
|
||||
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/eng.php
Executable file
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/eng.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : eng.php
|
||||
// Begin : 2004-03-03
|
||||
// Last Update : 2010-02-17
|
||||
//
|
||||
// Description : Language module for TCPDF
|
||||
// (contains translated texts)
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com s.r.l.
|
||||
// Via Della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* TCPDF language file (contains translated texts).
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF language file.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @link http://tcpdf.sourceforge.net
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2004-03-03
|
||||
*/
|
||||
|
||||
// ENGLISH
|
||||
|
||||
global $l;
|
||||
$l = Array();
|
||||
|
||||
// PAGE META DESCRIPTORS --------------------------------------
|
||||
|
||||
$l['a_meta_charset'] = 'UTF-8';
|
||||
$l['a_meta_dir'] = 'ltr';
|
||||
$l['a_meta_language'] = 'en';
|
||||
|
||||
// TRANSLATIONS --------------------------------------
|
||||
$l['w_page'] = 'page';
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
?>
|
||||
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/ger.php
Executable file
50
application/libraries/html2pdf/_tcpdf_5.0.002/config/lang/ger.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : eng.php
|
||||
// Begin : 2004-03-03
|
||||
// Last Update : 2010-02-17
|
||||
//
|
||||
// Description : Language module for TCPDF
|
||||
// (contains translated texts)
|
||||
//
|
||||
// Author: Nicola Asuni
|
||||
//
|
||||
// (c) Copyright:
|
||||
// Nicola Asuni
|
||||
// Tecnick.com s.r.l.
|
||||
// Via Della Pace, 11
|
||||
// 09044 Quartucciu (CA)
|
||||
// ITALY
|
||||
// www.tecnick.com
|
||||
// info@tecnick.com
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* TCPDF language file (contains translated texts).
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF language file.
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @link http://tcpdf.sourceforge.net
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2004-03-03
|
||||
*/
|
||||
|
||||
// ENGLISH
|
||||
|
||||
global $l;
|
||||
$l = Array();
|
||||
|
||||
// PAGE META DESCRIPTORS --------------------------------------
|
||||
|
||||
$l['a_meta_charset'] = 'UTF-8';
|
||||
$l['a_meta_dir'] = 'ltr';
|
||||
$l['a_meta_language'] = 'de';
|
||||
|
||||
// TRANSLATIONS --------------------------------------
|
||||
$l['w_page'] = 'seite';
|
||||
|
||||
//============================================================+
|
||||
// END OF FILE
|
||||
//============================================================+
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user